From c67fdb87f7f731d13050f752acf1c35e51766c05 Mon Sep 17 00:00:00 2001 From: patacongo Date: Fri, 21 Dec 2012 20:09:32 +0000 Subject: [PATCH 001/118] Patches from Petteri Aimonen (plus a few other things) git-svn-id: http://svn.code.sf.net/p/nuttx/code/trunk@5448 42af7a65-404d-4744-a932-0658087f49c3 --- NxWidgets/ChangeLog.txt | 32 + NxWidgets/Kconfig | 265 ++- NxWidgets/ReleaseNotes.txt | 2 +- NxWidgets/UnitTests/CButton/Makefile | 2 +- NxWidgets/UnitTests/CButtonArray/Makefile | 2 +- NxWidgets/UnitTests/CCheckBox/Makefile | 2 +- NxWidgets/UnitTests/CGlyphButton/Makefile | 2 +- NxWidgets/UnitTests/CImage/Makefile | 2 +- NxWidgets/UnitTests/CKeypad/Makefile | 2 +- NxWidgets/UnitTests/CLabel/Makefile | 2 +- NxWidgets/UnitTests/CLatchButton/Makefile | 2 +- .../UnitTests/CLatchButtonArray/Makefile | 2 +- NxWidgets/UnitTests/CListBox/Makefile | 2 +- NxWidgets/UnitTests/CProgressBar/Makefile | 2 +- NxWidgets/UnitTests/CRadioButton/Makefile | 2 +- .../UnitTests/CScrollbarHorizontal/Makefile | 2 +- .../UnitTests/CScrollbarVertical/Makefile | 2 +- NxWidgets/UnitTests/CSliderHorizonal/Makefile | 2 +- NxWidgets/UnitTests/CSliderVertical/Makefile | 2 +- NxWidgets/UnitTests/CTextBox/Makefile | 2 +- NxWidgets/UnitTests/nxwm/Makefile | 2 +- .../libnxwidgets/include/cgraphicsport.hxx | 34 + .../libnxwidgets/include/cscrollingpanel.hxx | 3 +- NxWidgets/libnxwidgets/src/ccyclebutton.cxx | 19 - NxWidgets/libnxwidgets/src/cgraphicsport.cxx | 110 +- NxWidgets/libnxwidgets/src/clabel.cxx | 23 +- .../libnxwidgets/src/cscrollingpanel.cxx | 40 +- apps/NxWidgets/Kconfig | 265 ++- nuttx/ChangeLog | 7 + nuttx/Documentation/NuttX.html | 2 +- nuttx/TODO | 13 +- nuttx/configs/shenzhou/nxwm/defconfig | 412 ++--- nuttx/configs/stm3220g-eval/README.txt | 15 + nuttx/configs/stm3220g-eval/nxwm/appconfig | 53 - nuttx/configs/stm3220g-eval/nxwm/defconfig | 1526 +++++++++-------- nuttx/configs/stm3220g-eval/nxwm/setenv.sh | 2 +- nuttx/drivers/input/Kconfig | 19 + nuttx/graphics/Makefile | 3 + nuttx/graphics/nxfonts/Make.defs | 6 + nuttx/graphics/nxfonts/Makefile.sources | 7 + nuttx/graphics/nxfonts/nxfonts_bitmaps.c | 2 + nuttx/graphics/nxfonts/nxfonts_getfont.c | 12 + nuttx/graphics/nxfonts/nxfonts_mono5x8.h | 815 +++++++++ nuttx/include/nuttx/nx/nxfonts.h | 6 + nuttx/include/pthread.h | 4 +- nuttx/include/stdbool.h | 4 +- nuttx/tools/bdf-converter.c | 1 + 47 files changed, 2554 insertions(+), 1184 deletions(-) delete mode 100644 nuttx/configs/stm3220g-eval/nxwm/appconfig create mode 100644 nuttx/graphics/nxfonts/nxfonts_mono5x8.h diff --git a/NxWidgets/ChangeLog.txt b/NxWidgets/ChangeLog.txt index df9fb2d418..744584ed46 100644 --- a/NxWidgets/ChangeLog.txt +++ b/NxWidgets/ChangeLog.txt @@ -220,3 +220,35 @@ classing easier (from Petteri Aimonen). 1.5 2013-xx-xx Gregory Nutt + +* NxWidgets::CGraphicsPort::move(): Fix typo bug in bounding rectangle + calculation (from Petteri Aimonen). +* NxWM::CScrollingPanel::scrollChildren(): Avoid unnecessary redraws in + CScrollingPanel (contributed by Petteri Aimonen). +* NxWM::CCycleButton: Remove the separator from CCycleButton. It draws in + wrong place, and doesnt look very good in the correct place either. + (from Petteri Aimonen). +* NxWidgets::CGraphicsPort: Many times we only want a constant background. + In that case the old code fills the background, reads it back, renders + the text and then writes it back. When used with LCD's (instead of + framebuffers) this causes unnecessary delay and screen flicker. + This commit adds a variant of drawText that takes background color, + so that the background and text can both be rendered at one go. + The old functions still function as before (Petteri Aimonen). +* NxWidgets::CLabel: The label was drawn as a single rectangular region, + then a text was added to the on top of this. The result is that the + text would flicker when the CLabel was updated. With this change, the + two step update is replaced with a five step update: The background + is updated as four rectangulear regions (leaving the previous text in + place), then the new text is updated. This eliminates the flicker + (Petteri Aimonen). +* Kconfig: Many NxWidgets/NxWM settings do not have meaningful, generic + default values. Colors, for example, depend on pixel depth. Some + geometry settings depending on other geometry settings. Font IDs are + not know-able by the configuration system. etc. In these cases, it + is best if the settings are just not undefined so that the system can + calculate a reasonable default. however, if no default is provided + in the .config file, mconf will complain and generate errors. So work + around this, I added several "enabling" settings to override the + default setting. This is awkward and I preferred the configuration as + it was before, but this avoids the mconf errors and warnings. diff --git a/NxWidgets/Kconfig b/NxWidgets/Kconfig index 59d8856bce..656399199e 100644 --- a/NxWidgets/Kconfig +++ b/NxWidgets/Kconfig @@ -13,6 +13,18 @@ config NXWIDGETS if NXWIDGETS comment "NX Server/Device Configuration" +config NXWIDGETS_FLICKERFREE + bool "Enable Flicker Reduction Logic" + default y if NX_LCDDRIVER + default n if !NX_LCDDRIVER + ---help--- + Because of their performance an in the manner in which they are + updated, LCDs may be prone to "flicker" in the displays when Widgets + are updated. Often more complex (and slower) options are availble + to reduce the flicker. Enabling this option will enabled those + lower-performance flicker-reductions measures where-ever thay may + be available. + config NXWIDGETS_DEVNO int "LCD Device Number" default 0 @@ -96,10 +108,20 @@ config NXWIDGETS_SIZEOFCHAR comment "NXWidget Default Values" +config NXWIDGETS_SYSTEM_CUSTOM_FONTID + bool "Use a Custom Default Font" + default n + ---help--- + Set to override the system default font id (NXFONT_DEFAULT). + +if NXWIDGETS_SYSTEM_CUSTOM_FONTID config NXWIDGETS_DEFAULT_FONTID int "Default Font ID" + default 0 ---help--- - Default font ID. Default: NXFONT_DEFAULT + Use this default NxWidgets font ID instead of the system font ID + (NXFONT_DEFAULT). Default: 0 +endif config NXWIDGETS_TNXARRAY_INITIALSIZE int "Initial Size of Dynamic Arrays" @@ -113,53 +135,88 @@ config NXWIDGETS_TNXARRAY_SIZEINCREMENT ---help--- Default dynamic array realloctino increment (in entries). Default: 8 +config NXWIDGETS_CUSTOM_FILLCOLORS + bool "Custom Default Fill Colors" + default n + ---help--- + Select custom default colors for the widget background. If defined, + the hexadecimal values for all filled colors must be provided + (there are no default colors because the hexadecimal representation + of the default colors depend on the pixel depth). Default: n + +if NXWIDGETS_CUSTOM_FILLCOLORS config NXWIDGETS_DEFAULT_BACKGROUNDCOLOR - hex "Normal Background Color" + hex "Default Normal Background Color" ---help--- Normal background color. Default: RGB(148,189,215) config NXWIDGETS_DEFAULT_SELECTEDBACKGROUNDCOLOR - hex "Selected Background Color" + hex "Default Selected Background Color" ---help--- Default selected background color. Default: RGB(206,227,241) +config NXWIDGETS_DEFAULT_HIGHLIGHTCOLOR + hex "Default Highlight Color" + ---help--- + Highlight color. Currently this color is only used in clist + boxes, progress bars, and slider grips. Default: RGB(192,192,192) +endif + +config NXWIDGETS_CUSTOM_EDGECOLORS + bool "Custom Default Edge Colors" + default n + ---help--- + Select custom default colors for the widget edges. If defined, + then hexadecimal values for all edge colors must be provided + (there are no default colors because the hexadecimal representation + of the default colors depend on the pixel depth). Default: n. + +if NXWIDGETS_CUSTOM_EDGECOLORS config NXWIDGETS_DEFAULT_SHINEEDGECOLOR - hex "Shiny Edge Color" + hex "Default Shiny Edge Color" ---help--- Shiny side boarder color. Default: RGB(248,248,248) config NXWIDGETS_DEFAULT_SHADOWEDGECOLOR - hex "Shadow Edge Color" + hex "Default Shadow Edge Color" ---help--- Shadowed side border color. Default: RGB(35,58,73) +endif -config NXWIDGETS_DEFAULT_HIGHLIGHTCOLOR - hex "Highlight Color" +config NXWIDGETS_CUSTOM_TEXTCOLORS + bool "Custom Default Text colors" + default n ---help--- - Highlight color. Default: RGB(192,192,192) + Select custom colors for the widget text. If defined, then + hexadecimal values for all text colors must be provided + (there are no default colors because the hexadecimal representation + of the default colors depend on the pixel depth). Default: n. +if NXWIDGETS_CUSTOM_TEXTCOLORS config NXWIDGETS_DEFAULT_DISABLEDTEXTCOLOR - hex "Disabled Text Color" + hex "Default Disabled Text Color" ---help--- Text color on a disabled widget: Default: RGB(192,192,192) config NXWIDGETS_DEFAULT_ENABLEDTEXTCOLOR - hex "Enabled Text Color" + hex "Default Enabled Text Color" ---help--- Text color on a enabled widget. Default: RGB(248,248,248) config NXWIDGETS_DEFAULT_SELECTEDTEXTCOLOR - hex "Selected Text Color" + hex "Default Selected Text Color" ---help--- Text color on a selected widget. Default: RGB(0,0,0) config NXWIDGETS_DEFAULT_FONTCOLOR - hex "Default Font Color" + hex "Default Default Font Color" ---help--- Default font color. Default: RGB(255,255,255) +endif config NXWIDGETS_TRANSPARENT_COLOR hex "Transparent Color" + default 0x0 ---help--- Transparent color. Default: RGB(0,0,0) @@ -220,10 +277,20 @@ config NXWM if NXWM comment "General settings" +config NXWM_SYSTEM_CUSTOM_FONTID + bool "Use Custom Default Font" + default n + ---help--- + Set to override the system default font id (NXFONT_DEFAULT). + +if NXWM_SYSTEM_CUSTOM_FONTID config NXWM_DEFAULT_FONTID int "Font ID" + default 0 ---help--- - The NxWM default font ID. Default: NXFONT_DEFAULT + Use this NxWM default font ID instead of the system font ID + (NXFONT_DEFAULT). Default: 0 +endif config NXWM_UNITTEST bool "NxWM Unit Test" @@ -233,6 +300,16 @@ config NXWM_UNITTEST comment "Color configuration" +config NXWM_CUSTOM_FILLCOLORS + bool "Custom Default Fill Colors" + default n + ---help--- + Select custom default colors for the widget background. If defined, + the hexadecimal values for all filled colors must be provided + (there are no default colors because the hexadecimal representation + of the default colors depend on the pixel depth). Default: n + +if NXWM_CUSTOM_FILLCOLORS config NXWM_DEFAULT_BACKGROUNDCOLOR hex "Background Color" ---help--- @@ -242,7 +319,18 @@ config NXWM_DEFAULT_SELECTEDBACKGROUNDCOLOR hex "Normal Background Color" ---help--- Select background color. Default: RGB(206,227,241) +endif +config NXWM_CUSTOM_EDGECOLORS + bool "Custom Default Edge Colors" + default n + ---help--- + Select custom default colors for the widget edges. If defined, + then hexadecimal values for all edge colors must be provided + (there are no default colors because the hexadecimal representation + of the default colors depend on the pixel depth). Default: n. + +if NXWM_CUSTOM_EDGECOLORS config NXWM_DEFAULT_SHINEEDGECOLOR hex "Shiny Edge Color" ---help--- @@ -252,7 +340,18 @@ config NXWM_DEFAULT_SHADOWEDGECOLOR hex "Shadow Edge Color" ---help--- Color of the shadowed edge of a border. Default: RGB(0,0,0) +endif +config NXWM_CUSTOM_TEXTCOLORS + bool "Custom Default Text colors" + default n + ---help--- + Select custom colors for the widget text. If defined, then + hexadecimal values for all text colors must be provided + (there are no default colors because the hexadecimal representation + of the default colors depend on the pixel depth). Default: n. + +if NXWM_CUSTOM_TEXTCOLORS config NXWM_DEFAULT_FONTCOLOR hex "Default Font Color" ---help--- @@ -260,8 +359,10 @@ config NXWM_DEFAULT_FONTCOLOR config NXWM_TRANSPARENT_COLOR hex "Transparent Color" + default 0x0 ---help--- The "transparent" color. Default: RGB(0,0,0) +endif comment "Horizontal and vertical spacing of icons in the task bar" @@ -303,27 +404,48 @@ config NXWM_TASKBAR_RIGHT endchoice +config NXWM_CUSTOM_TASKBAR_WIDTH + bool "Use Custom Taskbar width" + default n + ---help--- + Set to override the default taskbar thickness (either vertical or + horizontal). The default depends on the selected horizontal or + vertical spacing. Default: 25 + 2*spacing + +if NXWM_CUSTOM_TASKBAR_WIDTH config NXWM_TASKBAR_WIDTH int "Taskbar Width" + default 29 ---help--- - Task bar thickness (either vertical or horizontal). Default: 25 + 2*spacing + Task bar thickness (either vertical or horizontal). Default: 25 + 2*2 +endif config NXWM_DISABLE_MINIMIZE bool "Disable Minimize Button" default n ---help--- - If the "desktop" is empty, users have no need to minimize any windows. If the buttons - are small, it's easy to hit minimize button accidentally when trying to close an - application. + If the "desktop" is empty, users have no need to minimize any + windows. If the buttons are small, it's easy to hit minimize + button accidentally when trying to close an application. comment "Tool Bar Configuration" +config NXWM_CUSTOM_TOOLBAR_HEIGHT + bool "Use Custom Toolbar Height" + default n + ---help--- + Set to override the default tooldar height The default depends on + the selected horizontal or vertical spacing. Default: 21 + 2*spacing + +if NXWM_CUSTOM_TOOLBAR_HEIGHT config NXWM_TOOLBAR_HEIGHT int "Toolbar Height" + default 25 ---help--- The height of the tool bar in each application window. At present, all icons are 21 pixels in height and, hence, require a task bar of - at least that size. + at least that size. Default: 21 + 2*2 +endif comment "Background Image" @@ -357,10 +479,19 @@ config NXWM_STARTWINDOW_HSPACING ---help--- Horizontal spacing. Default: 4 rows +config NXWM_CUSTOM_STARTWINDOW_ICON + bool "Custom Start Window Icon" + default n + ---help--- + Select to override the default Start Window Icon: NxWM::g_playBitmap + +if NXWM_CUSTOM_STARTWINDOW_ICON config NXWM_STARTWINDOW_ICON string "StartWindow Icon" + default "NxWM::g_playBitmap" ---help--- The glyph to use as the start window icon. Default: NxWM::g_playBitmap +endif config NXWM_STARTWINDOW_MQNAME string "Message Queue Name" @@ -417,6 +548,16 @@ config NXWM_NXCONSOLE_STACKSIZE The stack size to use when starting the NxConsole task. Default: 2048 bytes. +config NXWM_NXCONSOLE_CUSTOM_COLORS + bool "Custom NxConsole Colors" + default n + ---help--- + Select custom default colors for the NxConsole window. If defined, + the hexadecimal values for all NxConsole colors must be provided + (there are no default colors because the hexadecimal representation + of the default colors depend on the pixel depth). Default: n + +if NXWM_NXCONSOLE_CUSTOM_COLORS config NXWM_NXCONSOLE_WCOLOR hex "NxConsole Background Color" ---help--- @@ -428,17 +569,36 @@ config NXWM_NXCONSOLE_FONTCOLOR ---help--- The color of the fonts to use in the NxConsole window. Default: RGB(0,0,0) +endif +config NXWM_NXCONSOLE_CUSTOM_FONTID + bool "Use Custom Default Font" + default n + ---help--- + Set to override the system default font id (NXWM_DEFAULT_FONTID). + +if NXWM_NXCONSOLE_CUSTOM_FONTID config NXWM_NXCONSOLE_FONTID int "NxConsole Font ID" + default 0 ---help--- - The ID of the font to use in the NxConsole window. Default: - NXWM_DEFAULT_FONTID + Use this default font ID in the NxConsole window instead of the + NxWM font ID (NXWM_DEFAULT_FONTID). Default: 0 +endif +config NXWM_CUSTOM_NXCONSOLE_ICON + bool "Custom NxConsole Icon" + default n + ---help--- + Select to override the default NxConsole Window Icon: NxWM::g_cmdBitmap + +if NXWM_CUSTOM_NXCONSOLE_ICON config NXWM_NXCONSOLE_ICON string "NxConsole Icon" + default "NxWM::g_cmdBitmap" ---help--- The glyph to use as the NxConsole icon. Default: NxWM::g_cmdBitmap +endif config NXWM_TOUCHSCREEN bool "Touchscreen Support" @@ -478,6 +638,7 @@ config NXWM_TOUCHSCREEN_LISTENERPRIO config NXWM_TOUCHSCREEN_LISTENERSTACK int "Touchscreen Listener Task Stack Size" + default 1024 ---help--- Touchscreen listener thread stack size. Default 1024 @@ -527,6 +688,17 @@ endif comment "Calibration display settings" +config NXWM_CALIBRATION_CUSTOM_COLORS + bool "Custom Calibration Colors" + default n + ---help--- + Select custom default colors for the calibration window. If + defined, the hexadecimal values for all calibration window + colors must be provided (there are no default colors because + the hexadecimal representation of the default colors depend + on the pixel depth). Default: n + +if NXWM_CALIBRATION_CUSTOM_COLORS config NXWM_CALIBRATION_BACKGROUNDCOLOR hex "Background Color" ---help--- @@ -550,12 +722,23 @@ config NXWM_CALIBRATION_TOUCHEDCOLOR ---help--- The color of the circle in the touchscreen calibration display after the touch is recorder. Default: RGB(255, 255, 96) (very light yellow) +endif +config NXWM_CUSTOM_CALIBRATION_ICON + bool "Custom Calibration Icon" + default n + ---help--- + Select to override the default Calibration Window Icon: + NxWM::g_calibrationBitmap + +if NXWM_CUSTOM_CALIBRATION_ICON config NXWM_CALIBRATION_ICON string "Callibration Icon" + default "NxWM::g_calibrationBitmap" ---help--- The ICON to use for the touchscreen calibration application. Default: NxWM::g_calibrationBitmap +endif config NXWM_CALIBRATION_SIGNO int "Calibration Signal Number" @@ -576,23 +759,55 @@ config NXWM_CALIBRATION_LISTENERSTACK ---help--- Calibration listener thread stack size. Default 2048 -comment "Calibration display settings" +comment "Hex Calculator display settings" +config NXWM_HEXCALCULATOR_CUSTOM_COLORS + bool "Custom Hex Calculator Colors" + default n + ---help--- + Select custom default colors for the Hex Calcualtor window. If + defined, the hexadecimal values for all hex calculator colors + must be provided (there are no default colors because the + hexadecimal representation of the default colors depend on the + pixel depth). Default: n + +if NXWM_HEXCALCULATOR_CUSTOM_COLORS config NXWM_HEXCALCULATOR_BACKGROUNDCOLOR hex "Calculator Background Color" ---help--- The background color of the calculator display. Default: Same as NXWM_DEFAULT_BACKGROUNDCOLOR +endif -config NXWM_HEXCALCULATOR_ICON - string "Calculator Icon" +config NXWM_CUSTOM_HEXCALCULATOR_ICON + bool "Custom Hex Calculator Icon" + default n ---help--- - The ICON to use for the hex calculator application. Default: + Select to override the default Hex Calculator Window Icon: NxWM::g_calculatorBitmap +if NXWM_CUSTOM_HEXCALCULATOR_ICON +config NXWM_HEXCALCULATOR_ICON + string "Calculator Icon" + default "NxWM::g_calculatorBitmap" + ---help--- + The ICON to use for the hex calculator application. Default: + "NxWM::g_calculatorBitmap" +endif + +config NXWM_HEXCALCULATOR_CUSTOM_FONTID + bool "Use Custom Default Font" + default n + ---help--- + Set to override the system default font id (NXWM_DEFAULT_FONTID). + +if NXWM_HEXCALCULATOR_CUSTOM_FONTID config NXWM_HEXCALCULATOR_FONTID int "Calculator Font ID" + default 0 ---help--- - The font used with the calculator. Default: NXWM_DEFAULT_FONTID + Use this default font ID in the calculator window instead of the + NxWM font ID (NXWM_DEFAULT_FONTID). Default: 0 +endif endif diff --git a/NxWidgets/ReleaseNotes.txt b/NxWidgets/ReleaseNotes.txt index 4b155c50ea..aaaefe6ebb 100644 --- a/NxWidgets/ReleaseNotes.txt +++ b/NxWidgets/ReleaseNotes.txt @@ -116,7 +116,7 @@ NxWidgets-1.4 ============= The 5th release of the NxWidgets package was made on December 20, 2012. This -release depends on NuttX-6.22 or above and should not be used with older +release depends on NuttX-6.24 or above and should not be used with older NuttX releases. This release corresponds to SVN revision r5447. Note: Nearly all changes between 1.3 and 1.4 were the result of the efforts diff --git a/NxWidgets/UnitTests/CButton/Makefile b/NxWidgets/UnitTests/CButton/Makefile index d80ef3c760..ea7b5cf25a 100644 --- a/NxWidgets/UnitTests/CButton/Makefile +++ b/NxWidgets/UnitTests/CButton/Makefile @@ -134,7 +134,7 @@ chklib: $(NXWIDGETS_LIB): # Just to keep make happy. chklib does the work. .built: chkcxx chklib $(OBJS) $(NXWIDGETS_LIB) - $(call ARCHIVE, $@, $(OBJS)) + $(call ARCHIVE, $(BIN), $(OBJS)) ifeq ($(WINTOOL),y) $(Q) $(ARCHIVER) -w -p "$(CROSSDEV)" $(BIN) $(NXWIDGETS_DIR) else diff --git a/NxWidgets/UnitTests/CButtonArray/Makefile b/NxWidgets/UnitTests/CButtonArray/Makefile index b4a3b0571d..6bb490e349 100644 --- a/NxWidgets/UnitTests/CButtonArray/Makefile +++ b/NxWidgets/UnitTests/CButtonArray/Makefile @@ -134,7 +134,7 @@ chklib: $(NXWIDGETS_LIB): # Just to keep make happy. chklib does the work. .built: chkcxx chklib $(OBJS) $(NXWIDGETS_LIB) - $(call ARCHIVE, $@, $(OBJS)) + $(call ARCHIVE, $(BIN), $(OBJS)) ifeq ($(WINTOOL),y) $(Q) $(ARCHIVER) -w -p "$(CROSSDEV)" $(BIN) $(NXWIDGETS_DIR) else diff --git a/NxWidgets/UnitTests/CCheckBox/Makefile b/NxWidgets/UnitTests/CCheckBox/Makefile index 21e007b3d8..bd8293983c 100644 --- a/NxWidgets/UnitTests/CCheckBox/Makefile +++ b/NxWidgets/UnitTests/CCheckBox/Makefile @@ -134,7 +134,7 @@ chklib: $(NXWIDGETS_LIB): # Just to keep make happy. chklib does the work. .built: chkcxx chklib $(OBJS) $(NXWIDGETS_LIB) - $(call ARCHIVE, $@, $(OBJS)) + $(call ARCHIVE, $(BIN), $(OBJS)) ifeq ($(WINTOOL),y) $(Q) $(ARCHIVER) -w -p "$(CROSSDEV)" $(BIN) $(NXWIDGETS_DIR) else diff --git a/NxWidgets/UnitTests/CGlyphButton/Makefile b/NxWidgets/UnitTests/CGlyphButton/Makefile index 1e7faf0262..b693821333 100644 --- a/NxWidgets/UnitTests/CGlyphButton/Makefile +++ b/NxWidgets/UnitTests/CGlyphButton/Makefile @@ -134,7 +134,7 @@ chklib: $(NXWIDGETS_LIB): # Just to keep make happy. chklib does the work. .built: chkcxx chklib $(OBJS) $(NXWIDGETS_LIB) - $(call ARCHIVE, $@, $(OBJS)) + $(call ARCHIVE, $(BIN), $(OBJS)) ifeq ($(WINTOOL),y) $(Q) $(ARCHIVER) -w -p "$(CROSSDEV)" $(BIN) $(NXWIDGETS_DIR) else diff --git a/NxWidgets/UnitTests/CImage/Makefile b/NxWidgets/UnitTests/CImage/Makefile index 61978147e2..08e22772f7 100644 --- a/NxWidgets/UnitTests/CImage/Makefile +++ b/NxWidgets/UnitTests/CImage/Makefile @@ -134,7 +134,7 @@ chklib: $(NXWIDGETS_LIB): # Just to keep make happy. chklib does the work. .built: chkcxx chklib $(OBJS) $(NXWIDGETS_LIB) - $(call ARCHIVE, $@, $(OBJS)) + $(call ARCHIVE, $(BIN), $(OBJS)) ifeq ($(WINTOOL),y) $(Q) $(ARCHIVER) -w -p "$(CROSSDEV)" $(BIN) $(NXWIDGETS_DIR) else diff --git a/NxWidgets/UnitTests/CKeypad/Makefile b/NxWidgets/UnitTests/CKeypad/Makefile index d27b90192e..0bbf837d8b 100644 --- a/NxWidgets/UnitTests/CKeypad/Makefile +++ b/NxWidgets/UnitTests/CKeypad/Makefile @@ -134,7 +134,7 @@ chklib: $(NXWIDGETS_LIB): # Just to keep make happy. chklib does the work. .built: chkcxx chklib $(OBJS) $(NXWIDGETS_LIB) - $(call ARCHIVE, $@, $(OBJS)) + $(call ARCHIVE, $(BIN), $(OBJS)) ifeq ($(WINTOOL),y) $(Q) $(ARCHIVER) -w -p "$(CROSSDEV)" $(BIN) $(NXWIDGETS_DIR) else diff --git a/NxWidgets/UnitTests/CLabel/Makefile b/NxWidgets/UnitTests/CLabel/Makefile index 14e8897d22..4cd3d05d8d 100644 --- a/NxWidgets/UnitTests/CLabel/Makefile +++ b/NxWidgets/UnitTests/CLabel/Makefile @@ -134,7 +134,7 @@ chklib: $(NXWIDGETS_LIB): # Just to keep make happy. chklib does the work. .built: chkcxx chklib $(OBJS) $(NXWIDGETS_LIB) - $(call ARCHIVE, $@, $(OBJS)) + $(call ARCHIVE, $(BIN), $(OBJS)) ifeq ($(WINTOOL),y) $(Q) $(ARCHIVER) -w -p "$(CROSSDEV)" $(BIN) $(NXWIDGETS_DIR) else diff --git a/NxWidgets/UnitTests/CLatchButton/Makefile b/NxWidgets/UnitTests/CLatchButton/Makefile index 435a4c3cdd..92909ab62f 100644 --- a/NxWidgets/UnitTests/CLatchButton/Makefile +++ b/NxWidgets/UnitTests/CLatchButton/Makefile @@ -134,7 +134,7 @@ chklib: $(NXWIDGETS_LIB): # Just to keep make happy. chklib does the work. .built: chkcxx chklib $(OBJS) $(NXWIDGETS_LIB) - $(call ARCHIVE, $@, $(OBJS)) + $(call ARCHIVE, $(BIN), $(OBJS)) ifeq ($(WINTOOL),y) $(Q) $(ARCHIVER) -w -p "$(CROSSDEV)" $(BIN) $(NXWIDGETS_DIR) else diff --git a/NxWidgets/UnitTests/CLatchButtonArray/Makefile b/NxWidgets/UnitTests/CLatchButtonArray/Makefile index 0f6fe639f6..412174ea2a 100644 --- a/NxWidgets/UnitTests/CLatchButtonArray/Makefile +++ b/NxWidgets/UnitTests/CLatchButtonArray/Makefile @@ -134,7 +134,7 @@ chklib: $(NXWIDGETS_LIB): # Just to keep make happy. chklib does the work. .built: chkcxx chklib $(OBJS) $(NXWIDGETS_LIB) - $(call ARCHIVE, $@, $(OBJS)) + $(call ARCHIVE, $(BIN), $(OBJS)) ifeq ($(WINTOOL),y) $(Q) $(ARCHIVER) -w -p "$(CROSSDEV)" $(BIN) $(NXWIDGETS_DIR) else diff --git a/NxWidgets/UnitTests/CListBox/Makefile b/NxWidgets/UnitTests/CListBox/Makefile index 301424c479..58d313b4f6 100644 --- a/NxWidgets/UnitTests/CListBox/Makefile +++ b/NxWidgets/UnitTests/CListBox/Makefile @@ -134,7 +134,7 @@ chklib: $(NXWIDGETS_LIB): # Just to keep make happy. chklib does the work. .built: chkcxx chklib $(OBJS) $(NXWIDGETS_LIB) - $(call ARCHIVE, $@, $(OBJS)) + $(call ARCHIVE, $(BIN), $(OBJS)) ifeq ($(WINTOOL),y) $(Q) $(ARCHIVER) -w -p "$(CROSSDEV)" $(BIN) $(NXWIDGETS_DIR) else diff --git a/NxWidgets/UnitTests/CProgressBar/Makefile b/NxWidgets/UnitTests/CProgressBar/Makefile index d50d3ed055..c57b0cf6ee 100644 --- a/NxWidgets/UnitTests/CProgressBar/Makefile +++ b/NxWidgets/UnitTests/CProgressBar/Makefile @@ -134,7 +134,7 @@ chklib: $(NXWIDGETS_LIB): # Just to keep make happy. chklib does the work. .built: chkcxx chklib $(OBJS) $(NXWIDGETS_LIB) - $(call ARCHIVE, $@, $(OBJS)) + $(call ARCHIVE, $(BIN), $(OBJS)) ifeq ($(WINTOOL),y) $(Q) $(ARCHIVER) -w -p "$(CROSSDEV)" $(BIN) $(NXWIDGETS_DIR) else diff --git a/NxWidgets/UnitTests/CRadioButton/Makefile b/NxWidgets/UnitTests/CRadioButton/Makefile index ff6c2d2472..1278c8f539 100644 --- a/NxWidgets/UnitTests/CRadioButton/Makefile +++ b/NxWidgets/UnitTests/CRadioButton/Makefile @@ -134,7 +134,7 @@ chklib: $(NXWIDGETS_LIB): # Just to keep make happy. chklib does the work. .built: chkcxx chklib $(OBJS) $(NXWIDGETS_LIB) - $(call ARCHIVE, $@, $(OBJS)) + $(call ARCHIVE, $(BIN), $(OBJS)) ifeq ($(WINTOOL),y) $(Q) $(ARCHIVER) -w -p "$(CROSSDEV)" $(BIN) $(NXWIDGETS_DIR) else diff --git a/NxWidgets/UnitTests/CScrollbarHorizontal/Makefile b/NxWidgets/UnitTests/CScrollbarHorizontal/Makefile index a5fab0dda8..c1edc89362 100644 --- a/NxWidgets/UnitTests/CScrollbarHorizontal/Makefile +++ b/NxWidgets/UnitTests/CScrollbarHorizontal/Makefile @@ -134,7 +134,7 @@ chklib: $(NXWIDGETS_LIB): # Just to keep make happy. chklib does the work. .built: chkcxx chklib $(OBJS) $(NXWIDGETS_LIB) - $(call ARCHIVE, $@, $(OBJS)) + $(call ARCHIVE, $(BIN), $(OBJS)) ifeq ($(WINTOOL),y) $(Q) $(ARCHIVER) -w -p "$(CROSSDEV)" $(BIN) $(NXWIDGETS_DIR) else diff --git a/NxWidgets/UnitTests/CScrollbarVertical/Makefile b/NxWidgets/UnitTests/CScrollbarVertical/Makefile index 204b90a52c..e3367e1674 100644 --- a/NxWidgets/UnitTests/CScrollbarVertical/Makefile +++ b/NxWidgets/UnitTests/CScrollbarVertical/Makefile @@ -134,7 +134,7 @@ chklib: $(NXWIDGETS_LIB): # Just to keep make happy. chklib does the work. .built: chkcxx chklib $(OBJS) $(NXWIDGETS_LIB) - $(call ARCHIVE, $@, $(OBJS)) + $(call ARCHIVE, $(BIN), $(OBJS)) ifeq ($(WINTOOL),y) $(Q) $(ARCHIVER) -w -p "$(CROSSDEV)" $(BIN) $(NXWIDGETS_DIR) else diff --git a/NxWidgets/UnitTests/CSliderHorizonal/Makefile b/NxWidgets/UnitTests/CSliderHorizonal/Makefile index 67f00f6220..c739fef96e 100644 --- a/NxWidgets/UnitTests/CSliderHorizonal/Makefile +++ b/NxWidgets/UnitTests/CSliderHorizonal/Makefile @@ -134,7 +134,7 @@ chklib: $(NXWIDGETS_LIB): # Just to keep make happy. chklib does the work. .built: chkcxx chklib $(OBJS) $(NXWIDGETS_LIB) - $(call ARCHIVE, $@, $(OBJS)) + $(call ARCHIVE, $(BIN), $(OBJS)) ifeq ($(WINTOOL),y) $(Q) $(ARCHIVER) -w -p "$(CROSSDEV)" $(BIN) $(NXWIDGETS_DIR) else diff --git a/NxWidgets/UnitTests/CSliderVertical/Makefile b/NxWidgets/UnitTests/CSliderVertical/Makefile index 409f361fd1..82f9c6fc6e 100644 --- a/NxWidgets/UnitTests/CSliderVertical/Makefile +++ b/NxWidgets/UnitTests/CSliderVertical/Makefile @@ -134,7 +134,7 @@ chklib: $(NXWIDGETS_LIB): # Just to keep make happy. chklib does the work. .built: chkcxx chklib $(OBJS) $(NXWIDGETS_LIB) - $(call ARCHIVE, $@, $(OBJS)) + $(call ARCHIVE, $(BIN), $(OBJS)) ifeq ($(WINTOOL),y) $(Q) $(ARCHIVER) -w -p "$(CROSSDEV)" $(BIN) $(NXWIDGETS_DIR) else diff --git a/NxWidgets/UnitTests/CTextBox/Makefile b/NxWidgets/UnitTests/CTextBox/Makefile index a4c752e6c0..ddd16e95a0 100644 --- a/NxWidgets/UnitTests/CTextBox/Makefile +++ b/NxWidgets/UnitTests/CTextBox/Makefile @@ -134,7 +134,7 @@ chklib: $(NXWIDGETS_LIB): # Just to keep make happy. chklib does the work. .built: chkcxx chklib $(OBJS) $(NXWIDGETS_LIB) - $(call ARCHIVE, $@, $(OBJS)) + $(call ARCHIVE, $(BIN), $(OBJS)) ifeq ($(WINTOOL),y) $(Q) $(ARCHIVER) -w -p "$(CROSSDEV)" $(BIN) $(NXWIDGETS_DIR) else diff --git a/NxWidgets/UnitTests/nxwm/Makefile b/NxWidgets/UnitTests/nxwm/Makefile index 338b83e548..76007da1cf 100644 --- a/NxWidgets/UnitTests/nxwm/Makefile +++ b/NxWidgets/UnitTests/nxwm/Makefile @@ -162,7 +162,7 @@ $(NXWIDGETS_LIB): # Just to keep make happy. chklibnxwidgets does the work. $(NXWM_LIB): # Just to keep make happy. chklibnxwm does the work. .built: $(OBJS) $(NXWIDGETS_LIB) - $(call ARCHIVE, $@, $(OBJS)) + $(call ARCHIVE, $(BIN), $(OBJS)) ifeq ($(WINTOOL),y) $(Q) $(ARCHIVER) -w -p "$(CROSSDEV)" $(BIN) $(NXWIDGETS_DIR) $(Q) $(ARCHIVER) -w -p "$(CROSSDEV)" $(BIN) $(NXWM_DIR) diff --git a/NxWidgets/libnxwidgets/include/cgraphicsport.hxx b/NxWidgets/libnxwidgets/include/cgraphicsport.hxx index b9fbc4d413..d3d9e61145 100644 --- a/NxWidgets/libnxwidgets/include/cgraphicsport.hxx +++ b/NxWidgets/libnxwidgets/include/cgraphicsport.hxx @@ -111,6 +111,22 @@ namespace NXWidgets nxgl_mxpixel_t m_backColor; /**< The background color to use */ #endif + /** + * The underlying implementation for drawText functions + * @param pos The window-relative x/y coordinate of the string. + * @param bound The window-relative bounds of the string. + * @param font The font to draw with. + * @param string The string to output. + * @param startIndex The start index within the string from which + * drawing will commence. + * @param length The number of characters to draw. + * @param background Color to use for background if transparent is false. + * @param transparent Whether to fill the background. + */ + void drawText(struct nxgl_point_s *pos, CRect *bound, CNxFont *font, + const CNxString &string, int startIndex, int length, + nxgl_mxpixel_t background, bool transparent); + public: /** * Constructor. @@ -329,6 +345,24 @@ namespace NXWidgets void drawText(struct nxgl_point_s *pos, CRect *bound, CNxFont *font, const CNxString &string, int startIndex, int length); + /** + * Draw a portion of a string to the window and fill the background + * in one go. + * @param pos The window-relative x/y coordinate of the string. + * @param bound The window-relative bounds of the string. + * @param font The font to draw with. + * @param string The string to output. + * @param startIndex The start index within the string from which + * drawing will commence. + * @param length The number of characters to draw. + * @param color Foreground color + * @param background Background color + */ + + void drawText(struct nxgl_point_s *pos, CRect *bound, CNxFont *font, + const CNxString &string, int startIndex, int length, + nxgl_mxpixel_t color, nxgl_mxpixel_t background); + /** * Draw an opaque bitmap to the window. * diff --git a/NxWidgets/libnxwidgets/include/cscrollingpanel.hxx b/NxWidgets/libnxwidgets/include/cscrollingpanel.hxx index 90dcc1ac9a..b27176e2f5 100644 --- a/NxWidgets/libnxwidgets/include/cscrollingpanel.hxx +++ b/NxWidgets/libnxwidgets/include/cscrollingpanel.hxx @@ -168,9 +168,10 @@ namespace NXWidgets * * @param dx The horizontal distance to scroll. * @param dy The vertical distance to scroll. + * @param do_redraw Redraw widgets after moving. */ - void scrollChildren(int32_t dx, int32_t dy); + void scrollChildren(int32_t dx, int32_t dy, bool do_redraw); /** * Destructor. diff --git a/NxWidgets/libnxwidgets/src/ccyclebutton.cxx b/NxWidgets/libnxwidgets/src/ccyclebutton.cxx index b5f96683da..0fdbba73c3 100644 --- a/NxWidgets/libnxwidgets/src/ccyclebutton.cxx +++ b/NxWidgets/libnxwidgets/src/ccyclebutton.cxx @@ -309,30 +309,21 @@ void CCycleButton::drawContents(CGraphicsPort *port) CRect rect; getRect(rect); - nxgl_coord_t glyphSpace = m_borderSize.left - 1; nxgl_coord_t glyphYOffset = (rect.getHeight() - g_cycle.height) >> 1; nxwidget_pixel_t textColor; - nxwidget_pixel_t separatorLeftColor; - nxwidget_pixel_t separatorRightColor; if (!isEnabled()) { textColor = getDisabledTextColor(); - separatorLeftColor = getShadowEdgeColor(); - separatorRightColor = getShineEdgeColor(); } else if (!isClicked()) { textColor = getEnabledTextColor(); - separatorLeftColor = getShadowEdgeColor(); - separatorRightColor = getShineEdgeColor(); } else { textColor = getSelectedTextColor(); - separatorLeftColor = getShineEdgeColor(); - separatorRightColor = getShadowEdgeColor(); } // Draw cycle glyph @@ -341,16 +332,6 @@ void CCycleButton::drawContents(CGraphicsPort *port) g_cycle.width, g_cycle.height, &g_cycle, 0, 0, CONFIG_NXWIDGETS_TRANSPARENT_COLOR); - // Draw separator - - nxgl_coord_t x = getX() + glyphSpace + g_cycle.width; - nxgl_coord_t y = getY(); - nxgl_coord_t w = glyphSpace + g_cycle.width; - nxgl_coord_t h = rect.getHeight() - 1; - - port->drawLine(x, y, w, h, separatorLeftColor); - port->drawLine(x+1, y, w+1, h, separatorRightColor); - // Only draw text if option is selected if (m_options.getSelectedItem() != NULL) diff --git a/NxWidgets/libnxwidgets/src/cgraphicsport.cxx b/NxWidgets/libnxwidgets/src/cgraphicsport.cxx index d43f3bdfac..73f2352eb3 100644 --- a/NxWidgets/libnxwidgets/src/cgraphicsport.cxx +++ b/NxWidgets/libnxwidgets/src/cgraphicsport.cxx @@ -653,6 +653,55 @@ void CGraphicsPort::drawText(struct nxgl_point_s *pos, CRect *bound, void CGraphicsPort::drawText(struct nxgl_point_s *pos, CRect *bound, CNxFont *font, const CNxString &string, int startIndex, int length) +{ + drawText(pos, bound, font, string, startIndex, length, 0, true); +} + +/** + * Draw a portion of a string to the window and fill the background + * in one go. + * @param pos The window-relative x/y coordinate of the string. + * @param bound The window-relative bounds of the string. + * @param font The font to draw with. + * @param string The string to output. + * @param startIndex The start index within the string from which + * drawing will commence. + * @param length The number of characters to draw. + * @param color Foreground color + * @param background Background color + */ + +void CGraphicsPort::drawText(struct nxgl_point_s *pos, CRect *bound, + CNxFont *font, const CNxString &string, + int startIndex, int length, + nxgl_mxpixel_t color, + nxgl_mxpixel_t background) +{ + nxgl_mxpixel_t savedColor = font->getColor(); + font->setColor(color); + + drawText(pos, bound, font, string, startIndex, length, background, false); + + font->setColor(savedColor); +} + +/** + * The underlying implementation for drawText functions + * @param pos The window-relative x/y coordinate of the string. + * @param bound The window-relative bounds of the string. + * @param font The font to draw with. + * @param string The string to output. + * @param startIndex The start index within the string from which + * drawing will commence. + * @param length The number of characters to draw. + * @param background Color to use for background if transparent is false. + * @param transparent Whether to fill the background. + */ +void CGraphicsPort::drawText(struct nxgl_point_s *pos, CRect *bound, + CNxFont *font, const CNxString &string, + int startIndex, int length, + nxgl_mxpixel_t background, + bool transparent) { // Verify index and length @@ -668,6 +717,16 @@ void CGraphicsPort::drawText(struct nxgl_point_s *pos, CRect *bound, endIndex = stringLength; } +#ifdef CONFIG_NX_WRITEONLY + if (transparent) + { + // Can't render transparently without reading memory. + + transparent = false; + background = m_backColor; + } +#endif + // Allocate a bit of memory to hold the largest rendered font unsigned int bmWidth = ((unsigned int)font->getMaxWidth() * CONFIG_NXWIDGETS_BPP + 7) >> 3; @@ -680,7 +739,7 @@ void CGraphicsPort::drawText(struct nxgl_point_s *pos, CRect *bound, struct nxgl_rect_s boundingBox; bound->getNxRect(&boundingBox); - + // Loop setup struct SBitmap bitmap; @@ -707,16 +766,12 @@ void CGraphicsPort::drawText(struct nxgl_point_s *pos, CRect *bound, // Does the letter have height? Spaces have width, but no height - if (metrics.height > 0) + if (metrics.height > 0 || !transparent) { - // Get the height of the font - - nxgl_coord_t fontHeight = (nxgl_coord_t)(metrics.height + metrics.yoffset); - // Set the current, effective size of the bitmap bitmap.width = fontWidth; - bitmap.height = fontHeight; + bitmap.height = bmHeight; bitmap.stride = (fontWidth * bitmap.bpp + 7) >> 3; // Describe the destination of the font as a bounding box @@ -725,7 +780,7 @@ void CGraphicsPort::drawText(struct nxgl_point_s *pos, CRect *bound, dest.pt1.x = pos->x; dest.pt1.y = pos->y; dest.pt2.x = pos->x + fontWidth - 1; - dest.pt2.y = pos->y + fontHeight - 1; + dest.pt2.y = pos->y + bmHeight - 1; // Get the interection of the font box and the bounding box @@ -737,25 +792,28 @@ void CGraphicsPort::drawText(struct nxgl_point_s *pos, CRect *bound, if (!nxgl_nullrect(&intersection)) { - // Initialize the bitmap memory by reading from the display. The - // font renderer always renders the fonts on a transparent background. - // Sometimes a solid background works, sometimes not. But reading - // from graphics memory always works. - -#ifdef CONFIG_NX_WRITEONLY - // Set the glyph memory to the background color - - nxwidget_pixel_t *bmPtr = (nxwidget_pixel_t *)bitmap.data; - unsigned int npixels = fontWidth * fontHeight; - for (unsigned int j = 0; j < npixels; j++) + // If we have been given a background color, use it to fill the array. + // Otherwise initialize the bitmap memory by reading from the display. + // The font renderer always renders the fonts on a transparent background. + + if (!transparent) { - *bmPtr++ = m_backColor; - } -#else - // Read the current contents of the destination into the glyph memory + // Set the glyph memory to the background color + + nxwidget_pixel_t *bmPtr = (nxwidget_pixel_t *)bitmap.data; + unsigned int npixels = fontWidth * bmHeight; + for (unsigned int j = 0; j < npixels; j++) + { + *bmPtr++ = background; + } + } + else + { + // Read the current contents of the destination into the glyph memory + + m_pNxWnd->getRectangle(&dest, &bitmap); + } - m_pNxWnd->getRectangle(&dest, &bitmap); -#endif // Render the font into the initialized bitmap font->drawChar(&bitmap, letter); @@ -827,7 +885,7 @@ void CGraphicsPort::move(nxgl_coord_t x, nxgl_coord_t y, rect.pt1.x = x; rect.pt1.y = y; rect.pt2.x = x + width - 1; - rect.pt2.y = y = height -1; + rect.pt2.y = y + height - 1; struct nxgl_point_s offset; offset.x = deltaX; diff --git a/NxWidgets/libnxwidgets/src/clabel.cxx b/NxWidgets/libnxwidgets/src/clabel.cxx index 4c7ea3554f..be4fe902de 100644 --- a/NxWidgets/libnxwidgets/src/clabel.cxx +++ b/NxWidgets/libnxwidgets/src/clabel.cxx @@ -303,8 +303,10 @@ void CLabel::drawContents(CGraphicsPort *port) // Draw the background (excluding the border) +#ifdef CONFIG_NXWIDGETS_FLICKERFREE port->drawFilledRect(rect.getX(), rect.getY(), rect.getWidth(), rect.getHeight(), backColor); +#endif // Get the X/Y position of the text within the Label @@ -312,10 +314,27 @@ void CLabel::drawContents(CGraphicsPort *port) pos.x = rect.getX() + m_align.x; pos.y = rect.getY() + m_align.y; - // Add the text using the selected color +#ifdef CONFIG_NXWIDGETS_FLICKERFREE + CNxFont* font = getFont(); + int height = font->getHeight(); + int width = font->getStringWidth(m_text); + + // Draw the background (excluding the border and the text area) + + port->drawFilledRect(rect.getX(), rect.getY(), + pos.x - rect.getX(), rect.getHeight(), backColor); // Left + port->drawFilledRect(pos.x + width, rect.getY(), + rect.getX2() - (pos.x + width) + 1, rect.getHeight(), backColor); // Right + port->drawFilledRect(pos.x, rect.getY(), + width, pos.y - rect.getY(), backColor); // Top + port->drawFilledRect(pos.x, pos.y + height, + width, rect.getY2() - (pos.y + height) + 1, backColor); // Bottom +#endif + + // Add the text using the selected color and background color port->drawText(&pos, &rect, getFont(), m_text, 0, m_text.getLength(), - textColor); + textColor, backColor); } /** diff --git a/NxWidgets/libnxwidgets/src/cscrollingpanel.cxx b/NxWidgets/libnxwidgets/src/cscrollingpanel.cxx index b7c507bb25..2541bb5721 100644 --- a/NxWidgets/libnxwidgets/src/cscrollingpanel.cxx +++ b/NxWidgets/libnxwidgets/src/cscrollingpanel.cxx @@ -215,10 +215,13 @@ void CScrollingPanel::scroll(int32_t dx, int32_t dy) m_canvasY += dy; m_canvasX += dx; + // Move children but do not redraw. + + scrollChildren(dx, dy, false); + if (revealedRects.size() > 0) { // Draw background to revealed sections - // Children will redraw themselves in moveTo. for (int i = 0; i < revealedRects.size(); ++i) { @@ -231,6 +234,18 @@ void CScrollingPanel::scroll(int32_t dx, int32_t dy) port->drawFilledRect(rrect.getX(), rrect.getY(), rrect.getWidth(), rrect.getHeight(), getBackgroundColor()); + + // Check if any children intersect this region. + // If it does, it should be redrawn. + + for (int j = 0; j < m_children.size(); ++j) + { + CRect crect = m_children[j]->getBoundingBox(); + if (crect.intersects(rrect)) + { + m_children[j]->redraw(); + } + } } } } @@ -240,12 +255,12 @@ void CScrollingPanel::scroll(int32_t dx, int32_t dy) m_canvasY += dy; m_canvasX += dx; + + // Scroll all child widgets and redraw them + + scrollChildren(dx, dy, true); } - // Scroll all child widgets - - scrollChildren(dx, dy); - // Notify event handlers m_widgetEventHandlers->raiseScrollEvent(dx, dy); @@ -332,9 +347,10 @@ void CScrollingPanel::onClick(nxgl_coord_t x, nxgl_coord_t y) * * @param dx The horizontal distance to scroll. * @param dy The vertical distance to scroll. + * @param do_redraw Redraw widgets after moving. */ -void CScrollingPanel::scrollChildren(int32_t dx, int32_t dy) +void CScrollingPanel::scrollChildren(int32_t dx, int32_t dy, bool do_redraw) { nxgl_coord_t widgetX = 0; nxgl_coord_t widgetY = 0; @@ -345,8 +361,20 @@ void CScrollingPanel::scrollChildren(int32_t dx, int32_t dy) for (int32_t i = 0; i < m_children.size(); i++) { widget = m_children[i]; + bool oldstate = widget->isDrawingEnabled(); + + if (!do_redraw) + { + widget->disableDrawing(); + } + widgetX = (widget->getX() - thisX) + dx; widgetY = (widget->getY() - thisY) + dy; widget->moveTo(widgetX, widgetY); + + if (!do_redraw && oldstate) + { + widget->enableDrawing(); + } } } diff --git a/apps/NxWidgets/Kconfig b/apps/NxWidgets/Kconfig index 59d8856bce..656399199e 100644 --- a/apps/NxWidgets/Kconfig +++ b/apps/NxWidgets/Kconfig @@ -13,6 +13,18 @@ config NXWIDGETS if NXWIDGETS comment "NX Server/Device Configuration" +config NXWIDGETS_FLICKERFREE + bool "Enable Flicker Reduction Logic" + default y if NX_LCDDRIVER + default n if !NX_LCDDRIVER + ---help--- + Because of their performance an in the manner in which they are + updated, LCDs may be prone to "flicker" in the displays when Widgets + are updated. Often more complex (and slower) options are availble + to reduce the flicker. Enabling this option will enabled those + lower-performance flicker-reductions measures where-ever thay may + be available. + config NXWIDGETS_DEVNO int "LCD Device Number" default 0 @@ -96,10 +108,20 @@ config NXWIDGETS_SIZEOFCHAR comment "NXWidget Default Values" +config NXWIDGETS_SYSTEM_CUSTOM_FONTID + bool "Use a Custom Default Font" + default n + ---help--- + Set to override the system default font id (NXFONT_DEFAULT). + +if NXWIDGETS_SYSTEM_CUSTOM_FONTID config NXWIDGETS_DEFAULT_FONTID int "Default Font ID" + default 0 ---help--- - Default font ID. Default: NXFONT_DEFAULT + Use this default NxWidgets font ID instead of the system font ID + (NXFONT_DEFAULT). Default: 0 +endif config NXWIDGETS_TNXARRAY_INITIALSIZE int "Initial Size of Dynamic Arrays" @@ -113,53 +135,88 @@ config NXWIDGETS_TNXARRAY_SIZEINCREMENT ---help--- Default dynamic array realloctino increment (in entries). Default: 8 +config NXWIDGETS_CUSTOM_FILLCOLORS + bool "Custom Default Fill Colors" + default n + ---help--- + Select custom default colors for the widget background. If defined, + the hexadecimal values for all filled colors must be provided + (there are no default colors because the hexadecimal representation + of the default colors depend on the pixel depth). Default: n + +if NXWIDGETS_CUSTOM_FILLCOLORS config NXWIDGETS_DEFAULT_BACKGROUNDCOLOR - hex "Normal Background Color" + hex "Default Normal Background Color" ---help--- Normal background color. Default: RGB(148,189,215) config NXWIDGETS_DEFAULT_SELECTEDBACKGROUNDCOLOR - hex "Selected Background Color" + hex "Default Selected Background Color" ---help--- Default selected background color. Default: RGB(206,227,241) +config NXWIDGETS_DEFAULT_HIGHLIGHTCOLOR + hex "Default Highlight Color" + ---help--- + Highlight color. Currently this color is only used in clist + boxes, progress bars, and slider grips. Default: RGB(192,192,192) +endif + +config NXWIDGETS_CUSTOM_EDGECOLORS + bool "Custom Default Edge Colors" + default n + ---help--- + Select custom default colors for the widget edges. If defined, + then hexadecimal values for all edge colors must be provided + (there are no default colors because the hexadecimal representation + of the default colors depend on the pixel depth). Default: n. + +if NXWIDGETS_CUSTOM_EDGECOLORS config NXWIDGETS_DEFAULT_SHINEEDGECOLOR - hex "Shiny Edge Color" + hex "Default Shiny Edge Color" ---help--- Shiny side boarder color. Default: RGB(248,248,248) config NXWIDGETS_DEFAULT_SHADOWEDGECOLOR - hex "Shadow Edge Color" + hex "Default Shadow Edge Color" ---help--- Shadowed side border color. Default: RGB(35,58,73) +endif -config NXWIDGETS_DEFAULT_HIGHLIGHTCOLOR - hex "Highlight Color" +config NXWIDGETS_CUSTOM_TEXTCOLORS + bool "Custom Default Text colors" + default n ---help--- - Highlight color. Default: RGB(192,192,192) + Select custom colors for the widget text. If defined, then + hexadecimal values for all text colors must be provided + (there are no default colors because the hexadecimal representation + of the default colors depend on the pixel depth). Default: n. +if NXWIDGETS_CUSTOM_TEXTCOLORS config NXWIDGETS_DEFAULT_DISABLEDTEXTCOLOR - hex "Disabled Text Color" + hex "Default Disabled Text Color" ---help--- Text color on a disabled widget: Default: RGB(192,192,192) config NXWIDGETS_DEFAULT_ENABLEDTEXTCOLOR - hex "Enabled Text Color" + hex "Default Enabled Text Color" ---help--- Text color on a enabled widget. Default: RGB(248,248,248) config NXWIDGETS_DEFAULT_SELECTEDTEXTCOLOR - hex "Selected Text Color" + hex "Default Selected Text Color" ---help--- Text color on a selected widget. Default: RGB(0,0,0) config NXWIDGETS_DEFAULT_FONTCOLOR - hex "Default Font Color" + hex "Default Default Font Color" ---help--- Default font color. Default: RGB(255,255,255) +endif config NXWIDGETS_TRANSPARENT_COLOR hex "Transparent Color" + default 0x0 ---help--- Transparent color. Default: RGB(0,0,0) @@ -220,10 +277,20 @@ config NXWM if NXWM comment "General settings" +config NXWM_SYSTEM_CUSTOM_FONTID + bool "Use Custom Default Font" + default n + ---help--- + Set to override the system default font id (NXFONT_DEFAULT). + +if NXWM_SYSTEM_CUSTOM_FONTID config NXWM_DEFAULT_FONTID int "Font ID" + default 0 ---help--- - The NxWM default font ID. Default: NXFONT_DEFAULT + Use this NxWM default font ID instead of the system font ID + (NXFONT_DEFAULT). Default: 0 +endif config NXWM_UNITTEST bool "NxWM Unit Test" @@ -233,6 +300,16 @@ config NXWM_UNITTEST comment "Color configuration" +config NXWM_CUSTOM_FILLCOLORS + bool "Custom Default Fill Colors" + default n + ---help--- + Select custom default colors for the widget background. If defined, + the hexadecimal values for all filled colors must be provided + (there are no default colors because the hexadecimal representation + of the default colors depend on the pixel depth). Default: n + +if NXWM_CUSTOM_FILLCOLORS config NXWM_DEFAULT_BACKGROUNDCOLOR hex "Background Color" ---help--- @@ -242,7 +319,18 @@ config NXWM_DEFAULT_SELECTEDBACKGROUNDCOLOR hex "Normal Background Color" ---help--- Select background color. Default: RGB(206,227,241) +endif +config NXWM_CUSTOM_EDGECOLORS + bool "Custom Default Edge Colors" + default n + ---help--- + Select custom default colors for the widget edges. If defined, + then hexadecimal values for all edge colors must be provided + (there are no default colors because the hexadecimal representation + of the default colors depend on the pixel depth). Default: n. + +if NXWM_CUSTOM_EDGECOLORS config NXWM_DEFAULT_SHINEEDGECOLOR hex "Shiny Edge Color" ---help--- @@ -252,7 +340,18 @@ config NXWM_DEFAULT_SHADOWEDGECOLOR hex "Shadow Edge Color" ---help--- Color of the shadowed edge of a border. Default: RGB(0,0,0) +endif +config NXWM_CUSTOM_TEXTCOLORS + bool "Custom Default Text colors" + default n + ---help--- + Select custom colors for the widget text. If defined, then + hexadecimal values for all text colors must be provided + (there are no default colors because the hexadecimal representation + of the default colors depend on the pixel depth). Default: n. + +if NXWM_CUSTOM_TEXTCOLORS config NXWM_DEFAULT_FONTCOLOR hex "Default Font Color" ---help--- @@ -260,8 +359,10 @@ config NXWM_DEFAULT_FONTCOLOR config NXWM_TRANSPARENT_COLOR hex "Transparent Color" + default 0x0 ---help--- The "transparent" color. Default: RGB(0,0,0) +endif comment "Horizontal and vertical spacing of icons in the task bar" @@ -303,27 +404,48 @@ config NXWM_TASKBAR_RIGHT endchoice +config NXWM_CUSTOM_TASKBAR_WIDTH + bool "Use Custom Taskbar width" + default n + ---help--- + Set to override the default taskbar thickness (either vertical or + horizontal). The default depends on the selected horizontal or + vertical spacing. Default: 25 + 2*spacing + +if NXWM_CUSTOM_TASKBAR_WIDTH config NXWM_TASKBAR_WIDTH int "Taskbar Width" + default 29 ---help--- - Task bar thickness (either vertical or horizontal). Default: 25 + 2*spacing + Task bar thickness (either vertical or horizontal). Default: 25 + 2*2 +endif config NXWM_DISABLE_MINIMIZE bool "Disable Minimize Button" default n ---help--- - If the "desktop" is empty, users have no need to minimize any windows. If the buttons - are small, it's easy to hit minimize button accidentally when trying to close an - application. + If the "desktop" is empty, users have no need to minimize any + windows. If the buttons are small, it's easy to hit minimize + button accidentally when trying to close an application. comment "Tool Bar Configuration" +config NXWM_CUSTOM_TOOLBAR_HEIGHT + bool "Use Custom Toolbar Height" + default n + ---help--- + Set to override the default tooldar height The default depends on + the selected horizontal or vertical spacing. Default: 21 + 2*spacing + +if NXWM_CUSTOM_TOOLBAR_HEIGHT config NXWM_TOOLBAR_HEIGHT int "Toolbar Height" + default 25 ---help--- The height of the tool bar in each application window. At present, all icons are 21 pixels in height and, hence, require a task bar of - at least that size. + at least that size. Default: 21 + 2*2 +endif comment "Background Image" @@ -357,10 +479,19 @@ config NXWM_STARTWINDOW_HSPACING ---help--- Horizontal spacing. Default: 4 rows +config NXWM_CUSTOM_STARTWINDOW_ICON + bool "Custom Start Window Icon" + default n + ---help--- + Select to override the default Start Window Icon: NxWM::g_playBitmap + +if NXWM_CUSTOM_STARTWINDOW_ICON config NXWM_STARTWINDOW_ICON string "StartWindow Icon" + default "NxWM::g_playBitmap" ---help--- The glyph to use as the start window icon. Default: NxWM::g_playBitmap +endif config NXWM_STARTWINDOW_MQNAME string "Message Queue Name" @@ -417,6 +548,16 @@ config NXWM_NXCONSOLE_STACKSIZE The stack size to use when starting the NxConsole task. Default: 2048 bytes. +config NXWM_NXCONSOLE_CUSTOM_COLORS + bool "Custom NxConsole Colors" + default n + ---help--- + Select custom default colors for the NxConsole window. If defined, + the hexadecimal values for all NxConsole colors must be provided + (there are no default colors because the hexadecimal representation + of the default colors depend on the pixel depth). Default: n + +if NXWM_NXCONSOLE_CUSTOM_COLORS config NXWM_NXCONSOLE_WCOLOR hex "NxConsole Background Color" ---help--- @@ -428,17 +569,36 @@ config NXWM_NXCONSOLE_FONTCOLOR ---help--- The color of the fonts to use in the NxConsole window. Default: RGB(0,0,0) +endif +config NXWM_NXCONSOLE_CUSTOM_FONTID + bool "Use Custom Default Font" + default n + ---help--- + Set to override the system default font id (NXWM_DEFAULT_FONTID). + +if NXWM_NXCONSOLE_CUSTOM_FONTID config NXWM_NXCONSOLE_FONTID int "NxConsole Font ID" + default 0 ---help--- - The ID of the font to use in the NxConsole window. Default: - NXWM_DEFAULT_FONTID + Use this default font ID in the NxConsole window instead of the + NxWM font ID (NXWM_DEFAULT_FONTID). Default: 0 +endif +config NXWM_CUSTOM_NXCONSOLE_ICON + bool "Custom NxConsole Icon" + default n + ---help--- + Select to override the default NxConsole Window Icon: NxWM::g_cmdBitmap + +if NXWM_CUSTOM_NXCONSOLE_ICON config NXWM_NXCONSOLE_ICON string "NxConsole Icon" + default "NxWM::g_cmdBitmap" ---help--- The glyph to use as the NxConsole icon. Default: NxWM::g_cmdBitmap +endif config NXWM_TOUCHSCREEN bool "Touchscreen Support" @@ -478,6 +638,7 @@ config NXWM_TOUCHSCREEN_LISTENERPRIO config NXWM_TOUCHSCREEN_LISTENERSTACK int "Touchscreen Listener Task Stack Size" + default 1024 ---help--- Touchscreen listener thread stack size. Default 1024 @@ -527,6 +688,17 @@ endif comment "Calibration display settings" +config NXWM_CALIBRATION_CUSTOM_COLORS + bool "Custom Calibration Colors" + default n + ---help--- + Select custom default colors for the calibration window. If + defined, the hexadecimal values for all calibration window + colors must be provided (there are no default colors because + the hexadecimal representation of the default colors depend + on the pixel depth). Default: n + +if NXWM_CALIBRATION_CUSTOM_COLORS config NXWM_CALIBRATION_BACKGROUNDCOLOR hex "Background Color" ---help--- @@ -550,12 +722,23 @@ config NXWM_CALIBRATION_TOUCHEDCOLOR ---help--- The color of the circle in the touchscreen calibration display after the touch is recorder. Default: RGB(255, 255, 96) (very light yellow) +endif +config NXWM_CUSTOM_CALIBRATION_ICON + bool "Custom Calibration Icon" + default n + ---help--- + Select to override the default Calibration Window Icon: + NxWM::g_calibrationBitmap + +if NXWM_CUSTOM_CALIBRATION_ICON config NXWM_CALIBRATION_ICON string "Callibration Icon" + default "NxWM::g_calibrationBitmap" ---help--- The ICON to use for the touchscreen calibration application. Default: NxWM::g_calibrationBitmap +endif config NXWM_CALIBRATION_SIGNO int "Calibration Signal Number" @@ -576,23 +759,55 @@ config NXWM_CALIBRATION_LISTENERSTACK ---help--- Calibration listener thread stack size. Default 2048 -comment "Calibration display settings" +comment "Hex Calculator display settings" +config NXWM_HEXCALCULATOR_CUSTOM_COLORS + bool "Custom Hex Calculator Colors" + default n + ---help--- + Select custom default colors for the Hex Calcualtor window. If + defined, the hexadecimal values for all hex calculator colors + must be provided (there are no default colors because the + hexadecimal representation of the default colors depend on the + pixel depth). Default: n + +if NXWM_HEXCALCULATOR_CUSTOM_COLORS config NXWM_HEXCALCULATOR_BACKGROUNDCOLOR hex "Calculator Background Color" ---help--- The background color of the calculator display. Default: Same as NXWM_DEFAULT_BACKGROUNDCOLOR +endif -config NXWM_HEXCALCULATOR_ICON - string "Calculator Icon" +config NXWM_CUSTOM_HEXCALCULATOR_ICON + bool "Custom Hex Calculator Icon" + default n ---help--- - The ICON to use for the hex calculator application. Default: + Select to override the default Hex Calculator Window Icon: NxWM::g_calculatorBitmap +if NXWM_CUSTOM_HEXCALCULATOR_ICON +config NXWM_HEXCALCULATOR_ICON + string "Calculator Icon" + default "NxWM::g_calculatorBitmap" + ---help--- + The ICON to use for the hex calculator application. Default: + "NxWM::g_calculatorBitmap" +endif + +config NXWM_HEXCALCULATOR_CUSTOM_FONTID + bool "Use Custom Default Font" + default n + ---help--- + Set to override the system default font id (NXWM_DEFAULT_FONTID). + +if NXWM_HEXCALCULATOR_CUSTOM_FONTID config NXWM_HEXCALCULATOR_FONTID int "Calculator Font ID" + default 0 ---help--- - The font used with the calculator. Default: NXWM_DEFAULT_FONTID + Use this default font ID in the calculator window instead of the + NxWM font ID (NXWM_DEFAULT_FONTID). Default: 0 +endif endif diff --git a/nuttx/ChangeLog b/nuttx/ChangeLog index ed1cf39dc6..c4a06af5e9 100644 --- a/nuttx/ChangeLog +++ b/nuttx/ChangeLog @@ -3801,3 +3801,10 @@ to find executables using a relative path. 6.25 2013-xx-xx Gregory Nutt + + * graphics/: Adds 5x8 monospace font. This tiny font is useful for graph + labels and for small bitmapped display. Contributed by Petteri + Aimonen. + * configs/stm3220g-eval/nxwm: Converted to use the kconfig-fronteds + configuration tool. + diff --git a/nuttx/Documentation/NuttX.html b/nuttx/Documentation/NuttX.html index 5d9d3af3ba..f48994babd 100644 --- a/nuttx/Documentation/NuttX.html +++ b/nuttx/Documentation/NuttX.html @@ -373,7 +373,7 @@

-

  • May be built either as an open, flat embedded RTOS or as a separtely built, secure micro-kernel with a system call interface.
  • +
  • May be built either as an open, flat embedded RTOS or as a separately built, secure micro-kernel with a system call interface.
  • diff --git a/nuttx/TODO b/nuttx/TODO index 6c28bfd434..6162431dc9 100644 --- a/nuttx/TODO +++ b/nuttx/TODO @@ -1,4 +1,4 @@ -NuttX TODO List (Last updated November 25, 2012) +NuttX TODO List (Last updated December 20, 2012) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ This file summarizes known NuttX bugs, limitations, inconsistencies with @@ -15,7 +15,7 @@ nuttx/ (6) Binary loaders (binfmt/) (17) Network (net/, drivers/net) (4) USB (drivers/usbdev, drivers/usbhost) - (11) Libraries (libc/, ) + (12) Libraries (libc/, ) (9) File system/Generic drivers (fs/, drivers/) (5) Graphics subystem (graphics/) (1) Pascal add-on (pcode/) @@ -637,6 +637,15 @@ o USB (drivers/usbdev, drivers/usbhost) o Libraries (libc/) ^^^^^^^^^^^^^^^^^ + Title: SIGNED time_t + Description: The NuttX time_t is type uint32_t. I think this is consistent + with all standards and with normal usage of time_t. However, + according to Wikipedia, time_t is usually implemented as a + signed 32-bit value. + Status: Open + Priority: Very low unless there is some compelling issue that I do not + know about. + Title: ENVIRON Description: The definition of environ in stdlib.h is bogus and will not work as it should. This is because the underlying diff --git a/nuttx/configs/shenzhou/nxwm/defconfig b/nuttx/configs/shenzhou/nxwm/defconfig index 86d17c3eed..0f100ed5e5 100644 --- a/nuttx/configs/shenzhou/nxwm/defconfig +++ b/nuttx/configs/shenzhou/nxwm/defconfig @@ -8,6 +8,14 @@ CONFIG_NUTTX_NEWCONFIG=y # Build Setup # # CONFIG_EXPERIMENTAL is not set +# CONFIG_HOST_LINUX is not set +# CONFIG_HOST_OSX is not set +CONFIG_HOST_WINDOWS=y +# CONFIG_HOST_OTHER is not set +# CONFIG_WINDOWS_NATIVE is not set +CONFIG_WINDOWS_CYGWIN=y +# CONFIG_WINDOWS_MSYS is not set +# CONFIG_WINDOWS_OTHER is not set # # Build Configuration @@ -28,6 +36,7 @@ CONFIG_INTELHEX_BINARY=y # # CONFIG_ARCH_STDBOOL_H is not set # CONFIG_ARCH_MATH_H is not set +# CONFIG_ARCH_FLOAT_H is not set # CONFIG_ARCH_STDARG_H is not set # @@ -51,6 +60,10 @@ CONFIG_ARCH_ARM=y # CONFIG_ARCH_Z16 is not set # CONFIG_ARCH_Z80 is not set CONFIG_ARCH="arm" + +# +# ARM Options +# # CONFIG_ARCH_CHIP_C5471 is not set # CONFIG_ARCH_CHIP_CALYPSO is not set # CONFIG_ARCH_CHIP_DM320 is not set @@ -68,11 +81,23 @@ CONFIG_ARCH_CHIP_STM32=y CONFIG_ARCH_CORTEXM3=y CONFIG_ARCH_FAMILY="armv7-m" CONFIG_ARCH_CHIP="stm32" +CONFIG_ARCH_HAVE_CMNVECTOR=y +# CONFIG_ARMV7M_CMNVECTOR is not set CONFIG_ARCH_HAVE_MPU=y # CONFIG_ARMV7M_MPU is not set -CONFIG_ARCH_IRQPRIO=y CONFIG_BOARD_LOOPSPERMSEC=5483 # CONFIG_ARCH_CALIBRATION is not set + +# +# ARMV7M Configuration Options +# +# CONFIG_ARMV7M_TOOLCHAIN_ATOLLIC is not set +# CONFIG_ARMV7M_TOOLCHAIN_BUILDROOT is not set +# CONFIG_ARMV7M_TOOLCHAIN_CODEREDW is not set +CONFIG_ARMV7M_TOOLCHAIN_CODESOURCERYW=y +# CONFIG_ARMV7M_TOOLCHAIN_DEVKITARM is not set +# CONFIG_ARMV7M_TOOLCHAIN_GNU_EABI is not set +# CONFIG_ARMV7M_TOOLCHAIN_RAISONANCE is not set # CONFIG_SERIAL_TERMIOS is not set # CONFIG_NET_MULTICAST is not set @@ -83,8 +108,14 @@ CONFIG_BOARD_LOOPSPERMSEC=5483 # CONFIG_ARCH_CHIP_STM32F100CB is not set # CONFIG_ARCH_CHIP_STM32F100R8 is not set # CONFIG_ARCH_CHIP_STM32F100RB is not set +# CONFIG_ARCH_CHIP_STM32F100RC is not set +# CONFIG_ARCH_CHIP_STM32F100RD is not set +# CONFIG_ARCH_CHIP_STM32F100RE is not set # CONFIG_ARCH_CHIP_STM32F100V8 is not set # CONFIG_ARCH_CHIP_STM32F100VB is not set +# CONFIG_ARCH_CHIP_STM32F100VC is not set +# CONFIG_ARCH_CHIP_STM32F100VD is not set +# CONFIG_ARCH_CHIP_STM32F100VE is not set # CONFIG_ARCH_CHIP_STM32F103RET6 is not set # CONFIG_ARCH_CHIP_STM32F103VCT6 is not set # CONFIG_ARCH_CHIP_STM32F103VET6 is not set @@ -103,13 +134,6 @@ CONFIG_ARCH_CHIP_STM32F107VC=y # CONFIG_ARCH_CHIP_STM32F407IG is not set CONFIG_STM32_STM32F10XX=y CONFIG_STM32_CONNECTIVITYLINE=y -CONFIG_STM32_CODESOURCERYW=y -# CONFIG_STM32_CODESOURCERYL is not set -# CONFIG_STM32_ATOLLIC_LITE is not set -# CONFIG_STM32_ATOLLIC_PRO is not set -# CONFIG_STM32_DEVKITARM is not set -# CONFIG_STM32_RAISONANCE is not set -# CONFIG_STM32_BUILDROOT is not set # CONFIG_STM32_DFU is not set # @@ -118,11 +142,11 @@ CONFIG_STM32_CODESOURCERYW=y # CONFIG_STM32_ADC1 is not set # CONFIG_STM32_ADC2 is not set # CONFIG_STM32_ADC3 is not set +# CONFIG_STM32_BKP is not set +# CONFIG_STM32_CAN1 is not set # CONFIG_STM32_CRC is not set # CONFIG_STM32_DMA1 is not set # CONFIG_STM32_DMA2 is not set -# CONFIG_STM32_BKP is not set -# CONFIG_STM32_CAN1 is not set # CONFIG_STM32_DAC1 is not set # CONFIG_STM32_DAC2 is not set CONFIG_STM32_ETHMAC=y @@ -153,9 +177,9 @@ CONFIG_STM32_SPI=y # # Alternate Pin Mapping # -CONFIG_STM32_USART2_REMAP=y -CONFIG_STM32_SPI3_REMAP=y CONFIG_STM32_ETH_REMAP=y +CONFIG_STM32_SPI3_REMAP=y +CONFIG_STM32_USART2_REMAP=y # CONFIG_STM32_JTAG_DISABLE is not set CONFIG_STM32_JTAG_FULL_ENABLE=y # CONFIG_STM32_JTAG_NOJNTRST_ENABLE is not set @@ -163,6 +187,11 @@ CONFIG_STM32_JTAG_FULL_ENABLE=y # CONFIG_STM32_FORCEPOWER is not set # CONFIG_ARCH_BOARD_STM32_CUSTOM_CLOCKCONFIG is not set +# +# U[S]ART Configuration +# +# CONFIG_USART2_RS485 is not set + # # SPI Configuration # @@ -173,6 +202,7 @@ CONFIG_STM32_JTAG_FULL_ENABLE=y # Ethernet MAC configuration # CONFIG_STM32_PHYADDR=0 +# CONFIG_STM32_PHYINIT is not set # CONFIG_STM32_MII is not set CONFIG_STM32_AUTONEG=y CONFIG_STM32_PHYSR=17 @@ -196,7 +226,11 @@ CONFIG_STM32_RMII_MCO=y # # CONFIG_ARCH_NOINTC is not set # CONFIG_ARCH_DMA is not set +CONFIG_ARCH_IRQPRIO=y +# CONFIG_CUSTOM_STACK is not set +# CONFIG_ADDRENV is not set CONFIG_ARCH_STACKDUMP=y +# CONFIG_ENDIAN_BIG is not set # # Board Settings @@ -218,6 +252,7 @@ CONFIG_BOOT_RUNFROMFLASH=y # # Board Selection # +# CONFIG_ARCH_BOARD_CLOUDCTRL is not set # CONFIG_ARCH_BOARD_OLIMEX_STM32P107 is not set CONFIG_ARCH_BOARD_SHENZHOU=y # CONFIG_ARCH_BOARD_CUSTOM is not set @@ -309,7 +344,6 @@ CONFIG_PREALLOC_TIMERS=4 # # Stack and heap information # -# CONFIG_CUSTOM_STACK is not set CONFIG_IDLETHREAD_STACKSIZE=1024 CONFIG_USERMAIN_STACKSIZE=1024 CONFIG_PTHREAD_STACK_MIN=256 @@ -351,6 +385,7 @@ CONFIG_LCD_MAXPOWER=1 # CONFIG_LCD_P14201 is not set # CONFIG_LCD_NOKIA6100 is not set # CONFIG_LCD_UG9664HSWAG01 is not set +# CONFIG_LCD_UG2864AMBAG01 is not set CONFIG_LCD_SSD1289=y CONFIG_SSD1289_PROFILE1=y # CONFIG_SSD1289_PROFILE2 is not set @@ -544,6 +579,16 @@ CONFIG_NX_MXCLIENTMSGS=16 CONFIG_MM_REGIONS=1 # CONFIG_GRAN is not set +# +# Binary Formats +# +# CONFIG_BINFMT_DISABLE is not set +# CONFIG_BINFMT_EXEPATH is not set +# CONFIG_NXFLAT is not set +# CONFIG_ELF is not set +# CONFIG_PIC is not set +# CONFIG_SYMTAB_ORDEREDBYNAME is not set + # # Library Routines # @@ -551,6 +596,7 @@ CONFIG_STDIO_BUFFER_SIZE=64 CONFIG_STDIO_LINEBUFFER=y CONFIG_NUNGET_CHARS=2 CONFIG_LIB_HOMEDIR="/" +# CONFIG_LIBM is not set # CONFIG_NOPRINTF_FIELDWIDTH is not set # CONFIG_LIBC_FLOATINGPOINT is not set # CONFIG_EOL_IS_CR is not set @@ -563,10 +609,20 @@ CONFIG_ARCH_LOWPUTC=y CONFIG_LIB_SENDFILE_BUFSIZE=512 # CONFIG_ARCH_ROMGETC is not set # CONFIG_ARCH_OPTIMIZED_FUNCTIONS is not set + +# +# Basic CXX Support +# +# CONFIG_C99_BOOL8 is not set CONFIG_HAVE_CXX=y CONFIG_HAVE_CXXINITIALIZE=y # CONFIG_CXX_NEWLONG is not set +# +# uClibc++ Standard C++ Library +# +# CONFIG_UCLIBCXX is not set + # # Application Configuration # @@ -579,260 +635,59 @@ CONFIG_NAMEDAPP=y # # Examples # - -# -# ADC Example -# -# CONFIG_EXAMPLES_ADC is not set - -# -# Buttons Example -# # CONFIG_EXAMPLES_BUTTONS is not set - -# -# CAN Example -# # CONFIG_EXAMPLES_CAN is not set - -# -# USB CDC/ACM Class Driver Example -# # CONFIG_EXAMPLES_CDCACM is not set - -# -# USB composite Class Driver Example -# # CONFIG_EXAMPLES_COMPOSITE is not set - -# -# DHCP Server Example -# +# CONFIG_EXAMPLES_CXXTEST is not set # CONFIG_EXAMPLES_DHCPD is not set - -# -# FTP Client Example -# +# CONFIG_EXAMPLES_ELF is not set # CONFIG_EXAMPLES_FTPC is not set - -# -# FTP Server Example -# # CONFIG_EXAMPLES_FTPD is not set - -# -# "Hello, World!" Example -# # CONFIG_EXAMPLES_HELLO is not set - -# -# "Hello, World!" C++ Example -# # CONFIG_EXAMPLES_HELLOXX is not set - -# -# USB HID Keyboard Example -# +# CONFIG_EXAMPLES_JSON is not set # CONFIG_EXAMPLES_HIDKBD is not set - -# -# IGMP Example -# +# CONFIG_EXAMPLES_KEYPADTEST is not set # CONFIG_EXAMPLES_IGMP is not set - -# -# LCD Read/Write Example -# # CONFIG_EXAMPLES_LCDRW is not set - -# -# Memory Management Example -# # CONFIG_EXAMPLES_MM is not set - -# -# File System Mount Example -# # CONFIG_EXAMPLES_MOUNT is not set - -# -# FreeModBus Example -# # CONFIG_EXAMPLES_MODBUS is not set - -# -# Network Test Example -# # CONFIG_EXAMPLES_NETTEST is not set - -# -# NuttShell (NSH) Example -# # CONFIG_EXAMPLES_NSH is not set - -# -# NULL Example -# # CONFIG_EXAMPLES_NULL is not set - -# -# NX Graphics Example -# # CONFIG_EXAMPLES_NX is not set - -# -# NxConsole Example -# # CONFIG_EXAMPLES_NXCONSOLE is not set - -# -# NXFFS File System Example -# # CONFIG_EXAMPLES_NXFFS is not set - -# -# NXFLAT Example -# # CONFIG_EXAMPLES_NXFLAT is not set - -# -# NX Graphics "Hello, World!" Example -# # CONFIG_EXAMPLES_NXHELLO is not set - -# -# NX Graphics image Example -# # CONFIG_EXAMPLES_NXIMAGE is not set - -# -# NX Graphics lines Example -# # CONFIG_EXAMPLES_NXLINES is not set - -# -# NX Graphics Text Example -# # CONFIG_EXAMPLES_NXTEXT is not set - -# -# OS Test Example -# # CONFIG_EXAMPLES_OSTEST is not set - -# -# Pascal "Hello, World!"example -# # CONFIG_EXAMPLES_PASHELLO is not set - -# -# Pipe Example -# # CONFIG_EXAMPLES_PIPE is not set - -# -# Poll Example -# # CONFIG_EXAMPLES_POLL is not set - -# -# Pulse Width Modulation (PWM) Example -# - -# -# Quadrature Encoder Example -# # CONFIG_EXAMPLES_QENCODER is not set - -# -# RGMP Example -# # CONFIG_EXAMPLES_RGMP is not set - -# -# ROMFS Example -# # CONFIG_EXAMPLES_ROMFS is not set - -# -# sendmail Example -# # CONFIG_EXAMPLES_SENDMAIL is not set - -# -# Serial Loopback Example -# # CONFIG_EXAMPLES_SERLOOP is not set - -# -# Telnet Daemon Example -# # CONFIG_EXAMPLES_TELNETD is not set - -# -# THTTPD Web Server Example -# # CONFIG_EXAMPLES_THTTPD is not set - -# -# TIFF Generation Example -# # CONFIG_EXAMPLES_TIFF is not set - -# -# Touchscreen Example -# # CONFIG_EXAMPLES_TOUCHSCREEN is not set - -# -# UDP Example -# # CONFIG_EXAMPLES_UDP is not set - -# -# UDP Discovery Daemon Example -# # CONFIG_EXAMPLES_DISCOVER is not set - -# -# uIP Web Server Example -# # CONFIG_EXAMPLES_UIP is not set - -# -# USB Serial Test Example -# # CONFIG_EXAMPLES_USBSERIAL is not set - -# -# USB Mass Storage Class Example -# # CONFIG_EXAMPLES_USBMSC is not set - -# -# USB Serial Terminal Example -# # CONFIG_EXAMPLES_USBTERM is not set - -# -# Watchdog timer Example -# # CONFIG_EXAMPLES_WATCHDOG is not set - -# -# wget Example -# # CONFIG_EXAMPLES_WGET is not set - -# -# WLAN Example -# # CONFIG_EXAMPLES_WLAN is not set -# -# XML RPC Example -# - # # Interpreters # @@ -850,76 +705,24 @@ CONFIG_NAMEDAPP=y # # Networking Utilities # - -# -# DHCP client -# +# CONFIG_NETUTILS_CODECS is not set # CONFIG_NETUTILS_DHCPC is not set - -# -# DHCP server -# # CONFIG_NETUTILS_DHCPD is not set - -# -# FTP client -# # CONFIG_NETUTILS_FTPC is not set - -# -# FTP server -# # CONFIG_NETUTILS_FTPD is not set - -# -# Name resolution -# +# CONFIG_NETUTILS_JSON is not set CONFIG_NETUTILS_RESOLV=y CONFIG_NET_RESOLV_ENTRIES=4 - -# -# SMTP -# +CONFIG_NET_RESOLV_MAXRESPONSE=96 # CONFIG_NETUTILS_SMTP is not set - -# -# TFTP client -# CONFIG_NETUTILS_TELNETD=y - -# -# TFTP client -# CONFIG_NETUTILS_TFTPC=y - -# -# THTTPD web server -# # CONFIG_NETUTILS_THTTPD is not set - -# -# uIP support library -# CONFIG_NETUTILS_UIPLIB=y - -# -# uIP web client -# CONFIG_NETUTILS_WEBCLIENT=y - -# -# uIP web server -# +CONFIG_NSH_WGET_USERAGENT="NuttX/6.xx.x (; http://www.nuttx.org/)" # CONFIG_NETUTILS_WEBSERVER is not set - -# -# UDP Discovery Utility -# # CONFIG_NETUTILS_DISCOVER is not set - -# -# XML-RPC library -# # CONFIG_NETUTILS_XMLRPC is not set # @@ -950,6 +753,7 @@ CONFIG_NSH_LIBRARY=y # CONFIG_NSH_DISABLE_FREE is not set # CONFIG_NSH_DISABLE_GET is not set # CONFIG_NSH_DISABLE_HELP is not set +# CONFIG_NSH_DISABLE_HEXDUMP is not set # CONFIG_NSH_DISABLE_IFCONFIG is not set # CONFIG_NSH_DISABLE_KILL is not set # CONFIG_NSH_DISABLE_LOSETUP is not set @@ -978,6 +782,7 @@ CONFIG_NSH_LIBRARY=y # CONFIG_NSH_DISABLE_USLEEP is not set # CONFIG_NSH_DISABLE_WGET is not set # CONFIG_NSH_DISABLE_XD is not set +CONFIG_NSH_CODECS_BUFSIZE=128 CONFIG_NSH_FILEIOSIZE=512 CONFIG_NSH_LINELEN=64 CONFIG_NSH_NESTDEPTH=3 @@ -993,10 +798,12 @@ CONFIG_NSH_TELNETD_DAEMONSTACKSIZE=1596 CONFIG_NSH_TELNETD_CLIENTPRIO=100 CONFIG_NSH_TELNETD_CLIENTSTACKSIZE=1596 CONFIG_NSH_IOBUFFER_SIZE=512 +# CONFIG_NSH_TELNET_LOGIN is not set CONFIG_NSH_IPADDR=0x0a000002 CONFIG_NSH_DRIPADDR=0x0a000001 CONFIG_NSH_NETMASK=0xffffff00 CONFIG_NSH_NOMAC=y +CONFIG_NSH_MAX_ROUNDTRIP=20 # # NxWidgets/NxWM @@ -1006,6 +813,7 @@ CONFIG_NXWIDGETS=y # # NX Server/Device Configuration # +CONFIG_NXWIDGETS_FLICKERFREE=y CONFIG_NXWIDGETS_DEVNO=0 CONFIG_NXWIDGETS_VPLANE=0 CONFIG_NXWIDGETS_SERVERPRIO=51 @@ -1025,19 +833,13 @@ CONFIG_NXWIDGETS_SIZEOFCHAR=1 # # NXWidget Default Values # -CONFIG_NXWIDGETS_DEFAULT_FONTID= +# CONFIG_NXWIDGETS_SYSTEM_CUSTOM_FONTID is not set CONFIG_NXWIDGETS_TNXARRAY_INITIALSIZE=16 CONFIG_NXWIDGETS_TNXARRAY_SIZEINCREMENT=8 -CONFIG_NXWIDGETS_DEFAULT_BACKGROUNDCOLOR= -CONFIG_NXWIDGETS_DEFAULT_SELECTEDBACKGROUNDCOLOR= -CONFIG_NXWIDGETS_DEFAULT_SHINEEDGECOLOR= -CONFIG_NXWIDGETS_DEFAULT_SHADOWEDGECOLOR= -CONFIG_NXWIDGETS_DEFAULT_HIGHLIGHTCOLOR= -CONFIG_NXWIDGETS_DEFAULT_DISABLEDTEXTCOLOR= -CONFIG_NXWIDGETS_DEFAULT_ENABLEDTEXTCOLOR= -CONFIG_NXWIDGETS_DEFAULT_SELECTEDTEXTCOLOR= -CONFIG_NXWIDGETS_DEFAULT_FONTCOLOR= -CONFIG_NXWIDGETS_TRANSPARENT_COLOR= +# CONFIG_NXWIDGETS_CUSTOM_FILLCOLORS is not set +# CONFIG_NXWIDGETS_CUSTOM_EDGECOLORS is not set +# CONFIG_NXWIDGETS_CUSTOM_TEXTCOLORS is not set +CONFIG_NXWIDGETS_TRANSPARENT_COLOR=0x0 # # Keypad behavior @@ -1053,18 +855,15 @@ CONFIG_NXWM=y # # General settings # -CONFIG_NXWM_DEFAULT_FONTID= +# CONFIG_NXWM_SYSTEM_CUSTOM_FONTID is not set CONFIG_NXWM_UNITTEST=y # # Color configuration # -CONFIG_NXWM_DEFAULT_BACKGROUNDCOLOR= -CONFIG_NXWM_DEFAULT_SELECTEDBACKGROUNDCOLOR= -CONFIG_NXWM_DEFAULT_SHINEEDGECOLOR= -CONFIG_NXWM_DEFAULT_SHADOWEDGECOLOR= -CONFIG_NXWM_DEFAULT_FONTCOLOR= -CONFIG_NXWM_TRANSPARENT_COLOR= +# CONFIG_NXWM_CUSTOM_FILLCOLORS is not set +# CONFIG_NXWM_CUSTOM_EDGECOLORS is not set +# CONFIG_NXWM_CUSTOM_TEXTCOLORS is not set # # Horizontal and vertical spacing of icons in the task bar @@ -1075,16 +874,18 @@ CONFIG_NXWM_TASKBAR_HSPACING=2 # CONFIG_NXWM_TASKBAR_BOTTOM is not set CONFIG_NXWM_TASKBAR_LEFT=y # CONFIG_NXWM_TASKBAR_RIGHT is not set -CONFIG_NXWM_TASKBAR_WIDTH= +# CONFIG_NXWM_CUSTOM_TASKBAR_WIDTH is not set +# CONFIG_NXWM_DISABLE_MINIMIZE is not set # # Tool Bar Configuration # -CONFIG_NXWM_TOOLBAR_HEIGHT= +# CONFIG_NXWM_CUSTOM_TOOLBAR_HEIGHT is not set # # Background Image # +# CONFIG_NXWM_DISABLE_BACKGROUND_IMAGE is not set CONFIG_NXWM_BACKGROUND_IMAGE="" # @@ -1096,7 +897,7 @@ CONFIG_NXWM_BACKGROUND_IMAGE="" # CONFIG_NXWM_STARTWINDOW_VSPACING=4 CONFIG_NXWM_STARTWINDOW_HSPACING=4 -CONFIG_NXWM_STARTWINDOW_ICON="" +# CONFIG_NXWM_CUSTOM_STARTWINDOW_ICON is not set CONFIG_NXWM_STARTWINDOW_MQNAME="/dev/nxwm" CONFIG_NXWM_STARTWINDOW_MXMSGS=32 CONFIG_NXWM_STARTWINDOW_MXMPRIO=42 @@ -1108,10 +909,9 @@ CONFIG_NXWM_STARTWINDOW_STACKSIZE=1596 # CONFIG_NXWM_NXCONSOLE_PRIO=50 CONFIG_NXWM_NXCONSOLE_STACKSIZE=1596 -CONFIG_NXWM_NXCONSOLE_WCOLOR= -CONFIG_NXWM_NXCONSOLE_FONTCOLOR= -CONFIG_NXWM_NXCONSOLE_FONTID= -CONFIG_NXWM_NXCONSOLE_ICON="" +# CONFIG_NXWM_NXCONSOLE_CUSTOM_COLORS is not set +# CONFIG_NXWM_NXCONSOLE_CUSTOM_FONTID is not set +# CONFIG_NXWM_CUSTOM_NXCONSOLE_ICON is not set CONFIG_NXWM_TOUCHSCREEN=y # @@ -1136,20 +936,18 @@ CONFIG_NXWM_KEYBOARD_LISTENERSTACK=1024 # # Calibration display settings # -CONFIG_NXWM_CALIBRATION_BACKGROUNDCOLOR= -CONFIG_NXWM_CALIBRATION_LINECOLOR= -CONFIG_NXWM_CALIBRATION_CIRCLECOLOR= -CONFIG_NXWM_CALIBRATION_TOUCHEDCOLOR= -CONFIG_NXWM_CALIBRATION_ICON="" +# CONFIG_NXWM_CALIBRATION_CUSTOM_COLORS is not set +# CONFIG_NXWM_CUSTOM_CALIBRATION_ICON is not set CONFIG_NXWM_CALIBRATION_SIGNO=5 CONFIG_NXWM_CALIBRATION_LISTENERPRIO=50 CONFIG_NXWM_CALIBRATION_LISTENERSTACK=1024 # -# Calibration display settings +# Hex Calculator display settings # -CONFIG_NXWM_HEXCALCULATOR_BACKGROUNDCOLOR= -CONFIG_NXWM_HEXCALCULATOR_ICON="" +# CONFIG_NXWM_HEXCALCULATOR_CUSTOM_COLORS is not set +# CONFIG_NXWM_CUSTOM_HEXCALCULATOR_ICON is not set +CONFIG_NXWM_HEXCALCULATOR_CUSTOM_FONTID=y CONFIG_NXWM_HEXCALCULATOR_FONTID=5 # diff --git a/nuttx/configs/stm3220g-eval/README.txt b/nuttx/configs/stm3220g-eval/README.txt index 8695dbb89c..e7bdd4de08 100644 --- a/nuttx/configs/stm3220g-eval/README.txt +++ b/nuttx/configs/stm3220g-eval/README.txt @@ -1077,6 +1077,21 @@ Where is one of the following: $ cd ~/nuttx-code/nuttx $ make + NOTES: + + 1. This configuration uses the mconf-based configuration tool. To + change this configuration using that tool, you should: + + a. Build and install the mconf tool. See nuttx/README.txt and + misc/tools/ + + b. Execute 'make menuconfig' in nuttx/ in order to start the + reconfiguration process. + + 2. This configuration is currently set up to build under Cygwin on + a Windows machine using the CodeSourcery Windows toolchain. + That configuration can be easy changed as described in Note 1. + ostest: ------ This configuration directory, performs a simple OS test using diff --git a/nuttx/configs/stm3220g-eval/nxwm/appconfig b/nuttx/configs/stm3220g-eval/nxwm/appconfig deleted file mode 100644 index 4ebd8137c7..0000000000 --- a/nuttx/configs/stm3220g-eval/nxwm/appconfig +++ /dev/null @@ -1,53 +0,0 @@ -############################################################################ -# configs/stm3220g-eval/nxwm/appconfig -# -# Copyright (C) 2012 Gregory Nutt. All rights reserved. -# Author: Gregory Nutt -# -# 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. -# -############################################################################ - -# The NSH Library -- NOTE: The NxWM unit test must be installed at -# apps/external in order to build this example. See -# NxWidgets/UnitTests/README.txt for additional information - -CONFIGURED_APPS += system/readline -CONFIGURED_APPS += nshlib - -# Networking libraries. - -ifeq ($(CONFIG_NET),y) -CONFIGURED_APPS += netutils/uiplib -CONFIGURED_APPS += netutils/resolv -CONFIGURED_APPS += netutils/webclient -CONFIGURED_APPS += netutils/tftpc -ifeq ($(CONFIG_NSH_TELNET),y) -CONFIGURED_APPS += netutils/telnetd -endif -endif diff --git a/nuttx/configs/stm3220g-eval/nxwm/defconfig b/nuttx/configs/stm3220g-eval/nxwm/defconfig index 065fbb1372..11e88f7640 100644 --- a/nuttx/configs/stm3220g-eval/nxwm/defconfig +++ b/nuttx/configs/stm3220g-eval/nxwm/defconfig @@ -1,371 +1,338 @@ -############################################################################ -# configs/stm3220g-eval/nxwm/defconfig # -# Copyright (C) 2012 Gregory Nutt. All rights reserved. -# Author: Gregory Nutt +# Automatically generated file; DO NOT EDIT. +# Nuttx/ Configuration # -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: +CONFIG_NUTTX_NEWCONFIG=y + # -# 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. +# Build Setup # -# 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. +# CONFIG_EXPERIMENTAL is not set +# CONFIG_HOST_LINUX is not set +# CONFIG_HOST_OSX is not set +CONFIG_HOST_WINDOWS=y +# CONFIG_HOST_OTHER is not set +# CONFIG_WINDOWS_NATIVE is not set +CONFIG_WINDOWS_CYGWIN=y +# CONFIG_WINDOWS_MSYS is not set +# CONFIG_WINDOWS_OTHER is not set + # -############################################################################ +# Build Configuration # -# Architecture Selection +# CONFIG_APPS_DIR="../apps" +# CONFIG_BUILD_2PASS is not set + # -CONFIG_ARCH="arm" +# Binary Output Formats +# +# CONFIG_RRLOAD_BINARY is not set +CONFIG_INTELHEX_BINARY=y +# CONFIG_MOTOROLA_SREC is not set +# CONFIG_RAW_BINARY is not set + +# +# Customize Header Files +# +# CONFIG_ARCH_STDBOOL_H is not set +# CONFIG_ARCH_MATH_H is not set +# CONFIG_ARCH_FLOAT_H is not set +# CONFIG_ARCH_STDARG_H is not set + +# +# Debug Options +# +# CONFIG_DEBUG is not set +# CONFIG_DEBUG_SYMBOLS is not set + +# +# System Type +# +# CONFIG_ARCH_8051 is not set CONFIG_ARCH_ARM=y +# CONFIG_ARCH_AVR is not set +# CONFIG_ARCH_HC is not set +# CONFIG_ARCH_MIPS is not set +# CONFIG_ARCH_RGMP is not set +# CONFIG_ARCH_SH is not set +# CONFIG_ARCH_SIM is not set +# CONFIG_ARCH_X86 is not set +# CONFIG_ARCH_Z16 is not set +# CONFIG_ARCH_Z80 is not set +CONFIG_ARCH="arm" + +# +# ARM Options +# +# CONFIG_ARCH_CHIP_C5471 is not set +# CONFIG_ARCH_CHIP_CALYPSO is not set +# CONFIG_ARCH_CHIP_DM320 is not set +# CONFIG_ARCH_CHIP_IMX is not set +# CONFIG_ARCH_CHIP_KINETIS is not set +# CONFIG_ARCH_CHIP_LM3S is not set +# CONFIG_ARCH_CHIP_LPC17XX is not set +# CONFIG_ARCH_CHIP_LPC214X is not set +# CONFIG_ARCH_CHIP_LPC2378 is not set +# CONFIG_ARCH_CHIP_LPC31XX is not set +# CONFIG_ARCH_CHIP_LPC43XX is not set +# CONFIG_ARCH_CHIP_SAM3U is not set +CONFIG_ARCH_CHIP_STM32=y +# CONFIG_ARCH_CHIP_STR71X is not set CONFIG_ARCH_CORTEXM3=y +CONFIG_ARCH_FAMILY="armv7-m" CONFIG_ARCH_CHIP="stm32" -CONFIG_ARCH_CHIP_STM32F207IG=y -CONFIG_ARCH_BOARD="stm3220g-eval" -CONFIG_ARCH_BOARD_STM3220G_EVAL=y +CONFIG_ARCH_HAVE_CMNVECTOR=y +# CONFIG_ARMV7M_CMNVECTOR is not set +CONFIG_ARCH_HAVE_MPU=y +# CONFIG_ARMV7M_MPU is not set CONFIG_BOARD_LOOPSPERMSEC=10926 -CONFIG_DRAM_SIZE=196608 -CONFIG_DRAM_START=0x20000000 -CONFIG_ARCH_IRQPRIO=y -CONFIG_ARCH_INTERRUPTSTACK=0 -CONFIG_ARCH_STACKDUMP=y -CONFIG_ARCH_BOOTLOADER=n -CONFIG_ARCH_LEDS=y -CONFIG_ARCH_BUTTONS=n -CONFIG_ARCH_CALIBRATION=n -CONFIG_ARCH_DMA=n +# CONFIG_ARCH_CALIBRATION is not set # -# Identify toolchain and linker options +# ARMV7M Configuration Options # -CONFIG_STM32_CODESOURCERYW=y -CONFIG_STM32_CODESOURCERYL=n -CONFIG_STM32_ATOLLIC_LITE=n -CONFIG_STM32_ATOLLIC_PRO=n -CONFIG_STM32_DEVKITARM=n -CONFIG_STM32_RAISONANCE=n -CONFIG_STM32_BUILDROOT=n +# CONFIG_ARMV7M_TOOLCHAIN_ATOLLIC is not set +# CONFIG_ARMV7M_TOOLCHAIN_BUILDROOT is not set +# CONFIG_ARMV7M_TOOLCHAIN_CODEREDW is not set +CONFIG_ARMV7M_TOOLCHAIN_CODESOURCERYW=y +# CONFIG_ARMV7M_TOOLCHAIN_DEVKITARM is not set +# CONFIG_ARMV7M_TOOLCHAIN_GNU_EABI is not set +# CONFIG_ARMV7M_TOOLCHAIN_RAISONANCE is not set +# CONFIG_SERIAL_TERMIOS is not set +# CONFIG_NET_MULTICAST is not set # -# JTAG Enable settings (by default JTAG-DP and SW-DP are disabled): +# STM32 Configuration Options # +# CONFIG_ARCH_CHIP_STM32F100C8 is not set +# CONFIG_ARCH_CHIP_STM32F100CB is not set +# CONFIG_ARCH_CHIP_STM32F100R8 is not set +# CONFIG_ARCH_CHIP_STM32F100RB is not set +# CONFIG_ARCH_CHIP_STM32F100RC is not set +# CONFIG_ARCH_CHIP_STM32F100RD is not set +# CONFIG_ARCH_CHIP_STM32F100RE is not set +# CONFIG_ARCH_CHIP_STM32F100V8 is not set +# CONFIG_ARCH_CHIP_STM32F100VB is not set +# CONFIG_ARCH_CHIP_STM32F100VC is not set +# CONFIG_ARCH_CHIP_STM32F100VD is not set +# CONFIG_ARCH_CHIP_STM32F100VE is not set +# CONFIG_ARCH_CHIP_STM32F103RET6 is not set +# CONFIG_ARCH_CHIP_STM32F103VCT6 is not set +# CONFIG_ARCH_CHIP_STM32F103VET6 is not set +# CONFIG_ARCH_CHIP_STM32F103ZET6 is not set +# CONFIG_ARCH_CHIP_STM32F105VBT7 is not set +# CONFIG_ARCH_CHIP_STM32F107VC is not set +CONFIG_ARCH_CHIP_STM32F207IG=y +# CONFIG_ARCH_CHIP_STM32F405RG is not set +# CONFIG_ARCH_CHIP_STM32F405VG is not set +# CONFIG_ARCH_CHIP_STM32F405ZG is not set +# CONFIG_ARCH_CHIP_STM32F407VE is not set +# CONFIG_ARCH_CHIP_STM32F407VG is not set +# CONFIG_ARCH_CHIP_STM32F407ZE is not set +# CONFIG_ARCH_CHIP_STM32F407ZG is not set +# CONFIG_ARCH_CHIP_STM32F407IE is not set +# CONFIG_ARCH_CHIP_STM32F407IG is not set +CONFIG_STM32_STM32F20XX=y CONFIG_STM32_DFU=y -CONFIG_STM32_JTAG_FULL_ENABLE=y -CONFIG_STM32_JTAG_NOJNTRST_ENABLE=n -CONFIG_STM32_JTAG_SW_ENABLE=n # -# On-board FSMC SRAM configuration +# STM32 Peripheral Support # -CONFIG_STM32_FSMC_SRAM=n -CONFIG_HEAP2_BASE=0x64000000 -CONFIG_HEAP2_SIZE=2097152 - -# -# Individual subsystems can be enabled: -# -# AHB1: -CONFIG_STM32_CRC=n -CONFIG_STM32_BKPSRAM=n -CONFIG_STM32_DMA1=n -CONFIG_STM32_DMA2=n +# CONFIG_STM32_ADC1 is not set +# CONFIG_STM32_ADC2 is not set +# CONFIG_STM32_ADC3 is not set +# CONFIG_STM32_BKPSRAM is not set +# CONFIG_STM32_CAN1 is not set +# CONFIG_STM32_CAN2 is not set +# CONFIG_STM32_CRC is not set +# CONFIG_STM32_CRYP is not set +# CONFIG_STM32_DMA1 is not set +# CONFIG_STM32_DMA2 is not set +# CONFIG_STM32_DAC1 is not set +# CONFIG_STM32_DAC2 is not set +# CONFIG_STM32_DCMI is not set CONFIG_STM32_ETHMAC=y -CONFIG_STM32_OTGHS=n -# AHB2: -CONFIG_STM32_DCMI=n -CONFIG_STM32_CRYP=n -CONFIG_STM32_HASH=n -CONFIG_STM32_RNG=n -CONFIG_STM32_OTGFS=n -# AHB3: CONFIG_STM32_FSMC=y -# APB1: -CONFIG_STM32_TIM2=n -CONFIG_STM32_TIM3=n -CONFIG_STM32_TIM4=n -CONFIG_STM32_TIM5=n -CONFIG_STM32_TIM6=n -CONFIG_STM32_TIM7=n -CONFIG_STM32_TIM12=n -CONFIG_STM32_TIM13=n -CONFIG_STM32_TIM14=n -CONFIG_STM32_WWDG=n -CONFIG_STM32_IWDG=n -CONFIG_STM32_SPI2=n -CONFIG_STM32_SPI3=n -CONFIG_STM32_USART2=n -CONFIG_STM32_USART3=y -CONFIG_STM32_UART4=n -CONFIG_STM32_UART5=n +# CONFIG_STM32_HASH is not set CONFIG_STM32_I2C1=y -CONFIG_STM32_I2C2=n -CONFIG_STM32_I2C3=n -CONFIG_STM32_CAN1=n -CONFIG_STM32_CAN2=n -CONFIG_STM32_DAC=n +# CONFIG_STM32_I2C2 is not set +# CONFIG_STM32_I2C3 is not set +# CONFIG_STM32_IWDG is not set +# CONFIG_STM32_OTGFS is not set +# CONFIG_STM32_OTGHS is not set CONFIG_STM32_PWR=y -# APB2: -CONFIG_STM32_TIM1=n -CONFIG_STM32_TIM8=n -CONFIG_STM32_USART1=n -CONFIG_STM32_USART6=n -CONFIG_STM32_ADC1=n -CONFIG_STM32_ADC2=n -CONFIG_STM32_ADC3=n -CONFIG_STM32_SDIO=n -CONFIG_STM32_SPI1=n +# CONFIG_STM32_RNG is not set +# CONFIG_STM32_SDIO is not set +# CONFIG_STM32_SPI1 is not set +# CONFIG_STM32_SPI2 is not set +# CONFIG_STM32_SPI3 is not set CONFIG_STM32_SYSCFG=y -CONFIG_STM32_TIM9=n -CONFIG_STM32_TIM10=n -CONFIG_STM32_TIM11=n +# CONFIG_STM32_TIM1 is not set +# CONFIG_STM32_TIM2 is not set +# CONFIG_STM32_TIM3 is not set +# CONFIG_STM32_TIM4 is not set +# CONFIG_STM32_TIM5 is not set +# CONFIG_STM32_TIM6 is not set +# CONFIG_STM32_TIM7 is not set +# CONFIG_STM32_TIM8 is not set +# CONFIG_STM32_TIM9 is not set +# CONFIG_STM32_TIM10 is not set +# CONFIG_STM32_TIM11 is not set +# CONFIG_STM32_TIM12 is not set +# CONFIG_STM32_TIM13 is not set +# CONFIG_STM32_TIM14 is not set +# CONFIG_STM32_USART1 is not set +# CONFIG_STM32_USART2 is not set +CONFIG_STM32_USART3=y +# CONFIG_STM32_UART4 is not set +# CONFIG_STM32_UART5 is not set +# CONFIG_STM32_USART6 is not set +# CONFIG_STM32_WWDG is not set +CONFIG_STM32_I2C=y # -# STM32F20xxx specific serial device driver settings +# Alternate Pin Mapping # -CONFIG_USART1_SERIAL_CONSOLE=n -CONFIG_USART2_SERIAL_CONSOLE=n -CONFIG_USART3_SERIAL_CONSOLE=y -CONFIG_UART4_SERIAL_CONSOLE=n -CONFIG_UART5_SERIAL_CONSOLE=n - -CONFIG_USART1_TXBUFSIZE=128 -CONFIG_USART2_TXBUFSIZE=128 -CONFIG_USART3_TXBUFSIZE=128 -CONFIG_UART4_TXBUFSIZE=128 -CONFIG_UART5_TXBUFSIZE=128 - -CONFIG_USART1_RXBUFSIZE=128 -CONFIG_USART2_RXBUFSIZE=128 -CONFIG_USART3_RXBUFSIZE=128 -CONFIG_UART4_RXBUFSIZE=128 -CONFIG_UART5_RXBUFSIZE=128 - -CONFIG_USART1_BAUD=115200 -CONFIG_USART2_BAUD=115200 -CONFIG_USART3_BAUD=115200 -CONFIG_UART4_BAUD=115200 -CONFIG_UART5_BAUD=115200 - -CONFIG_USART1_BITS=8 -CONFIG_USART2_BITS=8 -CONFIG_USART3_BITS=8 -CONFIG_UART4_BITS=8 -CONFIG_UART5_BITS=8 - -CONFIG_USART1_PARITY=0 -CONFIG_USART2_PARITY=0 -CONFIG_USART3_PARITY=0 -CONFIG_UART4_PARITY=0 -CONFIG_UART5_PARITY=0 - -CONFIG_USART1_2STOP=0 -CONFIG_USART2_2STOP=0 -CONFIG_USART3_2STOP=0 -CONFIG_UART4_2STOP=0 -CONFIG_UART5_2STOP=0 +# CONFIG_STM32_FLASH_PREFETCH is not set +# CONFIG_STM32_JTAG_DISABLE is not set +CONFIG_STM32_JTAG_FULL_ENABLE=y +# CONFIG_STM32_JTAG_NOJNTRST_ENABLE is not set +# CONFIG_STM32_JTAG_SW_ENABLE is not set +# CONFIG_STM32_FORCEPOWER is not set +# CONFIG_ARCH_BOARD_STM32_CUSTOM_CLOCKCONFIG is not set +# CONFIG_STM32_CCMEXCLUDE is not set +# CONFIG_STM32_FSMC_SRAM is not set # -# STM32F20xxx specific CAN device driver settings +# U[S]ART Configuration # -CONFIG_CAN=n -CONFIG_CAN_EXTID=n -#CONFIG_CAN_FIFOSIZE -#CONFIG_CAN_NPENDINGRTR -CONFIG_CAN_LOOPBACK=n -CONFIG_CAN1_BAUD=700000 -CONFIG_CAN2_BAUD=700000 +# CONFIG_USART3_RS485 is not set # -# STM32F20xxx Ethernet device driver settings +# I2C Configuration +# +# CONFIG_STM32_I2C_DYNTIMEO is not set +CONFIG_STM32_I2CTIMEOSEC=0 +CONFIG_STM32_I2CTIMEOMS=500 +CONFIG_STM32_I2CTIMEOTICKS=500 +# CONFIG_STM32_I2C_DUTY16_9 is not set +# CONFIG_SDIO_DMA is not set +# CONFIG_SDIO_WIDTH_D1_ONLY is not set + +# +# Ethernet MAC configuration # CONFIG_STM32_PHYADDR=1 +# CONFIG_STM32_PHYINIT is not set CONFIG_STM32_MII=y CONFIG_STM32_MII_MCO1=y -CONFIG_STM32_MII_MCO2=n -CONFIG_STM32_RMII=n +# CONFIG_STM32_MII_MCO2 is not set +# CONFIG_STM32_MII_EXTCLK is not set CONFIG_STM32_AUTONEG=y -#CONFIG_STM32_ETHFD -#CONFIG_STM32_ETH100MBPS CONFIG_STM32_PHYSR=16 +# CONFIG_STM32_PHYSR_ALTCONFIG is not set CONFIG_STM32_PHYSR_SPEED=0x0002 CONFIG_STM32_PHYSR_100MBPS=0x0000 CONFIG_STM32_PHYSR_MODE=0x0004 CONFIG_STM32_PHYSR_FULLDUPLEX=0x0004 -CONFIG_STM32_ETH_PTP=n -CONFIG_STM32_ETHMAC_REGDEBUG=n +# CONFIG_STM32_ETH_PTP is not set # -# I2C configuration +# USB Host Configuration # -CONFIG_I2C=y -CONFIG_I2C_POLLED=y -CONFIG_I2C_TRANSFER=y -CONFIG_I2C_TRACE=n # -# ADC configuration +# Architecture Options # -# Enable ADC driver support. The STM3220G-EVAL has a 10 Kohm potentiometer -# RV1 connected to PF9 of STM32F207IGH6 on the board: TIM14_CH1/ SMC_CD/ADC3_IN7 -# -CONFIG_ADC=n -#CONFIG_STM32_TIM1_ADC=y -CONFIG_STM32_TIM1_ADC3=y -CONFIG_STM32_ADC3_SAMPLE_FREQUENCY=100 +# CONFIG_ARCH_NOINTC is not set +# CONFIG_ARCH_DMA is not set +CONFIG_ARCH_IRQPRIO=y +# CONFIG_CUSTOM_STACK is not set +# CONFIG_ADDRENV is not set +CONFIG_ARCH_STACKDUMP=y +# CONFIG_ENDIAN_BIG is not set # -# PWM configuration +# Board Settings # -# The STM3220G-Eval has no real on-board PWM devices, but the board can be configured to output -# a pulse train using several options (see board.h). Here the default setup is for TIM8, CH4. -# Don't forget to enable CONFIG_PWM and CONFIG_STM32_TIM8. -# -CONFIG_PWM=n -CONFIG_PWM_PULSECOUNT=y -CONFIG_STM32_TIM8_PWM=y -CONFIG_STM32_TIM8_CHANNEL=4 +CONFIG_DRAM_START=0x20000000 +CONFIG_DRAM_SIZE=196608 +CONFIG_ARCH_HAVE_INTERRUPTSTACK=y +CONFIG_ARCH_INTERRUPTSTACK=0 # -# General build options +# Boot options # -CONFIG_RRLOAD_BINARY=n -CONFIG_INTELHEX_BINARY=y -CONFIG_MOTOROLA_SREC=n -CONFIG_RAW_BINARY=n +# CONFIG_BOOT_RUNFROMEXTSRAM is not set +CONFIG_BOOT_RUNFROMFLASH=y +# CONFIG_BOOT_RUNFROMISRAM is not set +# CONFIG_BOOT_RUNFROMSDRAM is not set +# CONFIG_BOOT_COPYTORAM is not set # -# General OS setup +# Board Selection # -CONFIG_USER_ENTRYPOINT="nxwm_main" -CONFIG_DEBUG=n -CONFIG_DEBUG_VERBOSE=n -CONFIG_DEBUG_SYMBOLS=n -CONFIG_DEBUG_FS=n -CONFIG_DEBUG_GRAPHICS=n -CONFIG_DEBUG_LCD=n -CONFIG_DEBUG_USB=n -CONFIG_DEBUG_NET=n -CONFIG_DEBUG_RTC=n -CONFIG_DEBUG_ANALOG=n -CONFIG_DEBUG_PWM=n -CONFIG_DEBUG_CAN=n -CONFIG_DEBUG_I2C=n -CONFIG_DEBUG_INPUT=n -CONFIG_DEBUG_DMA=n +CONFIG_ARCH_BOARD_STM3220G_EVAL=y +# CONFIG_ARCH_BOARD_CUSTOM is not set +CONFIG_ARCH_BOARD="stm3220g-eval" -CONFIG_HAVE_CXX=y -CONFIG_HAVE_CXXINITIALIZE=y -CONFIG_MM_REGIONS=1 -CONFIG_ARCH_LOWPUTC=y +# +# Common Board Options +# +CONFIG_ARCH_HAVE_LEDS=y +CONFIG_ARCH_LEDS=y +CONFIG_ARCH_HAVE_BUTTONS=y +# CONFIG_ARCH_BUTTONS is not set +CONFIG_ARCH_HAVE_IRQBUTTONS=y +CONFIG_NSH_MMCSDMINOR=0 +CONFIG_NSH_MMCSDSLOTNO=0 + +# +# Board-Specific Options +# +CONFIG_LCD_RDSHIFT=5 +CONFIG_STM3220G_LCD=y +# CONFIG_CONFIG_STM32_ILI9320_DISABLE is not set +# CONFIG_CONFIG_STM32_ILI9325_DISABLE is not set + +# +# RTOS Features +# +CONFIG_MSEC_PER_TICK=10 CONFIG_RR_INTERVAL=200 -CONFIG_SCHED_INSTRUMENTATION=n +# CONFIG_SCHED_INSTRUMENTATION is not set CONFIG_TASK_NAME_SIZE=0 +# CONFIG_JULIAN_TIME is not set CONFIG_START_YEAR=2012 CONFIG_START_MONTH=5 CONFIG_START_DAY=28 -CONFIG_GREGORIAN_TIME=n -CONFIG_JULIAN_TIME=n CONFIG_DEV_CONSOLE=y -CONFIG_DEV_LOWCONSOLE=n -CONFIG_MUTEX_TYPES=n -CONFIG_PRIORITY_INHERITANCE=n -CONFIG_SEM_PREALLOCHOLDERS=0 -CONFIG_SEM_NNESTPRIO=0 -CONFIG_FDCLONE_DISABLE=n -CONFIG_FDCLONE_STDIO=n +# CONFIG_MUTEX_TYPES is not set +# CONFIG_PRIORITY_INHERITANCE is not set +# CONFIG_FDCLONE_DISABLE is not set +# CONFIG_FDCLONE_STDIO is not set CONFIG_SDCLONE_DISABLE=y CONFIG_SCHED_WORKQUEUE=y CONFIG_SCHED_WORKPRIORITY=192 CONFIG_SCHED_WORKPERIOD=50000 CONFIG_SCHED_WORKSTACKSIZE=2048 CONFIG_SIG_SIGWORK=4 +# CONFIG_SCHED_LPWORK is not set CONFIG_SCHED_WAITPID=y -CONFIG_SCHED_ATEXIT=n +# CONFIG_SCHED_ATEXIT is not set CONFIG_SCHED_ONEXIT=y - -# -# System Logging -# - -CONFIG_SYSLOG=n -CONFIG_RAMLOG=n -CONFIG_RAMLOG_CONSOLE=n -CONFIG_RAMLOG_SYSLOG=n -#CONFIG_RAMLOG_NPOLLWAITERS -#CONFIG_RAMLOG_CONSOLE_BUFSIZE - -# -# Settings for NXFLAT -# -CONFIG_NXFLAT=n -CONFIG_NXFLAT_DUMPBUFFER=n -CONFIG_SYMTAB_ORDEREDBYNAME=y - -# -# The following can be used to disable categories of -# APIs supported by the OS. If the compiler supports -# weak functions, then it should not be necessary to -# disable functions unless you want to restrict usage -# of those APIs. -# -# There are certain dependency relationships in these -# features. -# -# o mq_notify logic depends on signals to awaken tasks -# waiting for queues to become full or empty. -# o pthread_condtimedwait() depends on signals to wake -# up waiting tasks. -# -CONFIG_DISABLE_CLOCK=n -CONFIG_DISABLE_POSIX_TIMERS=n -CONFIG_DISABLE_PTHREAD=n -CONFIG_DISABLE_SIGNALS=n -CONFIG_DISABLE_MQUEUE=n -CONFIG_DISABLE_MOUNTPOINT=n -CONFIG_DISABLE_ENVIRON=n +CONFIG_SCHED_ONEXIT_MAX=1 +CONFIG_USER_ENTRYPOINT="nxwm_main" +CONFIG_DISABLE_OS_API=y +# CONFIG_DISABLE_CLOCK is not set +# CONFIG_DISABLE_POSIX_TIMERS is not set +# CONFIG_DISABLE_PTHREAD is not set +# CONFIG_DISABLE_SIGNALS is not set +# CONFIG_DISABLE_MQUEUE is not set +# CONFIG_DISABLE_MOUNTPOINT is not set +# CONFIG_DISABLE_ENVIRON is not set CONFIG_DISABLE_POLL=y -# -# Misc libc settings -# -CONFIG_NOPRINTF_FIELDWIDTH=n - -# -# Allow for architecture optimized implementations -# -# The architecture can provide optimized versions of the -# following to improve system performance -# -CONFIG_ARCH_MEMCPY=n -CONFIG_ARCH_MEMCMP=n -CONFIG_ARCH_MEMMOVE=n -CONFIG_ARCH_MEMSET=n -CONFIG_ARCH_STRCMP=n -CONFIG_ARCH_STRCPY=n -CONFIG_ARCH_STRNCPY=n -CONFIG_ARCH_STRLEN=n -CONFIG_ARCH_STRNLEN=n -CONFIG_ARCH_BZERO=n - # # Sizes of configurable things (0 disables) # @@ -375,9 +342,6 @@ CONFIG_NPTHREAD_KEYS=4 CONFIG_NFILE_DESCRIPTORS=12 CONFIG_NFILE_STREAMS=12 CONFIG_NAME_MAX=32 -CONFIG_STDIO_BUFFER_SIZE=64 -CONFIG_STDIO_LINEBUFFER=y -CONFIG_NUNGET_CHARS=2 CONFIG_PREALLOC_MQ_MSGS=32 CONFIG_MQ_MAXMSGSIZE=48 CONFIG_MAX_WDOGPARMS=2 @@ -385,505 +349,681 @@ CONFIG_PREALLOC_WDOGS=8 CONFIG_PREALLOC_TIMERS=4 # -# Framebuffer driver options +# Stack and heap information # -CONFIG_FB_CMAP=n -CONFIG_FB_HWCURSOR=n -CONFIG_FB_HWCURSORIMAGE=n -#CONFIG_FB_HWCURSORSIZE -#CONFIG_FB_TRANSPARENCY +CONFIG_IDLETHREAD_STACKSIZE=1024 +CONFIG_USERMAIN_STACKSIZE=2048 +CONFIG_PTHREAD_STACK_MIN=256 +CONFIG_PTHREAD_STACK_DEFAULT=2048 # -# Filesystem configuration +# Device Drivers +# +CONFIG_DEV_NULL=y +# CONFIG_DEV_ZERO is not set +# CONFIG_LOOP is not set +# CONFIG_RAMDISK is not set +# CONFIG_CAN is not set +# CONFIG_PWM is not set +CONFIG_I2C=y +# CONFIG_I2C_SLAVE is not set +CONFIG_I2C_TRANSFER=y +# CONFIG_I2C_WRITEREAD is not set +CONFIG_I2C_POLLED=y +# CONFIG_I2C_TRACE is not set +CONFIG_ARCH_HAVE_I2CRESET=y +# CONFIG_I2C_RESET is not set +# CONFIG_SPI is not set +CONFIG_RTC=y +CONFIG_RTC_DATETIME=y +# CONFIG_RTC_ALARM is not set +# CONFIG_WATCHDOG is not set +# CONFIG_ANALOG is not set +# CONFIG_BCH is not set +CONFIG_INPUT=y +# CONFIG_INPUT_TSC2007 is not set +# CONFIG_INPUT_ADS7843E is not set +CONFIG_INPUT_STMPE811=y +# CONFIG_STMPE811_SPI is not set +CONFIG_STMPE811_I2C=y +CONFIG_STMPE811_ACTIVELOW=y +CONFIG_STMPE811_EDGE=y +CONFIG_STMPE811_MULTIPLE=y +# CONFIG_STMPE811_TSC_DISABLE is not set +# CONFIG_STMPE811_SWAPXY is not set +CONFIG_STMPE811_THRESHX=39 +CONFIG_STMPE811_THRESHY=51 +CONFIG_STMPE811_ADC_DISABLE=y +CONFIG_STMPE811_GPIO_DISABLE=y +CONFIG_STMPE811_TEMP_DISABLE=y +CONFIG_LCD=y +CONFIG_LCD_NOGETRUN=y +CONFIG_LCD_MAXCONTRAST=1 +CONFIG_LCD_MAXPOWER=1 +# CONFIG_LCD_P14201 is not set +# CONFIG_LCD_NOKIA6100 is not set +# CONFIG_LCD_UG9664HSWAG01 is not set +# CONFIG_LCD_UG2864AMBAG01 is not set +# CONFIG_LCD_SSD1289 is not set +CONFIG_LCD_LANDSCAPE=y +# CONFIG_LCD_PORTRAIT is not set +# CONFIG_LCD_RPORTRAIT is not set +# CONFIG_LCD_RLANDSCAPE is not set +CONFIG_MMCSD=y +CONFIG_MMCSD_NSLOTS=1 +# CONFIG_MMCSD_READONLY is not set +CONFIG_MMCSD_MULTIBLOCK_DISABLE=y +# CONFIG_MMCSD_MMCSUPPORT is not set +# CONFIG_MMCSD_HAVECARDDETECT is not set +CONFIG_MMCSD_SPI=y +CONFIG_MMCSD_SPICLOCK=12500000 +CONFIG_MMCSD_SDIO=y +# CONFIG_SDIO_MUXBUS is not set +# CONFIG_MTD is not set +# CONFIG_NETDEVICES is not set +# CONFIG_NET_SLIP is not set +# CONFIG_PIPES is not set +# CONFIG_PM is not set +# CONFIG_POWER is not set +# CONFIG_SENSORS is not set +# CONFIG_SERCOMM_CONSOLE is not set +CONFIG_SERIAL=y +# CONFIG_DEV_LOWCONSOLE is not set +# CONFIG_16550_UART is not set +CONFIG_ARCH_HAVE_USART3=y +CONFIG_MCU_SERIAL=y +CONFIG_STANDARD_SERIAL=y +CONFIG_USART3_SERIAL_CONSOLE=y +# CONFIG_NO_SERIAL_CONSOLE is not set + +# +# USART3 Configuration +# +CONFIG_USART3_RXBUFSIZE=128 +CONFIG_USART3_TXBUFSIZE=128 +CONFIG_USART3_BAUD=115200 +CONFIG_USART3_BITS=8 +CONFIG_USART3_PARITY=0 +CONFIG_USART3_2STOP=0 +# CONFIG_USBDEV is not set +# CONFIG_USBHOST is not set +# CONFIG_WIRELESS is not set + +# +# System Logging Device Options +# + +# +# System Logging +# +# CONFIG_RAMLOG is not set + +# +# Networking Support +# +CONFIG_NET=y +CONFIG_ARCH_HAVE_PHY=y +CONFIG_PHY_KS8721=y +# CONFIG_PHY_DP83848C is not set +# CONFIG_PHY_LAN8720 is not set +# CONFIG_PHY_DM9161 is not set +# CONFIG_NET_NOINTS is not set +CONFIG_NET_MULTIBUFFER=y +# CONFIG_NET_IPv6 is not set +CONFIG_NSOCKET_DESCRIPTORS=10 +CONFIG_NET_NACTIVESOCKETS=16 +CONFIG_NET_SOCKOPTS=y +CONFIG_NET_BUFSIZE=562 +# CONFIG_NET_TCPURGDATA is not set +CONFIG_NET_TCP=y +CONFIG_NET_TCP_CONNS=40 +CONFIG_NET_MAX_LISTENPORTS=40 +CONFIG_NET_TCP_READAHEAD_BUFSIZE=562 +CONFIG_NET_NTCP_READAHEAD_BUFFERS=16 +CONFIG_NET_TCP_RECVDELAY=0 +CONFIG_NET_TCPBACKLOG=y +CONFIG_NET_UDP=y +CONFIG_NET_UDP_CHECKSUMS=y +CONFIG_NET_UDP_CONNS=8 +# CONFIG_NET_BROADCAST is not set +CONFIG_NET_ICMP=y +CONFIG_NET_ICMP_PING=y +# CONFIG_NET_PINGADDRCONF is not set +# CONFIG_NET_IGMP is not set +CONFIG_NET_STATISTICS=y +CONFIG_NET_RECEIVE_WINDOW=562 +CONFIG_NET_ARPTAB_SIZE=16 +# CONFIG_NET_ARP_IPIN is not set + +# +# File Systems +# + +# +# File system configuration # CONFIG_FS_FAT=y CONFIG_FAT_LCNAMES=y CONFIG_FAT_LFN=y CONFIG_FAT_MAXFNAME=32 -CONFIG_FS_NXFFS=n -CONFIG_FS_ROMFS=n +# CONFIG_FS_FATTIME is not set +# CONFIG_FAT_DMAMEMORY is not set +# CONFIG_FS_RAMMAP is not set +# CONFIG_NFS is not set +# CONFIG_FS_NXFFS is not set +# CONFIG_FS_ROMFS is not set # -# Maintain legacy build behavior (revisit) +# System Logging # - -CONFIG_MMCSD=y -CONFIG_MMCSD_SPI=y -CONFIG_MMCSD_SDIO=y +# CONFIG_SYSLOG is not set # -# SPI-based MMC/SD driver -# -CONFIG_MMCSD_NSLOTS=1 -CONFIG_MMCSD_READONLY=n -CONFIG_MMCSD_SPICLOCK=12500000 - -# -# Block driver buffering -# -CONFIG_FS_READAHEAD=n -CONFIG_FS_WRITEBUFFER=n - -# -# STM32 SDIO-based MMC/SD driver -# -CONFIG_SDIO_DMA=n -#CONFIG_SDIO_PRI=128 -#CONFIG_SDIO_DMAPRIO -#CONFIG_SDIO_WIDTH_D1_ONLY -CONFIG_MMCSD_MULTIBLOCK_DISABLE=y -CONFIG_MMCSD_MMCSUPPORT=n -CONFIG_MMCSD_HAVECARDDETECT=n - -# -# TCP/IP and UDP support via uIP -# -CONFIG_NET=y -CONFIG_NET_NOINTS=n -CONFIG_NET_MULTIBUFFER=y -CONFIG_NET_IPv6=n -CONFIG_NSOCKET_DESCRIPTORS=10 -CONFIG_NET_SOCKOPTS=y -CONFIG_NET_BUFSIZE=562 -CONFIG_NET_TCP=y -CONFIG_NET_TCP_CONNS=40 -#CONFIG_NET_TCP_READAHEAD_BUFSIZE -CONFIG_NET_NTCP_READAHEAD_BUFFERS=16 -CONFIG_NET_TCPBACKLOG=y -CONFIG_NET_MAX_LISTENPORTS=40 -CONFIG_NET_UDP=y -CONFIG_NET_UDP_CHECKSUMS=y -#CONFIG_NET_UDP_CONNS=10 -CONFIG_NET_ICMP=y -CONFIG_NET_ICMP_PING=y -#CONFIG_NET_PINGADDRCONF=0 -CONFIG_NET_STATISTICS=y -#CONFIG_NET_RECEIVE_WINDOW= -CONFIG_NET_BROADCAST=n -#CONFIG_NET_ARPTAB_SIZE=8 -CONFIG_NET_ARP_IPIN=n -CONFIG_NET_MULTICAST=n - -# -# UIP Network Utilities -# -CONFIG_NET_DHCP_LIGHT=n -CONFIG_NET_RESOLV_ENTRIES=4 - -# -# FTP Server -# -CONFIG_FTPD_CMDBUFFERSIZE=2048 - -# -# RTC Configuration -# -CONFIG_RTC=y -CONFIG_RTC_DATETIME=y -CONFIG_RTC_HIRES=n -CONFIG_RTC_FREQUENCY=1 -CONFIG_RTC_ALARM=n - -# -# Input device configuration -# -CONFIG_INPUT=y -CONFIG_INPUT_TSC2007=n - -# -# STMPE811 input device configuration -# -# Prerequisites: CONFIG_INPUT=y -# Other settings that effect the driver: CONFIG_DISABLE_POLL -# -CONFIG_INPUT_STMPE811=y -CONFIG_STMPE811_SPI=n -CONFIG_STMPE811_I2C=y -CONFIG_STMPE811_MULTIPLE=y -CONFIG_STMPE811_ACTIVELOW=y -CONFIG_STMPE811_EDGE=y -#CONFIG_STMPE811_NPOLLWAITERS -CONFIG_STMPE811_TSC_DISABLE=n -CONFIG_STMPE811_ADC_DISABLE=y -CONFIG_STMPE811_GPIO_DISABLE=y -CONFIG_STMPE811_GPIOINT_DISABLE=y -CONFIG_STMPE811_SWAPXY=n -CONFIG_STMPE811_TEMP_DISABLE=y -CONFIG_STMPE811_REGDEBUG=n -CONFIG_STMPE811_THRESHX=39 -CONFIG_STMPE811_THRESHY=51 - -# -# STM32 USB OTG FS Device Configuration -# -CONFIG_USBDEV=n -CONFIG_USBDEV_ISOCHRONOUS=n -CONFIG_USBDEV_DUALSPEED=n -CONFIG_USBDEV_SELFPOWERED=y -CONFIG_USBDEV_REMOTEWAKEUP=n -CONFIG_USBDEV_MAXPOWER=100 -CONFIG_USBDEV_TRACE=n -CONFIG_USBDEV_TRACE_NRECORDS=128 - -# -# STM32 USB OTG FS Host Configuration -# -CONFIG_USBHOST=n -#CONFIG_STM32_OTGFS_RXFIFO_SIZE -#CONFIG_STM32_OTGFS_NPTXFIFO_SIZE -#CONFIG_STM32_OTGFS_PTXFIFO_SIZE -#CONFIG_STM32_OTGFS_DESCSIZE -CONFIG_STM32_OTGFS_SOFINTR=n -CONFIG_STM32_USBHOST_REGDEBUG=n -CONFIG_STM32_USBHOST_PKTDUMP=n - -# -# USB Serial Device Configuration -# -CONFIG_PL2303=n -CONFIG_PL2303_EPINTIN=1 -CONFIG_PL2303_EPBULKOUT=2 -CONFIG_PL2303_EPBULKIN=3 -CONFIG_PL2303_NWRREQS=4 -CONFIG_PL2303_NRDREQS=4 -CONFIG_PL2303_VENDORID=0x067b -CONFIG_PL2303_PRODUCTID=0x2303 -CONFIG_PL2303_VENDORSTR="Nuttx" -CONFIG_PL2303_PRODUCTSTR="USBdev Serial" -CONFIG_PL2303_RXBUFSIZE=512 -CONFIG_PL2303_TXBUFSIZE=512 - -# -# USB Storage Device Configuration -# -CONFIG_USBMSC=n -CONFIG_USBMSC_EP0MAXPACKET=64 -CONFIG_USBMSC_EPBULKOUT=2 -CONFIG_USBMSC_EPBULKIN=5 -CONFIG_USBMSC_NRDREQS=2 -CONFIG_USBMSC_NWRREQS=2 -CONFIG_USBMSC_BULKINREQLEN=256 -CONFIG_USBMSC_BULKOUTREQLEN=256 -CONFIG_USBMSC_VENDORID=0x584e -CONFIG_USBMSC_VENDORSTR="NuttX" -CONFIG_USBMSC_PRODUCTID=0x5342 -CONFIG_USBMSC_PRODUCTSTR="USBdev Storage" -CONFIG_USBMSC_VERSIONNO=0x0399 -CONFIG_USBMSC_REMOVABLE=y - -# -# Watchdog timer configuration -# -CONFIG_WATCHDOG=n - -# -# Graphics related configuration settings +# Graphics Support # CONFIG_NX=y -CONFIG_NX_MULTIUSER=y +CONFIG_NX_LCDDRIVER=y CONFIG_NX_NPLANES=1 +CONFIG_NX_WRITEONLY=y + +# +# Supported Pixel Depths +# CONFIG_NX_DISABLE_1BPP=y CONFIG_NX_DISABLE_2BPP=y CONFIG_NX_DISABLE_4BPP=y CONFIG_NX_DISABLE_8BPP=y -CONFIG_NX_DISABLE_16BPP=n +# CONFIG_NX_DISABLE_16BPP is not set CONFIG_NX_DISABLE_24BPP=y CONFIG_NX_DISABLE_32BPP=y -CONFIG_NX_PACKEDMSFIRST=n -CONFIG_NX_LCDDRIVER=y -CONFIG_LCD_MAXPOWER=1 -CONFIG_LCD_MAXCONTRAST=1 +# CONFIG_NX_PACKEDMSFIRST is not set + +# +# Input Devices +# CONFIG_NX_MOUSE=y CONFIG_NX_KBD=y -#CONFIG_NXTK_BORDERWIDTH=4 + +# +# Framed Window Borders +# +CONFIG_NXTK_BORDERWIDTH=4 CONFIG_NXTK_BORDERCOLOR1=0x5cb7 CONFIG_NXTK_BORDERCOLOR2=0x21c9 CONFIG_NXTK_BORDERCOLOR3=0xffdf -CONFIG_NXTK_AUTORAISE=n -CONFIG_NXFONT_SANS17X22=n -CONFIG_NXFONT_SANS20X26=n -CONFIG_NXFONT_SANS22X29=n -CONFIG_NXFONT_SANS23X27=y -CONFIG_NXFONT_SANS28X37=n -CONFIG_NXFONT_SANS17X23B=n -CONFIG_NXFONT_SANS20X27B=n -CONFIG_NXFONT_SANS22X29B=y -CONFIG_NXFONT_SANS28X37B=n -CONFIG_NXFONT_SANS40X49B=n -CONFIG_NXFONT_SERIF22X29=n -CONFIG_NXFONT_SERIF29X37=n -CONFIG_NXFONT_SERIF38X48=n -CONFIG_NXFONT_SERIF22X28B=n -CONFIG_NXFONT_SERIF27X38B=n -CONFIG_NXFONT_SERIF38X49B=n +# CONFIG_NXTK_AUTORAISE is not set + +# +# Font Selections +# CONFIG_NXFONTS_CHARBITS=7 +# CONFIG_NXFONT_SANS17X22 is not set +# CONFIG_NXFONT_SANS20X26 is not set +CONFIG_NXFONT_SANS23X27=y +# CONFIG_NXFONT_SANS22X29 is not set +# CONFIG_NXFONT_SANS28X37 is not set +# CONFIG_NXFONT_SANS39X48 is not set +# CONFIG_NXFONT_SANS17X23B is not set +# CONFIG_NXFONT_SANS20X27B is not set +CONFIG_NXFONT_SANS22X29B=y +# CONFIG_NXFONT_SANS28X37B is not set +# CONFIG_NXFONT_SANS40X49B is not set +# CONFIG_NXFONT_SERIF22X29 is not set +# CONFIG_NXFONT_SERIF29X37 is not set +# CONFIG_NXFONT_SERIF38X48 is not set +# CONFIG_NXFONT_SERIF22X28B is not set +# CONFIG_NXFONT_SERIF27X38B is not set +# CONFIG_NXFONT_SERIF38X49B is not set +CONFIG_NXCONSOLE=y + +# +# NxConsole Output Text/Graphics Options +# +CONFIG_NXCONSOLE_BPP=16 +CONFIG_NXCONSOLE_CURSORCHAR=137 +CONFIG_NXCONSOLE_MXCHARS=325 +CONFIG_NXCONSOLE_CACHESIZE=32 +CONFIG_NXCONSOLE_LINESEPARATION=0 +# CONFIG_NXCONSOLE_NOWRAP is not set + +# +# NxConsole Input options +# +CONFIG_NXCONSOLE_NXKBDIN=y +CONFIG_NXCONSOLE_KBDBUFSIZE=16 +CONFIG_NXCONSOLE_NPOLLWAITERS=4 + +# +# NX Multi-user only options +# +CONFIG_NX_MULTIUSER=y CONFIG_NX_BLOCKING=y CONFIG_NX_MXSERVERMSGS=32 CONFIG_NX_MXCLIENTMSGS=16 # -# NxWidgets / NxWM +# Memory Management # -# Use all defaults except -# 1. 16 bits-per-pixel -# 2. Make the NxWidgets background color match the NxWM back color -# 3. Build in support for keyboard input in NxConsole -# 4. Taskbar on the left -# 5. We do have a touchscreen -# 6. We do want the NxWM keybard listener -# 7. Use a larger font with the calculator -# -CONFIG_NXWIDGETS_BPP=16 -CONFIG_NXWIDGETS_SERVERSTACK=2048 -CONFIG_NXWIDGETS_LISTENERSTACK=2048 -CONFIG_NXWIDGETS_DEFAULT_BACKGROUNDCOLOR=MKRGB(148,189,215) -CONFIG_NXWIDGETS_DEFAULT_SELECTEDBACKGROUNDCOLOR=MKRGB(206,227,241) -CONFIG_NXWIDGETS_DEFAULT_SHADOWEDGECOLOR=MKRGB(35,58,73) - -CONFIG_NXCONSOLE_NXKBDIN=y - -CONFIG_NXWM_TASKBAR_LEFT=y -CONFIG_NXWM_NXCONSOLE_STACKSIZE=2048 -CONFIG_NXWM_TASKBAR_VSPACING=4 -CONFIG_NXWM_UNITTEST=y -CONFIG_NXWM_TOUCHSCREEN=y -CONFIG_NXWM_KEYBOARD=y -CONFIG_NXWM_HEXCALCULATOR_FONTID=5 +# CONFIG_MM_SMALL is not set +CONFIG_MM_REGIONS=1 +# CONFIG_GRAN is not set # -# NxConsole Configuration Settings: +# Binary Formats # -CONFIG_NXCONSOLE=y -CONFIG_NXCONSOLE_BPP=16 -CONFIG_NXCONSOLE_MXCHARS=325 -CONFIG_NXCONSOLE_CACHESIZE=32 +# CONFIG_BINFMT_DISABLE is not set +# CONFIG_BINFMT_EXEPATH is not set +# CONFIG_NXFLAT is not set +# CONFIG_ELF is not set +# CONFIG_PIC is not set +CONFIG_SYMTAB_ORDEREDBYNAME=y + +# +# Library Routines +# +CONFIG_STDIO_BUFFER_SIZE=64 +CONFIG_STDIO_LINEBUFFER=y +CONFIG_NUNGET_CHARS=2 +CONFIG_LIB_HOMEDIR="/" +# CONFIG_LIBM is not set +# CONFIG_NOPRINTF_FIELDWIDTH is not set +# CONFIG_LIBC_FLOATINGPOINT is not set +# CONFIG_EOL_IS_CR is not set +# CONFIG_EOL_IS_LF is not set +# CONFIG_EOL_IS_BOTH_CRLF is not set +CONFIG_EOL_IS_EITHER_CRLF=y +# CONFIG_LIBC_STRERROR is not set +# CONFIG_LIBC_PERROR_STDOUT is not set +CONFIG_ARCH_LOWPUTC=y +CONFIG_LIB_SENDFILE_BUFSIZE=512 +# CONFIG_ARCH_ROMGETC is not set +# CONFIG_ARCH_OPTIMIZED_FUNCTIONS is not set + +# +# Basic CXX Support +# +# CONFIG_C99_BOOL8 is not set +CONFIG_HAVE_CXX=y +CONFIG_HAVE_CXXINITIALIZE=y +# CONFIG_CXX_NEWLONG is not set + +# +# uClibc++ Standard C++ Library +# +# CONFIG_UCLIBCXX is not set + +# +# Application Configuration # # -# STM3220G-EVAL LCD Hardware Configuration +# Named Applications # -CONFIG_LCD_NOGETRUN=y -CONFIG_LCD_LANDSCAPE=y -CONFIG_LCD_RLANDSCAPE=n -CONFIG_LCD_PORTRAIT=n -CONFIG_LCD_RPORTRAIT=n +# CONFIG_NAMEDAPP is not set # -# STM3220G-EVAL specific LCD settings +# Examples # -CONFIG_STM32_ILI9320_DISABLE=n -CONFIG_STM32_ILI9325_DISABLE=n +# CONFIG_EXAMPLES_BUTTONS is not set +# CONFIG_EXAMPLES_CAN is not set +# CONFIG_EXAMPLES_CDCACM is not set +# CONFIG_EXAMPLES_COMPOSITE is not set +# CONFIG_EXAMPLES_CXXTEST is not set +# CONFIG_EXAMPLES_DHCPD is not set +# CONFIG_EXAMPLES_ELF is not set +# CONFIG_EXAMPLES_FTPC is not set +# CONFIG_EXAMPLES_FTPD is not set +# CONFIG_EXAMPLES_HELLO is not set +# CONFIG_EXAMPLES_HELLOXX is not set +# CONFIG_EXAMPLES_JSON is not set +# CONFIG_EXAMPLES_HIDKBD is not set +# CONFIG_EXAMPLES_KEYPADTEST is not set +# CONFIG_EXAMPLES_IGMP is not set +# CONFIG_EXAMPLES_LCDRW is not set +# CONFIG_EXAMPLES_MM is not set +# CONFIG_EXAMPLES_MOUNT is not set +# CONFIG_EXAMPLES_MODBUS is not set +# CONFIG_EXAMPLES_NETTEST is not set +# CONFIG_EXAMPLES_NSH is not set +# CONFIG_EXAMPLES_NULL is not set +# CONFIG_EXAMPLES_NX is not set +# CONFIG_EXAMPLES_NXCONSOLE is not set +# CONFIG_EXAMPLES_NXFFS is not set +# CONFIG_EXAMPLES_NXFLAT is not set +# CONFIG_EXAMPLES_NXHELLO is not set +# CONFIG_EXAMPLES_NXIMAGE is not set +# CONFIG_EXAMPLES_NXLINES is not set +# CONFIG_EXAMPLES_NXTEXT is not set +# CONFIG_EXAMPLES_OSTEST is not set +# CONFIG_EXAMPLES_PASHELLO is not set +# CONFIG_EXAMPLES_PIPE is not set +# CONFIG_EXAMPLES_POLL is not set +# CONFIG_EXAMPLES_QENCODER is not set +# CONFIG_EXAMPLES_RGMP is not set +# CONFIG_EXAMPLES_ROMFS is not set +# CONFIG_EXAMPLES_SENDMAIL is not set +# CONFIG_EXAMPLES_SERLOOP is not set +# CONFIG_EXAMPLES_TELNETD is not set +# CONFIG_EXAMPLES_THTTPD is not set +# CONFIG_EXAMPLES_TIFF is not set +# CONFIG_EXAMPLES_TOUCHSCREEN is not set +# CONFIG_EXAMPLES_UDP is not set +# CONFIG_EXAMPLES_DISCOVER is not set +# CONFIG_EXAMPLES_UIP is not set +# CONFIG_EXAMPLES_USBSERIAL is not set +# CONFIG_EXAMPLES_USBMSC is not set +# CONFIG_EXAMPLES_USBTERM is not set +# CONFIG_EXAMPLES_WATCHDOG is not set +# CONFIG_EXAMPLES_WGET is not set +# CONFIG_EXAMPLES_WLAN is not set # -# Settings for examples/uip +# Interpreters # -CONFIG_EXAMPLES_UIP_IPADDR=0x0a000002 -CONFIG_EXAMPLES_UIP_DRIPADDR=0x0a000001 -CONFIG_EXAMPLES_UIP_NETMASK=0xffffff00 -CONFIG_EXAMPLES_UIP_DHCPC=n # -# Settings for examples/nettest -CONFIG_EXAMPLES_NETTEST_SERVER=n -CONFIG_EXAMPLES_NETTEST_PERFORMANCE=n -CONFIG_EXAMPLES_NETTEST_NOMAC=y -CONFIG_EXAMPLES_NETTEST_IPADDR=0x0a000002 -CONFIG_EXAMPLES_NETTEST_DRIPADDR=0x0a000001 -CONFIG_EXAMPLES_NETTEST_NETMASK=0xffffff00 -CONFIG_EXAMPLES_NETTEST_CLIENTIP=0x0a000001 +# Interpreters +# +# CONFIG_INTERPRETERS_FICL is not set +# CONFIG_INTERPRETERS_PCODE is not set # -# Settings for examples/ostest +# Network Utilities # -CONFIG_EXAMPLES_OSTEST_LOOPS=1 -CONFIG_EXAMPLES_OSTEST_STACKSIZE=2048 -CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3 # -# Settings for apps/nshlib +# Networking Utilities # -CONFIG_NSH_BUILTIN_APPS=n +# CONFIG_NETUTILS_CODECS is not set +# CONFIG_NETUTILS_DHCPC is not set +# CONFIG_NETUTILS_DHCPD is not set +# CONFIG_NETUTILS_FTPC is not set +# CONFIG_NETUTILS_FTPD is not set +# CONFIG_NETUTILS_JSON is not set +CONFIG_NETUTILS_RESOLV=y +CONFIG_NET_RESOLV_ENTRIES=4 +CONFIG_NET_RESOLV_MAXRESPONSE=96 +# CONFIG_NETUTILS_SMTP is not set +CONFIG_NETUTILS_TELNETD=y +CONFIG_NETUTILS_TFTPC=y +# CONFIG_NETUTILS_THTTPD is not set +CONFIG_NETUTILS_UIPLIB=y +CONFIG_NETUTILS_WEBCLIENT=y +CONFIG_NSH_WGET_USERAGENT="NuttX/6.xx.x (; http://www.nuttx.org/)" +# CONFIG_NETUTILS_WEBSERVER is not set +# CONFIG_NETUTILS_DISCOVER is not set +# CONFIG_NETUTILS_XMLRPC is not set +# +# ModBus +# + +# +# FreeModbus +# +# CONFIG_MODBUS is not set + +# +# NSH Library +# +CONFIG_NSH_LIBRARY=y + +# +# Disable Individual commands +# +# CONFIG_NSH_DISABLE_CAT is not set +# CONFIG_NSH_DISABLE_CD is not set +# CONFIG_NSH_DISABLE_CP is not set +# CONFIG_NSH_DISABLE_DD is not set +# CONFIG_NSH_DISABLE_ECHO is not set +# CONFIG_NSH_DISABLE_EXEC is not set +# CONFIG_NSH_DISABLE_EXIT is not set +# CONFIG_NSH_DISABLE_FREE is not set +# CONFIG_NSH_DISABLE_GET is not set +# CONFIG_NSH_DISABLE_HELP is not set +# CONFIG_NSH_DISABLE_HEXDUMP is not set +# CONFIG_NSH_DISABLE_IFCONFIG is not set +# CONFIG_NSH_DISABLE_KILL is not set +# CONFIG_NSH_DISABLE_LOSETUP is not set +# CONFIG_NSH_DISABLE_LS is not set +# CONFIG_NSH_DISABLE_MB is not set +# CONFIG_NSH_DISABLE_MKDIR is not set +# CONFIG_NSH_DISABLE_MKFATFS is not set +# CONFIG_NSH_DISABLE_MKFIFO is not set +# CONFIG_NSH_DISABLE_MKRD is not set +# CONFIG_NSH_DISABLE_MH is not set +# CONFIG_NSH_DISABLE_MOUNT is not set +# CONFIG_NSH_DISABLE_MW is not set +# CONFIG_NSH_DISABLE_NSFMOUNT is not set +# CONFIG_NSH_DISABLE_PS is not set +# CONFIG_NSH_DISABLE_PING is not set +# CONFIG_NSH_DISABLE_PUT is not set +# CONFIG_NSH_DISABLE_PWD is not set +# CONFIG_NSH_DISABLE_RM is not set +# CONFIG_NSH_DISABLE_RMDIR is not set +# CONFIG_NSH_DISABLE_SET is not set +# CONFIG_NSH_DISABLE_SH is not set +# CONFIG_NSH_DISABLE_SLEEP is not set +# CONFIG_NSH_DISABLE_TEST is not set +# CONFIG_NSH_DISABLE_UMOUNT is not set +# CONFIG_NSH_DISABLE_UNSET is not set +# CONFIG_NSH_DISABLE_USLEEP is not set +# CONFIG_NSH_DISABLE_WGET is not set +# CONFIG_NSH_DISABLE_XD is not set +CONFIG_NSH_CODECS_BUFSIZE=128 CONFIG_NSH_FILEIOSIZE=512 -CONFIG_NSH_STRERROR=n CONFIG_NSH_LINELEN=64 CONFIG_NSH_NESTDEPTH=3 -CONFIG_NSH_DISABLESCRIPT=n -CONFIG_NSH_DISABLEBG=n -CONFIG_NSH_ROMFSETC=n +# CONFIG_NSH_DISABLESCRIPT is not set +# CONFIG_NSH_DISABLEBG is not set CONFIG_NSH_CONSOLE=y -#CONFIG_NSH_CONDEV="/dev/ttyS1" +# CONFIG_NSH_CONDEV is not set +# CONFIG_NSH_ARCHINIT is not set CONFIG_NSH_TELNET=y -CONFIG_NSH_ARCHINIT=n +CONFIG_NSH_TELNETD_PORT=23 +CONFIG_NSH_TELNETD_DAEMONPRIO=100 +CONFIG_NSH_TELNETD_DAEMONSTACKSIZE=2048 +CONFIG_NSH_TELNETD_CLIENTPRIO=100 +CONFIG_NSH_TELNETD_CLIENTSTACKSIZE=2048 CONFIG_NSH_IOBUFFER_SIZE=512 -CONFIG_NSH_DHCPC=n -CONFIG_NSH_NOMAC=y +# CONFIG_NSH_TELNET_LOGIN is not set CONFIG_NSH_IPADDR=0x0a000002 CONFIG_NSH_DRIPADDR=0x0a000001 CONFIG_NSH_NETMASK=0xffffff00 -CONFIG_NSH_ROMFSMOUNTPT="/etc" -CONFIG_NSH_INITSCRIPT="init.d/rcS" -CONFIG_NSH_ROMFSDEVNO=0 -CONFIG_NSH_ROMFSSECTSIZE=64 -CONFIG_NSH_FATDEVNO=1 -CONFIG_NSH_FATSECTSIZE=512 -CONFIG_NSH_FATNSECTORS=1024 -CONFIG_NSH_FATMOUNTPT="/tmp" +CONFIG_NSH_NOMAC=y +CONFIG_NSH_MAX_ROUNDTRIP=20 # -# Architecture-specific NSH options +# NxWidgets/NxWM # -CONFIG_NSH_MMCSDSPIPORTNO=0 -CONFIG_NSH_MMCSDSLOTNO=0 -CONFIG_NSH_MMCSDMINOR=0 +CONFIG_NXWIDGETS=y # -# I2C tool settings +# NX Server/Device Configuration # -CONFIG_I2CTOOL_BUILTIN=y -CONFIG_I2CTOOL_MINBUS=1 -CONFIG_I2CTOOL_MAXBUS=3 -#CONFIG_I2CTOOL_MINADDR -#CONFIG_I2CTOOL_MAXADDR -#CONFIG_I2CTOOL_MAXREGADDR -CONFIG_I2CTOOL_DEFFREQ=100000 +CONFIG_NXWIDGETS_FLICKERFREE=y +CONFIG_NXWIDGETS_DEVNO=0 +CONFIG_NXWIDGETS_VPLANE=0 +CONFIG_NXWIDGETS_SERVERPRIO=51 +CONFIG_NXWIDGETS_SERVERSTACK=2048 +CONFIG_NXWIDGETS_CLIENTPRIO=50 +CONFIG_NXWIDGETS_LISTENERPRIO=50 +CONFIG_NXWIDGETS_LISTENERSTACK=2048 +# CONFIG_NXWIDGETS_EXTERNINIT is not set +# CONFIG_NXWIDGET_EVENTWAIT is not set # -# Settings for examples/usbserial +# NXWidget Configuration # -CONFIG_EXAMPLES_USBSERIAL_INONLY=n -CONFIG_EXAMPLES_USBSERIAL_OUTONLY=n -CONFIG_EXAMPLES_USBSERIAL_ONLYSMALL=n -CONFIG_EXAMPLES_USBSERIAL_ONLYBIG=n - -CONFIG_EXAMPLES_USBSERIAL_TRACEINIT=n -CONFIG_EXAMPLES_USBSERIAL_TRACECLASS=n -CONFIG_EXAMPLES_USBSERIAL_TRACETRANSFERS=n -CONFIG_EXAMPLES_USBSERIAL_TRACECONTROLLER=n -CONFIG_EXAMPLES_USBSERIAL_TRACEINTERRUPTS=n +CONFIG_NXWIDGETS_BPP=16 +CONFIG_NXWIDGETS_SIZEOFCHAR=1 # -# Settings for examples/adc +# NXWidget Default Values +# +# CONFIG_NXWIDGETS_SYSTEM_CUSTOM_FONTID is not set +CONFIG_NXWIDGETS_TNXARRAY_INITIALSIZE=16 +CONFIG_NXWIDGETS_TNXARRAY_SIZEINCREMENT=8 +CONFIG_NXWIDGETS_CUSTOM_FILLCOLORS=y +CONFIG_NXWIDGETS_DEFAULT_BACKGROUNDCOLOR=0x9dfb +CONFIG_NXWIDGETS_DEFAULT_SELECTEDBACKGROUNDCOLOR=0xd73e +CONFIG_NXWIDGETS_DEFAULT_HIGHLIGHTCOLOR=0xc618 +CONFIG_NXWIDGETS_CUSTOM_EDGECOLORS=y +CONFIG_NXWIDGETS_DEFAULT_SHINEEDGECOLOR=0xffdf +CONFIG_NXWIDGETS_DEFAULT_SHADOWEDGECOLOR=0x21e9 +# CONFIG_NXWIDGETS_CUSTOM_TEXTCOLORS is not set +CONFIG_NXWIDGETS_TRANSPARENT_COLOR=0x0 + +# +# Keypad behavior +# +CONFIG_NXWIDGETS_FIRST_REPEAT_TIME=500 +CONFIG_NXWIDGETS_CONTINUE_REPEAT_TIME=200 +CONFIG_NXWIDGETS_DOUBLECLICK_TIME=350 +CONFIG_NXWIDGETS_KBDBUFFER_SIZE=16 +CONFIG_NXWIDGETS_CURSORCONTROL_SIZE=4 +# CONFIG_NXWIDGET_MEMMONITOR is not set +CONFIG_NXWM=y + +# +# General settings +# +# CONFIG_NXWM_SYSTEM_CUSTOM_FONTID is not set +CONFIG_NXWM_UNITTEST=y + +# +# Color configuration +# +# CONFIG_NXWM_CUSTOM_FILLCOLORS is not set +# CONFIG_NXWM_CUSTOM_EDGECOLORS is not set +# CONFIG_NXWM_CUSTOM_TEXTCOLORS is not set + +# +# Horizontal and vertical spacing of icons in the task bar +# +CONFIG_NXWM_TASKBAR_VSPACING=4 +CONFIG_NXWM_TASKBAR_HSPACING=2 +# CONFIG_NXWM_TASKBAR_TOP is not set +# CONFIG_NXWM_TASKBAR_BOTTOM is not set +CONFIG_NXWM_TASKBAR_LEFT=y +# CONFIG_NXWM_TASKBAR_RIGHT is not set +# CONFIG_NXWM_CUSTOM_TASKBAR_WIDTH is not set +# CONFIG_NXWM_DISABLE_MINIMIZE is not set + +# +# Tool Bar Configuration +# +# CONFIG_NXWM_CUSTOM_TOOLBAR_HEIGHT is not set + +# +# Background Image +# +# CONFIG_NXWM_DISABLE_BACKGROUND_IMAGE is not set +CONFIG_NXWM_BACKGROUND_IMAGE="" + +# +# Start Window Configuration # # -# Settings for examples/can +# Horizontal and vertical spacing of icons in the task bar +# +CONFIG_NXWM_STARTWINDOW_VSPACING=4 +CONFIG_NXWM_STARTWINDOW_HSPACING=4 +# CONFIG_NXWM_CUSTOM_STARTWINDOW_ICON is not set +CONFIG_NXWM_STARTWINDOW_MQNAME="/dev/nxwm" +CONFIG_NXWM_STARTWINDOW_MXMSGS=32 +CONFIG_NXWM_STARTWINDOW_MXMPRIO=42 +CONFIG_NXWM_STARTWINDOW_PRIO=50 +CONFIG_NXWM_STARTWINDOW_STACKSIZE=2048 + +# +# NxConsole Window Configuration +# +CONFIG_NXWM_NXCONSOLE_PRIO=50 +CONFIG_NXWM_NXCONSOLE_STACKSIZE=2048 +# CONFIG_NXWM_NXCONSOLE_CUSTOM_COLORS is not set +# CONFIG_NXWM_NXCONSOLE_CUSTOM_FONTID is not set +# CONFIG_NXWM_CUSTOM_NXCONSOLE_ICON is not set +CONFIG_NXWM_TOUCHSCREEN=y + +# +# Touchscreen device settings +# +CONFIG_NXWM_TOUCHSCREEN_DEVNO=0 +CONFIG_NXWM_TOUCHSCREEN_DEVPATH="/dev/input0" +CONFIG_NXWM_TOUCHSCREEN_SIGNO=5 +CONFIG_NXWM_TOUCHSCREEN_LISTENERPRIO=50 +CONFIG_NXWM_TOUCHSCREEN_LISTENERSTACK=1024 +CONFIG_NXWM_KEYBOARD=y + +# +# Keyboard device settings +# +CONFIG_NXWM_KEYBOARD_DEVPATH="/dev/console" +CONFIG_NXWM_KEYBOARD_SIGNO=6 +CONFIG_NXWM_KEYBOARD_BUFSIZE=16 +CONFIG_NXWM_KEYBOARD_LISTENERPRIO=50 +CONFIG_NXWM_KEYBOARD_LISTENERSTACK=2048 + +# +# Calibration display settings +# +# CONFIG_NXWM_CALIBRATION_CUSTOM_COLORS is not set +# CONFIG_NXWM_CUSTOM_CALIBRATION_ICON is not set +CONFIG_NXWM_CALIBRATION_SIGNO=5 +CONFIG_NXWM_CALIBRATION_LISTENERPRIO=50 +CONFIG_NXWM_CALIBRATION_LISTENERSTACK=2048 + +# +# Calibration display settings +# +# CONFIG_NXWM_HEXCALCULATOR_CUSTOM_COLORS is not set +# CONFIG_NXWM_CUSTOM_HEXCALCULATOR_ICON is not set +CONFIG_NXWM_HEXCALCULATOR_CUSTOM_FONTID=y +CONFIG_NXWM_HEXCALCULATOR_FONTID=5 + +# +# System NSH Add-Ons # # -# Settings for examples/nx +# Custom Free Memory Command # -CONFIG_EXAMPLES_NX_BUILTIN=y -CONFIG_EXAMPLES_NX_VPLANE=0 -CONFIG_EXAMPLES_NX_DEVNO=0 -CONFIG_EXAMPLES_NX_BGCOLOR=0x0011 -CONFIG_EXAMPLES_NX_COLOR1=0xaedc -CONFIG_EXAMPLES_NX_COLOR2=0xe7ff -CONFIG_EXAMPLES_NX_TBCOLOR=0xd69a -CONFIG_EXAMPLES_NX_FONTID=0 -CONFIG_EXAMPLES_NX_FONTCOLOR=0x0000 -CONFIG_EXAMPLES_NX_BPP=16 -CONFIG_EXAMPLES_NX_RAWWINDOWS=n -CONFIG_EXAMPLES_NX_STACKSIZE=2048 -CONFIG_EXAMPLES_NX_CLIENTPRIO=80 -CONFIG_EXAMPLES_NX_SERVERPRIO=120 -CONFIG_EXAMPLES_NX_NOTIFYSIGNO=4 -CONFIG_EXAMPLES_NX_EXTERNINIT=n +# CONFIG_SYSTEM_FREE is not set # -# Settings for examples/nxhello +# I2C tool # -CONFIG_EXAMPLES_NXHELLO_BUILTIN=y -CONFIG_EXAMPLES_NXHELLO_VPLANE=0 -CONFIG_EXAMPLES_NXHELLO_DEVNO=0 -CONFIG_EXAMPLES_NXHELLO_BGCOLOR=0x0011 -CONFIG_EXAMPLES_NXHELLO_FONTID=6 -CONFIG_EXAMPLES_NXHELLO_FONTCOLOR=0xffdf -CONFIG_EXAMPLES_NXHELLO_BPP=16 -CONFIG_EXAMPLES_NXHELLO_EXTERNINIT=n +# CONFIG_SYSTEM_I2CTOOL is not set # -# Settings for examples/nximage +# FLASH Program Installation # -CONFIG_EXAMPLES_NXIMAGE_BUILTIN=y -CONFIG_EXAMPLES_NXIMAGE_VPLANE=0 -CONFIG_EXAMPLES_NXIMAGE_DEVNO=0 -CONFIG_EXAMPLES_NXIMAGE_BPP=16 -CONFIG_EXAMPLES_NXIMAGE_XSCALEp5=n -CONFIG_EXAMPLES_NXIMAGE_XSCALE1p5=y -CONFIG_EXAMPLES_NXIMAGE_XSCALE2p0=n -CONFIG_EXAMPLES_NXIMAGE_YSCALEp5=n -CONFIG_EXAMPLES_NXIMAGE_YSCALE1p5=y -CONFIG_EXAMPLES_NXIMAGE_YSCALE2p0=n -CONFIG_EXAMPLES_NXIMAGE_EXTERNINIT=n +# CONFIG_SYSTEM_INSTALL is not set # -# Settings for examples/nxlines +# readline() # -CONFIG_EXAMPLES_NXLINES_VPLANE=0 -CONFIG_EXAMPLES_NXLINES_DEVNO=0 -CONFIG_EXAMPLES_NXLINES_BGCOLOR=0x0320 -CONFIG_EXAMPLES_NXLINES_LINEWIDTH=16 -CONFIG_EXAMPLES_NXLINES_LINECOLOR=0xffe0 -CONFIG_EXAMPLES_NXLINES_BORDERWIDTH=4 -CONFIG_EXAMPLES_NXLINES_BORDERCOLOR=0xffe0 -CONFIG_EXAMPLES_NXLINES_CIRCLECOLOR=0xf7bb -CONFIG_EXAMPLES_NXLINES_BPP=16 -CONFIG_EXAMPLES_NXLINES_EXTERNINIT=n +CONFIG_SYSTEM_READLINE=y +CONFIG_READLINE_ECHO=y # -# Settings for examples/touchscreen +# Power Off # -CONFIG_EXAMPLES_TOUCHSCREEN_BUILTIN=n -CONFIG_EXAMPLES_TOUCHSCREEN_MINOR=0 -CONFIG_EXAMPLES_TOUCHSCREEN_DEVPATH="/dev/input0" -CONFIG_EXAMPLES_TOUCHSCREEN_NSAMPLES=25 +# CONFIG_SYSTEM_POWEROFF is not set # -# Settings for examples/usbstorage +# RAMTRON # -CONFIG_EXAMPLES_USBMSC_BUILTIN=y -CONFIG_EXAMPLES_USBMSC_NLUNS=1 -CONFIG_EXAMPLES_USBMSC_DEVMINOR1=0 -CONFIG_EXAMPLES_USBMSC_DEVPATH1="/dev/mmcsd0" -CONFIG_EXAMPLES_USBMSC_DEBUGMM=n -CONFIG_EXAMPLES_USBMSC_TRACEINIT=n -CONFIG_EXAMPLES_USBMSC_TRACECLASS=n -CONFIG_EXAMPLES_USBMSC_TRACETRANSFERS=n -CONFIG_EXAMPLES_USBMSC_TRACECONTROLLER=n -CONFIG_EXAMPLES_USBMSC_TRACEINTERRUPTS=n +# CONFIG_SYSTEM_RAMTRON is not set # -# Settings for examples/watchdog -# -# This test depends on these specific Watchdog/NSH configurations settings (your -# specific watchdog hardware settings might require additional settings). +# SD Card # +# CONFIG_SYSTEM_SDCARD is not set # -# Settings for examples/pwm +# Sysinfo # - -# -# Settings for examples/ftpd -# - -# -# Settings for examples/watchdog -# -# This test depends on these specific Watchdog/NSH configurations settings (your -# specific watchdog hardware settings might require additional settings). -# - -# -# Stack and heap information -# -CONFIG_BOOT_RUNFROMFLASH=n -CONFIG_BOOT_COPYTORAM=n -CONFIG_CUSTOM_STACK=n -CONFIG_IDLETHREAD_STACKSIZE=1024 -CONFIG_USERMAIN_STACKSIZE=2048 -CONFIG_PTHREAD_STACK_MIN=256 -CONFIG_PTHREAD_STACK_DEFAULT=2048 -CONFIG_HEAP_BASE= -CONFIG_HEAP_SIZE= +# CONFIG_SYSTEM_SYSINFO is not set diff --git a/nuttx/configs/stm3220g-eval/nxwm/setenv.sh b/nuttx/configs/stm3220g-eval/nxwm/setenv.sh index 8585313914..7326fad478 100755 --- a/nuttx/configs/stm3220g-eval/nxwm/setenv.sh +++ b/nuttx/configs/stm3220g-eval/nxwm/setenv.sh @@ -67,7 +67,7 @@ export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/CodeSourcery/Sourcery G++ # This is the Cygwin path to the location where I build the buildroot # toolchain. -export TOOLCHAIN_BIN="${WD}/../misc/buildroot/build_arm_nofpu/staging_dir/bin" +#export TOOLCHAIN_BIN="${WD}/../misc/buildroot/build_arm_nofpu/staging_dir/bin" # Add the path to the toolchain to the PATH variable export PATH="${TOOLCHAIN_BIN}:/sbin:/usr/sbin:${PATH_ORIG}" diff --git a/nuttx/drivers/input/Kconfig b/nuttx/drivers/input/Kconfig index 1f345ee144..6da3a9f395 100644 --- a/nuttx/drivers/input/Kconfig +++ b/nuttx/drivers/input/Kconfig @@ -123,6 +123,25 @@ config STMPE811_I2C endchoice +config STMPE811_ACTIVELOW + bool "Active Low Interrupt" + default n + ---help--- + The STMPE811 interrupt is provided by a discrete input (usually a + GPIO interrupt on most MCU architectures). This setting determines + whether the interrupt is active high (or rising edge triggered) or + active low (or falling edge triggered). Default: Active + high/rising edge. + +config STMPE811_EDGE + bool "Edge triggered Interrupt" + default n + ---help--- + The STMPE811 interrupt is provided by a discrete input (usually a + GPIO interrupt on most MCU architectures). This setting determines + whether the interrupt is edge or level triggered. Default: Level + triggered. + config STMPE811_MULTIPLE bool "Multiple STMPE811 Devices" default n diff --git a/nuttx/graphics/Makefile b/nuttx/graphics/Makefile index 238e14df42..aa402bfa4c 100644 --- a/nuttx/graphics/Makefile +++ b/nuttx/graphics/Makefile @@ -124,6 +124,9 @@ gen32bppsources: $(Q) $(MAKE) -C nxfonts -f Makefile.sources TOPDIR=$(TOPDIR) NXFONTS_BITSPERPIXEL=32 EXTRADEFINES=$(EXTRADEFINES) genfontsources: +ifeq ($(CONFIG_NXFONT_MONO5X8),y) + @$(MAKE) -C nxfonts -f Makefile.sources TOPDIR=$(TOPDIR) NXFONTS_FONTID=18 EXTRADEFINES=$(EXTRADEFINES) +endif ifeq ($(CONFIG_NXFONT_SANS23X27),y) $(Q) $(MAKE) -C nxfonts -f Makefile.sources TOPDIR=$(TOPDIR) NXFONTS_FONTID=1 EXTRADEFINES=$(EXTRADEFINES) endif diff --git a/nuttx/graphics/nxfonts/Make.defs b/nuttx/graphics/nxfonts/Make.defs index bc65d7ad7a..def0928252 100644 --- a/nuttx/graphics/nxfonts/Make.defs +++ b/nuttx/graphics/nxfonts/Make.defs @@ -42,6 +42,12 @@ NXFCONV_CSRCS = nxfonts_convert_1bpp.c nxfonts_convert_2bpp.c \ NXFSET_ASRCS = NXFSET_CSRCS = +# Monospace fonts + +ifeq ($(CONFIG_NXFONT_MONO5X8),y) +NXFSET_CSRCS += nxfonts_bitmaps_mono5x8.c +endif + # Sans serif fonts ifeq ($(CONFIG_NXFONT_SANS17X22),y) diff --git a/nuttx/graphics/nxfonts/Makefile.sources b/nuttx/graphics/nxfonts/Makefile.sources index 76a099dcbe..2e41fc7049 100644 --- a/nuttx/graphics/nxfonts/Makefile.sources +++ b/nuttx/graphics/nxfonts/Makefile.sources @@ -72,6 +72,13 @@ endif ifdef NXFONTS_FONTID +# MONO + +ifeq ($(NXFONTS_FONTID),18) +NXFONTS_PREFIX := g_mono5x8_ +GEN_CSRC = nxfonts_bitmaps_mono5x8.c +endif + # SANS ifeq ($(NXFONTS_FONTID),14) diff --git a/nuttx/graphics/nxfonts/nxfonts_bitmaps.c b/nuttx/graphics/nxfonts/nxfonts_bitmaps.c index 2efc34b87f..b089ec0386 100644 --- a/nuttx/graphics/nxfonts/nxfonts_bitmaps.c +++ b/nuttx/graphics/nxfonts/nxfonts_bitmaps.c @@ -80,6 +80,8 @@ # include "nxfonts_sans17x23b.h" #elif NXFONTS_FONTID == 17 # include "nxfonts_sans20x27b.h" +#elif NXFONTS_FONTID == 18 +# include "nxfonts_mono5x8.h" #else # error "No font ID specified" #endif diff --git a/nuttx/graphics/nxfonts/nxfonts_getfont.c b/nuttx/graphics/nxfonts/nxfonts_getfont.c index 23e5c44744..c2af977f28 100644 --- a/nuttx/graphics/nxfonts/nxfonts_getfont.c +++ b/nuttx/graphics/nxfonts/nxfonts_getfont.c @@ -60,6 +60,12 @@ * Private Data ****************************************************************************/ +/* MONO */ + +#ifdef CONFIG_NXFONT_MONO5X8 +extern const struct nx_fontpackage_s g_mono5x8_package; +#endif + /* SANS */ #ifdef CONFIG_NXFONT_SANS17X22 @@ -139,6 +145,12 @@ extern const struct nx_fontpackage_s g_serif38x49b_package; static FAR const struct nx_fontpackage_s *g_fontpackages[] = { +/* MONO */ + +#ifdef CONFIG_NXFONT_MONO5X8 + &g_mono5x8_package, +#endif + /* SANS */ #ifdef CONFIG_NXFONT_SANS17X22 diff --git a/nuttx/graphics/nxfonts/nxfonts_mono5x8.h b/nuttx/graphics/nxfonts/nxfonts_mono5x8.h new file mode 100644 index 0000000000..739437e629 --- /dev/null +++ b/nuttx/graphics/nxfonts/nxfonts_mono5x8.h @@ -0,0 +1,815 @@ +/**************************************************************************** + * graphics/nxfonts/nxfonts_mono5x8.h + * + * Copyright (C) 2011-2012 NX Engineering, S.A., All rights reserved. + * Author: Petteri Aimonen + * + * Based on 5x8.pcf.gz from xfonts-base. The file is marked as + * COPYRIGHT "Public domain font. Share and enjoy." + * + * 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. + * + ****************************************************************************/ + +#ifndef __GRAPHICS_NXFONTS_NXFONTS_MONO5X8_H +#define __GRAPHICS_NXFONTS_NXFONTS_MONO5X8_H + +#define NXFONT_ID FONTID_MONO5X8 + +#define NXFONT_MIN7BIT 33 +#define NXFONT_MAX7BIT 126 + +#define NXFONT_MIN8BIT 161 +#define NXFONT_MAX8BIT 255 + +/* Maximum height and width of any glyph in the set */ + +#define NXFONT_MAXHEIGHT 8 +#define NXFONT_MAXWIDTH 5 + +/* The width of a space */ + +#define NXFONT_SPACEWIDTH 5 + +/* exclam (33) */ +#define NXFONT_METRICS_33 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_33 {0x0, 0x20, 0x20, 0x20, 0x20, 0x0, 0x20, 0x0} + +/* quotedbl (34) */ +#define NXFONT_METRICS_34 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_34 {0x0, 0x50, 0x50, 0x50, 0x0, 0x0, 0x0, 0x0} + +/* numbersign (35) */ +#define NXFONT_METRICS_35 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_35 {0x50, 0x50, 0xf8, 0x50, 0xf8, 0x50, 0x50, 0x0} + +/* dollar (36) */ +#define NXFONT_METRICS_36 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_36 {0x20, 0x70, 0xa0, 0x70, 0x28, 0x70, 0x20, 0x0} + +/* percent (37) */ +#define NXFONT_METRICS_37 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_37 {0x0, 0x40, 0x50, 0x20, 0x50, 0x10, 0x0, 0x0} + +/* ampersand (38) */ +#define NXFONT_METRICS_38 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_38 {0x40, 0xa0, 0xa0, 0x40, 0xa0, 0xa0, 0x50, 0x0} + +/* quotesingle (39) */ +#define NXFONT_METRICS_39 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_39 {0x0, 0x20, 0x20, 0x20, 0x0, 0x0, 0x0, 0x0} + +/* parenleft (40) */ +#define NXFONT_METRICS_40 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_40 {0x0, 0x20, 0x40, 0x40, 0x40, 0x40, 0x20, 0x0} + +/* parenright (41) */ +#define NXFONT_METRICS_41 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_41 {0x0, 0x40, 0x20, 0x20, 0x20, 0x20, 0x40, 0x0} + +/* asterisk (42) */ +#define NXFONT_METRICS_42 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_42 {0x0, 0x0, 0x90, 0x60, 0xf0, 0x60, 0x90, 0x0} + +/* plus (43) */ +#define NXFONT_METRICS_43 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_43 {0x0, 0x0, 0x20, 0x20, 0xf8, 0x20, 0x20, 0x0} + +/* comma (44) */ +#define NXFONT_METRICS_44 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_44 {0x0, 0x0, 0x0, 0x0, 0x0, 0x30, 0x20, 0x40} + +/* hyphen (45) */ +#define NXFONT_METRICS_45 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_45 {0x0, 0x0, 0x0, 0x0, 0xf0, 0x0, 0x0, 0x0} + +/* period (46) */ +#define NXFONT_METRICS_46 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_46 {0x0, 0x0, 0x0, 0x0, 0x0, 0x20, 0x70, 0x20} + +/* slash (47) */ +#define NXFONT_METRICS_47 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_47 {0x0, 0x10, 0x10, 0x20, 0x40, 0x80, 0x80, 0x0} + +/* zero (48) */ +#define NXFONT_METRICS_48 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_48 {0x0, 0x20, 0x50, 0x50, 0x50, 0x50, 0x20, 0x0} + +/* one (49) */ +#define NXFONT_METRICS_49 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_49 {0x0, 0x20, 0x60, 0x20, 0x20, 0x20, 0x70, 0x0} + +/* two (50) */ +#define NXFONT_METRICS_50 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_50 {0x0, 0x60, 0x90, 0x10, 0x60, 0x80, 0xf0, 0x0} + +/* three (51) */ +#define NXFONT_METRICS_51 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_51 {0x0, 0xf0, 0x20, 0x60, 0x10, 0x90, 0x60, 0x0} + +/* four (52) */ +#define NXFONT_METRICS_52 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_52 {0x0, 0x20, 0x60, 0xa0, 0xf0, 0x20, 0x20, 0x0} + +/* five (53) */ +#define NXFONT_METRICS_53 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_53 {0x0, 0xf0, 0x80, 0xe0, 0x10, 0x90, 0x60, 0x0} + +/* six (54) */ +#define NXFONT_METRICS_54 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_54 {0x0, 0x60, 0x80, 0xe0, 0x90, 0x90, 0x60, 0x0} + +/* seven (55) */ +#define NXFONT_METRICS_55 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_55 {0x0, 0xf0, 0x10, 0x20, 0x20, 0x40, 0x40, 0x0} + +/* eight (56) */ +#define NXFONT_METRICS_56 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_56 {0x0, 0x60, 0x90, 0x60, 0x90, 0x90, 0x60, 0x0} + +/* nine (57) */ +#define NXFONT_METRICS_57 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_57 {0x0, 0x60, 0x90, 0x90, 0x70, 0x10, 0x60, 0x0} + +/* colon (58) */ +#define NXFONT_METRICS_58 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_58 {0x0, 0x0, 0x60, 0x60, 0x0, 0x60, 0x60, 0x0} + +/* semicolon (59) */ +#define NXFONT_METRICS_59 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_59 {0x0, 0x0, 0x30, 0x30, 0x0, 0x30, 0x20, 0x40} + +/* less (60) */ +#define NXFONT_METRICS_60 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_60 {0x0, 0x10, 0x20, 0x40, 0x40, 0x20, 0x10, 0x0} + +/* equal (61) */ +#define NXFONT_METRICS_61 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_61 {0x0, 0x0, 0x0, 0xf0, 0x0, 0xf0, 0x0, 0x0} + +/* greater (62) */ +#define NXFONT_METRICS_62 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_62 {0x0, 0x40, 0x20, 0x10, 0x10, 0x20, 0x40, 0x0} + +/* question (63) */ +#define NXFONT_METRICS_63 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_63 {0x0, 0x20, 0x50, 0x10, 0x20, 0x0, 0x20, 0x0} + +/* at (64) */ +#define NXFONT_METRICS_64 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_64 {0x30, 0x48, 0x98, 0xa8, 0xa8, 0x90, 0x40, 0x30} + +/* A (65) */ +#define NXFONT_METRICS_65 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_65 {0x0, 0x60, 0x90, 0x90, 0xf0, 0x90, 0x90, 0x0} + +/* B (66) */ +#define NXFONT_METRICS_66 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_66 {0x0, 0xe0, 0x90, 0xe0, 0x90, 0x90, 0xe0, 0x0} + +/* C (67) */ +#define NXFONT_METRICS_67 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_67 {0x0, 0x60, 0x90, 0x80, 0x80, 0x90, 0x60, 0x0} + +/* D (68) */ +#define NXFONT_METRICS_68 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_68 {0x0, 0xe0, 0x90, 0x90, 0x90, 0x90, 0xe0, 0x0} + +/* E (69) */ +#define NXFONT_METRICS_69 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_69 {0x0, 0xf0, 0x80, 0xe0, 0x80, 0x80, 0xf0, 0x0} + +/* F (70) */ +#define NXFONT_METRICS_70 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_70 {0x0, 0xf0, 0x80, 0xe0, 0x80, 0x80, 0x80, 0x0} + +/* G (71) */ +#define NXFONT_METRICS_71 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_71 {0x0, 0x60, 0x90, 0x80, 0xb0, 0x90, 0x60, 0x0} + +/* H (72) */ +#define NXFONT_METRICS_72 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_72 {0x0, 0x90, 0x90, 0xf0, 0x90, 0x90, 0x90, 0x0} + +/* I (73) */ +#define NXFONT_METRICS_73 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_73 {0x0, 0x70, 0x20, 0x20, 0x20, 0x20, 0x70, 0x0} + +/* J (74) */ +#define NXFONT_METRICS_74 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_74 {0x0, 0x70, 0x20, 0x20, 0x20, 0xa0, 0x40, 0x0} + +/* K (75) */ +#define NXFONT_METRICS_75 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_75 {0x0, 0x90, 0xa0, 0xc0, 0xa0, 0xa0, 0x90, 0x0} + +/* L (76) */ +#define NXFONT_METRICS_76 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_76 {0x0, 0x80, 0x80, 0x80, 0x80, 0x80, 0xf0, 0x0} + +/* M (77) */ +#define NXFONT_METRICS_77 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_77 {0x0, 0x90, 0xf0, 0xf0, 0x90, 0x90, 0x90, 0x0} + +/* N (78) */ +#define NXFONT_METRICS_78 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_78 {0x0, 0x90, 0xd0, 0xf0, 0xb0, 0xb0, 0x90, 0x0} + +/* O (79) */ +#define NXFONT_METRICS_79 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_79 {0x0, 0x60, 0x90, 0x90, 0x90, 0x90, 0x60, 0x0} + +/* P (80) */ +#define NXFONT_METRICS_80 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_80 {0x0, 0xe0, 0x90, 0x90, 0xe0, 0x80, 0x80, 0x0} + +/* Q (81) */ +#define NXFONT_METRICS_81 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_81 {0x0, 0x60, 0x90, 0x90, 0xd0, 0xb0, 0x60, 0x10} + +/* R (82) */ +#define NXFONT_METRICS_82 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_82 {0x0, 0xe0, 0x90, 0x90, 0xe0, 0x90, 0x90, 0x0} + +/* S (83) */ +#define NXFONT_METRICS_83 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_83 {0x0, 0x60, 0x90, 0x40, 0x20, 0x90, 0x60, 0x0} + +/* T (84) */ +#define NXFONT_METRICS_84 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_84 {0x0, 0x70, 0x20, 0x20, 0x20, 0x20, 0x20, 0x0} + +/* U (85) */ +#define NXFONT_METRICS_85 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_85 {0x0, 0x90, 0x90, 0x90, 0x90, 0x90, 0x60, 0x0} + +/* V (86) */ +#define NXFONT_METRICS_86 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_86 {0x0, 0x90, 0x90, 0x90, 0x90, 0x60, 0x60, 0x0} + +/* W (87) */ +#define NXFONT_METRICS_87 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_87 {0x0, 0x90, 0x90, 0x90, 0xf0, 0xf0, 0x90, 0x0} + +/* X (88) */ +#define NXFONT_METRICS_88 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_88 {0x0, 0x90, 0x90, 0x60, 0x60, 0x90, 0x90, 0x0} + +/* Y (89) */ +#define NXFONT_METRICS_89 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_89 {0x0, 0x88, 0x88, 0x50, 0x20, 0x20, 0x20, 0x0} + +/* Z (90) */ +#define NXFONT_METRICS_90 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_90 {0x0, 0xf0, 0x10, 0x20, 0x40, 0x80, 0xf0, 0x0} + +/* bracketleft (91) */ +#define NXFONT_METRICS_91 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_91 {0x0, 0x70, 0x40, 0x40, 0x40, 0x40, 0x70, 0x0} + +/* backslash (92) */ +#define NXFONT_METRICS_92 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_92 {0x0, 0x80, 0x80, 0x40, 0x20, 0x10, 0x10, 0x0} + +/* bracketright (93) */ +#define NXFONT_METRICS_93 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_93 {0x0, 0x70, 0x10, 0x10, 0x10, 0x10, 0x70, 0x0} + +/* asciicircum (94) */ +#define NXFONT_METRICS_94 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_94 {0x0, 0x20, 0x50, 0x0, 0x0, 0x0, 0x0, 0x0} + +/* underscore (95) */ +#define NXFONT_METRICS_95 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_95 {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xf0} + +/* grave (96) */ +#define NXFONT_METRICS_96 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_96 {0x0, 0x40, 0x20, 0x0, 0x0, 0x0, 0x0, 0x0} + +/* a (97) */ +#define NXFONT_METRICS_97 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_97 {0x0, 0x0, 0x0, 0x70, 0x90, 0x90, 0x70, 0x0} + +/* b (98) */ +#define NXFONT_METRICS_98 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_98 {0x0, 0x80, 0x80, 0xe0, 0x90, 0x90, 0xe0, 0x0} + +/* c (99) */ +#define NXFONT_METRICS_99 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_99 {0x0, 0x0, 0x0, 0x30, 0x40, 0x40, 0x30, 0x0} + +/* d (100) */ +#define NXFONT_METRICS_100 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_100 {0x0, 0x10, 0x10, 0x70, 0x90, 0x90, 0x70, 0x0} + +/* e (101) */ +#define NXFONT_METRICS_101 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_101 {0x0, 0x0, 0x0, 0x60, 0xb0, 0xc0, 0x60, 0x0} + +/* f (102) */ +#define NXFONT_METRICS_102 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_102 {0x0, 0x20, 0x50, 0x40, 0xe0, 0x40, 0x40, 0x0} + +/* g (103) */ +#define NXFONT_METRICS_103 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_103 {0x0, 0x0, 0x0, 0x60, 0x90, 0x70, 0x10, 0x60} + +/* h (104) */ +#define NXFONT_METRICS_104 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_104 {0x0, 0x80, 0x80, 0xe0, 0x90, 0x90, 0x90, 0x0} + +/* i (105) */ +#define NXFONT_METRICS_105 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_105 {0x0, 0x20, 0x0, 0x60, 0x20, 0x20, 0x70, 0x0} + +/* j (106) */ +#define NXFONT_METRICS_106 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_106 {0x0, 0x10, 0x0, 0x10, 0x10, 0x10, 0x50, 0x20} + +/* k (107) */ +#define NXFONT_METRICS_107 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_107 {0x0, 0x80, 0x80, 0x90, 0xe0, 0x90, 0x90, 0x0} + +/* l (108) */ +#define NXFONT_METRICS_108 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_108 {0x0, 0x60, 0x20, 0x20, 0x20, 0x20, 0x70, 0x0} + +/* m (109) */ +#define NXFONT_METRICS_109 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_109 {0x0, 0x0, 0x0, 0xd0, 0xa8, 0xa8, 0xa8, 0x0} + +/* n (110) */ +#define NXFONT_METRICS_110 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_110 {0x0, 0x0, 0x0, 0xe0, 0x90, 0x90, 0x90, 0x0} + +/* o (111) */ +#define NXFONT_METRICS_111 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_111 {0x0, 0x0, 0x0, 0x60, 0x90, 0x90, 0x60, 0x0} + +/* p (112) */ +#define NXFONT_METRICS_112 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_112 {0x0, 0x0, 0x0, 0xe0, 0x90, 0xe0, 0x80, 0x80} + +/* q (113) */ +#define NXFONT_METRICS_113 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_113 {0x0, 0x0, 0x0, 0x70, 0x90, 0x70, 0x10, 0x10} + +/* r (114) */ +#define NXFONT_METRICS_114 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_114 {0x0, 0x0, 0x0, 0xa0, 0xd0, 0x80, 0x80, 0x0} + +/* s (115) */ +#define NXFONT_METRICS_115 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_115 {0x0, 0x0, 0x0, 0x30, 0x60, 0x10, 0x60, 0x0} + +/* t (116) */ +#define NXFONT_METRICS_116 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_116 {0x0, 0x40, 0x40, 0xe0, 0x40, 0x50, 0x20, 0x0} + +/* u (117) */ +#define NXFONT_METRICS_117 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_117 {0x0, 0x0, 0x0, 0x90, 0x90, 0x90, 0x70, 0x0} + +/* v (118) */ +#define NXFONT_METRICS_118 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_118 {0x0, 0x0, 0x0, 0x50, 0x50, 0x50, 0x20, 0x0} + +/* w (119) */ +#define NXFONT_METRICS_119 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_119 {0x0, 0x0, 0x0, 0x88, 0xa8, 0xa8, 0x50, 0x0} + +/* x (120) */ +#define NXFONT_METRICS_120 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_120 {0x0, 0x0, 0x0, 0x90, 0x60, 0x60, 0x90, 0x0} + +/* y (121) */ +#define NXFONT_METRICS_121 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_121 {0x0, 0x0, 0x0, 0x90, 0x90, 0x70, 0x90, 0x60} + +/* z (122) */ +#define NXFONT_METRICS_122 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_122 {0x0, 0x0, 0x0, 0xf0, 0x20, 0x40, 0xf0, 0x0} + +/* braceleft (123) */ +#define NXFONT_METRICS_123 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_123 {0x30, 0x40, 0x20, 0xc0, 0x20, 0x40, 0x30, 0x0} + +/* bar (124) */ +#define NXFONT_METRICS_124 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_124 {0x0, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x0} + +/* braceright (125) */ +#define NXFONT_METRICS_125 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_125 {0xc0, 0x20, 0x40, 0x30, 0x40, 0x20, 0xc0, 0x0} + +/* asciitilde (126) */ +#define NXFONT_METRICS_126 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_126 {0x0, 0x50, 0xa0, 0x0, 0x0, 0x0, 0x0, 0x0} + +/* exclamdown (161) */ +#define NXFONT_METRICS_161 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_161 {0x0, 0x20, 0x0, 0x20, 0x20, 0x20, 0x20, 0x0} + +/* cent (162) */ +#define NXFONT_METRICS_162 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_162 {0x0, 0x0, 0x20, 0x70, 0xa0, 0xa0, 0x70, 0x20} + +/* sterling (163) */ +#define NXFONT_METRICS_163 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_163 {0x0, 0x20, 0x50, 0xe0, 0x40, 0x50, 0xa0, 0x0} + +/* currency (164) */ +#define NXFONT_METRICS_164 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_164 {0x0, 0x0, 0x88, 0x70, 0x50, 0x70, 0x88, 0x0} + +/* yen (165) */ +#define NXFONT_METRICS_165 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_165 {0x0, 0x88, 0x50, 0xf8, 0x20, 0xf8, 0x20, 0x0} + +/* brokenbar (166) */ +#define NXFONT_METRICS_166 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_166 {0x20, 0x20, 0x20, 0x0, 0x20, 0x20, 0x20, 0x0} + +/* section (167) */ +#define NXFONT_METRICS_167 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_167 {0x70, 0x80, 0xe0, 0x90, 0x70, 0x10, 0xe0, 0x0} + +/* dieresis (168) */ +#define NXFONT_METRICS_168 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_168 {0x0, 0x50, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0} + +/* copyright (169) */ +#define NXFONT_METRICS_169 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_169 {0x0, 0x70, 0xa8, 0xc8, 0xc8, 0xa8, 0x70, 0x0} + +/* ordfeminine (170) */ +#define NXFONT_METRICS_170 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_170 {0x30, 0x50, 0x30, 0x0, 0x70, 0x0, 0x0, 0x0} + +/* guillemotleft (171) */ +#define NXFONT_METRICS_171 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_171 {0x0, 0x0, 0x0, 0x50, 0xa0, 0x50, 0x0, 0x0} + +/* logicalnot (172) */ +#define NXFONT_METRICS_172 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_172 {0x0, 0x0, 0x0, 0x0, 0x70, 0x10, 0x10, 0x0} + +/* hyphen (173) */ +#define NXFONT_METRICS_173 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_173 {0x0, 0x0, 0x0, 0x0, 0x70, 0x0, 0x0, 0x0} + +/* registered (174) */ +#define NXFONT_METRICS_174 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_174 {0x0, 0x70, 0xe8, 0xd8, 0xe8, 0xd8, 0x70, 0x0} + +/* macron (175) */ +#define NXFONT_METRICS_175 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_175 {0x0, 0x70, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0} + +/* degree (176) */ +#define NXFONT_METRICS_176 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_176 {0x0, 0x20, 0x50, 0x20, 0x0, 0x0, 0x0, 0x0} + +/* plusminus (177) */ +#define NXFONT_METRICS_177 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_177 {0x0, 0x0, 0x20, 0x70, 0x20, 0x0, 0x70, 0x0} + +/* twosuperior (178) */ +#define NXFONT_METRICS_178 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_178 {0x20, 0x50, 0x10, 0x20, 0x70, 0x0, 0x0, 0x0} + +/* threesuperior (179) */ +#define NXFONT_METRICS_179 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_179 {0x60, 0x10, 0x60, 0x10, 0x60, 0x0, 0x0, 0x0} + +/* acute (180) */ +#define NXFONT_METRICS_180 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_180 {0x0, 0x20, 0x40, 0x0, 0x0, 0x0, 0x0, 0x0} + +/* mu (181) */ +#define NXFONT_METRICS_181 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_181 {0x0, 0x0, 0x0, 0x90, 0x90, 0x90, 0xe0, 0x80} + +/* paragraph (182) */ +#define NXFONT_METRICS_182 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_182 {0x0, 0x78, 0xe8, 0xe8, 0x68, 0x28, 0x28, 0x0} + +/* periodcentered (183) */ +#define NXFONT_METRICS_183 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_183 {0x0, 0x0, 0x0, 0x0, 0x20, 0x0, 0x0, 0x0} + +/* cedilla (184) */ +#define NXFONT_METRICS_184 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_184 {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x20, 0x40} + +/* onesuperior (185) */ +#define NXFONT_METRICS_185 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_185 {0x20, 0x60, 0x20, 0x20, 0x70, 0x0, 0x0, 0x0} + +/* ordmasculine (186) */ +#define NXFONT_METRICS_186 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_186 {0x20, 0x50, 0x20, 0x0, 0x70, 0x0, 0x0, 0x0} + +/* guillemotright (187) */ +#define NXFONT_METRICS_187 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_187 {0x0, 0x0, 0x0, 0xa0, 0x50, 0xa0, 0x0, 0x0} + +/* onequarter (188) */ +#define NXFONT_METRICS_188 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_188 {0x80, 0x80, 0x80, 0xa0, 0x60, 0xf0, 0x20, 0x0} + +/* onehalf (189) */ +#define NXFONT_METRICS_189 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_189 {0x80, 0x80, 0xa0, 0xd0, 0x10, 0x20, 0x70, 0x0} + +/* threequarters (190) */ +#define NXFONT_METRICS_190 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_190 {0x80, 0x40, 0x80, 0x60, 0xa0, 0xf0, 0x20, 0x0} + +/* questiondown (191) */ +#define NXFONT_METRICS_191 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_191 {0x0, 0x20, 0x0, 0x20, 0x40, 0x50, 0x20, 0x0} + +/* Agrave (192) */ +#define NXFONT_METRICS_192 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_192 {0x40, 0x20, 0x60, 0x90, 0xf0, 0x90, 0x90, 0x0} + +/* Aacute (193) */ +#define NXFONT_METRICS_193 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_193 {0x20, 0x40, 0x60, 0x90, 0xf0, 0x90, 0x90, 0x0} + +/* Acircumflex (194) */ +#define NXFONT_METRICS_194 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_194 {0x60, 0x90, 0x60, 0x90, 0xf0, 0x90, 0x90, 0x0} + +/* Atilde (195) */ +#define NXFONT_METRICS_195 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_195 {0x50, 0xa0, 0x60, 0x90, 0xf0, 0x90, 0x90, 0x0} + +/* Adieresis (196) */ +#define NXFONT_METRICS_196 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_196 {0x90, 0x0, 0x60, 0x90, 0xf0, 0x90, 0x90, 0x0} + +/* Aring (197) */ +#define NXFONT_METRICS_197 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_197 {0x60, 0x90, 0x60, 0x90, 0xf0, 0x90, 0x90, 0x0} + +/* AE (198) */ +#define NXFONT_METRICS_198 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_198 {0x0, 0x70, 0xa0, 0xa0, 0xf0, 0xa0, 0xb0, 0x0} + +/* Ccedilla (199) */ +#define NXFONT_METRICS_199 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_199 {0x0, 0x60, 0x90, 0x80, 0x80, 0x90, 0x60, 0x40} + +/* Egrave (200) */ +#define NXFONT_METRICS_200 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_200 {0x40, 0x20, 0xf0, 0x80, 0xe0, 0x80, 0xf0, 0x0} + +/* Eacute (201) */ +#define NXFONT_METRICS_201 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_201 {0x20, 0x40, 0xf0, 0x80, 0xe0, 0x80, 0xf0, 0x0} + +/* Ecircumflex (202) */ +#define NXFONT_METRICS_202 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_202 {0x60, 0x90, 0xf0, 0x80, 0xe0, 0x80, 0xf0, 0x0} + +/* Edieresis (203) */ +#define NXFONT_METRICS_203 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_203 {0x90, 0x0, 0xf0, 0x80, 0xe0, 0x80, 0xf0, 0x0} + +/* Igrave (204) */ +#define NXFONT_METRICS_204 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_204 {0x40, 0x20, 0x70, 0x20, 0x20, 0x20, 0x70, 0x0} + +/* Iacute (205) */ +#define NXFONT_METRICS_205 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_205 {0x10, 0x20, 0x70, 0x20, 0x20, 0x20, 0x70, 0x0} + +/* Icircumflex (206) */ +#define NXFONT_METRICS_206 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_206 {0x20, 0x50, 0x70, 0x20, 0x20, 0x20, 0x70, 0x0} + +/* Idieresis (207) */ +#define NXFONT_METRICS_207 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_207 {0x50, 0x0, 0x70, 0x20, 0x20, 0x20, 0x70, 0x0} + +/* Eth (208) */ +#define NXFONT_METRICS_208 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_208 {0x0, 0x70, 0x48, 0xe8, 0x48, 0x48, 0x70, 0x0} + +/* Ntilde (209) */ +#define NXFONT_METRICS_209 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_209 {0x50, 0xa0, 0x90, 0xd0, 0xb0, 0x90, 0x90, 0x0} + +/* Ograve (210) */ +#define NXFONT_METRICS_210 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_210 {0x40, 0x20, 0x60, 0x90, 0x90, 0x90, 0x60, 0x0} + +/* Oacute (211) */ +#define NXFONT_METRICS_211 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_211 {0x20, 0x40, 0x60, 0x90, 0x90, 0x90, 0x60, 0x0} + +/* Ocircumflex (212) */ +#define NXFONT_METRICS_212 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_212 {0x60, 0x90, 0x60, 0x90, 0x90, 0x90, 0x60, 0x0} + +/* Otilde (213) */ +#define NXFONT_METRICS_213 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_213 {0x50, 0xa0, 0x60, 0x90, 0x90, 0x90, 0x60, 0x0} + +/* Odieresis (214) */ +#define NXFONT_METRICS_214 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_214 {0x90, 0x0, 0x60, 0x90, 0x90, 0x90, 0x60, 0x0} + +/* multiply (215) */ +#define NXFONT_METRICS_215 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_215 {0x0, 0x0, 0x0, 0x0, 0x50, 0x20, 0x50, 0x0} + +/* Oslash (216) */ +#define NXFONT_METRICS_216 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_216 {0x0, 0x70, 0xb0, 0xb0, 0xd0, 0xd0, 0xe0, 0x0} + +/* Ugrave (217) */ +#define NXFONT_METRICS_217 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_217 {0x40, 0x20, 0x90, 0x90, 0x90, 0x90, 0x60, 0x0} + +/* Uacute (218) */ +#define NXFONT_METRICS_218 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_218 {0x20, 0x40, 0x90, 0x90, 0x90, 0x90, 0x60, 0x0} + +/* Ucircumflex (219) */ +#define NXFONT_METRICS_219 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_219 {0x60, 0x90, 0x90, 0x90, 0x90, 0x90, 0x60, 0x0} + +/* Udieresis (220) */ +#define NXFONT_METRICS_220 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_220 {0x90, 0x0, 0x90, 0x90, 0x90, 0x90, 0x60, 0x0} + +/* Yacute (221) */ +#define NXFONT_METRICS_221 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_221 {0x10, 0x20, 0x88, 0x50, 0x20, 0x20, 0x20, 0x0} + +/* Thorn (222) */ +#define NXFONT_METRICS_222 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_222 {0x0, 0x80, 0xe0, 0x90, 0x90, 0xe0, 0x80, 0x0} + +/* germandbls (223) */ +#define NXFONT_METRICS_223 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_223 {0x0, 0x60, 0x90, 0xa0, 0xa0, 0x90, 0xa0, 0x0} + +/* agrave (224) */ +#define NXFONT_METRICS_224 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_224 {0x40, 0x20, 0x0, 0x70, 0x90, 0x90, 0x70, 0x0} + +/* aacute (225) */ +#define NXFONT_METRICS_225 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_225 {0x20, 0x40, 0x0, 0x70, 0x90, 0x90, 0x70, 0x0} + +/* acircumflex (226) */ +#define NXFONT_METRICS_226 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_226 {0x20, 0x50, 0x0, 0x70, 0x90, 0x90, 0x70, 0x0} + +/* atilde (227) */ +#define NXFONT_METRICS_227 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_227 {0x50, 0xa0, 0x0, 0x70, 0x90, 0x90, 0x70, 0x0} + +/* adieresis (228) */ +#define NXFONT_METRICS_228 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_228 {0x0, 0x50, 0x0, 0x70, 0x90, 0x90, 0x70, 0x0} + +/* aring (229) */ +#define NXFONT_METRICS_229 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_229 {0x60, 0x90, 0x60, 0x70, 0x90, 0x90, 0x70, 0x0} + +/* ae (230) */ +#define NXFONT_METRICS_230 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_230 {0x0, 0x0, 0x0, 0xf0, 0x68, 0xb0, 0x78, 0x0} + +/* ccedilla (231) */ +#define NXFONT_METRICS_231 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_231 {0x0, 0x0, 0x0, 0x30, 0x40, 0x40, 0x30, 0x20} + +/* egrave (232) */ +#define NXFONT_METRICS_232 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_232 {0x40, 0x20, 0x0, 0x60, 0xb0, 0xc0, 0x60, 0x0} + +/* eacute (233) */ +#define NXFONT_METRICS_233 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_233 {0x20, 0x40, 0x0, 0x60, 0xb0, 0xc0, 0x60, 0x0} + +/* ecircumflex (234) */ +#define NXFONT_METRICS_234 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_234 {0x60, 0x90, 0x0, 0x60, 0xb0, 0xc0, 0x60, 0x0} + +/* edieresis (235) */ +#define NXFONT_METRICS_235 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_235 {0x0, 0x50, 0x0, 0x60, 0xb0, 0xc0, 0x60, 0x0} + +/* igrave (236) */ +#define NXFONT_METRICS_236 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_236 {0x40, 0x20, 0x0, 0x60, 0x20, 0x20, 0x70, 0x0} + +/* iacute (237) */ +#define NXFONT_METRICS_237 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_237 {0x10, 0x20, 0x0, 0x60, 0x20, 0x20, 0x70, 0x0} + +/* icircumflex (238) */ +#define NXFONT_METRICS_238 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_238 {0x20, 0x50, 0x0, 0x60, 0x20, 0x20, 0x70, 0x0} + +/* idieresis (239) */ +#define NXFONT_METRICS_239 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_239 {0x0, 0x50, 0x0, 0x60, 0x20, 0x20, 0x70, 0x0} + +/* eth (240) */ +#define NXFONT_METRICS_240 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_240 {0xa0, 0x40, 0xa0, 0x10, 0x70, 0x90, 0x60, 0x0} + +/* ntilde (241) */ +#define NXFONT_METRICS_241 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_241 {0x50, 0xa0, 0x0, 0xe0, 0x90, 0x90, 0x90, 0x0} + +/* ograve (242) */ +#define NXFONT_METRICS_242 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_242 {0x40, 0x20, 0x0, 0x60, 0x90, 0x90, 0x60, 0x0} + +/* oacute (243) */ +#define NXFONT_METRICS_243 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_243 {0x20, 0x40, 0x0, 0x60, 0x90, 0x90, 0x60, 0x0} + +/* ocircumflex (244) */ +#define NXFONT_METRICS_244 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_244 {0x60, 0x90, 0x0, 0x60, 0x90, 0x90, 0x60, 0x0} + +/* otilde (245) */ +#define NXFONT_METRICS_245 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_245 {0x50, 0xa0, 0x0, 0x60, 0x90, 0x90, 0x60, 0x0} + +/* odieresis (246) */ +#define NXFONT_METRICS_246 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_246 {0x0, 0x90, 0x0, 0x60, 0x90, 0x90, 0x60, 0x0} + +/* divide (247) */ +#define NXFONT_METRICS_247 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_247 {0x0, 0x0, 0x20, 0x0, 0x70, 0x0, 0x20, 0x0} + +/* oslash (248) */ +#define NXFONT_METRICS_248 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_248 {0x0, 0x0, 0x0, 0x70, 0xb0, 0xd0, 0xe0, 0x0} + +/* ugrave (249) */ +#define NXFONT_METRICS_249 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_249 {0x40, 0x20, 0x0, 0x90, 0x90, 0x90, 0x70, 0x0} + +/* uacute (250) */ +#define NXFONT_METRICS_250 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_250 {0x20, 0x40, 0x0, 0x90, 0x90, 0x90, 0x70, 0x0} + +/* ucircumflex (251) */ +#define NXFONT_METRICS_251 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_251 {0x60, 0x90, 0x0, 0x90, 0x90, 0x90, 0x70, 0x0} + +/* udieresis (252) */ +#define NXFONT_METRICS_252 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_252 {0x0, 0x90, 0x0, 0x90, 0x90, 0x90, 0x70, 0x0} + +/* yacute (253) */ +#define NXFONT_METRICS_253 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_253 {0x20, 0x40, 0x0, 0x90, 0x90, 0x70, 0x90, 0x60} + +/* thorn (254) */ +#define NXFONT_METRICS_254 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_254 {0x0, 0x80, 0x80, 0xe0, 0x90, 0xe0, 0x80, 0x80} + +/* ydieresis (255) */ +#define NXFONT_METRICS_255 {1, 5, 8, 0, 0, 0} +#define NXFONT_BITMAP_255 {0x0, 0x90, 0x0, 0x90, 0x90, 0x70, 0x90, 0x60} + +#endif diff --git a/nuttx/include/nuttx/nx/nxfonts.h b/nuttx/include/nuttx/nx/nxfonts.h index f1aecb9e5a..8e7289b2a6 100644 --- a/nuttx/include/nuttx/nx/nxfonts.h +++ b/nuttx/include/nuttx/nx/nxfonts.h @@ -125,6 +125,12 @@ enum nx_fontid_e { FONTID_DEFAULT = 0 /* The default font */ +/* Monospace fonts */ + +#ifdef CONFIG_NXFONT_MONO5X8 + , FONTID_MONO5X8 = 18 /* The 5x8 monospace font */ +#endif + /* Sans Serif fonts */ #ifdef CONFIG_NXFONT_SANS17X22 diff --git a/nuttx/include/pthread.h b/nuttx/include/pthread.h index 5a08f13b61..5066275b41 100644 --- a/nuttx/include/pthread.h +++ b/nuttx/include/pthread.h @@ -41,15 +41,15 @@ ********************************************************************************/ #include /* Default settings */ -#include /* Compiler settings */ +#include /* Compiler settings, noreturn_function */ #include /* Needed for general types */ #include /* C99 fixed width integer types */ #include /* C99 boolean types */ +#include /* For getpid */ #include /* Needed for sem_t */ #include /* Needed for sigset_t */ #include /* Needed for struct timespec */ -#include /* For noreturn_function */ /******************************************************************************** * Compilation Switches diff --git a/nuttx/include/stdbool.h b/nuttx/include/stdbool.h index 9c16aee293..6c33025493 100644 --- a/nuttx/include/stdbool.h +++ b/nuttx/include/stdbool.h @@ -90,8 +90,8 @@ # define bool _Bool8 #endif -#define true 1 -#define false 0 +#define true (bool)1 +#define false (bool)0 #define __bool_true_false_are_defined 1 diff --git a/nuttx/tools/bdf-converter.c b/nuttx/tools/bdf-converter.c index b32209fcf6..a03faa93e7 100644 --- a/nuttx/tools/bdf-converter.c +++ b/nuttx/tools/bdf-converter.c @@ -43,6 +43,7 @@ * Included Files ****************************************************************************/ +#include #include #include #include From 247ad37c4bd0c27e3cf358df30fa29517f033260 Mon Sep 17 00:00:00 2001 From: patacongo Date: Fri, 21 Dec 2012 21:30:33 +0000 Subject: [PATCH 002/118] configs/sim/nxwm now uses kconfig-frontends git-svn-id: http://svn.code.sf.net/p/nuttx/code/trunk@5449 42af7a65-404d-4744-a932-0658087f49c3 --- nuttx/ChangeLog | 7 +- nuttx/arch/sim/Kconfig | 2 +- nuttx/configs/sim/README.txt | 81 +-- nuttx/configs/sim/nxwm/appconfig | 40 -- nuttx/configs/sim/nxwm/defconfig | 860 +++++++++++++++++++++---------- nuttx/include/pthread.h | 148 +++--- 6 files changed, 707 insertions(+), 431 deletions(-) delete mode 100644 nuttx/configs/sim/nxwm/appconfig diff --git a/nuttx/ChangeLog b/nuttx/ChangeLog index c4a06af5e9..04f180a8b1 100644 --- a/nuttx/ChangeLog +++ b/nuttx/ChangeLog @@ -3805,6 +3805,9 @@ * graphics/: Adds 5x8 monospace font. This tiny font is useful for graph labels and for small bitmapped display. Contributed by Petteri Aimonen. - * configs/stm3220g-eval/nxwm: Converted to use the kconfig-fronteds + * configs/stm3220g-eval/nxwm: Converted to use the kconfig-frontends configuration tool. - + * configs/sim/nxwm: Converted to use the kconfig-frontends configuration + tool. + * include/pthread.h: In sys/prctl.h because it is needed by + pthread_[set|get]name_np() diff --git a/nuttx/arch/sim/Kconfig b/nuttx/arch/sim/Kconfig index 331f61c79e..dc3a85b549 100644 --- a/nuttx/arch/sim/Kconfig +++ b/nuttx/arch/sim/Kconfig @@ -50,7 +50,7 @@ config SIM_FRAMEBUFFER config SIM_X11FB bool "Use X11 window" default n - depends on NX && FB_CMAP + depends on NX ---help--- Use an X11 graphics window to simulate the graphics device" diff --git a/nuttx/configs/sim/README.txt b/nuttx/configs/sim/README.txt index 032bb39b87..f1dfd0dd22 100644 --- a/nuttx/configs/sim/README.txt +++ b/nuttx/configs/sim/README.txt @@ -461,46 +461,57 @@ nxwm nuttx-code/NxWidgets/UnitTests/READEM.txt - NOTE: There is an issue with running this example under the - simulation. In the default configuration, this example will - run the NxConsole example which waits on readline() for console - intput. When it calls readline(), the whole system blocks - waiting from input from the host OS. So, in order to get - this example to run, you must comment out the readline call in - apps/nshlib/nsh_consolemain.c like: + NOTES + ----- + 1. This configuration uses the mconf-based configuration tool. To + change this configuration using that tool, you should: - Index: nsh_consolemain.c - =================================================================== - --- nsh_consolemain.c (revision 4681) - +++ nsh_consolemain.c (working copy) - @@ -117,7 +117,8 @@ - /* Execute the startup script */ + a. Build and install the mconf tool. See nuttx/README.txt and + misc/tools/ + + b. Execute 'make menuconfig' in nuttx/ in order to start the + reconfiguration process. + + 2. There is an issue with running this example under the + simulation. In the default configuration, this example will + run the NxConsole example which waits on readline() for console + input. When it calls readline(), the whole system blocks + waiting from input from the host OS. So, in order to get + this example to run, you must comment out the readline call in + apps/nshlib/nsh_consolemain.c like: + + Index: nsh_consolemain.c + =================================================================== + --- nsh_consolemain.c (revision 4681) + +++ nsh_consolemain.c (working copy) + @@ -117,7 +117,8 @@ + /* Execute the startup script */ - #ifdef CONFIG_NSH_ROMFSETC - - (void)nsh_script(&pstate->cn_vtbl, "init", NSH_INITPATH); - +// REMOVE ME - +// (void)nsh_script(&pstate->cn_vtbl, "init", NSH_INITPATH); - #endif + #ifdef CONFIG_NSH_ROMFSETC + - (void)nsh_script(&pstate->cn_vtbl, "init", NSH_INITPATH); + +// REMOVE ME + +// (void)nsh_script(&pstate->cn_vtbl, "init", NSH_INITPATH); + #endif - /* Then enter the command line parsing loop */ - @@ -130,7 +131,8 @@ - fflush(pstate->cn_outstream); + /* Then enter the command line parsing loop */ + @@ -130,7 +131,8 @@ + fflush(pstate->cn_outstream); - /* Get the next line of input */ - - - +sleep(2); // REMOVE ME - +#if 0 // REMOVE ME - ret = readline(pstate->cn_line, CONFIG_NSH_LINELEN, - INSTREAM(pstate), OUTSTREAM(pstate)); - if (ret > 0) - @@ -153,6 +155,7 @@ - "readline", NSH_ERRNO_OF(-ret)); - nsh_exit(&pstate->cn_vtbl, 1); - } - +#endif // REMOVE ME - } + /* Get the next line of input */ + - + +sleep(2); // REMOVE ME + +#if 0 // REMOVE ME + ret = readline(pstate->cn_line, CONFIG_NSH_LINELEN, + INSTREAM(pstate), OUTSTREAM(pstate)); + if (ret > 0) + @@ -153,6 +155,7 @@ + "readline", NSH_ERRNO_OF(-ret)); + nsh_exit(&pstate->cn_vtbl, 1); + } + +#endif // REMOVE ME + } - /* Clean up */ + /* Clean up */ ostest diff --git a/nuttx/configs/sim/nxwm/appconfig b/nuttx/configs/sim/nxwm/appconfig deleted file mode 100644 index 47c290dfeb..0000000000 --- a/nuttx/configs/sim/nxwm/appconfig +++ /dev/null @@ -1,40 +0,0 @@ -############################################################################ -# configs/sim/nxwm/appconfig -# -# Copyright (C) 2012 Gregory Nutt. All rights reserved. -# Author: Gregory Nutt -# -# 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. -# -############################################################################ - -# The NSH Library - -CONFIGURED_APPS += system/readline -CONFIGURED_APPS += nshlib - diff --git a/nuttx/configs/sim/nxwm/defconfig b/nuttx/configs/sim/nxwm/defconfig index 161322da8c..6a295ef4f2 100644 --- a/nuttx/configs/sim/nxwm/defconfig +++ b/nuttx/configs/sim/nxwm/defconfig @@ -1,159 +1,150 @@ -############################################################################ -# sim/nxwm/defconfig # -# Copyright (C) 2012 Gregory Nutt. All rights reserved. -# Author: Gregory Nutt +# Automatically generated file; DO NOT EDIT. +# Nuttx/ Configuration # -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: +CONFIG_NUTTX_NEWCONFIG=y + # -# 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. +# Build Setup # -# 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. +# CONFIG_EXPERIMENTAL is not set +CONFIG_HOST_LINUX=y +# CONFIG_HOST_OSX is not set +# CONFIG_HOST_WINDOWS is not set +# CONFIG_HOST_OTHER is not set + # -############################################################################ +# Build Configuration # -# Architecture selection +# CONFIG_APPS_DIR="../apps" +# CONFIG_BUILD_2PASS is not set + # -CONFIG_ARCH="sim" +# Binary Output Formats +# +# CONFIG_RRLOAD_BINARY is not set +# CONFIG_INTELHEX_BINARY is not set +# CONFIG_MOTOROLA_SREC is not set +# CONFIG_RAW_BINARY is not set + +# +# Customize Header Files +# +# CONFIG_ARCH_STDBOOL_H is not set +# CONFIG_ARCH_MATH_H is not set +# CONFIG_ARCH_FLOAT_H is not set +# CONFIG_ARCH_STDARG_H is not set + +# +# Debug Options +# +# CONFIG_DEBUG is not set +CONFIG_DEBUG_SYMBOLS=y + +# +# System Type +# +# CONFIG_ARCH_8051 is not set +# CONFIG_ARCH_ARM is not set +# CONFIG_ARCH_AVR is not set +# CONFIG_ARCH_HC is not set +# CONFIG_ARCH_MIPS is not set +# CONFIG_ARCH_RGMP is not set +# CONFIG_ARCH_SH is not set CONFIG_ARCH_SIM=y -CONFIG_ARCH_BOARD="sim" -CONFIG_ARCH_BOARD_SIM=y +# CONFIG_ARCH_X86 is not set +# CONFIG_ARCH_Z16 is not set +# CONFIG_ARCH_Z80 is not set +CONFIG_ARCH="sim" +CONFIG_BOARD_LOOPSPERMSEC= # -# Framebuffer driver options -# -CONFIG_FB_CMAP=n -CONFIG_FB_HWCURSOR=n -CONFIG_FB_HWCURSORIMAGE=n -#CONFIG_FB_HWCURSORSIZE -#CONFIG_FB_TRANSPARENCY - -# -# Simulated framebuffer configuration +# Simulation Configuration Options # +# CONFIG_SIM_M32 is not set +# CONFIG_SIM_WALLTIME is not set +CONFIG_SIM_FRAMEBUFFER=y CONFIG_SIM_X11FB=y -CONFIG_SIM_FBWIDTH=480 +# CONFIG_SIM_X11NOSHM is not set CONFIG_SIM_FBHEIGHT=240 +CONFIG_SIM_FBWIDTH=480 CONFIG_SIM_FBBPP=32 # -# Simulated touchscreen configuration -# (Set both of the following to 'y' to enable) +# Architecture Options # -CONFIG_INPUT=n -CONFIG_SIM_TOUCHSCREEN=n +# CONFIG_ARCH_NOINTC is not set +# CONFIG_ARCH_DMA is not set +# CONFIG_ARCH_IRQPRIO is not set +# CONFIG_CUSTOM_STACK is not set +# CONFIG_ADDRENV is not set +# CONFIG_ARCH_STACKDUMP is not set +# CONFIG_ENDIAN_BIG is not set # -# General OS setup +# Board Settings # -CONFIG_USER_ENTRYPOINT="nxwm_main" -CONFIG_DEBUG=n -CONFIG_DEBUG_VERBOSE=n -CONFIG_DEBUG_SYMBOLS=y -CONFIG_DEBUG_GRAPHICS=n -CONFIG_HAVE_CXX=y -CONFIG_HAVE_CXXINITIALIZE=n -CONFIG_MM_REGIONS=1 -CONFIG_ARCH_LOWPUTC=y +CONFIG_DRAM_START= +CONFIG_DRAM_SIZE= + +# +# Boot options +# +# CONFIG_BOOT_RUNFROMEXTSRAM is not set +CONFIG_BOOT_RUNFROMFLASH=y +# CONFIG_BOOT_RUNFROMISRAM is not set +# CONFIG_BOOT_RUNFROMSDRAM is not set +# CONFIG_BOOT_COPYTORAM is not set + +# +# Board Selection +# +CONFIG_ARCH_BOARD_SIM=y +# CONFIG_ARCH_BOARD_CUSTOM is not set +CONFIG_ARCH_BOARD="sim" + +# +# Common Board Options +# +CONFIG_NSH_MMCSDMINOR=0 + +# +# Board-Specific Options +# + +# +# RTOS Features +# +CONFIG_MSEC_PER_TICK=10 CONFIG_RR_INTERVAL=0 -CONFIG_SCHED_INSTRUMENTATION=n +# CONFIG_SCHED_INSTRUMENTATION is not set CONFIG_TASK_NAME_SIZE=32 +# CONFIG_JULIAN_TIME is not set CONFIG_START_YEAR=2012 CONFIG_START_MONTH=5 CONFIG_START_DAY=1 -CONFIG_JULIAN_TIME=n CONFIG_DEV_CONSOLE=y -CONFIG_DEV_LOWCONSOLE=n -CONFIG_MUTEX_TYPES=n -CONFIG_PRIORITY_INHERITANCE=n -CONFIG_SEM_PREALLOCHOLDERS=0 -CONFIG_SEM_NNESTPRIO=0 -CONFIG_FDCLONE_DISABLE=n -CONFIG_FDCLONE_STDIO=n +# CONFIG_MUTEX_TYPES is not set +# CONFIG_PRIORITY_INHERITANCE is not set +# CONFIG_FDCLONE_DISABLE is not set +# CONFIG_FDCLONE_STDIO is not set CONFIG_SDCLONE_DISABLE=y -CONFIG_SIG_SIGWORK=4 -CONFIG_SCHED_WORKQUEUE=n -CONFIG_SCHED_WORKPRIORITY=192 -CONFIG_SCHED_WORKPERIOD=50000 -CONFIG_SCHED_WORKSTACKSIZE=8192 +# CONFIG_SCHED_WORKQUEUE is not set CONFIG_SCHED_WAITPID=y -CONFIG_SCHED_ATEXIT=n +# CONFIG_SCHED_ATEXIT is not set CONFIG_SCHED_ONEXIT=y - -# -# The following can be used to disable categories of -# APIs supported by the OS. If the compiler supports -# weak functions, then it should not be necessary to -# disable functions unless you want to restrict usage -# of those APIs. -# -# There are certain dependency relationships in these -# features. -# -# o mq_notify logic depends on signals to awaken tasks -# waiting for queues to become full or empty. -# o pthread_condtimedwait() depends on signals to wake -# up waiting tasks. -# -CONFIG_DISABLE_CLOCK=n +CONFIG_SCHED_ONEXIT_MAX=1 +CONFIG_USER_ENTRYPOINT="nxwm_main" +CONFIG_DISABLE_OS_API=y +# CONFIG_DISABLE_CLOCK is not set CONFIG_DISABLE_POSIX_TIMERS=y -CONFIG_DISABLE_PTHREAD=n -CONFIG_DISABLE_SIGNALS=n -CONFIG_DISABLE_MQUEUE=n -CONFIG_DISABLE_MOUNTPOINT=n -CONFIG_DISABLE_ENVIRON=n +# CONFIG_DISABLE_PTHREAD is not set +# CONFIG_DISABLE_SIGNALS is not set +# CONFIG_DISABLE_MQUEUE is not set +# CONFIG_DISABLE_MOUNTPOINT is not set +# CONFIG_DISABLE_ENVIRON is not set CONFIG_DISABLE_POLL=y -# -# Misc libc settings -# -CONFIG_NOPRINTF_FIELDWIDTH=n - -# -# Allow for architecture optimized implementations -# -# The architecture can provide optimized versions of the -# following to improve sysem performance -# -CONFIG_ARCH_MEMCPY=n -CONFIG_ARCH_MEMCMP=n -CONFIG_ARCH_MEMMOVE=n -CONFIG_ARCH_MEMSET=n -CONFIG_ARCH_STRCMP=n -CONFIG_ARCH_STRCPY=n -CONFIG_ARCH_STRNCPY=n -CONFIG_ARCH_STRLEN=n -CONFIG_ARCH_STRNLEN=n -CONFIG_ARCH_BZERO=n - -# -# General build options -# -CONFIG_RRLOAD_BINARY=n -CONFIG_INTELHEX_BINARY=n -CONFIG_RAW_BINARY=n - # # Sizes of configurable things (0 disables) # @@ -163,9 +154,6 @@ CONFIG_NPTHREAD_KEYS=4 CONFIG_NFILE_DESCRIPTORS=16 CONFIG_NFILE_STREAMS=16 CONFIG_NAME_MAX=32 -CONFIG_STDIO_BUFFER_SIZE=256 -CONFIG_STDIO_LINEBUFFER=y -CONFIG_NUNGET_CHARS=2 CONFIG_PREALLOC_MQ_MSGS=32 CONFIG_MQ_MAXMSGSIZE=48 CONFIG_MAX_WDOGPARMS=4 @@ -173,156 +161,371 @@ CONFIG_PREALLOC_WDOGS=32 CONFIG_PREALLOC_TIMERS=8 # -# Filesystem configuration +# Stack and heap information +# +CONFIG_IDLETHREAD_STACKSIZE=8192 +CONFIG_USERMAIN_STACKSIZE=8192 +CONFIG_PTHREAD_STACK_MIN=256 +CONFIG_PTHREAD_STACK_DEFAULT=8192 + +# +# Device Drivers +# +CONFIG_DEV_NULL=y +# CONFIG_DEV_ZERO is not set +# CONFIG_LOOP is not set +# CONFIG_RAMDISK is not set +# CONFIG_CAN is not set +# CONFIG_PWM is not set +# CONFIG_I2C is not set +# CONFIG_SPI is not set +# CONFIG_RTC is not set +# CONFIG_WATCHDOG is not set +# CONFIG_ANALOG is not set +# CONFIG_BCH is not set +# CONFIG_INPUT is not set +# CONFIG_LCD is not set +# CONFIG_MMCSD is not set +# CONFIG_MTD is not set +# CONFIG_PIPES is not set +# CONFIG_PM is not set +# CONFIG_POWER is not set +# CONFIG_SENSORS is not set +# CONFIG_SERCOMM_CONSOLE is not set +CONFIG_SERIAL=y +# CONFIG_DEV_LOWCONSOLE is not set +# CONFIG_16550_UART is not set +# CONFIG_STANDARD_SERIAL is not set +# CONFIG_USBDEV is not set +# CONFIG_USBHOST is not set +# CONFIG_WIRELESS is not set + +# +# System Logging Device Options +# + +# +# System Logging +# +# CONFIG_RAMLOG is not set + +# +# Networking Support +# +# CONFIG_NET is not set + +# +# File Systems +# + +# +# File system configuration # CONFIG_FS_FAT=y CONFIG_FAT_LCNAMES=y CONFIG_FAT_LFN=y CONFIG_FAT_MAXFNAME=32 -CONFIG_FS_NXFFS=n +# CONFIG_FS_FATTIME is not set +# CONFIG_FAT_DMAMEMORY is not set +# CONFIG_FS_RAMMAP is not set +# CONFIG_FS_NXFFS is not set CONFIG_FS_ROMFS=y # -# TCP/IP and UDP support via uIP +# System Logging # -CONFIG_NET=n -CONFIG_NET_IPv6=n -CONFIG_NSOCKET_DESCRIPTORS=0 -CONFIG_NET_SOCKOPTS=y -CONFIG_NET_BUFSIZE=420 -CONFIG_NET_TCP=n -CONFIG_NET_TCP_CONNS=40 -CONFIG_NET_MAX_LISTENPORTS=40 -CONFIG_NET_UDP=n -CONFIG_NET_UDP_CHECKSUMS=y -#CONFIG_NET_UDP_CONNS=10 -CONFIG_NET_ICMP=n -CONFIG_NET_ICMP_PING=n -#CONFIG_NET_PINGADDRCONF=0 -CONFIG_NET_STATISTICS=y -#CONFIG_NET_RECEIVE_WINDOW= -#CONFIG_NET_ARPTAB_SIZE=8 -CONFIG_NET_BROADCAST=n +# CONFIG_SYSLOG is not set # -# UIP Network Utilities -# -CONFIG_NET_DHCP_LIGHT=n -CONFIG_NET_RESOLV_ENTRIES=4 - -# -# Graphics related configuration settings +# Graphics Support # CONFIG_NX=y -CONFIG_NX_MULTIUSER=y CONFIG_NX_NPLANES=1 +# CONFIG_NX_WRITEONLY is not set + +# +# Supported Pixel Depths +# CONFIG_NX_DISABLE_1BPP=y CONFIG_NX_DISABLE_2BPP=y CONFIG_NX_DISABLE_4BPP=y CONFIG_NX_DISABLE_8BPP=y CONFIG_NX_DISABLE_16BPP=y CONFIG_NX_DISABLE_24BPP=y -CONFIG_NX_DISABLE_32BPP=n -CONFIG_NX_PACKEDMSFIRST=n +# CONFIG_NX_DISABLE_32BPP is not set +# CONFIG_NX_PACKEDMSFIRST is not set + +# +# Input Devices +# CONFIG_NX_MOUSE=y CONFIG_NX_KBD=y -#CONFIG_NXTK_BORDERWIDTH=4 + +# +# Framed Window Borders +# +CONFIG_NXTK_BORDERWIDTH=4 CONFIG_NXTK_BORDERCOLOR1=0x005a96bd CONFIG_NXTK_BORDERCOLOR2=0x00233a49 CONFIG_NXTK_BORDERCOLOR3=0x00f8f8f8 -CONFIG_NXTK_AUTORAISE=n -CONFIG_NXFONT_SANS22X29=n -CONFIG_NXFONT_SANS23X27=y -CONFIG_NXFONT_SANS28X37=n -CONFIG_NXFONT_SANS22X29B=n -CONFIG_NXFONT_SANS28X37B=y -CONFIG_NXFONT_SANS40X49B=n -CONFIG_NXFONT_SERIF22X29=n -CONFIG_NXFONT_SERIF29X37=n -CONFIG_NXFONT_SERIF38X48=n -CONFIG_NXFONT_SERIF22X28B=n -CONFIG_NXFONT_SERIF27X38B=n -CONFIG_NXFONT_SERIF38X49B=n +# CONFIG_NXTK_AUTORAISE is not set + +# +# Font Selections +# CONFIG_NXFONTS_CHARBITS=7 +# CONFIG_NXFONT_SANS17X22 is not set +# CONFIG_NXFONT_SANS20X26 is not set +CONFIG_NXFONT_SANS23X27=y +# CONFIG_NXFONT_SANS22X29 is not set +# CONFIG_NXFONT_SANS28X37 is not set +# CONFIG_NXFONT_SANS39X48 is not set +# CONFIG_NXFONT_SANS17X23B is not set +# CONFIG_NXFONT_SANS20X27B is not set +# CONFIG_NXFONT_SANS22X29B is not set +CONFIG_NXFONT_SANS28X37B=y +# CONFIG_NXFONT_SANS40X49B is not set +# CONFIG_NXFONT_SERIF22X29 is not set +# CONFIG_NXFONT_SERIF29X37 is not set +# CONFIG_NXFONT_SERIF38X48 is not set +# CONFIG_NXFONT_SERIF22X28B is not set +# CONFIG_NXFONT_SERIF27X38B is not set +# CONFIG_NXFONT_SERIF38X49B is not set +CONFIG_NXCONSOLE=y + +# +# NxConsole Output Text/Graphics Options +# +CONFIG_NXCONSOLE_BPP=32 +CONFIG_NXCONSOLE_CURSORCHAR=137 +CONFIG_NXCONSOLE_MXCHARS=256 +CONFIG_NXCONSOLE_CACHESIZE=16 +CONFIG_NXCONSOLE_LINESEPARATION=0 +# CONFIG_NXCONSOLE_NOWRAP is not set + +# +# NxConsole Input options +# +# CONFIG_NXCONSOLE_NXKBDIN is not set +CONFIG_NXCONSOLE_KBDBUFSIZE=16 +CONFIG_NXCONSOLE_NPOLLWAITERS=4 + +# +# NX Multi-user only options +# +CONFIG_NX_MULTIUSER=y CONFIG_NX_BLOCKING=y CONFIG_NX_MXSERVERMSGS=32 CONFIG_NX_MXCLIENTMSGS=16 # -# NxWidgets / NxWM +# Memory Management # -# Use all defaults except -# 1. 32 bits-per-pixel -# 2. Need an especially big server stack size to work with X -# 3. Make the NxWidgets background color match the NxWM back color -# 4. Taskbar on the left -# 5. Bigger stack for NxConsole -# 6. No touchscreen -# -CONFIG_NXWIDGETS_BPP=32 -CONFIG_NXWIDGETS_SERVERSTACK=16384 -CONFIG_NXWIDGETS_LISTENERSTACK=8192 -CONFIG_NXWIDGETS_DEFAULT_BACKGROUNDCOLOR=MKRGB(148,189,215) -CONFIG_NXWIDGETS_DEFAULT_SELECTEDBACKGROUNDCOLOR=MKRGB(206,227,241) -CONFIG_NXWIDGETS_DEFAULT_SHADOWEDGECOLOR=MKRGB(35,58,73) - -CONFIG_NXWM_TASKBAR_LEFT=y -CONFIG_NXWM_NXCONSOLE_STACKSIZE=8192 -CONFIG_NXWM_UNITTEST=y -CONFIG_NXWM_TOUCHSCREEN=n +# CONFIG_MM_SMALL is not set +CONFIG_MM_REGIONS=1 +# CONFIG_GRAN is not set # -# NxConsole Configuration Settings: +# Binary Formats # -CONFIG_NXCONSOLE=y -CONFIG_NXCONSOLE_BPP=32 -CONFIG_NXCONSOLE_MXCHARS=256 +# CONFIG_BINFMT_DISABLE is not set +# CONFIG_BINFMT_EXEPATH is not set +# CONFIG_NXFLAT is not set +# CONFIG_ELF is not set +# CONFIG_PIC is not set +# CONFIG_SYMTAB_ORDEREDBYNAME is not set + +# +# Library Routines +# +CONFIG_STDIO_BUFFER_SIZE=256 +CONFIG_STDIO_LINEBUFFER=y +CONFIG_NUNGET_CHARS=2 +CONFIG_LIB_HOMEDIR="/" +# CONFIG_LIBM is not set +# CONFIG_NOPRINTF_FIELDWIDTH is not set +# CONFIG_LIBC_FLOATINGPOINT is not set +# CONFIG_EOL_IS_CR is not set +# CONFIG_EOL_IS_LF is not set +# CONFIG_EOL_IS_BOTH_CRLF is not set +CONFIG_EOL_IS_EITHER_CRLF=y +# CONFIG_LIBC_STRERROR is not set +# CONFIG_LIBC_PERROR_STDOUT is not set +CONFIG_ARCH_LOWPUTC=y +CONFIG_LIB_SENDFILE_BUFSIZE=512 +# CONFIG_ARCH_ROMGETC is not set +# CONFIG_ARCH_OPTIMIZED_FUNCTIONS is not set + +# +# Basic CXX Support +# +# CONFIG_C99_BOOL8 is not set +CONFIG_HAVE_CXX=y +# CONFIG_HAVE_CXXINITIALIZE is not set +# CONFIG_CXX_NEWLONG is not set + +# +# uClibc++ Standard C++ Library +# +# CONFIG_UCLIBCXX is not set + +# +# Application Configuration # # -# Settings for examples/uip +# Named Applications # -CONFIG_EXAMPLES_UIP_IPADDR=0xc0a80080 -CONFIG_EXAMPLES_UIP_DRIPADDR=0xc0a80001 -CONFIG_EXAMPLES_UIP_NETMASK=0xffffff00 -CONFIG_EXAMPLES_UIP_DHCPC=n +# CONFIG_NAMEDAPP is not set # -# Settings for examples/nettest +# Examples # -CONFIG_EXAMPLES_NETTEST_SERVER=n -CONFIG_EXAMPLES_NETTEST_PERFORMANCE=n -CONFIG_EXAMPLES_NETTEST_NOMAC=n -CONFIG_EXAMPLES_NETTEST_IPADDR=0xc0a80080 -CONFIG_EXAMPLES_NETTEST_DRIPADDR=0xc0a80001 -CONFIG_EXAMPLES_NETTEST_NETMASK=0xffffff00 -CONFIG_EXAMPLES_NETTEST_CLIENTIP=0xc0a8006a +# CONFIG_EXAMPLES_BUTTONS is not set +# CONFIG_EXAMPLES_CAN is not set +# CONFIG_EXAMPLES_CDCACM is not set +# CONFIG_EXAMPLES_COMPOSITE is not set +# CONFIG_EXAMPLES_CXXTEST is not set +# CONFIG_EXAMPLES_DHCPD is not set +# CONFIG_EXAMPLES_ELF is not set +# CONFIG_EXAMPLES_FTPC is not set +# CONFIG_EXAMPLES_FTPD is not set +# CONFIG_EXAMPLES_HELLO is not set +# CONFIG_EXAMPLES_HELLOXX is not set +# CONFIG_EXAMPLES_JSON is not set +# CONFIG_EXAMPLES_HIDKBD is not set +# CONFIG_EXAMPLES_KEYPADTEST is not set +# CONFIG_EXAMPLES_IGMP is not set +# CONFIG_EXAMPLES_LCDRW is not set +# CONFIG_EXAMPLES_MM is not set +# CONFIG_EXAMPLES_MOUNT is not set +# CONFIG_EXAMPLES_MODBUS is not set +# CONFIG_EXAMPLES_NETTEST is not set +# CONFIG_EXAMPLES_NSH is not set +# CONFIG_EXAMPLES_NULL is not set +# CONFIG_EXAMPLES_NX is not set +# CONFIG_EXAMPLES_NXCONSOLE is not set +# CONFIG_EXAMPLES_NXFFS is not set +# CONFIG_EXAMPLES_NXFLAT is not set +# CONFIG_EXAMPLES_NXHELLO is not set +# CONFIG_EXAMPLES_NXIMAGE is not set +# CONFIG_EXAMPLES_NXLINES is not set +# CONFIG_EXAMPLES_NXTEXT is not set +# CONFIG_EXAMPLES_OSTEST is not set +# CONFIG_EXAMPLES_PASHELLO is not set +# CONFIG_EXAMPLES_PIPE is not set +# CONFIG_EXAMPLES_POLL is not set +# CONFIG_EXAMPLES_QENCODER is not set +# CONFIG_EXAMPLES_RGMP is not set +# CONFIG_EXAMPLES_ROMFS is not set +# CONFIG_EXAMPLES_SENDMAIL is not set +# CONFIG_EXAMPLES_SERLOOP is not set +# CONFIG_EXAMPLES_TELNETD is not set +# CONFIG_EXAMPLES_THTTPD is not set +# CONFIG_EXAMPLES_TIFF is not set +# CONFIG_EXAMPLES_TOUCHSCREEN is not set +# CONFIG_EXAMPLES_UDP is not set +# CONFIG_EXAMPLES_UIP is not set +# CONFIG_EXAMPLES_USBSERIAL is not set +# CONFIG_EXAMPLES_USBMSC is not set +# CONFIG_EXAMPLES_USBTERM is not set +# CONFIG_EXAMPLES_WATCHDOG is not set +# CONFIG_EXAMPLES_WLAN is not set # -# Settings for examples/ostest +# Interpreters # -CONFIG_EXAMPLES_OSTEST_LOOPS=100 -CONFIG_EXAMPLES_OSTEST_STACKSIZE=8192 # -# Settings for apps/nshlib +# Interpreters # -CONFIG_NSH_BUILTIN_APPS=n +# CONFIG_INTERPRETERS_FICL is not set +# CONFIG_INTERPRETERS_PCODE is not set + +# +# Network Utilities +# + +# +# Networking Utilities +# +# CONFIG_NETUTILS_CODECS is not set +# CONFIG_NETUTILS_DHCPC is not set +# CONFIG_NETUTILS_DHCPD is not set +# CONFIG_NETUTILS_FTPC is not set +# CONFIG_NETUTILS_FTPD is not set +# CONFIG_NETUTILS_JSON is not set +# CONFIG_NETUTILS_RESOLV is not set +# CONFIG_NETUTILS_SMTP is not set +# CONFIG_NETUTILS_TELNETD is not set +# CONFIG_NETUTILS_TFTPC is not set +# CONFIG_NETUTILS_THTTPD is not set +# CONFIG_NETUTILS_UIPLIB is not set +# CONFIG_NETUTILS_WEBCLIENT is not set + +# +# ModBus +# + +# +# FreeModbus +# +# CONFIG_MODBUS is not set + +# +# NSH Library +# +CONFIG_NSH_LIBRARY=y + +# +# Disable Individual commands +# +# CONFIG_NSH_DISABLE_CAT is not set +# CONFIG_NSH_DISABLE_CD is not set +# CONFIG_NSH_DISABLE_CP is not set +# CONFIG_NSH_DISABLE_DD is not set +# CONFIG_NSH_DISABLE_ECHO is not set +# CONFIG_NSH_DISABLE_EXEC is not set +# CONFIG_NSH_DISABLE_EXIT is not set +# CONFIG_NSH_DISABLE_FREE is not set +# CONFIG_NSH_DISABLE_GET is not set +# CONFIG_NSH_DISABLE_HELP is not set +# CONFIG_NSH_DISABLE_HEXDUMP is not set +# CONFIG_NSH_DISABLE_IFCONFIG is not set +# CONFIG_NSH_DISABLE_KILL is not set +# CONFIG_NSH_DISABLE_LOSETUP is not set +# CONFIG_NSH_DISABLE_LS is not set +# CONFIG_NSH_DISABLE_MB is not set +# CONFIG_NSH_DISABLE_MKDIR is not set +# CONFIG_NSH_DISABLE_MKFATFS is not set +# CONFIG_NSH_DISABLE_MKFIFO is not set +# CONFIG_NSH_DISABLE_MKRD is not set +# CONFIG_NSH_DISABLE_MH is not set +# CONFIG_NSH_DISABLE_MOUNT is not set +# CONFIG_NSH_DISABLE_MW is not set +# CONFIG_NSH_DISABLE_NSFMOUNT is not set +# CONFIG_NSH_DISABLE_PS is not set +# CONFIG_NSH_DISABLE_PING is not set +# CONFIG_NSH_DISABLE_PUT is not set +# CONFIG_NSH_DISABLE_PWD is not set +# CONFIG_NSH_DISABLE_RM is not set +# CONFIG_NSH_DISABLE_RMDIR is not set +# CONFIG_NSH_DISABLE_SET is not set +# CONFIG_NSH_DISABLE_SH is not set +# CONFIG_NSH_DISABLE_SLEEP is not set +# CONFIG_NSH_DISABLE_TEST is not set +# CONFIG_NSH_DISABLE_UMOUNT is not set +# CONFIG_NSH_DISABLE_UNSET is not set +# CONFIG_NSH_DISABLE_USLEEP is not set +# CONFIG_NSH_DISABLE_WGET is not set +# CONFIG_NSH_DISABLE_XD is not set +CONFIG_NSH_CODECS_BUFSIZE=128 CONFIG_NSH_FILEIOSIZE=1024 -CONFIG_NSH_STRERROR=n CONFIG_NSH_LINELEN=80 CONFIG_NSH_NESTDEPTH=3 -CONFIG_NSH_DISABLESCRIPT=n -CONFIG_NSH_DISABLEBG=n +# CONFIG_NSH_DISABLESCRIPT is not set +# CONFIG_NSH_DISABLEBG is not set CONFIG_NSH_ROMFSETC=y -CONFIG_NSH_CONSOLE=y -CONFIG_NSH_TELNET=n -CONFIG_NSH_IOBUFFER_SIZE=512 -CONFIG_NSH_DHCPC=n -CONFIG_NSH_NOMAC=n -CONFIG_NSH_IPADDR=0x0a000002 -CONFIG_NSH_DRIPADDR=0x0a000001 -CONFIG_NSH_NETMASK=0xffffff00 CONFIG_NSH_ROMFSMOUNTPT="/etc" CONFIG_NSH_INITSCRIPT="init.d/rcS" CONFIG_NSH_ROMFSDEVNO=1 @@ -331,81 +534,176 @@ CONFIG_NSH_FATDEVNO=2 CONFIG_NSH_FATSECTSIZE=512 CONFIG_NSH_FATNSECTORS=1024 CONFIG_NSH_FATMOUNTPT="/tmp" +CONFIG_NSH_CONSOLE=y +# CONFIG_NSH_CONDEV is not set +# CONFIG_NSH_ARCHINIT is not set # -# Settings for examples/nx +# NxWidgets/NxWM # -CONFIG_EXAMPLES_NX_BUILTIN=n -CONFIG_EXAMPLES_NX_VPLANE=0 -#CONFIG_EXAMPLES_NX_BGCOLOR -#CONFIG_EXAMPLES_NX_COLOR1 -#CONFIG_EXAMPLES_NX_COLOR2 -#CONFIG_EXAMPLES_NX_TBCOLOR -#CONFIG_EXAMPLES_NX_FONTCOLOR -CONFIG_EXAMPLES_NX_BPP=CONFIG_SIM_FBBPP -CONFIG_EXAMPLES_NX_RAWWINDOWS=n -CONFIG_EXAMPLES_NX_STACKSIZE=8192 -CONFIG_EXAMPLES_NX_CLIENTPRIO=80 -CONFIG_EXAMPLES_NX_SERVERPRIO=120 -CONFIG_EXAMPLES_NX_NOTIFYSIGNO=4 +CONFIG_NXWIDGETS=y # -# Settings for examples/nxhello +# NX Server/Device Configuration # -CONFIG_EXAMPLES_NXHELLO_BUILTIN=y -CONFIG_EXAMPLES_NXHELLO_VPLANE=0 -#CONFIG_EXAMPLES_NXHELLO_BGCOLOR -CONFIG_EXAMPLES_NXHELLO_FONTID=6 -#CONFIG_EXAMPLES_NXHELLO_FONTCOLOR -CONFIG_EXAMPLES_NXHELLO_BPP=CONFIG_SIM_FBBPP -CONFIG_EXAMPLES_NXHELLO_EXTERNINIT=n +# CONFIG_NXWIDGETS_FLICKERFREE is not set +CONFIG_NXWIDGETS_DEVNO=0 +CONFIG_NXWIDGETS_VPLANE=0 +CONFIG_NXWIDGETS_SERVERPRIO=51 +CONFIG_NXWIDGETS_SERVERSTACK=16384 +CONFIG_NXWIDGETS_CLIENTPRIO=50 +CONFIG_NXWIDGETS_LISTENERPRIO=50 +CONFIG_NXWIDGETS_LISTENERSTACK=8192 +# CONFIG_NXWIDGETS_EXTERNINIT is not set +# CONFIG_NXWIDGET_EVENTWAIT is not set # -# Settings for examples/nxlines +# NXWidget Configuration # -CONFIG_EXAMPLES_NXLINES_VPLANE=0 -#CONFIG_EXAMPLES_NXLINES_BGCOLOR -CONFIG_EXAMPLES_NXLINES_LINEWIDTH=16 -#CONFIG_EXAMPLES_NXLINES_LINECOLOR -CONFIG_EXAMPLES_NXLINES_BORDERWIDTH=4 -#CONFIG_EXAMPLES_NXLINES_BORDERCOLOR -#CONFIG_EXAMPLES_NXLINES_CIRCLECOLOR -CONFIG_EXAMPLES_NXLINES_BPP=CONFIG_SIM_FBBPP -CONFIG_EXAMPLES_NXLINES_EXTERNINIT=n +CONFIG_NXWIDGETS_BPP=32 +CONFIG_NXWIDGETS_SIZEOFCHAR=1 # -# Settings for examples/touchscreen +# NXWidget Default Values # -CONFIG_EXAMPLES_TOUCHSCREEN_BUILTIN=y -CONFIG_EXAMPLES_TOUCHSCREEN_MINOR=0 -CONFIG_EXAMPLES_TOUCHSCREEN_DEVPATH="/dev/input0" -CONFIG_EXAMPLES_TOUCHSCREEN_NSAMPLES=25 +# CONFIG_NXWIDGETS_SYSTEM_CUSTOM_FONTID is not set +CONFIG_NXWIDGETS_TNXARRAY_INITIALSIZE=16 +CONFIG_NXWIDGETS_TNXARRAY_SIZEINCREMENT=8 +# CONFIG_NXWIDGETS_CUSTOM_FILLCOLORS is not set +# CONFIG_NXWIDGETS_CUSTOM_EDGECOLORS is not set +# CONFIG_NXWIDGETS_CUSTOM_TEXTCOLORS is not set +CONFIG_NXWIDGETS_TRANSPARENT_COLOR=0x0 # -# Settings for examples/mount +# Keypad behavior # -CONFIG_EXAMPLES_MOUNT_DEVNAME="/dev/ram0" -#CONFIG_EXAMPLES_MOUNT_NSECTORS=2048 -#CONFIG_EXAMPLES_MOUNT_SECTORSIZE=512 -#CONFIG_EXAMPLES_MOUNT_RAMDEVNO=1 +CONFIG_NXWIDGETS_FIRST_REPEAT_TIME=500 +CONFIG_NXWIDGETS_CONTINUE_REPEAT_TIME=200 +CONFIG_NXWIDGETS_DOUBLECLICK_TIME=350 +CONFIG_NXWIDGETS_KBDBUFFER_SIZE=16 +CONFIG_NXWIDGETS_CURSORCONTROL_SIZE=4 +# CONFIG_NXWIDGET_MEMMONITOR is not set +CONFIG_NXWM=y # -# Stack and heap information +# General settings # -CONFIG_BOOT_RUNFROMFLASH=n -CONFIG_BOOT_COPYTORAM=n -CONFIG_CUSTOM_STACK=n -CONFIG_IDLETHREAD_STACKSIZE=8192 -CONFIG_USERMAIN_STACKSIZE=8192 -CONFIG_PTHREAD_STACK_MIN=256 -CONFIG_PTHREAD_STACK_DEFAULT=8192 -CONFIG_HEAP_BASE= -CONFIG_HEAP_SIZE= +# CONFIG_NXWM_SYSTEM_CUSTOM_FONTID is not set +CONFIG_NXWM_UNITTEST=y # -# Maintain legacy build behavior (revisit) +# Color configuration +# +# CONFIG_NXWM_CUSTOM_FILLCOLORS is not set +# CONFIG_NXWM_CUSTOM_EDGECOLORS is not set +# CONFIG_NXWM_CUSTOM_TEXTCOLORS is not set + +# +# Horizontal and vertical spacing of icons in the task bar +# +CONFIG_NXWM_TASKBAR_VSPACING=2 +CONFIG_NXWM_TASKBAR_HSPACING=2 +# CONFIG_NXWM_TASKBAR_TOP is not set +# CONFIG_NXWM_TASKBAR_BOTTOM is not set +CONFIG_NXWM_TASKBAR_LEFT=y +# CONFIG_NXWM_TASKBAR_RIGHT is not set +# CONFIG_NXWM_CUSTOM_TASKBAR_WIDTH is not set +# CONFIG_NXWM_DISABLE_MINIMIZE is not set + +# +# Tool Bar Configuration +# +# CONFIG_NXWM_CUSTOM_TOOLBAR_HEIGHT is not set + +# +# Background Image +# +# CONFIG_NXWM_DISABLE_BACKGROUND_IMAGE is not set +CONFIG_NXWM_BACKGROUND_IMAGE="" + +# +# Start Window Configuration # -CONFIG_MMCSD=y -CONFIG_MMCSD_SPI=y -CONFIG_MMCSD_SDIO=y +# +# Horizontal and vertical spacing of icons in the task bar +# +CONFIG_NXWM_STARTWINDOW_VSPACING=4 +CONFIG_NXWM_STARTWINDOW_HSPACING=4 +# CONFIG_NXWM_CUSTOM_STARTWINDOW_ICON is not set +CONFIG_NXWM_STARTWINDOW_MQNAME="/dev/nxwm" +CONFIG_NXWM_STARTWINDOW_MXMSGS=32 +CONFIG_NXWM_STARTWINDOW_MXMPRIO=42 +CONFIG_NXWM_STARTWINDOW_PRIO=50 +CONFIG_NXWM_STARTWINDOW_STACKSIZE=2048 + +# +# NxConsole Window Configuration +# +CONFIG_NXWM_NXCONSOLE_PRIO=50 +CONFIG_NXWM_NXCONSOLE_STACKSIZE=8192 +# CONFIG_NXWM_NXCONSOLE_CUSTOM_COLORS is not set +# CONFIG_NXWM_NXCONSOLE_CUSTOM_FONTID is not set +# CONFIG_NXWM_CUSTOM_NXCONSOLE_ICON is not set +# CONFIG_NXWM_TOUCHSCREEN is not set +# CONFIG_NXWM_KEYBOARD is not set + +# +# Calibration display settings +# +# CONFIG_NXWM_CALIBRATION_CUSTOM_COLORS is not set +# CONFIG_NXWM_CUSTOM_CALIBRATION_ICON is not set +CONFIG_NXWM_CALIBRATION_SIGNO=5 +CONFIG_NXWM_CALIBRATION_LISTENERPRIO=50 +CONFIG_NXWM_CALIBRATION_LISTENERSTACK=2048 + +# +# Hex Calculator display settings +# +# CONFIG_NXWM_HEXCALCULATOR_CUSTOM_COLORS is not set +# CONFIG_NXWM_CUSTOM_HEXCALCULATOR_ICON is not set +# CONFIG_NXWM_HEXCALCULATOR_CUSTOM_FONTID is not set + +# +# System NSH Add-Ons +# + +# +# Custom Free Memory Command +# +# CONFIG_SYSTEM_FREE is not set + +# +# I2C tool +# + +# +# FLASH Program Installation +# +# CONFIG_SYSTEM_INSTALL is not set + +# +# readline() +# +CONFIG_SYSTEM_READLINE=y +CONFIG_READLINE_ECHO=y + +# +# Power Off +# +# CONFIG_SYSTEM_POWEROFF is not set + +# +# RAMTRON +# +# CONFIG_SYSTEM_RAMTRON is not set + +# +# SD Card +# +# CONFIG_SYSTEM_SDCARD is not set + +# +# Sysinfo +# +# CONFIG_SYSTEM_SYSINFO is not set diff --git a/nuttx/include/pthread.h b/nuttx/include/pthread.h index 5066275b41..a98b9aaaaf 100644 --- a/nuttx/include/pthread.h +++ b/nuttx/include/pthread.h @@ -44,6 +44,8 @@ #include /* Compiler settings, noreturn_function */ #include /* Needed for general types */ +#include /* Needed by pthread_[set|get]name_np */ + #include /* C99 fixed width integer types */ #include /* C99 boolean types */ #include /* For getpid */ @@ -58,10 +60,11 @@ /* Standard POSIX switches */ #ifndef _POSIX_THREADS -#define _POSIX_THREADS +# define _POSIX_THREADS #endif + #ifndef _POSIX_THREAD_ATTR_STACKSIZE -#define _POSIX_THREAD_ATTR_STACKSIZE +# define _POSIX_THREAD_ATTR_STACKSIZE #endif /******************************************************************************** @@ -153,10 +156,8 @@ ********************************************************************************/ #ifdef __cplusplus -#define EXTERN extern "C" -extern "C" { -#else -#define EXTERN extern +extern "C" +{ #endif /* pthread-specific types */ @@ -245,28 +246,29 @@ struct sched_param; /* Defined in sched.h */ * the individual attributes used by a given implementation. */ -EXTERN int pthread_attr_init(FAR pthread_attr_t *attr); +int pthread_attr_init(FAR pthread_attr_t *attr); /* An attributes object can be deleted when it is no longer needed. */ -EXTERN int pthread_attr_destroy(pthread_attr_t *attr); +int pthread_attr_destroy(pthread_attr_t *attr); /* Set or obtain the default scheduling algorithm */ -EXTERN int pthread_attr_setschedpolicy(FAR pthread_attr_t *attr, int policy); -EXTERN int pthread_attr_getschedpolicy(FAR pthread_attr_t *attr, int *policy); -EXTERN int pthread_attr_setschedparam(FAR pthread_attr_t *attr, - FAR const struct sched_param *param); -EXTERN int pthread_attr_getschedparam(FAR pthread_attr_t *attr, - FAR struct sched_param *param); -EXTERN int pthread_attr_setinheritsched(FAR pthread_attr_t *attr, int inheritsched); -EXTERN int pthread_attr_getinheritsched(FAR const pthread_attr_t *attr, - FAR int *inheritsched); +int pthread_attr_setschedpolicy(FAR pthread_attr_t *attr, int policy); +int pthread_attr_getschedpolicy(FAR pthread_attr_t *attr, int *policy); +int pthread_attr_setschedparam(FAR pthread_attr_t *attr, + FAR const struct sched_param *param); +int pthread_attr_getschedparam(FAR pthread_attr_t *attr, + FAR struct sched_param *param); +int pthread_attr_setinheritsched(FAR pthread_attr_t *attr, + int inheritsched); +int pthread_attr_getinheritsched(FAR const pthread_attr_t *attr, + FAR int *inheritsched); /* Set or obtain the default stack size */ -EXTERN int pthread_attr_setstacksize(FAR pthread_attr_t *attr, long stacksize); -EXTERN int pthread_attr_getstacksize(FAR pthread_attr_t *attr, long *stackaddr); +int pthread_attr_setstacksize(FAR pthread_attr_t *attr, long stacksize); +int pthread_attr_getstacksize(FAR pthread_attr_t *attr, long *stackaddr); /* To create a thread object and runnable thread, a routine must be specified * as the new thread's start routine. An argument may be passed to this @@ -275,34 +277,33 @@ EXTERN int pthread_attr_getstacksize(FAR pthread_attr_t *attr, long *stackaddr); * about the kind of thread being created. */ -EXTERN int pthread_create(FAR pthread_t *thread, FAR pthread_attr_t *attr, - pthread_startroutine_t startroutine, - pthread_addr_t arg); +int pthread_create(FAR pthread_t *thread, FAR pthread_attr_t *attr, + pthread_startroutine_t startroutine, pthread_addr_t arg); /* A thread object may be "detached" to specify that the return value and * completion status will not be requested. */ -EXTERN int pthread_detach(pthread_t thread); +int pthread_detach(pthread_t thread); /* A thread may terminate it's own execution or the execution of another * thread. */ -EXTERN void pthread_exit(pthread_addr_t value) noreturn_function; -EXTERN int pthread_cancel(pthread_t thread); -EXTERN int pthread_setcancelstate(int state, FAR int *oldstate); -EXTERN void pthread_testcancel(void); +void pthread_exit(pthread_addr_t value) noreturn_function; +int pthread_cancel(pthread_t thread); +int pthread_setcancelstate(int state, FAR int *oldstate); +void pthread_testcancel(void); /* A thread can await termination of another thread and retrieve the return * value of the thread. */ -EXTERN int pthread_join(pthread_t thread, FAR pthread_addr_t *value); +int pthread_join(pthread_t thread, FAR pthread_addr_t *value); /* A thread may tell the scheduler that its processor can be made available. */ -EXTERN void pthread_yield(void); +void pthread_yield(void); /* A thread may obtain a copy of its own thread handle. */ @@ -314,91 +315,94 @@ EXTERN void pthread_yield(void); /* Thread scheduling parameters */ -EXTERN int pthread_getschedparam(pthread_t thread, FAR int *policy, - FAR struct sched_param *param); -EXTERN int pthread_setschedparam(pthread_t thread, int policy, - FAR const struct sched_param *param); -EXTERN int pthread_setschedprio(pthread_t thread, int prio); +int pthread_getschedparam(pthread_t thread, FAR int *policy, + FAR struct sched_param *param); +int pthread_setschedparam(pthread_t thread, int policy, + FAR const struct sched_param *param); +int pthread_setschedprio(pthread_t thread, int prio); /* Thread-specific Data Interfaces */ -EXTERN int pthread_key_create(FAR pthread_key_t *key, - CODE void (*destructor)(FAR void*)); -EXTERN int pthread_setspecific(pthread_key_t key, FAR void *value); -EXTERN FAR void *pthread_getspecific(pthread_key_t key); -EXTERN int pthread_key_delete(pthread_key_t key); +int pthread_key_create(FAR pthread_key_t *key, + CODE void (*destructor)(FAR void*)); +int pthread_setspecific(pthread_key_t key, FAR void *value); +FAR void *pthread_getspecific(pthread_key_t key); +int pthread_key_delete(pthread_key_t key); /* Create, operate on, and destroy mutex attributes. */ -EXTERN int pthread_mutexattr_init(FAR pthread_mutexattr_t *attr); -EXTERN int pthread_mutexattr_destroy(FAR pthread_mutexattr_t *attr); -EXTERN int pthread_mutexattr_getpshared(FAR pthread_mutexattr_t *attr, FAR int *pshared); -EXTERN int pthread_mutexattr_setpshared(FAR pthread_mutexattr_t *attr, int pshared); +int pthread_mutexattr_init(FAR pthread_mutexattr_t *attr); +int pthread_mutexattr_destroy(FAR pthread_mutexattr_t *attr); +int pthread_mutexattr_getpshared(FAR pthread_mutexattr_t *attr, + FAR int *pshared); +int pthread_mutexattr_setpshared(FAR pthread_mutexattr_t *attr, + int pshared); #ifdef CONFIG_MUTEX_TYPES -EXTERN int pthread_mutexattr_gettype(const pthread_mutexattr_t *attr, int *type); -EXTERN int pthread_mutexattr_settype(pthread_mutexattr_t *attr, int type); +int pthread_mutexattr_gettype(const pthread_mutexattr_t *attr, int *type); +int pthread_mutexattr_settype(pthread_mutexattr_t *attr, int type); #endif /* The following routines create, delete, lock and unlock mutexes. */ -EXTERN int pthread_mutex_init(FAR pthread_mutex_t *mutex, FAR pthread_mutexattr_t *attr); -EXTERN int pthread_mutex_destroy(FAR pthread_mutex_t *mutex); -EXTERN int pthread_mutex_lock(FAR pthread_mutex_t *mutex); -EXTERN int pthread_mutex_trylock(FAR pthread_mutex_t *mutex); -EXTERN int pthread_mutex_unlock(FAR pthread_mutex_t *mutex); +int pthread_mutex_init(FAR pthread_mutex_t *mutex, + FAR pthread_mutexattr_t *attr); +int pthread_mutex_destroy(FAR pthread_mutex_t *mutex); +int pthread_mutex_lock(FAR pthread_mutex_t *mutex); +int pthread_mutex_trylock(FAR pthread_mutex_t *mutex); +int pthread_mutex_unlock(FAR pthread_mutex_t *mutex); /* Operations on condition variables */ -EXTERN int pthread_condattr_init(FAR pthread_condattr_t *attr); -EXTERN int pthread_condattr_destroy(FAR pthread_condattr_t *attr); +int pthread_condattr_init(FAR pthread_condattr_t *attr); +int pthread_condattr_destroy(FAR pthread_condattr_t *attr); /* A thread can create and delete condition variables. */ -EXTERN int pthread_cond_init(FAR pthread_cond_t *cond, FAR pthread_condattr_t *attr); -EXTERN int pthread_cond_destroy(FAR pthread_cond_t *cond); +int pthread_cond_init(FAR pthread_cond_t *cond, FAR pthread_condattr_t *attr); +int pthread_cond_destroy(FAR pthread_cond_t *cond); /* A thread can signal to and broadcast on a condition variable. */ -EXTERN int pthread_cond_broadcast(FAR pthread_cond_t *cond); -EXTERN int pthread_cond_signal(FAR pthread_cond_t *cond); +int pthread_cond_broadcast(FAR pthread_cond_t *cond); +int pthread_cond_signal(FAR pthread_cond_t *cond); /* A thread can wait for a condition variable to be signalled or broadcast. */ -EXTERN int pthread_cond_wait(FAR pthread_cond_t *cond, FAR pthread_mutex_t *mutex); +int pthread_cond_wait(FAR pthread_cond_t *cond, FAR pthread_mutex_t *mutex); /* A thread can perform a timed wait on a condition variable. */ -EXTERN int pthread_cond_timedwait(FAR pthread_cond_t *cond, FAR pthread_mutex_t *mutex, - FAR const struct timespec *abstime); +int pthread_cond_timedwait(FAR pthread_cond_t *cond, + FAR pthread_mutex_t *mutex, + FAR const struct timespec *abstime); /* Barrier attributes */ -EXTERN int pthread_barrierattr_destroy(FAR pthread_barrierattr_t *attr); -EXTERN int pthread_barrierattr_init(FAR pthread_barrierattr_t *attr); -EXTERN int pthread_barrierattr_getpshared(FAR const pthread_barrierattr_t *attr, - FAR int *pshared); -EXTERN int pthread_barrierattr_setpshared(FAR pthread_barrierattr_t *attr, - int pshared); +int pthread_barrierattr_destroy(FAR pthread_barrierattr_t *attr); +int pthread_barrierattr_init(FAR pthread_barrierattr_t *attr); +int pthread_barrierattr_getpshared(FAR const pthread_barrierattr_t *attr, + FAR int *pshared); +int pthread_barrierattr_setpshared(FAR pthread_barrierattr_t *attr, + int pshared); /* Barriers */ -EXTERN int pthread_barrier_destroy(FAR pthread_barrier_t *barrier); -EXTERN int pthread_barrier_init(FAR pthread_barrier_t *barrier, +int pthread_barrier_destroy(FAR pthread_barrier_t *barrier); +int pthread_barrier_init(FAR pthread_barrier_t *barrier, FAR const pthread_barrierattr_t *attr, unsigned int count); -EXTERN int pthread_barrier_wait(FAR pthread_barrier_t *barrier); +int pthread_barrier_wait(FAR pthread_barrier_t *barrier); /* Pthread initialization */ -EXTERN int pthread_once(FAR pthread_once_t *once_control, +int pthread_once(FAR pthread_once_t *once_control, CODE void (*init_routine)(void)); /* Pthread signal management APIs */ -EXTERN int pthread_kill(pthread_t thread, int sig); -EXTERN int pthread_sigmask(int how, FAR const sigset_t *set, FAR sigset_t *oset); +int pthread_kill(pthread_t thread, int sig); +int pthread_sigmask(int how, FAR const sigset_t *set, FAR sigset_t *oset); -#undef EXTERN #ifdef __cplusplus } #endif From e975043dd3f56765a2a0292784666b2246ea6211 Mon Sep 17 00:00:00 2001 From: patacongo Date: Sat, 22 Dec 2012 16:47:02 +0000 Subject: [PATCH 003/118] Add tools/kconfig.bat git-svn-id: http://svn.code.sf.net/p/nuttx/code/trunk@5450 42af7a65-404d-4744-a932-0658087f49c3 --- nuttx/ChangeLog | 2 + nuttx/Kconfig | 2 +- nuttx/Makefile.win | 17 ++--- nuttx/README.txt | 136 +++++++++++++++++++++++++++------------- nuttx/tools/README.txt | 30 +++++++++ nuttx/tools/kconfig.bat | 131 ++++++++++++++++++++++++++++++++++++++ 6 files changed, 265 insertions(+), 53 deletions(-) create mode 100755 nuttx/tools/kconfig.bat diff --git a/nuttx/ChangeLog b/nuttx/ChangeLog index 04f180a8b1..56edf9487a 100644 --- a/nuttx/ChangeLog +++ b/nuttx/ChangeLog @@ -3811,3 +3811,5 @@ tool. * include/pthread.h: In sys/prctl.h because it is needed by pthread_[set|get]name_np() + * tools/kconfig.bat: Kludge to run kconfig-frontends from a DOS shell. + diff --git a/nuttx/Kconfig b/nuttx/Kconfig index 10d624efb8..2c8c9b26ea 100644 --- a/nuttx/Kconfig +++ b/nuttx/Kconfig @@ -7,7 +7,7 @@ mainmenu "Nuttx/$ARCH Configuration" config APPSDIR string - option env="APPSDIR" + default "../apps" # This is a temporary kludge to let the build system know that we are using the new # configuration system diff --git a/nuttx/Makefile.win b/nuttx/Makefile.win index 34da12ad09..fcf971d325 100644 --- a/nuttx/Makefile.win +++ b/nuttx/Makefile.win @@ -252,7 +252,7 @@ LINKLIBS = $(patsubst lib\\%,%,$(NUTTXLIBS)) BIN = nuttx$(EXEEXT) all: $(BIN) -.PHONY: context clean_context check_context export subdir_clean clean subdir_distclean distclean apps_clean apps_distclean +.PHONY: context clean_context check_context configenv config oldconfig menuconfig export subdir_clean clean subdir_distclean distclean apps_clean apps_distclean # Target used to copy include\nuttx\math.h. If CONFIG_ARCH_MATH_H is # defined, then there is an architecture specific math.h header file @@ -647,14 +647,17 @@ pass2dep: context tools\mkdeps$(HOSTEXEEXT) # location: http://ymorin.is-a-geek.org/projects/kconfig-frontends. See # misc\tools\README.txt for additional information. -config: - $(Q) APPSDIR=${CONFIG_APPS_DIR} conf Kconfig +configenv: + $(Q) set APPSDIR=${CONFIG_APPS_DIR} -oldconfig: - $(Q) APPSDIR=${CONFIG_APPS_DIR} conf --oldconfig Kconfig +config: configenv + $(Q) conf Kconfig -menuconfig: - $(Q) APPSDIR=${CONFIG_APPS_DIR} mconf Kconfig +oldconfig: configenv + $(Q) conf --oldconfig Kconfig + +menuconfig: configenv + $(Q) mconf Kconfig # export # diff --git a/nuttx/README.txt b/nuttx/README.txt index b9210277e8..b71012cd8b 100644 --- a/nuttx/README.txt +++ b/nuttx/README.txt @@ -10,6 +10,7 @@ README o Configuring NuttX - Instantiating "Canned" Configurations - NuttX Configuration Tool + - NuttX Configuration Tool from DOS o Toolchains - Cross-Development Toolchains - NuttX Buildroot Toolchain @@ -249,7 +250,6 @@ easier. It is used as follows: cd ${TOPDIR}/tools ./configure.sh / - NuttX Configuration Tool ------------------------ @@ -292,6 +292,52 @@ NuttX Configuration Tool install 'mconf', make certain that your PATH variable includes a path to that installation directory. +NuttX Configuration Tool from DOS +--------------------------------- + +Recent versions of NuttX support building NuttX from a native Windows +CMD.exe shell (see "Native Windows Build" below). But kconfig-frontends +is a Linux tool. There have been some successes building a Windows +native version of the kconfig-frontends tool, but that is not ready +for prime time. + +At this point, there are only a few options for the Windows user: + + 1. You can run the configuration tool using Cygwin. However, the + Cygwin Makefile.win will complain so to do this will, you have + to manually edit the .config file: + + a. Delete the line: CONFIG_WINDOWS_NATIVE=y + b. Change the apps/ directory path, CONFIG_APPS_DIR to use Unix + style delimiters. For example, change "..\apps" to "../apps" + + And of course, after you use the configuration tool you need to + restore CONFIG_WINDOWS_NATIVE=y and the correct CONFIG_APPS_DIR. + + 2) You can, with some effort, run the the Cygwin mconf tool directly + in the CMD.exe shell. In this case, you do not have to modify the + .config file, but there are other complexities: + + a. You need to temporarily set the Cgywin directories in the PATH + variable then run mconf manually like: + + mconf Kconfig + + There is a Windows bacht file at tools/kconfig.bat that automates + these steps: + + tools/kconfig menuconfig + + b. There is an issue with accessing DOS environment variables from + the Cygwin mconf running in the CMD.exe shell. The following + change to the top-level Kconfig file seems to work around these + problems: + + config APPSDIR + string + - option env="APPSDIR" + + default "../apps" + TOOLCHAINS ^^^^^^^^^^ @@ -523,68 +569,68 @@ Native Windows Build Installing GNUWin32 ------------------- -The Windows native build will depend upon a few Unix-like tools that can be -provided either by MSYS or GNUWin32. The GNUWin32 are available from -http://gnuwin32.sourceforge.net/. GNUWin32 provides ports of tools with a -GPL or similar open source license to modern MS-Windows (Microsoft Windows -2000 / XP / 2003 / Vista / 2008 / 7). See -http://gnuwin32.sourceforge.net/packages.html for a list of all of the tools -available in the GNUWin32 package. + The Windows native build will depend upon a few Unix-like tools that can be + provided either by MSYS or GNUWin32. The GNUWin32 are available from + http://gnuwin32.sourceforge.net/. GNUWin32 provides ports of tools with a + GPL or similar open source license to modern MS-Windows (Microsoft Windows + 2000 / XP / 2003 / Vista / 2008 / 7). See + http://gnuwin32.sourceforge.net/packages.html for a list of all of the tools + available in the GNUWin32 package. -The SourceForge project is located here: -http://sourceforge.net/projects/gnuwin32/. The project is still being -actively supported (although some of the Windows ports have gotten very old). + The SourceForge project is located here: + http://sourceforge.net/projects/gnuwin32/. The project is still being + actively supported (although some of the Windows ports have gotten very old). -Some commercial toolchains include a subset of the GNUWin32 tools in the -installation. My recommendation is that you download the GNUWin32 tools -directly from the sourceforge.net website so that you will know what you are -using and can reproduce your build environment. + Some commercial toolchains include a subset of the GNUWin32 tools in the + installation. My recommendation is that you download the GNUWin32 tools + directly from the sourceforge.net website so that you will know what you are + using and can reproduce your build environment. -GNUWin32 Installation Steps: + GNUWin32 Installation Steps: -The following steps will download and execute the GNUWin32 installer. + The following steps will download and execute the GNUWin32 installer. -1. Download GetGNUWin32-x.x.x.exe from - http://sourceforge.net/projects/getgnuwin32/files/. This is the - installer. The current version as of this writing is 0.6.3. + 1. Download GetGNUWin32-x.x.x.exe from + http://sourceforge.net/projects/getgnuwin32/files/. This is the + installer. The current version as of this writing is 0.6.3. -2. Run the installer. + 2. Run the installer. -3. Accept the license. + 3. Accept the license. -4. Select the installation directory. My recommendation is the - directory that contains this README file (). + 4. Select the installation directory. My recommendation is the + directory that contains this README file (). -5. After running GetGNUWin32-0.x.x.exe, you will have a new directory - /GetGNUWin32 + 5. After running GetGNUWin32-0.x.x.exe, you will have a new directory + /GetGNUWin32 -Note the the GNUWin32 installer didn't install GNUWin32. Instead, it -installed another, smarter downloader. That downloader is the GNUWin32 -package management tool developed by the Open SSL project. + Note the the GNUWin32 installer didn't install GNUWin32. Instead, it + installed another, smarter downloader. That downloader is the GNUWin32 + package management tool developed by the Open SSL project. -The following steps probably should be performed from inside a DOS shell. + The following steps probably should be performed from inside a DOS shell. -6. Change to the directory created by GetGNUWin32-x.x.x.exe + 6. Change to the directory created by GetGNUWin32-x.x.x.exe - cd GetGNUWin32 + cd GetGNUWin32 -7. Execute the download.bat script. The download.bat script will download - about 446 packages! Enough to have a very complete Linux-like environment - under the DOS shell. This will take awhile. This step only downloads - the packages and the next step will install the packages. + 7. Execute the download.bat script. The download.bat script will download + about 446 packages! Enough to have a very complete Linux-like environment + under the DOS shell. This will take awhile. This step only downloads + the packages and the next step will install the packages. - download + download -8. This step will install the downloaded packages. The argument of the - install.bat script is the installation location. C:\gnuwin32 is the - standard install location: + 8. This step will install the downloaded packages. The argument of the + install.bat script is the installation location. C:\gnuwin32 is the + standard install location: - install C:\gnuwin32 + install C:\gnuwin32 -NOTE: This installation step will install *all* GNUWin32 packages... far -more than you will ever need. If disc space is a problem for you, you might -need to perform a manual installation of the individual ZIP files that you -will find in the /GetGNUWin32/packages directory. + NOTE: This installation step will install *all* GNUWin32 packages... far + more than you will ever need. If disc space is a problem for you, you might + need to perform a manual installation of the individual ZIP files that you + will find in the /GetGNUWin32/packages directory. CYGWIN BUILD PROBLEMS ^^^^^^^^^^^^^^^^^^^^^ diff --git a/nuttx/tools/README.txt b/nuttx/tools/README.txt index 2b9ac61f45..fc03322127 100644 --- a/nuttx/tools/README.txt +++ b/nuttx/tools/README.txt @@ -413,6 +413,36 @@ unlink.bat NTFS mklink.exe command instead of copying files. That logic, however, has not been verified as of this writing. +kconfig.bat +----------- + + Recent versions of NuttX support building NuttX from a native Windows + CMD.exe shell. But kconfig-frontends is a Linux tool and is not yet + available in the pure CMD.exe environment. At this point, there are + only a few options for the Windows user (see the top-level README.txt + file). + + You can, with some effort, run the the Cygwin mconf tool directly + in the CMD.exe shell. In this case, you do not have to modify the + .config file, but there are other complexities: You need to + temporarily set the Cgywin directories in the PATH variable and + then run mconf outside of the Make system. + + kconfig.bat is a Windows batch file at tools/kconfig.bat that automates + these steps. It is used from the top-level NuttX directory like: + + tools/kconfig menuconfig + + NOTE: There is an currently an issue with accessing DOS environment + variables from the Cygwin mconf running in the CMD.exe shell. The + following change to the top-level Kconfig file seems to work around + these problems: + + config APPSDIR + string + - option env="APPSDIR" + + default "../apps" + mkimage.sh ---------- diff --git a/nuttx/tools/kconfig.bat b/nuttx/tools/kconfig.bat new file mode 100755 index 0000000000..65ab60506c --- /dev/null +++ b/nuttx/tools/kconfig.bat @@ -0,0 +1,131 @@ +@echo off + +rem tools/kconfig.bat +rem +rem Copyright (C) 2012 Gregory Nutt. All rights reserved. +rem Author: Gregory Nutt +rem +rem Redistribution and use in source and binary forms, with or without +rem modification, are permitted provided that the following conditions +rem are met: +rem +rem 1. Redistributions of source code must retain the above copyright +rem notice, this list of conditions and the following disclaimer. +rem 2. Redistributions in binary form must reproduce the above copyright +rem notice, this list of conditions and the following disclaimer in +rem the documentation and/or other materials provided with the +rem distribution. +rem 3. Neither the name NuttX nor the names of its contributors may be +rem used to endorse or promote products derived from this software +rem without specific prior written permission. +rem +rem THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +rem "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +rem LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +rem FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +rem COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +rem INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +rem BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +rem OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +rem AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +rem LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +rem ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +rem POSSIBILITY OF SUCH DAMAGE. +rem + +rem Remember the state of the PATH variable on entry + +set oldpath=%PATH% + +rem Handle command line options + +set action=%1 +shift +if "%action%"=="" goto :MissingArgument + +set appsdir=..\apps +set cygwindir=C:\Cygwin + +:ArgLoop + +if "%1"=="" goto :CheckArguments + +if "%1"=="-a" ( + shift + set appsdir=%1 + goto :NextArg +) + +if "%1"=="-c" ( + shift + set cygwindir=%1 + goto :NextArg +) + +echo ERROR: Unrecognized option: %1 +goto :ShowUsage + +:NextArg +shift +goto :ArgLoop + +rem Verify that all of the paths are valid + +:CheckArguments +if exist "%appsdir%" goto :CheckCygwinDir + +echo ERROR: %appsdir% does not exist +goto :ShowUsage + +:CheckCygwinDir + +if exist "%cygwindir%" goto :SetPath + +echo ERROR: %cygwindir% does not exist +goto :ShowUsage + +rem Setup some required environment variables and PATH settings + +:SetPath +set PATH=%cygwindir%\usr\local\bin;%cygwindir%\usr\bin;%cygwindir%\bin;%PATH% +set APPSDIR=%appsdir% + +rem Execute the requested action + +if "%action%"=="config" goto :DoConfig +if "%action%"=="oldconfig" goto :DoOldConfig +if "%action%"=="menuconfig" goto :DoMenuConfig + +echo ERROR: Unrecognized action: %action% +goto :ShowUsage + +:DoConfig +conf Kconfig +goto End + +:DoOldConfig +conf --oldconfig Kconfig +goto End + +:DoMenuConfig +mconf Kconfig +goto End + +:MissingArgument + +echo ERROR: Missing required argument + +:ShowUsage +echo USAGE: %0 ^ [-a ^] [-c ^] +echo Where: +echo ^ is one of config, oldconf, or menuconfig +echo ^ is the relative path to the apps\ directory. +echo This defaults to ..\apps +echo ^ is the relative path to the Cygwin installation +echo directory. This defaults to C:\Cygwin + +rem Restore the original PATH settings + +:End +set PATH=%oldpath% + From f2a0267b0724206a9aa20b4c0caba36b3eecc3fe Mon Sep 17 00:00:00 2001 From: patacongo Date: Sat, 22 Dec 2012 16:51:01 +0000 Subject: [PATCH 004/118] Fix errors and omissions in last checkin git-svn-id: http://svn.code.sf.net/p/nuttx/code/trunk@5451 42af7a65-404d-4744-a932-0658087f49c3 --- misc/tools/kconfig-language.txt | 2 +- nuttx/Kconfig | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/misc/tools/kconfig-language.txt b/misc/tools/kconfig-language.txt index 44e2649fbb..a686f9cd69 100644 --- a/misc/tools/kconfig-language.txt +++ b/misc/tools/kconfig-language.txt @@ -117,7 +117,7 @@ applicable everywhere (see syntax). This attribute is only applicable to menu blocks, if the condition is false, the menu block is not displayed to the user (the symbols contained there can still be selected by other symbols, though). It is - similar to a conditional "prompt" attribude for individual menu + similar to a conditional "prompt" attribute for individual menu entries. Default value of "visible" is true. - numerical ranges: "range" ["if" ] diff --git a/nuttx/Kconfig b/nuttx/Kconfig index 2c8c9b26ea..10d624efb8 100644 --- a/nuttx/Kconfig +++ b/nuttx/Kconfig @@ -7,7 +7,7 @@ mainmenu "Nuttx/$ARCH Configuration" config APPSDIR string - default "../apps" + option env="APPSDIR" # This is a temporary kludge to let the build system know that we are using the new # configuration system From c62d3d93deef9ec14e80c3a96d70f846deeff66e Mon Sep 17 00:00:00 2001 From: patacongo Date: Sun, 23 Dec 2012 17:32:41 +0000 Subject: [PATCH 005/118] Mostly costmetic updates git-svn-id: http://svn.code.sf.net/p/nuttx/code/trunk@5452 42af7a65-404d-4744-a932-0658087f49c3 --- nuttx/Documentation/NuttX.html | 15 ++++----- nuttx/README.txt | 24 +++++++++------ nuttx/arch/arm/src/arm/up_doirq.c | 8 +++-- nuttx/arch/arm/src/armv7-m/up_doirq.c | 8 +++-- nuttx/arch/avr/src/avr/up_doirq.c | 8 +++-- nuttx/arch/avr/src/avr32/up_doirq.c | 8 +++-- nuttx/arch/hc/src/common/up_doirq.c | 8 +++-- nuttx/arch/mips/src/mips32/up_doirq.c | 8 +++-- nuttx/arch/sh/src/common/up_doirq.c | 9 ++++++ nuttx/arch/z16/src/common/up_doirq.c | 9 ++++++ nuttx/arch/z80/include/z80/chip.h | 6 ++-- nuttx/arch/z80/src/common/up_internal.h | 41 ++++++++++++------------- nuttx/arch/z80/src/ez80/switch.h | 26 +++++++++------- nuttx/arch/z80/src/z180/switch.h | 25 ++++++++------- nuttx/arch/z80/src/z8/switch.h | 28 +++++++++-------- nuttx/arch/z80/src/z80/switch.h | 26 +++++++++------- 16 files changed, 149 insertions(+), 108 deletions(-) diff --git a/nuttx/Documentation/NuttX.html b/nuttx/Documentation/NuttX.html index f48994babd..84f298d3ac 100644 --- a/nuttx/Documentation/NuttX.html +++ b/nuttx/Documentation/NuttX.html @@ -1078,7 +1078,6 @@ svn checkout -r5447 svn://svn.code.sf.net/p/nuttx/code/trunk nuttx-code svn checkout -r5447 http://svn.code.sf.net/p/nuttx/code/trunk nuttx-code -

    Additional new features and extended functionality

    @@ -1244,7 +1243,7 @@ svn checkout -r5447 http://svn.code.sf.net/p/nuttx/code/trunk nuttx-code This build: (1) Uses all Windows style paths, (2) Uses primarily Windows batch commands from CMD.exe, with (3) a few extensions from GNUWin32.

    - This capability should still be considered a work in progress because: (1) it has not been verfied on all targets and tools, and (2) still lacks some of the creature-comforts of the more mature environments (like a function configure.sh script and make menuconfig support). + This capability should still be considered a work in progress because: (1) It has not been verfied on all targets and tools, and (2) it still lacks some of the creature-comforts of the more mature environments (like a functional configure.sh script and make menuconfig support).

  • Example Windows native builds for STM32F4Discovery, eZ80, z16f, z8, Z80, and Z180. @@ -1890,8 +1889,7 @@ svn checkout -r5447 http://svn.code.sf.net/p/nuttx/code/trunk nuttx-code
  • - These ports uses a GNU arm-nuttx-elf toolchain* under either Linux or Cygwin (with native Windows GNU - tools or Cygwin-based GNU tools). + These ports uses a GNU arm-nuttx-elf toolchain* under either Linux or Cygwin (with native Windows GNU tools or Cygwin-based GNU tools).

      @@ -1999,8 +1997,7 @@ svn checkout -r5447 http://svn.code.sf.net/p/nuttx/code/trunk nuttx-code Atmel AT91SAM3U. This port uses the Atmel SAM3U-EK development board that features the AT91SAM3U4E MCU. - This port uses a GNU arm-nuttx-elf or arm-eabi toolchain* under either Linux or Cygwin (with native Windows GNU - tools or Cygwin-based GNU tools). + This port uses a GNU arm-nuttx-elf or arm-eabi toolchain* under either Linux or Cygwin (with native Windows GNU tools or Cygwin-based GNU tools).

        @@ -2884,7 +2881,7 @@ BFD_ASSERT (*plt_offset != (bfd_vma) -1); Zilog z16f Microncontroller. This port use the Zilog z16f2800100zcog development kit and the Zilog ZDS-II Windows command line tools. - The development environment is Cygwin under WinXP. + The development environment is either Windows native or Cygwin under Windows.

          @@ -2914,7 +2911,7 @@ BFD_ASSERT (*plt_offset != (bfd_vma) -1);

          Both boards are based on the eZ80F091 part and both use the Zilog ZDS-II Windows command line tools. - The development environment is Cygwin under WinXP. + The development environment is either Windows native or Cygwin under Windows.

            @@ -2946,7 +2943,7 @@ BFD_ASSERT (*plt_offset != (bfd_vma) -1);

          and the Zilog ZDS-II Windows command line tools. - The development environment is Cygwin under WinXP. + The development environment is either Windows native or Cygwin under Windows.

            diff --git a/nuttx/README.txt b/nuttx/README.txt index b71012cd8b..dc3c9fb673 100644 --- a/nuttx/README.txt +++ b/nuttx/README.txt @@ -10,7 +10,7 @@ README o Configuring NuttX - Instantiating "Canned" Configurations - NuttX Configuration Tool - - NuttX Configuration Tool from DOS + - NuttX Configuration Tool under DOS o Toolchains - Cross-Development Toolchains - NuttX Buildroot Toolchain @@ -292,16 +292,16 @@ NuttX Configuration Tool install 'mconf', make certain that your PATH variable includes a path to that installation directory. -NuttX Configuration Tool from DOS ---------------------------------- +NuttX Configuration Tool under DOS +---------------------------------- -Recent versions of NuttX support building NuttX from a native Windows -CMD.exe shell (see "Native Windows Build" below). But kconfig-frontends -is a Linux tool. There have been some successes building a Windows -native version of the kconfig-frontends tool, but that is not ready -for prime time. + Recent versions of NuttX support building NuttX from a native Windows + CMD.exe shell (see "Native Windows Build" below). But kconfig-frontends + is a Linux tool. There have been some successes building a Windows + native version of the kconfig-frontends tool, but that is not ready + for prime time. -At this point, there are only a few options for the Windows user: + At this point, there are only a few options for the Windows user: 1. You can run the configuration tool using Cygwin. However, the Cygwin Makefile.win will complain so to do this will, you have @@ -566,6 +566,12 @@ Native Windows Build http://www.mingw.org/. If you are using GNUWin32, then it is recommended the you not install the optional MSYS components as there may be conflicts. + This capability should still be considered a work in progress because: + (1) It has not been verfied on all targets and tools, and + (2) itstill lacks some of the creature-comforts of the more mature environments + (like a functional configure.sh script and 'make menuconfig' support. + See the section "NuttX Configuration Tool under DOS" above). + Installing GNUWin32 ------------------- diff --git a/nuttx/arch/arm/src/arm/up_doirq.c b/nuttx/arch/arm/src/arm/up_doirq.c index c82587fff0..7cd1a6a1be 100644 --- a/nuttx/arch/arm/src/arm/up_doirq.c +++ b/nuttx/arch/arm/src/arm/up_doirq.c @@ -79,9 +79,11 @@ void up_doirq(int irq, uint32_t *regs) uint32_t *savestate; /* Nested interrupts are not supported in this implementation. If you want - * implemented nested interrupts, you would have to (1) change the way that - * current regs is handled and (2) the design associated with - * CONFIG_ARCH_INTERRUPTSTACK. + * to implement nested interrupts, you would have to (1) change the way that + * current_regs is handled and (2) the design associated with + * CONFIG_ARCH_INTERRUPTSTACK. The savestate variable will not work for + * that purpose as implemented here because only the outermost nested + * interrupt can result in a context switch (it can probably be deleted). */ /* Current regs non-zero indicates that we are processing an interrupt; diff --git a/nuttx/arch/arm/src/armv7-m/up_doirq.c b/nuttx/arch/arm/src/armv7-m/up_doirq.c index 375054fba6..6063f9ca1c 100644 --- a/nuttx/arch/arm/src/armv7-m/up_doirq.c +++ b/nuttx/arch/arm/src/armv7-m/up_doirq.c @@ -79,9 +79,11 @@ uint32_t *up_doirq(int irq, uint32_t *regs) uint32_t *savestate; /* Nested interrupts are not supported in this implementation. If you want - * implemented nested interrupts, you would have to (1) change the way that - * current regs is handled and (2) the design associated with - * CONFIG_ARCH_INTERRUPTSTACK. + * to implement nested interrupts, you would have to (1) change the way that + * current_regs is handled and (2) the design associated with + * CONFIG_ARCH_INTERRUPTSTACK. The savestate variable will not work for + * that purpose as implemented here because only the outermost nested + * interrupt can result in a context switch (it can probably be deleted). */ /* Current regs non-zero indicates that we are processing an interrupt; diff --git a/nuttx/arch/avr/src/avr/up_doirq.c b/nuttx/arch/avr/src/avr/up_doirq.c index e38bf7fa84..7533d21592 100644 --- a/nuttx/arch/avr/src/avr/up_doirq.c +++ b/nuttx/arch/avr/src/avr/up_doirq.c @@ -79,9 +79,11 @@ uint8_t *up_doirq(uint8_t irq, uint8_t *regs) uint8_t *savestate; /* Nested interrupts are not supported in this implementation. If you want - * implemented nested interrupts, you would have to (1) change the way that - * current regs is handled and (2) the design associated with - * CONFIG_ARCH_INTERRUPTSTACK. + * to implement nested interrupts, you would have to (1) change the way that + * current_regs is handled and (2) the design associated with + * CONFIG_ARCH_INTERRUPTSTACK. The savestate variable will not work for + * that purpose as implemented here because only the outermost nested + * interrupt can result in a context switch (it can probably be deleted). */ /* Current regs non-zero indicates that we are processing an interrupt; diff --git a/nuttx/arch/avr/src/avr32/up_doirq.c b/nuttx/arch/avr/src/avr32/up_doirq.c index 7ade35fadc..2d4a5e14a9 100644 --- a/nuttx/arch/avr/src/avr32/up_doirq.c +++ b/nuttx/arch/avr/src/avr32/up_doirq.c @@ -79,9 +79,11 @@ uint32_t *up_doirq(int irq, uint32_t *regs) uint32_t *savestate; /* Nested interrupts are not supported in this implementation. If you want - * implemented nested interrupts, you would have to (1) change the way that - * current regs is handled and (2) the design associated with - * CONFIG_ARCH_INTERRUPTSTACK. + * to implement nested interrupts, you would have to (1) change the way that + * current_regs is handled and (2) the design associated with + * CONFIG_ARCH_INTERRUPTSTACK. The savestate variable will not work for + * that purpose as implemented here because only the outermost nested + * interrupt can result in a context switch (it can probably be deleted). */ /* Current regs non-zero indicates that we are processing an interrupt; diff --git a/nuttx/arch/hc/src/common/up_doirq.c b/nuttx/arch/hc/src/common/up_doirq.c index d03b007df1..4a56dedbdc 100644 --- a/nuttx/arch/hc/src/common/up_doirq.c +++ b/nuttx/arch/hc/src/common/up_doirq.c @@ -79,9 +79,11 @@ uint8_t *up_doirq(int irq, uint8_t *regs) uint8_t *savestate; /* Nested interrupts are not supported in this implementation. If you want - * implemented nested interrupts, you would have to (1) change the way that - * current regs is handled and (2) the design associated with - * CONFIG_ARCH_INTERRUPTSTACK. + * to implement nested interrupts, you would have to (1) change the way that + * current_regs is handled and (2) the design associated with + * CONFIG_ARCH_INTERRUPTSTACK. The savestate variable will not work for + * that purpose as implemented here because only the outermost nested + * interrupt can result in a context switch (it can probably be deleted). */ /* Current regs non-zero indicates that we are processing an interrupt; diff --git a/nuttx/arch/mips/src/mips32/up_doirq.c b/nuttx/arch/mips/src/mips32/up_doirq.c index 29cdf9c60a..b963881e30 100644 --- a/nuttx/arch/mips/src/mips32/up_doirq.c +++ b/nuttx/arch/mips/src/mips32/up_doirq.c @@ -79,9 +79,11 @@ uint32_t *up_doirq(int irq, uint32_t *regs) uint32_t *savestate; /* Nested interrupts are not supported in this implementation. If you want - * implemented nested interrupts, you would have to (1) change the way that - * current regs is handled and (2) the design associated with - * CONFIG_ARCH_INTERRUPTSTACK. + * to implement nested interrupts, you would have to (1) change the way that + * current_regs is handled and (2) the design associated with + * CONFIG_ARCH_INTERRUPTSTACK. The savestate variable will not work for + * that purpose as implemented here because only the outermost nested + * interrupt can result in a context switch (it can probably be deleted). */ /* Current regs non-zero indicates that we are processing an interrupt; diff --git a/nuttx/arch/sh/src/common/up_doirq.c b/nuttx/arch/sh/src/common/up_doirq.c index 717196682b..185fa96845 100644 --- a/nuttx/arch/sh/src/common/up_doirq.c +++ b/nuttx/arch/sh/src/common/up_doirq.c @@ -79,6 +79,15 @@ uint32_t *up_doirq(int irq, uint32_t* regs) { uint32_t *savestate; + /* Nested interrupts are not supported in this implementation. If + * you want to implement nested interrupts, you would have to (1) + * change the way that current_regs is handled and (2) the design + * associated with CONFIG_ARCH_INTERRUPTSTACK. The savestate + * variable will not work for that purpose as implemented here + * because only the outermost nested interrupt can result in a + * context switch (it can probably be deleted). + */ + /* Current regs non-zero indicates that we are processing * an interrupt; current_regs is also used to manage * interrupt level context switches. diff --git a/nuttx/arch/z16/src/common/up_doirq.c b/nuttx/arch/z16/src/common/up_doirq.c index 670e6985d4..9964f44325 100644 --- a/nuttx/arch/z16/src/common/up_doirq.c +++ b/nuttx/arch/z16/src/common/up_doirq.c @@ -90,6 +90,15 @@ FAR chipreg_t *up_doirq(int irq, FAR chipreg_t *regs) { FAR chipreg_t *savestate; + /* Nested interrupts are not supported in this implementation. If + * you want to implement nested interrupts, you would have to (1) change + * the way that current_regs is handled and (2) the design associated + * with CONFIG_ARCH_INTERRUPTSTACK. The savestate variable will not + * work for that purpose as implemented here because only the outermost + * nested interrupt can result in a context switch (it can probably be + * deleted). + */ + /* Current regs non-zero indicates that we are processing * an interrupt; current_regs is also used to manage * interrupt level context switches. diff --git a/nuttx/arch/z80/include/z80/chip.h b/nuttx/arch/z80/include/z80/chip.h index 5c0c61166a..c355eb7887 100644 --- a/nuttx/arch/z80/include/z80/chip.h +++ b/nuttx/arch/z80/include/z80/chip.h @@ -34,8 +34,8 @@ * ************************************************************************************/ -#ifndef __ARCH_Z80_SRC_Z80_CHIP_H -#define __ARCH_Z80_SRC_Z80_CHIP_H +#ifndef __ARCH_Z80_INCLUDE_Z80_CHIP_H +#define __ARCH_Z80_INCLUDE_Z80_CHIP_H /************************************************************************************ * Included Files @@ -76,4 +76,4 @@ extern "C" { #endif #endif -#endif /* __ARCH_Z80_SRC_Z80_CHIP_H */ +#endif /* __ARCH_Z80_INCLUDE_Z80_CHIP_H */ diff --git a/nuttx/arch/z80/src/common/up_internal.h b/nuttx/arch/z80/src/common/up_internal.h index def13b5462..5f1750b644 100644 --- a/nuttx/arch/z80/src/common/up_internal.h +++ b/nuttx/arch/z80/src/common/up_internal.h @@ -94,28 +94,26 @@ #ifndef __ASSEMBLY__ #ifdef __cplusplus -#define EXTERN extern "C" -extern "C" { -#else -#define EXTERN extern +extern "C" +{ #endif /* Supplied by chip- or board-specific logic */ -EXTERN void up_irqinitialize(void); -EXTERN int up_timerisr(int irq, FAR chipreg_t *regs); +void up_irqinitialize(void); +int up_timerisr(int irq, FAR chipreg_t *regs); #ifdef USE_LOWSERIALINIT -EXTERN void up_lowserialinit(void); +void up_lowserialinit(void); #endif /* Defined in up_doirq.c */ -EXTERN FAR chipreg_t *up_doirq(uint8_t irq, FAR chipreg_t *regs); +FAR chipreg_t *up_doirq(uint8_t irq, FAR chipreg_t *regs); /* Define in up_sigdeliver */ -EXTERN void up_sigdeliver(void); +void up_sigdeliver(void); /* Defined in CPU-specific logic (only for Z180) */ @@ -132,7 +130,7 @@ void up_addregion(void); /* Defined in up_serial.c */ #ifdef USE_SERIALDRIVER -EXTERN void up_serialinit(void); +void up_serialinit(void); #else # define up_serialinit() #endif @@ -140,7 +138,7 @@ EXTERN void up_serialinit(void); /* Defined in drivers/lowconsole.c */ #ifdef CONFIG_DEV_LOWCONSOLE -EXTERN void lowconsole_init(void); +void lowconsole_init(void); #else # define lowconsole_init() #endif @@ -159,14 +157,14 @@ extern void up_puts(const char *str); /* Defined in up_timerisr.c */ -EXTERN void up_timerinit(void); +void up_timerinit(void); /* Defined in board/up_leds.c */ #ifdef CONFIG_ARCH_LEDS -EXTERN void up_ledinit(void); -EXTERN void up_ledon(int led); -EXTERN void up_ledoff(int led); +void up_ledinit(void); +void up_ledon(int led); +void up_ledoff(int led); #else # define up_ledinit() # define up_ledon(led) @@ -176,16 +174,16 @@ EXTERN void up_ledoff(int led); /* Architecture specific hook into the timer interrupt handler */ #ifdef CONFIG_ARCH_TIMERHOOK -EXTERN void up_timerhook(void); +void up_timerhook(void); #endif /* Defined in board/up_network.c */ #ifdef CONFIG_NET -EXTERN int up_netinitialize(void); -EXTERN void up_netuninitialize(void); +int up_netinitialize(void); +void up_netuninitialize(void); # ifdef CONFIG_ARCH_MCFILTER -EXTERN int up_multicastfilter(FAR struct uip_driver_s *dev, FAR uint8_t *mac, bool enable); +int up_multicastfilter(FAR struct uip_driver_s *dev, FAR uint8_t *mac, bool enable); # else # define up_multicastfilter(dev, mac, enable) # endif @@ -197,19 +195,18 @@ EXTERN int up_multicastfilter(FAR struct uip_driver_s *dev, FAR uint8_t *mac, bo /* Return the current value of the stack pointer (used in stack dump logic) */ -EXTERN uint16_t up_getsp(void); +uint16_t up_getsp(void); /* Dump stack and registers */ #ifdef CONFIG_ARCH_STACKDUMP -EXTERN void up_stackdump(void); +void up_stackdump(void); # define REGISTER_DUMP() _REGISTER_DUMP() #else # define up_stackdump() # define REGISTER_DUMP() #endif -#undef EXTERN #ifdef __cplusplus } #endif diff --git a/nuttx/arch/z80/src/ez80/switch.h b/nuttx/arch/z80/src/ez80/switch.h index 0bac6aed1a..0970b25ce7 100644 --- a/nuttx/arch/z80/src/ez80/switch.h +++ b/nuttx/arch/z80/src/ez80/switch.h @@ -67,7 +67,14 @@ #define IN_INTERRUPT() (current_regs != NULL) -/* The following macro is used when the system enters interrupt handling logic */ +/* The following macro is used when the system enters interrupt handling logic + * + * NOTE: Nested interrupts are not supported in this implementation. If you want + * to implement nested interrupts, you would have to change the way that + * current_regs is handled. The savestate variable would not work for + * that purpose as implemented here because only the outermost nested + * interrupt can result in a context switch (it can probably be deleted). + */ #define DECL_SAVESTATE() \ FAR chipreg_t *savestate @@ -132,33 +139,30 @@ extern volatile chipreg_t *current_regs; #ifndef __ASSEMBLY__ #ifdef __cplusplus -#define EXTERN extern "C" -extern "C" { -#else -#define EXTERN extern +extern "C" +{ #endif /* Defined in ez80_copystate.c */ -EXTERN void ez80_copystate(FAR chipreg_t *dest, FAR const chipreg_t *src); +void ez80_copystate(FAR chipreg_t *dest, FAR const chipreg_t *src); /* Defined in ez80_saveusercontext.asm */ -EXTERN int ez80_saveusercontext(FAR chipreg_t *regs); +int ez80_saveusercontext(FAR chipreg_t *regs); /* Defined in ez80_restorecontext.asm */ -EXTERN void ez80_restorecontext(FAR chipreg_t *regs); +void ez80_restorecontext(FAR chipreg_t *regs); /* Defined in ez80_sigsetup.c */ -EXTERN void ez80_sigsetup(FAR _TCB *tcb, sig_deliver_t sigdeliver, chipreg_t *regs); +void ez80_sigsetup(FAR _TCB *tcb, sig_deliver_t sigdeliver, chipreg_t *regs); /* Defined in ez80_registerdump.c */ -EXTERN void ez80_registerdump(void); +void ez80_registerdump(void); -#undef EXTERN #ifdef __cplusplus } #endif diff --git a/nuttx/arch/z80/src/z180/switch.h b/nuttx/arch/z80/src/z180/switch.h index ae80f4f76d..7bf851a7ce 100644 --- a/nuttx/arch/z80/src/z180/switch.h +++ b/nuttx/arch/z80/src/z180/switch.h @@ -77,9 +77,11 @@ * - savestate holds the previous value of current_state. * - savecpr holds the previous value of current_cpr. * - * TODO: I think this logic is bad... I do not thing that this will really - * handle nested interrupts correctly. What if we are nested and then a - * context switch occurs? current_regs will not be updated correctly! + * NOTE: Nested interrupts are not supported in this implementation. If you want + * to implement nested interrupts, you would have to change the way that + * current_regs/cbr is handled. The savestate/savecbr variables would not work + * for that purpose as implemented here because only the outermost nested + * interrupt can result in a context switch (they can probabaly be deleted). */ #define DECL_SAVESTATE() \ @@ -203,33 +205,30 @@ extern uint8_t current_cbr; #ifndef __ASSEMBLY__ #ifdef __cplusplus -#define EXTERN extern "C" -extern "C" { -#else -#define EXTERN extern +extern "C" +{ #endif /* Defined in z180_copystate.c */ -EXTERN void z180_copystate(FAR chipreg_t *dest, FAR const chipreg_t *src); +void z180_copystate(FAR chipreg_t *dest, FAR const chipreg_t *src); /* Defined in z180_saveusercontext.asm */ -EXTERN int z180_saveusercontext(FAR chipreg_t *regs); +int z180_saveusercontext(FAR chipreg_t *regs); /* Defined in z180_restoreusercontext.asm */ -EXTERN void z180_restoreusercontext(FAR chipreg_t *regs); +void z180_restoreusercontext(FAR chipreg_t *regs); /* Defined in z180_sigsetup.c */ -EXTERN void z180_sigsetup(FAR _TCB *tcb, sig_deliver_t sigdeliver, FAR chipreg_t *regs); +void z180_sigsetup(FAR _TCB *tcb, sig_deliver_t sigdeliver, FAR chipreg_t *regs); /* Defined in z180_registerdump.c */ -EXTERN void z180_registerdump(void); +void z180_registerdump(void); -#undef EXTERN #ifdef __cplusplus } #endif diff --git a/nuttx/arch/z80/src/z8/switch.h b/nuttx/arch/z80/src/z8/switch.h index 45089947ca..17f15b6daf 100644 --- a/nuttx/arch/z80/src/z8/switch.h +++ b/nuttx/arch/z80/src/z8/switch.h @@ -112,7 +112,14 @@ #define IN_INTERRUPT() \ (g_z8irqstate.state != Z8_IRQSTATE_NONE) -/* The following macro is used when the system enters interrupt handling logic */ +/* The following macro is used when the system enters interrupt handling logic + * + * NOTE: Nested interrupts are not supported in this implementation. If you want + * to implement nested interrupts, you would have to change the way that + * current_regs is handled. The savestate variable would not work for + * that purpose as implemented here because only the outermost nested + * interrupt can result in a context switch (it can probably be deleted). + */ #define DECL_SAVESTATE() \ struct z8_irqstate_s savestate @@ -216,37 +223,34 @@ extern struct z8_irqstate_s g_z8irqstate; #ifndef __ASSEMBLY__ #ifdef __cplusplus -#define EXTERN extern "C" -extern "C" { -#else -#define EXTERN extern +extern "C" +{ #endif /* Defined in z8_irq.c */ -EXTERN void up_maskack_irq(int irq); +void up_maskack_irq(int irq); /* Defined in z8_saveusercontext.asm */ -EXTERN int z8_saveusercontext(FAR chipreg_t *regs); +int z8_saveusercontext(FAR chipreg_t *regs); /* Defined in z8_saveirqcontext.c */ -EXTERN void z8_saveirqcontext(FAR chipreg_t *regs); +void z8_saveirqcontext(FAR chipreg_t *regs); /* Defined in z8_restorecontext.asm */ -EXTERN void z8_restorecontext(FAR chipreg_t *regs); +void z8_restorecontext(FAR chipreg_t *regs); /* Defined in z8_sigsetup.c */ -EXTERN void z8_sigsetup(FAR _TCB *tcb, sig_deliver_t sigdeliver, FAR chipreg_t *regs); +void z8_sigsetup(FAR _TCB *tcb, sig_deliver_t sigdeliver, FAR chipreg_t *regs); /* Defined in z8_registerdump.c */ -EXTERN void z8_registerdump(void); +void z8_registerdump(void); -#undef EXTERN #ifdef __cplusplus } #endif diff --git a/nuttx/arch/z80/src/z80/switch.h b/nuttx/arch/z80/src/z80/switch.h index 3732a32a39..4a49c70eff 100644 --- a/nuttx/arch/z80/src/z80/switch.h +++ b/nuttx/arch/z80/src/z80/switch.h @@ -66,7 +66,14 @@ #define IN_INTERRUPT() (current_regs != NULL) -/* The following macro is used when the system enters interrupt handling logic */ +/* The following macro is used when the system enters interrupt handling logic + * + * NOTE: Nested interrupts are not supported in this implementation. If you want + * to implement nested interrupts, you would have to change the way that + * current_regs is handled. The savestate variable would not work for + * that purpose as implemented here because only the outermost nested + * interrupt can result in a context switch (it can probably be deleted). + */ #define DECL_SAVESTATE() \ FAR chipreg_t *savestate @@ -131,33 +138,30 @@ extern volatile chipreg_t *current_regs; #ifndef __ASSEMBLY__ #ifdef __cplusplus -#define EXTERN extern "C" -extern "C" { -#else -#define EXTERN extern +extern "C" +{ #endif /* Defined in z80_copystate.c */ -EXTERN void z80_copystate(FAR chipreg_t *dest, FAR const chipreg_t *src); +void z80_copystate(FAR chipreg_t *dest, FAR const chipreg_t *src); /* Defined in z80_saveusercontext.asm */ -EXTERN int z80_saveusercontext(FAR chipreg_t *regs); +int z80_saveusercontext(FAR chipreg_t *regs); /* Defined in z80_restoreusercontext.asm */ -EXTERN void z80_restoreusercontext(FAR chipreg_t *regs); +void z80_restoreusercontext(FAR chipreg_t *regs); /* Defined in z80_sigsetup.c */ -EXTERN void z80_sigsetup(FAR _TCB *tcb, sig_deliver_t sigdeliver, FAR chipreg_t *regs); +void z80_sigsetup(FAR _TCB *tcb, sig_deliver_t sigdeliver, FAR chipreg_t *regs); /* Defined in z80_registerdump.c */ -EXTERN void z80_registerdump(void); +void z80_registerdump(void); -#undef EXTERN #ifdef __cplusplus } #endif From edb3871913d4fa7d6ef0f01827a194d6362c3c71 Mon Sep 17 00:00:00 2001 From: patacongo Date: Sun, 23 Dec 2012 17:35:06 +0000 Subject: [PATCH 006/118] Remove some dependencies of distclean on clean. This should not be necessary in higher level makefiles and should speed up make distclean git-svn-id: http://svn.code.sf.net/p/nuttx/code/trunk@5453 42af7a65-404d-4744-a932-0658087f49c3 --- apps/ChangeLog.txt | 5 +++++ apps/Makefile | 2 +- apps/examples/Makefile | 2 +- apps/interpreters/Makefile | 2 +- apps/netutils/Makefile | 2 +- apps/system/Makefile | 2 +- 6 files changed, 10 insertions(+), 5 deletions(-) diff --git a/apps/ChangeLog.txt b/apps/ChangeLog.txt index 0695747f81..614538ad59 100644 --- a/apps/ChangeLog.txt +++ b/apps/ChangeLog.txt @@ -435,3 +435,8 @@ logic to find the absolute path to the program using the PATH variable. 6.25 2013-xx-xx Gregory Nutt + + * Makefiles: Removed dependency of distclean on clean in most top-level + files. It makes sense for 'leaf' Makefiles to have this dependency, + but it does not make sense for upper-level Makefiles. + diff --git a/apps/Makefile b/apps/Makefile index 353894b7f8..0973d64b5f 100644 --- a/apps/Makefile +++ b/apps/Makefile @@ -177,7 +177,7 @@ endif $(call DELFILE, $(BIN)) $(call CLEAN) -distclean: # clean +distclean: ifeq ($(CONFIG_WINDOWS_NATIVE),y) $(Q) for %%G in ($(SUBDIRS)) do ( \ $(MAKE) -C %%G distclean TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)" \ diff --git a/apps/examples/Makefile b/apps/examples/Makefile index bdbfd4de80..50e9596d78 100644 --- a/apps/examples/Makefile +++ b/apps/examples/Makefile @@ -120,7 +120,7 @@ depend: $(foreach SDIR, $(SUBDIRS), $(SDIR)_depend) clean: $(foreach SDIR, $(SUBDIRS), $(SDIR)_clean) -distclean: clean $(foreach SDIR, $(SUBDIRS), $(SDIR)_distclean) +distclean: $(foreach SDIR, $(SUBDIRS), $(SDIR)_distclean) -include Make.dep diff --git a/apps/interpreters/Makefile b/apps/interpreters/Makefile index 867d45f996..f785287149 100644 --- a/apps/interpreters/Makefile +++ b/apps/interpreters/Makefile @@ -73,4 +73,4 @@ depend: $(foreach SDIR, $(INSTALLED_DIRS), $(SDIR)_depend) clean: $(foreach SDIR, $(INSTALLED_DIRS), $(SDIR)_clean) -distclean: clean $(foreach SDIR, $(INSTALLED_DIRS), $(SDIR)_distclean) +distclean: $(foreach SDIR, $(INSTALLED_DIRS), $(SDIR)_distclean) diff --git a/apps/netutils/Makefile b/apps/netutils/Makefile index 0879ada4e7..781770fc10 100644 --- a/apps/netutils/Makefile +++ b/apps/netutils/Makefile @@ -64,4 +64,4 @@ depend: $(foreach SDIR, $(SUBDIRS), $(SDIR)_depend) clean: $(foreach SDIR, $(SUBDIRS), $(SDIR)_clean) -distclean: clean $(foreach SDIR, $(SUBDIRS), $(SDIR)_distclean) +distclean: $(foreach SDIR, $(SUBDIRS), $(SDIR)_distclean) diff --git a/apps/system/Makefile b/apps/system/Makefile index 9955a6b2ce..057fbcf776 100644 --- a/apps/system/Makefile +++ b/apps/system/Makefile @@ -73,4 +73,4 @@ depend: $(foreach SDIR, $(INSTALLED_DIRS), $(SDIR)_depend) clean: $(foreach SDIR, $(INSTALLED_DIRS), $(SDIR)_clean) -distclean: clean $(foreach SDIR, $(INSTALLED_DIRS), $(SDIR)_distclean) +distclean: $(foreach SDIR, $(INSTALLED_DIRS), $(SDIR)_distclean) From 5cfde412bb9cbd55db2854939d25c2d8e053aaa5 Mon Sep 17 00:00:00 2001 From: patacongo Date: Sun, 23 Dec 2012 20:22:41 +0000 Subject: [PATCH 007/118] Rename namedapp as simply builtin git-svn-id: http://svn.code.sf.net/p/nuttx/code/trunk@5454 42af7a65-404d-4744-a932-0658087f49c3 --- apps/ChangeLog.txt | 1 + apps/Kconfig | 4 +- apps/Make.defs | 4 +- apps/Makefile | 14 ++-- apps/README.txt | 30 +++---- apps/{namedapp => builtin}/Kconfig | 8 +- apps/{namedapp => builtin}/Make.defs | 6 +- apps/{namedapp => builtin}/Makefile | 12 +-- apps/{namedapp => builtin}/binfs.c | 12 +-- .../namedapp.c => builtin/builtin.c} | 12 +-- .../namedapp.h => builtin/builtin.h} | 13 ++- .../exec_builtin.c} | 42 +++++----- apps/include/apps.h | 18 ++--- apps/nshlib/Kconfig | 8 +- apps/nshlib/README.txt | 2 +- apps/nshlib/nsh_apps.c | 6 +- apps/nshlib/nsh_parse.c | 8 +- nuttx/Documentation/NuttShell.html | 81 +++++++++---------- nuttx/configs/cloudctrl/nsh/defconfig | 2 +- .../configs/ez80f910200kitg/ostest/defconfig | 2 +- nuttx/configs/ez80f910200zco/ostest/defconfig | 2 +- nuttx/configs/fire-stm32v2/nsh/defconfig | 2 +- nuttx/configs/p112/ostest/defconfig | 2 +- nuttx/configs/shenzhou/nsh/defconfig | 2 +- nuttx/configs/shenzhou/nxwm/defconfig | 2 +- nuttx/configs/shenzhou/thttpd/defconfig | 2 +- nuttx/configs/sim/README.txt | 6 +- nuttx/configs/sim/cxxtest/defconfig | 2 +- nuttx/configs/sim/nxwm/defconfig | 2 +- nuttx/configs/sim/ostest/defconfig | 2 +- nuttx/configs/stm3220g-eval/nxwm/defconfig | 2 +- .../configs/stm3240g-eval/discover/defconfig | 2 +- nuttx/configs/stm3240g-eval/xmlrpc/defconfig | 2 +- .../configs/stm32f100rc_generic/nsh/defconfig | 2 +- .../stm32f100rc_generic/ostest/defconfig | 2 +- .../stm32f4discovery/cxxtest/defconfig | 2 +- nuttx/configs/stm32f4discovery/elf/defconfig | 2 +- .../stm32f4discovery/nxlines/defconfig | 2 +- .../configs/stm32f4discovery/ostest/defconfig | 2 +- .../stm32f4discovery/winbuild/defconfig | 2 +- nuttx/configs/vsn/src/README.txt | 5 +- nuttx/configs/xtrs/nsh/defconfig | 2 +- nuttx/configs/xtrs/ostest/defconfig | 2 +- nuttx/configs/xtrs/pashello/defconfig | 2 +- .../configs/z16f2800100zcog/ostest/defconfig | 2 +- .../z16f2800100zcog/pashello/defconfig | 2 +- nuttx/configs/z80sim/nsh/defconfig | 2 +- nuttx/configs/z80sim/ostest/defconfig | 2 +- nuttx/configs/z80sim/pashello/defconfig | 2 +- nuttx/configs/z8encore000zco/ostest/defconfig | 2 +- nuttx/configs/z8f64200100kit/ostest/defconfig | 2 +- nuttx/sched/os_bringup.c | 4 +- 52 files changed, 179 insertions(+), 179 deletions(-) rename apps/{namedapp => builtin}/Kconfig (66%) rename apps/{namedapp => builtin}/Make.defs (95%) rename apps/{namedapp => builtin}/Makefile (93%) rename apps/{namedapp => builtin}/binfs.c (98%) rename apps/{namedapp/namedapp.c => builtin/builtin.c} (94%) rename apps/{namedapp/namedapp.h => builtin/builtin.h} (92%) rename apps/{namedapp/exec_namedapp.c => builtin/exec_builtin.c} (86%) diff --git a/apps/ChangeLog.txt b/apps/ChangeLog.txt index 614538ad59..886526b187 100644 --- a/apps/ChangeLog.txt +++ b/apps/ChangeLog.txt @@ -439,4 +439,5 @@ * Makefiles: Removed dependency of distclean on clean in most top-level files. It makes sense for 'leaf' Makefiles to have this dependency, but it does not make sense for upper-level Makefiles. + * namedapp/: Renamed to builtins in preparation for another change. diff --git a/apps/Kconfig b/apps/Kconfig index ea9bd2d314..68c36f5a5c 100644 --- a/apps/Kconfig +++ b/apps/Kconfig @@ -3,8 +3,8 @@ # see misc/tools/kconfig-language.txt. # -menu "Named Applications" -source "$APPSDIR/namedapp/Kconfig" +menu "Built-In Applications" +source "$APPSDIR/builtin/Kconfig" endmenu menu "Examples" diff --git a/apps/Make.defs b/apps/Make.defs index 53ac7f8be5..12b351e7f2 100644 --- a/apps/Make.defs +++ b/apps/Make.defs @@ -36,6 +36,6 @@ define REGISTER @echo "Register: $1" - @echo "{ \"$1\", $2, $3, $4 }," >> "$(APPDIR)/namedapp/namedapp_list.h" - @echo "EXTERN int $4(int argc, char *argv[]);" >> "$(APPDIR)/namedapp/namedapp_proto.h" + @echo "{ \"$1\", $2, $3, $4 }," >> "$(APPDIR)/builtin/builtin_list.h" + @echo "EXTERN int $4(int argc, char *argv[]);" >> "$(APPDIR)/builtin/builtin_proto.h" endef diff --git a/apps/Makefile b/apps/Makefile index 0973d64b5f..299560195c 100644 --- a/apps/Makefile +++ b/apps/Makefile @@ -44,11 +44,11 @@ APPDIR = ${shell pwd} # action. It is created by the configured appconfig file (a copy of which # appears in this directory as .config) # SUBDIRS is the list of all directories containing Makefiles. It is used -# only for cleaning. namedapp must always be the first in the list. This +# only for cleaning. builtin must always be the first in the list. This # list can be extended by the .config file as well. CONFIGURED_APPS = -SUBDIRS = examples graphics interpreters modbus namedapp nshlib netutils system +SUBDIRS = examples graphics interpreters modbus builtin nshlib netutils system # There are two different mechanisms for obtaining the list of configured # directories: @@ -69,9 +69,9 @@ SUBDIRS = examples graphics interpreters modbus namedapp nshlib netutils system ifeq ($(CONFIG_NUTTX_NEWCONFIG),y) -# namedapp/Make.defs must be included first +# builtin/Make.defs must be included first -include namedapp/Make.defs +include builtin/Make.defs include examples/Make.defs include graphics/Make.defs include interpreters/Make.defs @@ -82,7 +82,7 @@ include system/Make.defs # INSTALLED_APPS is the list of currently available application directories. It # is the same as CONFIGURED_APPS, but filtered to exclude any non-existent -# application directory. namedapp is always in the list of applications to be +# application directory. builtin is always in the list of applications to be # built. INSTALLED_APPS = @@ -94,10 +94,10 @@ else # INSTALLED_APPS is the list of currently available application directories. It # is the same as CONFIGURED_APPS, but filtered to exclude any non-existent -# application directory. namedapp is always in the list of applications to be +# application directory. builtin is always in the list of applications to be # built. -INSTALLED_APPS = namedapp +INSTALLED_APPS = builtin endif # Create the list of available applications (INSTALLED_APPS) diff --git a/apps/README.txt b/apps/README.txt index 7a379254e7..4f043dcfab 100644 --- a/apps/README.txt +++ b/apps/README.txt @@ -6,12 +6,12 @@ Contents General Directory Location - Named Applications - Named Startup main() function + Built-In Applications + Built-In Startup main() function NuttShell (NSH) Built-In Commands Synchronous Built-In Commands Application Configuration File - Example Named Application + Example Built-In Application Building NuttX with Board-Specific Pieces Outside the Source Tree General @@ -47,14 +47,14 @@ ways to do that: path to the application directory on the configuration command line like: ./configure.sh -a / -Named Applications ------------------- +Built-In Applications +--------------------- NuttX also supports applications that can be started using a name string. In this case, application entry points with their requirements are gathered together in two files: - - namedapp/namedapp_proto.h Entry points, prototype function - - namedapp/namedapp_list.h Application specific information and requirements + - builtin/builtin_proto.h Entry points, prototype function + - builtin/builtin_list.h Application specific information and requirements The build occurs in several phases as different build targets are executed: (1) context, (2) depend, and (3) default (all). Application information is @@ -62,18 +62,18 @@ collected during the make context build phase. To execute an application function: - exec_namedapp() is defined in the nuttx/include/apps/apps.h + exec_builtin() is defined in the nuttx/include/apps/apps.h NuttShell (NSH) Built-In Commands --------------------------------- -One use of named applications is to provide a way of invoking your custom +One use of builtin applications is to provide a way of invoking your custom application through the NuttShell (NSH) command line. NSH will support a seamless method invoking the applications, when the following option is enabled in the NuttX configuration file: CONFIG_NSH_BUILTIN_APPS=y -Applications registered in the apps/namedapp/namedapp_list.h file will then +Applications registered in the apps/builtin/builtin_list.h file will then be accessible from the NSH command line. If you type 'help' at the NSH prompt, you will see a list of the registered commands. @@ -109,9 +109,9 @@ CONFIGURED_APPS list like: CONFIGURED_APPS += examples/hello system/poweroff -Named Start-Up main() function +Built-In Start-Up main() function ------------------------------ -A named application can even be used as the main, start-up entry point +A builtin application can even be used as the main, start-up entry point into your embedded software. When the user defines this option in the NuttX configuration file: @@ -124,10 +124,10 @@ will call: int hello_main(int argc, char *argv[]) -Example Named Application -------------------------- +Example Built-In Application +---------------------------- An example application skeleton can be found under the examples/hello -sub-directory. This example shows how a named application can be added +sub-directory. This example shows how a builtin application can be added to the project. One must define: 1. create sub-directory as: appname diff --git a/apps/namedapp/Kconfig b/apps/builtin/Kconfig similarity index 66% rename from apps/namedapp/Kconfig rename to apps/builtin/Kconfig index 8d8f03421b..8310e6df9b 100644 --- a/apps/namedapp/Kconfig +++ b/apps/builtin/Kconfig @@ -3,13 +3,13 @@ # see misc/tools/kconfig-language.txt. # -config NAMEDAPP - bool "Support named applications" +config BUILTIN + bool "Support Builtin Applications" default n ---help--- - Enable support for named applications. This features assigns a string + Enable support for builtin applications. This features assigns a string name to an application. This feature is also the underlying requirement to support built-in applications in the NuttShell (NSH). -if NAMEDAPP +if BUILTIN endif diff --git a/apps/namedapp/Make.defs b/apps/builtin/Make.defs similarity index 95% rename from apps/namedapp/Make.defs rename to apps/builtin/Make.defs index 399fefee8a..ab6292cc3f 100644 --- a/apps/namedapp/Make.defs +++ b/apps/builtin/Make.defs @@ -1,5 +1,5 @@ ############################################################################ -# apps/namedapps/Make.defs +# apps/builtin/Make.defs # Adds selected applications to apps/ build # # Copyright (C) 2012 Gregory Nutt. All rights reserved. @@ -34,7 +34,7 @@ # ############################################################################ -ifeq ($(CONFIG_NAMEDAPP),y) -CONFIGURED_APPS += namedapp +ifeq ($(CONFIG_BUILTIN),y) +CONFIGURED_APPS += builtin endif diff --git a/apps/namedapp/Makefile b/apps/builtin/Makefile similarity index 93% rename from apps/namedapp/Makefile rename to apps/builtin/Makefile index a88c735674..72ba0347f7 100644 --- a/apps/namedapp/Makefile +++ b/apps/builtin/Makefile @@ -1,5 +1,5 @@ ############################################################################ -# apps/nshlib/Makefile +# apps/builtin/Makefile # # Copyright (C) 2011-2012 Gregory Nutt. All rights reserved. # Author: Gregory Nutt @@ -42,7 +42,7 @@ include $(APPDIR)/Make.defs # Source and object files ASRCS = -CSRCS = namedapp.c exec_namedapp.c +CSRCS = builtin.c exec_builtin.c ifeq ($(CONFIG_APPS_BINDIR),y) CSRCS += binfs.c @@ -83,8 +83,8 @@ $(COBJS): %$(OBJEXT): %.c $(Q) touch .built .context: - @echo "/* List of application requirements, generated during make context. */" > namedapp_list.h - @echo "/* List of application entry points, generated during make context. */" > namedapp_proto.h + @echo "/* List of application requirements, generated during make context. */" > builtin_list.h + @echo "/* List of application entry points, generated during make context. */" > builtin_proto.h $(Q) touch $@ context: .context @@ -103,8 +103,8 @@ distclean: clean $(call DELFILE, .context) $(call DELFILE, Make.dep) $(call DELFILE, .depend) - $(call DELFILE, namedapp_list.h) - $(call DELFILE, namedapp_proto.h) + $(call DELFILE, builtin_list.h) + $(call DELFILE, builtin_proto.h) -include Make.dep diff --git a/apps/namedapp/binfs.c b/apps/builtin/binfs.c similarity index 98% rename from apps/namedapp/binfs.c rename to apps/builtin/binfs.c index 36e3ace92e..501f0a4b93 100644 --- a/apps/namedapp/binfs.c +++ b/apps/builtin/binfs.c @@ -1,5 +1,5 @@ /**************************************************************************** - * apps/namedapps/binfs.c + * apps/builtin/binfs.c * * Copyright (C) 2011-2012 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -55,7 +55,7 @@ #include #include -#include "namedapp.h" +#include "builtin.h" #if !defined(CONFIG_DISABLE_MOUNTPOINT) && defined(CONFIG_APPS_BINDIR) @@ -362,7 +362,7 @@ static int binfs_readdir(struct inode *mountpt, struct fs_dirent_s *dir) /* Have we reached the end of the directory */ index = dir->u.binfs.fb_index; - if (namedapps[index].name == NULL) + if (builtins[index].name == NULL) { /* We signal the end of the directory by returning the * special error -ENOENT @@ -375,9 +375,9 @@ static int binfs_readdir(struct inode *mountpt, struct fs_dirent_s *dir) { /* Save the filename and file type */ - fvdbg("Entry %d: \"%s\"\n", index, namedapps[index].name); + fvdbg("Entry %d: \"%s\"\n", index, builtins[index].name); dir->fd_dir.d_type = DTYPE_FILE; - strncpy(dir->fd_dir.d_name, namedapps[index].name, NAME_MAX+1); + strncpy(dir->fd_dir.d_name, builtins[index].name, NAME_MAX+1); /* The application list is terminated by an entry with a NULL name. * Therefore, there is at least one more entry in the list. @@ -559,7 +559,7 @@ static int binfs_stat(struct inode *mountpt, const char *relpath, struct stat *b { /* Check if there is a file with this name. */ - if (namedapp_isavail(relpath) < 0) + if (builtin_isavail(relpath) < 0) { ret = -ENOENT; goto errout_with_semaphore; diff --git a/apps/namedapp/namedapp.c b/apps/builtin/builtin.c similarity index 94% rename from apps/namedapp/namedapp.c rename to apps/builtin/builtin.c index d59ce6e3b7..a6ed7dd3fb 100644 --- a/apps/namedapp/namedapp.c +++ b/apps/builtin/builtin.c @@ -1,5 +1,5 @@ /**************************************************************************** - * apps/namedaps/namedapp.c + * apps/builtin/builtin.c * * Copyright (C) 2011 Uros Platise. All rights reserved. * Copyright (C) 2011 Gregory Nutt. All rights reserved. @@ -62,11 +62,11 @@ extern "C" { #define EXTERN extern #endif -#include "namedapp_proto.h" +#include "builtin_proto.h" -const struct namedapp_s namedapps[] = +const struct builtin_s builtins[] = { -# include "namedapp_list.h" +# include "builtin_list.h" { NULL, 0, 0, 0 } }; @@ -88,9 +88,9 @@ const struct namedapp_s namedapps[] = * Public Functions ****************************************************************************/ -int number_namedapps(void) +int number_builtins(void) { - return sizeof(namedapps)/sizeof(struct namedapp_s) - 1; + return sizeof(builtins)/sizeof(struct builtin_s) - 1; } diff --git a/apps/namedapp/namedapp.h b/apps/builtin/builtin.h similarity index 92% rename from apps/namedapp/namedapp.h rename to apps/builtin/builtin.h index 7fcdf42dc2..3f7ddd7ce3 100644 --- a/apps/namedapp/namedapp.h +++ b/apps/builtin/builtin.h @@ -1,5 +1,5 @@ /**************************************************************************** - * apps/namedaps/namedapp.h + * apps/builtin/builtin.h * * Copyright (C) 2011 Uros Platise. All rights reserved. * Copyright (C) 2011-2012 Gregory Nutt. All rights reserved. @@ -35,8 +35,8 @@ * ****************************************************************************/ -#ifndef __APPS_NAMEDAPP_NAMEDAPP_H -#define __APPS_NAMEDAPP_NAMEDAPP_H +#ifndef __APPS_BUILTIN_BUILTIN_H +#define __APPS_BUILTIN_BUILTIN_H /**************************************************************************** * Included Files @@ -53,7 +53,6 @@ * Public Data ****************************************************************************/ -#undef EXTERN #if defined(__cplusplus) #define EXTERN extern "C" extern "C" { @@ -61,18 +60,18 @@ extern "C" { #define EXTERN extern #endif -EXTERN const struct namedapp_s namedapps[]; +EXTERN const struct builtin_s builtins[]; /**************************************************************************** * Public Functions ****************************************************************************/ -EXTERN int number_namedapps(void); +EXTERN int number_builtins(void); #undef EXTERN #if defined(__cplusplus) } #endif -#endif /* __APPS_NAMEDAPP_NAMEDAPP_H */ +#endif /* __APPS_BUILTIN_BUILTIN_H */ diff --git a/apps/namedapp/exec_namedapp.c b/apps/builtin/exec_builtin.c similarity index 86% rename from apps/namedapp/exec_namedapp.c rename to apps/builtin/exec_builtin.c index 264fca7b9e..dc36302300 100644 --- a/apps/namedapp/exec_namedapp.c +++ b/apps/builtin/exec_builtin.c @@ -1,5 +1,5 @@ /**************************************************************************** - * apps/namedaps/exec_namedapp.c + * apps/builtin/exec_builtin.c * * Copyright (C) 2011 Uros Platise. All rights reserved. * Author: Uros Platise @@ -49,7 +49,7 @@ #include #include -#include "namedapp.h" +#include "builtin.h" /**************************************************************************** * Private Types @@ -72,26 +72,26 @@ ****************************************************************************/ /**************************************************************************** - * Name: namedapp_getname + * Name: builtin_getname * * Description: - * Return the name of the application at index in the table of named + * Return the name of the application at index in the table of builtin * applications. * ****************************************************************************/ -const char *namedapp_getname(int index) +const char *builtin_getname(int index) { - if (index < 0 || index >= number_namedapps()) + if (index < 0 || index >= number_builtins()) { return NULL; } - return namedapps[index].name; + return builtins[index].name; } /**************************************************************************** - * Name: namedapp_isavail + * Name: builtin_isavail * * Description: * Return the index into the table of applications for the applicaiton with @@ -99,13 +99,13 @@ const char *namedapp_getname(int index) * ****************************************************************************/ -int namedapp_isavail(FAR const char *appname) +int builtin_isavail(FAR const char *appname) { int i; - for (i = 0; namedapps[i].name; i++) + for (i = 0; builtins[i].name; i++) { - if (!strcmp(namedapps[i].name, appname)) + if (!strcmp(builtins[i].name, appname)) { return i; } @@ -116,39 +116,39 @@ int namedapp_isavail(FAR const char *appname) } /**************************************************************************** - * Name: namedapp_isavail + * Name: builtin_isavail * * Description: * Execute the application with name 'appname', providing the arguments * in the argv[] array. * * Returned Value: - * On success, the task ID of the named application is returned. On + * On success, the task ID of the builtin application is returned. On * failure, -1 (ERROR) is returned an the errno value is set appropriately. * ****************************************************************************/ -int exec_namedapp(FAR const char *appname, FAR const char **argv) +int exec_builtin(FAR const char *appname, FAR const char **argv) { pid_t pid; int index; /* Verify that an application with this name exists */ - index = namedapp_isavail(appname); + index = builtin_isavail(appname); if (index >= 0) { - /* Disable pre-emption. This means that although we start the named + /* Disable pre-emption. This means that although we start the builtin * application here, it will not actually run until pre-emption is * re-enabled below. */ sched_lock(); - /* Start the named application task */ + /* Start the builtin application task */ - pid = TASK_CREATE(namedapps[index].name, namedapps[index].priority, - namedapps[index].stacksize, namedapps[index].main, + pid = TASK_CREATE(builtins[index].name, builtins[index].priority, + builtins[index].stacksize, builtins[index].main, (argv) ? &argv[1] : (const char **)NULL); /* If robin robin scheduling is enabled, then set the scheduling policy @@ -165,11 +165,11 @@ int exec_namedapp(FAR const char *appname, FAR const char **argv) * new task cannot yet have changed from its initial value. */ - param.sched_priority = namedapps[index].priority; + param.sched_priority = builtins[index].priority; sched_setscheduler(pid, SCHED_RR, ¶m); } #endif - /* Now let the named application run */ + /* Now let the builtin application run */ sched_unlock(); diff --git a/apps/include/apps.h b/apps/include/apps.h index 520128203e..37599ac5c5 100644 --- a/apps/include/apps.h +++ b/apps/include/apps.h @@ -52,7 +52,7 @@ * Public Types ****************************************************************************/ -struct namedapp_s +struct builtin_s { const char *name; /* Invocation name and as seen under /sbin/ */ int priority; /* Use: SCHED_PRIORITY_DEFAULT */ @@ -64,7 +64,7 @@ struct namedapp_s * Public Data ****************************************************************************/ -/* The "bindir" is file system that supports access to the named applications. +/* The "bindir" is file system that supports access to the builtin applications. * It is typically mounted under /bin. */ @@ -86,7 +86,7 @@ extern "C" { #endif /**************************************************************************** - * Name: namedapp_isavail + * Name: builtin_isavail * * Description: * Checks for availabiliy of application registerred during compile time. @@ -101,10 +101,10 @@ extern "C" { * ****************************************************************************/ -EXTERN int namedapp_isavail(FAR const char *appname); +EXTERN int builtin_isavail(FAR const char *appname); /**************************************************************************** - * Name: namedapp_getname + * Name: builtin_getname * * Description: * Returns pointer to a name of built-in application pointed by the @@ -119,13 +119,13 @@ EXTERN int namedapp_isavail(FAR const char *appname); * ****************************************************************************/ -EXTERN const char *namedapp_getname(int index); +EXTERN const char *builtin_getname(int index); /**************************************************************************** - * Name: exec_namedapp + * Name: exec_builtin * * Description: - * Executes builtin named application registered during compile time. + * Executes builtin applications registered during 'make context' time. * New application is run in a separate task context (and thread). * * Input Parameter: @@ -139,7 +139,7 @@ EXTERN const char *namedapp_getname(int index); * ****************************************************************************/ -EXTERN int exec_namedapp(FAR const char *appname, FAR const char **argv); +EXTERN int exec_builtin(FAR const char *appname, FAR const char **argv); #undef EXTERN #if defined(__cplusplus) diff --git a/apps/nshlib/Kconfig b/apps/nshlib/Kconfig index 17b107b8f5..e60e9c4806 100644 --- a/apps/nshlib/Kconfig +++ b/apps/nshlib/Kconfig @@ -15,12 +15,12 @@ if NSH_LIBRARY config NSH_BUILTIN_APPS bool "Enable built-in applications" default y - depends on NAMEDAPP + depends on BUILTIN ---help--- - Support external registered, "named" applications that can be + Support external registered, "built-in" applications that can be executed from the NSH command line (see apps/README.txt for - more information). This options requires support for named applications - (NAMEDAPP). + more information). This options requires support for builtin + applications (BUILTIN). menu "Disable Individual commands" diff --git a/apps/nshlib/README.txt b/apps/nshlib/README.txt index bc626e6995..006839628c 100644 --- a/apps/nshlib/README.txt +++ b/apps/nshlib/README.txt @@ -945,7 +945,7 @@ NSH-Specific Configuration Settings the configs//defconfig file: * CONFIG_NSH_BUILTIN_APPS - Support external registered, "named" applications that can be + Support external registered, "builtin" applications that can be executed from the NSH command line (see apps/README.txt for more information). diff --git a/apps/nshlib/nsh_apps.c b/apps/nshlib/nsh_apps.c index 7dbaf9ba8d..ea8791eef2 100644 --- a/apps/nshlib/nsh_apps.c +++ b/apps/nshlib/nsh_apps.c @@ -90,7 +90,7 @@ * Attempt to execute the application task whose name is 'cmd' * * Returned Value: - * <0 If exec_namedapp() fails, then the negated errno value + * <0 If exec_builtin() fails, then the negated errno value * is returned. * -1 (ERROR) if the application task corresponding to 'cmd' could not * be started (possibly because it doesn not exist). @@ -119,7 +119,7 @@ int nsh_execapp(FAR struct nsh_vtbl_s *vtbl, FAR const char *cmd, * applications. */ - ret = exec_namedapp(cmd, (FAR const char **)argv); + ret = exec_builtin(cmd, (FAR const char **)argv); if (ret >= 0) { /* The application was successfully started (but still blocked because @@ -205,7 +205,7 @@ int nsh_execapp(FAR struct nsh_vtbl_s *vtbl, FAR const char *cmd, sched_unlock(); - /* If exec_namedapp() or waitpid() failed, then return the negated errno + /* If exec_builtin() or waitpid() failed, then return the negated errno * value. */ diff --git a/apps/nshlib/nsh_parse.c b/apps/nshlib/nsh_parse.c index 27068acff0..70fa39f62a 100644 --- a/apps/nshlib/nsh_parse.c +++ b/apps/nshlib/nsh_parse.c @@ -605,7 +605,7 @@ static inline void help_builtins(FAR struct nsh_vtbl_s *vtbl) /* List the set of available built-in commands */ nsh_output(vtbl, "\nBuiltin Apps:\n"); - for (i = 0; (name = namedapp_getname(i)) != NULL; i++) + for (i = 0; (name = builtin_getname(i)) != NULL; i++) { nsh_output(vtbl, " %s\n", name); } @@ -726,7 +726,7 @@ static int cmd_exit(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv) * Exectue the command in argv[0] * * Returned Value: - * <0 If exec_namedapp() fails, then the negated errno value + * <0 If exec_builtin() fails, then the negated errno value * is returned. * -1 (ERRROR) if the command was unsuccessful * 0 (OK) if the command was successful @@ -1439,13 +1439,13 @@ int nsh_parse(FAR struct nsh_vtbl_s *vtbl, char *cmdline) } /* Handle the case where the command is executed in background. - * However is app is to be started as namedapp new process will + * However is app is to be started as builtin new process will * be created anyway, so skip this step. */ #ifndef CONFIG_NSH_DISABLEBG if (vtbl->np.np_bg #ifdef CONFIG_NSH_BUILTIN_APPS - && namedapp_isavail(argv[0]) < 0 + && builtin_isavail(argv[0]) < 0 #endif ) { diff --git a/nuttx/Documentation/NuttShell.html b/nuttx/Documentation/NuttShell.html index 0b5f7aa11b..cc3f078ddf 100644 --- a/nuttx/Documentation/NuttShell.html +++ b/nuttx/Documentation/NuttShell.html @@ -2515,7 +2515,7 @@ nsh> CONFIG_NSH_BUILTIN_APPS - Support external registered, "named" applications that can be + Support external registered, "builtin" applications that can be executed from the NSH command line (see apps/README.txt for more information). @@ -3239,48 +3239,48 @@ Builtin Apps: Note that no detailed help information beyond the name of the built-in application is provided.

            -

            4.3.1 Named Applications

            +

            4.3.1 Built-In Applications

            Overview. - The underlying logic that supports the NSH built-in applications is called "Named Applications". - The named application logic can be found at apps/namedapp. + The underlying logic that supports the NSH built-in applications is called "Built-In Applications". + The builtin application logic can be found at apps/builtin. This logic simply does the following:

            1. - It supports registration mechanism so that named applications can dynamically register themselves at build time, and + It supports registration mechanism so that builtin applications can dynamically register themselves at build time, and

            2. - Utility functions to look up, list, and execute the named applications. + Utility functions to look up, list, and execute the builtin applications.

            - Named Application Utility Functions. - The utility functions exported by the named application logic are prototyped in apps/include/apps.h. + Built-In Application Utility Functions. + The utility functions exported by the builtin application logic are prototyped in apps/include/apps.h. These utility functions include:

            • - int namedapp_isavail(FAR const char *appname); + int builtin_isavail(FAR const char *appname); Checks for availability of application registered as appname during build time.

            • - const char *namedapp_getname(int index); + const char *builtin_getname(int index); Returns a pointer to a name of built-in application pointed by the index. This is the utility function that is used by NSH in order to list the available built-in applications when "nsh> help" is entered.

            • - int exec_namedapp(FAR const char *appname, FAR const char **argv); - Executes built-in named application registered during compile time. + int exec_builtin(FAR const char *appname, FAR const char **argv); + Executes built-in builtin application registered during compile time. This is the utility function used by NSH to execute the built-in application.

            @@ -3292,23 +3292,23 @@ Builtin Apps:
            1. - apps/namedapp/namedapp_proto.h: + apps/builtin/builtin_proto.h: Prototypes of application task entry points.

            2. - apps/namedapp/namedapp_list.h: + apps/builtin/builtin_list.h: Application specific information and start-up requirements

            - Registration of Named Applications. + Registration of Built-In Applications. The NuttX build occurs in several phases as different build targets are executed: (1) context when the configuration is established, (2) depend when target dependencies are generated, and (3) default (all) when the normal compilation and link operations are performed. - Named application information is collected during the make context build phase. + Built-in application information is collected during the make context build phase.

            @@ -3376,7 +3376,7 @@ make apps_distclean

          - Logic for the context target in apps/examples/hello/Makefile registers the hello_main() application in the namedapp's namedapp_proto.hand namedapp_list.h files. + Logic for the context target in apps/examples/hello/Makefile registers the hello_main() application in the builtin's builtin_proto.hand builtin_list.h files. That logic that does that in apps/examples/hello/Makefile is abstracted below:

            @@ -3388,13 +3388,13 @@ make apps_distclean include $(APPDIR)/Make.defs

        - This defines a macro called REGISTER that adds data to the namedapp header files: + This defines a macro called REGISTER that adds data to the builtin header files:

           define REGISTER
               @echo "Register: $1"
          -    @echo "{ \"$1\", $2, $3, $4 }," >> "$(APPDIR)/namedapp/namedapp_list.h"
          -    @echo "EXTERN int $4(int argc, char *argv[]);" >> "$(APPDIR)/namedapp/namedapp_proto.h"
          +    @echo "{ \"$1\", $2, $3, $4 }," >> "$(APPDIR)/builtin/builtin_list.h"
          +    @echo "EXTERN int $4(int argc, char *argv[]);" >> "$(APPDIR)/builtin/builtin_proto.h"
           endef
           

        @@ -3412,7 +3412,7 @@ STACKSIZE = 2048

      • - And finally, the Makefile invokes the REGISTER macro to added the hello_main() named application. + And finally, the Makefile invokes the REGISTER macro to added the hello_main() builtin application. Then, when the system build completes, the hello command can be executed from the NSH command line. When the hello command is executed, it will start the task with entry point hello_main() with the default priority and with a stack size of 2K.

        @@ -3424,16 +3424,16 @@ STACKSIZE = 2048

        - Other Uses of Named Application. - The primary purpose of named applications is to support command line execution of applications from NSH. - However, there are two other uses of named applications that should be mentioned. + Other Uses of Built-In Application. + The primary purpose of builtin applications is to support command line execution of applications from NSH. + However, there are two other uses of builtin applications that should be mentioned.

        1. - Named Application Start-Up main() function. - A named application can even be used as the main, start-up entry point into your embedded software. + Built-In Application Start-Up main() function. + A builtin application can even be used as the main, start-up entry point into your embedded software. When the user defines this option in the NuttX configuration file:

            @@ -3451,11 +3451,11 @@ CONFIG_BUILTIN_APP_START=<application name>
             
               
          • binfs. - binfs is a tiny file system located at apps/namedapp/binfs.c. - This provides an alternative what of visualizing installed named applications. - Without binfs, you can see the installed named applications using the NSH help command. + binfs is a tiny file system located at apps/builtin/binfs.c. + This provides an alternative what of visualizing installed builtin applications. + Without binfs, you can see the installed builtin applications using the NSH help command. binfs will create a tiny pseudo-file system mounted at /bin. - Using binfs, you can see the available named applications by listing the contents of /bin directory. + Using binfs, you can see the available builtin applications by listing the contents of /bin directory. This gives some superficial Unix compatibility, but does not really add any new functionality.

        @@ -3762,7 +3762,12 @@ mount -t vfat /dev/ram1 /tmp
      • Background command priority
      • binfs
      • Built-In applications
      • +
      • Built-In application start-up main()
      • Built-in variables
      • +
      • builtin_getname()
      • +
      • builtin_isavail()
      • +
      • builtin_list.h
      • +
      • builtin_proto.h
      • base64dec
      • base64enc
      • cat
      • @@ -3827,12 +3832,12 @@ mount -t vfat /dev/ram1 /tmp
      • echo
      • Environment Variables
      • /etc/init.d/rcS -
      • exec
      • -
      • exec_namedapp()
      • -
      • exit
      • -
      • free
    +
  • exec
  • +
  • exec_builtin()
  • +
  • exit
  • +
  • free
  • g_cmdmap
  • genromfs
  • get
  • @@ -3858,12 +3863,6 @@ mount -t vfat /dev/ram1 /tmp
  • mkromfsimg.sh
  • mount
  • mv
  • -
  • Named application start-up main()
  • -
  • Named applications
  • -
  • namedapp_getname()
  • -
  • namedapp_isavail()
  • -
  • namedapp_list.h
  • -
  • namedapp_proto.h
  • nfsmount
  • nice
  • NSH library (nshlib)
  • @@ -3887,7 +3886,7 @@ mount -t vfat /dev/ram1 /tmp
  • PWD
  • rcS.template
  • Re-directed commands
  • -
  • Registration of named applications
  • +
  • Registration of builtin applications
  • rm
  • rmdir
  • ROMFS, Modifying the ROMFS image
  • diff --git a/nuttx/configs/cloudctrl/nsh/defconfig b/nuttx/configs/cloudctrl/nsh/defconfig index fbb5e8c139..99c7eb7901 100644 --- a/nuttx/configs/cloudctrl/nsh/defconfig +++ b/nuttx/configs/cloudctrl/nsh/defconfig @@ -505,7 +505,7 @@ CONFIG_HAVE_CXX=y # # Named Applications # -CONFIG_NAMEDAPP=y +CONFIG_BUILTIN=y # # Examples diff --git a/nuttx/configs/ez80f910200kitg/ostest/defconfig b/nuttx/configs/ez80f910200kitg/ostest/defconfig index 50efbfdaf3..80c9e682ea 100644 --- a/nuttx/configs/ez80f910200kitg/ostest/defconfig +++ b/nuttx/configs/ez80f910200kitg/ostest/defconfig @@ -334,7 +334,7 @@ CONFIG_LIB_SENDFILE_BUFSIZE=512 # # Named Applications # -# CONFIG_NAMEDAPP is not set +# CONFIG_BUILTIN is not set # # Examples diff --git a/nuttx/configs/ez80f910200zco/ostest/defconfig b/nuttx/configs/ez80f910200zco/ostest/defconfig index 3a13523331..88c1b72791 100644 --- a/nuttx/configs/ez80f910200zco/ostest/defconfig +++ b/nuttx/configs/ez80f910200zco/ostest/defconfig @@ -342,7 +342,7 @@ CONFIG_LIB_SENDFILE_BUFSIZE=512 # # Named Applications # -# CONFIG_NAMEDAPP is not set +# CONFIG_BUILTIN is not set # # Examples diff --git a/nuttx/configs/fire-stm32v2/nsh/defconfig b/nuttx/configs/fire-stm32v2/nsh/defconfig index 2fb623a0d0..c42bb15696 100644 --- a/nuttx/configs/fire-stm32v2/nsh/defconfig +++ b/nuttx/configs/fire-stm32v2/nsh/defconfig @@ -531,7 +531,7 @@ CONFIG_LIB_SENDFILE_BUFSIZE=512 # # Named Applications # -CONFIG_NAMEDAPP=y +CONFIG_BUILTIN=y # # Examples diff --git a/nuttx/configs/p112/ostest/defconfig b/nuttx/configs/p112/ostest/defconfig index c30adcf225..3699475c59 100644 --- a/nuttx/configs/p112/ostest/defconfig +++ b/nuttx/configs/p112/ostest/defconfig @@ -370,7 +370,7 @@ CONFIG_LIB_SENDFILE_BUFSIZE=512 # # Named Applications # -# CONFIG_NAMEDAPP is not set +# CONFIG_BUILTIN is not set # # Examples diff --git a/nuttx/configs/shenzhou/nsh/defconfig b/nuttx/configs/shenzhou/nsh/defconfig index 36f8e40fc6..c54d714d0d 100644 --- a/nuttx/configs/shenzhou/nsh/defconfig +++ b/nuttx/configs/shenzhou/nsh/defconfig @@ -505,7 +505,7 @@ CONFIG_HAVE_CXX=y # # Named Applications # -CONFIG_NAMEDAPP=y +CONFIG_BUILTIN=y # # Examples diff --git a/nuttx/configs/shenzhou/nxwm/defconfig b/nuttx/configs/shenzhou/nxwm/defconfig index 0f100ed5e5..9753277470 100644 --- a/nuttx/configs/shenzhou/nxwm/defconfig +++ b/nuttx/configs/shenzhou/nxwm/defconfig @@ -630,7 +630,7 @@ CONFIG_HAVE_CXXINITIALIZE=y # # Named Applications # -CONFIG_NAMEDAPP=y +CONFIG_BUILTIN=y # # Examples diff --git a/nuttx/configs/shenzhou/thttpd/defconfig b/nuttx/configs/shenzhou/thttpd/defconfig index ccbcf9ab25..958ab02ed1 100644 --- a/nuttx/configs/shenzhou/thttpd/defconfig +++ b/nuttx/configs/shenzhou/thttpd/defconfig @@ -474,7 +474,7 @@ CONFIG_HAVE_CXX=y # # Named Applications # -CONFIG_NAMEDAPP=y +CONFIG_BUILTIN=y # # Examples diff --git a/nuttx/configs/sim/README.txt b/nuttx/configs/sim/README.txt index f1dfd0dd22..03f163ea5a 100644 --- a/nuttx/configs/sim/README.txt +++ b/nuttx/configs/sim/README.txt @@ -148,9 +148,9 @@ If you are running X11 applications as NSH add-on programs, then the stack size of the add-on program is controlled in another way. Here are the steps for increasing the stack size in that case: - cd ../apps/namedapps # Go to the namedapps directory - vi namedapps_list.h # Edit this file and increase the stack size of the add-on - rm .built *.o # This will force the namedapps logic to rebuild + cd ../apps/builtin # Go to the builtin apps directory + vi builtin_list.h # Edit this file and increase the stack size of the add-on + rm .built *.o # This will force the builtin apps logic to rebuild Buffered I/O Issues ------------------- diff --git a/nuttx/configs/sim/cxxtest/defconfig b/nuttx/configs/sim/cxxtest/defconfig index 648a928519..6ac45d44d8 100644 --- a/nuttx/configs/sim/cxxtest/defconfig +++ b/nuttx/configs/sim/cxxtest/defconfig @@ -298,7 +298,7 @@ CONFIG_UCLIBCXX_HAVE_LIBSUPCXX=y # # Named Applications # -# CONFIG_NAMEDAPP is not set +# CONFIG_BUILTIN is not set # # Examples diff --git a/nuttx/configs/sim/nxwm/defconfig b/nuttx/configs/sim/nxwm/defconfig index 6a295ef4f2..90ee00f500 100644 --- a/nuttx/configs/sim/nxwm/defconfig +++ b/nuttx/configs/sim/nxwm/defconfig @@ -376,7 +376,7 @@ CONFIG_HAVE_CXX=y # # Named Applications # -# CONFIG_NAMEDAPP is not set +# CONFIG_BUILTIN is not set # # Examples diff --git a/nuttx/configs/sim/ostest/defconfig b/nuttx/configs/sim/ostest/defconfig index beee306398..55687c366a 100644 --- a/nuttx/configs/sim/ostest/defconfig +++ b/nuttx/configs/sim/ostest/defconfig @@ -297,7 +297,7 @@ CONFIG_LIB_SENDFILE_BUFSIZE=512 # # Named Applications # -# CONFIG_NAMEDAPP is not set +# CONFIG_BUILTIN is not set # # Examples diff --git a/nuttx/configs/stm3220g-eval/nxwm/defconfig b/nuttx/configs/stm3220g-eval/nxwm/defconfig index 11e88f7640..ab061f07a3 100644 --- a/nuttx/configs/stm3220g-eval/nxwm/defconfig +++ b/nuttx/configs/stm3220g-eval/nxwm/defconfig @@ -659,7 +659,7 @@ CONFIG_HAVE_CXXINITIALIZE=y # # Named Applications # -# CONFIG_NAMEDAPP is not set +# CONFIG_BUILTIN is not set # # Examples diff --git a/nuttx/configs/stm3240g-eval/discover/defconfig b/nuttx/configs/stm3240g-eval/discover/defconfig index 152486d1bb..e11d39ce1a 100644 --- a/nuttx/configs/stm3240g-eval/discover/defconfig +++ b/nuttx/configs/stm3240g-eval/discover/defconfig @@ -494,7 +494,7 @@ CONFIG_HAVE_CXXINITIALIZE=y # # Named Applications # -# CONFIG_NAMEDAPP is not set +# CONFIG_BUILTIN is not set # # Examples diff --git a/nuttx/configs/stm3240g-eval/xmlrpc/defconfig b/nuttx/configs/stm3240g-eval/xmlrpc/defconfig index 6b4c9af707..4f621d4535 100644 --- a/nuttx/configs/stm3240g-eval/xmlrpc/defconfig +++ b/nuttx/configs/stm3240g-eval/xmlrpc/defconfig @@ -487,7 +487,7 @@ CONFIG_HAVE_CXXINITIALIZE=y # # Named Applications # -# CONFIG_NAMEDAPP is not set +# CONFIG_BUILTIN is not set # # Examples diff --git a/nuttx/configs/stm32f100rc_generic/nsh/defconfig b/nuttx/configs/stm32f100rc_generic/nsh/defconfig index a0228a3def..65ac9a73d8 100644 --- a/nuttx/configs/stm32f100rc_generic/nsh/defconfig +++ b/nuttx/configs/stm32f100rc_generic/nsh/defconfig @@ -428,7 +428,7 @@ CONFIG_LIB_SENDFILE_BUFSIZE=512 # # Named Applications # -CONFIG_NAMEDAPP=y +CONFIG_BUILTIN=y # # Examples diff --git a/nuttx/configs/stm32f100rc_generic/ostest/defconfig b/nuttx/configs/stm32f100rc_generic/ostest/defconfig index 0041feb502..2d2842c543 100644 --- a/nuttx/configs/stm32f100rc_generic/ostest/defconfig +++ b/nuttx/configs/stm32f100rc_generic/ostest/defconfig @@ -410,7 +410,7 @@ CONFIG_LIB_SENDFILE_BUFSIZE=512 # # Named Applications # -# CONFIG_NAMEDAPP is not set +# CONFIG_BUILTIN is not set # # Examples diff --git a/nuttx/configs/stm32f4discovery/cxxtest/defconfig b/nuttx/configs/stm32f4discovery/cxxtest/defconfig index 6487742cf3..e7fa499541 100644 --- a/nuttx/configs/stm32f4discovery/cxxtest/defconfig +++ b/nuttx/configs/stm32f4discovery/cxxtest/defconfig @@ -426,7 +426,7 @@ CONFIG_UCLIBCXX_HAVE_LIBSUPCXX=y # # Named Applications # -# CONFIG_NAMEDAPP is not set +# CONFIG_BUILTIN is not set # # Examples diff --git a/nuttx/configs/stm32f4discovery/elf/defconfig b/nuttx/configs/stm32f4discovery/elf/defconfig index 9379c885b5..3f5a5d0fcf 100644 --- a/nuttx/configs/stm32f4discovery/elf/defconfig +++ b/nuttx/configs/stm32f4discovery/elf/defconfig @@ -460,7 +460,7 @@ CONFIG_HAVE_CXX=y # # Named Applications # -# CONFIG_NAMEDAPP is not set +# CONFIG_BUILTIN is not set # # Examples diff --git a/nuttx/configs/stm32f4discovery/nxlines/defconfig b/nuttx/configs/stm32f4discovery/nxlines/defconfig index 8609993ea1..58eebd41f1 100644 --- a/nuttx/configs/stm32f4discovery/nxlines/defconfig +++ b/nuttx/configs/stm32f4discovery/nxlines/defconfig @@ -518,7 +518,7 @@ CONFIG_HAVE_CXXINITIALIZE=y # # Named Applications # -# CONFIG_NAMEDAPP is not set +# CONFIG_BUILTIN is not set # # Examples diff --git a/nuttx/configs/stm32f4discovery/ostest/defconfig b/nuttx/configs/stm32f4discovery/ostest/defconfig index b29622c8ed..5fdd30f57e 100644 --- a/nuttx/configs/stm32f4discovery/ostest/defconfig +++ b/nuttx/configs/stm32f4discovery/ostest/defconfig @@ -430,7 +430,7 @@ CONFIG_LIB_SENDFILE_BUFSIZE=512 # # Named Applications # -# CONFIG_NAMEDAPP is not set +# CONFIG_BUILTIN is not set # # Examples diff --git a/nuttx/configs/stm32f4discovery/winbuild/defconfig b/nuttx/configs/stm32f4discovery/winbuild/defconfig index ac8a18c9bb..95be148865 100644 --- a/nuttx/configs/stm32f4discovery/winbuild/defconfig +++ b/nuttx/configs/stm32f4discovery/winbuild/defconfig @@ -430,7 +430,7 @@ CONFIG_LIB_SENDFILE_BUFSIZE=512 # # Named Applications # -# CONFIG_NAMEDAPP is not set +# CONFIG_BUILTIN is not set # # Examples diff --git a/nuttx/configs/vsn/src/README.txt b/nuttx/configs/vsn/src/README.txt index 4e2d50e0b1..87a538a109 100644 --- a/nuttx/configs/vsn/src/README.txt +++ b/nuttx/configs/vsn/src/README.txt @@ -12,7 +12,7 @@ Execution starts in the following order: is set. It must be set for the VSN board. - boot, performs initial chip and board initialization - - sched/os_bringup.c then calls either user_start or exec_namedapp() + - sched/os_bringup.c then calls either user_start or exec_builtin() with application as set in the .config @@ -55,4 +55,5 @@ Compile notes To link-in the sif_main() utility do, in this folder: - make context TOPDIR= -This will result in registering the application into the namedapp. +This will result in registering the application into the builtin application +registry. diff --git a/nuttx/configs/xtrs/nsh/defconfig b/nuttx/configs/xtrs/nsh/defconfig index 8730ebab72..72b32d9aaa 100644 --- a/nuttx/configs/xtrs/nsh/defconfig +++ b/nuttx/configs/xtrs/nsh/defconfig @@ -303,7 +303,7 @@ CONFIG_LIB_SENDFILE_BUFSIZE=512 # # Named Applications # -# CONFIG_NAMEDAPP is not set +# CONFIG_BUILTIN is not set # # Examples diff --git a/nuttx/configs/xtrs/ostest/defconfig b/nuttx/configs/xtrs/ostest/defconfig index a0a100bcfd..74a0199dfe 100644 --- a/nuttx/configs/xtrs/ostest/defconfig +++ b/nuttx/configs/xtrs/ostest/defconfig @@ -302,7 +302,7 @@ CONFIG_LIB_SENDFILE_BUFSIZE=512 # # Named Applications # -# CONFIG_NAMEDAPP is not set +# CONFIG_BUILTIN is not set # # Examples diff --git a/nuttx/configs/xtrs/pashello/defconfig b/nuttx/configs/xtrs/pashello/defconfig index d23c507163..abdaf1f359 100644 --- a/nuttx/configs/xtrs/pashello/defconfig +++ b/nuttx/configs/xtrs/pashello/defconfig @@ -303,7 +303,7 @@ CONFIG_LIB_SENDFILE_BUFSIZE=512 # # Named Applications # -# CONFIG_NAMEDAPP is not set +# CONFIG_BUILTIN is not set # # Examples diff --git a/nuttx/configs/z16f2800100zcog/ostest/defconfig b/nuttx/configs/z16f2800100zcog/ostest/defconfig index defd3d5efa..64828738f2 100644 --- a/nuttx/configs/z16f2800100zcog/ostest/defconfig +++ b/nuttx/configs/z16f2800100zcog/ostest/defconfig @@ -342,7 +342,7 @@ CONFIG_LIB_SENDFILE_BUFSIZE=512 # # Named Applications # -# CONFIG_NAMEDAPP is not set +# CONFIG_BUILTIN is not set # # Examples diff --git a/nuttx/configs/z16f2800100zcog/pashello/defconfig b/nuttx/configs/z16f2800100zcog/pashello/defconfig index f3067a9e7c..ba99283d33 100644 --- a/nuttx/configs/z16f2800100zcog/pashello/defconfig +++ b/nuttx/configs/z16f2800100zcog/pashello/defconfig @@ -342,7 +342,7 @@ CONFIG_LIB_SENDFILE_BUFSIZE=512 # # Named Applications # -# CONFIG_NAMEDAPP is not set +# CONFIG_BUILTIN is not set # # Examples diff --git a/nuttx/configs/z80sim/nsh/defconfig b/nuttx/configs/z80sim/nsh/defconfig index fb9fac5462..d13f0f7f7f 100644 --- a/nuttx/configs/z80sim/nsh/defconfig +++ b/nuttx/configs/z80sim/nsh/defconfig @@ -303,7 +303,7 @@ CONFIG_LIB_SENDFILE_BUFSIZE=512 # # Named Applications # -# CONFIG_NAMEDAPP is not set +# CONFIG_BUILTIN is not set # # Examples diff --git a/nuttx/configs/z80sim/ostest/defconfig b/nuttx/configs/z80sim/ostest/defconfig index d3410d52d3..bd4144821a 100644 --- a/nuttx/configs/z80sim/ostest/defconfig +++ b/nuttx/configs/z80sim/ostest/defconfig @@ -302,7 +302,7 @@ CONFIG_LIB_SENDFILE_BUFSIZE=512 # # Named Applications # -# CONFIG_NAMEDAPP is not set +# CONFIG_BUILTIN is not set # # Examples diff --git a/nuttx/configs/z80sim/pashello/defconfig b/nuttx/configs/z80sim/pashello/defconfig index e7dee626c1..58d609c4b8 100644 --- a/nuttx/configs/z80sim/pashello/defconfig +++ b/nuttx/configs/z80sim/pashello/defconfig @@ -302,7 +302,7 @@ CONFIG_LIB_SENDFILE_BUFSIZE=512 # # Named Applications # -# CONFIG_NAMEDAPP is not set +# CONFIG_BUILTIN is not set # # Examples diff --git a/nuttx/configs/z8encore000zco/ostest/defconfig b/nuttx/configs/z8encore000zco/ostest/defconfig index 7d9b227f4b..7bd512727e 100644 --- a/nuttx/configs/z8encore000zco/ostest/defconfig +++ b/nuttx/configs/z8encore000zco/ostest/defconfig @@ -329,7 +329,7 @@ CONFIG_LIB_SENDFILE_BUFSIZE=512 # # Named Applications # -# CONFIG_NAMEDAPP is not set +# CONFIG_BUILTIN is not set # # Examples diff --git a/nuttx/configs/z8f64200100kit/ostest/defconfig b/nuttx/configs/z8f64200100kit/ostest/defconfig index a349529872..e98e415618 100644 --- a/nuttx/configs/z8f64200100kit/ostest/defconfig +++ b/nuttx/configs/z8f64200100kit/ostest/defconfig @@ -329,7 +329,7 @@ CONFIG_LIB_SENDFILE_BUFSIZE=512 # # Named Applications # -# CONFIG_NAMEDAPP is not set +# CONFIG_BUILTIN is not set # # Examples diff --git a/nuttx/sched/os_bringup.c b/nuttx/sched/os_bringup.c index e0a236bbed..4b5adcae1a 100644 --- a/nuttx/sched/os_bringup.c +++ b/nuttx/sched/os_bringup.c @@ -189,11 +189,11 @@ int os_bringup(void) svdbg("Starting init thread\n"); #ifdef CONFIG_BUILTIN_APP_START - /* Start the built-in named application, passing an "init" argument, so that + /* Start the built-in application, passing an "init" argument, so that * application can distinguish different run-levels */ - init_taskid = exec_namedapp(CONFIG_BUILTIN_APP_START, argv); + init_taskid = exec_builtin(CONFIG_BUILTIN_APP_START, argv); #else /* Start the default application at CONFIG_USER_ENTRYPOINT() */ From 3fe53af6be14a28174eec48b5740dbbe7c1f818a Mon Sep 17 00:00:00 2001 From: patacongo Date: Sun, 23 Dec 2012 22:17:09 +0000 Subject: [PATCH 008/118] Remove .context kludge from apps/ directory git-svn-id: http://svn.code.sf.net/p/nuttx/code/trunk@5455 42af7a65-404d-4744-a932-0658087f49c3 --- apps/ChangeLog.txt | 4 +++ apps/Make.defs | 9 +++-- apps/Makefile | 9 +---- apps/builtin/Makefile | 33 +++++++++++------- apps/builtin/registry/Makefile | 54 ++++++++++++++++++++++++++++++ apps/examples/adc/Makefile | 9 ++--- apps/examples/buttons/Makefile | 9 ++--- apps/examples/can/Makefile | 9 ++--- apps/examples/cdcacm/Makefile | 13 ++++--- apps/examples/composite/Makefile | 13 ++++--- apps/examples/cxxtest/Makefile | 9 ++--- apps/examples/dhcpd/Makefile | 9 ++--- apps/examples/discover/Makefile | 9 ++--- apps/examples/ftpc/Makefile | 10 +++--- apps/examples/ftpd/Makefile | 13 ++++--- apps/examples/hello/Makefile | 9 ++--- apps/examples/helloxx/Makefile | 9 ++--- apps/examples/json/Makefile | 9 ++--- apps/examples/keypadtest/Makefile | 9 ++--- apps/examples/lcdrw/Makefile | 9 ++--- apps/examples/modbus/Makefile | 9 ++--- apps/examples/nettest/Makefile | 9 ++--- apps/examples/nx/Makefile | 9 ++--- apps/examples/nxhello/Makefile | 9 ++--- apps/examples/nximage/Makefile | 9 ++--- apps/examples/nxlines/Makefile | 9 ++--- apps/examples/nxtext/Makefile | 9 ++--- apps/examples/ostest/Makefile | 9 ++--- apps/examples/pwm/Makefile | 9 +++-- apps/examples/qencoder/Makefile | 9 ++--- apps/examples/relays/Makefile | 9 ++--- apps/examples/telnetd/Makefile | 9 ++--- apps/examples/tiff/Makefile | 9 ++--- apps/examples/touchscreen/Makefile | 9 ++--- apps/examples/usbstorage/Makefile | 13 ++++--- apps/examples/usbterm/Makefile | 9 ++--- apps/examples/watchdog/Makefile | 9 +++-- apps/examples/wgetjson/Makefile | 9 ++--- apps/examples/xmlrpc/Makefile | 9 ++--- apps/graphics/tiff/Makefile | 1 - apps/interpreters/ficl/Makefile | 1 - apps/modbus/Makefile | 1 - apps/nshlib/Makefile | 1 - apps/system/free/Makefile | 10 +++--- apps/system/i2c/Makefile | 12 ++++--- apps/system/install/Makefile | 10 +++--- apps/system/poweroff/Makefile | 10 +++--- apps/system/ramtron/Makefile | 10 +++--- apps/system/readline/Makefile | 1 - apps/system/sdcard/Makefile | 10 +++--- apps/system/sysinfo/Makefile | 10 +++--- nuttx/Documentation/NuttShell.html | 9 ++--- nuttx/configs/vsn/src/Makefile | 9 +++-- 53 files changed, 322 insertions(+), 205 deletions(-) create mode 100644 apps/builtin/registry/Makefile diff --git a/apps/ChangeLog.txt b/apps/ChangeLog.txt index 886526b187..8999047ef1 100644 --- a/apps/ChangeLog.txt +++ b/apps/ChangeLog.txt @@ -440,4 +440,8 @@ files. It makes sense for 'leaf' Makefiles to have this dependency, but it does not make sense for upper-level Makefiles. * namedapp/: Renamed to builtins in preparation for another change. + * .context: Removed the .context kludge. This causes lots of problems + when changing configurations because there is no easy way to get the + system to rebuild the context. Now, the context will be rebuilt + whenever there is a change in either .config or the Makefile. diff --git a/apps/Make.defs b/apps/Make.defs index 12b351e7f2..217137a29c 100644 --- a/apps/Make.defs +++ b/apps/Make.defs @@ -34,8 +34,11 @@ # ############################################################################ +BUILTIN_REGISTRY = $(APPDIR)$(DELIM)builtin$(DELIM)registry + define REGISTER - @echo "Register: $1" - @echo "{ \"$1\", $2, $3, $4 }," >> "$(APPDIR)/builtin/builtin_list.h" - @echo "EXTERN int $4(int argc, char *argv[]);" >> "$(APPDIR)/builtin/builtin_proto.h" + $(Q) echo "Register: $1" + $(Q) echo "{ \"$1\", $2, $3, $4 }," > "$(BUILTIN_REGISTRY)$(DELIM)$4.bdat" + $(Q) echo "int $4(int argc, char *argv[]);" > "$(BUILTIN_REGISTRY)$(DELIM)$4.pdat" + $(Q) touch "$(BUILTIN_REGISTRY)$(DELIM).updated" endef diff --git a/apps/Makefile b/apps/Makefile index 299560195c..cf6b33cd7e 100644 --- a/apps/Makefile +++ b/apps/Makefile @@ -132,21 +132,16 @@ $(INSTALLED_APPS): $(BIN): $(INSTALLED_APPS) -.context: +context: ifeq ($(CONFIG_WINDOWS_NATIVE),y) $(Q) for %%G in ($(INSTALLED_APPS)) do ( \ - if exist %%G\.context del /f /q %%G\.context \ $(MAKE) -C %%G TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)" context \ ) else $(Q) for dir in $(INSTALLED_APPS) ; do \ - rm -f $$dir/.context ; \ $(MAKE) -C $$dir TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)" context ; \ done endif - $(Q) touch $@ - -context: .context .depend: context Makefile $(SRCS) ifeq ($(CONFIG_WINDOWS_NATIVE),y) @@ -183,7 +178,6 @@ ifeq ($(CONFIG_WINDOWS_NATIVE),y) $(MAKE) -C %%G distclean TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)" \ ) $(call DELFILE, .config) - $(call DELFILE, .context) $(call DELFILE, .depend) $(Q) ( if exist external ( \ echo ********************************************************" \ @@ -195,7 +189,6 @@ else $(MAKE) -C $$dir distclean TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)"; \ done $(call DELFILE, .config) - $(call DELFILE, .context) $(call DELFILE, .depend) $(Q) ( if [ -e external ]; then \ echo "********************************************************"; \ diff --git a/apps/builtin/Makefile b/apps/builtin/Makefile index 72ba0347f7..6633146e93 100644 --- a/apps/builtin/Makefile +++ b/apps/builtin/Makefile @@ -33,12 +33,9 @@ # ############################################################################ --include $(TOPDIR)/.config -include $(TOPDIR)/Make.defs include $(APPDIR)/Make.defs -# NSH Library - # Source and object files ASRCS = @@ -70,7 +67,7 @@ VPATH = # Build Targets all: .built -.PHONY: .context context depend clean distclean +.PHONY: context depend clean distclean $(AOBJS): %$(OBJEXT): %.S $(call ASSEMBLE, $<, $@) @@ -78,16 +75,27 @@ $(AOBJS): %$(OBJEXT): %.S $(COBJS): %$(OBJEXT): %.c $(call COMPILE, $<, $@) -.built: $(OBJS) +builtin_list.h: registry/.updated + $(call DELFILE, builtin_list.h) +ifeq ($(CONFIG_WINDOWS_NATIVE),y) + $(Q) for /f %%G in ('dir /b registry\*.bdat`) do ( type registry\%%G >> builtin_list.h ) +else + $(Q) for file in `ls registry/*.bdat`; do cat $$file >> builtin_list.h; done +endif + +builtin_proto.h: registry/.updated + $(call DELFILE, builtin_proto.h) +ifeq ($(CONFIG_WINDOWS_NATIVE),y) + $(Q) for /f %%G in ('dir /b registry\*.pdat`) do ( type registry\%%G >> builtin_proto.h ) +else + $(Q) for file in `ls registry/*.pdat`; do cat $$file >> builtin_proto.h; done +endif + +.built: builtin_list.h builtin_proto.h $(OBJS) $(call ARCHIVE, $(BIN), $(OBJS)) $(Q) touch .built -.context: - @echo "/* List of application requirements, generated during make context. */" > builtin_list.h - @echo "/* List of application entry points, generated during make context. */" > builtin_proto.h - $(Q) touch $@ - -context: .context +context: .depend: Makefile $(SRCS) $(Q) $(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep @@ -100,11 +108,10 @@ clean: $(call CLEAN) distclean: clean - $(call DELFILE, .context) + $(Q) $(MAKE) -C registry distclean TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)" $(call DELFILE, Make.dep) $(call DELFILE, .depend) $(call DELFILE, builtin_list.h) $(call DELFILE, builtin_proto.h) -include Make.dep - diff --git a/apps/builtin/registry/Makefile b/apps/builtin/registry/Makefile new file mode 100644 index 0000000000..9117f53d6e --- /dev/null +++ b/apps/builtin/registry/Makefile @@ -0,0 +1,54 @@ +############################################################################ +# apps/builtin/registry/Makefile +# +# Copyright (C) 2012 Gregory Nutt. All rights reserved. +# Author: Gregory Nutt +# +# 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)/Make.defs +include $(APPDIR)/Make.defs + +# NSH Library + +all: +.PHONY: context depend clean distclean + +context: + +depend: + +clean: + $(call CLEAN) + +distclean: clean + $(call DELFILE, *.bdat) + $(call DELFILE, *.pdat) + $(call DELFILE, .updated) diff --git a/apps/examples/adc/Makefile b/apps/examples/adc/Makefile index 69862b383d..55bc259e4b 100644 --- a/apps/examples/adc/Makefile +++ b/apps/examples/adc/Makefile @@ -83,13 +83,14 @@ $(COBJS): %$(OBJEXT): %.c $(call ARCHIVE, $(BIN), $(OBJS)) @touch .built -.context: ifeq ($(CONFIG_NSH_BUILTIN_APPS),y) +$(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat: $(TOPDIR)$(DELIM).config Makefile $(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main) - @touch $@ -endif -context: .context +context: $(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat +else +context: +endif .depend: Makefile $(SRCS) @$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep diff --git a/apps/examples/buttons/Makefile b/apps/examples/buttons/Makefile index 77c1cd67df..ac1f2f05aa 100644 --- a/apps/examples/buttons/Makefile +++ b/apps/examples/buttons/Makefile @@ -83,13 +83,14 @@ $(COBJS): %$(OBJEXT): %.c $(call ARCHIVE, $(BIN), $(OBJS)) @touch .built -.context: ifeq ($(CONFIG_NSH_BUILTIN_APPS),y) +$(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat: $(TOPDIR)$(DELIM).config Makefile $(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main) - @touch $@ -endif -context: .context +context: $(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat +else +context: +endif .depend: Makefile $(SRCS) @$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep diff --git a/apps/examples/can/Makefile b/apps/examples/can/Makefile index 8924797e37..5df96e1e7d 100644 --- a/apps/examples/can/Makefile +++ b/apps/examples/can/Makefile @@ -83,13 +83,14 @@ $(COBJS): %$(OBJEXT): %.c $(call ARCHIVE, $(BIN), $(OBJS)) @touch .built -.context: ifeq ($(CONFIG_NSH_BUILTIN_APPS),y) +$(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat: $(TOPDIR)$(DELIM).config Makefile $(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main) - @touch $@ -endif -context: .context +context: $(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat +else +context: +endif .depend: Makefile $(SRCS) @$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep diff --git a/apps/examples/cdcacm/Makefile b/apps/examples/cdcacm/Makefile index e8d03807d8..d9e19e9064 100644 --- a/apps/examples/cdcacm/Makefile +++ b/apps/examples/cdcacm/Makefile @@ -87,12 +87,17 @@ $(COBJS): %$(OBJEXT): %.c $(call ARCHIVE, $(BIN), $(OBJS)) @touch .built -.context: +ifeq ($(CONFIG_NSH_BUILTIN_APPS),y) +$(BUILTIN_REGISTRY)$(DELIM)$(APPNAME1)_main.bdat: $(TOPDIR)$(DELIM).config Makefile $(call REGISTER,$(APPNAME1),$(PRIORITY1),$(STACKSIZE1),$(APPNAME1)_main) - $(call REGISTER,$(APPNAME2),$(PRIORITY2),$(STACKSIZE2),$(APPNAME2)_main) - @touch $@ -context: .context +$(BUILTIN_REGISTRY)$(DELIM)$(APPNAME2)_main.bdat: $(TOPDIR)$(DELIM).config Makefile + $(call REGISTER,$(APPNAME2),$(PRIORITY2),$(STACKSIZE2),$(APPNAME2)_main) + +context: $(BUILTIN_REGISTRY)$(DELIM)$(APPNAME1)_main.bdat $(BUILTIN_REGISTRY)$(DELIM)$(APPNAME2)_main.bdat +else +context: +endif .depend: Makefile $(SRCS) @$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep diff --git a/apps/examples/composite/Makefile b/apps/examples/composite/Makefile index 016ccbe3eb..b1fe493082 100644 --- a/apps/examples/composite/Makefile +++ b/apps/examples/composite/Makefile @@ -87,14 +87,17 @@ $(COBJS): %$(OBJEXT): %.c $(call ARCHIVE, $(BIN), $(OBJS)) @touch .built -.context: ifeq ($(CONFIG_NSH_BUILTIN_APPS),y) +$(BUILTIN_REGISTRY)$(DELIM)$(APPNAME1)_main.bdat: $(TOPDIR)$(DELIM).config Makefile $(call REGISTER,$(APPNAME1),$(PRIORITY1),$(STACKSIZE1),$(APPNAME1)_main) - $(call REGISTER,$(APPNAME2),$(PRIORITY2),$(STACKSIZE2),$(APPNAME2)_main) - @touch $@ -endif -context: .context +$(BUILTIN_REGISTRY)$(DELIM)$(APPNAME2)_main.bdat: $(TOPDIR)$(DELIM).config Makefile + $(call REGISTER,$(APPNAME2),$(PRIORITY2),$(STACKSIZE2),$(APPNAME2)_main) + +context: $(BUILTIN_REGISTRY)$(DELIM)$(APPNAME1)_main.bdat $(BUILTIN_REGISTRY)$(DELIM)$(APPNAME2)_main.bdat +else +context: +endif .depend: Makefile $(SRCS) @$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep diff --git a/apps/examples/cxxtest/Makefile b/apps/examples/cxxtest/Makefile index f0764b6e94..cba9f0a4f0 100644 --- a/apps/examples/cxxtest/Makefile +++ b/apps/examples/cxxtest/Makefile @@ -100,13 +100,14 @@ $(CXXOBJS): %$(OBJEXT): %.cxx $(call ARCHIVE, $(BIN), $(OBJS)) @touch .built -.context: ifeq ($(CONFIG_EXAMPLES_HELLOXX_BUILTIN),y) +$(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat: $(TOPDIR)$(DELIM).config Makefile $(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main) - @touch $@ -endif -context: .context +context: $(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat +else +context: +endif .depend: Makefile $(SRCS) @$(MKDEP) $(ROOTDEPPATH) "$(CXX)" -- $(CXXFLAGS) -- $(SRCS) >Make.dep diff --git a/apps/examples/dhcpd/Makefile b/apps/examples/dhcpd/Makefile index a41db5cdd7..0522d4cc47 100644 --- a/apps/examples/dhcpd/Makefile +++ b/apps/examples/dhcpd/Makefile @@ -83,13 +83,14 @@ $(COBJS): %$(OBJEXT): %.c $(call ARCHIVE, $(BIN), $(OBJS)) @touch .built -.context: ifeq ($(CONFIG_NSH_BUILTIN_APPS),y) +$(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat: $(TOPDIR)$(DELIM).config Makefile $(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main) - @touch $@ -endif -context: .context +context: $(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat +else +context: +endif .depend: Makefile $(SRCS) @$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep diff --git a/apps/examples/discover/Makefile b/apps/examples/discover/Makefile index 2ce52a18e9..b0285fbff3 100644 --- a/apps/examples/discover/Makefile +++ b/apps/examples/discover/Makefile @@ -84,13 +84,14 @@ $(COBJS): %$(OBJEXT): %.c $(call ARCHIVE, $(BIN), $(OBJS)) @touch .built -.context: ifeq ($(CONFIG_NSH_BUILTIN_APPS),y) +$(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat: $(TOPDIR)$(DELIM).config Makefile $(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main) - @touch $@ -endif -context: .context +context: $(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat +else +context: +endif .depend: Makefile $(SRCS) @$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep diff --git a/apps/examples/ftpc/Makefile b/apps/examples/ftpc/Makefile index 29960fb94c..e09779abdf 100644 --- a/apps/examples/ftpc/Makefile +++ b/apps/examples/ftpc/Makefile @@ -83,11 +83,14 @@ $(COBJS): %$(OBJEXT): %.c # Register application -.context: +ifeq ($(CONFIG_NSH_BUILTIN_APPS),y) +$(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat: $(TOPDIR)$(DELIM).config Makefile $(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main) - @touch $@ -context: .context +context: $(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat +else +context: +endif # Create dependencies @@ -102,7 +105,6 @@ clean: $(call CLEAN) distclean: clean - $(call DELFILE, .context) $(call DELFILE, Make.dep) $(call DELFILE, .depend) diff --git a/apps/examples/ftpd/Makefile b/apps/examples/ftpd/Makefile index 0b43b85a9c..dc53bfdeab 100644 --- a/apps/examples/ftpd/Makefile +++ b/apps/examples/ftpd/Makefile @@ -78,14 +78,17 @@ $(COBJS): %$(OBJEXT): %.c $(call ARCHIVE, $(BIN), $(OBJS)) @touch .built -.context: ifeq ($(CONFIG_NSH_BUILTIN_APPS),y) +$(BUILTIN_REGISTRY)$(DELIM)ftpd_start.bdat: $(TOPDIR)$(DELIM).config Makefile $(call REGISTER,ftpd_start,SCHED_PRIORITY_DEFAULT,2048,ftpd_start) - $(call REGISTER,ftpd_stop,SCHED_PRIORITY_DEFAULT,2048,ftpd_stop) - @touch $@ -endif -context: .context +$(BUILTIN_REGISTRY)$(DELIM)ftpd_stop.bdat: $(TOPDIR)$(DELIM).config Makefile + $(call REGISTER,ftpd_stop,SCHED_PRIORITY_DEFAULT,2048,ftpd_stop) + +context: $(BUILTIN_REGISTRY)$(DELIM)ftpd_start.bdat $(BUILTIN_REGISTRY)$(DELIM)ftpd_stop.bdat +else +context: +endif .depend: Makefile $(SRCS) @$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep diff --git a/apps/examples/hello/Makefile b/apps/examples/hello/Makefile index 560b0da358..c4e6f735a5 100644 --- a/apps/examples/hello/Makefile +++ b/apps/examples/hello/Makefile @@ -83,13 +83,14 @@ $(COBJS): %$(OBJEXT): %.c $(call ARCHIVE, $(BIN), $(OBJS)) @touch .built -.context: ifeq ($(CONFIG_EXAMPLES_HELLO_BUILTIN),y) +$(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat: $(TOPDIR)$(DELIM).config Makefile $(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main) - @touch $@ -endif -context: .context +context: $(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat +else +context: +endif .depend: Makefile $(SRCS) @$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep diff --git a/apps/examples/helloxx/Makefile b/apps/examples/helloxx/Makefile index 062da7d588..df1b360a50 100644 --- a/apps/examples/helloxx/Makefile +++ b/apps/examples/helloxx/Makefile @@ -100,13 +100,14 @@ $(CXXOBJS): %$(OBJEXT): %.cxx $(call ARCHIVE, $(BIN), $(OBJS)) @touch .built -.context: ifeq ($(CONFIG_EXAMPLES_HELLOXX_BUILTIN),y) +$(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat: $(TOPDIR)$(DELIM).config Makefile $(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main) - @touch $@ -endif -context: .context +context: $(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat +else +context: +endif .depend: Makefile $(SRCS) @$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep diff --git a/apps/examples/json/Makefile b/apps/examples/json/Makefile index c3e9203f93..1e42757b86 100644 --- a/apps/examples/json/Makefile +++ b/apps/examples/json/Makefile @@ -81,13 +81,14 @@ $(COBJS): %$(OBJEXT): %.c $(call ARCHIVE, $(BIN), $(OBJS)) @touch .built -.context: ifeq ($(CONFIG_NSH_BUILTIN_APPS),y) +$(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat: $(TOPDIR)$(DELIM).config Makefile $(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main) - @touch $@ -endif -context: .context +context: $(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat +else +context: +endif .depend: Makefile $(SRCS) @$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep diff --git a/apps/examples/keypadtest/Makefile b/apps/examples/keypadtest/Makefile index 3de0556a2b..0c40a5c6c1 100644 --- a/apps/examples/keypadtest/Makefile +++ b/apps/examples/keypadtest/Makefile @@ -83,13 +83,14 @@ $(COBJS): %$(OBJEXT): %.c $(call ARCHIVE, $(BIN), $(OBJS)) @touch .built -.context: ifeq ($(CONFIG_NSH_BUILTIN_APPS),y) +$(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat: $(TOPDIR)$(DELIM).config Makefile $(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main) - @touch $@ -endif -context: .context +context: $(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat +else +context: +endif .depend: Makefile $(SRCS) @$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep diff --git a/apps/examples/lcdrw/Makefile b/apps/examples/lcdrw/Makefile index ed612e0bec..61d6bcce6e 100644 --- a/apps/examples/lcdrw/Makefile +++ b/apps/examples/lcdrw/Makefile @@ -83,13 +83,14 @@ $(COBJS): %$(OBJEXT): %.c $(call ARCHIVE, $(BIN), $(OBJS)) @touch .built -.context: ifeq ($(CONFIG_EXAMPLES_LCDRW_BUILTIN),y) +$(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat: $(TOPDIR)$(DELIM).config Makefile $(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main) - @touch $@ -endif -context: .context +context: $(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat +else +context: +endif .depend: Makefile $(SRCS) @$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep diff --git a/apps/examples/modbus/Makefile b/apps/examples/modbus/Makefile index d6caefe81d..da31c3b524 100644 --- a/apps/examples/modbus/Makefile +++ b/apps/examples/modbus/Makefile @@ -83,13 +83,14 @@ $(COBJS): %$(OBJEXT): %.c $(call ARCHIVE, $(BIN), $(OBJS)) @touch .built -.context: ifeq ($(CONFIG_NSH_BUILTIN_APPS),y) +$(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat: $(TOPDIR)$(DELIM).config Makefile $(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main) - @touch $@ -endif -context: .context +context: $(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat +else +context: +endif .depend: Makefile $(SRCS) @$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep diff --git a/apps/examples/nettest/Makefile b/apps/examples/nettest/Makefile index 085b9406d8..e6f56e7659 100644 --- a/apps/examples/nettest/Makefile +++ b/apps/examples/nettest/Makefile @@ -116,13 +116,14 @@ $(HOST_BIN): $(HOST_OBJS) $(call ARCHIVE, $(BIN), $(TARG_OBJS)) @touch .built -.context: ifeq ($(CONFIG_NSH_BUILTIN_APPS),y) +$(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat: $(TOPDIR)$(DELIM).config Makefile $(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main) - @touch $@ -endif -context: .context +context: $(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat +else +context: +endif .depend: Makefile $(TARG_SRCS) @$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(TARG_SRCS) >Make.dep diff --git a/apps/examples/nx/Makefile b/apps/examples/nx/Makefile index ad2bee84ea..4474a58c3f 100644 --- a/apps/examples/nx/Makefile +++ b/apps/examples/nx/Makefile @@ -86,13 +86,14 @@ $(COBJS): %$(OBJEXT): %.c $(call ARCHIVE, $(BIN), $(OBJS)) @touch .built -.context: ifeq ($(CONFIG_EXAMPLES_NX_BUILTIN),y) +$(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat: $(TOPDIR)$(DELIM).config Makefile $(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main) - @touch $@ -endif -context: .context +context: $(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat +else +context: +endif .depend: Makefile $(SRCS) @$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep diff --git a/apps/examples/nxhello/Makefile b/apps/examples/nxhello/Makefile index b1ac6f116f..52ced123d5 100644 --- a/apps/examples/nxhello/Makefile +++ b/apps/examples/nxhello/Makefile @@ -83,13 +83,14 @@ $(COBJS): %$(OBJEXT): %.c $(call ARCHIVE, $(BIN), $(OBJS)) @touch .built -.context: ifeq ($(CONFIG_EXAMPLES_NXHELLO_BUILTIN),y) +$(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat: $(TOPDIR)$(DELIM).config Makefile $(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main) - @touch $@ -endif -context: .context +context: $(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat +else +context: +endif .depend: Makefile $(SRCS) @$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep diff --git a/apps/examples/nximage/Makefile b/apps/examples/nximage/Makefile index e2e9201e74..98f04c2d53 100644 --- a/apps/examples/nximage/Makefile +++ b/apps/examples/nximage/Makefile @@ -83,13 +83,14 @@ $(COBJS): %$(OBJEXT): %.c $(call ARCHIVE, $(BIN), $(OBJS)) @touch .built -.context: ifeq ($(CONFIG_EXAMPLES_NXIMAGE_BUILTIN),y) +$(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat: $(TOPDIR)$(DELIM).config Makefile $(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main) - @touch $@ -endif -context: .context +context: $(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat +else +context: +endif .depend: Makefile $(SRCS) @$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep diff --git a/apps/examples/nxlines/Makefile b/apps/examples/nxlines/Makefile index cdda7ad8cd..9673a5520d 100644 --- a/apps/examples/nxlines/Makefile +++ b/apps/examples/nxlines/Makefile @@ -83,13 +83,14 @@ $(COBJS): %$(OBJEXT): %.c $(call ARCHIVE, $(BIN), $(OBJS)) @touch .built -.context: ifeq ($(CONFIG_NSH_BUILTIN_APPS),y) +$(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat: $(TOPDIR)$(DELIM).config Makefile $(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main) - @touch $@ -endif -context: .context +context: $(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat +else +context: +endif .depend: Makefile $(SRCS) @$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep diff --git a/apps/examples/nxtext/Makefile b/apps/examples/nxtext/Makefile index dffe66ba1f..738209754f 100644 --- a/apps/examples/nxtext/Makefile +++ b/apps/examples/nxtext/Makefile @@ -87,13 +87,14 @@ $(COBJS): %$(OBJEXT): %.c $(call ARCHIVE, $(BIN), $(OBJS)) @touch .built -.context: ifeq ($(CONFIG_EXAMPLES_NXTEXT_BUILTIN),y) +$(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat: $(TOPDIR)$(DELIM).config Makefile $(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main) - @touch $@ -endif -context: .context +context: $(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat +else +context: +endif .depend: Makefile $(SRCS) @$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep diff --git a/apps/examples/ostest/Makefile b/apps/examples/ostest/Makefile index 3e78c64e83..dfb500387a 100644 --- a/apps/examples/ostest/Makefile +++ b/apps/examples/ostest/Makefile @@ -127,13 +127,14 @@ $(COBJS): %$(OBJEXT): %.c $(call ARCHIVE, $(BIN), $(OBJS)) @touch .built -.context: ifeq ($(CONFIG_EXAMPLES_OSTEST_BUILTIN),y) +$(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat: $(TOPDIR)$(DELIM).config Makefile $(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main) - @touch $@ -endif -context: .context +context: $(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat +else +context: +endif .depend: Makefile $(SRCS) @$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep diff --git a/apps/examples/pwm/Makefile b/apps/examples/pwm/Makefile index 3a6f2520a0..d33d1c2775 100644 --- a/apps/examples/pwm/Makefile +++ b/apps/examples/pwm/Makefile @@ -83,11 +83,14 @@ $(COBJS): %$(OBJEXT): %.c $(call ARCHIVE, $(BIN), $(OBJS)) @touch .built -.context: +ifeq ($(CONFIG_NSH_BUILTIN_APPS),y) +$(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat: $(TOPDIR)$(DELIM).config Makefile $(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main) - @touch $@ -context: .context +context: $(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat +else +context: +endif .depend: Makefile $(SRCS) @$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep diff --git a/apps/examples/qencoder/Makefile b/apps/examples/qencoder/Makefile index 7d2427c6bf..1caff2ed30 100644 --- a/apps/examples/qencoder/Makefile +++ b/apps/examples/qencoder/Makefile @@ -83,13 +83,14 @@ $(COBJS): %$(OBJEXT): %.c $(call ARCHIVE, $(BIN), $(OBJS)) @touch .built -.context: ifeq ($(CONFIG_NSH_BUILTIN_APPS),y) +$(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat: $(TOPDIR)$(DELIM).config Makefile $(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main) - @touch $@ -endif -context: .context +context: $(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat +else +context: +endif .depend: Makefile $(SRCS) @$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep diff --git a/apps/examples/relays/Makefile b/apps/examples/relays/Makefile index 8e91ab5723..17bf7a6a4b 100644 --- a/apps/examples/relays/Makefile +++ b/apps/examples/relays/Makefile @@ -83,13 +83,14 @@ $(COBJS): %$(OBJEXT): %.c $(call ARCHIVE, $(BIN), $(OBJS)) @touch .built -.context: ifeq ($(CONFIG_NSH_BUILTIN_APPS),y) +$(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat: $(TOPDIR)$(DELIM).config Makefile $(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main) - @touch $@ -endif -context: .context +context: $(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat +else +context: +endif .depend: Makefile $(SRCS) @$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep diff --git a/apps/examples/telnetd/Makefile b/apps/examples/telnetd/Makefile index 8f5e5b6d2f..63876baa03 100644 --- a/apps/examples/telnetd/Makefile +++ b/apps/examples/telnetd/Makefile @@ -83,13 +83,14 @@ $(COBJS): %$(OBJEXT): %.c $(call ARCHIVE, $(BIN), $(OBJS)) @touch .built -.context: ifeq ($(CONFIG_NSH_BUILTIN_APPS),y) +$(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat: $(TOPDIR)$(DELIM).config Makefile $(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main) - @touch $@ -endif -context: .context +context: $(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat +else +context: +endif .depend: Makefile $(SRCS) @$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep diff --git a/apps/examples/tiff/Makefile b/apps/examples/tiff/Makefile index f62209931a..853e904a73 100644 --- a/apps/examples/tiff/Makefile +++ b/apps/examples/tiff/Makefile @@ -83,13 +83,14 @@ $(COBJS): %$(OBJEXT): %.c $(call ARCHIVE, $(BIN), $(OBJS)) @touch .built -.context: ifeq ($(CONFIG_EXAMPLES_TIFF_BUILTIN),y) +$(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat: $(TOPDIR)$(DELIM).config Makefile $(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main) - @touch $@ -endif -context: .context +context: $(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat +else +context: +endif .depend: Makefile $(SRCS) @$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep diff --git a/apps/examples/touchscreen/Makefile b/apps/examples/touchscreen/Makefile index b3943951ef..8761cc5b50 100644 --- a/apps/examples/touchscreen/Makefile +++ b/apps/examples/touchscreen/Makefile @@ -83,13 +83,14 @@ $(COBJS): %$(OBJEXT): %.c $(call ARCHIVE, $(BIN), $(OBJS)) @touch .built -.context: ifeq ($(CONFIG_EXAMPLES_TOUCHSCREEN_BUILTIN),y) +$(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat: $(TOPDIR)$(DELIM).config Makefile $(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main) - @touch $@ -endif -context: .context +context: $(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat +else +context: +endif .depend: Makefile $(SRCS) @$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep diff --git a/apps/examples/usbstorage/Makefile b/apps/examples/usbstorage/Makefile index 5492e47dc4..a1eb77836e 100644 --- a/apps/examples/usbstorage/Makefile +++ b/apps/examples/usbstorage/Makefile @@ -87,14 +87,17 @@ $(COBJS): %$(OBJEXT): %.c $(call ARCHIVE, $(BIN), $(OBJS)) @touch .built -.context: ifeq ($(CONFIG_EXAMPLES_USBMSC_BUILTIN),y) +$(BUILTIN_REGISTRY)$(DELIM)$(APPNAME1)_main.bdat: $(TOPDIR)$(DELIM).config Makefile $(call REGISTER,$(APPNAME1),$(PRIORITY1),$(STACKSIZE1),$(APPNAME1)_main) - $(call REGISTER,$(APPNAME2),$(PRIORITY2),$(STACKSIZE2),$(APPNAME2)_main) - @touch $@ -endif -context: .context +$(BUILTIN_REGISTRY)$(DELIM)$(APPNAME2)_main.bdat: $(TOPDIR)$(DELIM).config Makefile + $(call REGISTER,$(APPNAME2),$(PRIORITY2),$(STACKSIZE2),$(APPNAME2)_main) + +context: $(BUILTIN_REGISTRY)$(DELIM)$(APPNAME1)_main.bdat $(BUILTIN_REGISTRY)$(DELIM)$(APPNAME2)_main.bdat +else +context: +endif .depend: Makefile $(SRCS) @$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep diff --git a/apps/examples/usbterm/Makefile b/apps/examples/usbterm/Makefile index c5fb95331e..3b3ca6cd7f 100644 --- a/apps/examples/usbterm/Makefile +++ b/apps/examples/usbterm/Makefile @@ -83,13 +83,14 @@ $(COBJS): %$(OBJEXT): %.c $(call ARCHIVE, $(BIN), $(OBJS)) @touch .built -.context: ifeq ($(CONFIG_EXAMPLES_USBTERM_BUILTIN),y) +$(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat: $(TOPDIR)$(DELIM).config Makefile $(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main) - @touch $@ -endif -context: .context +context: $(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat +else +context: +endif .depend: Makefile $(SRCS) @$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep diff --git a/apps/examples/watchdog/Makefile b/apps/examples/watchdog/Makefile index 9890959fb5..cf947b0119 100644 --- a/apps/examples/watchdog/Makefile +++ b/apps/examples/watchdog/Makefile @@ -83,11 +83,14 @@ $(COBJS): %$(OBJEXT): %.c $(call ARCHIVE, $(BIN), $(OBJS)) @touch .built -.context: +ifeq ($(CONFIG_NSH_BUILTIN_APPS),y) +$(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat: $(TOPDIR)$(DELIM).config Makefile $(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main) - @touch $@ -context: .context +context: $(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat +else +context: +endif .depend: Makefile $(SRCS) @$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep diff --git a/apps/examples/wgetjson/Makefile b/apps/examples/wgetjson/Makefile index fa8f302c68..38bd8ac04f 100644 --- a/apps/examples/wgetjson/Makefile +++ b/apps/examples/wgetjson/Makefile @@ -83,13 +83,14 @@ $(COBJS): %$(OBJEXT): %.c $(call ARCHIVE, $(BIN), $(OBJS)) @touch .built -.context: ifeq ($(CONFIG_NSH_BUILTIN_APPS),y) +$(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat: $(TOPDIR)$(DELIM).config Makefile $(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main) - @touch $@ -endif -context: .context +context: $(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat +else +context: +endif .depend: Makefile $(SRCS) @$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep diff --git a/apps/examples/xmlrpc/Makefile b/apps/examples/xmlrpc/Makefile index 7053f54d38..4756bfabbb 100644 --- a/apps/examples/xmlrpc/Makefile +++ b/apps/examples/xmlrpc/Makefile @@ -84,13 +84,14 @@ $(COBJS): %$(OBJEXT): %.c $(call ARCHIVE, $(BIN), $(OBJS)) @touch .built -.context: ifeq ($(CONFIG_NSH_BUILTIN_APPS),y) +$(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat: $(TOPDIR)$(DELIM).config Makefile $(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main) - @touch $@ -endif -context: .context +context: $(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat +else +context: +endif .depend: Makefile $(SRCS) @$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep diff --git a/apps/graphics/tiff/Makefile b/apps/graphics/tiff/Makefile index e42091ad94..b5f6c5b73b 100644 --- a/apps/graphics/tiff/Makefile +++ b/apps/graphics/tiff/Makefile @@ -90,7 +90,6 @@ clean: $(call CLEAN) distclean: clean - $(call DELFILE, .context) $(call DELFILE, Make.dep) $(call DELFILE, .depend) diff --git a/apps/interpreters/ficl/Makefile b/apps/interpreters/ficl/Makefile index 990630fb89..3b2dc7ab9b 100644 --- a/apps/interpreters/ficl/Makefile +++ b/apps/interpreters/ficl/Makefile @@ -108,7 +108,6 @@ context: depend: .depend clean: - $(call DELFILE, .context) $(call DELFILE, .built) $(call CLEAN) diff --git a/apps/modbus/Makefile b/apps/modbus/Makefile index d2b1481628..27548f3d61 100644 --- a/apps/modbus/Makefile +++ b/apps/modbus/Makefile @@ -111,7 +111,6 @@ clean: $(call CLEAN) distclean: clean - $(call DELFILE, .context) $(call DELFILE, Make.dep) $(call DELFILE, .depend) diff --git a/apps/nshlib/Makefile b/apps/nshlib/Makefile index 73325e899d..7ddbb67bf3 100644 --- a/apps/nshlib/Makefile +++ b/apps/nshlib/Makefile @@ -130,7 +130,6 @@ clean: $(call CLEAN) distclean: clean - $(call DELFILE, .context) $(call DELFILE, Make.dep) $(call DELFILE, .depend) diff --git a/apps/system/free/Makefile b/apps/system/free/Makefile index dada00d992..4f6424f50d 100644 --- a/apps/system/free/Makefile +++ b/apps/system/free/Makefile @@ -92,11 +92,14 @@ $(COBJS): %$(OBJEXT): %.c # Register application -.context: +ifeq ($(CONFIG_NSH_BUILTIN_APPS),y) +$(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat: $(TOPDIR)$(DELIM).config Makefile $(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main) - $(Q) touch $@ -context: .context +context: $(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat +else +context: +endif # Create dependencies @@ -111,7 +114,6 @@ clean: $(call CLEAN) distclean: clean - $(call DELFILE, .context) $(call DELFILE, Make.dep) $(call DELFILE, .depend) diff --git a/apps/system/i2c/Makefile b/apps/system/i2c/Makefile index 029d2b6fe4..7f42801a9f 100644 --- a/apps/system/i2c/Makefile +++ b/apps/system/i2c/Makefile @@ -68,7 +68,7 @@ STACKSIZE = 2048 # Build targets all: .built -.PHONY: .context context .depend depend clean distclean +.PHONY: context .depend depend clean distclean $(AOBJS): %$(OBJEXT): %.S $(call ASSEMBLE, $<, $@) @@ -80,11 +80,14 @@ $(COBJS): %$(OBJEXT): %.c $(call ARCHIVE, $(BIN), $(OBJS)) $(Q) touch .built -.context: +ifeq ($(CONFIG_NSH_BUILTIN_APPS),y) +$(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat: $(TOPDIR)$(DELIM).config Makefile $(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main) - $(Q) touch $@ -context: .context +context: $(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat +else +context: +endif .depend: Makefile $(SRCS) $(Q) $(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep @@ -97,7 +100,6 @@ clean: $(call CLEAN) distclean: clean - $(call DELFILE, .context) $(call DELFILE, Make.dep) $(call DELFILE, .depend) diff --git a/apps/system/install/Makefile b/apps/system/install/Makefile index 6a02d859ff..aa65e60edd 100644 --- a/apps/system/install/Makefile +++ b/apps/system/install/Makefile @@ -93,11 +93,14 @@ $(COBJS): %$(OBJEXT): %.c # Register application -.context: +ifeq ($(CONFIG_NSH_BUILTIN_APPS),y) +$(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat: $(TOPDIR)$(DELIM).config Makefile $(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main) - $(Q) touch $@ -context: .context +context: $(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat +else +context: +endif # Create dependencies @@ -112,7 +115,6 @@ clean: $(call CLEAN) distclean: clean - $(call DELFILE, .context) $(call DELFILE, Make.dep) $(call DELFILE, .depend) diff --git a/apps/system/poweroff/Makefile b/apps/system/poweroff/Makefile index bbceccb9e9..0067a13abe 100644 --- a/apps/system/poweroff/Makefile +++ b/apps/system/poweroff/Makefile @@ -93,11 +93,14 @@ $(COBJS): %$(OBJEXT): %.c # Register application -.context: +ifeq ($(CONFIG_NSH_BUILTIN_APPS),y) +$(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat: $(TOPDIR)$(DELIM).config Makefile $(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main) - $(Q) touch $@ -context: .context +context: $(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat +else +context: +endif # Create dependencies @@ -112,7 +115,6 @@ clean: $(call CLEAN) distclean: clean - $(call DELFILE, .context) $(call DELFILE, Make.dep) $(call DELFILE, .depend) diff --git a/apps/system/ramtron/Makefile b/apps/system/ramtron/Makefile index 9f5af1659b..1c92398f32 100644 --- a/apps/system/ramtron/Makefile +++ b/apps/system/ramtron/Makefile @@ -93,11 +93,14 @@ $(COBJS): %$(OBJEXT): %.c # Register application -.context: +ifeq ($(CONFIG_NSH_BUILTIN_APPS),y) +$(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat: $(TOPDIR)$(DELIM).config Makefile $(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main) - $(Q) touch $@ -context: .context +context: $(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat +else +context: +endif # Create dependencies @@ -112,7 +115,6 @@ clean: $(call CLEAN) distclean: clean - $(call DELFILE, .context) $(call DELFILE, Make.dep) $(call DELFILE, .depend) diff --git a/apps/system/readline/Makefile b/apps/system/readline/Makefile index 3a48d324e7..040fd2e28f 100644 --- a/apps/system/readline/Makefile +++ b/apps/system/readline/Makefile @@ -100,7 +100,6 @@ clean: $(call CLEAN) distclean: clean - $(call DELFILE, .context) $(call DELFILE, Make.dep) $(call DELFILE, .depend) diff --git a/apps/system/sdcard/Makefile b/apps/system/sdcard/Makefile index 6d5d129608..6c580ba868 100644 --- a/apps/system/sdcard/Makefile +++ b/apps/system/sdcard/Makefile @@ -93,11 +93,14 @@ $(COBJS): %$(OBJEXT): %.c # Register application -.context: +ifeq ($(CONFIG_NSH_BUILTIN_APPS),y) +$(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat: $(TOPDIR)$(DELIM).config Makefile $(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main) - $(Q) touch $@ -context: .context +context: $(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat +else +context: +endif # Create dependencies @@ -112,7 +115,6 @@ clean: $(call CLEAN) distclean: clean - $(call DELFILE, .context) $(call DELFILE, Make.dep) $(call DELFILE, .depend) diff --git a/apps/system/sysinfo/Makefile b/apps/system/sysinfo/Makefile index fa6aebf711..d233aa3d80 100644 --- a/apps/system/sysinfo/Makefile +++ b/apps/system/sysinfo/Makefile @@ -93,11 +93,14 @@ $(COBJS): %$(OBJEXT): %.c # Register application -.context: +ifeq ($(CONFIG_NSH_BUILTIN_APPS),y) +$(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat: $(TOPDIR)$(DELIM).config Makefile $(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main) - $(Q) touch $@ -context: .context +context: $(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat +else +context: +endif # Create dependencies @@ -112,7 +115,6 @@ clean: $(call CLEAN) distclean: clean - $(call DELFILE, .context) $(call DELFILE, Make.dep) $(call DELFILE, .depend) diff --git a/nuttx/Documentation/NuttShell.html b/nuttx/Documentation/NuttShell.html index cc3f078ddf..7ad96da79b 100644 --- a/nuttx/Documentation/NuttShell.html +++ b/nuttx/Documentation/NuttShell.html @@ -3349,11 +3349,7 @@ int hello_main(int argc, char *argv[])

  • - And finally, the apps/examples/Makefilewill execute the context target in all configured examplesub-directores, getting us finally to apps/examples/Makefile (which is covered below).

    -
  • -

    - At the conclusion of the context phase, the apps/Makefile will touch a file called .context in the apps/ directory, preventing any further configurations during any subsequent context phase build attempts. -

    + And finally, the apps/examples/Makefile will execute the context target in all configured examplesub-directores, getting us finally to apps/examples/Makefile which is covered below.

    @@ -3417,9 +3413,8 @@ STACKSIZE = 2048 When the hello command is executed, it will start the task with entry point hello_main() with the default priority and with a stack size of 2K.

      -.context:
      +context:
         $(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main)
      -  @touch $@
       
    diff --git a/nuttx/configs/vsn/src/Makefile b/nuttx/configs/vsn/src/Makefile index a71c80c8ab..b0eba0a20b 100644 --- a/nuttx/configs/vsn/src/Makefile +++ b/nuttx/configs/vsn/src/Makefile @@ -85,11 +85,14 @@ libboard$(LIBEXT): $(OBJS) # Register application -.context: +ifeq ($(CONFIG_NSH_BUILTIN_APPS),y) +$(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat: $(TOPDIR)$(DELIM).config Makefile $(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main) - $(Q) touch $@ -context: .context +context: $(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat +else +context: +endif # Create dependencies From 424d1af00f29a81ec98b9b91bc518b70fb8e2013 Mon Sep 17 00:00:00 2001 From: patacongo Date: Mon, 24 Dec 2012 13:15:57 +0000 Subject: [PATCH 009/118] Some fixes to apps/builtin/registry need to handle some additional cases git-svn-id: http://svn.code.sf.net/p/nuttx/code/trunk@5456 42af7a65-404d-4744-a932-0658087f49c3 --- apps/ChangeLog.txt | 5 ++++- apps/Make.defs | 6 ++++++ apps/builtin/Makefile | 2 ++ apps/builtin/registry/Makefile | 9 ++++++++- apps/examples/adc/Makefile | 2 +- apps/examples/buttons/Makefile | 2 +- apps/examples/can/Makefile | 2 +- apps/examples/cdcacm/Makefile | 4 ++-- apps/examples/composite/Makefile | 4 ++-- apps/examples/cxxtest/Makefile | 2 +- apps/examples/dhcpd/Makefile | 2 +- apps/examples/discover/Makefile | 2 +- apps/examples/ftpc/Makefile | 2 +- apps/examples/ftpd/Makefile | 4 ++-- apps/examples/hello/Makefile | 2 +- apps/examples/helloxx/Makefile | 2 +- apps/examples/json/Makefile | 2 +- apps/examples/keypadtest/Makefile | 2 +- apps/examples/lcdrw/Makefile | 2 +- apps/examples/modbus/Makefile | 2 +- apps/examples/nettest/Makefile | 2 +- apps/examples/nx/Makefile | 2 +- apps/examples/nxhello/Makefile | 2 +- apps/examples/nximage/Makefile | 2 +- apps/examples/nxlines/Makefile | 2 +- apps/examples/nxtext/Makefile | 2 +- apps/examples/ostest/Makefile | 2 +- apps/examples/pwm/Makefile | 2 +- apps/examples/qencoder/Makefile | 2 +- apps/examples/relays/Makefile | 2 +- apps/examples/telnetd/Makefile | 2 +- apps/examples/tiff/Makefile | 2 +- apps/examples/touchscreen/Makefile | 2 +- apps/examples/usbstorage/Makefile | 4 ++-- apps/examples/usbterm/Makefile | 2 +- apps/examples/watchdog/Makefile | 2 +- apps/examples/wgetjson/Makefile | 2 +- apps/examples/xmlrpc/Makefile | 2 +- apps/system/free/Makefile | 2 +- apps/system/i2c/Makefile | 2 +- apps/system/install/Makefile | 2 +- apps/system/poweroff/Makefile | 2 +- apps/system/ramtron/Makefile | 2 +- apps/system/sdcard/Makefile | 2 +- apps/system/sysinfo/Makefile | 2 +- 45 files changed, 65 insertions(+), 47 deletions(-) diff --git a/apps/ChangeLog.txt b/apps/ChangeLog.txt index 8999047ef1..09a4f634d1 100644 --- a/apps/ChangeLog.txt +++ b/apps/ChangeLog.txt @@ -440,8 +440,11 @@ files. It makes sense for 'leaf' Makefiles to have this dependency, but it does not make sense for upper-level Makefiles. * namedapp/: Renamed to builtins in preparation for another change. - * .context: Removed the .context kludge. This causes lots of problems + * .context: Removed the .context kludge. This caused lots of problems when changing configurations because there is no easy way to get the system to rebuild the context. Now, the context will be rebuilt whenever there is a change in either .config or the Makefile. + * builtin/registry: Updated new built-in registration logic to handle + cases where (1) old apps/.config is used, and (2) applications ared + removed, not just added. diff --git a/apps/Make.defs b/apps/Make.defs index 217137a29c..c62999804c 100644 --- a/apps/Make.defs +++ b/apps/Make.defs @@ -36,6 +36,12 @@ BUILTIN_REGISTRY = $(APPDIR)$(DELIM)builtin$(DELIM)registry +ifeq ($(CONFIG_NUTTX_NEWCONFIG),y) +DEPCONFIG = $(TOPDIR)/.config +else +DEPCONFIG = $(TOPDIR)/.config $(APPDIR)/.config +endif + define REGISTER $(Q) echo "Register: $1" $(Q) echo "{ \"$1\", $2, $3, $4 }," > "$(BUILTIN_REGISTRY)$(DELIM)$4.bdat" diff --git a/apps/builtin/Makefile b/apps/builtin/Makefile index 6633146e93..2d8b0193ed 100644 --- a/apps/builtin/Makefile +++ b/apps/builtin/Makefile @@ -96,6 +96,7 @@ endif $(Q) touch .built context: + $(Q) $(MAKE) -C registry context TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)" .depend: Makefile $(SRCS) $(Q) $(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep @@ -104,6 +105,7 @@ context: depend: .depend clean: + $(Q) $(MAKE) -C registry clean TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)" $(call DELFILE, .built) $(call CLEAN) diff --git a/apps/builtin/registry/Makefile b/apps/builtin/registry/Makefile index 9117f53d6e..4ecd5da9fa 100644 --- a/apps/builtin/registry/Makefile +++ b/apps/builtin/registry/Makefile @@ -41,7 +41,14 @@ include $(APPDIR)/Make.defs all: .PHONY: context depend clean distclean -context: +.updated: $(DEPCONFIG) + $(call DELFILE, *.bdat) + $(call DELFILE, *.pdat) + $(Q) touch .updated + +# This must run before any other context target + +context: .updated depend: diff --git a/apps/examples/adc/Makefile b/apps/examples/adc/Makefile index 55bc259e4b..3cbe843f6f 100644 --- a/apps/examples/adc/Makefile +++ b/apps/examples/adc/Makefile @@ -84,7 +84,7 @@ $(COBJS): %$(OBJEXT): %.c @touch .built ifeq ($(CONFIG_NSH_BUILTIN_APPS),y) -$(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat: $(TOPDIR)$(DELIM).config Makefile +$(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat: $(DEPCONFIG) Makefile $(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main) context: $(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat diff --git a/apps/examples/buttons/Makefile b/apps/examples/buttons/Makefile index ac1f2f05aa..a2e8679d49 100644 --- a/apps/examples/buttons/Makefile +++ b/apps/examples/buttons/Makefile @@ -84,7 +84,7 @@ $(COBJS): %$(OBJEXT): %.c @touch .built ifeq ($(CONFIG_NSH_BUILTIN_APPS),y) -$(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat: $(TOPDIR)$(DELIM).config Makefile +$(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat: $(DEPCONFIG) Makefile $(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main) context: $(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat diff --git a/apps/examples/can/Makefile b/apps/examples/can/Makefile index 5df96e1e7d..548c6702c1 100644 --- a/apps/examples/can/Makefile +++ b/apps/examples/can/Makefile @@ -84,7 +84,7 @@ $(COBJS): %$(OBJEXT): %.c @touch .built ifeq ($(CONFIG_NSH_BUILTIN_APPS),y) -$(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat: $(TOPDIR)$(DELIM).config Makefile +$(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat: $(DEPCONFIG) Makefile $(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main) context: $(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat diff --git a/apps/examples/cdcacm/Makefile b/apps/examples/cdcacm/Makefile index d9e19e9064..2cf3a107fa 100644 --- a/apps/examples/cdcacm/Makefile +++ b/apps/examples/cdcacm/Makefile @@ -88,10 +88,10 @@ $(COBJS): %$(OBJEXT): %.c @touch .built ifeq ($(CONFIG_NSH_BUILTIN_APPS),y) -$(BUILTIN_REGISTRY)$(DELIM)$(APPNAME1)_main.bdat: $(TOPDIR)$(DELIM).config Makefile +$(BUILTIN_REGISTRY)$(DELIM)$(APPNAME1)_main.bdat: $(DEPCONFIG) Makefile $(call REGISTER,$(APPNAME1),$(PRIORITY1),$(STACKSIZE1),$(APPNAME1)_main) -$(BUILTIN_REGISTRY)$(DELIM)$(APPNAME2)_main.bdat: $(TOPDIR)$(DELIM).config Makefile +$(BUILTIN_REGISTRY)$(DELIM)$(APPNAME2)_main.bdat: $(DEPCONFIG) Makefile $(call REGISTER,$(APPNAME2),$(PRIORITY2),$(STACKSIZE2),$(APPNAME2)_main) context: $(BUILTIN_REGISTRY)$(DELIM)$(APPNAME1)_main.bdat $(BUILTIN_REGISTRY)$(DELIM)$(APPNAME2)_main.bdat diff --git a/apps/examples/composite/Makefile b/apps/examples/composite/Makefile index b1fe493082..1f05d9c647 100644 --- a/apps/examples/composite/Makefile +++ b/apps/examples/composite/Makefile @@ -88,10 +88,10 @@ $(COBJS): %$(OBJEXT): %.c @touch .built ifeq ($(CONFIG_NSH_BUILTIN_APPS),y) -$(BUILTIN_REGISTRY)$(DELIM)$(APPNAME1)_main.bdat: $(TOPDIR)$(DELIM).config Makefile +$(BUILTIN_REGISTRY)$(DELIM)$(APPNAME1)_main.bdat: $(DEPCONFIG) Makefile $(call REGISTER,$(APPNAME1),$(PRIORITY1),$(STACKSIZE1),$(APPNAME1)_main) -$(BUILTIN_REGISTRY)$(DELIM)$(APPNAME2)_main.bdat: $(TOPDIR)$(DELIM).config Makefile +$(BUILTIN_REGISTRY)$(DELIM)$(APPNAME2)_main.bdat: $(DEPCONFIG) Makefile $(call REGISTER,$(APPNAME2),$(PRIORITY2),$(STACKSIZE2),$(APPNAME2)_main) context: $(BUILTIN_REGISTRY)$(DELIM)$(APPNAME1)_main.bdat $(BUILTIN_REGISTRY)$(DELIM)$(APPNAME2)_main.bdat diff --git a/apps/examples/cxxtest/Makefile b/apps/examples/cxxtest/Makefile index cba9f0a4f0..97fdb6edee 100644 --- a/apps/examples/cxxtest/Makefile +++ b/apps/examples/cxxtest/Makefile @@ -101,7 +101,7 @@ $(CXXOBJS): %$(OBJEXT): %.cxx @touch .built ifeq ($(CONFIG_EXAMPLES_HELLOXX_BUILTIN),y) -$(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat: $(TOPDIR)$(DELIM).config Makefile +$(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat: $(DEPCONFIG) Makefile $(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main) context: $(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat diff --git a/apps/examples/dhcpd/Makefile b/apps/examples/dhcpd/Makefile index 0522d4cc47..d718d79e13 100644 --- a/apps/examples/dhcpd/Makefile +++ b/apps/examples/dhcpd/Makefile @@ -84,7 +84,7 @@ $(COBJS): %$(OBJEXT): %.c @touch .built ifeq ($(CONFIG_NSH_BUILTIN_APPS),y) -$(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat: $(TOPDIR)$(DELIM).config Makefile +$(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat: $(DEPCONFIG) Makefile $(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main) context: $(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat diff --git a/apps/examples/discover/Makefile b/apps/examples/discover/Makefile index b0285fbff3..033ab11313 100644 --- a/apps/examples/discover/Makefile +++ b/apps/examples/discover/Makefile @@ -85,7 +85,7 @@ $(COBJS): %$(OBJEXT): %.c @touch .built ifeq ($(CONFIG_NSH_BUILTIN_APPS),y) -$(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat: $(TOPDIR)$(DELIM).config Makefile +$(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat: $(DEPCONFIG) Makefile $(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main) context: $(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat diff --git a/apps/examples/ftpc/Makefile b/apps/examples/ftpc/Makefile index e09779abdf..cc966f8d6b 100644 --- a/apps/examples/ftpc/Makefile +++ b/apps/examples/ftpc/Makefile @@ -84,7 +84,7 @@ $(COBJS): %$(OBJEXT): %.c # Register application ifeq ($(CONFIG_NSH_BUILTIN_APPS),y) -$(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat: $(TOPDIR)$(DELIM).config Makefile +$(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat: $(DEPCONFIG) Makefile $(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main) context: $(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat diff --git a/apps/examples/ftpd/Makefile b/apps/examples/ftpd/Makefile index dc53bfdeab..dd18d5043b 100644 --- a/apps/examples/ftpd/Makefile +++ b/apps/examples/ftpd/Makefile @@ -79,10 +79,10 @@ $(COBJS): %$(OBJEXT): %.c @touch .built ifeq ($(CONFIG_NSH_BUILTIN_APPS),y) -$(BUILTIN_REGISTRY)$(DELIM)ftpd_start.bdat: $(TOPDIR)$(DELIM).config Makefile +$(BUILTIN_REGISTRY)$(DELIM)ftpd_start.bdat: $(DEPCONFIG) Makefile $(call REGISTER,ftpd_start,SCHED_PRIORITY_DEFAULT,2048,ftpd_start) -$(BUILTIN_REGISTRY)$(DELIM)ftpd_stop.bdat: $(TOPDIR)$(DELIM).config Makefile +$(BUILTIN_REGISTRY)$(DELIM)ftpd_stop.bdat: $(DEPCONFIG) Makefile $(call REGISTER,ftpd_stop,SCHED_PRIORITY_DEFAULT,2048,ftpd_stop) context: $(BUILTIN_REGISTRY)$(DELIM)ftpd_start.bdat $(BUILTIN_REGISTRY)$(DELIM)ftpd_stop.bdat diff --git a/apps/examples/hello/Makefile b/apps/examples/hello/Makefile index c4e6f735a5..fc98fa7f45 100644 --- a/apps/examples/hello/Makefile +++ b/apps/examples/hello/Makefile @@ -84,7 +84,7 @@ $(COBJS): %$(OBJEXT): %.c @touch .built ifeq ($(CONFIG_EXAMPLES_HELLO_BUILTIN),y) -$(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat: $(TOPDIR)$(DELIM).config Makefile +$(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat: $(DEPCONFIG) Makefile $(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main) context: $(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat diff --git a/apps/examples/helloxx/Makefile b/apps/examples/helloxx/Makefile index df1b360a50..44d8806583 100644 --- a/apps/examples/helloxx/Makefile +++ b/apps/examples/helloxx/Makefile @@ -101,7 +101,7 @@ $(CXXOBJS): %$(OBJEXT): %.cxx @touch .built ifeq ($(CONFIG_EXAMPLES_HELLOXX_BUILTIN),y) -$(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat: $(TOPDIR)$(DELIM).config Makefile +$(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat: $(DEPCONFIG) Makefile $(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main) context: $(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat diff --git a/apps/examples/json/Makefile b/apps/examples/json/Makefile index 1e42757b86..f6a38fb1a1 100644 --- a/apps/examples/json/Makefile +++ b/apps/examples/json/Makefile @@ -82,7 +82,7 @@ $(COBJS): %$(OBJEXT): %.c @touch .built ifeq ($(CONFIG_NSH_BUILTIN_APPS),y) -$(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat: $(TOPDIR)$(DELIM).config Makefile +$(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat: $(DEPCONFIG) Makefile $(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main) context: $(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat diff --git a/apps/examples/keypadtest/Makefile b/apps/examples/keypadtest/Makefile index 0c40a5c6c1..e38e66a822 100644 --- a/apps/examples/keypadtest/Makefile +++ b/apps/examples/keypadtest/Makefile @@ -84,7 +84,7 @@ $(COBJS): %$(OBJEXT): %.c @touch .built ifeq ($(CONFIG_NSH_BUILTIN_APPS),y) -$(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat: $(TOPDIR)$(DELIM).config Makefile +$(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat: $(DEPCONFIG) Makefile $(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main) context: $(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat diff --git a/apps/examples/lcdrw/Makefile b/apps/examples/lcdrw/Makefile index 61d6bcce6e..aab04acf5e 100644 --- a/apps/examples/lcdrw/Makefile +++ b/apps/examples/lcdrw/Makefile @@ -84,7 +84,7 @@ $(COBJS): %$(OBJEXT): %.c @touch .built ifeq ($(CONFIG_EXAMPLES_LCDRW_BUILTIN),y) -$(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat: $(TOPDIR)$(DELIM).config Makefile +$(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat: $(DEPCONFIG) Makefile $(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main) context: $(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat diff --git a/apps/examples/modbus/Makefile b/apps/examples/modbus/Makefile index da31c3b524..b2fba6764e 100644 --- a/apps/examples/modbus/Makefile +++ b/apps/examples/modbus/Makefile @@ -84,7 +84,7 @@ $(COBJS): %$(OBJEXT): %.c @touch .built ifeq ($(CONFIG_NSH_BUILTIN_APPS),y) -$(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat: $(TOPDIR)$(DELIM).config Makefile +$(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat: $(DEPCONFIG) Makefile $(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main) context: $(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat diff --git a/apps/examples/nettest/Makefile b/apps/examples/nettest/Makefile index e6f56e7659..a0308713c1 100644 --- a/apps/examples/nettest/Makefile +++ b/apps/examples/nettest/Makefile @@ -117,7 +117,7 @@ $(HOST_BIN): $(HOST_OBJS) @touch .built ifeq ($(CONFIG_NSH_BUILTIN_APPS),y) -$(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat: $(TOPDIR)$(DELIM).config Makefile +$(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat: $(DEPCONFIG) Makefile $(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main) context: $(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat diff --git a/apps/examples/nx/Makefile b/apps/examples/nx/Makefile index 4474a58c3f..13a9388219 100644 --- a/apps/examples/nx/Makefile +++ b/apps/examples/nx/Makefile @@ -87,7 +87,7 @@ $(COBJS): %$(OBJEXT): %.c @touch .built ifeq ($(CONFIG_EXAMPLES_NX_BUILTIN),y) -$(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat: $(TOPDIR)$(DELIM).config Makefile +$(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat: $(DEPCONFIG) Makefile $(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main) context: $(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat diff --git a/apps/examples/nxhello/Makefile b/apps/examples/nxhello/Makefile index 52ced123d5..4a72eb8c7b 100644 --- a/apps/examples/nxhello/Makefile +++ b/apps/examples/nxhello/Makefile @@ -84,7 +84,7 @@ $(COBJS): %$(OBJEXT): %.c @touch .built ifeq ($(CONFIG_EXAMPLES_NXHELLO_BUILTIN),y) -$(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat: $(TOPDIR)$(DELIM).config Makefile +$(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat: $(DEPCONFIG) Makefile $(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main) context: $(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat diff --git a/apps/examples/nximage/Makefile b/apps/examples/nximage/Makefile index 98f04c2d53..7bdaa46d23 100644 --- a/apps/examples/nximage/Makefile +++ b/apps/examples/nximage/Makefile @@ -84,7 +84,7 @@ $(COBJS): %$(OBJEXT): %.c @touch .built ifeq ($(CONFIG_EXAMPLES_NXIMAGE_BUILTIN),y) -$(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat: $(TOPDIR)$(DELIM).config Makefile +$(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat: $(DEPCONFIG) Makefile $(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main) context: $(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat diff --git a/apps/examples/nxlines/Makefile b/apps/examples/nxlines/Makefile index 9673a5520d..54495b2924 100644 --- a/apps/examples/nxlines/Makefile +++ b/apps/examples/nxlines/Makefile @@ -84,7 +84,7 @@ $(COBJS): %$(OBJEXT): %.c @touch .built ifeq ($(CONFIG_NSH_BUILTIN_APPS),y) -$(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat: $(TOPDIR)$(DELIM).config Makefile +$(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat: $(DEPCONFIG) Makefile $(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main) context: $(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat diff --git a/apps/examples/nxtext/Makefile b/apps/examples/nxtext/Makefile index 738209754f..dfb165608d 100644 --- a/apps/examples/nxtext/Makefile +++ b/apps/examples/nxtext/Makefile @@ -88,7 +88,7 @@ $(COBJS): %$(OBJEXT): %.c @touch .built ifeq ($(CONFIG_EXAMPLES_NXTEXT_BUILTIN),y) -$(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat: $(TOPDIR)$(DELIM).config Makefile +$(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat: $(DEPCONFIG) Makefile $(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main) context: $(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat diff --git a/apps/examples/ostest/Makefile b/apps/examples/ostest/Makefile index dfb500387a..3d19f6a780 100644 --- a/apps/examples/ostest/Makefile +++ b/apps/examples/ostest/Makefile @@ -128,7 +128,7 @@ $(COBJS): %$(OBJEXT): %.c @touch .built ifeq ($(CONFIG_EXAMPLES_OSTEST_BUILTIN),y) -$(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat: $(TOPDIR)$(DELIM).config Makefile +$(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat: $(DEPCONFIG) Makefile $(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main) context: $(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat diff --git a/apps/examples/pwm/Makefile b/apps/examples/pwm/Makefile index d33d1c2775..ece901a993 100644 --- a/apps/examples/pwm/Makefile +++ b/apps/examples/pwm/Makefile @@ -84,7 +84,7 @@ $(COBJS): %$(OBJEXT): %.c @touch .built ifeq ($(CONFIG_NSH_BUILTIN_APPS),y) -$(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat: $(TOPDIR)$(DELIM).config Makefile +$(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat: $(DEPCONFIG) Makefile $(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main) context: $(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat diff --git a/apps/examples/qencoder/Makefile b/apps/examples/qencoder/Makefile index 1caff2ed30..9668796e67 100644 --- a/apps/examples/qencoder/Makefile +++ b/apps/examples/qencoder/Makefile @@ -84,7 +84,7 @@ $(COBJS): %$(OBJEXT): %.c @touch .built ifeq ($(CONFIG_NSH_BUILTIN_APPS),y) -$(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat: $(TOPDIR)$(DELIM).config Makefile +$(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat: $(DEPCONFIG) Makefile $(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main) context: $(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat diff --git a/apps/examples/relays/Makefile b/apps/examples/relays/Makefile index 17bf7a6a4b..1ab4c87167 100644 --- a/apps/examples/relays/Makefile +++ b/apps/examples/relays/Makefile @@ -84,7 +84,7 @@ $(COBJS): %$(OBJEXT): %.c @touch .built ifeq ($(CONFIG_NSH_BUILTIN_APPS),y) -$(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat: $(TOPDIR)$(DELIM).config Makefile +$(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat: $(DEPCONFIG) Makefile $(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main) context: $(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat diff --git a/apps/examples/telnetd/Makefile b/apps/examples/telnetd/Makefile index 63876baa03..4391870c0a 100644 --- a/apps/examples/telnetd/Makefile +++ b/apps/examples/telnetd/Makefile @@ -84,7 +84,7 @@ $(COBJS): %$(OBJEXT): %.c @touch .built ifeq ($(CONFIG_NSH_BUILTIN_APPS),y) -$(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat: $(TOPDIR)$(DELIM).config Makefile +$(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat: $(DEPCONFIG) Makefile $(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main) context: $(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat diff --git a/apps/examples/tiff/Makefile b/apps/examples/tiff/Makefile index 853e904a73..17b3bb92cf 100644 --- a/apps/examples/tiff/Makefile +++ b/apps/examples/tiff/Makefile @@ -84,7 +84,7 @@ $(COBJS): %$(OBJEXT): %.c @touch .built ifeq ($(CONFIG_EXAMPLES_TIFF_BUILTIN),y) -$(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat: $(TOPDIR)$(DELIM).config Makefile +$(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat: $(DEPCONFIG) Makefile $(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main) context: $(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat diff --git a/apps/examples/touchscreen/Makefile b/apps/examples/touchscreen/Makefile index 8761cc5b50..1a65c7282d 100644 --- a/apps/examples/touchscreen/Makefile +++ b/apps/examples/touchscreen/Makefile @@ -84,7 +84,7 @@ $(COBJS): %$(OBJEXT): %.c @touch .built ifeq ($(CONFIG_EXAMPLES_TOUCHSCREEN_BUILTIN),y) -$(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat: $(TOPDIR)$(DELIM).config Makefile +$(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat: $(DEPCONFIG) Makefile $(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main) context: $(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat diff --git a/apps/examples/usbstorage/Makefile b/apps/examples/usbstorage/Makefile index a1eb77836e..6c486bf9c4 100644 --- a/apps/examples/usbstorage/Makefile +++ b/apps/examples/usbstorage/Makefile @@ -88,10 +88,10 @@ $(COBJS): %$(OBJEXT): %.c @touch .built ifeq ($(CONFIG_EXAMPLES_USBMSC_BUILTIN),y) -$(BUILTIN_REGISTRY)$(DELIM)$(APPNAME1)_main.bdat: $(TOPDIR)$(DELIM).config Makefile +$(BUILTIN_REGISTRY)$(DELIM)$(APPNAME1)_main.bdat: $(DEPCONFIG) Makefile $(call REGISTER,$(APPNAME1),$(PRIORITY1),$(STACKSIZE1),$(APPNAME1)_main) -$(BUILTIN_REGISTRY)$(DELIM)$(APPNAME2)_main.bdat: $(TOPDIR)$(DELIM).config Makefile +$(BUILTIN_REGISTRY)$(DELIM)$(APPNAME2)_main.bdat: $(DEPCONFIG) Makefile $(call REGISTER,$(APPNAME2),$(PRIORITY2),$(STACKSIZE2),$(APPNAME2)_main) context: $(BUILTIN_REGISTRY)$(DELIM)$(APPNAME1)_main.bdat $(BUILTIN_REGISTRY)$(DELIM)$(APPNAME2)_main.bdat diff --git a/apps/examples/usbterm/Makefile b/apps/examples/usbterm/Makefile index 3b3ca6cd7f..91e80686e2 100644 --- a/apps/examples/usbterm/Makefile +++ b/apps/examples/usbterm/Makefile @@ -84,7 +84,7 @@ $(COBJS): %$(OBJEXT): %.c @touch .built ifeq ($(CONFIG_EXAMPLES_USBTERM_BUILTIN),y) -$(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat: $(TOPDIR)$(DELIM).config Makefile +$(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat: $(DEPCONFIG) Makefile $(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main) context: $(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat diff --git a/apps/examples/watchdog/Makefile b/apps/examples/watchdog/Makefile index cf947b0119..076272fe36 100644 --- a/apps/examples/watchdog/Makefile +++ b/apps/examples/watchdog/Makefile @@ -84,7 +84,7 @@ $(COBJS): %$(OBJEXT): %.c @touch .built ifeq ($(CONFIG_NSH_BUILTIN_APPS),y) -$(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat: $(TOPDIR)$(DELIM).config Makefile +$(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat: $(DEPCONFIG) Makefile $(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main) context: $(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat diff --git a/apps/examples/wgetjson/Makefile b/apps/examples/wgetjson/Makefile index 38bd8ac04f..89cb3e11e4 100644 --- a/apps/examples/wgetjson/Makefile +++ b/apps/examples/wgetjson/Makefile @@ -84,7 +84,7 @@ $(COBJS): %$(OBJEXT): %.c @touch .built ifeq ($(CONFIG_NSH_BUILTIN_APPS),y) -$(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat: $(TOPDIR)$(DELIM).config Makefile +$(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat: $(DEPCONFIG) Makefile $(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main) context: $(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat diff --git a/apps/examples/xmlrpc/Makefile b/apps/examples/xmlrpc/Makefile index 4756bfabbb..b103fd7edc 100644 --- a/apps/examples/xmlrpc/Makefile +++ b/apps/examples/xmlrpc/Makefile @@ -85,7 +85,7 @@ $(COBJS): %$(OBJEXT): %.c @touch .built ifeq ($(CONFIG_NSH_BUILTIN_APPS),y) -$(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat: $(TOPDIR)$(DELIM).config Makefile +$(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat: $(DEPCONFIG) Makefile $(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main) context: $(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat diff --git a/apps/system/free/Makefile b/apps/system/free/Makefile index 4f6424f50d..58ca7956c3 100644 --- a/apps/system/free/Makefile +++ b/apps/system/free/Makefile @@ -93,7 +93,7 @@ $(COBJS): %$(OBJEXT): %.c # Register application ifeq ($(CONFIG_NSH_BUILTIN_APPS),y) -$(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat: $(TOPDIR)$(DELIM).config Makefile +$(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat: $(DEPCONFIG) Makefile $(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main) context: $(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat diff --git a/apps/system/i2c/Makefile b/apps/system/i2c/Makefile index 7f42801a9f..1ed7a2faef 100644 --- a/apps/system/i2c/Makefile +++ b/apps/system/i2c/Makefile @@ -81,7 +81,7 @@ $(COBJS): %$(OBJEXT): %.c $(Q) touch .built ifeq ($(CONFIG_NSH_BUILTIN_APPS),y) -$(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat: $(TOPDIR)$(DELIM).config Makefile +$(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat: $(DEPCONFIG) Makefile $(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main) context: $(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat diff --git a/apps/system/install/Makefile b/apps/system/install/Makefile index aa65e60edd..07d42887a5 100644 --- a/apps/system/install/Makefile +++ b/apps/system/install/Makefile @@ -94,7 +94,7 @@ $(COBJS): %$(OBJEXT): %.c # Register application ifeq ($(CONFIG_NSH_BUILTIN_APPS),y) -$(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat: $(TOPDIR)$(DELIM).config Makefile +$(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat: $(DEPCONFIG) Makefile $(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main) context: $(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat diff --git a/apps/system/poweroff/Makefile b/apps/system/poweroff/Makefile index 0067a13abe..eb7518fbcc 100644 --- a/apps/system/poweroff/Makefile +++ b/apps/system/poweroff/Makefile @@ -94,7 +94,7 @@ $(COBJS): %$(OBJEXT): %.c # Register application ifeq ($(CONFIG_NSH_BUILTIN_APPS),y) -$(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat: $(TOPDIR)$(DELIM).config Makefile +$(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat: $(DEPCONFIG) Makefile $(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main) context: $(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat diff --git a/apps/system/ramtron/Makefile b/apps/system/ramtron/Makefile index 1c92398f32..b47781095d 100644 --- a/apps/system/ramtron/Makefile +++ b/apps/system/ramtron/Makefile @@ -94,7 +94,7 @@ $(COBJS): %$(OBJEXT): %.c # Register application ifeq ($(CONFIG_NSH_BUILTIN_APPS),y) -$(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat: $(TOPDIR)$(DELIM).config Makefile +$(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat: $(DEPCONFIG) Makefile $(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main) context: $(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat diff --git a/apps/system/sdcard/Makefile b/apps/system/sdcard/Makefile index 6c580ba868..d748b2b04f 100644 --- a/apps/system/sdcard/Makefile +++ b/apps/system/sdcard/Makefile @@ -94,7 +94,7 @@ $(COBJS): %$(OBJEXT): %.c # Register application ifeq ($(CONFIG_NSH_BUILTIN_APPS),y) -$(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat: $(TOPDIR)$(DELIM).config Makefile +$(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat: $(DEPCONFIG) Makefile $(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main) context: $(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat diff --git a/apps/system/sysinfo/Makefile b/apps/system/sysinfo/Makefile index d233aa3d80..eb788b01ac 100644 --- a/apps/system/sysinfo/Makefile +++ b/apps/system/sysinfo/Makefile @@ -94,7 +94,7 @@ $(COBJS): %$(OBJEXT): %.c # Register application ifeq ($(CONFIG_NSH_BUILTIN_APPS),y) -$(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat: $(TOPDIR)$(DELIM).config Makefile +$(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat: $(DEPCONFIG) Makefile $(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main) context: $(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat From 5859e0d35365a89d1b3001f562f89dd81d001302 Mon Sep 17 00:00:00 2001 From: patacongo Date: Mon, 24 Dec 2012 14:31:02 +0000 Subject: [PATCH 010/118] Correct round-to-ticks logic in sigtimedwait() git-svn-id: http://svn.code.sf.net/p/nuttx/code/trunk@5457 42af7a65-404d-4744-a932-0658087f49c3 --- apps/README.txt | 114 ++++++++++++++++++++++++++++++------ nuttx/ChangeLog | 3 + nuttx/sched/sig_timedwait.c | 22 ++++++- 3 files changed, 118 insertions(+), 21 deletions(-) diff --git a/apps/README.txt b/apps/README.txt index 4f043dcfab..3281269057 100644 --- a/apps/README.txt +++ b/apps/README.txt @@ -17,15 +17,15 @@ Contents General ------- This folder provides various applications found in sub-directories. These -applications are not inherently a part of NuttX but are provided you help +applications are not inherently a part of NuttX but are provided to help you develop your own applications. The apps/ directory is a "break away" -part of the configuration that you may chose to use or not. +part of the configuration that you may choose to use or not. Directory Location ------------------ The default application directory used by the NuttX build should be named apps/ (or apps-x.y/ where x.y is the NuttX version number). This apps/ -directoy should appear in the directory tree at the same level as the +directory should appear in the directory tree at the same level as the NuttX directory. Like: . @@ -54,7 +54,7 @@ In this case, application entry points with their requirements are gathered together in two files: - builtin/builtin_proto.h Entry points, prototype function - - builtin/builtin_list.h Application specific information and requirements + - builtin/builtin_list.h Application specific information and requirements The build occurs in several phases as different build targets are executed: (1) context, (2) depend, and (3) default (all). Application information is @@ -96,11 +96,11 @@ after the NSH command. Application Configuration File ------------------------------ -A special configuration file is used to configure which applications -are to be included in the build. The source for this file is -configs///appconfig. The existence of the appconfig -file in the board configuration directory is sufficient to enable building -of applications. +The old-style NuttX configuration uses a special configuration file is +used to configure which applications are to be included in the build. +The source for this file is configs///appconfig. +The existence of the appconfig file in the board configuration directory\ +is sufficient to enable building of applications. The appconfig file is copied into the apps/ directory as .config when NuttX is configured. .config is included in the toplevel apps/Makefile. @@ -109,6 +109,38 @@ CONFIGURED_APPS list like: CONFIGURED_APPS += examples/hello system/poweroff +The new NuttX configuration uses kconfig-frontends tools and only the +NuttX .config file. The new configuration is indicated by the existence +of the definition CONFIG_NUTTX_NEWCONFIG=y in the NuttX .config file. +If CONFIG_NUTTX_NEWCONFIG is defined, then the Makefile will: + +- Assume that there is no apps/.config file and will instead +- Include Make.defs files from each of the subdirectories. + +When an application is enabled using the kconfig-frontends tool, then +a new definition is added to the NuttX .config file. For example, if +you want to enable apps/examples/hello then the old apps/.config would +have had: + + CONFIGURED_APPS += examples/hello + +But in the new configuration there will be no apps/.config file and, +instead, the NuttX .config will have: + + CONFIG_EXAMPLES_HELLO=y + +This will select the apps/examples/hello in the following way: + +- The top-level make will include examples/Make.defs +- examples/Make.defs will set CONFIGURED_APPS += examples/hello + like this: + + ifeq ($(CONFIG_EXAMPLES_HELLO),y) + CONFIGURED_APPS += examples/hello + endif + +Thus accomplishing the same thing with no apps/.config file. + Built-In Start-Up main() function ------------------------------ A builtin application can even be used as the main, start-up entry point @@ -130,17 +162,63 @@ An example application skeleton can be found under the examples/hello sub-directory. This example shows how a builtin application can be added to the project. One must define: - 1. create sub-directory as: appname - 2. provide entry point: appname_main() - 3. set the requirements in the file: Makefile, specially the lines: +Old configuration method: - APPNAME = appname - PRIORITY = SCHED_PRIORITY_DEFAULT - STACKSIZE = 768 - ASRCS = asm source file list as a.asm b.asm ... - CSRCS = C source file list as foo1.c foo2.c .. + 1. Create sub-directory as: appname - 4. add application in the apps/.config + 2. In this directory there should be: + + - A Makefile, and + - The application source code. + + 3. The application source code should provide the entry point: + appname_main() + + 4. Set the requirements in the file: Makefile, specially the lines: + + APPNAME = appname + PRIORITY = SCHED_PRIORITY_DEFAULT + STACKSIZE = 768 + ASRCS = asm source file list as a.asm b.asm ... + CSRCS = C source file list as foo1.c foo2.c .. + + Look at some of the other Makefiles for examples. Note the + special registration logic needed for the context: target + + 5. Add the to the application to the CONFIGIURED_APPS in the + apps/.config file: + + CONFIGURED_APPS += appname + +New Configuration Method: + + 1. Create sub-directory as: appname + + 2. In this directory there should be: + + - A Make.defs file that would be included by the apps/Makefile + - A Kconfig file that would be used by the configuration tool (see + misc/tools/kconfig-language.txt). This Kconfig file should be + included by the apps/Kconfig file + - A Makefile, and + - The application source code. + + 3. The application source code should provide the entry point: + appname_main() + + 4. Set the requirements in the file: Makefile, specially the lines: + + APPNAME = appname + PRIORITY = SCHED_PRIORITY_DEFAULT + STACKSIZE = 768 + ASRCS = asm source file list as a.asm b.asm ... + CSRCS = C source file list as foo1.c foo2.c .. + + 4b. The Make.defs file should include a line like: + + ifeq ($(CONFIG_APPNAME),y) + CONFIGURED_APPS += appname + endif Building NuttX with Board-Specific Pieces Outside the Source Tree ----------------------------------------------------------------- diff --git a/nuttx/ChangeLog b/nuttx/ChangeLog index 56edf9487a..6c6fd7843c 100644 --- a/nuttx/ChangeLog +++ b/nuttx/ChangeLog @@ -3812,4 +3812,7 @@ * include/pthread.h: In sys/prctl.h because it is needed by pthread_[set|get]name_np() * tools/kconfig.bat: Kludge to run kconfig-frontends from a DOS shell. + * sched/sig_timedwait.c: Should always move the time up to the next + largest number of system ticks. The logic was rounding. Noted by + Petteri Aimonen. diff --git a/nuttx/sched/sig_timedwait.c b/nuttx/sched/sig_timedwait.c index 1b8dfd1620..d03611610d 100644 --- a/nuttx/sched/sig_timedwait.c +++ b/nuttx/sched/sig_timedwait.c @@ -238,10 +238,25 @@ int sigtimedwait(FAR const sigset_t *set, FAR struct siginfo *info, if (timeout) { - /* Convert the timespec to milliseconds */ + /* Convert the timespec to system clock ticks, making sure that + * the resultint delay is greater than or equal to the requested + * time in nanoseconds. + */ - waitticks = MSEC2TICK(timeout->tv_sec * MSEC_PER_SEC - + timeout->tv_nsec / NSEC_PER_MSEC); +#ifdef CONFIG_HAVE_LONG_LONG + uint64_t waitticks64 = (timeout->tv_sec * NSEC_PER_SEC + + timeout->tv_nsec + NSEC_PER_TICK - 1) / + NSEC_PER_TICK; + DEBUGASSERT(waitticks64 <= UINT32_MAX); + waitticks = (uint32_t)waitticks64; +#else + uint32_t waitmsec; + + DEBUGASSERT(timeout->tv_sec < UINT32_MAX / MSEC_PER_SEC); + waitmsec = timeout->tv_sec * MSEC_PER_SEC + + (timeout->tv_nsec + NSEC_PER_MSEC - 1) / NSEC_PER_MSEC; + waitticks = (waitmsec + MSEC_PER_TICK - 1) / MSEC_PER_TICK; +#endif /* Create a watchdog */ @@ -326,6 +341,7 @@ int sigtimedwait(FAR const sigset_t *set, FAR struct siginfo *info, { memcpy(info, &rtcb->sigunbinfo, sizeof(struct siginfo)); } + irqrestore(saved_state); } From 7c73fe57c659ce9f9a31a247b04f7068a0b62cb1 Mon Sep 17 00:00:00 2001 From: patacongo Date: Mon, 24 Dec 2012 17:49:58 +0000 Subject: [PATCH 011/118] Fixes for l3s, USB composite, nfsmount, apps context build problems git-svn-id: http://svn.code.sf.net/p/nuttx/code/trunk@5458 42af7a65-404d-4744-a932-0658087f49c3 --- apps/builtin/Makefile | 16 +++++++++++-- apps/nshlib/nsh_mntcmds.c | 3 +++ apps/nshlib/nsh_netcmds.c | 1 + nuttx/configs/ekk-lm3s9b96/nsh/setenv.sh | 12 ++++++---- nuttx/configs/ekk-lm3s9b96/ostest/setenv.sh | 12 ++++++---- nuttx/configs/lm3s8962-ek/nsh/appconfig | 2 +- nuttx/configs/lm3s8962-ek/nsh/setenv.sh | 26 +++++++++++++++++---- nuttx/configs/lm3s8962-ek/nx/setenv.sh | 26 +++++++++++++++++---- nuttx/configs/lm3s8962-ek/ostest/setenv.sh | 26 +++++++++++++++++---- nuttx/configs/stm3210e-eval/RIDE/defconfig | 2 +- nuttx/drivers/usbdev/composite.c | 4 ++-- nuttx/include/nuttx/clock.h | 2 +- nuttx/sched/sig_timedwait.c | 5 ++-- 13 files changed, 105 insertions(+), 32 deletions(-) diff --git a/apps/builtin/Makefile b/apps/builtin/Makefile index 2d8b0193ed..0efb832f87 100644 --- a/apps/builtin/Makefile +++ b/apps/builtin/Makefile @@ -77,18 +77,30 @@ $(COBJS): %$(OBJEXT): %.c builtin_list.h: registry/.updated $(call DELFILE, builtin_list.h) + $(Q) touch builtin_list.h ifeq ($(CONFIG_WINDOWS_NATIVE),y) $(Q) for /f %%G in ('dir /b registry\*.bdat`) do ( type registry\%%G >> builtin_list.h ) else - $(Q) for file in `ls registry/*.bdat`; do cat $$file >> builtin_list.h; done + $(Q) ( \ + filelist=`ls registry/*.bdat 2>/dev/null || echo ""`; \ + for file in $$filelist; \ + do cat $$file >> builtin_list.h; \ + done; \ + ) endif builtin_proto.h: registry/.updated $(call DELFILE, builtin_proto.h) + $(Q) touch builtin_proto.h ifeq ($(CONFIG_WINDOWS_NATIVE),y) $(Q) for /f %%G in ('dir /b registry\*.pdat`) do ( type registry\%%G >> builtin_proto.h ) else - $(Q) for file in `ls registry/*.pdat`; do cat $$file >> builtin_proto.h; done + $(Q) ( \ + filelist=`ls registry/*.pdat 2>/dev/null || echo ""`; \ + for file in $$filelist; \ + do cat $$file >> builtin_proto.h; \ + done; \ + ) endif .built: builtin_list.h builtin_proto.h $(OBJS) diff --git a/apps/nshlib/nsh_mntcmds.c b/apps/nshlib/nsh_mntcmds.c index 690d027cae..f6eb26c31a 100644 --- a/apps/nshlib/nsh_mntcmds.c +++ b/apps/nshlib/nsh_mntcmds.c @@ -45,10 +45,13 @@ #include #include +#include #include #include #include +#include + #include "nsh.h" #include "nsh_console.h" diff --git a/apps/nshlib/nsh_netcmds.c b/apps/nshlib/nsh_netcmds.c index 371d304606..506950e14f 100644 --- a/apps/nshlib/nsh_netcmds.c +++ b/apps/nshlib/nsh_netcmds.c @@ -67,6 +67,7 @@ #if defined(CONFIG_NET_ICMP) && defined(CONFIG_NET_ICMP_PING) && \ !defined(CONFIG_DISABLE_CLOCK) && !defined(CONFIG_DISABLE_SIGNALS) # include +# include #endif #if defined(CONFIG_NET_UDP) && CONFIG_NFILE_DESCRIPTORS > 0 diff --git a/nuttx/configs/ekk-lm3s9b96/nsh/setenv.sh b/nuttx/configs/ekk-lm3s9b96/nsh/setenv.sh index 6e591e0dd7..bba7595de3 100755 --- a/nuttx/configs/ekk-lm3s9b96/nsh/setenv.sh +++ b/nuttx/configs/ekk-lm3s9b96/nsh/setenv.sh @@ -48,12 +48,16 @@ if [ -z "${PATH_ORIG}" ]; then export PATH_ORIG="${PATH}" fi -# TOOLCHAIN_BIN must be defined to the full path to the location where you -# have installed the toolchain of your choice. Modify the following: +# This is the Cygwin path to the location where I installed the CodeSourcery +# toolchain under windows. You will also have to edit this if you install +# the CodeSourcery toolchain in any other location +# export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/CodeSourcery/Sourcery G++ Lite/bin" +# This is the Cygwin path to the location where I build the buildroot +# toolchain. export TOOLCHAIN_BIN="${WD}/../misc/buildroot/build_arm_nofpu/staging_dir/bin" -# Andd add the toolchain path to the PATH variable - +# Add the path to the toolchain to the PATH varialble export PATH="${TOOLCHAIN_BIN}:/sbin:/usr/sbin:${PATH_ORIG}" + echo "PATH : ${PATH}" diff --git a/nuttx/configs/ekk-lm3s9b96/ostest/setenv.sh b/nuttx/configs/ekk-lm3s9b96/ostest/setenv.sh index d98c6cc40c..60dfa3c71d 100755 --- a/nuttx/configs/ekk-lm3s9b96/ostest/setenv.sh +++ b/nuttx/configs/ekk-lm3s9b96/ostest/setenv.sh @@ -48,12 +48,16 @@ if [ -z "${PATH_ORIG}" ]; then export PATH_ORIG="${PATH}" fi -# TOOLCHAIN_BIN must be defined to the full path to the location where you -# have installed the toolchain of your choice. Modify the following: +# This is the Cygwin path to the location where I installed the CodeSourcery +# toolchain under windows. You will also have to edit this if you install +# the CodeSourcery toolchain in any other location +# export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/CodeSourcery/Sourcery G++ Lite/bin" +# This is the Cygwin path to the location where I build the buildroot +# toolchain. export TOOLCHAIN_BIN="${WD}/../misc/buildroot/build_arm_nofpu/staging_dir/bin" -# Andd add the toolchain path to the PATH variable - +# Add the path to the toolchain to the PATH varialble export PATH="${TOOLCHAIN_BIN}:/sbin:/usr/sbin:${PATH_ORIG}" + echo "PATH : ${PATH}" diff --git a/nuttx/configs/lm3s8962-ek/nsh/appconfig b/nuttx/configs/lm3s8962-ek/nsh/appconfig index 5eeb566076..2e2421b675 100644 --- a/nuttx/configs/lm3s8962-ek/nsh/appconfig +++ b/nuttx/configs/lm3s8962-ek/nsh/appconfig @@ -40,7 +40,7 @@ CONFIGURED_APPS += examples/nsh # NSH library CONFIGURED_APPS += system/readline -CONFIGURED_APPS += nshlibO +CONFIGURED_APPS += nshlib # Networking support diff --git a/nuttx/configs/lm3s8962-ek/nsh/setenv.sh b/nuttx/configs/lm3s8962-ek/nsh/setenv.sh index 511552d94b..1db7f8ee26 100755 --- a/nuttx/configs/lm3s8962-ek/nsh/setenv.sh +++ b/nuttx/configs/lm3s8962-ek/nsh/setenv.sh @@ -32,15 +32,31 @@ # POSSIBILITY OF SUCH DAMAGE. # -if [ "$(basename $0)" = "setenv.sh" ] ; then +if [ "$_" = "$0" ] ; then echo "You must source this script, not run it!" 1>&2 exit 1 fi -if [ -z "${PATH_ORIG}" ]; then export PATH_ORIG="${PATH}"; fi - WD=`pwd` -export BUILDROOT_BIN="${WD}/../misc/buildroot/build_arm_nofpu/staging_dir/bin" -export PATH="${BUILDROOT_BIN}:/sbin:/usr/sbin:${PATH_ORIG}" +if [ ! -x "setenv.sh" ]; then + echo "This script must be executed from the top-level NuttX build directory" + exit 1 +fi + +if [ -z "${PATH_ORIG}" ]; then + export PATH_ORIG="${PATH}" +fi + +# This is the Cygwin path to the location where I installed the CodeSourcery +# toolchain under windows. You will also have to edit this if you install +# the CodeSourcery toolchain in any other location +# export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/CodeSourcery/Sourcery G++ Lite/bin" + +# This is the Cygwin path to the location where I build the buildroot +# toolchain. +export TOOLCHAIN_BIN="${WD}/../misc/buildroot/build_arm_nofpu/staging_dir/bin" + +# Add the path to the toolchain to the PATH varialble +export PATH="${TOOLCHAIN_BIN}:/sbin:/usr/sbin:${PATH_ORIG}" echo "PATH : ${PATH}" diff --git a/nuttx/configs/lm3s8962-ek/nx/setenv.sh b/nuttx/configs/lm3s8962-ek/nx/setenv.sh index a367250836..c716ddf5ef 100755 --- a/nuttx/configs/lm3s8962-ek/nx/setenv.sh +++ b/nuttx/configs/lm3s8962-ek/nx/setenv.sh @@ -32,15 +32,31 @@ # POSSIBILITY OF SUCH DAMAGE. # -if [ "$(basename $0)" = "setenv.sh" ] ; then +if [ "$_" = "$0" ] ; then echo "You must source this script, not run it!" 1>&2 exit 1 fi -if [ -z "${PATH_ORIG}" ]; then export PATH_ORIG="${PATH}"; fi - WD=`pwd` -export BUILDROOT_BIN="${WD}/../misc/buildroot/build_arm_nofpu/staging_dir/bin" -export PATH="${BUILDROOT_BIN}:/sbin:/usr/sbin:${PATH_ORIG}" +if [ ! -x "setenv.sh" ]; then + echo "This script must be executed from the top-level NuttX build directory" + exit 1 +fi + +if [ -z "${PATH_ORIG}" ]; then + export PATH_ORIG="${PATH}" +fi + +# This is the Cygwin path to the location where I installed the CodeSourcery +# toolchain under windows. You will also have to edit this if you install +# the CodeSourcery toolchain in any other location +# export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/CodeSourcery/Sourcery G++ Lite/bin" + +# This is the Cygwin path to the location where I build the buildroot +# toolchain. +export TOOLCHAIN_BIN="${WD}/../misc/buildroot/build_arm_nofpu/staging_dir/bin" + +# Add the path to the toolchain to the PATH varialble +export PATH="${TOOLCHAIN_BIN}:/sbin:/usr/sbin:${PATH_ORIG}" echo "PATH : ${PATH}" diff --git a/nuttx/configs/lm3s8962-ek/ostest/setenv.sh b/nuttx/configs/lm3s8962-ek/ostest/setenv.sh index 6bd49b6fa0..91bf1095b9 100755 --- a/nuttx/configs/lm3s8962-ek/ostest/setenv.sh +++ b/nuttx/configs/lm3s8962-ek/ostest/setenv.sh @@ -32,15 +32,31 @@ # POSSIBILITY OF SUCH DAMAGE. # -if [ "$(basename $0)" = "setenv.sh" ] ; then +if [ "$_" = "$0" ] ; then echo "You must source this script, not run it!" 1>&2 exit 1 fi -if [ -z "${PATH_ORIG}" ]; then export PATH_ORIG="${PATH}"; fi - WD=`pwd` -export BUILDROOT_BIN="${WD}/../misc/buildroot/build_arm_nofpu/staging_dir/bin" -export PATH="${BUILDROOT_BIN}:/sbin:/usr/sbin:${PATH_ORIG}" +if [ ! -x "setenv.sh" ]; then + echo "This script must be executed from the top-level NuttX build directory" + exit 1 +fi + +if [ -z "${PATH_ORIG}" ]; then + export PATH_ORIG="${PATH}" +fi + +# This is the Cygwin path to the location where I installed the CodeSourcery +# toolchain under windows. You will also have to edit this if you install +# the CodeSourcery toolchain in any other location +# export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/CodeSourcery/Sourcery G++ Lite/bin" + +# This is the Cygwin path to the location where I build the buildroot +# toolchain. +export TOOLCHAIN_BIN="${WD}/../misc/buildroot/build_arm_nofpu/staging_dir/bin" + +# Add the path to the toolchain to the PATH varialble +export PATH="${TOOLCHAIN_BIN}:/sbin:/usr/sbin:${PATH_ORIG}" echo "PATH : ${PATH}" diff --git a/nuttx/configs/stm3210e-eval/RIDE/defconfig b/nuttx/configs/stm3210e-eval/RIDE/defconfig index 64665f47e7..e71540c24c 100755 --- a/nuttx/configs/stm3210e-eval/RIDE/defconfig +++ b/nuttx/configs/stm3210e-eval/RIDE/defconfig @@ -169,7 +169,7 @@ CONFIG_RAW_BINARY=n # # General OS setup # -#CONFIG_USER_ENTRYPOINT= +CONFIG_USER_ENTRYPOINT="null_main" CONFIG_DEBUG=n CONFIG_DEBUG_VERBOSE=n CONFIG_DEBUG_SYMBOLS=n diff --git a/nuttx/drivers/usbdev/composite.c b/nuttx/drivers/usbdev/composite.c index 4cad8af864..530d644169 100644 --- a/nuttx/drivers/usbdev/composite.c +++ b/nuttx/drivers/usbdev/composite.c @@ -523,12 +523,12 @@ static int composite_setup(FAR struct usbdevclass_driver_s *driver, { /* Save the configuration and inform the constituent classes */ - ret = CLASS_SETUP(priv->dev1, dev, ctrl); + ret = CLASS_SETUP(priv->dev1, dev, ctrl, dataout, outlen); dispatched = true; if (ret >= 0) { - ret = CLASS_SETUP(priv->dev2, dev, ctrl); + ret = CLASS_SETUP(priv->dev2, dev, ctrl, dataout, outlen); if (ret >= 0) { priv->config = value; diff --git a/nuttx/include/nuttx/clock.h b/nuttx/include/nuttx/clock.h index 952e0e5efc..e640ecd2e5 100644 --- a/nuttx/include/nuttx/clock.h +++ b/nuttx/include/nuttx/clock.h @@ -113,7 +113,7 @@ #define USEC2TICK(usec) (((usec)+(USEC_PER_TICK/2))/USEC_PER_TICK) /* Rounds */ #define MSEC2TICK(msec) (((msec)+(MSEC_PER_TICK/2))/MSEC_PER_TICK) /* Rounds */ #define DSEC2TICK(dsec) MSEC2TICK((dsec)*MSEC_PER_DSEC) -#define SEC2TICK(sec) MSEC2TICK((sec)*MSEC_PER_SEC) +#define SEC2TICK(sec) MSEC2TICK((sec)*MSEC_PER_SEC) /* Exact */ #define TICK2NSEC(tick) ((tick)*NSEC_PER_TICK) /* Exact */ #define TICK2USEC(tick) ((tick)*USEC_PER_TICK) /* Exact */ diff --git a/nuttx/sched/sig_timedwait.c b/nuttx/sched/sig_timedwait.c index d03611610d..d7610cd491 100644 --- a/nuttx/sched/sig_timedwait.c +++ b/nuttx/sched/sig_timedwait.c @@ -38,6 +38,7 @@ ****************************************************************************/ #include +#include #include #include @@ -244,8 +245,8 @@ int sigtimedwait(FAR const sigset_t *set, FAR struct siginfo *info, */ #ifdef CONFIG_HAVE_LONG_LONG - uint64_t waitticks64 = (timeout->tv_sec * NSEC_PER_SEC + - timeout->tv_nsec + NSEC_PER_TICK - 1) / + uint64_t waitticks64 = ((uint64_t)timeout->tv_sec * NSEC_PER_SEC + + (uint64_t)timeout->tv_nsec + NSEC_PER_TICK - 1) / NSEC_PER_TICK; DEBUGASSERT(waitticks64 <= UINT32_MAX); waitticks = (uint32_t)waitticks64; From 6953365d30f06846a8f3877b73e01ee7d8321db0 Mon Sep 17 00:00:00 2001 From: patacongo Date: Mon, 24 Dec 2012 20:22:14 +0000 Subject: [PATCH 012/118] Fix several build issues noted by Mike Smith git-svn-id: http://svn.code.sf.net/p/nuttx/code/trunk@5459 42af7a65-404d-4744-a932-0658087f49c3 --- apps/ChangeLog.txt | 10 +++- apps/builtin/Makefile | 5 +- apps/examples/nettest/Makefile | 57 +++++++++++---------- nuttx/ChangeLog | 3 ++ nuttx/arch/arm/src/arm/up_head.S | 51 +++++++++++++----- nuttx/configs/ntosd-dm320/nettest/setenv.sh | 26 ++++++++-- nuttx/configs/ntosd-dm320/nsh/setenv.sh | 26 ++++++++-- nuttx/configs/ntosd-dm320/ostest/setenv.sh | 26 ++++++++-- nuttx/configs/ntosd-dm320/poll/setenv.sh | 26 ++++++++-- nuttx/configs/ntosd-dm320/thttpd/setenv.sh | 26 ++++++++-- nuttx/configs/ntosd-dm320/udp/setenv.sh | 26 ++++++++-- nuttx/configs/ntosd-dm320/uip/setenv.sh | 26 ++++++++-- 12 files changed, 228 insertions(+), 80 deletions(-) diff --git a/apps/ChangeLog.txt b/apps/ChangeLog.txt index 09a4f634d1..ea1b247f51 100644 --- a/apps/ChangeLog.txt +++ b/apps/ChangeLog.txt @@ -439,12 +439,18 @@ * Makefiles: Removed dependency of distclean on clean in most top-level files. It makes sense for 'leaf' Makefiles to have this dependency, but it does not make sense for upper-level Makefiles. - * namedapp/: Renamed to builtins in preparation for another change. + * apps/namedapp/: Renamed to builtins in preparation for another change. * .context: Removed the .context kludge. This caused lots of problems when changing configurations because there is no easy way to get the system to rebuild the context. Now, the context will be rebuilt whenever there is a change in either .config or the Makefile. - * builtin/registry: Updated new built-in registration logic to handle + * apps/builtin/registry: Updated new built-in registration logic to handle cases where (1) old apps/.config is used, and (2) applications ared removed, not just added. + * apps/examples/nettest/Makefile: Fix an error that crept in during + some of the recent, massive build system changes. + * apps/builtin/Makefile: Need to have auto-generated header files + in place early in the dependency generation phase to avoid warnings. + It is not important if they are only stubbed out header files at + this build phase. diff --git a/apps/builtin/Makefile b/apps/builtin/Makefile index 0efb832f87..ccb860c884 100644 --- a/apps/builtin/Makefile +++ b/apps/builtin/Makefile @@ -75,6 +75,9 @@ $(AOBJS): %$(OBJEXT): %.S $(COBJS): %$(OBJEXT): %.c $(call COMPILE, $<, $@) +registry/.updated: + $(V) $(MAKE) -C registry .updated TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)" + builtin_list.h: registry/.updated $(call DELFILE, builtin_list.h) $(Q) touch builtin_list.h @@ -110,7 +113,7 @@ endif context: $(Q) $(MAKE) -C registry context TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)" -.depend: Makefile $(SRCS) +.depend: Makefile $(SRCS) builtin_list.h builtin_proto.h $(Q) $(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep $(Q) touch $@ diff --git a/apps/examples/nettest/Makefile b/apps/examples/nettest/Makefile index a0308713c1..5368bdefc0 100644 --- a/apps/examples/nettest/Makefile +++ b/apps/examples/nettest/Makefile @@ -39,64 +39,64 @@ include $(APPDIR)/Make.defs # Basic TCP networking test -TARG_ASRCS = -TARG_AOBJS = $(TARG_ASRCS:.S=$(OBJEXT)) +TARG_ASRCS = +TARG_AOBJS = $(TARG_ASRCS:.S=$(OBJEXT)) -TARG_CSRCS = nettest.c +TARG_CSRCS = nettest.c ifeq ($(CONFIG_EXAMPLES_NETTEST_SERVER),y) -TARG_CSRCS += nettest_server.c +TARG_CSRCS += nettest_server.c else -TARG_CSRCS += nettest_client.c +TARG_CSRCS += nettest_client.c endif -TARG_COBJS = $(TARG_CSRCS:.c=$(OBJEXT)) +TARG_COBJS = $(TARG_CSRCS:.c=$(OBJEXT)) -TARG_SRCS = $(TARG_ASRCS) $(TARG_CSRCS) -TARG_OBJS = $(TARG_AOBJS) $(TARG_COBJS) +TARG_SRCS = $(TARG_ASRCS) $(TARG_CSRCS) +TARG_OBJS = $(TARG_AOBJS) $(TARG_COBJS) ifeq ($(CONFIG_WINDOWS_NATIVE),y) - TARG_BIN = ..\..\libapps$(LIBEXT) + TARG_BIN = ..\..\libapps$(LIBEXT) else ifeq ($(WINTOOL),y) - TARG_BIN = ..\\..\\libapps$(LIBEXT) + TARG_BIN = ..\\..\\libapps$(LIBEXT) else - TARG_BIN = ../../libapps$(LIBEXT) + TARG_BIN = ../../libapps$(LIBEXT) endif endif -HOSTCFLAGS += -DCONFIG_EXAMPLES_NETTEST_HOST=1 +HOSTCFLAGS += -DCONFIG_EXAMPLES_NETTEST_HOST=1 ifeq ($(CONFIG_EXAMPLES_NETTEST_SERVER),y) -HOSTCFLAGS += -DCONFIG_EXAMPLES_NETTEST_SERVER=1 \ - -DCONFIG_EXAMPLES_NETTEST_CLIENTIP="$(CONFIG_EXAMPLES_NETTEST_CLIENTIP)" +HOSTCFLAGS += -DCONFIG_EXAMPLES_NETTEST_SERVER=1 -DCONFIG_EXAMPLES_NETTEST_CLIENTIP="$(CONFIG_EXAMPLES_NETTEST_CLIENTIP)" endif ifeq ($(CONFIG_EXAMPLES_NETTEST_PERFORMANCE),y) -HOSTCFLAGS += -DCONFIG_EXAMPLES_NETTEST_PERFORMANCE=1 +HOSTCFLAGS += -DCONFIG_EXAMPLES_NETTEST_PERFORMANCE=1 endif -HOST_SRCS = host.c +HOST_SRCS = host.c ifeq ($(CONFIG_EXAMPLES_NETTEST_SERVER),y) -HOST_SRCS += nettest_client.c +HOST_SRCS += nettest_client.c else -HOST_SRCS += nettest_server.c +HOST_SRCS += nettest_server.c endif -HOST_OBJS = $(HOST_SRCS:.c=.o) -HOST_BIN = host +HOSTOBJEXT ?= .hobj +HOST_OBJS = $(HOST_SRCS:.c=$(HOSTOBJEXT)) +HOST_BIN = host -ROOTDEPPATH = --dep-path . +ROOTDEPPATH = --dep-path . # NET test built-in application info -APPNAME = nettest -PRIORITY = SCHED_PRIORITY_DEFAULT -STACKSIZE = 2048 +APPNAME = nettest +PRIORITY = SCHED_PRIORITY_DEFAULT +STACKSIZE = 2048 # Common build -VPATH = +VPATH = all: .built $(HOST_BIN) -.PHONY: clean depend distclean +.PHONY: clean depend distclean $(TARG_AOBJS): %$(OBJEXT): %.S $(call ASSEMBLE, $<, $@) @@ -104,7 +104,7 @@ $(TARG_AOBJS): %$(OBJEXT): %.S $(TARG_COBJS): %$(OBJEXT): %.c $(call COMPILE, $<, $@) -$(HOST_OBJS): %.o: %.c +$(HOST_OBJS): %$(HOSTOBJEXT): %.c @echo "CC: $<" @$(HOSTCC) -c $(HOSTCFLAGS) $< -o $@ @@ -113,7 +113,7 @@ $(HOST_BIN): $(HOST_OBJS) @$(HOSTCC) $(HOSTLDFLAGS) $(HOST_OBJS) -o $@ .built: $(TARG_OBJS) - $(call ARCHIVE, $(BIN), $(TARG_OBJS)) + $(call ARCHIVE, $(TARG_BIN), $(TARG_OBJS)) @touch .built ifeq ($(CONFIG_NSH_BUILTIN_APPS),y) @@ -132,6 +132,7 @@ endif depend: .depend clean: + $(call DELFILE, *$(HOSTOBJEXT)) $(call DELFILE, $(HOST_BIN)) $(call DELFILE, .built) $(call CLEAN) diff --git a/nuttx/ChangeLog b/nuttx/ChangeLog index 6c6fd7843c..c5cc9b54a8 100644 --- a/nuttx/ChangeLog +++ b/nuttx/ChangeLog @@ -3815,4 +3815,7 @@ * sched/sig_timedwait.c: Should always move the time up to the next largest number of system ticks. The logic was rounding. Noted by Petteri Aimonen. + * arch/arm/src/up_head.S: Fix backward conditional compilation. NOTE + there is a issue of ARM9 systems with low vectors and large memories + that will have to be addressed in the future. diff --git a/nuttx/arch/arm/src/arm/up_head.S b/nuttx/arch/arm/src/arm/up_head.S index 91d67fd15b..46efd87725 100644 --- a/nuttx/arch/arm/src/arm/up_head.S +++ b/nuttx/arch/arm/src/arm/up_head.S @@ -1,5 +1,5 @@ /**************************************************************************** - * arch/arm/src/arm/up_head.S + * arch/arm/src/arm/up_pghead.S * * Copyright (C) 2007, 2009-2010 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -78,6 +78,10 @@ * beginning of FLASH. */ +# if !defined(CONFIG_FLASH_START) || !defined(CONFIG_FLASH_VSTART) +# error "CONFIG_FLASH_START or CONFIG_FLASH_VSTART is not defined" +# endif + # if CONFIG_FLASH_START == CONFIG_FLASH_VSTART # define CONFIG_IDENTITY_TEXTMAP 1 # endif @@ -102,6 +106,10 @@ * beginning of FLASH. */ +# if !defined(CONFIG_FLASH_START) || !defined(CONFIG_FLASH_VSTART) +# error "CONFIG_FLASH_START or CONFIG_FLASH_VSTART is not defined" +# endif + # if CONFIG_FLASH_START == CONFIG_FLASH_VSTART # define CONFIG_IDENTITY_TEXTMAP 1 # endif @@ -120,6 +128,10 @@ * beginning of RAM. */ +# if !defined(CONFIG_DRAM_START) || !defined(CONFIG_DRAM_VSTART) +# error "CONFIG_DRAM_START or CONFIG_DRAM_VSTART is not defined" +# endif + # if CONFIG_DRAM_START == CONFIG_DRAM_VSTART # define CONFIG_IDENTITY_TEXTMAP 1 # endif @@ -162,26 +174,37 @@ * Assembly Macros ****************************************************************************/ -/* The ARM9 L1 page table can be placed at the beginning or at the end of the - * RAM space. This decision is based on the placement of the vector area: - * If the vectors are place in low memory at address 0x0000 0000, then the - * page table is placed in high memory; if the vectors are placed in high - * memory at address 0xfff0 0000, then the page table is locating at the - * beginning of RAM. +/* The ARM9 L1 page table can be placed at the beginning or at the end of + * the RAM space. This decision is based on the placement of the vector + * area: If the vectors are place in low memory at address 0x0000 0000, then + * the page table is placed in high memory; if the vectors are placed in + * high memory at address 0xfff0 0000, then the page table is locating at + * the beginning of RAM. * - * For the special case where (1) the program executes out of RAM, and (2) the - * page is located at the beginning of RAM, then the following macro can - * easily find the physical address of the section that includes the first - * part of the text region: Since the page table is closely related to the - * NuttX base address in this case, we can convert the page table base address - * to the base address of the section containing both. + * For the special case where (1) the program executes out of RAM, and (2) + * the page is located at the beginning of RAM (i.e., the high vector case), + * then the following macro can easily find the physical address of the + * section that includes the first part of the text region: Since the page + * table is closely related to the NuttX base address in this case, we can + * convert the page table base address to the base address of the section + * containing both. + */ + +/* REVISIT: This works now of the low vector case only because the RAM + * sizes that we have been dealing with are less then 1MB so that both the + * page table and the vector table are in the same 1MB RAM block. But + * this will certainly break later. Hence, the annoying warning. */ #ifdef CONFIG_ARCH_LOWVECTORS +# warning "REVISIT" +#endif + +//#ifndef CONFIG_ARCH_LOWVECTORS .macro mksection, section, pgtable bic \section, \pgtable, #0x000ff000 .endm -#endif +//#endif /* This macro will modify r0, r1, r2 and r14 */ diff --git a/nuttx/configs/ntosd-dm320/nettest/setenv.sh b/nuttx/configs/ntosd-dm320/nettest/setenv.sh index 6090d4cea3..cfb438ce72 100755 --- a/nuttx/configs/ntosd-dm320/nettest/setenv.sh +++ b/nuttx/configs/ntosd-dm320/nettest/setenv.sh @@ -32,15 +32,31 @@ # POSSIBILITY OF SUCH DAMAGE. # -if [ "$(basename $0)" = "setenv.sh" ] ; then +if [ "$_" = "$0" ] ; then echo "You must source this script, not run it!" 1>&2 exit 1 fi -if [ -z ${PATH_ORIG} ]; then export PATH_ORIG=${PATH}; fi - WD=`pwd` -export BUILDROOT_BIN=${WD}/../misc/buildroot/build_arm_nofpu/staging_dir/bin -export PATH=${BUILDROOT_BIN}:/sbin:/usr/sbin:${PATH_ORIG} +if [ ! -x "setenv.sh" ]; then + echo "This script must be executed from the top-level NuttX build directory" + exit 1 +fi + +if [ -z "${PATH_ORIG}" ]; then + export PATH_ORIG="${PATH}" +fi + +# This is the Cygwin path to the location where I installed the CodeSourcery +# toolchain under windows. You will also have to edit this if you install +# the CodeSourcery toolchain in any other location +# export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/CodeSourcery/Sourcery G++ Lite/bin" + +# This is the Cygwin path to the location where I build the buildroot +# toolchain. +export TOOLCHAIN_BIN="${WD}/../misc/buildroot/build_arm_nofpu/staging_dir/bin" + +# Add the path to the toolchain to the PATH varialble +export PATH="${TOOLCHAIN_BIN}:/sbin:/usr/sbin:${PATH_ORIG}" echo "PATH : ${PATH}" diff --git a/nuttx/configs/ntosd-dm320/nsh/setenv.sh b/nuttx/configs/ntosd-dm320/nsh/setenv.sh index a84e68884b..005aa81530 100755 --- a/nuttx/configs/ntosd-dm320/nsh/setenv.sh +++ b/nuttx/configs/ntosd-dm320/nsh/setenv.sh @@ -32,15 +32,31 @@ # POSSIBILITY OF SUCH DAMAGE. # -if [ "$(basename $0)" = "setenv.sh" ] ; then +if [ "$_" = "$0" ] ; then echo "You must source this script, not run it!" 1>&2 exit 1 fi -if [ -z ${PATH_ORIG} ]; then export PATH_ORIG=${PATH}; fi - WD=`pwd` -export BUILDROOT_BIN=${WD}/../misc/buildroot/build_arm_nofpu/staging_dir/bin -export PATH=${BUILDROOT_BIN}:/sbin:/usr/sbin:${PATH_ORIG} +if [ ! -x "setenv.sh" ]; then + echo "This script must be executed from the top-level NuttX build directory" + exit 1 +fi + +if [ -z "${PATH_ORIG}" ]; then + export PATH_ORIG="${PATH}" +fi + +# This is the Cygwin path to the location where I installed the CodeSourcery +# toolchain under windows. You will also have to edit this if you install +# the CodeSourcery toolchain in any other location +# export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/CodeSourcery/Sourcery G++ Lite/bin" + +# This is the Cygwin path to the location where I build the buildroot +# toolchain. +export TOOLCHAIN_BIN="${WD}/../misc/buildroot/build_arm_nofpu/staging_dir/bin" + +# Add the path to the toolchain to the PATH varialble +export PATH="${TOOLCHAIN_BIN}:/sbin:/usr/sbin:${PATH_ORIG}" echo "PATH : ${PATH}" diff --git a/nuttx/configs/ntosd-dm320/ostest/setenv.sh b/nuttx/configs/ntosd-dm320/ostest/setenv.sh index a65be2677d..75d6f0cd0d 100755 --- a/nuttx/configs/ntosd-dm320/ostest/setenv.sh +++ b/nuttx/configs/ntosd-dm320/ostest/setenv.sh @@ -32,15 +32,31 @@ # POSSIBILITY OF SUCH DAMAGE. # -if [ "$(basename $0)" = "setenv.sh" ] ; then +if [ "$_" = "$0" ] ; then echo "You must source this script, not run it!" 1>&2 exit 1 fi -if [ -z ${PATH_ORIG} ]; then export PATH_ORIG=${PATH}; fi - WD=`pwd` -export BUILDROOT_BIN=${WD}/../misc/buildroot/build_arm_nofpu/staging_dir/bin -export PATH=${BUILDROOT_BIN}:/sbin:/usr/sbin:${PATH_ORIG} +if [ ! -x "setenv.sh" ]; then + echo "This script must be executed from the top-level NuttX build directory" + exit 1 +fi + +if [ -z "${PATH_ORIG}" ]; then + export PATH_ORIG="${PATH}" +fi + +# This is the Cygwin path to the location where I installed the CodeSourcery +# toolchain under windows. You will also have to edit this if you install +# the CodeSourcery toolchain in any other location +# export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/CodeSourcery/Sourcery G++ Lite/bin" + +# This is the Cygwin path to the location where I build the buildroot +# toolchain. +export TOOLCHAIN_BIN="${WD}/../misc/buildroot/build_arm_nofpu/staging_dir/bin" + +# Add the path to the toolchain to the PATH varialble +export PATH="${TOOLCHAIN_BIN}:/sbin:/usr/sbin:${PATH_ORIG}" echo "PATH : ${PATH}" diff --git a/nuttx/configs/ntosd-dm320/poll/setenv.sh b/nuttx/configs/ntosd-dm320/poll/setenv.sh index de3b64ea90..427ffe26ab 100755 --- a/nuttx/configs/ntosd-dm320/poll/setenv.sh +++ b/nuttx/configs/ntosd-dm320/poll/setenv.sh @@ -32,15 +32,31 @@ # POSSIBILITY OF SUCH DAMAGE. # -if [ "$(basename $0)" = "setenv.sh" ] ; then +if [ "$_" = "$0" ] ; then echo "You must source this script, not run it!" 1>&2 exit 1 fi -if [ -z ${PATH_ORIG} ]; then export PATH_ORIG=${PATH}; fi - WD=`pwd` -export BUILDROOT_BIN=${WD}/../misc/buildroot/build_arm_nofpu/staging_dir/bin -export PATH=${BUILDROOT_BIN}:/sbin:/usr/sbin:${PATH_ORIG} +if [ ! -x "setenv.sh" ]; then + echo "This script must be executed from the top-level NuttX build directory" + exit 1 +fi + +if [ -z "${PATH_ORIG}" ]; then + export PATH_ORIG="${PATH}" +fi + +# This is the Cygwin path to the location where I installed the CodeSourcery +# toolchain under windows. You will also have to edit this if you install +# the CodeSourcery toolchain in any other location +# export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/CodeSourcery/Sourcery G++ Lite/bin" + +# This is the Cygwin path to the location where I build the buildroot +# toolchain. +export TOOLCHAIN_BIN="${WD}/../misc/buildroot/build_arm_nofpu/staging_dir/bin" + +# Add the path to the toolchain to the PATH varialble +export PATH="${TOOLCHAIN_BIN}:/sbin:/usr/sbin:${PATH_ORIG}" echo "PATH : ${PATH}" diff --git a/nuttx/configs/ntosd-dm320/thttpd/setenv.sh b/nuttx/configs/ntosd-dm320/thttpd/setenv.sh index 92ff91700e..ea38c09a51 100755 --- a/nuttx/configs/ntosd-dm320/thttpd/setenv.sh +++ b/nuttx/configs/ntosd-dm320/thttpd/setenv.sh @@ -32,15 +32,31 @@ # POSSIBILITY OF SUCH DAMAGE. # -if [ "$(basename $0)" = "setenv.sh" ] ; then +if [ "$_" = "$0" ] ; then echo "You must source this script, not run it!" 1>&2 exit 1 fi -if [ -z ${PATH_ORIG} ]; then export PATH_ORIG=${PATH}; fi - WD=`pwd` -export BUILDROOT_BIN=${WD}/../misc/buildroot/build_arm_nofpu/staging_dir/bin -export PATH=${BUILDROOT_BIN}:/sbin:/usr/sbin:${PATH_ORIG} +if [ ! -x "setenv.sh" ]; then + echo "This script must be executed from the top-level NuttX build directory" + exit 1 +fi + +if [ -z "${PATH_ORIG}" ]; then + export PATH_ORIG="${PATH}" +fi + +# This is the Cygwin path to the location where I installed the CodeSourcery +# toolchain under windows. You will also have to edit this if you install +# the CodeSourcery toolchain in any other location +# export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/CodeSourcery/Sourcery G++ Lite/bin" + +# This is the Cygwin path to the location where I build the buildroot +# toolchain. +export TOOLCHAIN_BIN="${WD}/../misc/buildroot/build_arm_nofpu/staging_dir/bin" + +# Add the path to the toolchain to the PATH varialble +export PATH="${TOOLCHAIN_BIN}:/sbin:/usr/sbin:${PATH_ORIG}" echo "PATH : ${PATH}" diff --git a/nuttx/configs/ntosd-dm320/udp/setenv.sh b/nuttx/configs/ntosd-dm320/udp/setenv.sh index 052413b089..92995bee56 100755 --- a/nuttx/configs/ntosd-dm320/udp/setenv.sh +++ b/nuttx/configs/ntosd-dm320/udp/setenv.sh @@ -32,15 +32,31 @@ # POSSIBILITY OF SUCH DAMAGE. # -if [ "$(basename $0)" = "setenv.sh" ] ; then +if [ "$_" = "$0" ] ; then echo "You must source this script, not run it!" 1>&2 exit 1 fi -if [ -z ${PATH_ORIG} ]; then export PATH_ORIG=${PATH}; fi - WD=`pwd` -export BUILDROOT_BIN=${WD}/../misc/buildroot/build_arm_nofpu/staging_dir/bin -export PATH=${BUILDROOT_BIN}:/sbin:/usr/sbin:${PATH_ORIG} +if [ ! -x "setenv.sh" ]; then + echo "This script must be executed from the top-level NuttX build directory" + exit 1 +fi + +if [ -z "${PATH_ORIG}" ]; then + export PATH_ORIG="${PATH}" +fi + +# This is the Cygwin path to the location where I installed the CodeSourcery +# toolchain under windows. You will also have to edit this if you install +# the CodeSourcery toolchain in any other location +# export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/CodeSourcery/Sourcery G++ Lite/bin" + +# This is the Cygwin path to the location where I build the buildroot +# toolchain. +export TOOLCHAIN_BIN="${WD}/../misc/buildroot/build_arm_nofpu/staging_dir/bin" + +# Add the path to the toolchain to the PATH varialble +export PATH="${TOOLCHAIN_BIN}:/sbin:/usr/sbin:${PATH_ORIG}" echo "PATH : ${PATH}" diff --git a/nuttx/configs/ntosd-dm320/uip/setenv.sh b/nuttx/configs/ntosd-dm320/uip/setenv.sh index 988e0a1269..33c252e1ec 100755 --- a/nuttx/configs/ntosd-dm320/uip/setenv.sh +++ b/nuttx/configs/ntosd-dm320/uip/setenv.sh @@ -32,15 +32,31 @@ # POSSIBILITY OF SUCH DAMAGE. # -if [ "$(basename $0)" = "setenv.sh" ] ; then +if [ "$_" = "$0" ] ; then echo "You must source this script, not run it!" 1>&2 exit 1 fi -if [ -z ${PATH_ORIG} ]; then export PATH_ORIG=${PATH}; fi - WD=`pwd` -export BUILDROOT_BIN=${WD}/../misc/buildroot/build_arm_nofpu/staging_dir/bin -export PATH=${BUILDROOT_BIN}:/sbin:/usr/sbin:${PATH_ORIG} +if [ ! -x "setenv.sh" ]; then + echo "This script must be executed from the top-level NuttX build directory" + exit 1 +fi + +if [ -z "${PATH_ORIG}" ]; then + export PATH_ORIG="${PATH}" +fi + +# This is the Cygwin path to the location where I installed the CodeSourcery +# toolchain under windows. You will also have to edit this if you install +# the CodeSourcery toolchain in any other location +# export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/CodeSourcery/Sourcery G++ Lite/bin" + +# This is the Cygwin path to the location where I build the buildroot +# toolchain. +export TOOLCHAIN_BIN="${WD}/../misc/buildroot/build_arm_nofpu/staging_dir/bin" + +# Add the path to the toolchain to the PATH varialble +export PATH="${TOOLCHAIN_BIN}:/sbin:/usr/sbin:${PATH_ORIG}" echo "PATH : ${PATH}" From 292d4db37a4080585577c43434157db335cd5158 Mon Sep 17 00:00:00 2001 From: patacongo Date: Tue, 25 Dec 2012 17:22:58 +0000 Subject: [PATCH 013/118] Add logic to serialize and marshal out-of-band keyboard commands git-svn-id: http://svn.code.sf.net/p/nuttx/code/trunk@5460 42af7a65-404d-4744-a932-0658087f49c3 --- apps/Make.defs | 4 +- apps/builtin/Makefile | 6 +- nuttx/ChangeLog | 4 +- nuttx/include/nuttx/input/kbd_codec.h | 292 ++++++++++++++++++++++++++ nuttx/include/nuttx/usb/hid.h | 2 +- nuttx/libc/misc/Make.defs | 2 +- nuttx/libc/misc/lib_kbddecode.c | 258 +++++++++++++++++++++++ nuttx/libc/misc/lib_kbdencode.c | 81 +++++++ 8 files changed, 641 insertions(+), 8 deletions(-) create mode 100644 nuttx/include/nuttx/input/kbd_codec.h create mode 100644 nuttx/libc/misc/lib_kbddecode.c create mode 100644 nuttx/libc/misc/lib_kbdencode.c diff --git a/apps/Make.defs b/apps/Make.defs index c62999804c..f7e6aa08da 100644 --- a/apps/Make.defs +++ b/apps/Make.defs @@ -37,9 +37,9 @@ BUILTIN_REGISTRY = $(APPDIR)$(DELIM)builtin$(DELIM)registry ifeq ($(CONFIG_NUTTX_NEWCONFIG),y) -DEPCONFIG = $(TOPDIR)/.config +DEPCONFIG = $(TOPDIR)$(DELIM).config else -DEPCONFIG = $(TOPDIR)/.config $(APPDIR)/.config +DEPCONFIG = $(TOPDIR)$(DELIM).config $(APPDIR)$(DELIM).config endif define REGISTER diff --git a/apps/builtin/Makefile b/apps/builtin/Makefile index ccb860c884..8c89288864 100644 --- a/apps/builtin/Makefile +++ b/apps/builtin/Makefile @@ -75,10 +75,10 @@ $(AOBJS): %$(OBJEXT): %.S $(COBJS): %$(OBJEXT): %.c $(call COMPILE, $<, $@) -registry/.updated: +registry$(DELIM).updated: $(V) $(MAKE) -C registry .updated TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)" -builtin_list.h: registry/.updated +builtin_list.h: registry$(DELIM).updated $(call DELFILE, builtin_list.h) $(Q) touch builtin_list.h ifeq ($(CONFIG_WINDOWS_NATIVE),y) @@ -92,7 +92,7 @@ else ) endif -builtin_proto.h: registry/.updated +builtin_proto.h: registry$(DELIM).updated $(call DELFILE, builtin_proto.h) $(Q) touch builtin_proto.h ifeq ($(CONFIG_WINDOWS_NATIVE),y) diff --git a/nuttx/ChangeLog b/nuttx/ChangeLog index c5cc9b54a8..80ddb56c6b 100644 --- a/nuttx/ChangeLog +++ b/nuttx/ChangeLog @@ -3818,4 +3818,6 @@ * arch/arm/src/up_head.S: Fix backward conditional compilation. NOTE there is a issue of ARM9 systems with low vectors and large memories that will have to be addressed in the future. - + * libc/misc/lib_kbdencode.c and lib_kbddecode.c: Add logic to marshal + and serialized "out-of-band" keyboard commands intermixed with normal + ASCII data (not yet hooked into anything). diff --git a/nuttx/include/nuttx/input/kbd_codec.h b/nuttx/include/nuttx/input/kbd_codec.h new file mode 100644 index 0000000000..b103d544ec --- /dev/null +++ b/nuttx/include/nuttx/input/kbd_codec.h @@ -0,0 +1,292 @@ +/************************************************************************************ + * include/nuttx/input/kbd_codec.h + * Serialize and marshaling out-of-band keyboard data + * + * Copyright (C) 2012 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * 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. + * + ************************************************************************************/ + +#ifndef __INCLUDE_NUTTX_INPUT_KBD_CODEC_H +#define __INCLUDE_NUTTX_INPUT_KBD_CODEC_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include +#include + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +/**************************************************************************** + * Public Types + ****************************************************************************/ + +/* These are the special, "out-of-band" keyboard commands recognized by the + * CODEC. + */ + +enum kbd_keycode_e +{ + KEYCODE_NORMAL = 0, /* Not a special keycode */ + + /* Delete and Backspace keycodes (in case they may be different than the + * ASCII BKSP and DEL values. + */ + + KEYCODE_FWDDEL, /* DELete (forward delete) */ + KEYCODE_BACKDEL, /* Backspace (backward delete) */ + + /* Cursor movement */ + + KEYCODE_HOME, /* Home */ + KEYCODE_END, /* End */ + KEYCODE_LEFT, /* Left arrow */ + KEYCODE_RIGHT, /* Right arrow */ + KEYCODE_UP, /* Up arrow */ + KEYCODE_DOWN, /* Down arrow */ + KEYCODE_PAGEUP, /* Page up */ + KEYCODE_PAGEDOWN, /* Page down */ + + /* Edit commands */ + + KEYCODE_INSERT, /* Insert */ + KEYCODE_AGAIN, /* Again */ + KEYCODE_UNDO, /* Undo */ + KEYCODE_REDO, /* Redo */ + KEYCODE_CUT, /* Cut */ + KEYCODE_COPY, /* Copy */ + KEYCODE_PASTE, /* Paste */ + KEYCODE_FIND , /* Find */ + + /* Selection codes */ + + KEYCODE_ENTER, /* Enter */ + KEYCODE_SELECT, /* Select */ + KEYCODE_EXECUTE, /* Execute */ + + /* Keyboard modes */ + + KEYCODE_CAPSLOCK, /* Caps Lock */ + KEYCODE_SCROLLLOCK, /* Scroll Lock */ + KEYCODE_NUMLOCK, /* Keypad Num Lock and Clear */ + KEYCODE_LCAPSLOCK, /* Locking Caps Lock */ + KEYCODE_LNUMLOCK, /* Locking Num Lock */ + KEYCODE_LSCROLLLOCK, /* Locking Scroll Lock */ + + /* Misc control codes */ + + KEYCODE_POWER, /* Power */ + KEYCODE_HELP, /* Help */ + KEYCODE_MENU, /* Menu */ + KEYCODE_STOP, /* Stop */ + KEYCODE_PAUSE, /* Pause */ + KEYCODE_BREAK, /* Break */ + KEYCODE_CANCEL, /* Cancel */ + KEYCODE_PRINTSCN, /* PrintScreen */ + KEYCODE_SYSREQ, /* SysReq/Attention */ + + /* Audio */ + + KEYCODE_MUTE, /* Mute */ + KEYCODE_VOLUP, /* Volume Up */ + KEYCODE_VOLDOWN, /* Volume Down */ + + /* Telephone */ + + KEYCODE_ANSWER, /* Answer (phone) */ + KEYCODE_HANGUP, /* Hang-up (phone) */ + + /* Calculator */ + + KEYCODE_CLEAR, /* Clear */ + KEYCODE_CLEARENTRY, /* Clear entry */ + + KEYCODE_MEMSET, /* Memory set */ + KEYCODE_MEMCLEAR, /* Memory clear */ + KEYCODE_MEMRECALL, /* Memory recall */ + KEYCODE_MEMADD, /* Memory add */ + KEYCODE_MEMSUBTRACT, /* Memory substract */ + KEYCODE_MEMMULTIPY, /* Memory multiply */ + KEYCODE_MEMDIVIDE, /* Memory divide */ + + KEYCODE_BINARY, /* Binary mode */ + KEYCODE_OCTAL, /* Octal mode */ + KEYCODE_DECIMAL, /* Decimal mode */ + KEYCODE_HEXADECIMAL, /* Hexadecimal mode */ + + /* Languages */ + + KEYCODE_LANG1, /* LANG1 */ + KEYCODE_LANG2, /* LANG2 */ + KEYCODE_LANG3, /* LANG3 */ + KEYCODE_LANG4, /* LANG4 */ + KEYCODE_LANG5, /* LANG5 */ + KEYCODE_LANG6, /* LANG6 */ + KEYCODE_LANG7, /* LANG7 */ + KEYCODE_LANG8, /* LANG8 */ + + /* Context-specific function keys */ + + KEYCODE_F1, /* Function key 1 */ + KEYCODE_F2, /* Function key 2 */ + KEYCODE_F3, /* Function key 3 */ + KEYCODE_F4, /* Function key 4 */ + KEYCODE_F5, /* Function key 5 */ + KEYCODE_F6, /* Function key 6 */ + KEYCODE_F7, /* Function key 7 */ + KEYCODE_F8, /* Function key 8 */ + KEYCODE_F9, /* Function key 9 */ + KEYCODE_F10, /* Function key 10 */ + KEYCODE_F11, /* Function key 11 */ + KEYCODE_F12, /* Function key 12 */ + KEYCODE_F13, /* Function key 13 */ + KEYCODE_F14, /* Function key 14 */ + KEYCODE_F15, /* Function key 15 */ + KEYCODE_F16, /* Function key 16 */ + KEYCODE_F17, /* Function key 17 */ + KEYCODE_F18, /* Function key 18 */ + KEYCODE_F19, /* Function key 19 */ + KEYCODE_F20, /* Function key 20 */ + KEYCODE_F21, /* Function key 21 */ + KEYCODE_F22, /* Function key 22 */ + KEYCODE_F23, /* Function key 23 */ + KEYCODE_F24 /* Function key 24 */ +}; + +#define FIRST_KEYCODE KEYCODE_FWDDEL +#define LAST_KEYCODE KEYCODE_F24 + +/* kbd_get return values */ + +#define KBD_NORMAL 0 +#define KBD_SPECIAL 1 +#define KBD_ERROR EOF + +/**************************************************************************** + * Public Types + ****************************************************************************/ + +struct kget_getstate_s +{ + uint8_t nch; /* Number of characters in the buffer */ + uint8_t ndx; /* Index to next character in the buffer */ + uint8_t buf[4]; /* Buffer of ungotten data */ +}; + +/**************************************************************************** + * Public Function Prototypes + ****************************************************************************/ + +#ifdef __cplusplus +extern "C" +{ +#endif + +/**************************************************************************** + * The following functions are intended for use by "producer", keyboard + * or keypad drivers to encode information into driver buffers. + ****************************************************************************/ + +/**************************************************************************** + * Name: kbd_puttext + * + * Description: + * Put one byte of normal, "in-band" ASCII data into the output stream. + * + * Input Parameters: + * ch - The character to be into the output stream. + * stream - An instance of lib_outstream_s to do the low-level put + * operation. + * + * Returned Value: + * None + * + ****************************************************************************/ + +#define kbd_puttext(ch, stream) (stream)->put((stream), (int)(ch)) + +/**************************************************************************** + * Name: kbd_putspecial + * + * Description: + * Put one special, "out-of-band" command into the output stream. + * + * Input Parameters: + * + * Returned Value: + * None + * + ****************************************************************************/ + +void kbd_putspecial(enum kbd_keycode_e keycode, + FAR struct lib_outstream_s *stream); + +/**************************************************************************** + * The following functions are intended for use by "consumer" applications + * to remove and decode information from the driver provided buffer. + ****************************************************************************/ + +/**************************************************************************** + * Name: kbd_get + * + * Description: + * Put one byte of data or special command from the driver provided input + * buffer. + * + * Input Parameters: + * stream - An instance of lib_instream_s to do the low-level get + * operation. + * pch - The location character to save the returned value. This may be + * either a normal, "in-band" ASCII characer or a special, "out-of-band" + * command. + * state - A user provided buffer to support parsing. This structure + * should be cleared the first time that kbd_get is called. + * + * Returned Value: + * 1 - Indicates the successful receipt of a special, "out-of-band" command + * 0 - Indicates the successful receipt of normal, "in-band" ASCII data. + * EOF - An error has getting the next character (reported by the stream). + * Normally indicates the end of file. + * + ****************************************************************************/ + +int kbd_get(FAR struct lib_instream_s *stream, + FAR struct kget_getstate_s *state, FAR uint8_t *pch); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCLUDE_NUTTX_INPUT_KBD_CODEC_H */ + diff --git a/nuttx/include/nuttx/usb/hid.h b/nuttx/include/nuttx/usb/hid.h index 5b83f08fc8..877203a9c2 100644 --- a/nuttx/include/nuttx/usb/hid.h +++ b/nuttx/include/nuttx/usb/hid.h @@ -619,7 +619,7 @@ #define USBHID_KBDUSE_RCTRL 0xe4 /* Keyboard RightControl */ #define USBHID_KBDUSE_RSHIFT 0xe5 /* Keyboard RightShift */ #define USBHID_KBDUSE_RALT 0xe6 /* Keyboard RightAlt */ -#define USBHID_KBDUSE_RGUI 0xe7 /* Keyboard Right GUI*/ +#define USBHID_KBDUSE_RGUI 0xe7 /* Keyboard Right GUI */ #define USBHID_KBDUSE_MAX 0xe7 diff --git a/nuttx/libc/misc/Make.defs b/nuttx/libc/misc/Make.defs index f4284ac60c..c6af5f8604 100644 --- a/nuttx/libc/misc/Make.defs +++ b/nuttx/libc/misc/Make.defs @@ -35,7 +35,7 @@ # Add the internal C files to the build -CSRCS += lib_init.c lib_filesem.c +CSRCS += lib_init.c lib_filesem.c lib_kbdencode.c lib_kbddecode.c # Add C files that depend on file OR socket descriptors diff --git a/nuttx/libc/misc/lib_kbddecode.c b/nuttx/libc/misc/lib_kbddecode.c new file mode 100644 index 0000000000..046d570f90 --- /dev/null +++ b/nuttx/libc/misc/lib_kbddecode.c @@ -0,0 +1,258 @@ +/******************************************************************************************** + * libc/msic/lib_kbddecode.c + * Decoding side of the Keyboard CODEC + * + * Copyright (C) 2012 Gregory Nutt. All rights reserved. + * Authors: Gregory Nutt + * + * 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. + * + ********************************************************************************************/ + +/******************************************************************************************** + * Included Files + ********************************************************************************************/ + +#include + +#include +#include + +#include +#include +#include + +/******************************************************************************************** + * Pre-Processor Definitions + ********************************************************************************************/ + +#define NDX_ESC 0 +#define NDX_BRACKET 1 +#define NDX_CODE 2 +#define NCX_SEMICOLON 3 + +#define NCH_ESC 1 +#define NCH_BRACKET 2 +#define NCH_CODE 3 +#define NCH_SEMICOLON 4 + +/******************************************************************************************** + * Private Functions + ********************************************************************************************/ + +/**************************************************************************** + * Name: kbd_reget + * + * Description: + * We have unused characters from the last, unsuccessful. Return one of + * these instead of the . + * + * Input Parameters: + * stream - An instance of lib_instream_s to do the low-level get + * operation. + * pch - The location character to save the returned value. This may be + * either a normal, "in-band" ASCII characer or a special, "out-of-band" + * command. + * state - A user provided buffer to support parsing. This structure + * should be cleared the first time that kbd_get is called. + * + * Returned Value: + * 2 - Indicates the successful receipt of a special, "out-of-band" command + * 1 - Indicates the successful receipt of normal, "in-band" ASCII data. + * 0 - Indicates end-of-file or that the stream has been closed + * EOF - An error has getting the next character (reported by the stream). + * + ****************************************************************************/ + +static int kbd_reget(FAR struct kget_getstate_s *state, FAR uint8_t *pch) +{ + /* Return the next character */ + + *pch = state->buf[state->ndx]; + state->ndx++; + state->nch--; + return KBD_NORMAL; +} + +/******************************************************************************************** + * Public Functions + ********************************************************************************************/ + +/**************************************************************************** + * Name: kbd_get + * + * Description: + * Put one byte of data or special command from the driver provided input + * buffer. + * + * Input Parameters: + * stream - An instance of lib_instream_s to do the low-level get + * operation. + * pch - The location character to save the returned value. This may be + * either a normal, "in-band" ASCII characer or a special, "out-of-band" + * command. + * state - A user provided buffer to support parsing. This structure + * should be cleared the first time that kbd_get is called. + * + * Returned Value: + * 1 - Indicates the successful receipt of a special, "out-of-band" command + * 0 - Indicates the successful receipt of normal, "in-band" ASCII data. + * EOF - An error has getting the next character (reported by the stream). + * Normally indicates the end of file. + * + ****************************************************************************/ + +int kbd_get(FAR struct lib_instream_s *stream, + FAR struct kget_getstate_s *state, FAR uint8_t *pch) +{ + int ch; + + DEBUGASSERT(stream && state && pch); + + /* Are their ungotten characters from the last, failed parse? */ + + if (state->nch > 0) + { + /* Yes, return the next ungotten character */ + + return kbd_reget(state, pch); + } + + state->ndx = 0; + + /* No, ungotten characters. Check for the beginning of an esc sequence. */ + + ch = stream->get(stream); + if (ch == EOF) + { + /* End of file/stream */ + + return KBD_ERROR; + } + else + { + state->buf[NDX_ESC] = (uint8_t)ch; + state->nch = NCH_ESC; + + if (ch != ASCII_ESC) + { + /* Not the beginning of an escape sequence. Return the character. */ + + return kbd_reget(state, pch); + } + } + + /* Check for ESC-[ */ + + ch = stream->get(stream); + if (ch == EOF) + { + /* End of file/stream. Return the escape character now. We will + * return the EOF indication next time. + */ + + return kbd_reget(state, pch); + } + else + { + state->buf[NDX_BRACKET] = ch; + state->nch = NCH_BRACKET; + + if (ch != '[') + { + /* Not the beginning of an escape sequence. Return the ESC now, + * return the following character later. + */ + + return kbd_reget(state, pch); + } + } + + /* Get and verify the special, "out-of-band" command code */ + + ch = stream->get(stream); + if (ch == EOF) + { + /* End of file/stream. Unget everything and return the ESC character. + */ + + return kbd_reget(state, pch); + } + else + { + state->buf[NDX_CODE] = (uint8_t)ch; + state->nch = NCH_CODE; + + /* Check for a valid special command code */ + + if (ch < FIRST_KEYCODE || ch > LAST_KEYCODE) + { + /* Not a special command code, return the ESC now and the next two + * characters later. + */ + + return kbd_reget(state, pch); + } + } + + /* Check for the final semicolon */ + + ch = stream->get(stream); + if (ch == EOF) + { + /* End of file/stream. Unget everything and return the ESC character. + */ + + return kbd_reget(state, pch); + } + else + { + state->buf[NCX_SEMICOLON] = (uint8_t)ch; + state->nch = NCH_SEMICOLON; + + /* Check for a valid special command code */ + + if (ch != ';') + { + /* Not a special command code, return the ESC now and the next two + * characters later. + */ + + return kbd_reget(state, pch); + } + } + + /* We have successfully parsed the the entire escape sequence. Return the + * special code in pch and the value 2. + */ + + *pch = state->buf[NDX_CODE]; + state->nch = 0; + return KBD_SPECIAL; +} + diff --git a/nuttx/libc/misc/lib_kbdencode.c b/nuttx/libc/misc/lib_kbdencode.c new file mode 100644 index 0000000000..80bf147777 --- /dev/null +++ b/nuttx/libc/misc/lib_kbdencode.c @@ -0,0 +1,81 @@ +/******************************************************************************************** + * libc/msic/lib_kbdencode.c + * Encoding side of the Keyboard CODEC + * + * Copyright (C) 2012 Gregory Nutt. All rights reserved. + * Authors: Gregory Nutt + * + * 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. + * + ********************************************************************************************/ + +/******************************************************************************************** + * Included Files + ********************************************************************************************/ + +#include + +#include +#include + +#include +#include +#include + +/******************************************************************************************** + * Pre-Processor Definitions + ********************************************************************************************/ + +/******************************************************************************************** + * Public Functions + ********************************************************************************************/ + +/**************************************************************************** + * Name: kbd_putspecial + * + * Description: + * Put one special, "out-of-band" command into the output stream. + * + * Input Parameters: + * + * Returned Value: + * None + * + ****************************************************************************/ + +void kbd_putspecial(enum kbd_keycode_e keycode, + FAR struct lib_outstream_s *stream) +{ + DEBUGASSERT(stream && keycode >= KEYCODE_FWDDEL && keycode <= LAST_KEYCODE); + + stream->put(stream, ASCII_ESC); + stream->put(stream, '['); + stream->put(stream, (int)keycode); + stream->put(stream, ';'); +} + From 373e145e546cc34b6a0000d7b3f71538c05a3b1b Mon Sep 17 00:00:00 2001 From: patacongo Date: Wed, 26 Dec 2012 18:54:59 +0000 Subject: [PATCH 014/118] Implement encoding the usbhost HID keyboard driver; configre olimex-lpc1766stk HID keyboard configuration to use the kconfig-frontends tool git-svn-id: http://svn.code.sf.net/p/nuttx/code/trunk@5461 42af7a65-404d-4744-a932-0658087f49c3 --- apps/examples/hidkbd/hidkbd_main.c | 4 +- nuttx/ChangeLog | 6 + nuttx/Documentation/NuttxPortingGuide.html | 148 ++- nuttx/configs/olimex-lpc1766stk/README.txt | 20 +- .../olimex-lpc1766stk/hidkbd/appconfig | 39 - .../olimex-lpc1766stk/hidkbd/defconfig | 1010 +++++++++-------- .../olimex-lpc1766stk/hidkbd/setenv.sh | 4 +- nuttx/drivers/usbhost/Kconfig | 66 +- nuttx/drivers/usbhost/usbhost_hidkbd.c | 379 ++++++- nuttx/include/nuttx/input/kbd_codec.h | 26 +- nuttx/libc/misc/lib_kbddecode.c | 10 +- nuttx/libc/misc/lib_kbdencode.c | 3 + 12 files changed, 1131 insertions(+), 584 deletions(-) delete mode 100644 nuttx/configs/olimex-lpc1766stk/hidkbd/appconfig diff --git a/apps/examples/hidkbd/hidkbd_main.c b/apps/examples/hidkbd/hidkbd_main.c index e744a495c7..bc1eebed0b 100644 --- a/apps/examples/hidkbd/hidkbd_main.c +++ b/apps/examples/hidkbd/hidkbd_main.c @@ -206,7 +206,7 @@ int hidkbd_main(int argc, char *argv[]) printf("Device %s opened\n", CONFIG_EXAMPLES_HIDKBD_DEVNAME); fflush(stdout); - /* Loop until there is a read failure */ + /* Loop until there is a read failure (or EOF?) */ do { @@ -220,7 +220,7 @@ int hidkbd_main(int argc, char *argv[]) (void)write(1, buffer, nbytes); } } - while (nbytes >= 0); + while (nbytes > 0); printf("Closing device %s: %d\n", CONFIG_EXAMPLES_HIDKBD_DEVNAME, (int)nbytes); fflush(stdout); diff --git a/nuttx/ChangeLog b/nuttx/ChangeLog index 80ddb56c6b..7e1c538d72 100644 --- a/nuttx/ChangeLog +++ b/nuttx/ChangeLog @@ -3821,3 +3821,9 @@ * libc/misc/lib_kbdencode.c and lib_kbddecode.c: Add logic to marshal and serialized "out-of-band" keyboard commands intermixed with normal ASCII data (not yet hooked into anything). + * drivers/usbhost/usbhost_hidkbd.c: If CONFIG_HIDKBD_ENCODED is + defined, this driver will now use libc/misc/lib_kbdencode.c to + encode special function keys. + * configs/olimex-lpc1766stk/hidkbd: This configuration has been + converted to use the kconfig-frontends configuration tool. + diff --git a/nuttx/Documentation/NuttxPortingGuide.html b/nuttx/Documentation/NuttxPortingGuide.html index 0408f82ac8..ebb3eff4bf 100644 --- a/nuttx/Documentation/NuttxPortingGuide.html +++ b/nuttx/Documentation/NuttxPortingGuide.html @@ -131,7 +131,8 @@ 6.3.12 PWM Drivers
    6.3.13 CAN Drivers
    6.3.14 Quadrature Encoder Drivers
    - 6.3.15 Watchdog Timer Drivers + 6.3.15 Watchdog Timer Drivers
    + 6.3.16 Keyboard/Keypad Drivers
    6.4 Power Management
      @@ -3620,6 +3621,151 @@ extern void up_ledoff(int led);
    +

    6.3.16 Keyboard/Keypad Drivers

    +

    + "Out-of-Band" Commands. + Keyboards and keypads are the same device for NuttX. + A keypad is thought of as simply a keyboard with fewer keys. + In NuttX, a keyboard/keypad driver is simply a character driver that may have an (optional) encoding/decoding layer on the data returned by the character driver. + A keyboard may return simple text data (alphabetic, numeric, and punctuaction) or control characters (enter, control-C, etc.). + We can think about this the normal "in-band" keyboard data stream. + However, in addition, most keyboards support actions that cannot be represented as text data. + Such actions include things like cursor controls (home, up arrow, page down, etc.), editing functions (insert, delete, etc.), volume controls, (mute, volume up, etc.) and other special functions. + We can think about this as special, "out-of-band" keyboard commands. + In this case, some special encoding may be required to multiplex the in-band text data and out-of-band command streams. +

    +

    + Encoding/Decoding Layer. + An optional encoding/decoding layer can be used with the basic character driver to encode the out-of-band commands into the text data stream. + The function interfaces that comprise that encoding/decoding layer are defined in the header file include/nuttx/input/kbd_code.h. + These functions provide an matched set of (a) driver encoding interfaces, and (b) application decoding interfaces. +

    +
      +
    1. +

      + Driver Encoding Interfaces. +

      +
        +
      • +

        + kbd_puttext() +

        +

        Function Prototype:

        +
          +#include <nuttx/streams.h>
          +#include <nuttx/input/kbd_codec.h>
          +void kbd_puttext(int ch, FAR struct lib_outstream_s *stream);
          +
        +

        Description:

        +
          + Put one byte of normal, "in-band" ASCII data into the output stream. +
        +

        Input Pameters:

        +
          +
        • + ch: The character to be added to the output stream. +
        • +
        • + stream: An instance of lib_outstream_s to perform the actual low-level put operation. +
        • +
        +

        Returned Value:

        +
          + None. +
        +
      • +
      • +

        + kbd_putspecial() +

        +

        Function Prototype:

        +
          +#include <nuttx/streams.h>
          +#include <nuttx/input/kbd_codec.h>
          +void kbd_putspecial(enum kbd_keycode_e keycode, FAR struct lib_outstream_s *stream);
          +
        +

        Description:

        +
          + Put one special, "out-of-band" command into the output stream. +
        +

        Input Pameters:

        +
          +
        • + keycode: The command to be added to the output stream. + The enumeration enum kbd_keycode_e keycode identifies all commands known to the system. +
        • +
        • + stream: An instance of lib_outstream_s to perform the actual low-level put operation. +
        • +
        +

        Returned Value:

        +
          + None. +
        +
      • +
      +
    2. +
    3. +

      + Application Decoding Interfaces. +

      +
        +
      • +

        + kbd_get() +

        +

        Function Prototype:

        +
          +#include <nuttx/streams.h>
          +#include <nuttx/input/kbd_codec.h>
          +int kbd_get(FAR struct lib_instream_s *stream, FAR struct kbd_getstate_s *state, FAR uint8_t *pch);
          +
        +

        Description:

        +
          + Get one byte of data or special command from the driver provided input buffer. +
        +

        Input Pameters:

        +
          +
        • + stream: An instance of lib_instream_s to perform the actual low-level get operation. +
        • +
        • + pch: The location character to save the returned value. + This may be either a normal, "in-band" ASCII characer or a special, "out-of-band" command (i.e., a value from enum kbd_getstate_s. +
        • +
        • + state: A user provided buffer to support parsing. + This structure should be cleared the first time that kbd_get is called. +
        • +
        +

        Returned Value:

        +
          +
        • + 1: + Indicates the successful receipt of a special, "out-of-band" command. + The returned value in pch is a value from enum kbd_getstate_s. +
        • +
        • + 0: + Indicates the successful receipt of normal, "in-band" ASCII data. + The returned value in pch is a simple byte of text or control data. +
        • +
        • + EOF: + An error has getting the next character (reported by the stream). + Normally indicates the end of file. +
        • +
        +
      • +
      +
    4. +
    +

    + I/O Streams. + Notice the use of the abstract I/O streams in these interfaces. + These stream interfaces are defined in include/nuttx/streams.h. +

    +

    6.4 Power Management

    6.4.1 Overview

    diff --git a/nuttx/configs/olimex-lpc1766stk/README.txt b/nuttx/configs/olimex-lpc1766stk/README.txt index ec7ddd42db..e2c940bac5 100644 --- a/nuttx/configs/olimex-lpc1766stk/README.txt +++ b/nuttx/configs/olimex-lpc1766stk/README.txt @@ -899,7 +899,25 @@ Where is one of the following: This configuration directory, performs a simple test of the USB host HID keyboard class driver using the test logic in apps/examples/hidkbd. - nettest: + NOTES: + + 1. This configuration uses the mconf-based configuration tool. To + change this configuration using that tool, you should: + + a. Build and install the mconf tool. See nuttx/README.txt and + misc/tools/ + + b. Execute 'make menuconfig' in nuttx/ in order to start the + reconfiguration process. + + 2. Default platform/toolchain: This is how the build is configured by + be default. These options can easily be re-confured, however. + + CONFIG_HOST_WINDOWS=y : Windows + CONFIG_WINDOWS_CYGWIN=y : Cygwin environment on Windows + CONFIG_STM32_CODESOURCERYW=y : CodeSourcery under Windows + + nettest: This configuration directory may be used to enable networking using the LPC17xx's Ethernet controller. It uses apps/examples/nettest to excercise the TCP/IP network. diff --git a/nuttx/configs/olimex-lpc1766stk/hidkbd/appconfig b/nuttx/configs/olimex-lpc1766stk/hidkbd/appconfig deleted file mode 100644 index 79a7c50abe..0000000000 --- a/nuttx/configs/olimex-lpc1766stk/hidkbd/appconfig +++ /dev/null @@ -1,39 +0,0 @@ -############################################################################ -# configs/olimex-lpc1766stk/hidkbd/appconfig -# -# Copyright (C) 2011 Gregory Nutt. All rights reserved. -# Author: Gregory Nutt -# -# 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. -# -############################################################################ - -# Path to example in apps/examples containing the user_start entry point - -CONFIGURED_APPS += examples/hidkbd - diff --git a/nuttx/configs/olimex-lpc1766stk/hidkbd/defconfig b/nuttx/configs/olimex-lpc1766stk/hidkbd/defconfig index 9a4c37fb44..78e4115609 100755 --- a/nuttx/configs/olimex-lpc1766stk/hidkbd/defconfig +++ b/nuttx/configs/olimex-lpc1766stk/hidkbd/defconfig @@ -1,244 +1,282 @@ -############################################################################ -# configs/olimex-lpc1766stk/hidkbd/defconfig # -# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved. -# Author: Gregory Nutt +# Automatically generated file; DO NOT EDIT. +# Nuttx/ Configuration # -# 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. -# -############################################################################ -# -# Architecture Selection -# -CONFIG_ARCH="arm" -CONFIG_ARCH_ARM=y -CONFIG_ARCH_CORTEXM3=y -CONFIG_ARCH_CHIP="lpc17xx" -CONFIG_ARCH_CHIP_LPC17XX=y -CONFIG_ARCH_CHIP_LPC1766=y -CONFIG_ARCH_BOARD="olimex-lpc1766stk" -CONFIG_ARCH_BOARD_LPC1766STK=y -CONFIG_BOARD_LOOPSPERMSEC=8111 -CONFIG_DRAM_SIZE=32768 -CONFIG_DRAM_START=0x10000000 -CONFIG_ARCH_IRQPRIO=y -CONFIG_ARCH_INTERRUPTSTACK=0 -CONFIG_ARCH_STACKDUMP=y -CONFIG_ARCH_BOOTLOADER=n -CONFIG_ARCH_LEDS=y -CONFIG_ARCH_BUTTONS=n -CONFIG_ARCH_CALIBRATION=n -CONFIG_ARCH_DMA=n +CONFIG_NUTTX_NEWCONFIG=y # -# Identify toolchain and linker options +# Build Setup # -CONFIG_LPC17_CODESOURCERYW=n -CONFIG_LPC17_CODESOURCERYL=n -CONFIG_LPC17_DEVKITARM=n -CONFIG_LPC17_BUILDROOT=y +# CONFIG_EXPERIMENTAL is not set +# CONFIG_HOST_LINUX is not set +# CONFIG_HOST_OSX is not set +CONFIG_HOST_WINDOWS=y +# CONFIG_HOST_OTHER is not set +# CONFIG_WINDOWS_NATIVE is not set +CONFIG_WINDOWS_CYGWIN=y +# CONFIG_WINDOWS_MSYS is not set +# CONFIG_WINDOWS_OTHER is not set # -# Individual subsystems can be enabled: +# Build Configuration # -CONFIG_LPC17_ETHERNET=n -CONFIG_LPC17_USBHOST=y -CONFIG_LPC17_USBOTG=n -CONFIG_LPC17_USBDEV=n -CONFIG_LPC17_UART0=y -CONFIG_LPC17_UART1=n -CONFIG_LPC17_UART2=n -CONFIG_LPC17_UART3=n -CONFIG_LPC17_CAN1=n -CONFIG_LPC17_CAN2=n -CONFIG_LPC17_SPI=n -CONFIG_LPC17_SSP0=n -CONFIG_LPC17_SSP1=n -CONFIG_LPC17_I2C0=n -CONFIG_LPC17_I2C1=n -CONFIG_LPC17_I2S=n -CONFIG_LPC17_TMR0=n -CONFIG_LPC17_TMR1=n -CONFIG_LPC17_TMR2=n -CONFIG_LPC17_TMR3=n -CONFIG_LPC17_RIT=n -CONFIG_LPC17_PWM=n -CONFIG_LPC17_MCPWM=n -CONFIG_LPC17_QEI=n -CONFIG_LPC17_RTC=n -CONFIG_LPC17_WDT=n -CONFIG_LPC17_ADC=n -CONFIG_LPC17_DAC=n -CONFIG_LPC17_GPDMA=n +# CONFIG_APPS_DIR="../apps" +# CONFIG_BUILD_2PASS is not set # -# LPC17xx Button interrupt support +# Binary Output Formats # -CONFIG_GPIO_IRQ=n -CONFIG_ARCH_IRQBUTTONS=n - -# -# LPC17xx specific serial device driver settings -# -CONFIG_UART0_SERIAL_CONSOLE=y -CONFIG_UART1_SERIAL_CONSOLE=n -CONFIG_UART2_SERIAL_CONSOLE=n -CONFIG_UART3_SERIAL_CONSOLE=n - -CONFIG_UART0_TXBUFSIZE=256 -CONFIG_UART1_TXBUFSIZE=256 -CONFIG_UART2_TXBUFSIZE=256 -CONFIG_UART3_TXBUFSIZE=256 - -CONFIG_UART0_RXBUFSIZE=256 -CONFIG_UART1_RXBUFSIZE=256 -CONFIG_UART2_RXBUFSIZE=256 -CONFIG_UART3_RXBUFSIZE=256 - -CONFIG_UART0_BAUD=57600 -CONFIG_UART2_BAUD=57600 -CONFIG_UART3_BAUD=57600 -CONFIG_UART1_BAUD=57600 - -CONFIG_UART0_BITS=8 -CONFIG_UART1_BITS=8 -CONFIG_UART2_BITS=8 -CONFIG_UART3_BITS=8 - -CONFIG_UART0_PARITY=0 -CONFIG_UART1_PARITY=0 -CONFIG_UART2_PARITY=0 -CONFIG_UART3_PARITY=0 - -CONFIG_UART0_2STOP=0 -CONFIG_UART1_2STOP=0 -CONFIG_UART2_2STOP=0 -CONFIG_UART3_2STOP=0 - -# -# LPC17xx specific PHY/Ethernet device driver settings -# -CONFIG_PHY_KS8721=y -CONFIG_PHY_AUTONEG=y -CONFIG_PHY_SPEED100=n -CONFIG_PHY_FDUPLEX=y -CONFIG_NET_EMACRAM_SIZE=8192 -CONFIG_NET_NTXDESC=7 -CONFIG_NET_NRXDESC=7 -CONFIG_NET_REGDEBUG=n - -# -# General build options -# -CONFIG_RRLOAD_BINARY=n +# CONFIG_RRLOAD_BINARY is not set CONFIG_INTELHEX_BINARY=y -CONFIG_MOTOROLA_SREC=n -CONFIG_RAW_BINARY=n +# CONFIG_MOTOROLA_SREC is not set +# CONFIG_RAW_BINARY is not set # -# General OS setup +# Customize Header Files # -CONFIG_USER_ENTRYPOINT="hidkbd_main" -CONFIG_DEBUG=n -CONFIG_DEBUG_VERBOSE=n -CONFIG_DEBUG_SYMBOLS=n -CONFIG_DEBUG_USB=n -CONFIG_MM_REGIONS=2 -CONFIG_ARCH_LOWPUTC=y +# CONFIG_ARCH_STDBOOL_H is not set +# CONFIG_ARCH_MATH_H is not set +# CONFIG_ARCH_FLOAT_H is not set +# CONFIG_ARCH_STDARG_H is not set + +# +# Debug Options +# +# CONFIG_DEBUG is not set +# CONFIG_DEBUG_SYMBOLS is not set + +# +# System Type +# +# CONFIG_ARCH_8051 is not set +CONFIG_ARCH_ARM=y +# CONFIG_ARCH_AVR is not set +# CONFIG_ARCH_HC is not set +# CONFIG_ARCH_MIPS is not set +# CONFIG_ARCH_RGMP is not set +# CONFIG_ARCH_SH is not set +# CONFIG_ARCH_SIM is not set +# CONFIG_ARCH_X86 is not set +# CONFIG_ARCH_Z16 is not set +# CONFIG_ARCH_Z80 is not set +CONFIG_ARCH="arm" + +# +# ARM Options +# +# CONFIG_ARCH_CHIP_C5471 is not set +# CONFIG_ARCH_CHIP_CALYPSO is not set +# CONFIG_ARCH_CHIP_DM320 is not set +# CONFIG_ARCH_CHIP_IMX is not set +# CONFIG_ARCH_CHIP_KINETIS is not set +# CONFIG_ARCH_CHIP_LM3S is not set +CONFIG_ARCH_CHIP_LPC17XX=y +# CONFIG_ARCH_CHIP_LPC214X is not set +# CONFIG_ARCH_CHIP_LPC2378 is not set +# CONFIG_ARCH_CHIP_LPC31XX is not set +# CONFIG_ARCH_CHIP_LPC43XX is not set +# CONFIG_ARCH_CHIP_SAM3U is not set +# CONFIG_ARCH_CHIP_STM32 is not set +# CONFIG_ARCH_CHIP_STR71X is not set +CONFIG_ARCH_CORTEXM3=y +CONFIG_ARCH_FAMILY="armv7-m" +CONFIG_ARCH_CHIP="lpc17xx" +CONFIG_ARCH_HAVE_MPU=y +# CONFIG_ARMV7M_MPU is not set +CONFIG_BOARD_LOOPSPERMSEC=8111 +# CONFIG_ARCH_CALIBRATION is not set + +# +# ARMV7M Configuration Options +# +# CONFIG_ARMV7M_TOOLCHAIN_ATOLLIC is not set +# CONFIG_ARMV7M_TOOLCHAIN_BUILDROOT is not set +# CONFIG_ARMV7M_TOOLCHAIN_CODEREDW is not set +CONFIG_ARMV7M_TOOLCHAIN_CODESOURCERYW=y +# CONFIG_ARMV7M_TOOLCHAIN_DEVKITARM is not set +# CONFIG_ARMV7M_TOOLCHAIN_GNU_EABI is not set +# CONFIG_ARMV7M_TOOLCHAIN_RAISONANCE is not set + +# +# LPC17xx Configuration Options +# +# CONFIG_ARCH_CHIP_LPC1751 is not set +# CONFIG_ARCH_CHIP_LPC1752 is not set +# CONFIG_ARCH_CHIP_LPC1754 is not set +# CONFIG_ARCH_CHIP_LPC1756 is not set +# CONFIG_ARCH_CHIP_LPC1758 is not set +# CONFIG_ARCH_CHIP_LPC1759 is not set +# CONFIG_ARCH_CHIP_LPC1764 is not set +# CONFIG_ARCH_CHIP_LPC1765 is not set +CONFIG_ARCH_CHIP_LPC1766=y +# CONFIG_ARCH_CHIP_LPC1767 is not set +# CONFIG_ARCH_CHIP_LPC1768 is not set +# CONFIG_ARCH_CHIP_LPC1769 is not set +CONFIG_ARCH_FAMILY_LPC176X=y + +# +# LPC17xx Peripheral Support +# +CONFIG_LPC17_MAINOSC=y +CONFIG_LPC17_PLL0=y +# CONFIG_LPC17_PLL1 is not set +# CONFIG_LPC17_ETHERNET is not set +CONFIG_LPC17_USBHOST=y +# CONFIG_LPC17_USBDEV is not set +CONFIG_LPC17_UART0=y +# CONFIG_LPC17_UART1 is not set +# CONFIG_LPC17_UART2 is not set +# CONFIG_LPC17_UART3 is not set +# CONFIG_LPC17_CAN1 is not set +# CONFIG_LPC17_CAN2 is not set +# CONFIG_LPC17_SPI is not set +# CONFIG_LPC17_SSP0 is not set +# CONFIG_LPC17_SSP1 is not set +# CONFIG_LPC17_I2C0 is not set +# CONFIG_LPC17_I2C1 is not set +# CONFIG_LPC17_I2C2 is not set +# CONFIG_LPC17_I2S is not set +# CONFIG_LPC17_TMR0 is not set +# CONFIG_LPC17_TMR1 is not set +# CONFIG_LPC17_TMR2 is not set +# CONFIG_LPC17_TMR3 is not set +# CONFIG_LPC17_RIT is not set +# CONFIG_LPC17_PWM is not set +# CONFIG_LPC17_MCPWM is not set +# CONFIG_LPC17_QEI is not set +# CONFIG_LPC17_RTC is not set +# CONFIG_LPC17_WDT is not set +# CONFIG_LPC17_ADC is not set +# CONFIG_LPC17_DAC is not set +# CONFIG_LPC17_GPDMA is not set +# CONFIG_LPC17_FLASH is not set + +# +# Serial driver options +# +# CONFIG_SERIAL_TERMIOS is not set +# CONFIG_UART0_FLOWCONTROL is not set + +# +# ADC driver options +# + +# +# CAN driver options +# +# CONFIG_GPIO_IRQ is not set + +# +# I2C driver options +# + +# +# Ethernet driver options +# + +# +# USB device driver options +# + +# +# USB host driver options +# +CONFIG_USBHOST_OHCIRAM_SIZE=1536 +CONFIG_USBHOST_NEDS=2 +CONFIG_USBHOST_NTDS=3 +CONFIG_USBHOST_TDBUFFERS=3 +CONFIG_USBHOST_TDBUFSIZE=128 +CONFIG_USBHOST_IOBUFSIZE=512 +CONFIG_USBHOST_BULK_DISABLE=y +# CONFIG_USBHOST_INT_DISABLE is not set +CONFIG_USBHOST_ISOC_DISABLE=y +# CONFIG_SDIO_DMA is not set +# CONFIG_SDIO_WIDTH_D1_ONLY is not set + +# +# Architecture Options +# +# CONFIG_ARCH_NOINTC is not set +# CONFIG_ARCH_DMA is not set +CONFIG_ARCH_IRQPRIO=y +# CONFIG_CUSTOM_STACK is not set +# CONFIG_ADDRENV is not set +CONFIG_ARCH_STACKDUMP=y +# CONFIG_ENDIAN_BIG is not set + +# +# Board Settings +# +CONFIG_DRAM_START=0x10000000 +CONFIG_DRAM_SIZE=32768 +CONFIG_ARCH_HAVE_INTERRUPTSTACK=y +CONFIG_ARCH_INTERRUPTSTACK=0 + +# +# Boot options +# +# CONFIG_BOOT_RUNFROMEXTSRAM is not set +CONFIG_BOOT_RUNFROMFLASH=y +# CONFIG_BOOT_RUNFROMISRAM is not set +# CONFIG_BOOT_RUNFROMSDRAM is not set +# CONFIG_BOOT_COPYTORAM is not set + +# +# Board Selection +# +CONFIG_ARCH_BOARD_LPC1766STK=y +# CONFIG_ARCH_BOARD_CUSTOM is not set +CONFIG_ARCH_BOARD="olimex-lpc1766stk" + +# +# Common Board Options +# +CONFIG_ARCH_HAVE_LEDS=y +CONFIG_ARCH_LEDS=y +CONFIG_ARCH_HAVE_BUTTONS=y +# CONFIG_ARCH_BUTTONS is not set +CONFIG_ARCH_HAVE_IRQBUTTONS=y + +# +# Board-Specific Options +# + +# +# RTOS Features +# +CONFIG_MSEC_PER_TICK=10 CONFIG_RR_INTERVAL=200 -CONFIG_SCHED_INSTRUMENTATION=n +# CONFIG_SCHED_INSTRUMENTATION is not set CONFIG_TASK_NAME_SIZE=0 +# CONFIG_JULIAN_TIME is not set CONFIG_START_YEAR=2010 CONFIG_START_MONTH=11 CONFIG_START_DAY=10 -CONFIG_GREGORIAN_TIME=n -CONFIG_JULIAN_TIME=n CONFIG_DEV_CONSOLE=y -CONFIG_DEV_LOWCONSOLE=n -CONFIG_MUTEX_TYPES=n -CONFIG_PRIORITY_INHERITANCE=n -CONFIG_SEM_PREALLOCHOLDERS=0 -CONFIG_SEM_NNESTPRIO=0 -CONFIG_FDCLONE_DISABLE=n -CONFIG_FDCLONE_STDIO=n +# CONFIG_MUTEX_TYPES is not set +# CONFIG_PRIORITY_INHERITANCE is not set +# CONFIG_FDCLONE_DISABLE is not set +# CONFIG_FDCLONE_STDIO is not set CONFIG_SDCLONE_DISABLE=y -CONFIG_NXFLAT=n CONFIG_SCHED_WORKQUEUE=y CONFIG_SCHED_WORKPRIORITY=192 CONFIG_SCHED_WORKPERIOD=50000 CONFIG_SCHED_WORKSTACKSIZE=1024 CONFIG_SIG_SIGWORK=4 - -# -# The following can be used to disable categories of -# APIs supported by the OS. If the compiler supports -# weak functions, then it should not be necessary to -# disable functions unless you want to restrict usage -# of those APIs. -# -# There are certain dependency relationships in these -# features. -# -# o mq_notify logic depends on signals to awaken tasks -# waiting for queues to become full or empty. -# o pthread_condtimedwait() depends on signals to wake -# up waiting tasks. -# -CONFIG_DISABLE_CLOCK=n -CONFIG_DISABLE_POSIX_TIMERS=n -CONFIG_DISABLE_PTHREAD=n -CONFIG_DISABLE_SIGNALS=n -CONFIG_DISABLE_MQUEUE=n -CONFIG_DISABLE_MOUNTPOINT=n -CONFIG_DISABLE_ENVIRON=n -CONFIG_DISABLE_POLL=n - -# -# Misc libc settings -# -CONFIG_NOPRINTF_FIELDWIDTH=n - -# -# Allow for architecture optimized implementations -# -# The architecture can provide optimized versions of the -# following to improve system performance -# -CONFIG_ARCH_MEMCPY=n -CONFIG_ARCH_MEMCMP=n -CONFIG_ARCH_MEMMOVE=n -CONFIG_ARCH_MEMSET=n -CONFIG_ARCH_STRCMP=n -CONFIG_ARCH_STRCPY=n -CONFIG_ARCH_STRNCPY=n -CONFIG_ARCH_STRLEN=n -CONFIG_ARCH_STRNLEN=n -CONFIG_ARCH_BZERO=n +# CONFIG_SCHED_LPWORK is not set +# CONFIG_SCHED_WAITPID is not set +# CONFIG_SCHED_ATEXIT is not set +# CONFIG_SCHED_ONEXIT is not set +CONFIG_USER_ENTRYPOINT="hidkbd_main" +CONFIG_DISABLE_OS_API=y +# CONFIG_DISABLE_CLOCK is not set +# CONFIG_DISABLE_POSIX_TIMERS is not set +# CONFIG_DISABLE_PTHREAD is not set +# CONFIG_DISABLE_SIGNALS is not set +# CONFIG_DISABLE_MQUEUE is not set +# CONFIG_DISABLE_MOUNTPOINT is not set +# CONFIG_DISABLE_ENVIRON is not set +# CONFIG_DISABLE_POLL is not set # # Sizes of configurable things (0 disables) @@ -249,258 +287,318 @@ CONFIG_NPTHREAD_KEYS=4 CONFIG_NFILE_DESCRIPTORS=8 CONFIG_NFILE_STREAMS=8 CONFIG_NAME_MAX=32 -CONFIG_STDIO_BUFFER_SIZE=256 -CONFIG_NUNGET_CHARS=2 CONFIG_PREALLOC_MQ_MSGS=4 CONFIG_MQ_MAXMSGSIZE=32 CONFIG_MAX_WDOGPARMS=2 CONFIG_PREALLOC_WDOGS=4 CONFIG_PREALLOC_TIMERS=4 -# -# Filesystem configuration -# -CONFIG_FS_FAT=n -CONFIG_FAT_LCNAMES=n -CONFIG_FAT_LFN=n -CONFIG_FAT_MAXFNAME=32 -CONFIG_FS_NXFFS=n -CONFIG_FS_ROMFS=n - -# -# Maintain legacy build behavior (revisit) -# - -CONFIG_MMCSD=y -CONFIG_MMCSD_SPI=y -CONFIG_MMCSD_SDIO=y - -# -# SPI-based MMC/SD driver -# -CONFIG_MMCSD_NSLOTS=1 -CONFIG_MMCSD_READONLY=n -CONFIG_MMCSD_SPICLOCK=12500000 - -# -# Block driver buffering -# -CONFIG_FS_READAHEAD=n -CONFIG_FS_WRITEBUFFER=n - -# -# SDIO-based MMC/SD driver -# -CONFIG_SDIO_DMA=n -CONFIG_MMCSD_MMCSUPPORT=n -CONFIG_MMCSD_HAVECARDDETECT=n - -# -# TCP/IP and UDP support via uIP -# -CONFIG_NET=n -CONFIG_NET_IPv6=n -CONFIG_NSOCKET_DESCRIPTORS=8 -CONFIG_NET_SOCKOPTS=y -CONFIG_NET_BUFSIZE=562 -CONFIG_NET_TCP=y -CONFIG_NET_TCP_CONNS=8 -CONFIG_NET_NTCP_READAHEAD_BUFFERS=16 -CONFIG_NET_TCPBACKLOG=n -CONFIG_NET_MAX_LISTENPORTS=8 -CONFIG_NET_UDP=y -CONFIG_NET_UDP_CHECKSUMS=y -#CONFIG_NET_UDP_CONNS=8 -CONFIG_NET_ICMP=y -CONFIG_NET_ICMP_PING=y -#CONFIG_NET_PINGADDRCONF=0 -CONFIG_NET_STATISTICS=y -#CONFIG_NET_RECEIVE_WINDOW= -#CONFIG_NET_ARPTAB_SIZE=8 -CONFIG_NET_BROADCAST=n - -# -# UIP Network Utilities -# -CONFIG_NET_DHCP_LIGHT=n -CONFIG_NET_RESOLV_ENTRIES=4 - -# -# USB Device Configuration -# -CONFIG_USBDEV=n -CONFIG_USBDEV_ISOCHRONOUS=n -CONFIG_USBDEV_DUALSPEED=n -CONFIG_USBDEV_SELFPOWERED=y -CONFIG_USBDEV_REMOTEWAKEUP=n -CONFIG_USBDEV_MAXPOWER=100 -CONFIG_USBDEV_TRACE=n -CONFIG_USBDEV_TRACE_NRECORDS=128 - -# -# USB Host Configuration -# -CONFIG_USBHOST=y -CONFIG_USBHOST_NPREALLOC=0 -CONFIG_USBHOST_BULK_DISABLE=y -CONFIG_USBHOST_INT_DISABLE=n -CONFIG_USBHOST_ISOC_DISABLE=y - -# -# LPC17xx USB Device Configuration -# -CONFIG_LPC17_USBDEV_FRAME_INTERRUPT=n -CONFIG_LPC17_USBDEV_EPFAST_INTERRUPT=n -CONFIG_LPC17_USBDEV_DMA=n -CONFIG_LPC17_USBDEV_NDMADESCRIPTORS=0 -CONFIG_LPC17_USBDEV_DMAINTMASK=0 - -# -# LPC17xx USB Host Configuration -# -# OHCI RAM layout: -# -CONFIG_USBHOST_OHCIRAM_SIZE=1536 -CONFIG_USBHOST_NEDS=2 -CONFIG_USBHOST_NTDS=3 -CONFIG_USBHOST_TDBUFFERS=3 -CONFIG_USBHOST_TDBUFSIZE=128 -CONFIG_USBHOST_IOBUFSIZE=512 - -# -# USB Serial Device Configuration -# -CONFIG_PL2303=n -CONFIG_PL2303_EPINTIN=1 -CONFIG_PL2303_EPBULKOUT=2 -CONFIG_PL2303_EPBULKIN=5 -CONFIG_PL2303_NWRREQS=4 -CONFIG_PL2303_NRDREQS=4 -CONFIG_PL2303_VENDORID=0x067b -CONFIG_PL2303_PRODUCTID=0x2303 -CONFIG_PL2303_VENDORSTR="Nuttx" -CONFIG_PL2303_PRODUCTSTR="USBdev Serial" -CONFIG_PL2303_RXBUFSIZE=512 -CONFIG_PL2303_TXBUFSIZE=512 - -# -# USB Storage Device Configuration -# -CONFIG_USBMSC=n -CONFIG_USBMSC_EP0MAXPACKET=64 -CONFIG_USBMSC_EPBULKOUT=2 -CONFIG_USBMSC_EPBULKIN=5 -CONFIG_USBMSC_NRDREQS=2 -CONFIG_USBMSC_NWRREQS=2 -CONFIG_USBMSC_BULKINREQLEN=256 -CONFIG_USBMSC_BULKOUTREQLEN=256 -CONFIG_USBMSC_VENDORID=0x584e -CONFIG_USBMSC_VENDORSTR="NuttX" -CONFIG_USBMSC_PRODUCTID=0x5342 -CONFIG_USBMSC_PRODUCTSTR="USBdev Storage" -CONFIG_USBMSC_VERSIONNO=0x0399 -CONFIG_USBMSC_REMOVABLE=y - -# -# Settings for examples/uip -# -CONFIG_EXAMPLES_UIP_IPADDR=0x0a000002 -CONFIG_EXAMPLES_UIP_DRIPADDR=0x0a000001 -CONFIG_EXAMPLES_UIP_NETMASK=0xffffff00 -CONFIG_EXAMPLES_UIP_DHCPC=n - -# -# Settings for examples/nettest -# -CONFIG_EXAMPLES_NETTEST_SERVER=n -CONFIG_EXAMPLES_NETTEST_PERFORMANCE=n -CONFIG_EXAMPLES_NETTEST_NOMAC=y -CONFIG_EXAMPLES_NETTEST_IPADDR=0x0a000002 -CONFIG_EXAMPLES_NETTEST_DRIPADDR=0x0a000001 -CONFIG_EXAMPLES_NETTEST_NETMASK=0xffffff00 -CONFIG_EXAMPLES_NETTEST_CLIENTIP=0x0a000001 - -# -# Settings for examples/ostest -# -CONFIG_EXAMPLES_OSTEST_LOOPS=1 -CONFIG_EXAMPLES_OSTEST_STACKSIZE=2048 -CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3 - -# -# Settings for examples/buttons -# -CONFIG_EXAMPLES_BUTTONS_MIN=0 -CONFIG_EXAMPLES_BUTTONS_MAX=7 -CONFIG_EXAMPLES_IRQBUTTONS_MIN=0 -CONFIG_EXAMPLES_IRQBUTTONS_MAX=7 -CONFIG_EXAMPLES_BUTTONS_NAME0="BUT1" -CONFIG_EXAMPLES_BUTTONS_NAME1="BUT2" -CONFIG_EXAMPLES_BUTTONS_NAME2="WAKE-UP" -CONFIG_EXAMPLES_BUTTONS_NAME3="CENTER" -CONFIG_EXAMPLES_BUTTONS_NAME4="UP" -CONFIG_EXAMPLES_BUTTONS_NAME5="DOWN" -CONFIG_EXAMPLES_BUTTONS_NAME6="LEFT" -CONFIG_EXAMPLES_BUTTONS_NAME7="RIGHT" - -# -# Settings for apps/nshlib -# -CONFIG_NSH_FILEIOSIZE=512 -CONFIG_NSH_STRERROR=n -CONFIG_NSH_LINELEN=64 -CONFIG_NSH_NESTDEPTH=3 -CONFIG_NSH_DISABLESCRIPT=n -CONFIG_NSH_DISABLEBG=n -CONFIG_NSH_ROMFSETC=n -CONFIG_NSH_CONSOLE=y -CONFIG_NSH_TELNET=y -CONFIG_NSH_ARCHINIT=y -CONFIG_NSH_IOBUFFER_SIZE=512 -CONFIG_NSH_DHCPC=n -CONFIG_NSH_NOMAC=y -CONFIG_NSH_IPADDR=0x0a000002 -CONFIG_NSH_DRIPADDR=0x0a000001 -CONFIG_NSH_NETMASK=0xffffff00 -CONFIG_NSH_ROMFSMOUNTPT="/etc" -CONFIG_NSH_INITSCRIPT="init.d/rcS" -CONFIG_NSH_ROMFSDEVNO=0 -CONFIG_NSH_ROMFSSECTSIZE=64 -CONFIG_NSH_FATDEVNO=1 -CONFIG_NSH_FATSECTSIZE=512 -CONFIG_NSH_FATNSECTORS=1024 -CONFIG_NSH_FATMOUNTPT="/tmp" - -# -# Architecture-specific NSH options -# -CONFIG_NSH_MMCSDSPIPORTNO=1 -CONFIG_NSH_MMCSDSLOTNO=0 -CONFIG_NSH_MMCSDMINOR=0 - -# -# Settings for examples/usbserial -# -CONFIG_EXAMPLES_USBSERIAL_INONLY=n -CONFIG_EXAMPLES_USBSERIAL_OUTONLY=n -CONFIG_EXAMPLES_USBSERIAL_ONLYSMALL=n -CONFIG_EXAMPLES_USBSERIAL_ONLYBIG=n - -CONFIG_EXAMPLES_USBSERIAL_TRACEINIT=n -CONFIG_EXAMPLES_USBSERIAL_TRACECLASS=n -CONFIG_EXAMPLES_USBSERIAL_TRACETRANSFERS=n -CONFIG_EXAMPLES_USBSERIAL_TRACECONTROLLER=n -CONFIG_EXAMPLES_USBSERIAL_TRACEINTERRUPTS=n - # # Stack and heap information # -CONFIG_BOOT_RUNFROMFLASH=n -CONFIG_BOOT_COPYTORAM=n -CONFIG_CUSTOM_STACK=n CONFIG_IDLETHREAD_STACKSIZE=1024 CONFIG_USERMAIN_STACKSIZE=2048 CONFIG_PTHREAD_STACK_MIN=256 CONFIG_PTHREAD_STACK_DEFAULT=2048 -CONFIG_HEAP_BASE= -CONFIG_HEAP_SIZE= + +# +# Device Drivers +# +CONFIG_DEV_NULL=y +# CONFIG_DEV_ZERO is not set +# CONFIG_LOOP is not set +# CONFIG_RAMDISK is not set +# CONFIG_CAN is not set +# CONFIG_PWM is not set +# CONFIG_I2C is not set +# CONFIG_SPI is not set +# CONFIG_RTC is not set +# CONFIG_WATCHDOG is not set +# CONFIG_ANALOG is not set +# CONFIG_BCH is not set +# CONFIG_INPUT is not set +# CONFIG_LCD is not set +CONFIG_MMCSD=y +CONFIG_MMCSD_NSLOTS=1 +# CONFIG_MMCSD_READONLY is not set +# CONFIG_MMCSD_MULTIBLOCK_DISABLE is not set +# CONFIG_MMCSD_MMCSUPPORT is not set +# CONFIG_MMCSD_HAVECARDDETECT is not set +CONFIG_MMCSD_SPI=y +CONFIG_MMCSD_SPICLOCK=12500000 +CONFIG_MMCSD_SDIO=y +# CONFIG_SDIO_MUXBUS is not set +# CONFIG_MTD is not set +# CONFIG_PIPES is not set +# CONFIG_PM is not set +# CONFIG_POWER is not set +# CONFIG_SENSORS is not set +# CONFIG_SERCOMM_CONSOLE is not set +CONFIG_SERIAL=y +# CONFIG_DEV_LOWCONSOLE is not set +# CONFIG_16550_UART is not set +CONFIG_ARCH_HAVE_UART0=y +CONFIG_MCU_SERIAL=y +CONFIG_STANDARD_SERIAL=y +CONFIG_CONFIG_SERIAL_NPOLLWAITERS=2 +CONFIG_UART0_SERIAL_CONSOLE=y +# CONFIG_NO_SERIAL_CONSOLE is not set + +# +# UART0 Configuration +# +CONFIG_UART0_RXBUFSIZE=256 +CONFIG_UART0_TXBUFSIZE=256 +CONFIG_UART0_BAUD=57600 +CONFIG_UART0_BITS=8 +CONFIG_UART0_PARITY=0 +CONFIG_UART0_2STOP=0 +# CONFIG_USBDEV is not set +CONFIG_USBHOST=y +CONFIG_USBHOST_NPREALLOC=0 +# CONFIG_USBHOST_MSC is not set +CONFIG_USBHOST_HIDKBD=y +CONFIG_HIDKBD_POLLUSEC=100000 +CONFIG_HIDKBD_DEFPRIO=50 +CONFIG_HIDKBD_STACKSIZE=1024 +CONFIG_HIDKBD_BUFSIZE=64 +CONFIG_HIDKBD_NPOLLWAITERS=2 +# CONFIG_HIDKBD_RAWSCANCODES is not set +# CONFIG_HIDKBD_ENCODED is not set +# CONFIG_HIDKBD_ALLSCANCODES is not set +# CONFIG_HIDKBD_NODEBOUNCE is not set +# CONFIG_WIRELESS is not set + +# +# System Logging Device Options +# + +# +# System Logging +# +# CONFIG_RAMLOG is not set + +# +# Networking Support +# +# CONFIG_NET is not set + +# +# File Systems +# + +# +# File system configuration +# +# CONFIG_FS_FAT is not set +# CONFIG_FS_RAMMAP is not set +# CONFIG_FS_NXFFS is not set +# CONFIG_FS_ROMFS is not set + +# +# System Logging +# +# CONFIG_SYSLOG is not set + +# +# Graphics Support +# +# CONFIG_NX is not set + +# +# Memory Management +# +# CONFIG_MM_SMALL is not set +CONFIG_MM_REGIONS=2 +# CONFIG_GRAN is not set + +# +# Binary Formats +# +# CONFIG_BINFMT_DISABLE is not set +# CONFIG_BINFMT_EXEPATH is not set +# CONFIG_NXFLAT is not set +# CONFIG_ELF is not set +# CONFIG_PIC is not set +# CONFIG_SYMTAB_ORDEREDBYNAME is not set + +# +# Library Routines +# +CONFIG_STDIO_BUFFER_SIZE=256 +CONFIG_STDIO_LINEBUFFER=y +CONFIG_NUNGET_CHARS=2 +CONFIG_LIB_HOMEDIR="/" +# CONFIG_LIBM is not set +# CONFIG_NOPRINTF_FIELDWIDTH is not set +# CONFIG_LIBC_FLOATINGPOINT is not set +# CONFIG_EOL_IS_CR is not set +# CONFIG_EOL_IS_LF is not set +# CONFIG_EOL_IS_BOTH_CRLF is not set +CONFIG_EOL_IS_EITHER_CRLF=y +# CONFIG_LIBC_STRERROR is not set +# CONFIG_LIBC_PERROR_STDOUT is not set +CONFIG_ARCH_LOWPUTC=y +CONFIG_LIB_SENDFILE_BUFSIZE=512 +# CONFIG_ARCH_ROMGETC is not set +# CONFIG_ARCH_OPTIMIZED_FUNCTIONS is not set + +# +# Basic CXX Support +# +# CONFIG_C99_BOOL8 is not set +# CONFIG_HAVE_CXX is not set + +# +# Application Configuration +# + +# +# Built-In Applications +# +# CONFIG_BUILTIN is not set + +# +# Examples +# +# CONFIG_EXAMPLES_BUTTONS is not set +# CONFIG_EXAMPLES_CAN is not set +# CONFIG_EXAMPLES_CDCACM is not set +# CONFIG_EXAMPLES_COMPOSITE is not set +# CONFIG_EXAMPLES_DHCPD is not set +# CONFIG_EXAMPLES_ELF is not set +# CONFIG_EXAMPLES_FTPC is not set +# CONFIG_EXAMPLES_FTPD is not set +# CONFIG_EXAMPLES_HELLO is not set +# CONFIG_EXAMPLES_HELLOXX is not set +# CONFIG_EXAMPLES_JSON is not set +CONFIG_EXAMPLES_HIDKBD=y +# CONFIG_EXAMPLES_KEYPADTEST is not set +# CONFIG_EXAMPLES_IGMP is not set +# CONFIG_EXAMPLES_LCDRW is not set +# CONFIG_EXAMPLES_MM is not set +# CONFIG_EXAMPLES_MOUNT is not set +# CONFIG_EXAMPLES_MODBUS is not set +# CONFIG_EXAMPLES_NETTEST is not set +# CONFIG_EXAMPLES_NSH is not set +# CONFIG_EXAMPLES_NULL is not set +# CONFIG_EXAMPLES_NX is not set +# CONFIG_EXAMPLES_NXCONSOLE is not set +# CONFIG_EXAMPLES_NXFFS is not set +# CONFIG_EXAMPLES_NXFLAT is not set +# CONFIG_EXAMPLES_NXHELLO is not set +# CONFIG_EXAMPLES_NXIMAGE is not set +# CONFIG_EXAMPLES_NXLINES is not set +# CONFIG_EXAMPLES_NXTEXT is not set +# CONFIG_EXAMPLES_OSTEST is not set +# CONFIG_EXAMPLES_PASHELLO is not set +# CONFIG_EXAMPLES_PIPE is not set +# CONFIG_EXAMPLES_POLL is not set +# CONFIG_EXAMPLES_QENCODER is not set +# CONFIG_EXAMPLES_RGMP is not set +# CONFIG_EXAMPLES_ROMFS is not set +# CONFIG_EXAMPLES_SENDMAIL is not set +# CONFIG_EXAMPLES_SERLOOP is not set +# CONFIG_EXAMPLES_TELNETD is not set +# CONFIG_EXAMPLES_THTTPD is not set +# CONFIG_EXAMPLES_TIFF is not set +# CONFIG_EXAMPLES_TOUCHSCREEN is not set +# CONFIG_EXAMPLES_UDP is not set +# CONFIG_EXAMPLES_UIP is not set +# CONFIG_EXAMPLES_USBSERIAL is not set +# CONFIG_EXAMPLES_USBMSC is not set +# CONFIG_EXAMPLES_USBTERM is not set +# CONFIG_EXAMPLES_WATCHDOG is not set +# CONFIG_EXAMPLES_WLAN is not set + +# +# Interpreters +# + +# +# Interpreters +# +# CONFIG_INTERPRETERS_FICL is not set +# CONFIG_INTERPRETERS_PCODE is not set + +# +# Network Utilities +# + +# +# Networking Utilities +# +# CONFIG_NETUTILS_CODECS is not set +# CONFIG_NETUTILS_DHCPC is not set +# CONFIG_NETUTILS_DHCPD is not set +# CONFIG_NETUTILS_FTPC is not set +# CONFIG_NETUTILS_FTPD is not set +# CONFIG_NETUTILS_JSON is not set +# CONFIG_NETUTILS_RESOLV is not set +# CONFIG_NETUTILS_SMTP is not set +# CONFIG_NETUTILS_TELNETD is not set +# CONFIG_NETUTILS_TFTPC is not set +# CONFIG_NETUTILS_THTTPD is not set +# CONFIG_NETUTILS_UIPLIB is not set +# CONFIG_NETUTILS_WEBCLIENT is not set + +# +# ModBus +# + +# +# FreeModbus +# +# CONFIG_MODBUS is not set + +# +# NSH Library +# +# CONFIG_NSH_LIBRARY is not set + +# +# NxWidgets/NxWM +# + +# +# System NSH Add-Ons +# + +# +# Custom Free Memory Command +# +# CONFIG_SYSTEM_FREE is not set + +# +# I2C tool +# + +# +# FLASH Program Installation +# +# CONFIG_SYSTEM_INSTALL is not set + +# +# readline() +# +# CONFIG_SYSTEM_READLINE is not set + +# +# Power Off +# +# CONFIG_SYSTEM_POWEROFF is not set + +# +# RAMTRON +# +# CONFIG_SYSTEM_RAMTRON is not set + +# +# SD Card +# +# CONFIG_SYSTEM_SDCARD is not set + +# +# Sysinfo +# +# CONFIG_SYSTEM_SYSINFO is not set diff --git a/nuttx/configs/olimex-lpc1766stk/hidkbd/setenv.sh b/nuttx/configs/olimex-lpc1766stk/hidkbd/setenv.sh index af4a2589ee..6b51c10deb 100755 --- a/nuttx/configs/olimex-lpc1766stk/hidkbd/setenv.sh +++ b/nuttx/configs/olimex-lpc1766stk/hidkbd/setenv.sh @@ -50,7 +50,7 @@ fi # This is the Cygwin path to the location where I installed the CodeSourcery # toolchain under windows. You will also have to edit this if you install # the CodeSourcery toolchain in any other location -# export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/CodeSourcery/Sourcery G++ Lite/bin" +export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/CodeSourcery/Sourcery G++ Lite/bin" # These are the Cygwin paths to the locations where I installed the Atollic # toolchain under windows. You will also have to edit this if you install @@ -62,7 +62,7 @@ fi # This is the Cygwin path to the location where I build the buildroot # toolchain. -export TOOLCHAIN_BIN="${WD}/../misc/buildroot/build_arm_nofpu/staging_dir/bin" +# export TOOLCHAIN_BIN="${WD}/../misc/buildroot/build_arm_nofpu/staging_dir/bin" # The Olimex-lpc1766stk/tools directory export LPCTOOL_DIR="${WD}/configs/olimex-lpc1766stk/tools" diff --git a/nuttx/drivers/usbhost/Kconfig b/nuttx/drivers/usbhost/Kconfig index 35695d7501..de8469b41d 100644 --- a/nuttx/drivers/usbhost/Kconfig +++ b/nuttx/drivers/usbhost/Kconfig @@ -2,6 +2,7 @@ # For a description of the syntax of this configuration file, # see misc/tools/kconfig-language.txt. # + config USBHOST_NPREALLOC int "Number of pre-allocated class instances" default 4 @@ -29,64 +30,85 @@ config USBHOST_ISOC_DISABLE On some architectures, selecting this setting will reduce driver size by disabling isochronous endpoint support -config USBHOST_HIDKBD - bool "HID keyboad class support" +config USBHOST_MSC + bool "Mass Storage Class Support" default n - depends on !USBHOST_INT_DISABLE && SCHED_WORKQUEUE && !DISABLE_SIGNALS + depends on !BULK_DISABLE + ---help--- + Enable support for the keyboard class driver. This also depends on + NFILE_DESCRIPTORS > 0 && SCHED_WORKQUEUE=y + +config USBHOST_HIDKBD + bool "HID Keyboard Class Support" + default n + depends on !INT_DISABLE + ---help--- + Enable support for the keyboard class driver. This also depends on + SCHED_WORKQUEUE && !DISABLE_SIGNALS if USBHOST_HIDKBD config HIDKBD_POLLUSEC - bool "" - default n + int "Keyboard Poll Rate (MSEC)" + default 100000 ---help--- - Device poll rate in microseconds. Default: 100 milliseconds. + Device poll rate in microseconds. Default: 100,000 microseconds. config HIDKBD_DEFPRIO - bool "" - default n + int "Polling Thread Priority" + default 50 ---help--- Priority of the polling thread. Default: 50. config HIDKBD_STACKSIZE - bool "" - default n + int "Polling thread stack size" + default 1024 ---help--- Stack size for polling thread. Default: 1024 config HIDKBD_BUFSIZE - bool "" - default n + int "Scancode Buffer Size" + default 64 ---help--- Scancode buffer size. Default: 64. config HIDKBD_NPOLLWAITERS - bool "" - default n + int "Max Number of Waiters for Poll Event" + default 2 + depends on !DISABLE_POLL ---help--- If the poll() method is enabled, this defines the maximum number of threads that can be waiting for keyboard events. Default: 2. config HIDKBD_RAWSCANCODES - bool "" + bool "Use Raw Scan Codes" default n ---help--- - If set to y no conversion will be made on the raw keyboard scan - codes. Default: ASCII conversion. + If set to y no conversions will be made on the raw keyboard scan + codes. This option is useful during testing. Default: ASCII conversion. + +config HIDKBD_ENCODED + bool "Enocode Special Keys" + default n + depends on !HIDKBD_RAWSCANCODES + ---help--- + Encode special key press events in the user buffer. In this case, + the use end must decode the encoded special key values using the + interfaces defined in include/nuttx/input/kbd_codec.h. These + special keys include such things as up/down arrows, home and end + keys, etc. If this not defined, only 7-bit print-able and control + ASCII characters will be provided to the user. config HIDKBD_ALLSCANCODES - bool "" + bool "Use All Scancodes" default n ---help--- If set to y all 231 possible scancodes will be converted to something. Default: 104 key US keyboard. config HIDKBD_NODEBOUNCE - bool "" + bool "Disable Debounce" default n ---help--- If set to y normal debouncing is disabled. Default: Debounce enabled (No repeat keys). - USB host mass storage class driver. Requires USBHOST=y, - config USBHOST_BULK_DISABLE=n, NFILE_DESCRIPTORS > 0, - and SCHED_WORKQUEUE=y endif diff --git a/nuttx/drivers/usbhost/usbhost_hidkbd.c b/nuttx/drivers/usbhost/usbhost_hidkbd.c index e69d68e7b2..e0c4680ebb 100644 --- a/nuttx/drivers/usbhost/usbhost_hidkbd.c +++ b/nuttx/drivers/usbhost/usbhost_hidkbd.c @@ -1,7 +1,7 @@ /**************************************************************************** * drivers/usbhost/usbhost_hidkbd.c * - * Copyright (C) 2011 Gregory Nutt. All rights reserved. + * Copyright (C) 2011-2012 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -62,6 +62,11 @@ #include #include +#ifdef CONFIG_HIDKBD_ENCODED +# include +# include +#endif + /* Don't compile if prerequisites are not met */ #if defined(CONFIG_USBHOST) && !defined(CONFIG_USBHOST_INT_DISABLE) && CONFIG_NFILE_DESCRIPTORS > 0 @@ -126,6 +131,14 @@ # endif #endif +/* If we are using raw scancodes, then we cannot support encoding of + * special characters either. + */ + +#ifdef CONFIG_HIDKBD_RAWSCANCODES +# undef CONFIG_HIDKBD_ENCODED +#endif + /* Driver support ***********************************************************/ /* This format is used to construct the /dev/kbd[n] device driver path. It * defined here so that it will be used consistently in all places. @@ -144,6 +157,23 @@ #define USBHOST_MAX_CREFS 0x7fff +/* Debug ********************************************************************/ +/* Both CONFIG_DEBUG_INPUT and CONFIG_DEBUG_USB could apply to this file. + * We assume here that CONFIG_DEBUG_INPUT might be enabled separately, but + * CONFIG_DEBUG_USB implies both. + */ + +#ifndef CONFIG_DEBUG_INPUT +# undef idbg +# define idbg udbg +# undef illdbg +# define illdbg ulldbg +# undef ivdbg +# define ivdbg uvdbg +# undef illvdbg +# define illvdbg ullvdbg +#endif + /**************************************************************************** * Private Types ****************************************************************************/ @@ -209,6 +239,16 @@ struct usbhost_state_s uint8_t kbdbuffer[CONFIG_HIDKBD_BUFSIZE]; }; +/* This type is used for encoding special characters */ + +#ifdef CONFIG_HIDKBD_ENCODED +struct usbhost_outstream_s +{ + struct lib_outstream_s stream; + FAR struct usbhost_state_s *priv; +}; +#endif + /**************************************************************************** * Private Function Prototypes ****************************************************************************/ @@ -240,7 +280,15 @@ static inline void usbhost_mkdevname(FAR struct usbhost_state_s *priv, char *dev /* Keyboard polling thread */ static void usbhost_destroy(FAR void *arg); +static void usbhost_putbuffer(FAR struct usbhost_state_s *priv, uint8_t keycode); +#ifdef CONFIG_HIDKBD_ENCODED +static void usbhost_putstream(FAR struct lib_outstream_s *this, int ch); +#endif static inline uint8_t usbhost_mapscancode(uint8_t scancode, uint8_t modifier); +#ifdef CONFIG_HIDKBD_ENCODED +static inline void usbhost_encodescancode(FAR struct usbhost_state_s *priv, + uint8_t scancode, uint8_t modifier); +#endif static int usbhost_kbdpoll(int argc, char *argv[]); /* Helpers for usbhost_connect() */ @@ -346,6 +394,121 @@ static struct usbhost_state_s *g_priv; /* Data passed to thread */ */ #ifndef CONFIG_HIDKBD_RAWSCANCODES +#ifdef CONFIG_HIDKBD_ENCODED + +/* The first and last scancode values with encode-able values */ + +#define FIRST_ENCODING USBHID_KBDUSE_ENTER /* 0x28 Keyboard Return (ENTER) */ +#ifdef CONFIG_HIDKBD_ALLSCANCODES +# define LAST_ENCODING USBHID_KBDUSE_POWER /* 0x66 Keyboard Power */ +#else +#define LAST_ENCODING USBHID_KBDUSE_KPDHEXADECIMAL /* 0xdd Keypad Hexadecimal */ +#endif + +#define USBHID_NUMENCODINGS (LAST_ENCODING - FIRST_ENCODING + 1) + +static const uint8_t encoding[USBHID_NUMENCODINGS] = +{ + /* 0x28-0x2f: Enter,escape,del,back-tab,space,_,+,{ */ + + KEYCODE_ENTER, 0, KEYCODE_FWDDEL, KEYCODE_BACKDEL, 0, 0, 0, 0, + + /* 0x30-0x37: },|,Non-US tilde,:,",grave tidle,<,> */ + + 0, 0, 0, 0, 0, 0, 0, 0, + + /* 0x38-0x3f: /,CapsLock,F1,F2,F3,F4,F5,F6 */ + + 0, KEYCODE_CAPSLOCK, KEYCODE_F1, KEYCODE_F2, KEYCODE_F3, KEYCODE_F4, KEYCODE_F5, KEYCODE_F6, + + /* 0x40-0x47: F7,F8,F9,F10,F11,F12,PrtScn,ScrollLock */ + + KEYCODE_F7, KEYCODE_F8, KEYCODE_F9, KEYCODE_F10, KEYCODE_F11, KEYCODE_F12, KEYCODE_PRTSCRN, KEYCODE_SCROLLLOCK, + + /* 0x48-0x4f: Pause,Insert,Home,PageUp,DeleteForward,End,PageDown,RightArrow */ + + KEYCODE_PAUSE, KEYCODE_INSERT, KEYCODE_HOME, KEYCODE_PAGEUP, KEYCODE_FWDDEL, KEYCODE_END, KEYCODE_PAGEDOWN, KEYCODE_RIGHT, + + /* 0x50-0x57: LeftArrow,DownArrow,UpArrow,Num Lock,/,*,-,+ */ + + KEYCODE_LEFT, KEYCODE_DOWN, KEYCODE_UP, KEYCODE_NUMLOCK, 0, 0, 0, 0, + + /* 0x58-0x5f: Enter,1-7 */ + + KEYCODE_ENTER, 0, 0, 0, 0, 0, 0, 0, + + /* 0x60-0x66: 8-9,0,.,Non-US \,Application,Power */ + + 0, 0, 0, 0, 0, 0, KEYCODE_POWER, + +#ifdef CONFIG_HIDKBD_ALLSCANCODES + + 0, /* 0x67 = */ + + /* 0x68-0x6f: F13,F14,F15,F16,F17,F18,F19,F20 */ + + KEYCODE_F13, KEYCODE_F14, KEYCODE_F15, KEYCODE_F16, KEYCODE_F17, KEYCODE_F18, KEYCODE_F19, KEYCODE_F20, + + /* 0x70-0x77: F21,F22,F23,F24,Execute,Help,Menu,Select */ + + KEYCODE_F21, KEYCODE_F22, KEYCODE_F23, KEYCODE_F24, KEYCODE_EXECUTE, KEYCODE_HELP, KEYCODE_MENU, KEYCODE_SELECT, + + /* 0x78-0x7f: Stop,Again,Undo,Cut,Copy,Paste,Find,Mute */ + + KEYCODE_STOP, KEYCODE_AGAIN, KEYCODE_UNDO, KEYCODE_CUT, KEYCODE_COPY, KEYCODE_PASTE, KEYCODE_FIND, KEYCODE_MUTE, + + /* 0x80-0x87: VolUp,VolDown,LCapsLock,lNumLock,LScrollLock,,,=,International1 */ + + KEYCODE_VOLUP, KEYCODE_VOLDOWN, KEYCODE_LCAPSLOCK, KEYCODE_LNUMLOCK, KEYCODE_LSCROLLLOCK, 0, 0, 0, + + /* 0x88-0x8f: International 2-9 */ + + 0, 0, 0, 0, 0, 0, 0, 0, + + /* 0x90-0x97: LAN 1-8 */ + + KEYCODE_LANG1, KEYCODE_LANG2, KEYCODE_LANG3, KEYCODE_LANG4, KEYCODE_LANG5, KEYCODE_LANG6, KEYCODE_LANG7, KEYCODE_LANG8, + + /* 0x98-0x9f: LAN 9,Erase,SysReq,Cancel,Clear,Prior,Return,Separator */ + + 0, 0, KEYCODE_SYSREQ, KEYCODE_CANCEL, KEYCODE_CLEAR, 0, KEYCODE_ENTER, 0, + + /* 0xa0-0xa7: Out,Oper,Clear,CrSel,Excel,(reserved) */ + + 0, 0, 0, 0, 0, 0, 0, 0, + + /* 0xa8-0xaf: (reserved) */ + + 0, 0, 0, 0, 0, 0, 0, 0, + + /* 0xb0-0xb7: 00,000,ThouSeparator,DecSeparator,CurrencyUnit,SubUnit,(,) */ + + 0, 0, 0, 0, 0, 0, 0, 0, + + /* 0xb8-0xbf: {,},tab,backspace,A-D */ + + 0, 0, 0, KEYCODE_BACKDEL, 0, 0, 0, 0, + + /* 0xc0-0xc7: E-F,XOR,^,%,<,>,& */ + + 0, 0, 0, 0, 0, 0, 0, 0, + + /* 0xc8-0xcf: &&,|,||,:,#, ,@,! */ + + 0, 0, 0, 0, 0, 0, 0, 0, + + /* 0xd0-0xd7: Memory Store,Recall,Clear,Add,Subtract,Muliply,Divide,+/- */ + + KEYCODE_MEMSTORE, KEYCODE_MEMRECALL, KEYCODE_MEMCLEAR, KEYCODE_MEMADD, KEYCODE_MEMSUB, KEYCODE_MEMMUL, KEYCODE_MEMDIV, KEYCODE_NEGATE, + + /* 0xd8-0xdd: Clear,ClearEntry,Binary,Octal,Decimal,Hexadecimal */ + + KEYCODE_CLEAR, KEYCODE_CLEARENTRY, KEYCODE_BINARY, KEYCODE_OCTAL, KEYCODE_DECIMAL, KEYCODE_HEXADECIMAL +#endif +}; + +#endif + static const uint8_t ucmap[USBHID_NUMSCANCODES] = { 0, 0, 0, 0, 'A', 'B', 'C', 'D', /* 0x00-0x07: Reserved, errors, A-D */ @@ -356,7 +519,7 @@ static const uint8_t ucmap[USBHID_NUMSCANCODES] = '\n', '\033', '\177', 0, ' ', '_', '+', '{', /* 0x28-0x2f: Enter,escape,del,back-tab,space,_,+,{ */ '}', '|', 0, ':', '"', 0, '<', '>', /* 0x30-0x37: },|,Non-US tilde,:,",grave tidle,<,> */ '?', 0, 0, 0, 0, 0, 0, 0, /* 0x38-0x3f: /,CapsLock,F1,F2,F3,F4,F5,F6 */ - 0, 0, 0, 0, 0, 0, 0, 0, /* 0x40-0x47: F7,F8,F9,F10,F11,F12,PrtScn,sScrollLock */ + 0, 0, 0, 0, 0, 0, 0, 0, /* 0x40-0x47: F7,F8,F9,F10,F11,F12,PrtScn,ScrollLock */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x48-0x4f: Pause,Insert,Home,PageUp,DeleteForward,End,PageDown,RightArrow */ 0, 0, 0, 0, '/', '*', '-', '+', /* 0x50-0x57: LeftArrow,DownArrow,UpArrow,Num Lock,/,*,-,+ */ '\n', '1', '2', '3', '4', '4', '6', '7', /* 0x58-0x5f: Enter,1-7 */ @@ -368,7 +531,7 @@ static const uint8_t ucmap[USBHID_NUMSCANCODES] = 0, 0, 0, 0, 0, ',', 0, 0, /* 0x80-0x87: VolUp,VolDown,LCapsLock,lNumLock,LScrollLock,,,=,International1 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x88-0x8f: International 2-9 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x90-0x97: LAN 1-8 */ - 0, 0, 0, 0, 0, 0, '\n', 0, /* 0x98-0x9f: LAN 9,Ease,SysReq,Cancel,Clear,Prior,Return,Separator */ + 0, 0, 0, 0, 0, 0, '\n', 0, /* 0x98-0x9f: LAN 9,Erase,SysReq,Cancel,Clear,Prior,Return,Separator */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0xa0-0xa7: Out,Oper,Clear,CrSel,Excel,(reserved) */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0xa8-0xaf: (reserved) */ 0, 0, 0, 0, 0, 0, '(', ')', /* 0xb0-0xb7: 00,000,ThouSeparator,DecSeparator,CurrencyUnit,SubUnit,(,) */ @@ -403,7 +566,7 @@ static const uint8_t lcmap[USBHID_NUMSCANCODES] = 0, 0, 0, 0, 0, ',', 0, 0, /* 0x80-0x87: VolUp,VolDown,LCapsLock,lNumLock,LScrollLock,,,=,International1 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x88-0x8f: International 2-9 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x90-0x97: LAN 1-8 */ - 0, 0, 0, 0, 0, 0, '\n', 0, /* 0x98-0x9f: LAN 9,Ease,SysReq,Cancel,Clear,Prior,Return,Separator */ + 0, 0, 0, 0, 0, 0, '\n', 0, /* 0x98-0x9f: LAN 9,Erase,SysReq,Cancel,Clear,Prior,Return,Separator */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0xa0-0xa7: Out,Oper,Clear,CrSel,Excel,(reserved) */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0xa8-0xaf: (reserved) */ 0, 0, 0, 0, 0, 0, '(', ')', /* 0xb0-0xb7: 00,000,ThouSeparator,DecSeparator,CurrencyUnit,SubUnit,(,) */ @@ -637,6 +800,88 @@ static void usbhost_destroy(FAR void *arg) usbhost_freeclass(priv); } +/**************************************************************************** + * Name: usbhost_putbuffer + * + * Description: + * Add one character to the user buffer. + * + * Input Parameters: + * priv - Driver internal state + * keycode - The value to add to the user buffer + * + * Returned Values: + * None + * + ****************************************************************************/ + +static void usbhost_putbuffer(FAR struct usbhost_state_s *priv, + uint8_t keycode) +{ + register unsigned int head; + register unsigned int tail; + + /* Copy the next keyboard character into the user buffer. */ + + head = priv->headndx; + priv->kbdbuffer[head] = keycode; + + /* Increment the head index */ + + if (++head >= CONFIG_HIDKBD_BUFSIZE) + { + head = 0; + } + + /* If the buffer is full, then increment the tail index to make space. Is + * it better to lose old keystrokes or new? + */ + + tail = priv->tailndx; + if (tail == head) + { + if (++tail >= CONFIG_HIDKBD_BUFSIZE) + { + tail = 0; + } + + /* Save the updated tail index */ + + priv->tailndx = tail; + } + + /* Save the updated head index */ + + priv->headndx = head; +} + +/**************************************************************************** + * Name: usbhost_putstream + * + * Description: + * A wrapper for usbhost_putc that is compatibile with the lib_outstream_s + * putc methos. + * + * Input Parameters: + * stream - The struct lib_outstream_s reference + * ch - The character to add to the user buffer + * + * Returned Values: + * None + * + ****************************************************************************/ + +#ifdef CONFIG_HIDKBD_ENCODED +static void usbhost_putstream(FAR struct lib_outstream_s *stream, int ch) +{ + FAR struct usbhost_outstream_s *privstream = (FAR struct lib_outstream_s *)stream; + + DEBUGASSERT(privstream && privstream->priv); + usbhost_putbuffer(privstream->priv), (uint8_t)ch); + stream->nput++; +} +#endif + /**************************************************************************** * Name: usbhost_mapscancode * @@ -679,6 +924,58 @@ static inline uint8_t usbhost_mapscancode(uint8_t scancode, uint8_t modifier) #endif } +/**************************************************************************** + * Name: usbhost_encodescancode + * + * Description: + * Check if the key has a special function encoding and, if it does, add + * the encoded value to the user buffer. + * + * Input Parameters: + * priv - Driver internal state + * scancode - Scan code to be mapped. + * modifier - Ctrl,Alt,Shift,GUI modifier bits + * + * Returned Values: + * None + * + ****************************************************************************/ + +#ifdef CONFIG_HIDKBD_ENCODED +static inline void usbhost_encodescancode(FAR struct usbhost_state_s *priv, + uint8_t scancode, uint8_t modifier) +{ + struct usbhost_outstream_s stream; + uint8_t encoded; + + /* Check if the raw scancode is in a valid range */ + + if (scancode >= FIRST_ENCODING && scancode <= LAST_ENCODING) + { + /* Yes the value is within range */ + + encoded = encoding(scancode - FIRST_ENCODING); + ivdbg(" scancode: %02x modifier: %02x encoded: %d\n", + scancode, modifier, encoded); + + if (encoded) + { + struct usbhost_outstream_s usbstream; + + /* And it does correspond to a special function key */ + + usbstream->stream.put = usbhost_putstream; + usbstream->stream.nput = 0; + usbstream->priv = priv; + + /* Add the special function value to the user buffer */ + + kbd_putspecial((enum kbd_keycode_e)encoded, &usbstream); + } + } +} +#endif + /**************************************************************************** * Name: usbhost_kbdpoll * @@ -704,6 +1001,8 @@ static int usbhost_kbdpoll(int argc, char *argv[]) unsigned int npolls = 0; #endif unsigned int nerrors = 0; + bool empty = true; + bool newstate; int ret; uvdbg("Started\n"); @@ -717,13 +1016,13 @@ static int usbhost_kbdpoll(int argc, char *argv[]) * running. */ - priv = g_priv; - DEBUGASSERT(priv != NULL); + priv = g_priv; + DEBUGASSERT(priv != NULL); - priv->polling = true; - priv->crefs++; - usbhost_givesem(&g_syncsem); - sleep(1); + priv->polling = true; + priv->crefs++; + usbhost_givesem(&g_syncsem); + sleep(1); /* Loop here until the device is disconnected */ @@ -784,17 +1083,12 @@ static int usbhost_kbdpoll(int argc, char *argv[]) else if (priv->open) { struct usbhid_kbdreport_s *rpt = (struct usbhid_kbdreport_s *)priv->tbuffer; - unsigned int head; - unsigned int tail; - uint8_t ascii; + uint8_t keycode; int i; /* Add the newly received keystrokes to our internal buffer */ usbhost_takesem(&priv->exclsem); - head = priv->headndx; - tail = priv->tailndx; - for (i = 0; i < 6; i++) { /* Is this key pressed? But not pressed last time? @@ -828,15 +1122,15 @@ static int usbhost_kbdpoll(int argc, char *argv[]) * or cursor controls in this version of the driver. */ - ascii = usbhost_mapscancode(rpt->key[i], rpt->modifier); - uvdbg("Key %d: %02x ASCII:%c modifier: %02x\n", - i, rpt->key[i], ascii ? ascii : ' ', rpt->modifier); + keycode = usbhost_mapscancode(rpt->key[i], rpt->modifier); + ivdbg("Key %d: %02x keycode:%c modifier: %02x\n", + i, rpt->key[i], keycode ? keycode : ' ', rpt->modifier); /* Zero at this point means that the key does not map to a * printable character. */ - if (ascii != 0) + if (keycode != 0) { /* Handle control characters. Zero after this means * a valid, NUL character. @@ -844,36 +1138,28 @@ static int usbhost_kbdpoll(int argc, char *argv[]) if ((rpt->modifier & (USBHID_MODIFER_LCTRL|USBHID_MODIFER_RCTRL)) != 0) { - ascii &= 0x1f; + keycode &= 0x1f; } /* Copy the next keyboard character into the user * buffer. */ - priv->kbdbuffer[head] = ascii; - - /* Increment the head index */ - - if (++head >= CONFIG_HIDKBD_BUFSIZE) - { - head = 0; - } - - /* If the buffer is full, then increment the tail - * index to make space. Is it better to lose old - * keystrokes or new? - */ - - if (tail == head) - { - if (++tail >= CONFIG_HIDKBD_BUFSIZE) - { - tail = 0; - } - } + usbhost_putbuffer(priv, keycode); } + + /* The zero might, however, map to a special keyboard action (such as a + * cursor movement or function key). Attempt to encode the special key. + */ + +#ifdef CONFIG_HIDKBD_ENCODED + else + { + usbhost_encodescancode(priv, rpt->key[i], rpt->modifier)); + } +#endif } + /* Save the scancode (or lack thereof) for key debouncing on * next keyboard report. */ @@ -885,7 +1171,8 @@ static int usbhost_kbdpoll(int argc, char *argv[]) /* Did we just transition from no data available to data available? */ - if (head != tail && priv->headndx == priv->tailndx) + newstate = (priv->headndx == priv->tailndx); + if (empty && !newstate) { /* Yes.. Is there a thread waiting for keyboard data now? */ @@ -902,10 +1189,7 @@ static int usbhost_kbdpoll(int argc, char *argv[]) usbhost_pollnotify(priv); } - /* Update the head/tail indices */ - - priv->headndx = head; - priv->tailndx = tail; + empty = newstate; usbhost_givesem(&priv->exclsem); } @@ -958,6 +1242,7 @@ static int usbhost_kbdpoll(int argc, char *argv[]) usbhost_givesem(&priv->exclsem); } + return 0; } diff --git a/nuttx/include/nuttx/input/kbd_codec.h b/nuttx/include/nuttx/input/kbd_codec.h index b103d544ec..d374ed8d3a 100644 --- a/nuttx/include/nuttx/input/kbd_codec.h +++ b/nuttx/include/nuttx/input/kbd_codec.h @@ -113,7 +113,7 @@ enum kbd_keycode_e KEYCODE_PAUSE, /* Pause */ KEYCODE_BREAK, /* Break */ KEYCODE_CANCEL, /* Cancel */ - KEYCODE_PRINTSCN, /* PrintScreen */ + KEYCODE_PRTSCRN, /* PrintScreen */ KEYCODE_SYSREQ, /* SysReq/Attention */ /* Audio */ @@ -131,14 +131,15 @@ enum kbd_keycode_e KEYCODE_CLEAR, /* Clear */ KEYCODE_CLEARENTRY, /* Clear entry */ + KEYCODE_NEGATE, /* +/- */ - KEYCODE_MEMSET, /* Memory set */ + KEYCODE_MEMSTORE, /* Memory store */ KEYCODE_MEMCLEAR, /* Memory clear */ KEYCODE_MEMRECALL, /* Memory recall */ KEYCODE_MEMADD, /* Memory add */ - KEYCODE_MEMSUBTRACT, /* Memory substract */ - KEYCODE_MEMMULTIPY, /* Memory multiply */ - KEYCODE_MEMDIVIDE, /* Memory divide */ + KEYCODE_MEMSUB, /* Memory substract */ + KEYCODE_MEMMUL, /* Memory multiply */ + KEYCODE_MEMDIV, /* Memory divide */ KEYCODE_BINARY, /* Binary mode */ KEYCODE_OCTAL, /* Octal mode */ @@ -197,7 +198,7 @@ enum kbd_keycode_e * Public Types ****************************************************************************/ -struct kget_getstate_s +struct kbd_getstate_s { uint8_t nch; /* Number of characters in the buffer */ uint8_t ndx; /* Index to next character in the buffer */ @@ -225,7 +226,7 @@ extern "C" * Put one byte of normal, "in-band" ASCII data into the output stream. * * Input Parameters: - * ch - The character to be into the output stream. + * ch - The character to be added to the output stream. * stream - An instance of lib_outstream_s to do the low-level put * operation. * @@ -243,6 +244,9 @@ extern "C" * Put one special, "out-of-band" command into the output stream. * * Input Parameters: + * keycode - The command to be added to the output stream. + * stream - An instance of lib_outstream_s to do the low-level put + * operation. * * Returned Value: * None @@ -261,7 +265,7 @@ void kbd_putspecial(enum kbd_keycode_e keycode, * Name: kbd_get * * Description: - * Put one byte of data or special command from the driver provided input + * Get one byte of data or special command from the driver provided input * buffer. * * Input Parameters: @@ -274,15 +278,17 @@ void kbd_putspecial(enum kbd_keycode_e keycode, * should be cleared the first time that kbd_get is called. * * Returned Value: - * 1 - Indicates the successful receipt of a special, "out-of-band" command + * 1 - Indicates the successful receipt of a special, "out-of-band" command. + * The returned value in pch is a value from enum kbd_getstate_s. * 0 - Indicates the successful receipt of normal, "in-band" ASCII data. + * The returned value in pch is a simple byte of text or control data. * EOF - An error has getting the next character (reported by the stream). * Normally indicates the end of file. * ****************************************************************************/ int kbd_get(FAR struct lib_instream_s *stream, - FAR struct kget_getstate_s *state, FAR uint8_t *pch); + FAR struct kbd_getstate_s *state, FAR uint8_t *pch); #ifdef __cplusplus } diff --git a/nuttx/libc/misc/lib_kbddecode.c b/nuttx/libc/misc/lib_kbddecode.c index 046d570f90..cb57b52150 100644 --- a/nuttx/libc/misc/lib_kbddecode.c +++ b/nuttx/libc/misc/lib_kbddecode.c @@ -89,7 +89,7 @@ * ****************************************************************************/ -static int kbd_reget(FAR struct kget_getstate_s *state, FAR uint8_t *pch) +static int kbd_reget(FAR struct kbd_getstate_s *state, FAR uint8_t *pch) { /* Return the next character */ @@ -107,7 +107,7 @@ static int kbd_reget(FAR struct kget_getstate_s *state, FAR uint8_t *pch) * Name: kbd_get * * Description: - * Put one byte of data or special command from the driver provided input + * Get one byte of data or special command from the driver provided input * buffer. * * Input Parameters: @@ -120,15 +120,17 @@ static int kbd_reget(FAR struct kget_getstate_s *state, FAR uint8_t *pch) * should be cleared the first time that kbd_get is called. * * Returned Value: - * 1 - Indicates the successful receipt of a special, "out-of-band" command + * 1 - Indicates the successful receipt of a special, "out-of-band" command. + * The returned value in pch is a value from enum kbd_getstate_s. * 0 - Indicates the successful receipt of normal, "in-band" ASCII data. + * The returned value in pch is a simple byte of text or control data. * EOF - An error has getting the next character (reported by the stream). * Normally indicates the end of file. * ****************************************************************************/ int kbd_get(FAR struct lib_instream_s *stream, - FAR struct kget_getstate_s *state, FAR uint8_t *pch) + FAR struct kbd_getstate_s *state, FAR uint8_t *pch) { int ch; diff --git a/nuttx/libc/misc/lib_kbdencode.c b/nuttx/libc/misc/lib_kbdencode.c index 80bf147777..40a8805b11 100644 --- a/nuttx/libc/misc/lib_kbdencode.c +++ b/nuttx/libc/misc/lib_kbdencode.c @@ -62,6 +62,9 @@ * Put one special, "out-of-band" command into the output stream. * * Input Parameters: + * keycode - The command to be added to the output stream. + * stream - An instance of lib_outstream_s to do the low-level put + * operation. * * Returned Value: * None From 8ed19bb07d00a15e2f2c9893d57b1ef1261b2d23 Mon Sep 17 00:00:00 2001 From: patacongo Date: Wed, 26 Dec 2012 20:04:57 +0000 Subject: [PATCH 015/118] Add UG_2965SWEG01 driver from Darcy Gong; fix logic error in how waiters are reawakened in the USB HID keyboard driver git-svn-id: http://svn.code.sf.net/p/nuttx/code/trunk@5462 42af7a65-404d-4744-a932-0658087f49c3 --- apps/examples/hidkbd/hidkbd_main.c | 1 + nuttx/ChangeLog | 6 + nuttx/configs/stm32f4discovery/README.txt | 2 +- nuttx/configs/stm32f4discovery/src/Makefile | 4 + .../src/stm32f4discovery-internal.h | 4 +- .../stm32f4discovery/src/up_ug2864hsweg01.c | 161 +++ nuttx/drivers/lcd/Make.defs | 4 + nuttx/drivers/lcd/ug-2864hsweg01.c | 1177 +++++++++++++++++ nuttx/drivers/usbhost/usbhost_hidkbd.c | 16 +- nuttx/include/nuttx/lcd/ug-2864hsweg01.h | 245 ++++ 10 files changed, 1613 insertions(+), 7 deletions(-) create mode 100644 nuttx/configs/stm32f4discovery/src/up_ug2864hsweg01.c create mode 100644 nuttx/drivers/lcd/ug-2864hsweg01.c create mode 100644 nuttx/include/nuttx/lcd/ug-2864hsweg01.h diff --git a/apps/examples/hidkbd/hidkbd_main.c b/apps/examples/hidkbd/hidkbd_main.c index bc1eebed0b..8c9f6fa95f 100644 --- a/apps/examples/hidkbd/hidkbd_main.c +++ b/apps/examples/hidkbd/hidkbd_main.c @@ -227,5 +227,6 @@ int hidkbd_main(int argc, char *argv[]) close(fd); } } + return 0; } diff --git a/nuttx/ChangeLog b/nuttx/ChangeLog index 7e1c538d72..a7087656ae 100644 --- a/nuttx/ChangeLog +++ b/nuttx/ChangeLog @@ -3826,4 +3826,10 @@ encode special function keys. * configs/olimex-lpc1766stk/hidkbd: This configuration has been converted to use the kconfig-frontends configuration tool. + * drivers/lcd/ug-2864hsweg01.c and include/nuttx/lcd/ug-2864hsweg01.h: + Driver for UG-2864HSWEG01 OLED contributed by Darcy Gong. + * configs/stm32f4discovery/src/up_ug2864hsweg01.c: Support for the + UG-2864HSWEG01 OLED for the STM32F4Discovery board. + * drivers/usbhost/usbhost_hidkbd.c: Correct a logic error in how + tasks waiting for read data are awakened. diff --git a/nuttx/configs/stm32f4discovery/README.txt b/nuttx/configs/stm32f4discovery/README.txt index d824668cef..37dae7b9ea 100644 --- a/nuttx/configs/stm32f4discovery/README.txt +++ b/nuttx/configs/stm32f4discovery/README.txt @@ -711,7 +711,7 @@ pinout for the UG-2864AMBAG01 is specific to the theO.net display board that I am using: --------------------------+---------------------------------------------- - Connector CON10 J1: | STM32F4Discovery + Connector CON10 J1: | STM32F4Discovery --------------+-----------+---------------------------------------------- CON10 J1: | CON20 J2: | P1/P2: --------------+-----------+---------------------------------------------- diff --git a/nuttx/configs/stm32f4discovery/src/Makefile b/nuttx/configs/stm32f4discovery/src/Makefile index 68419e5d0e..7ac27a7d0a 100644 --- a/nuttx/configs/stm32f4discovery/src/Makefile +++ b/nuttx/configs/stm32f4discovery/src/Makefile @@ -100,6 +100,10 @@ ifeq ($(CONFIG_LCD_UG2864AMBAG01),y) CSRCS += up_ug2864ambag01.c endif +ifeq ($(CONFIG_LCD_UG2864HSWEG01),y) +CSRCS += up_ug2864hsweg01.c +endif + COBJS = $(CSRCS:.c=$(OBJEXT)) SRCS = $(ASRCS) $(CSRCS) diff --git a/nuttx/configs/stm32f4discovery/src/stm32f4discovery-internal.h b/nuttx/configs/stm32f4discovery/src/stm32f4discovery-internal.h index 00f17b58e9..eae09594c5 100644 --- a/nuttx/configs/stm32f4discovery/src/stm32f4discovery-internal.h +++ b/nuttx/configs/stm32f4discovery/src/stm32f4discovery-internal.h @@ -113,7 +113,7 @@ # define GPIO_OTGFS_OVER (GPIO_INPUT|GPIO_FLOAT|GPIO_SPEED_100MHz|GPIO_PUSHPULL|GPIO_PORTD|GPIO_PIN5) #endif -/* UG-2864AMBAG01 OLED Display: +/* UG-2864AMBAG01 or UG-2864HSWEG01 OLED Display: * * --------------------------+---------------------------------------------- * Connector CON10 J1: | STM32F4Discovery @@ -135,7 +135,7 @@ * ------------------------------------------------------------------------- */ -#ifdef CONFIG_LCD_UG2864AMBAG01 +#if defined(CONFIG_LCD_UG2864AMBAG01) || defined(CONFIG_LCD_UG2864HSWEG01) # define GPIO_OLED_RESET (GPIO_OUTPUT|GPIO_PUSHPULL|GPIO_SPEED_50MHz|\ GPIO_OUTPUT_CLEAR|GPIO_PORTB|GPIO_PIN6) # define GPIO_OLED_CS (GPIO_OUTPUT|GPIO_PUSHPULL|GPIO_SPEED_50MHz|\ diff --git a/nuttx/configs/stm32f4discovery/src/up_ug2864hsweg01.c b/nuttx/configs/stm32f4discovery/src/up_ug2864hsweg01.c new file mode 100644 index 0000000000..4eee077a14 --- /dev/null +++ b/nuttx/configs/stm32f4discovery/src/up_ug2864hsweg01.c @@ -0,0 +1,161 @@ +/**************************************************************************** + * config/stm32f4discovery/src/up_ug2864hsweg01.c + * arch/arm/src/board/up_ug2864hsweg01.c + * + * Copyright (C) 2012 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * 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. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include + +#include +#include +#include + +#include "stm32_gpio.h" +#include "stm32f4discovery-internal.h" + +#ifdef CONFIG_LCD_UG2864HSWEG01 + +/**************************************************************************** + * Pre-Processor Definitions + ****************************************************************************/ +/* Configuration ************************************************************/ +/* The pin configurations here require that SPI1 is selected */ + +#ifndef CONFIG_STM32_SPI1 +# error "The OLED driver requires CONFIG_STM32_SPI1 in the configuration" +#endif + +#ifndef CONFIG_SPI_CMDDATA +# error "The OLED driver requires CONFIG_SPI_CMDDATA in the configuration" +#endif + +/* Pin Configuration ********************************************************/ +/* UG-2864AMBAG01 or UG-2864HSWEG01 OLED Display: + * + * --------------------------+---------------------------------------------- + * Connector CON10 J1: | STM32F4Discovery + * --------------+-----------+---------------------------------------------- + * CON10 J1: | CON20 J2: | P1/P2: + * --------------+-----------+---------------------------------------------- + * 1 3v3 | 3,4 3v3 | P2 3V + * 3 /RESET | 8 /RESET | P2 PB6 (Arbitrary selection) + * 5 /CS | 7 /CS | P2 PB7 (Arbitrary selection)(2) + * 7 A0 | 9 A0 | P2 PB8 (Arbitrary selection)(2) + * 9 LED+ (N/C) | ----- | ----- + * 2 5V Vcc | 1,2 Vcc | P2 5V + * 4 DI | 18 D1/SI | P1 PA7 (GPIO_SPI1_MOSI == GPIO_SPI1_MOSI_1 (1)) + * 6 SCLK | 19 D0/SCL | P1 PA5 (GPIO_SPI1_SCK == GPIO_SPI1_SCK_1 (2)) + * 8 LED- (N/C) | ----- | ------ + * 10 GND | 20 GND | P2 GND + * --------------+-----------+---------------------------------------------- + * (1) Required because of on-board MEMS + * (2) Note that the OLED CS and A0 are managed in the up_spi.c file. + * ------------------------------------------------------------------------- + */ + +/* Definitions in stm32f4discovery-internal.h */ + +/* Debug ********************************************************************/ + +#ifdef CONFIG_DEBUG_LCD +# define lcddbg(format, arg...) dbg(format, ##arg) +# define lcdvdbg(format, arg...) vdbg(format, ##arg) +#else +# define lcddbg(x...) +# define lcdvdbg(x...) +#endif + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: up_nxdrvinit + * + * Description: + * Called by NX initialization logic to configure the OLED. + * + ****************************************************************************/ + +FAR struct lcd_dev_s *up_nxdrvinit(unsigned int devno) +{ + FAR struct spi_dev_s *spi; + FAR struct lcd_dev_s *dev; + + /* Configure the OLED GPIOs. This initial configuration is RESET low, + * putting the OLED into reset state. + */ + + (void)stm32_configgpio(GPIO_OLED_RESET); + + /* Wait a bit then release the OLED from the reset state */ + + up_mdelay(20); + stm32_gpiowrite(GPIO_OLED_RESET, true); + + /* Get the SPI1 port interface */ + + spi = up_spiinitialize(1); + if (!spi) + { + lcddbg("Failed to initialize SPI port 1\n"); + } + else + { + /* Bind the SPI port to the OLED */ + + dev = ug2864hsweg01_initialize(spi, devno); + if (!dev) + { + lcddbg("Failed to bind SPI port 1 to OLED %d: %d\n", devno); + } + else + { + lcdvdbg("Bound SPI port 1 to OLED %d\n", devno); + + /* And turn the OLED on */ + + (void)dev->setpower(dev, CONFIG_LCD_MAXPOWER); + return dev; + } + } + + return NULL; +} +#endif /* CONFIG_LCD_UG2864AMBAG01 */ diff --git a/nuttx/drivers/lcd/Make.defs b/nuttx/drivers/lcd/Make.defs index 1b445b6a78..067f76f4e3 100644 --- a/nuttx/drivers/lcd/Make.defs +++ b/nuttx/drivers/lcd/Make.defs @@ -51,6 +51,10 @@ ifeq ($(CONFIG_LCD_UG2864AMBAG01),y) CSRCS += ug-2864ambag01.c endif +ifeq ($(CONFIG_LCD_UG2864HSWEG01),y) + CSRCS += ug-2864hsweg01.c +endif + ifeq ($(CONFIG_LCD_UG9664HSWAG01),y) CSRCS += ug-9664hswag01.c endif diff --git a/nuttx/drivers/lcd/ug-2864hsweg01.c b/nuttx/drivers/lcd/ug-2864hsweg01.c new file mode 100644 index 0000000000..9f9f999066 --- /dev/null +++ b/nuttx/drivers/lcd/ug-2864hsweg01.c @@ -0,0 +1,1177 @@ +/************************************************************************************** + * drivers/lcd/ug-2864hsweg01.c + * Driver for Univision UG-2864HSWEG01 OLED display (wih SSD1306 controller) in SPI + * mode + * + * Copyright (C) 2012 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * References: + * 1. Product Specification (Preliminary), Part Name: OEL Display Module, Part ID: + * UG-2864HSWEG01, Doc No: SAS1-9046-B, Univision Technology Inc. + * 2. SSD1306, 128 X 64 Dot Matrix OLED/PLED, Preliminary Segment/Common Driver with + * Controller, Solomon Systech + * + * 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. + * + **************************************************************************************/ +/************************************************************************************** + * Device memory organization: + * + * +----------------------------+ + * | Column | + * --------+----+---+---+---+-...-+-----+ + * Page | 0 | 1 | 2 | 3 | ... | 127 | + * --------+----+---+---+---+-...-+-----+ + * Page 0 | D0 | X | | | | | + * | D1 | X | | | | | + * | D2 | X | | | | | + * | D3 | X | | | | | + * | D4 | X | | | | | + * | D5 | X | | | | | + * | D6 | X | | | | | + * | D7 | X | | | | | + * --------+----+---+---+---+-...-+-----+ + * Page 1 | | | | | | | + * --------+----+---+---+---+-...-+-----+ + * Page 2 | | | | | | | + * --------+----+---+---+---+-...-+-----+ + * Page 3 | | | | | | | + * --------+----+---+---+---+-...-+-----+ + * Page 4 | | | | | | | + * --------+----+---+---+---+-...-+-----+ + * Page 5 | | | | | | | + * --------+----+---+---+---+-...-+-----+ + * Page 6 | | | | | | | + * --------+----+---+---+---+-...-+-----+ + * Page 7 | | | | | | | + * --------+----+---+---+---+-...-+-----+ + * + * -----------------------------------+--------------------------------------- + * Landscape Display: | Reverse Landscape Display: + * --------+-----------------------+ | --------+---------------------------+ + * | Column | | | Column | + * --------+---+---+---+-...-+-----+ | --------+-----+-----+-----+-...-+---+ + * Page 0 | 0 | 1 | 2 | | 127 | | Page 7 | 127 | 126 | 125 | | 0 | + * --------+---+---+---+-...-+-----+ | --------+-----+-----+-----+-...-+---+ + * Page 1 | V | | Page 6 | ^ | + * --------+---+---+---+-...-+-----+ | --------+-----+-----+-----+-...-+---+ + * Page 2 | V | | Page 5 | ^ | + * --------+---+---+---+-...-+-----+ | --------+-----+-----+-----+-...-+---+ + * Page 3 | V | | Page 4 | ^ | + * --------+---+---+---+-...-+-----+ | --------+-----+-----+-----+-...-+---+ + * Page 4 | V | | Page 3 | ^ | + * --------+---+---+---+-...-+-----+ | --------+-----+-----+-----+-...-+---+ + * Page 5 | V | | Page 2 | ^ | + * --------+---+---+---+-...-+-----+ | --------+-----+-----+-----+-...-+---+ + * Page 6 | V | | Page 1 | ^ | + * --------+---+---+---+-...-+-----+ | --------+-----+-----+-----+-...-+---+ + * Page 7 | V | | Page 0 | ^ | + * --------+---+---+---+-...-+-----+ | --------+-----+-----+-----+-...-+---+ + * -----------------------------------+--------------------------------------- + * + * -----------------------------------+--------------------------------------- + * Portrait Display: | Reverse Portrait Display: + * -----------+---------------------+ | -----------+---------------------+ + * | Page | | | Page | + * -----------+---+---+---+-...-+---+ | -----------+---+---+---+-...-+---+ + * Column 0 | 0 | 1 | 2 | | 7 | | Column 127 | 7 | 6 | 5 | | 0 | + * -----------+---+---+---+-...-+---+ | -----------+---+---+---+-...-+---+ + * Column 1 | > > > > > | | Column 126 | | + * -----------+---+---+---+-...-+---+ | -----------+---+---+---+-...-+---+ + * Column 2 | | | Column 125 | | + * -----------+---+---+---+-...-+---+ | -----------+---+---+---+-...-+---+ + * ... | | | ... | | + * -----------+---+---+---+-...-+---+ | -----------+---+---+---+-...-+---+ + * Column 127 | | | Column 0 | < < < < < | + * -----------+---+---+---+-...-+---+ | -----------+---+---+---+-...-+---+ + * -----------------------------------+---------------------------------------- + **************************************************************************************/ + +/************************************************************************************** + * Included Files + **************************************************************************************/ + +#include + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include + +#ifdef CONFIG_LCD_UG2864HSWEG01 + +/************************************************************************************** + * Pre-processor Definitions + **************************************************************************************/ +/* Configuration **********************************************************************/ +/* Limitations of the current configuration that I hope to fix someday */ + +#if CONFIG_UG2864HSWEG01_NINTERFACES != 1 +# warning "This implementation supports only a single OLED device" +# undef CONFIG_UG2864HSWEG01_NINTERFACES +# define CONFIG_UG2864HSWEG01_NINTERFACES 1 +#endif + +#if defined(CONFIG_LCD_PORTRAIT) || defined(CONFIG_LCD_RPORTRAIT) +# warning "No support yet for portrait modes" +# define CONFIG_LCD_LANDSCAPE 1 +# undef CONFIG_LCD_PORTRAIT +# undef CONFIG_LCD_RLANDSCAPE +# undef CONFIG_LCD_RPORTRAIT +#elif defined(CONFIG_LCD_RLANDSCAPE) +# warning "Reverse landscape mode is untested and, hence, probably buggy" +#endif + +/* SSD1306 Commands *******************************************************************/ + +#define SSD1306_SETCOLL(ad) (0x00 | ((ad) & 0x0f)) /* Set Lower Column Address: (00h - 0fh) */ +#define SSD1306_SETCOLH(ad) (0x10 | ((ad) & 0x0f)) /* Set Higher Column Address: (10h - 1fh) */ +#define SSD1306_STARTLINE(ln) (0x40 | ((ln) & 0x3f)) /* Set Display Start Line: (40h - 7fh) */ +#define SSD1306_CONTRAST_MODE (0x81) /* Set Contrast Control Register: (Double Bytes Command) */ +# define SSD1306_CONTRAST(c) (c) +#define SSD1306_SEGREMAP(m) (0xa0 | ((m) & 0x01)) /* Set Segment Re-map: (a0h - a1h) */ +# define SSD1306_REMAPRIGHT SSD1306_SEGREMAP(0) /* Right rotation */ +# define SSD1306_REMAPPLEFT SSD1306_SEGREMAP(1) /* Left rotation */ +#define SSD1306_EDISPOFFON(s) (0xa4 | ((s) & 0x01)) /* Set Entire Display OFF/ON: (a4h - a5h) */ +# define SSD1306_EDISPOFF SSD1306_EDISPOFFON(0) /* Display off */ +# define SSD1306_EDISPON SSD1306_EDISPOFFON(1) /* Display on */ +#define SSD1306_NORMREV(s) (0xa6 | ((s) & 0x01)) /* Set Normal/Reverse Display: (a6h -a7h) */ +# define SSD1306_NORMAL SSD1306_NORMREV(0) /* Normal display */ +# define SSD1306_REVERSE SSD1306_NORMREV(1) /* Reverse display */ +#define SSD1306_MRATIO_MODE (0xa8) /* Set Multiplex Ration: (Double Bytes Command) */ +# define SSD1306_MRATIO(d) ((d) & 0x3f) +#define SSD1306_DCDC_MODE (0xad) /* Set DC-DC OFF/ON: (Double Bytes Command) */ +# define SSD1306_DCDC_OFF (0x8a) +# define SSD1306_DCDC_ON (0x8b) + +#define SSD1306_DISPOFFON(s) (0xae | ((s) & 0x01)) /* Display OFF/ON: (aeh - afh) */ +# define SSD1306_DISPOFF SSD1306_DISPOFFON(0) /* Display off */ +# define SSD1306_DISPON SSD1306_DISPOFFON(1) /* Display on */ +#define SSD1306_PAGEADDR(a) (0xb0 | ((a) & 0x0f)) /* Set Page Address: (b0h - b7h) */ +#define SSD1306_SCANDIR(d) (0xc0 | ((d) & 0x08)) /* Set Common Output Scan Direction: (c0h - c8h) */ +# define SSD1306_SCANFROMCOM0 SSD1306_SCANDIR(0x00) /* Scan from COM[0] to COM[n-1]*/ +# define SSD1306_SCANTOCOM0 SSD1306_SCANDIR(0x08) /* Scan from COM[n-1] to COM[0] */ +#define SSD1306_DISPOFFS_MODE (0xd3) /* Set Display Offset: (Double Bytes Command) */ +# define SSD1306_DISPOFFS(o) ((o) & 0x3f) +#define SSD1306_CLKDIV_SET (0xd5) /* Set Display Clock Divide Ratio/Oscillator Frequency: (Double Bytes Command) */ +# define SSD1306_CLKDIV(f,d) ((((f) & 0x0f) << 4) | ((d) & 0x0f)) +#define SSD1306_CHRGPER_SET (0xd9) /* Set Dis-charge/Pre-charge Period: (Double Bytes Command) */ +# define SSD1306_CHRGPER(d,p) ((((d) & 0x0f) << 4) | ((p) & 0x0f)) +#define SSD1306_CMNPAD_CONFIG (0xda) /* Set Common pads hardware configuration: (Double Bytes Command) */ +# define SSD1306_CMNPAD(c) ((0x02) | ((c) & 0x10)) +#define SSD1306_VCOM_SET (0xdb) /* Set VCOM Deselect Level: (Double Bytes Command) */ +# define SSD1306_VCOM(v) (v) + +#define SSD1306_CHRPUMP_SET (0x8d) /* Charge Pump Setting */ +# define SSD1306_CHRPUMP_ON (0x14) +# define SSD1306_CHRPUMP_OFF (0x10) + +#define SSD1306_RMWSTART (0xe0) /* Read-Modify-Write: (e0h) */ +#define SSD1306_NOP (0xe3) /* NOP: (e3h) */ +#define SSD1306_END (0xee) /* End: (eeh) */ + +#define SSD1306_WRDATA(d) (d) /* Write Display Data */ +#define SSD1306_STATUS_BUSY (0x80) /* Read Status */ +#define SSD1306_STATUS_ONOFF (0x40) +#define SSD1306_RDDATA(d) (d) /* Read Display Data */ + +/* Color Properties *******************************************************************/ +/* Display Resolution + * + * The SSD1306 display controller can handle a resolution of 132x64. The UG-2864HSWEG01 + * on the base board is 128x64. + */ + +#define UG2864HSWEG01_DEV_XRES 128 /* Only 128 of 131 columns used */ +#define UG2864HSWEG01_DEV_YRES 64 /* 8 pages each 8 rows */ +#define UG2864HSWEG01_DEV_XOFFSET 2 /* Offset to logical column 0 */ +#define UG2864HSWEG01_DEV_PAGES 8 /* 8 pages */ + +#if defined(CONFIG_LCD_LANDSCAPE) || defined(CONFIG_LCD_RLANDSCAPE) +# define UG2864HSWEG01_XRES UG2864HSWEG01_DEV_XRES +# define UG2864HSWEG01_YRES UG2864HSWEG01_DEV_YRES +#else +# define UG2864HSWEG01_XRES UG2864HSWEG01_DEV_YRES +# define UG2864HSWEG01_YRES UG2864HSWEG01_DEV_XRES +#endif + +/* Color depth and format */ + +#define UG2864HSWEG01_BPP 1 +#define UG2864HSWEG01_COLORFMT FB_FMT_Y1 + +/* Bytes per logical row and actual device row */ + +#define UG2864HSWEG01_XSTRIDE (UG2864HSWEG01_XRES >> 3) +#define UG2864HSWEG01_YSTRIDE (UG2864HSWEG01_YRES >> 3) + +/* Default contrast */ + +#define UG2864HSWEG01_CONTRAST (128) + +/* The size of the shadow frame buffer or one row buffer. + * + * Frame buffer size: 128 columns x 64 rows / 8 bits-per-pixel + * Row size: 128 columns x 8 rows-per-page / 8 bits-per-pixel + */ + +#define UG2864HSWEG01_FBSIZE (UG2864HSWEG01_XSTRIDE * UG2864HSWEG01_YRES) +#define UG2864HSWEG01_ROWSIZE (UG2864HSWEG01_XSTRIDE) + +/* Bit helpers */ + +#define LS_BIT (1 << 0) +#define MS_BIT (1 << 7) + +/* Debug ******************************************************************************/ + +#ifdef CONFIG_DEBUG_LCD +# define lcddbg(format, arg...) dbg(format, ##arg) +# define lcdvdbg(format, arg...) vdbg(format, ##arg) +#else +# define lcddbg(x...) +# define lcdvdbg(x...) +#endif + +/************************************************************************************** + * Private Type Definition + **************************************************************************************/ + +/* This structure describes the state of this driver */ + +struct ug2864hsweg01_dev_s +{ + struct lcd_dev_s dev; /* Publically visible device structure */ + + /* Private LCD-specific information follows */ + + FAR struct spi_dev_s *spi; /* Cached SPI device reference */ + uint8_t contrast; /* Current contrast setting */ + bool on; /* true: display is on */ + + + /* The SSD1306 does not support reading from the display memory in SPI mode. + * Since there is 1 BPP and access is byte-by-byte, it is necessary to keep + * a shadow copy of the framebuffer memory. At 128x64, this amounts to 1KB. + */ + + uint8_t fb[UG2864HSWEG01_FBSIZE]; +}; + +/************************************************************************************** + * Private Function Protototypes + **************************************************************************************/ + +/* Low-level SPI helpers */ + +#ifdef CONFIG_SPI_OWNBUS +static inline void ug2864hsweg01_configspi(FAR struct spi_dev_s *spi); +# define ug2864hsweg01_lock(spi) +# define ug2864hsweg01_unlock(spi) +#else +# define ug2864hsweg01_configspi(spi) +static void ug2864hsweg01_lock(FAR struct spi_dev_s *spi); +static void ug2864hsweg01_unlock(FAR struct spi_dev_s *spi); +#endif + +/* LCD Data Transfer Methods */ + +static int ug2864hsweg01_putrun(fb_coord_t row, fb_coord_t col, + FAR const uint8_t *buffer, size_t npixels); +static int ug2864hsweg01_getrun(fb_coord_t row, fb_coord_t col, FAR uint8_t *buffer, + size_t npixels); + +/* LCD Configuration */ + +static int ug2864hsweg01_getvideoinfo(FAR struct lcd_dev_s *dev, + FAR struct fb_videoinfo_s *vinfo); +static int ug2864hsweg01_getplaneinfo(FAR struct lcd_dev_s *dev, unsigned int planeno, + FAR struct lcd_planeinfo_s *pinfo); + +/* LCD RGB Mapping */ + +#ifdef CONFIG_FB_CMAP +# error "RGB color mapping not supported by this driver" +#endif + +/* Cursor Controls */ + +#ifdef CONFIG_FB_HWCURSOR +# error "Cursor control not supported by this driver" +#endif + +/* LCD Specific Controls */ + +static int ug2864hsweg01_getpower(struct lcd_dev_s *dev); +static int ug2864hsweg01_setpower(struct lcd_dev_s *dev, int power); +static int ug2864hsweg01_getcontrast(struct lcd_dev_s *dev); +static int ug2864hsweg01_setcontrast(struct lcd_dev_s *dev, unsigned int contrast); + +/************************************************************************************** + * Private Data + **************************************************************************************/ + +/* This is working memory allocated by the LCD driver for each LCD device + * and for each color plane. This memory will hold one raster line of data. + * The size of the allocated run buffer must therefore be at least + * (bpp * xres / 8). Actual alignment of the buffer must conform to the + * bitwidth of the underlying pixel type. + * + * If there are multiple planes, they may share the same working buffer + * because different planes will not be operate on concurrently. However, + * if there are multiple LCD devices, they must each have unique run buffers. + */ + +static uint8_t g_runbuffer[UG2864HSWEG01_ROWSIZE]; + +/* This structure describes the overall LCD video controller */ + +static const struct fb_videoinfo_s g_videoinfo = +{ + .fmt = UG2864HSWEG01_COLORFMT, /* Color format: RGB16-565: RRRR RGGG GGGB BBBB */ + .xres = UG2864HSWEG01_XRES, /* Horizontal resolution in pixel columns */ + .yres = UG2864HSWEG01_YRES, /* Vertical resolution in pixel rows */ + .nplanes = 1, /* Number of color planes supported */ +}; + +/* This is the standard, NuttX Plane information object */ + +static const struct lcd_planeinfo_s g_planeinfo = +{ + .putrun = ug2864hsweg01_putrun, /* Put a run into LCD memory */ + .getrun = ug2864hsweg01_getrun, /* Get a run from LCD memory */ + .buffer = (uint8_t*)g_runbuffer, /* Run scratch buffer */ + .bpp = UG2864HSWEG01_BPP, /* Bits-per-pixel */ +}; + +/* This is the OLED driver instance (only a single device is supported for now) */ + +static struct ug2864hsweg01_dev_s g_oleddev = +{ + .dev = + { + /* LCD Configuration */ + + .getvideoinfo = ug2864hsweg01_getvideoinfo, + .getplaneinfo = ug2864hsweg01_getplaneinfo, + + /* LCD RGB Mapping -- Not supported */ + /* Cursor Controls -- Not supported */ + + /* LCD Specific Controls */ + + .getpower = ug2864hsweg01_getpower, + .setpower = ug2864hsweg01_setpower, + .getcontrast = ug2864hsweg01_getcontrast, + .setcontrast = ug2864hsweg01_setcontrast, + }, +}; + +/************************************************************************************** + * Private Functions + **************************************************************************************/ + +/************************************************************************************** + * Name: ug2864hsweg01_configspi + * + * Description: + * Configure the SPI for use with the UG-2864HSWEG01 + * + * Input Parameters: + * spi - Reference to the SPI driver structure + * + * Returned Value: + * None + * + * Assumptions: + * + **************************************************************************************/ + +#ifdef CONFIG_SPI_OWNBUS +static inline void ug2864hsweg01_configspi(FAR struct spi_dev_s *spi) +{ + lcdvdbg("Mode: %d Bits: 8 Frequency: %d\n", + CONFIG_UG2864HSWEG01_SPIMODE, CONFIG_UG2864HSWEG01_FREQUENCY); + + /* Configure SPI for the UG-2864HSWEG01. But only if we own the SPI bus. Otherwise, + * don't bother because it might change. + */ + + SPI_SETMODE(spi, CONFIG_UG2864HSWEG01_SPIMODE); + SPI_SETBITS(spi, 8); + SPI_SETFREQUENCY(spi, CONFIG_UG2864HSWEG01_FREQUENCY) +} +#endif + +/************************************************************************************** + * Name: ug2864hsweg01_lock + * + * Description: + * Select the SPI, locking and re-configuring if necessary + * + * Input Parameters: + * spi - Reference to the SPI driver structure + * + * Returned Value: + * None + * + * Assumptions: + * + **************************************************************************************/ + +#ifndef CONFIG_SPI_OWNBUS +static inline void ug2864hsweg01_lock(FAR struct spi_dev_s *spi) +{ + /* Lock the SPI bus if there are multiple devices competing for the SPI bus. */ + + SPI_LOCK(spi, true); + + /* Now make sure that the SPI bus is configured for the UG-2864HSWEG01 (it + * might have gotten configured for a different device while unlocked) + */ + + SPI_SETMODE(spi, CONFIG_UG2864HSWEG01_SPIMODE); + SPI_SETBITS(spi, 8); + SPI_SETFREQUENCY(spi, CONFIG_UG2864HSWEG01_FREQUENCY); +} +#endif + +/************************************************************************************** + * Name: ug2864hsweg01_unlock + * + * Description: + * De-select the SPI + * + * Input Parameters: + * spi - Reference to the SPI driver structure + * + * Returned Value: + * None + * + * Assumptions: + * + **************************************************************************************/ + +#ifndef CONFIG_SPI_OWNBUS +static inline void ug2864hsweg01_unlock(FAR struct spi_dev_s *spi) +{ + /* De-select UG-2864HSWEG01 chip and relinquish the SPI bus. */ + + SPI_LOCK(spi, false); +} +#endif + +/************************************************************************************** + * Name: ug2864hsweg01_putrun + * + * Description: + * This method can be used to write a partial raster line to the LCD. + * + * Input Parameters: + * row - Starting row to write to (range: 0 <= row < yres) + * col - Starting column to write to (range: 0 <= col <= xres-npixels) + * buffer - The buffer containing the run to be written to the LCD + * npixels - The number of pixels to write to the LCD + * (range: 0 < npixels <= xres-col) + * + **************************************************************************************/ + +#if defined(CONFIG_LCD_LANDSCAPE) || defined(CONFIG_LCD_RLANDSCAPE) +static int ug2864hsweg01_putrun(fb_coord_t row, fb_coord_t col, FAR const uint8_t *buffer, + size_t npixels) +{ + /* Because of this line of code, we will only be able to support a single UG device */ + + FAR struct ug2864hsweg01_dev_s *priv = (FAR struct ug2864hsweg01_dev_s *)&g_oleddev; + FAR uint8_t *fbptr; + FAR uint8_t *ptr; + uint8_t devcol; + uint8_t fbmask; + uint8_t page; + uint8_t usrmask; + int pixlen; + uint8_t i; + + lcdvdbg("row: %d col: %d npixels: %d\n", row, col, npixels); + DEBUGASSERT(buffer); + + /* Clip the run to the display */ + + pixlen = npixels; + if ((unsigned int)col + (unsigned int)pixlen > (unsigned int)UG2864HSWEG01_XRES) + { + pixlen = (int)UG2864HSWEG01_XRES - (int)col; + } + + /* Verify that some portion of the run remains on the display */ + + if (pixlen <= 0 || row > UG2864HSWEG01_YRES) + { + return OK; + } + + /* Perform coordinate conversion for reverse landscape mode */ + +#ifdef CONFIG_LCD_RLANDSCAPE + row = (UG2864HSWEG01_YRES-1) - row; + col = (UG2864HSWEG01_XRES-1) - col; +#endif + + /* Get the page number. The range of 64 lines is divided up into eight + * pages of 8 lines each. + */ + + page = row >> 3; + + /* Update the shadow frame buffer memory. First determine the pixel + * position in the frame buffer memory. Pixels are organized like + * this: + * + * --------+---+---+---+---+-...-+-----+ + * Segment | 0 | 1 | 2 | 3 | ... | 131 | + * --------+---+---+---+---+-...-+-----+ + * D0 | | X | | | | | + * D1 | | X | | | | | + * D2 | | X | | | | | + * D3 | | X | | | | | + * D4 | | X | | | | | + * D5 | | X | | | | | + * D6 | | X | | | | | + * D7 | | X | | | | | + * --------+---+---+---+---+-...-+-----+ + * + * So, in order to draw a white, horizontal line, at row 45. we + * would have to modify all of the bytes in page 45/8 = 5. We + * would have to set bit 45%8 = 5 in every byte in the page. + */ + + fbmask = 1 << (row & 7); + fbptr = &priv->fb[page * UG2864HSWEG01_XRES + col]; +#ifdef CONFIG_LCD_RLANDSCAPE + ptr = fbptr + pixlen - 1; +#else + ptr = fbptr; +#endif +#ifdef CONFIG_NX_PACKEDMSFIRST + usrmask = MS_BIT; +#else + usrmask = LS_BIT; +#endif + + for (i = 0; i < pixlen; i++) + { + /* Set or clear the corresponding bit */ + +#ifdef CONFIG_LCD_RLANDSCAPE + if ((*buffer & usrmask) != 0) + { + *ptr-- |= fbmask; + } + else + { + *ptr-- &= ~fbmask; + } +#else + if ((*buffer & usrmask) != 0) + { + *ptr++ |= fbmask; + } + else + { + *ptr++ &= ~fbmask; + } +#endif + + /* Inc/Decrement to the next source pixel */ + +#ifdef CONFIG_NX_PACKEDMSFIRST + if (usrmask == LS_BIT) + { + buffer++; + usrmask = MS_BIT; + } + else + { + usrmask >>= 1; + } +#else + if (usrmask == MS_BIT) + { + buffer++; + usrmask = LS_BIT; + } + else + { + usrmask <<= 1; + } +#endif + } + + /* Offset the column position to account for smaller horizontal + * display range. + */ + + devcol = col + UG2864HSWEG01_DEV_XOFFSET; + + /* Lock and select device */ + + ug2864hsweg01_lock(priv->spi); + SPI_SELECT(priv->spi, SPIDEV_DISPLAY, true); + + /* Select command transfer */ + + SPI_CMDDATA(priv->spi, SPIDEV_DISPLAY, true); + + /* Set the starting position for the run */ + /* Set the column address to the XOFFSET value */ + + SPI_SEND(priv->spi, SSD1306_SETCOLL(devcol & 0x0f)); + SPI_SEND(priv->spi, SSD1306_SETCOLH(devcol >> 4)); + + /* Set the page address */ + + SPI_SEND(priv->spi, SSD1306_PAGEADDR(page)); + + /* Select data transfer */ + + SPI_CMDDATA(priv->spi, SPIDEV_DISPLAY, false); + + /* Then transfer all of the data */ + + (void)SPI_SNDBLOCK(priv->spi, fbptr, pixlen); + + /* De-select and unlock the device */ + + SPI_SELECT(priv->spi, SPIDEV_DISPLAY, false); + ug2864hsweg01_unlock(priv->spi); + return OK; +} +#else +# error "Configuration not implemented" +#endif + +/************************************************************************************** + * Name: ug2864hsweg01_getrun + * + * Description: + * This method can be used to read a partial raster line from the LCD: + * + * Description: + * This method can be used to write a partial raster line to the LCD. + * + * row - Starting row to read from (range: 0 <= row < yres) + * col - Starting column to read read (range: 0 <= col <= xres-npixels) + * buffer - The buffer in which to return the run read from the LCD + * npixels - The number of pixels to read from the LCD + * (range: 0 < npixels <= xres-col) + * + **************************************************************************************/ + +#if defined(CONFIG_LCD_LANDSCAPE) || defined(CONFIG_LCD_RLANDSCAPE) +static int ug2864hsweg01_getrun(fb_coord_t row, fb_coord_t col, FAR uint8_t *buffer, + size_t npixels) +{ + /* Because of this line of code, we will only be able to support a single UG device */ + + FAR struct ug2864hsweg01_dev_s *priv = &g_oleddev; + FAR uint8_t *fbptr; + uint8_t page; + uint8_t fbmask; + uint8_t usrmask; + int pixlen; + uint8_t i; + + lcdvdbg("row: %d col: %d npixels: %d\n", row, col, npixels); + DEBUGASSERT(buffer); + + /* Clip the run to the display */ + + pixlen = npixels; + if ((unsigned int)col + (unsigned int)pixlen > (unsigned int)UG2864HSWEG01_XRES) + { + pixlen = (int)UG2864HSWEG01_XRES - (int)col; + } + + /* Verify that some portion of the run is actually the display */ + + if (pixlen <= 0 || row > UG2864HSWEG01_YRES) + { + return -EINVAL; + } + + /* Perform coordinate conversion for reverse landscape mode */ + +#ifdef CONFIG_LCD_RLANDSCAPE + row = (UG2864HSWEG01_YRES-1) - row; + col = (UG2864HSWEG01_XRES-1) - col; +#endif + + /* Then transfer the display data from the shadow frame buffer memory */ + /* Get the page number. The range of 64 lines is divided up into eight + * pages of 8 lines each. + */ + + page = row >> 3; + + /* Update the shadow frame buffer memory. First determine the pixel + * position in the frame buffer memory. Pixels are organized like + * this: + * + * --------+---+---+---+---+-...-+-----+ + * Segment | 0 | 1 | 2 | 3 | ... | 131 | + * --------+---+---+---+---+-...-+-----+ + * D0 | | X | | | | | + * D1 | | X | | | | | + * D2 | | X | | | | | + * D3 | | X | | | | | + * D4 | | X | | | | | + * D5 | | X | | | | | + * D6 | | X | | | | | + * D7 | | X | | | | | + * --------+---+---+---+---+-...-+-----+ + * + * So, in order to draw a white, horizontal line, at row 45. we + * would have to modify all of the bytes in page 45/8 = 5. We + * would have to set bit 45%8 = 5 in every byte in the page. + */ + + fbmask = 1 << (row & 7); +#ifdef CONFIG_LCD_RLANDSCAPE + fbptr = &priv->fb[page * (UG2864HSWEG01_XRES-1) + col + pixlen]; +#else + fbptr = &priv->fb[page * UG2864HSWEG01_XRES + col]; +#endif +#ifdef CONFIG_NX_PACKEDMSFIRST + usrmask = MS_BIT; +#else + usrmask = LS_BIT; +#endif + + *buffer = 0; + for (i = 0; i < pixlen; i++) + { + /* Set or clear the corresponding bit */ + +#ifdef CONFIG_LCD_RLANDSCAPE + uint8_t byte = *fbptr--; +#else + uint8_t byte = *fbptr++; +#endif + if ((byte & fbmask) != 0) + { + *buffer |= usrmask; + } + + /* Inc/Decrement to the next destination pixel. Hmmmm. It looks like + * this logic could write past the end of the user buffer. Revisit + * this! + */ + +#ifdef CONFIG_NX_PACKEDMSFIRST + if (usrmask == LS_BIT) + { + buffer++; + *buffer = 0; + usrmask = MS_BIT; + } + else + { + usrmask >>= 1; + } +#else + if (usrmask == MS_BIT) + { + buffer++; + *buffer = 0; + usrmask = LS_BIT; + } + else + { + usrmask <<= 1; + } +#endif + } + + return OK; +} +#else +# error "Configuration not implemented" +#endif + +/************************************************************************************** + * Name: ug2864hsweg01_getvideoinfo + * + * Description: + * Get information about the LCD video controller configuration. + * + **************************************************************************************/ + +static int ug2864hsweg01_getvideoinfo(FAR struct lcd_dev_s *dev, + FAR struct fb_videoinfo_s *vinfo) +{ + DEBUGASSERT(dev && vinfo); + lcdvdbg("fmt: %d xres: %d yres: %d nplanes: %d\n", + g_videoinfo.fmt, g_videoinfo.xres, g_videoinfo.yres, g_videoinfo.nplanes); + memcpy(vinfo, &g_videoinfo, sizeof(struct fb_videoinfo_s)); + return OK; +} + +/************************************************************************************** + * Name: ug2864hsweg01_getplaneinfo + * + * Description: + * Get information about the configuration of each LCD color plane. + * + **************************************************************************************/ + +static int ug2864hsweg01_getplaneinfo(FAR struct lcd_dev_s *dev, unsigned int planeno, + FAR struct lcd_planeinfo_s *pinfo) +{ + DEBUGASSERT(pinfo && planeno == 0); + lcdvdbg("planeno: %d bpp: %d\n", planeno, g_planeinfo.bpp); + memcpy(pinfo, &g_planeinfo, sizeof(struct lcd_planeinfo_s)); + return OK; +} + +/************************************************************************************** + * Name: ug2864hsweg01_getpower + * + * Description: + * Get the LCD panel power status (0: full off - CONFIG_LCD_MAXPOWER: full on. On + * backlit LCDs, this setting may correspond to the backlight setting. + * + **************************************************************************************/ + +static int ug2864hsweg01_getpower(FAR struct lcd_dev_s *dev) +{ + FAR struct ug2864hsweg01_dev_s *priv = (FAR struct ug2864hsweg01_dev_s *)dev; + DEBUGASSERT(priv); + + lcdvdbg("power: %s\n", priv->on ? "ON" : "OFF"); + return priv->on ? CONFIG_LCD_MAXPOWER : 0; +} + +/************************************************************************************** + * Name: ug2864hsweg01_setpower + * + * Description: + * Enable/disable LCD panel power (0: full off - CONFIG_LCD_MAXPOWER: full on). On + * backlit LCDs, this setting may correspond to the backlight setting. + * + **************************************************************************************/ + +static int ug2864hsweg01_setpower(struct lcd_dev_s *dev, int power) +{ + struct ug2864hsweg01_dev_s *priv = (struct ug2864hsweg01_dev_s *)dev; + DEBUGASSERT(priv && (unsigned)power <= CONFIG_LCD_MAXPOWER && priv->spi); + + lcdvdbg("power: %d [%d]\n", power, priv->on ? CONFIG_LCD_MAXPOWER : 0); + + /* Lock and select device */ + + ug2864hsweg01_lock(priv->spi); + SPI_SELECT(priv->spi, SPIDEV_DISPLAY, true); + + if (power <= 0) + { + /* Turn the display off */ + + (void)SPI_SEND(priv->spi, SSD1306_DISPOFF); + priv->on = false; + } + else + { + /* Turn the display on */ + + (void)SPI_SEND(priv->spi, SSD1306_DISPON); /* Display on, dim mode */ + priv->on = true; + } + + /* De-select and unlock the device */ + + SPI_SELECT(priv->spi, SPIDEV_DISPLAY, false); + ug2864hsweg01_unlock(priv->spi); + return OK; +} + +/************************************************************************************** + * Name: ug2864hsweg01_getcontrast + * + * Description: + * Get the current contrast setting (0-CONFIG_LCD_MAXCONTRAST). + * + **************************************************************************************/ + +static int ug2864hsweg01_getcontrast(struct lcd_dev_s *dev) +{ + struct ug2864hsweg01_dev_s *priv = (struct ug2864hsweg01_dev_s *)dev; + DEBUGASSERT(priv); + + lcdvdbg("contrast: %d\n", priv->contrast); + return priv->contrast; +} + +/************************************************************************************** + * Name: ug2864hsweg01_setcontrast + * + * Description: + * Set LCD panel contrast (0-CONFIG_LCD_MAXCONTRAST). + * + **************************************************************************************/ + +static int ug2864hsweg01_setcontrast(struct lcd_dev_s *dev, unsigned int contrast) +{ + struct ug2864hsweg01_dev_s *priv = (struct ug2864hsweg01_dev_s *)dev; + unsigned int scaled; + + lcdvdbg("contrast: %d\n", contrast); + DEBUGASSERT(priv); + + /* Verify the contrast value */ + +#ifdef CONFIG_DEBUG + if (contrast > CONFIG_LCD_MAXCONTRAST) + { + return -EINVAL; + } +#endif + + /* Scale contrast: newcontrast = 255 * contrast / CONFIG_LCD_MAXCONTRAST + * Where contrast is in the range {1,255} + */ + +#if CONFIG_LCD_MAXCONTRAST != 255 + scaled = ((contrast << 8) - 1) / CONFIG_LCD_MAXCONTRAST; +#else + scaled = contrast; +#endif + + /* Lock and select device */ + + ug2864hsweg01_lock(priv->spi); + SPI_SELECT(priv->spi, SPIDEV_DISPLAY, true); + + /* Select command transfer */ + + SPI_CMDDATA(priv->spi, SPIDEV_DISPLAY, true); + + /* Set the contrast */ + + (void)SPI_SEND(priv->spi, SSD1306_CONTRAST_MODE); /* Set contrast control register */ + (void)SPI_SEND(priv->spi, SSD1306_CONTRAST(scaled)); /* Data 1: Set 1 of 256 contrast steps */ + priv->contrast = contrast; + + /* De-select and unlock the device */ + + SPI_SELECT(priv->spi, SPIDEV_DISPLAY, false); + ug2864hsweg01_unlock(priv->spi); + return OK; +} + +/************************************************************************************** + * Public Functions + **************************************************************************************/ + +/************************************************************************************** + * Name: ug2864hsweg01_initialize + * + * Description: + * Initialize the UG-2864HSWEG01 video hardware. The initial state of the + * OLED is fully initialized, display memory cleared, and the OLED ready + * to use, but with the power setting at 0 (full off == sleep mode). + * + * Input Parameters: + * + * spi - A reference to the SPI driver instance. + * devno - A value in the range of 0 through CONFIG_UG2864HSWEG01_NINTERFACES-1. + * This allows support for multiple OLED devices. + * + * Returned Value: + * + * On success, this function returns a reference to the LCD object for + * the specified OLED. NULL is returned on any failure. + * + **************************************************************************************/ + +FAR struct lcd_dev_s *ug2864hsweg01_initialize(FAR struct spi_dev_s *spi, unsigned int devno) +{ + FAR struct ug2864hsweg01_dev_s *priv = &g_oleddev; + + lcdvdbg("Initializing\n"); + DEBUGASSERT(spi && devno == 0); + + /* Save the reference to the SPI device */ + + priv->spi = spi; + + /* Configure the SPI */ + + ug2864hsweg01_configspi(spi) + + /* Lock and select device */ + + ug2864hsweg01_lock(priv->spi); + SPI_SELECT(spi, SPIDEV_DISPLAY, true); + + /* Select command transfer */ + + SPI_CMDDATA(spi, SPIDEV_DISPLAY, true); + + /* Configure the device */ + + SPI_SEND(spi, SSD1306_DISPOFF); /* Display off 0xAE*/ + SPI_SEND(spi, SSD1306_SETCOLL(0)); /* Set lower column address 0x00 */ + SPI_SEND(spi, SSD1306_SETCOLH(0)); /* Set higher column address 0x10 */ + SPI_SEND(spi, SSD1306_STARTLINE(0)); /* Set display start line 0x40*/ + SPI_SEND(spi, SSD1306_PAGEADDR(0)); /* Set page address [¿ÉºöÂÔ] */ + SPI_SEND(spi, SSD1306_CONTRAST_MODE); /* Contrast control 0x81*/ + SPI_SEND(spi ,SSD1306_CONTRAST(UG2864HSWEG01_CONTRAST)); /* Default contrast 0xCF */ + SPI_SEND(spi, SSD1306_REMAPPLEFT); /* Set segment remap left 95 to 0 | 0xA1*/ + SPI_SEND(spi, SSD1306_EDISPOFF); /* Normal display :off 0xA4 [¶à³öµÄÒ»ÐÐ] */ + SPI_SEND(spi, SSD1306_NORMAL); /* Normal (un-reversed) display mode 0xA6 */ + SPI_SEND(spi, SSD1306_MRATIO_MODE); /* Multiplex ratio 0xA8*/ + SPI_SEND(spi, SSD1306_MRATIO(0x3f)); /* Duty = 1/64 */ + SPI_SEND(spi, SSD1306_SCANTOCOM0); /* Com scan direction: Scan from COM[n-1] to COM[0] [¿ÉºöÂÔ] */ + SPI_SEND(spi, SSD1306_DISPOFFS_MODE); /* Set display offset 0xD3 */ + SPI_SEND(spi, SSD1306_DISPOFFS(0)); + SPI_SEND(spi, SSD1306_CLKDIV_SET); /* Set clock divider 0xD5*/ + SPI_SEND(spi, SSD1306_CLKDIV(8,0)); /* 0x80 ? ¼ì²é ĬÈÏ0,0*/ + + SPI_SEND(spi, SSD1306_CHRGPER_SET); /* ++Set pre-charge period 0xD9*/ + SPI_SEND(spi, SSD1306_CHRGPER(0x0f,1)); /* 0xf1 or 0x22£¨Ôöǿģʽ£¿£© */ + + SPI_SEND(spi, SSD1306_CMNPAD_CONFIG); /* Set common pads / set com pins hardware configuration 0xDA*/ + SPI_SEND(spi, SSD1306_CMNPAD(0x12)); /* 0x12 ? ¼ì²é ĬÈÏ 0x10 */ + + SPI_SEND(spi, SSD1306_VCOM_SET); /* set vcomh 0xDB*/ + SPI_SEND(spi, SSD1306_VCOM(0x40)); + + SPI_SEND(spi, SSD1306_CHRPUMP_SET); /* ++Set Charge Pump enable/disable 0x8D Ôö¼ÓµÄ*/ + SPI_SEND(spi, SSD1306_CHRPUMP_ON); /* 0x14 */ + + //SPI_SEND(spi, SSD1306_DCDC_MODE); /* DC/DC control mode: on */ + //SPI_SEND(spi, SSD1306_DCDC_ON); + + SPI_SEND(spi, SSD1306_DISPON); /* display ON 0xAF */ + + /* De-select and unlock the device */ + + SPI_SELECT(spi, SPIDEV_DISPLAY, false); + ug2864hsweg01_unlock(priv->spi); + + /* Clear the display */ + + up_mdelay(100); + ug2864hsweg01_fill(&priv->dev, UG_Y1_BLACK); + return &priv->dev; +} + +/************************************************************************************** + * Name: ug2864hsweg01_fill + * + * Description: + * This non-standard method can be used to clear the entire display by writing one + * color to the display. This is much faster than writing a series of runs. + * + * Input Parameters: + * priv - Reference to private driver structure + * + * Assumptions: + * Caller has selected the OLED section. + * + **************************************************************************************/ + +void ug2864hsweg01_fill(FAR struct lcd_dev_s *dev, uint8_t color) +{ + FAR struct ug2864hsweg01_dev_s *priv = &g_oleddev; + unsigned int page; + + /* Make an 8-bit version of the selected color */ + + if (color & 1) + { + color = 0xff; + } + else + { + color = 0; + } + + /* Initialize the framebuffer */ + + memset(priv->fb, color, UG2864HSWEG01_FBSIZE); + + /* Lock and select device */ + + ug2864hsweg01_lock(priv->spi); + SPI_SELECT(priv->spi, SPIDEV_DISPLAY, true); + + /* Visit each page */ + + for (page = 0; page < UG2864HSWEG01_DEV_PAGES; page++) + { + /* Select command transfer */ + + SPI_CMDDATA(priv->spi, SPIDEV_DISPLAY, true); + + /* Set the column address to the XOFFSET value */ + + SPI_SEND(priv->spi, SSD1306_SETCOLL(UG2864HSWEG01_DEV_XOFFSET)); + SPI_SEND(priv->spi, SSD1306_SETCOLH(0)); + + /* Set the page address */ + + SPI_SEND(priv->spi, SSD1306_PAGEADDR(page)); + + /* Select data transfer */ + + SPI_CMDDATA(priv->spi, SPIDEV_DISPLAY, false); + + /* Transfer one page of the selected color */ + + (void)SPI_SNDBLOCK(priv->spi, &priv->fb[page * UG2864HSWEG01_XRES], + UG2864HSWEG01_XRES); + } + + /* De-select and unlock the device */ + + SPI_SELECT(priv->spi, SPIDEV_DISPLAY, false); + ug2864hsweg01_unlock(priv->spi); +} + +#endif /* CONFIG_LCD_UG2864HSWEG01 */ diff --git a/nuttx/drivers/usbhost/usbhost_hidkbd.c b/nuttx/drivers/usbhost/usbhost_hidkbd.c index e0c4680ebb..5022793cac 100644 --- a/nuttx/drivers/usbhost/usbhost_hidkbd.c +++ b/nuttx/drivers/usbhost/usbhost_hidkbd.c @@ -1027,6 +1027,7 @@ static int usbhost_kbdpoll(int argc, char *argv[]) /* Loop here until the device is disconnected */ uvdbg("Entering poll loop\n"); + while (!priv->disconnected) { /* Make sure that we have exclusive access to the private data @@ -1169,10 +1170,10 @@ static int usbhost_kbdpoll(int argc, char *argv[]) #endif } - /* Did we just transition from no data available to data available? */ + /* Is there data available? */ newstate = (priv->headndx == priv->tailndx); - if (empty && !newstate) + if (!newstate) { /* Yes.. Is there a thread waiting for keyboard data now? */ @@ -1184,9 +1185,15 @@ static int usbhost_kbdpoll(int argc, char *argv[]) priv->waiting = false; } - /* And wake up any threads waiting for the POLLIN event */ + /* Did we just transition from no data available to data + * available? If so, wake up any threads waiting for the + * POLLIN event. + */ - usbhost_pollnotify(priv); + if (empty) + { + usbhost_pollnotify(priv); + } } empty = newstate; @@ -2146,6 +2153,7 @@ static ssize_t usbhost_read(FAR struct file *filep, FAR char *buffer, size_t len /* Wait for data to be available */ uvdbg("Waiting...\n"); + priv->waiting = true; usbhost_givesem(&priv->exclsem); usbhost_takesem(&priv->waitsem); diff --git a/nuttx/include/nuttx/lcd/ug-2864hsweg01.h b/nuttx/include/nuttx/lcd/ug-2864hsweg01.h new file mode 100644 index 0000000000..bbefd39be0 --- /dev/null +++ b/nuttx/include/nuttx/lcd/ug-2864hsweg01.h @@ -0,0 +1,245 @@ +/************************************************************************************** + * include/nuttx/lcd/ug-2864hsweg01.h + * Driver for Univision UG-2864HSWEG01 OLED display (wih SSD1306 controller) in SPI + * mode + * + * Copyright (C) 2012 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * References: + * 1. Product Specification (Preliminary), Part Name: OEL Display Module, Part ID: + * UG-2864HSWEG01, Doc No: SAS1-9046-B, Univision Technology Inc. + * 2. SSD1306, 128 X 64 Dot Matrix OLED/PLED, Preliminary Segment/Common Driver with + * Controller, Solomon Systech + * + * 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. + * + **************************************************************************************/ + +#ifndef __INCLUDE_NUTTX_UG_8264HSWEG01_H +#define __INCLUDE_NUTTX_UG_8264HSWEG01_H + +/************************************************************************************** + * Included Files + **************************************************************************************/ + +#include + +#include + +#include + +#ifdef CONFIG_LCD_UG2864HSWEG01 + +/************************************************************************************** + * Pre-processor Definitions + **************************************************************************************/ +/* Configuration **********************************************************************/ +/* UG-2864HSWEG01 Configuration Settings: + * + * CONFIG_UG2864HSWEG01_SPIMODE - Controls the SPI mode + * CONFIG_UG2864HSWEG01_FREQUENCY - Define to use a different bus frequency + * CONFIG_UG2864HSWEG01_NINTERFACES - Specifies the number of physical UG-2864HSWEG01 + * devices that will be supported. + * + * Required LCD driver settings: + * + * CONFIG_LCD_UG28HSWEG01 - Enable UG-2864HSWEG01 support + * CONFIG_LCD_MAXCONTRAST should be 255, but any value >0 and <=255 will be accepted. + * CONFIG_LCD_MAXPOWER must be 1 + * + * Option LCD driver settings: + * CONFIG_LCD_LANDSCAPE, CONFIG_LCD_PORTRAIT, CONFIG_LCD_RLANDSCAPE, and + * CONFIG_LCD_RPORTRAIT - Display orientation. + * + * Required SPI driver settings: + * CONFIG_SPI_CMDDATA - Include support for cmd/data selection. + */ + +/* SPI Interface + * + * "The serial interface consists of serial clock SCL, serial data SI, A0 and + * CS . SI is shifted into an 8-bit shift register on every rising edge of + * SCL in the order of D7, D6, … and D0. A0 is sampled on every eighth clock + * and the data byte in the shift register is written to the display data RAM + * or command register in the same clock." + * + * MODE 3: + * Clock polarity: High (CPOL=1) + * Clock phase: Sample on trailing (rising edge) (CPHA 1) + */ + +#ifndef CONFIG_UG2864HSWEG01_SPIMODE +# define CONFIG_UG2864HSWEG01_SPIMODE SPIDEV_MODE3 +#endif + +/* "This module determines whether the input data is interpreted as data or + * command. When A0 = “H”, the inputs at D7 - D0 are interpreted as data and be + * written to display RAM. When A0 = “L”, the inputs at D7 - D0 are interpreted + * as command, they will be decoded and be written to the corresponding command + * registers. + */ + +#ifndef CONFIG_SPI_CMDDATA +# error "CONFIG_SPI_CMDDATA must be defined in your NuttX configuration" +#endif + +/* CONFIG_UG2864HSWEG01_NINTERFACES determines the number of physical interfaces + * that will be supported. + */ + +#ifndef CONFIG_UG2864HSWEG01_NINTERFACES +# define CONFIG_UG2864HSWEG01_NINTERFACES 1 +#endif + +/* Check contrast selection */ + +#if !defined(CONFIG_LCD_MAXCONTRAST) +# define CONFIG_LCD_MAXCONTRAST 255 +#endif + +#if CONFIG_LCD_MAXCONTRAST <= 0|| CONFIG_LCD_MAXCONTRAST > 255 +# error "CONFIG_LCD_MAXCONTRAST exceeds supported maximum" +#endif + +#if CONFIG_LCD_MAXCONTRAST < 255 +# warning "Optimal setting of CONFIG_LCD_MAXCONTRAST is 255" +#endif + +/* Check power setting */ + +#if !defined(CONFIG_LCD_MAXPOWER) +# define CONFIG_LCD_MAXPOWER 1 +#endif + +#if CONFIG_LCD_MAXPOWER != 1 +# warning "CONFIG_LCD_MAXPOWER exceeds supported maximum" +# undef CONFIG_LCD_MAXPOWER +# define CONFIG_LCD_MAXPOWER 1 +#endif + +/* Color is 1bpp monochrome with leftmost column contained in bits 0 */ + +#ifdef CONFIG_NX_DISABLE_1BPP +# warning "1 bit-per-pixel support needed" +#endif + +/* Orientation */ + +#if defined(CONFIG_LCD_LANDSCAPE) +# undef CONFIG_LCD_PORTRAIT +# undef CONFIG_LCD_RLANDSCAPE +# undef CONFIG_LCD_RPORTRAIT +#elif defined(CONFIG_LCD_PORTRAIT) +# undef CONFIG_LCD_LANDSCAPE +# undef CONFIG_LCD_RLANDSCAPE +# undef CONFIG_LCD_RPORTRAIT +#elif defined(CONFIG_LCD_RLANDSCAPE) +# undef CONFIG_LCD_LANDSCAPE +# undef CONFIG_LCD_PORTRAIT +# undef CONFIG_LCD_RPORTRAIT +#elif defined(CONFIG_LCD_RPORTRAIT) +# undef CONFIG_LCD_LANDSCAPE +# undef CONFIG_LCD_PORTRAIT +# undef CONFIG_LCD_RLANDSCAPE +#else +# define CONFIG_LCD_LANDSCAPE 1 +# warning "Assuming landscape orientation" +#endif + +/* Some important "colors" */ + +#define UG_Y1_BLACK 0 +#define UG_Y1_WHITE 1 + +/************************************************************************************** + * Public Types + **************************************************************************************/ + +/************************************************************************************** + * Public Data + **************************************************************************************/ + +#ifdef __cplusplus +extern "C" +{ +#endif + +/************************************************************************************** + * Public Function Prototypes + **************************************************************************************/ + +/************************************************************************************** + * Name: ug2864hsweg01_initialize + * + * Description: + * Initialize the UG-2864HSWEG01 video hardware. The initial state of the + * OLED is fully initialized, display memory cleared, and the OLED ready + * to use, but with the power setting at 0 (full off == sleep mode). + * + * Input Parameters: + * + * spi - A reference to the SPI driver instance. + * devno - A value in the range of 0 through CONFIG_UG2864HSWEG01_NINTERFACES-1. + * This allows support for multiple OLED devices. + * + * Returned Value: + * + * On success, this function returns a reference to the LCD object for + * the specified OLED. NULL is returned on any failure. + * + **************************************************************************************/ + +struct lcd_dev_s; /* See include/nuttx/lcd/lcd.h */ +struct spi_dev_s; /* See include/nuttx/spi.h */ +FAR struct lcd_dev_s *ug2864hsweg01_initialize(FAR struct spi_dev_s *spi, + unsigned int devno); + +/************************************************************************************************ + * Name: ug2864hsweg01_fill + * + * Description: + * This non-standard method can be used to clear the entire display by writing one + * color to the display. This is much faster than writing a series of runs. + * + * Input Parameters: + * priv - Reference to private driver structure + * + * Assumptions: + * Caller has selected the OLED section. + * + **************************************************************************************/ + +void ug2864hsweg01_fill(FAR struct lcd_dev_s *dev, uint8_t color); + +#ifdef __cplusplus +} +#endif + +#endif /* CONFIG_LCD_UG2864HSWEG01 */ +#endif /* __INCLUDE_NUTTX_UG_8264HSWEG01_H */ From 88bccb641eccf8ca1a91ab0583976a211deb1ed5 Mon Sep 17 00:00:00 2001 From: patacongo Date: Wed, 26 Dec 2012 21:37:50 +0000 Subject: [PATCH 016/118] Verified USB HID KBD driver encoding of special characters; apps/examples/hidkbd now decodes encoded keyboar characters. git-svn-id: http://svn.code.sf.net/p/nuttx/code/trunk@5463 42af7a65-404d-4744-a932-0658087f49c3 --- apps/ChangeLog.txt | 2 + apps/examples/README.txt | 16 ++- apps/examples/hidkbd/Kconfig | 31 +++++ apps/examples/hidkbd/hidkbd_main.c | 106 +++++++++++++++++- .../olimex-lpc1766stk/hidkbd/defconfig | 20 +++- nuttx/drivers/usbhost/Kconfig | 4 +- nuttx/drivers/usbhost/usbhost_hidkbd.c | 34 +++--- nuttx/include/nuttx/input/kbd_codec.h | 5 +- nuttx/libc/Kconfig | 28 +++++ nuttx/libc/math/Kconfig | 2 +- nuttx/libc/misc/Make.defs | 8 +- 11 files changed, 233 insertions(+), 23 deletions(-) diff --git a/apps/ChangeLog.txt b/apps/ChangeLog.txt index ea1b247f51..d156b10657 100644 --- a/apps/ChangeLog.txt +++ b/apps/ChangeLog.txt @@ -453,4 +453,6 @@ in place early in the dependency generation phase to avoid warnings. It is not important if they are only stubbed out header files at this build phase. + * apps/examples/hidbkd: Now supports decoding of encoded special keys + if CONFIG_EXAMPLES_HIDKBD_ENCODED is defined. diff --git a/apps/examples/README.txt b/apps/examples/README.txt index e40a63be9e..7bfba721a6 100644 --- a/apps/examples/README.txt +++ b/apps/examples/README.txt @@ -540,9 +540,21 @@ examples/hidkbd This is a simple test to debug/verify the USB host HID keyboard class driver. - CONFIG_EXAMPLES_HIDKBD_DEFPRIO - Priority of "waiter" thread. - CONFIG_EXAMPLES_HIDKBD_STACKSIZE - Stacksize of "waiter" thread. + CONFIG_EXAMPLES_HIDKBD_DEFPRIO - Priority of "waiter" thread. Default: + 50 + CONFIG_EXAMPLES_HIDKBD_STACKSIZE - Stacksize of "waiter" thread. Default + 1024 + CONFIG_EXAMPLES_HIDKBD_DEVNAME - Name of keyboard device to be used. + Default: "/dev/kbda" + CONFIG_EXAMPLES_HIDKBD_ENCODED - Decode special key press events in the + user buffer. In this case, the example coded will use the interfaces + defined in include/nuttx/input/kbd_codec.h to decode the returned + keyboard data. These special keys include such things as up/down + arrows, home and end keys, etc. If this not defined, only 7-bit print- + able and control ASCII characters will be provided to the user. + Requires CONFIG_HIDKBD_ENCODED && CONFIG_LIB_KBDCODEC +endif examples/igmp ^^^^^^^^^^^^^ diff --git a/apps/examples/hidkbd/Kconfig b/apps/examples/hidkbd/Kconfig index 503d9d9d9c..81f817ef9b 100644 --- a/apps/examples/hidkbd/Kconfig +++ b/apps/examples/hidkbd/Kconfig @@ -10,4 +10,35 @@ config EXAMPLES_HIDKBD Enable the USB HID keyboard example if EXAMPLES_HIDKBD + +config EXAMPLES_HIDKBD_DEFPRIO + int "Waiter Thread Priority" + default 50 + ---help--- + Priority of "waiter" thread. Default: 50 + +config EXAMPLES_HIDKBD_STACKSIZE + int "Waiter Thread Stack Size" + default 1024 + ---help--- + Stacksize of "waiter" thread. Default 1024 + +config EXAMPLES_HIDKBD_DEVNAME + string "Keyboard Device Name" + default "/dev/kbda" + ---help--- + Name of keyboard device to be used. Default: "/dev/kbda" + +config EXAMPLES_HIDKBD_ENCODED + bool "Encode Special Keys" + default y + depends on HIDKBD_ENCODED && LIB_KBDCODEC + ---help--- + Decode special key press events in the user buffer. In this case, + the example coded will use the interfaces defined in + include/nuttx/input/kbd_codec.h to decode the returned keyboard + data. These special keys include such things as up/down arrows, + home and end keys, etc. If this not defined, only 7-bit print-able + and control ASCII characters will be provided to the user. + endif diff --git a/apps/examples/hidkbd/hidkbd_main.c b/apps/examples/hidkbd/hidkbd_main.c index 8c9f6fa95f..8a632bab75 100644 --- a/apps/examples/hidkbd/hidkbd_main.c +++ b/apps/examples/hidkbd/hidkbd_main.c @@ -46,10 +46,18 @@ #include #include #include +#include +#include +#include #include #include +#ifdef CONFIG_EXAMPLES_HIDKBD_ENCODED +# include +# include +#endif + /**************************************************************************** * Definitions ****************************************************************************/ @@ -83,10 +91,23 @@ # define CONFIG_EXAMPLES_HIDKBD_DEVNAME "/dev/kbda" #endif +#if !defined(CONFIG_HIDKBD_ENCODED) || !defined(CONFIG_LIB_KBDCODEC) +# undef CONFIG_EXAMPLES_HIDKBD_ENCODED +#endif + /**************************************************************************** * Private Types ****************************************************************************/ +#ifdef CONFIG_EXAMPLES_HIDKBD_ENCODED +struct hidbkd_instream_s +{ + struct lib_instream_s stream; + FAR char *buffer; + ssize_t nbytes; +}; +#endif + /**************************************************************************** * Private Data ****************************************************************************/ @@ -98,9 +119,84 @@ static struct usbhost_driver_s *g_drvr; ****************************************************************************/ /**************************************************************************** - * Public Functions + * Name: hidkbd_getstream + * + * Description: + * Get one character from the keyboard. + * ****************************************************************************/ +#ifdef CONFIG_EXAMPLES_HIDKBD_ENCODED +static int hidkbd_getstream(FAR struct lib_instream_s *this) +{ + FAR struct hidbkd_instream_s *kbdstream = (FAR struct hidbkd_instream_s *)this; + + DEBUGASSERT(kbdstream && kbdstream->buffer); + if (kbdstream->nbytes > 0) + { + kbdstream->nbytes--; + kbdstream->stream.nget++; + return (int)*kbdstream->buffer++; + } + + return EOF; +} +#endif + +/**************************************************************************** + * Name: hidkbd_decode + * + * Description: + * Decode encoded keyboard input + * + ****************************************************************************/ + +#ifdef CONFIG_EXAMPLES_HIDKBD_ENCODED +static void hidkbd_decode(FAR char *buffer, ssize_t nbytes) +{ + struct hidbkd_instream_s kbdstream; + struct kbd_getstate_s state; + uint8_t ch; + int ret; + + /* Initialize */ + + memset(&state, 0, sizeof(struct kbd_getstate_s)); + kbdstream.stream.get = hidkbd_getstream; + kbdstream.stream.nget = 0; + kbdstream.buffer = buffer; + kbdstream.nbytes = nbytes; + + /* Loop until all of the bytes have been consumed. We implicitly assume + * that the the escaped sequences do not cross buffer boundaries. That + * might be true if the read buffer were small or the data rates high. + */ + + for (;;) + { + /* Decode the next thing from the buffer */ + + ret = kbd_get((FAR struct lib_instream_s *)&kbdstream, &state, &ch); + if (ret == KBD_ERROR) + { + break; + } + + /* Normal data? Or special key? */ + + if (ret == KBD_NORMAL) + { + printf("Data: %c [%02x]\n", isprint(ch) ? ch : '.', ch); + } + else + { + DEBUGASSERT(ret == KBD_SPECIAL); + printf("Special: %d\n", ch); + } + } +} +#endif + /**************************************************************************** * Name: hidkbd_waiter * @@ -140,6 +236,10 @@ static int hidkbd_waiter(int argc, char *argv[]) return 0; } +/**************************************************************************** + * Public Functions + ****************************************************************************/ + /**************************************************************************** * Name: hidkbd_main ****************************************************************************/ @@ -217,7 +317,11 @@ int hidkbd_main(int argc, char *argv[]) { /* On success, echo the buffer to stdout */ +#ifdef CONFIG_EXAMPLES_HIDKBD_ENCODED + hidkbd_decode(buffer, nbytes); +#else (void)write(1, buffer, nbytes); +#endif } } while (nbytes > 0); diff --git a/nuttx/configs/olimex-lpc1766stk/hidkbd/defconfig b/nuttx/configs/olimex-lpc1766stk/hidkbd/defconfig index 78e4115609..35a7bfc3db 100755 --- a/nuttx/configs/olimex-lpc1766stk/hidkbd/defconfig +++ b/nuttx/configs/olimex-lpc1766stk/hidkbd/defconfig @@ -316,7 +316,10 @@ CONFIG_DEV_NULL=y # CONFIG_WATCHDOG is not set # CONFIG_ANALOG is not set # CONFIG_BCH is not set -# CONFIG_INPUT is not set +CONFIG_INPUT=y +# CONFIG_INPUT_TSC2007 is not set +# CONFIG_INPUT_ADS7843E is not set +# CONFIG_INPUT_STMPE811 is not set # CONFIG_LCD is not set CONFIG_MMCSD=y CONFIG_MMCSD_NSLOTS=1 @@ -364,7 +367,7 @@ CONFIG_HIDKBD_STACKSIZE=1024 CONFIG_HIDKBD_BUFSIZE=64 CONFIG_HIDKBD_NPOLLWAITERS=2 # CONFIG_HIDKBD_RAWSCANCODES is not set -# CONFIG_HIDKBD_ENCODED is not set +CONFIG_HIDKBD_ENCODED=y # CONFIG_HIDKBD_ALLSCANCODES is not set # CONFIG_HIDKBD_NODEBOUNCE is not set # CONFIG_WIRELESS is not set @@ -425,6 +428,10 @@ CONFIG_MM_REGIONS=2 # # Library Routines # + +# +# Standard C Library Options +# CONFIG_STDIO_BUFFER_SIZE=256 CONFIG_STDIO_LINEBUFFER=y CONFIG_NUNGET_CHARS=2 @@ -443,6 +450,11 @@ CONFIG_LIB_SENDFILE_BUFSIZE=512 # CONFIG_ARCH_ROMGETC is not set # CONFIG_ARCH_OPTIMIZED_FUNCTIONS is not set +# +# Non-standard Helper Functions +# +CONFIG_LIB_KBDCODEC=y + # # Basic CXX Support # @@ -473,6 +485,10 @@ CONFIG_LIB_SENDFILE_BUFSIZE=512 # CONFIG_EXAMPLES_HELLOXX is not set # CONFIG_EXAMPLES_JSON is not set CONFIG_EXAMPLES_HIDKBD=y +CONFIG_EXAMPLES_HIDKBD_DEFPRIO=50 +CONFIG_EXAMPLES_HIDKBD_STACKSIZE=1024 +CONFIG_EXAMPLES_HIDKBD_DEVNAME="/dev/kbda" +CONFIG_EXAMPLES_HIDKBD_ENCODED=y # CONFIG_EXAMPLES_KEYPADTEST is not set # CONFIG_EXAMPLES_IGMP is not set # CONFIG_EXAMPLES_LCDRW is not set diff --git a/nuttx/drivers/usbhost/Kconfig b/nuttx/drivers/usbhost/Kconfig index de8469b41d..531e94442c 100644 --- a/nuttx/drivers/usbhost/Kconfig +++ b/nuttx/drivers/usbhost/Kconfig @@ -89,10 +89,10 @@ config HIDKBD_RAWSCANCODES config HIDKBD_ENCODED bool "Enocode Special Keys" default n - depends on !HIDKBD_RAWSCANCODES + depends on !HIDKBD_RAWSCANCODES && LIB_KBDCODEC ---help--- Encode special key press events in the user buffer. In this case, - the use end must decode the encoded special key values using the + the user end must decode the encoded special key values using the interfaces defined in include/nuttx/input/kbd_codec.h. These special keys include such things as up/down arrows, home and end keys, etc. If this not defined, only 7-bit print-able and control diff --git a/nuttx/drivers/usbhost/usbhost_hidkbd.c b/nuttx/drivers/usbhost/usbhost_hidkbd.c index 5022793cac..917ebfa3f2 100644 --- a/nuttx/drivers/usbhost/usbhost_hidkbd.c +++ b/nuttx/drivers/usbhost/usbhost_hidkbd.c @@ -131,6 +131,14 @@ # endif #endif +/* We cant support encoding of special characters of unless the Keyboard + * CODEC is enabled. + */ + +#ifndef CONFIG_LIB_KBDCODEC +# undef CONFIG_HIDKBD_ENCODED +#endif + /* If we are using raw scancodes, then we cannot support encoding of * special characters either. */ @@ -398,11 +406,11 @@ static struct usbhost_state_s *g_priv; /* Data passed to thread */ /* The first and last scancode values with encode-able values */ -#define FIRST_ENCODING USBHID_KBDUSE_ENTER /* 0x28 Keyboard Return (ENTER) */ -#ifdef CONFIG_HIDKBD_ALLSCANCODES -# define LAST_ENCODING USBHID_KBDUSE_POWER /* 0x66 Keyboard Power */ +#define FIRST_ENCODING USBHID_KBDUSE_ENTER /* 0x28 Keyboard Return (ENTER) */ +#ifndef CONFIG_HIDKBD_ALLSCANCODES +# define LAST_ENCODING USBHID_KBDUSE_POWER /* 0x66 Keyboard Power */ #else -#define LAST_ENCODING USBHID_KBDUSE_KPDHEXADECIMAL /* 0xdd Keypad Hexadecimal */ +# define LAST_ENCODING USBHID_KBDUSE_KPDHEXADECIMAL /* 0xdd Keypad Hexadecimal */ #endif #define USBHID_NUMENCODINGS (LAST_ENCODING - FIRST_ENCODING + 1) @@ -874,10 +882,10 @@ static void usbhost_putbuffer(FAR struct usbhost_state_s *priv, #ifdef CONFIG_HIDKBD_ENCODED static void usbhost_putstream(FAR struct lib_outstream_s *stream, int ch) { - FAR struct usbhost_outstream_s *privstream = (FAR struct lib_outstream_s *)stream; + FAR struct usbhost_outstream_s *privstream = (FAR struct usbhost_outstream_s *)stream; DEBUGASSERT(privstream && privstream->priv); - usbhost_putbuffer(privstream->priv), (uint8_t)ch); + usbhost_putbuffer(privstream->priv, (uint8_t)ch); stream->nput++; } #endif @@ -945,7 +953,6 @@ static inline uint8_t usbhost_mapscancode(uint8_t scancode, uint8_t modifier) static inline void usbhost_encodescancode(FAR struct usbhost_state_s *priv, uint8_t scancode, uint8_t modifier) { - struct usbhost_outstream_s stream; uint8_t encoded; /* Check if the raw scancode is in a valid range */ @@ -954,7 +961,7 @@ static inline void usbhost_encodescancode(FAR struct usbhost_state_s *priv, { /* Yes the value is within range */ - encoded = encoding(scancode - FIRST_ENCODING); + encoded = encoding[scancode - FIRST_ENCODING]; ivdbg(" scancode: %02x modifier: %02x encoded: %d\n", scancode, modifier, encoded); @@ -964,13 +971,14 @@ static inline void usbhost_encodescancode(FAR struct usbhost_state_s *priv, /* And it does correspond to a special function key */ - usbstream->stream.put = usbhost_putstream; - usbstream->stream.nput = 0; - usbstream->priv = priv; + usbstream.stream.put = usbhost_putstream; + usbstream.stream.nput = 0; + usbstream.priv = priv; /* Add the special function value to the user buffer */ - kbd_putspecial((enum kbd_keycode_e)encoded, &usbstream); + kbd_putspecial((enum kbd_keycode_e)encoded, + (FAR struct lib_outstream_s *)&usbstream); } } } @@ -1156,7 +1164,7 @@ static int usbhost_kbdpoll(int argc, char *argv[]) #ifdef CONFIG_HIDKBD_ENCODED else { - usbhost_encodescancode(priv, rpt->key[i], rpt->modifier)); + usbhost_encodescancode(priv, rpt->key[i], rpt->modifier); } #endif } diff --git a/nuttx/include/nuttx/input/kbd_codec.h b/nuttx/include/nuttx/input/kbd_codec.h index d374ed8d3a..0a3a54d2dc 100644 --- a/nuttx/include/nuttx/input/kbd_codec.h +++ b/nuttx/include/nuttx/input/kbd_codec.h @@ -44,6 +44,8 @@ #include #include +#ifdef CONFIG_LIB_KBDCODEC + /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ @@ -87,7 +89,7 @@ enum kbd_keycode_e KEYCODE_CUT, /* Cut */ KEYCODE_COPY, /* Copy */ KEYCODE_PASTE, /* Paste */ - KEYCODE_FIND , /* Find */ + KEYCODE_FIND, /* Find */ /* Selection codes */ @@ -294,5 +296,6 @@ int kbd_get(FAR struct lib_instream_s *stream, } #endif +#endif /* CONFIG_LIB_KBDCODEC */ #endif /* __INCLUDE_NUTTX_INPUT_KBD_CODEC_H */ diff --git a/nuttx/libc/Kconfig b/nuttx/libc/Kconfig index bd470be7f5..a5ff7fd438 100644 --- a/nuttx/libc/Kconfig +++ b/nuttx/libc/Kconfig @@ -3,6 +3,8 @@ # see misc/tools/kconfig-language.txt. # +comment "Standard C Library Options" + config STDIO_BUFFER_SIZE int "C STDIO buffer size" default 64 @@ -273,3 +275,29 @@ config ARCH_BZERO of bzero(). endif + +comment "Non-standard Helper Functions" + +config LIB_KBDCODEC + bool "Keyboard CODEC" + default y + ---help--- + In NuttX, a keyboard/keypad driver is simply a character driver that + may have an (optional) encoding/decoding layer on the data returned + by the character driver. A keyboard may return simple text data + (alphabetic, numeric, and punctuaction) or control characters + (enter, control-C, etc.). We can think about this the normal + "in-band" keyboard data stream. However, in addition, most + keyboards support actions that cannot be represented as text data. + Such actions include things like cursor controls (home, up arrow, + page down, etc.), editing functions (insert, delete, etc.), volume + controls, (mute, volume up, etc.) and other special functions. We + can think about this as special, "out-of-band" keyboard commands. + In this case, some special encoding may be required to multiplex + the in-band text data and out-of-band command streams. + + This option enables the functions that implement the encoding and + decoding of keyboard data. These are the interfaces prototyped in + include/nuttx/input/kbd_codec.h. While not correctly a part of + the C library, it is included here because the decoding side of this + interface must be accessible by end user programs. diff --git a/nuttx/libc/math/Kconfig b/nuttx/libc/math/Kconfig index c24bfd53f3..db9dfae638 100644 --- a/nuttx/libc/math/Kconfig +++ b/nuttx/libc/math/Kconfig @@ -4,7 +4,7 @@ # config LIBM - bool "Math library" + bool "Standard Math library" default n depends on !ARCH_MATH_H ---help--- diff --git a/nuttx/libc/misc/Make.defs b/nuttx/libc/misc/Make.defs index c6af5f8604..ad0313346b 100644 --- a/nuttx/libc/misc/Make.defs +++ b/nuttx/libc/misc/Make.defs @@ -35,7 +35,7 @@ # Add the internal C files to the build -CSRCS += lib_init.c lib_filesem.c lib_kbdencode.c lib_kbddecode.c +CSRCS += lib_init.c lib_filesem.c # Add C files that depend on file OR socket descriptors @@ -63,6 +63,12 @@ CSRCS += lib_match.c CSRCS += lib_crc32.c CSRCS += lib_dbg.c lib_dumpbuffer.c +# Keyboard driver encoder/decoder + +ifneq ($(CONFIG_LIB_KBDCODEC),0) +CSRCS += lib_kbdencode.c lib_kbddecode.c +endif + # Add the misc directory to the build DEPPATH += --dep-path misc From 954529e8c571cd7c2cc5963259d7eef46f6f5429 Mon Sep 17 00:00:00 2001 From: patacongo Date: Thu, 27 Dec 2012 14:01:59 +0000 Subject: [PATCH 017/118] Add support for key release events git-svn-id: http://svn.code.sf.net/p/nuttx/code/trunk@5464 42af7a65-404d-4744-a932-0658087f49c3 --- apps/ChangeLog.txt | 5 +- apps/examples/hidkbd/hidkbd_main.c | 33 +++-- nuttx/ChangeLog | 4 + nuttx/Documentation/NuttxPortingGuide.html | 140 ++++++++++++++++----- nuttx/drivers/usbhost/usbhost_hidkbd.c | 8 +- nuttx/include/nuttx/input/kbd_codec.h | 100 +++++++++++---- nuttx/libc/misc/lib_kbddecode.c | 99 ++++++++------- nuttx/libc/misc/lib_kbdencode.c | 105 +++++++++++++--- 8 files changed, 359 insertions(+), 135 deletions(-) diff --git a/apps/ChangeLog.txt b/apps/ChangeLog.txt index d156b10657..d6a2f9d907 100644 --- a/apps/ChangeLog.txt +++ b/apps/ChangeLog.txt @@ -455,4 +455,7 @@ this build phase. * apps/examples/hidbkd: Now supports decoding of encoded special keys if CONFIG_EXAMPLES_HIDKBD_ENCODED is defined. - + * apps/examples/hidbkd: Add support for decoding key release events + as well. However, the USB HID keyboard drier has not yet been + updated to detect key release events. That is kind of tricky in + the USB HID keyboard report data. diff --git a/apps/examples/hidkbd/hidkbd_main.c b/apps/examples/hidkbd/hidkbd_main.c index 8a632bab75..d7e79b1216 100644 --- a/apps/examples/hidkbd/hidkbd_main.c +++ b/apps/examples/hidkbd/hidkbd_main.c @@ -176,7 +176,7 @@ static void hidkbd_decode(FAR char *buffer, ssize_t nbytes) { /* Decode the next thing from the buffer */ - ret = kbd_get((FAR struct lib_instream_s *)&kbdstream, &state, &ch); + ret = kbd_decode((FAR struct lib_instream_s *)&kbdstream, &state, &ch); if (ret == KBD_ERROR) { break; @@ -184,14 +184,31 @@ static void hidkbd_decode(FAR char *buffer, ssize_t nbytes) /* Normal data? Or special key? */ - if (ret == KBD_NORMAL) + switch (ret) { - printf("Data: %c [%02x]\n", isprint(ch) ? ch : '.', ch); - } - else - { - DEBUGASSERT(ret == KBD_SPECIAL); - printf("Special: %d\n", ch); + case KBD_PRESS: /* Key press event */ + printf("Normal Press: %c [%02x]\n", isprint(ch) ? ch : '.', ch); + break; + + case KBD_RELEASE: /* Key release event */ + printf("Normal Release: %c [%02x]\n", isprint(ch) ? ch : '.', ch); + break; + + case KBD_SPECPRESS: /* Special key press event */ + printf("Special Press: %d\n", ch); + break; + + case KBD_SPECREL: /* Special key release event */ + printf("Special Release: %d\n", ch); + break; + + case KBD_ERROR: /* Error or end-of-file */ + printf("EOF: %d\n", ret); + break; + + default: + printf("Unexpected: %d\n", ret); + break; } } } diff --git a/nuttx/ChangeLog b/nuttx/ChangeLog index a7087656ae..2e114af8c7 100644 --- a/nuttx/ChangeLog +++ b/nuttx/ChangeLog @@ -3832,4 +3832,8 @@ UG-2864HSWEG01 OLED for the STM32F4Discovery board. * drivers/usbhost/usbhost_hidkbd.c: Correct a logic error in how tasks waiting for read data are awakened. + * libc/misc/lib_kbdencode.c and lib_kbddecode.c: Now handles keypress + events too. However, the USB HID keyboard drier has not yet been + updated to detect key release events. That is kind of tricky in + the USB HID keyboard report data. diff --git a/nuttx/Documentation/NuttxPortingGuide.html b/nuttx/Documentation/NuttxPortingGuide.html index ebb3eff4bf..e626bf7a57 100644 --- a/nuttx/Documentation/NuttxPortingGuide.html +++ b/nuttx/Documentation/NuttxPortingGuide.html @@ -3623,20 +3623,27 @@ extern void up_ledoff(int led);

    6.3.16 Keyboard/Keypad Drivers

    - "Out-of-Band" Commands. - Keyboards and keypads are the same device for NuttX. + Keypads vs. Keyboards + Keyboards and keypads are really the same devices for NuttX. A keypad is thought of as simply a keyboard with fewer keys. +

    +

    + Special Commands. In NuttX, a keyboard/keypad driver is simply a character driver that may have an (optional) encoding/decoding layer on the data returned by the character driver. - A keyboard may return simple text data (alphabetic, numeric, and punctuaction) or control characters (enter, control-C, etc.). - We can think about this the normal "in-band" keyboard data stream. - However, in addition, most keyboards support actions that cannot be represented as text data. + A keyboard may return simple text data (alphabetic, numeric, and punctuaction) or control characters (enter, control-C, etc.) when a key is pressed. + We can think about this the "normal" keyboard data stream. + However, in addition, most keyboards support actions that cannot be represented as text or control data. Such actions include things like cursor controls (home, up arrow, page down, etc.), editing functions (insert, delete, etc.), volume controls, (mute, volume up, etc.) and other special functions. - We can think about this as special, "out-of-band" keyboard commands. - In this case, some special encoding may be required to multiplex the in-band text data and out-of-band command streams. + In this case, some special encoding may be required to multiplex the normal text data and special command key press data streams. +

    +

    + Key Press and Release Events + Sometimes the time that a key is released is needed by applications as well. + Thus, in addition to normal and special key press events, it may also be necessary to encode normal and special key release events.

    Encoding/Decoding Layer. - An optional encoding/decoding layer can be used with the basic character driver to encode the out-of-band commands into the text data stream. + An optional encoding/decoding layer can be used with the basic character driver to encode the keyboard events into the text data stream. The function interfaces that comprise that encoding/decoding layer are defined in the header file include/nuttx/input/kbd_code.h. These functions provide an matched set of (a) driver encoding interfaces, and (b) application decoding interfaces.

    @@ -3644,21 +3651,23 @@ extern void up_ledoff(int led);
  • Driver Encoding Interfaces. + These are interfaces used by the keyboard/keypad driver to encode keyboard events and data.

    • - kbd_puttext() + kbd_press()

      Function Prototype:

         #include <nuttx/streams.h>
         #include <nuttx/input/kbd_codec.h>
        -void kbd_puttext(int ch, FAR struct lib_outstream_s *stream);
        +void kbd_press(int ch, FAR struct lib_outstream_s *stream);
         

      Description:

        - Put one byte of normal, "in-band" ASCII data into the output stream. + Indicates a normal key press event. + Put one byte of normal keyboard data into the output stream.

      Input Pameters:

        @@ -3676,19 +3685,78 @@ void kbd_puttext(int ch, FAR struct lib_outstream_s *stream);
      • - kbd_putspecial() + kbd_release()

        Function Prototype:

           #include <nuttx/streams.h>
           #include <nuttx/input/kbd_codec.h>
          -void kbd_putspecial(enum kbd_keycode_e keycode, FAR struct lib_outstream_s *stream);
          +void kbd_release(uint8_t ch, FAR struct lib_outstream_s *stream);
           

        Description:

          - Put one special, "out-of-band" command into the output stream. + Encode the release of a normal key.

        Input Pameters:

        +
          +
        • + ch: The character associated with the key that was releared. +
        • +
        • + stream: An instance of lib_outstream_s to perform the actual low-level put operation. +
        • +
        +

        Returned Value:

        +
          + None. +
        +
      • +
      • +

        + kbd_specpress() +

        +

        Function Prototype:

        +
          +#include <nuttx/streams.h>
          +#include <nuttx/input/kbd_codec.h>
          +void kbd_specpress(enum kbd_keycode_e keycode, FAR struct lib_outstream_s *stream);
          +
        +

        Description:

        +
          + Denotes a special key press event. + Put one special keyboard command into the output stream. +
        +

        Input Pameters:

        +
          +
        • + keycode: The command to be added to the output stream. + The enumeration enum kbd_keycode_e keycode identifies all commands known to the system. +
        • +
        • + stream: An instance of lib_outstream_s to perform the actual low-level put operation. +
        • +
        +

        Returned Value:

        +
          + None. +
        +
      • +
      • +

        + kbd_specrel() +

        +

        Function Prototype:

        +
          +#include <nuttx/streams.h>
          +#include <nuttx/input/kbd_codec.h>
          +void kbd_specrel(enum kbd_keycode_e keycode, FAR struct lib_outstream_s *stream);
          +
        +

        Description:

        +
          + Denotes a special key release event. + Put one special keyboard command into the output stream. +
        +

        Input Pameters:

        • keycode: The command to be added to the output stream. @@ -3708,17 +3776,18 @@ void kbd_putspecial(enum kbd_keycode_e keycode, FAR struct lib_outstream_s *stre
        • Application Decoding Interfaces. -

          + These are user interfaces to decode the values returned by the keyboard/keypad driver. +

          • - kbd_get() + kbd_decode()

            Function Prototype:

               #include <nuttx/streams.h>
               #include <nuttx/input/kbd_codec.h>
              -int kbd_get(FAR struct lib_instream_s *stream, FAR struct kbd_getstate_s *state, FAR uint8_t *pch);
              +int kbd_decode(FAR struct lib_instream_s *stream, FAR struct kbd_getstate_s *state, FAR uint8_t *pch);
               

            Description:

              @@ -3730,30 +3799,41 @@ int kbd_get(FAR struct lib_instream_s *stream, FAR struct kbd_getstate_s *state, stream: An instance of lib_instream_s to perform the actual low-level get operation.
            • - pch: The location character to save the returned value. - This may be either a normal, "in-band" ASCII characer or a special, "out-of-band" command (i.e., a value from enum kbd_getstate_s. + pch: The location to save the returned value. + This may be either a normal, character code or a special command (i.e., a value from enum kbd_getstate_s.
            • state: A user provided buffer to support parsing. - This structure should be cleared the first time that kbd_get is called. + This structure should be cleared the first time that kbd_decode() is called.

            Returned Value:

            • - 1: - Indicates the successful receipt of a special, "out-of-band" command. - The returned value in pch is a value from enum kbd_getstate_s. -
            • -
            • - 0: - Indicates the successful receipt of normal, "in-band" ASCII data. + KBD_PRESS (0): + Indicates the successful receipt of normal, keyboard data. + This corresponds to a keypress event. The returned value in pch is a simple byte of text or control data.
            • - EOF: - An error has getting the next character (reported by the stream). - Normally indicates the end of file. + KBD_RELEASE (1): + Indicates a key release event. + The returned value in pch is the byte of text or control data corresponding to the released key. +
            • +
            • + KBD_SPECPRESS (2): + Indicates the successful receipt of a special keyboard command. + The returned value in pch is a value from enum kbd_getstate_s. +
            • +
            • + KBD_SPECREL (3): + Indicates a special command key release event. + The returned value in pch is a value from enum kbd_getstate_s. +
            • +
            • + KBD_ERROR (EOF): + An error has getting the next character (reported by the stream). + Normally indicates the end of file.
          • diff --git a/nuttx/drivers/usbhost/usbhost_hidkbd.c b/nuttx/drivers/usbhost/usbhost_hidkbd.c index 917ebfa3f2..0bab89c284 100644 --- a/nuttx/drivers/usbhost/usbhost_hidkbd.c +++ b/nuttx/drivers/usbhost/usbhost_hidkbd.c @@ -530,7 +530,7 @@ static const uint8_t ucmap[USBHID_NUMSCANCODES] = 0, 0, 0, 0, 0, 0, 0, 0, /* 0x40-0x47: F7,F8,F9,F10,F11,F12,PrtScn,ScrollLock */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x48-0x4f: Pause,Insert,Home,PageUp,DeleteForward,End,PageDown,RightArrow */ 0, 0, 0, 0, '/', '*', '-', '+', /* 0x50-0x57: LeftArrow,DownArrow,UpArrow,Num Lock,/,*,-,+ */ - '\n', '1', '2', '3', '4', '4', '6', '7', /* 0x58-0x5f: Enter,1-7 */ + '\n', '1', '2', '3', '4', '5', '6', '7', /* 0x58-0x5f: Enter,1-7 */ '8', '9', '0', '.', 0, 0, 0, '=', /* 0x60-0x67: 8-9,0,.,Non-US \,Application,Power,= */ #ifdef CONFIG_HIDKBD_ALLSCANCODES 0, 0, 0, 0, 0, 0, 0, 0, /* 0x68-0x6f: F13,F14,F15,F16,F17,F18,F19,F20 */ @@ -565,7 +565,7 @@ static const uint8_t lcmap[USBHID_NUMSCANCODES] = 0, 0, 0, 0, 0, 0, 0, 0, /* 0x40-0x47: F7,F8,F9,F10,F11,F12,PrtScn,ScrollLock */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x48-0x4f: Pause,Insert,Home,PageUp,DeleteForward,End,PageDown,RightArrow */ 0, 0, 0, 0, '/', '*', '-', '+', /* 0x50-0x57: LeftArrow,DownArrow,UpArrow,Num Lock,/,*,-,+ */ - '\n', '1', '2', '3', '4', '4', '6', '7', /* 0x58-0x5f: Enter,1-7 */ + '\n', '1', '2', '3', '4', '5', '6', '7', /* 0x58-0x5f: Enter,1-7 */ '8', '9', '0', '.', 0, 0, 0, '=', /* 0x60-0x67: 8-9,0,.,Non-US \,Application,Power,= */ #ifdef CONFIG_HIDKBD_ALLSCANCODES 0, 0, 0, 0, 0, 0, 0, 0, /* 0x68-0x6f: F13,F14,F15,F16,F17,F18,F19,F20 */ @@ -977,8 +977,8 @@ static inline void usbhost_encodescancode(FAR struct usbhost_state_s *priv, /* Add the special function value to the user buffer */ - kbd_putspecial((enum kbd_keycode_e)encoded, - (FAR struct lib_outstream_s *)&usbstream); + kbd_specpress((enum kbd_keycode_e)encoded, + (FAR struct lib_outstream_s *)&usbstream); } } } diff --git a/nuttx/include/nuttx/input/kbd_codec.h b/nuttx/include/nuttx/input/kbd_codec.h index 0a3a54d2dc..9a7c7c8e6d 100644 --- a/nuttx/include/nuttx/input/kbd_codec.h +++ b/nuttx/include/nuttx/input/kbd_codec.h @@ -1,6 +1,6 @@ /************************************************************************************ * include/nuttx/input/kbd_codec.h - * Serialize and marshaling out-of-band keyboard data + * Serialize and marshaling keyboard data and events * * Copyright (C) 2012 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -54,9 +54,7 @@ * Public Types ****************************************************************************/ -/* These are the special, "out-of-band" keyboard commands recognized by the - * CODEC. - */ +/* These are the special keyboard commands recognized by the CODEC. */ enum kbd_keycode_e { @@ -190,11 +188,13 @@ enum kbd_keycode_e #define FIRST_KEYCODE KEYCODE_FWDDEL #define LAST_KEYCODE KEYCODE_F24 -/* kbd_get return values */ +/* kbd_decode() return values */ -#define KBD_NORMAL 0 -#define KBD_SPECIAL 1 -#define KBD_ERROR EOF +#define KBD_PRESS 0 /* Key press event */ +#define KBD_RELEASE 1 /* Key release event */ +#define KBD_SPECPRESS 2 /* Special key press event */ +#define KBD_SPECREL 3 /* Special key release event */ +#define KBD_ERROR EOF /* Error or end-of-file */ /**************************************************************************** * Public Types @@ -222,10 +222,11 @@ extern "C" ****************************************************************************/ /**************************************************************************** - * Name: kbd_puttext + * Name: kbd_press * * Description: - * Put one byte of normal, "in-band" ASCII data into the output stream. + * Indicates a normal key press event. Put one byte of normal keyboard + * data into the output stream. * * Input Parameters: * ch - The character to be added to the output stream. @@ -237,13 +238,32 @@ extern "C" * ****************************************************************************/ -#define kbd_puttext(ch, stream) (stream)->put((stream), (int)(ch)) +#define kbd_press(ch, stream) (stream)->put((stream), (int)(ch)) /**************************************************************************** - * Name: kbd_putspecial + * Name: kbd_release * * Description: - * Put one special, "out-of-band" command into the output stream. + * Encode the release of a normal key. + * + * Input Parameters: + * ch - The character associated with the key that was releared. + * stream - An instance of lib_outstream_s to do the low-level put + * operation. + * + * Returned Value: + * None + * + ****************************************************************************/ + +void kbd_release(uint8_t ch, FAR struct lib_outstream_s *stream); + +/**************************************************************************** + * Name: kbd_specpress + * + * Description: + * Denotes a special key press event. Put one special keyboard command + * into the output stream. * * Input Parameters: * keycode - The command to be added to the output stream. @@ -255,8 +275,28 @@ extern "C" * ****************************************************************************/ -void kbd_putspecial(enum kbd_keycode_e keycode, - FAR struct lib_outstream_s *stream); +void kbd_specpress(enum kbd_keycode_e keycode, + FAR struct lib_outstream_s *stream); + +/**************************************************************************** + * Name: kbd_specrel + * + * Description: + * Denotes a special key release event. Put one special keyboard + * command into the output stream. + * + * Input Parameters: + * keycode - The command to be added to the output stream. + * stream - An instance of lib_outstream_s to do the low-level put + * operation. + * + * Returned Value: + * None + * + ****************************************************************************/ + +void kbd_specrel(enum kbd_keycode_e keycode, + FAR struct lib_outstream_s *stream); /**************************************************************************** * The following functions are intended for use by "consumer" applications @@ -264,7 +304,7 @@ void kbd_putspecial(enum kbd_keycode_e keycode, ****************************************************************************/ /**************************************************************************** - * Name: kbd_get + * Name: kbd_decode * * Description: * Get one byte of data or special command from the driver provided input @@ -273,24 +313,30 @@ void kbd_putspecial(enum kbd_keycode_e keycode, * Input Parameters: * stream - An instance of lib_instream_s to do the low-level get * operation. - * pch - The location character to save the returned value. This may be - * either a normal, "in-band" ASCII characer or a special, "out-of-band" - * command. + * pch - The location to save the returned value. This may be + * either a normal, character code or a special command from enum + * kbd_keycode_e * state - A user provided buffer to support parsing. This structure - * should be cleared the first time that kbd_get is called. + * should be cleared the first time that kbd_decode is called. * * Returned Value: - * 1 - Indicates the successful receipt of a special, "out-of-band" command. - * The returned value in pch is a value from enum kbd_getstate_s. - * 0 - Indicates the successful receipt of normal, "in-band" ASCII data. - * The returned value in pch is a simple byte of text or control data. + * + * KBD_PRESS - Indicates the successful receipt of normal, keyboard data. + * This corresponds to a keypress event. The returned value in pch is a + * simple byte of text or control data corresponding to the pressed key. + * KBD_RELEASE - Indicates a key release event. The returned value in pch + * is the byte of text or control data corresponding to the released key. + * KBD_SPECPRESS - Indicates the successful receipt of a special keyboard + * command. The returned value in pch is a value from enum kbd_getstate_s. + * KBD_SPECREL - Indicates a special key release event. The returned value + * in pch is a value from enum kbd_getstate_s. * EOF - An error has getting the next character (reported by the stream). - * Normally indicates the end of file. + * Normally indicates the end of file. * ****************************************************************************/ -int kbd_get(FAR struct lib_instream_s *stream, - FAR struct kbd_getstate_s *state, FAR uint8_t *pch); +int kbd_decode(FAR struct lib_instream_s *stream, + FAR struct kbd_getstate_s *state, FAR uint8_t *pch); #ifdef __cplusplus } diff --git a/nuttx/libc/misc/lib_kbddecode.c b/nuttx/libc/misc/lib_kbddecode.c index cb57b52150..62554902c9 100644 --- a/nuttx/libc/misc/lib_kbddecode.c +++ b/nuttx/libc/misc/lib_kbddecode.c @@ -1,4 +1,4 @@ -/******************************************************************************************** +/**************************************************************************** * libc/msic/lib_kbddecode.c * Decoding side of the Keyboard CODEC * @@ -32,38 +32,43 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - ********************************************************************************************/ + ****************************************************************************/ -/******************************************************************************************** +/**************************************************************************** * Included Files - ********************************************************************************************/ + ****************************************************************************/ #include #include #include +#include #include #include #include -/******************************************************************************************** +/**************************************************************************** * Pre-Processor Definitions - ********************************************************************************************/ + ****************************************************************************/ -#define NDX_ESC 0 -#define NDX_BRACKET 1 -#define NDX_CODE 2 -#define NCX_SEMICOLON 3 +#define NDX_ESC 0 +#define NDX_BRACKET 1 +#define NDX_CODE 2 +#define NDX_TERMINATOR 3 -#define NCH_ESC 1 -#define NCH_BRACKET 2 -#define NCH_CODE 3 -#define NCH_SEMICOLON 4 +#define NCH_ESC 1 +#define NCH_BRACKET 2 +#define NCH_CODE 3 +#define NCH_TERMINATOR 4 -/******************************************************************************************** +#define TERM_MIN ('a' + KBD_RELEASE) +#define TERM_MAX ('a' + KBD_SPECREL) +#define TERM_RETURN(a) ((a) - 'a') + +/**************************************************************************** * Private Functions - ********************************************************************************************/ + ****************************************************************************/ /**************************************************************************** * Name: kbd_reget @@ -76,16 +81,11 @@ * stream - An instance of lib_instream_s to do the low-level get * operation. * pch - The location character to save the returned value. This may be - * either a normal, "in-band" ASCII characer or a special, "out-of-band" - * command. - * state - A user provided buffer to support parsing. This structure - * should be cleared the first time that kbd_get is called. + * either a normal, character code or a special command from enum + * kbd_keycode_e * * Returned Value: - * 2 - Indicates the successful receipt of a special, "out-of-band" command - * 1 - Indicates the successful receipt of normal, "in-band" ASCII data. - * 0 - Indicates end-of-file or that the stream has been closed - * EOF - An error has getting the next character (reported by the stream). + * KBD_PRESS - Indicates the successful receipt of norma keyboard data. * ****************************************************************************/ @@ -96,15 +96,15 @@ static int kbd_reget(FAR struct kbd_getstate_s *state, FAR uint8_t *pch) *pch = state->buf[state->ndx]; state->ndx++; state->nch--; - return KBD_NORMAL; + return KBD_PRESS; } -/******************************************************************************************** +/**************************************************************************** * Public Functions - ********************************************************************************************/ + ****************************************************************************/ /**************************************************************************** - * Name: kbd_get + * Name: kbd_decode * * Description: * Get one byte of data or special command from the driver provided input @@ -113,24 +113,30 @@ static int kbd_reget(FAR struct kbd_getstate_s *state, FAR uint8_t *pch) * Input Parameters: * stream - An instance of lib_instream_s to do the low-level get * operation. - * pch - The location character to save the returned value. This may be - * either a normal, "in-band" ASCII characer or a special, "out-of-band" - * command. + * pch - The location to save the returned value. This may be + * either a normal, character code or a special command from enum + * kbd_keycode_e * state - A user provided buffer to support parsing. This structure - * should be cleared the first time that kbd_get is called. + * should be cleared the first time that kbd_decode is called. * * Returned Value: - * 1 - Indicates the successful receipt of a special, "out-of-band" command. - * The returned value in pch is a value from enum kbd_getstate_s. - * 0 - Indicates the successful receipt of normal, "in-band" ASCII data. - * The returned value in pch is a simple byte of text or control data. + * + * KBD_PRESS - Indicates the successful receipt of normal, keyboard data. + * This corresponds to a keypress event. The returned value in pch is a + * simple byte of text or control data corresponding to the pressed key. + * KBD_RELEASE - Indicates a key release event. The returned value in pch + * is the byte of text or control data corresponding to the released key. + * KBD_SPECPRESS - Indicates the successful receipt of a special keyboard + * command. The returned value in pch is a value from enum kbd_getstate_s. + * KBD_SPECREL - Indicates a special key release event. The returned value + * in pch is a value from enum kbd_getstate_s. * EOF - An error has getting the next character (reported by the stream). - * Normally indicates the end of file. + * Normally indicates the end of file. * ****************************************************************************/ -int kbd_get(FAR struct lib_instream_s *stream, - FAR struct kbd_getstate_s *state, FAR uint8_t *pch) +int kbd_decode(FAR struct lib_instream_s *stream, + FAR struct kbd_getstate_s *state, FAR uint8_t *pch) { int ch; @@ -147,7 +153,7 @@ int kbd_get(FAR struct lib_instream_s *stream, state->ndx = 0; - /* No, ungotten characters. Check for the beginning of an esc sequence. */ + /* No, ungotten characters. Check for the beginning of an ESC sequence. */ ch = stream->get(stream); if (ch == EOF) @@ -195,7 +201,7 @@ int kbd_get(FAR struct lib_instream_s *stream, } } - /* Get and verify the special, "out-of-band" command code */ + /* Get and verify the special keyboard data to decode */ ch = stream->get(stream); if (ch == EOF) @@ -234,12 +240,12 @@ int kbd_get(FAR struct lib_instream_s *stream, } else { - state->buf[NCX_SEMICOLON] = (uint8_t)ch; - state->nch = NCH_SEMICOLON; + state->buf[NDX_TERMINATOR] = (uint8_t)ch; + state->nch = NCH_TERMINATOR; /* Check for a valid special command code */ - if (ch != ';') + if (ch < TERM_MIN || ch > TERM_MAX) { /* Not a special command code, return the ESC now and the next two * characters later. @@ -250,11 +256,12 @@ int kbd_get(FAR struct lib_instream_s *stream, } /* We have successfully parsed the the entire escape sequence. Return the - * special code in pch and the value 2. + * keyboard value in pch and the value an indication determined by the + * terminating character. */ *pch = state->buf[NDX_CODE]; state->nch = 0; - return KBD_SPECIAL; + return TERM_RETURN(state->buf[NDX_TERMINATOR]); } diff --git a/nuttx/libc/misc/lib_kbdencode.c b/nuttx/libc/misc/lib_kbdencode.c index 40a8805b11..80138ca800 100644 --- a/nuttx/libc/misc/lib_kbdencode.c +++ b/nuttx/libc/misc/lib_kbdencode.c @@ -1,4 +1,4 @@ -/******************************************************************************************** +/**************************************************************************** * libc/msic/lib_kbdencode.c * Encoding side of the Keyboard CODEC * @@ -32,11 +32,11 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - ********************************************************************************************/ + ****************************************************************************/ -/******************************************************************************************** +/**************************************************************************** * Included Files - ********************************************************************************************/ + ****************************************************************************/ #include @@ -47,19 +47,67 @@ #include #include -/******************************************************************************************** +/**************************************************************************** * Pre-Processor Definitions - ********************************************************************************************/ - -/******************************************************************************************** - * Public Functions - ********************************************************************************************/ + ****************************************************************************/ /**************************************************************************** - * Name: kbd_putspecial + * Name: kbd_encode * * Description: - * Put one special, "out-of-band" command into the output stream. + * Encode one special special sequence command into the output stream. + * + * Input Parameters: + * keycode - The command to be added to the output stream. + * stream - An instance of lib_outstream_s to do the low-level put + * operation. + * terminator - Escape sequence terminating character. + * + * Returned Value: + * None + * + ****************************************************************************/ + +static void kbd_encode(uint8_t keycode, FAR struct lib_outstream_s *stream, + uint8_t terminator) +{ + stream->put(stream, ASCII_ESC); + stream->put(stream, '['); + stream->put(stream, (int)keycode); + stream->put(stream, terminator); +} + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: kbd_release + * + * Description: + * Encode the release of a normal key. + * + * Input Parameters: + * ch - The character associated with the key that was releared. + * stream - An instance of lib_outstream_s to do the low-level put + * operation. + * + * Returned Value: + * None + * + ****************************************************************************/ + +void kbd_release(uint8_t ch, FAR struct lib_outstream_s *stream) +{ + kbd_encode(ch, stream, ('a' + KBD_RELEASE)); +} + +/**************************************************************************** + * Name: kbd_specpress + * + * Description: + * Denotes a special key press event. Put one special keyboard command + * into the output stream. * * Input Parameters: * keycode - The command to be added to the output stream. @@ -71,14 +119,33 @@ * ****************************************************************************/ -void kbd_putspecial(enum kbd_keycode_e keycode, - FAR struct lib_outstream_s *stream) +void kbd_specpress(enum kbd_keycode_e keycode, + FAR struct lib_outstream_s *stream) { DEBUGASSERT(stream && keycode >= KEYCODE_FWDDEL && keycode <= LAST_KEYCODE); - - stream->put(stream, ASCII_ESC); - stream->put(stream, '['); - stream->put(stream, (int)keycode); - stream->put(stream, ';'); + kbd_encode((uint8_t)keycode, stream, ('a' + KBD_SPECPRESS)); } +/**************************************************************************** + * Name: kbd_specrel + * + * Description: + * Denotes a special key release event. Put one special keyboard + * command into the output stream. + * + * Input Parameters: + * keycode - The command to be added to the output stream. + * stream - An instance of lib_outstream_s to do the low-level put + * operation. + * + * Returned Value: + * None + * + ****************************************************************************/ + +void kbd_specrel(enum kbd_keycode_e keycode, + FAR struct lib_outstream_s *stream) +{ + DEBUGASSERT(stream && keycode >= KEYCODE_FWDDEL && keycode <= LAST_KEYCODE); + kbd_encode((uint8_t)keycode, stream, ('a' + KBD_SPECREL)); +} From e0be95b9a02ebd38cc370b81586371bd93e6ac76 Mon Sep 17 00:00:00 2001 From: patacongo Date: Fri, 28 Dec 2012 23:40:54 +0000 Subject: [PATCH 018/118] Add board support at configs/zp214xpa for the The0.net ZP213X/4XPA board with the LPC2148; Add configurations sim/nxlines. convert mcu123-lpc214x/nsh to use the kconfig-frontends. git-svn-id: http://svn.code.sf.net/p/nuttx/code/trunk@5465 42af7a65-404d-4744-a932-0658087f49c3 --- apps/examples/hidkbd/hidkbd_main.c | 11 +- nuttx/ChangeLog | 6 + nuttx/Documentation/NuttX.html | 5 +- nuttx/arch/arm/src/lpc214x/Kconfig | 134 +++ nuttx/configs/Kconfig | 14 +- nuttx/configs/README.txt | 5 + nuttx/configs/mcu123-lpc214x/README.txt | 18 +- nuttx/configs/mcu123-lpc214x/nsh/defconfig | 764 ++++++++++++------ .../configs/mcu123-lpc214x/scripts/ld.script | 6 +- nuttx/configs/sim/nxlines/Make.defs | 107 +++ nuttx/configs/sim/nxlines/defconfig | 591 ++++++++++++++ .../nsh/appconfig => sim/nxlines/setenv.sh} | 27 +- nuttx/configs/zp214xpa/Kconfig | 7 + nuttx/configs/zp214xpa/README.txt | 136 ++++ nuttx/configs/zp214xpa/include/board.h | 68 ++ nuttx/configs/zp214xpa/nsh/Make.defs | 128 +++ nuttx/configs/zp214xpa/nsh/defconfig | 574 +++++++++++++ nuttx/configs/zp214xpa/nsh/setenv.sh | 65 ++ nuttx/configs/zp214xpa/scripts/ld.script | 120 +++ nuttx/configs/zp214xpa/src/Makefile | 84 ++ nuttx/drivers/mmcsd/Kconfig | 1 + nuttx/drivers/usbhost/usbhost_hidkbd.c | 6 +- 22 files changed, 2593 insertions(+), 284 deletions(-) create mode 100644 nuttx/configs/sim/nxlines/Make.defs create mode 100644 nuttx/configs/sim/nxlines/defconfig rename nuttx/configs/{mcu123-lpc214x/nsh/appconfig => sim/nxlines/setenv.sh} (76%) mode change 100644 => 100755 create mode 100644 nuttx/configs/zp214xpa/Kconfig create mode 100644 nuttx/configs/zp214xpa/README.txt create mode 100644 nuttx/configs/zp214xpa/include/board.h create mode 100644 nuttx/configs/zp214xpa/nsh/Make.defs create mode 100644 nuttx/configs/zp214xpa/nsh/defconfig create mode 100755 nuttx/configs/zp214xpa/nsh/setenv.sh create mode 100644 nuttx/configs/zp214xpa/scripts/ld.script create mode 100644 nuttx/configs/zp214xpa/src/Makefile diff --git a/apps/examples/hidkbd/hidkbd_main.c b/apps/examples/hidkbd/hidkbd_main.c index d7e79b1216..abc942a446 100644 --- a/apps/examples/hidkbd/hidkbd_main.c +++ b/apps/examples/hidkbd/hidkbd_main.c @@ -177,12 +177,14 @@ static void hidkbd_decode(FAR char *buffer, ssize_t nbytes) /* Decode the next thing from the buffer */ ret = kbd_decode((FAR struct lib_instream_s *)&kbdstream, &state, &ch); - if (ret == KBD_ERROR) + if (ret == KBD_ERROR) /* Error or end-of-file */ { + /* Break out when all of the data has been processed */ + break; } - /* Normal data? Or special key? */ + /* Normal data? Or special key? Press? Or release? */ switch (ret) { @@ -202,10 +204,7 @@ static void hidkbd_decode(FAR char *buffer, ssize_t nbytes) printf("Special Release: %d\n", ch); break; - case KBD_ERROR: /* Error or end-of-file */ - printf("EOF: %d\n", ret); - break; - + case KBD_ERROR: /* Error or end-of-file, already handled */ default: printf("Unexpected: %d\n", ret); break; diff --git a/nuttx/ChangeLog b/nuttx/ChangeLog index 2e114af8c7..dcabb6c071 100644 --- a/nuttx/ChangeLog +++ b/nuttx/ChangeLog @@ -3836,4 +3836,10 @@ events too. However, the USB HID keyboard drier has not yet been updated to detect key release events. That is kind of tricky in the USB HID keyboard report data. + * configs/mcu123-214x/nsh: Converted to use the kconfig-frontends + configuration tool. + * configs/zp214xpa: Add basic support for the The0.net ZP213x/4xPA + board (with the LPC2148 and the UG_2864AMBAG01). + * configs/sim/nxlines: Add an nxlines configuration for the + simulator. diff --git a/nuttx/Documentation/NuttX.html b/nuttx/Documentation/NuttX.html index 84f298d3ac..dc454c0b61 100644 --- a/nuttx/Documentation/NuttX.html +++ b/nuttx/Documentation/NuttX.html @@ -8,7 +8,7 @@

            NuttX RTOS

            -

            Last Updated: December 20, 2012

            +

            Last Updated: December 28, 2012

            @@ -1505,7 +1505,8 @@ svn checkout -r5447 http://svn.code.sf.net/p/nuttx/code/trunk nuttx-code

            NXP LPC214x. Support is provided for the NXP LPC214x family of processors. In particular, - support is provided for the mcu123.com lpc214x evaluation board (LPC2148). + support is provided for (1) the mcu123.com lpc214x evaluation board (LPC2148) + and (1) the The0.net ZPA213X/4XPA development board (with the The0.net UG-2864AMBAG01 OLED) This port also used the GNU arm-nuttx-elf toolchain* under Linux or Cygwin.

              diff --git a/nuttx/arch/arm/src/lpc214x/Kconfig b/nuttx/arch/arm/src/lpc214x/Kconfig index a26483ed9e..5d52eb0001 100644 --- a/nuttx/arch/arm/src/lpc214x/Kconfig +++ b/nuttx/arch/arm/src/lpc214x/Kconfig @@ -4,3 +4,137 @@ # comment "LPC214x Configuration Options" + +# Fragments of LPC214x chip selection logic. The LPC2148 is the only chip +# supported for now. + +config ARCH_CHIP_LPC2148 + bool + default y + +comment "LPC214x Initialization Options" + +choice + prompt "Memory Execution Mode" + default DEFAULT_MODE + +config EXTMEM_MODE + bool "External Memory Mode" + ---help--- + Code executes from external memory starting at address 0x8000:0000. + +config RAM_MODE + bool "RAM Memory Mode" + ---help--- + Code executes from on-chip RAM at address 0x4000:0000. + +config DEFAULT_MODE + bool "Default Memory Mode" + ---help--- + Executes from 0x0000:0000. In non-default modes, the MEMAP register + is set override the settings of the CPU configuration pins. + +endchoice + +config CODE_BASE + hex "Execuation Base Address" + default 0x00000000 + ---help--- + This must match the expected address for the selected "Memory + Execution Address": + + EXTMEM_MODE: 0x8000:0000 + RAM_MODE: 0x4000:0000 + DEFAULT)MODE: 0x0000:0000 + +config PLL_SETUP + bool "Configure the PLL" + default y + +config MAM_SETUP + bool "Configure the Memory Accelerator Module (MAM)" + default y + +config APBDIV_SETUP + bool "Configure the APB Divider" + default y + +config APBDIV_VALUE + int "APB Divisor" + default 1 + +config EMC_SETUP + bool "Configure EMC" + default n + +config BCFG0_SETUP + bool "Configure BCFG0" + default n + +config BCFG1_SETUP + bool "Configure BCFG1" + default n + +config BCFG2_SETUP + bool "Configure BCFG2" + default n + +config BCFG3_SETUP + bool "Configure BCFG3" + default n + +config ADC_SETUP + bool "Configure ADC" + default y + +menu "LPC214x Peripheral Support" + +config LPC214X_UART0 + bool + default y + select ARCH_HAVE_UART0 + +config LPC214X_UART1 + bool + default y + select ARCH_HAVE_UART1 + +config LPC214X_USBDEV + bool "USB Device" + default y + depends on USBDEV + +endmenu + +config LPC214x_FIO + bool "Fast GPIO" + default n + +if LPC214X_USBDEV +menu "LPC214x USB Device Configuration" + +config LPC214X_USBDEV_DMA + bool "USB Device DMA Support" + default n + +config CONFIG_LPC214X_USBDEV_NDMADESCRIPTORS + int "Number of USB DMA Descriptors" + default 8 + depends on LPC214X_USBDEV_DMA + +config LPC214X_USBDEV_EPFAST_INTERRUPT + bool "USB Device Fast Endpoint Interrupts" + default n + +config LPC214X_USBDEV_FRAME_INTERRUPT + bool "USB Device Frame Interrupts" + default n + +config LPC214X_USBDEV_REGDEBUG + bool "USB Device Register-Level Debug Output" + default n + depends on DEBUG + +endmenu +endif + diff --git a/nuttx/configs/Kconfig b/nuttx/configs/Kconfig index bba1444c4d..cda5aa7bcd 100644 --- a/nuttx/configs/Kconfig +++ b/nuttx/configs/Kconfig @@ -619,6 +619,14 @@ config ARCH_BOARD_Z8F64200100KIT development kit, Z8F6423 part, and the Zilog ZDS-II Windows command line tools. The development environment is Cygwin under WinXP. +config ARCH_BOARD_ZP214XPA + bool "The0.net LPC2148 Development Board" + depends on ARCH_CHIP_LPC2148 + ---help--- + This port is for the NXP LPC2148 as provided on the The0.net + ZPA213X/4XPA development board. Includes support for the + UG-2864AMBAG01 OLED also from The0.net + config ARCH_BOARD_SIM bool "User mode simulation" depends on ARCH_SIM @@ -700,6 +708,7 @@ config ARCH_BOARD default "z80sim" if ARCH_BOARD_Z80SIM default "z8encore000zco" if ARCH_BOARD_Z8ENCORE000ZCO default "z8f64200100kit" if ARCH_BOARD_Z8F64200100KIT + default "zp214xpa" if ARCH_BOARD_ZP214XPA default "sim" if ARCH_BOARD_SIM default "" if ARCH_BOARD_CUSTOM @@ -709,7 +718,7 @@ config ARCH_HAVE_LEDS bool config ARCH_LEDS - bool "Board LEDs support" + bool "Board LED support" default y depends on ARCH_HAVE_LEDS ---help--- @@ -935,6 +944,9 @@ endif if ARCH_BOARD_Z8F64200100KIT source "configs/z8f64200100kit/Kconfig" endif +if ARCH_BOARD_ZP214XPA +source "configs/zp214xpa/Kconfig" +endif if ARCH_BOARD_SIM source "configs/sim/Kconfig" endif diff --git a/nuttx/configs/README.txt b/nuttx/configs/README.txt index 21aace2afe..4e9bcca146 100644 --- a/nuttx/configs/README.txt +++ b/nuttx/configs/README.txt @@ -1936,6 +1936,11 @@ configs/z8f64200100kit development kit, Z8F6423 part, and the Zilog ZDS-II Windows command line tools. The development environment is Cygwin under WinXP. +configs/zp214xpa + This port is for the NXP LPC2148 as provided on the The0.net + ZPA213X/4XPA development board. Includes support for the + UG-2864AMBAG01 OLED also from The0.net + Configuring NuttX ^^^^^^^^^^^^^^^^^ diff --git a/nuttx/configs/mcu123-lpc214x/README.txt b/nuttx/configs/mcu123-lpc214x/README.txt index 435f8647d4..4c7c608b7f 100644 --- a/nuttx/configs/mcu123-lpc214x/README.txt +++ b/nuttx/configs/mcu123-lpc214x/README.txt @@ -349,8 +349,22 @@ nsh: Configures the NuttShell (nsh) located at examples/nsh. The Configuration enables only the serial NSH interfaces. - Default toolchain: Buildroot - Output format: ELF and binary + NOTES: + + 1. This configuration uses the mconf-based configuration tool. To + change this configuration using that tool, you should: + + a. Build and install the mconf tool. See nuttx/README.txt and + misc/tools/ + + b. Execute 'make menuconfig' in nuttx/ in order to start the + reconfiguration process. + + 2. Default platform/toolchain: + + CONFIG_HOST_LINUX=y : Windows + CONFIG_ARM_TOOLCHAIN_GNU_EABI=y : Buildroot (arm-nuttx-elf-gcc) + CONFIG_RAW_BINARY=y : Output formats: ELF and raw binary ostest: ------- diff --git a/nuttx/configs/mcu123-lpc214x/nsh/defconfig b/nuttx/configs/mcu123-lpc214x/nsh/defconfig index a8a53a3403..6ae163386a 100644 --- a/nuttx/configs/mcu123-lpc214x/nsh/defconfig +++ b/nuttx/configs/mcu123-lpc214x/nsh/defconfig @@ -1,169 +1,207 @@ -############################################################################ -# configs/mcu123-lpc214x/nsh/defconfig # -# Copyright (C) 2008-2010, 2012 Gregory Nutt. All rights reserved. -# Author: Gregory Nutt +# Automatically generated file; DO NOT EDIT. +# Nuttx/ Configuration # -# 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. -# -############################################################################ -# -# Architecture selection -# -CONFIG_ARCH="arm" -CONFIG_ARCH_ARM=y -CONFIG_ARCH_ARM7TDMI=y -CONFIG_ARCH_CHIP="lpc214x" -CONFIG_ARCH_CHIP_LPC2148=y -CONFIG_ARCH_BOARD="mcu123-lpc214x" -CONFIG_ARCH_BOARD_MCU123=y -CONFIG_BOARD_LOOPSPERMSEC=3270 -CONFIG_ARCH_LEDS=y -CONFIG_DRAM_SIZE=32768 -CONFIG_DRAM_START=0x40000000 -CONFIG_ARCH_INTERRUPTSTACK=0 -CONFIG_ARCH_STACKDUMP=y +CONFIG_NUTTX_NEWCONFIG=y # -# LPC2148 specific chip initialization +# Build Setup # -CONFIG_EXTMEM_MODE=n -CONFIG_RAM_MODE=n +# CONFIG_EXPERIMENTAL is not set +CONFIG_HOST_LINUX=y +# CONFIG_HOST_OSX is not set +# CONFIG_HOST_WINDOWS is not set +# CONFIG_HOST_OTHER is not set + +# +# Build Configuration +# +# CONFIG_APPS_DIR="../apps" +# CONFIG_BUILD_2PASS is not set + +# +# Binary Output Formats +# +# CONFIG_RRLOAD_BINARY is not set +# CONFIG_INTELHEX_BINARY is not set +# CONFIG_MOTOROLA_SREC is not set +CONFIG_RAW_BINARY=y + +# +# Customize Header Files +# +# CONFIG_ARCH_STDBOOL_H is not set +# CONFIG_ARCH_MATH_H is not set +# CONFIG_ARCH_FLOAT_H is not set +# CONFIG_ARCH_STDARG_H is not set + +# +# Debug Options +# +# CONFIG_DEBUG is not set +# CONFIG_DEBUG_SYMBOLS is not set + +# +# System Type +# +# CONFIG_ARCH_8051 is not set +CONFIG_ARCH_ARM=y +# CONFIG_ARCH_AVR is not set +# CONFIG_ARCH_HC is not set +# CONFIG_ARCH_MIPS is not set +# CONFIG_ARCH_RGMP is not set +# CONFIG_ARCH_SH is not set +# CONFIG_ARCH_SIM is not set +# CONFIG_ARCH_X86 is not set +# CONFIG_ARCH_Z16 is not set +# CONFIG_ARCH_Z80 is not set +CONFIG_ARCH="arm" + +# +# ARM Options +# +# CONFIG_ARCH_CHIP_C5471 is not set +# CONFIG_ARCH_CHIP_CALYPSO is not set +# CONFIG_ARCH_CHIP_DM320 is not set +# CONFIG_ARCH_CHIP_IMX is not set +# CONFIG_ARCH_CHIP_KINETIS is not set +# CONFIG_ARCH_CHIP_LM3S is not set +# CONFIG_ARCH_CHIP_LPC17XX is not set +CONFIG_ARCH_CHIP_LPC214X=y +# CONFIG_ARCH_CHIP_LPC2378 is not set +# CONFIG_ARCH_CHIP_LPC31XX is not set +# CONFIG_ARCH_CHIP_LPC43XX is not set +# CONFIG_ARCH_CHIP_SAM3U is not set +# CONFIG_ARCH_CHIP_STM32 is not set +# CONFIG_ARCH_CHIP_STR71X is not set +CONFIG_ARCH_ARM7TDMI=y +CONFIG_ARCH_FAMILY="arm" +CONFIG_ARCH_CHIP="lpc214x" +CONFIG_ARCH_HAVE_LOWVECTORS=y +# CONFIG_ARCH_LOWVECTORS is not set +CONFIG_BOARD_LOOPSPERMSEC=3270 +# CONFIG_ARCH_CALIBRATION is not set + +# +# ARM Configuration Options +# +# CONFIG_ARM_TOOLCHAIN_BUILDROOT is not set +# CONFIG_ARM_TOOLCHAIN_CODESOURCERYL is not set +CONFIG_ARM_TOOLCHAIN_GNU_EABI=y + +# +# LPC214x Configuration Options +# +CONFIG_ARCH_CHIP_LPC2148=y + +# +# LPC214x Initialization Options +# +# CONFIG_EXTMEM_MODE is not set +# CONFIG_RAM_MODE is not set +CONFIG_DEFAULT_MODE=y CONFIG_CODE_BASE=0x00000000 CONFIG_PLL_SETUP=y CONFIG_MAM_SETUP=y CONFIG_APBDIV_SETUP=y -CONFIG_EMC_SETUP=n -CONFIG_BCFG0_SETUP=n -CONFIG_BCFG1_SETUP=n -CONFIG_BCFG2_SETUP=n -CONFIG_BCFG3_SETUP=n +CONFIG_APBDIV_VALUE=1 +# CONFIG_EMC_SETUP is not set +# CONFIG_BCFG0_SETUP is not set +# CONFIG_BCFG1_SETUP is not set +# CONFIG_BCFG2_SETUP is not set +# CONFIG_BCFG3_SETUP is not set CONFIG_ADC_SETUP=y # -# LPC214X specific device driver settings +# LPC214x Peripheral Support # -CONFIG_UART0_SERIAL_CONSOLE=y -CONFIG_UART1_SERIAL_CONSOLE=n -CONFIG_UART0_TXBUFSIZE=256 -CONFIG_UART1_TXBUFSIZE=256 -CONFIG_UART0_RXBUFSIZE=256 -CONFIG_UART1_RXBUFSIZE=256 -CONFIG_UART0_BAUD=38400 -CONFIG_UART1_BAUD=38400 -CONFIG_UART0_BITS=8 -CONFIG_UART1_BITS=8 -CONFIG_UART0_PARITY=0 -CONFIG_UART1_PARITY=0 -CONFIG_UART0_2STOP=0 -CONFIG_UART1_2STOP=0 +CONFIG_LPC214X_UART0=y +CONFIG_LPC214X_UART1=y +# CONFIG_LPC214x_FIO is not set +# CONFIG_SDIO_DMA is not set +# CONFIG_SDIO_WIDTH_D1_ONLY is not set # -# General build options +# Architecture Options # -CONFIG_RRLOAD_BINARY=n -CONFIG_INTELHEX_BINARY=n -CONFIG_MOTOROLA_SREC=n -CONFIG_RAW_BINARY=y +# CONFIG_ARCH_NOINTC is not set +# CONFIG_ARCH_DMA is not set +# CONFIG_ARCH_IRQPRIO is not set +# CONFIG_CUSTOM_STACK is not set +# CONFIG_ADDRENV is not set +CONFIG_ARCH_STACKDUMP=y +# CONFIG_ENDIAN_BIG is not set # -# General OS setup +# Board Settings # -CONFIG_USER_ENTRYPOINT="nsh_main" -CONFIG_DEBUG=n -CONFIG_DEBUG_VERBOSE=n -CONFIG_DEBUG_SYMBOLS=n -CONFIG_MM_REGIONS=1 -CONFIG_ARCH_LOWPUTC=y +CONFIG_DRAM_START=0x40000000 +CONFIG_DRAM_SIZE=32768 +CONFIG_ARCH_HAVE_INTERRUPTSTACK=y +CONFIG_ARCH_INTERRUPTSTACK=0 + +# +# Boot options +# +# CONFIG_BOOT_RUNFROMEXTSRAM is not set +CONFIG_BOOT_RUNFROMFLASH=y +# CONFIG_BOOT_RUNFROMISRAM is not set +# CONFIG_BOOT_RUNFROMSDRAM is not set +# CONFIG_BOOT_COPYTORAM is not set + +# +# Board Selection +# +CONFIG_ARCH_BOARD_MCU123=y +# CONFIG_ARCH_BOARD_ZP214XPA is not set +# CONFIG_ARCH_BOARD_CUSTOM is not set +CONFIG_ARCH_BOARD="mcu123-lpc214x" + +# +# Common Board Options +# +CONFIG_ARCH_HAVE_LEDS=y +CONFIG_ARCH_LEDS=y +CONFIG_NSH_MMCSDMINOR=0 +CONFIG_NSH_MMCSDSLOTNO=0 +CONFIG_NSH_MMCSDSPIPORTNO=1 + +# +# Board-Specific Options +# + +# +# RTOS Features +# +CONFIG_MSEC_PER_TICK=10 CONFIG_RR_INTERVAL=0 -CONFIG_SCHED_INSTRUMENTATION=n +# CONFIG_SCHED_INSTRUMENTATION is not set CONFIG_TASK_NAME_SIZE=0 +# CONFIG_JULIAN_TIME is not set CONFIG_START_YEAR=2008 CONFIG_START_MONTH=10 CONFIG_START_DAY=1 -CONFIG_JULIAN_TIME=n CONFIG_DEV_CONSOLE=y -CONFIG_DEV_LOWCONSOLE=n -CONFIG_MUTEX_TYPES=n -CONFIG_PRIORITY_INHERITANCE=n -CONFIG_SEM_PREALLOCHOLDERS=0 -CONFIG_SEM_NNESTPRIO=0 -CONFIG_FDCLONE_DISABLE=n -CONFIG_FDCLONE_STDIO=n +# CONFIG_MUTEX_TYPES is not set +# CONFIG_PRIORITY_INHERITANCE is not set +# CONFIG_FDCLONE_DISABLE is not set +# CONFIG_FDCLONE_STDIO is not set CONFIG_SDCLONE_DISABLE=y -CONFIG_NXFLAT=n - -# -# The following can be used to disable categories of -# APIs supported by the OS. If the compiler supports -# weak functions, then it should not be necessary to -# disable functions unless you want to restrict usage -# of those APIs. -# -# There are certain dependency relationships in these -# features. -# -# o mq_notify logic depends on signals to awaken tasks -# waiting for queues to become full or empty. -# o pthread_condtimedwait() depends on signals to wake -# up waiting tasks. -# -CONFIG_DISABLE_CLOCK=n -CONFIG_DISABLE_POSIX_TIMERS=n -CONFIG_DISABLE_PTHREAD=n -CONFIG_DISABLE_SIGNALS=n -CONFIG_DISABLE_MQUEUE=n -CONFIG_DISABLE_MOUNTPOINT=n -CONFIG_DISABLE_ENVIRON=n +# CONFIG_SCHED_WORKQUEUE is not set +# CONFIG_SCHED_WAITPID is not set +# CONFIG_SCHED_ATEXIT is not set +# CONFIG_SCHED_ONEXIT is not set +CONFIG_USER_ENTRYPOINT="nsh_main" +CONFIG_DISABLE_OS_API=y +# CONFIG_DISABLE_CLOCK is not set +# CONFIG_DISABLE_POSIX_TIMERS is not set +# CONFIG_DISABLE_PTHREAD is not set +# CONFIG_DISABLE_SIGNALS is not set +# CONFIG_DISABLE_MQUEUE is not set +# CONFIG_DISABLE_MOUNTPOINT is not set +# CONFIG_DISABLE_ENVIRON is not set CONFIG_DISABLE_POLL=y -# -# Misc libc settings -# -CONFIG_NOPRINTF_FIELDWIDTH=n - -# -# Allow for architecture optimized implementations -# -# The architecture can provide optimized versions of the -# following to improve system performance -# -CONFIG_ARCH_MEMCPY=n -CONFIG_ARCH_MEMCMP=n -CONFIG_ARCH_MEMMOVE=n -CONFIG_ARCH_MEMSET=n -CONFIG_ARCH_STRCMP=n -CONFIG_ARCH_STRCPY=n -CONFIG_ARCH_STRNCPY=n -CONFIG_ARCH_STRLEN=n -CONFIG_ARCH_STRNLEN=n -CONFIG_ARCH_BZERO=n - # # Sizes of configurable things (0 disables) # @@ -173,8 +211,6 @@ CONFIG_NPTHREAD_KEYS=4 CONFIG_NFILE_DESCRIPTORS=8 CONFIG_NFILE_STREAMS=8 CONFIG_NAME_MAX=32 -CONFIG_STDIO_BUFFER_SIZE=256 -CONFIG_NUNGET_CHARS=2 CONFIG_PREALLOC_MQ_MSGS=4 CONFIG_MQ_MAXMSGSIZE=32 CONFIG_MAX_WDOGPARMS=2 @@ -182,168 +218,380 @@ CONFIG_PREALLOC_WDOGS=4 CONFIG_PREALLOC_TIMERS=4 # -# Filesystem configuration +# Stack and heap information +# +CONFIG_IDLETHREAD_STACKSIZE=2048 +CONFIG_USERMAIN_STACKSIZE=2048 +CONFIG_PTHREAD_STACK_MIN=256 +CONFIG_PTHREAD_STACK_DEFAULT=2048 + +# +# Device Drivers +# +CONFIG_DEV_NULL=y +# CONFIG_DEV_ZERO is not set +# CONFIG_LOOP is not set +# CONFIG_RAMDISK is not set +# CONFIG_CAN is not set +# CONFIG_PWM is not set +# CONFIG_I2C is not set +CONFIG_SPI=y +# CONFIG_SPI_OWNBUS is not set +# CONFIG_SPI_EXCHANGE is not set +# CONFIG_SPI_CMDDATA is not set +# CONFIG_RTC is not set +# CONFIG_WATCHDOG is not set +# CONFIG_ANALOG is not set +# CONFIG_BCH is not set +# CONFIG_INPUT is not set +# CONFIG_LCD is not set +CONFIG_MMCSD=y +CONFIG_MMCSD_NSLOTS=1 +# CONFIG_MMCSD_READONLY is not set +# CONFIG_MMCSD_MULTIBLOCK_DISABLE is not set +CONFIG_MMCSD_MMCSUPPORT=y +CONFIG_MMCSD_HAVECARDDETECT=y +CONFIG_MMCSD_SPI=y +CONFIG_MMCSD_SPICLOCK=20000000 +# CONFIG_MMCSD_SDIO is not set +# CONFIG_SDIO_MUXBUS is not set +# CONFIG_MTD is not set +# CONFIG_PIPES is not set +# CONFIG_PM is not set +# CONFIG_POWER is not set +# CONFIG_SENSORS is not set +# CONFIG_SERCOMM_CONSOLE is not set +CONFIG_SERIAL=y +# CONFIG_DEV_LOWCONSOLE is not set +# CONFIG_16550_UART is not set +CONFIG_ARCH_HAVE_UART0=y +CONFIG_ARCH_HAVE_UART1=y +CONFIG_MCU_SERIAL=y +CONFIG_STANDARD_SERIAL=y +CONFIG_UART0_SERIAL_CONSOLE=y +# CONFIG_UART1_SERIAL_CONSOLE is not set +# CONFIG_NO_SERIAL_CONSOLE is not set + +# +# UART0 Configuration +# +CONFIG_UART0_RXBUFSIZE=256 +CONFIG_UART0_TXBUFSIZE=256 +CONFIG_UART0_BAUD=38400 +CONFIG_UART0_BITS=8 +CONFIG_UART0_PARITY=0 +CONFIG_UART0_2STOP=0 + +# +# UART1 Configuration +# +CONFIG_UART1_RXBUFSIZE=256 +CONFIG_UART1_TXBUFSIZE=256 +CONFIG_UART1_BAUD=38400 +CONFIG_UART1_BITS=8 +CONFIG_UART1_PARITY=0 +CONFIG_UART1_2STOP=0 +# CONFIG_USBDEV is not set +# CONFIG_USBHOST is not set +# CONFIG_WIRELESS is not set + +# +# System Logging Device Options +# + +# +# System Logging +# +# CONFIG_RAMLOG is not set + +# +# Networking Support +# +# CONFIG_NET is not set + +# +# File Systems +# + +# +# File system configuration # CONFIG_FS_FAT=y CONFIG_FAT_LCNAMES=y CONFIG_FAT_LFN=y CONFIG_FAT_MAXFNAME=32 -CONFIG_FS_NXFFS=n -CONFIG_FS_ROMFS=n +# CONFIG_FS_FATTIME is not set +# CONFIG_FAT_DMAMEMORY is not set +# CONFIG_FS_RAMMAP is not set +# CONFIG_FS_NXFFS is not set +# CONFIG_FS_ROMFS is not set # -# Maintain legacy build behavior (revisit) +# System Logging # - -CONFIG_MMCSD=y -CONFIG_MMCSD_SPI=y -CONFIG_MMCSD_SDIO=y +# CONFIG_SYSLOG is not set # -# SPI-based MMC/SD driver +# Graphics Support # -CONFIG_MMCSD_NSLOTS=1 -CONFIG_MMCSD_READONLY=n -#CONFIG_MMCSD_SPICLOCK=20000000 +# CONFIG_NX is not set # -# SPI-based MMC/SD driver +# Memory Management # -CONFIG_MMCSD_NSLOTS=1 -CONFIG_MMCSD_READONLY=n +# CONFIG_MM_SMALL is not set +CONFIG_MM_REGIONS=1 +# CONFIG_GRAN is not set # -# TCP/IP and UDP support via uIP +# Binary Formats # -CONFIG_NET=n -CONFIG_NET_IPv6=n -CONFIG_NSOCKET_DESCRIPTORS=0 -CONFIG_NET_SOCKOPTS=y -CONFIG_NET_BUFSIZE=420 -CONFIG_NET_TCP=n -CONFIG_NET_TCP_CONNS=40 -CONFIG_NET_MAX_LISTENPORTS=40 -CONFIG_NET_UDP=n -CONFIG_NET_UDP_CHECKSUMS=y -#CONFIG_NET_UDP_CONNS=10 -CONFIG_NET_ICMP=n -CONFIG_NET_ICMP_PING=n -#CONFIG_NET_PINGADDRCONF=0 -CONFIG_NET_STATISTICS=y -#CONFIG_NET_RECEIVE_WINDOW= -#CONFIG_NET_ARPTAB_SIZE=8 -CONFIG_NET_BROADCAST=n +# CONFIG_BINFMT_DISABLE is not set +# CONFIG_BINFMT_EXEPATH is not set +# CONFIG_NXFLAT is not set +# CONFIG_ELF is not set +# CONFIG_PIC is not set +# CONFIG_SYMTAB_ORDEREDBYNAME is not set # -# UIP Network Utilities +# Library Routines # -CONFIG_NET_DHCP_LIGHT=n -CONFIG_NET_RESOLV_ENTRIES=4 # -# USB Device Configuration +# Standard C Library Options # -CONFIG_USBDEV=n -CONFIG_USBDEV_ISOCHRONOUS=n -CONFIG_USBDEV_DUALSPEED=n -CONFIG_USBDEV_SELFPOWERED=y -CONFIG_USBDEV_REMOTEWAKEUP=n -CONFIG_USBDEV_MAXPOWER=100 -CONFIG_USBDEV_TRACE=n -CONFIG_USBDEV_TRACE_NRECORDS=128 +CONFIG_STDIO_BUFFER_SIZE=256 +CONFIG_STDIO_LINEBUFFER=y +CONFIG_NUNGET_CHARS=2 +CONFIG_LIB_HOMEDIR="/" +# CONFIG_LIBM is not set +# CONFIG_NOPRINTF_FIELDWIDTH is not set +# CONFIG_LIBC_FLOATINGPOINT is not set +# CONFIG_EOL_IS_CR is not set +# CONFIG_EOL_IS_LF is not set +# CONFIG_EOL_IS_BOTH_CRLF is not set +CONFIG_EOL_IS_EITHER_CRLF=y +# CONFIG_LIBC_STRERROR is not set +# CONFIG_LIBC_PERROR_STDOUT is not set +CONFIG_ARCH_LOWPUTC=y +CONFIG_LIB_SENDFILE_BUFSIZE=512 +# CONFIG_ARCH_ROMGETC is not set +# CONFIG_ARCH_OPTIMIZED_FUNCTIONS is not set # -# LPC214X USB Configuration +# Non-standard Helper Functions # -CONFIG_LPC214X_USBDEV_FRAME_INTERRUPT=n -CONFIG_LPC214X_USBDEV_EPFAST_INTERRUPT=n -CONFIG_LPC214X_USBDEV_DMA=n -CONFIG_LPC214X_USBDEV_NDMADESCRIPTORS=0 -CONFIG_LPC214X_USBDEV_DMAINTMASK=0 +CONFIG_LIB_KBDCODEC=y # -# USB Serial Device Configuration +# Basic CXX Support # -CONFIG_PL2303=n -CONFIG_PL2303_EPINTIN=1 -CONFIG_PL2303_EPBULKOUT=2 -CONFIG_PL2303_EPBULKIN=5 -CONFIG_PL2303_NWRREQS=4 -CONFIG_PL2303_NRDREQS=4 -CONFIG_PL2303_VENDORID=0x067b -CONFIG_PL2303_PRODUCTID=0x2303 -CONFIG_PL2303_VENDORSTR="Nuttx" -CONFIG_PL2303_PRODUCTSTR="USBdev Serial" -CONFIG_PL2303_RXBUFSIZE=512 -CONFIG_PL2303_TXBUFSIZE=512 +# CONFIG_C99_BOOL8 is not set +# CONFIG_HAVE_CXX is not set # -# USB Storage Device Configuration +# Application Configuration # -CONFIG_USBMSC=n -CONFIG_USBMSC_EP0MAXPACKET=64 -CONFIG_USBMSC_EPBULKOUT=2 -CONFIG_USBMSC_EPBULKIN=5 -CONFIG_USBMSC_NRDREQS=2 -CONFIG_USBMSC_NWRREQS=2 -CONFIG_USBMSC_BULKINREQLEN=256 -CONFIG_USBMSC_BULKOUTREQLEN=256 -CONFIG_USBMSC_VENDORID=0x584e -CONFIG_USBMSC_VENDORSTR="NuttX" -CONFIG_USBMSC_PRODUCTID=0x5342 -CONFIG_USBMSC_PRODUCTSTR="USBdev Storage" -CONFIG_USBMSC_VERSIONNO=0x0399 -CONFIG_USBMSC_REMOVABLE=y # -# Settings for examples/ostest -CONFIG_EXAMPLES_OSTEST_LOOPS=1 -CONFIG_EXAMPLES_OSTEST_STACKSIZE=4096 -CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3 +# Built-In Applications +# +# CONFIG_BUILTIN is not set # -# Settings for apps/nshlib +# Examples # +# CONFIG_EXAMPLES_BUTTONS is not set +# CONFIG_EXAMPLES_CAN is not set +# CONFIG_EXAMPLES_CDCACM is not set +# CONFIG_EXAMPLES_COMPOSITE is not set +# CONFIG_EXAMPLES_DHCPD is not set +# CONFIG_EXAMPLES_ELF is not set +# CONFIG_EXAMPLES_FTPC is not set +# CONFIG_EXAMPLES_FTPD is not set +# CONFIG_EXAMPLES_HELLO is not set +# CONFIG_EXAMPLES_HELLOXX is not set +# CONFIG_EXAMPLES_JSON is not set +# CONFIG_EXAMPLES_HIDKBD is not set +# CONFIG_EXAMPLES_KEYPADTEST is not set +# CONFIG_EXAMPLES_IGMP is not set +# CONFIG_EXAMPLES_LCDRW is not set +# CONFIG_EXAMPLES_MM is not set +# CONFIG_EXAMPLES_MOUNT is not set +# CONFIG_EXAMPLES_MODBUS is not set +# CONFIG_EXAMPLES_NETTEST is not set +CONFIG_EXAMPLES_NSH=y +# CONFIG_EXAMPLES_NULL is not set +# CONFIG_EXAMPLES_NX is not set +# CONFIG_EXAMPLES_NXCONSOLE is not set +# CONFIG_EXAMPLES_NXFFS is not set +# CONFIG_EXAMPLES_NXFLAT is not set +# CONFIG_EXAMPLES_NXHELLO is not set +# CONFIG_EXAMPLES_NXIMAGE is not set +# CONFIG_EXAMPLES_NXLINES is not set +# CONFIG_EXAMPLES_NXTEXT is not set +# CONFIG_EXAMPLES_OSTEST is not set +# CONFIG_EXAMPLES_PASHELLO is not set +# CONFIG_EXAMPLES_PIPE is not set +# CONFIG_EXAMPLES_POLL is not set +# CONFIG_EXAMPLES_QENCODER is not set +# CONFIG_EXAMPLES_RGMP is not set +# CONFIG_EXAMPLES_ROMFS is not set +# CONFIG_EXAMPLES_SENDMAIL is not set +# CONFIG_EXAMPLES_SERLOOP is not set +# CONFIG_EXAMPLES_TELNETD is not set +# CONFIG_EXAMPLES_THTTPD is not set +# CONFIG_EXAMPLES_TIFF is not set +# CONFIG_EXAMPLES_TOUCHSCREEN is not set +# CONFIG_EXAMPLES_UDP is not set +# CONFIG_EXAMPLES_UIP is not set +# CONFIG_EXAMPLES_USBSERIAL is not set +# CONFIG_EXAMPLES_USBMSC is not set +# CONFIG_EXAMPLES_USBTERM is not set +# CONFIG_EXAMPLES_WATCHDOG is not set +# CONFIG_EXAMPLES_WLAN is not set + +# +# Interpreters +# + +# +# Interpreters +# +# CONFIG_INTERPRETERS_FICL is not set +# CONFIG_INTERPRETERS_PCODE is not set + +# +# Network Utilities +# + +# +# Networking Utilities +# +# CONFIG_NETUTILS_CODECS is not set +# CONFIG_NETUTILS_DHCPC is not set +# CONFIG_NETUTILS_DHCPD is not set +# CONFIG_NETUTILS_FTPC is not set +# CONFIG_NETUTILS_FTPD is not set +# CONFIG_NETUTILS_JSON is not set +# CONFIG_NETUTILS_RESOLV is not set +# CONFIG_NETUTILS_SMTP is not set +# CONFIG_NETUTILS_TELNETD is not set +# CONFIG_NETUTILS_TFTPC is not set +# CONFIG_NETUTILS_THTTPD is not set +# CONFIG_NETUTILS_UIPLIB is not set +# CONFIG_NETUTILS_WEBCLIENT is not set + +# +# ModBus +# + +# +# FreeModbus +# +# CONFIG_MODBUS is not set + +# +# NSH Library +# +CONFIG_NSH_LIBRARY=y + +# +# Disable Individual commands +# +# CONFIG_NSH_DISABLE_CAT is not set +# CONFIG_NSH_DISABLE_CD is not set +# CONFIG_NSH_DISABLE_CP is not set +# CONFIG_NSH_DISABLE_DD is not set +# CONFIG_NSH_DISABLE_ECHO is not set +# CONFIG_NSH_DISABLE_EXEC is not set +# CONFIG_NSH_DISABLE_EXIT is not set +# CONFIG_NSH_DISABLE_FREE is not set +# CONFIG_NSH_DISABLE_GET is not set +# CONFIG_NSH_DISABLE_HELP is not set +# CONFIG_NSH_DISABLE_HEXDUMP is not set +# CONFIG_NSH_DISABLE_IFCONFIG is not set +# CONFIG_NSH_DISABLE_KILL is not set +# CONFIG_NSH_DISABLE_LOSETUP is not set +# CONFIG_NSH_DISABLE_LS is not set +# CONFIG_NSH_DISABLE_MB is not set +# CONFIG_NSH_DISABLE_MKDIR is not set +# CONFIG_NSH_DISABLE_MKFATFS is not set +# CONFIG_NSH_DISABLE_MKFIFO is not set +# CONFIG_NSH_DISABLE_MKRD is not set +# CONFIG_NSH_DISABLE_MH is not set +# CONFIG_NSH_DISABLE_MOUNT is not set +# CONFIG_NSH_DISABLE_MW is not set +# CONFIG_NSH_DISABLE_NSFMOUNT is not set +# CONFIG_NSH_DISABLE_PS is not set +# CONFIG_NSH_DISABLE_PING is not set +# CONFIG_NSH_DISABLE_PUT is not set +# CONFIG_NSH_DISABLE_PWD is not set +# CONFIG_NSH_DISABLE_RM is not set +# CONFIG_NSH_DISABLE_RMDIR is not set +# CONFIG_NSH_DISABLE_SET is not set +# CONFIG_NSH_DISABLE_SH is not set +# CONFIG_NSH_DISABLE_SLEEP is not set +# CONFIG_NSH_DISABLE_TEST is not set +# CONFIG_NSH_DISABLE_UMOUNT is not set +# CONFIG_NSH_DISABLE_UNSET is not set +# CONFIG_NSH_DISABLE_USLEEP is not set +# CONFIG_NSH_DISABLE_WGET is not set +# CONFIG_NSH_DISABLE_XD is not set +CONFIG_NSH_CODECS_BUFSIZE=128 CONFIG_NSH_FILEIOSIZE=512 -CONFIG_NSH_STRERROR=n CONFIG_NSH_LINELEN=64 CONFIG_NSH_NESTDEPTH=3 -CONFIG_NSH_DISABLESCRIPT=n -CONFIG_NSH_DISABLEBG=n -CONFIG_NSH_ROMFSETC=n +# CONFIG_NSH_DISABLESCRIPT is not set +# CONFIG_NSH_DISABLEBG is not set CONFIG_NSH_CONSOLE=y -CONFIG_NSH_TELNET=n +# CONFIG_NSH_CONDEV is not set CONFIG_NSH_ARCHINIT=y -CONFIG_NSH_IOBUFFER_SIZE=512 -CONFIG_NSH_DHCPC=n -CONFIG_NSH_NOMAC=n -CONFIG_NSH_IPADDR=0x0a000002 -CONFIG_NSH_DRIPADDR=0x0a000001 -CONFIG_NSH_NETMASK=0xffffff00 -CONFIG_NSH_ROMFSMOUNTPT="/etc" -CONFIG_NSH_INITSCRIPT="init.d/rcS" -CONFIG_NSH_ROMFSDEVNO=0 -CONFIG_NSH_ROMFSSECTSIZE=64 -CONFIG_NSH_FATDEVNO=1 -CONFIG_NSH_FATSECTSIZE=512 -CONFIG_NSH_FATNSECTORS=1024 -CONFIG_NSH_FATMOUNTPT="/tmp" # -# Architecture-specific NSH options -CONFIG_NSH_MMCSDSPIPORTNO=1 -CONFIG_NSH_MMCSDSLOTNO=0 -CONFIG_NSH_MMCSDMINOR=0 +# NxWidgets/NxWM +# # -# Stack and heap information +# System NSH Add-Ons # -CONFIG_BOOT_RUNFROMFLASH=n -CONFIG_BOOT_COPYTORAM=n -CONFIG_CUSTOM_STACK=n -CONFIG_IDLETHREAD_STACKSIZE=2048 -CONFIG_USERMAIN_STACKSIZE=2048 -CONFIG_PTHREAD_STACK_MIN=256 -CONFIG_PTHREAD_STACK_DEFAULT=2048 -CONFIG_HEAP_BASE= -CONFIG_HEAP_SIZE= + +# +# Custom Free Memory Command +# +# CONFIG_SYSTEM_FREE is not set + +# +# I2C tool +# + +# +# FLASH Program Installation +# +# CONFIG_SYSTEM_INSTALL is not set + +# +# readline() +# +CONFIG_SYSTEM_READLINE=y +CONFIG_READLINE_ECHO=y + +# +# Power Off +# +# CONFIG_SYSTEM_POWEROFF is not set + +# +# RAMTRON +# +# CONFIG_SYSTEM_RAMTRON is not set + +# +# SD Card +# +# CONFIG_SYSTEM_SDCARD is not set + +# +# Sysinfo +# +# CONFIG_SYSTEM_SYSINFO is not set diff --git a/nuttx/configs/mcu123-lpc214x/scripts/ld.script b/nuttx/configs/mcu123-lpc214x/scripts/ld.script index 8ce83748f9..bc025dfb7f 100644 --- a/nuttx/configs/mcu123-lpc214x/scripts/ld.script +++ b/nuttx/configs/mcu123-lpc214x/scripts/ld.script @@ -35,12 +35,12 @@ /* FLASH: * The lpc2148 has 512Kb of non-volatile memory beginning at address - * 0x00000000. The OS entry point is via the reset vector at address - * 0x00000000 (default MEMMAP mode assumed) + * 0x0000:0000. The OS entry point is via the reset vector at address + * 0x0000:0000 (default MEMMAP mode assumed) * * SRAM: * The lpc2148 has 32Kb of on-chip static RAM beginning at address - * 0x40000000. The .data section will be relocated from _eronly + * 0x4000:0000. The .data section will be relocated from _eronly * to _sdata at boot time. */ diff --git a/nuttx/configs/sim/nxlines/Make.defs b/nuttx/configs/sim/nxlines/Make.defs new file mode 100644 index 0000000000..18c8bf5375 --- /dev/null +++ b/nuttx/configs/sim/nxlines/Make.defs @@ -0,0 +1,107 @@ +############################################################################ +# configs/sim/nxlines/Make.defs +# +# Copyright (C) 2012 Gregory Nutt. All rights reserved. +# Author: Gregory Nutt +# +# 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 +include ${TOPDIR}/tools/Config.mk + +HOSTOS = ${shell uname -o 2>/dev/null || echo "Other"} + +ifeq ($(CONFIG_DEBUG_SYMBOLS),y) + ARCHOPTIMIZATION = -g +else + ARCHOPTIMIZATION = -O2 +endif + +ARCHCPUFLAGS = -fno-builtin +ARCHCPUFLAGSXX = -fno-builtin -fno-exceptions -fno-rtti +ARCHPICFLAGS = -fpic +ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow +ARCHWARNINGSXX = -Wall -Wshadow +ARCHDEFINES = +ARCHINCLUDES = -I. -isystem $(TOPDIR)/include +ARCHINCLUDESXX = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx +ARCHSCRIPT = + +ifeq ($(CONFIG_SIM_M32),y) + ARCHCPUFLAGS += -m32 + ARCHCPUFLAGSXX += -m32 +endif + +CROSSDEV = +CC = $(CROSSDEV)gcc +CXX = $(CROSSDEV)g++ +CPP = $(CROSSDEV)gcc -E +LD = $(CROSSDEV)ld +AR = $(CROSSDEV)ar rcs +NM = $(CROSSDEV)nm +OBJCOPY = $(CROSSDEV)objcopy +OBJDUMP = $(CROSSDEV)objdump + +CFLAGS = $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe +CXXFLAGS = $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGSXX) $(ARCHINCLUDESXX) $(ARCHDEFINES) $(EXTRADEFINES) -pipe +CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) +AFLAGS = $(CFLAGS) -D__ASSEMBLY__ + +OBJEXT = .o +LIBEXT = .a + +ifeq ($(HOSTOS),Cygwin) + EXEEXT = .exe +else + EXEEXT = +endif + +LDLINKFLAGS = $(ARCHSCRIPT) # Link flags used with $(LD) +CCLINKFLAGS = $(ARCHSCRIPT) # Link flags used with $(CC) +LDFLAGS = $(ARCHSCRIPT) # For backward compatibility, same as CCLINKFLAGS + +ifeq ($(CONFIG_DEBUG_SYMBOLS),y) + LDLINKFLAGS += -g + CCLINKFLAGS += -g + LDFLAGS += -g +endif + +ifeq ($(CONFIG_SIM_M32),y) + LDLINKFLAGS += -melf_i386 + CCLINKFLAGS += -m32 + LDFLAGS += -m32 +endif + +MKDEP = $(TOPDIR)/tools/mkdeps.sh + +HOSTCC = gcc +HOSTINCLUDES = -I. +HOSTCFLAGS = $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(HOSTINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe +HOSTLDFLAGS = diff --git a/nuttx/configs/sim/nxlines/defconfig b/nuttx/configs/sim/nxlines/defconfig new file mode 100644 index 0000000000..c023af6743 --- /dev/null +++ b/nuttx/configs/sim/nxlines/defconfig @@ -0,0 +1,591 @@ +# +# Automatically generated file; DO NOT EDIT. +# Nuttx/ Configuration +# +CONFIG_NUTTX_NEWCONFIG=y + +# +# Build Setup +# +# CONFIG_EXPERIMENTAL is not set +# CONFIG_HOST_LINUX is not set +# CONFIG_HOST_OSX is not set +CONFIG_HOST_WINDOWS=y +# CONFIG_HOST_OTHER is not set +# CONFIG_WINDOWS_NATIVE is not set +CONFIG_WINDOWS_CYGWIN=y +# CONFIG_WINDOWS_MSYS is not set +# CONFIG_WINDOWS_OTHER is not set + +# +# Build Configuration +# +CONFIG_APPS_DIR="../apps" +# CONFIG_BUILD_2PASS is not set + +# +# Binary Output Formats +# +# CONFIG_RRLOAD_BINARY is not set +# CONFIG_INTELHEX_BINARY is not set +# CONFIG_MOTOROLA_SREC is not set +# CONFIG_RAW_BINARY is not set + +# +# Customize Header Files +# +# CONFIG_ARCH_STDBOOL_H is not set +# CONFIG_ARCH_MATH_H is not set +# CONFIG_ARCH_FLOAT_H is not set +# CONFIG_ARCH_STDARG_H is not set + +# +# Debug Options +# +# CONFIG_DEBUG is not set +CONFIG_DEBUG_SYMBOLS=y + +# +# System Type +# +# CONFIG_ARCH_8051 is not set +# CONFIG_ARCH_ARM is not set +# CONFIG_ARCH_AVR is not set +# CONFIG_ARCH_HC is not set +# CONFIG_ARCH_MIPS is not set +# CONFIG_ARCH_RGMP is not set +# CONFIG_ARCH_SH is not set +CONFIG_ARCH_SIM=y +# CONFIG_ARCH_X86 is not set +# CONFIG_ARCH_Z16 is not set +# CONFIG_ARCH_Z80 is not set +CONFIG_ARCH="sim" +CONFIG_BOARD_LOOPSPERMSEC= + +# +# Simulation Configuration Options +# +# CONFIG_SIM_M32 is not set +# CONFIG_SIM_WALLTIME is not set +CONFIG_SIM_FRAMEBUFFER=y +CONFIG_SIM_X11FB=y +# CONFIG_SIM_X11NOSHM is not set +CONFIG_SIM_FBHEIGHT=240 +CONFIG_SIM_FBWIDTH=480 +CONFIG_SIM_FBBPP=32 + +# +# Architecture Options +# +# CONFIG_ARCH_NOINTC is not set +# CONFIG_ARCH_DMA is not set +# CONFIG_ARCH_IRQPRIO is not set +# CONFIG_CUSTOM_STACK is not set +# CONFIG_ADDRENV is not set +# CONFIG_ARCH_STACKDUMP is not set +# CONFIG_ENDIAN_BIG is not set + +# +# Board Settings +# +CONFIG_DRAM_START= +CONFIG_DRAM_SIZE= + +# +# Boot options +# +# CONFIG_BOOT_RUNFROMEXTSRAM is not set +CONFIG_BOOT_RUNFROMFLASH=y +# CONFIG_BOOT_RUNFROMISRAM is not set +# CONFIG_BOOT_RUNFROMSDRAM is not set +# CONFIG_BOOT_COPYTORAM is not set + +# +# Board Selection +# +CONFIG_ARCH_BOARD_SIM=y +# CONFIG_ARCH_BOARD_CUSTOM is not set +CONFIG_ARCH_BOARD="sim" + +# +# Common Board Options +# +CONFIG_NSH_MMCSDMINOR=0 + +# +# Board-Specific Options +# + +# +# RTOS Features +# +CONFIG_MSEC_PER_TICK=10 +CONFIG_RR_INTERVAL=0 +# CONFIG_SCHED_INSTRUMENTATION is not set +CONFIG_TASK_NAME_SIZE=32 +# CONFIG_JULIAN_TIME is not set +CONFIG_START_YEAR=2012 +CONFIG_START_MONTH=5 +CONFIG_START_DAY=1 +CONFIG_DEV_CONSOLE=y +# CONFIG_MUTEX_TYPES is not set +# CONFIG_PRIORITY_INHERITANCE is not set +# CONFIG_FDCLONE_DISABLE is not set +# CONFIG_FDCLONE_STDIO is not set +CONFIG_SDCLONE_DISABLE=y +# CONFIG_SCHED_WORKQUEUE is not set +CONFIG_SCHED_WAITPID=y +# CONFIG_SCHED_ATEXIT is not set +CONFIG_SCHED_ONEXIT=y +CONFIG_SCHED_ONEXIT_MAX=1 +CONFIG_USER_ENTRYPOINT="nxlines_main" +CONFIG_DISABLE_OS_API=y +# CONFIG_DISABLE_CLOCK is not set +CONFIG_DISABLE_POSIX_TIMERS=y +# CONFIG_DISABLE_PTHREAD is not set +# CONFIG_DISABLE_SIGNALS is not set +# CONFIG_DISABLE_MQUEUE is not set +# CONFIG_DISABLE_MOUNTPOINT is not set +# CONFIG_DISABLE_ENVIRON is not set +CONFIG_DISABLE_POLL=y + +# +# Sizes of configurable things (0 disables) +# +CONFIG_MAX_TASKS=16 +CONFIG_MAX_TASK_ARGS=4 +CONFIG_NPTHREAD_KEYS=4 +CONFIG_NFILE_DESCRIPTORS=16 +CONFIG_NFILE_STREAMS=16 +CONFIG_NAME_MAX=32 +CONFIG_PREALLOC_MQ_MSGS=32 +CONFIG_MQ_MAXMSGSIZE=48 +CONFIG_MAX_WDOGPARMS=4 +CONFIG_PREALLOC_WDOGS=32 +CONFIG_PREALLOC_TIMERS=8 + +# +# Stack and heap information +# +CONFIG_IDLETHREAD_STACKSIZE=8192 +CONFIG_USERMAIN_STACKSIZE=16384 +CONFIG_PTHREAD_STACK_MIN=256 +CONFIG_PTHREAD_STACK_DEFAULT=8192 + +# +# Device Drivers +# +CONFIG_DEV_NULL=y +# CONFIG_DEV_ZERO is not set +# CONFIG_LOOP is not set +# CONFIG_RAMDISK is not set +# CONFIG_CAN is not set +# CONFIG_PWM is not set +# CONFIG_I2C is not set +# CONFIG_SPI is not set +# CONFIG_RTC is not set +# CONFIG_WATCHDOG is not set +# CONFIG_ANALOG is not set +# CONFIG_BCH is not set +# CONFIG_INPUT is not set +# CONFIG_LCD is not set +# CONFIG_MMCSD is not set +# CONFIG_MTD is not set +# CONFIG_PIPES is not set +# CONFIG_PM is not set +# CONFIG_POWER is not set +# CONFIG_SENSORS is not set +# CONFIG_SERCOMM_CONSOLE is not set +CONFIG_SERIAL=y +# CONFIG_DEV_LOWCONSOLE is not set +# CONFIG_16550_UART is not set +# CONFIG_STANDARD_SERIAL is not set +# CONFIG_USBDEV is not set +# CONFIG_USBHOST is not set +# CONFIG_WIRELESS is not set + +# +# System Logging Device Options +# + +# +# System Logging +# +# CONFIG_RAMLOG is not set + +# +# Networking Support +# +# CONFIG_NET is not set + +# +# File Systems +# + +# +# File system configuration +# +CONFIG_FS_FAT=y +CONFIG_FAT_LCNAMES=y +CONFIG_FAT_LFN=y +CONFIG_FAT_MAXFNAME=32 +# CONFIG_FS_FATTIME is not set +# CONFIG_FAT_DMAMEMORY is not set +# CONFIG_FS_RAMMAP is not set +# CONFIG_FS_NXFFS is not set +CONFIG_FS_ROMFS=y + +# +# System Logging +# +# CONFIG_SYSLOG is not set + +# +# Graphics Support +# +CONFIG_NX=y +CONFIG_NX_NPLANES=1 +# CONFIG_NX_WRITEONLY is not set + +# +# Supported Pixel Depths +# +CONFIG_NX_DISABLE_1BPP=y +CONFIG_NX_DISABLE_2BPP=y +CONFIG_NX_DISABLE_4BPP=y +CONFIG_NX_DISABLE_8BPP=y +CONFIG_NX_DISABLE_16BPP=y +CONFIG_NX_DISABLE_24BPP=y +# CONFIG_NX_DISABLE_32BPP is not set +# CONFIG_NX_PACKEDMSFIRST is not set + +# +# Input Devices +# +CONFIG_NX_MOUSE=y +CONFIG_NX_KBD=y + +# +# Framed Window Borders +# +CONFIG_NXTK_BORDERWIDTH=4 +CONFIG_NXTK_BORDERCOLOR1=0x005a96bd +CONFIG_NXTK_BORDERCOLOR2=0x00233a49 +CONFIG_NXTK_BORDERCOLOR3=0x00f8f8f8 +# CONFIG_NXTK_AUTORAISE is not set + +# +# Font Selections +# +CONFIG_NXFONTS_CHARBITS=7 +# CONFIG_NXFONT_SANS17X22 is not set +# CONFIG_NXFONT_SANS20X26 is not set +CONFIG_NXFONT_SANS23X27=y +# CONFIG_NXFONT_SANS22X29 is not set +# CONFIG_NXFONT_SANS28X37 is not set +# CONFIG_NXFONT_SANS39X48 is not set +# CONFIG_NXFONT_SANS17X23B is not set +# CONFIG_NXFONT_SANS20X27B is not set +# CONFIG_NXFONT_SANS22X29B is not set +CONFIG_NXFONT_SANS28X37B=y +# CONFIG_NXFONT_SANS40X49B is not set +# CONFIG_NXFONT_SERIF22X29 is not set +# CONFIG_NXFONT_SERIF29X37 is not set +# CONFIG_NXFONT_SERIF38X48 is not set +# CONFIG_NXFONT_SERIF22X28B is not set +# CONFIG_NXFONT_SERIF27X38B is not set +# CONFIG_NXFONT_SERIF38X49B is not set +# CONFIG_NXCONSOLE is not set + +# +# NX Multi-user only options +# +# CONFIG_NX_MULTIUSER is not set + +# +# Memory Management +# +# CONFIG_MM_SMALL is not set +CONFIG_MM_REGIONS=1 +# CONFIG_GRAN is not set + +# +# Binary Formats +# +# CONFIG_BINFMT_DISABLE is not set +# CONFIG_BINFMT_EXEPATH is not set +# CONFIG_NXFLAT is not set +# CONFIG_ELF is not set +# CONFIG_PIC is not set +# CONFIG_SYMTAB_ORDEREDBYNAME is not set + +# +# Library Routines +# + +# +# Standard C Library Options +# +CONFIG_STDIO_BUFFER_SIZE=256 +CONFIG_STDIO_LINEBUFFER=y +CONFIG_NUNGET_CHARS=2 +CONFIG_LIB_HOMEDIR="/" +# CONFIG_LIBM is not set +# CONFIG_NOPRINTF_FIELDWIDTH is not set +# CONFIG_LIBC_FLOATINGPOINT is not set +# CONFIG_EOL_IS_CR is not set +# CONFIG_EOL_IS_LF is not set +# CONFIG_EOL_IS_BOTH_CRLF is not set +CONFIG_EOL_IS_EITHER_CRLF=y +# CONFIG_LIBC_STRERROR is not set +# CONFIG_LIBC_PERROR_STDOUT is not set +CONFIG_ARCH_LOWPUTC=y +CONFIG_LIB_SENDFILE_BUFSIZE=512 +# CONFIG_ARCH_ROMGETC is not set +# CONFIG_ARCH_OPTIMIZED_FUNCTIONS is not set + +# +# Non-standard Helper Functions +# +CONFIG_LIB_KBDCODEC=y + +# +# Basic CXX Support +# +# CONFIG_C99_BOOL8 is not set +CONFIG_HAVE_CXX=y +# CONFIG_HAVE_CXXINITIALIZE is not set +# CONFIG_CXX_NEWLONG is not set + +# +# uClibc++ Standard C++ Library +# +# CONFIG_UCLIBCXX is not set + +# +# Application Configuration +# + +# +# Built-In Applications +# +# CONFIG_BUILTIN is not set + +# +# Examples +# +# CONFIG_EXAMPLES_BUTTONS is not set +# CONFIG_EXAMPLES_CAN is not set +# CONFIG_EXAMPLES_CDCACM is not set +# CONFIG_EXAMPLES_COMPOSITE is not set +# CONFIG_EXAMPLES_CXXTEST is not set +# CONFIG_EXAMPLES_DHCPD is not set +# CONFIG_EXAMPLES_ELF is not set +# CONFIG_EXAMPLES_FTPC is not set +# CONFIG_EXAMPLES_FTPD is not set +# CONFIG_EXAMPLES_HELLO is not set +# CONFIG_EXAMPLES_HELLOXX is not set +# CONFIG_EXAMPLES_JSON is not set +# CONFIG_EXAMPLES_HIDKBD is not set +# CONFIG_EXAMPLES_KEYPADTEST is not set +# CONFIG_EXAMPLES_IGMP is not set +# CONFIG_EXAMPLES_LCDRW is not set +# CONFIG_EXAMPLES_MM is not set +# CONFIG_EXAMPLES_MOUNT is not set +# CONFIG_EXAMPLES_MODBUS is not set +# CONFIG_EXAMPLES_NETTEST is not set +# CONFIG_EXAMPLES_NSH is not set +# CONFIG_EXAMPLES_NULL is not set +# CONFIG_EXAMPLES_NX is not set +# CONFIG_EXAMPLES_NXCONSOLE is not set +# CONFIG_EXAMPLES_NXFFS is not set +# CONFIG_EXAMPLES_NXFLAT is not set +# CONFIG_EXAMPLES_NXHELLO is not set +# CONFIG_EXAMPLES_NXIMAGE is not set +CONFIG_EXAMPLES_NXLINES=y +CONFIG_EXAMPLES_NXLINES_VPLANE=0 +CONFIG_EXAMPLES_NXLINES_DEVNO=0 +CONFIG_EXAMPLES_NXLINES_BGCOLOR=0x00006400 +CONFIG_EXAMPLES_NXLINES_LINEWIDTH=16 +CONFIG_EXAMPLES_NXLINES_LINECOLOR=0x00ffff00 +CONFIG_EXAMPLES_NXLINES_BORDERWIDTH=16 +CONFIG_EXAMPLES_NXLINES_BORDERCOLOR=0x00ffff00 +CONFIG_EXAMPLES_NXLINES_CIRCLECOLOR=0x00f5f5dc +CONFIG_EXAMPLES_NXLINES_BPP=32 +# CONFIG_EXAMPLES_NXLINES_EXTERNINIT is not set +# CONFIG_EXAMPLES_NXTEXT is not set +# CONFIG_EXAMPLES_OSTEST is not set +# CONFIG_EXAMPLES_PASHELLO is not set +# CONFIG_EXAMPLES_PIPE is not set +# CONFIG_EXAMPLES_POLL is not set +# CONFIG_EXAMPLES_QENCODER is not set +# CONFIG_EXAMPLES_RGMP is not set +# CONFIG_EXAMPLES_ROMFS is not set +# CONFIG_EXAMPLES_SENDMAIL is not set +# CONFIG_EXAMPLES_SERLOOP is not set +# CONFIG_EXAMPLES_TELNETD is not set +# CONFIG_EXAMPLES_THTTPD is not set +# CONFIG_EXAMPLES_TIFF is not set +# CONFIG_EXAMPLES_TOUCHSCREEN is not set +# CONFIG_EXAMPLES_UDP is not set +# CONFIG_EXAMPLES_UIP is not set +# CONFIG_EXAMPLES_USBSERIAL is not set +# CONFIG_EXAMPLES_USBMSC is not set +# CONFIG_EXAMPLES_USBTERM is not set +# CONFIG_EXAMPLES_WATCHDOG is not set +# CONFIG_EXAMPLES_WLAN is not set + +# +# Interpreters +# + +# +# Interpreters +# +# CONFIG_INTERPRETERS_FICL is not set +# CONFIG_INTERPRETERS_PCODE is not set + +# +# Network Utilities +# + +# +# Networking Utilities +# +# CONFIG_NETUTILS_CODECS is not set +# CONFIG_NETUTILS_DHCPC is not set +# CONFIG_NETUTILS_DHCPD is not set +# CONFIG_NETUTILS_FTPC is not set +# CONFIG_NETUTILS_FTPD is not set +# CONFIG_NETUTILS_JSON is not set +# CONFIG_NETUTILS_RESOLV is not set +# CONFIG_NETUTILS_SMTP is not set +# CONFIG_NETUTILS_TELNETD is not set +# CONFIG_NETUTILS_TFTPC is not set +# CONFIG_NETUTILS_THTTPD is not set +# CONFIG_NETUTILS_UIPLIB is not set +# CONFIG_NETUTILS_WEBCLIENT is not set + +# +# ModBus +# + +# +# FreeModbus +# +# CONFIG_MODBUS is not set + +# +# NSH Library +# +CONFIG_NSH_LIBRARY=y + +# +# Disable Individual commands +# +# CONFIG_NSH_DISABLE_CAT is not set +# CONFIG_NSH_DISABLE_CD is not set +# CONFIG_NSH_DISABLE_CP is not set +# CONFIG_NSH_DISABLE_DD is not set +# CONFIG_NSH_DISABLE_ECHO is not set +# CONFIG_NSH_DISABLE_EXEC is not set +# CONFIG_NSH_DISABLE_EXIT is not set +# CONFIG_NSH_DISABLE_FREE is not set +# CONFIG_NSH_DISABLE_GET is not set +# CONFIG_NSH_DISABLE_HELP is not set +# CONFIG_NSH_DISABLE_HEXDUMP is not set +# CONFIG_NSH_DISABLE_IFCONFIG is not set +# CONFIG_NSH_DISABLE_KILL is not set +# CONFIG_NSH_DISABLE_LOSETUP is not set +# CONFIG_NSH_DISABLE_LS is not set +# CONFIG_NSH_DISABLE_MB is not set +# CONFIG_NSH_DISABLE_MKDIR is not set +# CONFIG_NSH_DISABLE_MKFATFS is not set +# CONFIG_NSH_DISABLE_MKFIFO is not set +# CONFIG_NSH_DISABLE_MKRD is not set +# CONFIG_NSH_DISABLE_MH is not set +# CONFIG_NSH_DISABLE_MOUNT is not set +# CONFIG_NSH_DISABLE_MW is not set +# CONFIG_NSH_DISABLE_NSFMOUNT is not set +# CONFIG_NSH_DISABLE_PS is not set +# CONFIG_NSH_DISABLE_PING is not set +# CONFIG_NSH_DISABLE_PUT is not set +# CONFIG_NSH_DISABLE_PWD is not set +# CONFIG_NSH_DISABLE_RM is not set +# CONFIG_NSH_DISABLE_RMDIR is not set +# CONFIG_NSH_DISABLE_SET is not set +# CONFIG_NSH_DISABLE_SH is not set +# CONFIG_NSH_DISABLE_SLEEP is not set +# CONFIG_NSH_DISABLE_TEST is not set +# CONFIG_NSH_DISABLE_UMOUNT is not set +# CONFIG_NSH_DISABLE_UNSET is not set +# CONFIG_NSH_DISABLE_USLEEP is not set +# CONFIG_NSH_DISABLE_WGET is not set +# CONFIG_NSH_DISABLE_XD is not set +CONFIG_NSH_CODECS_BUFSIZE=128 +CONFIG_NSH_FILEIOSIZE=1024 +CONFIG_NSH_LINELEN=80 +CONFIG_NSH_NESTDEPTH=3 +# CONFIG_NSH_DISABLESCRIPT is not set +# CONFIG_NSH_DISABLEBG is not set +CONFIG_NSH_ROMFSETC=y +CONFIG_NSH_ROMFSMOUNTPT="/etc" +CONFIG_NSH_INITSCRIPT="init.d/rcS" +CONFIG_NSH_ROMFSDEVNO=1 +CONFIG_NSH_ROMFSSECTSIZE=64 +CONFIG_NSH_FATDEVNO=2 +CONFIG_NSH_FATSECTSIZE=512 +CONFIG_NSH_FATNSECTORS=1024 +CONFIG_NSH_FATMOUNTPT="/tmp" +CONFIG_NSH_CONSOLE=y +# CONFIG_NSH_CONDEV is not set +# CONFIG_NSH_ARCHINIT is not set + +# +# NxWidgets/NxWM +# +# CONFIG_NXWIDGETS is not set + +# +# System NSH Add-Ons +# + +# +# Custom Free Memory Command +# +# CONFIG_SYSTEM_FREE is not set + +# +# I2C tool +# + +# +# FLASH Program Installation +# +# CONFIG_SYSTEM_INSTALL is not set + +# +# readline() +# +CONFIG_SYSTEM_READLINE=y +CONFIG_READLINE_ECHO=y + +# +# Power Off +# +# CONFIG_SYSTEM_POWEROFF is not set + +# +# RAMTRON +# +# CONFIG_SYSTEM_RAMTRON is not set + +# +# SD Card +# +# CONFIG_SYSTEM_SDCARD is not set + +# +# Sysinfo +# +# CONFIG_SYSTEM_SYSINFO is not set diff --git a/nuttx/configs/mcu123-lpc214x/nsh/appconfig b/nuttx/configs/sim/nxlines/setenv.sh old mode 100644 new mode 100755 similarity index 76% rename from nuttx/configs/mcu123-lpc214x/nsh/appconfig rename to nuttx/configs/sim/nxlines/setenv.sh index f8e2d51652..0722cbc2ee --- a/nuttx/configs/mcu123-lpc214x/nsh/appconfig +++ b/nuttx/configs/sim/nxlines/setenv.sh @@ -1,7 +1,7 @@ -############################################################################ -# configs/mcu123-lpc214x/nsh/appconfig +#!/bin/bash +# sim/nxlines/setenv.sh # -# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved. +# Copyright (C) 2012 Gregory Nutt. All rights reserved. # Author: Gregory Nutt # # Redistribution and use in source and binary forms, with or without @@ -31,14 +31,23 @@ # ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE # POSSIBILITY OF SUCH DAMAGE. # -############################################################################ -# Path to example in apps/examples containing the user_start entry point +if [ "$_" = "$0" ] ; then + echo "You must source this script, not run it!" 1>&2 + exit 1 +fi -CONFIGURED_APPS += examples/nsh +WD=`pwd` +if [ ! -x "setenv.sh" ]; then + echo "This script must be executed from the top-level NuttX build directory" + exit 1 +fi -# The NSH library +if [ -z "${PATH_ORIG}" ]; then + export PATH_ORIG="${PATH}" +fi -CONFIGURED_APPS += system/readline -CONFIGURED_APPS += nshlib +#export NUTTX_BIN= +#export PATH=${NUTTX_BIN}:/sbin:/usr/sbin:${PATH_ORIG} +echo "PATH : ${PATH}" diff --git a/nuttx/configs/zp214xpa/Kconfig b/nuttx/configs/zp214xpa/Kconfig new file mode 100644 index 0000000000..d8d04ca5cf --- /dev/null +++ b/nuttx/configs/zp214xpa/Kconfig @@ -0,0 +1,7 @@ +# +# For a description of the syntax of this configuration file, +# see misc/tools/kconfig-language.txt. +# + +if ARCH_BOARD_ZP214XPA +endif diff --git a/nuttx/configs/zp214xpa/README.txt b/nuttx/configs/zp214xpa/README.txt new file mode 100644 index 0000000000..6fd7bfba9d --- /dev/null +++ b/nuttx/configs/zp214xpa/README.txt @@ -0,0 +1,136 @@ +zp214xpa README FILE +==================== + +The ZP213X/4XPA board from the0.net with LPC2148 installed. +Includes support for the UG-2864AMBAG01 OLED from The0.net. + +Contents +======== + + o MCU Connections + o Serial Console + o Configurations + +MCU Connections: +================ + +Module Socket: +-------------- +PIN NAME PIN NAME + 1 VBAT 56 VCC + 2 3V3 55 Vusb + 3 VREF 54 3V3 + 4 P0.0 53 RESET + 5 P0.1 52 P1.31 + 6 P0.2 51 P1.30 + 7 P0.3 50 P1.29 + 8 P0.4 49 P1.28 + 9 P0.5 48 P1.27 +10 P0.6 47 P1.26 +11 P0.7 46 P1.25 +12 P0.8 45 P1.24 +13 P0.9 44 P1.23 +14 P0.10 43 P1.22 +15 P0.11 42 P1.21 +16 P0.12 41 P1.20 +17 P0.13 40 P1.19 +18 P0.14 39 P1.18 +19 P0.15 38 P1.17 +20 P0.16 37 P1.16 +21 P0.17 36 P0.31 +22 P0.18 35 P0.30 +23 P0.19 34 P0.29 +24 P0.20 33 P0.28 +25 P0.21 32 P0.27 +26 P0.22 31 P0.26 +27 P0.23 30 P0.25 +28 GND 29 GND + +JTAG Debug: +----------- +PIN NAME PIN NAME + 1 VCC1 2 3V3 + 3 P1.31 NTRST 4 GND + 5 P1.28 TDI 6 GND + 7 P1.30 TMS 8 GND + 9 P1.29 TCK 10 GND +11 P1.26 RTCK 12 GND +13 P1.27 TDO 14 GND +15 RESET NRTS 16 GND +17 N/C NC0 18 GND +19 N/C NC1 20 GND + +Z28160 Net Module: +------------------ +PIN NAME PIN NAME + 1 P0.7 /CS 10 3V3 VCC + 2 P0.4 SCK 9 P1.24 RST + 3 P0.6 SI 8 N/C CLKOUT + 4 P0.5 SO 7 INT P1.25 + 5 GND 6 N/C WOL + +SPI LCD: +-------- +PIN NAME + 1 3V3 3V3 + 2 VCC 5V + 3 P0.18 RESET(DO) + 4 P0.19 DI + 5 P0.20 CS + 6 P0.17 SCK + 7 P0.23 A0(RESET) + 8 N/C LED- + 9 N/C LED+(BL) +10 GND GND + +USB Interface: +-------------- +Vusb, P0.26, P0.27 + +Serial Console: +=============== + +Both UART0 and UART1 are always enabled. UART0 is configured to be the +serial console in these configurations. + +P0.0/TXD0/PWM1 Module Socket, Pin 4 +P0.1/RxD0/PWM3/EINT0 Module Socket, Pin 5 + +P0.8/TXD1/PWM4/AD1.1 Module Socket, Pin 12 +P0.9/RxD1/PWM6/EINT3 Module Socket, Pin 13 + +Configurations: +=============== + +Each NXP LPC214x configuration is maintained in a sudirectory and +can be selected as follow: + + cd tools + ./configure.sh zp214xpa/ + cd - + . ./setenv.sh + +Where is one of the following: + +nsh: +---- + + Configures the NuttShell (nsh) located at examples/nsh. The + Configuration enables only the serial NSH interfaces. + + NOTES: + + 1. This configuration uses the mconf-based configuration tool. To + change this configuration using that tool, you should: + + a. Build and install the mconf tool. See nuttx/README.txt and + misc/tools/ + + b. Execute 'make menuconfig' in nuttx/ in order to start the + reconfiguration process. + + 2. Default platform/toolchain: + + CONFIG_HOST_LINUX=y : Windows + CONFIG_ARM_TOOLCHAIN_GNU_EABI=y : Buildroot (arm-nuttx-elf-gcc) + CONFIG_RAW_BINARY=y : Output formats: ELF and raw binary diff --git a/nuttx/configs/zp214xpa/include/board.h b/nuttx/configs/zp214xpa/include/board.h new file mode 100644 index 0000000000..111d8ad550 --- /dev/null +++ b/nuttx/configs/zp214xpa/include/board.h @@ -0,0 +1,68 @@ +/**************************************************************************** + * configs/zp214xpa/include/board.h + * + * Copyright (C) 2012 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * 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. + * + ****************************************************************************/ + +#ifndef __CONFIGS_ZP214XPA_INCLUDE_BOARD_H +#define __CONFIGS_ZP214XPA_INCLUDE_BOARD_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +/**************************************************************************** + * Definitions + ****************************************************************************/ + +/* Clocking *****************************************************************/ + +/* Oscillator frequency */ + +#define LPC214X_FOSC 12000000 + +/* PLL0 settings CCLK = PLL_M * FOSC PCLK = CCLK/APBDIV */ + +#define LPC214X_PLL_M 5 +#define LPC214X_PLL_P 2 +#define LPC214X_APB_DIV 1 + +/* USB Pll settings -- 48 MHz needed. FUSB = PLL_M FOSC */ + +#define LPC214X_USBPLL_M 4 +#define LPC214X_USBPLL_P 2 + +/**************************************************************************** + * Inline Functions + ****************************************************************************/ + +#endif /* __CONFIGS_ZP214XPA_INCLUDE_BOARD_H */ diff --git a/nuttx/configs/zp214xpa/nsh/Make.defs b/nuttx/configs/zp214xpa/nsh/Make.defs new file mode 100644 index 0000000000..f55e766d32 --- /dev/null +++ b/nuttx/configs/zp214xpa/nsh/Make.defs @@ -0,0 +1,128 @@ +############################################################################## +# configs/zp214xpa/nsh/Make.defs +# +# Copyright (C) 2012 Gregory Nutt. All rights reserved. +# Author: Gregory Nutt +# +# 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 +include ${TOPDIR}/tools/Config.mk + +# The default value for CROSSDEV can be overridden from the make command line: +# make -- Will build for the NuttX buildroot toolchain +# make CROSSDEV=arm-eabi- -- Will build for the devkitARM toolchain +# make CROSSDEV=arm-none-eabi- -- Will build for the CodeSourcery toolchain +# make CROSSDEV=arm-nuttx-elf- -- Will build for the NuttX buildroot toolchain + +CROSSDEV = arm-nuttx-elf- +CC = $(CROSSDEV)gcc +CXX = $(CROSSDEV)g++ +CPP = $(CROSSDEV)gcc -E +LD = $(CROSSDEV)ld +AR = $(CROSSDEV)ar rcs +NM = $(CROSSDEV)nm +OBJCOPY = $(CROSSDEV)objcopy +OBJDUMP = $(CROSSDEV)objdump + +HOSTOS = ${shell uname -o 2>/dev/null || echo "Other"} + +ARCHCCVERSION = ${shell $(CC) -v 2>&1 | sed -n '/^gcc version/p' | sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q'} +ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1} + +ifeq ($(ARCHCCMAJOR),4) +ifneq ($(HOSTOS),Cygwin) +OBJCOPYARGS = -R .note -R .note.gnu.build-id -R .comment +endif +endif + +ifeq ($(CROSSDEV),arm-nuttx-elf-) + MKDEP = $(TOPDIR)/tools/mkdeps.sh + ARCHINCLUDES = -I. -isystem $(TOPDIR)/include + ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx + ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/scripts/ld.script + MAXOPTIMIZATION = -Os +else + WINTOOL = y + DIRLINK = $(TOPDIR)/tools/copydir.sh + DIRUNLINK = $(TOPDIR)/tools/unlink.sh + MKDEP = $(TOPDIR)/tools/mknulldeps.sh + ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" + ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}" + ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/scripts/ld.script}" + MAXOPTIMIZATION = -O2 +endif + +ifeq ($(CONFIG_DEBUG_SYMBOLS),y) + ARCHOPTIMIZATION = -g +else + ARCHOPTIMIZATION = $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer +endif + +ifeq ($(ARCHCCMAJOR),4) + ARCHCPUFLAGS = -mcpu=arm7tdmi -mfloat-abi=soft +else + ARCHCPUFLAGS = -mapcs-32 -mcpu=arm7tdmi -msoft-float +endif + +ARCHCFLAGS = -fno-builtin +ARCHCXXFLAGS = -fno-builtin -fno-exceptions +ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10 +ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow +ARCHWARNINGSXX = -Wall -Wshadow +ARCHDEFINES = + +CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe +CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS) +CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) \ + $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe +CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS) +CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) +AFLAGS = $(CFLAGS) -D__ASSEMBLY__ + +NXFLATLDFLAGS1 = -r -d -warn-common +NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat-gotoff.ld -no-check-sections +LDNXFLATFLAGS = -e main -s 2048 + +OBJEXT = .o +LIBEXT = .a +EXEEXT = + +ifneq ($(CROSSDEV),arm-nuttx-elf-) + LDFLAGS += -nostartfiles -nodefaultlibs +endif +ifeq ($(CONFIG_DEBUG_SYMBOLS),y) + LDFLAGS += -g +endif + +HOSTCC = gcc +HOSTINCLUDES = -I. +HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe +HOSTLDFLAGS = diff --git a/nuttx/configs/zp214xpa/nsh/defconfig b/nuttx/configs/zp214xpa/nsh/defconfig new file mode 100644 index 0000000000..7c7d9d06cf --- /dev/null +++ b/nuttx/configs/zp214xpa/nsh/defconfig @@ -0,0 +1,574 @@ +# +# Automatically generated file; DO NOT EDIT. +# Nuttx/ Configuration +# +CONFIG_NUTTX_NEWCONFIG=y + +# +# Build Setup +# +# CONFIG_EXPERIMENTAL is not set +CONFIG_HOST_LINUX=y +# CONFIG_HOST_OSX is not set +# CONFIG_HOST_WINDOWS is not set +# CONFIG_HOST_OTHER is not set + +# +# Build Configuration +# +# CONFIG_APPS_DIR="../apps" +# CONFIG_BUILD_2PASS is not set + +# +# Binary Output Formats +# +# CONFIG_RRLOAD_BINARY is not set +# CONFIG_INTELHEX_BINARY is not set +# CONFIG_MOTOROLA_SREC is not set +CONFIG_RAW_BINARY=y + +# +# Customize Header Files +# +# CONFIG_ARCH_STDBOOL_H is not set +# CONFIG_ARCH_MATH_H is not set +# CONFIG_ARCH_FLOAT_H is not set +# CONFIG_ARCH_STDARG_H is not set + +# +# Debug Options +# +# CONFIG_DEBUG is not set +# CONFIG_DEBUG_SYMBOLS is not set + +# +# System Type +# +# CONFIG_ARCH_8051 is not set +CONFIG_ARCH_ARM=y +# CONFIG_ARCH_AVR is not set +# CONFIG_ARCH_HC is not set +# CONFIG_ARCH_MIPS is not set +# CONFIG_ARCH_RGMP is not set +# CONFIG_ARCH_SH is not set +# CONFIG_ARCH_SIM is not set +# CONFIG_ARCH_X86 is not set +# CONFIG_ARCH_Z16 is not set +# CONFIG_ARCH_Z80 is not set +CONFIG_ARCH="arm" + +# +# ARM Options +# +# CONFIG_ARCH_CHIP_C5471 is not set +# CONFIG_ARCH_CHIP_CALYPSO is not set +# CONFIG_ARCH_CHIP_DM320 is not set +# CONFIG_ARCH_CHIP_IMX is not set +# CONFIG_ARCH_CHIP_KINETIS is not set +# CONFIG_ARCH_CHIP_LM3S is not set +# CONFIG_ARCH_CHIP_LPC17XX is not set +CONFIG_ARCH_CHIP_LPC214X=y +# CONFIG_ARCH_CHIP_LPC2378 is not set +# CONFIG_ARCH_CHIP_LPC31XX is not set +# CONFIG_ARCH_CHIP_LPC43XX is not set +# CONFIG_ARCH_CHIP_SAM3U is not set +# CONFIG_ARCH_CHIP_STM32 is not set +# CONFIG_ARCH_CHIP_STR71X is not set +CONFIG_ARCH_ARM7TDMI=y +CONFIG_ARCH_FAMILY="arm" +CONFIG_ARCH_CHIP="lpc214x" +CONFIG_ARCH_HAVE_LOWVECTORS=y +# CONFIG_ARCH_LOWVECTORS is not set +CONFIG_BOARD_LOOPSPERMSEC=3270 +# CONFIG_ARCH_CALIBRATION is not set + +# +# ARM Configuration Options +# +# CONFIG_ARM_TOOLCHAIN_BUILDROOT is not set +# CONFIG_ARM_TOOLCHAIN_CODESOURCERYL is not set +CONFIG_ARM_TOOLCHAIN_GNU_EABI=y + +# +# LPC214x Configuration Options +# +CONFIG_ARCH_CHIP_LPC2148=y + +# +# LPC214x Initialization Options +# +# CONFIG_EXTMEM_MODE is not set +# CONFIG_RAM_MODE is not set +CONFIG_DEFAULT_MODE=y +CONFIG_CODE_BASE=0x00000000 +CONFIG_PLL_SETUP=y +CONFIG_MAM_SETUP=y +CONFIG_APBDIV_SETUP=y +CONFIG_APBDIV_VALUE=1 +# CONFIG_EMC_SETUP is not set +# CONFIG_BCFG0_SETUP is not set +# CONFIG_BCFG1_SETUP is not set +# CONFIG_BCFG2_SETUP is not set +# CONFIG_BCFG3_SETUP is not set +CONFIG_ADC_SETUP=y + +# +# LPC214x Peripheral Support +# +CONFIG_LPC214X_UART0=y +CONFIG_LPC214X_UART1=y +# CONFIG_LPC214x_FIO is not set + +# +# Architecture Options +# +# CONFIG_ARCH_NOINTC is not set +# CONFIG_ARCH_DMA is not set +# CONFIG_ARCH_IRQPRIO is not set +# CONFIG_CUSTOM_STACK is not set +# CONFIG_ADDRENV is not set +CONFIG_ARCH_STACKDUMP=y +# CONFIG_ENDIAN_BIG is not set + +# +# Board Settings +# +CONFIG_DRAM_START=0x40000000 +CONFIG_DRAM_SIZE=32768 +CONFIG_ARCH_HAVE_INTERRUPTSTACK=y +CONFIG_ARCH_INTERRUPTSTACK=0 + +# +# Boot options +# +# CONFIG_BOOT_RUNFROMEXTSRAM is not set +CONFIG_BOOT_RUNFROMFLASH=y +# CONFIG_BOOT_RUNFROMISRAM is not set +# CONFIG_BOOT_RUNFROMSDRAM is not set +# CONFIG_BOOT_COPYTORAM is not set + +# +# Board Selection +# +# CONFIG_ARCH_BOARD_MCU123 is not set +CONFIG_ARCH_BOARD_ZP214XPA=y +# CONFIG_ARCH_BOARD_CUSTOM is not set +CONFIG_ARCH_BOARD="zp214xpa" + +# +# Common Board Options +# +CONFIG_NSH_MMCSDMINOR=0 + +# +# Board-Specific Options +# + +# +# RTOS Features +# +CONFIG_MSEC_PER_TICK=10 +CONFIG_RR_INTERVAL=0 +# CONFIG_SCHED_INSTRUMENTATION is not set +CONFIG_TASK_NAME_SIZE=0 +# CONFIG_JULIAN_TIME is not set +CONFIG_START_YEAR=2008 +CONFIG_START_MONTH=10 +CONFIG_START_DAY=1 +CONFIG_DEV_CONSOLE=y +# CONFIG_MUTEX_TYPES is not set +# CONFIG_PRIORITY_INHERITANCE is not set +# CONFIG_FDCLONE_DISABLE is not set +# CONFIG_FDCLONE_STDIO is not set +CONFIG_SDCLONE_DISABLE=y +# CONFIG_SCHED_WORKQUEUE is not set +# CONFIG_SCHED_WAITPID is not set +# CONFIG_SCHED_ATEXIT is not set +# CONFIG_SCHED_ONEXIT is not set +CONFIG_USER_ENTRYPOINT="nsh_main" +CONFIG_DISABLE_OS_API=y +# CONFIG_DISABLE_CLOCK is not set +# CONFIG_DISABLE_POSIX_TIMERS is not set +# CONFIG_DISABLE_PTHREAD is not set +# CONFIG_DISABLE_SIGNALS is not set +# CONFIG_DISABLE_MQUEUE is not set +# CONFIG_DISABLE_MOUNTPOINT is not set +# CONFIG_DISABLE_ENVIRON is not set +CONFIG_DISABLE_POLL=y + +# +# Sizes of configurable things (0 disables) +# +CONFIG_MAX_TASKS=16 +CONFIG_MAX_TASK_ARGS=4 +CONFIG_NPTHREAD_KEYS=4 +CONFIG_NFILE_DESCRIPTORS=8 +CONFIG_NFILE_STREAMS=8 +CONFIG_NAME_MAX=32 +CONFIG_PREALLOC_MQ_MSGS=4 +CONFIG_MQ_MAXMSGSIZE=32 +CONFIG_MAX_WDOGPARMS=2 +CONFIG_PREALLOC_WDOGS=4 +CONFIG_PREALLOC_TIMERS=4 + +# +# Stack and heap information +# +CONFIG_IDLETHREAD_STACKSIZE=2048 +CONFIG_USERMAIN_STACKSIZE=2048 +CONFIG_PTHREAD_STACK_MIN=256 +CONFIG_PTHREAD_STACK_DEFAULT=2048 + +# +# Device Drivers +# +CONFIG_DEV_NULL=y +# CONFIG_DEV_ZERO is not set +# CONFIG_LOOP is not set +# CONFIG_RAMDISK is not set +# CONFIG_CAN is not set +# CONFIG_PWM is not set +# CONFIG_I2C is not set +# CONFIG_SPI is not set +# CONFIG_RTC is not set +# CONFIG_WATCHDOG is not set +# CONFIG_ANALOG is not set +# CONFIG_BCH is not set +# CONFIG_INPUT is not set +# CONFIG_LCD is not set +# CONFIG_MMCSD is not set +# CONFIG_MTD is not set +# CONFIG_PIPES is not set +# CONFIG_PM is not set +# CONFIG_POWER is not set +# CONFIG_SENSORS is not set +# CONFIG_SERCOMM_CONSOLE is not set +CONFIG_SERIAL=y +# CONFIG_DEV_LOWCONSOLE is not set +# CONFIG_16550_UART is not set +CONFIG_ARCH_HAVE_UART0=y +CONFIG_ARCH_HAVE_UART1=y +CONFIG_MCU_SERIAL=y +CONFIG_STANDARD_SERIAL=y +CONFIG_UART0_SERIAL_CONSOLE=y +# CONFIG_UART1_SERIAL_CONSOLE is not set +# CONFIG_NO_SERIAL_CONSOLE is not set + +# +# UART0 Configuration +# +CONFIG_UART0_RXBUFSIZE=256 +CONFIG_UART0_TXBUFSIZE=256 +CONFIG_UART0_BAUD=38400 +CONFIG_UART0_BITS=8 +CONFIG_UART0_PARITY=0 +CONFIG_UART0_2STOP=0 + +# +# UART1 Configuration +# +CONFIG_UART1_RXBUFSIZE=256 +CONFIG_UART1_TXBUFSIZE=256 +CONFIG_UART1_BAUD=38400 +CONFIG_UART1_BITS=8 +CONFIG_UART1_PARITY=0 +CONFIG_UART1_2STOP=0 +# CONFIG_USBDEV is not set +# CONFIG_USBHOST is not set +# CONFIG_WIRELESS is not set + +# +# System Logging Device Options +# + +# +# System Logging +# +# CONFIG_RAMLOG is not set + +# +# Networking Support +# +# CONFIG_NET is not set + +# +# File Systems +# + +# +# File system configuration +# +# CONFIG_FS_FAT is not set +# CONFIG_FS_RAMMAP is not set +# CONFIG_FS_NXFFS is not set +# CONFIG_FS_ROMFS is not set + +# +# System Logging +# +# CONFIG_SYSLOG is not set + +# +# Graphics Support +# +# CONFIG_NX is not set + +# +# Memory Management +# +# CONFIG_MM_SMALL is not set +CONFIG_MM_REGIONS=1 +# CONFIG_GRAN is not set + +# +# Binary Formats +# +# CONFIG_BINFMT_DISABLE is not set +# CONFIG_BINFMT_EXEPATH is not set +# CONFIG_NXFLAT is not set +# CONFIG_ELF is not set +# CONFIG_PIC is not set +# CONFIG_SYMTAB_ORDEREDBYNAME is not set + +# +# Library Routines +# + +# +# Standard C Library Options +# +CONFIG_STDIO_BUFFER_SIZE=256 +CONFIG_STDIO_LINEBUFFER=y +CONFIG_NUNGET_CHARS=2 +CONFIG_LIB_HOMEDIR="/" +# CONFIG_LIBM is not set +# CONFIG_NOPRINTF_FIELDWIDTH is not set +# CONFIG_LIBC_FLOATINGPOINT is not set +# CONFIG_EOL_IS_CR is not set +# CONFIG_EOL_IS_LF is not set +# CONFIG_EOL_IS_BOTH_CRLF is not set +CONFIG_EOL_IS_EITHER_CRLF=y +# CONFIG_LIBC_STRERROR is not set +# CONFIG_LIBC_PERROR_STDOUT is not set +CONFIG_ARCH_LOWPUTC=y +CONFIG_LIB_SENDFILE_BUFSIZE=512 +# CONFIG_ARCH_ROMGETC is not set +# CONFIG_ARCH_OPTIMIZED_FUNCTIONS is not set + +# +# Non-standard Helper Functions +# +CONFIG_LIB_KBDCODEC=y + +# +# Basic CXX Support +# +# CONFIG_C99_BOOL8 is not set +# CONFIG_HAVE_CXX is not set + +# +# Application Configuration +# + +# +# Built-In Applications +# +# CONFIG_BUILTIN is not set + +# +# Examples +# +# CONFIG_EXAMPLES_BUTTONS is not set +# CONFIG_EXAMPLES_CAN is not set +# CONFIG_EXAMPLES_CDCACM is not set +# CONFIG_EXAMPLES_COMPOSITE is not set +# CONFIG_EXAMPLES_DHCPD is not set +# CONFIG_EXAMPLES_ELF is not set +# CONFIG_EXAMPLES_FTPC is not set +# CONFIG_EXAMPLES_FTPD is not set +# CONFIG_EXAMPLES_HELLO is not set +# CONFIG_EXAMPLES_HELLOXX is not set +# CONFIG_EXAMPLES_JSON is not set +# CONFIG_EXAMPLES_HIDKBD is not set +# CONFIG_EXAMPLES_KEYPADTEST is not set +# CONFIG_EXAMPLES_IGMP is not set +# CONFIG_EXAMPLES_LCDRW is not set +# CONFIG_EXAMPLES_MM is not set +# CONFIG_EXAMPLES_MOUNT is not set +# CONFIG_EXAMPLES_MODBUS is not set +# CONFIG_EXAMPLES_NETTEST is not set +CONFIG_EXAMPLES_NSH=y +# CONFIG_EXAMPLES_NULL is not set +# CONFIG_EXAMPLES_NX is not set +# CONFIG_EXAMPLES_NXCONSOLE is not set +# CONFIG_EXAMPLES_NXFFS is not set +# CONFIG_EXAMPLES_NXFLAT is not set +# CONFIG_EXAMPLES_NXHELLO is not set +# CONFIG_EXAMPLES_NXIMAGE is not set +# CONFIG_EXAMPLES_NXLINES is not set +# CONFIG_EXAMPLES_NXTEXT is not set +# CONFIG_EXAMPLES_OSTEST is not set +# CONFIG_EXAMPLES_PASHELLO is not set +# CONFIG_EXAMPLES_PIPE is not set +# CONFIG_EXAMPLES_POLL is not set +# CONFIG_EXAMPLES_QENCODER is not set +# CONFIG_EXAMPLES_RGMP is not set +# CONFIG_EXAMPLES_ROMFS is not set +# CONFIG_EXAMPLES_SENDMAIL is not set +# CONFIG_EXAMPLES_SERLOOP is not set +# CONFIG_EXAMPLES_TELNETD is not set +# CONFIG_EXAMPLES_THTTPD is not set +# CONFIG_EXAMPLES_TIFF is not set +# CONFIG_EXAMPLES_TOUCHSCREEN is not set +# CONFIG_EXAMPLES_UDP is not set +# CONFIG_EXAMPLES_UIP is not set +# CONFIG_EXAMPLES_USBSERIAL is not set +# CONFIG_EXAMPLES_USBMSC is not set +# CONFIG_EXAMPLES_USBTERM is not set +# CONFIG_EXAMPLES_WATCHDOG is not set +# CONFIG_EXAMPLES_WLAN is not set + +# +# Interpreters +# + +# +# Interpreters +# +# CONFIG_INTERPRETERS_FICL is not set +# CONFIG_INTERPRETERS_PCODE is not set + +# +# Network Utilities +# + +# +# Networking Utilities +# +# CONFIG_NETUTILS_CODECS is not set +# CONFIG_NETUTILS_DHCPC is not set +# CONFIG_NETUTILS_DHCPD is not set +# CONFIG_NETUTILS_FTPC is not set +# CONFIG_NETUTILS_FTPD is not set +# CONFIG_NETUTILS_JSON is not set +# CONFIG_NETUTILS_RESOLV is not set +# CONFIG_NETUTILS_SMTP is not set +# CONFIG_NETUTILS_TELNETD is not set +# CONFIG_NETUTILS_TFTPC is not set +# CONFIG_NETUTILS_THTTPD is not set +# CONFIG_NETUTILS_UIPLIB is not set +# CONFIG_NETUTILS_WEBCLIENT is not set + +# +# ModBus +# + +# +# FreeModbus +# +# CONFIG_MODBUS is not set + +# +# NSH Library +# +CONFIG_NSH_LIBRARY=y + +# +# Disable Individual commands +# +# CONFIG_NSH_DISABLE_CAT is not set +# CONFIG_NSH_DISABLE_CD is not set +# CONFIG_NSH_DISABLE_CP is not set +# CONFIG_NSH_DISABLE_DD is not set +# CONFIG_NSH_DISABLE_ECHO is not set +# CONFIG_NSH_DISABLE_EXEC is not set +# CONFIG_NSH_DISABLE_EXIT is not set +# CONFIG_NSH_DISABLE_FREE is not set +# CONFIG_NSH_DISABLE_GET is not set +# CONFIG_NSH_DISABLE_HELP is not set +# CONFIG_NSH_DISABLE_HEXDUMP is not set +# CONFIG_NSH_DISABLE_IFCONFIG is not set +# CONFIG_NSH_DISABLE_KILL is not set +# CONFIG_NSH_DISABLE_LOSETUP is not set +# CONFIG_NSH_DISABLE_LS is not set +# CONFIG_NSH_DISABLE_MB is not set +# CONFIG_NSH_DISABLE_MKDIR is not set +# CONFIG_NSH_DISABLE_MKFATFS is not set +# CONFIG_NSH_DISABLE_MKFIFO is not set +# CONFIG_NSH_DISABLE_MKRD is not set +# CONFIG_NSH_DISABLE_MH is not set +# CONFIG_NSH_DISABLE_MOUNT is not set +# CONFIG_NSH_DISABLE_MW is not set +# CONFIG_NSH_DISABLE_NSFMOUNT is not set +# CONFIG_NSH_DISABLE_PS is not set +# CONFIG_NSH_DISABLE_PING is not set +# CONFIG_NSH_DISABLE_PUT is not set +# CONFIG_NSH_DISABLE_PWD is not set +# CONFIG_NSH_DISABLE_RM is not set +# CONFIG_NSH_DISABLE_RMDIR is not set +# CONFIG_NSH_DISABLE_SET is not set +# CONFIG_NSH_DISABLE_SH is not set +# CONFIG_NSH_DISABLE_SLEEP is not set +# CONFIG_NSH_DISABLE_TEST is not set +# CONFIG_NSH_DISABLE_UMOUNT is not set +# CONFIG_NSH_DISABLE_UNSET is not set +# CONFIG_NSH_DISABLE_USLEEP is not set +# CONFIG_NSH_DISABLE_WGET is not set +# CONFIG_NSH_DISABLE_XD is not set +CONFIG_NSH_CODECS_BUFSIZE=128 +CONFIG_NSH_FILEIOSIZE=512 +CONFIG_NSH_LINELEN=64 +CONFIG_NSH_NESTDEPTH=3 +# CONFIG_NSH_DISABLESCRIPT is not set +# CONFIG_NSH_DISABLEBG is not set +CONFIG_NSH_CONSOLE=y +# CONFIG_NSH_CONDEV is not set +# CONFIG_NSH_ARCHINIT is not set + +# +# NxWidgets/NxWM +# + +# +# System NSH Add-Ons +# + +# +# Custom Free Memory Command +# +# CONFIG_SYSTEM_FREE is not set + +# +# I2C tool +# + +# +# FLASH Program Installation +# +# CONFIG_SYSTEM_INSTALL is not set + +# +# readline() +# +CONFIG_SYSTEM_READLINE=y +CONFIG_READLINE_ECHO=y + +# +# Power Off +# +# CONFIG_SYSTEM_POWEROFF is not set + +# +# RAMTRON +# +# CONFIG_SYSTEM_RAMTRON is not set + +# +# SD Card +# +# CONFIG_SYSTEM_SDCARD is not set + +# +# Sysinfo +# +# CONFIG_SYSTEM_SYSINFO is not set diff --git a/nuttx/configs/zp214xpa/nsh/setenv.sh b/nuttx/configs/zp214xpa/nsh/setenv.sh new file mode 100755 index 0000000000..724dab7064 --- /dev/null +++ b/nuttx/configs/zp214xpa/nsh/setenv.sh @@ -0,0 +1,65 @@ +#!/bin/bash +# configs/zp214xpa/nsh/setenv.sh +# +# Copyright (C) 2012 Gregory Nutt. All rights reserved. +# Author: Gregory Nutt +# +# 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. +# + +if [ "$_" = "$0" ] ; then + echo "You must source this script, not run it!" 1>&2 + exit 1 +fi + +WD=`pwd` +if [ ! -x "setenv.sh" ]; then + echo "This script must be executed from the top-level NuttX build directory" + exit 1 +fi + +if [ -z "${PATH_ORIG}" ]; then + export PATH_ORIG="${PATH}" +fi + +# This is the Cygwin path to the location where I installed the CodeSourcery +# toolchain under windows. You will also have to edit this if you install +# the CodeSourcery toolchain in any other location +# export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/CodeSourcery/Sourcery G++ Lite/bin" + +# This is the Cygwin path to the location where I build the buildroot +# toolchain. +export TOOLCHAIN_BIN="${WD}/../misc/buildroot/build_arm_nofpu/staging_dir/bin" + +# The zp214xpa/tools directory +export LPCTOOL_DIR="${WD}/configs/zp214xpa/tools" + +# Add the path to the toolchain and tools directory to the PATH varialble +export PATH="${TOOLCHAIN_BIN}:${LPCTOOL_DIR}:/sbin:/usr/sbin:${PATH_ORIG}" + +echo "PATH : ${PATH}" diff --git a/nuttx/configs/zp214xpa/scripts/ld.script b/nuttx/configs/zp214xpa/scripts/ld.script new file mode 100644 index 0000000000..ba6ff8f2c1 --- /dev/null +++ b/nuttx/configs/zp214xpa/scripts/ld.script @@ -0,0 +1,120 @@ +/**************************************************************************** + * configs/zp214xpa/scripts/ld.script + * + * Copyright (C) 2012 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * 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. + * + ****************************************************************************/ + +/* FLASH: + * The lpc2148 has 512Kb of non-volatile memory beginning at address + * 0x0000:0000. The OS entry point is via the reset vector at address + * 0x0000:0000 (default MEMMAP mode assumed) + * + * SRAM: + * The lpc2148 has 32Kb of on-chip static RAM beginning at address + * 0x4000:0000. The .data section will be relocated from _eronly + * to _sdata at boot time. + */ + +MEMORY +{ + flash (rx) : ORIGIN = 0x00000000, LENGTH = 500K + sram (rw) : ORIGIN = 0x40000000, LENGTH = 32K - 32 +} + +OUTPUT_ARCH(arm) +ENTRY(_stext) +SECTIONS +{ + .text : { + _stext = ABSOLUTE(.); + *(.vectors) + *(.text .text.*) + *(.fixup) + *(.gnu.warning) + *(.rodata .rodata.*) + *(.gnu.linkonce.t.*) + *(.glue_7) + *(.glue_7t) + *(.got) + *(.gcc_except_table) + *(.gnu.linkonce.r.*) + _etext = ABSOLUTE(.); + } > flash + + .init_section : { + _sinit = ABSOLUTE(.); + *(.init_array .init_array.*) + _einit = ABSOLUTE(.); + } > flash + + .ARM.extab : { + *(.ARM.extab*) + } > flash + + __exidx_start = ABSOLUTE(.); + .ARM.exidx : { + *(.ARM.exidx*) + } > flash + __exidx_end = ABSOLUTE(.); + + _eronly = ABSOLUTE(.); + + .data : { + _sdata = ABSOLUTE(.); + *(.data .data.*) + *(.gnu.linkonce.d.*) + CONSTRUCTORS + _edata = ABSOLUTE(.); + } > sram AT > flash + + .bss : { + _sbss = ABSOLUTE(.); + *(.bss .bss.*) + *(.gnu.linkonce.b.*) + *(COMMON) + _ebss = ABSOLUTE(.); + } > sram + + /* Stabs debugging sections. */ + .stab 0 : { *(.stab) } + .stabstr 0 : { *(.stabstr) } + .stab.excl 0 : { *(.stab.excl) } + .stab.exclstr 0 : { *(.stab.exclstr) } + .stab.index 0 : { *(.stab.index) } + .stab.indexstr 0 : { *(.stab.indexstr) } + .comment 0 : { *(.comment) } + .debug_abbrev 0 : { *(.debug_abbrev) } + .debug_info 0 : { *(.debug_info) } + .debug_line 0 : { *(.debug_line) } + .debug_pubnames 0 : { *(.debug_pubnames) } + .debug_aranges 0 : { *(.debug_aranges) } +} diff --git a/nuttx/configs/zp214xpa/src/Makefile b/nuttx/configs/zp214xpa/src/Makefile new file mode 100644 index 0000000000..8f1e1c05d9 --- /dev/null +++ b/nuttx/configs/zp214xpa/src/Makefile @@ -0,0 +1,84 @@ +############################################################################ +# configs/zp214xpa/src/Makefile +# +# Copyright (C) 2012 Gregory Nutt. All rights reserved. +# Author: Gregory Nutt +# +# 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)/Make.defs + +ARCH_SRCDIR = $(TOPDIR)/arch/$(CONFIG_ARCH)/src +ifeq ($(WINTOOL),y) + CFLAGS += -I "${shell cygpath -w $(ARCH_SRCDIR)/chip}" \ + -I "${shell cygpath -w $(ARCH_SRCDIR)/common}" \ + -I "${shell cygpath -w $(ARCH_SRCDIR)/arm}" \ + -I "${shell cygpath -w $(ARCH_SRCDIR)/sched}" +else + CFLAGS += -I$(ARCH_SRCDIR)/chip -I$(ARCH_SRCDIR)/common -I$(ARCH_SRCDIR)/arm -I$(TOPDIR)/sched +endif + +ASRCS = +AOBJS = $(ASRCS:.S=$(OBJEXT)) +CSRCS = + +COBJS = $(CSRCS:.c=$(OBJEXT)) + +SRCS = $(ASRCS) $(CSRCS) +OBJS = $(AOBJS) $(COBJS) + +CFLAGS += -I $(TOPDIR)/arch/$(CONFIG_ARCH)/src + +all: libboard$(LIBEXT) + +$(AOBJS): %$(OBJEXT): %.S + $(call ASSEMBLE, $<, $@) + +$(COBJS) $(LINKOBJS): %$(OBJEXT): %.c + $(call COMPILE, $<, $@) + +libboard$(LIBEXT): $(OBJS) + $(call ARCHIVE, $@, $(OBJS)) + +.depend: Makefile $(SRCS) + $(Q) $(MKDEP) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep + $(Q) touch $@ + +depend: .depend + +clean: + $(call DELFILE, libboard$(LIBEXT)) + $(call CLEAN) + +distclean: clean + $(call DELFILE, Make.dep) + $(call DELFILE, .depend) + +-include Make.dep diff --git a/nuttx/drivers/mmcsd/Kconfig b/nuttx/drivers/mmcsd/Kconfig index c224f220af..f3a64be6ce 100644 --- a/nuttx/drivers/mmcsd/Kconfig +++ b/nuttx/drivers/mmcsd/Kconfig @@ -2,6 +2,7 @@ # For a description of the syntax of this configuration file, # see misc/tools/kconfig-language.txt. # + config MMCSD_NSLOTS int "Number of MMC/SD slots" default 1 diff --git a/nuttx/drivers/usbhost/usbhost_hidkbd.c b/nuttx/drivers/usbhost/usbhost_hidkbd.c index 0bab89c284..d6a9ceda31 100644 --- a/nuttx/drivers/usbhost/usbhost_hidkbd.c +++ b/nuttx/drivers/usbhost/usbhost_hidkbd.c @@ -421,7 +421,7 @@ static const uint8_t encoding[USBHID_NUMENCODINGS] = KEYCODE_ENTER, 0, KEYCODE_FWDDEL, KEYCODE_BACKDEL, 0, 0, 0, 0, - /* 0x30-0x37: },|,Non-US tilde,:,",grave tidle,<,> */ + /* 0x30-0x37: },|,Non-US tilde,:,",grave tilde,<,> */ 0, 0, 0, 0, 0, 0, 0, 0, @@ -525,7 +525,7 @@ static const uint8_t ucmap[USBHID_NUMSCANCODES] = 'U', 'V', 'W', 'X', 'Y', 'Z', '!', '@', /* 0x18-0x1f: U-Z,!,@ */ '#', '$', '%', '^', '&', '*', '(', ')', /* 0x20-0x27: #,$,%,^,&,*,(,) */ '\n', '\033', '\177', 0, ' ', '_', '+', '{', /* 0x28-0x2f: Enter,escape,del,back-tab,space,_,+,{ */ - '}', '|', 0, ':', '"', 0, '<', '>', /* 0x30-0x37: },|,Non-US tilde,:,",grave tidle,<,> */ + '}', '|', 0, ':', '"', '~', '<', '>', /* 0x30-0x37: },|,Non-US tilde,:,",grave tilde,<,> */ '?', 0, 0, 0, 0, 0, 0, 0, /* 0x38-0x3f: /,CapsLock,F1,F2,F3,F4,F5,F6 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x40-0x47: F7,F8,F9,F10,F11,F12,PrtScn,ScrollLock */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x48-0x4f: Pause,Insert,Home,PageUp,DeleteForward,End,PageDown,RightArrow */ @@ -560,7 +560,7 @@ static const uint8_t lcmap[USBHID_NUMSCANCODES] = 'u', 'v', 'w', 'x', 'y', 'z', '1', '2', /* 0x18-0x1f: u-z,1-2 */ '3', '4', '5', '6', '7', '8', '9', '0', /* 0x20-0x27: 3-9,0 */ '\n', '\033', '\177', '\t', ' ', '-', '=', '[', /* 0x28-0x2f: Enter,escape,del,tab,space,-,=,[ */ - ']', '\\', '\234', ';', '\'', 0, ',', '.', /* 0x30-0x37: ],\,Non-US pound,;,',grave accent,,,. */ + ']', '\\', '\234', ';', '\'', '`', ',', '.', /* 0x30-0x37: ],\,Non-US pound,;,',grave accent,,,. */ '/', 0, 0, 0, 0, 0, 0, 0, /* 0x38-0x3f: /,CapsLock,F1,F2,F3,F4,F5,F6 */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x40-0x47: F7,F8,F9,F10,F11,F12,PrtScn,ScrollLock */ 0, 0, 0, 0, 0, 0, 0, 0, /* 0x48-0x4f: Pause,Insert,Home,PageUp,DeleteForward,End,PageDown,RightArrow */ From e1eacb2254652f35e0eacc8b9a733bbad7976111 Mon Sep 17 00:00:00 2001 From: patacongo Date: Sun, 30 Dec 2012 16:39:25 +0000 Subject: [PATCH 019/118] Add ZP213X/4XPA nxlines configuration (needs a little more work) git-svn-id: http://svn.code.sf.net/p/nuttx/code/trunk@5466 42af7a65-404d-4744-a932-0658087f49c3 --- .../configs/arm7tdmi-defconfig-4.3.3 | 7 + nuttx/ChangeLog | 5 +- nuttx/configs/mcu123-lpc214x/src/Makefile | 2 +- .../src/{up_spi.c => up_spi1.c} | 4 +- nuttx/configs/olimex-lpc1766stk/README.txt | 10 +- nuttx/configs/sim/README.txt | 15 + nuttx/configs/zp214xpa/README.txt | 368 +++++++--- nuttx/configs/zp214xpa/nxlines/Make.defs | 128 ++++ nuttx/configs/zp214xpa/nxlines/defconfig | 606 ++++++++++++++++ nuttx/configs/zp214xpa/nxlines/setenv.sh | 65 ++ nuttx/configs/zp214xpa/src/Makefile | 4 + nuttx/configs/zp214xpa/src/up_spi1.c | 644 ++++++++++++++++++ nuttx/configs/zp214xpa/src/up_ug2864ambag01.c | 177 +++++ nuttx/configs/zp214xpa/tools/olimex.cfg | 62 ++ nuttx/configs/zp214xpa/tools/oocd.sh | 52 ++ nuttx/configs/zp214xpa/tools/usb-repair.txt | 25 + nuttx/graphics/Kconfig | 6 + nuttx/include/nuttx/nx/nxfonts.h | 5 + 18 files changed, 2094 insertions(+), 91 deletions(-) rename nuttx/configs/mcu123-lpc214x/src/{up_spi.c => up_spi1.c} (99%) create mode 100644 nuttx/configs/zp214xpa/nxlines/Make.defs create mode 100644 nuttx/configs/zp214xpa/nxlines/defconfig create mode 100755 nuttx/configs/zp214xpa/nxlines/setenv.sh create mode 100644 nuttx/configs/zp214xpa/src/up_spi1.c create mode 100644 nuttx/configs/zp214xpa/src/up_ug2864ambag01.c create mode 100755 nuttx/configs/zp214xpa/tools/olimex.cfg create mode 100755 nuttx/configs/zp214xpa/tools/oocd.sh create mode 100644 nuttx/configs/zp214xpa/tools/usb-repair.txt diff --git a/misc/buildroot/configs/arm7tdmi-defconfig-4.3.3 b/misc/buildroot/configs/arm7tdmi-defconfig-4.3.3 index 7e97a77d67..c027c8a8c9 100644 --- a/misc/buildroot/configs/arm7tdmi-defconfig-4.3.3 +++ b/misc/buildroot/configs/arm7tdmi-defconfig-4.3.3 @@ -14,6 +14,7 @@ BR2_arm=y # BR2_m68k is not set # BR2_m68hc11 is not set # BR2_m68hc12 is not set +# BR2_m9s12x is not set # BR2_mips is not set # BR2_mipsel is not set # BR2_nios2 is not set @@ -71,8 +72,11 @@ BR2_GNU_TARGET_SUFFIX="nuttx-elf" # Binutils Options # # BR2_BINUTILS_VERSION_2_17 is not set +# BR2_BINUTILS_VERSION_2_18 is not set # BR2_BINUTILS_VERSION_2_19 is not set BR2_BINUTILS_VERSION_2_19_1=y +# BR2_BINUTILS_VERSION_2_21_1 is not set +# BR2_BINUTILS_VERSION_2_22 is not set BR2_BINUTILS_VERSION="2.19.1" BR2_EXTRA_BINUTILS_CONFIG_OPTIONS="" @@ -80,9 +84,12 @@ BR2_EXTRA_BINUTILS_CONFIG_OPTIONS="" # GCC Options # BR2_PACKAGE_GCC=y +# BR2_GCC_VERSION_3_3_6 is not set # BR2_GCC_VERSION_3_4_6 is not set # BR2_GCC_VERSION_4_2_4 is not set BR2_GCC_VERSION_4_3_3=y +# BR2_GCC_VERSION_4_5_2 is not set +# BR2_GCC_VERSION_4_6_3 is not set BR2_GCC_SUPPORTS_SYSROOT=y BR2_GCC_VERSION="4.3.3" # BR2_GCC_USE_SJLJ_EXCEPTIONS is not set diff --git a/nuttx/ChangeLog b/nuttx/ChangeLog index dcabb6c071..56cc5515dc 100644 --- a/nuttx/ChangeLog +++ b/nuttx/ChangeLog @@ -3842,4 +3842,7 @@ board (with the LPC2148 and the UG_2864AMBAG01). * configs/sim/nxlines: Add an nxlines configuration for the simulator. - + * configs/zp214xpa/nxlines: Add an nxlines configuration for the + ZP213x/4xPA (with the LPC2148 and the UG_2864AMBAG01). As of this + writing (2012-12-30), I see only garbage on the display each time + the display is updated. diff --git a/nuttx/configs/mcu123-lpc214x/src/Makefile b/nuttx/configs/mcu123-lpc214x/src/Makefile index 5ddcebe424..79f767fffc 100644 --- a/nuttx/configs/mcu123-lpc214x/src/Makefile +++ b/nuttx/configs/mcu123-lpc214x/src/Makefile @@ -47,7 +47,7 @@ endif ASRCS = AOBJS = $(ASRCS:.S=$(OBJEXT)) -CSRCS = up_spi.c up_leds.c +CSRCS = up_spi1.c up_leds.c ifeq ($(CONFIG_NSH_ARCHINIT),y) CSRCS += up_nsh.c diff --git a/nuttx/configs/mcu123-lpc214x/src/up_spi.c b/nuttx/configs/mcu123-lpc214x/src/up_spi1.c similarity index 99% rename from nuttx/configs/mcu123-lpc214x/src/up_spi.c rename to nuttx/configs/mcu123-lpc214x/src/up_spi1.c index b58c8d6670..61abee20a9 100644 --- a/nuttx/configs/mcu123-lpc214x/src/up_spi.c +++ b/nuttx/configs/mcu123-lpc214x/src/up_spi1.c @@ -1,6 +1,6 @@ /**************************************************************************** - * config/mcu123-lpc214x/src/up_spi.c - * arch/arm/src/board/up_spi.c + * config/mcu123-lpc214x/src/up_spi1.c + * arch/arm/src/board/up_spi1.c * * Copyright (C) 2008-2010, 2012 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/configs/olimex-lpc1766stk/README.txt b/nuttx/configs/olimex-lpc1766stk/README.txt index e2c940bac5..35f00e9f2e 100644 --- a/nuttx/configs/olimex-lpc1766stk/README.txt +++ b/nuttx/configs/olimex-lpc1766stk/README.txt @@ -439,12 +439,12 @@ LEDs that interrupt). So a brighter LED1 means that the processor is spending less time sleeping. - When my STM32 sits IDLE -- doing absolutely nothing but processing timer interrupts -- + When my LPC1766 sits IDLE -- doing absolutely nothing but processing timer interrupts -- I see the following: 1. LED1 glows dimly due to the timer interrupts. 2. But LED2 is even more dim! The LED ON time excludes the time processing the - interrupt that re-awakens the processing. So this tells me that the STM32 is + interrupt that re-awakens the processing. So this tells me that the LPC1766 is spending more time processing timer interrupts than doing any other kind of processing. That, of course, makes sense if the system is truly idle and only processing timer interrupts. @@ -913,9 +913,9 @@ Where is one of the following: 2. Default platform/toolchain: This is how the build is configured by be default. These options can easily be re-confured, however. - CONFIG_HOST_WINDOWS=y : Windows - CONFIG_WINDOWS_CYGWIN=y : Cygwin environment on Windows - CONFIG_STM32_CODESOURCERYW=y : CodeSourcery under Windows + CONFIG_HOST_WINDOWS=y : Windows + CONFIG_WINDOWS_CYGWIN=y : Cygwin environment on Windows + CONFIG_ARMV7M_TOOLCHAIN_CODESOURCERYW=y : CodeSourcery under Windows nettest: This configuration directory may be used to enable networking using the diff --git a/nuttx/configs/sim/README.txt b/nuttx/configs/sim/README.txt index 03f163ea5a..ff756fb4b6 100644 --- a/nuttx/configs/sim/README.txt +++ b/nuttx/configs/sim/README.txt @@ -446,6 +446,21 @@ nx11 See apps/examples/README.txt for further details. +nxlines + + This is the apps/examples/nxlines test. + + NOTES: + ------ + 1. This configuration uses the mconf-based configuration tool. To + change this configuration using that tool, you should: + + a. Build and install the mconf tool. See nuttx/README.txt and + misc/tools/ + + b. Execute 'make menuconfig' in nuttx/ in order to start the + reconfiguration process. + nxwm This is a special configuration setup for the NxWM window manager diff --git a/nuttx/configs/zp214xpa/README.txt b/nuttx/configs/zp214xpa/README.txt index 6fd7bfba9d..9f577b98d5 100644 --- a/nuttx/configs/zp214xpa/README.txt +++ b/nuttx/configs/zp214xpa/README.txt @@ -9,114 +9,294 @@ Contents o MCU Connections o Serial Console + o Using OpenOCD and GDB with an FT2232 JTAG emulator o Configurations MCU Connections: ================ -Module Socket: --------------- -PIN NAME PIN NAME - 1 VBAT 56 VCC - 2 3V3 55 Vusb - 3 VREF 54 3V3 - 4 P0.0 53 RESET - 5 P0.1 52 P1.31 - 6 P0.2 51 P1.30 - 7 P0.3 50 P1.29 - 8 P0.4 49 P1.28 - 9 P0.5 48 P1.27 -10 P0.6 47 P1.26 -11 P0.7 46 P1.25 -12 P0.8 45 P1.24 -13 P0.9 44 P1.23 -14 P0.10 43 P1.22 -15 P0.11 42 P1.21 -16 P0.12 41 P1.20 -17 P0.13 40 P1.19 -18 P0.14 39 P1.18 -19 P0.15 38 P1.17 -20 P0.16 37 P1.16 -21 P0.17 36 P0.31 -22 P0.18 35 P0.30 -23 P0.19 34 P0.29 -24 P0.20 33 P0.28 -25 P0.21 32 P0.27 -26 P0.22 31 P0.26 -27 P0.23 30 P0.25 -28 GND 29 GND +The ZP213X/4XPA board is no more than an LPC2148, crystals, +USB device and several connectors. -JTAG Debug: ------------ -PIN NAME PIN NAME - 1 VCC1 2 3V3 - 3 P1.31 NTRST 4 GND - 5 P1.28 TDI 6 GND - 7 P1.30 TMS 8 GND - 9 P1.29 TCK 10 GND -11 P1.26 RTCK 12 GND -13 P1.27 TDO 14 GND -15 RESET NRTS 16 GND -17 N/C NC0 18 GND -19 N/C NC1 20 GND + Module Socket: + -------------- + PIN NAME PIN NAME + 1 VBAT 56 VCC + 2 3V3 55 Vusb + 3 VREF 54 3V3 + 4 P0.0 53 RESET + 5 P0.1 52 P1.31 + 6 P0.2 51 P1.30 + 7 P0.3 50 P1.29 + 8 P0.4 49 P1.28 + 9 P0.5 48 P1.27 + 10 P0.6 47 P1.26 + 11 P0.7 46 P1.25 + 12 P0.8 45 P1.24 + 13 P0.9 44 P1.23 + 14 P0.10 43 P1.22 + 15 P0.11 42 P1.21 + 16 P0.12 41 P1.20 + 17 P0.13 40 P1.19 + 18 P0.14 39 P1.18 + 19 P0.15 38 P1.17 + 20 P0.16 37 P1.16 + 21 P0.17 36 P0.31 + 22 P0.18 35 P0.30 + 23 P0.19 34 P0.29 + 24 P0.20 33 P0.28 + 25 P0.21 32 P0.27 + 26 P0.22 31 P0.26 + 27 P0.23 30 P0.25 + 28 GND 29 GND -Z28160 Net Module: ------------------- -PIN NAME PIN NAME - 1 P0.7 /CS 10 3V3 VCC - 2 P0.4 SCK 9 P1.24 RST - 3 P0.6 SI 8 N/C CLKOUT - 4 P0.5 SO 7 INT P1.25 - 5 GND 6 N/C WOL + JTAG Debug: + ----------- + PIN NAME PIN NAME + 1 VCC1 2 3V3 + 3 P1.31 NTRST 4 GND + 5 P1.28 TDI 6 GND + 7 P1.30 TMS 8 GND + 9 P1.29 TCK 10 GND + 11 P1.26 RTCK 12 GND + 13 P1.27 TDO 14 GND + 15 RESET NRTS 16 GND + 17 N/C NC0 18 GND + 19 N/C NC1 20 GND -SPI LCD: --------- -PIN NAME - 1 3V3 3V3 - 2 VCC 5V - 3 P0.18 RESET(DO) - 4 P0.19 DI - 5 P0.20 CS - 6 P0.17 SCK - 7 P0.23 A0(RESET) - 8 N/C LED- - 9 N/C LED+(BL) -10 GND GND + Z28160 Net Module: + ------------------ + PIN NAME PIN NAME + 1 P0.7 /CS 10 3V3 VCC + 2 P0.4 SCK 9 P1.24 RST + 3 P0.6 SI 8 N/C CLKOUT + 4 P0.5 SO 7 INT P1.25 + 5 GND 6 N/C WOL -USB Interface: --------------- -Vusb, P0.26, P0.27 + SPI LCD: + -------- + PIN NAME + 1 3V3 3V3 + 2 VCC 5V + 3 P0.18 RESET(DO) + 4 P0.19 DI + 5 P0.20 CS + 6 P0.17 SCK + 7 P0.23 A0(RESET) + 8 N/C LED- + 9 N/C LED+(BL) + 10 GND GND + + USB Interface: + -------------- + Vusb, P0.26, P0.27 Serial Console: =============== -Both UART0 and UART1 are always enabled. UART0 is configured to be the -serial console in these configurations. + Both UART0 and UART1 are always enabled. UART0 is configured to be the + serial console in these configurations. -P0.0/TXD0/PWM1 Module Socket, Pin 4 -P0.1/RxD0/PWM3/EINT0 Module Socket, Pin 5 + P0.0/TXD0/PWM1 Module Socket, Pin 4 + P0.1/RxD0/PWM3/EINT0 Module Socket, Pin 5 -P0.8/TXD1/PWM4/AD1.1 Module Socket, Pin 12 -P0.9/RxD1/PWM6/EINT3 Module Socket, Pin 13 + P0.8/TXD1/PWM4/AD1.1 Module Socket, Pin 12 + P0.9/RxD1/PWM6/EINT3 Module Socket, Pin 13 + +LCD Interface +============= + + PIN NAME PIN CONFIGURATION + 3 RESET P0.18/CAP1.3/MISO1/MAT1.3P0.18 RESET - General purpose output + 4 DI P0.19/MAT1.2/MOSI1/CAP1.2P0.19 DI - Alternate function 2 + 5 CS P0.20/MAT1.3/SSEL1/EINT3 - General purpose output + 6 SCK P0.17/CAP1.2/SCK1/MAT1.2 - Alternate function 2 + 7 A0 P0.23/VBUS - General purpose output + +ENC29J60 Interface +================== + + PIN NAME PIN CONFIGURATION + 1 /CS P0.7/SSEL0/PWM2/EINT2 - General purpose output + 2 SCK P0.4/SCK0/CAP0.1/AD0.6 - Alternate function 1 + 3 SI P0.6/MOSI0/CAP0.2/AD1.0 - Alternate function 1 + 4 SO P0.5/MISO0/MAT0.1/AD0.7 - Alternate function 1 + 7 INT P1.25/EXTIN0 - Alternal function 1 + 9 RST P1.24/TRACECLK - General purpose output + +Using OpenOCD and GDB with an FT2232 JTAG emulator +================================================== + + Downloading OpenOCD + + You can get information about OpenOCD here: http://openocd.berlios.de/web/ + and you can download it from here. http://sourceforge.net/projects/openocd/files/. + To get the latest OpenOCD with more mature lpc214x, you have to download + from the GIT archive. + + git clone git://openocd.git.sourceforge.net/gitroot/openocd/openocd + + At present, there is only the older, frozen 0.4.0 version. These, of course, + may have changed since I wrote this. + + Building OpenOCD under Cygwin: + + You can build OpenOCD for Windows using the Cygwin tools. Below are a + few notes that worked as of November 7, 2010. Things may have changed + by the time you read this, but perhaps the following will be helpful to + you: + + 1. Install Cygwin (http://www.cygwin.com/). My recommendation is to install + everything. There are many tools you will need and it is best just to + waste a little disk space and have everthing you need. Everything will + require a couple of gigbytes of disk space. + + 2. Create a directory /home/OpenOCD. + + 3. Get the FT2232 drivr from http://www.ftdichip.com/Drivers/D2XX.htm and + extract it into /home/OpenOCD/ftd2xx + + $ pwd + /home/OpenOCD + $ ls + CDM20802 WHQL Certified.zip + $ mkdir ftd2xx + $ cd ftd2xx + $ unzip ..CDM20802\ WHQL\ Certified.zip + Archive: CDM20802 WHQL Certified.zip + ... + + 3. Get the latest OpenOCD source + + $ pwd + /home/OpenOCD + $ git clone git://openocd.git.sourceforge.net/gitroot/openocd/openocd + + You will then have the source code in /home/OpenOCD/openocd + + 4. Build OpenOCD for the FT22322 interface + + $ pwd + /home/OpenOCD/openocd + $ ./bootstrap + + Jim is a tiny version of the Tcl scripting language. It is needed + by more recent versions of OpenOCD. Build libjim.a using the following + instructions: + + $ git submodule init + $ git submodule update + $ cd jimtcl + $ ./configure --with-jim-ext=nvp + $ make + $ make install + + Configure OpenOCD: + + $ ./configure --enable-maintainer-mode --disable-werror --disable-shared \ + --enable-ft2232_ftd2xx --with-ftd2xx-win32-zipdir=/home/OpenOCD/ftd2xx \ + LDFLAGS="-L/home/OpenOCD/openocd/jimtcl" + + Then build OpenOCD and its HTML documentation: + + $ make + $ make html + + The result of the first make will be the "openocd.exe" will be + created in the folder /home/openocd/src. The following command + will install OpenOCD to a standard location (/usr/local/bin) + using using this command: + + $ make install + + Helper Scripts. + + I have been using the Olimex ARM-USB-OCD JTAG debugger with the + ZP213X/4XPA. OpenOCD requires a configuration file. I keep the + one I used last here: + + configs/zpa214xpa/tools/olimex.cfg + + However, the "correct" configuration script to use with OpenOCD may + change as the features of OpenOCD evolve. So you should at least + compare that olimex.cfg file with configuration files in + /usr/local/share/openocd/scripts/target (or /home/OpenOCD/openocd/tcl/target). + + There is also a script on the tools/ directory that I use to start + the OpenOCD daemon on my system called oocd.sh. That script will + probably require some modifications to work in another environment: + + - Possibly the value of OPENOCD_PATH and TARGET_PATH + - It assumes that the correct script to use is the one at + configs/zp214xpa/tools/olimex.cfg + + Starting OpenOCD + + Then you should be able to start the OpenOCD daemon like: + + configs/zp214xpa/tools/oocd.sh $PWD + + If you use the setenv.sh file, that the path to oocd.sh will be added + to your PATH environment variabl. So, in that case, the command simplifies + to just: + + oocd.sh $PWD + + Where it is assumed that you are executing oocd.sh from the top-level + directory where NuttX is installed. $PWD will be the path to the + top-level NuttX directory. + + Connecting GDB + + Once the OpenOCD daemon has been started, you can connect to it via + GDB using the following GDB command: + + arm-nuttx-elf-gdb + (gdb) target remote localhost:3333 + + NOTE: The name of your GDB program may differ. For example, with the + CodeSourcery toolchain, the ARM GDB would be called arm-none-eabi-gdb. + + After starting GDB, you can load the NuttX ELF file: + + (gdb) symbol-file nuttx + (gdb) load nuttx + + NOTES: + 1. Loading the symbol-file is only useful if you have built NuttX to + include debug symbols (by setting CONFIG_DEBUG_SYMBOLS=y in the + .config file). + + OpenOCD will support several special 'monitor' commands. These + GDB commands will send comments to the OpenOCD monitor. Here + are a couple that you will need to use: + + (gdb) monitor reset + (gdb) monitor halt + + NOTES: + 1. The MCU must be halted using 'mon halt' prior to loading code. + 2. Reset will restart the processor after loading code. + 3. The 'monitor' command can be abbreviated as just 'mon'. Configurations: =============== -Each NXP LPC214x configuration is maintained in a sudirectory and -can be selected as follow: + Each NXP LPC214x configuration is maintained in a sudirectory and + can be selected as follow: cd tools ./configure.sh zp214xpa/ cd - . ./setenv.sh -Where is one of the following: + Where is one of the following: -nsh: ----- + nsh: + ---- - Configures the NuttShell (nsh) located at examples/nsh. The - Configuration enables only the serial NSH interfaces. + Configures the NuttShell (nsh) located at examples/nsh. The + Configuration enables only the serial NSH interfaces. NOTES: @@ -131,6 +311,30 @@ nsh: 2. Default platform/toolchain: - CONFIG_HOST_LINUX=y : Windows + CONFIG_HOST_LINUX=y : Linux (Cygwin under Windows okay too). + CONFIG_ARM_TOOLCHAIN_GNU_EABI=y : Buildroot (arm-nuttx-elf-gcc) + CONFIG_RAW_BINARY=y : Output formats: ELF and raw binary + + nxlines: + -------- + + This is the apps/examples/nxlines test using the UG_2864AMBAG01 board + from The0.net that plugs into the "SPI LCD" connector on the ZP3X4XPA + board. + + NOTES: + + 1. This configuration uses the mconf-based configuration tool. To + change this configuration using that tool, you should: + + a. Build and install the mconf tool. See nuttx/README.txt and + misc/tools/ + + b. Execute 'make menuconfig' in nuttx/ in order to start the + reconfiguration process. + + 2. Default platform/toolchain: + + CONFIG_HOST_LINUX=y : Linux (Cygwin under Windows okay too). CONFIG_ARM_TOOLCHAIN_GNU_EABI=y : Buildroot (arm-nuttx-elf-gcc) CONFIG_RAW_BINARY=y : Output formats: ELF and raw binary diff --git a/nuttx/configs/zp214xpa/nxlines/Make.defs b/nuttx/configs/zp214xpa/nxlines/Make.defs new file mode 100644 index 0000000000..274eb8d72d --- /dev/null +++ b/nuttx/configs/zp214xpa/nxlines/Make.defs @@ -0,0 +1,128 @@ +############################################################################## +# configs/zp214xpa/nxlines/Make.defs +# +# Copyright (C) 2012 Gregory Nutt. All rights reserved. +# Author: Gregory Nutt +# +# 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 +include ${TOPDIR}/tools/Config.mk + +# The default value for CROSSDEV can be overridden from the make command line: +# make -- Will build for the NuttX buildroot toolchain +# make CROSSDEV=arm-eabi- -- Will build for the devkitARM toolchain +# make CROSSDEV=arm-none-eabi- -- Will build for the CodeSourcery toolchain +# make CROSSDEV=arm-nuttx-elf- -- Will build for the NuttX buildroot toolchain + +CROSSDEV = arm-nuttx-elf- +CC = $(CROSSDEV)gcc +CXX = $(CROSSDEV)g++ +CPP = $(CROSSDEV)gcc -E +LD = $(CROSSDEV)ld +AR = $(CROSSDEV)ar rcs +NM = $(CROSSDEV)nm +OBJCOPY = $(CROSSDEV)objcopy +OBJDUMP = $(CROSSDEV)objdump + +HOSTOS = ${shell uname -o 2>/dev/null || echo "Other"} + +ARCHCCVERSION = ${shell $(CC) -v 2>&1 | sed -n '/^gcc version/p' | sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q'} +ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1} + +ifeq ($(ARCHCCMAJOR),4) +ifneq ($(HOSTOS),Cygwin) +OBJCOPYARGS = -R .note -R .note.gnu.build-id -R .comment +endif +endif + +ifeq ($(CROSSDEV),arm-nuttx-elf-) + MKDEP = $(TOPDIR)/tools/mkdeps.sh + ARCHINCLUDES = -I. -isystem $(TOPDIR)/include + ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx + ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/scripts/ld.script + MAXOPTIMIZATION = -Os +else + WINTOOL = y + DIRLINK = $(TOPDIR)/tools/copydir.sh + DIRUNLINK = $(TOPDIR)/tools/unlink.sh + MKDEP = $(TOPDIR)/tools/mknulldeps.sh + ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" + ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}" + ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/scripts/ld.script}" + MAXOPTIMIZATION = -O2 +endif + +ifeq ($(CONFIG_DEBUG_SYMBOLS),y) + ARCHOPTIMIZATION = -g +else + ARCHOPTIMIZATION = $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer +endif + +ifeq ($(ARCHCCMAJOR),4) + ARCHCPUFLAGS = -mcpu=arm7tdmi -mfloat-abi=soft +else + ARCHCPUFLAGS = -mapcs-32 -mcpu=arm7tdmi -msoft-float +endif + +ARCHCFLAGS = -fno-builtin +ARCHCXXFLAGS = -fno-builtin -fno-exceptions +ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10 +ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow +ARCHWARNINGSXX = -Wall -Wshadow +ARCHDEFINES = + +CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe +CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS) +CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) \ + $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe +CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS) +CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) +AFLAGS = $(CFLAGS) -D__ASSEMBLY__ + +NXFLATLDFLAGS1 = -r -d -warn-common +NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat-gotoff.ld -no-check-sections +LDNXFLATFLAGS = -e main -s 2048 + +OBJEXT = .o +LIBEXT = .a +EXEEXT = + +ifneq ($(CROSSDEV),arm-nuttx-elf-) + LDFLAGS += -nostartfiles -nodefaultlibs +endif +ifeq ($(CONFIG_DEBUG_SYMBOLS),y) + LDFLAGS += -g +endif + +HOSTCC = gcc +HOSTINCLUDES = -I. +HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe +HOSTLDFLAGS = diff --git a/nuttx/configs/zp214xpa/nxlines/defconfig b/nuttx/configs/zp214xpa/nxlines/defconfig new file mode 100644 index 0000000000..03a6bf72cd --- /dev/null +++ b/nuttx/configs/zp214xpa/nxlines/defconfig @@ -0,0 +1,606 @@ +# +# Automatically generated file; DO NOT EDIT. +# Nuttx/ Configuration +# +CONFIG_NUTTX_NEWCONFIG=y + +# +# Build Setup +# +# CONFIG_EXPERIMENTAL is not set +CONFIG_HOST_LINUX=y +# CONFIG_HOST_OSX is not set +# CONFIG_HOST_WINDOWS is not set +# CONFIG_HOST_OTHER is not set + +# +# Build Configuration +# +# CONFIG_APPS_DIR="../apps" +# CONFIG_BUILD_2PASS is not set + +# +# Binary Output Formats +# +# CONFIG_RRLOAD_BINARY is not set +# CONFIG_INTELHEX_BINARY is not set +# CONFIG_MOTOROLA_SREC is not set +CONFIG_RAW_BINARY=y + +# +# Customize Header Files +# +# CONFIG_ARCH_STDBOOL_H is not set +# CONFIG_ARCH_MATH_H is not set +# CONFIG_ARCH_FLOAT_H is not set +# CONFIG_ARCH_STDARG_H is not set + +# +# Debug Options +# +# CONFIG_DEBUG is not set +# CONFIG_DEBUG_SYMBOLS is not set + +# +# System Type +# +# CONFIG_ARCH_8051 is not set +CONFIG_ARCH_ARM=y +# CONFIG_ARCH_AVR is not set +# CONFIG_ARCH_HC is not set +# CONFIG_ARCH_MIPS is not set +# CONFIG_ARCH_RGMP is not set +# CONFIG_ARCH_SH is not set +# CONFIG_ARCH_SIM is not set +# CONFIG_ARCH_X86 is not set +# CONFIG_ARCH_Z16 is not set +# CONFIG_ARCH_Z80 is not set +CONFIG_ARCH="arm" + +# +# ARM Options +# +# CONFIG_ARCH_CHIP_C5471 is not set +# CONFIG_ARCH_CHIP_CALYPSO is not set +# CONFIG_ARCH_CHIP_DM320 is not set +# CONFIG_ARCH_CHIP_IMX is not set +# CONFIG_ARCH_CHIP_KINETIS is not set +# CONFIG_ARCH_CHIP_LM3S is not set +# CONFIG_ARCH_CHIP_LPC17XX is not set +CONFIG_ARCH_CHIP_LPC214X=y +# CONFIG_ARCH_CHIP_LPC2378 is not set +# CONFIG_ARCH_CHIP_LPC31XX is not set +# CONFIG_ARCH_CHIP_LPC43XX is not set +# CONFIG_ARCH_CHIP_SAM3U is not set +# CONFIG_ARCH_CHIP_STM32 is not set +# CONFIG_ARCH_CHIP_STR71X is not set +CONFIG_ARCH_ARM7TDMI=y +CONFIG_ARCH_FAMILY="arm" +CONFIG_ARCH_CHIP="lpc214x" +CONFIG_ARCH_HAVE_LOWVECTORS=y +# CONFIG_ARCH_LOWVECTORS is not set +CONFIG_BOARD_LOOPSPERMSEC=3270 +# CONFIG_ARCH_CALIBRATION is not set + +# +# ARM Configuration Options +# +# CONFIG_ARM_TOOLCHAIN_BUILDROOT is not set +# CONFIG_ARM_TOOLCHAIN_CODESOURCERYL is not set +CONFIG_ARM_TOOLCHAIN_GNU_EABI=y + +# +# LPC214x Configuration Options +# +CONFIG_ARCH_CHIP_LPC2148=y + +# +# LPC214x Initialization Options +# +# CONFIG_EXTMEM_MODE is not set +# CONFIG_RAM_MODE is not set +CONFIG_DEFAULT_MODE=y +CONFIG_CODE_BASE=0x00000000 +CONFIG_PLL_SETUP=y +CONFIG_MAM_SETUP=y +CONFIG_APBDIV_SETUP=y +CONFIG_APBDIV_VALUE=1 +# CONFIG_EMC_SETUP is not set +# CONFIG_BCFG0_SETUP is not set +# CONFIG_BCFG1_SETUP is not set +# CONFIG_BCFG2_SETUP is not set +# CONFIG_BCFG3_SETUP is not set +CONFIG_ADC_SETUP=y + +# +# LPC214x Peripheral Support +# +CONFIG_LPC214X_UART0=y +CONFIG_LPC214X_UART1=y +# CONFIG_LPC214x_FIO is not set + +# +# Architecture Options +# +# CONFIG_ARCH_NOINTC is not set +# CONFIG_ARCH_DMA is not set +# CONFIG_ARCH_IRQPRIO is not set +# CONFIG_CUSTOM_STACK is not set +# CONFIG_ADDRENV is not set +CONFIG_ARCH_STACKDUMP=y +# CONFIG_ENDIAN_BIG is not set + +# +# Board Settings +# +CONFIG_DRAM_START=0x40000000 +CONFIG_DRAM_SIZE=32768 +CONFIG_ARCH_HAVE_INTERRUPTSTACK=y +CONFIG_ARCH_INTERRUPTSTACK=0 + +# +# Boot options +# +# CONFIG_BOOT_RUNFROMEXTSRAM is not set +CONFIG_BOOT_RUNFROMFLASH=y +# CONFIG_BOOT_RUNFROMISRAM is not set +# CONFIG_BOOT_RUNFROMSDRAM is not set +# CONFIG_BOOT_COPYTORAM is not set + +# +# Board Selection +# +# CONFIG_ARCH_BOARD_MCU123 is not set +CONFIG_ARCH_BOARD_ZP214XPA=y +# CONFIG_ARCH_BOARD_CUSTOM is not set +CONFIG_ARCH_BOARD="zp214xpa" + +# +# Common Board Options +# + +# +# Board-Specific Options +# + +# +# RTOS Features +# +CONFIG_MSEC_PER_TICK=10 +CONFIG_RR_INTERVAL=0 +# CONFIG_SCHED_INSTRUMENTATION is not set +CONFIG_TASK_NAME_SIZE=0 +# CONFIG_JULIAN_TIME is not set +CONFIG_START_YEAR=2008 +CONFIG_START_MONTH=10 +CONFIG_START_DAY=1 +CONFIG_DEV_CONSOLE=y +# CONFIG_MUTEX_TYPES is not set +# CONFIG_PRIORITY_INHERITANCE is not set +# CONFIG_FDCLONE_DISABLE is not set +# CONFIG_FDCLONE_STDIO is not set +CONFIG_SDCLONE_DISABLE=y +# CONFIG_SCHED_WORKQUEUE is not set +# CONFIG_SCHED_WAITPID is not set +# CONFIG_SCHED_ATEXIT is not set +# CONFIG_SCHED_ONEXIT is not set +CONFIG_USER_ENTRYPOINT="nxlines_main" +CONFIG_DISABLE_OS_API=y +# CONFIG_DISABLE_CLOCK is not set +# CONFIG_DISABLE_POSIX_TIMERS is not set +# CONFIG_DISABLE_PTHREAD is not set +# CONFIG_DISABLE_SIGNALS is not set +# CONFIG_DISABLE_MQUEUE is not set +# CONFIG_DISABLE_MOUNTPOINT is not set +# CONFIG_DISABLE_ENVIRON is not set +CONFIG_DISABLE_POLL=y + +# +# Sizes of configurable things (0 disables) +# +CONFIG_MAX_TASKS=16 +CONFIG_MAX_TASK_ARGS=4 +CONFIG_NPTHREAD_KEYS=4 +CONFIG_NFILE_DESCRIPTORS=8 +CONFIG_NFILE_STREAMS=8 +CONFIG_NAME_MAX=32 +CONFIG_PREALLOC_MQ_MSGS=4 +CONFIG_MQ_MAXMSGSIZE=32 +CONFIG_MAX_WDOGPARMS=2 +CONFIG_PREALLOC_WDOGS=4 +CONFIG_PREALLOC_TIMERS=4 + +# +# Stack and heap information +# +CONFIG_IDLETHREAD_STACKSIZE=2048 +CONFIG_USERMAIN_STACKSIZE=2048 +CONFIG_PTHREAD_STACK_MIN=256 +CONFIG_PTHREAD_STACK_DEFAULT=2048 + +# +# Device Drivers +# +CONFIG_DEV_NULL=y +# CONFIG_DEV_ZERO is not set +# CONFIG_LOOP is not set +# CONFIG_RAMDISK is not set +# CONFIG_CAN is not set +# CONFIG_PWM is not set +# CONFIG_I2C is not set +CONFIG_SPI=y +# CONFIG_SPI_OWNBUS is not set +# CONFIG_SPI_EXCHANGE is not set +CONFIG_SPI_CMDDATA=y +# CONFIG_RTC is not set +# CONFIG_WATCHDOG is not set +# CONFIG_ANALOG is not set +# CONFIG_BCH is not set +# CONFIG_INPUT is not set +CONFIG_LCD=y +# CONFIG_LCD_NOGETRUN is not set +CONFIG_LCD_MAXCONTRAST=255 +CONFIG_LCD_MAXPOWER=1 +# CONFIG_LCD_P14201 is not set +# CONFIG_LCD_NOKIA6100 is not set +# CONFIG_LCD_UG9664HSWAG01 is not set +CONFIG_LCD_UG2864AMBAG01=y +CONFIG_UG2864AMBAG01_SPIMODE=3 +CONFIG_UG2864AMBAG01_FREQUENCY=3500000 +CONFIG_UG2864AMBAG01_NINTERFACES=1 +# CONFIG_LCD_SSD1289 is not set +CONFIG_LCD_LANDSCAPE=y +# CONFIG_LCD_PORTRAIT is not set +# CONFIG_LCD_RPORTRAIT is not set +# CONFIG_LCD_RLANDSCAPE is not set +# CONFIG_MMCSD is not set +# CONFIG_MTD is not set +# CONFIG_PIPES is not set +# CONFIG_PM is not set +# CONFIG_POWER is not set +# CONFIG_SENSORS is not set +# CONFIG_SERCOMM_CONSOLE is not set +CONFIG_SERIAL=y +CONFIG_DEV_LOWCONSOLE=y +# CONFIG_16550_UART is not set +CONFIG_ARCH_HAVE_UART0=y +CONFIG_ARCH_HAVE_UART1=y +CONFIG_MCU_SERIAL=y +CONFIG_UART0_SERIAL_CONSOLE=y +# CONFIG_UART1_SERIAL_CONSOLE is not set +# CONFIG_NO_SERIAL_CONSOLE is not set + +# +# UART0 Configuration +# +CONFIG_UART0_RXBUFSIZE=256 +CONFIG_UART0_TXBUFSIZE=256 +CONFIG_UART0_BAUD=38400 +CONFIG_UART0_BITS=8 +CONFIG_UART0_PARITY=0 +CONFIG_UART0_2STOP=0 + +# +# UART1 Configuration +# +CONFIG_UART1_RXBUFSIZE=256 +CONFIG_UART1_TXBUFSIZE=256 +CONFIG_UART1_BAUD=38400 +CONFIG_UART1_BITS=8 +CONFIG_UART1_PARITY=0 +CONFIG_UART1_2STOP=0 +# CONFIG_USBDEV is not set +# CONFIG_USBHOST is not set +# CONFIG_WIRELESS is not set + +# +# System Logging Device Options +# + +# +# System Logging +# +# CONFIG_RAMLOG is not set + +# +# Networking Support +# +# CONFIG_NET is not set + +# +# File Systems +# + +# +# File system configuration +# +# CONFIG_FS_FAT is not set +# CONFIG_FS_RAMMAP is not set +# CONFIG_FS_NXFFS is not set +# CONFIG_FS_ROMFS is not set + +# +# System Logging +# +# CONFIG_SYSLOG is not set + +# +# Graphics Support +# +CONFIG_NX=y +CONFIG_NX_LCDDRIVER=y +CONFIG_NX_NPLANES=1 +CONFIG_NX_WRITEONLY=y + +# +# Supported Pixel Depths +# +# CONFIG_NX_DISABLE_1BPP is not set +CONFIG_NX_DISABLE_2BPP=y +CONFIG_NX_DISABLE_4BPP=y +CONFIG_NX_DISABLE_8BPP=y +CONFIG_NX_DISABLE_16BPP=y +CONFIG_NX_DISABLE_24BPP=y +CONFIG_NX_DISABLE_32BPP=y +CONFIG_NX_PACKEDMSFIRST=y + +# +# Input Devices +# +# CONFIG_NX_MOUSE is not set +# CONFIG_NX_KBD is not set + +# +# Framed Window Borders +# +CONFIG_NXTK_BORDERWIDTH=2 +CONFIG_NXTK_BORDERCOLOR1=0x01 +CONFIG_NXTK_BORDERCOLOR2=0x01 +CONFIG_NXTK_BORDERCOLOR3=0x01 +# CONFIG_NXTK_AUTORAISE is not set + +# +# Font Selections +# +CONFIG_NXFONTS_CHARBITS=7 +CONFIG_NXFONT_MONO5X8=y +# CONFIG_NXFONT_SANS17X22 is not set +# CONFIG_NXFONT_SANS20X26 is not set +# CONFIG_NXFONT_SANS23X27 is not set +# CONFIG_NXFONT_SANS22X29 is not set +# CONFIG_NXFONT_SANS28X37 is not set +# CONFIG_NXFONT_SANS39X48 is not set +# CONFIG_NXFONT_SANS17X23B is not set +# CONFIG_NXFONT_SANS20X27B is not set +# CONFIG_NXFONT_SANS22X29B is not set +# CONFIG_NXFONT_SANS28X37B is not set +# CONFIG_NXFONT_SANS40X49B is not set +# CONFIG_NXFONT_SERIF22X29 is not set +# CONFIG_NXFONT_SERIF29X37 is not set +# CONFIG_NXFONT_SERIF38X48 is not set +# CONFIG_NXFONT_SERIF22X28B is not set +# CONFIG_NXFONT_SERIF27X38B is not set +# CONFIG_NXFONT_SERIF38X49B is not set +# CONFIG_NXCONSOLE is not set + +# +# NX Multi-user only options +# +# CONFIG_NX_MULTIUSER is not set + +# +# Memory Management +# +# CONFIG_MM_SMALL is not set +CONFIG_MM_REGIONS=1 +# CONFIG_GRAN is not set + +# +# Binary Formats +# +# CONFIG_BINFMT_DISABLE is not set +# CONFIG_BINFMT_EXEPATH is not set +# CONFIG_NXFLAT is not set +# CONFIG_ELF is not set +# CONFIG_PIC is not set +# CONFIG_SYMTAB_ORDEREDBYNAME is not set + +# +# Library Routines +# + +# +# Standard C Library Options +# +CONFIG_STDIO_BUFFER_SIZE=256 +CONFIG_STDIO_LINEBUFFER=y +CONFIG_NUNGET_CHARS=2 +CONFIG_LIB_HOMEDIR="/" +# CONFIG_LIBM is not set +# CONFIG_NOPRINTF_FIELDWIDTH is not set +# CONFIG_LIBC_FLOATINGPOINT is not set +# CONFIG_EOL_IS_CR is not set +# CONFIG_EOL_IS_LF is not set +# CONFIG_EOL_IS_BOTH_CRLF is not set +CONFIG_EOL_IS_EITHER_CRLF=y +# CONFIG_LIBC_STRERROR is not set +# CONFIG_LIBC_PERROR_STDOUT is not set +CONFIG_ARCH_LOWPUTC=y +CONFIG_LIB_SENDFILE_BUFSIZE=512 +# CONFIG_ARCH_ROMGETC is not set +# CONFIG_ARCH_OPTIMIZED_FUNCTIONS is not set + +# +# Non-standard Helper Functions +# +CONFIG_LIB_KBDCODEC=y + +# +# Basic CXX Support +# +# CONFIG_C99_BOOL8 is not set +# CONFIG_HAVE_CXX is not set + +# +# Application Configuration +# + +# +# Built-In Applications +# +# CONFIG_BUILTIN is not set + +# +# Examples +# +# CONFIG_EXAMPLES_BUTTONS is not set +# CONFIG_EXAMPLES_CAN is not set +# CONFIG_EXAMPLES_CDCACM is not set +# CONFIG_EXAMPLES_COMPOSITE is not set +# CONFIG_EXAMPLES_DHCPD is not set +# CONFIG_EXAMPLES_ELF is not set +# CONFIG_EXAMPLES_FTPC is not set +# CONFIG_EXAMPLES_FTPD is not set +# CONFIG_EXAMPLES_HELLO is not set +# CONFIG_EXAMPLES_HELLOXX is not set +# CONFIG_EXAMPLES_JSON is not set +# CONFIG_EXAMPLES_HIDKBD is not set +# CONFIG_EXAMPLES_KEYPADTEST is not set +# CONFIG_EXAMPLES_IGMP is not set +# CONFIG_EXAMPLES_LCDRW is not set +# CONFIG_EXAMPLES_MM is not set +# CONFIG_EXAMPLES_MOUNT is not set +# CONFIG_EXAMPLES_MODBUS is not set +# CONFIG_EXAMPLES_NETTEST is not set +# CONFIG_EXAMPLES_NSH is not set +# CONFIG_EXAMPLES_NULL is not set +# CONFIG_EXAMPLES_NX is not set +# CONFIG_EXAMPLES_NXCONSOLE is not set +# CONFIG_EXAMPLES_NXFFS is not set +# CONFIG_EXAMPLES_NXFLAT is not set +# CONFIG_EXAMPLES_NXHELLO is not set +# CONFIG_EXAMPLES_NXIMAGE is not set +CONFIG_EXAMPLES_NXLINES=y +CONFIG_EXAMPLES_NXLINES_VPLANE=0 +CONFIG_EXAMPLES_NXLINES_DEVNO=0 +CONFIG_EXAMPLES_NXLINES_BGCOLOR=0x00 +CONFIG_EXAMPLES_NXLINES_LINEWIDTH=4 +CONFIG_EXAMPLES_NXLINES_LINECOLOR=0x01 +CONFIG_EXAMPLES_NXLINES_BORDERWIDTH=4 +CONFIG_EXAMPLES_NXLINES_BORDERCOLOR=0x01 +CONFIG_EXAMPLES_NXLINES_CIRCLECOLOR=0x00 +CONFIG_EXAMPLES_NXLINES_BPP=1 +CONFIG_EXAMPLES_NXLINES_EXTERNINIT=y +# CONFIG_EXAMPLES_NXTEXT is not set +# CONFIG_EXAMPLES_OSTEST is not set +# CONFIG_EXAMPLES_PASHELLO is not set +# CONFIG_EXAMPLES_PIPE is not set +# CONFIG_EXAMPLES_POLL is not set +# CONFIG_EXAMPLES_QENCODER is not set +# CONFIG_EXAMPLES_RGMP is not set +# CONFIG_EXAMPLES_ROMFS is not set +# CONFIG_EXAMPLES_SENDMAIL is not set +# CONFIG_EXAMPLES_SERLOOP is not set +# CONFIG_EXAMPLES_TELNETD is not set +# CONFIG_EXAMPLES_THTTPD is not set +# CONFIG_EXAMPLES_TIFF is not set +# CONFIG_EXAMPLES_TOUCHSCREEN is not set +# CONFIG_EXAMPLES_UDP is not set +# CONFIG_EXAMPLES_UIP is not set +# CONFIG_EXAMPLES_USBSERIAL is not set +# CONFIG_EXAMPLES_USBMSC is not set +# CONFIG_EXAMPLES_USBTERM is not set +# CONFIG_EXAMPLES_WATCHDOG is not set +# CONFIG_EXAMPLES_WLAN is not set + +# +# Interpreters +# + +# +# Interpreters +# +# CONFIG_INTERPRETERS_FICL is not set +# CONFIG_INTERPRETERS_PCODE is not set + +# +# Network Utilities +# + +# +# Networking Utilities +# +# CONFIG_NETUTILS_CODECS is not set +# CONFIG_NETUTILS_DHCPC is not set +# CONFIG_NETUTILS_DHCPD is not set +# CONFIG_NETUTILS_FTPC is not set +# CONFIG_NETUTILS_FTPD is not set +# CONFIG_NETUTILS_JSON is not set +# CONFIG_NETUTILS_RESOLV is not set +# CONFIG_NETUTILS_SMTP is not set +# CONFIG_NETUTILS_TELNETD is not set +# CONFIG_NETUTILS_TFTPC is not set +# CONFIG_NETUTILS_THTTPD is not set +# CONFIG_NETUTILS_UIPLIB is not set +# CONFIG_NETUTILS_WEBCLIENT is not set + +# +# ModBus +# + +# +# FreeModbus +# +# CONFIG_MODBUS is not set + +# +# NSH Library +# +# CONFIG_NSH_LIBRARY is not set + +# +# NxWidgets/NxWM +# + +# +# System NSH Add-Ons +# + +# +# Custom Free Memory Command +# +# CONFIG_SYSTEM_FREE is not set + +# +# I2C tool +# + +# +# FLASH Program Installation +# +# CONFIG_SYSTEM_INSTALL is not set + +# +# readline() +# +# CONFIG_SYSTEM_READLINE is not set + +# +# Power Off +# +# CONFIG_SYSTEM_POWEROFF is not set + +# +# RAMTRON +# +# CONFIG_SYSTEM_RAMTRON is not set + +# +# SD Card +# +# CONFIG_SYSTEM_SDCARD is not set + +# +# Sysinfo +# +# CONFIG_SYSTEM_SYSINFO is not set diff --git a/nuttx/configs/zp214xpa/nxlines/setenv.sh b/nuttx/configs/zp214xpa/nxlines/setenv.sh new file mode 100755 index 0000000000..77f1425e58 --- /dev/null +++ b/nuttx/configs/zp214xpa/nxlines/setenv.sh @@ -0,0 +1,65 @@ +#!/bin/bash +# configs/zp214xpa/nxlines/setenv.sh +# +# Copyright (C) 2012 Gregory Nutt. All rights reserved. +# Author: Gregory Nutt +# +# 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. +# + +if [ "$_" = "$0" ] ; then + echo "You must source this script, not run it!" 1>&2 + exit 1 +fi + +WD=`pwd` +if [ ! -x "setenv.sh" ]; then + echo "This script must be executed from the top-level NuttX build directory" + exit 1 +fi + +if [ -z "${PATH_ORIG}" ]; then + export PATH_ORIG="${PATH}" +fi + +# This is the Cygwin path to the location where I installed the CodeSourcery +# toolchain under windows. You will also have to edit this if you install +# the CodeSourcery toolchain in any other location +# export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/CodeSourcery/Sourcery G++ Lite/bin" + +# This is the Cygwin path to the location where I build the buildroot +# toolchain. +export TOOLCHAIN_BIN="${WD}/../misc/buildroot/build_arm_nofpu/staging_dir/bin" + +# The zp214xpa/tools directory +export LPCTOOL_DIR="${WD}/configs/zp214xpa/tools" + +# Add the path to the toolchain and tools directory to the PATH varialble +export PATH="${TOOLCHAIN_BIN}:${LPCTOOL_DIR}:/sbin:/usr/sbin:${PATH_ORIG}" + +echo "PATH : ${PATH}" diff --git a/nuttx/configs/zp214xpa/src/Makefile b/nuttx/configs/zp214xpa/src/Makefile index 8f1e1c05d9..571b43b078 100644 --- a/nuttx/configs/zp214xpa/src/Makefile +++ b/nuttx/configs/zp214xpa/src/Makefile @@ -49,6 +49,10 @@ ASRCS = AOBJS = $(ASRCS:.S=$(OBJEXT)) CSRCS = +ifeq ($(CONFIG_LCD_UG2864AMBAG01),y) +CSRCS += up_ug2864ambag01.c up_spi1.c +endif + COBJS = $(CSRCS:.c=$(OBJEXT)) SRCS = $(ASRCS) $(CSRCS) diff --git a/nuttx/configs/zp214xpa/src/up_spi1.c b/nuttx/configs/zp214xpa/src/up_spi1.c new file mode 100644 index 0000000000..563d63589c --- /dev/null +++ b/nuttx/configs/zp214xpa/src/up_spi1.c @@ -0,0 +1,644 @@ +/**************************************************************************** + * config/zp214xpa/src/up_spi1.c + * arch/arm/src/board/up_spi1.c + * + * Copyright (C) 2008-2010, 2012 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * 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. + * + ****************************************************************************/ + +/**************************************************************************** + * LCD Interface + * + * PIN NAME PIN CONFIGURATION + * 3 RESET P0.18/CAP1.3/MISO1/MAT1.3P0.18 - General purpose output + * 4 DI P0.19/MAT1.2/MOSI1/CAP1.2P0.19 - Alternate function 2 + * 5 CS P0.20/MAT1.3/SSEL1/EINT3 - General purpose output + * 6 SCK P0.17/CAP1.2/SCK1/MAT1.2 - Alternate function 2 + * 7 A0 P0.23/VBUS - General purpose output + * + * ENC29J60 Interface + * + * PIN NAME PIN CONFIGURATION + * 1 /CS P0.7/SSEL0/PWM2/EINT2 - General purpose output + * 2 SCK P0.4/SCK0/CAP0.1/AD0.6 - Alternate function 1 + * 3 SI P0.6/MOSI0/CAP0.2/AD1.0 - Alternate function 1 + * 4 SO P0.5/MISO0/MAT0.1/AD0.7 - Alternate function 1 + * 7 INT P1.25/EXTIN0 - Alternal function 1 + * 9 RST P1.24/TRACECLK + * + * This file provides support only for the LCD interface on SPI1. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include +#include +#include +#include +#include + +#include +#include +#include + +#include "up_internal.h" +#include "up_arch.h" + +#include "chip.h" +#include "lpc214x_power.h" +#include "lpc214x_pinsel.h" +#include "lpc214x_spi.h" + +/**************************************************************************** + * Definitions + ****************************************************************************/ + +/* Enables debug output from this file (needs CONFIG_DEBUG too) */ + +#undef SPI_DEBUG /* Define to enable debug */ +#undef SPI_VERBOSE /* Define to enable verbose debug */ + +#ifdef SPI_DEBUG +# define spidbg lldbg +# ifdef SPI_VERBOSE +# define spivdbg lldbg +# else +# define spivdbg(x...) +# endif +#else +# undef SPI_VERBOSE +# define spidbg(x...) +# define spivdbg(x...) +#endif + +/* Clocking */ + +#define LPC214X_CCLKFREQ (LPC214X_FOSC*LPC214X_PLL_M) +#define LPC214X_PCLKFREQ (LPC214X_CCLKFREQ/LPC214X_APB_DIV) + +/* Use either FIO or legacy GPIO */ + +#ifdef CONFIG_LPC214x_FIO +# define CS_SET_REGISTER (LPC214X_FIO0_BASE+LPC214X_FIO_SET_OFFSET) +# define CS_CLR_REGISTER (LPC214X_FIO0_BASE+LPC214X_FIO_CLR_OFFSET) +# define CS_DIR_REGISTER (LPC214X_FIO0_BASE+LPC214X_FIO_DIR_OFFSET) +#else +# define CS_SET_REGISTER (LPC214X_GPIO0_BASE+LPC214X_GPIO_SET_OFFSET) +# define CS_CLR_REGISTER (LPC214X_GPIO0_BASE+LPC214X_GPIO_CLR_OFFSET) +# define CS_DIR_REGISTER (LPC214X_GPIO0_BASE+LPC214X_GPIO_DIR_OFFSET) +#endif + +/**************************************************************************** + * Private Function Prototypes + ****************************************************************************/ + +#ifndef CONFIG_SPI_OWNBUS +static int spi_lock(FAR struct spi_dev_s *dev, bool lock); +#endif +static void spi_select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected); +static uint32_t spi_setfrequency(FAR struct spi_dev_s *dev, uint32_t frequency); +static uint8_t spi_status(FAR struct spi_dev_s *dev, enum spi_dev_e devid); +#ifdef CONFIG_SPI_CMDDATA +static int spi_cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd); +#endif +static uint16_t spi_send(FAR struct spi_dev_s *dev, uint16_t ch); +static void spi_sndblock(FAR struct spi_dev_s *dev, FAR const void *buffer, size_t nwords); +static void spi_recvblock(FAR struct spi_dev_s *dev, FAR void *buffer, size_t nwords); + +/**************************************************************************** + * Private Data + ****************************************************************************/ + +static const struct spi_ops_s g_spiops = +{ +#ifndef CONFIG_SPI_OWNBUS + .lock = spi_lock, +#endif + .select = spi_select, + .setfrequency = spi_setfrequency, + .status = spi_status, +#ifdef CONFIG_SPI_CMDDATA + .cmddata = spi_cmddata, +#endif + .send = spi_send, + .sndblock = spi_sndblock, + .recvblock = spi_recvblock, + .registercallback = 0, /* Not implemented */ +}; + +static struct spi_dev_s g_spidev = { &g_spiops }; + +/**************************************************************************** + * Public Data + ****************************************************************************/ + +/**************************************************************************** + * Private Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: spi_lock + * + * Description: + * On SPI busses where there are multiple devices, it will be necessary to + * lock SPI to have exclusive access to the busses for a sequence of + * transfers. The bus should be locked before the chip is selected. After + * locking the SPI bus, the caller should then also call the setfrequency, + * setbits, and setmode methods to make sure that the SPI is properly + * configured for the device. If the SPI buss is being shared, then it + * may have been left in an incompatible state. + * + * Input Parameters: + * dev - Device-specific state data + * lock - true: Lock spi bus, false: unlock SPI bus + * + * Returned Value: + * None + * + ****************************************************************************/ + +#ifndef CONFIG_SPI_OWNBUS +static int spi_lock(FAR struct spi_dev_s *dev, bool lock) +{ + /* Not implemented */ + + return -ENOSYS; +} +#endif + +/**************************************************************************** + * Name: spi_select + * + * Description: + * Enable/disable the SPI slave select. The implementation of this method + * must include handshaking: If a device is selected, it must hold off + * all other attempts to select the device until the device is deselecte. + * + * Input Parameters: + * dev - Device-specific state data + * devid - Identifies the device to select + * selected - true: slave selected, false: slave de-selected + * + * Returned Value: + * None + * + ****************************************************************************/ + +static void spi_select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected) +{ + uint32_t bit = 1 << 20; + + /* We do not bother to check if devid == SPIDEV_DISPLAY because that is the + * only thing on the bus. + */ + + if (selected) + { + /* Enable slave select (low enables) */ + + spidbg("CD asserted\n"); + putreg32(bit, CS_CLR_REGISTER); + } + else + { + /* Disable slave select (low enables) */ + + spidbg("CD de-asserted\n"); + putreg32(bit, CS_SET_REGISTER); + + /* Wait for the TX FIFO not full indication */ + + while (!(getreg8(LPC214X_SPI1_SR) & LPC214X_SPI1SR_TNF)); + putreg16(0xff, LPC214X_SPI1_DR); + + /* Wait until TX FIFO and TX shift buffer are empty */ + + while (getreg8(LPC214X_SPI1_SR) & LPC214X_SPI1SR_BSY); + + /* Wait until RX FIFO is not empty */ + + while (!(getreg8(LPC214X_SPI1_SR) & LPC214X_SPI1SR_RNE)); + + /* Then read and discard bytes until the RX FIFO is empty */ + + do + { + (void)getreg16(LPC214X_SPI1_DR); + } + while (getreg8(LPC214X_SPI1_SR) & LPC214X_SPI1SR_RNE); + } +} + +/**************************************************************************** + * Name: spi_setfrequency + * + * Description: + * Set the SPI frequency. + * + * Input Parameters: + * dev - Device-specific state data + * frequency - The SPI frequency requested + * + * Returned Value: + * Returns the actual frequency selected + * + ****************************************************************************/ + +static uint32_t spi_setfrequency(FAR struct spi_dev_s *dev, uint32_t frequency) +{ + uint32_t divisor = LPC214X_PCLKFREQ / frequency; + + if (divisor < 2) + { + divisor = 2; + } + else if (divisor > 254) + { + divisor = 254; + } + + divisor = (divisor + 1) & ~1; + putreg8(divisor, LPC214X_SPI1_CPSR); + + spidbg("Frequency %d->%d\n", frequency, LPC214X_PCLKFREQ / divisor); + return LPC214X_PCLKFREQ / divisor; +} + +/**************************************************************************** + * Name: spi_status + * + * Description: + * Get SPI/MMC status + * + * Input Parameters: + * dev - Device-specific state data + * devid - Identifies the device to report status on + * + * Returned Value: + * Returns a bitset of status values (see SPI_STATUS_* defines + * + ****************************************************************************/ + +static uint8_t spi_status(FAR struct spi_dev_s *dev, enum spi_dev_e devid) +{ + spidbg("Return 0\n"); + return 0; +} + +/**************************************************************************** + * Name: spi_cmddata + * + * Description: + * Some devices require and additional out-of-band bit to specify if the + * next word sent to the device is a command or data. This is typical, for + * example, in "9-bit" displays where the 9th bit is the CMD/DATA bit. + * This function provides selection of command or data. + * + * This "latches" the CMD/DATA state. It does not have to be called before + * every word is transferred; only when the CMD/DATA state changes. This + * method is required if CONFIG_SPI_CMDDATA is selected in the NuttX + * configuration + * + * Input Parameters: + * dev - Device-specific state data + * cmd - TRUE: The following word is a command; FALSE: the following words + * are data. + * + * Returned Value: + * OK unless an error occurs. Then a negated errno value is returned + * + ****************************************************************************/ + +#ifdef CONFIG_SPI_CMDDATA +static int spi_cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd) +{ + uint32_t bit = 1 << 23; + + /* We do not bother to check if devid == SPIDEV_DISPLAY because that is the + * only thing on the bus. + */ + + /* "This is the Data/Command control pad which determines whether the + * data bits are data or a command. + * + * A0 = H: the inputs at D0 to D7 are treated as display data. + * A0 = L: the inputs at D0 to D7 are transferred to the command registers." + */ + + if (cmd) + { + /* L: the inputs at D0 to D7 are transferred to the command registers */ + + spidbg("Command\n"); + putreg32(bit, CS_CLR_REGISTER); + } + else + { + /* H: the inputs at D0 to D7 are treated as display data. */ + + spidbg("CD de-asserted\n"); + putreg32(bit, CS_SET_REGISTER); + } + + return OK; +} +#endif + +/**************************************************************************** + * Name: spi_send + * + * Description: + * Exchange one word on SPI + * + * Input Parameters: + * dev - Device-specific state data + * wd - The word to send. the size of the data is determined by the + * number of bits selected for the SPI interface. + * + * Returned Value: + * response + * + ****************************************************************************/ + +static uint16_t spi_send(FAR struct spi_dev_s *dev, uint16_t wd) +{ + register uint16_t regval; + + /* Wait while the TX FIFO is full */ + + while (!(getreg8(LPC214X_SPI1_SR) & LPC214X_SPI1SR_TNF)); + + /* Write the byte to the TX FIFO */ + + putreg16((uint8_t)wd, LPC214X_SPI1_DR); + + /* Wait for the RX FIFO not empty */ + + while (!(getreg8(LPC214X_SPI1_SR) & LPC214X_SPI1SR_RNE)); + + /* Get the value from the RX FIFO and return it */ + + regval = getreg16(LPC214X_SPI1_DR); + spidbg("%04x->%04x\n", wd, regval); + return regval; +} + +/************************************************************************* + * Name: spi_sndblock + * + * Description: + * Send a block of data on SPI + * + * Input Parameters: + * dev - Device-specific state data + * buffer - A pointer to the buffer of data to be sent + * nwords - the length of data to send from the buffer in number of words. + * The wordsize is determined by the number of bits-per-word + * selected for the SPI interface. If nbits <= 8, the data is + * packed into uint8_t's; if nbits >8, the data is packed into uint16_t's + * + * Returned Value: + * None + * + ****************************************************************************/ + +static void spi_sndblock(FAR struct spi_dev_s *dev, FAR const void *buffer, size_t nwords) +{ + FAR const uint8_t *ptr = (FAR const uint8_t *)buffer; + uint8_t sr; + + /* Loop while thre are bytes remaining to be sent */ + + spidbg("nwords: %d\n", nwords); + while (nwords > 0) + { + /* While the TX FIFO is not full and there are bytes left to send */ + + while ((getreg8(LPC214X_SPI1_SR) & LPC214X_SPI1SR_TNF) && nwords) + { + /* Send the data */ + + putreg16((uint16_t)*ptr, LPC214X_SPI1_DR); + ptr++; + nwords--; + } + } + + /* Then discard all card responses until the RX & TX FIFOs are emptied. */ + + spidbg("discarding\n"); + do + { + /* Is there anything in the RX fifo? */ + + sr = getreg8(LPC214X_SPI1_SR); + if ((sr & LPC214X_SPI1SR_RNE) != 0) + { + /* Yes.. Read and discard */ + + (void)getreg16(LPC214X_SPI1_DR); + } + + /* There is a race condition where TFE may go true just before + * RNE goes true and this loop terminates prematurely. The nasty little + * delay in the following solves that (it could probably be tuned + * to improve performance). + */ + + else if ((sr & LPC214X_SPI1SR_TFE) != 0) + { + up_udelay(100); + sr = getreg8(LPC214X_SPI1_SR); + } + } + while ((sr & LPC214X_SPI1SR_RNE) != 0 || (sr & LPC214X_SPI1SR_TFE) == 0); +} + +/**************************************************************************** + * Name: spi_recvblock + * + * Description: + * Revice a block of data from SPI + * + * Input Parameters: + * dev - Device-specific state data + * buffer - A pointer to the buffer in which to recieve data + * nwords - the length of data that can be received in the buffer in number + * of words. The wordsize is determined by the number of bits-per-word + * selected for the SPI interface. If nbits <= 8, the data is + * packed into uint8_t's; if nbits >8, the data is packed into uint16_t's + * + * Returned Value: + * None + * + ****************************************************************************/ + +static void spi_recvblock(FAR struct spi_dev_s *dev, FAR void *buffer, size_t nwords) +{ + FAR uint8_t *ptr = (FAR uint8_t*)buffer; + uint32_t rxpending = 0; + + /* While there is remaining to be sent (and no synchronization error has occurred) */ + + spidbg("nwords: %d\n", nwords); + while (nwords || rxpending) + { + /* Fill the transmit FIFO with 0xff... + * Write 0xff to the data register while (1) the TX FIFO is + * not full, (2) we have not exceeded the depth of the TX FIFO, + * and (3) there are more bytes to be sent. + */ + + spivdbg("TX: rxpending: %d nwords: %d\n", rxpending, nwords); + while ((getreg8(LPC214X_SPI1_SR) & LPC214X_SPI1SR_TNF) && + (rxpending < LPC214X_SPI1_FIFOSZ) && nwords) + { + putreg16(0xff, LPC214X_SPI1_DR); + nwords--; + rxpending++; + } + + /* Now, read the RX data from the RX FIFO while the RX FIFO is not empty */ + + spivdbg("RX: rxpending: %d\n", rxpending); + while (getreg8(LPC214X_SPI1_SR) & LPC214X_SPI1SR_RNE) + { + *ptr++ = (uint8_t)getreg16(LPC214X_SPI1_DR); + rxpending--; + } + } +} + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: up_spiinitialize + * + * Description: + * Initialize the selected SPI port + * + * Input Parameter: + * Port number (for hardware that has mutiple SPI interfaces) + * + * Returned Value: + * Valid SPI device structre reference on succcess; a NULL on failure + * + ****************************************************************************/ + +FAR struct spi_dev_s *up_spiinitialize(int port) +{ + uint32_t regval32; + uint8_t regval8; + int i; + + /* Only the SPI1 interface is supported */ + +#ifdef CONFIG_DEBUG + if (port != 1) + { + return NULL; + } +#endif + + /* Configure multiplexed pins as connected on the ZP213X/4XPA board: + * + * PINSEL1 P0.17/CAP1.2/SCK1/MAT1.2 Bits 2-3=10 for SCK1 + * PINSEL1 P0.18/CAP1.3/MISO1/MAT1.3 Bits 4-5=10 for MISO1 + * (This is the RESET line for the UG_2864AMBAG01, + * although it is okay to configure it as an input too) + * PINSEL1 P0.19/MAT1.2/MOSI1/CAP1.2 Bits 6-7=10 for MOSI1 + * PINSEL1 P0.20/MAT1.3/SSEL1/EINT3 Bits 8-9=00 for P0.20 (we'll control it via GPIO or FIO) + * PINSEL1 P0.23/VBUS Bits 12-13=00 for P0.21 (we'll control it via GPIO or FIO) + */ + + regval32 = getreg32(LPC214X_PINSEL1); +#ifdef CONFIG_LCD_UG2864AMBAG01 + regval32 &= ~(LPC214X_PINSEL1_P017_MASK|LPC214X_PINSEL1_P019_MASK| + LPC214X_PINSEL1_P020_MASK|LPC214X_PINSEL1_P023_MASK); + regval32 |= (LPC214X_PINSEL1_P017_SCK1|LPC214X_PINSEL1_P019_MOSI1| + LPC214X_PINSEL1_P020_GPIO|LPC214X_PINSEL1_P023_GPIO); +#else + regval32 &= ~(LPC214X_PINSEL1_P017_MASK|LPC214X_PINSEL1_P018_MASK + LPC214X_PINSEL1_P019_MASK|LPC214X_PINSEL1_P020_MASK| + LPC214X_PINSEL1_P023_MASK); + regval32 |= (LPC214X_PINSEL1_P017_SCK1|LPC214X_PINSEL1_P018_MISO1| + LPC214X_PINSEL1_P019_MOSI1|LPC214X_PINSEL1_P020_GPIO| + LPC214X_PINSEL1_P023_GPIO); +#endif + putreg32(regval32, LPC214X_PINSEL1); + + /* De-select chip select using P0.20 (SSEL1) (low enables) and select A0 + * for commands (also low) + */ + + regval32 = (1 << 20) || (1 << 23); + putreg32(regval32, CS_SET_REGISTER); + regval32 |= getreg32(CS_DIR_REGISTER); + putreg32(regval32, CS_DIR_REGISTER); + + /* Enable peripheral clocking to SPI1 */ + + regval32 = getreg32(LPC214X_PCON_PCONP); + regval32 |= LPC214X_PCONP_PCSPI1; + putreg32(regval32, LPC214X_PCON_PCONP); + + /* Configure 8-bit SPI mode */ + + putreg16(LPC214X_SPI1CR0_DSS8BIT|LPC214X_SPI1CR0_FRFSPI, LPC214X_SPI1_CR0); + + /* Disable the SSP and all interrupts (we'll poll for all data) */ + + putreg8(0, LPC214X_SPI1_CR1); + putreg8(0, LPC214X_SPI1_IMSC); + + /* Set the initial clock frequency for indentification mode < 400kHz */ + + spi_setfrequency(NULL, 400000); + + /* Enable the SPI */ + + regval8 = getreg8(LPC214X_SPI1_CR1); + putreg8(regval8 | LPC214X_SPI1CR1_SSE, LPC214X_SPI1_CR1); + + for (i = 0; i < 8; i++) + { + (void)getreg16(LPC214X_SPI1_DR); + } + + return &g_spidev; +} diff --git a/nuttx/configs/zp214xpa/src/up_ug2864ambag01.c b/nuttx/configs/zp214xpa/src/up_ug2864ambag01.c new file mode 100644 index 0000000000..164518db36 --- /dev/null +++ b/nuttx/configs/zp214xpa/src/up_ug2864ambag01.c @@ -0,0 +1,177 @@ +/**************************************************************************** + * config/zp214xpa/src/up_ug2864ambag01.c + * arch/arm/src/board/up_ug2864ambag01.c + * + * Copyright (C) 2012 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * 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. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include + +#include +#include +#include + +#include "up_arch.h" +#include "chip.h" +#include "lpc214x_pinsel.h" + +#ifdef CONFIG_LCD_UG2864AMBAG01 + +/**************************************************************************** + * Pre-Processor Definitions + ****************************************************************************/ +/* Configuration ************************************************************/ +/* The pin configurations here requires that SPI1 is avaialable */ + +/* SPI should be configured with CMD/DATA support (and no transfer methods) */ + +#ifndef CONFIG_SPI_CMDDATA +# error "The OLED driver requires CONFIG_SPI_CMDDATA in the configuration" +#endif + +/* Pin Configuration ********************************************************/ +/* UG-2864AMBAG01 OLED Display: + * + * PIN NAME PIN CONFIGURATION + * 1 3V3 + * 2 5V + * 3 RESET P0.18/CAP1.3/MISO1/MAT1.3P0.18 RESET - General purpose output + * 4 DI P0.19/MAT1.2/MOSI1/CAP1.2P0.19 DI - Alternate function 2 + * 5 CS P0.20/MAT1.3/SSEL1/EINT3 - General purpose output + * 6 SCK P0.17/CAP1.2/SCK1/MAT1.2 - Alternate function 2 + * 7 A0 P0.23/VBUS - General purpose output + * 8 N/C LED- + * 9 N/C LED+ (BL) + * 10 GND + * + * Definitions and configuration for DO, DI, CS, in up_spi1.c + */ + +/* Use either FIO or legacy GPIO */ + +#ifdef CONFIG_LPC214x_FIO +# define CS_SET_REGISTER (LPC214X_FIO0_BASE+LPC214X_FIO_SET_OFFSET) +# define CS_CLR_REGISTER (LPC214X_FIO0_BASE+LPC214X_FIO_CLR_OFFSET) +# define CS_DIR_REGISTER (LPC214X_FIO0_BASE+LPC214X_FIO_DIR_OFFSET) +#else +# define CS_SET_REGISTER (LPC214X_GPIO0_BASE+LPC214X_GPIO_SET_OFFSET) +# define CS_CLR_REGISTER (LPC214X_GPIO0_BASE+LPC214X_GPIO_CLR_OFFSET) +# define CS_DIR_REGISTER (LPC214X_GPIO0_BASE+LPC214X_GPIO_DIR_OFFSET) +#endif + +/* Debug ********************************************************************/ + +#ifdef CONFIG_DEBUG_LCD +# define lcddbg(format, arg...) dbg(format, ##arg) +# define lcdvdbg(format, arg...) vdbg(format, ##arg) +#else +# define lcddbg(x...) +# define lcdvdbg(x...) +#endif + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: up_nxdrvinit + * + * Description: + * Called by NX initialization logic to configure the OLED. + * + ****************************************************************************/ + +FAR struct lcd_dev_s *up_nxdrvinit(unsigned int devno) +{ + FAR struct spi_dev_s *spi; + FAR struct lcd_dev_s *dev; + uint32_t regval32; + uint32_t bits32; + + /* Configure multiplexed pins as connected on the ZP213X/4XPA board: + * + * PINSEL1 P0.18/CAP1.3/MISO1/MAT1.3 Bits 4-5=00 for P0.18 + */ + + regval32 = getreg32(LPC214X_PINSEL1); + regval32 &= ~LPC214X_PINSEL1_P018_MASK; + regval32 |= LPC214X_PINSEL1_P018_GPIO; + putreg32(regval32, LPC214X_PINSEL1); + + /* Set the RESET line low, putting the OLED into the reset state. */ + + bits32 = (1 << 18); + putreg32(bits32, CS_CLR_REGISTER); + regval32 = getreg32(CS_DIR_REGISTER); + putreg32(regval32 | bits32, CS_DIR_REGISTER); + + /* Wait a bit then release the OLED from the reset state */ + + up_mdelay(20); + putreg32(bits32, CS_SET_REGISTER); + + /* Get the SPI1 port interface */ + + spi = up_spiinitialize(1); + if (!spi) + { + lcddbg("Failed to initialize SPI port 1\n"); + } + else + { + /* Bind the SPI port to the OLED */ + + dev = ug2864ambag01_initialize(spi, devno); + if (!dev) + { + lcddbg("Failed to bind SPI port 1 to OLED %d: %d\n", devno); + } + else + { + lcdvdbg("Bound SPI port 1 to OLED %d\n", devno); + + /* And turn the OLED on */ + + (void)dev->setpower(dev, CONFIG_LCD_MAXPOWER); + return dev; + } + } + + return NULL; +} +#endif /* CONFIG_LCD_UG2864AMBAG01 */ diff --git a/nuttx/configs/zp214xpa/tools/olimex.cfg b/nuttx/configs/zp214xpa/tools/olimex.cfg new file mode 100755 index 0000000000..09f373993b --- /dev/null +++ b/nuttx/configs/zp214xpa/tools/olimex.cfg @@ -0,0 +1,62 @@ +# NXP LPC2148 ARM7TDMI + +#daemon configuration +telnet_port 4444 +gdb_port 3333 + +#interface +interface ft2232 +ft2232_device_desc "Olimex OpenOCD JTAG A" +ft2232_layout "olimex-jtag" +ft2232_vid_pid 0x15BA 0x0003 + +# Use RCLK. If RCLK is not available fall back to 500kHz. +# +# Depending on cabling you might be able to eek this up to 2000kHz. +jtag_rclk 500 + +if { [info exists CHIPNAME] } { + set _CHIPNAME $CHIPNAME +} else { + set _CHIPNAME lpc2148 +} + +if { [info exists CPUTAPID ] } { + set _CPUTAPID $CPUTAPID +} else { + set _CPUTAPID 0x4f1f0f0f +} + +adapter_nsrst_delay 200 +jtag_ntrst_delay 200 + +# NOTE!!! LPCs need reset pulled while RTCK is low. 0 to activate +# JTAG, power-on reset is not enough, i.e. you need to perform a +# reset before being able to talk to the LPC2148, attach is not possible. + +reset_config trst_and_srst + +jtag newtap $_CHIPNAME cpu -irlen 4 -ircapture 0x1 -irmask 0xf -expected-id $_CPUTAPID + +set _TARGETNAME $_CHIPNAME.cpu +target create $_TARGETNAME arm7tdmi -chain-position $_TARGETNAME + +$_TARGETNAME configure -work-area-phys 0x40000000 -work-area-size 0x4000 -work-area-backup 0 + +$_TARGETNAME configure -event reset-init { + # Force target into ARM state + arm core_state arm + + # Do not remap 0x0000-0x0020 to anything but the flash (i.e. select + # "User Flash Mode" where interrupt vectors are _not_ remapped, + # and reside in flash instead). + # + # See section 7.1 on page 32 ("Memory Mapping control register") in + # "UM10139: Volume 1: LPC214x User Manual", Rev. 02 -- 25 July 2006. + # http://www.standardics.nxp.com/support/documents/microcontrollers/pdf/user.manual.lpc2141.lpc2142.lpc2144.lpc2146.lpc2148.pdf + mwb 0xE01FC040 0x01 +} + +# flash bank lpc2000 0 0 [calc checksum] +set _FLASHNAME $_CHIPNAME.flash +flash bank $_FLASHNAME lpc2000 0x0 0x7d000 0 0 $_TARGETNAME lpc2000_v2 14765 calc_checksum diff --git a/nuttx/configs/zp214xpa/tools/oocd.sh b/nuttx/configs/zp214xpa/tools/oocd.sh new file mode 100755 index 0000000000..f1e49344d2 --- /dev/null +++ b/nuttx/configs/zp214xpa/tools/oocd.sh @@ -0,0 +1,52 @@ +#!/bin/sh +# +# See configs/zp214xpa/README.txt for information about +# this file. + +TOPDIR=$1 +USAGE="$0 [-d]" +if [ -z "${TOPDIR}" ]; then + echo "Missing argument" + echo $USAGE + exit 1 +fi + +# Assume that OpenOCD was installed and at /usr/local/bin. Uncomment +# the following to run directly from the build directory +#OPENOCD_PATH="/home/OpenOCD/openocd/src" +#TARGET_PATH="/home/OpenOCD/openocd/tcl" +OPENOCD_PATH="/usr/local/bin" +TARGET_PATH="/usr/local/share/openocd/scripts" + +OPENOCD_EXE=openocd.exe +OPENOCD_CFG="${TOPDIR}/configs/zp214xpa/tools/olimex.cfg" +OPENOCD_ARGS="-f ${OPENOCD_CFG} -s ${TARGET_PATH}" + +if [ "X$2" = "X-d" ]; then + OPENOCD_ARGS=$OPENOCD_ARGS" -d3" + set -x +fi + +if [ ! -d ${OPENOCD_PATH} ]; then + echo "OpenOCD path does not exist: ${OPENOCD_PATH}" + exit 1 +fi +if [ ! -x ${OPENOCD_PATH}/${OPENOCD_EXE} ]; then + echo "OpenOCD does not exist: ${OPENOCD_PATH}/${OPENOCD_EXE}" + exit 1 +fi +if [ ! -f ${OPENOCD_CFG} ]; then + echo "OpenOCD config file does not exist: ${OPENOCD_CFG}" + exit 1 +fi + +echo "Starting OpenOCD" +cd ${OPENOCD_PATH} || { echo "Failed to CD to ${OPENOCD_PATH}"; exit 1; } +${OPENOCD_EXE} ${OPENOCD_ARGS} & +echo "OpenOCD daemon started" +ps -ef | grep openocd +echo "In GDB: target remote localhost:3333" + + + + diff --git a/nuttx/configs/zp214xpa/tools/usb-repair.txt b/nuttx/configs/zp214xpa/tools/usb-repair.txt new file mode 100644 index 0000000000..83d7598a55 --- /dev/null +++ b/nuttx/configs/zp214xpa/tools/usb-repair.txt @@ -0,0 +1,25 @@ +https://www.olimex.com/dev/pdf/ARM/JTAG/Repair%20Procedure%20for%20OpenOcd-Rev.%20G%20drivers.pdf + +Repair procedure for ARM-USB-OCD drivers + +1. Uninstalling ARM-USB-OCD drivers +------------------------------------- +1.1. Connect your programmer/debugger to your computer, open Device Manager + and uninstall the drivers for ARM-USB-OCD. +1.2. After you have uninstalled ARM-USB-TINY driver from Device Manager, + disconnect the programmer from your computer. +1.3. Now you should download FTClean.exe from here: + http://www.ftdichip.com/Support/Utilities/FTClean.zip. +1.4. After download is complete extract the "*.zip" file, open folder FTClean, + and run FTClean.exe +1.5. Ror VID (Hex) select "Other". And after that fill the first box with 15ba + and "PID (Hex)" with 0004. +1.6. Press "Clean System" button. Make sure that all FTDI devices are + disconnected. (My require administrator privileges). + +2. Re-installing the ARM-USB-OCD driver +--------------------------------------- +2.1 Connect the programmer/debugger to the computer. +2.2 When prompted, browse to the C:\gccfd\DRIVERS\ARM-USB-OCD-DRIVER + directory and install. (A different driver is required for OpenOCD + 0.4.0. That driver is available from the olimex.com web site). diff --git a/nuttx/graphics/Kconfig b/nuttx/graphics/Kconfig index 18b1e1ab97..b56a6cb5c0 100644 --- a/nuttx/graphics/Kconfig +++ b/nuttx/graphics/Kconfig @@ -178,6 +178,12 @@ config NXFONTS_CHARBITS The number of bits in the character set. Current options are only 7 and 8. The default is 7. +config NXFONT_MONO5X8 + bool "Mono 5x8" + default n + ---help--- + Tiny mono-spaced 5x8 font (font ID FONTID_MONO5X8 = 18) + config NXFONT_SANS17X22 bool "Sans 17x22" default n diff --git a/nuttx/include/nuttx/nx/nxfonts.h b/nuttx/include/nuttx/nx/nxfonts.h index 8e7289b2a6..91bce0036b 100644 --- a/nuttx/include/nuttx/nx/nxfonts.h +++ b/nuttx/include/nuttx/nx/nxfonts.h @@ -113,6 +113,11 @@ #elif defined(CONFIG_NXFONT_SERIF38X49B) # define NXFONT_DEFAULT FONTID_SERIF38X49B +/* Mono-space fonts */ + +#elif defined(CONFIG_NXFONT_MONO5X8) +# define NXFONT_DEFAULT FONTID_MONO5X8 + #endif /**************************************************************************** From e88ff3cdfaf26f8dec8f2d634cb3bc4390c6c464 Mon Sep 17 00:00:00 2001 From: patacongo Date: Sun, 30 Dec 2012 21:12:43 +0000 Subject: [PATCH 020/118] Fix the nxlines configuration for the zp214xpa board git-svn-id: http://svn.code.sf.net/p/nuttx/code/trunk@5467 42af7a65-404d-4744-a932-0658087f49c3 --- apps/examples/nxlines/nxlines_main.c | 1 + nuttx/ChangeLog | 6 +-- nuttx/configs/mcu123-lpc214x/src/up_spi1.c | 26 +++++------ nuttx/configs/zp214xpa/README.txt | 2 + nuttx/configs/zp214xpa/src/up_spi1.c | 44 +++++++++++++------ nuttx/configs/zp214xpa/src/up_ug2864ambag01.c | 29 +++++++----- nuttx/drivers/lcd/ug-2864ambag01.c | 4 +- 7 files changed, 68 insertions(+), 44 deletions(-) diff --git a/apps/examples/nxlines/nxlines_main.c b/apps/examples/nxlines/nxlines_main.c index 331fab6317..e4632bb21d 100644 --- a/apps/examples/nxlines/nxlines_main.c +++ b/apps/examples/nxlines/nxlines_main.c @@ -191,6 +191,7 @@ static inline int nxlines_initialize(void) g_nxlines.code = NXEXIT_NXOPEN; return ERROR; } + return OK; } diff --git a/nuttx/ChangeLog b/nuttx/ChangeLog index 56cc5515dc..daa1e068c4 100644 --- a/nuttx/ChangeLog +++ b/nuttx/ChangeLog @@ -3843,6 +3843,6 @@ * configs/sim/nxlines: Add an nxlines configuration for the simulator. * configs/zp214xpa/nxlines: Add an nxlines configuration for the - ZP213x/4xPA (with the LPC2148 and the UG_2864AMBAG01). As of this - writing (2012-12-30), I see only garbage on the display each time - the display is updated. + ZP213x/4xPA (with the LPC2148 and the UG_2864AMBAG01). Working + as of 2012-12-30. + diff --git a/nuttx/configs/mcu123-lpc214x/src/up_spi1.c b/nuttx/configs/mcu123-lpc214x/src/up_spi1.c index 61abee20a9..c10144d888 100644 --- a/nuttx/configs/mcu123-lpc214x/src/up_spi1.c +++ b/nuttx/configs/mcu123-lpc214x/src/up_spi1.c @@ -85,20 +85,16 @@ * Definitions ****************************************************************************/ -/* Enables debug output from this file (needs CONFIG_DEBUG too) */ +/* Enables debug output from this file */ -#undef SPI_DEBUG /* Define to enable debug */ -#undef SPI_VERBOSE /* Define to enable verbose debug */ - -#ifdef SPI_DEBUG +#ifdef CONFIG_DEBUG_SPI # define spidbg lldbg -# ifdef SPI_VERBOSE +# ifdef CONFIG_DEBUG_VERBOSE # define spivdbg lldbg # else # define spivdbg(x...) # endif #else -# undef SPI_VERBOSE # define spidbg(x...) # define spivdbg(x...) #endif @@ -125,17 +121,17 @@ ****************************************************************************/ #ifndef CONFIG_SPI_OWNBUS -static int spi_lock(FAR struct spi_dev_s *dev, bool lock); +static int spi_lock(FAR struct spi_dev_s *dev, bool lock); #endif -static void spi_select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected); +static void spi_select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected); static uint32_t spi_setfrequency(FAR struct spi_dev_s *dev, uint32_t frequency); -static uint8_t spi_status(FAR struct spi_dev_s *dev, enum spi_dev_e devid); +static uint8_t spi_status(FAR struct spi_dev_s *dev, enum spi_dev_e devid); #ifdef CONFIG_SPI_CMDDATA -static int spi_cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd); +static int spi_cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd); #endif static uint16_t spi_send(FAR struct spi_dev_s *dev, uint16_t ch); -static void spi_sndblock(FAR struct spi_dev_s *dev, FAR const void *buffer, size_t nwords); -static void spi_recvblock(FAR struct spi_dev_s *dev, FAR void *buffer, size_t nwords); +static void spi_sndblock(FAR struct spi_dev_s *dev, FAR const void *buffer, size_t nwords); +static void spi_recvblock(FAR struct spi_dev_s *dev, FAR void *buffer, size_t nwords); /**************************************************************************** * Private Data @@ -224,14 +220,14 @@ static void spi_select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool sel { /* Enable slave select (low enables) */ - spidbg("CD asserted\n"); + spidbg("CS asserted\n"); putreg32(bit, CS_CLR_REGISTER); } else { /* Disable slave select (low enables) */ - spidbg("CD de-asserted\n"); + spidbg("CS de-asserted\n"); putreg32(bit, CS_SET_REGISTER); /* Wait for the TX FIFO not full indication */ diff --git a/nuttx/configs/zp214xpa/README.txt b/nuttx/configs/zp214xpa/README.txt index 9f577b98d5..58a2242d07 100644 --- a/nuttx/configs/zp214xpa/README.txt +++ b/nuttx/configs/zp214xpa/README.txt @@ -338,3 +338,5 @@ Configurations: CONFIG_HOST_LINUX=y : Linux (Cygwin under Windows okay too). CONFIG_ARM_TOOLCHAIN_GNU_EABI=y : Buildroot (arm-nuttx-elf-gcc) CONFIG_RAW_BINARY=y : Output formats: ELF and raw binary + + 3. Verified as of this writing (2012-12-30). diff --git a/nuttx/configs/zp214xpa/src/up_spi1.c b/nuttx/configs/zp214xpa/src/up_spi1.c index 563d63589c..1ee1cac326 100644 --- a/nuttx/configs/zp214xpa/src/up_spi1.c +++ b/nuttx/configs/zp214xpa/src/up_spi1.c @@ -86,20 +86,16 @@ * Definitions ****************************************************************************/ -/* Enables debug output from this file (needs CONFIG_DEBUG too) */ +/* Enables debug output from this file */ -#undef SPI_DEBUG /* Define to enable debug */ -#undef SPI_VERBOSE /* Define to enable verbose debug */ - -#ifdef SPI_DEBUG +#ifdef CONFIG_DEBUG_SPI # define spidbg lldbg -# ifdef SPI_VERBOSE +# ifdef CONFIG_DEBUG_VERBOSE # define spivdbg lldbg # else # define spivdbg(x...) # endif #else -# undef SPI_VERBOSE # define spidbg(x...) # define spivdbg(x...) #endif @@ -112,10 +108,12 @@ /* Use either FIO or legacy GPIO */ #ifdef CONFIG_LPC214x_FIO +# define CS_PIN_REGISTER (LPC214X_FIO0_BASE+LPC214X_FIO_PIN_OFFSET) # define CS_SET_REGISTER (LPC214X_FIO0_BASE+LPC214X_FIO_SET_OFFSET) # define CS_CLR_REGISTER (LPC214X_FIO0_BASE+LPC214X_FIO_CLR_OFFSET) # define CS_DIR_REGISTER (LPC214X_FIO0_BASE+LPC214X_FIO_DIR_OFFSET) #else +# define CS_PIN_REGISTER (LPC214X_GPIO0_BASE+LPC214X_GPIO_PIN_OFFSET) # define CS_SET_REGISTER (LPC214X_GPIO0_BASE+LPC214X_GPIO_SET_OFFSET) # define CS_CLR_REGISTER (LPC214X_GPIO0_BASE+LPC214X_GPIO_CLR_OFFSET) # define CS_DIR_REGISTER (LPC214X_GPIO0_BASE+LPC214X_GPIO_DIR_OFFSET) @@ -130,7 +128,7 @@ static int spi_lock(FAR struct spi_dev_s *dev, bool lock); #endif static void spi_select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected); static uint32_t spi_setfrequency(FAR struct spi_dev_s *dev, uint32_t frequency); -static uint8_t spi_status(FAR struct spi_dev_s *dev, enum spi_dev_e devid); +static uint8_t spi_status(FAR struct spi_dev_s *dev, enum spi_dev_e devid); #ifdef CONFIG_SPI_CMDDATA static int spi_cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd); #endif @@ -193,7 +191,7 @@ static struct spi_dev_s g_spidev = { &g_spiops }; #ifndef CONFIG_SPI_OWNBUS static int spi_lock(FAR struct spi_dev_s *dev, bool lock) { - /* Not implemented */ + /* Not implemented -- the UG_2864AMBAG01 is the only device on SPI1 */ return -ENOSYS; } @@ -219,25 +217,32 @@ static int spi_lock(FAR struct spi_dev_s *dev, bool lock) static void spi_select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected) { +#ifdef CONFIG_DEBUG_SPI + uint32_t regval; +#endif uint32_t bit = 1 << 20; /* We do not bother to check if devid == SPIDEV_DISPLAY because that is the * only thing on the bus. */ +#ifdef CONFIG_DEBUG_SPI + regval = getreg32(CS_PIN_REGISTER); +#endif + if (selected) { /* Enable slave select (low enables) */ - spidbg("CD asserted\n"); putreg32(bit, CS_CLR_REGISTER); + spidbg("CS asserted: %08x->%08x\n", regval, getreg32(CS_PIN_REGISTER)); } else { /* Disable slave select (low enables) */ - spidbg("CD de-asserted\n"); putreg32(bit, CS_SET_REGISTER); + spidbg("CS de-asserted: %08x->%08x\n", regval, getreg32(CS_PIN_REGISTER)); /* Wait for the TX FIFO not full indication */ @@ -345,6 +350,9 @@ static uint8_t spi_status(FAR struct spi_dev_s *dev, enum spi_dev_e devid) #ifdef CONFIG_SPI_CMDDATA static int spi_cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd) { +#ifdef CONFIG_DEBUG_SPI + uint32_t regval; +#endif uint32_t bit = 1 << 23; /* We do not bother to check if devid == SPIDEV_DISPLAY because that is the @@ -358,19 +366,23 @@ static int spi_cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd * A0 = L: the inputs at D0 to D7 are transferred to the command registers." */ +#ifdef CONFIG_DEBUG_SPI + regval = getreg32(CS_PIN_REGISTER); +#endif + if (cmd) { /* L: the inputs at D0 to D7 are transferred to the command registers */ - spidbg("Command\n"); putreg32(bit, CS_CLR_REGISTER); + spidbg("Command: %08x->%08x\n", regval, getreg32(CS_PIN_REGISTER)); } else { /* H: the inputs at D0 to D7 are treated as display data. */ - spidbg("CD de-asserted\n"); putreg32(bit, CS_SET_REGISTER); + spidbg("Data: %08x->%08x\n", regval, getreg32(CS_PIN_REGISTER)); } return OK; @@ -606,11 +618,15 @@ FAR struct spi_dev_s *up_spiinitialize(int port) * for commands (also low) */ - regval32 = (1 << 20) || (1 << 23); + regval32 = (1 << 20) | (1 << 23); putreg32(regval32, CS_SET_REGISTER); regval32 |= getreg32(CS_DIR_REGISTER); putreg32(regval32, CS_DIR_REGISTER); + spidbg("CS Pin Config: PINSEL1: %08x PIN: %08x DIR: %08x\n", + getreg32(LPC214X_PINSEL1), getreg32(CS_PIN_REGISTER), + getreg32(CS_DIR_REGISTER)); + /* Enable peripheral clocking to SPI1 */ regval32 = getreg32(LPC214X_PCON_PCONP); diff --git a/nuttx/configs/zp214xpa/src/up_ug2864ambag01.c b/nuttx/configs/zp214xpa/src/up_ug2864ambag01.c index 164518db36..236f9fa411 100644 --- a/nuttx/configs/zp214xpa/src/up_ug2864ambag01.c +++ b/nuttx/configs/zp214xpa/src/up_ug2864ambag01.c @@ -85,13 +85,15 @@ /* Use either FIO or legacy GPIO */ #ifdef CONFIG_LPC214x_FIO -# define CS_SET_REGISTER (LPC214X_FIO0_BASE+LPC214X_FIO_SET_OFFSET) -# define CS_CLR_REGISTER (LPC214X_FIO0_BASE+LPC214X_FIO_CLR_OFFSET) -# define CS_DIR_REGISTER (LPC214X_FIO0_BASE+LPC214X_FIO_DIR_OFFSET) +# define RESET_PIN_REGISTER (LPC214X_FIO0_BASE+LPC214X_FIO_PIN_OFFSET) +# define RESET_SET_REGISTER (LPC214X_FIO0_BASE+LPC214X_FIO_SET_OFFSET) +# define RESET_CLR_REGISTER (LPC214X_FIO0_BASE+LPC214X_FIO_CLR_OFFSET) +# define RESET_DIR_REGISTER (LPC214X_FIO0_BASE+LPC214X_FIO_DIR_OFFSET) #else -# define CS_SET_REGISTER (LPC214X_GPIO0_BASE+LPC214X_GPIO_SET_OFFSET) -# define CS_CLR_REGISTER (LPC214X_GPIO0_BASE+LPC214X_GPIO_CLR_OFFSET) -# define CS_DIR_REGISTER (LPC214X_GPIO0_BASE+LPC214X_GPIO_DIR_OFFSET) +# define RESET_PIN_REGISTER (LPC214X_GPIO0_BASE+LPC214X_GPIO_PIN_OFFSET) +# define RESET_SET_REGISTER (LPC214X_GPIO0_BASE+LPC214X_GPIO_SET_OFFSET) +# define RESET_CLR_REGISTER (LPC214X_GPIO0_BASE+LPC214X_GPIO_CLR_OFFSET) +# define RESET_DIR_REGISTER (LPC214X_GPIO0_BASE+LPC214X_GPIO_DIR_OFFSET) #endif /* Debug ********************************************************************/ @@ -136,14 +138,21 @@ FAR struct lcd_dev_s *up_nxdrvinit(unsigned int devno) /* Set the RESET line low, putting the OLED into the reset state. */ bits32 = (1 << 18); - putreg32(bits32, CS_CLR_REGISTER); - regval32 = getreg32(CS_DIR_REGISTER); - putreg32(regval32 | bits32, CS_DIR_REGISTER); + putreg32(bits32, RESET_CLR_REGISTER); + regval32 = getreg32(RESET_DIR_REGISTER); + putreg32(regval32 | bits32, RESET_DIR_REGISTER); + + lcdvdbg("RESET Pin Config: PINSEL1: %08x PIN: %08x DIR: %08x\n", + getreg32(LPC214X_PINSEL1), getreg32(RESET_PIN_REGISTER), + getreg32(RESET_DIR_REGISTER)); /* Wait a bit then release the OLED from the reset state */ up_mdelay(20); - putreg32(bits32, CS_SET_REGISTER); + putreg32(bits32, RESET_SET_REGISTER); + + lcdvdbg("RESET release: PIN: %08x DIR: %08x\n", + getreg32(RESET_PIN_REGISTER), getreg32(RESET_DIR_REGISTER)); /* Get the SPI1 port interface */ diff --git a/nuttx/drivers/lcd/ug-2864ambag01.c b/nuttx/drivers/lcd/ug-2864ambag01.c index 2a47b38eb7..ca1d4c1234 100644 --- a/nuttx/drivers/lcd/ug-2864ambag01.c +++ b/nuttx/drivers/lcd/ug-2864ambag01.c @@ -1148,8 +1148,8 @@ void ug2864ambag01_fill(FAR struct lcd_dev_s *dev, uint8_t color) /* Transfer one page of the selected color */ - (void)SPI_SNDBLOCK(priv->spi, &priv->fb[page * UG2864AMBAG01_XRES], - UG2864AMBAG01_XRES); + (void)SPI_SNDBLOCK(priv->spi, &priv->fb[page * UG2864AMBAG01_XRES], + UG2864AMBAG01_XRES); } /* De-select and unlock the device */ From 167854a980facb6f611e2610a1754903dfc12ce4 Mon Sep 17 00:00:00 2001 From: patacongo Date: Mon, 31 Dec 2012 13:44:36 +0000 Subject: [PATCH 021/118] Remove non-functional WLAN examples, configurations git-svn-id: http://svn.code.sf.net/p/nuttx/code/trunk@5468 42af7a65-404d-4744-a932-0658087f49c3 --- apps/ChangeLog.txt | 2 + apps/examples/Kconfig | 1 - apps/examples/Make.defs | 4 - apps/examples/Makefile | 2 +- apps/examples/wlan/Kconfig | 13 - apps/examples/wlan/Makefile | 98 ---- apps/examples/wlan/wlan_main.c | 306 ----------- nuttx/ChangeLog | 6 +- .../configs/olimex-lpc1766stk/wlan/Make.defs | 109 ---- .../configs/olimex-lpc1766stk/wlan/appconfig | 42 -- .../configs/olimex-lpc1766stk/wlan/defconfig | 498 ------------------ .../configs/olimex-lpc1766stk/wlan/setenv.sh | 73 --- 12 files changed, 7 insertions(+), 1147 deletions(-) delete mode 100644 apps/examples/wlan/Kconfig delete mode 100644 apps/examples/wlan/Makefile delete mode 100644 apps/examples/wlan/wlan_main.c delete mode 100644 nuttx/configs/olimex-lpc1766stk/wlan/Make.defs delete mode 100644 nuttx/configs/olimex-lpc1766stk/wlan/appconfig delete mode 100755 nuttx/configs/olimex-lpc1766stk/wlan/defconfig delete mode 100755 nuttx/configs/olimex-lpc1766stk/wlan/setenv.sh diff --git a/apps/ChangeLog.txt b/apps/ChangeLog.txt index d6a2f9d907..0464c61988 100644 --- a/apps/ChangeLog.txt +++ b/apps/ChangeLog.txt @@ -459,3 +459,5 @@ as well. However, the USB HID keyboard drier has not yet been updated to detect key release events. That is kind of tricky in the USB HID keyboard report data. + * apps/examples/wlan: Remove non-functional example. + diff --git a/apps/examples/Kconfig b/apps/examples/Kconfig index ae5f0a61a1..b0cbd70886 100644 --- a/apps/examples/Kconfig +++ b/apps/examples/Kconfig @@ -58,5 +58,4 @@ source "$APPSDIR/examples/usbterm/Kconfig" source "$APPSDIR/examples/watchdog/Kconfig" source "$APPSDIR/examples/wget/Kconfig" source "$APPSDIR/examples/wgetjson/Kconfig" -source "$APPSDIR/examples/wlan/Kconfig" source "$APPSDIR/examples/xmlrpc/Kconfig" diff --git a/apps/examples/Make.defs b/apps/examples/Make.defs index 91f1331dfc..de2b8939fe 100644 --- a/apps/examples/Make.defs +++ b/apps/examples/Make.defs @@ -254,10 +254,6 @@ ifeq ($(CONFIG_EXAMPLES_WGETJSON),y) CONFIGURED_APPS += examples/wgetjson endif -ifeq ($(CONFIG_EXAMPLES_WLAN),y) -CONFIGURED_APPS += examples/wlan -endif - ifeq ($(CONFIG_EXAMPLES_XMLRPC),y) CONFIGURED_APPS += examples/xmlrpc endif diff --git a/apps/examples/Makefile b/apps/examples/Makefile index 50e9596d78..99312af7ab 100644 --- a/apps/examples/Makefile +++ b/apps/examples/Makefile @@ -42,7 +42,7 @@ SUBDIRS += ftpd hello helloxx hidkbd igmp json keypadtest lcdrw mm modbus mount SUBDIRS += nettest nsh null nx nxconsole nxffs nxflat nxhello nximage SUBDIRS += nxlines nxtext ostest pashello pipe poll pwm qencoder relays SUBDIRS += rgmp romfs serloop telnetd thttpd tiff touchscreen udp uip -SUBDIRS += usbserial sendmail usbstorage usbterm watchdog wget wgetjson wlan +SUBDIRS += usbserial sendmail usbstorage usbterm watchdog wget wgetjson # Sub-directories that might need context setup. Directories may need # context setup for a variety of reasons, but the most common is because diff --git a/apps/examples/wlan/Kconfig b/apps/examples/wlan/Kconfig deleted file mode 100644 index 7f8fb526a5..0000000000 --- a/apps/examples/wlan/Kconfig +++ /dev/null @@ -1,13 +0,0 @@ -# -# For a description of the syntax of this configuration file, -# see misc/tools/kconfig-language.txt. -# - -config EXAMPLES_WLAN - bool "WLAN example" - default n - ---help--- - Enable the WLAN example - -if EXAMPLES_WLAN -endif diff --git a/apps/examples/wlan/Makefile b/apps/examples/wlan/Makefile deleted file mode 100644 index 1da79736f1..0000000000 --- a/apps/examples/wlan/Makefile +++ /dev/null @@ -1,98 +0,0 @@ -############################################################################ -# apps/examples/wlan/Makefile -# -# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved. -# Authors: Gregory Nutt -# Rafael Noronha -# -# 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 --include $(TOPDIR)/Make.defs -include $(APPDIR)/Make.defs - -# WLAN Test - -ASRCS = -CSRCS = wlan_main.c - -AOBJS = $(ASRCS:.S=$(OBJEXT)) -COBJS = $(CSRCS:.c=$(OBJEXT)) - -SRCS = $(ASRCS) $(CSRCS) -OBJS = $(AOBJS) $(COBJS) - -ifeq ($(CONFIG_WINDOWS_NATIVE),y) - BIN = ..\..\libapps$(LIBEXT) -else -ifeq ($(WINTOOL),y) - BIN = ..\\..\\libapps$(LIBEXT) -else - BIN = ../../libapps$(LIBEXT) -endif -endif - -ROOTDEPPATH = --dep-path . - -# Common build - -VPATH = - -all: .built -.PHONY: clean depend distclean - -$(AOBJS): %$(OBJEXT): %.S - $(call ASSEMBLE, $<, $@) - -$(COBJS): %$(OBJEXT): %.c - $(call COMPILE, $<, $@) - -.built: $(OBJS) - $(call ARCHIVE, $(BIN), $(OBJS)) - @touch .built - -context: - -.depend: Makefile $(SRCS) - @$(MKDEP) $(ROOTDEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep - @touch $@ - -depend: .depend - -clean: - $(call DELFILE, .built) - $(call CLEAN) - -distclean: clean - $(call DELFILE, Make.dep) - $(call DELFILE, .depend) - --include Make.dep - diff --git a/apps/examples/wlan/wlan_main.c b/apps/examples/wlan/wlan_main.c deleted file mode 100644 index aa48a02382..0000000000 --- a/apps/examples/wlan/wlan_main.c +++ /dev/null @@ -1,306 +0,0 @@ -/**************************************************************************** - * examples/wlan/wlan_main.c - * - * Copyright (C) 2011 Gregory Nutt. All rights reserved. - * Authors: Gregory Nutt - * Rafael Noronha - * - * 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 Gregory Nutt 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. - * - ****************************************************************************/ - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include - -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#include -#include -#include - -#include - -/* DHCPC may be used in conjunction with any other feature (or not) */ - -#ifdef CONFIG_EXAMPLES_WLAN_DHCPC -# include -# include -# include -#endif - -/**************************************************************************** - * Definitions - ****************************************************************************/ -/* Configuration ************************************************************/ - -/* Sanity checking */ - -#ifndef CONFIG_USBHOST -# error "CONFIG_USBHOST is not defined" -#endif - -#ifdef CONFIG_USBHOST_BULK_DISABLE -# error "Bulk endpoints are disabled (CONFIG_USBHOST_BULK_DISABLE)" -#endif - -#ifndef CONFIG_NFILE_DESCRIPTORS -# error "CONFIG_NFILE_DESCRIPTORS > 0 needed" -#endif - -/* Provide some default values for other configuration settings */ - -#ifndef CONFIG_EXAMPLES_WLAN_DEFPRIO -# define CONFIG_EXAMPLES_WLAN_DEFPRIO 50 -#endif - -#ifndef CONFIG_EXAMPLES_WLAN_STACKSIZE -# define CONFIG_EXAMPLES_WLAN_STACKSIZE 1024 -#endif - -#ifndef CONFIG_EXAMPLES_WLAN_DEVNAME -# define CONFIG_EXAMPLES_WLAN_DEVNAME "wlan0" -#endif - -/**************************************************************************** - * Private Types - ****************************************************************************/ - -/**************************************************************************** - * Private Data - ****************************************************************************/ - -static struct usbhost_driver_s *g_drvr; - -/**************************************************************************** - * Private Functions - ****************************************************************************/ - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: wlan_bringup - * - * Description: - * Wait for USB devices to be connected. - * - ****************************************************************************/ - -static inline void wlan_bringup(void) -{ -#if defined(CONFIG_EXAMPLES_WLAN_DHCPC) || defined(CONFIG_EXAMPLES_WLAN_NOMAC) - uint8_t mac[IFHWADDRLEN]; -#endif - struct in_addr addr; -#ifdef CONFIG_EXAMPLES_WLAN_DHCPC - void *handle; -#endif - - /* Many embedded network interfaces must have a software assigned - * MAC - */ - -#ifdef CONFIG_EXAMPLES_WLAN_NOMAC - mac[0] = 0x00; - mac[1] = 0xe0; - mac[2] = 0xde; - mac[3] = 0xad; - mac[4] = 0xbe; - mac[5] = 0xef; - uip_setmacaddr("eth0", mac); -#endif - - /* Set up the default router address */ - - addr.s_addr = HTONL(CONFIG_EXAMPLES_WLAN_DRIPADDR); - uip_setdraddr("eth0", &addr); - - /* Setup the subnet mask */ - - addr.s_addr = HTONL(CONFIG_EXAMPLES_WLAN_NETMASK); - uip_setnetmask("eth0", &addr); - - /* Set up our host address */ - -#ifdef CONFIG_EXAMPLES_WLAN_DHCPC - addr.s_addr = 0; -#else - addr.s_addr = HTONL(CONFIG_EXAMPLES_WLAN_IPADDR); -#endif - uip_sethostaddr("eth0", &addr); - -#ifdef CONFIG_EXAMPLES_WLAN_DHCPC - /* Set up the resolver */ - - resolv_init(); - - /* Get the MAC address of the NIC */ - - uip_getmacaddr("eth0", mac); - - /* Set up the DHCPC modules */ - - handle = dhcpc_open(&mac, IFHWADDRLEN); - - /* Get an IP address. Note: there is no logic here for renewing - * the address in this example. The address should be renewed in - * ds.lease_time/2 seconds. - */ - - printf("Getting IP address\n"); - if (handle) - { - struct dhcpc_state ds; - (void)dhcpc_request(handle, &ds); - uip_sethostaddr("eth1", &ds.ipaddr); - if (ds.netmask.s_addr != 0) - { - uip_setnetmask("eth0", &ds.netmask); - } - if (ds.default_router.s_addr != 0) - { - uip_setdraddr("eth0", &ds.default_router); - } - if (ds.dnsaddr.s_addr != 0) - { - resolv_conf(&ds.dnsaddr); - } - dhcpc_close(handle); - printf("IP: %s\n", inet_ntoa(ds.ipaddr)); - } -#endif -} - -/**************************************************************************** - * Name: wlan_waiter - * - * Description: - * Wait for USB devices to be connected. - * - ****************************************************************************/ - -static int wlan_waiter(int argc, char *argv[]) -{ - bool connected = false; - int ret; - - printf("wlan_waiter: Running\n"); - for (;;) - { - /* Wait for the device to change state */ - - ret = DRVR_WAIT(g_drvr, connected); - DEBUGASSERT(ret == OK); - - connected = !connected; - printf("wlan_waiter: %s\n", connected ? "connected" : "disconnected"); - - /* Did we just become connected? */ - - if (connected) - { - /* Yes.. enumerate the newly connected device */ - - ret = DRVR_ENUMERATE(g_drvr); - - /* If the enumeration was successful, then bring up the interface */ - - wlan_bringup(); - } - } - - /* Keep the compiler from complaining */ - - return 0; -} - -/**************************************************************************** - * Name: wlan_main - ****************************************************************************/ - -int wlan_main(int argc, char *argv[]) -{ - pid_t pid; - int ret; - - /* First, register all of the USB host Wireless LAN drivers */ - - printf("wlan_main: Register drivers\n"); - ret = usbhost_wlaninit(); - if (ret != OK) - { - printf("wlan_main: Failed to register the WLAN driver\n"); - } - - /* Then get an instance of the USB host interface */ - - printf("wlan_main: Initialize USB host WLAN driver\n"); - g_drvr = usbhost_initialize(0); - if (g_drvr) - { - /* Start a thread to handle device connection. */ - - printf("wlan_main: Start wlan_waiter\n"); - -#ifndef CONFIG_CUSTOM_STACK - pid = task_create("usbhost", CONFIG_EXAMPLES_WLAN_DEFPRIO, - CONFIG_EXAMPLES_WLAN_STACKSIZE, - (main_t)wlan_waiter, (const char **)NULL); -#else - pid = task_create("usbhost", CONFIG_EXAMPLES_WLAN_DEFPRIO, - (main_t)wlan_waiter, (const char **)NULL); -#endif - - /* Now just sleep. Eventually logic here will perform the device test. */ - - for (;;) - { - sleep(5); - printf("usert_start: Still alive\n"); - } - } - return 0; -} diff --git a/nuttx/ChangeLog b/nuttx/ChangeLog index daa1e068c4..80b4bde1dd 100644 --- a/nuttx/ChangeLog +++ b/nuttx/ChangeLog @@ -1452,7 +1452,7 @@ complex: 'uname -o 2>/dev/null || echo "Other"' * drivers/usbhost/usbhost_enumerate.c: Add logic to get the VID and PID. This is necessary in order to support vendor-specific USB devices. - * examplex/wlan, configs/olimex-lpc1766stk/wlan, drivers/usbhost/usbhost_rtl8187.c, + * examples/wlan, configs/olimex-lpc1766stk/wlan, drivers/usbhost/usbhost_rtl8187.c, Add infrastructure to support RTL18187 wireless USB. * configs/nucleus2g: backed out USB host changes... wrong board. * Renamed arc/hc/include/mc9s12ne64 and src/mc9s12ne64 to m9s12. That name is @@ -1920,7 +1920,7 @@ CONFIG_FAT_LCNAMES is not selected, all filenames are strictly upper case. * configs/stm3210e-eval/nsh2: Console is back on UART1; Added - examplex/nx as an NSH "built-in" command as a demonstration. + examples/nx as an NSH "built-in" command as a demonstration. * fs/fat/fs_fat32dirent.c: Fix an important bug in the directory allocation (fat_allocatedirentry()). I looks like it could be initializing the wrong sectors! NOTE: This function was in @@ -3845,4 +3845,6 @@ * configs/zp214xpa/nxlines: Add an nxlines configuration for the ZP213x/4xPA (with the LPC2148 and the UG_2864AMBAG01). Working as of 2012-12-30. + * config/olimex-lpc1766stk/wlan: Remove non-functional + configuration. diff --git a/nuttx/configs/olimex-lpc1766stk/wlan/Make.defs b/nuttx/configs/olimex-lpc1766stk/wlan/Make.defs deleted file mode 100644 index f99c88f53d..0000000000 --- a/nuttx/configs/olimex-lpc1766stk/wlan/Make.defs +++ /dev/null @@ -1,109 +0,0 @@ -############################################################################ -# configs/olimex-lpc1766stk/wlan/Make.defs -# -# Copyright (C) 2011, 2012 Gregory Nutt. All rights reserved. -# Author: Gregory Nutt -# -# 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 -include ${TOPDIR}/tools/Config.mk -include ${TOPDIR}/arch/arm/src/armv7-m/Toolchain.defs - -ifeq ($(WINTOOL),y) - # Windows-native toolchains - DIRLINK = $(TOPDIR)/tools/copydir.sh - DIRUNLINK = $(TOPDIR)/tools/unlink.sh - MKDEP = $(TOPDIR)/tools/mknulldeps.sh - ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" - ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}" - ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/scripts/ld.script}" - MAXOPTIMIZATION = -O2 -else - # Linux/Cygwin-native toolchain - MKDEP = $(TOPDIR)/tools/mkdeps.sh - ARCHINCLUDES = -I. -isystem $(TOPDIR)/include - ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx - ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/scripts/ld.script -endif - -CC = $(CROSSDEV)gcc -CXX = $(CROSSDEV)g++ -CPP = $(CROSSDEV)gcc -E -LD = $(CROSSDEV)ld -AR = $(CROSSDEV)ar rcs -NM = $(CROSSDEV)nm -OBJCOPY = $(CROSSDEV)objcopy -OBJDUMP = $(CROSSDEV)objdump - -ARCHCCVERSION = ${shell $(CC) -v 2>&1 | sed -n '/^gcc version/p' | sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q'} -ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1} - -ifeq ($(CONFIG_DEBUG_SYMBOLS),y) - ARCHOPTIMIZATION = -g -else - ARCHOPTIMIZATION = $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer -endif - -ARCHCFLAGS = -fno-builtin -ARCHCXXFLAGS = -fno-builtin -fno-exceptions -ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow -ARCHWARNINGSXX = -Wall -Wshadow -ARCHDEFINES = -ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10 - -CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe -CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS) -CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe -CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS) -CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -AFLAGS = $(CFLAGS) -D__ASSEMBLY__ - -NXFLATLDFLAGS1 = -r -d -warn-common -NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat-pcrel.ld -no-check-sections -LDNXFLATFLAGS = -e main -s 2048 - -OBJEXT = .o -LIBEXT = .a -EXEEXT = - -ifneq ($(CROSSDEV),arm-nuttx-elf-) - LDFLAGS += -nostartfiles -nodefaultlibs -endif -ifeq ($(CONFIG_DEBUG_SYMBOLS),y) - LDFLAGS += -g -endif - - -HOSTCC = gcc -HOSTINCLUDES = -I. -HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe -HOSTLDFLAGS = - diff --git a/nuttx/configs/olimex-lpc1766stk/wlan/appconfig b/nuttx/configs/olimex-lpc1766stk/wlan/appconfig deleted file mode 100644 index 7fb2871aaf..0000000000 --- a/nuttx/configs/olimex-lpc1766stk/wlan/appconfig +++ /dev/null @@ -1,42 +0,0 @@ -############################################################################ -# configs/olimex-lpc1766stk/wlan/appconfig -# -# Copyright (C) 2011 Gregory Nutt. All rights reserved. -# Author: Gregory Nutt -# -# 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. -# -############################################################################ - -# Path to example in apps/examples containing the user_start entry point - -CONFIGURED_APPS += examples/wlan - -# Networking support - -CONFIGURED_APPS += netutils/uiplib diff --git a/nuttx/configs/olimex-lpc1766stk/wlan/defconfig b/nuttx/configs/olimex-lpc1766stk/wlan/defconfig deleted file mode 100755 index 009191f654..0000000000 --- a/nuttx/configs/olimex-lpc1766stk/wlan/defconfig +++ /dev/null @@ -1,498 +0,0 @@ -############################################################################ -# configs/olimex-lpc1766stk/wlan/defconfig -# -# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved. -# Author: Gregory Nutt -# -# 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. -# -############################################################################ -# -# Architecture Selection -# -CONFIG_ARCH="arm" -CONFIG_ARCH_ARM=y -CONFIG_ARCH_CORTEXM3=y -CONFIG_ARCH_CHIP="lpc17xx" -CONFIG_ARCH_CHIP_LPC17XX=y -CONFIG_ARCH_CHIP_LPC1766=y -CONFIG_ARCH_BOARD="olimex-lpc1766stk" -CONFIG_ARCH_BOARD_LPC1766STK=y -CONFIG_BOARD_LOOPSPERMSEC=8111 -CONFIG_DRAM_SIZE=32768 -CONFIG_DRAM_START=0x10000000 -CONFIG_ARCH_IRQPRIO=y -CONFIG_ARCH_INTERRUPTSTACK=0 -CONFIG_ARCH_STACKDUMP=y -CONFIG_ARCH_BOOTLOADER=n -CONFIG_ARCH_LEDS=y -CONFIG_ARCH_BUTTONS=n -CONFIG_ARCH_CALIBRATION=n -CONFIG_ARCH_DMA=n - -# -# Identify toolchain and linker options -# -CONFIG_LPC17_CODESOURCERYW=n -CONFIG_LPC17_CODESOURCERYL=n -CONFIG_LPC17_DEVKITARM=n -CONFIG_LPC17_BUILDROOT=y - -# -# Individual subsystems can be enabled: -# -CONFIG_LPC17_ETHERNET=n -CONFIG_LPC17_USBHOST=y -CONFIG_LPC17_USBOTG=n -CONFIG_LPC17_USBDEV=n -CONFIG_LPC17_UART0=y -CONFIG_LPC17_UART1=n -CONFIG_LPC17_UART2=n -CONFIG_LPC17_UART3=n -CONFIG_LPC17_CAN1=n -CONFIG_LPC17_CAN2=n -CONFIG_LPC17_SPI=n -CONFIG_LPC17_SSP0=n -CONFIG_LPC17_SSP1=n -CONFIG_LPC17_I2C0=n -CONFIG_LPC17_I2C1=n -CONFIG_LPC17_I2S=n -CONFIG_LPC17_TMR0=n -CONFIG_LPC17_TMR1=n -CONFIG_LPC17_TMR2=n -CONFIG_LPC17_TMR3=n -CONFIG_LPC17_RIT=n -CONFIG_LPC17_PWM=n -CONFIG_LPC17_MCPWM=n -CONFIG_LPC17_QEI=n -CONFIG_LPC17_RTC=n -CONFIG_LPC17_WDT=n -CONFIG_LPC17_ADC=n -CONFIG_LPC17_DAC=n -CONFIG_LPC17_GPDMA=n - -# -# LPC17xx specific serial device driver settings -# -CONFIG_UART0_SERIAL_CONSOLE=y -CONFIG_UART1_SERIAL_CONSOLE=n -CONFIG_UART2_SERIAL_CONSOLE=n -CONFIG_UART3_SERIAL_CONSOLE=n - -CONFIG_UART0_TXBUFSIZE=256 -CONFIG_UART1_TXBUFSIZE=256 -CONFIG_UART2_TXBUFSIZE=256 -CONFIG_UART3_TXBUFSIZE=256 - -CONFIG_UART0_RXBUFSIZE=256 -CONFIG_UART1_RXBUFSIZE=256 -CONFIG_UART2_RXBUFSIZE=256 -CONFIG_UART3_RXBUFSIZE=256 - -CONFIG_UART0_BAUD=57600 -CONFIG_UART2_BAUD=57600 -CONFIG_UART3_BAUD=57600 -CONFIG_UART1_BAUD=57600 - -CONFIG_UART0_BITS=8 -CONFIG_UART1_BITS=8 -CONFIG_UART2_BITS=8 -CONFIG_UART3_BITS=8 - -CONFIG_UART0_PARITY=0 -CONFIG_UART1_PARITY=0 -CONFIG_UART2_PARITY=0 -CONFIG_UART3_PARITY=0 - -CONFIG_UART0_2STOP=0 -CONFIG_UART1_2STOP=0 -CONFIG_UART2_2STOP=0 -CONFIG_UART3_2STOP=0 - -# -# LPC17xx specific PHY/Ethernet device driver settings -# -CONFIG_PHY_KS8721=y -CONFIG_PHY_AUTONEG=y -CONFIG_PHY_SPEED100=n -CONFIG_PHY_FDUPLEX=y -CONFIG_NET_REGDEBUG=n - -# -# General build options -# -CONFIG_RRLOAD_BINARY=n -CONFIG_INTELHEX_BINARY=y -CONFIG_MOTOROLA_SREC=n -CONFIG_RAW_BINARY=n - -# -# General OS setup -# -CONFIG_USER_ENTRYPOINT="wlan_main" -CONFIG_DEBUG=n -CONFIG_DEBUG_VERBOSE=n -CONFIG_DEBUG_SYMBOLS=n -CONFIG_DEBUG_NET=n -CONFIG_DEBUG_USB=n -CONFIG_MM_REGIONS=2 -CONFIG_ARCH_LOWPUTC=y -CONFIG_RR_INTERVAL=200 -CONFIG_SCHED_INSTRUMENTATION=n -CONFIG_TASK_NAME_SIZE=0 -CONFIG_START_YEAR=2011 -CONFIG_START_MONTH=3 -CONFIG_START_DAY=8 -CONFIG_GREGORIAN_TIME=n -CONFIG_JULIAN_TIME=n -CONFIG_DEV_CONSOLE=y -CONFIG_DEV_LOWCONSOLE=n -CONFIG_MUTEX_TYPES=n -CONFIG_PRIORITY_INHERITANCE=n -CONFIG_SEM_PREALLOCHOLDERS=0 -CONFIG_SEM_NNESTPRIO=0 -CONFIG_FDCLONE_DISABLE=n -CONFIG_FDCLONE_STDIO=n -CONFIG_SDCLONE_DISABLE=y -CONFIG_NXFLAT=n -CONFIG_SCHED_WORKQUEUE=y -CONFIG_SCHED_WORKPRIORITY=192 -CONFIG_SCHED_WORKPERIOD=50000 -CONFIG_SCHED_WORKSTACKSIZE=1024 -CONFIG_SIG_SIGWORK=4 - -# -# The following can be used to disable categories of -# APIs supported by the OS. If the compiler supports -# weak functions, then it should not be necessary to -# disable functions unless you want to restrict usage -# of those APIs. -# -# There are certain dependency relationships in these -# features. -# -# o mq_notify logic depends on signals to awaken tasks -# waiting for queues to become full or empty. -# o pthread_condtimedwait() depends on signals to wake -# up waiting tasks. -# -CONFIG_DISABLE_CLOCK=n -CONFIG_DISABLE_POSIX_TIMERS=n -CONFIG_DISABLE_PTHREAD=n -CONFIG_DISABLE_SIGNALS=n -CONFIG_DISABLE_MQUEUE=n -CONFIG_DISABLE_MOUNTPOINT=n -CONFIG_DISABLE_ENVIRON=n -CONFIG_DISABLE_POLL=n - -# -# Misc libc settings -# -CONFIG_NOPRINTF_FIELDWIDTH=n - -# -# Allow for architecture optimized implementations -# -# The architecture can provide optimized versions of the -# following to improve system performance -# -CONFIG_ARCH_MEMCPY=n -CONFIG_ARCH_MEMCMP=n -CONFIG_ARCH_MEMMOVE=n -CONFIG_ARCH_MEMSET=n -CONFIG_ARCH_STRCMP=n -CONFIG_ARCH_STRCPY=n -CONFIG_ARCH_STRNCPY=n -CONFIG_ARCH_STRLEN=n -CONFIG_ARCH_STRNLEN=n -CONFIG_ARCH_BZERO=n - -# -# Sizes of configurable things (0 disables) -# -CONFIG_MAX_TASKS=16 -CONFIG_MAX_TASK_ARGS=4 -CONFIG_NPTHREAD_KEYS=4 -CONFIG_NFILE_DESCRIPTORS=8 -CONFIG_NFILE_STREAMS=8 -CONFIG_NAME_MAX=32 -CONFIG_STDIO_BUFFER_SIZE=256 -CONFIG_NUNGET_CHARS=2 -CONFIG_PREALLOC_MQ_MSGS=4 -CONFIG_MQ_MAXMSGSIZE=32 -CONFIG_MAX_WDOGPARMS=2 -CONFIG_PREALLOC_WDOGS=4 -CONFIG_PREALLOC_TIMERS=4 - -# -# Filesystem configuration -# -CONFIG_FS_FAT=n -CONFIG_FAT_LCNAMES=n -CONFIG_FAT_LFN=n -CONFIG_FAT_MAXFNAME=32 -CONFIG_FS_NXFFS=n -CONFIG_FS_ROMFS=n - -# -# Maintain legacy build behavior (revisit) -# - -CONFIG_MMCSD=y -CONFIG_MMCSD_SPI=y -CONFIG_MMCSD_SDIO=y - -# -# SPI-based MMC/SD driver -# -CONFIG_MMCSD_NSLOTS=1 -CONFIG_MMCSD_READONLY=n -CONFIG_MMCSD_SPICLOCK=12500000 - -# -# Block driver buffering -# -CONFIG_FS_READAHEAD=n -CONFIG_FS_WRITEBUFFER=n - -# -# SDIO-based MMC/SD driver -# -CONFIG_SDIO_DMA=n -CONFIG_MMCSD_MMCSUPPORT=n -CONFIG_MMCSD_HAVECARDDETECT=n - -# -# TCP/IP and UDP support via uIP -# -CONFIG_NET=y -CONFIG_NET_NOINTS=y -CONFIG_NET_MULTIBUFFER=y -CONFIG_NET_IPv6=n -CONFIG_NSOCKET_DESCRIPTORS=2 -CONFIG_NET_SOCKOPTS=y -CONFIG_NET_BUFSIZE=420 -CONFIG_NET_TCP=y -CONFIG_NET_TCP_CONNS=40 -CONFIG_NET_MAX_LISTENPORTS=40 -CONFIG_NET_UDP=y -CONFIG_NET_UDP_CHECKSUMS=y -#CONFIG_NET_UDP_CONNS=10 -CONFIG_NET_ICMP=n -CONFIG_NET_ICMP_PING=n -#CONFIG_NET_PINGADDRCONF=0 -CONFIG_NET_STATISTICS=y -#CONFIG_NET_RECEIVE_WINDOW= -#CONFIG_NET_ARPTAB_SIZE=8 -CONFIG_NET_BROADCAST=n -CONFIG_NET_WLAN=y - -# -# UIP Network Utilities -# -CONFIG_NET_DHCP_LIGHT=n -CONFIG_NET_RESOLV_ENTRIES=4 - -# -# USB Device Configuration -# -CONFIG_USBDEV=n -CONFIG_USBDEV_ISOCHRONOUS=n -CONFIG_USBDEV_DUALSPEED=n -CONFIG_USBDEV_SELFPOWERED=y -CONFIG_USBDEV_REMOTEWAKEUP=n -CONFIG_USBDEV_MAXPOWER=100 -CONFIG_USBDEV_TRACE=n -CONFIG_USBDEV_TRACE_NRECORDS=128 - -# -# USB Host Configuration -# -CONFIG_USBHOST=y -CONFIG_USBHOST_NPREALLOC=0 -CONFIG_USBHOST_BULK_DISABLE=n -CONFIG_USBHOST_INT_DISABLE=y -CONFIG_USBHOST_ISOC_DISABLE=y - -# -# LPC17xx USB Device Configuration -# -CONFIG_LPC17_USBDEV_FRAME_INTERRUPT=n -CONFIG_LPC17_USBDEV_EPFAST_INTERRUPT=n -CONFIG_LPC17_USBDEV_DMA=n -CONFIG_LPC17_USBDEV_NDMADESCRIPTORS=0 -CONFIG_LPC17_USBDEV_DMAINTMASK=0 - -# -# LPC17xx USB Host Configuration -# -# OHCI RAM layout: -# -CONFIG_USBHOST_OHCIRAM_SIZE=2048 -CONFIG_USBHOST_NEDS=3 -CONFIG_USBHOST_NTDS=2 -CONFIG_USBHOST_TDBUFFERS=4 -CONFIG_USBHOST_TDBUFSIZE=128 -CONFIG_USBHOST_IOBUFSIZE=448 - -# -# USB Serial Device Configuration -# -CONFIG_PL2303=n -CONFIG_PL2303_EPINTIN=1 -CONFIG_PL2303_EPBULKOUT=2 -CONFIG_PL2303_EPBULKIN=5 -CONFIG_PL2303_NWRREQS=4 -CONFIG_PL2303_NRDREQS=4 -CONFIG_PL2303_VENDORID=0x067b -CONFIG_PL2303_PRODUCTID=0x2303 -CONFIG_PL2303_VENDORSTR="Nuttx" -CONFIG_PL2303_PRODUCTSTR="USBdev Serial" -CONFIG_PL2303_RXBUFSIZE=512 -CONFIG_PL2303_TXBUFSIZE=512 - -# -# USB Storage Device Configuration -# -CONFIG_USBMSC=n -CONFIG_USBMSC_EP0MAXPACKET=64 -CONFIG_USBMSC_EPBULKOUT=2 -CONFIG_USBMSC_EPBULKIN=5 -CONFIG_USBMSC_NRDREQS=2 -CONFIG_USBMSC_NWRREQS=2 -CONFIG_USBMSC_BULKINREQLEN=256 -CONFIG_USBMSC_BULKOUTREQLEN=256 -CONFIG_USBMSC_VENDORID=0x584e -CONFIG_USBMSC_VENDORSTR="NuttX" -CONFIG_USBMSC_PRODUCTID=0x5342 -CONFIG_USBMSC_PRODUCTSTR="USBdev Storage" -CONFIG_USBMSC_VERSIONNO=0x0399 -CONFIG_USBMSC_REMOVABLE=y - -# -# Settings for examples/uip -# -CONFIG_EXAMPLES_UIP_IPADDR=0x0a000002 -CONFIG_EXAMPLES_UIP_DRIPADDR=0x0a000001 -CONFIG_EXAMPLES_UIP_NETMASK=0xffffff00 -CONFIG_EXAMPLES_UIP_DHCPC=n - -# -# Settings for examples/nettest -# -CONFIG_EXAMPLES_NETTEST_SERVER=n -CONFIG_EXAMPLES_NETTEST_PERFORMANCE=n -CONFIG_EXAMPLES_NETTEST_NOMAC=n -CONFIG_EXAMPLES_NETTEST_IPADDR=0x0a000002 -CONFIG_EXAMPLES_NETTEST_DRIPADDR=0x0a000001 -CONFIG_EXAMPLES_NETTEST_NETMASK=0xffffff00 -CONFIG_EXAMPLES_NETTEST_CLIENTIP=0x0a000001 - -# -# Settings for apps/examples/wlan -# -CONFIG_EXAMPLES_WLAN_DHCPC=n -CONFIG_EXAMPLES_WLAN_NOMAC=n -CONFIG_EXAMPLES_WLAN_IPADDR=0xc0a800c9 -CONFIG_EXAMPLES_WLAN_DRIPADDR=0xc0a80001 -CONFIG_EXAMPLES_WLAN_NETMASK=0xffffff00 - -# -# Settings for examples/ostest -# -CONFIG_EXAMPLES_OSTEST_LOOPS=1 -CONFIG_EXAMPLES_OSTEST_STACKSIZE=2048 -CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3 - -# -# Settings for apps/nshlib -# -CONFIG_NSH_FILEIOSIZE=512 -CONFIG_NSH_STRERROR=n -CONFIG_NSH_LINELEN=64 -CONFIG_NSH_NESTDEPTH=3 -CONFIG_NSH_DISABLESCRIPT=n -CONFIG_NSH_DISABLEBG=n -CONFIG_NSH_ROMFSETC=n -CONFIG_NSH_CONSOLE=y -CONFIG_NSH_TELNET=n -CONFIG_NSH_ARCHINIT=n -CONFIG_NSH_IOBUFFER_SIZE=512 -CONFIG_NSH_DHCPC=n -CONFIG_NSH_NOMAC=n -CONFIG_NSH_IPADDR=0x0a000002 -CONFIG_NSH_DRIPADDR=0x0a000001 -CONFIG_NSH_NETMASK=0xffffff00 -CONFIG_NSH_ROMFSMOUNTPT="/etc" -CONFIG_NSH_INITSCRIPT="init.d/rcS" -CONFIG_NSH_ROMFSDEVNO=0 -CONFIG_NSH_ROMFSSECTSIZE=64 -CONFIG_NSH_FATDEVNO=1 -CONFIG_NSH_FATSECTSIZE=512 -CONFIG_NSH_FATNSECTORS=1024 -CONFIG_NSH_FATMOUNTPT="/tmp" - -# -# Architecture-specific NSH options -# -CONFIG_NSH_MMCSDSPIPORTNO=0 -CONFIG_NSH_MMCSDSLOTNO=0 -CONFIG_NSH_MMCSDMINOR=0 - -# -# Settings for examples/usbserial -# -CONFIG_EXAMPLES_USBSERIAL_INONLY=n -CONFIG_EXAMPLES_USBSERIAL_OUTONLY=n -CONFIG_EXAMPLES_USBSERIAL_ONLYSMALL=n -CONFIG_EXAMPLES_USBSERIAL_ONLYBIG=n - -CONFIG_EXAMPLES_USBSERIAL_TRACEINIT=n -CONFIG_EXAMPLES_USBSERIAL_TRACECLASS=n -CONFIG_EXAMPLES_USBSERIAL_TRACETRANSFERS=n -CONFIG_EXAMPLES_USBSERIAL_TRACECONTROLLER=n -CONFIG_EXAMPLES_USBSERIAL_TRACEINTERRUPTS=n - -# -# Stack and heap information -# -CONFIG_BOOT_RUNFROMFLASH=n -CONFIG_BOOT_COPYTORAM=n -CONFIG_CUSTOM_STACK=n -CONFIG_IDLETHREAD_STACKSIZE=1024 -CONFIG_USERMAIN_STACKSIZE=2048 -CONFIG_PTHREAD_STACK_MIN=256 -CONFIG_PTHREAD_STACK_DEFAULT=2048 -CONFIG_HEAP_BASE= -CONFIG_HEAP_SIZE= - -# -# USB WLAN device identification -# -CONFIG_USB_WLAN_VID=0x0bda -CONFIG_USB_WLAN_PID=0x8189 diff --git a/nuttx/configs/olimex-lpc1766stk/wlan/setenv.sh b/nuttx/configs/olimex-lpc1766stk/wlan/setenv.sh deleted file mode 100755 index 767614612b..0000000000 --- a/nuttx/configs/olimex-lpc1766stk/wlan/setenv.sh +++ /dev/null @@ -1,73 +0,0 @@ -#!/bin/bash -# configs/olimex-lpc1766stk/wlan/setenv.sh -# -# Copyright (C) 2011 Gregory Nutt. All rights reserved. -# Author: Gregory Nutt -# -# 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. -# - -if [ "$_" = "$0" ] ; then - echo "You must source this script, not run it!" 1>&2 - exit 1 -fi - -WD=`pwd` -if [ ! -x "setenv.sh" ]; then - echo "This script must be executed from the top-level NuttX build directory" - exit 1 -fi - -if [ -z "${PATH_ORIG}" ]; then - export PATH_ORIG="${PATH}" -fi - -# This is the Cygwin path to the location where I installed the CodeSourcery -# toolchain under windows. You will also have to edit this if you install -# the CodeSourcery toolchain in any other location -# export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/CodeSourcery/Sourcery G++ Lite/bin" - -# These are the Cygwin paths to the locations where I installed the Atollic -# toolchain under windows. You will also have to edit this if you install -# the Atollic toolchain in any other location. /usr/bin is added before -# the Atollic bin path because there is are binaries named gcc.exe and g++.exe -# at those locations as well. -#export TOOLCHAIN_BIN="/usr/bin:/cygdrive/c/Program Files (x86)/Atollic/TrueSTUDIO for ARM Pro 2.3.0/ARMTools/bin" -#export TOOLCHAIN_BIN="/usr/bin:/cygdrive/c/Program Files (x86)/Atollic/TrueSTUDIO for STMicroelectronics STM32 Lite 2.3.0/ARMTools/bin" - -# This is the Cygwin path to the location where I build the buildroot -# toolchain. -export TOOLCHAIN_BIN="${WD}/../misc/buildroot/build_arm_nofpu/staging_dir/bin" - -# The Olimex-lpc1766stk/tools directory -export LPCTOOL_DIR="${WD}/configs/olimex-lpc1766stk/tools" - -# Add the path to the toolchain and tools directory to the PATH varialble -export PATH="${TOOLCHAIN_BIN}:${LPCTOOL_DIR}:/sbin:/usr/sbin:${PATH_ORIG}" - -echo "PATH : ${PATH}" From 29da58a677ffc192c61b29f8c1d53216b1c68ebe Mon Sep 17 00:00:00 2001 From: patacongo Date: Tue, 1 Jan 2013 14:55:01 +0000 Subject: [PATCH 022/118] Updates from Darcy Gong for UG-2864SWEG01 OLED git-svn-id: http://svn.code.sf.net/p/nuttx/code/trunk@5469 42af7a65-404d-4744-a932-0658087f49c3 --- nuttx/ChangeLog | 4 +- nuttx/configs/stm32f4discovery/README.txt | 21 ++++-- .../src/stm32f4discovery-internal.h | 5 +- nuttx/configs/stm32f4discovery/src/up_spi.c | 28 ++++--- .../stm32f4discovery/src/up_ug2864ambag01.c | 2 +- .../stm32f4discovery/src/up_ug2864hsweg01.c | 6 +- nuttx/drivers/lcd/ug-2864ambag01.c | 4 +- nuttx/drivers/lcd/ug-2864hsweg01.c | 73 +++++++++++++++---- 8 files changed, 101 insertions(+), 42 deletions(-) diff --git a/nuttx/ChangeLog b/nuttx/ChangeLog index 80b4bde1dd..9fd5619fdd 100644 --- a/nuttx/ChangeLog +++ b/nuttx/ChangeLog @@ -3845,6 +3845,8 @@ * configs/zp214xpa/nxlines: Add an nxlines configuration for the ZP213x/4xPA (with the LPC2148 and the UG_2864AMBAG01). Working as of 2012-12-30. - * config/olimex-lpc1766stk/wlan: Remove non-functional + * configs/olimex-lpc1766stk/wlan: Remove non-functional configuration. + * configs/stm32f4discovery/src and nuttx/drivers/lcd/ug-2864hsweg01.c: + Updates and correctinos for the UG-2864HSWEG01 from Darcy Gong. diff --git a/nuttx/configs/stm32f4discovery/README.txt b/nuttx/configs/stm32f4discovery/README.txt index 37dae7b9ea..571385abb3 100644 --- a/nuttx/configs/stm32f4discovery/README.txt +++ b/nuttx/configs/stm32f4discovery/README.txt @@ -20,7 +20,7 @@ Contents - FPU - FSMC SRAM - SSD1289 - - UG-2864AMBAG01 + - UG-2864AMBAG01 / UG-2964SWEG01 - STM32F4Discovery-specific Configuration Options - Configurations @@ -696,10 +696,10 @@ The following summarize the bit banging oprations: WriteData(data); } -UG-2864AMBAG01 -============== +UG-2864AMBAG01 / UG-2964SWEG01 +============================== -I purchased an OLED display on eBay. The OLDE is 128x64 monochrome and +I purchased an OLED display on eBay. The OLED is 128x64 monochrome and is based on an UG-2864AMBAG01 OLED controller. The OLED can run in either parallel or SPI mode. I am using SPI mode. In SPI mode, the OLED is write only so the driver keeps a 128*64/8 = 1KB framebuffer to remember @@ -729,6 +729,10 @@ that I am using: (1) Required because of on-board MEMS ------------------------------------------------------------------------- +Darcy Gong recently added support for the UG-2964SWEG01 OLED which is also +an option with this configuratin. I have little technical information about +the UG-2964SWEG01 interface (see configs/stm32f4discovery/src/up_ug2864sweg01.c). + STM32F4Discovery-specific Configuration Options =============================================== @@ -1347,9 +1351,10 @@ Where is one of the following: b. Execute 'make menuconfig' in nuttx/ in order to start the reconfiguration process. - 3. This configured can be re-configured to use the UG-2864AMBAG01 - 0.96 inch OLED by adding or changing the following items int - the configuration (using 'make menuconfig'): + 3. This configured can be re-configured to use either the + UG-2864AMBAG01 or UG-2864SWEG01 0.96 inch OLEDs by adding + or changing the following items in the configuration (using + 'make menuconfig'): +CONFIG_SPI_CMDDATA=y @@ -1360,7 +1365,7 @@ Where is one of the following: -CONFIG_LCD_SSD1289=y -CONFIG_SSD1289_PROFILE1=y - +CONFIG_LCD_UG2864AMBAG01=y + +CONFIG_LCD_UG2864AMBAG01=y : For the UG-2964AMBAG01 +CONFIG_UG2864AMBAG01_SPIMODE=3 +CONFIG_UG2864AMBAG01_FREQUENCY=3500000 +CONFIG_UG2864AMBAG01_NINTERFACES=1 diff --git a/nuttx/configs/stm32f4discovery/src/stm32f4discovery-internal.h b/nuttx/configs/stm32f4discovery/src/stm32f4discovery-internal.h index eae09594c5..7027b639b8 100644 --- a/nuttx/configs/stm32f4discovery/src/stm32f4discovery-internal.h +++ b/nuttx/configs/stm32f4discovery/src/stm32f4discovery-internal.h @@ -113,7 +113,7 @@ # define GPIO_OTGFS_OVER (GPIO_INPUT|GPIO_FLOAT|GPIO_SPEED_100MHz|GPIO_PUSHPULL|GPIO_PORTD|GPIO_PIN5) #endif -/* UG-2864AMBAG01 or UG-2864HSWEG01 OLED Display: +/* UG-2864AMBAG01 or UG-2864HSWEG01 OLED Display (SPI 4-wire): * * --------------------------+---------------------------------------------- * Connector CON10 J1: | STM32F4Discovery @@ -123,7 +123,7 @@ * 1 3v3 | 3,4 3v3 | P2 3V * 3 /RESET | 8 /RESET | P2 PB6 (Arbitrary selection) * 5 /CS | 7 /CS | P2 PB7 (Arbitrary selection) - * 7 A0 | 9 A0 | P2 PB8 (Arbitrary selection) + * 7 A0|D/C | 9 A0|D/C | P2 PB8 (Arbitrary selection) * 9 LED+ (N/C) | ----- | ----- * 2 5V Vcc | 1,2 Vcc | P2 5V * 4 DI | 18 D1/SI | P1 PA7 (GPIO_SPI1_MOSI == GPIO_SPI1_MOSI_1 (1)) @@ -142,6 +142,7 @@ GPIO_OUTPUT_SET|GPIO_PORTB|GPIO_PIN7) # define GPIO_OLED_A0 (GPIO_OUTPUT|GPIO_PUSHPULL|GPIO_SPEED_50MHz|\ GPIO_OUTPUT_CLEAR|GPIO_PORTB|GPIO_PIN8) +# define GPIO_OLED_DC GPIO_OLED_A0 #endif /**************************************************************************************************** diff --git a/nuttx/configs/stm32f4discovery/src/up_spi.c b/nuttx/configs/stm32f4discovery/src/up_spi.c index 7ef3138fdd..5b812d50c5 100644 --- a/nuttx/configs/stm32f4discovery/src/up_spi.c +++ b/nuttx/configs/stm32f4discovery/src/up_spi.c @@ -96,11 +96,16 @@ void weak_function stm32_spiinitialize(void) { #ifdef CONFIG_STM32_SPI1 - (void)stm32_configgpio(GPIO_CS_MEMS); + (void)stm32_configgpio(GPIO_CS_MEMS); /* MEMS chip select */ #endif -#ifdef CONFIG_LCD_UG2864AMBAG01 +#if defined(CONFIG_LCD_UG2864AMBAG01) || defined(CONFIG_LCD_UG2864HSWEG01) (void)stm32_configgpio(GPIO_OLED_CS); /* OLED chip select */ +# if defined(CONFIG_LCD_UG2864AMBAG01) (void)stm32_configgpio(GPIO_OLED_A0); /* OLED Command/Data */ +# endif +# if defined(CONFIG_LCD_UG2864HSWEG01) + (void)stm32_configgpio(GPIO_OLED_DC); /* OLED Command/Data */ +# endif #endif } @@ -134,7 +139,7 @@ void stm32_spi1select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool sele { spidbg("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert"); -#ifdef CONFIG_LCD_UG2864AMBAG01 +#if defined(CONFIG_LCD_UG2864AMBAG01) || defined(CONFIG_LCD_UG2864HSWEG01) if (devid == SPIDEV_DISPLAY) { stm32_gpiowrite(GPIO_OLED_CS, !selected); @@ -180,9 +185,9 @@ uint8_t stm32_spi3status(FAR struct spi_dev_s *dev, enum spi_dev_e devid) * Name: stm32_spi1cmddata * * Description: - * Set or clear the SD1329 D/Cn bit to select data (true) or command - * (false). This function must be provided by platform-specific logic. - * This is an implementation of the cmddata method of the SPI + * Set or clear the SH1101A A0 or SD1306 D/C n bit to select data (true) + * or command (false). This function must be provided by platform-specific + * logic. This is an implementation of the cmddata method of the SPI * interface defined by struct spi_ops_s (see include/nuttx/spi.h). * * Input Parameters: @@ -203,18 +208,23 @@ uint8_t stm32_spi3status(FAR struct spi_dev_s *dev, enum spi_dev_e devid) #ifdef CONFIG_STM32_SPI1 int stm32_spi1cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd) { -#ifdef CONFIG_LCD_UG2864AMBAG01 +#if defined(CONFIG_LCD_UG2864AMBAG01) || defined(CONFIG_LCD_UG2864HSWEG01) if (devid == SPIDEV_DISPLAY) { /* "This is the Data/Command control pad which determines whether the * data bits are data or a command. * - * A0 = “H”: the inputs at D0 to D7 are treated as display data. - * A0 = “L”: the inputs at D0 to D7 are transferred to the command + * A0 = "H": the inputs at D0 to D7 are treated as display data. + * A0 = "L": the inputs at D0 to D7 are transferred to the command * registers." */ +# if defined(CONFIG_LCD_UG2864AMBAG01) (void)stm32_gpiowrite(GPIO_OLED_A0, !cmd); +# endif +# if defined(CONFIG_LCD_UG2864HSWEG01) + (void)stm32_gpiowrite(GPIO_OLED_DC, !cmd); +# endif return OK; } #endif diff --git a/nuttx/configs/stm32f4discovery/src/up_ug2864ambag01.c b/nuttx/configs/stm32f4discovery/src/up_ug2864ambag01.c index 2f21331168..42ad0c2a5e 100644 --- a/nuttx/configs/stm32f4discovery/src/up_ug2864ambag01.c +++ b/nuttx/configs/stm32f4discovery/src/up_ug2864ambag01.c @@ -66,7 +66,7 @@ #endif /* Pin Configuration ********************************************************/ -/* UG-2864AMBAG01 OLED Display: +/* UG-2864AMBAG01 OLED Display (SPI 4-wire): * * --------------------------+---------------------------------------------- * Connector CON10 J1: | STM32F4Discovery diff --git a/nuttx/configs/stm32f4discovery/src/up_ug2864hsweg01.c b/nuttx/configs/stm32f4discovery/src/up_ug2864hsweg01.c index 4eee077a14..b6fe354d30 100644 --- a/nuttx/configs/stm32f4discovery/src/up_ug2864hsweg01.c +++ b/nuttx/configs/stm32f4discovery/src/up_ug2864hsweg01.c @@ -66,7 +66,7 @@ #endif /* Pin Configuration ********************************************************/ -/* UG-2864AMBAG01 or UG-2864HSWEG01 OLED Display: +/* UG-2864HSWEG01 OLED Display (SPI 4-wire): * * --------------------------+---------------------------------------------- * Connector CON10 J1: | STM32F4Discovery @@ -76,7 +76,7 @@ * 1 3v3 | 3,4 3v3 | P2 3V * 3 /RESET | 8 /RESET | P2 PB6 (Arbitrary selection) * 5 /CS | 7 /CS | P2 PB7 (Arbitrary selection)(2) - * 7 A0 | 9 A0 | P2 PB8 (Arbitrary selection)(2) + * 7 D/C | 9 D/C | P2 PB8 (Arbitrary selection)(2) * 9 LED+ (N/C) | ----- | ----- * 2 5V Vcc | 1,2 Vcc | P2 5V * 4 DI | 18 D1/SI | P1 PA7 (GPIO_SPI1_MOSI == GPIO_SPI1_MOSI_1 (1)) @@ -85,7 +85,7 @@ * 10 GND | 20 GND | P2 GND * --------------+-----------+---------------------------------------------- * (1) Required because of on-board MEMS - * (2) Note that the OLED CS and A0 are managed in the up_spi.c file. + * (2) Note that the OLED CS and D/C are managed in the up_spi.c file. * ------------------------------------------------------------------------- */ diff --git a/nuttx/drivers/lcd/ug-2864ambag01.c b/nuttx/drivers/lcd/ug-2864ambag01.c index ca1d4c1234..6b3d6d5a84 100644 --- a/nuttx/drivers/lcd/ug-2864ambag01.c +++ b/nuttx/drivers/lcd/ug-2864ambag01.c @@ -428,7 +428,7 @@ static inline void ug2864ambag01_configspi(FAR struct spi_dev_s *spi) SPI_SETMODE(spi, CONFIG_UG2864AMBAG01_SPIMODE); SPI_SETBITS(spi, 8); - SPI_SETFREQUENCY(spi, CONFIG_UG2864AMBAG01_FREQUENCY) + SPI_SETFREQUENCY(spi, CONFIG_UG2864AMBAG01_FREQUENCY); } #endif @@ -1035,7 +1035,7 @@ FAR struct lcd_dev_s *ug2864ambag01_initialize(FAR struct spi_dev_s *spi, unsign /* Configure the SPI */ - ug2864ambag01_configspi(spi) + ug2864ambag01_configspi(spi); /* Lock and select device */ diff --git a/nuttx/drivers/lcd/ug-2864hsweg01.c b/nuttx/drivers/lcd/ug-2864hsweg01.c index 9f9f999066..02a59b104e 100644 --- a/nuttx/drivers/lcd/ug-2864hsweg01.c +++ b/nuttx/drivers/lcd/ug-2864hsweg01.c @@ -434,7 +434,7 @@ static inline void ug2864hsweg01_configspi(FAR struct spi_dev_s *spi) SPI_SETMODE(spi, CONFIG_UG2864HSWEG01_SPIMODE); SPI_SETBITS(spi, 8); - SPI_SETFREQUENCY(spi, CONFIG_UG2864HSWEG01_FREQUENCY) + SPI_SETFREQUENCY(spi, CONFIG_UG2864HSWEG01_FREQUENCY); } #endif @@ -1041,7 +1041,7 @@ FAR struct lcd_dev_s *ug2864hsweg01_initialize(FAR struct spi_dev_s *spi, unsign /* Configure the SPI */ - ug2864hsweg01_configspi(spi) + ug2864hsweg01_configspi(spi); /* Lock and select device */ @@ -1052,40 +1052,81 @@ FAR struct lcd_dev_s *ug2864hsweg01_initialize(FAR struct spi_dev_s *spi, unsign SPI_CMDDATA(spi, SPIDEV_DISPLAY, true); + /* Configure OLED SPI or I/O, must be delayed 1-10ms */ + + up_mdelay(5); + /* Configure the device */ +//#define OLED_WriteCmd(v) SPI_SEND(spi,v) +// +// /* Module manufacturers to provide initialization code Ä£¿é³§¼ÒÌṩ³õʼ»¯´úÂë */ +// +// OLED_WriteCmd(0xAE); /* ¹Ø±ÕOLEDÃæ°åÏÔʾ(ÐÝÃß) */ +// OLED_WriteCmd(0x00); /* ÉèÖÃÁеØÖ·µÍ4bit */ +// OLED_WriteCmd(0x10); /* ÉèÖÃÁеØÖ·¸ß4bit */ +// OLED_WriteCmd(0x40); /* ÉèÖÃÆðʼÐеØÖ·£¨µÍ5bit 0-63£©£¬ Ó²¼þÏà¹Ø*/ +// +// OLED_WriteCmd(0x81); /* ÉèÖöԱȶÈÃüÁî(Ë«×Ö½ÚÃüÁ£¬µÚ1¸ö×Ö½ÚÊÇÃüÁµÚ2¸ö×Ö½ÚÊǶԱȶȲÎÊý0-255 */ +// OLED_WriteCmd(0xCF); /* ÉèÖöԱȶȲÎÊý */ +// +// OLED_WriteCmd(0xA1); /* A0 £ºÁеØÖ·0Ó³Éäµ½SEG0; A1 £ºÁеØÖ·127Ó³Éäµ½SEG0 */ +// OLED_WriteCmd(0xA6); /* A6 : ÉèÖÃÕý³£ÏÔʾģʽ; A7 : ÉèÖÃΪ·´ÏÔģʽ */ +// +// OLED_WriteCmd(0xA8); /* ÉèÖÃCOM·Êý */ +// OLED_WriteCmd(0x3F); /* 1 ->£¨63+1£©Â· */ +// +// OLED_WriteCmd(0xD3); /* ÉèÖÃÏÔÊ¾Æ«ÒÆ£¨Ë«×Ö½ÚÃüÁ*/ +// OLED_WriteCmd(0x00); /* ÎÞÆ«ÒÆ */ +// +// OLED_WriteCmd(0xD5); /* ÉèÖÃÏÔʾʱÖÓ·ÖÆµÏµÊý/Õñµ´ÆµÂÊ */ +// OLED_WriteCmd(0x80); /* ÉèÖÃ·ÖÆµÏµÊý,¸ß4bitÊÇ·ÖÆµÏµÊý£¬µÍ4bitÊÇÕñµ´ÆµÂÊ */ +// +// OLED_WriteCmd(0xD9); /* ÉèÖÃÔ¤³äµçÖÜÆÚ */ +// OLED_WriteCmd(0xF1); /* [3:0],PHASE 1; [7:4],PHASE 2; */ +// +// OLED_WriteCmd(0xDA); /* ÉèÖÃCOM½ÅÓ²¼þ½ÓÏß·½Ê½ */ +// OLED_WriteCmd(0x12); +// +// OLED_WriteCmd(0xDB); /* ÉèÖà vcomh µçѹ±¶ÂÊ */ +// OLED_WriteCmd(0x40); /* [6:4] 000 = 0.65 x VCC; 0.77 x VCC (RESET); 0.83 x VCC */ +// +// OLED_WriteCmd(0x8D); /* ÉèÖóäµç±Ã£¨ºÍϸöÃüÁî½áºÏʹÓã© */ +// OLED_WriteCmd(0x14); /* 0x14 ʹÄܳäµç±Ã£¬ 0x10 ÊÇ¹Ø±Õ */ +// OLED_WriteCmd(0xAF); /* ´ò¿ªOLEDÃæ°å */ + SPI_SEND(spi, SSD1306_DISPOFF); /* Display off 0xAE*/ SPI_SEND(spi, SSD1306_SETCOLL(0)); /* Set lower column address 0x00 */ SPI_SEND(spi, SSD1306_SETCOLH(0)); /* Set higher column address 0x10 */ SPI_SEND(spi, SSD1306_STARTLINE(0)); /* Set display start line 0x40*/ - SPI_SEND(spi, SSD1306_PAGEADDR(0)); /* Set page address [¿ÉºöÂÔ] */ + /* SPI_SEND(spi, SSD1306_PAGEADDR(0));*//* Set page address (Can ignore)*/ SPI_SEND(spi, SSD1306_CONTRAST_MODE); /* Contrast control 0x81*/ SPI_SEND(spi ,SSD1306_CONTRAST(UG2864HSWEG01_CONTRAST)); /* Default contrast 0xCF */ SPI_SEND(spi, SSD1306_REMAPPLEFT); /* Set segment remap left 95 to 0 | 0xA1*/ - SPI_SEND(spi, SSD1306_EDISPOFF); /* Normal display :off 0xA4 [¶à³öµÄÒ»ÐÐ] */ + /* SPI_SEND(spi, SSD1306_EDISPOFF); */ /* Normal display :off 0xA4 (Can ignore)*/ SPI_SEND(spi, SSD1306_NORMAL); /* Normal (un-reversed) display mode 0xA6 */ SPI_SEND(spi, SSD1306_MRATIO_MODE); /* Multiplex ratio 0xA8*/ SPI_SEND(spi, SSD1306_MRATIO(0x3f)); /* Duty = 1/64 */ - SPI_SEND(spi, SSD1306_SCANTOCOM0); /* Com scan direction: Scan from COM[n-1] to COM[0] [¿ÉºöÂÔ] */ + /* SPI_SEND(spi, SSD1306_SCANTOCOM0);*/ /* Com scan direction: Scan from COM[n-1] to COM[0] (Can ignore)*/ SPI_SEND(spi, SSD1306_DISPOFFS_MODE); /* Set display offset 0xD3 */ SPI_SEND(spi, SSD1306_DISPOFFS(0)); SPI_SEND(spi, SSD1306_CLKDIV_SET); /* Set clock divider 0xD5*/ - SPI_SEND(spi, SSD1306_CLKDIV(8,0)); /* 0x80 ? ¼ì²é ĬÈÏ0,0*/ - + SPI_SEND(spi, SSD1306_CLKDIV(8,0)); /* 0x80*/ + SPI_SEND(spi, SSD1306_CHRGPER_SET); /* ++Set pre-charge period 0xD9*/ - SPI_SEND(spi, SSD1306_CHRGPER(0x0f,1)); /* 0xf1 or 0x22£¨Ôöǿģʽ£¿£© */ - + SPI_SEND(spi, SSD1306_CHRGPER(0x0f,1)); /* 0xf1 or 0x22£¨Enhanced mode?£© */ + SPI_SEND(spi, SSD1306_CMNPAD_CONFIG); /* Set common pads / set com pins hardware configuration 0xDA*/ - SPI_SEND(spi, SSD1306_CMNPAD(0x12)); /* 0x12 ? ¼ì²é ĬÈÏ 0x10 */ - - SPI_SEND(spi, SSD1306_VCOM_SET); /* set vcomh 0xDB*/ + SPI_SEND(spi, SSD1306_CMNPAD(0x12)); /* 0x12 */ + + SPI_SEND(spi, SSD1306_VCOM_SET); /* set vcomh 0xDB*/ SPI_SEND(spi, SSD1306_VCOM(0x40)); - SPI_SEND(spi, SSD1306_CHRPUMP_SET); /* ++Set Charge Pump enable/disable 0x8D Ôö¼ÓµÄ*/ - SPI_SEND(spi, SSD1306_CHRPUMP_ON); /* 0x14 */ + SPI_SEND(spi, SSD1306_CHRPUMP_SET); /* ++Set Charge Pump enable/disable 0x8D ssd1306*/ + SPI_SEND(spi, SSD1306_CHRPUMP_ON); /* 0x14 close 0x10 */ - //SPI_SEND(spi, SSD1306_DCDC_MODE); /* DC/DC control mode: on */ - //SPI_SEND(spi, SSD1306_DCDC_ON); + /*SPI_SEND(spi, SSD1306_DCDC_MODE); */ /* DC/DC control mode: on (SSD1306 Not supported) */ + /*SPI_SEND(spi, SSD1306_DCDC_ON); */ SPI_SEND(spi, SSD1306_DISPON); /* display ON 0xAF */ From 41731a71efe2bca6fdc3490eff7af1e6fbcb6a3c Mon Sep 17 00:00:00 2001 From: patacongo Date: Tue, 1 Jan 2013 16:33:47 +0000 Subject: [PATCH 023/118] All lm3s6965-ek configurations converted to use kconfig-frontends git-svn-id: http://svn.code.sf.net/p/nuttx/code/trunk@5470 42af7a65-404d-4744-a932-0658087f49c3 --- nuttx/ChangeLog | 2 + nuttx/arch/arm/src/lm3s/Kconfig | 140 ++++ nuttx/configs/lm3s6965-ek/README.txt | 59 +- nuttx/configs/lm3s6965-ek/nsh/appconfig | 58 -- nuttx/configs/lm3s6965-ek/nsh/defconfig | 892 ++++++++++++++------- nuttx/configs/lm3s6965-ek/nx/appconfig | 39 - nuttx/configs/lm3s6965-ek/nx/defconfig | 800 +++++++++++------- nuttx/configs/lm3s6965-ek/ostest/appconfig | 39 - nuttx/configs/lm3s6965-ek/ostest/defconfig | 765 +++++++++++------- 9 files changed, 1760 insertions(+), 1034 deletions(-) delete mode 100644 nuttx/configs/lm3s6965-ek/nsh/appconfig delete mode 100644 nuttx/configs/lm3s6965-ek/nx/appconfig delete mode 100644 nuttx/configs/lm3s6965-ek/ostest/appconfig diff --git a/nuttx/ChangeLog b/nuttx/ChangeLog index 9fd5619fdd..7f2bda4579 100644 --- a/nuttx/ChangeLog +++ b/nuttx/ChangeLog @@ -3849,4 +3849,6 @@ configuration. * configs/stm32f4discovery/src and nuttx/drivers/lcd/ug-2864hsweg01.c: Updates and correctinos for the UG-2864HSWEG01 from Darcy Gong. + * configs/lm326965-ek: All configurations converted to use the + kconfig-frontends configuration tool. diff --git a/nuttx/arch/arm/src/lm3s/Kconfig b/nuttx/arch/arm/src/lm3s/Kconfig index 469ff1fc91..aaf8342fa6 100644 --- a/nuttx/arch/arm/src/lm3s/Kconfig +++ b/nuttx/arch/arm/src/lm3s/Kconfig @@ -12,6 +12,7 @@ choice config ARCH_CHIP_LM3S6918 bool "LM3S6918" + select LM3S_HAVE_SSI1 config ARCH_CHIP_LM3S9B96 bool "LM3S9B96" @@ -27,33 +28,172 @@ config ARCH_CHIP_LM3S8962 endchoice +config LM3S_HAVE_SSI1 + bool + +config LM3S_REVA2 + bool "Rev A2" + default n + ---help--- + Some early silicon returned an increase LDO voltage or 2.75V to work + around a PLL bug + config LM3S_DFU bool "DFU" default y +menu "Select LM3S Peripheral Support" + +config LM3S_UART0 + bool "UART0" + select ARCH_HAVE_UART0 + default n + +config LM3S_UART1 + bool "UART1" + select ARCH_HAVE_UART1 + default n + +config SSI0_DISABLE + bool "Disable SSI0" + default y + +config SSI1_DISABLE + bool "Disable SSI1" + default y + +config LM3S_UART2 + bool "UART2" + select ARCH_HAVE_UART2 + default n + +config LM3S_ETHERNET + bool "LM3S Ethernet" + default n + ---help--- + This must be set (along with NET) to build the LM3S Ethernet driver. + +endmenu + +menu "Disable GPIO Interrupts" + config LM3S_DISABLE_GPIOA_IRQS bool "Disable GPIOA IRQs" + default n config LM3S_DISABLE_GPIOB_IRQS bool "Disable GPIOB IRQs" + default n config LM3S_DISABLE_GPIOC_IRQS bool "Disable GPIOC IRQs" + default n config LM3S_DISABLE_GPIOD_IRQS bool "Disable GPIOD IRQs" + default n config LM3S_DISABLE_GPIOE_IRQS bool "Disable GPIOE IRQs" + default n config LM3S_DISABLE_GPIOF_IRQS bool "Disable GPIOF IRQs" + default n config LM3S_DISABLE_GPIOG_IRQS bool "Disable GPIOG IRQs" + default n config LM3S_DISABLE_GPIOH_IRQS bool "Disable GPIOH IRQs" + default n config LM3S_DISABLE_GPIOJ_IRQS bool "Disable GPIOJ IRQs" + default n + +endmenu + +if LM3S_ETHERNET +menu "LM3S Ethernet Configuration" + +config LM3S_ETHLEDS + bool "Ethernet LEDs" + default n + ---help--- + Enable to use Ethernet LEDs on the board. + +config LM3S_BOARDMAC + bool "Board MAC" + default n + ---help--- + If the board-specific logic can provide a MAC address (via + lm3s_ethernetmac()), then this should be selected. + +config LM3S_ETHHDUPLEX + bool "Force Half Duplex" + default n + ---help--- + Set to force half duplex operation + +config LM3S_ETHNOAUTOCRC + bool "Disable auto-CRC" + default n + ---help--- + Set to suppress auto-CRC generation + +config LM3S_ETHNOPAD + bool "Disable Tx Padding" + default n + ---help--- + Set to suppress Tx padding + +config LM3S_MULTICAST + bool "Enable Multicast" + default n + ---help--- + Set to enable multicast frames + +config LM3S_PROMISCUOUS + bool "Enable Promiscuous Mode" + default n + ---help--- + Set to enable promiscuous mode + +config LM3S_TIMESTAMP + bool "Enable Timestamping" + default n + +config LM3S_BADCRC + bool "Enable Bad CRC Rejection" + default n + ---help--- + Set to enable bad CRC rejection. + +config M3S_DUMPPACKET + bool "Dump Packets" + default n + ---help--- + Dump each packet received/sent to the console. + +endmenu +endif + +if !SSI0_DISABLE || !SSI1_DISABLE +menu "LM3S SSI Configuration" + +config SSI_POLLWAIT + bool "Poll Wait (No-Interrupt) Mode" + default y + +config SSI_TXLIMIT + int "Tx Limit" + default 4 + ---help--- + Default of 4 assumes half of the 8 entry FIFO + +endmenu +endif + + diff --git a/nuttx/configs/lm3s6965-ek/README.txt b/nuttx/configs/lm3s6965-ek/README.txt index 1e3aed2d95..09a07ec685 100644 --- a/nuttx/configs/lm3s6965-ek/README.txt +++ b/nuttx/configs/lm3s6965-ek/README.txt @@ -478,21 +478,68 @@ Where is one of the following: Configures the NuttShell (nsh) located at examples/nsh. The Configuration enables both the serial and telnetd NSH interfaces. - NOTE: As it is configured now, you MUST have a network connected. - Otherwise, the NSH prompt will not come up because the Ethernet - driver is waiting for the network to come up. That is probably - a bug in the Ethernet driver behavior! + NOTES: + 1. This configuration uses the mconf-based configuration tool. To + change this configuration using that tool, you should: - Network File System (NFS) support can be added by setting the - following in your configuration file: + a. Build and install the mconf tool. See nuttx/README.txt and + misc/tools/ + + b. Execute 'make menuconfig' in nuttx/ in order to start the + reconfiguration process. + + 2. Default platform/toolchain: + + CONFIG_HOST_LINUX=y : Linux (Cygwin under Windows okay too). + CONFIG_ARMV7M_TOOLCHAIN_BUILDROOT=y : Buildroot (arm-nuttx-elf-gcc) + CONFIG_RAW_BINARY=y : Output formats: ELF and raw binary + + 3. As it is configured now, you MUST have a network connected. + Otherwise, the NSH prompt will not come up because the Ethernet + driver is waiting for the network to come up. That is probably + a bug in the Ethernet driver behavior! + + 4. Network File System (NFS) support can be added by setting the + following in your configuration file: CONFIG_NFS=y + nx: And example using the NuttX graphics system (NX). This example uses the P14201 OLED driver. + NOTES: + 1. This configuration uses the mconf-based configuration tool. To + change this configuration using that tool, you should: + + a. Build and install the mconf tool. See nuttx/README.txt and + misc/tools/ + + b. Execute 'make menuconfig' in nuttx/ in order to start the + reconfiguration process. + + 2. Default platform/toolchain: + + CONFIG_HOST_LINUX=y : Linux (Cygwin under Windows okay too). + CONFIG_ARMV7M_TOOLCHAIN_BUILDROOT=y : Buildroot (arm-nuttx-elf-gcc) + CONFIG_RAW_BINARY=y : Output formats: ELF and raw binary + ostest: This configuration directory, performs a simple OS test using examples/ostest. + NOTES: + 1. This configuration uses the mconf-based configuration tool. To + change this configuration using that tool, you should: + a. Build and install the mconf tool. See nuttx/README.txt and + misc/tools/ + + b. Execute 'make menuconfig' in nuttx/ in order to start the + reconfiguration process. + + 2. Default platform/toolchain: + + CONFIG_HOST_LINUX=y : Linux (Cygwin under Windows okay too). + CONFIG_ARMV7M_TOOLCHAIN_BUILDROOT=y : Buildroot (arm-nuttx-elf-gcc) + CONFIG_RAW_BINARY=y : Output formats: ELF and raw binary diff --git a/nuttx/configs/lm3s6965-ek/nsh/appconfig b/nuttx/configs/lm3s6965-ek/nsh/appconfig deleted file mode 100644 index 6277056d00..0000000000 --- a/nuttx/configs/lm3s6965-ek/nsh/appconfig +++ /dev/null @@ -1,58 +0,0 @@ -############################################################################ -# configs/lm3s6965-ek/nsh/appconfig -# -# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved. -# Author: Gregory Nutt -# -# 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. -# -############################################################################ - -# Path to example in apps/examples containing the user_start entry point - -CONFIGURED_APPS += examples/nsh - -# NSH library - -CONFIGURED_APPS += system/readline -CONFIGURED_APPS += nshlib - -# Networking support - -ifeq ($(CONFIG_NET),y) -CONFIGURED_APPS += netutils/uiplib -CONFIGURED_APPS += netutils/dhcpc -CONFIGURED_APPS += netutils/resolv -CONFIGURED_APPS += netutils/tftpc -CONFIGURED_APPS += netutils/webclient -ifeq ($(CONFIG_NSH_TELNET),y) -CONFIGURED_APPS += netutils/telnetd -endif -endif - - diff --git a/nuttx/configs/lm3s6965-ek/nsh/defconfig b/nuttx/configs/lm3s6965-ek/nsh/defconfig index 7b75178eab..84651012d6 100755 --- a/nuttx/configs/lm3s6965-ek/nsh/defconfig +++ b/nuttx/configs/lm3s6965-ek/nsh/defconfig @@ -1,213 +1,231 @@ -############################################################################ -# configs/lm3s6965-ek/nsh/defconfig # -# Copyright (C) 2010 Gregory Nutt. All rights reserved. -# Author: Gregory Nutt +# Automatically generated file; DO NOT EDIT. +# Nuttx/ Configuration # -# 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. -# -############################################################################ -# -# Architecture Selection -# -CONFIG_ARCH="arm" -CONFIG_ARCH_ARM=y -CONFIG_ARCH_CORTEXM3=y -CONFIG_ARCH_CHIP="lm3s" -CONFIG_ARCH_CHIP_LM3S=y -CONFIG_ARCH_CHIP_LM3S6965=y -CONFIG_ARCH_BOARD="lm3s6965-ek" -CONFIG_ARCH_BOARD_LM3S6965EK=y -CONFIG_BOARD_LOOPSPERMSEC=4531 -CONFIG_DRAM_SIZE=65536 -CONFIG_DRAM_START=0x20000000 -CONFIG_ARCH_IRQPRIO=y -CONFIG_ARCH_INTERRUPTSTACK=0 -CONFIG_ARCH_STACKDUMP=y -CONFIG_ARCH_LEDS=y -CONFIG_ARCH_CALIBRATION=n +CONFIG_NUTTX_NEWCONFIG=y # -# Identify toolchain and linker options +# Build Setup # -CONFIG_LM3S_CODESOURCERYW=n -CONFIG_LM3S_CODESOURCERYL=n -CONFIG_LM3S_DEVKITARM=n -CONFIG_LM3S_BUILDROOT=y +# CONFIG_EXPERIMENTAL is not set +CONFIG_HOST_LINUX=y +# CONFIG_HOST_OSX is not set +# CONFIG_HOST_WINDOWS is not set +# CONFIG_HOST_OTHER is not set + +# +# Build Configuration +# +# CONFIG_APPS_DIR="../apps" +# CONFIG_BUILD_2PASS is not set + +# +# Binary Output Formats +# +# CONFIG_RRLOAD_BINARY is not set +# CONFIG_INTELHEX_BINARY is not set +# CONFIG_MOTOROLA_SREC is not set +CONFIG_RAW_BINARY=y + +# +# Customize Header Files +# +# CONFIG_ARCH_STDBOOL_H is not set +# CONFIG_ARCH_MATH_H is not set +# CONFIG_ARCH_FLOAT_H is not set +# CONFIG_ARCH_STDARG_H is not set + +# +# Debug Options +# +# CONFIG_DEBUG is not set +# CONFIG_DEBUG_SYMBOLS is not set + +# +# System Type +# +# CONFIG_ARCH_8051 is not set +CONFIG_ARCH_ARM=y +# CONFIG_ARCH_AVR is not set +# CONFIG_ARCH_HC is not set +# CONFIG_ARCH_MIPS is not set +# CONFIG_ARCH_RGMP is not set +# CONFIG_ARCH_SH is not set +# CONFIG_ARCH_SIM is not set +# CONFIG_ARCH_X86 is not set +# CONFIG_ARCH_Z16 is not set +# CONFIG_ARCH_Z80 is not set +CONFIG_ARCH="arm" + +# +# ARM Options +# +# CONFIG_ARCH_CHIP_C5471 is not set +# CONFIG_ARCH_CHIP_CALYPSO is not set +# CONFIG_ARCH_CHIP_DM320 is not set +# CONFIG_ARCH_CHIP_IMX is not set +# CONFIG_ARCH_CHIP_KINETIS is not set +CONFIG_ARCH_CHIP_LM3S=y +# CONFIG_ARCH_CHIP_LPC17XX is not set +# CONFIG_ARCH_CHIP_LPC214X is not set +# CONFIG_ARCH_CHIP_LPC2378 is not set +# CONFIG_ARCH_CHIP_LPC31XX is not set +# CONFIG_ARCH_CHIP_LPC43XX is not set +# CONFIG_ARCH_CHIP_SAM3U is not set +# CONFIG_ARCH_CHIP_STM32 is not set +# CONFIG_ARCH_CHIP_STR71X is not set +CONFIG_ARCH_CORTEXM3=y +CONFIG_ARCH_FAMILY="armv7-m" +CONFIG_ARCH_CHIP="lm3s" +CONFIG_ARCH_HAVE_MPU=y +# CONFIG_ARMV7M_MPU is not set +CONFIG_BOARD_LOOPSPERMSEC=4531 +# CONFIG_ARCH_CALIBRATION is not set + +# +# ARMV7M Configuration Options +# +CONFIG_ARMV7M_TOOLCHAIN_BUILDROOT=y +# CONFIG_ARMV7M_TOOLCHAIN_CODEREDL is not set +# CONFIG_ARMV7M_TOOLCHAIN_CODESOURCERYL is not set +# CONFIG_ARMV7M_TOOLCHAIN_GNU_EABI is not set + +# +# LM3S Configuration Options +# +# CONFIG_ARCH_CHIP_LM3S6918 is not set +# CONFIG_ARCH_CHIP_LM3S9B96 is not set +# CONFIG_ARCH_CHIP_LM3S6432 is not set +CONFIG_ARCH_CHIP_LM3S6965=y +# CONFIG_ARCH_CHIP_LM3S8962 is not set +# CONFIG_LM3S_REVA2 is not set CONFIG_LM3S_DFU=y # -# Disable support for interrupts on GPIOH and GPIOJ which do not -# exist on the LM3S6B96. Additional interrupt support can be -# disabled if desired to reduce memory footprint. -CONFIG_LM3S_DISABLE_GPIOA_IRQS=n -CONFIG_LM3S_DISABLE_GPIOB_IRQS=n -CONFIG_LM3S_DISABLE_GPIOC_IRQS=n -CONFIG_LM3S_DISABLE_GPIOD_IRQS=n -CONFIG_LM3S_DISABLE_GPIOE_IRQS=n -CONFIG_LM3S_DISABLE_GPIOF_IRQS=n -CONFIG_LM3S_DISABLE_GPIOG_IRQS=n +# Select LM3S Peripheral Support +# +CONFIG_LM3S_UART0=y +# CONFIG_LM3S_UART1 is not set +# CONFIG_SSI0_DISABLE is not set +CONFIG_SSI1_DISABLE=y +# CONFIG_LM3S_UART2 is not set +CONFIG_LM3S_ETHERNET=y + +# +# Disable GPIO Interrupts +# +# CONFIG_LM3S_DISABLE_GPIOA_IRQS is not set +# CONFIG_LM3S_DISABLE_GPIOB_IRQS is not set +# CONFIG_LM3S_DISABLE_GPIOC_IRQS is not set +# CONFIG_LM3S_DISABLE_GPIOD_IRQS is not set +# CONFIG_LM3S_DISABLE_GPIOE_IRQS is not set +# CONFIG_LM3S_DISABLE_GPIOF_IRQS is not set +# CONFIG_LM3S_DISABLE_GPIOG_IRQS is not set CONFIG_LM3S_DISABLE_GPIOH_IRQS=y CONFIG_LM3S_DISABLE_GPIOJ_IRQS=y # -# LM3S6965 specific serial device driver settings +# LM3S Ethernet Configuration # -CONFIG_LM3S_UART0=y -CONFIG_LM3S_UART1=n -CONFIG_LM3S_UART2=n -CONFIG_UART0_SERIAL_CONSOLE=y -CONFIG_UART1_SERIAL_CONSOLE=n -CONFIG_UART2_SERIAL_CONSOLE=n -CONFIG_UART0_TXBUFSIZE=256 -CONFIG_UART1_TXBUFSIZE=256 -CONFIG_UART2_TXBUFSIZE=256 -CONFIG_UART0_RXBUFSIZE=256 -CONFIG_UART1_RXBUFSIZE=256 -CONFIG_UART2_RXBUFSIZE=256 -CONFIG_UART0_BAUD=115200 -CONFIG_UART1_BAUD=115200 -CONFIG_UART2_BAUD=115200 -CONFIG_UART0_BITS=8 -CONFIG_UART1_BITS=8 -CONFIG_UART2_BITS=8 -CONFIG_UART0_PARITY=0 -CONFIG_UART1_PARITY=0 -CONFIG_UART2_PARITY=0 -CONFIG_UART0_2STOP=0 -CONFIG_UART1_2STOP=0 -CONFIG_UART2_2STOP=0 +# CONFIG_LM3S_ETHLEDS is not set +# CONFIG_LM3S_BOARDMAC is not set +# CONFIG_LM3S_ETHHDUPLEX is not set +# CONFIG_LM3S_ETHNOAUTOCRC is not set +# CONFIG_LM3S_ETHNOPAD is not set +# CONFIG_LM3S_MULTICAST is not set +# CONFIG_LM3S_PROMISCUOUS is not set +# CONFIG_LM3S_TIMESTAMP is not set +# CONFIG_LM3S_BADCRC is not set +# CONFIG_M3S_DUMPPACKET is not set # -# LM3S6965 specific SSI device driver settings +# LM3S SSI Configuration # -CONFIG_SSI0_DISABLE=n -CONFIG_SSI1_DISABLE=y CONFIG_SSI_POLLWAIT=y -#CONFIG_SSI_TXLIMIT=4 +CONFIG_SSI_TXLIMIT=4 +# CONFIG_NET_MULTICAST is not set +# CONFIG_SDIO_DMA is not set +# CONFIG_SDIO_WIDTH_D1_ONLY is not set # -# LM3S6965 specific serial device driver settings +# Architecture Options # -CONFIG_LM3S_ETHERNET=y -CONFIG_LM3S_ETHLEDS=n -CONFIG_LM3S_BOARDMAC=n -CONFIG_LM3S_ETHHDUPLEX=n -CONFIG_LM3S_ETHNOAUTOCRC=n -CONFIG_LM3S_ETHNOPAD=n -CONFIG_LM3S_MULTICAST=n -CONFIG_LM3S_PROMISCUOUS=n -CONFIG_LM3S_BADCRC=n -CONFIG_LM3S_DUMPPACKET=n +# CONFIG_ARCH_NOINTC is not set +# CONFIG_ARCH_DMA is not set +CONFIG_ARCH_IRQPRIO=y +# CONFIG_CUSTOM_STACK is not set +# CONFIG_ADDRENV is not set +CONFIG_ARCH_STACKDUMP=y +# CONFIG_ENDIAN_BIG is not set # -# General build options +# Board Settings # -CONFIG_RRLOAD_BINARY=n -CONFIG_INTELHEX_BINARY=n -CONFIG_MOTOROLA_SREC=n -CONFIG_RAW_BINARY=y +CONFIG_DRAM_START=0x20000000 +CONFIG_DRAM_SIZE=65536 +CONFIG_ARCH_HAVE_INTERRUPTSTACK=y +CONFIG_ARCH_INTERRUPTSTACK=0 # -# General OS setup +# Boot options # -CONFIG_USER_ENTRYPOINT="nsh_main" -CONFIG_DEBUG=n -CONFIG_DEBUG_VERBOSE=n -CONFIG_DEBUG_SYMBOLS=n -CONFIG_DEBUG_NET=n -CONFIG_MM_REGIONS=1 -CONFIG_ARCH_LOWPUTC=y +# CONFIG_BOOT_RUNFROMEXTSRAM is not set +CONFIG_BOOT_RUNFROMFLASH=y +# CONFIG_BOOT_RUNFROMISRAM is not set +# CONFIG_BOOT_RUNFROMSDRAM is not set +# CONFIG_BOOT_COPYTORAM is not set + +# +# Board Selection +# +CONFIG_ARCH_BOARD_LM3S6965EK=y +# CONFIG_ARCH_BOARD_CUSTOM is not set +CONFIG_ARCH_BOARD="lm3s6965-ek" + +# +# Common Board Options +# +CONFIG_ARCH_HAVE_LEDS=y +CONFIG_ARCH_LEDS=y +CONFIG_NSH_MMCSDMINOR=0 +CONFIG_NSH_MMCSDSLOTNO=0 + +# +# Board-Specific Options +# + +# +# RTOS Features +# +CONFIG_MSEC_PER_TICK=10 CONFIG_RR_INTERVAL=200 -CONFIG_SCHED_INSTRUMENTATION=n +# CONFIG_SCHED_INSTRUMENTATION is not set CONFIG_TASK_NAME_SIZE=0 +# CONFIG_JULIAN_TIME is not set CONFIG_START_YEAR=2010 CONFIG_START_MONTH=5 CONFIG_START_DAY=8 -CONFIG_GREGORIAN_TIME=n -CONFIG_JULIAN_TIME=n CONFIG_DEV_CONSOLE=y -CONFIG_DEV_LOWCONSOLE=n -CONFIG_MUTEX_TYPES=n -CONFIG_PRIORITY_INHERITANCE=n -CONFIG_SEM_PREALLOCHOLDERS=0 -CONFIG_SEM_NNESTPRIO=0 -CONFIG_FDCLONE_DISABLE=n -CONFIG_FDCLONE_STDIO=n +# CONFIG_MUTEX_TYPES is not set +# CONFIG_PRIORITY_INHERITANCE is not set +# CONFIG_FDCLONE_DISABLE is not set +# CONFIG_FDCLONE_STDIO is not set CONFIG_SDCLONE_DISABLE=y -CONFIG_NXFLAT=n - -# -# The following can be used to disable categories of -# APIs supported by the OS. If the compiler supports -# weak functions, then it should not be necessary to -# disable functions unless you want to restrict usage -# of those APIs. -# -# There are certain dependency relationships in these -# features. -# -# o mq_notify logic depends on signals to awaken tasks -# waiting for queues to become full or empty. -# o pthread_condtimedwait() depends on signals to wake -# up waiting tasks. -# -CONFIG_DISABLE_CLOCK=n -CONFIG_DISABLE_POSIX_TIMERS=n -CONFIG_DISABLE_PTHREAD=n -CONFIG_DISABLE_SIGNALS=n -CONFIG_DISABLE_MQUEUE=n -CONFIG_DISABLE_MOUNTPOINT=n -CONFIG_DISABLE_ENVIRON=n +# CONFIG_SCHED_WORKQUEUE is not set +# CONFIG_SCHED_WAITPID is not set +# CONFIG_SCHED_ATEXIT is not set +# CONFIG_SCHED_ONEXIT is not set +CONFIG_USER_ENTRYPOINT="nsh_main" +CONFIG_DISABLE_OS_API=y +# CONFIG_DISABLE_CLOCK is not set +# CONFIG_DISABLE_POSIX_TIMERS is not set +# CONFIG_DISABLE_PTHREAD is not set +# CONFIG_DISABLE_SIGNALS is not set +# CONFIG_DISABLE_MQUEUE is not set +# CONFIG_DISABLE_MOUNTPOINT is not set +# CONFIG_DISABLE_ENVIRON is not set CONFIG_DISABLE_POLL=y -# -# Misc libc settings -# -CONFIG_NOPRINTF_FIELDWIDTH=n - -# -# Allow for architecture optimized implementations -# -# The architecture can provide optimized versions of the -# following to improve system performance -# -CONFIG_ARCH_MEMCPY=n -CONFIG_ARCH_MEMCMP=n -CONFIG_ARCH_MEMMOVE=n -CONFIG_ARCH_MEMSET=n -CONFIG_ARCH_STRCMP=n -CONFIG_ARCH_STRCPY=n -CONFIG_ARCH_STRNCPY=n -CONFIG_ARCH_STRLEN=n -CONFIG_ARCH_STRNLEN=n -CONFIG_ARCH_BZERO=n - # # Sizes of configurable things (0 disables) # @@ -217,135 +235,421 @@ CONFIG_NPTHREAD_KEYS=4 CONFIG_NFILE_DESCRIPTORS=8 CONFIG_NFILE_STREAMS=8 CONFIG_NAME_MAX=32 -CONFIG_STDIO_BUFFER_SIZE=256 -CONFIG_NUNGET_CHARS=2 CONFIG_PREALLOC_MQ_MSGS=4 CONFIG_MQ_MAXMSGSIZE=32 CONFIG_MAX_WDOGPARMS=2 CONFIG_PREALLOC_WDOGS=4 CONFIG_PREALLOC_TIMERS=4 -# -# Filesystem configuration -# -CONFIG_FS_FAT=y -CONFIG_FS_ROMFS=n -CONFIG_NFS=n - -# -# Maintain legacy build behavior (revisit) -# - -CONFIG_MMCSD=y -CONFIG_MMCSD_SPI=y -CONFIG_MMCSD_SDIO=y - -# -# SPI-based MMC/SD driver -# -CONFIG_MMCSD_NSLOTS=1 -CONFIG_MMCSD_READONLY=n -CONFIG_MMCSD_SPICLOCK=12500000 - -# -# TCP/IP and UDP support via uIP -# -CONFIG_NET=y -CONFIG_NET_IPv6=n -CONFIG_NSOCKET_DESCRIPTORS=8 -CONFIG_NET_SOCKOPTS=y -CONFIG_NET_BUFSIZE=562 -CONFIG_NET_TCP=y -CONFIG_NET_TCP_CONNS=8 -CONFIG_NET_NTCP_READAHEAD_BUFFERS=16 -CONFIG_NET_TCPBACKLOG=n -CONFIG_NET_MAX_LISTENPORTS=8 -CONFIG_NET_UDP=y -CONFIG_NET_UDP_CHECKSUMS=y -#CONFIG_NET_UDP_CONNS=8 -CONFIG_NET_ICMP=y -CONFIG_NET_ICMP_PING=y -#CONFIG_NET_PINGADDRCONF=0 -CONFIG_NET_STATISTICS=y -#CONFIG_NET_RECEIVE_WINDOW= -#CONFIG_NET_ARPTAB_SIZE=8 -CONFIG_NET_BROADCAST=n - -# -# UIP Network Utilities -# -CONFIG_NET_DHCP_LIGHT=n -CONFIG_NET_RESOLV_ENTRIES=4 - -# -# Settings for examples/uip -# -CONFIG_EXAMPLES_UIP_IPADDR=0x0a000002 -CONFIG_EXAMPLES_UIP_DRIPADDR=0x0a000001 -CONFIG_EXAMPLES_UIP_NETMASK=0xffffff00 -CONFIG_EXAMPLES_UIP_DHCPC=n - -# -# Settings for examples/nettest -CONFIG_EXAMPLES_NETTEST_SERVER=n -CONFIG_EXAMPLES_NETTEST_PERFORMANCE=n -CONFIG_EXAMPLES_NETTEST_NOMAC=n -CONFIG_EXAMPLES_NETTEST_IPADDR=0x0a000002 -CONFIG_EXAMPLES_NETTEST_DRIPADDR=0x0a000001 -CONFIG_EXAMPLES_NETTEST_NETMASK=0xffffff00 -CONFIG_EXAMPLES_NETTEST_CLIENTIP=0x0a000001 - -# -# Settings for examples/ostest -# -CONFIG_EXAMPLES_OSTEST_LOOPS=1 -CONFIG_EXAMPLES_OSTEST_STACKSIZE=2048 -CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3 - -# -# Settings for apps/nshlib -# -CONFIG_NSH_FILEIOSIZE=512 -CONFIG_NSH_STRERROR=n -CONFIG_NSH_LINELEN=64 -CONFIG_NSH_NESTDEPTH=3 -CONFIG_NSH_DISABLESCRIPT=n -CONFIG_NSH_DISABLEBG=n -CONFIG_NSH_ROMFSETC=n -CONFIG_NSH_CONSOLE=y -CONFIG_NSH_TELNET=y -CONFIG_NSH_ARCHINIT=y -CONFIG_NSH_IOBUFFER_SIZE=512 -CONFIG_NSH_DHCPC=n -CONFIG_NSH_NOMAC=y -CONFIG_NSH_IPADDR=0x0a000002 -CONFIG_NSH_DRIPADDR=0x0a000001 -CONFIG_NSH_NETMASK=0xffffff00 -CONFIG_NSH_ROMFSMOUNTPT="/etc" -CONFIG_NSH_INITSCRIPT="init.d/rcS" -CONFIG_NSH_ROMFSDEVNO=0 -CONFIG_NSH_ROMFSSECTSIZE=64 -CONFIG_NSH_FATDEVNO=1 -CONFIG_NSH_FATSECTSIZE=512 -CONFIG_NSH_FATNSECTORS=1024 -CONFIG_NSH_FATMOUNTPT="/tmp" - -# -# Architecture-specific NSH options -# -CONFIG_NSH_MMCSDSPIPORTNO=0 -CONFIG_NSH_MMCSDSLOTNO=0 -CONFIG_NSH_MMCSDMINOR=0 - # # Stack and heap information # -CONFIG_BOOT_RUNFROMFLASH=n -CONFIG_BOOT_COPYTORAM=n -CONFIG_CUSTOM_STACK=n CONFIG_IDLETHREAD_STACKSIZE=1024 CONFIG_USERMAIN_STACKSIZE=2048 CONFIG_PTHREAD_STACK_MIN=256 CONFIG_PTHREAD_STACK_DEFAULT=2048 -CONFIG_HEAP_BASE= -CONFIG_HEAP_SIZE= + +# +# Device Drivers +# +CONFIG_DEV_NULL=y +# CONFIG_DEV_ZERO is not set +# CONFIG_LOOP is not set +# CONFIG_RAMDISK is not set +# CONFIG_CAN is not set +# CONFIG_PWM is not set +# CONFIG_I2C is not set +# CONFIG_SPI is not set +# CONFIG_RTC is not set +# CONFIG_WATCHDOG is not set +# CONFIG_ANALOG is not set +# CONFIG_BCH is not set +# CONFIG_INPUT is not set +# CONFIG_LCD is not set +CONFIG_MMCSD=y +CONFIG_MMCSD_NSLOTS=1 +# CONFIG_MMCSD_READONLY is not set +# CONFIG_MMCSD_MULTIBLOCK_DISABLE is not set +CONFIG_MMCSD_MMCSUPPORT=y +CONFIG_MMCSD_HAVECARDDETECT=y +CONFIG_MMCSD_SPI=y +CONFIG_MMCSD_SPICLOCK=12500000 +CONFIG_MMCSD_SDIO=y +# CONFIG_SDIO_MUXBUS is not set +# CONFIG_MTD is not set +# CONFIG_NETDEVICES is not set +# CONFIG_NET_SLIP is not set +# CONFIG_PIPES is not set +# CONFIG_PM is not set +# CONFIG_POWER is not set +# CONFIG_SENSORS is not set +# CONFIG_SERCOMM_CONSOLE is not set +CONFIG_SERIAL=y +# CONFIG_DEV_LOWCONSOLE is not set +# CONFIG_16550_UART is not set +CONFIG_ARCH_HAVE_UART0=y +CONFIG_MCU_SERIAL=y +CONFIG_STANDARD_SERIAL=y +CONFIG_UART0_SERIAL_CONSOLE=y +# CONFIG_NO_SERIAL_CONSOLE is not set + +# +# UART0 Configuration +# +CONFIG_UART0_RXBUFSIZE=256 +CONFIG_UART0_TXBUFSIZE=256 +CONFIG_UART0_BAUD=115200 +CONFIG_UART0_BITS=8 +CONFIG_UART0_PARITY=0 +CONFIG_UART0_2STOP=0 +# CONFIG_USBDEV is not set +# CONFIG_USBHOST is not set +# CONFIG_WIRELESS is not set + +# +# System Logging Device Options +# + +# +# System Logging +# +# CONFIG_RAMLOG is not set + +# +# Networking Support +# +CONFIG_NET=y +# CONFIG_NET_NOINTS is not set +# CONFIG_NET_MULTIBUFFER is not set +# CONFIG_NET_IPv6 is not set +CONFIG_NSOCKET_DESCRIPTORS=8 +CONFIG_NET_NACTIVESOCKETS=16 +CONFIG_NET_SOCKOPTS=y +CONFIG_NET_BUFSIZE=562 +# CONFIG_NET_TCPURGDATA is not set +CONFIG_NET_TCP=y +CONFIG_NET_TCP_CONNS=8 +CONFIG_NET_MAX_LISTENPORTS=8 +CONFIG_NET_TCP_READAHEAD_BUFSIZE=562 +CONFIG_NET_NTCP_READAHEAD_BUFFERS=16 +CONFIG_NET_TCP_RECVDELAY=0 +# CONFIG_NET_TCPBACKLOG is not set +CONFIG_NET_UDP=y +CONFIG_NET_UDP_CHECKSUMS=y +CONFIG_NET_UDP_CONNS=8 +# CONFIG_NET_BROADCAST is not set +CONFIG_NET_ICMP=y +CONFIG_NET_ICMP_PING=y +# CONFIG_NET_PINGADDRCONF is not set +# CONFIG_NET_IGMP is not set +CONFIG_NET_STATISTICS=y +CONFIG_NET_RECEIVE_WINDOW=562 +CONFIG_NET_ARPTAB_SIZE=16 +# CONFIG_NET_ARP_IPIN is not set + +# +# File Systems +# + +# +# File system configuration +# +CONFIG_FS_FAT=y +# CONFIG_FAT_LCNAMES is not set +# CONFIG_FAT_LFN is not set +# CONFIG_FS_FATTIME is not set +# CONFIG_FAT_DMAMEMORY is not set +# CONFIG_FS_RAMMAP is not set +# CONFIG_NFS is not set +# CONFIG_FS_NXFFS is not set +# CONFIG_FS_ROMFS is not set + +# +# System Logging +# +# CONFIG_SYSLOG is not set + +# +# Graphics Support +# +# CONFIG_NX is not set + +# +# Memory Management +# +# CONFIG_MM_SMALL is not set +CONFIG_MM_REGIONS=1 +# CONFIG_GRAN is not set + +# +# Binary Formats +# +# CONFIG_BINFMT_DISABLE is not set +# CONFIG_BINFMT_EXEPATH is not set +# CONFIG_NXFLAT is not set +# CONFIG_ELF is not set +# CONFIG_PIC is not set +# CONFIG_SYMTAB_ORDEREDBYNAME is not set + +# +# Library Routines +# + +# +# Standard C Library Options +# +CONFIG_STDIO_BUFFER_SIZE=256 +CONFIG_STDIO_LINEBUFFER=y +CONFIG_NUNGET_CHARS=2 +CONFIG_LIB_HOMEDIR="/" +# CONFIG_LIBM is not set +# CONFIG_NOPRINTF_FIELDWIDTH is not set +# CONFIG_LIBC_FLOATINGPOINT is not set +# CONFIG_EOL_IS_CR is not set +# CONFIG_EOL_IS_LF is not set +# CONFIG_EOL_IS_BOTH_CRLF is not set +CONFIG_EOL_IS_EITHER_CRLF=y +# CONFIG_LIBC_STRERROR is not set +# CONFIG_LIBC_PERROR_STDOUT is not set +CONFIG_ARCH_LOWPUTC=y +CONFIG_LIB_SENDFILE_BUFSIZE=512 +# CONFIG_ARCH_ROMGETC is not set +# CONFIG_ARCH_OPTIMIZED_FUNCTIONS is not set + +# +# Non-standard Helper Functions +# +CONFIG_LIB_KBDCODEC=y + +# +# Basic CXX Support +# +# CONFIG_C99_BOOL8 is not set +# CONFIG_HAVE_CXX is not set + +# +# Application Configuration +# + +# +# Built-In Applications +# +# CONFIG_BUILTIN is not set + +# +# Examples +# +# CONFIG_EXAMPLES_BUTTONS is not set +# CONFIG_EXAMPLES_CAN is not set +# CONFIG_EXAMPLES_CDCACM is not set +# CONFIG_EXAMPLES_COMPOSITE is not set +# CONFIG_EXAMPLES_DHCPD is not set +# CONFIG_EXAMPLES_ELF is not set +# CONFIG_EXAMPLES_FTPC is not set +# CONFIG_EXAMPLES_FTPD is not set +# CONFIG_EXAMPLES_HELLO is not set +# CONFIG_EXAMPLES_HELLOXX is not set +# CONFIG_EXAMPLES_JSON is not set +# CONFIG_EXAMPLES_HIDKBD is not set +# CONFIG_EXAMPLES_KEYPADTEST is not set +# CONFIG_EXAMPLES_IGMP is not set +# CONFIG_EXAMPLES_LCDRW is not set +# CONFIG_EXAMPLES_MM is not set +# CONFIG_EXAMPLES_MOUNT is not set +# CONFIG_EXAMPLES_MODBUS is not set +# CONFIG_EXAMPLES_NETTEST is not set +CONFIG_EXAMPLES_NSH=y +# CONFIG_EXAMPLES_NULL is not set +# CONFIG_EXAMPLES_NX is not set +# CONFIG_EXAMPLES_NXCONSOLE is not set +# CONFIG_EXAMPLES_NXFFS is not set +# CONFIG_EXAMPLES_NXFLAT is not set +# CONFIG_EXAMPLES_NXHELLO is not set +# CONFIG_EXAMPLES_NXIMAGE is not set +# CONFIG_EXAMPLES_NXLINES is not set +# CONFIG_EXAMPLES_NXTEXT is not set +# CONFIG_EXAMPLES_OSTEST is not set +# CONFIG_EXAMPLES_PASHELLO is not set +# CONFIG_EXAMPLES_PIPE is not set +# CONFIG_EXAMPLES_POLL is not set +# CONFIG_EXAMPLES_QENCODER is not set +# CONFIG_EXAMPLES_RGMP is not set +# CONFIG_EXAMPLES_ROMFS is not set +# CONFIG_EXAMPLES_SENDMAIL is not set +# CONFIG_EXAMPLES_SERLOOP is not set +# CONFIG_EXAMPLES_TELNETD is not set +# CONFIG_EXAMPLES_THTTPD is not set +# CONFIG_EXAMPLES_TIFF is not set +# CONFIG_EXAMPLES_TOUCHSCREEN is not set +# CONFIG_EXAMPLES_UDP is not set +# CONFIG_EXAMPLES_DISCOVER is not set +# CONFIG_EXAMPLES_UIP is not set +# CONFIG_EXAMPLES_USBSERIAL is not set +# CONFIG_EXAMPLES_USBMSC is not set +# CONFIG_EXAMPLES_USBTERM is not set +# CONFIG_EXAMPLES_WATCHDOG is not set +# CONFIG_EXAMPLES_WGET is not set + +# +# Interpreters +# + +# +# Interpreters +# +# CONFIG_INTERPRETERS_FICL is not set +# CONFIG_INTERPRETERS_PCODE is not set + +# +# Network Utilities +# + +# +# Networking Utilities +# +# CONFIG_NETUTILS_CODECS is not set +CONFIG_NETUTILS_DHCPC=y +# CONFIG_NETUTILS_DHCPD is not set +# CONFIG_NETUTILS_FTPC is not set +# CONFIG_NETUTILS_FTPD is not set +# CONFIG_NETUTILS_JSON is not set +CONFIG_NETUTILS_RESOLV=y +CONFIG_NET_RESOLV_ENTRIES=4 +CONFIG_NET_RESOLV_MAXRESPONSE=96 +# CONFIG_NETUTILS_SMTP is not set +CONFIG_NETUTILS_TELNETD=y +CONFIG_NETUTILS_TFTPC=y +# CONFIG_NETUTILS_THTTPD is not set +CONFIG_NETUTILS_UIPLIB=y +CONFIG_NETUTILS_WEBCLIENT=y +CONFIG_NSH_WGET_USERAGENT="NuttX/6.xx.x (; http://www.nuttx.org/)" +# CONFIG_NETUTILS_WEBSERVER is not set +# CONFIG_NETUTILS_DISCOVER is not set +# CONFIG_NETUTILS_XMLRPC is not set + +# +# ModBus +# + +# +# FreeModbus +# +# CONFIG_MODBUS is not set + +# +# NSH Library +# +CONFIG_NSH_LIBRARY=y + +# +# Disable Individual commands +# +# CONFIG_NSH_DISABLE_CAT is not set +# CONFIG_NSH_DISABLE_CD is not set +# CONFIG_NSH_DISABLE_CP is not set +# CONFIG_NSH_DISABLE_DD is not set +# CONFIG_NSH_DISABLE_ECHO is not set +# CONFIG_NSH_DISABLE_EXEC is not set +# CONFIG_NSH_DISABLE_EXIT is not set +# CONFIG_NSH_DISABLE_FREE is not set +# CONFIG_NSH_DISABLE_GET is not set +# CONFIG_NSH_DISABLE_HELP is not set +# CONFIG_NSH_DISABLE_HEXDUMP is not set +# CONFIG_NSH_DISABLE_IFCONFIG is not set +# CONFIG_NSH_DISABLE_KILL is not set +# CONFIG_NSH_DISABLE_LOSETUP is not set +# CONFIG_NSH_DISABLE_LS is not set +# CONFIG_NSH_DISABLE_MB is not set +# CONFIG_NSH_DISABLE_MKDIR is not set +# CONFIG_NSH_DISABLE_MKFATFS is not set +# CONFIG_NSH_DISABLE_MKFIFO is not set +# CONFIG_NSH_DISABLE_MKRD is not set +# CONFIG_NSH_DISABLE_MH is not set +# CONFIG_NSH_DISABLE_MOUNT is not set +# CONFIG_NSH_DISABLE_MW is not set +# CONFIG_NSH_DISABLE_NSFMOUNT is not set +# CONFIG_NSH_DISABLE_PS is not set +# CONFIG_NSH_DISABLE_PING is not set +# CONFIG_NSH_DISABLE_PUT is not set +# CONFIG_NSH_DISABLE_PWD is not set +# CONFIG_NSH_DISABLE_RM is not set +# CONFIG_NSH_DISABLE_RMDIR is not set +# CONFIG_NSH_DISABLE_SET is not set +# CONFIG_NSH_DISABLE_SH is not set +# CONFIG_NSH_DISABLE_SLEEP is not set +# CONFIG_NSH_DISABLE_TEST is not set +# CONFIG_NSH_DISABLE_UMOUNT is not set +# CONFIG_NSH_DISABLE_UNSET is not set +# CONFIG_NSH_DISABLE_USLEEP is not set +# CONFIG_NSH_DISABLE_WGET is not set +# CONFIG_NSH_DISABLE_XD is not set +CONFIG_NSH_CODECS_BUFSIZE=128 +CONFIG_NSH_FILEIOSIZE=512 +CONFIG_NSH_LINELEN=64 +CONFIG_NSH_NESTDEPTH=3 +# CONFIG_NSH_DISABLESCRIPT is not set +# CONFIG_NSH_DISABLEBG is not set +CONFIG_NSH_CONSOLE=y +# CONFIG_NSH_CONDEV is not set +CONFIG_NSH_ARCHINIT=y +CONFIG_NSH_TELNET=y +CONFIG_NSH_TELNETD_PORT=23 +CONFIG_NSH_TELNETD_DAEMONPRIO=100 +CONFIG_NSH_TELNETD_DAEMONSTACKSIZE=2048 +CONFIG_NSH_TELNETD_CLIENTPRIO=100 +CONFIG_NSH_TELNETD_CLIENTSTACKSIZE=2048 +CONFIG_NSH_IOBUFFER_SIZE=512 +# CONFIG_NSH_TELNET_LOGIN is not set +CONFIG_NSH_IPADDR=0x0a000002 +CONFIG_NSH_DRIPADDR=0x0a000001 +CONFIG_NSH_NETMASK=0xffffff00 +CONFIG_NSH_NOMAC=y +CONFIG_NSH_MAX_ROUNDTRIP=20 + +# +# NxWidgets/NxWM +# + +# +# System NSH Add-Ons +# + +# +# Custom Free Memory Command +# +# CONFIG_SYSTEM_FREE is not set + +# +# I2C tool +# + +# +# FLASH Program Installation +# +# CONFIG_SYSTEM_INSTALL is not set + +# +# readline() +# +CONFIG_SYSTEM_READLINE=y +CONFIG_READLINE_ECHO=y + +# +# Power Off +# +# CONFIG_SYSTEM_POWEROFF is not set + +# +# RAMTRON +# +# CONFIG_SYSTEM_RAMTRON is not set + +# +# SD Card +# +# CONFIG_SYSTEM_SDCARD is not set + +# +# Sysinfo +# +# CONFIG_SYSTEM_SYSINFO is not set diff --git a/nuttx/configs/lm3s6965-ek/nx/appconfig b/nuttx/configs/lm3s6965-ek/nx/appconfig deleted file mode 100644 index 69f92ce3a5..0000000000 --- a/nuttx/configs/lm3s6965-ek/nx/appconfig +++ /dev/null @@ -1,39 +0,0 @@ -############################################################################ -# configs/lm3s6965-ek/nx/appconfig -# -# Copyright (C) 2011 Gregory Nutt. All rights reserved. -# Author: Gregory Nutt -# -# 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. -# -############################################################################ - -# Path to example in apps/examples containing the user_start entry point - -CONFIGURED_APPS += examples/nx - diff --git a/nuttx/configs/lm3s6965-ek/nx/defconfig b/nuttx/configs/lm3s6965-ek/nx/defconfig index bca864013d..5fb666e65b 100755 --- a/nuttx/configs/lm3s6965-ek/nx/defconfig +++ b/nuttx/configs/lm3s6965-ek/nx/defconfig @@ -1,219 +1,212 @@ -############################################################################ -# configs/lm3s6965-ek/nx/defconfig # -# Copyright (C) 2010 Gregory Nutt. All rights reserved. -# Author: Gregory Nutt +# Automatically generated file; DO NOT EDIT. +# Nuttx/ Configuration # -# 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. -# -############################################################################ -# -# Architecture Selection -# -CONFIG_ARCH="arm" -CONFIG_ARCH_ARM=y -CONFIG_ARCH_CORTEXM3=y -CONFIG_ARCH_CHIP="lm3s" -CONFIG_ARCH_CHIP_LM3S=y -CONFIG_ARCH_CHIP_LM3S6965=y -CONFIG_ARCH_BOARD="lm3s6965-ek" -CONFIG_ARCH_BOARD_LM3S6965EK=y -CONFIG_BOARD_LOOPSPERMSEC=4531 -CONFIG_DRAM_SIZE=65536 -CONFIG_DRAM_START=0x20000000 -CONFIG_ARCH_IRQPRIO=y -CONFIG_ARCH_INTERRUPTSTACK=0 -CONFIG_ARCH_STACKDUMP=y -CONFIG_ARCH_LEDS=y -CONFIG_ARCH_CALIBRATION=n +CONFIG_NUTTX_NEWCONFIG=y # -# Identify toolchain and linker options +# Build Setup # -CONFIG_LM3S_CODESOURCERYW=n -CONFIG_LM3S_CODESOURCERYL=n -CONFIG_LM3S_DEVKITARM=n -CONFIG_LM3S_BUILDROOT=y +# CONFIG_EXPERIMENTAL is not set +CONFIG_HOST_LINUX=y +# CONFIG_HOST_OSX is not set +# CONFIG_HOST_WINDOWS is not set +# CONFIG_HOST_OTHER is not set + +# +# Build Configuration +# +# CONFIG_APPS_DIR="../apps" +# CONFIG_BUILD_2PASS is not set + +# +# Binary Output Formats +# +# CONFIG_RRLOAD_BINARY is not set +# CONFIG_INTELHEX_BINARY is not set +# CONFIG_MOTOROLA_SREC is not set +CONFIG_RAW_BINARY=y + +# +# Customize Header Files +# +# CONFIG_ARCH_STDBOOL_H is not set +# CONFIG_ARCH_MATH_H is not set +# CONFIG_ARCH_FLOAT_H is not set +# CONFIG_ARCH_STDARG_H is not set + +# +# Debug Options +# +# CONFIG_DEBUG is not set +# CONFIG_DEBUG_SYMBOLS is not set + +# +# System Type +# +# CONFIG_ARCH_8051 is not set +CONFIG_ARCH_ARM=y +# CONFIG_ARCH_AVR is not set +# CONFIG_ARCH_HC is not set +# CONFIG_ARCH_MIPS is not set +# CONFIG_ARCH_RGMP is not set +# CONFIG_ARCH_SH is not set +# CONFIG_ARCH_SIM is not set +# CONFIG_ARCH_X86 is not set +# CONFIG_ARCH_Z16 is not set +# CONFIG_ARCH_Z80 is not set +CONFIG_ARCH="arm" + +# +# ARM Options +# +# CONFIG_ARCH_CHIP_C5471 is not set +# CONFIG_ARCH_CHIP_CALYPSO is not set +# CONFIG_ARCH_CHIP_DM320 is not set +# CONFIG_ARCH_CHIP_IMX is not set +# CONFIG_ARCH_CHIP_KINETIS is not set +CONFIG_ARCH_CHIP_LM3S=y +# CONFIG_ARCH_CHIP_LPC17XX is not set +# CONFIG_ARCH_CHIP_LPC214X is not set +# CONFIG_ARCH_CHIP_LPC2378 is not set +# CONFIG_ARCH_CHIP_LPC31XX is not set +# CONFIG_ARCH_CHIP_LPC43XX is not set +# CONFIG_ARCH_CHIP_SAM3U is not set +# CONFIG_ARCH_CHIP_STM32 is not set +# CONFIG_ARCH_CHIP_STR71X is not set +CONFIG_ARCH_CORTEXM3=y +CONFIG_ARCH_FAMILY="armv7-m" +CONFIG_ARCH_CHIP="lm3s" +CONFIG_ARCH_HAVE_MPU=y +# CONFIG_ARMV7M_MPU is not set +CONFIG_BOARD_LOOPSPERMSEC=4531 +# CONFIG_ARCH_CALIBRATION is not set + +# +# ARMV7M Configuration Options +# +CONFIG_ARMV7M_TOOLCHAIN_BUILDROOT=y +# CONFIG_ARMV7M_TOOLCHAIN_CODEREDL is not set +# CONFIG_ARMV7M_TOOLCHAIN_CODESOURCERYL is not set +# CONFIG_ARMV7M_TOOLCHAIN_GNU_EABI is not set + +# +# LM3S Configuration Options +# +# CONFIG_ARCH_CHIP_LM3S6918 is not set +# CONFIG_ARCH_CHIP_LM3S9B96 is not set +# CONFIG_ARCH_CHIP_LM3S6432 is not set +CONFIG_ARCH_CHIP_LM3S6965=y +# CONFIG_ARCH_CHIP_LM3S8962 is not set +# CONFIG_LM3S_REVA2 is not set CONFIG_LM3S_DFU=y # -# Disable support for interrupts on GPIOH and GPIOJ which do not -# exist on the LM3S6B96. Additional interrupt support can be -# disabled if desired to reduce memory footprint. -CONFIG_LM3S_DISABLE_GPIOA_IRQS=n -CONFIG_LM3S_DISABLE_GPIOB_IRQS=n -CONFIG_LM3S_DISABLE_GPIOC_IRQS=n -CONFIG_LM3S_DISABLE_GPIOD_IRQS=n -CONFIG_LM3S_DISABLE_GPIOE_IRQS=n -CONFIG_LM3S_DISABLE_GPIOF_IRQS=n -CONFIG_LM3S_DISABLE_GPIOG_IRQS=n +# Select LM3S Peripheral Support +# +CONFIG_LM3S_UART0=y +# CONFIG_LM3S_UART1 is not set +# CONFIG_SSI0_DISABLE is not set +CONFIG_SSI1_DISABLE=y +# CONFIG_LM3S_UART2 is not set +# CONFIG_LM3S_ETHERNET is not set + +# +# Disable GPIO Interrupts +# +# CONFIG_LM3S_DISABLE_GPIOA_IRQS is not set +# CONFIG_LM3S_DISABLE_GPIOB_IRQS is not set +# CONFIG_LM3S_DISABLE_GPIOC_IRQS is not set +# CONFIG_LM3S_DISABLE_GPIOD_IRQS is not set +# CONFIG_LM3S_DISABLE_GPIOE_IRQS is not set +# CONFIG_LM3S_DISABLE_GPIOF_IRQS is not set +# CONFIG_LM3S_DISABLE_GPIOG_IRQS is not set CONFIG_LM3S_DISABLE_GPIOH_IRQS=y CONFIG_LM3S_DISABLE_GPIOJ_IRQS=y # -# LM3S6965 specific serial device driver settings +# LM3S SSI Configuration # -CONFIG_LM3S_UART0=y -CONFIG_LM3S_UART1=n -CONFIG_LM3S_UART2=n -CONFIG_UART0_SERIAL_CONSOLE=y -CONFIG_UART1_SERIAL_CONSOLE=n -CONFIG_UART2_SERIAL_CONSOLE=n -CONFIG_UART0_TXBUFSIZE=256 -CONFIG_UART1_TXBUFSIZE=256 -CONFIG_UART2_TXBUFSIZE=256 -CONFIG_UART0_RXBUFSIZE=256 -CONFIG_UART1_RXBUFSIZE=256 -CONFIG_UART2_RXBUFSIZE=256 -CONFIG_UART0_BAUD=115200 -CONFIG_UART1_BAUD=115200 -CONFIG_UART2_BAUD=115200 -CONFIG_UART0_BITS=8 -CONFIG_UART1_BITS=8 -CONFIG_UART2_BITS=8 -CONFIG_UART0_PARITY=0 -CONFIG_UART1_PARITY=0 -CONFIG_UART2_PARITY=0 -CONFIG_UART0_2STOP=0 -CONFIG_UART1_2STOP=0 -CONFIG_UART2_2STOP=0 - -# -# LM3S6965 specific SSI device driver settings -# -CONFIG_SSI0_DISABLE=n -CONFIG_SSI1_DISABLE=y CONFIG_SSI_POLLWAIT=y -#CONFIG_SSI_TXLIMIT=4 +CONFIG_SSI_TXLIMIT=4 # -# LM3S6965 specific serial device driver settings +# Architecture Options # -CONFIG_LM3S_ETHERNET=n -CONFIG_LM3S_ETHLEDS=n -CONFIG_LM3S_BOARDMAC=y -CONFIG_LM3S_ETHHDUPLEX=n -CONFIG_LM3S_ETHNOAUTOCRC=n -CONFIG_LM3S_ETHNOPAD=n -CONFIG_LM3S_MULTICAST=n -CONFIG_LM3S_PROMISCUOUS=n -CONFIG_LM3S_BADCRC=n -CONFIG_LM3S_DUMPPACKET=n +# CONFIG_ARCH_NOINTC is not set +# CONFIG_ARCH_DMA is not set +CONFIG_ARCH_IRQPRIO=y +# CONFIG_CUSTOM_STACK is not set +# CONFIG_ADDRENV is not set +CONFIG_ARCH_STACKDUMP=y +# CONFIG_ENDIAN_BIG is not set # -# General build options +# Board Settings # -CONFIG_RRLOAD_BINARY=n -CONFIG_INTELHEX_BINARY=n -CONFIG_MOTOROLA_SREC=n -CONFIG_RAW_BINARY=y +CONFIG_DRAM_START=0x20000000 +CONFIG_DRAM_SIZE=65536 +CONFIG_ARCH_HAVE_INTERRUPTSTACK=y +CONFIG_ARCH_INTERRUPTSTACK=0 # -# General SPI interface configuration +# Boot options # -CONFIG_SPI_CMDDATA=y +# CONFIG_BOOT_RUNFROMEXTSRAM is not set +CONFIG_BOOT_RUNFROMFLASH=y +# CONFIG_BOOT_RUNFROMISRAM is not set +# CONFIG_BOOT_RUNFROMSDRAM is not set +# CONFIG_BOOT_COPYTORAM is not set # -# General OS setup +# Board Selection # -CONFIG_USER_ENTRYPOINT="nx_main" -CONFIG_DEBUG=n -CONFIG_DEBUG_VERBOSE=n -CONFIG_DEBUG_SYMBOLS=n -CONFIG_DEBUG_GRAPHICS=n -CONFIG_LCD_RITDEBUG=n -CONFIG_MM_REGIONS=1 -CONFIG_ARCH_LOWPUTC=y +CONFIG_ARCH_BOARD_LM3S6965EK=y +# CONFIG_ARCH_BOARD_CUSTOM is not set +CONFIG_ARCH_BOARD="lm3s6965-ek" + +# +# Common Board Options +# +CONFIG_ARCH_HAVE_LEDS=y +CONFIG_ARCH_LEDS=y + +# +# Board-Specific Options +# + +# +# RTOS Features +# +CONFIG_MSEC_PER_TICK=10 CONFIG_RR_INTERVAL=200 -CONFIG_SCHED_INSTRUMENTATION=n +# CONFIG_SCHED_INSTRUMENTATION is not set CONFIG_TASK_NAME_SIZE=0 +# CONFIG_JULIAN_TIME is not set CONFIG_START_YEAR=2010 CONFIG_START_MONTH=5 CONFIG_START_DAY=12 -CONFIG_GREGORIAN_TIME=n -CONFIG_JULIAN_TIME=n CONFIG_DEV_CONSOLE=y -CONFIG_DEV_LOWCONSOLE=n -CONFIG_MUTEX_TYPES=n -CONFIG_PRIORITY_INHERITANCE=n -CONFIG_SEM_PREALLOCHOLDERS=0 -CONFIG_SEM_NNESTPRIO=0 -CONFIG_FDCLONE_DISABLE=n -CONFIG_FDCLONE_STDIO=n +# CONFIG_MUTEX_TYPES is not set +# CONFIG_PRIORITY_INHERITANCE is not set +# CONFIG_FDCLONE_DISABLE is not set +# CONFIG_FDCLONE_STDIO is not set CONFIG_SDCLONE_DISABLE=y -CONFIG_NXFLAT=n - -# -# The following can be used to disable categories of -# APIs supported by the OS. If the compiler supports -# weak functions, then it should not be necessary to -# disable functions unless you want to restrict usage -# of those APIs. -# -# There are certain dependency relationships in these -# features. -# -# o mq_notify logic depends on signals to awaken tasks -# waiting for queues to become full or empty. -# o pthread_condtimedwait() depends on signals to wake -# up waiting tasks. -# -CONFIG_DISABLE_CLOCK=n +# CONFIG_SCHED_WORKQUEUE is not set +# CONFIG_SCHED_WAITPID is not set +# CONFIG_SCHED_ATEXIT is not set +# CONFIG_SCHED_ONEXIT is not set +CONFIG_USER_ENTRYPOINT="nx_main" +CONFIG_DISABLE_OS_API=y +# CONFIG_DISABLE_CLOCK is not set CONFIG_DISABLE_POSIX_TIMERS=y -CONFIG_DISABLE_PTHREAD=n -CONFIG_DISABLE_SIGNALS=n -CONFIG_DISABLE_MQUEUE=n +# CONFIG_DISABLE_PTHREAD is not set +# CONFIG_DISABLE_SIGNALS is not set +# CONFIG_DISABLE_MQUEUE is not set CONFIG_DISABLE_MOUNTPOINT=y CONFIG_DISABLE_ENVIRON=y CONFIG_DISABLE_POLL=y -# -# Misc libc settings -# -CONFIG_NOPRINTF_FIELDWIDTH=n - -# -# Allow for architecture optimized implementations -# -# The architecture can provide optimized versions of the -# following to improve system performance -# -CONFIG_ARCH_MEMCPY=n -CONFIG_ARCH_MEMCMP=n -CONFIG_ARCH_MEMMOVE=n -CONFIG_ARCH_MEMSET=n -CONFIG_ARCH_STRCMP=n -CONFIG_ARCH_STRCPY=n -CONFIG_ARCH_STRNCPY=n -CONFIG_ARCH_STRLEN=n -CONFIG_ARCH_STRNLEN=n -CONFIG_ARCH_BZERO=n - # # Sizes of configurable things (0 disables) # @@ -223,8 +216,6 @@ CONFIG_NPTHREAD_KEYS=4 CONFIG_NFILE_DESCRIPTORS=12 CONFIG_NFILE_STREAMS=12 CONFIG_NAME_MAX=32 -CONFIG_STDIO_BUFFER_SIZE=256 -CONFIG_NUNGET_CHARS=2 CONFIG_PREALLOC_MQ_MSGS=4 CONFIG_MQ_MAXMSGSIZE=32 CONFIG_MAX_WDOGPARMS=2 @@ -232,187 +223,382 @@ CONFIG_PREALLOC_WDOGS=4 CONFIG_PREALLOC_TIMERS=4 # -# Framebuffer driver options -CONFIG_FB_CMAP=n -CONFIG_FB_HWCURSOR=n -CONFIG_FB_HWCURSORIMAGE=n -#CONFIG_FB_HWCURSORSIZE -#CONFIG_FB_TRANSPARENCY +# Stack and heap information +# +CONFIG_IDLETHREAD_STACKSIZE=1024 +CONFIG_USERMAIN_STACKSIZE=2048 +CONFIG_PTHREAD_STACK_MIN=256 +CONFIG_PTHREAD_STACK_DEFAULT=2048 # -# Filesystem configuration +# Device Drivers # -CONFIG_FS_FAT=n -CONFIG_FS_ROMFS=n +CONFIG_DEV_NULL=y +# CONFIG_DEV_ZERO is not set +# CONFIG_LOOP is not set +# CONFIG_RAMDISK is not set +# CONFIG_CAN is not set +# CONFIG_PWM is not set +# CONFIG_I2C is not set +CONFIG_SPI=y +# CONFIG_SPI_OWNBUS is not set +CONFIG_SPI_EXCHANGE=y +CONFIG_SPI_CMDDATA=y +# CONFIG_RTC is not set +# CONFIG_WATCHDOG is not set +# CONFIG_ANALOG is not set +# CONFIG_BCH is not set +# CONFIG_INPUT is not set +CONFIG_LCD=y +# CONFIG_LCD_NOGETRUN is not set +CONFIG_LCD_MAXCONTRAST=255 +CONFIG_LCD_MAXPOWER=1 +CONFIG_LCD_P14201=y +CONFIG_P14201_NINTERFACES=1 +CONFIG_P14201_SPIMODE=2 +CONFIG_P14201_FREQUENCY=3500000 +CONFIG_P14201_FRAMEBUFFER=y +# CONFIG_LCD_NOKIA6100 is not set +# CONFIG_LCD_UG9664HSWAG01 is not set +# CONFIG_LCD_UG2864AMBAG01 is not set +# CONFIG_LCD_SSD1289 is not set +CONFIG_LCD_LANDSCAPE=y +# CONFIG_LCD_PORTRAIT is not set +# CONFIG_LCD_RPORTRAIT is not set +# CONFIG_LCD_RLANDSCAPE is not set +# CONFIG_MMCSD is not set +# CONFIG_MTD is not set +# CONFIG_PIPES is not set +# CONFIG_PM is not set +# CONFIG_POWER is not set +# CONFIG_SENSORS is not set +# CONFIG_SERCOMM_CONSOLE is not set +CONFIG_SERIAL=y +# CONFIG_DEV_LOWCONSOLE is not set +# CONFIG_16550_UART is not set +CONFIG_ARCH_HAVE_UART0=y +CONFIG_MCU_SERIAL=y +CONFIG_STANDARD_SERIAL=y +CONFIG_UART0_SERIAL_CONSOLE=y +# CONFIG_NO_SERIAL_CONSOLE is not set # -# Maintain legacy build behavior (revisit) +# UART0 Configuration # - -CONFIG_MMCSD=y -CONFIG_MMCSD_SPI=y -CONFIG_MMCSD_SDIO=y +CONFIG_UART0_RXBUFSIZE=256 +CONFIG_UART0_TXBUFSIZE=256 +CONFIG_UART0_BAUD=115200 +CONFIG_UART0_BITS=8 +CONFIG_UART0_PARITY=0 +CONFIG_UART0_2STOP=0 +# CONFIG_USBDEV is not set +# CONFIG_USBHOST is not set +# CONFIG_WIRELESS is not set # -# SPI-based MMC/SD driver +# System Logging Device Options # -CONFIG_MMCSD_NSLOTS=1 -CONFIG_MMCSD_READONLY=n -CONFIG_MMCSD_SPICLOCK=12500000 # -# TCP/IP and UDP support via uIP +# System Logging # -CONFIG_NET=n -CONFIG_NET_IPv6=n -CONFIG_NSOCKET_DESCRIPTORS=0 -CONFIG_NET_SOCKOPTS=y -CONFIG_NET_BUFSIZE=420 -CONFIG_NET_TCP=n -CONFIG_NET_TCP_CONNS=40 -CONFIG_NET_MAX_LISTENPORTS=40 -CONFIG_NET_UDP=n -CONFIG_NET_UDP_CHECKSUMS=y -#CONFIG_NET_UDP_CONNS=10 -CONFIG_NET_ICMP=n -CONFIG_NET_ICMP_PING=n -#CONFIG_NET_PINGADDRCONF=0 -CONFIG_NET_STATISTICS=y -#CONFIG_NET_RECEIVE_WINDOW= -#CONFIG_NET_ARPTAB_SIZE=8 -CONFIG_NET_BROADCAST=n +# CONFIG_RAMLOG is not set # -# UIP Network Utilities +# Networking Support # -CONFIG_NET_DHCP_LIGHT=n -CONFIG_NET_RESOLV_ENTRIES=4 +# CONFIG_NET is not set # -# Graphics related configuration settings +# File Systems +# + +# +# File system configuration +# +# CONFIG_FS_RAMMAP is not set + +# +# System Logging +# +# CONFIG_SYSLOG is not set + +# +# Graphics Support # CONFIG_NX=y -CONFIG_NX_MULTIUSER=n +CONFIG_NX_LCDDRIVER=y CONFIG_NX_NPLANES=1 +# CONFIG_NX_WRITEONLY is not set + +# +# Supported Pixel Depths +# CONFIG_NX_DISABLE_1BPP=y CONFIG_NX_DISABLE_2BPP=y -CONFIG_NX_DISABLE_4BPP=n +# CONFIG_NX_DISABLE_4BPP is not set CONFIG_NX_DISABLE_8BPP=y CONFIG_NX_DISABLE_16BPP=y CONFIG_NX_DISABLE_24BPP=y CONFIG_NX_DISABLE_32BPP=y CONFIG_NX_PACKEDMSFIRST=y -CONFIG_NX_LCDDRIVER=y -CONFIG_LCD_MAXPOWER=1 -CONFIG_LCD_MAXCONTRAST=255 + +# +# Input Devices +# CONFIG_NX_MOUSE=y CONFIG_NX_KBD=y -#CONFIG_NXTK_BORDERWIDTH=4 -CONFIG_NXTK_BORDERCOLOR1=8 -CONFIG_NXTK_BORDERCOLOR2=4 -CONFIG_NXTK_AUTORAISE=n -CONFIG_NXFONT_SANS23X27=y + +# +# Framed Window Borders +# +CONFIG_NXTK_BORDERWIDTH=4 +CONFIG_NXTK_BORDERCOLOR1=0x08 +CONFIG_NXTK_BORDERCOLOR2=0x04 +CONFIG_NXTK_BORDERCOLOR3=0 +# CONFIG_NXTK_AUTORAISE is not set + +# +# Font Selections +# CONFIG_NXFONTS_CHARBITS=7 -CONFIG_NX_BLOCKING=y -CONFIG_NX_MXSERVERMSGS=32 -CONFIG_NX_MXCLIENTMSGS=16 +# CONFIG_NXFONT_MONO5X8 is not set +# CONFIG_NXFONT_SANS17X22 is not set +# CONFIG_NXFONT_SANS20X26 is not set +CONFIG_NXFONT_SANS23X27=y +# CONFIG_NXFONT_SANS22X29 is not set +# CONFIG_NXFONT_SANS28X37 is not set +# CONFIG_NXFONT_SANS39X48 is not set +# CONFIG_NXFONT_SANS17X23B is not set +# CONFIG_NXFONT_SANS20X27B is not set +# CONFIG_NXFONT_SANS22X29B is not set +# CONFIG_NXFONT_SANS28X37B is not set +# CONFIG_NXFONT_SANS40X49B is not set +# CONFIG_NXFONT_SERIF22X29 is not set +# CONFIG_NXFONT_SERIF29X37 is not set +# CONFIG_NXFONT_SERIF38X48 is not set +# CONFIG_NXFONT_SERIF22X28B is not set +# CONFIG_NXFONT_SERIF27X38B is not set +# CONFIG_NXFONT_SERIF38X49B is not set +# CONFIG_NXCONSOLE is not set # -# RiT P14201 OLED Driver Configuration +# NX Multi-user only options # -CONFIG_LCD_P14201=y -CONFIG_P14201_SPIMODE=2 -CONFIG_P14201_FREQUENCY=3500000 -CONFIG_P14201_NINTERFACES=1 -CONFIG_P14201_FRAMEBUFFER=y +# CONFIG_NX_MULTIUSER is not set # -# Settings for examples/uip +# Memory Management # -CONFIG_EXAMPLES_UIP_IPADDR=0x0a000002 -CONFIG_EXAMPLES_UIP_DRIPADDR=0x0a000001 -CONFIG_EXAMPLES_UIP_NETMASK=0xffffff00 -CONFIG_EXAMPLES_UIP_DHCPC=n +# CONFIG_MM_SMALL is not set +CONFIG_MM_REGIONS=1 +# CONFIG_GRAN is not set # -# Settings for examples/nettest -CONFIG_EXAMPLES_NETTEST_SERVER=n -CONFIG_EXAMPLES_NETTEST_PERFORMANCE=n -CONFIG_EXAMPLES_NETTEST_NOMAC=n -CONFIG_EXAMPLES_NETTEST_IPADDR=0x0a000002 -CONFIG_EXAMPLES_NETTEST_DRIPADDR=0x0a000001 -CONFIG_EXAMPLES_NETTEST_NETMASK=0xffffff00 -CONFIG_EXAMPLES_NETTEST_CLIENTIP=0x0a000001 +# Binary Formats +# +# CONFIG_BINFMT_DISABLE is not set +# CONFIG_NXFLAT is not set +# CONFIG_ELF is not set +# CONFIG_PIC is not set +# CONFIG_SYMTAB_ORDEREDBYNAME is not set # -# Settings for examples/ostest +# Library Routines # -CONFIG_EXAMPLES_OSTEST_LOOPS=1 -CONFIG_EXAMPLES_OSTEST_STACKSIZE=2048 -CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3 # -# Settings for apps/nshlib +# Standard C Library Options # -CONFIG_NSH_FILEIOSIZE=512 -CONFIG_NSH_STRERROR=n -CONFIG_NSH_LINELEN=64 -CONFIG_NSH_NESTDEPTH=3 -CONFIG_NSH_DISABLESCRIPT=n -CONFIG_NSH_DISABLEBG=n -CONFIG_NSH_ROMFSETC=n -CONFIG_NSH_CONSOLE=y -CONFIG_NSH_TELNET=n -CONFIG_NSH_ARCHINIT=n -CONFIG_NSH_IOBUFFER_SIZE=512 -CONFIG_NSH_DHCPC=n -CONFIG_NSH_NOMAC=n -CONFIG_NSH_IPADDR=0x0a000002 -CONFIG_NSH_DRIPADDR=0x0a000001 -CONFIG_NSH_NETMASK=0xffffff00 -CONFIG_NSH_ROMFSMOUNTPT="/etc" -CONFIG_NSH_INITSCRIPT="init.d/rcS" -CONFIG_NSH_ROMFSDEVNO=0 -CONFIG_NSH_ROMFSSECTSIZE=64 -CONFIG_NSH_FATDEVNO=1 -CONFIG_NSH_FATSECTSIZE=512 -CONFIG_NSH_FATNSECTORS=1024 -CONFIG_NSH_FATMOUNTPT="/tmp" +CONFIG_STDIO_BUFFER_SIZE=256 +CONFIG_STDIO_LINEBUFFER=y +CONFIG_NUNGET_CHARS=2 +# CONFIG_LIBM is not set +# CONFIG_NOPRINTF_FIELDWIDTH is not set +# CONFIG_LIBC_FLOATINGPOINT is not set +# CONFIG_EOL_IS_CR is not set +# CONFIG_EOL_IS_LF is not set +# CONFIG_EOL_IS_BOTH_CRLF is not set +CONFIG_EOL_IS_EITHER_CRLF=y +# CONFIG_LIBC_STRERROR is not set +# CONFIG_LIBC_PERROR_STDOUT is not set +CONFIG_ARCH_LOWPUTC=y +CONFIG_LIB_SENDFILE_BUFSIZE=512 +# CONFIG_ARCH_ROMGETC is not set +# CONFIG_ARCH_OPTIMIZED_FUNCTIONS is not set # -# Architecture-specific NSH options +# Non-standard Helper Functions # -CONFIG_NSH_MMCSDSPIPORTNO=0 -CONFIG_NSH_MMCSDSLOTNO=0 -CONFIG_NSH_MMCSDMINOR=0 +CONFIG_LIB_KBDCODEC=y # -# Settings for examples/nx +# Basic CXX Support # +# CONFIG_C99_BOOL8 is not set +# CONFIG_HAVE_CXX is not set + +# +# Application Configuration +# + +# +# Built-In Applications +# +# CONFIG_BUILTIN is not set + +# +# Examples +# +# CONFIG_EXAMPLES_BUTTONS is not set +# CONFIG_EXAMPLES_CAN is not set +# CONFIG_EXAMPLES_CDCACM is not set +# CONFIG_EXAMPLES_COMPOSITE is not set +# CONFIG_EXAMPLES_DHCPD is not set +# CONFIG_EXAMPLES_ELF is not set +# CONFIG_EXAMPLES_FTPC is not set +# CONFIG_EXAMPLES_FTPD is not set +# CONFIG_EXAMPLES_HELLO is not set +# CONFIG_EXAMPLES_HELLOXX is not set +# CONFIG_EXAMPLES_JSON is not set +# CONFIG_EXAMPLES_HIDKBD is not set +# CONFIG_EXAMPLES_KEYPADTEST is not set +# CONFIG_EXAMPLES_IGMP is not set +# CONFIG_EXAMPLES_LCDRW is not set +# CONFIG_EXAMPLES_MM is not set +# CONFIG_EXAMPLES_MOUNT is not set +# CONFIG_EXAMPLES_MODBUS is not set +# CONFIG_EXAMPLES_NETTEST is not set +# CONFIG_EXAMPLES_NSH is not set +# CONFIG_EXAMPLES_NULL is not set +CONFIG_EXAMPLES_NX=y CONFIG_EXAMPLES_NX_VPLANE=0 CONFIG_EXAMPLES_NX_DEVNO=0 -CONFIG_EXAMPLES_NX_BGCOLOR=2 -CONFIG_EXAMPLES_NX_COLOR1=10 -CONFIG_EXAMPLES_NX_COLOR2=12 -CONFIG_EXAMPLES_NX_TBCOLOR=8 -CONFIG_EXAMPLES_NX_FONTCOLOR=0 +# CONFIG_EXAMPLES_NX_DEFAULT_COLORS is not set +CONFIG_EXAMPLES_NX_BGCOLOR=0x02 +CONFIG_EXAMPLES_NX_COLOR1=0x0a +CONFIG_EXAMPLES_NX_COLOR2=0x0c +CONFIG_EXAMPLES_NX_TBCOLOR=0x08 +CONFIG_EXAMPLES_NX_FONTCOLOR=0x00 +CONFIG_EXAMPLES_NX_DEFAULT_FONT=y CONFIG_EXAMPLES_NX_BPP=4 -CONFIG_EXAMPLES_NX_RAWWINDOWS=n -CONFIG_EXAMPLES_NX_STACKSIZE=2048 -CONFIG_EXAMPLES_NX_CLIENTPRIO=80 -CONFIG_EXAMPLES_NX_SERVERPRIO=120 -CONFIG_EXAMPLES_NX_NOTIFYSIGNO=4 +# CONFIG_EXAMPLES_NX_RAWWINDOWS is not set CONFIG_EXAMPLES_NX_EXTERNINIT=y +# CONFIG_EXAMPLES_NXCONSOLE is not set +# CONFIG_EXAMPLES_NXFFS is not set +# CONFIG_EXAMPLES_NXFLAT is not set +# CONFIG_EXAMPLES_NXHELLO is not set +# CONFIG_EXAMPLES_NXIMAGE is not set +# CONFIG_EXAMPLES_NXLINES is not set +# CONFIG_EXAMPLES_NXTEXT is not set +# CONFIG_EXAMPLES_OSTEST is not set +# CONFIG_EXAMPLES_PASHELLO is not set +# CONFIG_EXAMPLES_PIPE is not set +# CONFIG_EXAMPLES_POLL is not set +# CONFIG_EXAMPLES_QENCODER is not set +# CONFIG_EXAMPLES_RGMP is not set +# CONFIG_EXAMPLES_ROMFS is not set +# CONFIG_EXAMPLES_SENDMAIL is not set +# CONFIG_EXAMPLES_SERLOOP is not set +# CONFIG_EXAMPLES_TELNETD is not set +# CONFIG_EXAMPLES_THTTPD is not set +# CONFIG_EXAMPLES_TIFF is not set +# CONFIG_EXAMPLES_TOUCHSCREEN is not set +# CONFIG_EXAMPLES_UDP is not set +# CONFIG_EXAMPLES_UIP is not set +# CONFIG_EXAMPLES_USBSERIAL is not set +# CONFIG_EXAMPLES_USBMSC is not set +# CONFIG_EXAMPLES_USBTERM is not set +# CONFIG_EXAMPLES_WATCHDOG is not set # -# Stack and heap information +# Interpreters # -CONFIG_BOOT_RUNFROMFLASH=n -CONFIG_BOOT_COPYTORAM=n -CONFIG_CUSTOM_STACK=n -CONFIG_IDLETHREAD_STACKSIZE=1024 -CONFIG_USERMAIN_STACKSIZE=2048 -CONFIG_PTHREAD_STACK_MIN=256 -CONFIG_PTHREAD_STACK_DEFAULT=2048 -CONFIG_HEAP_BASE= -CONFIG_HEAP_SIZE= + +# +# Interpreters +# +# CONFIG_INTERPRETERS_FICL is not set +# CONFIG_INTERPRETERS_PCODE is not set + +# +# Network Utilities +# + +# +# Networking Utilities +# +# CONFIG_NETUTILS_CODECS is not set +# CONFIG_NETUTILS_DHCPC is not set +# CONFIG_NETUTILS_DHCPD is not set +# CONFIG_NETUTILS_FTPC is not set +# CONFIG_NETUTILS_FTPD is not set +# CONFIG_NETUTILS_JSON is not set +# CONFIG_NETUTILS_RESOLV is not set +# CONFIG_NETUTILS_SMTP is not set +# CONFIG_NETUTILS_TELNETD is not set +# CONFIG_NETUTILS_TFTPC is not set +# CONFIG_NETUTILS_THTTPD is not set +# CONFIG_NETUTILS_UIPLIB is not set +# CONFIG_NETUTILS_WEBCLIENT is not set + +# +# ModBus +# + +# +# FreeModbus +# +# CONFIG_MODBUS is not set + +# +# NSH Library +# +# CONFIG_NSH_LIBRARY is not set + +# +# NxWidgets/NxWM +# + +# +# System NSH Add-Ons +# + +# +# Custom Free Memory Command +# +# CONFIG_SYSTEM_FREE is not set + +# +# I2C tool +# + +# +# FLASH Program Installation +# +# CONFIG_SYSTEM_INSTALL is not set + +# +# readline() +# +# CONFIG_SYSTEM_READLINE is not set + +# +# Power Off +# +# CONFIG_SYSTEM_POWEROFF is not set + +# +# RAMTRON +# +# CONFIG_SYSTEM_RAMTRON is not set + +# +# SD Card +# +# CONFIG_SYSTEM_SDCARD is not set + +# +# Sysinfo +# +# CONFIG_SYSTEM_SYSINFO is not set diff --git a/nuttx/configs/lm3s6965-ek/ostest/appconfig b/nuttx/configs/lm3s6965-ek/ostest/appconfig deleted file mode 100644 index dabf1f2b44..0000000000 --- a/nuttx/configs/lm3s6965-ek/ostest/appconfig +++ /dev/null @@ -1,39 +0,0 @@ -############################################################################ -# configs/lm3s6965-ek/ostest/appconfig -# -# Copyright (C) 2011 Gregory Nutt. All rights reserved. -# Author: Gregory Nutt -# -# 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. -# -############################################################################ - -# Path to example in apps/examples containing the user_start entry point - -CONFIGURED_APPS += examples/ostest - diff --git a/nuttx/configs/lm3s6965-ek/ostest/defconfig b/nuttx/configs/lm3s6965-ek/ostest/defconfig index fcee444333..d1168ad45a 100755 --- a/nuttx/configs/lm3s6965-ek/ostest/defconfig +++ b/nuttx/configs/lm3s6965-ek/ostest/defconfig @@ -1,212 +1,214 @@ -############################################################################ -# configs/lm3s6965-ek/ostest/defconfig # -# Copyright (C) 2010 Gregory Nutt. All rights reserved. -# Author: Gregory Nutt +# Automatically generated file; DO NOT EDIT. +# Nuttx/ Configuration # -# 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. -# -############################################################################ -# -# Architecture Selection -# -CONFIG_ARCH="arm" -CONFIG_ARCH_ARM=y -CONFIG_ARCH_CORTEXM3=y -CONFIG_ARCH_CHIP="lm3s" -CONFIG_ARCH_CHIP_LM3S=y -CONFIG_ARCH_CHIP_LM3S6965=y -CONFIG_ARCH_BOARD="lm3s6965-ek" -CONFIG_ARCH_BOARD_LM3S6965EK=y -CONFIG_BOARD_LOOPSPERMSEC=4531 -CONFIG_DRAM_SIZE=65536 -CONFIG_DRAM_START=0x20000000 -CONFIG_ARCH_IRQPRIO=y -CONFIG_ARCH_INTERRUPTSTACK=0 -CONFIG_ARCH_STACKDUMP=y -CONFIG_ARCH_LEDS=y -CONFIG_ARCH_CALIBRATION=n +CONFIG_NUTTX_NEWCONFIG=y # -# Identify toolchain and linker options +# Build Setup # -CONFIG_LM3S_CODESOURCERYW=n -CONFIG_LM3S_CODESOURCERYL=n -CONFIG_LM3S_DEVKITARM=n -CONFIG_LM3S_BUILDROOT=y +# CONFIG_EXPERIMENTAL is not set +CONFIG_HOST_LINUX=y +# CONFIG_HOST_OSX is not set +# CONFIG_HOST_WINDOWS is not set +# CONFIG_HOST_OTHER is not set + +# +# Build Configuration +# +# CONFIG_APPS_DIR="../apps" +# CONFIG_BUILD_2PASS is not set + +# +# Binary Output Formats +# +# CONFIG_RRLOAD_BINARY is not set +# CONFIG_INTELHEX_BINARY is not set +# CONFIG_MOTOROLA_SREC is not set +CONFIG_RAW_BINARY=y + +# +# Customize Header Files +# +# CONFIG_ARCH_STDBOOL_H is not set +# CONFIG_ARCH_MATH_H is not set +# CONFIG_ARCH_FLOAT_H is not set +# CONFIG_ARCH_STDARG_H is not set + +# +# Debug Options +# +# CONFIG_DEBUG is not set +# CONFIG_DEBUG_SYMBOLS is not set + +# +# System Type +# +# CONFIG_ARCH_8051 is not set +CONFIG_ARCH_ARM=y +# CONFIG_ARCH_AVR is not set +# CONFIG_ARCH_HC is not set +# CONFIG_ARCH_MIPS is not set +# CONFIG_ARCH_RGMP is not set +# CONFIG_ARCH_SH is not set +# CONFIG_ARCH_SIM is not set +# CONFIG_ARCH_X86 is not set +# CONFIG_ARCH_Z16 is not set +# CONFIG_ARCH_Z80 is not set +CONFIG_ARCH="arm" + +# +# ARM Options +# +# CONFIG_ARCH_CHIP_C5471 is not set +# CONFIG_ARCH_CHIP_CALYPSO is not set +# CONFIG_ARCH_CHIP_DM320 is not set +# CONFIG_ARCH_CHIP_IMX is not set +# CONFIG_ARCH_CHIP_KINETIS is not set +CONFIG_ARCH_CHIP_LM3S=y +# CONFIG_ARCH_CHIP_LPC17XX is not set +# CONFIG_ARCH_CHIP_LPC214X is not set +# CONFIG_ARCH_CHIP_LPC2378 is not set +# CONFIG_ARCH_CHIP_LPC31XX is not set +# CONFIG_ARCH_CHIP_LPC43XX is not set +# CONFIG_ARCH_CHIP_SAM3U is not set +# CONFIG_ARCH_CHIP_STM32 is not set +# CONFIG_ARCH_CHIP_STR71X is not set +CONFIG_ARCH_CORTEXM3=y +CONFIG_ARCH_FAMILY="armv7-m" +CONFIG_ARCH_CHIP="lm3s" +CONFIG_ARCH_HAVE_MPU=y +# CONFIG_ARMV7M_MPU is not set +CONFIG_BOARD_LOOPSPERMSEC=4531 +# CONFIG_ARCH_CALIBRATION is not set + +# +# ARMV7M Configuration Options +# +CONFIG_ARMV7M_TOOLCHAIN_BUILDROOT=y +# CONFIG_ARMV7M_TOOLCHAIN_CODEREDL is not set +# CONFIG_ARMV7M_TOOLCHAIN_CODESOURCERYL is not set +# CONFIG_ARMV7M_TOOLCHAIN_GNU_EABI is not set + +# +# LM3S Configuration Options +# +# CONFIG_ARCH_CHIP_LM3S6918 is not set +# CONFIG_ARCH_CHIP_LM3S9B96 is not set +# CONFIG_ARCH_CHIP_LM3S6432 is not set +CONFIG_ARCH_CHIP_LM3S6965=y +# CONFIG_ARCH_CHIP_LM3S8962 is not set +# CONFIG_LM3S_REVA2 is not set CONFIG_LM3S_DFU=y # -# Disable support for interrupts on GPIOH and GPIOJ which do not -# exist on the LM3S6B96. Additional interrupt support can be -# disabled if desired to reduce memory footprint. -CONFIG_LM3S_DISABLE_GPIOA_IRQS=n -CONFIG_LM3S_DISABLE_GPIOB_IRQS=n -CONFIG_LM3S_DISABLE_GPIOC_IRQS=n -CONFIG_LM3S_DISABLE_GPIOD_IRQS=n -CONFIG_LM3S_DISABLE_GPIOE_IRQS=n -CONFIG_LM3S_DISABLE_GPIOF_IRQS=n -CONFIG_LM3S_DISABLE_GPIOG_IRQS=n +# Select LM3S Peripheral Support +# +CONFIG_LM3S_UART0=y +# CONFIG_LM3S_UART1 is not set +# CONFIG_SSI0_DISABLE is not set +CONFIG_SSI1_DISABLE=y +# CONFIG_LM3S_UART2 is not set +# CONFIG_LM3S_ETHERNET is not set + +# +# Disable GPIO Interrupts +# +# CONFIG_LM3S_DISABLE_GPIOA_IRQS is not set +# CONFIG_LM3S_DISABLE_GPIOB_IRQS is not set +# CONFIG_LM3S_DISABLE_GPIOC_IRQS is not set +# CONFIG_LM3S_DISABLE_GPIOD_IRQS is not set +# CONFIG_LM3S_DISABLE_GPIOE_IRQS is not set +# CONFIG_LM3S_DISABLE_GPIOF_IRQS is not set +# CONFIG_LM3S_DISABLE_GPIOG_IRQS is not set CONFIG_LM3S_DISABLE_GPIOH_IRQS=y CONFIG_LM3S_DISABLE_GPIOJ_IRQS=y # -# LM3S6965 specific serial device driver settings +# LM3S SSI Configuration # -CONFIG_LM3S_UART0=y -CONFIG_LM3S_UART1=n -CONFIG_LM3S_UART2=n -CONFIG_UART0_SERIAL_CONSOLE=y -CONFIG_UART1_SERIAL_CONSOLE=n -CONFIG_UART2_SERIAL_CONSOLE=n -CONFIG_UART0_TXBUFSIZE=256 -CONFIG_UART1_TXBUFSIZE=256 -CONFIG_UART2_TXBUFSIZE=256 -CONFIG_UART0_RXBUFSIZE=256 -CONFIG_UART1_RXBUFSIZE=256 -CONFIG_UART2_RXBUFSIZE=256 -CONFIG_UART0_BAUD=115200 -CONFIG_UART1_BAUD=115200 -CONFIG_UART2_BAUD=115200 -CONFIG_UART0_BITS=8 -CONFIG_UART1_BITS=8 -CONFIG_UART2_BITS=8 -CONFIG_UART0_PARITY=0 -CONFIG_UART1_PARITY=0 -CONFIG_UART2_PARITY=0 -CONFIG_UART0_2STOP=0 -CONFIG_UART1_2STOP=0 -CONFIG_UART2_2STOP=0 - -# -# LM3S6965 specific SSI device driver settings -# -CONFIG_SSI0_DISABLE=n -CONFIG_SSI1_DISABLE=y CONFIG_SSI_POLLWAIT=y -#CONFIG_SSI_TXLIMIT=4 +CONFIG_SSI_TXLIMIT=4 +# CONFIG_SDIO_DMA is not set +# CONFIG_SDIO_WIDTH_D1_ONLY is not set # -# LM3S6965 specific serial device driver settings +# Architecture Options # -CONFIG_LM3S_ETHERNET=n -CONFIG_LM3S_ETHLEDS=n -CONFIG_LM3S_BOARDMAC=y -CONFIG_LM3S_ETHHDUPLEX=n -CONFIG_LM3S_ETHNOAUTOCRC=n -CONFIG_LM3S_ETHNOPAD=n -CONFIG_LM3S_MULTICAST=n -CONFIG_LM3S_PROMISCUOUS=n -CONFIG_LM3S_BADCRC=n -CONFIG_LM3S_DUMPPACKET=n +# CONFIG_ARCH_NOINTC is not set +# CONFIG_ARCH_DMA is not set +CONFIG_ARCH_IRQPRIO=y +# CONFIG_CUSTOM_STACK is not set +# CONFIG_ADDRENV is not set +CONFIG_ARCH_STACKDUMP=y +# CONFIG_ENDIAN_BIG is not set # -# General build options +# Board Settings # -CONFIG_RRLOAD_BINARY=n -CONFIG_INTELHEX_BINARY=n -CONFIG_MOTOROLA_SREC=n -CONFIG_RAW_BINARY=y +CONFIG_DRAM_START=0x20000000 +CONFIG_DRAM_SIZE=65536 +CONFIG_ARCH_HAVE_INTERRUPTSTACK=y +CONFIG_ARCH_INTERRUPTSTACK=0 # -# General OS setup +# Boot options # -CONFIG_USER_ENTRYPOINT="ostest_main" -CONFIG_DEBUG=n -CONFIG_DEBUG_VERBOSE=n -CONFIG_DEBUG_SYMBOLS=n -CONFIG_MM_REGIONS=1 -CONFIG_ARCH_LOWPUTC=y +# CONFIG_BOOT_RUNFROMEXTSRAM is not set +CONFIG_BOOT_RUNFROMFLASH=y +# CONFIG_BOOT_RUNFROMISRAM is not set +# CONFIG_BOOT_RUNFROMSDRAM is not set +# CONFIG_BOOT_COPYTORAM is not set + +# +# Board Selection +# +CONFIG_ARCH_BOARD_LM3S6965EK=y +# CONFIG_ARCH_BOARD_CUSTOM is not set +CONFIG_ARCH_BOARD="lm3s6965-ek" + +# +# Common Board Options +# +CONFIG_ARCH_HAVE_LEDS=y +CONFIG_ARCH_LEDS=y + +# +# Board-Specific Options +# + +# +# RTOS Features +# +CONFIG_MSEC_PER_TICK=10 CONFIG_RR_INTERVAL=200 -CONFIG_SCHED_INSTRUMENTATION=n +# CONFIG_SCHED_INSTRUMENTATION is not set CONFIG_TASK_NAME_SIZE=0 +# CONFIG_JULIAN_TIME is not set CONFIG_START_YEAR=2010 CONFIG_START_MONTH=5 CONFIG_START_DAY=6 -CONFIG_GREGORIAN_TIME=n -CONFIG_JULIAN_TIME=n CONFIG_DEV_CONSOLE=y -CONFIG_DEV_LOWCONSOLE=y -CONFIG_MUTEX_TYPES=n -CONFIG_PRIORITY_INHERITANCE=n -CONFIG_SEM_PREALLOCHOLDERS=0 -CONFIG_SEM_NNESTPRIO=0 -CONFIG_FDCLONE_DISABLE=n -CONFIG_FDCLONE_STDIO=n +# CONFIG_MUTEX_TYPES is not set +# CONFIG_PRIORITY_INHERITANCE is not set +# CONFIG_FDCLONE_DISABLE is not set +# CONFIG_FDCLONE_STDIO is not set CONFIG_SDCLONE_DISABLE=y -CONFIG_NXFLAT=n - -# -# The following can be used to disable categories of -# APIs supported by the OS. If the compiler supports -# weak functions, then it should not be necessary to -# disable functions unless you want to restrict usage -# of those APIs. -# -# There are certain dependency relationships in these -# features. -# -# o mq_notify logic depends on signals to awaken tasks -# waiting for queues to become full or empty. -# o pthread_condtimedwait() depends on signals to wake -# up waiting tasks. -# -CONFIG_DISABLE_CLOCK=n -CONFIG_DISABLE_POSIX_TIMERS=n -CONFIG_DISABLE_PTHREAD=n -CONFIG_DISABLE_SIGNALS=n -CONFIG_DISABLE_MQUEUE=n +# CONFIG_SCHED_WORKQUEUE is not set +# CONFIG_SCHED_WAITPID is not set +# CONFIG_SCHED_ATEXIT is not set +# CONFIG_SCHED_ONEXIT is not set +CONFIG_USER_ENTRYPOINT="ostest_main" +CONFIG_DISABLE_OS_API=y +# CONFIG_DISABLE_CLOCK is not set +# CONFIG_DISABLE_POSIX_TIMERS is not set +# CONFIG_DISABLE_PTHREAD is not set +# CONFIG_DISABLE_SIGNALS is not set +# CONFIG_DISABLE_MQUEUE is not set CONFIG_DISABLE_MOUNTPOINT=y CONFIG_DISABLE_ENVIRON=y CONFIG_DISABLE_POLL=y -# -# Misc libc settings -# -CONFIG_NOPRINTF_FIELDWIDTH=n - -# -# Allow for architecture optimized implementations -# -# The architecture can provide optimized versions of the -# following to improve system performance -# -CONFIG_ARCH_MEMCPY=n -CONFIG_ARCH_MEMCMP=n -CONFIG_ARCH_MEMMOVE=n -CONFIG_ARCH_MEMSET=n -CONFIG_ARCH_STRCMP=n -CONFIG_ARCH_STRCPY=n -CONFIG_ARCH_STRNCPY=n -CONFIG_ARCH_STRLEN=n -CONFIG_ARCH_STRNLEN=n -CONFIG_ARCH_BZERO=n - # # Sizes of configurable things (0 disables) # @@ -216,132 +218,313 @@ CONFIG_NPTHREAD_KEYS=4 CONFIG_NFILE_DESCRIPTORS=8 CONFIG_NFILE_STREAMS=8 CONFIG_NAME_MAX=32 -CONFIG_STDIO_BUFFER_SIZE=256 -CONFIG_NUNGET_CHARS=2 CONFIG_PREALLOC_MQ_MSGS=4 CONFIG_MQ_MAXMSGSIZE=32 CONFIG_MAX_WDOGPARMS=2 CONFIG_PREALLOC_WDOGS=4 CONFIG_PREALLOC_TIMERS=4 -# -# Filesystem configuration -# -CONFIG_FS_FAT=n -CONFIG_FS_ROMFS=n - -# -# Maintain legacy build behavior (revisit) -# - -CONFIG_MMCSD=y -CONFIG_MMCSD_SPI=y -CONFIG_MMCSD_SDIO=y - -# -# SPI-based MMC/SD driver -# -CONFIG_MMCSD_NSLOTS=1 -CONFIG_MMCSD_READONLY=n -CONFIG_MMCSD_SPICLOCK=12500000 - -# -# TCP/IP and UDP support via uIP -# -CONFIG_NET=n -CONFIG_NET_IPv6=n -CONFIG_NSOCKET_DESCRIPTORS=0 -CONFIG_NET_SOCKOPTS=y -CONFIG_NET_BUFSIZE=420 -CONFIG_NET_TCP=n -CONFIG_NET_TCP_CONNS=40 -CONFIG_NET_MAX_LISTENPORTS=40 -CONFIG_NET_UDP=n -CONFIG_NET_UDP_CHECKSUMS=y -#CONFIG_NET_UDP_CONNS=10 -CONFIG_NET_ICMP=n -CONFIG_NET_ICMP_PING=n -#CONFIG_NET_PINGADDRCONF=0 -CONFIG_NET_STATISTICS=y -#CONFIG_NET_RECEIVE_WINDOW= -#CONFIG_NET_ARPTAB_SIZE=8 -CONFIG_NET_BROADCAST=n - -# -# UIP Network Utilities -# -CONFIG_NET_DHCP_LIGHT=n -CONFIG_NET_RESOLV_ENTRIES=4 - -# -# Settings for examples/uip -# -CONFIG_EXAMPLES_UIP_IPADDR=0x0a000002 -CONFIG_EXAMPLES_UIP_DRIPADDR=0x0a000001 -CONFIG_EXAMPLES_UIP_NETMASK=0xffffff00 -CONFIG_EXAMPLES_UIP_DHCPC=n - -# -# Settings for examples/nettest -CONFIG_EXAMPLES_NETTEST_SERVER=n -CONFIG_EXAMPLES_NETTEST_PERFORMANCE=n -CONFIG_EXAMPLES_NETTEST_NOMAC=n -CONFIG_EXAMPLES_NETTEST_IPADDR=0x0a000002 -CONFIG_EXAMPLES_NETTEST_DRIPADDR=0x0a000001 -CONFIG_EXAMPLES_NETTEST_NETMASK=0xffffff00 -CONFIG_EXAMPLES_NETTEST_CLIENTIP=0x0a000001 - -# -# Settings for examples/ostest -# -CONFIG_EXAMPLES_OSTEST_LOOPS=1 -CONFIG_EXAMPLES_OSTEST_STACKSIZE=2048 -CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3 - -# -# Settings for apps/nshlib -# -CONFIG_NSH_FILEIOSIZE=512 -CONFIG_NSH_STRERROR=n -CONFIG_NSH_LINELEN=64 -CONFIG_NSH_NESTDEPTH=3 -CONFIG_NSH_DISABLESCRIPT=n -CONFIG_NSH_DISABLEBG=n -CONFIG_NSH_ROMFSETC=n -CONFIG_NSH_CONSOLE=y -CONFIG_NSH_TELNET=n -CONFIG_NSH_ARCHINIT=n -CONFIG_NSH_IOBUFFER_SIZE=512 -CONFIG_NSH_DHCPC=n -CONFIG_NSH_NOMAC=n -CONFIG_NSH_IPADDR=0x0a000002 -CONFIG_NSH_DRIPADDR=0x0a000001 -CONFIG_NSH_NETMASK=0xffffff00 -CONFIG_NSH_ROMFSMOUNTPT="/etc" -CONFIG_NSH_INITSCRIPT="init.d/rcS" -CONFIG_NSH_ROMFSDEVNO=0 -CONFIG_NSH_ROMFSSECTSIZE=64 -CONFIG_NSH_FATDEVNO=1 -CONFIG_NSH_FATSECTSIZE=512 -CONFIG_NSH_FATNSECTORS=1024 -CONFIG_NSH_FATMOUNTPT="/tmp" - -# -# Architecture-specific NSH options -# -CONFIG_NSH_MMCSDSPIPORTNO=0 -CONFIG_NSH_MMCSDSLOTNO=0 -CONFIG_NSH_MMCSDMINOR=0 - # # Stack and heap information # -CONFIG_BOOT_RUNFROMFLASH=n -CONFIG_BOOT_COPYTORAM=n -CONFIG_CUSTOM_STACK=n CONFIG_IDLETHREAD_STACKSIZE=1024 CONFIG_USERMAIN_STACKSIZE=2048 CONFIG_PTHREAD_STACK_MIN=256 CONFIG_PTHREAD_STACK_DEFAULT=2048 -CONFIG_HEAP_BASE= -CONFIG_HEAP_SIZE= + +# +# Device Drivers +# +CONFIG_DEV_NULL=y +# CONFIG_DEV_ZERO is not set +# CONFIG_LOOP is not set +# CONFIG_RAMDISK is not set +# CONFIG_CAN is not set +# CONFIG_PWM is not set +# CONFIG_I2C is not set +# CONFIG_SPI is not set +# CONFIG_RTC is not set +# CONFIG_WATCHDOG is not set +# CONFIG_ANALOG is not set +# CONFIG_BCH is not set +# CONFIG_INPUT is not set +# CONFIG_LCD is not set +CONFIG_MMCSD=y +CONFIG_MMCSD_NSLOTS=1 +# CONFIG_MMCSD_READONLY is not set +# CONFIG_MMCSD_MULTIBLOCK_DISABLE is not set +CONFIG_MMCSD_MMCSUPPORT=y +CONFIG_MMCSD_HAVECARDDETECT=y +CONFIG_MMCSD_SPI=y +CONFIG_MMCSD_SPICLOCK=12500000 +CONFIG_MMCSD_SDIO=y +# CONFIG_SDIO_MUXBUS is not set +# CONFIG_MTD is not set +# CONFIG_PIPES is not set +# CONFIG_PM is not set +# CONFIG_POWER is not set +# CONFIG_SENSORS is not set +# CONFIG_SERCOMM_CONSOLE is not set +CONFIG_SERIAL=y +CONFIG_DEV_LOWCONSOLE=y +# CONFIG_16550_UART is not set +CONFIG_ARCH_HAVE_UART0=y +CONFIG_MCU_SERIAL=y +CONFIG_UART0_SERIAL_CONSOLE=y +# CONFIG_NO_SERIAL_CONSOLE is not set + +# +# UART0 Configuration +# +CONFIG_UART0_RXBUFSIZE=256 +CONFIG_UART0_TXBUFSIZE=256 +CONFIG_UART0_BAUD=115200 +CONFIG_UART0_BITS=8 +CONFIG_UART0_PARITY=0 +CONFIG_UART0_2STOP=0 +# CONFIG_USBDEV is not set +# CONFIG_USBHOST is not set +# CONFIG_WIRELESS is not set + +# +# System Logging Device Options +# + +# +# System Logging +# +# CONFIG_RAMLOG is not set + +# +# Networking Support +# +# CONFIG_NET is not set + +# +# File Systems +# + +# +# File system configuration +# +# CONFIG_FS_RAMMAP is not set + +# +# System Logging +# +# CONFIG_SYSLOG is not set + +# +# Graphics Support +# +# CONFIG_NX is not set + +# +# Memory Management +# +# CONFIG_MM_SMALL is not set +CONFIG_MM_REGIONS=1 +# CONFIG_GRAN is not set + +# +# Binary Formats +# +# CONFIG_BINFMT_DISABLE is not set +# CONFIG_NXFLAT is not set +# CONFIG_ELF is not set +# CONFIG_PIC is not set +# CONFIG_SYMTAB_ORDEREDBYNAME is not set + +# +# Library Routines +# + +# +# Standard C Library Options +# +CONFIG_STDIO_BUFFER_SIZE=256 +CONFIG_STDIO_LINEBUFFER=y +CONFIG_NUNGET_CHARS=2 +# CONFIG_LIBM is not set +# CONFIG_NOPRINTF_FIELDWIDTH is not set +# CONFIG_LIBC_FLOATINGPOINT is not set +# CONFIG_EOL_IS_CR is not set +# CONFIG_EOL_IS_LF is not set +# CONFIG_EOL_IS_BOTH_CRLF is not set +CONFIG_EOL_IS_EITHER_CRLF=y +# CONFIG_LIBC_STRERROR is not set +# CONFIG_LIBC_PERROR_STDOUT is not set +CONFIG_ARCH_LOWPUTC=y +CONFIG_LIB_SENDFILE_BUFSIZE=512 +# CONFIG_ARCH_ROMGETC is not set +# CONFIG_ARCH_OPTIMIZED_FUNCTIONS is not set + +# +# Non-standard Helper Functions +# +CONFIG_LIB_KBDCODEC=y + +# +# Basic CXX Support +# +# CONFIG_C99_BOOL8 is not set +# CONFIG_HAVE_CXX is not set + +# +# Application Configuration +# + +# +# Built-In Applications +# +# CONFIG_BUILTIN is not set + +# +# Examples +# +# CONFIG_EXAMPLES_BUTTONS is not set +# CONFIG_EXAMPLES_CAN is not set +# CONFIG_EXAMPLES_CDCACM is not set +# CONFIG_EXAMPLES_COMPOSITE is not set +# CONFIG_EXAMPLES_DHCPD is not set +# CONFIG_EXAMPLES_ELF is not set +# CONFIG_EXAMPLES_FTPC is not set +# CONFIG_EXAMPLES_FTPD is not set +# CONFIG_EXAMPLES_HELLO is not set +# CONFIG_EXAMPLES_HELLOXX is not set +# CONFIG_EXAMPLES_JSON is not set +# CONFIG_EXAMPLES_HIDKBD is not set +# CONFIG_EXAMPLES_KEYPADTEST is not set +# CONFIG_EXAMPLES_IGMP is not set +# CONFIG_EXAMPLES_LCDRW is not set +# CONFIG_EXAMPLES_MM is not set +# CONFIG_EXAMPLES_MOUNT is not set +# CONFIG_EXAMPLES_MODBUS is not set +# CONFIG_EXAMPLES_NETTEST is not set +# CONFIG_EXAMPLES_NSH is not set +# CONFIG_EXAMPLES_NULL is not set +# CONFIG_EXAMPLES_NX is not set +# CONFIG_EXAMPLES_NXCONSOLE is not set +# CONFIG_EXAMPLES_NXFFS is not set +# CONFIG_EXAMPLES_NXFLAT is not set +# CONFIG_EXAMPLES_NXHELLO is not set +# CONFIG_EXAMPLES_NXIMAGE is not set +# CONFIG_EXAMPLES_NXLINES is not set +# CONFIG_EXAMPLES_NXTEXT is not set +CONFIG_EXAMPLES_OSTEST=y +# CONFIG_EXAMPLES_OSTEST_BUILTIN is not set +CONFIG_EXAMPLES_OSTEST_LOOPS=1 +CONFIG_EXAMPLES_OSTEST_STACKSIZE=2048 +CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3 +CONFIG_EXAMPLES_OSTEST_RR_RANGE=10000 +CONFIG_EXAMPLES_OSTEST_RR_RUNS=10 +# CONFIG_EXAMPLES_PASHELLO is not set +# CONFIG_EXAMPLES_PIPE is not set +# CONFIG_EXAMPLES_POLL is not set +# CONFIG_EXAMPLES_QENCODER is not set +# CONFIG_EXAMPLES_RGMP is not set +# CONFIG_EXAMPLES_ROMFS is not set +# CONFIG_EXAMPLES_SENDMAIL is not set +# CONFIG_EXAMPLES_SERLOOP is not set +# CONFIG_EXAMPLES_TELNETD is not set +# CONFIG_EXAMPLES_THTTPD is not set +# CONFIG_EXAMPLES_TIFF is not set +# CONFIG_EXAMPLES_TOUCHSCREEN is not set +# CONFIG_EXAMPLES_UDP is not set +# CONFIG_EXAMPLES_UIP is not set +# CONFIG_EXAMPLES_USBSERIAL is not set +# CONFIG_EXAMPLES_USBMSC is not set +# CONFIG_EXAMPLES_USBTERM is not set +# CONFIG_EXAMPLES_WATCHDOG is not set + +# +# Interpreters +# + +# +# Interpreters +# +# CONFIG_INTERPRETERS_FICL is not set +# CONFIG_INTERPRETERS_PCODE is not set + +# +# Network Utilities +# + +# +# Networking Utilities +# +# CONFIG_NETUTILS_CODECS is not set +# CONFIG_NETUTILS_DHCPC is not set +# CONFIG_NETUTILS_DHCPD is not set +# CONFIG_NETUTILS_FTPC is not set +# CONFIG_NETUTILS_FTPD is not set +# CONFIG_NETUTILS_JSON is not set +# CONFIG_NETUTILS_RESOLV is not set +# CONFIG_NETUTILS_SMTP is not set +# CONFIG_NETUTILS_TELNETD is not set +# CONFIG_NETUTILS_TFTPC is not set +# CONFIG_NETUTILS_THTTPD is not set +# CONFIG_NETUTILS_UIPLIB is not set +# CONFIG_NETUTILS_WEBCLIENT is not set + +# +# ModBus +# + +# +# FreeModbus +# +# CONFIG_MODBUS is not set + +# +# NSH Library +# +# CONFIG_NSH_LIBRARY is not set + +# +# NxWidgets/NxWM +# + +# +# System NSH Add-Ons +# + +# +# Custom Free Memory Command +# +# CONFIG_SYSTEM_FREE is not set + +# +# I2C tool +# + +# +# FLASH Program Installation +# +# CONFIG_SYSTEM_INSTALL is not set + +# +# readline() +# +# CONFIG_SYSTEM_READLINE is not set + +# +# Power Off +# +# CONFIG_SYSTEM_POWEROFF is not set + +# +# RAMTRON +# +# CONFIG_SYSTEM_RAMTRON is not set + +# +# SD Card +# +# CONFIG_SYSTEM_SDCARD is not set + +# +# Sysinfo +# +# CONFIG_SYSTEM_SYSINFO is not set From 5d6b2017a05d31b6e7bdeab8defa3717fc72be3a Mon Sep 17 00:00:00 2001 From: patacongo Date: Tue, 1 Jan 2013 16:34:12 +0000 Subject: [PATCH 024/118] All lm3s6965-ek configurations converted to use kconfig-frontends git-svn-id: http://svn.code.sf.net/p/nuttx/code/trunk@5471 42af7a65-404d-4744-a932-0658087f49c3 --- apps/examples/nx/Kconfig | 128 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 128 insertions(+) diff --git a/apps/examples/nx/Kconfig b/apps/examples/nx/Kconfig index 2081b12dc3..f636daf84f 100644 --- a/apps/examples/nx/Kconfig +++ b/apps/examples/nx/Kconfig @@ -10,4 +10,132 @@ config EXAMPLES_NX Enable the NX graphics example if EXAMPLES_NX + +config EXAMPLES_NX_BUILTIN + bool "NSH Built-IN" + depends on NSH_BUILTIN_APPS + ---help--- + Build the NX example as a "built-in" that can be executed from the + NSH command line + +config EXAMPLES_NX_VPLANE + int "Video Plane" + default 0 + ---help--- + The plane to select from the framebuffer driver for use in the test. + Default: 0 + +config EXAMPLES_NX_DEVNO + int "Video Device Number" + default 0 + ---help--- + The LCD device to select from the LCD driver for use in the test: + Default: 0 + +config EXAMPLES_NX_DEFAULT_COLORS + bool "Use Default Colors" + default y + +if !EXAMPLES_NX_DEFAULT_COLORS + +config EXAMPLES_NX_BGCOLOR + hex "Background Color" + ---help--- + The color of the background. Default depends on config EXAMPLES_NX_BPP. + +config EXAMPLES_NX_COLOR1 + hex "Color of Window 1" + ---help--- + The color of window 1. Default depends on config EXAMPLES_NX_BPP. + +config EXAMPLES_NX_COLOR2 + hex "Color of Window 2" + ---help--- + The color of window 2. Default depends on config EXAMPLES_NX_BPP. + +config EXAMPLES_NX_TBCOLOR + hex "Toolbar Color" + ---help--- + The color of the toolbar. Default depends on config EXAMPLES_NX_BPP. + +config EXAMPLES_NX_FONTCOLOR + hex "Font Color" + ---help--- + The color of the fonts. Default depends on config EXAMPLES_NX_BPP. + +endif + +config EXAMPLES_NX_DEFAULT_FONT + bool "Use Default Font" + default y + +config EXAMPLES_NX_FONTID + bool "Font ID" + depends on !EXAMPLES_NX_DEFAULT_FONT + ---help--- + Selects the font (see font ID numbers in include/nuttx/nx/nxfonts.h) + +config EXAMPLES_NX_BPP + int "Bits-Per-Pixel" + default 32 + ---help--- + Pixels per pixel to use. Valid options include 2, 4, 8, 16, 24, + and 32. Default is 32. + +config EXAMPLES_NX_RAWWINDOWS + bool "Use Raw Windows" + default n + ---help--- + Use raw windows; Default is to use pretty, framed NXTK windows with + toolbars. + +config EXAMPLES_NX_EXTERNINIT + bool "External Device Initialization" + default n + ---help--- + The driver for the graphics device on this platform requires some + unusual initialization. This is the for, for example, SPI LCD/OLED + devices. If this configuration is selected, then the platform code + must provide an LCD initialization function with a prototype like: + + #ifdef CONFIG_NX_LCDDRIVER + FAR struct lcd_dev_s *up_nxdrvinit(unsigned int devno); + #else + FAR struct fb_vtable_s *up_nxdrvinit(unsigned int devno); + #endif + +if NX_MULTIUSER +comment "Multi-User Configuration Options" + +config EXAMPLES_NX_STACKSIZE + int "NX Server Stack Size" + default 2048 + ---help--- + The stacksize to use when creating the NX server. Default 2048 + +config EXAMPLES_NX_CLIENTPRIO + int "Client Priority" + default 100 + ---help--- + The client priority. Default: 100 + +config EXAMPLES_NX_SERVERPRIO + int "Server Priority" + default 120 + ---help--- + The server priority. Default: 120 + +config EXAMPLES_NX_LISTENERPRIO + int "Listener Priority" + default 80 + ---help--- + The priority of the event listener thread. Default 80. + +config EXAMPLES_NX_NOTIFYSIGNO + int "Notify Signal Number" + default 4 + ---help--- + The signal number to use with nx_eventnotify(). Default: 4 + +endif endif From d0d3328d9cec65a161330c29aa318d1a3ded63e3 Mon Sep 17 00:00:00 2001 From: patacongo Date: Wed, 2 Jan 2013 14:02:07 +0000 Subject: [PATCH 025/118] Misc fixes for LM3S kconfig-frontends build git-svn-id: http://svn.code.sf.net/p/nuttx/code/trunk@5472 42af7a65-404d-4744-a932-0658087f49c3 --- misc/buildroot/configs/cortexm3-defconfig-4.3.3 | 7 +++++++ nuttx/ChangeLog | 5 ++++- nuttx/arch/arm/src/arm/Kconfig | 7 +++++++ nuttx/arch/arm/src/arm/Toolchain.defs | 5 +++++ nuttx/arch/arm/src/armv7-m/Kconfig | 8 ++++++++ nuttx/arch/arm/src/armv7-m/Toolchain.defs | 11 ++++++----- nuttx/configs/Kconfig | 2 +- nuttx/configs/lm3s6965-ek/nsh/defconfig | 7 ++++++- nuttx/configs/lm3s6965-ek/nx/defconfig | 1 + nuttx/configs/lm3s6965-ek/ostest/defconfig | 1 + nuttx/drivers/Kconfig | 3 ++- nuttx/drivers/mmcsd/Kconfig | 3 ++- 12 files changed, 50 insertions(+), 10 deletions(-) diff --git a/misc/buildroot/configs/cortexm3-defconfig-4.3.3 b/misc/buildroot/configs/cortexm3-defconfig-4.3.3 index 664000a168..a3371531be 100644 --- a/misc/buildroot/configs/cortexm3-defconfig-4.3.3 +++ b/misc/buildroot/configs/cortexm3-defconfig-4.3.3 @@ -14,6 +14,7 @@ BR2_arm=y # BR2_m68k is not set # BR2_m68hc11 is not set # BR2_m68hc12 is not set +# BR2_m9s12x is not set # BR2_mips is not set # BR2_mipsel is not set # BR2_nios2 is not set @@ -71,8 +72,11 @@ BR2_GNU_TARGET_SUFFIX="nuttx-elf" # Binutils Options # # BR2_BINUTILS_VERSION_2_17 is not set +# BR2_BINUTILS_VERSION_2_18 is not set # BR2_BINUTILS_VERSION_2_19 is not set BR2_BINUTILS_VERSION_2_19_1=y +# BR2_BINUTILS_VERSION_2_21_1 is not set +# BR2_BINUTILS_VERSION_2_22 is not set BR2_BINUTILS_VERSION="2.19.1" BR2_EXTRA_BINUTILS_CONFIG_OPTIONS="" @@ -80,9 +84,12 @@ BR2_EXTRA_BINUTILS_CONFIG_OPTIONS="" # GCC Options # BR2_PACKAGE_GCC=y +# BR2_GCC_VERSION_3_3_6 is not set # BR2_GCC_VERSION_3_4_6 is not set # BR2_GCC_VERSION_4_2_4 is not set BR2_GCC_VERSION_4_3_3=y +# BR2_GCC_VERSION_4_5_2 is not set +# BR2_GCC_VERSION_4_6_3 is not set BR2_GCC_SUPPORTS_SYSROOT=y BR2_GCC_VERSION="4.3.3" # BR2_GCC_USE_SJLJ_EXCEPTIONS is not set diff --git a/nuttx/ChangeLog b/nuttx/ChangeLog index 7f2bda4579..ee43a897e5 100644 --- a/nuttx/ChangeLog +++ b/nuttx/ChangeLog @@ -3851,4 +3851,7 @@ Updates and correctinos for the UG-2864HSWEG01 from Darcy Gong. * configs/lm326965-ek: All configurations converted to use the kconfig-frontends configuration tool. - + * configs/Kconfig: NSH_MMCSDSPIPORTNO should depend on MMCSD_SPI, + not just SPI (from Jose Pablo Carballo). + * arch/arm/src/arm/Kconfig and armv7m/Kconfig: Add an option for + buildroot toolchains: They may be EABI or OABI. diff --git a/nuttx/arch/arm/src/arm/Kconfig b/nuttx/arch/arm/src/arm/Kconfig index 0d08d89a8e..665fab5758 100644 --- a/nuttx/arch/arm/src/arm/Kconfig +++ b/nuttx/arch/arm/src/arm/Kconfig @@ -33,3 +33,10 @@ config ARM_TOOLCHAIN_GNU_EABI configured for arm-none-eabi. endchoice + +config ARM_OABI_TOOLCHAIN + bool "OABI (vs EABI)" + default y + depends on ARM_TOOLCHAIN_BUILDROOT + ---help--- + Most of the older buildroot toolchains are OABI and are named arm-nuttx-elf- vs. arm-nuttx-eabi- diff --git a/nuttx/arch/arm/src/arm/Toolchain.defs b/nuttx/arch/arm/src/arm/Toolchain.defs index defe30b51b..ea11c4dc90 100644 --- a/nuttx/arch/arm/src/arm/Toolchain.defs +++ b/nuttx/arch/arm/src/arm/Toolchain.defs @@ -102,8 +102,13 @@ endif # NuttX buildroot under Linux or Cygwin ifeq ($(CONFIG_ARM_TOOLCHAIN),BUILDROOT) +ifeq ($(CONFIG_ARMV_OABI_TOOLCHAIN),y) CROSSDEV = arm-nuttx-elf- ARCROSSDEV = arm-nuttx-elf- +else + CROSSDEV = arm-nuttx-eabi- + ARCROSSDEV = arm-nuttx-eabi- +endif MAXOPTIMIZATION = -Os endif diff --git a/nuttx/arch/arm/src/armv7-m/Kconfig b/nuttx/arch/arm/src/armv7-m/Kconfig index dc5aa39153..a154a4c5c4 100644 --- a/nuttx/arch/arm/src/armv7-m/Kconfig +++ b/nuttx/arch/arm/src/armv7-m/Kconfig @@ -49,3 +49,11 @@ config ARMV7M_TOOLCHAIN_RAISONANCE depends on HOST_WINDOWS endchoice + +config ARMV7M_OABI_TOOLCHAIN + bool "OABI (vs EABI)" + default y + depends on ARMV7M_TOOLCHAIN_BUILDROOT + ---help--- + Most of the older buildroot toolchains are OABI and are named arm-nuttx-elf- vs. arm-nuttx-eabi- + diff --git a/nuttx/arch/arm/src/armv7-m/Toolchain.defs b/nuttx/arch/arm/src/armv7-m/Toolchain.defs index e214ce8bd0..d7f2ed77f1 100644 --- a/nuttx/arch/arm/src/armv7-m/Toolchain.defs +++ b/nuttx/arch/arm/src/armv7-m/Toolchain.defs @@ -160,14 +160,15 @@ endif # NuttX buildroot under Linux or Cygwin ifeq ($(CONFIG_ARMV7M_TOOLCHAIN),BUILDROOT) - # OABI - # CROSSDEV = arm-nuttx-elf- - # ARCROSSDEV = arm-nuttx-elf- - # ARCHCPUFLAGS = -mtune=cortex-m3 -march=armv7-m -mfloat-abi=soft - # EABI +ifeq ($(CONFIG_ARMV7M_OABI_TOOLCHAIN),y) + CROSSDEV = arm-nuttx-elf- + ARCROSSDEV = arm-nuttx-elf- + ARCHCPUFLAGS = -mtune=cortex-m3 -march=armv7-m -mfloat-abi=soft +else CROSSDEV = arm-nuttx-eabi- ARCROSSDEV = arm-nuttx-eabi- ARCHCPUFLAGS = -mcpu=cortex-m3 -mthumb -mfloat-abi=soft +endif MAXOPTIMIZATION = -Os endif diff --git a/nuttx/configs/Kconfig b/nuttx/configs/Kconfig index cda5aa7bcd..d851eeccb1 100644 --- a/nuttx/configs/Kconfig +++ b/nuttx/configs/Kconfig @@ -761,7 +761,7 @@ config NSH_MMCSDSLOTNO config NSH_MMCSDSPIPORTNO int "MMC/SD SPI device number" default 0 - depends on NSH_LIBRARY && MMCSD && SPI + depends on NSH_LIBRARY && MMCSD && MMCSD_SPI ---help--- If board-specif NSH start-up logic will mount an SPI-based MMC/SD volume, then this setting may be needed to tell the board logic which SPI bus to use. Default: 0 (meaning is board-specific). diff --git a/nuttx/configs/lm3s6965-ek/nsh/defconfig b/nuttx/configs/lm3s6965-ek/nsh/defconfig index 84651012d6..1213797a77 100755 --- a/nuttx/configs/lm3s6965-ek/nsh/defconfig +++ b/nuttx/configs/lm3s6965-ek/nsh/defconfig @@ -89,6 +89,7 @@ CONFIG_ARMV7M_TOOLCHAIN_BUILDROOT=y # CONFIG_ARMV7M_TOOLCHAIN_CODEREDL is not set # CONFIG_ARMV7M_TOOLCHAIN_CODESOURCERYL is not set # CONFIG_ARMV7M_TOOLCHAIN_GNU_EABI is not set +CONFIG_ARMV7M_OABI_TOOLCHAIN=y # # LM3S Configuration Options @@ -189,6 +190,7 @@ CONFIG_ARCH_HAVE_LEDS=y CONFIG_ARCH_LEDS=y CONFIG_NSH_MMCSDMINOR=0 CONFIG_NSH_MMCSDSLOTNO=0 +CONFIG_NSH_MMCSDSPIPORTNO=0 # # Board-Specific Options @@ -259,7 +261,10 @@ CONFIG_DEV_NULL=y # CONFIG_CAN is not set # CONFIG_PWM is not set # CONFIG_I2C is not set -# CONFIG_SPI is not set +CONFIG_SPI=y +# CONFIG_SPI_OWNBUS is not set +CONFIG_SPI_EXCHANGE=y +# CONFIG_SPI_CMDDATA is not set # CONFIG_RTC is not set # CONFIG_WATCHDOG is not set # CONFIG_ANALOG is not set diff --git a/nuttx/configs/lm3s6965-ek/nx/defconfig b/nuttx/configs/lm3s6965-ek/nx/defconfig index 5fb666e65b..7fca4d7357 100755 --- a/nuttx/configs/lm3s6965-ek/nx/defconfig +++ b/nuttx/configs/lm3s6965-ek/nx/defconfig @@ -89,6 +89,7 @@ CONFIG_ARMV7M_TOOLCHAIN_BUILDROOT=y # CONFIG_ARMV7M_TOOLCHAIN_CODEREDL is not set # CONFIG_ARMV7M_TOOLCHAIN_CODESOURCERYL is not set # CONFIG_ARMV7M_TOOLCHAIN_GNU_EABI is not set +CONFIG_ARMV7M_OABI_TOOLCHAIN=y # # LM3S Configuration Options diff --git a/nuttx/configs/lm3s6965-ek/ostest/defconfig b/nuttx/configs/lm3s6965-ek/ostest/defconfig index d1168ad45a..abfdcc251f 100755 --- a/nuttx/configs/lm3s6965-ek/ostest/defconfig +++ b/nuttx/configs/lm3s6965-ek/ostest/defconfig @@ -89,6 +89,7 @@ CONFIG_ARMV7M_TOOLCHAIN_BUILDROOT=y # CONFIG_ARMV7M_TOOLCHAIN_CODEREDL is not set # CONFIG_ARMV7M_TOOLCHAIN_CODESOURCERYL is not set # CONFIG_ARMV7M_TOOLCHAIN_GNU_EABI is not set +CONFIG_ARMV7M_OABI_TOOLCHAIN=y # # LM3S Configuration Options diff --git a/nuttx/drivers/Kconfig b/nuttx/drivers/Kconfig index 8302d21b71..3ced01b587 100644 --- a/nuttx/drivers/Kconfig +++ b/nuttx/drivers/Kconfig @@ -140,7 +140,8 @@ menuconfig SPI bool "SPI Driver Support" default n ---help--- - This selection enables building of the "upper-half" SPI driver. + This selection enables selection of common SPI options. This option + should be enabled by all platforms that support SPI interfaces. See include/nuttx/spi.h for further SPI driver information. if SPI diff --git a/nuttx/drivers/mmcsd/Kconfig b/nuttx/drivers/mmcsd/Kconfig index f3a64be6ce..5cdc23bcf8 100644 --- a/nuttx/drivers/mmcsd/Kconfig +++ b/nuttx/drivers/mmcsd/Kconfig @@ -39,8 +39,9 @@ config MMCSD_HAVECARDDETECT 100% accurate config MMCSD_SPI - bool "MMC/SD spi transfer support" + bool "MMC/SD SPI transfer support" default y + depends on SPI config MMCSD_SPICLOCK int "MMC/SD maximum SPI clock" From 8d75785fad6f77f796655167bb9087266df2a117 Mon Sep 17 00:00:00 2001 From: patacongo Date: Thu, 3 Jan 2013 13:39:16 +0000 Subject: [PATCH 026/118] STM32 FLASH changes from Freddie Chopin git-svn-id: http://svn.code.sf.net/p/nuttx/code/trunk@5473 42af7a65-404d-4744-a932-0658087f49c3 --- nuttx/ChangeLog | 3 + nuttx/README.txt | 110 +++++++++++++++++++++++++ nuttx/arch/arm/src/stm32/stm32_flash.c | 37 +++++---- nuttx/include/nuttx/progmem.h | 4 +- 4 files changed, 138 insertions(+), 16 deletions(-) diff --git a/nuttx/ChangeLog b/nuttx/ChangeLog index ee43a897e5..0c7a4dcbf5 100644 --- a/nuttx/ChangeLog +++ b/nuttx/ChangeLog @@ -3855,3 +3855,6 @@ not just SPI (from Jose Pablo Carballo). * arch/arm/src/arm/Kconfig and armv7m/Kconfig: Add an option for buildroot toolchains: They may be EABI or OABI. + * include/nuttx/progmem and arch/arm/src/stm32/stm32_flash.c: + Fix a counting bug plus change interface to use either relative + or absolut FLASH addressing (from Freddie Chopin). diff --git a/nuttx/README.txt b/nuttx/README.txt index dc3c9fb673..c00f086a11 100644 --- a/nuttx/README.txt +++ b/nuttx/README.txt @@ -10,6 +10,8 @@ README o Configuring NuttX - Instantiating "Canned" Configurations - NuttX Configuration Tool + - Incompatibilities with Older Configurations + - Converting Older Configurations to use the Configuration Tool - NuttX Configuration Tool under DOS o Toolchains - Cross-Development Toolchains @@ -292,6 +294,114 @@ NuttX Configuration Tool install 'mconf', make certain that your PATH variable includes a path to that installation directory. + The basic configuration order is "bottom-up": + + - Select the build environment, + - Select the processor, + - Select the board, + - Select the supported peripherals + - Configure the device drivers, + - Configure the application options on top of this. + + This is pretty straight forward for creating new configurations + but may be less intuitive for modifying existing configurations. + +Incompatibilities with Older Configurations +------------------------------------------- + + ***** WARNING ***** + + The old legacy, manual configurations and the new kconfig-frontends + configurations are not 100% compatible. Old legacy configurations + can *not* be used with the kconfig-frontends tool: If you run + 'make menuconfig' with a legacy configuration the resulting + configuration will probably not be functional. + + Q: How can I tell if a configuration is a new kconfig-frontends + configuration or an older, manual configuration? + + A: a) New kcondfig-frontends configurations will have this setting + within the defconfig/.config file": + + CONFIG_NUTTX_NEWCONFIG=y + + b) Only old, manual configurations will have an appconfig file + +Converting Older Configurations to use the Configuration Tool +------------------------------------------------------------- + + Q: How can I convert a older, manual configuration into a new, + kconfig-frontends toolchain. + + A: 1) Look at the appconfig file: Each application path there + will now have to have an enabling setting. For example, + if the old appconfig file had: + + CONFIGURED_APPS = examples/ostest + + Then the new configuration will need: + + CONFIG_EXAMPLES_OSTEST=y + + The appconfig file can then be deleted because it will not + be needed after the conversion. + + 2) Build the cmpconfig utility at tools: + + cd tools + make -f Makefile.host cmpconfig + + 3) Perform these steps repeatedly until you are convinced that + the configurations are the same: + + a) Repeat the following until you have account for all of the differences: + + cp configs///defconfig .config + make menuconfig (Just exit and save the new .config file) + tools/cmpconfig configs///defconfig .config | grep file1 + + The final grep will show settings in the old defconfig file that + do not appear in the new .config file (or have a different value + in the new .config file). In the new configuration, you will + probably have to enable certain groups of features. Such + hierarachical enabling options were not part of the older + configuration. + + b) Then make sure these all make sense: + + tools/cmpconfig configs///defconfig .config | grep file2 + + The final grep will show settings in the new .config file that + do not appear in the older defconfig file (or have a different value + in the new .config file). Here you should see only the new + hierarachical enabling options (such as CONFIG_SPI or CONFIG_MMCSD) + plus some other internal configuration settings (like CONFIG_ARCH_HAVE_UART0). + You will have to convince yourself that these new settings all make sense. + + 4) Finally, update the configuration: + + cp .config configs///defconfig + rm configs///appconfig + + NOTE: You should comment out the line containing the CONFIG_APPS_DIR + in the new defconfig file. Why? Because the application directory + may reside at a different location when the configuration is installed + at some later time. + + # CONFIG_APPS_DIR="../apps" + + 5) The updated configuration can then be instantiated in the normal + fashion: + + cd tools + ./configure.sh / + + NOTE: If CONFIG_APPS_DIR is not defined in the defconfig file, + the configure.sh script will find and add the new, correct path to + the application directory (CONFIG_APPS_DIR) when it copies the + defconfig file to the .config file. This is the setting that was + commented out in step 4. + NuttX Configuration Tool under DOS ---------------------------------- diff --git a/nuttx/arch/arm/src/stm32/stm32_flash.c b/nuttx/arch/arm/src/stm32/stm32_flash.c index 83fcc6172e..20b0cfe103 100644 --- a/nuttx/arch/arm/src/stm32/stm32_flash.c +++ b/nuttx/arch/arm/src/stm32/stm32_flash.c @@ -35,7 +35,7 @@ /* Provides standard flash access functions, to be used by the flash mtd driver. * The interface is defined in the include/nuttx/progmem.h - * + * * Requirements during write/erase operations on FLASH: * - HSI must be ON. * - Low Power Modes are not permitted during write/erase @@ -80,7 +80,7 @@ void stm32_flash_unlock(void) if (getreg32(STM32_FLASH_CR) & FLASH_CR_LOCK) { /* Unlock sequence */ - + putreg32(FLASH_KEY1, STM32_FLASH_KEYR); putreg32(FLASH_KEY2, STM32_FLASH_KEYR); } @@ -112,6 +112,11 @@ uint16_t up_progmem_pagesize(uint16_t page) int up_progmem_getpage(uint32_t addr) { + if (addr >= STM32_FLASH_BASE) + { + addr -= STM32_FLASH_BASE; + } + if (addr >= STM32_FLASH_SIZE) { return -EFAULT; @@ -131,14 +136,14 @@ int up_progmem_erasepage(uint16_t page) } /* Get flash ready and begin erasing single page */ - + if (!(getreg32(STM32_RCC_CR) & RCC_CR_HSION)) { return -EPERM; } - + stm32_flash_unlock(); - + modifyreg32(STM32_FLASH_CR, 0, FLASH_CR_PER); putreg32(page * STM32_FLASH_PAGESIZE, STM32_FLASH_AR); modifyreg32(STM32_FLASH_CR, 0, FLASH_CR_STRT); @@ -146,10 +151,10 @@ int up_progmem_erasepage(uint16_t page) while(getreg32(STM32_FLASH_SR) & FLASH_SR_BSY) up_waste(); modifyreg32(STM32_FLASH_CR, FLASH_CR_PER, 0); - + /* Verify */ - - for (addr = page * STM32_FLASH_PAGESIZE + STM32_FLASH_BASE, count = STM32_FLASH_PAGESIZE; + + for (addr = page * STM32_FLASH_PAGESIZE + STM32_FLASH_BASE, count = STM32_FLASH_PAGESIZE; count; count-=4, addr += 4) { if (getreg32(addr) != 0xffffffff) @@ -173,8 +178,8 @@ int up_progmem_ispageerased(uint16_t page) } /* Verify */ - - for (addr = page * STM32_FLASH_PAGESIZE + STM32_FLASH_BASE, count = STM32_FLASH_PAGESIZE; + + for (addr = page * STM32_FLASH_PAGESIZE + STM32_FLASH_BASE, count = STM32_FLASH_PAGESIZE; count; count--, addr++) { if (getreg8(addr) != 0xff) @@ -200,6 +205,11 @@ int up_progmem_write(uint32_t addr, const void *buf, size_t count) /* Check for valid address range */ + if (addr >= STM32_FLASH_BASE) + { + addr -= STM32_FLASH_BASE; + } + if ((addr+count) >= STM32_FLASH_SIZE) { return -EFAULT; @@ -213,10 +223,10 @@ int up_progmem_write(uint32_t addr, const void *buf, size_t count) } stm32_flash_unlock(); - + modifyreg32(STM32_FLASH_CR, 0, FLASH_CR_PG); - - for (addr += STM32_FLASH_BASE; count; count--, hword++, addr+=2) + + for (addr += STM32_FLASH_BASE; count; count-=2, hword++, addr+=2) { /* Write half-word and wait to complete */ @@ -237,7 +247,6 @@ int up_progmem_write(uint32_t addr, const void *buf, size_t count) modifyreg32(STM32_FLASH_CR, FLASH_CR_PG, 0); return -EIO; } - } modifyreg32(STM32_FLASH_CR, FLASH_CR_PG, 0); diff --git a/nuttx/include/nuttx/progmem.h b/nuttx/include/nuttx/progmem.h index ac5a659407..2da59eab1c 100644 --- a/nuttx/include/nuttx/progmem.h +++ b/nuttx/include/nuttx/progmem.h @@ -99,7 +99,7 @@ uint16_t up_progmem_pagesize(uint16_t page); * Address to page conversion * * Input Parameters: - * addr - Address without flash offet (aligned to page0) + * addr - Address with of without flash offset (absolute or aligned to page0) * * Returned Value: * Page or negative value on error. The following errors are reported @@ -165,7 +165,7 @@ int up_progmem_ispageerased(uint16_t page); * the address be aligned inside the page boundaries. * * Input Parameters: - * addr - Address without flash offet (aligned to page0) + * addr - Address with or without flash offset (absolute or aligned to page0) * buf - Pointer to buffer * count - Number of bytes to write * * From 60bd93728b779608fb0733822b7de55308ab738b Mon Sep 17 00:00:00 2001 From: patacongo Date: Thu, 3 Jan 2013 15:45:57 +0000 Subject: [PATCH 027/118] Fix bad conditional in nuttx/libc/misc/Make.defs git-svn-id: http://svn.code.sf.net/p/nuttx/code/trunk@5474 42af7a65-404d-4744-a932-0658087f49c3 --- nuttx/ChangeLog | 2 ++ nuttx/libc/misc/Make.defs | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/nuttx/ChangeLog b/nuttx/ChangeLog index 0c7a4dcbf5..bc698f6ad4 100644 --- a/nuttx/ChangeLog +++ b/nuttx/ChangeLog @@ -3858,3 +3858,5 @@ * include/nuttx/progmem and arch/arm/src/stm32/stm32_flash.c: Fix a counting bug plus change interface to use either relative or absolut FLASH addressing (from Freddie Chopin). + * libc/misc/Make.defs: Fix error in conditional for KBD CODEC. + diff --git a/nuttx/libc/misc/Make.defs b/nuttx/libc/misc/Make.defs index ad0313346b..0d3c87d9d9 100644 --- a/nuttx/libc/misc/Make.defs +++ b/nuttx/libc/misc/Make.defs @@ -65,7 +65,7 @@ CSRCS += lib_dbg.c lib_dumpbuffer.c # Keyboard driver encoder/decoder -ifneq ($(CONFIG_LIB_KBDCODEC),0) +ifeq ($(CONFIG_LIB_KBDCODEC),y) CSRCS += lib_kbdencode.c lib_kbddecode.c endif From 19752b4453e78c844b9ca348992100b594c3eaa1 Mon Sep 17 00:00:00 2001 From: patacongo Date: Thu, 3 Jan 2013 16:18:44 +0000 Subject: [PATCH 028/118] The default should be CONFIG_LIB_KBDCODEC=n git-svn-id: http://svn.code.sf.net/p/nuttx/code/trunk@5475 42af7a65-404d-4744-a932-0658087f49c3 --- nuttx/ChangeLog | 2 ++ nuttx/configs/lm3s6965-ek/nsh/defconfig | 2 +- nuttx/configs/lm3s6965-ek/nx/defconfig | 2 +- nuttx/configs/lm3s6965-ek/ostest/defconfig | 2 +- nuttx/configs/mcu123-lpc214x/nsh/defconfig | 2 +- nuttx/configs/sim/nxlines/defconfig | 2 +- nuttx/configs/zp214xpa/nsh/defconfig | 2 +- nuttx/configs/zp214xpa/nxlines/defconfig | 2 +- nuttx/libc/Kconfig | 2 +- 9 files changed, 10 insertions(+), 8 deletions(-) diff --git a/nuttx/ChangeLog b/nuttx/ChangeLog index bc698f6ad4..2762faf665 100644 --- a/nuttx/ChangeLog +++ b/nuttx/ChangeLog @@ -3859,4 +3859,6 @@ Fix a counting bug plus change interface to use either relative or absolut FLASH addressing (from Freddie Chopin). * libc/misc/Make.defs: Fix error in conditional for KBD CODEC. + * libc/Kconfig and configs/*/defconfig (several): The default + setting should be CONFIG_LIB_KBDCODEC=n diff --git a/nuttx/configs/lm3s6965-ek/nsh/defconfig b/nuttx/configs/lm3s6965-ek/nsh/defconfig index 1213797a77..64f4397cb5 100755 --- a/nuttx/configs/lm3s6965-ek/nsh/defconfig +++ b/nuttx/configs/lm3s6965-ek/nsh/defconfig @@ -424,7 +424,7 @@ CONFIG_LIB_SENDFILE_BUFSIZE=512 # # Non-standard Helper Functions # -CONFIG_LIB_KBDCODEC=y +# CONFIG_LIB_KBDCODEC is not set # # Basic CXX Support diff --git a/nuttx/configs/lm3s6965-ek/nx/defconfig b/nuttx/configs/lm3s6965-ek/nx/defconfig index 7fca4d7357..be75c28755 100755 --- a/nuttx/configs/lm3s6965-ek/nx/defconfig +++ b/nuttx/configs/lm3s6965-ek/nx/defconfig @@ -431,7 +431,7 @@ CONFIG_LIB_SENDFILE_BUFSIZE=512 # # Non-standard Helper Functions # -CONFIG_LIB_KBDCODEC=y +# CONFIG_LIB_KBDCODEC is not set # # Basic CXX Support diff --git a/nuttx/configs/lm3s6965-ek/ostest/defconfig b/nuttx/configs/lm3s6965-ek/ostest/defconfig index abfdcc251f..83e89a6ae7 100755 --- a/nuttx/configs/lm3s6965-ek/ostest/defconfig +++ b/nuttx/configs/lm3s6965-ek/ostest/defconfig @@ -363,7 +363,7 @@ CONFIG_LIB_SENDFILE_BUFSIZE=512 # # Non-standard Helper Functions # -CONFIG_LIB_KBDCODEC=y +# CONFIG_LIB_KBDCODEC is not set # # Basic CXX Support diff --git a/nuttx/configs/mcu123-lpc214x/nsh/defconfig b/nuttx/configs/mcu123-lpc214x/nsh/defconfig index 6ae163386a..e065ef3fb2 100644 --- a/nuttx/configs/mcu123-lpc214x/nsh/defconfig +++ b/nuttx/configs/mcu123-lpc214x/nsh/defconfig @@ -381,7 +381,7 @@ CONFIG_LIB_SENDFILE_BUFSIZE=512 # # Non-standard Helper Functions # -CONFIG_LIB_KBDCODEC=y +# CONFIG_LIB_KBDCODEC is not set # # Basic CXX Support diff --git a/nuttx/configs/sim/nxlines/defconfig b/nuttx/configs/sim/nxlines/defconfig index c023af6743..c798b175fd 100644 --- a/nuttx/configs/sim/nxlines/defconfig +++ b/nuttx/configs/sim/nxlines/defconfig @@ -347,7 +347,7 @@ CONFIG_LIB_SENDFILE_BUFSIZE=512 # # Non-standard Helper Functions # -CONFIG_LIB_KBDCODEC=y +# CONFIG_LIB_KBDCODEC is not set # # Basic CXX Support diff --git a/nuttx/configs/zp214xpa/nsh/defconfig b/nuttx/configs/zp214xpa/nsh/defconfig index 7c7d9d06cf..7f8ddc19b9 100644 --- a/nuttx/configs/zp214xpa/nsh/defconfig +++ b/nuttx/configs/zp214xpa/nsh/defconfig @@ -358,7 +358,7 @@ CONFIG_LIB_SENDFILE_BUFSIZE=512 # # Non-standard Helper Functions # -CONFIG_LIB_KBDCODEC=y +# CONFIG_LIB_KBDCODEC is not set # # Basic CXX Support diff --git a/nuttx/configs/zp214xpa/nxlines/defconfig b/nuttx/configs/zp214xpa/nxlines/defconfig index 03a6bf72cd..209b4a5e4f 100644 --- a/nuttx/configs/zp214xpa/nxlines/defconfig +++ b/nuttx/configs/zp214xpa/nxlines/defconfig @@ -433,7 +433,7 @@ CONFIG_LIB_SENDFILE_BUFSIZE=512 # # Non-standard Helper Functions # -CONFIG_LIB_KBDCODEC=y +# CONFIG_LIB_KBDCODEC is not set # # Basic CXX Support diff --git a/nuttx/libc/Kconfig b/nuttx/libc/Kconfig index a5ff7fd438..0ae56ac57e 100644 --- a/nuttx/libc/Kconfig +++ b/nuttx/libc/Kconfig @@ -280,7 +280,7 @@ comment "Non-standard Helper Functions" config LIB_KBDCODEC bool "Keyboard CODEC" - default y + default n ---help--- In NuttX, a keyboard/keypad driver is simply a character driver that may have an (optional) encoding/decoding layer on the data returned From c504d9e32ec45736356b68afd878705a46d8791e Mon Sep 17 00:00:00 2001 From: patacongo Date: Fri, 4 Jan 2013 16:00:38 +0000 Subject: [PATCH 029/118] Renaming some files in tools/ git-svn-id: http://svn.code.sf.net/p/nuttx/code/trunk@5476 42af7a65-404d-4744-a932-0658087f49c3 --- nuttx/README.txt | 9 +- nuttx/TODO | 84 ++++++---- nuttx/tools/Makefile.host | 22 ++- nuttx/tools/README.txt | 4 +- nuttx/tools/cfgdefine.c | 322 ++++++++++++++++++++++++++++++++++++++ nuttx/tools/cfgdefine.h | 64 ++++++++ nuttx/tools/mkconfig.c | 4 +- nuttx/tools/mkversion.c | 4 +- 8 files changed, 469 insertions(+), 44 deletions(-) create mode 100644 nuttx/tools/cfgdefine.c create mode 100644 nuttx/tools/cfgdefine.h diff --git a/nuttx/README.txt b/nuttx/README.txt index c00f086a11..bfd057351a 100644 --- a/nuttx/README.txt +++ b/nuttx/README.txt @@ -41,6 +41,10 @@ Installing Cygwin tiny setup.exe program and it does the real, internet installation for you. + NOTE: NuttX can also be installed and built on a native Windows + system, but with some loss of tool functionality (see the + discussion "Native Windows Build" below). + Some Cygwin installation tips: 1. Install at C:\cygwin @@ -61,8 +65,9 @@ Installing Cygwin After installing Cygwin, you will get lots of links for installed tools and shells. I use the RXVT native shell. It is fast and reliable and does not require you to run the Cygwin X server (which is neither - fast nor reliable). The rest of these instructions assume that you - are at a bash command line prompt in either Linux or in Cygwin shell. + fast nor reliable). Unless otherwise noted, the rest of these + instructions assume that you are at a bash command line prompt in + either Linux or in Cygwin shell. Download and Unpack ------------------- diff --git a/nuttx/TODO b/nuttx/TODO index 6162431dc9..d37231e1d5 100644 --- a/nuttx/TODO +++ b/nuttx/TODO @@ -6,8 +6,7 @@ standards, things that could be improved, and ideas for enhancements. nuttx/ - (6) Task/Scheduler (sched/) - (1) On-demand paging (sched/) + (10) Task/Scheduler (sched/) (1) Memory Managment (mm/) (2) Signals (sched/, arch/) (2) pthreads (sched/) @@ -56,14 +55,9 @@ o Task/Scheduler (sched/) Title: CHILD PTHREAD TERMINATION Description: When a tasks exits, shouldn't all of its child pthreads also be terminated? - Status: Open + Status: Closed. No, this behavior will not be implemented. Priority: Medium, required for good emulation of process/pthread model. - Title: MMAN.H - Description: Implement sys/mman.h and functions - Status: Open - Priority: Low - Title: WAIT.H Description: Implement sys/wait.h and functions. Consider implementing wait, waitpid, waitid. At present, a parent has no information about @@ -72,14 +66,16 @@ o Task/Scheduler (sched/) Update: A simple but usable version of waitpid() has been included. This version is not compliant with all specifications and can be enabled with CONFIG_SCHED_WAITPID. - Status: Open + Status: Open, however no further work is planned. Priority: Low Title: MISSING ERRNO SETTINGS Description: Several APIs do not set errno. Need to review all APIs. Update: These are being fixed as they are encountered. There is no accounting of how many interfaces have this problem. - Status: Open + Status: Open? There has been an effort over the past few years to assure + that all errno settings are in place. What is the current state? + Unknown. Priority: Medium, required for standard compliance (but makes the code bigger) @@ -107,18 +103,29 @@ o Task/Scheduler (sched/) 3) sched_process_timeslice(). Then there is round-robin time-slicing. - Status: Open + The primary advantage of a tickless OS is that is would allow for + reduce power consumptions. That is because timer interrupts will + usually awaken CPUs from reduced power consumption states. + Status: Open. There will probably be no tickless OS implementation unless + someone gets motivated and drives the change. Priority: Low Title: posix_spawn() Description: This would be a good interface to add to NuttX. It is really just a re-packaging of the existing, non-standard NuttX exec() function. - Status: Open + Status: Open. There are no plans to implement this capabilitiey now. Priority: Medium low. -o On-demand paging (sched/) - ^^^^^^^^^^^^^^^^^^^^^^^^^ + Title: pause() NON-COMPLIANCE + Description: In the POSIX description of this function is the pause() function + will suspend the calling thread until delivery of a signal whose + action is either to execute a signal-catching function or to + terminate the process. The current implementation only waits for + any non-blocked signal to be received. It should only wake up if + the signal is delivered to a handler. + Status: Open. + Priority: Medium Low. Title: ON-DEMAND PAGE INCOMPLETE Description: On-demand paging has recently been incorporated into the RTOS. @@ -130,19 +137,16 @@ o On-demand paging (sched/) configs/ea3131/pgnsh and locked directories). There are some limitations of this testing so I still cannot say that the feature is fully functional. - Status: Open + Status: Open. This has been put on the shelf for some time. Priority: Medium-Low -o Other core OS logic - ^^^^^^^^^^^^^^^^^^^ - Title: GET_ENVIRON_PTR() Description: get_environ_ptr() (sched/sched_getenvironptr.c) is not implemented. The representation of the the environment strings selected for NutX is not compatible with the operation. Some significant re-design would be required to implement this funcion and that effort is thought to be not worth the result. - Status: Open + Status: Open. No change is planned. Priority: Low -- There is no plan to implement this. Title: TIMER_GETOVERRUN() @@ -150,6 +154,23 @@ o Other core OS logic Status: Open Priority: Low -- There is no plan to implement this. + Title: USER-SPACE WORK QUEUES + Description: There has been some use of work queues that has crept into some + user code. I am thinking of NxWidgets::CNxTimer. That timer + logic was originally implemented (correctly) using POSIX timers, + but was re-implemented using timed work. + + The issue is that NxWidgets::CNxTimer is a user-space application + but the work queues are an OS internal feature. This will be a + problem for KERNEL builds. Hooks and definitions have been added + in include/nuttx/wqueue.h to support a user-space work queue, but + the corresponding logic has not been implemented. + + The work queue logic will need to be moved from sched/ to libc/wqueue/ + Status: Open. No work will probably be done until a functional KERNEL build + that includes NxWisges::CNxTimer is needed. + Priority: Medium Low for now + o Memory Managment (mm/) ^^^^^^^^^^^^^^^^^^^^^^ @@ -212,7 +233,7 @@ o Memory Managment (mm/) be required to keep this memory on the correct list (or on no list at all). - Status: Open + Status: Open. No changes are planned. Priority: Medium/Low, a good feature to prevent memory leaks but would have negative impact on memory usage and code size. @@ -222,7 +243,7 @@ o Signals (sched/, arch/) Title: STANDARD SIGNALS Description: 'Standard' signals and signal actions are not supported. (e.g., SIGINT, SIGCHLD, SIGSEGV, etc). - Status: Open + Status: Open. No changes are planned. Priority: Low, required by standards but not so critical for an embedded system. @@ -240,11 +261,11 @@ o pthreads (sched/) Title: CANCELLATION POINTS Description: pthread_cancel(): Should implement cancellation points and pthread_testcancel() - Status: Open + Status: Open. No changes are planned. Priority: Low, probably not that useful Title: PTHREAD_PRIO_PROTECT - Description: Extended pthread_mutexattr_setprotocol() suport PTHREAD_PRIO_PROTECT: + Description: Extended pthread_mutexattr_setprotocol() suport PTHREAD_PRIO_PROTECT: "When a thread owns one or more mutexes initialized with the PTHREAD_PRIO_PROTECT protocol, it shall execute at the higher of its priority or the highest of the priority ceilings of all the mutexes @@ -260,7 +281,7 @@ o pthreads (sched/) PTHREAD_PRIO_PROTECT protocol attributes, it shall not be subject to being moved to the tail of the scheduling queue at its priority in the event that its original priority is changed." - Status: Open + Status: Open. No changes planned. Priority: Low -- about zero, probably not that useful. Priority inheritance is already supported and is a much better solution. And it turns out that priority protection is just about as complex as priority inheritance. @@ -442,21 +463,25 @@ o Network (net/, drivers/net) Title: SOCK_RAW/SOCK_PACKET Description: Should implement SOCK_RAW, SOCK_PACKET - Status: Open + Status: Open. No changes are planned. Priority: Low Tile: MULTIPLE NETWORK INTERFACE SUPPORT Description: uIP polling issues / Multiple network interface support: + (1) Current logic will not support multiple ethernet drivers. Each driver should poll on TCP connections connect on the network supported by the driver; UDP polling should respond with TX data only if the UDP packet is intended for the the network supported by the driver. + (2) If there were multiple drivers, polling would occur at double the rate. Fix by using bound IP address in TCP connection (lipaddr) and verifying that it is in the subnet served by the driver. - Status: Open + + Status: Open. Nothing will probably be done until I have a platform + with two network interfaces that I need to support. Priority: Medium, The feature is not important, but it is important for NuttX to resolve the architectural issues. @@ -464,7 +489,7 @@ o Network (net/, drivers/net) Description: sendto() and multiple network interface support: When polled, would have to assure that the destination IP is on the subnet served by the polling driver. - Status: Open + Status: Open. This is really part of the above issue. Priority: Medium, The feature is not important, but it is important for NuttX to resolve the architectural issues. @@ -472,7 +497,8 @@ o Network (net/, drivers/net) Description: IPv6 support is incomplete. Adam Dunkels has recently announced IPv6 support for uIP (currently only as part of Contiki). Those changes need to be ported to NuttX. - Status: Open + Status: Open. No work will probably be done until there is a specific + requirement for IPv6. Priority: Medium Title: LISTENING FOR UDP BROADCASTS @@ -488,7 +514,7 @@ o Network (net/, drivers/net) driver should be throttled. Perhaps the driver should disable RX interrupts when throttled and re-anable on each poll time. recvfrom would, of course, have to un-throttle. - Status: Open + Status: Open. This is just a thought experiment. No changes are planned. Priority: Medium Title: STANDARDIZE ETHERNET DRIVER STATISTICS diff --git a/nuttx/tools/Makefile.host b/nuttx/tools/Makefile.host index 4a46901e6a..663ff29c73 100644 --- a/nuttx/tools/Makefile.host +++ b/nuttx/tools/Makefile.host @@ -45,13 +45,12 @@ ifneq ($(CONFIG_WINDOWS_NATIVE),y) endif all: b16$(HOSTEXEEXT) bdf-converter$(HOSTEXEEXT) cmpconfig$(HOSTEXEEXT) \ - mkconfig$(HOSTEXEEXT) mkdeps$(HOSTEXEEXT) mksymtab$(HOSTEXEEXT) \ + configure$(HOSTEXEEXT) mkconfig$(HOSTEXEEXT) mkdeps$(HOSTEXEEXT) mksymtab$(HOSTEXEEXT) \ mksyscall$(HOSTEXEEXT) mkversion$(HOSTEXEEXT) default: mkconfig$(HOSTEXEEXT) mksyscall$(HOSTEXEEXT) mkdeps$(HOSTEXEEXT) ifdef HOSTEXEEXT -.PHONY: b16 bdf-converter cmpconfig clean mkconfig mkdeps mksymtab \ - mksyscall mkversion +.PHONY: b16 bdf-converter cmpconfig clean configure mkconfig mkdeps mksymtab mksyscall mkversion else .PHONY: clean endif @@ -70,10 +69,19 @@ ifdef HOSTEXEEXT b16: b16$(HOSTEXEEXT) endif +# configure - Instantiate a canned NuttX configuration + +configure$(HOSTEXEEXT): configure.c cfgparser.c + $(Q) $(HOSTCC) $(HOSTCFLAGS) -o configure$(HOSTEXEEXT) configure.c cfgparser.c + +ifdef HOSTEXEEXT +configure: configure$(HOSTEXEEXT) +endif + # mkconfig - Convert a .config file into a C config.h file -mkconfig$(HOSTEXEEXT): mkconfig.c cfgparser.c - $(Q) $(HOSTCC) $(HOSTCFLAGS) -o mkconfig$(HOSTEXEEXT) mkconfig.c cfgparser.c +mkconfig$(HOSTEXEEXT): mkconfig.c cfgdefine.c + $(Q) $(HOSTCC) $(HOSTCFLAGS) -o mkconfig$(HOSTEXEEXT) mkconfig.c cfgdefine.c ifdef HOSTEXEEXT mkconfig: mkconfig$(HOSTEXEEXT) @@ -90,8 +98,8 @@ endif # mkversion - Convert a .version file into a C version.h file -mkversion$(HOSTEXEEXT): mkconfig.c cfgparser.c - $(Q) $(HOSTCC) $(HOSTCFLAGS) -o mkversion$(HOSTEXEEXT) mkversion.c cfgparser.c +mkversion$(HOSTEXEEXT): mkconfig.c cfgdefine.c + $(Q) $(HOSTCC) $(HOSTCFLAGS) -o mkversion$(HOSTEXEEXT) mkversion.c cfgdefine.c ifdef HOSTEXEEXT mkversion: mkversion$(HOSTEXEEXT) diff --git a/nuttx/tools/README.txt b/nuttx/tools/README.txt index fc03322127..f9e2d1099c 100644 --- a/nuttx/tools/README.txt +++ b/nuttx/tools/README.txt @@ -38,7 +38,7 @@ discover.py Example script for discovering devices in the local network. It is the counter part to apps/netutils/discover -mkconfig.c, cfgparser.c, and cfgparser.h +mkconfig.c, cfgdefine.c, and cfgdefine.h ---------------------------------------- These are Cs file that are used to build mkconfig program. The mkconfig @@ -79,7 +79,7 @@ mkfsdata.pl NOTE: This perl script comes from uIP and was (probably) written by Adam Dunkels. uIP has a license that is compatible with NuttX. -mkversion.c, cfgparser.c, and cfgparser.h +mkversion.c, cfgdefine.c, and cfgdefine.h ----------------------------------------- This is C file that is used to build mkversion program. The mkversion diff --git a/nuttx/tools/cfgdefine.c b/nuttx/tools/cfgdefine.c new file mode 100644 index 0000000000..00dd11c20b --- /dev/null +++ b/nuttx/tools/cfgdefine.c @@ -0,0 +1,322 @@ +/**************************************************************************** + * tools/cfgdefine.c + * + * Copyright (C) 2007-2012 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * 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. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include +#include +#include "cfgdefine.h" + +/**************************************************************************** + * Definitions + ****************************************************************************/ + +/**************************************************************************** + * Public Data + ****************************************************************************/ + +char line[LINESIZE+1]; + +/**************************************************************************** + * Private Data + ****************************************************************************/ + +/* These are configuration variable name that are quoted by configuration tool + * but which must be unquoted when used in C code. + */ + +static const char *dequote_list[] = +{ + /* NuttX */ + + "CONFIG_USER_ENTRYPOINT", /* Name of entry point function */ + + /* NxWidgets/NxWM */ + + "CONFIG_NXWM_BACKGROUND_IMAGE", /* Name of bitmap image class */ + "CONFIG_NXWM_STARTWINDOW_ICON", /* Name of bitmap image class */ + "CONFIG_NXWM_NXCONSOLE_ICON", /* Name of bitmap image class */ + "CONFIG_NXWM_CALIBRATION_ICON", /* Name of bitmap image class */ + "CONFIG_NXWM_HEXCALCULATOR_ICON", /* Name of bitmap image class */ + + NULL /* Marks the end of the list */ +}; + + /**************************************************************************** + * Private Functions + ****************************************************************************/ + + /* Skip over any spaces */ + +static char *skip_space(char *ptr) +{ + while (*ptr && isspace((int)*ptr)) ptr++; + return ptr; +} + +/* Find the end of a variable string */ + +static char *find_name_end(char *ptr) +{ + while (*ptr && (isalnum((int)*ptr) || *ptr == '_')) ptr++; + return ptr; +} + +/* Find the end of a value string */ + +static char *find_value_end(char *ptr) +{ + while (*ptr && !isspace((int)*ptr)) + { + if (*ptr == '"') + { + do ptr++; while (*ptr && *ptr != '"'); + if (*ptr) ptr++; + } + else + { + do ptr++; while (*ptr && !isspace((int)*ptr) && *ptr != '"'); + } + } + return ptr; +} + +/* Read the next line from the configuration file */ + +static char *read_line(FILE *stream) +{ + char *ptr; + + for (;;) + { + line[LINESIZE] = '\0'; + if (!fgets(line, LINESIZE, stream)) + { + return NULL; + } + else + { + ptr = skip_space(line); + if (*ptr && *ptr != '#' && *ptr != '\n') + { + return ptr; + } + } + } +} + +/* Parse the line from the configuration file into a variable name + * string and a value string. + */ + +static void parse_line(char *ptr, char **varname, char **varval) +{ + /* Skip over any leading spaces */ + + ptr = skip_space(ptr); + + /* The first no-space is the beginning of the variable name */ + + *varname = skip_space(ptr); + *varval = NULL; + + /* Parse to the end of the variable name */ + + ptr = find_name_end(ptr); + + /* An equal sign is expected next, perhaps after some white space */ + + if (*ptr && *ptr != '=') + { + /* Some else follows the variable name. Terminate the variable + * name and skip over any spaces. + */ + + *ptr = '\0'; + ptr = skip_space(ptr + 1); + } + + /* Verify that the equal sign is present */ + + if (*ptr == '=') + { + /* Make sure that the variable name is terminated (this was already + * done if the name was followed by white space. + */ + + *ptr = '\0'; + + /* The variable value should follow =, perhaps separated by some + * white space. + */ + + ptr = skip_space(ptr + 1); + if (*ptr) + { + /* Yes.. a variable follows. Save the pointer to the start + * of the variable string. + */ + + *varval = ptr; + + /* Find the end of the variable string and make sure that it + * is terminated. + */ + + ptr = find_value_end(ptr); + *ptr = '\0'; + } + } +} + +static char *dequote_value(const char *varname, char *varval) +{ + const char **dqnam; + char *dqval = varval; + int len; + + if (dqval) + { + /* Check if the variable name is in the list of strings to be dequoated */ + + for (dqnam = dequote_list; *dqnam; dqnam++) + { + if (strcmp(*dqnam, varname) == 0) + { + break; + } + } + + /* Did we find the variable name in the list of configuration variables + * to be dequoated? + */ + + if (*dqnam) + { + /* Yes... Check if there is a traiing quote */ + + len = strlen(dqval); + if (dqval[len-1] == '"') + { + /* Yes... replace it with a terminator */ + + dqval[len-1] = '\0'; + len--; + } + + /* Is there a leading quote? */ + + if (dqval[0] == '"') + { + /* Yes.. skip over the leading quote */ + + dqval++; + len--; + } + + /* Handle the case where nothing is left after dequoting */ + + if (len <= 0) + { + dqval = NULL; + } + } + } + + return dqval; +} + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +void generate_definitions(FILE *stream) +{ + char *varname; + char *varval; + char *ptr; + + /* Loop until the entire file has been parsed. */ + + do + { + /* Read the next line from the file */ + + ptr = read_line(stream); + if (ptr) + { + /* Parse the line into a variable and a value field */ + + parse_line(ptr, &varname, &varval); + + /* Was a variable name found? */ + + if (varname) + { + /* Yes.. dequote the value if necessary */ + + varval = dequote_value(varname, varval); + + /* If no value was provided or if the special value 'n' was provided, + * then undefine the configuration variable. + */ + + if (!varval || strcmp(varval, "n") == 0) + { + printf("#undef %s\n", varname); + } + + /* Simply define the configuration variable if it has the special + * value "y" + */ + + else if (strcmp(varval, "y") == 0) + { + printf("#define %s 1\n", varname); + } + + /* Otherwise, use the value as provided */ + + else + { + printf("#define %s %s\n", varname, varval); + } + } + } + } + while (ptr); +} diff --git a/nuttx/tools/cfgdefine.h b/nuttx/tools/cfgdefine.h new file mode 100644 index 0000000000..04817b719c --- /dev/null +++ b/nuttx/tools/cfgdefine.h @@ -0,0 +1,64 @@ +/**************************************************************************** + * tools/cfgdefine.h + * + * Copyright (C) 2007-2011 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * 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. + * + ****************************************************************************/ + +#ifndef __TOOLS_CFGDEFINE_H +#define __TOOLS_CFGDEFINE_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include +#include + +/**************************************************************************** + * Definitions + ****************************************************************************/ + +#define LINESIZE ( PATH_MAX > 256 ? PATH_MAX : 256 ) + +/**************************************************************************** + * Public Data + ****************************************************************************/ + +extern char line[LINESIZE+1]; + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +extern void generate_definitions(FILE *stream); + +#endif /* __TOOLS_CFGDEFINE_H */ diff --git a/nuttx/tools/mkconfig.c b/nuttx/tools/mkconfig.c index 3e55f50974..f4a1168c57 100644 --- a/nuttx/tools/mkconfig.c +++ b/nuttx/tools/mkconfig.c @@ -41,7 +41,7 @@ #include #include -#include "cfgparser.h" +#include "cfgdefine.h" /**************************************************************************** * Pre-processor Definitions @@ -99,7 +99,7 @@ int main(int argc, char **argv, char **envp) printf("#ifndef __INCLUDE_NUTTX_CONFIG_H\n"); printf("#define __INCLUDE_NUTTX_CONFIG_H\n\n"); printf("/* Architecture-specific options *************************/\n\n"); - parse_file(stream); + generate_definitions(stream); printf("\n/* Sanity Checks *****************************************/\n\n"); printf("/* If this is an NXFLAT, external build, then make sure that\n"); printf(" * NXFLAT support is enabled in the base code.\n"); diff --git a/nuttx/tools/mkversion.c b/nuttx/tools/mkversion.c index 32068df38b..c6b00c5e50 100644 --- a/nuttx/tools/mkversion.c +++ b/nuttx/tools/mkversion.c @@ -41,7 +41,7 @@ #include #include -#include "cfgparser.h" +#include "cfgdefine.h" /**************************************************************************** * Definitions @@ -98,7 +98,7 @@ int main(int argc, char **argv, char **envp) printf("/* version.h -- Autogenerated! Do not edit. */\n\n"); printf("#ifndef __INCLUDE_NUTTX_VERSION_H\n"); printf("#define __INCLUDE_NUTTX_VERSION_H\n\n"); - parse_file(stream); + generate_definitions(stream); printf("\n#define CONFIG_VERSION ((CONFIG_VERSION_MAJOR << 8) | (CONFIG_VERSION_MINOR))\n\n"); printf("#endif /* __INCLUDE_NUTTX_VERSION_H */\n"); fclose(stream); From b66a46decca8ba8bc3570ca5d91d908f2e339c0d Mon Sep 17 00:00:00 2001 From: patacongo Date: Fri, 4 Jan 2013 16:50:15 +0000 Subject: [PATCH 030/118] Working on configure.c git-svn-id: http://svn.code.sf.net/p/nuttx/code/trunk@5477 42af7a65-404d-4744-a932-0658087f49c3 --- nuttx/tools/Makefile.host | 4 +- nuttx/tools/cfgdefine.c | 2 +- nuttx/tools/cfgdefine.h | 2 +- nuttx/tools/cfgparser.c | 165 ++++++++++++++++---------------------- nuttx/tools/cfgparser.h | 15 +++- nuttx/tools/cmpconfig.c | 154 +---------------------------------- 6 files changed, 91 insertions(+), 251 deletions(-) diff --git a/nuttx/tools/Makefile.host b/nuttx/tools/Makefile.host index 663ff29c73..73352aae3a 100644 --- a/nuttx/tools/Makefile.host +++ b/nuttx/tools/Makefile.host @@ -89,8 +89,8 @@ endif # cmpconfig - Compare the contents of two configuration files -cmpconfig$(HOSTEXEEXT): cmpconfig.c - $(Q) $(HOSTCC) $(HOSTCFLAGS) -o cmpconfig$(HOSTEXEEXT) cmpconfig.c +cmpconfig$(HOSTEXEEXT): cmpconfig.c cfgparser.c + $(Q) $(HOSTCC) $(HOSTCFLAGS) -o cmpconfig$(HOSTEXEEXT) cmpconfig.c cfgparser.c ifdef HOSTEXEEXT cmpconfig: cmpconfig$(HOSTEXEEXT) diff --git a/nuttx/tools/cfgdefine.c b/nuttx/tools/cfgdefine.c index 00dd11c20b..ee1dd40038 100644 --- a/nuttx/tools/cfgdefine.c +++ b/nuttx/tools/cfgdefine.c @@ -76,7 +76,7 @@ static const char *dequote_list[] = NULL /* Marks the end of the list */ }; - /**************************************************************************** +/**************************************************************************** * Private Functions ****************************************************************************/ diff --git a/nuttx/tools/cfgdefine.h b/nuttx/tools/cfgdefine.h index 04817b719c..f76ba73fb9 100644 --- a/nuttx/tools/cfgdefine.h +++ b/nuttx/tools/cfgdefine.h @@ -59,6 +59,6 @@ extern char line[LINESIZE+1]; * Public Functions ****************************************************************************/ -extern void generate_definitions(FILE *stream); +void generate_definitions(FILE *stream); #endif /* __TOOLS_CFGDEFINE_H */ diff --git a/nuttx/tools/cfgparser.c b/nuttx/tools/cfgparser.c index 1a35f78579..cb4ab4c52f 100644 --- a/nuttx/tools/cfgparser.c +++ b/nuttx/tools/cfgparser.c @@ -38,7 +38,9 @@ ****************************************************************************/ #include +#include #include + #include "cfgparser.h" /**************************************************************************** @@ -55,28 +57,7 @@ char line[LINESIZE+1]; * Private Data ****************************************************************************/ -/* These are configuration variable name that are quoted by configuration tool - * but which must be unquoted when used in C code. - */ - -static const char *dequote_list[] = -{ - /* NuttX */ - - "CONFIG_USER_ENTRYPOINT", /* Name of entry point function */ - - /* NxWidgets/NxWM */ - - "CONFIG_NXWM_BACKGROUND_IMAGE", /* Name of bitmap image class */ - "CONFIG_NXWM_STARTWINDOW_ICON", /* Name of bitmap image class */ - "CONFIG_NXWM_NXCONSOLE_ICON", /* Name of bitmap image class */ - "CONFIG_NXWM_CALIBRATION_ICON", /* Name of bitmap image class */ - "CONFIG_NXWM_HEXCALCULATOR_ICON", /* Name of bitmap image class */ - - NULL /* Marks the end of the list */ -}; - - /**************************************************************************** +/**************************************************************************** * Private Functions ****************************************************************************/ @@ -203,69 +184,15 @@ static void parse_line(char *ptr, char **varname, char **varval) } } -static char *dequote_value(const char *varname, char *varval) -{ - const char **dqnam; - char *dqval = varval; - int len; - - if (dqval) - { - /* Check if the variable name is in the list of strings to be dequoated */ - - for (dqnam = dequote_list; *dqnam; dqnam++) - { - if (strcmp(*dqnam, varname) == 0) - { - break; - } - } - - /* Did we find the variable name in the list of configuration variables - * to be dequoated? - */ - - if (*dqnam) - { - /* Yes... Check if there is a traiing quote */ - - len = strlen(dqval); - if (dqval[len-1] == '"') - { - /* Yes... replace it with a terminator */ - - dqval[len-1] = '\0'; - len--; - } - - /* Is there a leading quote? */ - - if (dqval[0] == '"') - { - /* Yes.. skip over the leading quote */ - - dqval++; - len--; - } - - /* Handle the case where nothing is left after dequoting */ - - if (len <= 0) - { - dqval = NULL; - } - } - } - - return dqval; -} - /**************************************************************************** * Public Functions ****************************************************************************/ -void parse_file(FILE *stream) +void parse_file(FILE *stream, struct variable_s **list) { + struct variable_s *curr; + struct variable_s *prev; + struct variable_s *next; char *varname; char *varval; char *ptr; @@ -283,40 +210,90 @@ void parse_file(FILE *stream) parse_line(ptr, &varname, &varval); - /* Was a variable name found? */ + /* If the variable has not value (or the special value 'n'), then + * ignore it. + */ + + if (!varval || strcmp(varval, "n") == 0) + { + continue; + } + + /* Make sure that a variable name was found. */ if (varname) { - /* Yes.. dequote the value if necessary */ + int varlen = strlen(varname) + 1; + int vallen = 0; - varval = dequote_value(varname, varval); - - /* If no value was provided or if the special value 'n' was provided, - * then undefine the configuration variable. + /* Get the size of the value, including the NUL terminating + * character. */ - if (!varval || strcmp(varval, "n") == 0) + if (varval) { - printf("#undef %s\n", varname); + vallen = strlen(varval) + 1; } - /* Simply define the configuration variable if it has the special - * value "y" + /* Allocate memory to hold the struct variable_s with the + * variable name and the value. */ - else if (strcmp(varval, "y") == 0) + curr = (struct variable_s *)malloc(sizeof(struct variable_s) + varlen + vallen - 1); + if (curr) { - printf("#define %s 1\n", varname); + /* Add the variable to the list */ + + curr->var = &curr->storage[0]; + strcpy(curr->var, varname); + + curr->val = NULL; + if (varval) + { + curr->val = &curr->storage[varlen]; + strcpy(curr->val, varval); + } } - /* Otherwise, use the value as provided */ + prev = 0; + next = *list; + while (next && strcmp(next->var, curr->var) <= 0) + { + prev = next; + next = next->flink; + } + if (prev) + { + prev->flink = curr; + } else { - printf("#define %s %s\n", varname, varval); + *list = curr; } + + curr->flink = next; } } } while (ptr); } + +struct variable_s *find_variable(const char *varname, struct variable_s *list) +{ + char *varval1; + char *varval2; + + while (list) + { + if (strcmp(varname, list->var) == 0) + { + return list; + } + + list = list->flink; + } + + return NULL; +} + diff --git a/nuttx/tools/cfgparser.h b/nuttx/tools/cfgparser.h index b1c4bae762..b1f421a68e 100644 --- a/nuttx/tools/cfgparser.h +++ b/nuttx/tools/cfgparser.h @@ -49,6 +49,18 @@ #define LINESIZE ( PATH_MAX > 256 ? PATH_MAX : 256 ) +/**************************************************************************** + * Public Types + ****************************************************************************/ + +struct variable_s +{ + struct variable_s *flink; + char *var; + char *val; + char storage[1]; +}; + /**************************************************************************** * Public Data ****************************************************************************/ @@ -59,6 +71,7 @@ extern char line[LINESIZE+1]; * Public Functions ****************************************************************************/ -extern void parse_file(FILE *stream); +void parse_file(FILE *stream, struct variable_s **list); +struct variable_s *find_variable(const char *varname, struct variable_s *list); #endif /* __TOOLS_CFGPARSER_H */ diff --git a/nuttx/tools/cmpconfig.c b/nuttx/tools/cmpconfig.c index 2958acdc78..08b7dab3f0 100644 --- a/nuttx/tools/cmpconfig.c +++ b/nuttx/tools/cmpconfig.c @@ -43,6 +43,8 @@ #include #include +#include "cfgparser.h" + /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ @@ -51,14 +53,6 @@ * Private Types ****************************************************************************/ -struct variable_s -{ - struct variable_s *flink; - char *var; - char *val; - char storage[1]; -}; - /**************************************************************************** * Private Functions ****************************************************************************/ @@ -69,150 +63,6 @@ static void show_usage(const char *progname) exit(EXIT_FAILURE); } -static char *skip_space(char *ptr) -{ - while (*ptr && isspace((int)*ptr)) ptr++; - return ptr; -} - -static char *read_line(FILE *stream, char *line, int len) -{ - char *ptr; - - for (;;) - { - line[len-1] = '\0'; - if (!fgets(line, len, stream)) - { - return NULL; - } - else - { - ptr = skip_space(line); - if (*ptr && *ptr != '#' && *ptr != '\n') - { - return ptr; - } - } - } -} - -static char *find_name_end(char *ptr) -{ - while (*ptr && (isalnum((int)*ptr) || *ptr == '_')) ptr++; - return ptr; -} - -static char *find_value_end(char *ptr) -{ - while (*ptr && !isspace((int)*ptr)) - { - if (*ptr == '"') - { - do ptr++; while (*ptr && *ptr != '"'); - if (*ptr) ptr++; - } - else - { - do ptr++; while (*ptr && !isspace((int)*ptr) && *ptr != '"'); - } - } - return ptr; -} - -static void parse_line(char *ptr, char **varname, char **varval) -{ - *varname = ptr; - *varval = NULL; - - ptr = find_name_end(ptr); - if (*ptr && *ptr != '=') - { - *ptr = '\0'; - ptr = skip_space(ptr + 1); - } - - if (*ptr == '=') - { - *ptr = '\0'; - ptr = skip_space(ptr + 1); - if (*ptr) - { - *varval = ptr; - ptr = find_value_end(ptr); - *ptr = '\0'; - } - } -} - -static void parse_file(FILE *stream, struct variable_s **list) -{ - char line[10242]; - struct variable_s *curr; - struct variable_s *prev; - struct variable_s *next; - char *varname; - char *varval; - char *ptr; - - do - { - ptr = read_line(stream, line, 1024); - if (ptr) - { - parse_line(ptr, &varname, &varval); - if (!varval || strcmp(varval, "n") == 0) - { - continue; - } - - if (varname) - { - int varlen = strlen(varname) + 1; - int vallen = 0; - - if (varval) - { - vallen = strlen(varval) + 1; - } - - curr = (struct variable_s *)malloc(sizeof(struct variable_s) + varlen + vallen - 1); - if (curr) - { - curr->var = &curr->storage[0]; - strcpy(curr->var, varname); - - curr->val = NULL; - if (varval) - { - curr->val = &curr->storage[varlen]; - strcpy(curr->val, varval); - } - } - - prev = 0; - next = *list; - while (next && strcmp(next->var, curr->var) <= 0) - { - prev = next; - next = next->flink; - } - - if (prev) - { - prev->flink = curr; - } - else - { - *list = curr; - } - curr->flink = next; - } - } - } - while (ptr); -} - static void compare_variables(struct variable_s *list1, struct variable_s *list2) { char *varval1; From 5c572a3cb50e6e52a641ee652d9e151b4c70661c Mon Sep 17 00:00:00 2001 From: patacongo Date: Fri, 4 Jan 2013 21:37:31 +0000 Subject: [PATCH 031/118] Add tools/configure.c and configure.bat git-svn-id: http://svn.code.sf.net/p/nuttx/code/trunk@5478 42af7a65-404d-4744-a932-0658087f49c3 --- nuttx/ChangeLog | 11 +- nuttx/Documentation/NuttxPortingGuide.html | 31 +- nuttx/Makefile.win | 2 +- nuttx/README.txt | 21 +- nuttx/TODO | 16 +- nuttx/configs/README.txt | 24 +- nuttx/configs/stm32f4discovery/README.txt | 5 + nuttx/configs/xtrs/README.txt | 15 + nuttx/tools/README.txt | 27 +- nuttx/tools/cfgparser.c | 3 - nuttx/tools/configure.bat | 128 ++++ nuttx/tools/configure.c | 763 +++++++++++++++++++++ 12 files changed, 1003 insertions(+), 43 deletions(-) create mode 100644 nuttx/tools/configure.bat create mode 100644 nuttx/tools/configure.c diff --git a/nuttx/ChangeLog b/nuttx/ChangeLog index 2762faf665..710ffdceb7 100644 --- a/nuttx/ChangeLog +++ b/nuttx/ChangeLog @@ -3861,4 +3861,13 @@ * libc/misc/Make.defs: Fix error in conditional for KBD CODEC. * libc/Kconfig and configs/*/defconfig (several): The default setting should be CONFIG_LIB_KBDCODEC=n - + * tools/configure.c: configure.c can be used to build a work-alike + program as a replacement for configure.sh. This work-alike + program would be used in environments that do not support Bash + scripting (such as the Windows native environment). + * tools/configure.bat: configure.bat is a small Windows batch + file that can be used as a replacement for configure.sh in a + Windows native environment. configure.bat is actually just a + thin layer that execuates configure.exe if it is available. If + configure.exe is not available, then configure.bat will attempt + to build it first. diff --git a/nuttx/Documentation/NuttxPortingGuide.html b/nuttx/Documentation/NuttxPortingGuide.html index e626bf7a57..559253d45b 100644 --- a/nuttx/Documentation/NuttxPortingGuide.html +++ b/nuttx/Documentation/NuttxPortingGuide.html @@ -1263,23 +1263,23 @@ tools/ |-- Makefile.host |-- Makefile.export |-- README.txt -|-- configure.sh +|-- configure.sh / configure.bat |-- cfgparser.c |-- cfgparser.h -|-- copydir.sh -|-- define.sh -|-- incdir.sh +|-- copydir.sh / copydir.bat +|-- define.sh / define.bat +|-- incdir.sh / indir.bat |-- indent.sh -|-- link.sh +|-- link.sh / link.bat |-- mkconfig.c -|-- mkdeps.sh +|-- mkdeps.sh / mkdeps.bat |-- mkexport.sh |-- mkimage.sh |-- mknulldeps.sh |-- mkromfsimg.sh |-- mksyscall.c |-- mkversion.c -|-- unlink.sh +|-- unlink.sh / unlink.bat |-- version.sh `-- zipme.sh
            @@ -1416,17 +1416,28 @@ netutils/

                 cd tools
              -  ./configure.sh <board-name>[/<config-dir>]
              +  ./configure.sh <board-name>[/<config-dir>]
               

            - And if configs/<board-name>/[<config-dir>/appconfig + There is an alternative Windows batch file, configure.bat, that can be used insteach of configure.sh in the windows native enironment like: +

            +
              +  cd tools
              +  configure.bat <board-name>[\<config-dir>]
              +
            +

            + See tools/README.txt for more information about these scripts. +

            + +

            + If configs/<board-name>/[<config-dir>]/appconfig exists and your application directory is not in the standard loction (../apps), then you should also specify the location of the application directory on the command line like:

                 cd tools
              -  ./configure.sh -a <app-dir> <board-name>[/<config-dir>]
              +  ./configure.sh -a <app-dir> <board-name>[/<config-dir>]
               

            diff --git a/nuttx/Makefile.win b/nuttx/Makefile.win index fcf971d325..803d073b2d 100644 --- a/nuttx/Makefile.win +++ b/nuttx/Makefile.win @@ -452,7 +452,7 @@ clean_context: # check_context # # This target checks if NuttX has been configured. NuttX is configured using -# the script tools\configure.sh. That script will install certain files in +# the script tools\configure.bat. That script will install certain files in # the top-level NuttX build directory. This target verifies that those # configuration files have been installed and that NuttX is ready to be built. diff --git a/nuttx/README.txt b/nuttx/README.txt index bfd057351a..717c129b08 100644 --- a/nuttx/README.txt +++ b/nuttx/README.txt @@ -257,6 +257,14 @@ easier. It is used as follows: cd ${TOPDIR}/tools ./configure.sh / +There is an alternative Windows batch file that can be used in the +windows native enironment like: + + cd ${TOPDIR}\tools + configure.bat \ + +See tools/README.txt for more information about these scripts. + NuttX Configuration Tool ------------------------ @@ -401,6 +409,8 @@ Converting Older Configurations to use the Configuration Tool cd tools ./configure.sh / + (or configure.bat for the case of the Windows native build). + NOTE: If CONFIG_APPS_DIR is not defined in the defconfig file, the configure.sh script will find and add the new, correct path to the application directory (CONFIG_APPS_DIR) when it copies the @@ -682,10 +692,15 @@ Native Windows Build the you not install the optional MSYS components as there may be conflicts. This capability should still be considered a work in progress because: + (1) It has not been verfied on all targets and tools, and - (2) itstill lacks some of the creature-comforts of the more mature environments - (like a functional configure.sh script and 'make menuconfig' support. - See the section "NuttX Configuration Tool under DOS" above). + (2) it still lacks some of the creature-comforts of the more mature environments + (like 'make menuconfig' support. See the section "NuttX Configuration Tool + under DOS" above). + + There is an alternative to the setenv.sh script available for the Windows + native environment: tools/configure.bat. See tools/README.txt for additional + information. Installing GNUWin32 ------------------- diff --git a/nuttx/TODO b/nuttx/TODO index d37231e1d5..4a70e577fb 100644 --- a/nuttx/TODO +++ b/nuttx/TODO @@ -19,7 +19,7 @@ nuttx/ (5) Graphics subystem (graphics/) (1) Pascal add-on (pcode/) (1) Documentation (Documentation/) - (8) Build system / Toolchains + (7) Build system / Toolchains (5) Linux/Cywgin simulation (arch/sim) (6) ARM (arch/arm/) (1) ARM/C5471 (arch/arm/src/c5471/) @@ -1037,20 +1037,6 @@ o Build system Status: Open, there are some workarounds, but none are good. Priority: High - Title: configure.sh NOT AVAILABLE IN NATIVE WINDOWS BUILD - Description: configure.sh is a Bash script and cannot be used from a Windows - CMD.exe window. I started a configure.bat script, but I do - not have the batch file programming skills to duplicate some - of the more complex operations. - - I also considered adding a configure.c file that could be - compiled and then executed by configure.bat (and configure.sh?). - But I have not gone down that path yet. - - The current work-around is to configure under Cygwin. - Status: Open - Priority: High - o Linux/Cywgin simulation (arch/sim) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/nuttx/configs/README.txt b/nuttx/configs/README.txt index 4e9bcca146..6e7526ed0e 100644 --- a/nuttx/configs/README.txt +++ b/nuttx/configs/README.txt @@ -1960,16 +1960,24 @@ tools/configure.sh There is a script that automates these steps. The following steps will accomplish the same configuration: - cd tools - ./configure.sh / + cd tools + ./configure.sh / -And if configs///appconfig exists and your -application directory is not in the standard loction (../apps), then -you should also specify the location of the application directory on the -command line like: + There is an alternative Windows batch file that can be used in the + windows native enironment like: - cd tools - ./configure.sh -a / + cd ${TOPDIR}\tools + configure.bat \ + + See tools/README.txt for more information about these scripts. + + And if configs///appconfig exists and your + application directory is not in the standard loction (../apps), then + you should also specify the location of the application directory on the + command line like: + + cd tools + ./configure.sh -a / Building Symbol Tables ^^^^^^^^^^^^^^^^^^^^^^ diff --git a/nuttx/configs/stm32f4discovery/README.txt b/nuttx/configs/stm32f4discovery/README.txt index 571385abb3..28072f44b2 100644 --- a/nuttx/configs/stm32f4discovery/README.txt +++ b/nuttx/configs/stm32f4discovery/README.txt @@ -1011,6 +1011,11 @@ can be selected as follow: cd - . ./setenv.sh +If this is a Windows native build, then configure.bat should be used +instead of configure.sh: + + configure.bat STM32F4Discovery\ + Where is one of the following: cxxtest: diff --git a/nuttx/configs/xtrs/README.txt b/nuttx/configs/xtrs/README.txt index 1a63d3a90e..d462dcab1f 100644 --- a/nuttx/configs/xtrs/README.txt +++ b/nuttx/configs/xtrs/README.txt @@ -59,6 +59,11 @@ Configuring NuttX setenv.bat make + If this is a Windows native build, then configure.bat should be used + in step 1) instead of configure.sh: + + configure.bat xtrs\ostest + The setenv.bat will need to be updated to include the PATH to the XTRS hex2cmd program. @@ -90,6 +95,11 @@ Configuring NuttX setenv.bat make + If this is a Windows native build, then configure.bat should be used + in step 1) instead of configure.sh: + + configure.bat xtrs\nsh + The setenv.bat will need to be updated to include the PATH to the XTRS hex2cmd program. @@ -128,6 +138,11 @@ Configuring NuttX setenv.bat make + If this is a Windows native build, then configure.bat should be used + in step 1) instead of configure.sh: + + configure.bat xtrs\pashello + The setenv.bat will need to be updated to include the PATH to the XTRS hex2cmd program. diff --git a/nuttx/tools/README.txt b/nuttx/tools/README.txt index f9e2d1099c..5651ff2f06 100644 --- a/nuttx/tools/README.txt +++ b/nuttx/tools/README.txt @@ -26,12 +26,35 @@ Config.mk override these default definitions as necessary. configure.sh +configure.bat +configure.c, cfgparser.c, and cfgparser.h ------------ - This is a bash script that is used to configure NuttX for a given - target board. See configs/README.txt or Documentation/NuttxPortingGuide.html + configure.sh is a bash script that is used to configure NuttX for a given + target board in a environment that supports POSIX paths (Linux, Cygwin, + OSX, or similar). See configs/README.txt or Documentation/NuttxPortingGuide.html for a description of how to configure NuttX with this script. + configure.c, cfgparser.c, and cfgparser.h can be used to build a work-alike + program as a replacement for configure.sh. This work-alike program would be + used in environments that do not support Bash scripting (such as the Windows + native environment). + + configure.bat is a small Windows batch file that can be used as a replacement + for configure.sh in a Windows native environment. configure.bat is actually + just a thin layer that execuates configure.exe if it is available. If + configure.exe is not available, then configure.bat will attempt to build it + first. + + In order two build configure.exe from configure.c in the Windows native + environment, two assumptions are made: + + 1) You have installed the MinGW GCC toolchain. This toolchain can be + downloaded from http://www.mingw.org/. Tt is recommended the you not + install the optional MSYS components as there may be conflicts. + 2) That path to bin bin/ directory containing mingw-gcc.exe must be + included in the PATH variable. + discover.py ----------- diff --git a/nuttx/tools/cfgparser.c b/nuttx/tools/cfgparser.c index cb4ab4c52f..ac25bd26b3 100644 --- a/nuttx/tools/cfgparser.c +++ b/nuttx/tools/cfgparser.c @@ -281,9 +281,6 @@ void parse_file(FILE *stream, struct variable_s **list) struct variable_s *find_variable(const char *varname, struct variable_s *list) { - char *varval1; - char *varval2; - while (list) { if (strcmp(varname, list->var) == 0) diff --git a/nuttx/tools/configure.bat b/nuttx/tools/configure.bat new file mode 100644 index 0000000000..c28558fbbd --- /dev/null +++ b/nuttx/tools/configure.bat @@ -0,0 +1,128 @@ +@echo off + +rem tools/configure.bat +rem +rem Copyright (C) 2012 Gregory Nutt. All rights reserved. +rem Author: Gregory Nutt +rem +rem Redistribution and use in source and binary forms, with or without +rem modification, are permitted provided that the following conditions +rem are met: +rem +rem 1. Redistributions of source code must retain the above copyright +rem notice, this list of conditions and the following disclaimer. +rem 2. Redistributions in binary form must reproduce the above copyright +rem notice, this list of conditions and the following disclaimer in +rem the documentation and/or other materials provided with the +rem distribution. +rem 3. Neither the name NuttX nor the names of its contributors may be +rem used to endorse or promote products derived from this software +rem without specific prior written permission. +rem +rem THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +rem "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +rem LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +rem FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +rem COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +rem INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +rem BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +rem OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +rem AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +rem LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +rem ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +rem POSSIBILITY OF SUCH DAMAGE. +rem + +rem Parse command line arguments + +set debug= +set fmt=-w +set posix= +set help= +set appdir= +set config= + +:ArgLoop +if "%1"=="" goto :NoConfig +if "%1"=="-h" goto :ShowUsage +if "%1"=="-d" goto :SetDebug +if "%1"=="-w" goto :SetWindows +if "%1"=="-l" goto :SetPosix +if "%1"=="-a" goto :SetAppDir + +set config=%1 +goto EndOfLoop + +:SetDebug +set debug=-d +goto :NextArg + +:SetWindows +set fmt=-w +goto :NextArg + +:SetWindows +set fmt=-l +goto :NextArg + +:SetAppDir +shift +set appdir=-a %1 + +:NextArg +shift +goto :ArgLoop + +:EndOfLoop + +rem Check if we have to build configure.exe + +if exist configure.exe goto :HaveConfigureExe + +set cc=mingw32-gcc.exe +set cflags=-Wall -Wstrict-prototypes -Wshadow -g -pipe -I. -DCONFIG_WINDOWS_NATIVE=y +%cc% %cflags% -o configure.exe configure.c cfgparser.c +if errorlevel 1 ( + echo ERROR: %cc% failed + echo Is ming32-gcc.exe installed? Is it in the PATH variable? + goto End +) + +:HaveConfigureExe +configure.exe %debug% %fmt% %appdir% %config% +if errorlevel 1 echo configure.exe failed +goto End + + +:NoConfig +echo Missing ^/^ argument + +:ShowUsage +echo USAGE: %0 [-d] [-w] [-l] [-h] [-a ^] ^\^ +echo\nWhere: +echo ^: +echo Identifies the board. This must correspond to a board directory +echo under nuttx/configs/. +echo ^: +echo Identifies the specific configuratin for the selected ^. +echo This must correspond to a sub-directory under the board directory at +echo under nuttx/configs/^/. +echo ^<-d^>: +echo Enables debug output +echo ^<-w^>: +echo Informs the tool that it should use Windows style paths like C:\\Program Files +echo instead of POSIX style paths are used like /usr/local/bin. Windows +echo style paths are used by default. +echo ^<-l^>: +echo Informs the tool that it should use POSIX style paths like /usr/local/bin. +echo By default, Windows style paths like C:\\Program Files are used. +echo -a ^: +echo Informs the configuration tool where the application build +echo directory. This is a relative path from the top-level NuttX +echo build directory. But default, this tool will look in the usual +echo places to try to locate the application directory: ../apps or +echo ../apps-xx.yy where xx.yy is the NuttX version number. +echo ^<-h^>: +echo Prints this message and exits. + +:End diff --git a/nuttx/tools/configure.c b/nuttx/tools/configure.c new file mode 100644 index 0000000000..f189f5b98b --- /dev/null +++ b/nuttx/tools/configure.c @@ -0,0 +1,763 @@ +/**************************************************************************** + * tools/configure.c + * + * Copyright (C) 2012 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * 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. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "cfgparser.h" + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +#define BUFFER_SIZE 1024 + +/**************************************************************************** + * Private Data + ****************************************************************************/ + +#ifdef CONFIG_WINDOWS_NATIVE +static char g_delim = '\\'; /* Delimiter to use when forming paths */ +static bool g_winpaths = true; /* True: Windows style paths */ +#else +static char g_delim = '/'; /* Delimiter to use when forming paths */ +static bool g_winpaths = false; /* False: POSIX style paths */ +#endif +static bool g_debug = false; /* Enable debug output */ + +static const char *g_appdir = NULL; /* Relative path to the applicatin directory */ +static const char *g_boarddir = NULL; /* Name of board subdirectory */ +static char *g_configdir = NULL; /* Name of configuration subdirectory */ + +static char *g_topdir = NULL; /* Full path to top-level NuttX build directory */ +static char *g_apppath = NULL; /* Full path to the applicatino directory */ +static char *g_configpath = NULL; /* Full path to the configuration directory */ +static char *g_verstring = "0.0"; /* Version String */ + +static char *g_srcdefconfig = NULL; /* Source defconfig file */ +static char *g_srcmakedefs = NULL; /* Source Make.defs file */ +static char *g_srcappconfig = NULL ; /* Source appconfig file (optional) */ +static char *g_srcsetenvsh = NULL; /* Source setenv.sh file (optional) */ +static char *g_srcsetenvbat = NULL; /* Source setenv.bat file (optional) */ + +static bool g_newconfig = false; /* True: New style configuration */ +static bool g_winnative = false; /* True: Windows native configuration */ +static bool g_needapppath = true; /* Need to add app path to the .config file */ + +static char g_buffer[BUFFER_SIZE]; /* Scratch buffer for forming full paths */ + +static struct variable_s *g_configvars = NULL; +static struct variable_s *g_versionvars = NULL; + +/**************************************************************************** + * Private Functions + ****************************************************************************/ + +static void show_usage(const char *progname, int exitcode) +{ + fprintf(stderr, "\nUSAGE: %s [-d] [-w] [-l] [-h] [-a ] %c\n", progname, g_delim); + fprintf(stderr, "\nWhere:\n"); + fprintf(stderr, " :\n"); + fprintf(stderr, " Identifies the board. This must correspond to a board directory\n"); + fprintf(stderr, " under nuttx%cconfigs%c.\n", g_delim, g_delim); + fprintf(stderr, " :\n"); + fprintf(stderr, " Identifies the specific configuratin for the selected .\n"); + fprintf(stderr, " This must correspond to a sub-directory under the board directory at\n"); + fprintf(stderr, " under nuttx%cconfigs%c%c.\n", g_delim, g_delim, g_delim); + fprintf(stderr, " <-d>:\n"); + fprintf(stderr, " Enables debug output\n"); + fprintf(stderr, " <-w>:\n"); +#ifdef CONFIG_WINDOWS_NATIVE + fprintf(stderr, " Informs the tool that it should use Windows style paths like C:\\Program Files\n"); + fprintf(stderr, " instead of POSIX style paths are used like /usr/local/bin. Windows\n"); + fprintf(stderr, " style paths are used by default.\n"); +#else + fprintf(stderr, " Informs the tool that it should use Windows style paths like C:\\Program Files.\n"); + fprintf(stderr, " By default, POSIX style paths like /usr/local/bin are used.\n"); +#endif + fprintf(stderr, " <-l>:\n"); +#ifdef CONFIG_WINDOWS_NATIVE + fprintf(stderr, " Informs the tool that it should use POSIX style paths like /usr/local/bin.\n"); + fprintf(stderr, " By default, Windows style paths like C:\\Program Files are used.\n"); +#else + fprintf(stderr, " Informs the tool that it should use POSIX style paths like /usr/local/bin\n"); + fprintf(stderr, " instead of Windows style paths like C:\\Program Files are used. POSIX\n"); + fprintf(stderr, " style paths are used by default.\n"); +#endif + fprintf(stderr, " -a :\n"); + fprintf(stderr, " Informs the configuration tool where the application build\n"); + fprintf(stderr, " directory. This is a relative path from the top-level NuttX\n"); + fprintf(stderr, " build directory. But default, this tool will look in the usual\n"); + fprintf(stderr, " places to try to locate the application directory: ..%capps or\n", g_delim); + fprintf(stderr, " ..%capps-xx.yy where xx.yy is the NuttX version number.\n", g_delim); + fprintf(stderr, " <-h>:\n"); + fprintf(stderr, " Prints this message and exits.\n"); + exit(exitcode); +} + +static void debug(const char *fmt, ...) +{ + va_list ap; + + if (g_debug) + { + va_start(ap, fmt); + (void)vprintf(fmt, ap); + va_end(ap); + } +} + +static void parse_args(int argc, char **argv) +{ + char *ptr; + int ch; + + /* Parse command line options */ + + g_debug = false; + + while ((ch = getopt(argc, argv, ":a:dwlh")) > 0) + { + switch (ch) + { + case 'a' : + g_appdir = optarg; + break; + + case 'd' : + g_debug = true; + break; + + case 'w' : + g_delim = '/'; + g_winpaths = true; + break; + + case 'l' : + g_delim = '\\'; + g_winpaths = false; + break; + + case 'h' : + show_usage(argv[0], EXIT_SUCCESS); + + case '?' : + fprintf(stderr, "ERROR: Unrecognized option: %c\n", optopt); + show_usage(argv[0], EXIT_FAILURE); + + case ':' : + fprintf(stderr, "ERROR: Missing option argument, option: %c\n", optopt); + show_usage(argv[0], EXIT_FAILURE); + + break; + fprintf(stderr, "ERROR: Unexpected option: %c\n", ch); + show_usage(argv[0], EXIT_FAILURE); + } + } + + /* There should be exactly one argument following the options */ + + if (optind >= argc) + { + fprintf(stderr, "ERROR: Missing %c\n", g_delim); + show_usage(argv[0], EXIT_FAILURE); + } + + /* The required option should be the board directory name and the + * configuration directory name separated by '/' or '\'. Either is + * acceptable in this context. + */ + + g_boarddir = argv[optind]; + optind++; + + ptr = strchr(g_boarddir, '/'); + if (!ptr) + { + ptr = strchr(g_boarddir, '\\'); + } + + if (!ptr) + { + fprintf(stderr, "ERROR: Invalid %c\n", g_delim); + show_usage(argv[0], EXIT_FAILURE); + } + + *ptr++ = '\0'; + g_configdir = ptr; + + if (optind < argc) + { + fprintf(stderr, "Unexpected garbage at the end of the line\n"); + show_usage(argv[0], EXIT_FAILURE); + } +} + +static void verify_directory(const char *directory) +{ + struct stat buf; + + if (stat(directory, &buf) < 0) + { + fprintf(stderr, "ERROR: stat of %s failed: %s\n", directory, strerror(errno)); + exit(EXIT_FAILURE); + } + + if (!S_ISDIR(buf.st_mode)) + { + fprintf(stderr, "ERROR: %s exists but is not a directory\n", directory); + exit(EXIT_FAILURE); + } +} + +static bool verify_optiondir(const char *directory) +{ + struct stat buf; + + if (stat(directory, &buf) < 0) + { + /* It may be okay if the dirctory does not exist */ + + debug("verify_optiondir: stat of %s failed: %s\n", directory, strerror(errno)); + return false; + } + + if (!S_ISDIR(buf.st_mode)) + { + fprintf(stderr, "ERROR: %s exists but is not a directory\n", directory); + exit(EXIT_FAILURE); + } + + return true; +} + +static void verify_file(const char *path) +{ + struct stat buf; + + if (stat(path, &buf) < 0) + { + fprintf(stderr, "ERROR: stat of %s failed: %s\n", path, strerror(errno)); + exit(EXIT_FAILURE); + } + + if (!S_ISREG(buf.st_mode)) + { + fprintf(stderr, "ERROR: %s exists but is not a regular file\n", path); + exit(EXIT_FAILURE); + } +} + +static bool verify_optionfile(const char *path) +{ + struct stat buf; + + if (stat(path, &buf) < 0) + { + /* It may be okay if the file does not exist */ + + debug("verify_optionfile: stat of %s failed: %s\n", path, strerror(errno)); + return false; + } + + if (!S_ISREG(buf.st_mode)) + { + fprintf(stderr, "ERROR: %s exists but is not a regular file\n", path); + exit(EXIT_FAILURE); + } + + return true; +} + +static void get_topdir(void) +{ + /* Get and verify the top-level NuttX directory */ + + if (getcwd(g_buffer, BUFFER_SIZE) == NULL) + { + fprintf(stderr, "ERROR: getcwd failed: %s\n", strerror(errno)); + exit(EXIT_FAILURE); + } + + g_topdir = strdup(dirname(g_buffer)); + debug("get_topdir: Checking topdir=%s\n", g_topdir); + verify_directory(g_topdir); +} + +static void check_configdir(void) +{ + /* Get and verify the path to the selected configuration */ + + snprintf(g_buffer, BUFFER_SIZE, "%s%cconfigs%c%s%c%s", + g_topdir, g_delim, g_delim, g_boarddir, g_delim, g_configdir); + g_configpath = strdup(g_buffer); + debug("check_configdir: Checking configpath=%s\n", g_configpath); + verify_directory(g_configpath); +} + +static void read_configfile(void) +{ + FILE *stream; + + snprintf(g_buffer, BUFFER_SIZE, "%s%cdefconfig", g_configpath, g_delim); + stream = fopen(g_buffer, "r"); + if (!stream) + { + fprintf(stderr, "ERROR: failed to open %s for reading: %s\n", + g_buffer, strerror(errno)); + exit(EXIT_FAILURE); + } + + parse_file(stream, &g_configvars); + fclose(stream); +} + +static void read_versionfile(void) +{ + FILE *stream; + + snprintf(g_buffer, BUFFER_SIZE, "%s%c.version", g_topdir, g_delim); + stream = fopen(g_buffer, "r"); + if (!stream) + { + /* It may not be an error if there is no .version file */ + + debug("Failed to open %s for reading: %s\n", + g_buffer, strerror(errno)); + } + else + { + parse_file(stream, &g_versionvars); + fclose(stream); + } +} + +static void get_verstring(void) +{ + struct variable_s *var; + + if (g_versionvars) + { + var = find_variable("CONFIG_VERSION_STRING", g_versionvars); + if (var && var->val) + { + g_verstring = strdup(var->val); + } + } + + debug("get_verstring: Version string=%s\n", g_verstring); +} + +static bool verify_appdir(const char *appdir) +{ + /* Does this directory exist? */ + + snprintf(g_buffer, BUFFER_SIZE, "%s%c%s", g_topdir, g_delim, appdir); + debug("verify_appdir: Checking apppath=%s\n", g_buffer); + if (verify_optiondir(g_buffer)) + { + /* Yes.. Use this application directory path */ + + g_appdir = strdup(appdir); + g_apppath = strdup(g_buffer); + return true; + } + + debug("verify_appdir: apppath=%s does not exist\n", g_buffer); + return false; +} + +static void check_appdir(void) +{ + char tmp[16]; + + /* Get and verify the full path to the application directory */ + /* Was the appdir provided on the command line? */ + + debug("check_appdir: Command line appdir=%s\n", + g_appdir ? g_appdir : ""); + + if (!g_appdir) + { + /* No, was the path provided in the configuration? */ + + struct variable_s *var = find_variable("CONFIG_APP_DIR", g_configvars); + if (var) + { + debug("check_appdir: Config file appdir=%s\n", + var->val ? var->val : ""); + + /* Yes.. does this directory exist? */ + + if (var->val && verify_appdir(var->val)) + { + /* We are using the CONFIG_APP_DIR setting already + * in the defconfig file. + */ + + g_needapppath = false; + return; + } + } + + /* Now try some canned locations */ + + /* Try ../apps-xx.yy where xx.yy is the version string */ + + snprintf(tmp, 16, ".%capps-%s", g_delim, g_verstring); + debug("check_appdir: Try appdir=%s\n", tmp); + if (verify_appdir(tmp)) + { + return; + } + + /* Try ../apps with no version */ + + snprintf(tmp, 16, "..%capps", g_delim); + debug("check_appdir: Try appdir=%s\n", tmp); + if (verify_appdir(tmp)) + { + return; + } + + /* Try ../apps-xx.yy where xx.yy are the NuttX version number */ + + fprintf(stderr, "ERROR: Could not find the path to the application directory\n"); + exit(EXIT_FAILURE); + } + else + { + snprintf(g_buffer, BUFFER_SIZE, "%s%c%s", g_topdir, g_delim, g_appdir); + if (!verify_appdir(g_buffer)) + { + fprintf(stderr, "ERROR: Command line path to application directory does not exist\n"); + exit(EXIT_FAILURE); + } + } +} + +static void check_configuration(void) +{ + struct variable_s *var; + + /* Check if this the new style configuration based on kconfig-fontends */ + + var = find_variable("CONFIG_NUTTX_NEWCONFIG", g_configvars); + if (var && var->val && strcmp("y", var->val) == 0) + { + debug("check_configuration: New style configuration\n"); + g_newconfig = true; + } + + /* Check if this is a Windows native configuration */ + + var = find_variable("CONFIG_WINDOWS_NATIVE", g_configvars); + if (var && var->val && strcmp("y", var->val) == 0) + { + debug("check_configuration: Windows native configuration\n"); + g_winnative = true; + } + + /* All configurations must provide a defconfig and Make.defs file */ + + snprintf(g_buffer, BUFFER_SIZE, "%s%cdefconfig", g_configpath, g_delim); + debug("check_configuration: Checking %s\n", g_buffer); + verify_file(g_buffer); + g_srcdefconfig = strdup(g_buffer); + + snprintf(g_buffer, BUFFER_SIZE, "%s%cMake.defs", g_configpath, g_delim); + debug("check_configuration: Checking %s\n", g_buffer); + verify_file(g_buffer); + g_srcmakedefs = strdup(g_buffer); + + /* Windows native configurations may provide setenv.bat; POSIX + * configurations may provide a setenv.sh. + */ + + if (g_winnative) + { + snprintf(g_buffer, BUFFER_SIZE, "%s%csetenv.bat", g_configpath, g_delim); + debug("check_configuration: Checking %s\n", g_buffer); + if (verify_optionfile(g_buffer)) + { + g_srcsetenvbat = strdup(g_buffer); + } + } + else + { + snprintf(g_buffer, BUFFER_SIZE, "%s%csetenv.sh", g_configpath, g_delim); + debug("check_configuration: Checking %s\n", g_buffer); + if (verify_optionfile(g_buffer)) + { + g_srcsetenvsh = strdup(g_buffer); + } + } + + /* Old style configurations MUST provide an appconfig file */ + + if (!g_newconfig) + { + snprintf(g_buffer, BUFFER_SIZE, "%s%cappconfig", g_configpath, g_delim); + debug("check_configuration: Checking %s\n", g_buffer); + verify_file(g_buffer); + g_srcappconfig = strdup(g_buffer); + } +} + +static void copy_file(const char *srcpath, const char *destpath) +{ + int nbytesread; + int nbyteswritten; + int rdfd; + int wrfd; + + /* Open the source file for reading */ + + rdfd = open(srcpath, O_RDONLY); + if (rdfd < 0) + { + fprintf(stderr, "ERROR: Failed to open %s for reading: %s\n", srcpath, strerror(errno)); + exit(EXIT_FAILURE); + } + + /* Now open the destination for writing*/ + + wrfd = open(destpath, O_WRONLY|O_CREAT|O_TRUNC, 0666); + if (wrfd < 0) + { + fprintf(stderr, "ERROR: Failed to open %s for writing: %s\n", destpath, strerror(errno)); + exit(EXIT_FAILURE); + } + + /* Now copy the file */ + + for (;;) + { + do + { + nbytesread = read(rdfd, g_buffer, BUFFER_SIZE); + if (nbytesread == 0) + { + /* End of file */ + + close(rdfd); + close(wrfd); + return; + } + else if (nbytesread < 0) + { + /* EINTR is not an error (but will still stop the copy) */ + + fprintf(stderr, "ERROR: Read failure: %s\n", strerror(errno)); + exit(EXIT_FAILURE); + } + } + while (nbytesread <= 0); + + do + { + nbyteswritten = write(wrfd, g_buffer, nbytesread); + if (nbyteswritten >= 0) + { + nbytesread -= nbyteswritten; + } + else + { + /* EINTR is not an error (but will still stop the copy) */ + + fprintf(stderr, "ERROR: Write failure: %s\n", strerror(errno)); + exit(EXIT_FAILURE); + } + } + while (nbytesread > 0); + } +} + +static void substitute(char *str, int ch1, int ch2) +{ + for (; *str; str++) + { + if (*str == ch1) + { + *str = ch2; + } + } +} + +static void configure(void) +{ + char *destconfig; + + /* Copy the defconfig file as .config */ + + snprintf(g_buffer, BUFFER_SIZE, "%s%c.config", g_topdir, g_delim); + destconfig = strdup(g_buffer); + debug("configure: Copying from %s to %s\n", g_srcdefconfig, destconfig); + copy_file(g_srcdefconfig, destconfig); + + /* Copy the Make.defs file as Make.defs */ + + snprintf(g_buffer, BUFFER_SIZE, "%s%cMake.defs", g_topdir, g_delim); + debug("configure: Copying from %s to %s\n", g_srcmakedefs, g_buffer); + copy_file(g_srcmakedefs, g_buffer); + + /* Copy the setenv.sh file if have one and need one */ + + if (g_srcsetenvsh) + { + snprintf(g_buffer, BUFFER_SIZE, "%s%csetenv.sh", g_topdir, g_delim); + debug("configure: Copying from %s to %s\n", g_srcsetenvsh, g_buffer); + copy_file(g_srcsetenvsh, g_buffer); + + /* Mark the file executable */ + + if (chmod(g_buffer, 0777) != 0) + { + fprintf(stderr, "ERROR: Failed to make setenv.sh executable: %s\n", strerror(errno)); + exit(EXIT_FAILURE); + } + } + + /* Copy the setenv.bat file if have one and need one */ + + if (g_srcsetenvbat) + { + snprintf(g_buffer, BUFFER_SIZE, "%s%csetenv.bat", g_topdir, g_delim); + debug("configure: Copying from %s to %s\n", g_srcsetenvbat, g_buffer); + copy_file(g_srcsetenvbat, g_buffer); + } + + /* Copy the appconfig file to ../apps/.config if have one and need one */ + + if (g_srcappconfig) + { + snprintf(g_buffer, BUFFER_SIZE, "%s%c.config", g_apppath, g_delim); + debug("configure: Copying from %s to %s\n", g_srcappconfig, g_buffer); + copy_file(g_srcappconfig, g_buffer); + } + + /* If we did not use the CONFIG_APPS_DIR that was in the defconfig config file, + * then append the correct application information to the tail of the .config + * file + */ + + if (g_needapppath) + { + FILE *stream; + char *appdir = strdup(g_appdir); + + /* One complexity is if we are using Windows paths, but the configuration + * needs POSIX paths (or vice versa). + */ + + if (g_winpaths != g_winnative) + { + /* Not the same */ + + if (g_winpaths) + { + /* Using Windows paths, but the configuration wants POSIX paths */ + + substitute(appdir, '\\', '/'); + } + else + { + /* Using POSIX paths, but the configuration wants Windows paths */ + + substitute(appdir, '/', '\\'); + } + } + + /* Open the file for appending */ + + stream = fopen(destconfig, "a"); + if (!stream) + { + fprintf(stderr, "ERROR: Failed to open %s for append mode mode: %s\n", + destconfig, strerror(errno)); + exit(EXIT_FAILURE); + } + + fprintf(stream, "\n# Application configuration\n\n"); + fprintf(stream, "CONFIG_APPS_DIR=\"%s\"\n", appdir); + fclose(stream); + free(appdir); + } + + free(destconfig); +} + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +int main(int argc, char **argv, char **envp) +{ + debug("main: Checking arguments\n"); + parse_args(argc, argv); + + debug("main: Checking Nuttx Directories\n"); + get_topdir(); + check_configdir(); + + debug("main: Reading the configuration/version files\n"); + read_configfile(); + read_versionfile(); + get_verstring(); + + debug("main: Checking Configuration Directory\n"); + check_configuration(); + + debug("main: Checking Application Directories\n"); + check_appdir(); + debug("main: Using apppath=%s\n", g_apppath ? g_apppath : ""); + + debug("main: Configuring\n"); + configure(); + return EXIT_SUCCESS; +} From 470c2e71df47a3ad527afe4b20dbe8988c3f8575 Mon Sep 17 00:00:00 2001 From: patacongo Date: Sat, 5 Jan 2013 13:19:53 +0000 Subject: [PATCH 032/118] Correct some errors in the LPC17xx SYSCON register bit definitions (from Rommel Marcello) git-svn-id: http://svn.code.sf.net/p/nuttx/code/trunk@5479 42af7a65-404d-4744-a932-0658087f49c3 --- nuttx/ChangeLog | 2 ++ nuttx/Documentation/NuttX.html | 2 +- nuttx/Documentation/NuttxPortingGuide.html | 2 +- nuttx/README.txt | 2 +- nuttx/TODO | 2 +- nuttx/arch/arm/src/lpc17xx/lpc17_syscon.h | 16 ++++++++-------- nuttx/tools/configure.c | 22 +++++++--------------- nuttx/tools/configure.sh | 21 +++++++-------------- 8 files changed, 28 insertions(+), 41 deletions(-) diff --git a/nuttx/ChangeLog b/nuttx/ChangeLog index 710ffdceb7..cce0915872 100644 --- a/nuttx/ChangeLog +++ b/nuttx/ChangeLog @@ -3871,3 +3871,5 @@ thin layer that execuates configure.exe if it is available. If configure.exe is not available, then configure.bat will attempt to build it first. + * arch/arm/src/lpc17xx/lpc17_syscon.h: Correct some typos in bit + definitions (from Rommel Marcelo). diff --git a/nuttx/Documentation/NuttX.html b/nuttx/Documentation/NuttX.html index dc454c0b61..876aa2a0ac 100644 --- a/nuttx/Documentation/NuttX.html +++ b/nuttx/Documentation/NuttX.html @@ -8,7 +8,7 @@

            NuttX RTOS

            -

            Last Updated: December 28, 2012

            +

            Last Updated: January 4, 2012

            diff --git a/nuttx/Documentation/NuttxPortingGuide.html b/nuttx/Documentation/NuttxPortingGuide.html index 559253d45b..24b4852e03 100644 --- a/nuttx/Documentation/NuttxPortingGuide.html +++ b/nuttx/Documentation/NuttxPortingGuide.html @@ -12,7 +12,7 @@

            NuttX RTOS Porting Guide

            -

            Last Updated: December 18, 2012

            +

            Last Updated: January 4, 2012

            diff --git a/nuttx/README.txt b/nuttx/README.txt index 717c129b08..0348f7f303 100644 --- a/nuttx/README.txt +++ b/nuttx/README.txt @@ -687,7 +687,7 @@ Native Windows Build Build Tools. The build still relies on some Unix-like commands. I use the GNUWin32 tools that can be downloaded from http://gnuwin32.sourceforge.net/. - Host Compiler: I use the MingGW compiler which can be downloaded from + Host Compiler: I use the MingGW GCC compiler which can be downloaded from http://www.mingw.org/. If you are using GNUWin32, then it is recommended the you not install the optional MSYS components as there may be conflicts. diff --git a/nuttx/TODO b/nuttx/TODO index 4a70e577fb..02100e97e2 100644 --- a/nuttx/TODO +++ b/nuttx/TODO @@ -1,4 +1,4 @@ -NuttX TODO List (Last updated December 20, 2012) +NuttX TODO List (Last updated January 4, 2013) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ This file summarizes known NuttX bugs, limitations, inconsistencies with diff --git a/nuttx/arch/arm/src/lpc17xx/lpc17_syscon.h b/nuttx/arch/arm/src/lpc17xx/lpc17_syscon.h index ce8654645d..3b9c325260 100644 --- a/nuttx/arch/arm/src/lpc17xx/lpc17_syscon.h +++ b/nuttx/arch/arm/src/lpc17xx/lpc17_syscon.h @@ -242,29 +242,29 @@ #define SYSCON_PLL0STAT_MSEL_SHIFT (0) /* Bit 0-14: PLL0 Multiplier value readback */ #define SYSCON_PLL0STAT_MSEL_MASK (0x7fff << SYSCON_PLL0STAT_MSEL_SHIFT) - /* Bit 15: Reserved */ + /* Bit 15: Reserved */ #define SYSCON_PLL0STAT_NSEL_SHIFT (16) /* Bit 16-23: PLL0 Pre-Divider value readback */ #define SYSCON_PLL0STAT_NSEL_MASK (0xff << SYSCON_PLL0STAT_NSEL_SHIFT) #define SYSCON_PLL0STAT_PLLE (1 << 24) /* Bit 24: PLL0 enable readback */ #define SYSCON_PLL0STAT_PLLC (1 << 25) /* Bit 25: PLL0 connect readback */ #define SYSCON_PLL0STAT_PLOCK (1 << 26) /* Bit 26: PLL0 lock status */ - /* Bits 27-31: Reserved */ + /* Bits 27-31: Reserved */ /* PLL1 Status register */ -#define SYSCON_PLL1STAT_MSEL_SHIFT (0) /* Bit 0-4: PLL01Multiplier value readback */ +#define SYSCON_PLL1STAT_MSEL_SHIFT (0) /* Bit 0-4: PLL1 Multiplier value readback */ #define SYSCON_PLL1STAT_MSEL_MASK (0x1f << SYSCON_PLL1STAT_MSEL_SHIFT) #define SYSCON_PLL1STAT_NSEL_SHIFT (5) /* Bit 5-6: PLL1 Pre-Divider value readback */ #define SYSCON_PLL1STAT_NSEL_MASK (3 << SYSCON_PLL1STAT_NSEL_SHIFT) /* Bit 7: Reserved */ -#define SYSCON_PLL1STAT_PLLE (1 << 24) /* Bit 8: PLL1 enable readback */ -#define SYSCON_PLL1STAT_PLLC (1 << 25) /* Bit 9: PLL1 connect readback */ -#define SYSCON_PLL1STAT_PLOCK (1 << 26) /* Bit 10: PLL1 lock status */ - /* Bits 11-31: Reserved */ +#define SYSCON_PLL1STAT_PLLE (1 << 8) /* Bit 8: PLL1 enable readback */ +#define SYSCON_PLL1STAT_PLLC (1 << 9) /* Bit 9: PLL1 connect readback */ +#define SYSCON_PLL1STAT_PLOCK (1 << 10) /* Bit 10: PLL1 lock status */ + /* Bits 11-31: Reserved */ /* PLL0/1 Feed register */ #define SYSCON_PLLFEED_SHIFT (0) /* Bit 0-7: PLL0/1 feed sequence */ #define SYSCON_PLLFEED_MASK (0xff << SYSCON_PLLFEED_SHIFT) - /* Bits 8-31: Reserved */ + /* Bits 8-31: Reserved */ /* Clocking and power control -- Clock dividers */ /* CPU Clock Configuration register */ diff --git a/nuttx/tools/configure.c b/nuttx/tools/configure.c index f189f5b98b..eb8268f19a 100644 --- a/nuttx/tools/configure.c +++ b/nuttx/tools/configure.c @@ -549,7 +549,7 @@ static void check_configuration(void) } } -static void copy_file(const char *srcpath, const char *destpath) +static void copy_file(const char *srcpath, const char *destpath, mode_t mode) { int nbytesread; int nbyteswritten; @@ -567,7 +567,7 @@ static void copy_file(const char *srcpath, const char *destpath) /* Now open the destination for writing*/ - wrfd = open(destpath, O_WRONLY|O_CREAT|O_TRUNC, 0666); + wrfd = open(destpath, O_WRONLY|O_CREAT|O_TRUNC, mode); if (wrfd < 0) { fprintf(stderr, "ERROR: Failed to open %s for writing: %s\n", destpath, strerror(errno)); @@ -638,13 +638,13 @@ static void configure(void) snprintf(g_buffer, BUFFER_SIZE, "%s%c.config", g_topdir, g_delim); destconfig = strdup(g_buffer); debug("configure: Copying from %s to %s\n", g_srcdefconfig, destconfig); - copy_file(g_srcdefconfig, destconfig); + copy_file(g_srcdefconfig, destconfig, 0644); /* Copy the Make.defs file as Make.defs */ snprintf(g_buffer, BUFFER_SIZE, "%s%cMake.defs", g_topdir, g_delim); debug("configure: Copying from %s to %s\n", g_srcmakedefs, g_buffer); - copy_file(g_srcmakedefs, g_buffer); + copy_file(g_srcmakedefs, g_buffer, 0644); /* Copy the setenv.sh file if have one and need one */ @@ -652,15 +652,7 @@ static void configure(void) { snprintf(g_buffer, BUFFER_SIZE, "%s%csetenv.sh", g_topdir, g_delim); debug("configure: Copying from %s to %s\n", g_srcsetenvsh, g_buffer); - copy_file(g_srcsetenvsh, g_buffer); - - /* Mark the file executable */ - - if (chmod(g_buffer, 0777) != 0) - { - fprintf(stderr, "ERROR: Failed to make setenv.sh executable: %s\n", strerror(errno)); - exit(EXIT_FAILURE); - } + copy_file(g_srcsetenvsh, g_buffer, 0755); } /* Copy the setenv.bat file if have one and need one */ @@ -669,7 +661,7 @@ static void configure(void) { snprintf(g_buffer, BUFFER_SIZE, "%s%csetenv.bat", g_topdir, g_delim); debug("configure: Copying from %s to %s\n", g_srcsetenvbat, g_buffer); - copy_file(g_srcsetenvbat, g_buffer); + copy_file(g_srcsetenvbat, g_buffer, 0644); } /* Copy the appconfig file to ../apps/.config if have one and need one */ @@ -678,7 +670,7 @@ static void configure(void) { snprintf(g_buffer, BUFFER_SIZE, "%s%c.config", g_apppath, g_delim); debug("configure: Copying from %s to %s\n", g_srcappconfig, g_buffer); - copy_file(g_srcappconfig, g_buffer); + copy_file(g_srcappconfig, g_buffer, 0644); } /* If we did not use the CONFIG_APPS_DIR that was in the defconfig config file, diff --git a/nuttx/tools/configure.sh b/nuttx/tools/configure.sh index ffa997178e..89f2e2fbc0 100755 --- a/nuttx/tools/configure.sh +++ b/nuttx/tools/configure.sh @@ -125,7 +125,6 @@ else fi src_config="${configpath}/defconfig" -tmp_config="${TOPDIR}/.configX" dest_config="${TOPDIR}/.config" if [ ! -r "${src_config}" ]; then @@ -201,7 +200,7 @@ if [ "X${have_setenv}" = "Xy" ]; then { echo "Failed to copy ${src_setenv}" ; exit 8 ; } chmod 755 "${dest_setenv}" fi -install "${src_config}" "${tmp_config}" || \ +install "${src_config}" "${dest_config}" || \ { echo "Failed to copy \"${src_config}\"" ; exit 9 ; } # If we did not use the CONFIG_APPS_DIR that was in the defconfig config file, @@ -209,14 +208,14 @@ install "${src_config}" "${tmp_config}" || \ # file if [ "X${defappdir}" = "Xy" ]; then - sed -i -e "/^CONFIG_APPS_DIR/d" "${tmp_config}" - echo "" >> "${tmp_config}" - echo "# Application configuration" >> "${tmp_config}" - echo "" >> "${tmp_config}" + sed -i -e "/^CONFIG_APPS_DIR/d" "${dest_config}" + echo "" >> "${dest_config}" + echo "# Application configuration" >> "${dest_config}" + echo "" >> "${dest_config}" if [ "X${winnative}" = "Xy" ]; then - echo "CONFIG_APPS_DIR=\"$winappdir\"" >> "${tmp_config}" + echo "CONFIG_APPS_DIR=\"$winappdir\"" >> "${dest_config}" else - echo "CONFIG_APPS_DIR=\"$posappdir\"" >> "${tmp_config}" + echo "CONFIG_APPS_DIR=\"$posappdir\"" >> "${dest_config}" fi fi @@ -232,9 +231,3 @@ if [ ! -z "${appdir}" -a "X${newconfig}" != "Xy" ]; then { echo "Failed to copy ${configpath}/appconfig" ; exit 10 ; } fi fi - -# install the final .configX only if it differs from any existing -# .config file. - -install "${tmp_config}" "${dest_config}" -rm -f "${tmp_config}" From 3e91a8a290fddb2b7755ac32fd1b8b318fc013a5 Mon Sep 17 00:00:00 2001 From: patacongo Date: Sat, 5 Jan 2013 14:57:43 +0000 Subject: [PATCH 033/118] Clean up a few tools/ build issues git-svn-id: http://svn.code.sf.net/p/nuttx/code/trunk@5480 42af7a65-404d-4744-a932-0658087f49c3 --- nuttx/tools/Makefile.host | 27 +++++++++++++++++++-------- nuttx/tools/cmpconfig.c | 7 ++++--- nuttx/tools/configure.bat | 1 - nuttx/tools/mksyscall.c | 6 ++++-- 4 files changed, 27 insertions(+), 14 deletions(-) diff --git a/nuttx/tools/Makefile.host b/nuttx/tools/Makefile.host index 73352aae3a..998d389160 100644 --- a/nuttx/tools/Makefile.host +++ b/nuttx/tools/Makefile.host @@ -37,13 +37,29 @@ TOPDIR ?= ${shell pwd}/.. -include $(TOPDIR)/Make.defs include ${TOPDIR}/tools/Config.mk +# Define HOSTCC on the make command line if it differs from these defaults +# Define HOSTCFLAGS with -g on the make command line to build debug versions + +ifeq ($(CONFIG_WINDOWS_NATIVE),y) + +# In the Windows native environment, the MinGW GCC compiler is assumed + +HOSTCC ?= mingw-gcc.exe +HOSTCFLAGS ?= -O2 -Wall -Wstrict-prototypes -Wshadow -I. -DCONFIG_WINDOWS_NATIVE=y + +else + +# GCC is assumed in the POSIX environment. # strtok_r is used in some tools, but does not seem to be available in # the MinGW environment. -ifneq ($(CONFIG_WINDOWS_NATIVE),y) - HOSTCFLAGS += -D HAVE_STRTOK_C +HOSTCC ?= gcc +HOSTCFLAGS ?= -O2 -Wall -Wstrict-prototypes -Wshadow -I. -DHAVE_STRTOK_C + endif +# Targets + all: b16$(HOSTEXEEXT) bdf-converter$(HOSTEXEEXT) cmpconfig$(HOSTEXEEXT) \ configure$(HOSTEXEEXT) mkconfig$(HOSTEXEEXT) mkdeps$(HOSTEXEEXT) mksymtab$(HOSTEXEEXT) \ mksyscall$(HOSTEXEEXT) mkversion$(HOSTEXEEXT) @@ -55,12 +71,7 @@ else .PHONY: clean endif -# Add HOSTCFLAGS=-g on the make command line build debug versions - -HOSTCFLAGS ?= -O2 -Wall -I. -HOSTCC ?= gcc - -# b16 - Fixed precision math converstion tool +# b16 - Fixed precision math conversion tool b16$(HOSTEXEEXT): b16.c $(Q) $(HOSTCC) $(HOSTCFLAGS) -o b16$(HOSTEXEEXT) b16.c diff --git a/nuttx/tools/cmpconfig.c b/nuttx/tools/cmpconfig.c index 08b7dab3f0..a5a5394017 100644 --- a/nuttx/tools/cmpconfig.c +++ b/nuttx/tools/cmpconfig.c @@ -67,6 +67,7 @@ static void compare_variables(struct variable_s *list1, struct variable_s *list2 { char *varval1; char *varval2; + int result; while (list1 || list2) { @@ -102,7 +103,7 @@ static void compare_variables(struct variable_s *list1, struct variable_s *list2 } else { - int result = strcmp(list1->var, list2->var); + result = strcmp(list1->var, list2->var); if (result < 0) { printf("file1: %s=%s\n", list1->var, varval1); @@ -115,9 +116,9 @@ static void compare_variables(struct variable_s *list1, struct variable_s *list2 printf("file2: %s=%s\n\n", list2->var, varval2); list2 = list2->flink; } - else + else /* if (result == 0) */ { - int result = strcmp(varval1, varval2); + result = strcmp(varval1, varval2); if (result != 0) { printf("file1: %s=%s\n", list1->var, varval1); diff --git a/nuttx/tools/configure.bat b/nuttx/tools/configure.bat index c28558fbbd..7dc9ca116c 100644 --- a/nuttx/tools/configure.bat +++ b/nuttx/tools/configure.bat @@ -93,7 +93,6 @@ configure.exe %debug% %fmt% %appdir% %config% if errorlevel 1 echo configure.exe failed goto End - :NoConfig echo Missing ^/^ argument diff --git a/nuttx/tools/mksyscall.c b/nuttx/tools/mksyscall.c index a75e82d280..1d172a2a11 100644 --- a/nuttx/tools/mksyscall.c +++ b/nuttx/tools/mksyscall.c @@ -61,11 +61,11 @@ static FILE *g_stubstream; * Private Functions ****************************************************************************/ -static bool is_vararg(const char *type, int index, int nparms) +static bool is_vararg(const char *type, int ndx, int nparms) { if (strcmp(type,"...") == 0) { - if (index != (nparms-1)) + if (ndx != (nparms-1)) { fprintf(stderr, "%d: ... is not the last in the argument list\n", g_lineno); exit(11); @@ -75,8 +75,10 @@ static bool is_vararg(const char *type, int index, int nparms) fprintf(stderr, "%d: Need one parameter before ...\n", g_lineno); exit(14); } + return true; } + return false; } From 362d3bb5d2257092e30c5ff9c27cd713403a87df Mon Sep 17 00:00:00 2001 From: patacongo Date: Sat, 5 Jan 2013 16:07:37 +0000 Subject: [PATCH 034/118] Extend tools/configure.c for better compatibility with configure.sh git-svn-id: http://svn.code.sf.net/p/nuttx/code/trunk@5481 42af7a65-404d-4744-a932-0658087f49c3 --- nuttx/ChangeLog | 2 + nuttx/libc/string/lib_strndup.c | 11 +- nuttx/tools/configure.c | 199 +++++++++++++++++++++++++++----- 3 files changed, 173 insertions(+), 39 deletions(-) diff --git a/nuttx/ChangeLog b/nuttx/ChangeLog index cce0915872..b278004198 100644 --- a/nuttx/ChangeLog +++ b/nuttx/ChangeLog @@ -3873,3 +3873,5 @@ to build it first. * arch/arm/src/lpc17xx/lpc17_syscon.h: Correct some typos in bit definitions (from Rommel Marcelo). + * libc/string/lib_strndup.c: strndup() should use strnlen(), not + strlen(), to determine the size of the string. diff --git a/nuttx/libc/string/lib_strndup.c b/nuttx/libc/string/lib_strndup.c index 524e09754e..5a78e2dcfe 100644 --- a/nuttx/libc/string/lib_strndup.c +++ b/nuttx/libc/string/lib_strndup.c @@ -1,7 +1,7 @@ /************************************************************************ * libc/string//lib_strndup.c * - * Copyright (C) 2011 Gregory Nutt. All rights reserved. + * Copyright (C) 2011, 2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -68,13 +68,9 @@ FAR char *strndup(FAR const char *s, size_t size) FAR char *news = NULL; if (s) { - /* Get the size of the new string = MIN(strlen(s), size) */ + /* Get the size of the new string (limited to size) */ - size_t allocsize = strlen(s); - if (allocsize > size) - { - allocsize = size; - } + size_t allocsize = strnlen(s, size); /* Allocate the new string, adding 1 for the NUL terminator */ @@ -89,5 +85,6 @@ FAR char *strndup(FAR const char *s, size_t size) news[allocsize] = '\0'; } } + return news; } diff --git a/nuttx/tools/configure.c b/nuttx/tools/configure.c index eb8268f19a..9e82c36571 100644 --- a/nuttx/tools/configure.c +++ b/nuttx/tools/configure.c @@ -46,6 +46,7 @@ #include #include #include +#include #include #include @@ -76,7 +77,8 @@ static char *g_configdir = NULL; /* Name of configuration subdirector static char *g_topdir = NULL; /* Full path to top-level NuttX build directory */ static char *g_apppath = NULL; /* Full path to the applicatino directory */ -static char *g_configpath = NULL; /* Full path to the configuration directory */ +static char *g_configtop = NULL; /* Full path to the top-level configuration directory */ +static char *g_configpath = NULL; /* Full path to the configuration sub-directory */ static char *g_verstring = "0.0"; /* Version String */ static char *g_srcdefconfig = NULL; /* Source defconfig file */ @@ -100,13 +102,13 @@ static struct variable_s *g_versionvars = NULL; static void show_usage(const char *progname, int exitcode) { - fprintf(stderr, "\nUSAGE: %s [-d] [-w] [-l] [-h] [-a ] %c\n", progname, g_delim); + fprintf(stderr, "\nUSAGE: %s [-d] [-w] [-l] [-h] [-a ] [%c]\n", progname, g_delim); fprintf(stderr, "\nWhere:\n"); fprintf(stderr, " :\n"); fprintf(stderr, " Identifies the board. This must correspond to a board directory\n"); fprintf(stderr, " under nuttx%cconfigs%c.\n", g_delim, g_delim); fprintf(stderr, " :\n"); - fprintf(stderr, " Identifies the specific configuratin for the selected .\n"); + fprintf(stderr, " Identifies the specific configuration for the selected .\n"); fprintf(stderr, " This must correspond to a sub-directory under the board directory at\n"); fprintf(stderr, " under nuttx%cconfigs%c%c.\n", g_delim, g_delim, g_delim); fprintf(stderr, " <-d>:\n"); @@ -263,8 +265,19 @@ static bool verify_optiondir(const char *directory) { /* It may be okay if the dirctory does not exist */ - debug("verify_optiondir: stat of %s failed: %s\n", directory, strerror(errno)); - return false; + /* It may be okay if the file does not exist */ + + int errcode = errno; + if (errcode == ENOENT) + { + debug("verify_optiondir: stat of %s failed: %s\n", directory, strerror(errno)); + return false; + } + else + { + fprintf(stderr, "ERROR: stat of %s failed: %s\n", directory, strerror(errno)); + exit(EXIT_FAILURE); + } } if (!S_ISDIR(buf.st_mode)) @@ -276,24 +289,7 @@ static bool verify_optiondir(const char *directory) return true; } -static void verify_file(const char *path) -{ - struct stat buf; - - if (stat(path, &buf) < 0) - { - fprintf(stderr, "ERROR: stat of %s failed: %s\n", path, strerror(errno)); - exit(EXIT_FAILURE); - } - - if (!S_ISREG(buf.st_mode)) - { - fprintf(stderr, "ERROR: %s exists but is not a regular file\n", path); - exit(EXIT_FAILURE); - } -} - -static bool verify_optionfile(const char *path) +static bool verify_file(const char *path) { struct stat buf; @@ -301,8 +297,17 @@ static bool verify_optionfile(const char *path) { /* It may be okay if the file does not exist */ - debug("verify_optionfile: stat of %s failed: %s\n", path, strerror(errno)); - return false; + int errcode = errno; + if (errcode == ENOENT) + { + debug("verify_file: stat of %s failed: %s\n", path, strerror(errno)); + return false; + } + else + { + fprintf(stderr, "ERROR: stat of %s failed: %s\n", path, strerror(errno)); + exit(EXIT_FAILURE); + } } if (!S_ISREG(buf.st_mode)) @@ -329,15 +334,124 @@ static void get_topdir(void) verify_directory(g_topdir); } +static void config_search(const char *boarddir) +{ + DIR *dir; + struct dirent *dp; + struct stat buf; + char *parent; + char *child; + + /* Skip over any leading '/' or '\\'. This happens on the first second + * call because the starting boarddir is "" + */ + + if (boarddir[0] == g_delim) + { + boarddir++; + } + + /* Get the full directory path and open it */ + + snprintf(g_buffer, BUFFER_SIZE, "%s%c%s", g_configtop, g_delim, boarddir); + dir = opendir(g_buffer); + if (!dir) + { + fprintf(stderr, "ERROR: Could not open %s: %s\n", + g_buffer, strerror(errno)); + return; + } + + /* Make a copy of the path to the directory */ + + parent = strdup(g_buffer); + + /* Vist each entry in the directory */ + + while ((dp = readdir (dir)) != NULL) + { + /* Ignore directory entries that start with '.' */ + + if (dp->d_name[0] == '.') + { + continue; + } + + /* Get a properly terminated copy of d_name (if d_name is long it may + * not include a NUL terminator.\ */ + + child = strndup(dp->d_name, NAME_MAX); + + /* Get the full path to d_name and stat the file/directory */ + + snprintf(g_buffer, BUFFER_SIZE, "%s%c%s", parent, g_delim, child); + if (stat(g_buffer, &buf) < 0) + { + fprintf(stderr, "ERROR: stat of %s failed: %s\n", + g_buffer, strerror(errno)); + free(child); + continue; + } + + /* If it is a directory, the recurse */ + + if (S_ISDIR(buf.st_mode)) + { + char *tmppath; + snprintf(g_buffer, BUFFER_SIZE, "%s%c%s", boarddir, g_delim, child); + tmppath = strdup(g_buffer); + config_search(tmppath); + free(tmppath); + } + + /* If it is a regular file named 'defconfig' then we have found a + * configuration directory. We could terminate the serach in this case + * because we do not expect sub-directories within configuration + * directories. + */ + + else if (S_ISREG(buf.st_mode) && strcmp("defconfig", child) == 0) + { + fprintf(stderr, " %s\n", boarddir); + } + + free(child); + } + + free(parent); + closedir(dir); +} + +static void enumerate_configs(void) +{ + fprintf(stderr, "Options for [%c] include:\n\n", g_delim); + config_search(""); +} + static void check_configdir(void) { + /* Get the path to the top level configuration directory */ + + snprintf(g_buffer, BUFFER_SIZE, "%s%cconfigs", g_topdir, g_delim); + debug("check_configdir: Checking configtop=%s\n", g_buffer); + + verify_directory(g_buffer); + g_configtop = strdup(g_buffer); + /* Get and verify the path to the selected configuration */ snprintf(g_buffer, BUFFER_SIZE, "%s%cconfigs%c%s%c%s", g_topdir, g_delim, g_delim, g_boarddir, g_delim, g_configdir); + debug("check_configdir: Checking configpath=%s\n", g_buffer); + + if (!verify_optiondir(g_buffer)) + { + fprintf(stderr, "ERROR: No configuration at %s\n", g_buffer); + enumerate_configs(); + exit(EXIT_FAILURE); + } + g_configpath = strdup(g_buffer); - debug("check_configdir: Checking configpath=%s\n", g_configpath); - verify_directory(g_configpath); } static void read_configfile(void) @@ -507,12 +621,26 @@ static void check_configuration(void) snprintf(g_buffer, BUFFER_SIZE, "%s%cdefconfig", g_configpath, g_delim); debug("check_configuration: Checking %s\n", g_buffer); - verify_file(g_buffer); + if (!verify_file(g_buffer)) + { + fprintf(stderr, "ERROR: No configuration in %s\n", g_configpath); + fprintf(stderr, " No defconfig file found.\n"); + enumerate_configs(); + exit(EXIT_FAILURE); + } + g_srcdefconfig = strdup(g_buffer); snprintf(g_buffer, BUFFER_SIZE, "%s%cMake.defs", g_configpath, g_delim); debug("check_configuration: Checking %s\n", g_buffer); - verify_file(g_buffer); + if (!verify_file(g_buffer)) + { + fprintf(stderr, "ERROR: Configuration corrupted in %s\n", g_configpath); + fprintf(stderr, " No Make.defs file found.\n"); + enumerate_configs(); + exit(EXIT_FAILURE); + } + g_srcmakedefs = strdup(g_buffer); /* Windows native configurations may provide setenv.bat; POSIX @@ -523,7 +651,7 @@ static void check_configuration(void) { snprintf(g_buffer, BUFFER_SIZE, "%s%csetenv.bat", g_configpath, g_delim); debug("check_configuration: Checking %s\n", g_buffer); - if (verify_optionfile(g_buffer)) + if (verify_file(g_buffer)) { g_srcsetenvbat = strdup(g_buffer); } @@ -532,7 +660,7 @@ static void check_configuration(void) { snprintf(g_buffer, BUFFER_SIZE, "%s%csetenv.sh", g_configpath, g_delim); debug("check_configuration: Checking %s\n", g_buffer); - if (verify_optionfile(g_buffer)) + if (verify_file(g_buffer)) { g_srcsetenvsh = strdup(g_buffer); } @@ -544,7 +672,14 @@ static void check_configuration(void) { snprintf(g_buffer, BUFFER_SIZE, "%s%cappconfig", g_configpath, g_delim); debug("check_configuration: Checking %s\n", g_buffer); - verify_file(g_buffer); + if (!verify_file(g_buffer)) + { + fprintf(stderr, "ERROR: Configuration corrupted in %s\n", g_configpath); + fprintf(stderr, " Required appconfig file not found.\n"); + enumerate_configs(); + exit(EXIT_FAILURE); + } + g_srcappconfig = strdup(g_buffer); } } From 0d86268de677a844efa345638650dcaa6bf12764 Mon Sep 17 00:00:00 2001 From: patacongo Date: Sun, 6 Jan 2013 17:00:08 +0000 Subject: [PATCH 035/118] Remove CONFIG_BUILTIN_APPS_START git-svn-id: http://svn.code.sf.net/p/nuttx/code/trunk@5482 42af7a65-404d-4744-a932-0658087f49c3 --- apps/README.txt | 15 --------------- nuttx/ChangeLog | 5 +++++ nuttx/Documentation/NuttShell.html | 25 +++---------------------- nuttx/sched/os_bringup.c | 22 ++-------------------- 4 files changed, 10 insertions(+), 57 deletions(-) diff --git a/apps/README.txt b/apps/README.txt index 3281269057..4a336abdb2 100644 --- a/apps/README.txt +++ b/apps/README.txt @@ -141,21 +141,6 @@ This will select the apps/examples/hello in the following way: Thus accomplishing the same thing with no apps/.config file. -Built-In Start-Up main() function ------------------------------- -A builtin application can even be used as the main, start-up entry point -into your embedded software. When the user defines this option in -the NuttX configuration file: - - CONFIG_BUILTIN_APP_START= - -that application shall be invoked immediately after system starts -*instead* of the default "user_start" entry point. -Note that must be provided as: "hello", -will call: - - int hello_main(int argc, char *argv[]) - Example Built-In Application ---------------------------- An example application skeleton can be found under the examples/hello diff --git a/nuttx/ChangeLog b/nuttx/ChangeLog index b278004198..f4f6975637 100644 --- a/nuttx/ChangeLog +++ b/nuttx/ChangeLog @@ -3875,3 +3875,8 @@ definitions (from Rommel Marcelo). * libc/string/lib_strndup.c: strndup() should use strnlen(), not strlen(), to determine the size of the string. + * sched/os_bringup.c: Remove support for CONFIG_BUILTIN_APP_START. + This is not really a useful feature and creates a violation of the + OS layered architecture. + + diff --git a/nuttx/Documentation/NuttShell.html b/nuttx/Documentation/NuttShell.html index 7ad96da79b..95a75b22c5 100644 --- a/nuttx/Documentation/NuttShell.html +++ b/nuttx/Documentation/NuttShell.html @@ -3421,29 +3421,10 @@ context:

            Other Uses of Built-In Application. The primary purpose of builtin applications is to support command line execution of applications from NSH. - However, there are two other uses of builtin applications that should be mentioned. + However, there is one other use of builtin applications that should be mentioned.

              -
            1. -

              - Built-In Application Start-Up main() function. - A builtin application can even be used as the main, start-up entry point into your embedded software. - When the user defines this option in the NuttX configuration file: -

              -
                -CONFIG_BUILTIN_APP_START=<application name>
                -
              -

              - that application will be invoked immediately after system starts instead of the default CONFIG_USER_ENTRYPOINT() entry point. - Note that <application name> must be provided just as it would have been on the NSH command line. - For example, hello would result in hello_main() being started at power-up. -

              -

              - This option might be useful in some develop environments where you use NSH only during the debug phase, but want to eliminate NSH in the final product. - Setting CONFIG_BUILTIN_APP_START in this way will bypass NSH and execute your application just as if it were entered from the NSH command line. -

              -
            2. binfs. binfs is a tiny file system located at apps/builtin/binfs.c. @@ -3452,7 +3433,8 @@ CONFIG_BUILTIN_APP_START=<application name> binfs will create a tiny pseudo-file system mounted at /bin. Using binfs, you can see the available builtin applications by listing the contents of /bin directory. This gives some superficial Unix compatibility, but does not really add any new functionality. -

              +

              +

            4.3.2 Synchronous Built-In Applications

            @@ -3770,7 +3752,6 @@ mount -t vfat /dev/ram1 /tmp
          • Command summaries
          • Command table
          • Conditional command execution
          • -
          • CONFIG_BUILTIN_APP_START
          • CONFIG_DISABLE_MOUNTPOINT
          • CONFIG_FS_ROMFS
          • CONFIG_NFILE_DESCRIPTORS
          • diff --git a/nuttx/sched/os_bringup.c b/nuttx/sched/os_bringup.c index 4b5adcae1a..610d8515a6 100644 --- a/nuttx/sched/os_bringup.c +++ b/nuttx/sched/os_bringup.c @@ -57,9 +57,6 @@ #ifdef CONFIG_SCHED_WORKQUEUE # include "work_internal.h" #endif -#ifdef CONFIG_BUILTIN_APP_START -# include "apps/apps.h" -#endif #ifdef CONFIG_NUTTX_KERNEL # include "arch/board/user_map.h" #endif @@ -112,22 +109,15 @@ * function is to serve as the "bottom half" of device * drivers. * - * And the main application entry point. This may be one of two different + * And the main application entry point: * symbols: * - * - USER_ENTRYPOINT: This is the default entry point used for all of the - * example code in apps/examples. - * - CONFIG_BUILTIN_APP_START: The system can also be configured to start - * custom applications at however CONFIG_BUILTIN_APP_START - * is defined in the NuttX start-up file. + * - USER_ENTRYPOINT: This is the default user application entry point. * ****************************************************************************/ int os_bringup(void) { -#ifdef CONFIG_BUILTIN_APP_START - static const char *argv[3] = {NULL, "init", NULL}; -#endif int init_taskid; /* Setup up the initial environment for the idle task. At present, this @@ -188,19 +178,11 @@ int os_bringup(void) svdbg("Starting init thread\n"); -#ifdef CONFIG_BUILTIN_APP_START - /* Start the built-in application, passing an "init" argument, so that - * application can distinguish different run-levels - */ - - init_taskid = exec_builtin(CONFIG_BUILTIN_APP_START, argv); -#else /* Start the default application at CONFIG_USER_ENTRYPOINT() */ init_taskid = TASK_CREATE("init", SCHED_PRIORITY_DEFAULT, CONFIG_USERMAIN_STACKSIZE, (main_t)CONFIG_USER_ENTRYPOINT, (const char **)NULL); -#endif ASSERT(init_taskid != ERROR); /* We an save a few bytes by discarding the IDLE thread's environment. */ From fe4b34bdedf8004ce14843f9d3dd16bff1d8693a Mon Sep 17 00:00:00 2001 From: patacongo Date: Sun, 6 Jan 2013 17:34:03 +0000 Subject: [PATCH 036/118] Fix SEM_INITIALIZER git-svn-id: http://svn.code.sf.net/p/nuttx/code/trunk@5483 42af7a65-404d-4744-a932-0658087f49c3 --- nuttx/include/semaphore.h | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/nuttx/include/semaphore.h b/nuttx/include/semaphore.h index 257a5826f3..203118bd66 100644 --- a/nuttx/include/semaphore.h +++ b/nuttx/include/semaphore.h @@ -1,7 +1,7 @@ /**************************************************************************** * include/semaphore.h * - * Copyright (C) 2007-2009, 2012 Gregory Nutt. All rights reserved. + * Copyright (C) 2007-2009, 2012-2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -103,9 +103,13 @@ typedef struct sem_s sem_t; /* Initializers */ #ifdef CONFIG_PRIORITY_INHERITANCE -# define SEM_INITIALIZER(c) {(c), SEMHOLDER_INITIALIZER} +# if CONFIG_SEM_PREALLOCHOLDERS > 0 +# define SEM_INITIALIZER(c) {(c), NULL} /* semcount, hhead */ +# else +# define SEM_INITIALIZER(c) {(c), SEMHOLDER_INITIALIZER} /* semcount, holder */ +# endif #else -# define SEM_INITIALIZER(c) {(c)} +# define SEM_INITIALIZER(c) {(c)} /* semcount */ #endif /**************************************************************************** From f6c0ca1513bf82552a6d5fab92eedceee96515c0 Mon Sep 17 00:00:00 2001 From: patacongo Date: Sun, 6 Jan 2013 19:29:01 +0000 Subject: [PATCH 037/118] Update kconfig-frontends to 3.7.0 git-svn-id: http://svn.code.sf.net/p/nuttx/code/trunk@5484 42af7a65-404d-4744-a932-0658087f49c3 --- misc/tools/kconfig-frontends/configure | 22 +-- misc/tools/kconfig-frontends/configure.ac | 1 + .../kconfig-frontends/frontends/conf/conf.c | 25 ++- .../kconfig-frontends/frontends/mconf/mconf.c | 123 ++++++++++--- .../kconfig-frontends/frontends/nconf/nconf.c | 2 +- .../kconfig-frontends/libs/lxdialog/dialog.h | 9 +- .../kconfig-frontends/libs/lxdialog/textbox.c | 171 ++++++++++-------- .../kconfig-frontends/libs/lxdialog/util.c | 7 + .../kconfig-frontends/libs/parser/Makefile.am | 2 +- .../kconfig-frontends/libs/parser/Makefile.in | 2 +- .../kconfig-frontends/libs/parser/expr.h | 10 + .../kconfig-frontends/libs/parser/list.h | 91 ++++++++++ .../kconfig-frontends/libs/parser/lkc_proto.h | 6 +- .../kconfig-frontends/libs/parser/menu.c | 55 +++++- .../kconfig-frontends/scripts/ksync.list | 1 + .../kconfig-frontends/scripts/version.sh | 2 +- 16 files changed, 388 insertions(+), 141 deletions(-) create mode 100644 misc/tools/kconfig-frontends/libs/parser/list.h diff --git a/misc/tools/kconfig-frontends/configure b/misc/tools/kconfig-frontends/configure index ad26f3f9d7..069ec071f7 100755 --- a/misc/tools/kconfig-frontends/configure +++ b/misc/tools/kconfig-frontends/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.67 for kconfig-frontends 3.6.0-0. +# Generated by GNU Autoconf 2.67 for kconfig-frontends 3.7.0.0. # # Report bugs to . # @@ -701,8 +701,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='kconfig-frontends' PACKAGE_TARNAME='kconfig-frontends' -PACKAGE_VERSION='3.6.0-0' -PACKAGE_STRING='kconfig-frontends 3.6.0-0' +PACKAGE_VERSION='3.7.0.0' +PACKAGE_STRING='kconfig-frontends 3.7.0.0' PACKAGE_BUGREPORT='yann.morin.1998@free.fr' PACKAGE_URL='' @@ -1516,7 +1516,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures kconfig-frontends 3.6.0-0 to adapt to many kinds of systems. +\`configure' configures kconfig-frontends 3.7.0.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1587,7 +1587,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of kconfig-frontends 3.6.0-0:";; + short | recursive ) echo "Configuration of kconfig-frontends 3.7.0.0:";; esac cat <<\_ACEOF @@ -1735,7 +1735,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -kconfig-frontends configure 3.6.0-0 +kconfig-frontends configure 3.7.0.0 generated by GNU Autoconf 2.67 Copyright (C) 2010 Free Software Foundation, Inc. @@ -2325,7 +2325,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by kconfig-frontends $as_me 3.6.0-0, which was +It was created by kconfig-frontends $as_me 3.7.0.0, which was generated by GNU Autoconf 2.67. Invocation command line was $ $0 $@ @@ -3157,7 +3157,7 @@ fi # Define the identity of the package. PACKAGE='kconfig-frontends' - VERSION='3.6.0-0' + VERSION='3.7.0.0' cat >>confdefs.h <<_ACEOF @@ -17335,7 +17335,7 @@ fi #---------------------------------------- # Get the version to apply to the parser shared library -KCONFIGPARSER_LIB_VERSION=3.6.0 +KCONFIGPARSER_LIB_VERSION=3.7.0 #---------------------------------------- @@ -17912,7 +17912,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by kconfig-frontends $as_me 3.6.0-0, which was +This file was extended by kconfig-frontends $as_me 3.7.0.0, which was generated by GNU Autoconf 2.67. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -17978,7 +17978,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -kconfig-frontends config.status 3.6.0-0 +kconfig-frontends config.status 3.7.0.0 configured by $0, generated by GNU Autoconf 2.67, with options \\"\$ac_cs_config\\" diff --git a/misc/tools/kconfig-frontends/configure.ac b/misc/tools/kconfig-frontends/configure.ac index 895cd58cf9..6ecf47b4ff 100644 --- a/misc/tools/kconfig-frontends/configure.ac +++ b/misc/tools/kconfig-frontends/configure.ac @@ -43,6 +43,7 @@ AC_SUBST([SILENT_MAKEFLAGS]) #---------------------------------------- # Prepare libtool +m4_ifdef([AM_PROG_AR], [AM_PROG_AR]) dnl Automake, we have a problem... LT_PREREQ([2.2.6]) LT_INIT([disable-static]) diff --git a/misc/tools/kconfig-frontends/frontends/conf/conf.c b/misc/tools/kconfig-frontends/frontends/conf/conf.c index 0dc4a2c779..4da3b4adfa 100644 --- a/misc/tools/kconfig-frontends/frontends/conf/conf.c +++ b/misc/tools/kconfig-frontends/frontends/conf/conf.c @@ -32,7 +32,7 @@ enum input_mode { defconfig, savedefconfig, listnewconfig, - oldnoconfig, + olddefconfig, } input_mode = oldaskconfig; static int indent = 1; @@ -365,7 +365,7 @@ static void conf(struct menu *menu) case P_MENU: if ((input_mode == silentoldconfig || input_mode == listnewconfig || - input_mode == oldnoconfig) && + input_mode == olddefconfig) && rootEntry != menu) { check_conf(menu); return; @@ -429,7 +429,7 @@ static void check_conf(struct menu *menu) if (sym->name && !sym_is_choice_value(sym)) { printf("%s%s\n", CONFIG_, sym->name); } - } else if (input_mode != oldnoconfig) { + } else if (input_mode != olddefconfig) { if (!conf_cnt++) printf(_("*\n* Restart config...\n*\n")); rootEntry = menu_get_parent_menu(menu); @@ -454,7 +454,13 @@ static struct option long_opts[] = { {"alldefconfig", no_argument, NULL, alldefconfig}, {"randconfig", no_argument, NULL, randconfig}, {"listnewconfig", no_argument, NULL, listnewconfig}, - {"oldnoconfig", no_argument, NULL, oldnoconfig}, + {"olddefconfig", no_argument, NULL, olddefconfig}, + /* + * oldnoconfig is an alias of olddefconfig, because people already + * are dependent on its behavior(sets new symbols to their default + * value but not 'n') with the counter-intuitive name. + */ + {"oldnoconfig", no_argument, NULL, olddefconfig}, {NULL, 0, NULL, 0} }; @@ -467,7 +473,8 @@ static void conf_usage(const char *progname) printf(" --oldaskconfig Start a new configuration using a line-oriented program\n"); printf(" --oldconfig Update a configuration using a provided .config as base\n"); printf(" --silentoldconfig Same as oldconfig, but quietly, additionally update deps\n"); - printf(" --oldnoconfig Same as silentoldconfig but set new symbols to no\n"); + printf(" --olddefconfig Same as silentoldconfig but sets new symbols to their default value\n"); + printf(" --oldnoconfig An alias of olddefconfig\n"); printf(" --defconfig New config with default defined in \n"); printf(" --savedefconfig Save the minimal current configuration to \n"); printf(" --allnoconfig New config where all options are answered with no\n"); @@ -520,7 +527,7 @@ int main(int ac, char **av) case allmodconfig: case alldefconfig: case listnewconfig: - case oldnoconfig: + case olddefconfig: break; case '?': conf_usage(progname); @@ -565,7 +572,7 @@ int main(int ac, char **av) case oldaskconfig: case oldconfig: case listnewconfig: - case oldnoconfig: + case olddefconfig: conf_read(NULL); break; case allnoconfig: @@ -645,7 +652,7 @@ int main(int ac, char **av) /* fall through */ case oldconfig: case listnewconfig: - case oldnoconfig: + case olddefconfig: case silentoldconfig: /* Update until a loop caused no more changes */ do { @@ -653,7 +660,7 @@ int main(int ac, char **av) check_conf(&rootmenu); } while (conf_cnt && (input_mode != listnewconfig && - input_mode != oldnoconfig)); + input_mode != olddefconfig)); break; } diff --git a/misc/tools/kconfig-frontends/frontends/mconf/mconf.c b/misc/tools/kconfig-frontends/frontends/mconf/mconf.c index f584a281bb..53975cf876 100644 --- a/misc/tools/kconfig-frontends/frontends/mconf/mconf.c +++ b/misc/tools/kconfig-frontends/frontends/mconf/mconf.c @@ -236,16 +236,19 @@ search_help[] = N_( "Result:\n" "-----------------------------------------------------------------\n" "Symbol: FOO [=m]\n" + "Type : tristate\n" "Prompt: Foo bus is used to drive the bar HW\n" - "Defined at drivers/pci/Kconfig:47\n" - "Depends on: X86_LOCAL_APIC && X86_IO_APIC || IA64\n" - "Location:\n" - " -> Bus options (PCI, PCMCIA, EISA, ISA)\n" - " -> PCI support (PCI [=y])\n" - " -> PCI access mode ( [=y])\n" - "Selects: LIBCRC32\n" - "Selected by: BAR\n" + " Defined at drivers/pci/Kconfig:47\n" + " Depends on: X86_LOCAL_APIC && X86_IO_APIC || IA64\n" + " Location:\n" + " -> Bus options (PCI, PCMCIA, EISA, ISA)\n" + " -> PCI support (PCI [=y])\n" + "(1) -> PCI access mode ( [=y])\n" + " Selects: LIBCRC32\n" + " Selected by: BAR\n" "-----------------------------------------------------------------\n" + "o The line 'Type:' shows the type of the configuration option for\n" + " this symbol (boolean, tristate, string, ...)\n" "o The line 'Prompt:' shows the text used in the menu structure for\n" " this symbol\n" "o The 'Defined at' line tell at what file / line number the symbol\n" @@ -254,8 +257,12 @@ search_help[] = N_( " this symbol to be visible in the menu (selectable)\n" "o The 'Location:' lines tell where in the menu structure this symbol\n" " is located\n" - " A location followed by a [=y] indicate that this is a selectable\n" - " menu item - and current value is displayed inside brackets.\n" + " A location followed by a [=y] indicates that this is a\n" + " selectable menu item - and the current value is displayed inside\n" + " brackets.\n" + " Press the key in the (#) prefix to jump directly to that\n" + " location. You will be returned to the current search results\n" + " after exiting this new menu.\n" "o The 'Selects:' line tell what symbol will be automatically\n" " selected if this symbol is selected (y or m)\n" "o The 'Selected by' line tell what symbol has selected this symbol\n" @@ -273,13 +280,15 @@ static struct menu *current_menu; static int child_count; static int single_menu_mode; static int show_all_options; -static int saved_x, saved_y; -static void conf(struct menu *menu); +static void conf(struct menu *menu, struct menu *active_menu); static void conf_choice(struct menu *menu); static void conf_string(struct menu *menu); static void conf_load(void); static void conf_save(void); +static int show_textbox_ext(const char *title, char *text, int r, int c, + int *keys, int *vscroll, int *hscroll, + update_text_fn update_text, void *data); static void show_textbox(const char *title, const char *text, int r, int c); static void show_helptext(const char *title, const char *text); static void show_help(struct menu *menu); @@ -302,12 +311,47 @@ static void set_config_filename(const char *config_filename) } +struct search_data { + struct list_head *head; + struct menu **targets; + int *keys; +}; + +static void update_text(char *buf, size_t start, size_t end, void *_data) +{ + struct search_data *data = _data; + struct jump_key *pos; + int k = 0; + + list_for_each_entry(pos, data->head, entries) { + if (pos->offset >= start && pos->offset < end) { + char header[4]; + + if (k < JUMP_NB) { + int key = '0' + (pos->index % JUMP_NB) + 1; + + sprintf(header, "(%c)", key); + data->keys[k] = key; + data->targets[k] = pos->target; + k++; + } else { + sprintf(header, " "); + } + + memcpy(buf + pos->offset, header, sizeof(header) - 1); + } + } + data->keys[k] = 0; +} + static void search_conf(void) { struct symbol **sym_arr; struct gstr res; char *dialog_input; - int dres; + int dres, vscroll = 0, hscroll = 0; + bool again; + again: dialog_clear(); dres = dialog_inputbox(_("Search Configuration Parameter"), @@ -330,10 +374,30 @@ again: dialog_input += strlen(CONFIG_); sym_arr = sym_re_search(dialog_input); - res = get_relations_str(sym_arr); + do { + LIST_HEAD(head); + struct menu *targets[JUMP_NB]; + int keys[JUMP_NB + 1], i; + struct search_data data = { + .head = &head, + .targets = targets, + .keys = keys, + }; + + res = get_relations_str(sym_arr, &head); + dres = show_textbox_ext(_("Search Results"), (char *) + str_get(&res), 0, 0, keys, &vscroll, + &hscroll, &update_text, (void *) + &data); + again = false; + for (i = 0; i < JUMP_NB && keys[i]; i++) + if (dres == keys[i]) { + conf(targets[i]->parent, targets[i]); + again = true; + } + str_free(&res); + } while (again); free(sym_arr); - show_textbox(_("Search Results"), str_get(&res), 0, 0); - str_free(&res); } static void build_conf(struct menu *menu) @@ -514,12 +578,11 @@ conf_childs: indent -= doint; } -static void conf(struct menu *menu) +static void conf(struct menu *menu, struct menu *active_menu) { struct menu *submenu; const char *prompt = menu_get_prompt(menu); struct symbol *sym; - struct menu *active_menu = NULL; int res; int s_scroll = 0; @@ -562,13 +625,13 @@ static void conf(struct menu *menu) if (single_menu_mode) submenu->data = (void *) (long) !submenu->data; else - conf(submenu); + conf(submenu, NULL); break; case 't': if (sym_is_choice(sym) && sym_get_tristate_value(sym) == yes) conf_choice(submenu); else if (submenu->prompt->type == P_MENU) - conf(submenu); + conf(submenu, NULL); break; case 's': conf_string(submenu); @@ -607,7 +670,7 @@ static void conf(struct menu *menu) if (item_is_tag('t')) sym_toggle_tristate_value(sym); else if (item_is_tag('m')) - conf(submenu); + conf(submenu, NULL); break; case 7: search_conf(); @@ -619,10 +682,19 @@ static void conf(struct menu *menu) } } -static void show_textbox(const char *title, const char *text, int r, int c) +static int show_textbox_ext(const char *title, char *text, int r, int c, int + *keys, int *vscroll, int *hscroll, update_text_fn + update_text, void *data) { dialog_clear(); - dialog_textbox(title, text, r, c); + return dialog_textbox(title, text, r, c, keys, vscroll, hscroll, + update_text, data); +} + +static void show_textbox(const char *title, const char *text, int r, int c) +{ + show_textbox_ext(title, (char *) text, r, c, (int []) {0}, NULL, NULL, + NULL, NULL); } static void show_helptext(const char *title, const char *text) @@ -862,9 +934,6 @@ int main(int ac, char **av) single_menu_mode = 1; } - initscr(); - - getyx(stdscr, saved_y, saved_x); if (init_dialog(NULL)) { fprintf(stderr, N_("Your display is too small to run Menuconfig!\n")); fprintf(stderr, N_("It must be at least 19 lines by 80 columns.\n")); @@ -873,7 +942,7 @@ int main(int ac, char **av) set_config_filename(conf_get_configname()); do { - conf(&rootmenu); + conf(&rootmenu, NULL); res = handle_exit(); } while (res == KEY_ESC); diff --git a/misc/tools/kconfig-frontends/frontends/nconf/nconf.c b/misc/tools/kconfig-frontends/frontends/nconf/nconf.c index 1704a8562a..87d4b15da9 100644 --- a/misc/tools/kconfig-frontends/frontends/nconf/nconf.c +++ b/misc/tools/kconfig-frontends/frontends/nconf/nconf.c @@ -721,7 +721,7 @@ again: dialog_input += strlen(CONFIG_); sym_arr = sym_re_search(dialog_input); - res = get_relations_str(sym_arr); + res = get_relations_str(sym_arr, NULL); free(sym_arr); show_scroll_win(main_window, _("Search Results"), str_get(&res)); diff --git a/misc/tools/kconfig-frontends/libs/lxdialog/dialog.h b/misc/tools/kconfig-frontends/libs/lxdialog/dialog.h index b5211fce0d..ee17a5264d 100644 --- a/misc/tools/kconfig-frontends/libs/lxdialog/dialog.h +++ b/misc/tools/kconfig-frontends/libs/lxdialog/dialog.h @@ -144,6 +144,7 @@ struct dialog_info { */ extern struct dialog_info dlg; extern char dialog_input_result[]; +extern int saved_x, saved_y; /* Needed in signal handler in mconf.c */ /* * Function prototypes @@ -209,7 +210,13 @@ int first_alpha(const char *string, const char *exempt); int dialog_yesno(const char *title, const char *prompt, int height, int width); int dialog_msgbox(const char *title, const char *prompt, int height, int width, int pause); -int dialog_textbox(const char *title, const char *file, int height, int width); + + +typedef void (*update_text_fn)(char *buf, size_t start, size_t end, void + *_data); +int dialog_textbox(const char *title, char *tbuf, int initial_height, + int initial_width, int *keys, int *_vscroll, int *_hscroll, + update_text_fn update_text, void *data); int dialog_menu(const char *title, const char *prompt, const void *selected, int *s_scroll); int dialog_checklist(const char *title, const char *prompt, int height, diff --git a/misc/tools/kconfig-frontends/libs/lxdialog/textbox.c b/misc/tools/kconfig-frontends/libs/lxdialog/textbox.c index 4e5de60a0c..a48bb93e09 100644 --- a/misc/tools/kconfig-frontends/libs/lxdialog/textbox.c +++ b/misc/tools/kconfig-frontends/libs/lxdialog/textbox.c @@ -22,23 +22,25 @@ #include "dialog.h" static void back_lines(int n); -static void print_page(WINDOW * win, int height, int width); -static void print_line(WINDOW * win, int row, int width); +static void print_page(WINDOW *win, int height, int width, update_text_fn + update_text, void *data); +static void print_line(WINDOW *win, int row, int width); static char *get_line(void); static void print_position(WINDOW * win); static int hscroll; static int begin_reached, end_reached, page_length; -static const char *buf; -static const char *page; +static char *buf; +static char *page; /* * refresh window content */ static void refresh_text_box(WINDOW *dialog, WINDOW *box, int boxh, int boxw, - int cur_y, int cur_x) + int cur_y, int cur_x, update_text_fn update_text, + void *data) { - print_page(box, boxh, boxw); + print_page(box, boxh, boxw, update_text, data); print_position(dialog); wmove(dialog, cur_y, cur_x); /* Restore cursor position */ wrefresh(dialog); @@ -47,14 +49,18 @@ static void refresh_text_box(WINDOW *dialog, WINDOW *box, int boxh, int boxw, /* * Display text from a file in a dialog box. + * + * keys is a null-terminated array + * update_text() may not add or remove any '\n' or '\0' in tbuf */ -int dialog_textbox(const char *title, const char *tbuf, - int initial_height, int initial_width) +int dialog_textbox(const char *title, char *tbuf, int initial_height, + int initial_width, int *keys, int *_vscroll, int *_hscroll, + update_text_fn update_text, void *data) { int i, x, y, cur_x, cur_y, key = 0; int height, width, boxh, boxw; - int passed_end; WINDOW *dialog, *box; + bool done = false; begin_reached = 1; end_reached = 0; @@ -63,6 +69,15 @@ int dialog_textbox(const char *title, const char *tbuf, buf = tbuf; page = buf; /* page is pointer to start of page to be displayed */ + if (_vscroll && *_vscroll) { + begin_reached = 0; + + for (i = 0; i < *_vscroll; i++) + get_line(); + } + if (_hscroll) + hscroll = *_hscroll; + do_resize: getmaxyx(stdscr, height, width); if (height < 8 || width < 8) @@ -120,9 +135,10 @@ do_resize: /* Print first page of text */ attr_clear(box, boxh, boxw, dlg.dialog.atr); - refresh_text_box(dialog, box, boxh, boxw, cur_y, cur_x); + refresh_text_box(dialog, box, boxh, boxw, cur_y, cur_x, update_text, + data); - while ((key != KEY_ESC) && (key != '\n')) { + while (!done) { key = wgetch(dialog); switch (key) { case 'E': /* Exit */ @@ -130,16 +146,17 @@ do_resize: case 'X': case 'x': case 'q': - delwin(box); - delwin(dialog); - return 0; + case '\n': + done = true; + break; case 'g': /* First page */ case KEY_HOME: if (!begin_reached) { begin_reached = 1; page = buf; refresh_text_box(dialog, box, boxh, boxw, - cur_y, cur_x); + cur_y, cur_x, update_text, + data); } break; case 'G': /* Last page */ @@ -149,45 +166,18 @@ do_resize: /* point to last char in buf */ page = buf + strlen(buf); back_lines(boxh); - refresh_text_box(dialog, box, boxh, boxw, - cur_y, cur_x); + refresh_text_box(dialog, box, boxh, boxw, cur_y, + cur_x, update_text, data); break; case 'K': /* Previous line */ case 'k': case KEY_UP: - if (!begin_reached) { - back_lines(page_length + 1); + if (begin_reached) + break; - /* We don't call print_page() here but use - * scrolling to ensure faster screen update. - * However, 'end_reached' and 'page_length' - * should still be updated, and 'page' should - * point to start of next page. This is done - * by calling get_line() in the following - * 'for' loop. */ - scrollok(box, TRUE); - wscrl(box, -1); /* Scroll box region down one line */ - scrollok(box, FALSE); - page_length = 0; - passed_end = 0; - for (i = 0; i < boxh; i++) { - if (!i) { - /* print first line of page */ - print_line(box, 0, boxw); - wnoutrefresh(box); - } else - /* Called to update 'end_reached' and 'page' */ - get_line(); - if (!passed_end) - page_length++; - if (end_reached && !passed_end) - passed_end = 1; - } - - print_position(dialog); - wmove(dialog, cur_y, cur_x); /* Restore cursor position */ - wrefresh(dialog); - } + back_lines(page_length + 1); + refresh_text_box(dialog, box, boxh, boxw, cur_y, + cur_x, update_text, data); break; case 'B': /* Previous page */ case 'b': @@ -196,23 +186,18 @@ do_resize: if (begin_reached) break; back_lines(page_length + boxh); - refresh_text_box(dialog, box, boxh, boxw, - cur_y, cur_x); + refresh_text_box(dialog, box, boxh, boxw, cur_y, + cur_x, update_text, data); break; case 'J': /* Next line */ case 'j': case KEY_DOWN: - if (!end_reached) { - begin_reached = 0; - scrollok(box, TRUE); - scroll(box); /* Scroll box region up one line */ - scrollok(box, FALSE); - print_line(box, boxh - 1, boxw); - wnoutrefresh(box); - print_position(dialog); - wmove(dialog, cur_y, cur_x); /* Restore cursor position */ - wrefresh(dialog); - } + if (end_reached) + break; + + back_lines(page_length - 1); + refresh_text_box(dialog, box, boxh, boxw, cur_y, + cur_x, update_text, data); break; case KEY_NPAGE: /* Next page */ case ' ': @@ -221,8 +206,8 @@ do_resize: break; begin_reached = 0; - refresh_text_box(dialog, box, boxh, boxw, - cur_y, cur_x); + refresh_text_box(dialog, box, boxh, boxw, cur_y, + cur_x, update_text, data); break; case '0': /* Beginning of line */ case 'H': /* Scroll left */ @@ -237,8 +222,8 @@ do_resize: hscroll--; /* Reprint current page to scroll horizontally */ back_lines(page_length); - refresh_text_box(dialog, box, boxh, boxw, - cur_y, cur_x); + refresh_text_box(dialog, box, boxh, boxw, cur_y, + cur_x, update_text, data); break; case 'L': /* Scroll right */ case 'l': @@ -248,11 +233,12 @@ do_resize: hscroll++; /* Reprint current page to scroll horizontally */ back_lines(page_length); - refresh_text_box(dialog, box, boxh, boxw, - cur_y, cur_x); + refresh_text_box(dialog, box, boxh, boxw, cur_y, + cur_x, update_text, data); break; case KEY_ESC: - key = on_key_esc(dialog); + if (on_key_esc(dialog) == KEY_ESC) + done = true; break; case KEY_RESIZE: back_lines(height); @@ -260,11 +246,31 @@ do_resize: delwin(dialog); on_key_resize(); goto do_resize; + default: + for (i = 0; keys[i]; i++) { + if (key == keys[i]) { + done = true; + break; + } + } } } delwin(box); delwin(dialog); - return key; /* ESC pressed */ + if (_vscroll) { + const char *s; + + s = buf; + *_vscroll = 0; + back_lines(page_length); + while (s < page && (s = strchr(s, '\n'))) { + (*_vscroll)++; + s++; + } + } + if (_hscroll) + *_hscroll = hscroll; + return key; } /* @@ -301,12 +307,23 @@ static void back_lines(int n) } /* - * Print a new page of text. Called by dialog_textbox(). + * Print a new page of text. */ -static void print_page(WINDOW * win, int height, int width) +static void print_page(WINDOW *win, int height, int width, update_text_fn + update_text, void *data) { int i, passed_end = 0; + if (update_text) { + char *end; + + for (i = 0; i < height; i++) + get_line(); + end = page; + back_lines(height); + update_text(buf, page - buf, end - buf, data); + } + page_length = 0; for (i = 0; i < height; i++) { print_line(win, i, width); @@ -319,7 +336,7 @@ static void print_page(WINDOW * win, int height, int width) } /* - * Print a new line of text. Called by dialog_textbox() and print_page(). + * Print a new line of text. */ static void print_line(WINDOW * win, int row, int width) { @@ -357,10 +374,8 @@ static char *get_line(void) end_reached = 0; while (*page != '\n') { if (*page == '\0') { - if (!end_reached) { - end_reached = 1; - break; - } + end_reached = 1; + break; } else if (i < MAX_LEN) line[i++] = *(page++); else { @@ -373,7 +388,7 @@ static char *get_line(void) if (i <= MAX_LEN) line[i] = '\0'; if (!end_reached) - page++; /* move pass '\n' */ + page++; /* move past '\n' */ return line; } diff --git a/misc/tools/kconfig-frontends/libs/lxdialog/util.c b/misc/tools/kconfig-frontends/libs/lxdialog/util.c index f2375ad7eb..109d53117d 100644 --- a/misc/tools/kconfig-frontends/libs/lxdialog/util.c +++ b/misc/tools/kconfig-frontends/libs/lxdialog/util.c @@ -23,6 +23,9 @@ #include "dialog.h" +/* Needed in signal handler in mconf.c */ +int saved_x, saved_y; + struct dialog_info dlg; static void set_mono_theme(void) @@ -273,6 +276,10 @@ int init_dialog(const char *backtitle) int height, width; initscr(); /* Init curses */ + + /* Get current cursor position for signal handler in mconf.c */ + getyx(stdscr, saved_y, saved_x); + getmaxyx(stdscr, height, width); if (height < 19 || width < 80) { endwin(); diff --git a/misc/tools/kconfig-frontends/libs/parser/Makefile.am b/misc/tools/kconfig-frontends/libs/parser/Makefile.am index ad6e5aa8b6..567b1e888f 100644 --- a/misc/tools/kconfig-frontends/libs/parser/Makefile.am +++ b/misc/tools/kconfig-frontends/libs/parser/Makefile.am @@ -14,7 +14,7 @@ libkconfig_parser_la_LDFLAGS = -release $(KCONFIGPARSER_LIB_VERSION) -no-undefin libkconfig_parser_la_LIBADD = $(intl_LIBS) kconfig_includedir = $(includedir)/kconfig -kconfig_include_HEADERS = lkc.h expr.h lkc_proto.h +kconfig_include_HEADERS = list.h lkc.h expr.h lkc_proto.h BUILT_SOURCES = hconf.c lconf.c CLEANFILES = hconf.c lconf.c yconf.c diff --git a/misc/tools/kconfig-frontends/libs/parser/Makefile.in b/misc/tools/kconfig-frontends/libs/parser/Makefile.in index 97793927c3..7fa4e8507b 100644 --- a/misc/tools/kconfig-frontends/libs/parser/Makefile.in +++ b/misc/tools/kconfig-frontends/libs/parser/Makefile.in @@ -304,7 +304,7 @@ libkconfig_parser_la_CFLAGS = $(AM_CFLAGS) $(kf_CFLAGS) libkconfig_parser_la_LDFLAGS = -release $(KCONFIGPARSER_LIB_VERSION) -no-undefined libkconfig_parser_la_LIBADD = $(intl_LIBS) kconfig_includedir = $(includedir)/kconfig -kconfig_include_HEADERS = lkc.h expr.h lkc_proto.h +kconfig_include_HEADERS = list.h lkc.h expr.h lkc_proto.h BUILT_SOURCES = hconf.c lconf.c CLEANFILES = hconf.c lconf.c yconf.c EXTRA_DIST = yconf.y.patch diff --git a/misc/tools/kconfig-frontends/libs/parser/expr.h b/misc/tools/kconfig-frontends/libs/parser/expr.h index d4ecce8bc3..cdd48600e0 100644 --- a/misc/tools/kconfig-frontends/libs/parser/expr.h +++ b/misc/tools/kconfig-frontends/libs/parser/expr.h @@ -12,6 +12,7 @@ extern "C" { #include #include +#include "list.h" #ifndef __cplusplus #include #endif @@ -173,6 +174,15 @@ struct menu { #define MENU_CHANGED 0x0001 #define MENU_ROOT 0x0002 +struct jump_key { + struct list_head entries; + size_t offset; + struct menu *target; + int index; +}; + +#define JUMP_NB 9 + extern struct file *file_list; extern struct file *current_file; struct file *lookup_file(const char *name); diff --git a/misc/tools/kconfig-frontends/libs/parser/list.h b/misc/tools/kconfig-frontends/libs/parser/list.h new file mode 100644 index 0000000000..0ae730be5f --- /dev/null +++ b/misc/tools/kconfig-frontends/libs/parser/list.h @@ -0,0 +1,91 @@ +#ifndef LIST_H +#define LIST_H + +/* + * Copied from include/linux/... + */ + +#undef offsetof +#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER) + +/** + * container_of - cast a member of a structure out to the containing structure + * @ptr: the pointer to the member. + * @type: the type of the container struct this is embedded in. + * @member: the name of the member within the struct. + * + */ +#define container_of(ptr, type, member) ({ \ + const typeof( ((type *)0)->member ) *__mptr = (ptr); \ + (type *)( (char *)__mptr - offsetof(type,member) );}) + + +struct list_head { + struct list_head *next, *prev; +}; + + +#define LIST_HEAD_INIT(name) { &(name), &(name) } + +#define LIST_HEAD(name) \ + struct list_head name = LIST_HEAD_INIT(name) + +/** + * list_entry - get the struct for this entry + * @ptr: the &struct list_head pointer. + * @type: the type of the struct this is embedded in. + * @member: the name of the list_struct within the struct. + */ +#define list_entry(ptr, type, member) \ + container_of(ptr, type, member) + +/** + * list_for_each_entry - iterate over list of given type + * @pos: the type * to use as a loop cursor. + * @head: the head for your list. + * @member: the name of the list_struct within the struct. + */ +#define list_for_each_entry(pos, head, member) \ + for (pos = list_entry((head)->next, typeof(*pos), member); \ + &pos->member != (head); \ + pos = list_entry(pos->member.next, typeof(*pos), member)) + +/** + * list_empty - tests whether a list is empty + * @head: the list to test. + */ +static inline int list_empty(const struct list_head *head) +{ + return head->next == head; +} + +/* + * Insert a new entry between two known consecutive entries. + * + * This is only for internal list manipulation where we know + * the prev/next entries already! + */ +static inline void __list_add(struct list_head *_new, + struct list_head *prev, + struct list_head *next) +{ + next->prev = _new; + _new->next = next; + _new->prev = prev; + prev->next = _new; +} + +/** + * list_add_tail - add a new entry + * @new: new entry to be added + * @head: list head to add it before + * + * Insert a new entry before the specified head. + * This is useful for implementing queues. + */ +static inline void list_add_tail(struct list_head *_new, struct list_head *head) +{ + __list_add(_new, head->prev, head); +} + +#endif diff --git a/misc/tools/kconfig-frontends/libs/parser/lkc_proto.h b/misc/tools/kconfig-frontends/libs/parser/lkc_proto.h index 47fe9c340f..ef1a7381f9 100644 --- a/misc/tools/kconfig-frontends/libs/parser/lkc_proto.h +++ b/misc/tools/kconfig-frontends/libs/parser/lkc_proto.h @@ -21,8 +21,10 @@ P(menu_get_root_menu,struct menu *,(struct menu *menu)); P(menu_get_parent_menu,struct menu *,(struct menu *menu)); P(menu_has_help,bool,(struct menu *menu)); P(menu_get_help,const char *,(struct menu *menu)); -P(get_symbol_str, void, (struct gstr *r, struct symbol *sym)); -P(get_relations_str, struct gstr, (struct symbol **sym_arr)); +P(get_symbol_str, void, (struct gstr *r, struct symbol *sym, struct list_head + *head)); +P(get_relations_str, struct gstr, (struct symbol **sym_arr, struct list_head + *head)); P(menu_get_ext_help,void,(struct menu *menu, struct gstr *help)); /* symbol.c */ diff --git a/misc/tools/kconfig-frontends/libs/parser/menu.c b/misc/tools/kconfig-frontends/libs/parser/menu.c index 8c2a97e60f..e98a05c8e5 100644 --- a/misc/tools/kconfig-frontends/libs/parser/menu.c +++ b/misc/tools/kconfig-frontends/libs/parser/menu.c @@ -507,10 +507,12 @@ const char *menu_get_help(struct menu *menu) return ""; } -static void get_prompt_str(struct gstr *r, struct property *prop) +static void get_prompt_str(struct gstr *r, struct property *prop, + struct list_head *head) { int i, j; - struct menu *submenu[8], *menu; + struct menu *submenu[8], *menu, *location = NULL; + struct jump_key *jump; str_printf(r, _("Prompt: %s\n"), _(prop->text)); str_printf(r, _(" Defined at %s:%d\n"), prop->menu->file->name, @@ -521,13 +523,44 @@ static void get_prompt_str(struct gstr *r, struct property *prop) str_append(r, "\n"); } menu = prop->menu->parent; - for (i = 0; menu != &rootmenu && i < 8; menu = menu->parent) + for (i = 0; menu != &rootmenu && i < 8; menu = menu->parent) { + bool accessible = menu_is_visible(menu); + submenu[i++] = menu; + if (location == NULL && accessible) + location = menu; + } + if (head && location) { + jump = malloc(sizeof(struct jump_key)); + + if (menu_is_visible(prop->menu)) { + /* + * There is not enough room to put the hint at the + * beginning of the "Prompt" line. Put the hint on the + * last "Location" line even when it would belong on + * the former. + */ + jump->target = prop->menu; + } else + jump->target = location; + + if (list_empty(head)) + jump->index = 0; + else + jump->index = list_entry(head->prev, struct jump_key, + entries)->index + 1; + + list_add_tail(&jump->entries, head); + } + if (i > 0) { str_printf(r, _(" Location:\n")); for (j = 4; --i >= 0; j += 2) { menu = submenu[i]; - str_printf(r, "%*c-> %s", j, ' ', _(menu_get_prompt(menu))); + if (head && location && menu == location) + jump->offset = r->len - 1; + str_printf(r, "%*c-> %s", j, ' ', + _(menu_get_prompt(menu))); if (menu->sym) { str_printf(r, " (%s [=%s])", menu->sym->name ? menu->sym->name : _(""), @@ -538,7 +571,11 @@ static void get_prompt_str(struct gstr *r, struct property *prop) } } -void get_symbol_str(struct gstr *r, struct symbol *sym) +/* + * head is optional and may be NULL + */ +void get_symbol_str(struct gstr *r, struct symbol *sym, + struct list_head *head) { bool hit; struct property *prop; @@ -557,7 +594,7 @@ void get_symbol_str(struct gstr *r, struct symbol *sym) } } for_all_prompts(sym, prop) - get_prompt_str(r, prop); + get_prompt_str(r, prop, head); hit = false; for_all_properties(sym, prop, P_SELECT) { if (!hit) { @@ -577,14 +614,14 @@ void get_symbol_str(struct gstr *r, struct symbol *sym) str_append(r, "\n\n"); } -struct gstr get_relations_str(struct symbol **sym_arr) +struct gstr get_relations_str(struct symbol **sym_arr, struct list_head *head) { struct symbol *sym; struct gstr res = str_new(); int i; for (i = 0; sym_arr && (sym = sym_arr[i]); i++) - get_symbol_str(&res, sym); + get_symbol_str(&res, sym, head); if (!i) str_append(&res, _("No matches found.\n")); return res; @@ -603,5 +640,5 @@ void menu_get_ext_help(struct menu *menu, struct gstr *help) } str_printf(help, "%s\n", _(help_text)); if (sym) - get_symbol_str(help, sym); + get_symbol_str(help, sym, NULL); } diff --git a/misc/tools/kconfig-frontends/scripts/ksync.list b/misc/tools/kconfig-frontends/scripts/ksync.list index 9766b7a050..aa8b9b6fa8 100644 --- a/misc/tools/kconfig-frontends/scripts/ksync.list +++ b/misc/tools/kconfig-frontends/scripts/ksync.list @@ -21,6 +21,7 @@ scripts/kconfig/expr.c --> libs/parser/expr.c scripts/kconfig/expr.h --> libs/parser/expr.h scripts/kconfig/zconf.gperf --> libs/parser/hconf.gperf scripts/kconfig/zconf.l --> libs/parser/lconf.l +scripts/kconfig/list.h --> libs/parser/list.h scripts/kconfig/lkc.h --> libs/parser/lkc.h scripts/kconfig/lkc_proto.h --> libs/parser/lkc_proto.h scripts/kconfig/menu.c --> libs/parser/menu.c diff --git a/misc/tools/kconfig-frontends/scripts/version.sh b/misc/tools/kconfig-frontends/scripts/version.sh index 57f699c6a5..b3d0c6ebea 100755 --- a/misc/tools/kconfig-frontends/scripts/version.sh +++ b/misc/tools/kconfig-frontends/scripts/version.sh @@ -38,6 +38,6 @@ esac if [ "${plain}" -eq 1 ]; then echo "${k_ver_plain}" else - echo "${k_ver}${k_ver_extra}-${kf_ver}" + echo "${k_ver}${k_ver_extra}.${kf_ver}" fi From a4a2b830b9958cd5aff6fc13bed75f001ae79ddb Mon Sep 17 00:00:00 2001 From: patacongo Date: Sun, 6 Jan 2013 19:33:10 +0000 Subject: [PATCH 038/118] Missed a file in the kconfig-frontends 3.7.0 update git-svn-id: http://svn.code.sf.net/p/nuttx/code/trunk@5485 42af7a65-404d-4744-a932-0658087f49c3 --- misc/tools/kconfig-frontends/.version | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/misc/tools/kconfig-frontends/.version b/misc/tools/kconfig-frontends/.version index a512a0944e..585c66f03b 100644 --- a/misc/tools/kconfig-frontends/.version +++ b/misc/tools/kconfig-frontends/.version @@ -1,2 +1,2 @@ -3.6.0 a0d271cbfed1dd50278c6b06bead3d00ba0a88f9 Terrified Chipmunk +3.7.0 29594404d7fe73cd80eaa4ee8c43dcc53970c60e Terrified Chipmunk 0 From 876062fe3a2b6273855b77c0ed1c9d0cbcfc43c6 Mon Sep 17 00:00:00 2001 From: patacongo Date: Mon, 7 Jan 2013 15:20:21 +0000 Subject: [PATCH 039/118] Implement a simple vfork(). ARM only for now git-svn-id: http://svn.code.sf.net/p/nuttx/code/trunk@5486 42af7a65-404d-4744-a932-0658087f49c3 --- nuttx/ChangeLog | 3 +- nuttx/arch/arm/src/arm/up_vfork.S | 92 ++++++++++++++++++ nuttx/arch/arm/src/armv7-m/up_vfork.S | 96 ++++++++++++++++++ nuttx/arch/arm/src/c5471/Make.defs | 6 +- nuttx/arch/arm/src/calypso/Make.defs | 6 +- nuttx/arch/arm/src/common/up__vfork.c | 134 ++++++++++++++++++++++++++ nuttx/arch/arm/src/dm320/Make.defs | 6 +- nuttx/arch/arm/src/imx/Make.defs | 6 +- nuttx/arch/arm/src/kinetis/Make.defs | 8 +- nuttx/arch/arm/src/lm3s/Make.defs | 8 +- nuttx/arch/arm/src/lpc17xx/Make.defs | 7 +- nuttx/arch/arm/src/lpc214x/Make.defs | 7 +- nuttx/arch/arm/src/lpc2378/Make.defs | 15 +-- nuttx/arch/arm/src/lpc31xx/Make.defs | 4 +- nuttx/arch/arm/src/lpc43xx/Make.defs | 10 +- nuttx/arch/arm/src/sam3u/Make.defs | 7 +- nuttx/arch/arm/src/stm32/Make.defs | 8 +- nuttx/arch/arm/src/str71x/Make.defs | 15 +-- nuttx/include/unistd.h | 3 +- 19 files changed, 389 insertions(+), 52 deletions(-) create mode 100644 nuttx/arch/arm/src/arm/up_vfork.S create mode 100644 nuttx/arch/arm/src/armv7-m/up_vfork.S create mode 100644 nuttx/arch/arm/src/common/up__vfork.c diff --git a/nuttx/ChangeLog b/nuttx/ChangeLog index f4f6975637..e2d8a586b3 100644 --- a/nuttx/ChangeLog +++ b/nuttx/ChangeLog @@ -3878,5 +3878,6 @@ * sched/os_bringup.c: Remove support for CONFIG_BUILTIN_APP_START. This is not really a useful feature and creates a violation of the OS layered architecture. - + * include/unistd.h, arch/arch/src/*: Implement a simple vfork(). + On initial checkin, this API is available only for ARM platforms. diff --git a/nuttx/arch/arm/src/arm/up_vfork.S b/nuttx/arch/arm/src/arm/up_vfork.S new file mode 100644 index 0000000000..23e975c304 --- /dev/null +++ b/nuttx/arch/arm/src/arm/up_vfork.S @@ -0,0 +1,92 @@ +/************************************************************************************ + * arch/arm/src/arm/up_vfork.S + * + * Copyright (C) 2013 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * 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. + * + ************************************************************************************/ + +/************************************************************************************ + * Included Files + ************************************************************************************/ + +#include + +/************************************************************************************ + * Pre-processor Definitions + ************************************************************************************/ + +/************************************************************************************ + * Global Symbols + ************************************************************************************/ + + .file "up_vfork.S" + .globl __vfork + +/************************************************************************************ + * Public Functions + ************************************************************************************/ + +/************************************************************************************ + * Name: vfork + * + * Description: + * The vfork() function has the same effect as fork(), except that the behavior is + * undefined if the process created by vfork() either modifies any data other than + * a variable of type pid_t used to store the return value from vfork(), or returns + * from the function in which vfork() was called, or calls any other function before + * successfully calling _exit() or one of the exec family of functions. + * + * This thin layer implements vfork by simply calling __vfork() with the vfork() + * return address as an argument. + * + * Input Paremeters: + * None + * + * Return: + * Upon successful completion, vfork() returns 0 to the child process and returns + * the process ID of the child process to the parent process. Otherwise, -1 is + * returned to the parent, no child process is created, and errno is set to + * indicate the error. + * + ************************************************************************************/ + + .globl vfork + .type vfork, function +vfork: + + /* I know, I could have used the GCC's return address builtin and done this all + * in C. But this works even if there is no builtin. + */ + + mov r0, lr + b __vfork + .size vfork, .-vfork + .end diff --git a/nuttx/arch/arm/src/armv7-m/up_vfork.S b/nuttx/arch/arm/src/armv7-m/up_vfork.S new file mode 100644 index 0000000000..65ccc45353 --- /dev/null +++ b/nuttx/arch/arm/src/armv7-m/up_vfork.S @@ -0,0 +1,96 @@ +/************************************************************************************ + * arch/arm/src/armv7-m/up_vfork.S + * + * Copyright (C) 2013 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * 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. + * + ************************************************************************************/ + +/************************************************************************************ + * Included Files + ************************************************************************************/ + +#include + +/************************************************************************************ + * Pre-processor Definitions + ************************************************************************************/ + +/************************************************************************************ + * Global Symbols + ************************************************************************************/ + + .syntax unified + .thumb + .file "up_vfork.S" + .globl __vfork + +/************************************************************************************ + * Public Functions + ************************************************************************************/ + +/************************************************************************************ + * Name: vfork + * + * Description: + * The vfork() function has the same effect as fork(), except that the behavior is + * undefined if the process created by vfork() either modifies any data other than + * a variable of type pid_t used to store the return value from vfork(), or returns + * from the function in which vfork() was called, or calls any other function before + * successfully calling _exit() or one of the exec family of functions. + * + * This thin layer implements vfork by simply calling __vfork() with the vfork() + * return address as an argument. + * + * Input Paremeters: + * None + * + * Return: + * Upon successful completion, vfork() returns 0 to the child process and returns + * the process ID of the child process to the parent process. Otherwise, -1 is + * returned to the parent, no child process is created, and errno is set to + * indicate the error. + * + ************************************************************************************/ + + .thumb_func + .globl vfork + .type vfork, function +vfork: + + /* I know, I could have used the GCC's return address builtin and done this all + * in C. But this works even if there is no builtin. + */ + + mov r0, lr + b __vfork + .size vfork, .-vfork + .end + diff --git a/nuttx/arch/arm/src/c5471/Make.defs b/nuttx/arch/arm/src/c5471/Make.defs index 2bc396fd36..89c3aaf0be 100644 --- a/nuttx/arch/arm/src/c5471/Make.defs +++ b/nuttx/arch/arm/src/c5471/Make.defs @@ -1,7 +1,7 @@ ############################################################################ # c5471/Make.defs # -# Copyright (C) 2007 Gregory Nutt. All rights reserved. +# Copyright (C) 2007, 2013 Gregory Nutt. All rights reserved. # Author: Gregory Nutt # # Redistribution and use in source and binary forms, with or without @@ -35,14 +35,14 @@ HEAD_ASRC = up_nommuhead.S -CMN_ASRCS = up_saveusercontext.S up_fullcontextrestore.S +CMN_ASRCS = up_saveusercontext.S up_fullcontextrestore.S up_vfork.S CMN_CSRCS = up_allocateheap.c up_assert.c up_blocktask.c up_copystate.c \ up_createstack.c up_dataabort.c up_mdelay.c up_udelay.c up_doirq.c \ up_exit.c up_idle.c up_initialize.c up_initialstate.c \ up_interruptcontext.c up_prefetchabort.c up_releasepending.c \ up_releasestack.c up_reprioritizertr.c up_schedulesigaction.c \ up_sigdeliver.c up_syscall.c up_unblocktask.c \ - up_undefinedinsn.c up_usestack.c + up_undefinedinsn.c up_usestack.c up__vfork.c ifeq ($(CONFIG_ELF),y) CMN_CSRCS += up_elf.c diff --git a/nuttx/arch/arm/src/calypso/Make.defs b/nuttx/arch/arm/src/calypso/Make.defs index 4b53c3b7cb..957d4e6773 100644 --- a/nuttx/arch/arm/src/calypso/Make.defs +++ b/nuttx/arch/arm/src/calypso/Make.defs @@ -1,7 +1,7 @@ ############################################################################ # calypso/Make.defs # -# Copyright (C) 2007 Gregory Nutt. All rights reserved. +# Copyright (C) 2007, 2013 Gregory Nutt. All rights reserved. # Author: Gregory Nutt # # Copyright (C) 2011 Stefan Richter. All rights reserved. @@ -39,14 +39,14 @@ HEAD_ASRC = calypso_head.S CMN_ASRCS = up_saveusercontext.S up_fullcontextrestore.S up_vectors.S \ - up_nommuhead.S + up_nommuhead.S up_vfork.S CMN_CSRCS = up_allocateheap.c up_assert.c up_blocktask.c up_copystate.c \ up_createstack.c up_dataabort.c up_mdelay.c up_udelay.c up_doirq.c \ up_exit.c up_idle.c up_initialstate.c up_initialize.c \ up_interruptcontext.c up_prefetchabort.c up_releasepending.c \ up_releasestack.c up_reprioritizertr.c up_schedulesigaction.c \ up_sigdeliver.c up_syscall.c up_unblocktask.c \ - up_undefinedinsn.c up_usestack.c calypso_power.c + up_undefinedinsn.c up_usestack.c calypso_power.c up__vfork.c ifeq ($(CONFIG_ELF),y) CMN_CSRCS += up_elf.c diff --git a/nuttx/arch/arm/src/common/up__vfork.c b/nuttx/arch/arm/src/common/up__vfork.c new file mode 100644 index 0000000000..a1081faa88 --- /dev/null +++ b/nuttx/arch/arm/src/common/up__vfork.c @@ -0,0 +1,134 @@ +/**************************************************************************** + * arch/arm/src/common/up__vfork + * + * Copyright (C) 2013 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * 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. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include + +#include + +#include "os_internal.h" + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +/* ARM requires at least a 4-byte stack alignment. For use with EABI and + * floating point, the stack must be aligned to 8-byte addresses. + */ + +#ifndef CONFIG_STACK_ALIGNMENT + +/* The symbol __ARM_EABI__ is defined by GCC if EABI is being used. If you + * are not using GCC, make sure that CONFIG_STACK_ALIGNMENT is set correctly! + */ + +# ifdef __ARM_EABI__ +# define CONFIG_STACK_ALIGNMENT 8 +# else +# define CONFIG_STACK_ALIGNMENT 4 +# endif +#endif + +/**************************************************************************** + * Private Functions + ****************************************************************************/ + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: __vfork + * + * Description: + * The vfork() function has the same effect as fork(), except that the + * behavior is undefined if the process created by vfork() either modifies + * any data other than a variable of type pid_t used to store the return + * value from vfork(), or returns from the function in which vfork() was + * called, or calls any other function before successfully calling _exit() + * or one of the exec family of functions. + * + * This thin layer starts the vfork child by simply spawning a new thread + * that begins at the return address of vfork(). + * + * Input Paremeters: + * retaddr - The return address of vfork() + * + * Return: + * Upon successful completion, vfork() returns 0 to the child process and + * returns the process ID of the child process to the parent process. + * Otherwise, -1 is returned to the parent, no child process is created, + * and errno is set to indicate the error. + * + ****************************************************************************/ + +pid_t __vfork(uint32_t retaddr) +{ + FAR _TCB *parent = (FAR _TCB *)g_readytorun.head; + size_t stacksize; + int priority; + + /* Get the size of the parent task's stack. Due to alignment operations, + * the adjusted stack size may be smaller than the stack size originally + * requrested. + */ + + stacksize = parent->adj_stack_size + CONFIG_STACK_ALIGNMENT - 1; + + /* Get the current priority of the parent task */ + +#ifdef CONFIG_PRIORITY_INHERITANCE + priority = parent->base_priority; /* "Normal," unboosted priority */ +#else + priority = parent->sched_priority; /* Current priority */ +#endif + + /* Start the child thread at the vfork return address. TASK_CREATE will + * return the PID of the new thread. Otherwise a negative value will be + * returned and the errno will be set appropriately. + * + * When the registers are initialized, the return value in R0 should be + * cleared to zero, providing the indication to the newly started child + * thread. + */ + + return TASK_CREATE("init", priority, stacksize, (main_t)retaddr, + (const char **)NULL); +} diff --git a/nuttx/arch/arm/src/dm320/Make.defs b/nuttx/arch/arm/src/dm320/Make.defs index 9087708ef5..52e65c0e89 100644 --- a/nuttx/arch/arm/src/dm320/Make.defs +++ b/nuttx/arch/arm/src/dm320/Make.defs @@ -1,7 +1,7 @@ ############################################################################ # dm320/Make.defs # -# Copyright (C) 2007, 2010 Gregory Nutt. All rights reserved. +# Copyright (C) 2007, 2010, 2013 Gregory Nutt. All rights reserved. # Author: Gregory Nutt # # Redistribution and use in source and binary forms, with or without @@ -36,14 +36,14 @@ HEAD_ASRC = up_head.S CMN_ASRCS = up_cache.S up_fullcontextrestore.S up_saveusercontext.S \ - up_vectors.S up_vectoraddrexcptn.S up_vectortab.S + up_vectors.S up_vectoraddrexcptn.S up_vectortab.S up_vfork.S CMN_CSRCS = up_assert.c up_blocktask.c up_copystate.c up_createstack.c \ up_dataabort.c up_mdelay.c up_udelay.c up_exit.c up_idle.c \ up_initialize.c up_initialstate.c up_interruptcontext.c \ up_prefetchabort.c up_releasepending.c up_releasestack.c \ up_reprioritizertr.c up_schedulesigaction.c \ up_sigdeliver.c up_syscall.c up_unblocktask.c \ - up_undefinedinsn.c up_usestack.c + up_undefinedinsn.c up_usestack.c up__vfork.c ifeq ($(CONFIG_ELF),y) CMN_CSRCS += up_elf.c diff --git a/nuttx/arch/arm/src/imx/Make.defs b/nuttx/arch/arm/src/imx/Make.defs index a1c2e72e6b..a7c0ceebd2 100644 --- a/nuttx/arch/arm/src/imx/Make.defs +++ b/nuttx/arch/arm/src/imx/Make.defs @@ -1,7 +1,7 @@ ############################################################################ # arch/arm/src/imx/Make.defs # -# Copyright (C) 2009 Gregory Nutt. All rights reserved. +# Copyright (C) 2009, 2013 Gregory Nutt. All rights reserved. # Author: Gregory Nutt # # Redistribution and use in source and binary forms, with or without @@ -36,14 +36,14 @@ HEAD_ASRC = up_head.S CMN_ASRCS = up_cache.S up_fullcontextrestore.S up_saveusercontext.S \ - up_vectors.S up_vectoraddrexcptn.S up_vectortab.S + up_vectors.S up_vectoraddrexcptn.S up_vectortab.S up_vfork.S CMN_CSRCS = up_assert.c up_blocktask.c up_copystate.c up_createstack.c \ up_dataabort.c up_mdelay.c up_udelay.c up_exit.c up_idle.c \ up_initialize.c up_initialstate.c up_interruptcontext.c \ up_prefetchabort.c up_releasepending.c up_releasestack.c \ up_reprioritizertr.c up_schedulesigaction.c \ up_sigdeliver.c up_syscall.c up_unblocktask.c \ - up_undefinedinsn.c up_usestack.c + up_undefinedinsn.c up_usestack.c up__vfork.c ifeq ($(CONFIG_ELF),y) CMN_CSRCS += up_elf.c diff --git a/nuttx/arch/arm/src/kinetis/Make.defs b/nuttx/arch/arm/src/kinetis/Make.defs index 65bc7b465a..bad2946e23 100644 --- a/nuttx/arch/arm/src/kinetis/Make.defs +++ b/nuttx/arch/arm/src/kinetis/Make.defs @@ -1,7 +1,7 @@ ############################################################################ # arch/arm/src/kinetis/Make.defs # -# Copyright (C) 2011 Gregory Nutt. All rights reserved. +# Copyright (C) 2011, 2013 Gregory Nutt. All rights reserved. # Author: Gregory Nutt # # Redistribution and use in source and binary forms, with or without @@ -39,14 +39,16 @@ HEAD_ASRC = kinetis_vectors.S # Common ARM and Cortex-M3 files -CMN_ASRCS = up_saveusercontext.S up_fullcontextrestore.S up_switchcontext.S +CMN_ASRCS = up_saveusercontext.S up_fullcontextrestore.S up_switchcontext.S \ + up_vfork.S CMN_CSRCS = up_allocateheap.c up_assert.c up_blocktask.c up_copystate.c \ up_createstack.c up_mdelay.c up_udelay.c up_exit.c up_initialize.c \ up_memfault.c up_initialstate.c up_interruptcontext.c \ up_modifyreg8.c up_modifyreg16.c up_modifyreg32.c \ up_releasestack.c up_reprioritizertr.c up_schedulesigaction.c \ up_releasepending.c up_sigdeliver.c up_unblocktask.c up_usestack.c \ - up_doirq.c up_hardfault.c up_svcall.c up_checkstack.c + up_doirq.c up_hardfault.c up_svcall.c up_checkstack.c \ + up__vfork.c ifeq ($(CONFIG_ARCH_MEMCPY),y) CMN_ASRCS += up_memcpy.S diff --git a/nuttx/arch/arm/src/lm3s/Make.defs b/nuttx/arch/arm/src/lm3s/Make.defs index 8d29180277..c745e19539 100644 --- a/nuttx/arch/arm/src/lm3s/Make.defs +++ b/nuttx/arch/arm/src/lm3s/Make.defs @@ -1,7 +1,7 @@ ############################################################################ # arch/arm/src/lm3s/Make.defs # -# Copyright (C) 2009-2011 Gregory Nutt. All rights reserved. +# Copyright (C) 2009-2011, 2013 Gregory Nutt. All rights reserved. # Author: Gregory Nutt # # Redistribution and use in source and binary forms, with or without @@ -35,14 +35,16 @@ HEAD_ASRC = lm3s_vectors.S -CMN_ASRCS = up_saveusercontext.S up_fullcontextrestore.S up_switchcontext.S +CMN_ASRCS = up_saveusercontext.S up_fullcontextrestore.S up_switchcontext.S \ + up_vfork.S CMN_CSRCS = up_allocateheap.c up_assert.c up_blocktask.c up_copystate.c \ up_createstack.c up_mdelay.c up_udelay.c up_exit.c \ up_idle.c up_initialize.c up_initialstate.c up_interruptcontext.c \ up_memfault.c up_modifyreg8.c up_modifyreg16.c up_modifyreg32.c \ up_releasepending.c up_releasestack.c up_reprioritizertr.c \ up_schedulesigaction.c up_sigdeliver.c up_unblocktask.c \ - up_usestack.c up_doirq.c up_hardfault.c up_svcall.c + up_usestack.c up_doirq.c up_hardfault.c up_svcall.c \ + up__vfork.c ifeq ($(CONFIG_ARCH_MEMCPY),y) CMN_ASRCS += up_memcpy.S diff --git a/nuttx/arch/arm/src/lpc17xx/Make.defs b/nuttx/arch/arm/src/lpc17xx/Make.defs index c7ef4a1474..1ea0183a11 100644 --- a/nuttx/arch/arm/src/lpc17xx/Make.defs +++ b/nuttx/arch/arm/src/lpc17xx/Make.defs @@ -1,7 +1,7 @@ ############################################################################ # arch/arm/src/lpc17xx/Make.defs # -# Copyright (C) 2010-2011 Gregory Nutt. All rights reserved. +# Copyright (C) 2010-2011, 2013 Gregory Nutt. All rights reserved. # Author: Gregory Nutt # # Redistribution and use in source and binary forms, with or without @@ -39,14 +39,15 @@ HEAD_ASRC = lpc17_vectors.S # Common ARM and Cortex-M3 files -CMN_ASRCS = up_saveusercontext.S up_fullcontextrestore.S up_switchcontext.S +CMN_ASRCS = up_saveusercontext.S up_fullcontextrestore.S up_switchcontext.S \ + up_vfork.S CMN_CSRCS = up_assert.c up_blocktask.c up_copystate.c up_createstack.c \ up_mdelay.c up_udelay.c up_exit.c up_initialize.c up_memfault.c \ up_initialstate.c up_interruptcontext.c up_modifyreg8.c \ up_modifyreg16.c up_modifyreg32.c up_releasepending.c \ up_releasestack.c up_reprioritizertr.c up_schedulesigaction.c \ up_sigdeliver.c up_unblocktask.c up_usestack.c up_doirq.c \ - up_hardfault.c up_svcall.c up_checkstack.c + up_hardfault.c up_svcall.c up_checkstack.c up__vfork.c ifeq ($(CONFIG_ARCH_MEMCPY),y) CMN_ASRCS += up_memcpy.S diff --git a/nuttx/arch/arm/src/lpc214x/Make.defs b/nuttx/arch/arm/src/lpc214x/Make.defs index ae5ed15fba..6821d512b3 100644 --- a/nuttx/arch/arm/src/lpc214x/Make.defs +++ b/nuttx/arch/arm/src/lpc214x/Make.defs @@ -1,7 +1,7 @@ ############################################################################## # lpc214x/Make.defs # -# Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved. +# Copyright (C) 2007, 2008, 2013 Gregory Nutt. All rights reserved. # Author: Gregory Nutt # # Redistribution and use in source and binary forms, with or without @@ -35,13 +35,14 @@ HEAD_ASRC = lpc214x_head.S -CMN_ASRCS = up_saveusercontext.S up_fullcontextrestore.S up_vectors.S +CMN_ASRCS = up_saveusercontext.S up_fullcontextrestore.S up_vectors.S \ + up_vfork.S CMN_CSRCS = up_allocateheap.c up_assert.c up_blocktask.c up_copystate.c \ up_createstack.c up_dataabort.c up_mdelay.c up_udelay.c \ up_exit.c up_idle.c up_initialize.c up_initialstate.c \ up_interruptcontext.c up_prefetchabort.c up_releasepending.c \ up_releasestack.c up_reprioritizertr.c up_syscall.c up_unblocktask.c \ - up_undefinedinsn.c up_usestack.c up_lowputs.c + up_undefinedinsn.c up_usestack.c up_lowputs.c up__vfork.c ifneq ($(CONFIG_DISABLE_SIGNALS),y) CMN_CSRCS += up_schedulesigaction.c up_sigdeliver.c diff --git a/nuttx/arch/arm/src/lpc2378/Make.defs b/nuttx/arch/arm/src/lpc2378/Make.defs index 4fe75d9244..3d3c15926f 100644 --- a/nuttx/arch/arm/src/lpc2378/Make.defs +++ b/nuttx/arch/arm/src/lpc2378/Make.defs @@ -1,7 +1,7 @@ ############################################################################## # lpc23xx/Make.defs # -# Copyright (C) 2010 Rommel Marcelo. All rights reserved. +# Copyright (C) 2010, 2013 Rommel Marcelo. All rights reserved. # Author: Rommel Marcelo # # This file is part of the NuttX RTOS and based on the lpc2148 port: @@ -40,13 +40,14 @@ HEAD_ASRC = lpc23xx_head.S -CMN_ASRCS = up_saveusercontext.S up_fullcontextrestore.S up_vectors.S +CMN_ASRCS = up_saveusercontext.S up_fullcontextrestore.S up_vectors.S \ + up_vfork.S CMN_CSRCS = up_allocateheap.c up_assert.c up_blocktask.c up_copystate.c \ - up_createstack.c up_dataabort.c up_mdelay.c up_udelay.c \ - up_exit.c up_idle.c up_initialize.c up_initialstate.c \ - up_interruptcontext.c up_prefetchabort.c up_releasepending.c \ - up_releasestack.c up_reprioritizertr.c up_syscall.c up_unblocktask.c \ - up_undefinedinsn.c up_usestack.c up_lowputs.c + up_createstack.c up_dataabort.c up_mdelay.c up_udelay.c \ + up_exit.c up_idle.c up_initialize.c up_initialstate.c \ + up_interruptcontext.c up_prefetchabort.c up_releasepending.c \ + up_releasestack.c up_reprioritizertr.c up_syscall.c up_unblocktask.c \ + up_undefinedinsn.c up_usestack.c up_lowputs.c up__vfork.c ifneq ($(CONFIG_DISABLE_SIGNALS),y) CMN_CSRCS += up_schedulesigaction.c up_sigdeliver.c diff --git a/nuttx/arch/arm/src/lpc31xx/Make.defs b/nuttx/arch/arm/src/lpc31xx/Make.defs index db63563efe..b3a9746b4f 100644 --- a/nuttx/arch/arm/src/lpc31xx/Make.defs +++ b/nuttx/arch/arm/src/lpc31xx/Make.defs @@ -36,7 +36,7 @@ HEAD_ASRC = up_head.S CMN_ASRCS = up_cache.S up_fullcontextrestore.S up_saveusercontext.S \ - up_vectors.S up_vectoraddrexcptn.S up_vectortab.S + up_vectors.S up_vectoraddrexcptn.S up_vectortab.S up_vfork.S CMN_CSRCS = up_assert.c up_blocktask.c up_copystate.c up_createstack.c \ up_dataabort.c up_mdelay.c up_udelay.c up_exit.c up_idle.c \ up_initialize.c up_initialstate.c up_interruptcontext.c \ @@ -44,7 +44,7 @@ CMN_CSRCS = up_assert.c up_blocktask.c up_copystate.c up_createstack.c \ up_prefetchabort.c up_releasepending.c up_releasestack.c \ up_reprioritizertr.c up_schedulesigaction.c \ up_sigdeliver.c up_syscall.c up_unblocktask.c \ - up_undefinedinsn.c up_usestack.c + up_undefinedinsn.c up_usestack.c up__vfork.c ifeq ($(CONFIG_PAGING),y) CMN_CSRCS += up_pginitialize.c up_checkmapping.c up_allocpage.c up_va2pte.c diff --git a/nuttx/arch/arm/src/lpc43xx/Make.defs b/nuttx/arch/arm/src/lpc43xx/Make.defs index cd78ddd5bc..211f9bee33 100644 --- a/nuttx/arch/arm/src/lpc43xx/Make.defs +++ b/nuttx/arch/arm/src/lpc43xx/Make.defs @@ -1,7 +1,7 @@ ############################################################################ # arch/arm/src/lpc43xx/Make.defs # -# Copyright (C) 2012 Gregory Nutt. All rights reserved. +# Copyright (C) 2012-2013 Gregory Nutt. All rights reserved. # Author: Gregory Nutt # # Redistribution and use in source and binary forms, with or without @@ -33,16 +33,18 @@ # ############################################################################ -HEAD_ASRC = +HEAD_ASRC = CMN_ASRCS = up_saveusercontext.S up_fullcontextrestore.S up_switchcontext.S -CMN_CSRCS += up_assert.c up_blocktask.c up_copystate.c +CMN_ASRCS += up_vfork.S + +CMN_CSRCS = up_assert.c up_blocktask.c up_copystate.c CMN_CSRCS += up_createstack.c up_mdelay.c up_udelay.c up_exit.c CMN_CSRCS += up_initialize.c up_initialstate.c up_interruptcontext.c CMN_CSRCS += up_memfault.c up_modifyreg8.c up_modifyreg16.c up_modifyreg32.c CMN_CSRCS += up_releasepending.c up_releasestack.c up_reprioritizertr.c CMN_CSRCS += up_schedulesigaction.c up_sigdeliver.c up_unblocktask.c -CMN_CSRCS += up_usestack.c up_doirq.c up_hardfault.c up_svcall.c +CMN_CSRCS += up_usestack.c up_doirq.c up_hardfault.c up_svcall.c up__vfork.c ifeq ($(CONFIG_ARMV7M_CMNVECTOR),y) CMN_ASRCS += up_exception.S diff --git a/nuttx/arch/arm/src/sam3u/Make.defs b/nuttx/arch/arm/src/sam3u/Make.defs index daa1291699..4682ea83d7 100644 --- a/nuttx/arch/arm/src/sam3u/Make.defs +++ b/nuttx/arch/arm/src/sam3u/Make.defs @@ -1,7 +1,7 @@ ############################################################################ # arch/arm/src/sam3u/Make.defs # -# Copyright (C) 2009-2011 Gregory Nutt. All rights reserved. +# Copyright (C) 2009-2011, 2013 Gregory Nutt. All rights reserved. # Author: Gregory Nutt # # Redistribution and use in source and binary forms, with or without @@ -39,14 +39,15 @@ HEAD_ASRC = sam3u_vectors.S # Common ARM and Cortex-M3 files -CMN_ASRCS = up_saveusercontext.S up_fullcontextrestore.S up_switchcontext.S +CMN_ASRCS = up_saveusercontext.S up_fullcontextrestore.S up_switchcontext.S \ + up_vfork.S CMN_CSRCS = up_assert.c up_blocktask.c up_copystate.c up_createstack.c \ up_mdelay.c up_udelay.c up_exit.c up_idle.c up_initialize.c \ up_initialstate.c up_interruptcontext.c up_memfault.c up_modifyreg8.c \ up_modifyreg16.c up_modifyreg32.c up_releasepending.c \ up_releasestack.c up_reprioritizertr.c up_schedulesigaction.c \ up_sigdeliver.c up_unblocktask.c up_usestack.c up_doirq.c \ - up_hardfault.c up_svcall.c + up_hardfault.c up_svcall.c up__vfork.c # Configuration-dependent common files diff --git a/nuttx/arch/arm/src/stm32/Make.defs b/nuttx/arch/arm/src/stm32/Make.defs index 1e6c0c4010..89c2917918 100644 --- a/nuttx/arch/arm/src/stm32/Make.defs +++ b/nuttx/arch/arm/src/stm32/Make.defs @@ -1,7 +1,7 @@ ############################################################################ # arch/arm/src/stm32/Make.defs # -# Copyright (C) 2009, 2011-2012 Gregory Nutt. All rights reserved. +# Copyright (C) 2009, 2011-2013 Gregory Nutt. All rights reserved. # Author: Gregory Nutt # # Redistribution and use in source and binary forms, with or without @@ -39,14 +39,16 @@ else HEAD_ASRC = stm32_vectors.S endif -CMN_ASRCS = up_saveusercontext.S up_fullcontextrestore.S up_switchcontext.S +CMN_ASRCS = up_saveusercontext.S up_fullcontextrestore.S up_switchcontext.S \ + up_vfork.S CMN_CSRCS = up_assert.c up_blocktask.c up_copystate.c \ up_createstack.c up_mdelay.c up_udelay.c up_exit.c \ up_initialize.c up_initialstate.c up_interruptcontext.c \ up_memfault.c up_modifyreg8.c up_modifyreg16.c up_modifyreg32.c \ up_releasepending.c up_releasestack.c up_reprioritizertr.c \ up_schedulesigaction.c up_sigdeliver.c up_systemreset.c \ - up_unblocktask.c up_usestack.c up_doirq.c up_hardfault.c up_svcall.c + up_unblocktask.c up_usestack.c up_doirq.c up_hardfault.c \ + up_svcall.c up__vfork.c ifeq ($(CONFIG_ARMV7M_CMNVECTOR),y) CMN_ASRCS += up_exception.S diff --git a/nuttx/arch/arm/src/str71x/Make.defs b/nuttx/arch/arm/src/str71x/Make.defs index 32eaddcdb8..3612950a67 100644 --- a/nuttx/arch/arm/src/str71x/Make.defs +++ b/nuttx/arch/arm/src/str71x/Make.defs @@ -1,7 +1,7 @@ ############################################################################## # arch/arm/src/str71x/Make.defs # -# Copyright (C) 2008 Gregory Nutt. All rights reserved. +# Copyright (C) 2008, 2013 Gregory Nutt. All rights reserved. # Author: Gregory Nutt # # Redistribution and use in source and binary forms, with or without @@ -35,13 +35,14 @@ HEAD_ASRC = str71x_head.S -CMN_ASRCS = up_saveusercontext.S up_fullcontextrestore.S up_vectors.S +CMN_ASRCS = up_saveusercontext.S up_fullcontextrestore.S up_vectors.S \ + up_vfork.S CMN_CSRCS = up_allocateheap.c up_assert.c up_blocktask.c up_copystate.c \ - up_createstack.c up_dataabort.c up_mdelay.c up_udelay.c \ - up_exit.c up_idle.c up_initialize.c up_initialstate.c \ - up_interruptcontext.c up_prefetchabort.c up_releasepending.c \ - up_releasestack.c up_reprioritizertr.c up_syscall.c up_unblocktask.c \ - up_undefinedinsn.c up_usestack.c up_lowputs.c + up_createstack.c up_dataabort.c up_mdelay.c up_udelay.c \ + up_exit.c up_idle.c up_initialize.c up_initialstate.c \ + up_interruptcontext.c up_prefetchabort.c up_releasepending.c \ + up_releasestack.c up_reprioritizertr.c up_syscall.c up_unblocktask.c \ + up_undefinedinsn.c up_usestack.c up_lowputs.c up__vfork.c ifneq ($(CONFIG_DISABLE_SIGNALS),y) CMN_CSRCS += up_schedulesigaction.c up_sigdeliver.c diff --git a/nuttx/include/unistd.h b/nuttx/include/unistd.h index 681ce9e632..ddb6880f4d 100644 --- a/nuttx/include/unistd.h +++ b/nuttx/include/unistd.h @@ -1,7 +1,7 @@ /**************************************************************************** * include/unistd.h * - * Copyright (C) 2007-2009 Gregory Nutt. All rights reserved. + * Copyright (C) 2007-2009, 2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -129,6 +129,7 @@ EXTERN int optopt; /* unrecognized option character */ /* Task Control Interfaces */ +EXTERN pid_t vfork(void); EXTERN pid_t getpid(void); EXTERN void _exit(int status) noreturn_function; EXTERN unsigned int sleep(unsigned int seconds); From a5f001189e1a056be275e1d736e38893f96cd395 Mon Sep 17 00:00:00 2001 From: patacongo Date: Mon, 7 Jan 2013 19:35:47 +0000 Subject: [PATCH 040/118] This initial vfork() check-in was a little pollyanna-ish git-svn-id: http://svn.code.sf.net/p/nuttx/code/trunk@5487 42af7a65-404d-4744-a932-0658087f49c3 --- .../arch/arm/src/arm/{up_vfork.S => vfork.S} | 62 +++- .../arm/src/armv7-m/{up_vfork.S => vfork.S} | 62 +++- nuttx/arch/arm/src/c5471/Make.defs | 4 +- nuttx/arch/arm/src/calypso/Make.defs | 4 +- .../src/common/{up__vfork.c => up_vfork.c} | 110 ++++++-- nuttx/arch/arm/src/common/up_vfork.h | 82 ++++++ nuttx/arch/arm/src/dm320/Make.defs | 4 +- nuttx/arch/arm/src/imx/Make.defs | 4 +- nuttx/arch/arm/src/kinetis/Make.defs | 4 +- nuttx/arch/arm/src/lm3s/Make.defs | 4 +- nuttx/arch/arm/src/lpc17xx/Make.defs | 4 +- nuttx/arch/arm/src/lpc214x/Make.defs | 4 +- nuttx/arch/arm/src/lpc2378/Make.defs | 4 +- nuttx/arch/arm/src/lpc31xx/Make.defs | 4 +- nuttx/arch/arm/src/lpc43xx/Make.defs | 4 +- nuttx/arch/arm/src/sam3u/Make.defs | 4 +- nuttx/arch/arm/src/stm32/Make.defs | 4 +- nuttx/arch/arm/src/str71x/Make.defs | 4 +- nuttx/include/nuttx/arch.h | 2 +- nuttx/include/nuttx/sched.h | 26 ++ nuttx/sched/Makefile | 2 +- nuttx/sched/sched_setuptaskfiles.c | 3 +- nuttx/sched/task_create.c | 2 + nuttx/sched/task_vfork.c | 266 ++++++++++++++++++ 24 files changed, 598 insertions(+), 75 deletions(-) rename nuttx/arch/arm/src/arm/{up_vfork.S => vfork.S} (65%) rename nuttx/arch/arm/src/armv7-m/{up_vfork.S => vfork.S} (65%) rename nuttx/arch/arm/src/common/{up__vfork.c => up_vfork.c} (54%) create mode 100644 nuttx/arch/arm/src/common/up_vfork.h create mode 100644 nuttx/sched/task_vfork.c diff --git a/nuttx/arch/arm/src/arm/up_vfork.S b/nuttx/arch/arm/src/arm/vfork.S similarity index 65% rename from nuttx/arch/arm/src/arm/up_vfork.S rename to nuttx/arch/arm/src/arm/vfork.S index 23e975c304..f0fe17f738 100644 --- a/nuttx/arch/arm/src/arm/up_vfork.S +++ b/nuttx/arch/arm/src/arm/vfork.S @@ -1,5 +1,5 @@ /************************************************************************************ - * arch/arm/src/arm/up_vfork.S + * arch/arm/src/arm/vfork.S * * Copyright (C) 2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -39,6 +39,8 @@ #include +#include "up_vfork.h" + /************************************************************************************ * Pre-processor Definitions ************************************************************************************/ @@ -47,8 +49,8 @@ * Global Symbols ************************************************************************************/ - .file "up_vfork.S" - .globl __vfork + .file "vfork.S" + .globl task_vfork /************************************************************************************ * Public Functions @@ -64,8 +66,25 @@ * from the function in which vfork() was called, or calls any other function before * successfully calling _exit() or one of the exec family of functions. * - * This thin layer implements vfork by simply calling __vfork() with the vfork() - * return address as an argument. + * This thin layer implements vfork by simply calling task_vfork() with the vfork() + * context as an argument. The overall sequence is: + * + * 1) User code calls vfork(). vfork() collects context information and + * transfers control up up_vfork(). + * 2) up_vfork()and calls task_vforksetup(). + * 3) task_vforksetup() allocates and configures the child task's TCB. This + * consists of: + * - Allocation of the child task's TCB. + * - Initialization of file descriptors and streams + * - Configuration of environment variables + * - Setup the intput parameters for the task. + * - Initialization of the TCB (including call to up_initial_state() + * 4) up_vfork() provides any additional operating context. up_vfork must: + * - Allocate and initialize the stack + * - Initialize special values in any CPU registers that were not + * already configured by up_initial_state() + * 5) up_vfork() then calls task_vforkstart() + * 6) task_vforkstart() then executes the child thread. * * Input Paremeters: * None @@ -81,12 +100,35 @@ .globl vfork .type vfork, function vfork: + /* Create a stack frame */ - /* I know, I could have used the GCC's return address builtin and done this all - * in C. But this works even if there is no builtin. - */ + mov r0, sp /* Save the value of the stack frame on entry */ + sub sp, sp, #VFORK_SIZEOF /* Allocate the structure on the stack */ - mov r0, lr - b __vfork + /* Save the volatile registers */ + + str r4, [sp, #VFORK_R4_OFFSET] + str r5, [sp, #VFORK_R5_OFFSET] + str r6, [sp, #VFORK_R6_OFFSET] + str r7, [sp, #VFORK_R7_OFFSET] + str r8, [sp, #VFORK_R8_OFFSET] + str r9, [sp, #VFORK_R9_OFFSET] + str r10, [sp, #VFORK_R10_OFFSET] + + /* Save the frame pointer, stack pointer, and return address */ + + str fp, [sp, #VFORK_FP_OFFSET] + str r0, [sp, #VFORK_SP_OFFSET] + str lr, [sp, #VFORK_LR_OFFSET] + + /* Then, call task_vfork(), passing it a pointer to the stack structure */ + + mov r0, sp + bl task_vfork + + /* Release the stack data and return the value returned by task_vfork */ + + add sp, sp, #VFORK_SIZEOF + mov pc, lr .size vfork, .-vfork .end diff --git a/nuttx/arch/arm/src/armv7-m/up_vfork.S b/nuttx/arch/arm/src/armv7-m/vfork.S similarity index 65% rename from nuttx/arch/arm/src/armv7-m/up_vfork.S rename to nuttx/arch/arm/src/armv7-m/vfork.S index 65ccc45353..aceded4001 100644 --- a/nuttx/arch/arm/src/armv7-m/up_vfork.S +++ b/nuttx/arch/arm/src/armv7-m/vfork.S @@ -1,5 +1,5 @@ /************************************************************************************ - * arch/arm/src/armv7-m/up_vfork.S + * arch/arm/src/armv7-m/vfork.S * * Copyright (C) 2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -39,6 +39,8 @@ #include +#include "up_vfork.h" + /************************************************************************************ * Pre-processor Definitions ************************************************************************************/ @@ -49,8 +51,8 @@ .syntax unified .thumb - .file "up_vfork.S" - .globl __vfork + .file "vfork.S" + .globl task_vfork /************************************************************************************ * Public Functions @@ -66,8 +68,25 @@ * from the function in which vfork() was called, or calls any other function before * successfully calling _exit() or one of the exec family of functions. * - * This thin layer implements vfork by simply calling __vfork() with the vfork() - * return address as an argument. + * This thin layer implements vfork by simply calling task_vfork() with the vfork() + * context as an argument. The overall sequence is: + * + * 1) User code calls vfork(). vfork() collects context information and + * transfers control up up_vfork(). + * 2) up_vfork()and calls task_vforksetup(). + * 3) task_vforksetup() allocates and configures the child task's TCB. This + * consists of: + * - Allocation of the child task's TCB. + * - Initialization of file descriptors and streams + * - Configuration of environment variables + * - Setup the intput parameters for the task. + * - Initialization of the TCB (including call to up_initial_state() + * 4) up_vfork() provides any additional operating context. up_vfork must: + * - Allocate and initialize the stack + * - Initialize special values in any CPU registers that were not + * already configured by up_initial_state() + * 5) up_vfork() then calls task_vforkstart() + * 6) task_vforkstart() then executes the child thread. * * Input Paremeters: * None @@ -84,13 +103,36 @@ .globl vfork .type vfork, function vfork: + /* Create a stack frame */ - /* I know, I could have used the GCC's return address builtin and done this all - * in C. But this works even if there is no builtin. - */ + mov r0, sp /* Save the value of the stack frame on entry */ + sub sp, sp, #VFORK_SIZEOF /* Allocate the structure on the stack */ - mov r0, lr - b __vfork + /* Save the volatile registers */ + + str r4, [sp, #VFORK_R4_OFFSET] + str r5, [sp, #VFORK_R5_OFFSET] + str r6, [sp, #VFORK_R6_OFFSET] + str r7, [sp, #VFORK_R7_OFFSET] + str r8, [sp, #VFORK_R8_OFFSET] + str r9, [sp, #VFORK_R9_OFFSET] + str r10, [sp, #VFORK_R10_OFFSET] + + /* Save the frame pointer, stack pointer, and return address */ + + str fp, [sp, #VFORK_FP_OFFSET] + str r0, [sp, #VFORK_SP_OFFSET] + str lr, [sp, #VFORK_LR_OFFSET] + + /* Then, call task_vfork(), passing it a pointer to the stack structure */ + + mov r0, sp + bl task_vfork + + /* Release the stack data and return the value returned by task_vfork */ + + add sp, sp, #VFORK_SIZEOF + bx lr .size vfork, .-vfork .end diff --git a/nuttx/arch/arm/src/c5471/Make.defs b/nuttx/arch/arm/src/c5471/Make.defs index 89c3aaf0be..afa73cf6ca 100644 --- a/nuttx/arch/arm/src/c5471/Make.defs +++ b/nuttx/arch/arm/src/c5471/Make.defs @@ -35,14 +35,14 @@ HEAD_ASRC = up_nommuhead.S -CMN_ASRCS = up_saveusercontext.S up_fullcontextrestore.S up_vfork.S +CMN_ASRCS = up_saveusercontext.S up_fullcontextrestore.S vfork.S CMN_CSRCS = up_allocateheap.c up_assert.c up_blocktask.c up_copystate.c \ up_createstack.c up_dataabort.c up_mdelay.c up_udelay.c up_doirq.c \ up_exit.c up_idle.c up_initialize.c up_initialstate.c \ up_interruptcontext.c up_prefetchabort.c up_releasepending.c \ up_releasestack.c up_reprioritizertr.c up_schedulesigaction.c \ up_sigdeliver.c up_syscall.c up_unblocktask.c \ - up_undefinedinsn.c up_usestack.c up__vfork.c + up_undefinedinsn.c up_usestack.c up_vfork.c ifeq ($(CONFIG_ELF),y) CMN_CSRCS += up_elf.c diff --git a/nuttx/arch/arm/src/calypso/Make.defs b/nuttx/arch/arm/src/calypso/Make.defs index 957d4e6773..1a1d148697 100644 --- a/nuttx/arch/arm/src/calypso/Make.defs +++ b/nuttx/arch/arm/src/calypso/Make.defs @@ -39,14 +39,14 @@ HEAD_ASRC = calypso_head.S CMN_ASRCS = up_saveusercontext.S up_fullcontextrestore.S up_vectors.S \ - up_nommuhead.S up_vfork.S + up_nommuhead.S vfork.S CMN_CSRCS = up_allocateheap.c up_assert.c up_blocktask.c up_copystate.c \ up_createstack.c up_dataabort.c up_mdelay.c up_udelay.c up_doirq.c \ up_exit.c up_idle.c up_initialstate.c up_initialize.c \ up_interruptcontext.c up_prefetchabort.c up_releasepending.c \ up_releasestack.c up_reprioritizertr.c up_schedulesigaction.c \ up_sigdeliver.c up_syscall.c up_unblocktask.c \ - up_undefinedinsn.c up_usestack.c calypso_power.c up__vfork.c + up_undefinedinsn.c up_usestack.c calypso_power.c up_vfork.c ifeq ($(CONFIG_ELF),y) CMN_CSRCS += up_elf.c diff --git a/nuttx/arch/arm/src/common/up__vfork.c b/nuttx/arch/arm/src/common/up_vfork.c similarity index 54% rename from nuttx/arch/arm/src/common/up__vfork.c rename to nuttx/arch/arm/src/common/up_vfork.c index a1081faa88..404abd1f83 100644 --- a/nuttx/arch/arm/src/common/up__vfork.c +++ b/nuttx/arch/arm/src/common/up_vfork.c @@ -1,5 +1,5 @@ /**************************************************************************** - * arch/arm/src/common/up__vfork + * arch/arm/src/common/up_vfork.c * * Copyright (C) 2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -39,10 +39,16 @@ #include -#include +#include +#include +#include +#include #include +#include +#include +#include "up_vfork.h" #include "os_internal.h" /**************************************************************************** @@ -75,7 +81,7 @@ ****************************************************************************/ /**************************************************************************** - * Name: __vfork + * Name: up_vfork * * Description: * The vfork() function has the same effect as fork(), except that the @@ -85,11 +91,29 @@ * called, or calls any other function before successfully calling _exit() * or one of the exec family of functions. * - * This thin layer starts the vfork child by simply spawning a new thread - * that begins at the return address of vfork(). + * The overall sequence is: + * + * 1) User code calls vfork(). vfork() collects context information and + * transfers control up up_vfork(). + * 2) up_vfork()and calls task_vforksetup(). + * 3) task_vforksetup() allocates and configures the child task's TCB. This + * consists of: + * - Allocation of the child task's TCB. + * - Initialization of file descriptors and streams + * - Configuration of environment variables + * - Setup the intput parameters for the task. + * - Initialization of the TCB (including call to up_initial_state() + * 4) up_vfork() provides any additional operating context. up_vfork must: + * - Allocate and initialize the stack + * - Initialize special values in any CPU registers that were not + * already configured by up_initial_state() + * 5) up_vfork() then calls task_vforkstart() + * 6) task_vforkstart() then executes the child thread. + * + * task_vforkabort() may be called if an error occurs between steps 3 and 6. * * Input Paremeters: - * retaddr - The return address of vfork() + * context - Caller context information saved by vfork() * * Return: * Upon successful completion, vfork() returns 0 to the child process and @@ -99,11 +123,22 @@ * ****************************************************************************/ -pid_t __vfork(uint32_t retaddr) +pid_t up_vfork(struct vfork_s *context) { - FAR _TCB *parent = (FAR _TCB *)g_readytorun.head; + _TCB *parent = (FAR _TCB *)g_readytorun.head; + _TCB *child; size_t stacksize; - int priority; + uint32_t newsp; + uint32_t stackutil; + int ret; + + /* Allocate and initialize a TCB for the child task. */ + + child = task_vforksetup((start_t)context->lr); + if (!child) + { + return (pid_t)ERROR; + } /* Get the size of the parent task's stack. Due to alignment operations, * the adjusted stack size may be smaller than the stack size originally @@ -112,23 +147,50 @@ pid_t __vfork(uint32_t retaddr) stacksize = parent->adj_stack_size + CONFIG_STACK_ALIGNMENT - 1; - /* Get the current priority of the parent task */ + /* Allocate the stack for the TCB */ -#ifdef CONFIG_PRIORITY_INHERITANCE - priority = parent->base_priority; /* "Normal," unboosted priority */ -#else - priority = parent->sched_priority; /* Current priority */ -#endif + ret = up_create_stack(child, stacksize); + if (ret != OK) + { + task_vforkabort(child, -ret); + return (pid_t)ERROR; + } - /* Start the child thread at the vfork return address. TASK_CREATE will - * return the PID of the new thread. Otherwise a negative value will be - * returned and the errno will be set appropriately. - * - * When the registers are initialized, the return value in R0 should be - * cleared to zero, providing the indication to the newly started child - * thread. + /* How much of the parent's stack was utilized? */ + + DEBUGASSERT(parent->adj_stack_ptr > context->sp); + stackutil = (uint32_t)parent->adj_stack_ptr - context->sp; + + /* Make some feeble effort to perserve the stack contents. This is + * feeble because the stack surely contains invalid pointer and other + * content that will not work in the child context. However, if the + * user follows all of the caveats of vfor() usage, even this feeble + * effort is overkill. + */ + + newsp = (uint32_t)child->adj_stack_ptr - stackutil; + memcpy((void *)newsp, (const void *)context->sp, stackutil); + + /* Update the stack pointer, frame pointer, and voltile registers. When + * the child TCB was initialized, all of the values were set to zero. + * up_initial_state() altered a few values, but the return value in R0 + * should be cleared to zero, providing the indication to the newly started + * child thread. */ - return TASK_CREATE("init", priority, stacksize, (main_t)retaddr, - (const char **)NULL); + child->xcp.regs[REG_R4] = context->r4; /* Volatile register r4 */ + child->xcp.regs[REG_R5] = context->r5; /* Volatile register r5 */ + child->xcp.regs[REG_R6] = context->r6; /* Volatile register r6 */ + child->xcp.regs[REG_R7] = context->r7; /* Volatile register r7 */ + child->xcp.regs[REG_R8] = context->r8; /* Volatile register r8 */ + child->xcp.regs[REG_R9] = context->r9; /* Volatile register r9 */ + child->xcp.regs[REG_R10] = context->r10; /* Volatile register r10 */ + child->xcp.regs[REG_FP] = context->fp; /* Frame pointer */ + child->xcp.regs[REG_SP] = context->sp; /* Stack pointer */ + + /* And, finally, start the child task. On a failure, task_vforkstart() + * will discard the TCB by calling task_vforkabort(). + */ + + return task_vforkstart(child); } diff --git a/nuttx/arch/arm/src/common/up_vfork.h b/nuttx/arch/arm/src/common/up_vfork.h new file mode 100644 index 0000000000..a4505474a3 --- /dev/null +++ b/nuttx/arch/arm/src/common/up_vfork.h @@ -0,0 +1,82 @@ +/**************************************************************************** + * arch/arm/src/common/arm-vfork.h + * + * Copyright (C) 2013 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * 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. + * + ****************************************************************************/ + +#ifndef __ARCH_ARM_SRC_ARM_VFORK_H +#define __ARCH_ARM_SRC_ARM_VFORK_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +#define VFORK_R4_OFFSET (0*4) /* Volatile register r4 */ +#define VFORK_R5_OFFSET (1*4) /* Volatile register r5 */ +#define VFORK_R6_OFFSET (2*4) /* Volatile register r6 */ +#define VFORK_R7_OFFSET (3*4) /* Volatile register r7 */ +#define VFORK_R8_OFFSET (4*4) /* Volatile register r8 */ +#define VFORK_R9_OFFSET (5*4) /* Volatile register r9 */ +#define VFORK_R10_OFFSET (6*4) /* Volatile register r10 */ +#define VFORK_FP_OFFSET (7*4) /* Frame pointer */ +#define VFORK_SP_OFFSET (8*4) /* Stack pointer*/ +#define VFORK_LR_OFFSET (9*4) /* Return address*/ + +#define VFORK_SIZEOF (10*4) + +/**************************************************************************** + * Public Types + ****************************************************************************/ + +#ifndef __ASSEMBLY__ +struct vfork_s +{ + uint32_t r4; /* Volatile register r4 */ + uint32_t r5; /* Volatile register r5 */ + uint32_t r6; /* Volatile register r6 */ + uint32_t r7; /* Volatile register r7 */ + uint32_t r8; /* Volatile register r8 */ + uint32_t r9; /* Volatile register r9 */ + uint32_t r10; /* Volatile register r10 */ + uint32_t fp; /* Frame pointer */ + uint32_t sp; /* Stack pointer*/ + uint32_t lr; /* Return address*/ +}; +#endif + +#endif /* __ARCH_ARM_SRC_ARM_VFORK_H */ diff --git a/nuttx/arch/arm/src/dm320/Make.defs b/nuttx/arch/arm/src/dm320/Make.defs index 52e65c0e89..651d9fea96 100644 --- a/nuttx/arch/arm/src/dm320/Make.defs +++ b/nuttx/arch/arm/src/dm320/Make.defs @@ -36,14 +36,14 @@ HEAD_ASRC = up_head.S CMN_ASRCS = up_cache.S up_fullcontextrestore.S up_saveusercontext.S \ - up_vectors.S up_vectoraddrexcptn.S up_vectortab.S up_vfork.S + up_vectors.S up_vectoraddrexcptn.S up_vectortab.S vfork.S CMN_CSRCS = up_assert.c up_blocktask.c up_copystate.c up_createstack.c \ up_dataabort.c up_mdelay.c up_udelay.c up_exit.c up_idle.c \ up_initialize.c up_initialstate.c up_interruptcontext.c \ up_prefetchabort.c up_releasepending.c up_releasestack.c \ up_reprioritizertr.c up_schedulesigaction.c \ up_sigdeliver.c up_syscall.c up_unblocktask.c \ - up_undefinedinsn.c up_usestack.c up__vfork.c + up_undefinedinsn.c up_usestack.c up_vfork.c ifeq ($(CONFIG_ELF),y) CMN_CSRCS += up_elf.c diff --git a/nuttx/arch/arm/src/imx/Make.defs b/nuttx/arch/arm/src/imx/Make.defs index a7c0ceebd2..3cea29b9bb 100644 --- a/nuttx/arch/arm/src/imx/Make.defs +++ b/nuttx/arch/arm/src/imx/Make.defs @@ -36,14 +36,14 @@ HEAD_ASRC = up_head.S CMN_ASRCS = up_cache.S up_fullcontextrestore.S up_saveusercontext.S \ - up_vectors.S up_vectoraddrexcptn.S up_vectortab.S up_vfork.S + up_vectors.S up_vectoraddrexcptn.S up_vectortab.S vfork.S CMN_CSRCS = up_assert.c up_blocktask.c up_copystate.c up_createstack.c \ up_dataabort.c up_mdelay.c up_udelay.c up_exit.c up_idle.c \ up_initialize.c up_initialstate.c up_interruptcontext.c \ up_prefetchabort.c up_releasepending.c up_releasestack.c \ up_reprioritizertr.c up_schedulesigaction.c \ up_sigdeliver.c up_syscall.c up_unblocktask.c \ - up_undefinedinsn.c up_usestack.c up__vfork.c + up_undefinedinsn.c up_usestack.c up_vfork.c ifeq ($(CONFIG_ELF),y) CMN_CSRCS += up_elf.c diff --git a/nuttx/arch/arm/src/kinetis/Make.defs b/nuttx/arch/arm/src/kinetis/Make.defs index bad2946e23..e417465478 100644 --- a/nuttx/arch/arm/src/kinetis/Make.defs +++ b/nuttx/arch/arm/src/kinetis/Make.defs @@ -40,7 +40,7 @@ HEAD_ASRC = kinetis_vectors.S # Common ARM and Cortex-M3 files CMN_ASRCS = up_saveusercontext.S up_fullcontextrestore.S up_switchcontext.S \ - up_vfork.S + vfork.S CMN_CSRCS = up_allocateheap.c up_assert.c up_blocktask.c up_copystate.c \ up_createstack.c up_mdelay.c up_udelay.c up_exit.c up_initialize.c \ up_memfault.c up_initialstate.c up_interruptcontext.c \ @@ -48,7 +48,7 @@ CMN_CSRCS = up_allocateheap.c up_assert.c up_blocktask.c up_copystate.c \ up_releasestack.c up_reprioritizertr.c up_schedulesigaction.c \ up_releasepending.c up_sigdeliver.c up_unblocktask.c up_usestack.c \ up_doirq.c up_hardfault.c up_svcall.c up_checkstack.c \ - up__vfork.c + up_vfork.c ifeq ($(CONFIG_ARCH_MEMCPY),y) CMN_ASRCS += up_memcpy.S diff --git a/nuttx/arch/arm/src/lm3s/Make.defs b/nuttx/arch/arm/src/lm3s/Make.defs index c745e19539..66b8f56583 100644 --- a/nuttx/arch/arm/src/lm3s/Make.defs +++ b/nuttx/arch/arm/src/lm3s/Make.defs @@ -36,7 +36,7 @@ HEAD_ASRC = lm3s_vectors.S CMN_ASRCS = up_saveusercontext.S up_fullcontextrestore.S up_switchcontext.S \ - up_vfork.S + vfork.S CMN_CSRCS = up_allocateheap.c up_assert.c up_blocktask.c up_copystate.c \ up_createstack.c up_mdelay.c up_udelay.c up_exit.c \ up_idle.c up_initialize.c up_initialstate.c up_interruptcontext.c \ @@ -44,7 +44,7 @@ CMN_CSRCS = up_allocateheap.c up_assert.c up_blocktask.c up_copystate.c \ up_releasepending.c up_releasestack.c up_reprioritizertr.c \ up_schedulesigaction.c up_sigdeliver.c up_unblocktask.c \ up_usestack.c up_doirq.c up_hardfault.c up_svcall.c \ - up__vfork.c + up_vfork.c ifeq ($(CONFIG_ARCH_MEMCPY),y) CMN_ASRCS += up_memcpy.S diff --git a/nuttx/arch/arm/src/lpc17xx/Make.defs b/nuttx/arch/arm/src/lpc17xx/Make.defs index 1ea0183a11..ed05fff95e 100644 --- a/nuttx/arch/arm/src/lpc17xx/Make.defs +++ b/nuttx/arch/arm/src/lpc17xx/Make.defs @@ -40,14 +40,14 @@ HEAD_ASRC = lpc17_vectors.S # Common ARM and Cortex-M3 files CMN_ASRCS = up_saveusercontext.S up_fullcontextrestore.S up_switchcontext.S \ - up_vfork.S + vfork.S CMN_CSRCS = up_assert.c up_blocktask.c up_copystate.c up_createstack.c \ up_mdelay.c up_udelay.c up_exit.c up_initialize.c up_memfault.c \ up_initialstate.c up_interruptcontext.c up_modifyreg8.c \ up_modifyreg16.c up_modifyreg32.c up_releasepending.c \ up_releasestack.c up_reprioritizertr.c up_schedulesigaction.c \ up_sigdeliver.c up_unblocktask.c up_usestack.c up_doirq.c \ - up_hardfault.c up_svcall.c up_checkstack.c up__vfork.c + up_hardfault.c up_svcall.c up_checkstack.c up_vfork.c ifeq ($(CONFIG_ARCH_MEMCPY),y) CMN_ASRCS += up_memcpy.S diff --git a/nuttx/arch/arm/src/lpc214x/Make.defs b/nuttx/arch/arm/src/lpc214x/Make.defs index 6821d512b3..34713b0083 100644 --- a/nuttx/arch/arm/src/lpc214x/Make.defs +++ b/nuttx/arch/arm/src/lpc214x/Make.defs @@ -36,13 +36,13 @@ HEAD_ASRC = lpc214x_head.S CMN_ASRCS = up_saveusercontext.S up_fullcontextrestore.S up_vectors.S \ - up_vfork.S + vfork.S CMN_CSRCS = up_allocateheap.c up_assert.c up_blocktask.c up_copystate.c \ up_createstack.c up_dataabort.c up_mdelay.c up_udelay.c \ up_exit.c up_idle.c up_initialize.c up_initialstate.c \ up_interruptcontext.c up_prefetchabort.c up_releasepending.c \ up_releasestack.c up_reprioritizertr.c up_syscall.c up_unblocktask.c \ - up_undefinedinsn.c up_usestack.c up_lowputs.c up__vfork.c + up_undefinedinsn.c up_usestack.c up_lowputs.c up_vfork.c ifneq ($(CONFIG_DISABLE_SIGNALS),y) CMN_CSRCS += up_schedulesigaction.c up_sigdeliver.c diff --git a/nuttx/arch/arm/src/lpc2378/Make.defs b/nuttx/arch/arm/src/lpc2378/Make.defs index 3d3c15926f..cfd9dc79f2 100644 --- a/nuttx/arch/arm/src/lpc2378/Make.defs +++ b/nuttx/arch/arm/src/lpc2378/Make.defs @@ -41,13 +41,13 @@ HEAD_ASRC = lpc23xx_head.S CMN_ASRCS = up_saveusercontext.S up_fullcontextrestore.S up_vectors.S \ - up_vfork.S + vfork.S CMN_CSRCS = up_allocateheap.c up_assert.c up_blocktask.c up_copystate.c \ up_createstack.c up_dataabort.c up_mdelay.c up_udelay.c \ up_exit.c up_idle.c up_initialize.c up_initialstate.c \ up_interruptcontext.c up_prefetchabort.c up_releasepending.c \ up_releasestack.c up_reprioritizertr.c up_syscall.c up_unblocktask.c \ - up_undefinedinsn.c up_usestack.c up_lowputs.c up__vfork.c + up_undefinedinsn.c up_usestack.c up_lowputs.c up_vfork.c ifneq ($(CONFIG_DISABLE_SIGNALS),y) CMN_CSRCS += up_schedulesigaction.c up_sigdeliver.c diff --git a/nuttx/arch/arm/src/lpc31xx/Make.defs b/nuttx/arch/arm/src/lpc31xx/Make.defs index b3a9746b4f..4e6f69299a 100644 --- a/nuttx/arch/arm/src/lpc31xx/Make.defs +++ b/nuttx/arch/arm/src/lpc31xx/Make.defs @@ -36,7 +36,7 @@ HEAD_ASRC = up_head.S CMN_ASRCS = up_cache.S up_fullcontextrestore.S up_saveusercontext.S \ - up_vectors.S up_vectoraddrexcptn.S up_vectortab.S up_vfork.S + up_vectors.S up_vectoraddrexcptn.S up_vectortab.S vfork.S CMN_CSRCS = up_assert.c up_blocktask.c up_copystate.c up_createstack.c \ up_dataabort.c up_mdelay.c up_udelay.c up_exit.c up_idle.c \ up_initialize.c up_initialstate.c up_interruptcontext.c \ @@ -44,7 +44,7 @@ CMN_CSRCS = up_assert.c up_blocktask.c up_copystate.c up_createstack.c \ up_prefetchabort.c up_releasepending.c up_releasestack.c \ up_reprioritizertr.c up_schedulesigaction.c \ up_sigdeliver.c up_syscall.c up_unblocktask.c \ - up_undefinedinsn.c up_usestack.c up__vfork.c + up_undefinedinsn.c up_usestack.c up_vfork.c ifeq ($(CONFIG_PAGING),y) CMN_CSRCS += up_pginitialize.c up_checkmapping.c up_allocpage.c up_va2pte.c diff --git a/nuttx/arch/arm/src/lpc43xx/Make.defs b/nuttx/arch/arm/src/lpc43xx/Make.defs index 211f9bee33..9674196c5b 100644 --- a/nuttx/arch/arm/src/lpc43xx/Make.defs +++ b/nuttx/arch/arm/src/lpc43xx/Make.defs @@ -36,7 +36,7 @@ HEAD_ASRC = CMN_ASRCS = up_saveusercontext.S up_fullcontextrestore.S up_switchcontext.S -CMN_ASRCS += up_vfork.S +CMN_ASRCS += vfork.S CMN_CSRCS = up_assert.c up_blocktask.c up_copystate.c CMN_CSRCS += up_createstack.c up_mdelay.c up_udelay.c up_exit.c @@ -44,7 +44,7 @@ CMN_CSRCS += up_initialize.c up_initialstate.c up_interruptcontext.c CMN_CSRCS += up_memfault.c up_modifyreg8.c up_modifyreg16.c up_modifyreg32.c CMN_CSRCS += up_releasepending.c up_releasestack.c up_reprioritizertr.c CMN_CSRCS += up_schedulesigaction.c up_sigdeliver.c up_unblocktask.c -CMN_CSRCS += up_usestack.c up_doirq.c up_hardfault.c up_svcall.c up__vfork.c +CMN_CSRCS += up_usestack.c up_doirq.c up_hardfault.c up_svcall.c up_vfork.c ifeq ($(CONFIG_ARMV7M_CMNVECTOR),y) CMN_ASRCS += up_exception.S diff --git a/nuttx/arch/arm/src/sam3u/Make.defs b/nuttx/arch/arm/src/sam3u/Make.defs index 4682ea83d7..58047af21d 100644 --- a/nuttx/arch/arm/src/sam3u/Make.defs +++ b/nuttx/arch/arm/src/sam3u/Make.defs @@ -40,14 +40,14 @@ HEAD_ASRC = sam3u_vectors.S # Common ARM and Cortex-M3 files CMN_ASRCS = up_saveusercontext.S up_fullcontextrestore.S up_switchcontext.S \ - up_vfork.S + vfork.S CMN_CSRCS = up_assert.c up_blocktask.c up_copystate.c up_createstack.c \ up_mdelay.c up_udelay.c up_exit.c up_idle.c up_initialize.c \ up_initialstate.c up_interruptcontext.c up_memfault.c up_modifyreg8.c \ up_modifyreg16.c up_modifyreg32.c up_releasepending.c \ up_releasestack.c up_reprioritizertr.c up_schedulesigaction.c \ up_sigdeliver.c up_unblocktask.c up_usestack.c up_doirq.c \ - up_hardfault.c up_svcall.c up__vfork.c + up_hardfault.c up_svcall.c up_vfork.c # Configuration-dependent common files diff --git a/nuttx/arch/arm/src/stm32/Make.defs b/nuttx/arch/arm/src/stm32/Make.defs index 89c2917918..fd19e3bf6b 100644 --- a/nuttx/arch/arm/src/stm32/Make.defs +++ b/nuttx/arch/arm/src/stm32/Make.defs @@ -40,7 +40,7 @@ HEAD_ASRC = stm32_vectors.S endif CMN_ASRCS = up_saveusercontext.S up_fullcontextrestore.S up_switchcontext.S \ - up_vfork.S + vfork.S CMN_CSRCS = up_assert.c up_blocktask.c up_copystate.c \ up_createstack.c up_mdelay.c up_udelay.c up_exit.c \ up_initialize.c up_initialstate.c up_interruptcontext.c \ @@ -48,7 +48,7 @@ CMN_CSRCS = up_assert.c up_blocktask.c up_copystate.c \ up_releasepending.c up_releasestack.c up_reprioritizertr.c \ up_schedulesigaction.c up_sigdeliver.c up_systemreset.c \ up_unblocktask.c up_usestack.c up_doirq.c up_hardfault.c \ - up_svcall.c up__vfork.c + up_svcall.c up_vfork.c ifeq ($(CONFIG_ARMV7M_CMNVECTOR),y) CMN_ASRCS += up_exception.S diff --git a/nuttx/arch/arm/src/str71x/Make.defs b/nuttx/arch/arm/src/str71x/Make.defs index 3612950a67..bde5ca003e 100644 --- a/nuttx/arch/arm/src/str71x/Make.defs +++ b/nuttx/arch/arm/src/str71x/Make.defs @@ -36,13 +36,13 @@ HEAD_ASRC = str71x_head.S CMN_ASRCS = up_saveusercontext.S up_fullcontextrestore.S up_vectors.S \ - up_vfork.S + vfork.S CMN_CSRCS = up_allocateheap.c up_assert.c up_blocktask.c up_copystate.c \ up_createstack.c up_dataabort.c up_mdelay.c up_udelay.c \ up_exit.c up_idle.c up_initialize.c up_initialstate.c \ up_interruptcontext.c up_prefetchabort.c up_releasepending.c \ up_releasestack.c up_reprioritizertr.c up_syscall.c up_unblocktask.c \ - up_undefinedinsn.c up_usestack.c up_lowputs.c up__vfork.c + up_undefinedinsn.c up_usestack.c up_lowputs.c up_vfork.c ifneq ($(CONFIG_DISABLE_SIGNALS),y) CMN_CSRCS += up_schedulesigaction.c up_sigdeliver.c diff --git a/nuttx/include/nuttx/arch.h b/nuttx/include/nuttx/arch.h index 8b4b10ade9..9589864720 100644 --- a/nuttx/include/nuttx/arch.h +++ b/nuttx/include/nuttx/arch.h @@ -1,7 +1,7 @@ /**************************************************************************** * include/nuttx/arch.h * - * Copyright (C) 2007-2012 Gregory Nutt. All rights reserved. + * Copyright (C) 2007-2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without diff --git a/nuttx/include/nuttx/sched.h b/nuttx/include/nuttx/sched.h index 6eaba6e9c6..940bf1f1b7 100644 --- a/nuttx/include/nuttx/sched.h +++ b/nuttx/include/nuttx/sched.h @@ -382,6 +382,32 @@ EXTERN FAR struct streamlist *sched_getstreams(void); EXTERN FAR struct socketlist *sched_getsockets(void); #endif /* CONFIG_NSOCKET_DESCRIPTORS */ +/* Internal vfork support.The overall sequence is: + * + * 1) User code calls vfork(). vfork() is provided in architecture-specific + * code. + * 2) vfork()and calls task_vforksetup(). + * 3) task_vforksetup() allocates and configures the child task's TCB. This + * consists of: + * - Allocation of the child task's TCB. + * - Initialization of file descriptors and streams + * - Configuration of environment variables + * - Setup the intput parameters for the task. + * - Initialization of the TCB (including call to up_initial_state() + * 4) vfork() provides any additional operating context. vfork must: + * - Allocate and initialize the stack + * - Initialize special values in any CPU registers that were not + * already configured by up_initial_state() + * 5) vfork() then calls task_vforkstart() + * 6) task_vforkstart() then executes the child thread. + * + * task_vforkabort() may be called if an error occurs between steps 3 and 6. + */ + +FAR _TCB *task_vforksetup(start_t retaddr); +pid_t task_vforkstart(FAR _TCB *child); +void task_vforkabort(FAR _TCB *child, int errcode); + /* sched_foreach will enumerate over each task and provide the * TCB of each task to a user callback functions. Interrupts * will be disabled throughout this enumeration! diff --git a/nuttx/sched/Makefile b/nuttx/sched/Makefile index 82f74fc3c8..23d1e9938e 100644 --- a/nuttx/sched/Makefile +++ b/nuttx/sched/Makefile @@ -45,7 +45,7 @@ MISC_SRCS = os_start.c os_bringup.c errno_getptr.c errno_get.c errno_set.c \ TSK_SRCS = prctl.c task_create.c task_init.c task_setup.c task_activate.c \ task_start.c task_delete.c task_deletecurrent.c task_exithook.c \ - task_restart.c exit.c getpid.c sched_addreadytorun.c \ + task_restart.c task_vfork.c exit.c getpid.c sched_addreadytorun.c \ sched_removereadytorun.c sched_addprioritized.c sched_mergepending.c \ sched_addblocked.c sched_removeblocked.c sched_free.c sched_gettcb.c \ sched_verifytcb.c sched_releasetcb.c diff --git a/nuttx/sched/sched_setuptaskfiles.c b/nuttx/sched/sched_setuptaskfiles.c index fe0b14143d..d01b8d4cdd 100644 --- a/nuttx/sched/sched_setuptaskfiles.c +++ b/nuttx/sched/sched_setuptaskfiles.c @@ -200,7 +200,8 @@ static inline void sched_dupsockets(FAR _TCB *tcb) * tcb - tcb of the new task. * * Return Value: - * None + * Zero (OK) is returned on success; A negated errno value is returned on + * failure. * * Assumptions: * diff --git a/nuttx/sched/task_create.c b/nuttx/sched/task_create.c index 4d92c9bb07..801706cbf3 100644 --- a/nuttx/sched/task_create.c +++ b/nuttx/sched/task_create.c @@ -169,6 +169,8 @@ static int thread_create(const char *name, uint8_t type, int priority, ret = task_activate(tcb); if (ret != OK) { + /* The TCB was added to the active task list by task_schedsetup() */ + dq_rem((FAR dq_entry_t*)tcb, (dq_queue_t*)&g_inactivetasks); goto errout_with_tcb; } diff --git a/nuttx/sched/task_vfork.c b/nuttx/sched/task_vfork.c new file mode 100644 index 0000000000..93fcb46da8 --- /dev/null +++ b/nuttx/sched/task_vfork.c @@ -0,0 +1,266 @@ +/**************************************************************************** + * sched/task_vfork + * + * Copyright (C) 2013 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * 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. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include +#include +#include +#include + +#include + +#include "os_internal.h" +#include "env_internal.h" + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +/**************************************************************************** + * Private Functions + ****************************************************************************/ + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: task_vforksetup + * + * Description: + * The vfork() function has the same effect as fork(), except that the + * behavior is undefined if the process created by vfork() either modifies + * any data other than a variable of type pid_t used to store the return + * value from vfork(), or returns from the function in which vfork() was + * called, or calls any other function before successfully calling _exit() + * or one of the exec family of functions. + * + * This functin provides one step in the overall vfork() sequence: It + * Allocates and initializes the child task's TCB. The overall sequence is: + * + * 1) User code calls vfork(). vfork() is provided in architecture-specific + * code. + * 2) vfork()and calls task_vforksetup(). + * 3) task_vforksetup() allocates and configures the child task's TCB. This + * consists of: + * - Allocation of the child task's TCB. + * - Initialization of file descriptors and streams + * - Configuration of environment variables + * - Setup the intput parameters for the task. + * - Initialization of the TCB (including call to up_initial_state() + * 4) up_vfork() provides any additional operating context. up_vfork must: + * - Allocate and initialize the stack + * - Initialize special values in any CPU registers that were not + * already configured by up_initial_state() + * 5) up_vfork() then calls task_vforkstart() + * 6) task_vforkstart() then executes the child thread. + * + * Input Paremeters: + * retaddr - The return address from vfork() where the child task + * will be started. + * + * Returned Value: + * Upon successful completion, task_vforksetup() returns a pointer to + * newly allocated and initalized child task's TCB. NULL is returned + * on any failure and the errno is set appropriately. + * + ****************************************************************************/ + +FAR _TCB *task_vforksetup(start_t retaddr) +{ + _TCB *parent = (FAR _TCB *)g_readytorun.head; + _TCB *child; + int priority; + int ret; + + DEBUGASSERT(retaddr); + + /* Allocate a TCB for the child task. */ + + child = (FAR _TCB*)kzalloc(sizeof(_TCB)); + if (!child) + { + set_errno(ENOMEM); + return NULL; + } + + /* Associate file descriptors with the new task */ + +#if CONFIG_NFILE_DESCRIPTORS > 0 || CONFIG_NSOCKET_DESCRIPTORS > 0 + ret = sched_setuptaskfiles(child); + if (ret != OK) + { + goto errout_with_tcb; + } +#endif + + /* Clone the parent's task environment */ + + (void)env_dup(child); + + /* Mark the type of this thread (this setting will be needed in + * task_schedsetup() when up_initial_state() is called. + */ + + child->flags |= TCB_FLAG_TTYPE_TASK; + + /* Get the priority of the parent task */ + +#ifdef CONFIG_PRIORITY_INHERITANCE + priority = parent->base_priority; /* "Normal," unboosted priority */ +#else + priority = parent->sched_priority; /* Current priority */ +#endif + + /* Initialize the task control block. This calls up_initial_state() */ + + ret = task_schedsetup(child, priority, retaddr, parent->entry.main); + if (ret != OK) + { + goto errout_with_tcb; + } + + return child; + +errout_with_tcb: + sched_releasetcb(child); + set_errno(-ret); + return NULL; +} + +/**************************************************************************** + * Name: task_vforkstart + * + * Description: + * The vfork() function has the same effect as fork(), except that the + * behavior is undefined if the process created by vfork() either modifies + * any data other than a variable of type pid_t used to store the return + * value from vfork(), or returns from the function in which vfork() was + * called, or calls any other function before successfully calling _exit() + * or one of the exec family of functions. + * + * This functin provides one step in the overall vfork() sequence: It + * starts execution of the previously initialized TCB. The overall + * sequence is: + * + * 1) User code calls vfork() + * 2) Architecture-specific code provides vfork()and calls task_vforksetup(). + * 3) task_vforksetup() allocates and configures the child task's TCB. This + * consists of: + * - Allocation of the child task's TCB. + * - Initialization of file descriptors and streams + * - Configuration of environment variables + * - Setup the intput parameters for the task. + * - Initialization of the TCB (including call to up_initial_state() + * 4) vfork() provides any additional operating context. vfork must: + * - Allocate and initialize the stack + * - Initialize special values in any CPU registers that were not + * already configured by up_initial_state() + * 5) vfork() then calls task_vforkstart() + * 6) task_vforkstart() then executes the child thread. + * + * Input Paremeters: + * retaddr - The return address from vfork() where the child task + * will be started. + * + * Returned Value: + * Upon successful completion, vfork() returns 0 to the child process and + * returns the process ID of the child process to the parent process. + * Otherwise, -1 is returned to the parent, no child process is created, + * and errno is set to indicate the error. + * + ****************************************************************************/ + +pid_t task_vforkstart(FAR _TCB *child) +{ + FAR const char *name; + pid_t pid; + int ret; + + DEBUGASSERT(child); + + /* Setup to pass parameters to the new task */ + +#if CONFIG_TASK_NAME_SIZE > 0 + name = parent->name; +#else + name = ""; +#endif + + (void)task_argsetup(child, name, (const char **)NULL); + + /* Get the assigned pid before we start the task */ + + pid = (int)child->pid; + + /* Activate the task */ + + ret = task_activate(child); + if (ret != OK) + { + task_vforkabort(child, -ret); + return ERROR; + } + + return pid; +} + +/**************************************************************************** + * Name: task_vforkabort + * + * Description: + * Recover from any errors after task_vforksetup() was called. + * + * Returned Value: + * None + * + ****************************************************************************/ + +void task_vforkabort(FAR _TCB *child, int errcode) +{ + /* The TCB was added to the active task list by task_schedsetup() */ + + dq_rem((FAR dq_entry_t*)child, (dq_queue_t*)&g_inactivetasks); + + /* Release the TCB */ + + sched_releasetcb(child); + set_errno(errcode); +} \ No newline at end of file From 66cdd288ab6a4d19c67300a73a26e9ee5a958187 Mon Sep 17 00:00:00 2001 From: patacongo Date: Mon, 7 Jan 2013 21:41:20 +0000 Subject: [PATCH 041/118] Add ostest vfork test (does not work yet) git-svn-id: http://svn.code.sf.net/p/nuttx/code/trunk@5488 42af7a65-404d-4744-a932-0658087f49c3 --- apps/examples/ostest/Makefile | 4 ++ apps/examples/ostest/ostest.h | 6 ++ apps/examples/ostest/ostest_main.c | 6 ++ apps/examples/ostest/vfork.c | 99 ++++++++++++++++++++++++++++ nuttx/arch/Kconfig | 5 ++ nuttx/arch/arm/src/arm/vfork.S | 10 +-- nuttx/arch/arm/src/armv7-m/vfork.S | 10 +-- nuttx/arch/arm/src/common/up_vfork.c | 45 +++++++++++-- nuttx/sched/sched_addprioritized.c | 2 +- nuttx/sched/sched_addreadytorun.c | 8 +-- nuttx/sched/task_vfork.c | 9 ++- 11 files changed, 182 insertions(+), 22 deletions(-) create mode 100644 apps/examples/ostest/vfork.c diff --git a/apps/examples/ostest/Makefile b/apps/examples/ostest/Makefile index 3d19f6a780..b7ba9a9a87 100644 --- a/apps/examples/ostest/Makefile +++ b/apps/examples/ostest/Makefile @@ -84,6 +84,10 @@ ifneq ($(CONFIG_DISABLE_POSIX_TIMERS),y) CSRCS += posixtimer.c endif +ifeq ($(CONFIG_ARCH_HAVE_VFORK),y) +CSRCS += vfork.c +endif + ifneq ($(CONFIG_DISABLE_SIGNALS),y) ifneq ($(CONFIG_DISABLE_PTHREAD),y) ifeq ($(CONFIG_PRIORITY_INHERITANCE),y) diff --git a/apps/examples/ostest/ostest.h b/apps/examples/ostest/ostest.h index a4af37f05f..bc46a3860c 100644 --- a/apps/examples/ostest/ostest.h +++ b/apps/examples/ostest/ostest.h @@ -163,6 +163,12 @@ extern void barrier_test(void); extern void priority_inheritance(void); +/* vfork.c ******************************************************************/ + +#ifdef CONFIG_ARCH_HAVE_VFORK +extern int vfork_test(void); +#endif + /* APIs exported (conditionally) by the OS specifically for testing of * priority inheritance */ diff --git a/apps/examples/ostest/ostest_main.c b/apps/examples/ostest/ostest_main.c index 46726d515d..ca44353c3d 100644 --- a/apps/examples/ostest/ostest_main.c +++ b/apps/examples/ostest/ostest_main.c @@ -409,6 +409,11 @@ static int user_main(int argc, char *argv[]) check_test_memory_usage(); #endif /* CONFIG_PRIORITY_INHERITANCE && !CONFIG_DISABLE_SIGNALS && !CONFIG_DISABLE_PTHREAD */ +#ifdef CONFIG_ARCH_HAVE_VFORK + printf("\nuser_main: vfork() test\n"); + vfork_test(); +#endif + /* Compare memory usage at time ostest_main started until * user_main exits. These should not be identical, but should * be similar enough that we can detect any serious OS memory @@ -428,6 +433,7 @@ static int user_main(int argc, char *argv[]) show_memory_usage(&g_mmbefore, &g_mmafter); #endif } + printf("user_main: Exitting\n"); return 0; } diff --git a/apps/examples/ostest/vfork.c b/apps/examples/ostest/vfork.c new file mode 100644 index 0000000000..6c83047e30 --- /dev/null +++ b/apps/examples/ostest/vfork.c @@ -0,0 +1,99 @@ +/**************************************************************************** + * examples/ostest/vfork.c + * + * Copyright (C) 2013 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * 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. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include +#include +#include +#include +#include + +#include "ostest.h" + +/**************************************************************************** + * Private Data + ****************************************************************************/ + +#if defined(CONFIG_ARCH_HAVE_VFORK) && !defined(CONFIG_DISABLE_SIGNALS) +static volatile bool g_vforkchild; +#endif + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +int vfork_test(void) +{ +#if defined(CONFIG_ARCH_HAVE_VFORK) && !defined(CONFIG_DISABLE_SIGNALS) + pid_t pid; + + g_vforkchild = false; + pid = vfork(); + if (pid == 0) + { + /* There is not very much that the child is permitted to do. Perhaps + * it can just set g_vforkchild. + */ + + g_vforkchild = true; + exit(0); + } + else if (pid < 0) + { + printf("vfork_test: vfork() failed: %d\n", errno); + return -1; + } + else + { + sleep(1); + if (g_vforkchild) + { + printf("vfork_test: Child %d ran successfully\n", pid); + } + else + { + printf("vfork_test: ERROR Child %d did not run\n", pid); + return -1; + } + } +#endif + + return 0; +} diff --git a/nuttx/arch/Kconfig b/nuttx/arch/Kconfig index f192281439..7d34b56f4d 100644 --- a/nuttx/arch/Kconfig +++ b/nuttx/arch/Kconfig @@ -16,6 +16,7 @@ config ARCH_8051 config ARCH_ARM bool "ARM" select ARCH_HAVE_INTERRUPTSTACK + select ARCH_HAVE_VFORK ---help--- The ARM architectures @@ -124,6 +125,10 @@ config ADDRENV bool default n +config ARCH_HAVE_VFORK + bool + default n + config ARCH_STACKDUMP bool "Dump stack on assertions" default n diff --git a/nuttx/arch/arm/src/arm/vfork.S b/nuttx/arch/arm/src/arm/vfork.S index f0fe17f738..b498fd7f70 100644 --- a/nuttx/arch/arm/src/arm/vfork.S +++ b/nuttx/arch/arm/src/arm/vfork.S @@ -50,7 +50,7 @@ ************************************************************************************/ .file "vfork.S" - .globl task_vfork + .globl up_vfork /************************************************************************************ * Public Functions @@ -66,7 +66,7 @@ * from the function in which vfork() was called, or calls any other function before * successfully calling _exit() or one of the exec family of functions. * - * This thin layer implements vfork by simply calling task_vfork() with the vfork() + * This thin layer implements vfork by simply calling up_vfork() with the vfork() * context as an argument. The overall sequence is: * * 1) User code calls vfork(). vfork() collects context information and @@ -121,12 +121,12 @@ vfork: str r0, [sp, #VFORK_SP_OFFSET] str lr, [sp, #VFORK_LR_OFFSET] - /* Then, call task_vfork(), passing it a pointer to the stack structure */ + /* Then, call up_vfork(), passing it a pointer to the stack structure */ mov r0, sp - bl task_vfork + bl up_vfork - /* Release the stack data and return the value returned by task_vfork */ + /* Release the stack data and return the value returned by up_vfork */ add sp, sp, #VFORK_SIZEOF mov pc, lr diff --git a/nuttx/arch/arm/src/armv7-m/vfork.S b/nuttx/arch/arm/src/armv7-m/vfork.S index aceded4001..0d9e144cdf 100644 --- a/nuttx/arch/arm/src/armv7-m/vfork.S +++ b/nuttx/arch/arm/src/armv7-m/vfork.S @@ -52,7 +52,7 @@ .syntax unified .thumb .file "vfork.S" - .globl task_vfork + .globl up_vfork /************************************************************************************ * Public Functions @@ -68,7 +68,7 @@ * from the function in which vfork() was called, or calls any other function before * successfully calling _exit() or one of the exec family of functions. * - * This thin layer implements vfork by simply calling task_vfork() with the vfork() + * This thin layer implements vfork by simply calling up_vfork() with the vfork() * context as an argument. The overall sequence is: * * 1) User code calls vfork(). vfork() collects context information and @@ -124,12 +124,12 @@ vfork: str r0, [sp, #VFORK_SP_OFFSET] str lr, [sp, #VFORK_LR_OFFSET] - /* Then, call task_vfork(), passing it a pointer to the stack structure */ + /* Then, call up_vfork(), passing it a pointer to the stack structure */ mov r0, sp - bl task_vfork + bl up_vfork - /* Release the stack data and return the value returned by task_vfork */ + /* Release the stack data and return the value returned by up_vfork */ add sp, sp, #VFORK_SIZEOF bx lr diff --git a/nuttx/arch/arm/src/common/up_vfork.c b/nuttx/arch/arm/src/common/up_vfork.c index 404abd1f83..2e3c2d4a1b 100644 --- a/nuttx/arch/arm/src/common/up_vfork.c +++ b/nuttx/arch/arm/src/common/up_vfork.c @@ -43,6 +43,7 @@ #include #include #include +#include #include #include @@ -129,17 +130,28 @@ pid_t up_vfork(struct vfork_s *context) _TCB *child; size_t stacksize; uint32_t newsp; + uint32_t newfp; uint32_t stackutil; int ret; + svdbg("r4:%08x r5:%08x r6:%08x r7:%08x\n", + context->r4, context->r5, context->r6, context->r7); + svdbg("r8:%08x r9:%08x r10:%08x\n", + context->r8, context->r9, context->r10); + svdbg("fp:%08x sp:%08x lr:%08x\n", + context->fp, context->sp, context->lr); + /* Allocate and initialize a TCB for the child task. */ - child = task_vforksetup((start_t)context->lr); + child = task_vforksetup((start_t)(context->lr & ~1)); if (!child) { + sdbg("task_vforksetup failed\n"); return (pid_t)ERROR; } + svdbg("Parent=%p Child=%p\n", parent, child); + /* Get the size of the parent task's stack. Due to alignment operations, * the adjusted stack size may be smaller than the stack size originally * requrested. @@ -152,15 +164,18 @@ pid_t up_vfork(struct vfork_s *context) ret = up_create_stack(child, stacksize); if (ret != OK) { + sdbg("up_create_stack failed: %d\n", ret); task_vforkabort(child, -ret); return (pid_t)ERROR; } /* How much of the parent's stack was utilized? */ - DEBUGASSERT(parent->adj_stack_ptr > context->sp); + DEBUGASSERT((uint32_t)parent->adj_stack_ptr > context->sp); stackutil = (uint32_t)parent->adj_stack_ptr - context->sp; + svdbg("stacksize:%d stackutil:%d\n", stacksize, stackutil); + /* Make some feeble effort to perserve the stack contents. This is * feeble because the stack surely contains invalid pointer and other * content that will not work in the child context. However, if the @@ -170,8 +185,26 @@ pid_t up_vfork(struct vfork_s *context) newsp = (uint32_t)child->adj_stack_ptr - stackutil; memcpy((void *)newsp, (const void *)context->sp, stackutil); - - /* Update the stack pointer, frame pointer, and voltile registers. When + + /* Was there a frame pointer in place before? */ + + if (context->fp <= (uint32_t)parent->adj_stack_ptr && + context->fp >= (uint32_t)parent->adj_stack_ptr - stacksize) + { + uint32_t frameutil = (uint32_t)parent->adj_stack_ptr - context->fp; + newfp = (uint32_t)child->adj_stack_ptr - frameutil; + } + else + { + newfp = context->fp; + } + + svdbg("Old stack base:%08x SP:%08x FP:%08x\n", + parent->adj_stack_ptr, context->sp, context->fp); + svdbg("New stack base:%08x SP:%08x FP:%08x\n", + child->adj_stack_ptr, newsp, newfp); + + /* Update the stack pointer, frame pointer, and voltile registers. When * the child TCB was initialized, all of the values were set to zero. * up_initial_state() altered a few values, but the return value in R0 * should be cleared to zero, providing the indication to the newly started @@ -185,8 +218,8 @@ pid_t up_vfork(struct vfork_s *context) child->xcp.regs[REG_R8] = context->r8; /* Volatile register r8 */ child->xcp.regs[REG_R9] = context->r9; /* Volatile register r9 */ child->xcp.regs[REG_R10] = context->r10; /* Volatile register r10 */ - child->xcp.regs[REG_FP] = context->fp; /* Frame pointer */ - child->xcp.regs[REG_SP] = context->sp; /* Stack pointer */ + child->xcp.regs[REG_FP] = newfp; /* Frame pointer */ + child->xcp.regs[REG_SP] = newsp; /* Stack pointer */ /* And, finally, start the child task. On a failure, task_vforkstart() * will discard the TCB by calling task_vforkabort(). diff --git a/nuttx/sched/sched_addprioritized.c b/nuttx/sched/sched_addprioritized.c index 8f19a4731d..20178fb9c2 100644 --- a/nuttx/sched/sched_addprioritized.c +++ b/nuttx/sched/sched_addprioritized.c @@ -114,7 +114,7 @@ bool sched_addprioritized(FAR _TCB *tcb, DSEG dq_queue_t *list) (next && sched_priority <= next->sched_priority); next = next->flink); - /* Add the tcb to the spot found in the list. Check if the tcb + /* Add the tcb to the spot found in the list. Check if the tcb * goes at the end of the list. NOTE: This could only happen if list * is the g_pendingtasks list! */ diff --git a/nuttx/sched/sched_addreadytorun.c b/nuttx/sched/sched_addreadytorun.c index f6117b6ffe..1e18293433 100644 --- a/nuttx/sched/sched_addreadytorun.c +++ b/nuttx/sched/sched_addreadytorun.c @@ -84,8 +84,8 @@ * btcb - Points to the blocked TCB that is ready-to-run * * Return Value: - * true if the currently active task (the head of the - * g_readytorun list) has changed. + * true if the currently active task (the head of the g_readytorun list) + * has changed. * * Assumptions: * - The caller has established a critical section before @@ -104,7 +104,7 @@ bool sched_addreadytorun(FAR _TCB *btcb) bool ret; /* Check if pre-emption is disabled for the current running task and if - * the new ready-to-run task would cause the current running task to be + * the new ready-to-run task would cause the current running task to be * preempted. */ @@ -123,7 +123,7 @@ bool sched_addreadytorun(FAR _TCB *btcb) else if (sched_addprioritized(btcb, (FAR dq_queue_t*)&g_readytorun)) { - /* Information the instrumentation logic that we are switching tasks */ + /* Inform the instrumentation logic that we are switching tasks */ sched_note_switch(rtcb, btcb); diff --git a/nuttx/sched/task_vfork.c b/nuttx/sched/task_vfork.c index 93fcb46da8..64f6f06366 100644 --- a/nuttx/sched/task_vfork.c +++ b/nuttx/sched/task_vfork.c @@ -43,6 +43,7 @@ #include #include #include +#include #include @@ -151,12 +152,14 @@ FAR _TCB *task_vforksetup(start_t retaddr) /* Initialize the task control block. This calls up_initial_state() */ + svdbg("Child priority=%d start=%p\n", priority, retaddr); ret = task_schedsetup(child, priority, retaddr, parent->entry.main); if (ret != OK) { goto errout_with_tcb; } + svdbg("parent=%p, returning child=%p\n", parent, child); return child; errout_with_tcb: @@ -210,10 +213,14 @@ errout_with_tcb: pid_t task_vforkstart(FAR _TCB *child) { +#if CONFIG_TASK_NAME_SIZE > 0 + _TCB *parent = (FAR _TCB *)g_readytorun.head; +#endif FAR const char *name; pid_t pid; int ret; + svdbg("Starting Child TCB=%p, parent=%p\n", child, g_readytorun.head); DEBUGASSERT(child); /* Setup to pass parameters to the new task */ @@ -221,7 +228,7 @@ pid_t task_vforkstart(FAR _TCB *child) #if CONFIG_TASK_NAME_SIZE > 0 name = parent->name; #else - name = ""; + name = NULL; #endif (void)task_argsetup(child, name, (const char **)NULL); From 5a9162f017e457a5415eb0af7c41a7ef49d355c6 Mon Sep 17 00:00:00 2001 From: patacongo Date: Mon, 7 Jan 2013 23:09:09 +0000 Subject: [PATCH 042/118] Disable the vfork() OS test... it fails git-svn-id: http://svn.code.sf.net/p/nuttx/code/trunk@5489 42af7a65-404d-4744-a932-0658087f49c3 --- apps/examples/ostest/vfork.c | 10 ++++++++++ nuttx/arch/arm/src/common/up_vfork.c | 10 +++++++--- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/apps/examples/ostest/vfork.c b/apps/examples/ostest/vfork.c index 6c83047e30..8657f0cebc 100644 --- a/apps/examples/ostest/vfork.c +++ b/apps/examples/ostest/vfork.c @@ -47,6 +47,16 @@ #include "ostest.h" +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +/* Disabled this test for now. There are some issues with the vfork + * implementation. +*/ + +#undef CONFIG_ARCH_HAVE_VFORK + /**************************************************************************** * Private Data ****************************************************************************/ diff --git a/nuttx/arch/arm/src/common/up_vfork.c b/nuttx/arch/arm/src/common/up_vfork.c index 2e3c2d4a1b..3da6026797 100644 --- a/nuttx/arch/arm/src/common/up_vfork.c +++ b/nuttx/arch/arm/src/common/up_vfork.c @@ -169,7 +169,11 @@ pid_t up_vfork(struct vfork_s *context) return (pid_t)ERROR; } - /* How much of the parent's stack was utilized? */ + /* How much of the parent's stack was utilized? The ARM uses + * a push-down stack so that the current stack pointer should + * be lower than the initial, adjusted stack pointer. The + * stack usage should be the difference between those two. + */ DEBUGASSERT((uint32_t)parent->adj_stack_ptr > context->sp); stackutil = (uint32_t)parent->adj_stack_ptr - context->sp; @@ -177,7 +181,7 @@ pid_t up_vfork(struct vfork_s *context) svdbg("stacksize:%d stackutil:%d\n", stacksize, stackutil); /* Make some feeble effort to perserve the stack contents. This is - * feeble because the stack surely contains invalid pointer and other + * feeble because the stack surely contains invalid pointers and other * content that will not work in the child context. However, if the * user follows all of the caveats of vfor() usage, even this feeble * effort is overkill. @@ -204,7 +208,7 @@ pid_t up_vfork(struct vfork_s *context) svdbg("New stack base:%08x SP:%08x FP:%08x\n", child->adj_stack_ptr, newsp, newfp); - /* Update the stack pointer, frame pointer, and voltile registers. When + /* Update the stack pointer, frame pointer, and voltile registers. When * the child TCB was initialized, all of the values were set to zero. * up_initial_state() altered a few values, but the return value in R0 * should be cleared to zero, providing the indication to the newly started From a9f2c6fa8ae6936da9489e4acf2a2d2cd6c0f664 Mon Sep 17 00:00:00 2001 From: patacongo Date: Mon, 7 Jan 2013 23:50:25 +0000 Subject: [PATCH 043/118] Fixed ARM vfork; re-enabled vfork OS test git-svn-id: http://svn.code.sf.net/p/nuttx/code/trunk@5490 42af7a65-404d-4744-a932-0658087f49c3 --- apps/examples/ostest/vfork.c | 6 ------ nuttx/arch/arm/src/arm/vfork.S | 3 ++- nuttx/arch/arm/src/armv7-m/vfork.S | 3 ++- nuttx/arch/arm/src/common/up_vfork.c | 2 +- 4 files changed, 5 insertions(+), 9 deletions(-) diff --git a/apps/examples/ostest/vfork.c b/apps/examples/ostest/vfork.c index 8657f0cebc..4e1b8c8925 100644 --- a/apps/examples/ostest/vfork.c +++ b/apps/examples/ostest/vfork.c @@ -51,12 +51,6 @@ * Pre-processor Definitions ****************************************************************************/ -/* Disabled this test for now. There are some issues with the vfork - * implementation. -*/ - -#undef CONFIG_ARCH_HAVE_VFORK - /**************************************************************************** * Private Data ****************************************************************************/ diff --git a/nuttx/arch/arm/src/arm/vfork.S b/nuttx/arch/arm/src/arm/vfork.S index b498fd7f70..226d9f7de4 100644 --- a/nuttx/arch/arm/src/arm/vfork.S +++ b/nuttx/arch/arm/src/arm/vfork.S @@ -102,7 +102,7 @@ vfork: /* Create a stack frame */ - mov r0, sp /* Save the value of the stack frame on entry */ + mov r0, sp /* Save the value of the stack on entry */ sub sp, sp, #VFORK_SIZEOF /* Allocate the structure on the stack */ /* Save the volatile registers */ @@ -128,6 +128,7 @@ vfork: /* Release the stack data and return the value returned by up_vfork */ + ldr lr, [sp, #VFORK_LR_OFFSET] add sp, sp, #VFORK_SIZEOF mov pc, lr .size vfork, .-vfork diff --git a/nuttx/arch/arm/src/armv7-m/vfork.S b/nuttx/arch/arm/src/armv7-m/vfork.S index 0d9e144cdf..386fca33c4 100644 --- a/nuttx/arch/arm/src/armv7-m/vfork.S +++ b/nuttx/arch/arm/src/armv7-m/vfork.S @@ -105,7 +105,7 @@ vfork: /* Create a stack frame */ - mov r0, sp /* Save the value of the stack frame on entry */ + mov r0, sp /* Save the value of the stack on entry */ sub sp, sp, #VFORK_SIZEOF /* Allocate the structure on the stack */ /* Save the volatile registers */ @@ -131,6 +131,7 @@ vfork: /* Release the stack data and return the value returned by up_vfork */ + ldr lr, [sp, #VFORK_LR_OFFSET] add sp, sp, #VFORK_SIZEOF bx lr .size vfork, .-vfork diff --git a/nuttx/arch/arm/src/common/up_vfork.c b/nuttx/arch/arm/src/common/up_vfork.c index 3da6026797..5349378bc4 100644 --- a/nuttx/arch/arm/src/common/up_vfork.c +++ b/nuttx/arch/arm/src/common/up_vfork.c @@ -124,7 +124,7 @@ * ****************************************************************************/ -pid_t up_vfork(struct vfork_s *context) +pid_t up_vfork(const struct vfork_s *context) { _TCB *parent = (FAR _TCB *)g_readytorun.head; _TCB *child; From 3d160e45b64485aa5f231179bf61cdea8fc5c141 Mon Sep 17 00:00:00 2001 From: patacongo Date: Tue, 8 Jan 2013 00:04:12 +0000 Subject: [PATCH 044/118] Documentation update git-svn-id: http://svn.code.sf.net/p/nuttx/code/trunk@5491 42af7a65-404d-4744-a932-0658087f49c3 --- apps/ChangeLog.txt | 1 + nuttx/Documentation/NuttX.html | 2 +- nuttx/Documentation/NuttxPortingGuide.html | 2 +- nuttx/Documentation/NuttxUserGuide.html | 39 +++++++++++++++++++++- 4 files changed, 41 insertions(+), 3 deletions(-) diff --git a/apps/ChangeLog.txt b/apps/ChangeLog.txt index 0464c61988..cd15b430db 100644 --- a/apps/ChangeLog.txt +++ b/apps/ChangeLog.txt @@ -460,4 +460,5 @@ updated to detect key release events. That is kind of tricky in the USB HID keyboard report data. * apps/examples/wlan: Remove non-functional example. + * apps/examples/ostest/vfork.c: Added a test of vfork(). diff --git a/nuttx/Documentation/NuttX.html b/nuttx/Documentation/NuttX.html index 876aa2a0ac..21f732c970 100644 --- a/nuttx/Documentation/NuttX.html +++ b/nuttx/Documentation/NuttX.html @@ -8,7 +8,7 @@

            NuttX RTOS

            -

            Last Updated: January 4, 2012

            +

            Last Updated: January 4, 2013

            diff --git a/nuttx/Documentation/NuttxPortingGuide.html b/nuttx/Documentation/NuttxPortingGuide.html index 24b4852e03..48fafb89f5 100644 --- a/nuttx/Documentation/NuttxPortingGuide.html +++ b/nuttx/Documentation/NuttxPortingGuide.html @@ -12,7 +12,7 @@

            NuttX RTOS Porting Guide

            -

            Last Updated: January 4, 2012

            +

            Last Updated: January 4, 2013

            diff --git a/nuttx/Documentation/NuttxUserGuide.html b/nuttx/Documentation/NuttxUserGuide.html index d9dddf9be6..5c76737e5a 100644 --- a/nuttx/Documentation/NuttxUserGuide.html +++ b/nuttx/Documentation/NuttxUserGuide.html @@ -13,7 +13,7 @@

            NuttX Operating System

            User's Manual

            by

            Gregory Nutt

            -

            Last Updated: November 20, 2012

            +

            Last Updated: January 7, 2013

            @@ -201,6 +201,7 @@ paragraphs.
          • 2.1.5 exit
          • 2.1.6 task_restart
          • 2.1.7 getpid
          • +
          • 2.1.8 vfork

          2.1.1 task_create

          @@ -613,6 +614,40 @@ level. Compatible with the POSIX interface of the same name.

          +

          2.1.8 vfork

          +

          + Function Prototype: +

          +
            +#include <unistd.h>
            +pid_t vfork(void);
            +
          +

          + Description: + The vfork() function has the same effect as fork(), except that the behavior is undefined if the process created by vfork() either modifies any data other than a variable of type pid_t used to store the return value from vfork(), or returns from the function in which vfork() was called, or calls any other function before successfully calling _exit() or one of the exec family of functions. +

          +

          + NOTE: + vfork() is not an independent NuttX feature, but is implemented in architecture-specific logic (using only helper functions from the NuttX core logic). + As a result, vfork() may not be available on all architectures. +
          +

          + Input Parameters: + None. +

          +

          + Returned Value: + Upon successful completion, vfork() returns 0 to the child process and returns + the process ID of the child process to the parent process. + Otherwise, -1 is returned to the parent, no child process is created, and errno is set to indicate the error. +

          + Assumptions/Limitations: +

          +

          + POSIX Compatibility: + Compatible with the Unix interface of the same name. +

          + @@ -536,7 +536,7 @@ @@ -1009,7 +1009,7 @@ This configuration file contains a long list of settings that control what is built into NuttX and what is not. There are hundreds of such settings - (see the NuttX Porting Guide + (see the NuttX Porting Guide for a partial list that excludes platform specific settings). These many, many configuration options allow NuttX to be highly tuned to meet size requirements. @@ -3837,7 +3837,7 @@ pascal-3.0 2011-05-15 Gregory Nutt <gnutt@nuttx.org> - + diff --git a/nuttx/Documentation/NuttxPortingGuide.html b/nuttx/Documentation/NuttxPortingGuide.html index 0b67eddb74..fec7106b00 100644 --- a/nuttx/Documentation/NuttxPortingGuide.html +++ b/nuttx/Documentation/NuttxPortingGuide.html @@ -12,7 +12,7 @@

          NuttX RTOS Porting Guide

          -

          Last Updated: January 12, 2013

          +

          Last Updated: January 13, 2013

          @@ -6741,6 +6776,7 @@ int telldir(FAR DIR *dirp);
             #include <unistd.h>
             
            +pid_t   vfork(void);
             pid_t   getpid(void);
             void    _exit(int status) noreturn_function;
             unsigned int sleep(unsigned int seconds);
            @@ -8363,6 +8399,7 @@ notify a task when a message is available on a queue.
               
          • unistd.h, unistd.h
          • unlink
          • +
          • vfork
          • vfprintf
          • vprintf
          • vsprintf
          • From 14f72f7a210648fe6eaaac3359ec76cab62c7278 Mon Sep 17 00:00:00 2001 From: patacongo Date: Tue, 8 Jan 2013 16:25:30 +0000 Subject: [PATCH 045/118] Add execv() and execl(); Move lm3s header files for compatibility git-svn-id: http://svn.code.sf.net/p/nuttx/code/trunk@5492 42af7a65-404d-4744-a932-0658087f49c3 --- nuttx/ChangeLog | 12 ++ nuttx/Documentation/NuttxUserGuide.html | 15 +- nuttx/arch/arm/include/lm3s/chip.h | 123 +++++++++++++ nuttx/arch/arm/src/lm3s/chip.h | 79 +------- nuttx/arch/arm/src/lm3s/{ => chip}/lm3s_epi.h | 10 +- .../arm/src/lm3s/{ => chip}/lm3s_ethernet.h | 10 +- .../arch/arm/src/lm3s/{ => chip}/lm3s_flash.h | 10 +- .../arch/arm/src/lm3s/{ => chip}/lm3s_gpio.h | 10 +- nuttx/arch/arm/src/lm3s/{ => chip}/lm3s_i2c.h | 10 +- .../arm/src/lm3s/{ => chip}/lm3s_memorymap.h | 8 +- nuttx/arch/arm/src/lm3s/{ => chip}/lm3s_ssi.h | 10 +- .../arm/src/lm3s/{ => chip}/lm3s_syscontrol.h | 10 +- .../arch/arm/src/lm3s/{ => chip}/lm3s_timer.h | 8 +- .../arch/arm/src/lm3s/{ => chip}/lm3s_uart.h | 10 +- nuttx/arch/arm/src/lm3s/chip/lm_memorymap.h | 69 +++++++ nuttx/binfmt/binfmt_exec.c | 21 ++- nuttx/include/nuttx/binfmt/binfmt.h | 3 +- nuttx/include/unistd.h | 7 + nuttx/libc/Kconfig | 48 +++++ nuttx/libc/unistd/Make.defs | 4 + nuttx/libc/unistd/lib_execl.c | 146 +++++++++++++++ nuttx/libc/unistd/lib_execv.c | 168 ++++++++++++++++++ nuttx/tools/cfgdefine.c | 1 + 23 files changed, 669 insertions(+), 123 deletions(-) create mode 100644 nuttx/arch/arm/include/lm3s/chip.h rename nuttx/arch/arm/src/lm3s/{ => chip}/lm3s_epi.h (95%) rename nuttx/arch/arm/src/lm3s/{ => chip}/lm3s_ethernet.h (97%) rename nuttx/arch/arm/src/lm3s/{ => chip}/lm3s_flash.h (96%) rename nuttx/arch/arm/src/lm3s/{ => chip}/lm3s_gpio.h (99%) rename nuttx/arch/arm/src/lm3s/{ => chip}/lm3s_i2c.h (97%) rename nuttx/arch/arm/src/lm3s/{ => chip}/lm3s_memorymap.h (99%) rename nuttx/arch/arm/src/lm3s/{ => chip}/lm3s_ssi.h (98%) rename nuttx/arch/arm/src/lm3s/{ => chip}/lm3s_syscontrol.h (99%) rename nuttx/arch/arm/src/lm3s/{ => chip}/lm3s_timer.h (97%) rename nuttx/arch/arm/src/lm3s/{ => chip}/lm3s_uart.h (98%) create mode 100644 nuttx/arch/arm/src/lm3s/chip/lm_memorymap.h create mode 100644 nuttx/libc/unistd/lib_execl.c create mode 100644 nuttx/libc/unistd/lib_execv.c diff --git a/nuttx/ChangeLog b/nuttx/ChangeLog index e2d8a586b3..ee6b088cf0 100644 --- a/nuttx/ChangeLog +++ b/nuttx/ChangeLog @@ -3880,4 +3880,16 @@ OS layered architecture. * include/unistd.h, arch/arch/src/*: Implement a simple vfork(). On initial checkin, this API is available only for ARM platforms. + * binfmt/binfmt_exec.c: exec() now sets the priority of the new task + to the same priority as the current task (instead of the arbirtrary + value of 50). + * libc/unisted/lib_execv.c and lib_execl.c: New, somewhat flawed, + implementations of execv() and execl(). + * tools/cfgdefine.c: Strips quotes from CONFIG_EXECFUNCS_SYMTAB + value. + * arch/arm/include/lm3s/chip.h: Move chip definitions into + public include area for compatibility with other architectures. + * arch/arm/src/lm3s/chip: Move register definition header files + into a new chip/ sub-directory. + diff --git a/nuttx/Documentation/NuttxUserGuide.html b/nuttx/Documentation/NuttxUserGuide.html index 5c76737e5a..918b69d0fa 100644 --- a/nuttx/Documentation/NuttxUserGuide.html +++ b/nuttx/Documentation/NuttxUserGuide.html @@ -202,6 +202,8 @@ paragraphs.
          • 2.1.6 task_restart
          • 2.1.7 getpid
          • 2.1.8 vfork
          • +
          • 2.1.9 execv
          • +
          • 2.1.10 execl

          2.1.1 task_create

          @@ -648,6 +650,9 @@ pid_t vfork(void); Compatible with the Unix interface of the same name.

          +

          2.1.9 execv

          +

          2.1.10 execl

          +
          @@ -6798,6 +6803,12 @@ FAR char *getcwd(FAR char *buf, size_t size); int unlink(FAR const char *pathname); int rmdir(FAR const char *pathname); + +#ifdef CONFIG_LIBC_EXECFUNCS +int execl(FAR const char *path, ...); +int execv(FAR const char *path, FAR char *const argv[]); +#endif + int getopt(int argc, FAR char *const argv[], FAR const char *optstring); @@ -8198,7 +8209,9 @@ notify a task when a message is available on a queue.
        • Driver operations
        • dup
        • dup2
        • +
        • execl
        • eXecute In Place (XIP)
        • +
        • execv
        • exit
        • FAT File System Support
        • fclose
        • @@ -8333,9 +8346,9 @@ notify a task when a message is available on a queue.
        • ROMFS
        • sched_getparam
        • sched_get_priority_max
        • +
        • sched_get_priority_min
        • -
        • sched_get_priority_min
        • sched_get_rr_interval
        • sched_lockcount
        • sched_lock
        • diff --git a/nuttx/arch/arm/include/lm3s/chip.h b/nuttx/arch/arm/include/lm3s/chip.h new file mode 100644 index 0000000000..d7e98a4613 --- /dev/null +++ b/nuttx/arch/arm/include/lm3s/chip.h @@ -0,0 +1,123 @@ +/************************************************************************************ + * arch/arm/include/lm3s/chip.h + * + * Copyright (C) 2009-2010, 2013 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * 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. + * + ************************************************************************************/ + +#ifndef __ARCH_ARM_INCLUDE_LM3S_CHIP_H +#define __ARCH_ARM_INCLUDE_LM3S_CHIP_H + +/************************************************************************************ + * Included Files + ************************************************************************************/ + +#include + +/************************************************************************************ + * Pre-processor Definitions + ************************************************************************************/ + +/* Get customizations for each supported chip (only the LM3S6918 and 65 right now) */ + +#if defined(CONFIG_ARCH_CHIP_LM3S6918) +# define LM3S_NTIMERS 4 /* Four general purpose timers */ +# define LM3S_NETHCONTROLLERS 1 /* One Ethernet controller */ +# undef LM3S_ETHTS /* No timestamp register */ +# define LM3S_NSSI 2 /* Two SSI modules */ +# define LM3S_NUARTS 2 /* Two UART modules */ +# define LM3S_NI2C 2 /* Two I2C modules */ +# define LM3S_NADC 1 /* One ADC module */ +# define LM2S_NPWM 0 /* No PWM generator modules */ +# define LM3S_NQEI 0 /* No quadrature encoders */ +# define LM3S_NPORTS 8 /* 8 Ports (GPIOA-H) 5-38 GPIOs */ +#elif defined(CONFIG_ARCH_CHIP_LM3S6432) +# define LM3S_NTIMERS 3 /* Three general purpose timers */ +# define LM3S_NETHCONTROLLERS 1 /* One Ethernet controller */ +# undef LM3S_ETHTS /* No timestamp register */ +# define LM3S_NSSI 1 /* One SSI module */ +# define LM3S_NUARTS 2 /* Two UART modules */ +# define LM3S_NI2C 1 /* Two I2C modules */ +# define LM3S_NADC 1 /* One ADC module */ +# define LM2S_NPWM 1 /* One PWM generator module */ +# define LM3S_NQEI 0 /* No quadrature encoders */ +# define LM3S_NPORTS 7 /* 7 Ports (GPIOA-G), 0-42 GPIOs */ +#elif defined(CONFIG_ARCH_CHIP_LM3S6965) +# define LM3S_NTIMERS 4 /* Four general purpose timers */ +# define LM3S_NETHCONTROLLERS 1 /* One Ethernet controller */ +# undef LM3S_ETHTS /* No timestamp register */ +# define LM3S_NSSI 1 /* One SSI module */ +# define LM3S_NUARTS 3 /* Three UART modules */ +# define LM3S_NI2C 2 /* Two I2C modules */ +# define LM3S_NADC 1 /* One ADC module */ +# define LM2S_NPWM 3 /* Three PWM generator modules */ +# define LM3S_NQEI 2 /* Two quadrature encoders */ +# define LM3S_NPORTS 7 /* 7 Ports (GPIOA-G), 0-42 GPIOs */ +#elif defined(CONFIG_ARCH_CHIP_LM3S9B96) +# define LM3S_NTIMERS 4 /* Four general purpose timers */ +# define LM3S_NETHCONTROLLERS 1 /* One Ethernet controller */ +# undef LM3S_ETHTS /* No timestamp register */ +# define LM3S_NSSI 2 /* Two SSI modules */ +# define LM3S_NUARTS 3 /* Three UART modules */ +# define LM3S_NI2C 2 /* Two I2C modules */ +# define LM3S_NADC 2 /* Two ADC module */ +# define LM3S_CAN 2 /* Two CAN module */ +# define LM3S_NPWM 4 /* Four PWM generator modules */ +# define LM3S_NQEI 2 /* Two quadrature encoders */ +# define LM3S_NPORTS 9 /* 9 Ports (GPIOA-H,J) 0-65 GPIOs */ +#elif defined(CONFIG_ARCH_CHIP_LM3S8962) +# define LM3S_NTIMERS 4 /* Four general purpose timers */ +# define LM3S_NETHCONTROLLERS 1 /* One Ethernet controller */ +# define LM3S_NSSI 1 /* One SSI module */ +# define LM3S_NUARTS 3 /* Two UART modules */ +# define LM3S_NI2C 2 /* One I2C module */ +# define LM3S_NADC 1 /* One ADC module */ +# define LM2S_NPWM 3 /* Three PWM generator modules */ +# define LM3S_NQEI 2 /* Two quadrature encoders */ +# define LM3S_NPORTS 7 /* 7 Ports (GPIOA-G), 5-42 GPIOs */ +# define LC3S_CANCONTROLLER 1 /* One CAN controller */ +#else +# error "Capabilities not specified for this LM3S chip" +#endif + +/************************************************************************************ + * Public Types + ************************************************************************************/ + +/************************************************************************************ + * Public Data + ************************************************************************************/ + +/**************************************************************************** + * Public Function Prototypes + ****************************************************************************/ + +#endif /* __ARCH_ARM_INCLUDE_LM3S_CHIP_H */ diff --git a/nuttx/arch/arm/src/lm3s/chip.h b/nuttx/arch/arm/src/lm3s/chip.h index 1e22f6221c..1e96b5222b 100644 --- a/nuttx/arch/arm/src/lm3s/chip.h +++ b/nuttx/arch/arm/src/lm3s/chip.h @@ -41,83 +41,22 @@ ************************************************************************************/ #include +#include /************************************************************************************ * Pre-processor Definitions ************************************************************************************/ -/* Get customizations for each supported chip (only the LM3S6918 and 65 right now) */ - -#if defined(CONFIG_ARCH_CHIP_LM3S6918) -# define LM3S_NTIMERS 4 /* Four general purpose timers */ -# define LM3S_NETHCONTROLLERS 1 /* One Ethernet controller */ -# undef LM3S_ETHTS /* No timestamp register */ -# define LM3S_NSSI 2 /* Two SSI modules */ -# define LM3S_NUARTS 2 /* Two UART modules */ -# define LM3S_NI2C 2 /* Two I2C modules */ -# define LM3S_NADC 1 /* One ADC module */ -# define LM2S_NPWM 0 /* No PWM generator modules */ -# define LM3S_NQEI 0 /* No quadrature encoders */ -# define LM3S_NPORTS 8 /* 8 Ports (GPIOA-H) 5-38 GPIOs */ -#elif defined(CONFIG_ARCH_CHIP_LM3S6432) -# define LM3S_NTIMERS 3 /* Three general purpose timers */ -# define LM3S_NETHCONTROLLERS 1 /* One Ethernet controller */ -# undef LM3S_ETHTS /* No timestamp register */ -# define LM3S_NSSI 1 /* One SSI module */ -# define LM3S_NUARTS 2 /* Two UART modules */ -# define LM3S_NI2C 1 /* Two I2C modules */ -# define LM3S_NADC 1 /* One ADC module */ -# define LM2S_NPWM 1 /* One PWM generator module */ -# define LM3S_NQEI 0 /* No quadrature encoders */ -# define LM3S_NPORTS 7 /* 7 Ports (GPIOA-G), 0-42 GPIOs */ -#elif defined(CONFIG_ARCH_CHIP_LM3S6965) -# define LM3S_NTIMERS 4 /* Four general purpose timers */ -# define LM3S_NETHCONTROLLERS 1 /* One Ethernet controller */ -# undef LM3S_ETHTS /* No timestamp register */ -# define LM3S_NSSI 1 /* One SSI module */ -# define LM3S_NUARTS 3 /* Three UART modules */ -# define LM3S_NI2C 2 /* Two I2C modules */ -# define LM3S_NADC 1 /* One ADC module */ -# define LM2S_NPWM 3 /* Three PWM generator modules */ -# define LM3S_NQEI 2 /* Two quadrature encoders */ -# define LM3S_NPORTS 7 /* 7 Ports (GPIOA-G), 0-42 GPIOs */ -#elif defined(CONFIG_ARCH_CHIP_LM3S9B96) -# define LM3S_NTIMERS 4 /* Four general purpose timers */ -# define LM3S_NETHCONTROLLERS 1 /* One Ethernet controller */ -# undef LM3S_ETHTS /* No timestamp register */ -# define LM3S_NSSI 2 /* Two SSI modules */ -# define LM3S_NUARTS 3 /* Three UART modules */ -# define LM3S_NI2C 2 /* Two I2C modules */ -# define LM3S_NADC 2 /* Two ADC module */ -# define LM3S_CAN 2 /* Two CAN module */ -# define LM3S_NPWM 4 /* Four PWM generator modules */ -# define LM3S_NQEI 2 /* Two quadrature encoders */ -# define LM3S_NPORTS 9 /* 9 Ports (GPIOA-H,J) 0-65 GPIOs */ -#elif defined(CONFIG_ARCH_CHIP_LM3S8962) -# define LM3S_NTIMERS 4 /* Four general purpose timers */ -# define LM3S_NETHCONTROLLERS 1 /* One Ethernet controller */ -# define LM3S_NSSI 1 /* One SSI module */ -# define LM3S_NUARTS 3 /* Two UART modules */ -# define LM3S_NI2C 2 /* One I2C module */ -# define LM3S_NADC 1 /* One ADC module */ -# define LM2S_NPWM 3 /* Three PWM generator modules */ -# define LM3S_NQEI 2 /* Two quadrature encoders */ -# define LM3S_NPORTS 7 /* 7 Ports (GPIOA-G), 5-42 GPIOs */ -# define LC3S_CANCONTROLLER 1 /* One CAN controller */ -#else -# error "Capabilities not specified for this LM3S chip" -#endif - /* Then get all of the register definitions */ -#include "lm3s_memorymap.h" /* Memory map */ -#include "lm3s_syscontrol.h" /* System control module */ -#include "lm3s_gpio.h" /* GPIO modules */ -#include "lm3s_uart.h" /* UART modules */ -#include "lm3s_i2c.h" /* I2C modules */ -#include "lm3s_ssi.h" /* SSI modules */ -#include "lm3s_ethernet.h" /* Ethernet MAC and PHY */ -#include "lm3s_flash.h" /* FLASH */ +#include "chip/lm_memorymap.h" /* Memory map */ +#include "chip/lm3s_syscontrol.h" /* System control module */ +#include "chip/lm3s_gpio.h" /* GPIO modules */ +#include "chip/lm3s_uart.h" /* UART modules */ +#include "chip/lm3s_i2c.h" /* I2C modules */ +#include "chip/lm3s_ssi.h" /* SSI modules */ +#include "chip/lm3s_ethernet.h" /* Ethernet MAC and PHY */ +#include "chip/lm3s_flash.h" /* FLASH */ /************************************************************************************ * Public Types diff --git a/nuttx/arch/arm/src/lm3s/lm3s_epi.h b/nuttx/arch/arm/src/lm3s/chip/lm3s_epi.h similarity index 95% rename from nuttx/arch/arm/src/lm3s/lm3s_epi.h rename to nuttx/arch/arm/src/lm3s/chip/lm3s_epi.h index 90c9bfb7f9..5b54d44ac4 100644 --- a/nuttx/arch/arm/src/lm3s/lm3s_epi.h +++ b/nuttx/arch/arm/src/lm3s/chip/lm3s_epi.h @@ -1,7 +1,7 @@ /************************************************************************************ - * arch/arm/src/lm3s/lm3s_epi.h + * arch/arm/src/lm3s/chip/lm3s_epi.h * - * Copyright (C) 2009-2012 Max Neklyudov. All rights reserved. + * Copyright (C) 2009-2013 Max Neklyudov. All rights reserved. * Author: Max Neklyudov * * Redistribution and use in source and binary forms, with or without @@ -33,8 +33,8 @@ * ************************************************************************************/ -#ifndef __ARCH_ARM_SRC_LM3S_LM3S_EPI_H -#define __ARCH_ARM_SRC_LM3S_LM3S_EPI_H +#ifndef __ARCH_ARM_SRC_LM3S_CHIP_LM3S_EPI_H +#define __ARCH_ARM_SRC_LM3S_CHIP_LM3S_EPI_H /************************************************************************************ * Included Files @@ -110,4 +110,4 @@ #define EPI_BAUD_COUNT0_MASK (0xFFFF << EPI_BAUD_COUNT0_SHIFT) # define EPI_BAUD_COUNT0(n) ((n) << EPI_BAUD_COUNT0_SHIFT) -#endif /* __ARCH_ARM_SRC_LM3S_LM3S_EPI_H */ +#endif /* __ARCH_ARM_SRC_LM3S_CHIP_LM3S_EPI_H */ diff --git a/nuttx/arch/arm/src/lm3s/lm3s_ethernet.h b/nuttx/arch/arm/src/lm3s/chip/lm3s_ethernet.h similarity index 97% rename from nuttx/arch/arm/src/lm3s/lm3s_ethernet.h rename to nuttx/arch/arm/src/lm3s/chip/lm3s_ethernet.h index 71833b2716..940686e7de 100644 --- a/nuttx/arch/arm/src/lm3s/lm3s_ethernet.h +++ b/nuttx/arch/arm/src/lm3s/chip/lm3s_ethernet.h @@ -1,7 +1,7 @@ /************************************************************************************ - * arch/arm/src/lm3s/lm3s_ethernet.h + * arch/arm/src/lm3s/chip/lm3s_ethernet.h * - * Copyright (C) 2009-2010, 2012 Gregory Nutt. All rights reserved. + * Copyright (C) 2009-2010, 2012-2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -33,8 +33,8 @@ * ************************************************************************************/ -#ifndef __ARCH_ARM_SRC_LM3S_LM3S_ETHERNET_H -#define __ARCH_ARM_SRC_LM3S_LM3S_ETHERNET_H +#ifndef __ARCH_ARM_SRC_LM3S_CHIP_LM3S_ETHERNET_H +#define __ARCH_ARM_SRC_LM3S_CHIP_LM3S_ETHERNET_H /************************************************************************************ * Included Files @@ -200,4 +200,4 @@ * Public Function Prototypes ************************************************************************************/ -#endif /* __ARCH_ARM_SRC_LM3S_LM3S_ETHERNET_H */ +#endif /* __ARCH_ARM_SRC_LM3S_CHIP_LM3S_ETHERNET_H */ diff --git a/nuttx/arch/arm/src/lm3s/lm3s_flash.h b/nuttx/arch/arm/src/lm3s/chip/lm3s_flash.h similarity index 96% rename from nuttx/arch/arm/src/lm3s/lm3s_flash.h rename to nuttx/arch/arm/src/lm3s/chip/lm3s_flash.h index 83e3889214..2bd8956b0a 100644 --- a/nuttx/arch/arm/src/lm3s/lm3s_flash.h +++ b/nuttx/arch/arm/src/lm3s/chip/lm3s_flash.h @@ -1,7 +1,7 @@ /************************************************************************************ - * arch/arm/src/lm3s/lm3s_flash.h + * arch/arm/src/lm3s/chip/lm3s_flash.h * - * Copyright (C) 2009 Gregory Nutt. All rights reserved. + * Copyright (C) 2009, 2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -33,8 +33,8 @@ * ************************************************************************************/ -#ifndef __ARCH_ARM_SRC_LM3S_LM3S_FLASH_H -#define __ARCH_ARM_SRC_LM3S_LM3S_FLASH_H +#ifndef __ARCH_ARM_SRC_LM3S_CHIP_LM3S_FLASH_H +#define __ARCH_ARM_SRC_LM3S_CHIP_LM3S_FLASH_H /************************************************************************************ * Included Files @@ -125,4 +125,4 @@ * Public Function Prototypes ************************************************************************************/ -#endif /* __ARCH_ARM_SRC_LM3S_LM3S_FLASH_H */ +#endif /* __ARCH_ARM_SRC_LM3S_CHIP_LM3S_FLASH_H */ diff --git a/nuttx/arch/arm/src/lm3s/lm3s_gpio.h b/nuttx/arch/arm/src/lm3s/chip/lm3s_gpio.h similarity index 99% rename from nuttx/arch/arm/src/lm3s/lm3s_gpio.h rename to nuttx/arch/arm/src/lm3s/chip/lm3s_gpio.h index 0666664329..7253c1e7a8 100644 --- a/nuttx/arch/arm/src/lm3s/lm3s_gpio.h +++ b/nuttx/arch/arm/src/lm3s/chip/lm3s_gpio.h @@ -1,7 +1,7 @@ /************************************************************************************ - * arch/arm/src/lm3s/lm3s_gpio.h + * arch/arm/src/lm3s/chip/lm3s_gpio.h * - * Copyright (C) 2009-2010 Gregory Nutt. All rights reserved. + * Copyright (C) 2009-2010, 2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -33,8 +33,8 @@ * ************************************************************************************/ -#ifndef __ARCH_ARM_SRC_LM3S_LM3S_GPIO_H -#define __ARCH_ARM_SRC_LM3S_LM3S_GPIO_H +#ifndef __ARCH_ARM_SRC_LM3S_CHIP_LM3S_GPIO_H +#define __ARCH_ARM_SRC_LM3S_CHIP_LM3S_GPIO_H /************************************************************************************ * Included Files @@ -392,4 +392,4 @@ * Public Function Prototypes ************************************************************************************/ -#endif /* __ARCH_ARM_SRC_LM3S_LM3S_GPIO_H */ +#endif /* __ARCH_ARM_SRC_LM3S_CHIP_LM3S_GPIO_H */ diff --git a/nuttx/arch/arm/src/lm3s/lm3s_i2c.h b/nuttx/arch/arm/src/lm3s/chip/lm3s_i2c.h similarity index 97% rename from nuttx/arch/arm/src/lm3s/lm3s_i2c.h rename to nuttx/arch/arm/src/lm3s/chip/lm3s_i2c.h index a5f0567b98..71ebe8fcf2 100644 --- a/nuttx/arch/arm/src/lm3s/lm3s_i2c.h +++ b/nuttx/arch/arm/src/lm3s/chip/lm3s_i2c.h @@ -1,7 +1,7 @@ /************************************************************************************ - * arch/arm/src/lm3s/lm3s_i2c.h + * arch/arm/src/lm3s/chip/lm3s_i2c.h * - * Copyright (C) 2009 Gregory Nutt. All rights reserved. + * Copyright (C) 2009, 2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -33,8 +33,8 @@ * ************************************************************************************/ -#ifndef __ARCH_ARM_SRC_LM3S_LM3S_I2C_H -#define __ARCH_ARM_SRC_LM3S_LM3S_I2C_H +#ifndef __ARCH_ARM_SRC_LM3S_CHIP_LM3S_I2C_H +#define __ARCH_ARM_SRC_LM3S_CHIP_LM3S_I2C_H /************************************************************************************ * Included Files @@ -244,4 +244,4 @@ * Public Function Prototypes ****************************************************************************/ -#endif /* __ARCH_ARM_SRC_LM3S_LM3S_I2C_H */ +#endif /* __ARCH_ARM_SRC_LM3S_CHIP_LM3S_I2C_H */ diff --git a/nuttx/arch/arm/src/lm3s/lm3s_memorymap.h b/nuttx/arch/arm/src/lm3s/chip/lm3s_memorymap.h similarity index 99% rename from nuttx/arch/arm/src/lm3s/lm3s_memorymap.h rename to nuttx/arch/arm/src/lm3s/chip/lm3s_memorymap.h index be0d8b58d7..31dc2b2490 100644 --- a/nuttx/arch/arm/src/lm3s/lm3s_memorymap.h +++ b/nuttx/arch/arm/src/lm3s/chip/lm3s_memorymap.h @@ -1,5 +1,5 @@ /************************************************************************************ - * arch/arm/src/lm3s/lm3s_memorymap.h + * arch/arm/src/lm3s/chip/lm3s_memorymap.h * * Copyright (C) 2009-2010 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -33,8 +33,8 @@ * ************************************************************************************/ -#ifndef __ARCH_ARM_SRC_LM3S_LM3S_MEMORYMAP_H -#define __ARCH_ARM_SRC_LM3S_LM3S_MEMORYMAP_H +#ifndef __ARCH_ARM_SRC_LM3S_CHIP_LM3S_MEMORYMAP_H +#define __ARCH_ARM_SRC_LM3S_CHIP_LM3S_MEMORYMAP_H /************************************************************************************ * Included Files @@ -357,4 +357,4 @@ * Public Function Prototypes ************************************************************************************/ -#endif /* __ARCH_ARM_SRC_LM3S_LM3S_MEMORYMAP_H */ +#endif /* __ARCH_ARM_SRC_LM3S_CHIP_LM3S_MEMORYMAP_H */ diff --git a/nuttx/arch/arm/src/lm3s/lm3s_ssi.h b/nuttx/arch/arm/src/lm3s/chip/lm3s_ssi.h similarity index 98% rename from nuttx/arch/arm/src/lm3s/lm3s_ssi.h rename to nuttx/arch/arm/src/lm3s/chip/lm3s_ssi.h index 482dab3269..b56ca77cb9 100644 --- a/nuttx/arch/arm/src/lm3s/lm3s_ssi.h +++ b/nuttx/arch/arm/src/lm3s/chip/lm3s_ssi.h @@ -1,7 +1,7 @@ /************************************************************************************ - * arch/arm/src/lm3s/lm3s_ssi.h + * arch/arm/src/lm3s/chip/lm3s_ssi.h * - * Copyright (C) 2009 Gregory Nutt. All rights reserved. + * Copyright (C) 2009, 2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -33,8 +33,8 @@ * ************************************************************************************/ -#ifndef __ARCH_ARM_SRC_LM3S_LM3S_SSI_H -#define __ARCH_ARM_SRC_LM3S_LM3S_SSI_H +#ifndef __ARCH_ARM_SRC_LM3S_CHIP_LM3S_SSI_H +#define __ARCH_ARM_SRC_LM3S_CHIP_LM3S_SSI_H /************************************************************************************ * Included Files @@ -232,4 +232,4 @@ ************************************************************************************/ #endif /* LM3S_NSSI > 0 */ -#endif /* __ARCH_ARM_SRC_LM3S_LM3S_SSI_H */ +#endif /* __ARCH_ARM_SRC_LM3S_CHIP_LM3S_SSI_H */ diff --git a/nuttx/arch/arm/src/lm3s/lm3s_syscontrol.h b/nuttx/arch/arm/src/lm3s/chip/lm3s_syscontrol.h similarity index 99% rename from nuttx/arch/arm/src/lm3s/lm3s_syscontrol.h rename to nuttx/arch/arm/src/lm3s/chip/lm3s_syscontrol.h index c59b921c48..d66cfeb475 100644 --- a/nuttx/arch/arm/src/lm3s/lm3s_syscontrol.h +++ b/nuttx/arch/arm/src/lm3s/chip/lm3s_syscontrol.h @@ -1,7 +1,7 @@ /************************************************************************************ - * arch/arm/src/lm3s/lm3s_syscontrol.h + * arch/arm/src/lm3s/chip/lm3s_syscontrol.h * - * Copyright (C) 2009-2010 Gregory Nutt. All rights reserved. + * Copyright (C) 2009-2010, 2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -33,8 +33,8 @@ * ************************************************************************************/ -#ifndef __ARCH_ARM_SRC_LM3S_LM3S_SYSCONTROL_H -#define __ARCH_ARM_SRC_LM3S_LM3S_SYSCONTROL_H +#ifndef __ARCH_ARM_SRC_LM3S_CHIP_LM3S_SYSCONTROL_H +#define __ARCH_ARM_SRC_LM3S_CHIP_LM3S_SYSCONTROL_H /************************************************************************************ * Included Files @@ -492,4 +492,4 @@ * Public Functions ************************************************************************************/ -#endif /* __ARCH_ARM_SRC_LM3S_LM3S_SYSCONTROL_H */ +#endif /* __ARCH_ARM_SRC_LM3S_CHIP_LM3S_SYSCONTROL_H */ diff --git a/nuttx/arch/arm/src/lm3s/lm3s_timer.h b/nuttx/arch/arm/src/lm3s/chip/lm3s_timer.h similarity index 97% rename from nuttx/arch/arm/src/lm3s/lm3s_timer.h rename to nuttx/arch/arm/src/lm3s/chip/lm3s_timer.h index 7c4166293e..649737f130 100644 --- a/nuttx/arch/arm/src/lm3s/lm3s_timer.h +++ b/nuttx/arch/arm/src/lm3s/chip/lm3s_timer.h @@ -1,5 +1,5 @@ /************************************************************************************ - * arch/arm/src/lm3s/lm3s_timer.h + * arch/arm/src/lm3s/chip/lm3s_timer.h * * Copyright (C) 2012 Max Nekludov. All rights reserved. * Author: Max Nekludov @@ -33,8 +33,8 @@ * ************************************************************************************/ -#ifndef __ARCH_ARM_SRC_LM3S_LM3S_TIMER_H -#define __ARCH_ARM_SRC_LM3S_LM3S_TIMER_H +#ifndef __ARCH_ARM_SRC_LM3S_CHIP_LM3S_TIMER_H +#define __ARCH_ARM_SRC_LM3S_CHIP_LM3S_TIMER_H /************************************************************************************ * Included Files @@ -122,4 +122,4 @@ #define TIMER_GPTMICR_TATOCINT_SHIFT 0 /* Bits 0: GPTM Timer A Time-Out Raw Interrupt Clear*/ #define TIMER_GPTMICR_TATOCINT_MASK (0x01 << TIMER_GPTMICR_TATOCINT_SHIFT) -#endif /* __ARCH_ARM_SRC_LM3S_LM3S_TIMER_H */ +#endif /* __ARCH_ARM_SRC_LM3S_CHIP_LM3S_TIMER_H */ diff --git a/nuttx/arch/arm/src/lm3s/lm3s_uart.h b/nuttx/arch/arm/src/lm3s/chip/lm3s_uart.h similarity index 98% rename from nuttx/arch/arm/src/lm3s/lm3s_uart.h rename to nuttx/arch/arm/src/lm3s/chip/lm3s_uart.h index 91bfb2266a..0fef5ccf7d 100644 --- a/nuttx/arch/arm/src/lm3s/lm3s_uart.h +++ b/nuttx/arch/arm/src/lm3s/chip/lm3s_uart.h @@ -1,7 +1,7 @@ /************************************************************************************ - * arch/arm/src/lm3s/lm3s_uart.h + * arch/arm/src/lm3s/chip/lm3s_uart.h * - * Copyright (C) 2009 Gregory Nutt. All rights reserved. + * Copyright (C) 2009, 2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -33,8 +33,8 @@ * ************************************************************************************/ -#ifndef __ARCH_ARM_SRC_LM3S_LM3S_UART_H -#define __ARCH_ARM_SRC_LM3S_LM3S_UART_H +#ifndef __ARCH_ARM_SRC_LM3S_CHIP_LM3S_UART_H +#define __ARCH_ARM_SRC_LM3S_CHIP_LM3S_UART_H /************************************************************************************ * Included Files @@ -344,4 +344,4 @@ * Public Functions ************************************************************************************/ -#endif /* __ARCH_ARM_SRC_LM3S_LM3S_UART_H */ +#endif /* __ARCH_ARM_SRC_LM3S_CHIP_LM3S_UART_H */ diff --git a/nuttx/arch/arm/src/lm3s/chip/lm_memorymap.h b/nuttx/arch/arm/src/lm3s/chip/lm_memorymap.h new file mode 100644 index 0000000000..c528578476 --- /dev/null +++ b/nuttx/arch/arm/src/lm3s/chip/lm_memorymap.h @@ -0,0 +1,69 @@ +/************************************************************************************ + * arch/arm/src/lm3s/chip/lm_memorymap.h + * + * Copyright (C) 2013 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * 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. + * + ************************************************************************************/ + +#ifndef __ARCH_ARM_SRC_LM3S_CHIP_LM_MEMORYMAP_H +#define __ARCH_ARM_SRC_LM3S_CHIP_LM_MEMORYMAP_H + +/************************************************************************************ + * Included Files + ************************************************************************************/ + +#include + +/* Include the memory map file for the specific Stellaris chip */ + +#ifdef CONFIG_ARCH_CHIP_LM3S +# include "chip/lm3s_memorymap.h" +#else +# error "Unsupported Stellaris memory map" +#endif + +/************************************************************************************ + * Pre-processor Definitions + ************************************************************************************/ + +/************************************************************************************ + * Public Types + ************************************************************************************/ + +/************************************************************************************ + * Public Data + ************************************************************************************/ + +/************************************************************************************ + * Public Function Prototypes + ************************************************************************************/ + +#endif /* __ARCH_ARM_SRC_LM3S_CHIP_LM_MEMORYMAP_H */ diff --git a/nuttx/binfmt/binfmt_exec.c b/nuttx/binfmt/binfmt_exec.c index 60e8d8efde..d5e2747103 100644 --- a/nuttx/binfmt/binfmt_exec.c +++ b/nuttx/binfmt/binfmt_exec.c @@ -1,7 +1,7 @@ /**************************************************************************** * binfmt/binfmt_exec.c * - * Copyright (C) 2009 Gregory Nutt. All rights reserved. + * Copyright (C) 2009, 2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -75,7 +75,8 @@ * * Description: * This is a convenience function that wraps load_ and exec_module into - * one call. + * one call. The priority of the executed program is set to be the + * same as the priority of the calling thread. * * Input Parameter: * filename - Fulll path to the binary to be loaded @@ -94,8 +95,20 @@ int exec(FAR const char *filename, FAR const char **argv, FAR const struct symtab_s *exports, int nexports) { struct binary_s bin; + struct sched_param param; int ret; + /* Get the priority of this thread */ + + ret = sched_getparam(0, ¶m); + if (ret < 0) + { + bdbg("ERROR: sched_getparam failed: %d\n", errno); + return ERROR; + } + + /* Load the module into memory */ + memset(&bin, 0, sizeof(struct binary_s)); bin.filename = filename; bin.exports = exports; @@ -108,7 +121,9 @@ int exec(FAR const char *filename, FAR const char **argv, return ERROR; } - ret = exec_module(&bin, 50); + /* Then start the module at the priority of this thread */ + + ret = exec_module(&bin, param.sched_priority); if (ret < 0) { bdbg("ERROR: Failed to execute program '%s'\n", filename); diff --git a/nuttx/include/nuttx/binfmt/binfmt.h b/nuttx/include/nuttx/binfmt/binfmt.h index 6df5190d20..480e82c09f 100644 --- a/nuttx/include/nuttx/binfmt/binfmt.h +++ b/nuttx/include/nuttx/binfmt/binfmt.h @@ -228,7 +228,8 @@ int exec_module(FAR const struct binary_s *bin, int priority); * * Description: * This is a convenience function that wraps load_ and exec_module into - * one call. + * one call. The priority of the executed program is set to be the + * same as the priority of the calling thread. * * Input Parameter: * filename - Fulll path to the binary to be loaded diff --git a/nuttx/include/unistd.h b/nuttx/include/unistd.h index ddb6880f4d..d2ace79fa3 100644 --- a/nuttx/include/unistd.h +++ b/nuttx/include/unistd.h @@ -160,6 +160,13 @@ EXTERN FAR char *getcwd(FAR char *buf, size_t size); EXTERN int unlink(FAR const char *pathname); EXTERN int rmdir(FAR const char *pathname); +/* Execution of programs from files */ + +#ifdef CONFIG_LIBC_EXECFUNCS +EXTERN int execl(FAR const char *path, ...); +EXTERN int execv(FAR const char *path, FAR char *const argv[]); +#endif + /* Other */ EXTERN int getopt(int argc, FAR char *const argv[], FAR const char *optstring); diff --git a/nuttx/libc/Kconfig b/nuttx/libc/Kconfig index 0ae56ac57e..699b3ebb26 100644 --- a/nuttx/libc/Kconfig +++ b/nuttx/libc/Kconfig @@ -71,6 +71,54 @@ config EOL_IS_EITHER_CRLF endchoice +config LIBC_EXECFUNCS + bool "Enable exec[l|v] Support" + default n + depends on !BINFMT_DISABLE + ---help--- + Enable support for the exec[l|v] family of functions that can be + used to start other programs, terminating the current program. + Typical usage is (1) first call vfork() to create a new thread, then + (2) call exec[l|v] to replace the new thread with a program from the + file system. + + NOTE 1: This two step process start is completely unnecessary in + NuttX and is provided only for compatibily with Unix systems. These + functions are essentially just wrapper functions that (1) call the + non-standard binfmt function 'exec', and then (2) exit(0). Since + the new thread will be terminated by the exec[l|v] call, it really + served no purpose other than to suport Unix compatility. + + NOTE 2: Support for exec[l|v] is conditional because is requires + additional support for symbol tables that will not be available in + the typical system. + +if LIBC_EXECFUNCS + +config EXECFUNCS_SYMTAB + string "Symbol table used by exec[l|v]" + default "g_symtab" + ---help--- + The exec[l|v] functions are wrapper functions that (1) call the non- + standard binfmt function 'exec', and then (2) exit(0). The binfmt + function 'exec' needs to have (1) a symbol table that provides the + list of symbols exported by the base code, and (2) the number of + symbols in that table. This selection provides the name of that + symbol table. + +config EXECFUNCS_NSYMBOLS + int "Number of Symbols in the Table" + default 0 + ---help--- + The exec[l|v] functions are wrapper functions that (1) call the non- + standard binfmt function 'exec', and then (2) exit(0). The binfmt + function 'exec' needs to have (1) a symbol table that provides the + list of symbols exported by the base code, and (2) the number of + symbols in that table. This selection provides the number of + symbols in the symbol table. + +endif + config LIBC_STRERROR bool "Enable strerror" default n diff --git a/nuttx/libc/unistd/Make.defs b/nuttx/libc/unistd/Make.defs index 67fce9b1d7..3811673bf5 100644 --- a/nuttx/libc/unistd/Make.defs +++ b/nuttx/libc/unistd/Make.defs @@ -41,6 +41,10 @@ ifneq ($(CONFIG_NFILE_DESCRIPTORS),0) ifneq ($(CONFIG_DISABLE_ENVIRON),y) CSRCS += lib_chdir.c lib_getcwd.c endif + +ifeq ($(CONFIG_LIBC_EXECFUNCS),y) +CSRCS += lib_execl.c lib_execv.c +endif endif # Add the unistd directory to the build diff --git a/nuttx/libc/unistd/lib_execl.c b/nuttx/libc/unistd/lib_execl.c new file mode 100644 index 0000000000..ac31473435 --- /dev/null +++ b/nuttx/libc/unistd/lib_execl.c @@ -0,0 +1,146 @@ +/**************************************************************************** + * libc/unistd/lib_execl.c + * + * Copyright (C) 2013 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * 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. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include +#include + +#ifdef CONFIG_LIBC_EXECFUNCS + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +/**************************************************************************** + * Global Variables + ****************************************************************************/ + +/**************************************************************************** + * Private Variables + ****************************************************************************/ + +/**************************************************************************** + * Global Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: execl + * + * Description: + * The standard 'exec' family of functions will replace the current process + * image with a new process image. The new image will be constructed from a + * regular, executable file called the new process image file. There will + * be no return from a successful exec, because the calling process image + * is overlaid by the new process image. + * + * Simplified 'execl()' and 'execv()' functions are provided by NuttX for + * compatibility. NuttX is a tiny embedded RTOS that does not support + * processes and hence the concept of overlaying a tasks process image with + * a new process image does not make any sense. In NuttX, these functions + * are wrapper functions that: + * + * 1. Call the non-standard binfmt function 'exec', and then + * 2. exit(0). + * + * Note the inefficiency when 'exec[l|v]()' is called in the normal, two- + * step process: (1) first call vfork() to create a new thread, then (2) + * call 'exec[l|v]()' to replace the new thread with a program from the + * file system. Since the new thread will be terminated by the + * 'exec[l|v]()' call, it really served no purpose other than to suport + * Unix compatility. + * + * The non-standard binfmt function 'exec()' needs to have (1) a symbol + * table that provides the list of symbols exported by the base code, and + * (2) the number of symbols in that table. This information is currently + * provided to 'exec()' from 'exec[l|v]()' via NuttX configuration settings: + * + * CONFIG_LIBC_EXECFUNCS : Enable exec[l|v] Support + * CONFIG_EXECFUNCS_SYMTAB : Symbol table used by exec[l|v] + * CONFIG_EXECFUNCS_NSYMBOLS : Number of Symbols in the Table + * + * As a result of the above, the current implementations of 'execl()' and + * 'execv()' suffer from some incompatibilities that may or may not be + * addressed in a future version of NuttX. Other than just being an + * inefficient use of MCU resource, the most serious of these is that + * the exec'ed task will not have the same task ID as the vfork'ed + * function. So the parent function cannot know the ID of the exec'ed + * task. + * + * Input Parameters: + * path - The path to the program to be executed. If CONFIG_BINFMT_EXEPATH + * is defined in the configuration, then this may be a relative path + * from the current working directory. Otherwise, path must be the + * absolute path to the program. + * arg0,... - A list of the string arguments to be recevied by the + * program. Zero indicates the end of the list. + * + * Returned Value: + * This function does not return on success. On failure, it will return + * -1 (ERROR) and will set the 'errno' value appropriately. + * + ****************************************************************************/ + +int execl(FAR const char *path, ...) +{ + FAR char *argv[CONFIG_MAX_TASK_ARGS+1]; + va_list ap; + int argc; + + /* Collect the arguments into the argv[] array */ + + va_start(ap, path); + for (argc = 0; argc < CONFIG_MAX_TASK_ARGS; argc++) + { + argv[argc] = va_arg(ap, FAR char *); + if (argv[argc] == NULL) + { + break; + } + } + + argv[CONFIG_MAX_TASK_ARGS] = NULL; + va_end(ap); + + /* Then let execv() do the real work */ + + return execv(path, (char * const *)&argv); +} + +#endif /* CONFIG_LIBC_EXECFUNCS */ \ No newline at end of file diff --git a/nuttx/libc/unistd/lib_execv.c b/nuttx/libc/unistd/lib_execv.c new file mode 100644 index 0000000000..cad8ee3076 --- /dev/null +++ b/nuttx/libc/unistd/lib_execv.c @@ -0,0 +1,168 @@ +/**************************************************************************** + * libc/unistd/lib_execv.c + * + * Copyright (C) 2013 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * 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. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include +#include +#include +#include + +#include + +#ifdef CONFIG_LIBC_EXECFUNCS + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ +/* If CONFIG_LIBC_EXECFUNCS is defined in the configuration, then the + * following must also be defined: + */ + +/* Symbol table used by exec[l|v] */ + +#ifndef CONFIG_EXECFUNCS_SYMTAB +# error "CONFIG_EXECFUNCS_SYMTAB must be defined" +#endif + +/* Number of Symbols in the Table */ + +#ifndef CONFIG_EXECFUNCS_NSYMBOLS +# error "CONFIG_EXECFUNCS_NSYMBOLS must be defined" +#endif + +/**************************************************************************** + * Global Variables + ****************************************************************************/ + +extern struct symtab_s CONFIG_EXECFUNCS_SYMTAB; + +/**************************************************************************** + * Private Variables + ****************************************************************************/ + +/**************************************************************************** + * Global Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: execv + * + * Description: + * The standard 'exec' family of functions will replace the current process + * image with a new process image. The new image will be constructed from a + * regular, executable file called the new process image file. There will + * be no return from a successful exec, because the calling process image + * is overlaid by the new process image. + * + * Simplified 'execl()' and 'execv()' functions are provided by NuttX for + * compatibility. NuttX is a tiny embedded RTOS that does not support + * processes and hence the concept of overlaying a tasks process image with + * a new process image does not make any sense. In NuttX, these functions + * are wrapper functions that: + * + * 1. Call the non-standard binfmt function 'exec', and then + * 2. exit(0). + * + * Note the inefficiency when 'exec[l|v]()' is called in the normal, two- + * step process: (1) first call vfork() to create a new thread, then (2) + * call 'exec[l|v]()' to replace the new thread with a program from the + * file system. Since the new thread will be terminated by the + * 'exec[l|v]()' call, it really served no purpose other than to suport + * Unix compatility. + * + * The non-standard binfmt function 'exec()' needs to have (1) a symbol + * table that provides the list of symbols exported by the base code, and + * (2) the number of symbols in that table. This information is currently + * provided to 'exec()' from 'exec[l|v]()' via NuttX configuration settings: + * + * CONFIG_LIBC_EXECFUNCS : Enable exec[l|v] Support + * CONFIG_EXECFUNCS_SYMTAB : Symbol table used by exec[l|v] + * CONFIG_EXECFUNCS_NSYMBOLS : Number of Symbols in the Table + * + * As a result of the above, the current implementations of 'execl()' and + * 'execv()' suffer from some incompatibilities that may or may not be + * addressed in a future version of NuttX. Other than just being an + * inefficient use of MCU resource, the most serious of these is that + * the exec'ed task will not have the same task ID as the vfork'ed + * function. So the parent function cannot know the ID of the exec'ed + * task. + * + * Input Parameters: + * path - The path to the program to be executed. If CONFIG_BINFMT_EXEPATH + * is defined in the configuration, then this may be a relative path + * from the current working directory. Otherwise, path must be the + * absolute path to the program. + * argv - A pointer to an array of string arguments. The end of the + * array is indicated with a NULL entry. + * + * Returned Value: + * This function does not return on success. On failure, it will return + * -1 (ERROR) and will set the 'errno' value appropriately. + * + ****************************************************************************/ + +int execv(FAR const char *path, FAR char *const argv[]) +{ + int ret; + + /* Start the task */ + + ret = exec(path, (FAR const char **)argv, + &CONFIG_EXECFUNCS_SYMTAB, CONFIG_EXECFUNCS_NSYMBOLS); + + if (ret < 0) + { + sdbg("exec failed: %d\n", errno); + return ERROR; + } + + /* Then exit */ + + exit(0); + + /* We should not get here, but might be needed by some compilers. Other, + * smarter compilers might complain that this code is unreachable. You just + * can't win. + */ + + return ERROR; +} + +#endif /* CONFIG_LIBC_EXECFUNCS */ \ No newline at end of file diff --git a/nuttx/tools/cfgdefine.c b/nuttx/tools/cfgdefine.c index ee1dd40038..f026a186f0 100644 --- a/nuttx/tools/cfgdefine.c +++ b/nuttx/tools/cfgdefine.c @@ -64,6 +64,7 @@ static const char *dequote_list[] = /* NuttX */ "CONFIG_USER_ENTRYPOINT", /* Name of entry point function */ + "CONFIG_EXECFUNCS_SYMTAB", /* Symbol table used by exec[l|v] */ /* NxWidgets/NxWM */ From fd45b36c041c0bbb1f9066592482d40790405812 Mon Sep 17 00:00:00 2001 From: patacongo Date: Tue, 8 Jan 2013 16:51:22 +0000 Subject: [PATCH 046/118] Documentation update git-svn-id: http://svn.code.sf.net/p/nuttx/code/trunk@5493 42af7a65-404d-4744-a932-0658087f49c3 --- nuttx/Documentation/NuttxUserGuide.html | 129 +++++++++++++++++++++++- nuttx/libc/unistd/lib_execl.c | 8 +- nuttx/libc/unistd/lib_execv.c | 6 +- 3 files changed, 135 insertions(+), 8 deletions(-) diff --git a/nuttx/Documentation/NuttxUserGuide.html b/nuttx/Documentation/NuttxUserGuide.html index 918b69d0fa..89bc08942a 100644 --- a/nuttx/Documentation/NuttxUserGuide.html +++ b/nuttx/Documentation/NuttxUserGuide.html @@ -13,7 +13,7 @@

          NuttX Operating System

          User's Manual

          by

          Gregory Nutt

          -

          Last Updated: January 7, 2013

          +

          Last Updated: January 8, 2013

          @@ -651,7 +651,134 @@ pid_t vfork(void);

          2.1.9 execv

          +

          + Function Prototype: +

          +
            +#include <unistd.h>
            +#ifdef CONFIG_LIBC_EXECFUNCS
            +int execv(FAR const char *path, FAR char *const argv[]);
            +#endif
            +
          +

          + Description: + The standard exec family of functions will replace the current process image with a new process image. + The new image will be constructed from a regular, executable file called the new process image file. + There will be no return from a successful exec, because the calling process image is overlaid by the new process image. +

          +

          + Simplified execl() and execv() functions are provided by NuttX for compatibility. + NuttX is a tiny embedded RTOS that does not support processes and hence the concept of overlaying a tasks process image with a new process image does not make any sense. + In NuttX, these functions are wrapper functions that: +

          +
            +
          1. + Call the non-standard binfmt function exec(), and then +
          2. +
          3. + exit(0). +
          4. +
          +

          + Note the inefficiency when execv() or execl() is called in the normal, two-step process: + (1) first call vfork() to create a new thread, then (2) call execv() or execl() to replace the new thread with a program from the file system. + Since the new thread will be terminated by the execv() or execl() call, it really served no purpose other than to support Unix compatility. +

          +

          + The non-standard binfmt function exec() needs to have (1) a symbol table that provides the list of symbols exported by the base code, and (2) the number of symbols in that table. + This information is currently provided to exec() from execv() or execl() via NuttX configuration settings: +

          +
            +
          • + CONFIG_LIBC_EXECFUNCS: + Enable execv() and execl() support +
          • +
          • + CONFIG_EXECFUNCS_SYMTAB: + Symbol table used by execv() or execl(). +
          • +
          • + CONFIG_EXECFUNCS_NSYMBOLS: + Number of symbols in the symbol table +
          • +
          +

          + As a result of the above, the current implementations of execl() and execv() suffer from some incompatibilities that may or may not be addressed in a future version of NuttX. + Other than just being an inefficient use of MCU resource, the most serious of these is that + the exec'ed task will not have the same task ID as the vfork'ed function. + So the parent function cannot know the ID of the exec'ed task.

          +

          + Input Parameters: +

          +
            +
          • + path: + The path to the program to be executed. + If CONFIG_BINFMT_EXEPATH is defined in the configuration, then this may be a relative path from the current working directory. + Otherwise, path must be the absolute path to the program. +
          • +
          • + argv: + A pointer to an array of string arguments. + The end of the array is indicated with a NULL entry. + +
          +

          + Returned Value: + This function does not return on success. + On failure, it will return -1 (ERROR) and will set the errno value appropriately. +

          + Assumptions/Limitations: +

          +

          + POSIX Compatibility: + Similar with the Unix interface of the same name. + There are, however, several compatibility issues as detailed in the description above. +

          +

          2.1.10 execl

          +

          + Function Prototype: +

          +
            +#include <unistd.h>
            +#ifdef CONFIG_LIBC_EXECFUNCS
            +int execl(FAR const char *path, ...);
            +#endif
            +
          +

          + Description: + execl() is functionally equivalent to execv(), differing only in the form of its input parameters. + See the decription of execv() for additional information. +

          +

          + Input Parameters: +

          +
            +
          • + path: + The path to the program to be executed. + If CONFIG_BINFMT_EXEPATH is defined in the configuration, then this may be a relative path from the current working directory. + Otherwise, path must be the absolute path to the program. +
          • +
          • + ...: + A list of the string arguments to be recevied by the program. + Zero indicates the end of the list. + +
          +

          + Returned Value: + This function does not return on success. + On failure, it will return -1 (ERROR) and will set the errno value appropriately. +

          + Assumptions/Limitations: +

          +

          + POSIX Compatibility: + Similar with the Unix interface of the same name. + There are, however, several compatibility issues as detailed in the description of execv(). +

          diff --git a/nuttx/libc/unistd/lib_execl.c b/nuttx/libc/unistd/lib_execl.c index ac31473435..fa50c14298 100644 --- a/nuttx/libc/unistd/lib_execl.c +++ b/nuttx/libc/unistd/lib_execl.c @@ -83,7 +83,7 @@ * step process: (1) first call vfork() to create a new thread, then (2) * call 'exec[l|v]()' to replace the new thread with a program from the * file system. Since the new thread will be terminated by the - * 'exec[l|v]()' call, it really served no purpose other than to suport + * 'exec[l|v]()' call, it really served no purpose other than to support * Unix compatility. * * The non-standard binfmt function 'exec()' needs to have (1) a symbol @@ -91,9 +91,9 @@ * (2) the number of symbols in that table. This information is currently * provided to 'exec()' from 'exec[l|v]()' via NuttX configuration settings: * - * CONFIG_LIBC_EXECFUNCS : Enable exec[l|v] Support + * CONFIG_LIBC_EXECFUNCS : Enable exec[l|v] support * CONFIG_EXECFUNCS_SYMTAB : Symbol table used by exec[l|v] - * CONFIG_EXECFUNCS_NSYMBOLS : Number of Symbols in the Table + * CONFIG_EXECFUNCS_NSYMBOLS : Number of symbols in the table * * As a result of the above, the current implementations of 'execl()' and * 'execv()' suffer from some incompatibilities that may or may not be @@ -108,7 +108,7 @@ * is defined in the configuration, then this may be a relative path * from the current working directory. Otherwise, path must be the * absolute path to the program. - * arg0,... - A list of the string arguments to be recevied by the + * ... - A list of the string arguments to be recevied by the * program. Zero indicates the end of the list. * * Returned Value: diff --git a/nuttx/libc/unistd/lib_execv.c b/nuttx/libc/unistd/lib_execv.c index cad8ee3076..b0f4136f12 100644 --- a/nuttx/libc/unistd/lib_execv.c +++ b/nuttx/libc/unistd/lib_execv.c @@ -104,7 +104,7 @@ extern struct symtab_s CONFIG_EXECFUNCS_SYMTAB; * step process: (1) first call vfork() to create a new thread, then (2) * call 'exec[l|v]()' to replace the new thread with a program from the * file system. Since the new thread will be terminated by the - * 'exec[l|v]()' call, it really served no purpose other than to suport + * 'exec[l|v]()' call, it really served no purpose other than to support * Unix compatility. * * The non-standard binfmt function 'exec()' needs to have (1) a symbol @@ -112,9 +112,9 @@ extern struct symtab_s CONFIG_EXECFUNCS_SYMTAB; * (2) the number of symbols in that table. This information is currently * provided to 'exec()' from 'exec[l|v]()' via NuttX configuration settings: * - * CONFIG_LIBC_EXECFUNCS : Enable exec[l|v] Support + * CONFIG_LIBC_EXECFUNCS : Enable exec[l|v] support * CONFIG_EXECFUNCS_SYMTAB : Symbol table used by exec[l|v] - * CONFIG_EXECFUNCS_NSYMBOLS : Number of Symbols in the Table + * CONFIG_EXECFUNCS_NSYMBOLS : Number of symbols in the table * * As a result of the above, the current implementations of 'execl()' and * 'execv()' suffer from some incompatibilities that may or may not be From 23cc9f459cba8e90faf59922616f1c0975b389f3 Mon Sep 17 00:00:00 2001 From: patacongo Date: Tue, 8 Jan 2013 19:27:38 +0000 Subject: [PATCH 047/118] Eliminate arch/arc/src/lm3s/lm3s_internal.h; replace with several header files git-svn-id: http://svn.code.sf.net/p/nuttx/code/trunk@5494 42af7a65-404d-4744-a932-0658087f49c3 --- nuttx/ChangeLog | 3 +- nuttx/TODO | 29 +- nuttx/arch/arm/src/arm/Toolchain.defs | 2 +- nuttx/arch/arm/src/lm3s/chip.h | 10 + .../{lm3s_internal.h => chip/lm3s_pinmap.h} | 275 +----------------- nuttx/arch/arm/src/lm3s/chip/lm_pinmap.h | 69 +++++ nuttx/arch/arm/src/lm3s/lm3s_dumpgpio.c | 2 +- nuttx/arch/arm/src/lm3s/lm3s_ethernet.c | 4 +- nuttx/arch/arm/src/lm3s/lm3s_gpio.c | 2 +- nuttx/arch/arm/src/lm3s/lm3s_gpioirq.c | 3 +- nuttx/arch/arm/src/lm3s/lm3s_irq.c | 4 +- nuttx/arch/arm/src/lm3s/lm3s_lowputc.c | 5 +- nuttx/arch/arm/src/lm3s/lm3s_ssi.c | 4 +- nuttx/arch/arm/src/lm3s/lm3s_start.c | 4 +- nuttx/arch/arm/src/lm3s/lm3s_syscontrol.c | 3 +- nuttx/arch/arm/src/lm3s/lm3s_timerisr.c | 1 - nuttx/arch/arm/src/lm3s/lm_ethernet.h | 103 +++++++ nuttx/arch/arm/src/lm3s/lm_gpio.h | 223 ++++++++++++++ nuttx/arch/arm/src/lm3s/lm_lowputc.h | 87 ++++++ nuttx/arch/arm/src/lm3s/lm_ssi.h | 114 ++++++++ nuttx/arch/arm/src/lm3s/lm_syscontrol.h | 100 +++++++ nuttx/configs/eagle100/httpd/defconfig | 1 + nuttx/configs/eagle100/nettest/defconfig | 1 + nuttx/configs/eagle100/nsh/defconfig | 1 + nuttx/configs/eagle100/nxflat/defconfig | 1 + nuttx/configs/eagle100/ostest/defconfig | 1 + .../configs/eagle100/src/eagle100_internal.h | 1 + nuttx/configs/eagle100/src/up_leds.c | 2 +- nuttx/configs/eagle100/src/up_ssi.c | 2 +- nuttx/configs/eagle100/thttpd/defconfig | 1 + nuttx/configs/ekk-lm3s9b96/nsh/defconfig | 1 + nuttx/configs/ekk-lm3s9b96/ostest/defconfig | 1 + .../ekk-lm3s9b96/src/ekklm3s9b96_internal.h | 1 + nuttx/configs/ekk-lm3s9b96/src/up_leds.c | 2 +- nuttx/configs/ekk-lm3s9b96/src/up_ssi.c | 2 +- nuttx/configs/lm3s6432-s2e/nsh/defconfig | 1 + nuttx/configs/lm3s6432-s2e/ostest/defconfig | 1 + .../lm3s6432-s2e/src/lm3s6432s2e_internal.h | 1 + nuttx/configs/lm3s6432-s2e/src/up_boot.c | 2 +- nuttx/configs/lm3s6432-s2e/src/up_leds.c | 2 +- nuttx/configs/lm3s6432-s2e/src/up_ssi.c | 2 +- .../lm3s6965-ek/src/lm3s6965ek_internal.h | 1 + nuttx/configs/lm3s6965-ek/src/up_leds.c | 2 +- nuttx/configs/lm3s6965-ek/src/up_oled.c | 2 +- nuttx/configs/lm3s6965-ek/src/up_ssi.c | 2 +- nuttx/configs/lm3s8962-ek/nsh/defconfig | 1 + nuttx/configs/lm3s8962-ek/nx/defconfig | 1 + nuttx/configs/lm3s8962-ek/ostest/defconfig | 1 + .../lm3s8962-ek/src/lm3s8962ek_internal.h | 1 + nuttx/configs/lm3s8962-ek/src/up_leds.c | 2 +- nuttx/configs/lm3s8962-ek/src/up_oled.c | 2 +- nuttx/configs/lm3s8962-ek/src/up_ssi.c | 2 +- 52 files changed, 793 insertions(+), 298 deletions(-) rename nuttx/arch/arm/src/lm3s/{lm3s_internal.h => chip/lm3s_pinmap.h} (66%) create mode 100644 nuttx/arch/arm/src/lm3s/chip/lm_pinmap.h create mode 100644 nuttx/arch/arm/src/lm3s/lm_ethernet.h create mode 100644 nuttx/arch/arm/src/lm3s/lm_gpio.h create mode 100644 nuttx/arch/arm/src/lm3s/lm_lowputc.h create mode 100644 nuttx/arch/arm/src/lm3s/lm_ssi.h create mode 100644 nuttx/arch/arm/src/lm3s/lm_syscontrol.h diff --git a/nuttx/ChangeLog b/nuttx/ChangeLog index ee6b088cf0..edf500df67 100644 --- a/nuttx/ChangeLog +++ b/nuttx/ChangeLog @@ -3891,5 +3891,6 @@ public include area for compatibility with other architectures. * arch/arm/src/lm3s/chip: Move register definition header files into a new chip/ sub-directory. - + * arch/arm/src/lm3s/lm3s_internal.h: Broke up into several + smaller header files. diff --git a/nuttx/TODO b/nuttx/TODO index 02100e97e2..c0b00d4979 100644 --- a/nuttx/TODO +++ b/nuttx/TODO @@ -1,4 +1,4 @@ -NuttX TODO List (Last updated January 4, 2013) +NuttX TODO List (Last updated January 8, 2013) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ This file summarizes known NuttX bugs, limitations, inconsistencies with @@ -6,7 +6,7 @@ standards, things that could be improved, and ideas for enhancements. nuttx/ - (10) Task/Scheduler (sched/) + (11) Task/Scheduler (sched/) (1) Memory Managment (mm/) (2) Signals (sched/, arch/) (2) pthreads (sched/) @@ -31,7 +31,7 @@ nuttx/ (0) ARM/LPC43x (arch/arm/src/lpc43xx/) (3) ARM/STR71x (arch/arm/src/str71x/) (3) ARM/LM3S6918 (arch/arm/src/lm3s/) - (4) ARM/STM32 (arch/arm/src/stm32/) + (5) ARM/STM32 (arch/arm/src/stm32/) (3) AVR (arch/avr) (0) Intel x86 (arch/x86) (5) 8051 / MCS51 (arch/8051/) @@ -171,6 +171,24 @@ o Task/Scheduler (sched/) that includes NxWisges::CNxTimer is needed. Priority: Medium Low for now + Title: INCOMPATIBILITES WITH execv() AND execl() + Description: Simplified 'execl()' and 'execv()' functions are provided by + NuttX. NuttX does not support processes and hence the concept + of overlaying a tasks process image with a new process image + does not make any sense. In NuttX, these functions are + wrapper functions that: + + 1. Call the non-standard binfmt function 'exec', and then + 2. exit(0). + + As a result, the current implementations of 'execl()' and + 'execv()' suffer from some incompatibilities, the most + serious of these is that the exec'ed task will not have + the same task ID as the vfork'ed function. So the parent + function cannot know the ID of the exec'ed task. + Status: Open + Priority: Medium Low for now + o Memory Managment (mm/) ^^^^^^^^^^^^^^^^^^^^^^ @@ -1481,6 +1499,11 @@ o ARM/STM32 (arch/arm/src/stm32/) Status: Open Priority: Low + Title: STM32 F4 USB OTG FS DEVICE-SIDE DRIVER + Description: This driver is reported to be buggy and to need some TLC. + Status: Open + Priority: High + o AVR (arch/avr) ^^^^^^^^^^^^^^ diff --git a/nuttx/arch/arm/src/arm/Toolchain.defs b/nuttx/arch/arm/src/arm/Toolchain.defs index ea11c4dc90..daa8258423 100644 --- a/nuttx/arch/arm/src/arm/Toolchain.defs +++ b/nuttx/arch/arm/src/arm/Toolchain.defs @@ -102,7 +102,7 @@ endif # NuttX buildroot under Linux or Cygwin ifeq ($(CONFIG_ARM_TOOLCHAIN),BUILDROOT) -ifeq ($(CONFIG_ARMV_OABI_TOOLCHAIN),y) +ifeq ($(CONFIG_ARM_OABI_TOOLCHAIN),y) CROSSDEV = arm-nuttx-elf- ARCROSSDEV = arm-nuttx-elf- else diff --git a/nuttx/arch/arm/src/lm3s/chip.h b/nuttx/arch/arm/src/lm3s/chip.h index 1e96b5222b..481a9be159 100644 --- a/nuttx/arch/arm/src/lm3s/chip.h +++ b/nuttx/arch/arm/src/lm3s/chip.h @@ -58,6 +58,16 @@ #include "chip/lm3s_ethernet.h" /* Ethernet MAC and PHY */ #include "chip/lm3s_flash.h" /* FLASH */ +/* The LM3S69xx only supports 8 priority levels. The hardware priority mechanism + * will only look at the upper N bits of the 8-bit priority level (where N is 3 for + * the Stellaris family), so any prioritization must be performed in those bits. + * The default priority level is set to the middle value + */ + +#define NVIC_SYSH_PRIORITY_MIN 0xe0 /* All bits set in minimum priority */ +#define NVIC_SYSH_PRIORITY_DEFAULT 0x80 /* Midpoint is the default */ +#define NVIC_SYSH_PRIORITY_MAX 0x00 /* Zero is maximum priority */ + /************************************************************************************ * Public Types ************************************************************************************/ diff --git a/nuttx/arch/arm/src/lm3s/lm3s_internal.h b/nuttx/arch/arm/src/lm3s/chip/lm3s_pinmap.h similarity index 66% rename from nuttx/arch/arm/src/lm3s/lm3s_internal.h rename to nuttx/arch/arm/src/lm3s/chip/lm3s_pinmap.h index 9bfd67a5e4..62a4a03fd0 100644 --- a/nuttx/arch/arm/src/lm3s/lm3s_internal.h +++ b/nuttx/arch/arm/src/lm3s/chip/lm3s_pinmap.h @@ -1,7 +1,7 @@ /************************************************************************************ - * arch/arm/src/lm3s/lm3s_internal.h + * arch/arm/src/lm3s/chip/lm3s_pinmap.h * - * Copyright (C) 2009-2010 Gregory Nutt. All rights reserved. + * Copyright (C) 2009-2010, 2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -33,123 +33,19 @@ * ************************************************************************************/ -#ifndef __ARCH_ARM_SRC_LM3S_LM3S_INTERNAL_H -#define __ARCH_ARM_SRC_LM3S_LM3S_INTERNAL_H +#ifndef __ARCH_ARM_SRC_LM3S_CHIP_LM3S_PINMAP_H +#define __ARCH_ARM_SRC_LM3S_CHIP_LM3S_PINMAP_H /************************************************************************************ * Included Files ************************************************************************************/ #include -#include -#include - -#include "up_internal.h" -#include "chip.h" /************************************************************************************ * Pre-processor Definitions ************************************************************************************/ -/* The LM3S69xx only supports 8 priority levels. The hardware priority mechanism - * will only look at the upper N bits of the 8-bit priority level (where N is 3 for - * the Stellaris family), so any prioritization must be performed in those bits. - * The default priority level is set to the middle value - */ - -#define NVIC_SYSH_PRIORITY_MIN 0xe0 /* All bits set in minimum priority */ -#define NVIC_SYSH_PRIORITY_DEFAULT 0x80 /* Midpoint is the default */ -#define NVIC_SYSH_PRIORITY_MAX 0x00 /* Zero is maximum priority */ - -/* Bit-encoded input to lm3s_configgpio() *******************************************/ - -/* Encoding: - * FFFS SPPP IIIn nnnn nnnn nnnn VPPP PBBB - * - * These bits set the primary function of the pin: - * FFFn nnnn nnnn nnnn nnnn nnnn nnnn nnnn - */ - -#define GPIO_FUNC_SHIFT 29 /* Bit 31-29: GPIO function */ -#define GPIO_FUNC_MASK (7 << GPIO_FUNC_SHIFT) /* (See table 9-1 in data sheet) */ -#define GPIO_FUNC_INPUT (0 << GPIO_FUNC_SHIFT) /* Digital GPIO input */ -#define GPIO_FUNC_OUTPUT (1 << GPIO_FUNC_SHIFT) /* Digital GPIO output */ -#define GPIO_FUNC_ODINPUT (2 << GPIO_FUNC_SHIFT) /* Open-drain GPIO input */ -#define GPIO_FUNC_ODOUTPUT (3 << GPIO_FUNC_SHIFT) /* Open-drain GPIO output */ -#define GPIO_FUNC_PFODIO (4 << GPIO_FUNC_SHIFT) /* Open-drain input/output (I2C) */ -#define GPIO_FUNC_PFINPUT (5 << GPIO_FUNC_SHIFT) /* Digital input (Timer, CCP) */ -#define GPIO_FUNC_PFOUTPUT (5 << GPIO_FUNC_SHIFT) /* Digital output (Timer, PWM, Comparator) */ -#define GPIO_FUNC_PFIO (5 << GPIO_FUNC_SHIFT) /* Digital input/output (SSI, UART) */ -#define GPIO_FUNC_ANINPUT (6 << GPIO_FUNC_SHIFT) /* Analog input (Comparator) */ -#define GPIO_FUNC_INTERRUPT (7 << GPIO_FUNC_SHIFT) /* Interrupt function */ -#define GPIO_FUNC_MAX GPIO_FUNC_INTERRUPT - -/* That primary may be modified by the following options - * nnnS SPPP nnnn nnnn nnnn nnnn nnnn nnnn - */ - -#define GPIO_STRENGTH_SHIFT 27 /* Bits 28-27: Pad drive strength */ -#define GPIO_STRENGTH_MASK (3 << GPIO_STRENGTH_SHIFT) -#define GPIO_STRENGTH_2MA (0 << GPIO_STRENGTH_SHIFT) /* 2mA pad drive strength */ -#define GPIO_STRENGTH_4MA (1 << GPIO_STRENGTH_SHIFT) /* 4mA pad drive strength */ -#define GPIO_STRENGTH_8MA (2 << GPIO_STRENGTH_SHIFT) /* 8mA pad drive strength */ -#define GPIO_STRENGTH_8MASC (3 << GPIO_STRENGTH_SHIFT) /* 8mA Pad drive with slew rate control */ -#define GPIO_STRENGTH_MAX GPIO_STRENGTH_8MASC - -#define GPIO_PADTYPE_SHIFT 24 /* Bits 26-24: Pad type */ -#define GPIO_PADTYPE_MASK (7 << GPIO_PADTYPE_SHIFT) -#define GPIO_PADTYPE_STD (0 << GPIO_PADTYPE_SHIFT) /* Push-pull */ -#define GPIO_PADTYPE_STDWPU (1 << GPIO_PADTYPE_SHIFT) /* Push-pull with weak pull-up */ -#define GPIO_PADTYPE_STDWPD (2 << GPIO_PADTYPE_SHIFT) /* Push-pull with weak pull-down */ -#define GPIO_PADTYPE_OD (3 << GPIO_PADTYPE_SHIFT) /* Open-drain */ -#define GPIO_PADTYPE_ODWPU (4 << GPIO_PADTYPE_SHIFT) /* Open-drain with weak pull-up */ -#define GPIO_PADTYPE_ODWPD (5 << GPIO_PADTYPE_SHIFT) /* Open-drain with weak pull-down */ -#define GPIO_PADTYPE_ANALOG (6 << GPIO_PADTYPE_SHIFT) /* Analog comparator */ - -/* If the pin is an interrupt, then the following options apply - * nnnn nnnn IIIn nnnn nnnn nnnn nnnn nnnn - */ - -#define GPIO_INT_SHIFT 21 /* Bits 23-21: Interrupt type */ -#define GPIO_INT_MASK (7 << GPIO_INT_SHIFT) -#define GPIO_INT_FALLINGEDGE (0 << GPIO_INT_SHIFT) /* Interrupt on falling edge */ -#define GPIO_INT_RISINGEDGE (1 << GPIO_INT_SHIFT) /* Interrupt on rising edge */ -#define GPIO_INT_BOTHEDGES (2 << GPIO_INT_SHIFT) /* Interrupt on both edges */ -#define GPIO_INT_LOWLEVEL (3 << GPIO_INT_SHIFT) /* Interrupt on low level */ -#define GPIO_INT_HIGHLEVEL (4 << GPIO_INT_SHIFT) /* Interrupt on high level */ - -/* If the pin is an GPIO digital output, then this identifies the initial output value: - * nnnn nnnn nnnn nnnn nnnn nnnn Vnnn nnnn - */ - -#define GPIO_VALUE_SHIFT 7 /* Bit 7: If output, inital value of output */ -#define GPIO_VALUE_MASK (1 << GPIO_VALUE_SHIFT) -#define GPIO_VALUE_ZERO (0 << GPIO_VALUE_SHIFT) /* Initial value is zero */ -#define GPIO_VALUE_ONE (1 << GPIO_VALUE_SHIFT) /* Initial value is one */ - -/* This identifies the GPIO port - * nnnn nnnn nnnn nnnn nnnn nnnn nPPP Pnnn - */ - -#define GPIO_PORT_SHIFT 3 /* Bit 3-6: Port number */ -#define GPIO_PORT_MASK (15 << GPIO_PORT_SHIFT) -#define GPIO_PORTA (0 << GPIO_PORT_SHIFT) /* GPIOA */ -#define GPIO_PORTB (1 << GPIO_PORT_SHIFT) /* GPIOB */ -#define GPIO_PORTC (2 << GPIO_PORT_SHIFT) /* GPIOC */ -#define GPIO_PORTD (3 << GPIO_PORT_SHIFT) /* GPIOD */ -#define GPIO_PORTE (4 << GPIO_PORT_SHIFT) /* GPIOE */ -#define GPIO_PORTF (5 << GPIO_PORT_SHIFT) /* GPIOF */ -#define GPIO_PORTG (6 << GPIO_PORT_SHIFT) /* GPIOG */ -#define GPIO_PORTH (7 << GPIO_PORT_SHIFT) /* GPIOH */ -#define GPIO_PORTJ (8 << GPIO_PORT_SHIFT) /* GPIOJ */ - -/* This identifies the bit in the port: - * nnnn nnnn nnnn nnnn nnnn nnnn nnnn nBBB - */ - -#define GPIO_NUMBER_SHIFT 0 /* Bits 0-2: GPIO number: 0-7 */ -#define GPIO_NUMBER_MASK (7 << GPIO_NUMBER_SHIFT) - /* The following lists the input value to lm3s_configgpio to setup the alternate, * hardware function for each pin. */ @@ -325,7 +221,6 @@ # define GPIO_UART2_RX (GPIO_FUNC_PFINPUT | GPIO_PORTG | 0) /* PA0: UART 0 receive (UGRx) */ # define GPIO_UART2_TX (GPIO_FUNC_PFOUTPUT | GPIO_PORTG | 1) /* PA1: UART 0 transmit (UGTx) */ - #elif defined(CONFIG_ARCH_CHIP_LM3S8962) # define GPIO_UART0_RX (GPIO_FUNC_PFINPUT | GPIO_PORTA | 0) /* PA0: UART 0 receive (U0Rx) */ # define GPIO_UART0_TX (GPIO_FUNC_PFOUTPUT | GPIO_PORTA | 1) /* PA1: UART 0 transmit (U0Tx) */ @@ -375,172 +270,12 @@ * Public Types ************************************************************************************/ -/************************************************************************************ - * Inline Functions - ************************************************************************************/ - -#ifndef __ASSEMBLY__ - /************************************************************************************ * Public Data ************************************************************************************/ -#undef EXTERN -#if defined(__cplusplus) -#define EXTERN extern "C" -extern "C" { -#else -#define EXTERN extern -#endif - /**************************************************************************** * Public Function Prototypes ****************************************************************************/ -/**************************************************************************** - * Name: up_lowsetup - * - * Description: - * Called at the very beginning of _start. Performs low level initialization. - * - ****************************************************************************/ - -EXTERN void up_lowsetup(void); - -/**************************************************************************** - * Name: lm3s_clockconfig - * - * Description: - * Called to change to new clock based on desired rcc and rcc2 settings. - * This is use to set up the initial clocking but can be used later to - * support slow clocked, low power consumption modes. - * - ****************************************************************************/ - -EXTERN void lm3s_clockconfig(uint32_t newrcc, uint32_t newrcc2); - -/**************************************************************************** - * Name: up_clockconfig - * - * Description: - * Called early in the bootsequence (before .data and .bss are available) - * in order to configure initial clocking. - * - ****************************************************************************/ - -EXTERN void up_clockconfig(void); - -/**************************************************************************** - * Name: lm3s_configgpio - * - * Description: - * Configure a GPIO pin based on bit-encoded description of the pin. - * - ****************************************************************************/ - -EXTERN int lm3s_configgpio(uint32_t cfgset); - -/**************************************************************************** - * Name: lm3s_gpiowrite - * - * Description: - * Write one or zero to the selected GPIO pin - * - ****************************************************************************/ - -EXTERN void lm3s_gpiowrite(uint32_t pinset, bool value); - -/**************************************************************************** - * Name: lm3s_gpioread - * - * Description: - * Read one or zero from the selected GPIO pin - * - ****************************************************************************/ - -EXTERN bool lm3s_gpioread(uint32_t pinset, bool value); - -/**************************************************************************** - * Function: lm3s_dumpgpio - * - * Description: - * Dump all GPIO registers associated with the provided base address - * - ****************************************************************************/ - -EXTERN int lm3s_dumpgpio(uint32_t pinset, const char *msg); - -/**************************************************************************** - * Name: gpio_irqinitialize - * - * Description: - * Initialize all vectors to the unexpected interrupt handler - * - ****************************************************************************/ - -EXTERN int weak_function gpio_irqinitialize(void); - -/**************************************************************************** - * Function: lm3s_ethinitialize - * - * Description: - * Initialize the Ethernet driver for one interface. If the LM3S chip - * supports multiple Ethernet controllers, then bould specific logic - * must implement up_netinitialize() and call this function to initialize - * the desiresed interfaces. - * - * Parameters: - * None - * - * Returned Value: - * OK on success; Negated errno on failure. - * - * Assumptions: - * - ****************************************************************************/ - -#if LM3S_NETHCONTROLLERS > 1 -EXTERN int lm3s_ethinitialize(int intf); -#endif - -/**************************************************************************** - * The external functions, lm3s_spiselect, lm3s_spistatus, and - * lm3s_spicmddata must be provided by board-specific logic. These are - * implementations of the select, status, and cmddata methods of the SPI - * interface defined by struct spi_ops_s (see include/nuttx/spi.h). - * All other methods (including up_spiinitialize()) are provided by common - * logic. To use this common SPI logic on your board: - * - * 1. Provide logic in lm3s_boardinitialize() to configure SPI chip select - * pins. - * 2. Provide lm3s_spiselect() and lm3s_spistatus() functions in your - * board-specific logic. These functions will perform chip selection and - * status operations using GPIOs in the way your board is configured. - * 3. If CONFIG_SPI_CMDDATA is defined in your NuttX configuration, provide - * the lm3s_spicmddata() function in your board-specific logic. This - * functions will perform cmd/data selection operations using GPIOs in - * the way your board is configured. - * 4. Add a call to up_spiinitialize() in your low level application - * initialization logic - * 5. The handle returned by up_spiinitialize() may then be used to bind the - * SPI driver to higher level logic (e.g., calling - * mmcsd_spislotinitialize(), for example, will bind the SPI driver to - * the SPI MMC/SD driver). - * - ****************************************************************************/ - -struct spi_dev_s; -enum spi_dev_e; -EXTERN void lm3s_spiselect(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected); -EXTERN uint8_t lm3s_spistatus(FAR struct spi_dev_s *dev, enum spi_dev_e devid); -#ifdef CONFIG_SPI_CMDDATA -EXTERN int lm3s_spicmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd); -#endif - -#undef EXTERN -#if defined(__cplusplus) -} -#endif - -#endif /* __ASSEMBLY__ */ -#endif /* __ARCH_ARM_SRC_LM3S_LM3S_INTERNAL_H */ +#endif /* __ARCH_ARM_SRC_LM3S_CHIP_LM3S_PINMAP_H */ diff --git a/nuttx/arch/arm/src/lm3s/chip/lm_pinmap.h b/nuttx/arch/arm/src/lm3s/chip/lm_pinmap.h new file mode 100644 index 0000000000..b00a6e7940 --- /dev/null +++ b/nuttx/arch/arm/src/lm3s/chip/lm_pinmap.h @@ -0,0 +1,69 @@ +/************************************************************************************ + * arch/arm/src/lm3s/chip/lm_pinmap.h + * + * Copyright (C) 2013 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * 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. + * + ************************************************************************************/ + +#ifndef __ARCH_ARM_SRC_LM3S_CHIP_LM_PINMAP_H +#define __ARCH_ARM_SRC_LM3S_CHIP_LM_PINMAP_H + +/************************************************************************************ + * Included Files + ************************************************************************************/ + +#include + +/* Include the memory map file for the specific Stellaris chip */ + +#ifdef CONFIG_ARCH_CHIP_LM3S +# include "chip/lm3s_pinmap.h" +#else +# error "Unsupported Stellaris PIN mapping" +#endif + +/************************************************************************************ + * Pre-processor Definitions + ************************************************************************************/ + +/************************************************************************************ + * Public Types + ************************************************************************************/ + +/************************************************************************************ + * Public Data + ************************************************************************************/ + +/************************************************************************************ + * Public Function Prototypes + ************************************************************************************/ + +#endif /* __ARCH_ARM_SRC_LM3S_CHIP_LM_PINMAP_H */ diff --git a/nuttx/arch/arm/src/lm3s/lm3s_dumpgpio.c b/nuttx/arch/arm/src/lm3s/lm3s_dumpgpio.c index 334a3930f9..9d205b7634 100644 --- a/nuttx/arch/arm/src/lm3s/lm3s_dumpgpio.c +++ b/nuttx/arch/arm/src/lm3s/lm3s_dumpgpio.c @@ -48,7 +48,7 @@ #include "up_arch.h" #include "chip.h" -#include "lm3s_internal.h" +#include "lm_gpio.h" /**************************************************************************** * Pre-processor Definitions diff --git a/nuttx/arch/arm/src/lm3s/lm3s_ethernet.c b/nuttx/arch/arm/src/lm3s/lm3s_ethernet.c index f7bbedb20c..f44b6654ff 100644 --- a/nuttx/arch/arm/src/lm3s/lm3s_ethernet.c +++ b/nuttx/arch/arm/src/lm3s/lm3s_ethernet.c @@ -58,7 +58,9 @@ #include "chip.h" #include "up_arch.h" -#include "lm3s_internal.h" +#include "lm_gpio.h" +#include "lm_ethernet.h" +#include "chip/lm_pinmap.h" /**************************************************************************** * Pre-processor Definitions diff --git a/nuttx/arch/arm/src/lm3s/lm3s_gpio.c b/nuttx/arch/arm/src/lm3s/lm3s_gpio.c index c345d113c6..dd005fdd19 100644 --- a/nuttx/arch/arm/src/lm3s/lm3s_gpio.c +++ b/nuttx/arch/arm/src/lm3s/lm3s_gpio.c @@ -50,7 +50,7 @@ #include "up_arch.h" #include "os_internal.h" -#include "lm3s_internal.h" +#include "lm_gpio.h" /**************************************************************************** * Pre-processor Definitions diff --git a/nuttx/arch/arm/src/lm3s/lm3s_gpioirq.c b/nuttx/arch/arm/src/lm3s/lm3s_gpioirq.c index 7cc5fea40c..511195f2d5 100644 --- a/nuttx/arch/arm/src/lm3s/lm3s_gpioirq.c +++ b/nuttx/arch/arm/src/lm3s/lm3s_gpioirq.c @@ -50,7 +50,8 @@ #include "up_arch.h" #include "os_internal.h" #include "irq_internal.h" -#include "lm3s_internal.h" + +#include "lm_gpio.h" /**************************************************************************** * Pre-processor Definitions diff --git a/nuttx/arch/arm/src/lm3s/lm3s_irq.c b/nuttx/arch/arm/src/lm3s/lm3s_irq.c index aa0ed6c879..2f0b9fa728 100644 --- a/nuttx/arch/arm/src/lm3s/lm3s_irq.c +++ b/nuttx/arch/arm/src/lm3s/lm3s_irq.c @@ -51,7 +51,9 @@ #include "up_arch.h" #include "os_internal.h" #include "up_internal.h" -#include "lm3s_internal.h" + +#include "chip.h" +#include "lm_gpio.h" /**************************************************************************** * Pre-processor Definitions diff --git a/nuttx/arch/arm/src/lm3s/lm3s_lowputc.c b/nuttx/arch/arm/src/lm3s/lm3s_lowputc.c index b1cb21b2c2..bdbd5a9065 100644 --- a/nuttx/arch/arm/src/lm3s/lm3s_lowputc.c +++ b/nuttx/arch/arm/src/lm3s/lm3s_lowputc.c @@ -46,7 +46,10 @@ #include "up_arch.h" #include "up_internal.h" -#include "lm3s_internal.h" +#include "lm_gpio.h" +#include "chip/lm_pinmap.h" + +#include "lm_lowputc.h" /************************************************************************** * Pre-processor Definitions diff --git a/nuttx/arch/arm/src/lm3s/lm3s_ssi.c b/nuttx/arch/arm/src/lm3s/lm3s_ssi.c index 8d19879927..8cd1cee077 100644 --- a/nuttx/arch/arm/src/lm3s/lm3s_ssi.c +++ b/nuttx/arch/arm/src/lm3s/lm3s_ssi.c @@ -56,7 +56,9 @@ #include "up_arch.h" #include "chip.h" -#include "lm3s_internal.h" +#include "lm_gpio.h" +#include "lm_ssi.h" +#include "chip/lm_pinmap.h" /**************************************************************************** * Pre-processor Definitions diff --git a/nuttx/arch/arm/src/lm3s/lm3s_start.c b/nuttx/arch/arm/src/lm3s/lm3s_start.c index f3f762b52f..341b82e507 100644 --- a/nuttx/arch/arm/src/lm3s/lm3s_start.c +++ b/nuttx/arch/arm/src/lm3s/lm3s_start.c @@ -49,7 +49,9 @@ #include "up_arch.h" #include "up_internal.h" -#include "lm3s_internal.h" + +#include "lm_lowputc.h" +#include "lm_syscontrol.h" /**************************************************************************** * Pre-processor Definitions diff --git a/nuttx/arch/arm/src/lm3s/lm3s_syscontrol.c b/nuttx/arch/arm/src/lm3s/lm3s_syscontrol.c index e26789d32f..3ad0cacb5c 100644 --- a/nuttx/arch/arm/src/lm3s/lm3s_syscontrol.c +++ b/nuttx/arch/arm/src/lm3s/lm3s_syscontrol.c @@ -49,7 +49,8 @@ #include "up_arch.h" #include "up_internal.h" -#include "lm3s_internal.h" +#include "chip.h" +#include "lm_syscontrol.h" /**************************************************************************** * Pre-processor Definitions diff --git a/nuttx/arch/arm/src/lm3s/lm3s_timerisr.c b/nuttx/arch/arm/src/lm3s/lm3s_timerisr.c index 4d42af5971..9cd912249f 100644 --- a/nuttx/arch/arm/src/lm3s/lm3s_timerisr.c +++ b/nuttx/arch/arm/src/lm3s/lm3s_timerisr.c @@ -51,7 +51,6 @@ #include "up_arch.h" #include "chip.h" -#include "lm3s_internal.h" /**************************************************************************** * Pre-processor Definitions diff --git a/nuttx/arch/arm/src/lm3s/lm_ethernet.h b/nuttx/arch/arm/src/lm3s/lm_ethernet.h new file mode 100644 index 0000000000..600955b95b --- /dev/null +++ b/nuttx/arch/arm/src/lm3s/lm_ethernet.h @@ -0,0 +1,103 @@ +/************************************************************************************ + * arch/arm/src/lm3s/lm_ethernet.h + * + * Copyright (C) 2009-2010, 2013 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * 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. + * + ************************************************************************************/ + +#ifndef __ARCH_ARM_SRC_LM3S_LM_ETHERNET_H +#define __ARCH_ARM_SRC_LM3S_LM_ETHERNET_H + +/************************************************************************************ + * Included Files + ************************************************************************************/ + +#include + +#include "chip.h" + +#if LM3S_NETHCONTROLLERS > 1 + +/************************************************************************************ + * Pre-processor Definitions + ************************************************************************************/ + +/************************************************************************************ + * Public Types + ************************************************************************************/ + +/************************************************************************************ + * Inline Functions + ************************************************************************************/ + +#ifndef __ASSEMBLY__ + +/************************************************************************************ + * Public Data + ************************************************************************************/ + +#if defined(__cplusplus) +extern "C" +{ +#endif + +/**************************************************************************** + * Public Function Prototypes + ****************************************************************************/ + +/**************************************************************************** + * Function: lm3s_ethinitialize + * + * Description: + * Initialize the Ethernet driver for one interface. If the LM3S chip + * supports multiple Ethernet controllers, then bould specific logic + * must implement up_netinitialize() and call this function to initialize + * the desiresed interfaces. + * + * Parameters: + * None + * + * Returned Value: + * OK on success; Negated errno on failure. + * + * Assumptions: + * + ****************************************************************************/ + +int lm3s_ethinitialize(int intf); + +#if defined(__cplusplus) +} +#endif + +#endif /* __ASSEMBLY__ */ +#endif /* LM3S_NETHCONTROLLERS > 1 */ +#endif /* __ARCH_ARM_SRC_LM3S_LM_ETHERNET_H */ diff --git a/nuttx/arch/arm/src/lm3s/lm_gpio.h b/nuttx/arch/arm/src/lm3s/lm_gpio.h new file mode 100644 index 0000000000..1bfb79fc90 --- /dev/null +++ b/nuttx/arch/arm/src/lm3s/lm_gpio.h @@ -0,0 +1,223 @@ +/************************************************************************************ + * arch/arm/src/lm3s/lm_gpio.h + * + * Copyright (C) 2009-2010, 2013 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * 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. + * + ************************************************************************************/ + +#ifndef __ARCH_ARM_SRC_LM3S_LM_GPIO_H +#define __ARCH_ARM_SRC_LM3S_LM_GPIO_H + +/************************************************************************************ + * Included Files + ************************************************************************************/ + +#include +#include + +#include +#include + +#include "up_internal.h" +#include "chip.h" + +/************************************************************************************ + * Pre-processor Definitions + ************************************************************************************/ + +/* Bit-encoded input to lm3s_configgpio() *******************************************/ + +/* Encoding: + * FFFS SPPP IIIn nnnn nnnn nnnn VPPP PBBB + * + * These bits set the primary function of the pin: + * FFFn nnnn nnnn nnnn nnnn nnnn nnnn nnnn + */ + +#define GPIO_FUNC_SHIFT 29 /* Bit 31-29: GPIO function */ +#define GPIO_FUNC_MASK (7 << GPIO_FUNC_SHIFT) /* (See table 9-1 in data sheet) */ +#define GPIO_FUNC_INPUT (0 << GPIO_FUNC_SHIFT) /* Digital GPIO input */ +#define GPIO_FUNC_OUTPUT (1 << GPIO_FUNC_SHIFT) /* Digital GPIO output */ +#define GPIO_FUNC_ODINPUT (2 << GPIO_FUNC_SHIFT) /* Open-drain GPIO input */ +#define GPIO_FUNC_ODOUTPUT (3 << GPIO_FUNC_SHIFT) /* Open-drain GPIO output */ +#define GPIO_FUNC_PFODIO (4 << GPIO_FUNC_SHIFT) /* Open-drain input/output (I2C) */ +#define GPIO_FUNC_PFINPUT (5 << GPIO_FUNC_SHIFT) /* Digital input (Timer, CCP) */ +#define GPIO_FUNC_PFOUTPUT (5 << GPIO_FUNC_SHIFT) /* Digital output (Timer, PWM, Comparator) */ +#define GPIO_FUNC_PFIO (5 << GPIO_FUNC_SHIFT) /* Digital input/output (SSI, UART) */ +#define GPIO_FUNC_ANINPUT (6 << GPIO_FUNC_SHIFT) /* Analog input (Comparator) */ +#define GPIO_FUNC_INTERRUPT (7 << GPIO_FUNC_SHIFT) /* Interrupt function */ +#define GPIO_FUNC_MAX GPIO_FUNC_INTERRUPT + +/* That primary may be modified by the following options + * nnnS SPPP nnnn nnnn nnnn nnnn nnnn nnnn + */ + +#define GPIO_STRENGTH_SHIFT 27 /* Bits 28-27: Pad drive strength */ +#define GPIO_STRENGTH_MASK (3 << GPIO_STRENGTH_SHIFT) +#define GPIO_STRENGTH_2MA (0 << GPIO_STRENGTH_SHIFT) /* 2mA pad drive strength */ +#define GPIO_STRENGTH_4MA (1 << GPIO_STRENGTH_SHIFT) /* 4mA pad drive strength */ +#define GPIO_STRENGTH_8MA (2 << GPIO_STRENGTH_SHIFT) /* 8mA pad drive strength */ +#define GPIO_STRENGTH_8MASC (3 << GPIO_STRENGTH_SHIFT) /* 8mA Pad drive with slew rate control */ +#define GPIO_STRENGTH_MAX GPIO_STRENGTH_8MASC + +#define GPIO_PADTYPE_SHIFT 24 /* Bits 26-24: Pad type */ +#define GPIO_PADTYPE_MASK (7 << GPIO_PADTYPE_SHIFT) +#define GPIO_PADTYPE_STD (0 << GPIO_PADTYPE_SHIFT) /* Push-pull */ +#define GPIO_PADTYPE_STDWPU (1 << GPIO_PADTYPE_SHIFT) /* Push-pull with weak pull-up */ +#define GPIO_PADTYPE_STDWPD (2 << GPIO_PADTYPE_SHIFT) /* Push-pull with weak pull-down */ +#define GPIO_PADTYPE_OD (3 << GPIO_PADTYPE_SHIFT) /* Open-drain */ +#define GPIO_PADTYPE_ODWPU (4 << GPIO_PADTYPE_SHIFT) /* Open-drain with weak pull-up */ +#define GPIO_PADTYPE_ODWPD (5 << GPIO_PADTYPE_SHIFT) /* Open-drain with weak pull-down */ +#define GPIO_PADTYPE_ANALOG (6 << GPIO_PADTYPE_SHIFT) /* Analog comparator */ + +/* If the pin is an interrupt, then the following options apply + * nnnn nnnn IIIn nnnn nnnn nnnn nnnn nnnn + */ + +#define GPIO_INT_SHIFT 21 /* Bits 23-21: Interrupt type */ +#define GPIO_INT_MASK (7 << GPIO_INT_SHIFT) +#define GPIO_INT_FALLINGEDGE (0 << GPIO_INT_SHIFT) /* Interrupt on falling edge */ +#define GPIO_INT_RISINGEDGE (1 << GPIO_INT_SHIFT) /* Interrupt on rising edge */ +#define GPIO_INT_BOTHEDGES (2 << GPIO_INT_SHIFT) /* Interrupt on both edges */ +#define GPIO_INT_LOWLEVEL (3 << GPIO_INT_SHIFT) /* Interrupt on low level */ +#define GPIO_INT_HIGHLEVEL (4 << GPIO_INT_SHIFT) /* Interrupt on high level */ + +/* If the pin is an GPIO digital output, then this identifies the initial output value: + * nnnn nnnn nnnn nnnn nnnn nnnn Vnnn nnnn + */ + +#define GPIO_VALUE_SHIFT 7 /* Bit 7: If output, inital value of output */ +#define GPIO_VALUE_MASK (1 << GPIO_VALUE_SHIFT) +#define GPIO_VALUE_ZERO (0 << GPIO_VALUE_SHIFT) /* Initial value is zero */ +#define GPIO_VALUE_ONE (1 << GPIO_VALUE_SHIFT) /* Initial value is one */ + +/* This identifies the GPIO port + * nnnn nnnn nnnn nnnn nnnn nnnn nPPP Pnnn + */ + +#define GPIO_PORT_SHIFT 3 /* Bit 3-6: Port number */ +#define GPIO_PORT_MASK (15 << GPIO_PORT_SHIFT) +#define GPIO_PORTA (0 << GPIO_PORT_SHIFT) /* GPIOA */ +#define GPIO_PORTB (1 << GPIO_PORT_SHIFT) /* GPIOB */ +#define GPIO_PORTC (2 << GPIO_PORT_SHIFT) /* GPIOC */ +#define GPIO_PORTD (3 << GPIO_PORT_SHIFT) /* GPIOD */ +#define GPIO_PORTE (4 << GPIO_PORT_SHIFT) /* GPIOE */ +#define GPIO_PORTF (5 << GPIO_PORT_SHIFT) /* GPIOF */ +#define GPIO_PORTG (6 << GPIO_PORT_SHIFT) /* GPIOG */ +#define GPIO_PORTH (7 << GPIO_PORT_SHIFT) /* GPIOH */ +#define GPIO_PORTJ (8 << GPIO_PORT_SHIFT) /* GPIOJ */ + +/* This identifies the bit in the port: + * nnnn nnnn nnnn nnnn nnnn nnnn nnnn nBBB + */ + +#define GPIO_NUMBER_SHIFT 0 /* Bits 0-2: GPIO number: 0-7 */ +#define GPIO_NUMBER_MASK (7 << GPIO_NUMBER_SHIFT) + +/************************************************************************************ + * Public Types + ************************************************************************************/ + +/************************************************************************************ + * Inline Functions + ************************************************************************************/ + +#ifndef __ASSEMBLY__ + +/************************************************************************************ + * Public Data + ************************************************************************************/ + +#if defined(__cplusplus) +extern "C" +{ +#endif + +/**************************************************************************** + * Public Function Prototypes + ****************************************************************************/ + +/**************************************************************************** + * Name: lm3s_configgpio + * + * Description: + * Configure a GPIO pin based on bit-encoded description of the pin. + * + ****************************************************************************/ + +int lm3s_configgpio(uint32_t cfgset); + +/**************************************************************************** + * Name: lm3s_gpiowrite + * + * Description: + * Write one or zero to the selected GPIO pin + * + ****************************************************************************/ + +void lm3s_gpiowrite(uint32_t pinset, bool value); + +/**************************************************************************** + * Name: lm3s_gpioread + * + * Description: + * Read one or zero from the selected GPIO pin + * + ****************************************************************************/ + +bool lm3s_gpioread(uint32_t pinset, bool value); + +/**************************************************************************** + * Function: lm3s_dumpgpio + * + * Description: + * Dump all GPIO registers associated with the provided base address + * + ****************************************************************************/ + +int lm3s_dumpgpio(uint32_t pinset, const char *msg); + +/**************************************************************************** + * Name: gpio_irqinitialize + * + * Description: + * Initialize all vectors to the unexpected interrupt handler + * + ****************************************************************************/ + +int weak_function gpio_irqinitialize(void); + +#if defined(__cplusplus) +} +#endif + +#endif /* __ASSEMBLY__ */ +#endif /* __ARCH_ARM_SRC_LM3S_LM_GPIO_H */ diff --git a/nuttx/arch/arm/src/lm3s/lm_lowputc.h b/nuttx/arch/arm/src/lm3s/lm_lowputc.h new file mode 100644 index 0000000000..8e2858ebf3 --- /dev/null +++ b/nuttx/arch/arm/src/lm3s/lm_lowputc.h @@ -0,0 +1,87 @@ +/************************************************************************************ + * arch/arm/src/lm3s/lm3s_lowputc.h + * + * Copyright (C) 2009-2010, 2013 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * 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. + * + ************************************************************************************/ + +#ifndef __ARCH_ARM_SRC_LM3S_LM_LOWPUTC_H +#define __ARCH_ARM_SRC_LM3S_LM_LOWPUTC_H + +/************************************************************************************ + * Included Files + ************************************************************************************/ + +#include + +/************************************************************************************ + * Pre-processor Definitions + ************************************************************************************/ + +/************************************************************************************ + * Public Types + ************************************************************************************/ + +/************************************************************************************ + * Inline Functions + ************************************************************************************/ + +#ifndef __ASSEMBLY__ + +/************************************************************************************ + * Public Data + ************************************************************************************/ + +#if defined(__cplusplus) +extern "C" +{ +#endif + +/**************************************************************************** + * Public Function Prototypes + ****************************************************************************/ + +/**************************************************************************** + * Name: up_lowsetup + * + * Description: + * Called at the very beginning of _start. Performs low level initialization. + * + ****************************************************************************/ + +void up_lowsetup(void); + +#if defined(__cplusplus) +} +#endif + +#endif /* __ASSEMBLY__ */ +#endif /* __ARCH_ARM_SRC_LM3S_LM_LOWPUTC_H */ diff --git a/nuttx/arch/arm/src/lm3s/lm_ssi.h b/nuttx/arch/arm/src/lm3s/lm_ssi.h new file mode 100644 index 0000000000..dd1e30817d --- /dev/null +++ b/nuttx/arch/arm/src/lm3s/lm_ssi.h @@ -0,0 +1,114 @@ +/************************************************************************************ + * arch/arm/src/lm3s/lm_ssi.h + * + * Copyright (C) 2009-2010, 2013 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * 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. + * + ************************************************************************************/ + +#ifndef __ARCH_ARM_SRC_LM3S_LM_SSI_H +#define __ARCH_ARM_SRC_LM3S_LM_SSI_H + +/************************************************************************************ + * Included Files + ************************************************************************************/ + +#include + +#include +#include + +/************************************************************************************ + * Pre-processor Definitions + ************************************************************************************/ + +/************************************************************************************ + * Public Types + ************************************************************************************/ + +/************************************************************************************ + * Inline Functions + ************************************************************************************/ + +#ifndef __ASSEMBLY__ + +/************************************************************************************ + * Public Data + ************************************************************************************/ + +#if defined(__cplusplus) +extern "C" +{ +#endif + +/**************************************************************************** + * Public Function Prototypes + ****************************************************************************/ + +/**************************************************************************** + * The external functions, lm3s_spiselect, lm3s_spistatus, and + * lm3s_spicmddata must be provided by board-specific logic. These are + * implementations of the select, status, and cmddata methods of the SPI + * interface defined by struct spi_ops_s (see include/nuttx/spi.h). + * All other methods (including up_spiinitialize()) are provided by common + * logic. To use this common SPI logic on your board: + * + * 1. Provide logic in lm3s_boardinitialize() to configure SPI chip select + * pins. + * 2. Provide lm3s_spiselect() and lm3s_spistatus() functions in your + * board-specific logic. These functions will perform chip selection and + * status operations using GPIOs in the way your board is configured. + * 3. If CONFIG_SPI_CMDDATA is defined in your NuttX configuration, provide + * the lm3s_spicmddata() function in your board-specific logic. This + * functions will perform cmd/data selection operations using GPIOs in + * the way your board is configured. + * 4. Add a call to up_spiinitialize() in your low level application + * initialization logic + * 5. The handle returned by up_spiinitialize() may then be used to bind the + * SPI driver to higher level logic (e.g., calling + * mmcsd_spislotinitialize(), for example, will bind the SPI driver to + * the SPI MMC/SD driver). + * + ****************************************************************************/ + +struct spi_dev_s; +enum spi_dev_e; +void lm3s_spiselect(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected); +uint8_t lm3s_spistatus(FAR struct spi_dev_s *dev, enum spi_dev_e devid); +#ifdef CONFIG_SPI_CMDDATA +int lm3s_spicmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd); +#endif + +#if defined(__cplusplus) +} +#endif + +#endif /* __ASSEMBLY__ */ +#endif /* __ARCH_ARM_SRC_LM3S_LM_SSI_H */ diff --git a/nuttx/arch/arm/src/lm3s/lm_syscontrol.h b/nuttx/arch/arm/src/lm3s/lm_syscontrol.h new file mode 100644 index 0000000000..7c49da5658 --- /dev/null +++ b/nuttx/arch/arm/src/lm3s/lm_syscontrol.h @@ -0,0 +1,100 @@ +/************************************************************************************ + * arch/arm/src/lm3s/lm3s_syscontrol.h + * + * Copyright (C) 2009-2010, 2013 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * 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. + * + ************************************************************************************/ + +#ifndef __ARCH_ARM_SRC_LM3S_LM_SYSCONTROL_H +#define __ARCH_ARM_SRC_LM3S_LM_SYSCONTROL_H + +/************************************************************************************ + * Included Files + ************************************************************************************/ + +#include + +/************************************************************************************ + * Pre-processor Definitions + ************************************************************************************/ + +/************************************************************************************ + * Public Types + ************************************************************************************/ + +/************************************************************************************ + * Inline Functions + ************************************************************************************/ + +#ifndef __ASSEMBLY__ + +/************************************************************************************ + * Public Data + ************************************************************************************/ + +#if defined(__cplusplus) +extern "C" +{ +#endif + +/**************************************************************************** + * Public Function Prototypes + ****************************************************************************/ + +/**************************************************************************** + * Name: lm3s_clockconfig + * + * Description: + * Called to change to new clock based on desired rcc and rcc2 settings. + * This is use to set up the initial clocking but can be used later to + * support slow clocked, low power consumption modes. + * + ****************************************************************************/ + +void lm3s_clockconfig(uint32_t newrcc, uint32_t newrcc2); + +/**************************************************************************** + * Name: up_clockconfig + * + * Description: + * Called early in the bootsequence (before .data and .bss are available) + * in order to configure initial clocking. + * + ****************************************************************************/ + +void up_clockconfig(void); + +#if defined(__cplusplus) +} +#endif + +#endif /* __ASSEMBLY__ */ +#endif /* __ARCH_ARM_SRC_LM3S_LM_SYSCONTROL_H */ diff --git a/nuttx/configs/eagle100/httpd/defconfig b/nuttx/configs/eagle100/httpd/defconfig index 2d8f82180e..c2ea86bed8 100644 --- a/nuttx/configs/eagle100/httpd/defconfig +++ b/nuttx/configs/eagle100/httpd/defconfig @@ -39,6 +39,7 @@ CONFIG_ARCH="arm" CONFIG_ARCH_ARM=y CONFIG_ARCH_CORTEXM3=y CONFIG_ARCH_CHIP="lm3s" +CONFIG_ARCH_CHIP_LM3S=y CONFIG_ARCH_CHIP_LM3S6918=y CONFIG_ARCH_BOARD="eagle100" CONFIG_ARCH_BOARD_EAGLE100=y diff --git a/nuttx/configs/eagle100/nettest/defconfig b/nuttx/configs/eagle100/nettest/defconfig index fa07402085..2dab94846f 100644 --- a/nuttx/configs/eagle100/nettest/defconfig +++ b/nuttx/configs/eagle100/nettest/defconfig @@ -39,6 +39,7 @@ CONFIG_ARCH="arm" CONFIG_ARCH_ARM=y CONFIG_ARCH_CORTEXM3=y CONFIG_ARCH_CHIP="lm3s" +CONFIG_ARCH_CHIP_LM3S=y CONFIG_ARCH_CHIP_LM3S6918=y CONFIG_ARCH_BOARD="eagle100" CONFIG_ARCH_BOARD_EAGLE100=y diff --git a/nuttx/configs/eagle100/nsh/defconfig b/nuttx/configs/eagle100/nsh/defconfig index d8041c299c..fd141bc80d 100644 --- a/nuttx/configs/eagle100/nsh/defconfig +++ b/nuttx/configs/eagle100/nsh/defconfig @@ -39,6 +39,7 @@ CONFIG_ARCH="arm" CONFIG_ARCH_ARM=y CONFIG_ARCH_CORTEXM3=y CONFIG_ARCH_CHIP="lm3s" +CONFIG_ARCH_CHIP_LM3S=y CONFIG_ARCH_CHIP_LM3S6918=y CONFIG_ARCH_BOARD="eagle100" CONFIG_ARCH_BOARD_EAGLE100=y diff --git a/nuttx/configs/eagle100/nxflat/defconfig b/nuttx/configs/eagle100/nxflat/defconfig index 756902bb0f..20cd50432c 100644 --- a/nuttx/configs/eagle100/nxflat/defconfig +++ b/nuttx/configs/eagle100/nxflat/defconfig @@ -39,6 +39,7 @@ CONFIG_ARCH="arm" CONFIG_ARCH_ARM=y CONFIG_ARCH_CORTEXM3=y CONFIG_ARCH_CHIP="lm3s" +CONFIG_ARCH_CHIP_LM3S=y CONFIG_ARCH_CHIP_LM3S6918=y CONFIG_ARCH_BOARD="eagle100" CONFIG_ARCH_BOARD_EAGLE100=y diff --git a/nuttx/configs/eagle100/ostest/defconfig b/nuttx/configs/eagle100/ostest/defconfig index 43c77fe07f..01f3be334f 100644 --- a/nuttx/configs/eagle100/ostest/defconfig +++ b/nuttx/configs/eagle100/ostest/defconfig @@ -39,6 +39,7 @@ CONFIG_ARCH="arm" CONFIG_ARCH_ARM=y CONFIG_ARCH_CORTEXM3=y CONFIG_ARCH_CHIP="lm3s" +CONFIG_ARCH_CHIP_LM3S=y CONFIG_ARCH_CHIP_LM3S6918=y CONFIG_ARCH_BOARD="eagle100" CONFIG_ARCH_BOARD_EAGLE100=y diff --git a/nuttx/configs/eagle100/src/eagle100_internal.h b/nuttx/configs/eagle100/src/eagle100_internal.h index 88d2bf3b0e..d8bcd6a810 100644 --- a/nuttx/configs/eagle100/src/eagle100_internal.h +++ b/nuttx/configs/eagle100/src/eagle100_internal.h @@ -45,6 +45,7 @@ #include #include "chip.h" +#include "lm_gpio.h" /************************************************************************************ * Definitions diff --git a/nuttx/configs/eagle100/src/up_leds.c b/nuttx/configs/eagle100/src/up_leds.c index 59b489c114..0124b964bd 100644 --- a/nuttx/configs/eagle100/src/up_leds.c +++ b/nuttx/configs/eagle100/src/up_leds.c @@ -48,7 +48,7 @@ #include "chip.h" #include "up_arch.h" #include "up_internal.h" -#include "lm3s_internal.h" +#include "lm_gpio.h" #include "eagle100_internal.h" /**************************************************************************** diff --git a/nuttx/configs/eagle100/src/up_ssi.c b/nuttx/configs/eagle100/src/up_ssi.c index fb5f99df34..b78a0d67ca 100644 --- a/nuttx/configs/eagle100/src/up_ssi.c +++ b/nuttx/configs/eagle100/src/up_ssi.c @@ -49,7 +49,7 @@ #include "up_arch.h" #include "chip.h" -#include "lm3s_internal.h" +#include "lm_gpio.h" #include "eagle100_internal.h" /* The Eagle100 microSD CS is on SSI0 */ diff --git a/nuttx/configs/eagle100/thttpd/defconfig b/nuttx/configs/eagle100/thttpd/defconfig index dceac09900..460bd64b33 100644 --- a/nuttx/configs/eagle100/thttpd/defconfig +++ b/nuttx/configs/eagle100/thttpd/defconfig @@ -39,6 +39,7 @@ CONFIG_ARCH="arm" CONFIG_ARCH_ARM=y CONFIG_ARCH_CORTEXM3=y CONFIG_ARCH_CHIP="lm3s" +CONFIG_ARCH_CHIP_LM3S=y CONFIG_ARCH_CHIP_LM3S6918=y CONFIG_ARCH_BOARD="eagle100" CONFIG_ARCH_BOARD_EAGLE100=y diff --git a/nuttx/configs/ekk-lm3s9b96/nsh/defconfig b/nuttx/configs/ekk-lm3s9b96/nsh/defconfig index 82ad3ce5dd..d8ae63cfff 100644 --- a/nuttx/configs/ekk-lm3s9b96/nsh/defconfig +++ b/nuttx/configs/ekk-lm3s9b96/nsh/defconfig @@ -40,6 +40,7 @@ CONFIG_ARCH="arm" CONFIG_ARCH_ARM=y CONFIG_ARCH_CORTEXM3=y CONFIG_ARCH_CHIP="lm3s" +CONFIG_ARCH_CHIP_LM3S=y CONFIG_ARCH_CHIP_LM3S9B96=y CONFIG_ARCH_BOARD="ekk-lm3s9b96" CONFIG_ARCH_BOARD_EKKLM3S9B96=y diff --git a/nuttx/configs/ekk-lm3s9b96/ostest/defconfig b/nuttx/configs/ekk-lm3s9b96/ostest/defconfig index bcf2a94262..62a092d1f2 100644 --- a/nuttx/configs/ekk-lm3s9b96/ostest/defconfig +++ b/nuttx/configs/ekk-lm3s9b96/ostest/defconfig @@ -40,6 +40,7 @@ CONFIG_ARCH="arm" CONFIG_ARCH_ARM=y CONFIG_ARCH_CORTEXM3=y CONFIG_ARCH_CHIP="lm3s" +CONFIG_ARCH_CHIP_LM3S=y CONFIG_ARCH_CHIP_LM3S9B96=y CONFIG_ARCH_BOARD="ekk-lm3s9b96" CONFIG_ARCH_BOARD_EKKLM3S9B96=y diff --git a/nuttx/configs/ekk-lm3s9b96/src/ekklm3s9b96_internal.h b/nuttx/configs/ekk-lm3s9b96/src/ekklm3s9b96_internal.h index fd8ff3adb1..bb3315f5b2 100644 --- a/nuttx/configs/ekk-lm3s9b96/src/ekklm3s9b96_internal.h +++ b/nuttx/configs/ekk-lm3s9b96/src/ekklm3s9b96_internal.h @@ -46,6 +46,7 @@ #include #include "chip.h" +#include "lm_gpio.h" /************************************************************************************ * Definitions diff --git a/nuttx/configs/ekk-lm3s9b96/src/up_leds.c b/nuttx/configs/ekk-lm3s9b96/src/up_leds.c index 5ed84c2d26..7628fcfe0a 100644 --- a/nuttx/configs/ekk-lm3s9b96/src/up_leds.c +++ b/nuttx/configs/ekk-lm3s9b96/src/up_leds.c @@ -49,7 +49,7 @@ #include "chip.h" #include "up_arch.h" #include "up_internal.h" -#include "lm3s_internal.h" +#include "lm_gpio.h" #include "ekklm3s9b96_internal.h" /**************************************************************************** diff --git a/nuttx/configs/ekk-lm3s9b96/src/up_ssi.c b/nuttx/configs/ekk-lm3s9b96/src/up_ssi.c index 2fe3b81c86..8f297e7a79 100644 --- a/nuttx/configs/ekk-lm3s9b96/src/up_ssi.c +++ b/nuttx/configs/ekk-lm3s9b96/src/up_ssi.c @@ -50,7 +50,7 @@ #include "up_arch.h" #include "chip.h" -#include "lm3s_internal.h" +#include "lm_gpio.h" #include "ekklm3s9b96_internal.h" #if !defined(CONFIG_SSI0_DISABLE) || !defined(CONFIG_SSI1_DISABLE) diff --git a/nuttx/configs/lm3s6432-s2e/nsh/defconfig b/nuttx/configs/lm3s6432-s2e/nsh/defconfig index 704d8ad91a..7d1657cda5 100644 --- a/nuttx/configs/lm3s6432-s2e/nsh/defconfig +++ b/nuttx/configs/lm3s6432-s2e/nsh/defconfig @@ -39,6 +39,7 @@ CONFIG_ARCH="arm" CONFIG_ARCH_ARM=y CONFIG_ARCH_CORTEXM3=y CONFIG_ARCH_CHIP="lm3s" +CONFIG_ARCH_CHIP_LM3S=y CONFIG_ARCH_CHIP_LM3S6432=y CONFIG_ARCH_BOARD="lm3s6432-s2e" CONFIG_ARCH_BOARD_LM3S6432S2E=y diff --git a/nuttx/configs/lm3s6432-s2e/ostest/defconfig b/nuttx/configs/lm3s6432-s2e/ostest/defconfig index 0be2cfd4c2..90357ce7f5 100644 --- a/nuttx/configs/lm3s6432-s2e/ostest/defconfig +++ b/nuttx/configs/lm3s6432-s2e/ostest/defconfig @@ -39,6 +39,7 @@ CONFIG_ARCH="arm" CONFIG_ARCH_ARM=y CONFIG_ARCH_CORTEXM3=y CONFIG_ARCH_CHIP="lm3s" +CONFIG_ARCH_CHIP_LM3S=y CONFIG_ARCH_CHIP_LM3S6432=y CONFIG_ARCH_BOARD="lm3s6432-s2e" CONFIG_ARCH_BOARD_LM3S6432S2E=y diff --git a/nuttx/configs/lm3s6432-s2e/src/lm3s6432s2e_internal.h b/nuttx/configs/lm3s6432-s2e/src/lm3s6432s2e_internal.h index bd4cff77fc..f54403c7a8 100644 --- a/nuttx/configs/lm3s6432-s2e/src/lm3s6432s2e_internal.h +++ b/nuttx/configs/lm3s6432-s2e/src/lm3s6432s2e_internal.h @@ -44,6 +44,7 @@ #include #include "chip.h" +#include "lm_gpio.h" /************************************************************************************ * Definitions diff --git a/nuttx/configs/lm3s6432-s2e/src/up_boot.c b/nuttx/configs/lm3s6432-s2e/src/up_boot.c index 5bb7b670fe..1845296384 100644 --- a/nuttx/configs/lm3s6432-s2e/src/up_boot.c +++ b/nuttx/configs/lm3s6432-s2e/src/up_boot.c @@ -47,7 +47,7 @@ #include "up_arch.h" #include "chip.h" #include "up_internal.h" -#include "lm3s_internal.h" +#include "lm_gpio.h" #include "lm3s6432s2e_internal.h" /************************************************************************************ diff --git a/nuttx/configs/lm3s6432-s2e/src/up_leds.c b/nuttx/configs/lm3s6432-s2e/src/up_leds.c index 80fea934f9..81610db34f 100644 --- a/nuttx/configs/lm3s6432-s2e/src/up_leds.c +++ b/nuttx/configs/lm3s6432-s2e/src/up_leds.c @@ -48,7 +48,7 @@ #include "chip.h" #include "up_arch.h" #include "up_internal.h" -#include "lm3s_internal.h" +#include "lm_gpio.h" #include "lm3s6432s2e_internal.h" /**************************************************************************** diff --git a/nuttx/configs/lm3s6432-s2e/src/up_ssi.c b/nuttx/configs/lm3s6432-s2e/src/up_ssi.c index d20e1d978b..a7844a9791 100644 --- a/nuttx/configs/lm3s6432-s2e/src/up_ssi.c +++ b/nuttx/configs/lm3s6432-s2e/src/up_ssi.c @@ -49,7 +49,7 @@ #include "up_arch.h" #include "chip.h" -#include "lm3s_internal.h" +#include "lm_gpio.h" #include "lm3s6432s2e_internal.h" #if !defined(CONFIG_SSI0_DISABLE) diff --git a/nuttx/configs/lm3s6965-ek/src/lm3s6965ek_internal.h b/nuttx/configs/lm3s6965-ek/src/lm3s6965ek_internal.h index 621f00148c..8ebd4cf65a 100644 --- a/nuttx/configs/lm3s6965-ek/src/lm3s6965ek_internal.h +++ b/nuttx/configs/lm3s6965-ek/src/lm3s6965ek_internal.h @@ -45,6 +45,7 @@ #include #include "chip.h" +#include "lm_gpio.h" /************************************************************************************ * Definitions diff --git a/nuttx/configs/lm3s6965-ek/src/up_leds.c b/nuttx/configs/lm3s6965-ek/src/up_leds.c index 933c114467..efa1eb7388 100644 --- a/nuttx/configs/lm3s6965-ek/src/up_leds.c +++ b/nuttx/configs/lm3s6965-ek/src/up_leds.c @@ -48,7 +48,7 @@ #include "chip.h" #include "up_arch.h" #include "up_internal.h" -#include "lm3s_internal.h" +#include "lm_gpio.h" #include "lm3s6965ek_internal.h" /**************************************************************************** diff --git a/nuttx/configs/lm3s6965-ek/src/up_oled.c b/nuttx/configs/lm3s6965-ek/src/up_oled.c index 586927d536..23ce7e036c 100644 --- a/nuttx/configs/lm3s6965-ek/src/up_oled.c +++ b/nuttx/configs/lm3s6965-ek/src/up_oled.c @@ -48,7 +48,7 @@ #include #include -#include "lm3s_internal.h" +#include "lm_gpio.h" #include "lm3s6965ek_internal.h" /**************************************************************************** diff --git a/nuttx/configs/lm3s6965-ek/src/up_ssi.c b/nuttx/configs/lm3s6965-ek/src/up_ssi.c index 16111fcdaf..b52116f145 100644 --- a/nuttx/configs/lm3s6965-ek/src/up_ssi.c +++ b/nuttx/configs/lm3s6965-ek/src/up_ssi.c @@ -49,7 +49,7 @@ #include "up_arch.h" #include "chip.h" -#include "lm3s_internal.h" +#include "lm_gpio.h" #include "lm3s6965ek_internal.h" /* The LM3S6965 Eval Kit microSD CS is on SSI0 */ diff --git a/nuttx/configs/lm3s8962-ek/nsh/defconfig b/nuttx/configs/lm3s8962-ek/nsh/defconfig index 573ea582ef..79f90d5f9b 100755 --- a/nuttx/configs/lm3s8962-ek/nsh/defconfig +++ b/nuttx/configs/lm3s8962-ek/nsh/defconfig @@ -39,6 +39,7 @@ CONFIG_ARCH="arm" CONFIG_ARCH_ARM=y CONFIG_ARCH_CORTEXM3=y CONFIG_ARCH_CHIP="lm3s" +CONFIG_ARCH_CHIP_LM3S=y CONFIG_ARCH_CHIP_LM3S8962=y CONFIG_ARCH_BOARD="lm3s8962-ek" CONFIG_ARCH_BOARD_LM3S8962EK=y diff --git a/nuttx/configs/lm3s8962-ek/nx/defconfig b/nuttx/configs/lm3s8962-ek/nx/defconfig index 30c3b89522..8424b6623d 100755 --- a/nuttx/configs/lm3s8962-ek/nx/defconfig +++ b/nuttx/configs/lm3s8962-ek/nx/defconfig @@ -39,6 +39,7 @@ CONFIG_ARCH="arm" CONFIG_ARCH_ARM=y CONFIG_ARCH_CORTEXM3=y CONFIG_ARCH_CHIP="lm3s" +CONFIG_ARCH_CHIP_LM3S=y CONFIG_ARCH_CHIP_LM3S8962=y CONFIG_ARCH_BOARD="lm3s8962-ek" CONFIG_ARCH_BOARD_LM3S8962EK=y diff --git a/nuttx/configs/lm3s8962-ek/ostest/defconfig b/nuttx/configs/lm3s8962-ek/ostest/defconfig index e19cab1cc2..73fbff29fb 100755 --- a/nuttx/configs/lm3s8962-ek/ostest/defconfig +++ b/nuttx/configs/lm3s8962-ek/ostest/defconfig @@ -39,6 +39,7 @@ CONFIG_ARCH="arm" CONFIG_ARCH_ARM=y CONFIG_ARCH_CORTEXM3=y CONFIG_ARCH_CHIP="lm3s" +CONFIG_ARCH_CHIP_LM3S=y CONFIG_ARCH_CHIP_LM3S8962=y CONFIG_ARCH_BOARD="lm3s8962-ek" CONFIG_ARCH_BOARD_LM3S8962EK=y diff --git a/nuttx/configs/lm3s8962-ek/src/lm3s8962ek_internal.h b/nuttx/configs/lm3s8962-ek/src/lm3s8962ek_internal.h index 3b6175661b..689472f158 100644 --- a/nuttx/configs/lm3s8962-ek/src/lm3s8962ek_internal.h +++ b/nuttx/configs/lm3s8962-ek/src/lm3s8962ek_internal.h @@ -45,6 +45,7 @@ #include #include "chip.h" +#include "lm_gpio.h" /************************************************************************************ * Definitions diff --git a/nuttx/configs/lm3s8962-ek/src/up_leds.c b/nuttx/configs/lm3s8962-ek/src/up_leds.c index bff9204341..d5000d0379 100644 --- a/nuttx/configs/lm3s8962-ek/src/up_leds.c +++ b/nuttx/configs/lm3s8962-ek/src/up_leds.c @@ -48,7 +48,7 @@ #include "chip.h" #include "up_arch.h" #include "up_internal.h" -#include "lm3s_internal.h" +#include "lm_gpio.h" #include "lm3s8962ek_internal.h" /**************************************************************************** diff --git a/nuttx/configs/lm3s8962-ek/src/up_oled.c b/nuttx/configs/lm3s8962-ek/src/up_oled.c index 7611872794..3324b38974 100644 --- a/nuttx/configs/lm3s8962-ek/src/up_oled.c +++ b/nuttx/configs/lm3s8962-ek/src/up_oled.c @@ -48,7 +48,7 @@ #include #include -#include "lm3s_internal.h" +#include "lm_gpio.h" #include "lm3s8962ek_internal.h" /**************************************************************************** diff --git a/nuttx/configs/lm3s8962-ek/src/up_ssi.c b/nuttx/configs/lm3s8962-ek/src/up_ssi.c index 00e07c85d0..7f78b3477a 100644 --- a/nuttx/configs/lm3s8962-ek/src/up_ssi.c +++ b/nuttx/configs/lm3s8962-ek/src/up_ssi.c @@ -49,7 +49,7 @@ #include "up_arch.h" #include "chip.h" -#include "lm3s_internal.h" +#include "lm_gpio.h" #include "lm3s8962ek_internal.h" /* The LM3S8962 Eval Kit microSD CS is on SSI0 */ From 3f4d20628887f3d76705262fcbf18315bc31ea18 Mon Sep 17 00:00:00 2001 From: patacongo Date: Tue, 8 Jan 2013 20:56:40 +0000 Subject: [PATCH 048/118] Rename arch/arm/src/lm3s to arch/arm/src/lm to allow a namespace that will include the lm4f git-svn-id: http://svn.code.sf.net/p/nuttx/code/trunk@5495 42af7a65-404d-4744-a932-0658087f49c3 --- nuttx/ChangeLog | 3 +++ nuttx/TODO | 4 ++-- nuttx/arch/README.txt | 12 +++++----- nuttx/arch/arm/Kconfig | 9 ++++--- nuttx/arch/arm/include/{lm3s => lm}/chip.h | 8 +++---- nuttx/arch/arm/include/{lm3s => lm}/irq.h | 8 +++---- nuttx/arch/arm/src/{lm3s => lm}/Kconfig | 24 ++++++++++++++++--- nuttx/arch/arm/src/{lm3s => lm}/Make.defs | 2 +- nuttx/arch/arm/src/{lm3s => lm}/chip.h | 10 ++++---- .../arch/arm/src/{lm3s => lm}/chip/lm3s_epi.h | 8 +++---- .../arm/src/{lm3s => lm}/chip/lm3s_ethernet.h | 8 +++---- .../arm/src/{lm3s => lm}/chip/lm3s_flash.h | 8 +++---- .../arm/src/{lm3s => lm}/chip/lm3s_gpio.h | 8 +++---- .../arch/arm/src/{lm3s => lm}/chip/lm3s_i2c.h | 8 +++---- .../src/{lm3s => lm}/chip/lm3s_memorymap.h | 8 +++---- .../arm/src/{lm3s => lm}/chip/lm3s_pinmap.h | 8 +++---- .../arch/arm/src/{lm3s => lm}/chip/lm3s_ssi.h | 8 +++---- .../src/{lm3s => lm}/chip/lm3s_syscontrol.h | 8 +++---- .../arm/src/{lm3s => lm}/chip/lm3s_timer.h | 8 +++---- .../arm/src/{lm3s => lm}/chip/lm3s_uart.h | 8 +++---- .../arm/src/{lm3s => lm}/chip/lm_memorymap.h | 8 +++---- .../arm/src/{lm3s => lm}/chip/lm_pinmap.h | 8 +++---- .../arch/arm/src/{lm3s => lm}/lm3s_dumpgpio.c | 2 +- .../arch/arm/src/{lm3s => lm}/lm3s_ethernet.c | 2 +- nuttx/arch/arm/src/{lm3s => lm}/lm3s_gpio.c | 2 +- .../arch/arm/src/{lm3s => lm}/lm3s_gpioirq.c | 2 +- nuttx/arch/arm/src/{lm3s => lm}/lm3s_irq.c | 2 +- .../arch/arm/src/{lm3s => lm}/lm3s_lowputc.c | 2 +- nuttx/arch/arm/src/{lm3s => lm}/lm3s_serial.c | 2 +- nuttx/arch/arm/src/{lm3s => lm}/lm3s_ssi.c | 0 nuttx/arch/arm/src/{lm3s => lm}/lm3s_start.c | 2 +- .../arm/src/{lm3s => lm}/lm3s_syscontrol.c | 2 +- .../arch/arm/src/{lm3s => lm}/lm3s_timerisr.c | 2 +- .../arch/arm/src/{lm3s => lm}/lm3s_vectors.S | 2 +- nuttx/arch/arm/src/{lm3s => lm}/lm_ethernet.h | 8 +++---- nuttx/arch/arm/src/{lm3s => lm}/lm_gpio.h | 8 +++---- nuttx/arch/arm/src/{lm3s => lm}/lm_lowputc.h | 8 +++---- nuttx/arch/arm/src/{lm3s => lm}/lm_ssi.h | 8 +++---- .../arch/arm/src/{lm3s => lm}/lm_syscontrol.h | 8 +++---- nuttx/configs/eagle100/README.txt | 4 ++-- nuttx/configs/eagle100/httpd/defconfig | 3 ++- nuttx/configs/eagle100/nettest/defconfig | 3 ++- nuttx/configs/eagle100/nsh/defconfig | 3 ++- nuttx/configs/eagle100/nxflat/defconfig | 3 ++- nuttx/configs/eagle100/ostest/defconfig | 3 ++- nuttx/configs/eagle100/thttpd/defconfig | 3 ++- nuttx/configs/ekk-lm3s9b96/README.txt | 8 +++---- nuttx/configs/ekk-lm3s9b96/nsh/defconfig | 3 ++- nuttx/configs/ekk-lm3s9b96/ostest/defconfig | 3 ++- .../ekk-lm3s9b96/src/ekklm3s9b96_internal.h | 2 +- nuttx/configs/lm3s6432-s2e/README.txt | 6 ++--- nuttx/configs/lm3s6432-s2e/nsh/defconfig | 3 ++- nuttx/configs/lm3s6432-s2e/ostest/defconfig | 3 ++- nuttx/configs/lm3s6965-ek/README.txt | 8 +++---- nuttx/configs/lm3s6965-ek/nsh/defconfig | 3 ++- nuttx/configs/lm3s6965-ek/nx/defconfig | 3 ++- nuttx/configs/lm3s6965-ek/ostest/defconfig | 3 ++- .../lm3s6965-ek/src/lm3s6965ek_internal.h | 2 +- nuttx/configs/lm3s8962-ek/README.txt | 8 +++---- nuttx/configs/lm3s8962-ek/nsh/defconfig | 3 ++- nuttx/configs/lm3s8962-ek/nx/defconfig | 3 ++- nuttx/configs/lm3s8962-ek/ostest/defconfig | 3 ++- 62 files changed, 184 insertions(+), 148 deletions(-) rename nuttx/arch/arm/include/{lm3s => lm}/chip.h (97%) rename nuttx/arch/arm/include/{lm3s => lm}/irq.h (99%) rename nuttx/arch/arm/src/{lm3s => lm}/Kconfig (88%) rename nuttx/arch/arm/src/{lm3s => lm}/Make.defs (98%) rename nuttx/arch/arm/src/{lm3s => lm}/chip.h (95%) rename nuttx/arch/arm/src/{lm3s => lm}/chip/lm3s_epi.h (97%) rename nuttx/arch/arm/src/{lm3s => lm}/chip/lm3s_ethernet.h (98%) rename nuttx/arch/arm/src/{lm3s => lm}/chip/lm3s_flash.h (97%) rename nuttx/arch/arm/src/{lm3s => lm}/chip/lm3s_gpio.h (99%) rename nuttx/arch/arm/src/{lm3s => lm}/chip/lm3s_i2c.h (98%) rename nuttx/arch/arm/src/{lm3s => lm}/chip/lm3s_memorymap.h (99%) rename nuttx/arch/arm/src/{lm3s => lm}/chip/lm3s_pinmap.h (99%) rename nuttx/arch/arm/src/{lm3s => lm}/chip/lm3s_ssi.h (98%) rename nuttx/arch/arm/src/{lm3s => lm}/chip/lm3s_syscontrol.h (99%) rename nuttx/arch/arm/src/{lm3s => lm}/chip/lm3s_timer.h (97%) rename nuttx/arch/arm/src/{lm3s => lm}/chip/lm3s_uart.h (99%) rename nuttx/arch/arm/src/{lm3s => lm}/chip/lm_memorymap.h (94%) rename nuttx/arch/arm/src/{lm3s => lm}/chip/lm_pinmap.h (94%) rename nuttx/arch/arm/src/{lm3s => lm}/lm3s_dumpgpio.c (99%) rename nuttx/arch/arm/src/{lm3s => lm}/lm3s_ethernet.c (99%) rename nuttx/arch/arm/src/{lm3s => lm}/lm3s_gpio.c (99%) rename nuttx/arch/arm/src/{lm3s => lm}/lm3s_gpioirq.c (99%) rename nuttx/arch/arm/src/{lm3s => lm}/lm3s_irq.c (99%) rename nuttx/arch/arm/src/{lm3s => lm}/lm3s_lowputc.c (99%) rename nuttx/arch/arm/src/{lm3s => lm}/lm3s_serial.c (99%) rename nuttx/arch/arm/src/{lm3s => lm}/lm3s_ssi.c (100%) rename nuttx/arch/arm/src/{lm3s => lm}/lm3s_start.c (99%) rename nuttx/arch/arm/src/{lm3s => lm}/lm3s_syscontrol.c (99%) rename nuttx/arch/arm/src/{lm3s => lm}/lm3s_timerisr.c (99%) rename nuttx/arch/arm/src/{lm3s => lm}/lm3s_vectors.S (99%) rename nuttx/arch/arm/src/{lm3s => lm}/lm_ethernet.h (95%) rename nuttx/arch/arm/src/{lm3s => lm}/lm_gpio.h (98%) rename nuttx/arch/arm/src/{lm3s => lm}/lm_lowputc.h (95%) rename nuttx/arch/arm/src/{lm3s => lm}/lm_ssi.h (97%) rename nuttx/arch/arm/src/{lm3s => lm}/lm_syscontrol.h (95%) diff --git a/nuttx/ChangeLog b/nuttx/ChangeLog index edf500df67..35bf422538 100644 --- a/nuttx/ChangeLog +++ b/nuttx/ChangeLog @@ -3893,4 +3893,7 @@ into a new chip/ sub-directory. * arch/arm/src/lm3s/lm3s_internal.h: Broke up into several smaller header files. + * arch/arm/src/lm: Rename the arch/arm/src/lm3s directory to + arch/arm/src/lm so that is can support other members of the + Stellaris family. diff --git a/nuttx/TODO b/nuttx/TODO index c0b00d4979..72eb845bc2 100644 --- a/nuttx/TODO +++ b/nuttx/TODO @@ -30,7 +30,7 @@ nuttx/ (2) ARM/LPC313x (arch/arm/src/lpc313x/) (0) ARM/LPC43x (arch/arm/src/lpc43xx/) (3) ARM/STR71x (arch/arm/src/str71x/) - (3) ARM/LM3S6918 (arch/arm/src/lm3s/) + (3) ARM/LM3S6918 (arch/arm/src/lm/) (5) ARM/STM32 (arch/arm/src/stm32/) (3) AVR (arch/avr) (0) Intel x86 (arch/x86) @@ -1409,7 +1409,7 @@ o ARM/STR71x (arch/arm/src/str71x/) Status: Open Priority: Medium -- Will be very high if you do SPI access from multiple threads. -o ARM/LM3S6918 (arch/arm/src/lm3s/) +o ARM/LM3S6918 (arch/arm/src/lm/) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Title: I2C DRIVER diff --git a/nuttx/arch/README.txt b/nuttx/arch/README.txt index 67b99b255d..14704aa76b 100644 --- a/nuttx/arch/README.txt +++ b/nuttx/arch/README.txt @@ -170,12 +170,12 @@ arch/arm - ARM-based micro-controllers STATUS: This port has stalled because of development tool issues. Coding is complete on the basic port (timer, serial console, SPI). - arch/arm/include/lm3s and arch/arm/src/lm3s - These directories contain support for the Luminary LMS family, particularly - for the LM3S6918. The initial, release of this port was included in NuttX version - 0.4.6. The current port includes timer, serial console, Ethernet, SSI, and microSD - support. There are working configurations the NuttX OS test, to run the NuttShell - (NSH), the NuttX networking test, and the uIP web server. + arch/arm/include/lm and arch/arm/src/lm + These directories contain support for the Luminary LM3S/4F family. The + initial, release of this port was included in NuttX version 0.4.6. The + current port includes timer, serial console, Ethernet, SSI, and microSD + support. There are working configurations the NuttX OS test, to run the + NuttShell (NSH), the NuttX networking test, and the uIP web server. arch/arm/include/lpc214x and arch/arm/src/lpc214x These directories provide support for NXP LPC214x family of diff --git a/nuttx/arch/arm/Kconfig b/nuttx/arch/arm/Kconfig index 4fce8efbfb..bc7634695e 100644 --- a/nuttx/arch/arm/Kconfig +++ b/nuttx/arch/arm/Kconfig @@ -50,9 +50,8 @@ config ARCH_CHIP_KINETIS ---help--- Freescale Kinetis Architectures (ARM Cortex-M4) -config ARCH_CHIP_LM3S +config ARCH_CHIP_LM bool "TI Stellaris" - select ARCH_CORTEXM3 select ARCH_HAVE_MPU select ARCH_IRQPRIO ---help--- @@ -151,7 +150,7 @@ config ARCH_CHIP default "dm320" if ARCH_CHIP_DM320 default "imx" if ARCH_CHIP_IMX default "kinetis" if ARCH_CHIP_KINETIS - default "lm3s" if ARCH_CHIP_LM3S + default "lm" if ARCH_CHIP_LM default "lpc17xx" if ARCH_CHIP_LPC17XX default "lpc214x" if ARCH_CHIP_LPC214X default "lpc2378" if ARCH_CHIP_LPC2378 @@ -274,8 +273,8 @@ endif if ARCH_CHIP_KINETIS source arch/arm/src/kinetis/Kconfig endif -if ARCH_CHIP_LM3S -source arch/arm/src/lm3s/Kconfig +if ARCH_CHIP_LM +source arch/arm/src/lm/Kconfig endif if ARCH_CHIP_LPC17XX source arch/arm/src/lpc17xx/Kconfig diff --git a/nuttx/arch/arm/include/lm3s/chip.h b/nuttx/arch/arm/include/lm/chip.h similarity index 97% rename from nuttx/arch/arm/include/lm3s/chip.h rename to nuttx/arch/arm/include/lm/chip.h index d7e98a4613..9eee51922e 100644 --- a/nuttx/arch/arm/include/lm3s/chip.h +++ b/nuttx/arch/arm/include/lm/chip.h @@ -1,5 +1,5 @@ /************************************************************************************ - * arch/arm/include/lm3s/chip.h + * arch/arm/include/lm/chip.h * * Copyright (C) 2009-2010, 2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -33,8 +33,8 @@ * ************************************************************************************/ -#ifndef __ARCH_ARM_INCLUDE_LM3S_CHIP_H -#define __ARCH_ARM_INCLUDE_LM3S_CHIP_H +#ifndef __ARCH_ARM_INCLUDE_LM_CHIP_H +#define __ARCH_ARM_INCLUDE_LM_CHIP_H /************************************************************************************ * Included Files @@ -120,4 +120,4 @@ * Public Function Prototypes ****************************************************************************/ -#endif /* __ARCH_ARM_INCLUDE_LM3S_CHIP_H */ +#endif /* __ARCH_ARM_INCLUDE_LM_CHIP_H */ diff --git a/nuttx/arch/arm/include/lm3s/irq.h b/nuttx/arch/arm/include/lm/irq.h similarity index 99% rename from nuttx/arch/arm/include/lm3s/irq.h rename to nuttx/arch/arm/include/lm/irq.h index 6ffc7dec09..a80517e40d 100644 --- a/nuttx/arch/arm/include/lm3s/irq.h +++ b/nuttx/arch/arm/include/lm/irq.h @@ -1,5 +1,5 @@ /************************************************************************************ - * arch/arm/include/lm3s/irq.h + * arch/arm/include/lm/irq.h * * Copyright (C) 2009-2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -37,8 +37,8 @@ * only indirectly through nuttx/irq.h */ -#ifndef __ARCH_ARM_INCLUDE_LM3S_IRQ_H -#define __ARCH_ARM_INCLUDE_LM3S_IRQ_H +#ifndef __ARCH_ARM_INCLUDE_LM_IRQ_H +#define __ARCH_ARM_INCLUDE_LM_IRQ_H /************************************************************************************ * Included Files @@ -493,5 +493,5 @@ EXTERN void gpio_irqdisable(int irq); #endif #endif -#endif /* __ARCH_ARM_INCLUDE_LM3S_IRQ_H */ +#endif /* __ARCH_ARM_INCLUDE_LM_IRQ_H */ diff --git a/nuttx/arch/arm/src/lm3s/Kconfig b/nuttx/arch/arm/src/lm/Kconfig similarity index 88% rename from nuttx/arch/arm/src/lm3s/Kconfig rename to nuttx/arch/arm/src/lm/Kconfig index aaf8342fa6..74d1712f32 100644 --- a/nuttx/arch/arm/src/lm3s/Kconfig +++ b/nuttx/arch/arm/src/lm/Kconfig @@ -3,31 +3,49 @@ # see misc/tools/kconfig-language.txt. # -comment "LM3S Configuration Options" +comment "Stellaris Configuration Options" choice - prompt "LM3S Chip Selection" + prompt "Stellaris Chip Selection" default ARCH_CHIP_LM3S6965 - depends on ARCH_CHIP_LM3S + depends on ARCH_CHIP_LM config ARCH_CHIP_LM3S6918 bool "LM3S6918" + select ARCH_CORTEXM3 + select ARCH_CHIP_LM3S select LM3S_HAVE_SSI1 config ARCH_CHIP_LM3S9B96 bool "LM3S9B96" + select ARCH_CORTEXM3 + select ARCH_CHIP_LM3S config ARCH_CHIP_LM3S6432 bool "LM3S6432" + select ARCH_CORTEXM3 + select ARCH_CHIP_LM3S config ARCH_CHIP_LM3S6965 bool "LM3S6965" + select ARCH_CORTEXM3 + select ARCH_CHIP_LM3S config ARCH_CHIP_LM3S8962 bool "LM3S8962" + select ARCH_CORTEXM3 + select ARCH_CHIP_LM3S endchoice +# Chip families + +config ARCH_CHIP_LM3S + bool + +config ARCH_CHIP_LM4F + bool + config LM3S_HAVE_SSI1 bool diff --git a/nuttx/arch/arm/src/lm3s/Make.defs b/nuttx/arch/arm/src/lm/Make.defs similarity index 98% rename from nuttx/arch/arm/src/lm3s/Make.defs rename to nuttx/arch/arm/src/lm/Make.defs index 66b8f56583..aacbb1c831 100644 --- a/nuttx/arch/arm/src/lm3s/Make.defs +++ b/nuttx/arch/arm/src/lm/Make.defs @@ -1,5 +1,5 @@ ############################################################################ -# arch/arm/src/lm3s/Make.defs +# arch/arm/src/lm/Make.defs # # Copyright (C) 2009-2011, 2013 Gregory Nutt. All rights reserved. # Author: Gregory Nutt diff --git a/nuttx/arch/arm/src/lm3s/chip.h b/nuttx/arch/arm/src/lm/chip.h similarity index 95% rename from nuttx/arch/arm/src/lm3s/chip.h rename to nuttx/arch/arm/src/lm/chip.h index 481a9be159..5857b30949 100644 --- a/nuttx/arch/arm/src/lm3s/chip.h +++ b/nuttx/arch/arm/src/lm/chip.h @@ -1,5 +1,5 @@ /************************************************************************************ - * arch/arm/src/lm3s/chip.h + * arch/arm/src/lm/chip.h * * Copyright (C) 2009-2010 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -33,15 +33,15 @@ * ************************************************************************************/ -#ifndef __ARCH_ARM_SRC_LM3S_CHIP_H -#define __ARCH_ARM_SRC_LM3S_CHIP_H +#ifndef __ARCH_ARM_SRC_LM_CHIP_H +#define __ARCH_ARM_SRC_LM_CHIP_H /************************************************************************************ * Included Files ************************************************************************************/ #include -#include +#include /************************************************************************************ * Pre-processor Definitions @@ -80,4 +80,4 @@ * Public Function Prototypes ****************************************************************************/ -#endif /* __ARCH_ARM_SRC_LM3S_CHIP_H */ +#endif /* __ARCH_ARM_SRC_LM_CHIP_H */ diff --git a/nuttx/arch/arm/src/lm3s/chip/lm3s_epi.h b/nuttx/arch/arm/src/lm/chip/lm3s_epi.h similarity index 97% rename from nuttx/arch/arm/src/lm3s/chip/lm3s_epi.h rename to nuttx/arch/arm/src/lm/chip/lm3s_epi.h index 5b54d44ac4..82fc94f4c7 100644 --- a/nuttx/arch/arm/src/lm3s/chip/lm3s_epi.h +++ b/nuttx/arch/arm/src/lm/chip/lm3s_epi.h @@ -1,5 +1,5 @@ /************************************************************************************ - * arch/arm/src/lm3s/chip/lm3s_epi.h + * arch/arm/src/lm/chip/lm3s_epi.h * * Copyright (C) 2009-2013 Max Neklyudov. All rights reserved. * Author: Max Neklyudov @@ -33,8 +33,8 @@ * ************************************************************************************/ -#ifndef __ARCH_ARM_SRC_LM3S_CHIP_LM3S_EPI_H -#define __ARCH_ARM_SRC_LM3S_CHIP_LM3S_EPI_H +#ifndef __ARCH_ARM_SRC_LM_CHIP_LM3S_EPI_H +#define __ARCH_ARM_SRC_LM_CHIP_LM3S_EPI_H /************************************************************************************ * Included Files @@ -110,4 +110,4 @@ #define EPI_BAUD_COUNT0_MASK (0xFFFF << EPI_BAUD_COUNT0_SHIFT) # define EPI_BAUD_COUNT0(n) ((n) << EPI_BAUD_COUNT0_SHIFT) -#endif /* __ARCH_ARM_SRC_LM3S_CHIP_LM3S_EPI_H */ +#endif /* __ARCH_ARM_SRC_LM_CHIP_LM3S_EPI_H */ diff --git a/nuttx/arch/arm/src/lm3s/chip/lm3s_ethernet.h b/nuttx/arch/arm/src/lm/chip/lm3s_ethernet.h similarity index 98% rename from nuttx/arch/arm/src/lm3s/chip/lm3s_ethernet.h rename to nuttx/arch/arm/src/lm/chip/lm3s_ethernet.h index 940686e7de..512e962219 100644 --- a/nuttx/arch/arm/src/lm3s/chip/lm3s_ethernet.h +++ b/nuttx/arch/arm/src/lm/chip/lm3s_ethernet.h @@ -1,5 +1,5 @@ /************************************************************************************ - * arch/arm/src/lm3s/chip/lm3s_ethernet.h + * arch/arm/src/lm/chip/lm3s_ethernet.h * * Copyright (C) 2009-2010, 2012-2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -33,8 +33,8 @@ * ************************************************************************************/ -#ifndef __ARCH_ARM_SRC_LM3S_CHIP_LM3S_ETHERNET_H -#define __ARCH_ARM_SRC_LM3S_CHIP_LM3S_ETHERNET_H +#ifndef __ARCH_ARM_SRC_LM_CHIP_LM3S_ETHERNET_H +#define __ARCH_ARM_SRC_LM_CHIP_LM3S_ETHERNET_H /************************************************************************************ * Included Files @@ -200,4 +200,4 @@ * Public Function Prototypes ************************************************************************************/ -#endif /* __ARCH_ARM_SRC_LM3S_CHIP_LM3S_ETHERNET_H */ +#endif /* __ARCH_ARM_SRC_LM_CHIP_LM3S_ETHERNET_H */ diff --git a/nuttx/arch/arm/src/lm3s/chip/lm3s_flash.h b/nuttx/arch/arm/src/lm/chip/lm3s_flash.h similarity index 97% rename from nuttx/arch/arm/src/lm3s/chip/lm3s_flash.h rename to nuttx/arch/arm/src/lm/chip/lm3s_flash.h index 2bd8956b0a..2f6dc78fae 100644 --- a/nuttx/arch/arm/src/lm3s/chip/lm3s_flash.h +++ b/nuttx/arch/arm/src/lm/chip/lm3s_flash.h @@ -1,5 +1,5 @@ /************************************************************************************ - * arch/arm/src/lm3s/chip/lm3s_flash.h + * arch/arm/src/lm/chip/lm3s_flash.h * * Copyright (C) 2009, 2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -33,8 +33,8 @@ * ************************************************************************************/ -#ifndef __ARCH_ARM_SRC_LM3S_CHIP_LM3S_FLASH_H -#define __ARCH_ARM_SRC_LM3S_CHIP_LM3S_FLASH_H +#ifndef __ARCH_ARM_SRC_LM_CHIP_LM3S_FLASH_H +#define __ARCH_ARM_SRC_LM_CHIP_LM3S_FLASH_H /************************************************************************************ * Included Files @@ -125,4 +125,4 @@ * Public Function Prototypes ************************************************************************************/ -#endif /* __ARCH_ARM_SRC_LM3S_CHIP_LM3S_FLASH_H */ +#endif /* __ARCH_ARM_SRC_LM_CHIP_LM3S_FLASH_H */ diff --git a/nuttx/arch/arm/src/lm3s/chip/lm3s_gpio.h b/nuttx/arch/arm/src/lm/chip/lm3s_gpio.h similarity index 99% rename from nuttx/arch/arm/src/lm3s/chip/lm3s_gpio.h rename to nuttx/arch/arm/src/lm/chip/lm3s_gpio.h index 7253c1e7a8..2c199dae9d 100644 --- a/nuttx/arch/arm/src/lm3s/chip/lm3s_gpio.h +++ b/nuttx/arch/arm/src/lm/chip/lm3s_gpio.h @@ -1,5 +1,5 @@ /************************************************************************************ - * arch/arm/src/lm3s/chip/lm3s_gpio.h + * arch/arm/src/lm/chip/lm3s_gpio.h * * Copyright (C) 2009-2010, 2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -33,8 +33,8 @@ * ************************************************************************************/ -#ifndef __ARCH_ARM_SRC_LM3S_CHIP_LM3S_GPIO_H -#define __ARCH_ARM_SRC_LM3S_CHIP_LM3S_GPIO_H +#ifndef __ARCH_ARM_SRC_LM_CHIP_LM3S_GPIO_H +#define __ARCH_ARM_SRC_LM_CHIP_LM3S_GPIO_H /************************************************************************************ * Included Files @@ -392,4 +392,4 @@ * Public Function Prototypes ************************************************************************************/ -#endif /* __ARCH_ARM_SRC_LM3S_CHIP_LM3S_GPIO_H */ +#endif /* __ARCH_ARM_SRC_LM_CHIP_LM3S_GPIO_H */ diff --git a/nuttx/arch/arm/src/lm3s/chip/lm3s_i2c.h b/nuttx/arch/arm/src/lm/chip/lm3s_i2c.h similarity index 98% rename from nuttx/arch/arm/src/lm3s/chip/lm3s_i2c.h rename to nuttx/arch/arm/src/lm/chip/lm3s_i2c.h index 71ebe8fcf2..e029c4f3f3 100644 --- a/nuttx/arch/arm/src/lm3s/chip/lm3s_i2c.h +++ b/nuttx/arch/arm/src/lm/chip/lm3s_i2c.h @@ -1,5 +1,5 @@ /************************************************************************************ - * arch/arm/src/lm3s/chip/lm3s_i2c.h + * arch/arm/src/lm/chip/lm3s_i2c.h * * Copyright (C) 2009, 2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -33,8 +33,8 @@ * ************************************************************************************/ -#ifndef __ARCH_ARM_SRC_LM3S_CHIP_LM3S_I2C_H -#define __ARCH_ARM_SRC_LM3S_CHIP_LM3S_I2C_H +#ifndef __ARCH_ARM_SRC_LM_CHIP_LM3S_I2C_H +#define __ARCH_ARM_SRC_LM_CHIP_LM3S_I2C_H /************************************************************************************ * Included Files @@ -244,4 +244,4 @@ * Public Function Prototypes ****************************************************************************/ -#endif /* __ARCH_ARM_SRC_LM3S_CHIP_LM3S_I2C_H */ +#endif /* __ARCH_ARM_SRC_LM_CHIP_LM3S_I2C_H */ diff --git a/nuttx/arch/arm/src/lm3s/chip/lm3s_memorymap.h b/nuttx/arch/arm/src/lm/chip/lm3s_memorymap.h similarity index 99% rename from nuttx/arch/arm/src/lm3s/chip/lm3s_memorymap.h rename to nuttx/arch/arm/src/lm/chip/lm3s_memorymap.h index 31dc2b2490..51de04a2bd 100644 --- a/nuttx/arch/arm/src/lm3s/chip/lm3s_memorymap.h +++ b/nuttx/arch/arm/src/lm/chip/lm3s_memorymap.h @@ -1,5 +1,5 @@ /************************************************************************************ - * arch/arm/src/lm3s/chip/lm3s_memorymap.h + * arch/arm/src/lm/chip/lm3s_memorymap.h * * Copyright (C) 2009-2010 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -33,8 +33,8 @@ * ************************************************************************************/ -#ifndef __ARCH_ARM_SRC_LM3S_CHIP_LM3S_MEMORYMAP_H -#define __ARCH_ARM_SRC_LM3S_CHIP_LM3S_MEMORYMAP_H +#ifndef __ARCH_ARM_SRC_LM_CHIP_LM3S_MEMORYMAP_H +#define __ARCH_ARM_SRC_LM_CHIP_LM3S_MEMORYMAP_H /************************************************************************************ * Included Files @@ -357,4 +357,4 @@ * Public Function Prototypes ************************************************************************************/ -#endif /* __ARCH_ARM_SRC_LM3S_CHIP_LM3S_MEMORYMAP_H */ +#endif /* __ARCH_ARM_SRC_LM_CHIP_LM3S_MEMORYMAP_H */ diff --git a/nuttx/arch/arm/src/lm3s/chip/lm3s_pinmap.h b/nuttx/arch/arm/src/lm/chip/lm3s_pinmap.h similarity index 99% rename from nuttx/arch/arm/src/lm3s/chip/lm3s_pinmap.h rename to nuttx/arch/arm/src/lm/chip/lm3s_pinmap.h index 62a4a03fd0..85ec1369a3 100644 --- a/nuttx/arch/arm/src/lm3s/chip/lm3s_pinmap.h +++ b/nuttx/arch/arm/src/lm/chip/lm3s_pinmap.h @@ -1,5 +1,5 @@ /************************************************************************************ - * arch/arm/src/lm3s/chip/lm3s_pinmap.h + * arch/arm/src/lm/chip/lm3s_pinmap.h * * Copyright (C) 2009-2010, 2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -33,8 +33,8 @@ * ************************************************************************************/ -#ifndef __ARCH_ARM_SRC_LM3S_CHIP_LM3S_PINMAP_H -#define __ARCH_ARM_SRC_LM3S_CHIP_LM3S_PINMAP_H +#ifndef __ARCH_ARM_SRC_LM_CHIP_LM3S_PINMAP_H +#define __ARCH_ARM_SRC_LM_CHIP_LM3S_PINMAP_H /************************************************************************************ * Included Files @@ -278,4 +278,4 @@ * Public Function Prototypes ****************************************************************************/ -#endif /* __ARCH_ARM_SRC_LM3S_CHIP_LM3S_PINMAP_H */ +#endif /* __ARCH_ARM_SRC_LM_CHIP_LM3S_PINMAP_H */ diff --git a/nuttx/arch/arm/src/lm3s/chip/lm3s_ssi.h b/nuttx/arch/arm/src/lm/chip/lm3s_ssi.h similarity index 98% rename from nuttx/arch/arm/src/lm3s/chip/lm3s_ssi.h rename to nuttx/arch/arm/src/lm/chip/lm3s_ssi.h index b56ca77cb9..be5a766e54 100644 --- a/nuttx/arch/arm/src/lm3s/chip/lm3s_ssi.h +++ b/nuttx/arch/arm/src/lm/chip/lm3s_ssi.h @@ -1,5 +1,5 @@ /************************************************************************************ - * arch/arm/src/lm3s/chip/lm3s_ssi.h + * arch/arm/src/lm/chip/lm3s_ssi.h * * Copyright (C) 2009, 2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -33,8 +33,8 @@ * ************************************************************************************/ -#ifndef __ARCH_ARM_SRC_LM3S_CHIP_LM3S_SSI_H -#define __ARCH_ARM_SRC_LM3S_CHIP_LM3S_SSI_H +#ifndef __ARCH_ARM_SRC_LM_CHIP_LM3S_SSI_H +#define __ARCH_ARM_SRC_LM_CHIP_LM3S_SSI_H /************************************************************************************ * Included Files @@ -232,4 +232,4 @@ ************************************************************************************/ #endif /* LM3S_NSSI > 0 */ -#endif /* __ARCH_ARM_SRC_LM3S_CHIP_LM3S_SSI_H */ +#endif /* __ARCH_ARM_SRC_LM_CHIP_LM3S_SSI_H */ diff --git a/nuttx/arch/arm/src/lm3s/chip/lm3s_syscontrol.h b/nuttx/arch/arm/src/lm/chip/lm3s_syscontrol.h similarity index 99% rename from nuttx/arch/arm/src/lm3s/chip/lm3s_syscontrol.h rename to nuttx/arch/arm/src/lm/chip/lm3s_syscontrol.h index d66cfeb475..00a222ee37 100644 --- a/nuttx/arch/arm/src/lm3s/chip/lm3s_syscontrol.h +++ b/nuttx/arch/arm/src/lm/chip/lm3s_syscontrol.h @@ -1,5 +1,5 @@ /************************************************************************************ - * arch/arm/src/lm3s/chip/lm3s_syscontrol.h + * arch/arm/src/lm/chip/lm3s_syscontrol.h * * Copyright (C) 2009-2010, 2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -33,8 +33,8 @@ * ************************************************************************************/ -#ifndef __ARCH_ARM_SRC_LM3S_CHIP_LM3S_SYSCONTROL_H -#define __ARCH_ARM_SRC_LM3S_CHIP_LM3S_SYSCONTROL_H +#ifndef __ARCH_ARM_SRC_LM_CHIP_LM3S_SYSCONTROL_H +#define __ARCH_ARM_SRC_LM_CHIP_LM3S_SYSCONTROL_H /************************************************************************************ * Included Files @@ -492,4 +492,4 @@ * Public Functions ************************************************************************************/ -#endif /* __ARCH_ARM_SRC_LM3S_CHIP_LM3S_SYSCONTROL_H */ +#endif /* __ARCH_ARM_SRC_LM_CHIP_LM3S_SYSCONTROL_H */ diff --git a/nuttx/arch/arm/src/lm3s/chip/lm3s_timer.h b/nuttx/arch/arm/src/lm/chip/lm3s_timer.h similarity index 97% rename from nuttx/arch/arm/src/lm3s/chip/lm3s_timer.h rename to nuttx/arch/arm/src/lm/chip/lm3s_timer.h index 649737f130..6be963cc31 100644 --- a/nuttx/arch/arm/src/lm3s/chip/lm3s_timer.h +++ b/nuttx/arch/arm/src/lm/chip/lm3s_timer.h @@ -1,5 +1,5 @@ /************************************************************************************ - * arch/arm/src/lm3s/chip/lm3s_timer.h + * arch/arm/src/lm/chip/lm3s_timer.h * * Copyright (C) 2012 Max Nekludov. All rights reserved. * Author: Max Nekludov @@ -33,8 +33,8 @@ * ************************************************************************************/ -#ifndef __ARCH_ARM_SRC_LM3S_CHIP_LM3S_TIMER_H -#define __ARCH_ARM_SRC_LM3S_CHIP_LM3S_TIMER_H +#ifndef __ARCH_ARM_SRC_LM_CHIP_LM3S_TIMER_H +#define __ARCH_ARM_SRC_LM_CHIP_LM3S_TIMER_H /************************************************************************************ * Included Files @@ -122,4 +122,4 @@ #define TIMER_GPTMICR_TATOCINT_SHIFT 0 /* Bits 0: GPTM Timer A Time-Out Raw Interrupt Clear*/ #define TIMER_GPTMICR_TATOCINT_MASK (0x01 << TIMER_GPTMICR_TATOCINT_SHIFT) -#endif /* __ARCH_ARM_SRC_LM3S_CHIP_LM3S_TIMER_H */ +#endif /* __ARCH_ARM_SRC_LM_CHIP_LM3S_TIMER_H */ diff --git a/nuttx/arch/arm/src/lm3s/chip/lm3s_uart.h b/nuttx/arch/arm/src/lm/chip/lm3s_uart.h similarity index 99% rename from nuttx/arch/arm/src/lm3s/chip/lm3s_uart.h rename to nuttx/arch/arm/src/lm/chip/lm3s_uart.h index 0fef5ccf7d..98dcbce128 100644 --- a/nuttx/arch/arm/src/lm3s/chip/lm3s_uart.h +++ b/nuttx/arch/arm/src/lm/chip/lm3s_uart.h @@ -1,5 +1,5 @@ /************************************************************************************ - * arch/arm/src/lm3s/chip/lm3s_uart.h + * arch/arm/src/lm/chip/lm3s_uart.h * * Copyright (C) 2009, 2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -33,8 +33,8 @@ * ************************************************************************************/ -#ifndef __ARCH_ARM_SRC_LM3S_CHIP_LM3S_UART_H -#define __ARCH_ARM_SRC_LM3S_CHIP_LM3S_UART_H +#ifndef __ARCH_ARM_SRC_LM_CHIP_LM3S_UART_H +#define __ARCH_ARM_SRC_LM_CHIP_LM3S_UART_H /************************************************************************************ * Included Files @@ -344,4 +344,4 @@ * Public Functions ************************************************************************************/ -#endif /* __ARCH_ARM_SRC_LM3S_CHIP_LM3S_UART_H */ +#endif /* __ARCH_ARM_SRC_LM_CHIP_LM3S_UART_H */ diff --git a/nuttx/arch/arm/src/lm3s/chip/lm_memorymap.h b/nuttx/arch/arm/src/lm/chip/lm_memorymap.h similarity index 94% rename from nuttx/arch/arm/src/lm3s/chip/lm_memorymap.h rename to nuttx/arch/arm/src/lm/chip/lm_memorymap.h index c528578476..530ecdf647 100644 --- a/nuttx/arch/arm/src/lm3s/chip/lm_memorymap.h +++ b/nuttx/arch/arm/src/lm/chip/lm_memorymap.h @@ -1,5 +1,5 @@ /************************************************************************************ - * arch/arm/src/lm3s/chip/lm_memorymap.h + * arch/arm/src/lm/chip/lm_memorymap.h * * Copyright (C) 2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -33,8 +33,8 @@ * ************************************************************************************/ -#ifndef __ARCH_ARM_SRC_LM3S_CHIP_LM_MEMORYMAP_H -#define __ARCH_ARM_SRC_LM3S_CHIP_LM_MEMORYMAP_H +#ifndef __ARCH_ARM_SRC_LM_CHIP_LM_MEMORYMAP_H +#define __ARCH_ARM_SRC_LM_CHIP_LM_MEMORYMAP_H /************************************************************************************ * Included Files @@ -66,4 +66,4 @@ * Public Function Prototypes ************************************************************************************/ -#endif /* __ARCH_ARM_SRC_LM3S_CHIP_LM_MEMORYMAP_H */ +#endif /* __ARCH_ARM_SRC_LM_CHIP_LM_MEMORYMAP_H */ diff --git a/nuttx/arch/arm/src/lm3s/chip/lm_pinmap.h b/nuttx/arch/arm/src/lm/chip/lm_pinmap.h similarity index 94% rename from nuttx/arch/arm/src/lm3s/chip/lm_pinmap.h rename to nuttx/arch/arm/src/lm/chip/lm_pinmap.h index b00a6e7940..b8154dd9f5 100644 --- a/nuttx/arch/arm/src/lm3s/chip/lm_pinmap.h +++ b/nuttx/arch/arm/src/lm/chip/lm_pinmap.h @@ -1,5 +1,5 @@ /************************************************************************************ - * arch/arm/src/lm3s/chip/lm_pinmap.h + * arch/arm/src/lm/chip/lm_pinmap.h * * Copyright (C) 2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -33,8 +33,8 @@ * ************************************************************************************/ -#ifndef __ARCH_ARM_SRC_LM3S_CHIP_LM_PINMAP_H -#define __ARCH_ARM_SRC_LM3S_CHIP_LM_PINMAP_H +#ifndef __ARCH_ARM_SRC_LM_CHIP_LM_PINMAP_H +#define __ARCH_ARM_SRC_LM_CHIP_LM_PINMAP_H /************************************************************************************ * Included Files @@ -66,4 +66,4 @@ * Public Function Prototypes ************************************************************************************/ -#endif /* __ARCH_ARM_SRC_LM3S_CHIP_LM_PINMAP_H */ +#endif /* __ARCH_ARM_SRC_LM_CHIP_LM_PINMAP_H */ diff --git a/nuttx/arch/arm/src/lm3s/lm3s_dumpgpio.c b/nuttx/arch/arm/src/lm/lm3s_dumpgpio.c similarity index 99% rename from nuttx/arch/arm/src/lm3s/lm3s_dumpgpio.c rename to nuttx/arch/arm/src/lm/lm3s_dumpgpio.c index 9d205b7634..a84dc59ddb 100644 --- a/nuttx/arch/arm/src/lm3s/lm3s_dumpgpio.c +++ b/nuttx/arch/arm/src/lm/lm3s_dumpgpio.c @@ -1,5 +1,5 @@ /**************************************************************************** - * arch/arm/src/lm3s/lm3s_dumpgpio.c + * arch/arm/src/lm/lm3s_dumpgpio.c * * Copyright (C) 2009-2010 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/arch/arm/src/lm3s/lm3s_ethernet.c b/nuttx/arch/arm/src/lm/lm3s_ethernet.c similarity index 99% rename from nuttx/arch/arm/src/lm3s/lm3s_ethernet.c rename to nuttx/arch/arm/src/lm/lm3s_ethernet.c index f44b6654ff..f6edab5ae2 100644 --- a/nuttx/arch/arm/src/lm3s/lm3s_ethernet.c +++ b/nuttx/arch/arm/src/lm/lm3s_ethernet.c @@ -1,5 +1,5 @@ /**************************************************************************** - * arch/arm/src/lm3s/lm3s_ethernet.c + * arch/arm/src/lm/lm3s_ethernet.c * * Copyright (C) 2009-2010 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/arch/arm/src/lm3s/lm3s_gpio.c b/nuttx/arch/arm/src/lm/lm3s_gpio.c similarity index 99% rename from nuttx/arch/arm/src/lm3s/lm3s_gpio.c rename to nuttx/arch/arm/src/lm/lm3s_gpio.c index dd005fdd19..48cbefabf7 100644 --- a/nuttx/arch/arm/src/lm3s/lm3s_gpio.c +++ b/nuttx/arch/arm/src/lm/lm3s_gpio.c @@ -1,5 +1,5 @@ /**************************************************************************** - * arch/arm/src/lm3s/lm3s_gpio.c + * arch/arm/src/lm/lm3s_gpio.c * arch/arm/src/chip/lm3s_gpio.c * * Copyright (C) 2009-2010 Gregory Nutt. All rights reserved. diff --git a/nuttx/arch/arm/src/lm3s/lm3s_gpioirq.c b/nuttx/arch/arm/src/lm/lm3s_gpioirq.c similarity index 99% rename from nuttx/arch/arm/src/lm3s/lm3s_gpioirq.c rename to nuttx/arch/arm/src/lm/lm3s_gpioirq.c index 511195f2d5..a54bfe335e 100644 --- a/nuttx/arch/arm/src/lm3s/lm3s_gpioirq.c +++ b/nuttx/arch/arm/src/lm/lm3s_gpioirq.c @@ -1,5 +1,5 @@ /**************************************************************************** - * arch/arm/src/lm3s/lm3s_gpioirq.c + * arch/arm/src/lm/lm3s_gpioirq.c * arch/arm/src/chip/lm3s_gpioirq.c * * Copyright (C) 2009-2010, 2012 Gregory Nutt. All rights reserved. diff --git a/nuttx/arch/arm/src/lm3s/lm3s_irq.c b/nuttx/arch/arm/src/lm/lm3s_irq.c similarity index 99% rename from nuttx/arch/arm/src/lm3s/lm3s_irq.c rename to nuttx/arch/arm/src/lm/lm3s_irq.c index 2f0b9fa728..2039d84a85 100644 --- a/nuttx/arch/arm/src/lm3s/lm3s_irq.c +++ b/nuttx/arch/arm/src/lm/lm3s_irq.c @@ -1,5 +1,5 @@ /**************************************************************************** - * arch/arm/src/lm3s/lm3s_irq.c + * arch/arm/src/lm/lm3s_irq.c * arch/arm/src/chip/lm3s_irq.c * * Copyright (C) 2009, 2011 Gregory Nutt. All rights reserved. diff --git a/nuttx/arch/arm/src/lm3s/lm3s_lowputc.c b/nuttx/arch/arm/src/lm/lm3s_lowputc.c similarity index 99% rename from nuttx/arch/arm/src/lm3s/lm3s_lowputc.c rename to nuttx/arch/arm/src/lm/lm3s_lowputc.c index bdbd5a9065..7f9a826c8f 100644 --- a/nuttx/arch/arm/src/lm3s/lm3s_lowputc.c +++ b/nuttx/arch/arm/src/lm/lm3s_lowputc.c @@ -1,5 +1,5 @@ /************************************************************************** - * arch/arm/src/lm3s/lm3s_lowputc.c + * arch/arm/src/lm/lm3s_lowputc.c * * Copyright (C) 2009-2010 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/arch/arm/src/lm3s/lm3s_serial.c b/nuttx/arch/arm/src/lm/lm3s_serial.c similarity index 99% rename from nuttx/arch/arm/src/lm3s/lm3s_serial.c rename to nuttx/arch/arm/src/lm/lm3s_serial.c index 7ed9b6fa84..79628c765b 100644 --- a/nuttx/arch/arm/src/lm3s/lm3s_serial.c +++ b/nuttx/arch/arm/src/lm/lm3s_serial.c @@ -1,5 +1,5 @@ /**************************************************************************** - * arch/arm/src/lm3s/lm3s_serial.c + * arch/arm/src/lm/lm3s_serial.c * * Copyright (C) 2009-2010, 2012 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/arch/arm/src/lm3s/lm3s_ssi.c b/nuttx/arch/arm/src/lm/lm3s_ssi.c similarity index 100% rename from nuttx/arch/arm/src/lm3s/lm3s_ssi.c rename to nuttx/arch/arm/src/lm/lm3s_ssi.c diff --git a/nuttx/arch/arm/src/lm3s/lm3s_start.c b/nuttx/arch/arm/src/lm/lm3s_start.c similarity index 99% rename from nuttx/arch/arm/src/lm3s/lm3s_start.c rename to nuttx/arch/arm/src/lm/lm3s_start.c index 341b82e507..4dfe928442 100644 --- a/nuttx/arch/arm/src/lm3s/lm3s_start.c +++ b/nuttx/arch/arm/src/lm/lm3s_start.c @@ -1,5 +1,5 @@ /**************************************************************************** - * arch/arm/src/lm3s/lm3s_start.c + * arch/arm/src/lm/lm3s_start.c * arch/arm/src/chip/lm3s_start.c * * Copyright (C) 2009, 2012 Gregory Nutt. All rights reserved. diff --git a/nuttx/arch/arm/src/lm3s/lm3s_syscontrol.c b/nuttx/arch/arm/src/lm/lm3s_syscontrol.c similarity index 99% rename from nuttx/arch/arm/src/lm3s/lm3s_syscontrol.c rename to nuttx/arch/arm/src/lm/lm3s_syscontrol.c index 3ad0cacb5c..87545bec7a 100644 --- a/nuttx/arch/arm/src/lm3s/lm3s_syscontrol.c +++ b/nuttx/arch/arm/src/lm/lm3s_syscontrol.c @@ -1,5 +1,5 @@ /**************************************************************************** - * arch/arm/src/lm3s/lm3s_syscontrol.c + * arch/arm/src/lm/lm3s_syscontrol.c * arch/arm/src/chip/lm3s_syscontrol.c * * Copyright (C) 2009 Gregory Nutt. All rights reserved. diff --git a/nuttx/arch/arm/src/lm3s/lm3s_timerisr.c b/nuttx/arch/arm/src/lm/lm3s_timerisr.c similarity index 99% rename from nuttx/arch/arm/src/lm3s/lm3s_timerisr.c rename to nuttx/arch/arm/src/lm/lm3s_timerisr.c index 9cd912249f..823d810da2 100644 --- a/nuttx/arch/arm/src/lm3s/lm3s_timerisr.c +++ b/nuttx/arch/arm/src/lm/lm3s_timerisr.c @@ -1,5 +1,5 @@ /**************************************************************************** - * arch/arm/src/lm3s/lm3s_timerisr.c + * arch/arm/src/lm/lm3s_timerisr.c * * Copyright (C) 2009 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/arch/arm/src/lm3s/lm3s_vectors.S b/nuttx/arch/arm/src/lm/lm3s_vectors.S similarity index 99% rename from nuttx/arch/arm/src/lm3s/lm3s_vectors.S rename to nuttx/arch/arm/src/lm/lm3s_vectors.S index 71db122a0d..fe92fc9547 100644 --- a/nuttx/arch/arm/src/lm3s/lm3s_vectors.S +++ b/nuttx/arch/arm/src/lm/lm3s_vectors.S @@ -1,5 +1,5 @@ /************************************************************************************ - * arch/arm/src/lm3s/lm3s_vectors.S + * arch/arm/src/lm/lm3s_vectors.S * arch/arm/src/chip/lm3s_vectors.S * * Copyright (C) 2009-2010 Gregory Nutt. All rights reserved. diff --git a/nuttx/arch/arm/src/lm3s/lm_ethernet.h b/nuttx/arch/arm/src/lm/lm_ethernet.h similarity index 95% rename from nuttx/arch/arm/src/lm3s/lm_ethernet.h rename to nuttx/arch/arm/src/lm/lm_ethernet.h index 600955b95b..29fe4fd17b 100644 --- a/nuttx/arch/arm/src/lm3s/lm_ethernet.h +++ b/nuttx/arch/arm/src/lm/lm_ethernet.h @@ -1,5 +1,5 @@ /************************************************************************************ - * arch/arm/src/lm3s/lm_ethernet.h + * arch/arm/src/lm/lm_ethernet.h * * Copyright (C) 2009-2010, 2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -33,8 +33,8 @@ * ************************************************************************************/ -#ifndef __ARCH_ARM_SRC_LM3S_LM_ETHERNET_H -#define __ARCH_ARM_SRC_LM3S_LM_ETHERNET_H +#ifndef __ARCH_ARM_SRC_LM_LM_ETHERNET_H +#define __ARCH_ARM_SRC_LM_LM_ETHERNET_H /************************************************************************************ * Included Files @@ -100,4 +100,4 @@ int lm3s_ethinitialize(int intf); #endif /* __ASSEMBLY__ */ #endif /* LM3S_NETHCONTROLLERS > 1 */ -#endif /* __ARCH_ARM_SRC_LM3S_LM_ETHERNET_H */ +#endif /* __ARCH_ARM_SRC_LM_LM_ETHERNET_H */ diff --git a/nuttx/arch/arm/src/lm3s/lm_gpio.h b/nuttx/arch/arm/src/lm/lm_gpio.h similarity index 98% rename from nuttx/arch/arm/src/lm3s/lm_gpio.h rename to nuttx/arch/arm/src/lm/lm_gpio.h index 1bfb79fc90..9577fd9261 100644 --- a/nuttx/arch/arm/src/lm3s/lm_gpio.h +++ b/nuttx/arch/arm/src/lm/lm_gpio.h @@ -1,5 +1,5 @@ /************************************************************************************ - * arch/arm/src/lm3s/lm_gpio.h + * arch/arm/src/lm/lm_gpio.h * * Copyright (C) 2009-2010, 2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -33,8 +33,8 @@ * ************************************************************************************/ -#ifndef __ARCH_ARM_SRC_LM3S_LM_GPIO_H -#define __ARCH_ARM_SRC_LM3S_LM_GPIO_H +#ifndef __ARCH_ARM_SRC_LM_LM_GPIO_H +#define __ARCH_ARM_SRC_LM_LM_GPIO_H /************************************************************************************ * Included Files @@ -220,4 +220,4 @@ int weak_function gpio_irqinitialize(void); #endif #endif /* __ASSEMBLY__ */ -#endif /* __ARCH_ARM_SRC_LM3S_LM_GPIO_H */ +#endif /* __ARCH_ARM_SRC_LM_LM_GPIO_H */ diff --git a/nuttx/arch/arm/src/lm3s/lm_lowputc.h b/nuttx/arch/arm/src/lm/lm_lowputc.h similarity index 95% rename from nuttx/arch/arm/src/lm3s/lm_lowputc.h rename to nuttx/arch/arm/src/lm/lm_lowputc.h index 8e2858ebf3..b384bbd800 100644 --- a/nuttx/arch/arm/src/lm3s/lm_lowputc.h +++ b/nuttx/arch/arm/src/lm/lm_lowputc.h @@ -1,5 +1,5 @@ /************************************************************************************ - * arch/arm/src/lm3s/lm3s_lowputc.h + * arch/arm/src/lm/lm3s_lowputc.h * * Copyright (C) 2009-2010, 2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -33,8 +33,8 @@ * ************************************************************************************/ -#ifndef __ARCH_ARM_SRC_LM3S_LM_LOWPUTC_H -#define __ARCH_ARM_SRC_LM3S_LM_LOWPUTC_H +#ifndef __ARCH_ARM_SRC_LM_LM_LOWPUTC_H +#define __ARCH_ARM_SRC_LM_LM_LOWPUTC_H /************************************************************************************ * Included Files @@ -84,4 +84,4 @@ void up_lowsetup(void); #endif #endif /* __ASSEMBLY__ */ -#endif /* __ARCH_ARM_SRC_LM3S_LM_LOWPUTC_H */ +#endif /* __ARCH_ARM_SRC_LM_LM_LOWPUTC_H */ diff --git a/nuttx/arch/arm/src/lm3s/lm_ssi.h b/nuttx/arch/arm/src/lm/lm_ssi.h similarity index 97% rename from nuttx/arch/arm/src/lm3s/lm_ssi.h rename to nuttx/arch/arm/src/lm/lm_ssi.h index dd1e30817d..4e71198987 100644 --- a/nuttx/arch/arm/src/lm3s/lm_ssi.h +++ b/nuttx/arch/arm/src/lm/lm_ssi.h @@ -1,5 +1,5 @@ /************************************************************************************ - * arch/arm/src/lm3s/lm_ssi.h + * arch/arm/src/lm/lm_ssi.h * * Copyright (C) 2009-2010, 2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -33,8 +33,8 @@ * ************************************************************************************/ -#ifndef __ARCH_ARM_SRC_LM3S_LM_SSI_H -#define __ARCH_ARM_SRC_LM3S_LM_SSI_H +#ifndef __ARCH_ARM_SRC_LM_LM_SSI_H +#define __ARCH_ARM_SRC_LM_LM_SSI_H /************************************************************************************ * Included Files @@ -111,4 +111,4 @@ int lm3s_spicmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd); #endif #endif /* __ASSEMBLY__ */ -#endif /* __ARCH_ARM_SRC_LM3S_LM_SSI_H */ +#endif /* __ARCH_ARM_SRC_LM_LM_SSI_H */ diff --git a/nuttx/arch/arm/src/lm3s/lm_syscontrol.h b/nuttx/arch/arm/src/lm/lm_syscontrol.h similarity index 95% rename from nuttx/arch/arm/src/lm3s/lm_syscontrol.h rename to nuttx/arch/arm/src/lm/lm_syscontrol.h index 7c49da5658..79cc2349d1 100644 --- a/nuttx/arch/arm/src/lm3s/lm_syscontrol.h +++ b/nuttx/arch/arm/src/lm/lm_syscontrol.h @@ -1,5 +1,5 @@ /************************************************************************************ - * arch/arm/src/lm3s/lm3s_syscontrol.h + * arch/arm/src/lm/lm3s_syscontrol.h * * Copyright (C) 2009-2010, 2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -33,8 +33,8 @@ * ************************************************************************************/ -#ifndef __ARCH_ARM_SRC_LM3S_LM_SYSCONTROL_H -#define __ARCH_ARM_SRC_LM3S_LM_SYSCONTROL_H +#ifndef __ARCH_ARM_SRC_LM_LM_SYSCONTROL_H +#define __ARCH_ARM_SRC_LM_LM_SYSCONTROL_H /************************************************************************************ * Included Files @@ -97,4 +97,4 @@ void up_clockconfig(void); #endif #endif /* __ASSEMBLY__ */ -#endif /* __ARCH_ARM_SRC_LM3S_LM_SYSCONTROL_H */ +#endif /* __ARCH_ARM_SRC_LM_LM_SYSCONTROL_H */ diff --git a/nuttx/configs/eagle100/README.txt b/nuttx/configs/eagle100/README.txt index a79ac2b2d7..3f9da652b4 100644 --- a/nuttx/configs/eagle100/README.txt +++ b/nuttx/configs/eagle100/README.txt @@ -273,7 +273,7 @@ Eagle100-specific Configuration Options CONFIG_ARCH_CHIP - Identifies the arch/*/chip subdirectory - CONFIG_ARCH_CHIP=lm3s + CONFIG_ARCH_CHIP=lm CONFIG_ARCH_CHIP_name - For use in C code to identify the exact chip: @@ -371,7 +371,7 @@ Eagle100-specific Configuration Options to build the LM3S Ethernet driver CONFIG_LM3S_ETHLEDS - Enable to use Ethernet LEDs on the board. CONFIG_LM3S_BOARDMAC - If the board-specific logic can provide - a MAC address (via lm3s_ethernetmac()), then this should be selected. + a MAC address (via lm_ethernetmac()), then this should be selected. CONFIG_LM3S_ETHHDUPLEX - Set to force half duplex operation CONFIG_LM3S_ETHNOAUTOCRC - Set to suppress auto-CRC generation CONFIG_LM3S_ETHNOPAD - Set to suppress Tx padding diff --git a/nuttx/configs/eagle100/httpd/defconfig b/nuttx/configs/eagle100/httpd/defconfig index c2ea86bed8..cf4f979304 100644 --- a/nuttx/configs/eagle100/httpd/defconfig +++ b/nuttx/configs/eagle100/httpd/defconfig @@ -38,7 +38,8 @@ CONFIG_ARCH="arm" CONFIG_ARCH_ARM=y CONFIG_ARCH_CORTEXM3=y -CONFIG_ARCH_CHIP="lm3s" +CONFIG_ARCH_CHIP="lm" +CONFIG_ARCH_CHIP_LM=y CONFIG_ARCH_CHIP_LM3S=y CONFIG_ARCH_CHIP_LM3S6918=y CONFIG_ARCH_BOARD="eagle100" diff --git a/nuttx/configs/eagle100/nettest/defconfig b/nuttx/configs/eagle100/nettest/defconfig index 2dab94846f..a3b50ead6b 100644 --- a/nuttx/configs/eagle100/nettest/defconfig +++ b/nuttx/configs/eagle100/nettest/defconfig @@ -38,7 +38,8 @@ CONFIG_ARCH="arm" CONFIG_ARCH_ARM=y CONFIG_ARCH_CORTEXM3=y -CONFIG_ARCH_CHIP="lm3s" +CONFIG_ARCH_CHIP="lm" +CONFIG_ARCH_CHIP_LM=y CONFIG_ARCH_CHIP_LM3S=y CONFIG_ARCH_CHIP_LM3S6918=y CONFIG_ARCH_BOARD="eagle100" diff --git a/nuttx/configs/eagle100/nsh/defconfig b/nuttx/configs/eagle100/nsh/defconfig index fd141bc80d..342023d6a0 100644 --- a/nuttx/configs/eagle100/nsh/defconfig +++ b/nuttx/configs/eagle100/nsh/defconfig @@ -38,7 +38,8 @@ CONFIG_ARCH="arm" CONFIG_ARCH_ARM=y CONFIG_ARCH_CORTEXM3=y -CONFIG_ARCH_CHIP="lm3s" +CONFIG_ARCH_CHIP="lm" +CONFIG_ARCH_CHIP_LM=y CONFIG_ARCH_CHIP_LM3S=y CONFIG_ARCH_CHIP_LM3S6918=y CONFIG_ARCH_BOARD="eagle100" diff --git a/nuttx/configs/eagle100/nxflat/defconfig b/nuttx/configs/eagle100/nxflat/defconfig index 20cd50432c..fe02ab4b92 100644 --- a/nuttx/configs/eagle100/nxflat/defconfig +++ b/nuttx/configs/eagle100/nxflat/defconfig @@ -38,7 +38,8 @@ CONFIG_ARCH="arm" CONFIG_ARCH_ARM=y CONFIG_ARCH_CORTEXM3=y -CONFIG_ARCH_CHIP="lm3s" +CONFIG_ARCH_CHIP="lm" +CONFIG_ARCH_CHIP_LM=y CONFIG_ARCH_CHIP_LM3S=y CONFIG_ARCH_CHIP_LM3S6918=y CONFIG_ARCH_BOARD="eagle100" diff --git a/nuttx/configs/eagle100/ostest/defconfig b/nuttx/configs/eagle100/ostest/defconfig index 01f3be334f..52496c4a32 100644 --- a/nuttx/configs/eagle100/ostest/defconfig +++ b/nuttx/configs/eagle100/ostest/defconfig @@ -38,7 +38,8 @@ CONFIG_ARCH="arm" CONFIG_ARCH_ARM=y CONFIG_ARCH_CORTEXM3=y -CONFIG_ARCH_CHIP="lm3s" +CONFIG_ARCH_CHIP="lm" +CONFIG_ARCH_CHIP_LM=y CONFIG_ARCH_CHIP_LM3S=y CONFIG_ARCH_CHIP_LM3S6918=y CONFIG_ARCH_BOARD="eagle100" diff --git a/nuttx/configs/eagle100/thttpd/defconfig b/nuttx/configs/eagle100/thttpd/defconfig index 460bd64b33..7efbbed11a 100644 --- a/nuttx/configs/eagle100/thttpd/defconfig +++ b/nuttx/configs/eagle100/thttpd/defconfig @@ -38,7 +38,8 @@ CONFIG_ARCH="arm" CONFIG_ARCH_ARM=y CONFIG_ARCH_CORTEXM3=y -CONFIG_ARCH_CHIP="lm3s" +CONFIG_ARCH_CHIP="lm" +CONFIG_ARCH_CHIP_LM=y CONFIG_ARCH_CHIP_LM3S=y CONFIG_ARCH_CHIP_LM3S6918=y CONFIG_ARCH_BOARD="eagle100" diff --git a/nuttx/configs/ekk-lm3s9b96/README.txt b/nuttx/configs/ekk-lm3s9b96/README.txt index d331c1cd56..f7896118e7 100644 --- a/nuttx/configs/ekk-lm3s9b96/README.txt +++ b/nuttx/configs/ekk-lm3s9b96/README.txt @@ -173,13 +173,13 @@ IDEs 2) Start the NuttX build at least one time from the Cygwin command line before trying to create your project. This is necessary to create certain auto-generated files and directories that will be needed. - 3) Set up include pathes: You will need include/, arch/arm/src/lm3s, + 3) Set up include pathes: You will need include/, arch/arm/src/lm, arch/arm/src/common, arch/arm/src/armv7-m, and sched/. 4) All assembly files need to have the definition option -D __ASSEMBLY__ on the command line. Startup files will probably cause you some headaches. The NuttX startup file - is arch/arm/src/lm3s/lm3s_vectors.S. + is arch/arm/src/lm/lm_vectors.S. NuttX EABI "buildroot" Toolchain ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -294,7 +294,7 @@ Stellaris EKK-LM3S9B96 Evaluation Kit Configuration Options CONFIG_ARCH_CHIP - Identifies the arch/*/chip subdirectory - CONFIG_ARCH_CHIP=lm3s + CONFIG_ARCH_CHIP=lm CONFIG_ARCH_CHIP_name - For use in C code to identify the exact chip: @@ -389,7 +389,7 @@ Stellaris EKK-LM3S9B96 Evaluation Kit Configuration Options to build the LM3S Ethernet driver CONFIG_LM3S_ETHLEDS - Enable to use Ethernet LEDs on the board. CONFIG_LM3S_BOARDMAC - If the board-specific logic can provide - a MAC address (via lm3s_ethernetmac()), then this should be selected. + a MAC address (via lm_ethernetmac()), then this should be selected. CONFIG_LM3S_ETHHDUPLEX - Set to force half duplex operation CONFIG_LM3S_ETHNOAUTOCRC - Set to suppress auto-CRC generation CONFIG_LM3S_ETHNOPAD - Set to suppress Tx padding diff --git a/nuttx/configs/ekk-lm3s9b96/nsh/defconfig b/nuttx/configs/ekk-lm3s9b96/nsh/defconfig index d8ae63cfff..b614c03164 100644 --- a/nuttx/configs/ekk-lm3s9b96/nsh/defconfig +++ b/nuttx/configs/ekk-lm3s9b96/nsh/defconfig @@ -39,7 +39,8 @@ CONFIG_ARCH="arm" CONFIG_ARCH_ARM=y CONFIG_ARCH_CORTEXM3=y -CONFIG_ARCH_CHIP="lm3s" +CONFIG_ARCH_CHIP="lm" +CONFIG_ARCH_CHIP_LM=y CONFIG_ARCH_CHIP_LM3S=y CONFIG_ARCH_CHIP_LM3S9B96=y CONFIG_ARCH_BOARD="ekk-lm3s9b96" diff --git a/nuttx/configs/ekk-lm3s9b96/ostest/defconfig b/nuttx/configs/ekk-lm3s9b96/ostest/defconfig index 62a092d1f2..df56223606 100644 --- a/nuttx/configs/ekk-lm3s9b96/ostest/defconfig +++ b/nuttx/configs/ekk-lm3s9b96/ostest/defconfig @@ -39,7 +39,8 @@ CONFIG_ARCH="arm" CONFIG_ARCH_ARM=y CONFIG_ARCH_CORTEXM3=y -CONFIG_ARCH_CHIP="lm3s" +CONFIG_ARCH_CHIP="lm" +CONFIG_ARCH_CHIP_LM=y CONFIG_ARCH_CHIP_LM3S=y CONFIG_ARCH_CHIP_LM3S9B96=y CONFIG_ARCH_BOARD="ekk-lm3s9b96" diff --git a/nuttx/configs/ekk-lm3s9b96/src/ekklm3s9b96_internal.h b/nuttx/configs/ekk-lm3s9b96/src/ekklm3s9b96_internal.h index bb3315f5b2..17b0d0e279 100644 --- a/nuttx/configs/ekk-lm3s9b96/src/ekklm3s9b96_internal.h +++ b/nuttx/configs/ekk-lm3s9b96/src/ekklm3s9b96_internal.h @@ -1,6 +1,6 @@ /************************************************************************************ * configs/ekk-lm3s9b96/src/ekklm3s9b96_internal.h - * arch/arm/src/board/lm3s6965ek_internal.n + * arch/arm/src/board/lm3s6965ek_internal.h * * Copyright (C) 2012 Gregory Nutt. All rights reserved. * Authors: Gregory Nutt diff --git a/nuttx/configs/lm3s6432-s2e/README.txt b/nuttx/configs/lm3s6432-s2e/README.txt index 296a10f054..669708c168 100644 --- a/nuttx/configs/lm3s6432-s2e/README.txt +++ b/nuttx/configs/lm3s6432-s2e/README.txt @@ -163,13 +163,13 @@ IDEs 2) Start the NuttX build at least one time from the Cygwin command line before trying to create your project. This is necessary to create certain auto-generated files and directories that will be needed. - 3) Set up include pathes: You will need include/, arch/arm/src/lm3s, + 3) Set up include pathes: You will need include/, arch/arm/src/lm, arch/arm/src/common, arch/arm/src/armv7-m, and sched/. 4) All assembly files need to have the definition option -D __ASSEMBLY__ on the command line. Startup files will probably cause you some headaches. The NuttX startup file - is arch/arm/src/lm3s/lm3s_vectors.S. + is arch/arm/src/lm/lm_vectors.S. NuttX EABI "buildroot" Toolchain ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -288,7 +288,7 @@ Stellaris MDL-S2E Reference Design Configuration Options CONFIG_ARCH_CHIP - Identifies the arch/*/chip subdirectory - CONFIG_ARCH_CHIP=lm3s + CONFIG_ARCH_CHIP=lm CONFIG_ARCH_CHIP_name - For use in C code to identify the exact chip: diff --git a/nuttx/configs/lm3s6432-s2e/nsh/defconfig b/nuttx/configs/lm3s6432-s2e/nsh/defconfig index 7d1657cda5..edd61eaccb 100644 --- a/nuttx/configs/lm3s6432-s2e/nsh/defconfig +++ b/nuttx/configs/lm3s6432-s2e/nsh/defconfig @@ -38,7 +38,8 @@ CONFIG_ARCH="arm" CONFIG_ARCH_ARM=y CONFIG_ARCH_CORTEXM3=y -CONFIG_ARCH_CHIP="lm3s" +CONFIG_ARCH_CHIP="lm" +CONFIG_ARCH_CHIP_LM=y CONFIG_ARCH_CHIP_LM3S=y CONFIG_ARCH_CHIP_LM3S6432=y CONFIG_ARCH_BOARD="lm3s6432-s2e" diff --git a/nuttx/configs/lm3s6432-s2e/ostest/defconfig b/nuttx/configs/lm3s6432-s2e/ostest/defconfig index 90357ce7f5..2d32db81c6 100644 --- a/nuttx/configs/lm3s6432-s2e/ostest/defconfig +++ b/nuttx/configs/lm3s6432-s2e/ostest/defconfig @@ -38,7 +38,8 @@ CONFIG_ARCH="arm" CONFIG_ARCH_ARM=y CONFIG_ARCH_CORTEXM3=y -CONFIG_ARCH_CHIP="lm3s" +CONFIG_ARCH_CHIP="lm" +CONFIG_ARCH_CHIP_LM=y CONFIG_ARCH_CHIP_LM3S=y CONFIG_ARCH_CHIP_LM3S6432=y CONFIG_ARCH_BOARD="lm3s6432-s2e" diff --git a/nuttx/configs/lm3s6965-ek/README.txt b/nuttx/configs/lm3s6965-ek/README.txt index 09a07ec685..5a9cdbf4e7 100644 --- a/nuttx/configs/lm3s6965-ek/README.txt +++ b/nuttx/configs/lm3s6965-ek/README.txt @@ -197,13 +197,13 @@ IDEs 2) Start the NuttX build at least one time from the Cygwin command line before trying to create your project. This is necessary to create certain auto-generated files and directories that will be needed. - 3) Set up include pathes: You will need include/, arch/arm/src/lm3s, + 3) Set up include pathes: You will need include/, arch/arm/src/lm, arch/arm/src/common, arch/arm/src/armv7-m, and sched/. 4) All assembly files need to have the definition option -D __ASSEMBLY__ on the command line. Startup files will probably cause you some headaches. The NuttX startup file - is arch/arm/src/lm3s/lm3s_vectors.S. + is arch/arm/src/lm/lm_vectors.S. NuttX EABI "buildroot" Toolchain ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -357,7 +357,7 @@ Stellaris LM3S6965 Evaluation Kit Configuration Options CONFIG_ARCH_CHIP - Identifies the arch/*/chip subdirectory - CONFIG_ARCH_CHIP=lm3s + CONFIG_ARCH_CHIP=lm CONFIG_ARCH_CHIP_name - For use in C code to identify the exact chip: @@ -452,7 +452,7 @@ Stellaris LM3S6965 Evaluation Kit Configuration Options to build the LM3S Ethernet driver CONFIG_LM3S_ETHLEDS - Enable to use Ethernet LEDs on the board. CONFIG_LM3S_BOARDMAC - If the board-specific logic can provide - a MAC address (via lm3s_ethernetmac()), then this should be selected. + a MAC address (via lm_ethernetmac()), then this should be selected. CONFIG_LM3S_ETHHDUPLEX - Set to force half duplex operation CONFIG_LM3S_ETHNOAUTOCRC - Set to suppress auto-CRC generation CONFIG_LM3S_ETHNOPAD - Set to suppress Tx padding diff --git a/nuttx/configs/lm3s6965-ek/nsh/defconfig b/nuttx/configs/lm3s6965-ek/nsh/defconfig index 64f4397cb5..c1827920b9 100755 --- a/nuttx/configs/lm3s6965-ek/nsh/defconfig +++ b/nuttx/configs/lm3s6965-ek/nsh/defconfig @@ -65,6 +65,7 @@ CONFIG_ARCH="arm" # CONFIG_ARCH_CHIP_DM320 is not set # CONFIG_ARCH_CHIP_IMX is not set # CONFIG_ARCH_CHIP_KINETIS is not set +CONFIG_ARCH_CHIP_LM=y CONFIG_ARCH_CHIP_LM3S=y # CONFIG_ARCH_CHIP_LPC17XX is not set # CONFIG_ARCH_CHIP_LPC214X is not set @@ -76,7 +77,7 @@ CONFIG_ARCH_CHIP_LM3S=y # CONFIG_ARCH_CHIP_STR71X is not set CONFIG_ARCH_CORTEXM3=y CONFIG_ARCH_FAMILY="armv7-m" -CONFIG_ARCH_CHIP="lm3s" +CONFIG_ARCH_CHIP="lm" CONFIG_ARCH_HAVE_MPU=y # CONFIG_ARMV7M_MPU is not set CONFIG_BOARD_LOOPSPERMSEC=4531 diff --git a/nuttx/configs/lm3s6965-ek/nx/defconfig b/nuttx/configs/lm3s6965-ek/nx/defconfig index be75c28755..e3cac8dd75 100755 --- a/nuttx/configs/lm3s6965-ek/nx/defconfig +++ b/nuttx/configs/lm3s6965-ek/nx/defconfig @@ -65,6 +65,7 @@ CONFIG_ARCH="arm" # CONFIG_ARCH_CHIP_DM320 is not set # CONFIG_ARCH_CHIP_IMX is not set # CONFIG_ARCH_CHIP_KINETIS is not set +CONFIG_ARCH_CHIP_LM=y CONFIG_ARCH_CHIP_LM3S=y # CONFIG_ARCH_CHIP_LPC17XX is not set # CONFIG_ARCH_CHIP_LPC214X is not set @@ -76,7 +77,7 @@ CONFIG_ARCH_CHIP_LM3S=y # CONFIG_ARCH_CHIP_STR71X is not set CONFIG_ARCH_CORTEXM3=y CONFIG_ARCH_FAMILY="armv7-m" -CONFIG_ARCH_CHIP="lm3s" +CONFIG_ARCH_CHIP="lm" CONFIG_ARCH_HAVE_MPU=y # CONFIG_ARMV7M_MPU is not set CONFIG_BOARD_LOOPSPERMSEC=4531 diff --git a/nuttx/configs/lm3s6965-ek/ostest/defconfig b/nuttx/configs/lm3s6965-ek/ostest/defconfig index 83e89a6ae7..81247c795d 100755 --- a/nuttx/configs/lm3s6965-ek/ostest/defconfig +++ b/nuttx/configs/lm3s6965-ek/ostest/defconfig @@ -65,6 +65,7 @@ CONFIG_ARCH="arm" # CONFIG_ARCH_CHIP_DM320 is not set # CONFIG_ARCH_CHIP_IMX is not set # CONFIG_ARCH_CHIP_KINETIS is not set +CONFIG_ARCH_CHIP_LM=y CONFIG_ARCH_CHIP_LM3S=y # CONFIG_ARCH_CHIP_LPC17XX is not set # CONFIG_ARCH_CHIP_LPC214X is not set @@ -76,7 +77,7 @@ CONFIG_ARCH_CHIP_LM3S=y # CONFIG_ARCH_CHIP_STR71X is not set CONFIG_ARCH_CORTEXM3=y CONFIG_ARCH_FAMILY="armv7-m" -CONFIG_ARCH_CHIP="lm3s" +CONFIG_ARCH_CHIP="lm" CONFIG_ARCH_HAVE_MPU=y # CONFIG_ARMV7M_MPU is not set CONFIG_BOARD_LOOPSPERMSEC=4531 diff --git a/nuttx/configs/lm3s6965-ek/src/lm3s6965ek_internal.h b/nuttx/configs/lm3s6965-ek/src/lm3s6965ek_internal.h index 8ebd4cf65a..4cd2eddc76 100644 --- a/nuttx/configs/lm3s6965-ek/src/lm3s6965ek_internal.h +++ b/nuttx/configs/lm3s6965-ek/src/lm3s6965ek_internal.h @@ -1,6 +1,6 @@ /************************************************************************************ * configs/lm3s6965-ek/src/lm3s6965ek_internal.h - * arch/arm/src/board/lm3s6965ek_internal.n + * arch/arm/src/board/lm3s6965ek_internal.h * * Copyright (C) 2010 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/configs/lm3s8962-ek/README.txt b/nuttx/configs/lm3s8962-ek/README.txt index fdb7834660..0f796e38dc 100644 --- a/nuttx/configs/lm3s8962-ek/README.txt +++ b/nuttx/configs/lm3s8962-ek/README.txt @@ -181,13 +181,13 @@ IDEs 2) Start the NuttX build at least one time from the Cygwin command line before trying to create your project. This is necessary to create certain auto-generated files and directories that will be needed. - 3) Set up include pathes: You will need include/, arch/arm/src/lm3s, + 3) Set up include pathes: You will need include/, arch/arm/src/lm, arch/arm/src/common, arch/arm/src/armv7-m, and sched/. 4) All assembly files need to have the definition option -D __ASSEMBLY__ on the command line. Startup files will probably cause you some headaches. The NuttX startup file - is arch/arm/src/lm3s/lm3s_vectors.S. + is arch/arm/src/lm/lm_vectors.S. NuttX EABI "buildroot" Toolchain ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -341,7 +341,7 @@ Stellaris LM3S8962 Evaluation Kit Configuration Options CONFIG_ARCH_CHIP - Identifies the arch/*/chip subdirectory - CONFIG_ARCH_CHIP=lm3s + CONFIG_ARCH_CHIP=lm CONFIG_ARCH_CHIP_name - For use in C code to identify the exact chip: @@ -436,7 +436,7 @@ Stellaris LM3S8962 Evaluation Kit Configuration Options to build the LM3S Ethernet driver CONFIG_LM3S_ETHLEDS - Enable to use Ethernet LEDs on the board. CONFIG_LM3S_BOARDMAC - If the board-specific logic can provide - a MAC address (via lm3s_ethernetmac()), then this should be selected. + a MAC address (via lm_ethernetmac()), then this should be selected. CONFIG_LM3S_ETHHDUPLEX - Set to force half duplex operation CONFIG_LM3S_ETHNOAUTOCRC - Set to suppress auto-CRC generation CONFIG_LM3S_ETHNOPAD - Set to suppress Tx padding diff --git a/nuttx/configs/lm3s8962-ek/nsh/defconfig b/nuttx/configs/lm3s8962-ek/nsh/defconfig index 79f90d5f9b..1d3df2fa79 100755 --- a/nuttx/configs/lm3s8962-ek/nsh/defconfig +++ b/nuttx/configs/lm3s8962-ek/nsh/defconfig @@ -38,7 +38,8 @@ CONFIG_ARCH="arm" CONFIG_ARCH_ARM=y CONFIG_ARCH_CORTEXM3=y -CONFIG_ARCH_CHIP="lm3s" +CONFIG_ARCH_CHIP="lm" +CONFIG_ARCH_CHIP_LM=y CONFIG_ARCH_CHIP_LM3S=y CONFIG_ARCH_CHIP_LM3S8962=y CONFIG_ARCH_BOARD="lm3s8962-ek" diff --git a/nuttx/configs/lm3s8962-ek/nx/defconfig b/nuttx/configs/lm3s8962-ek/nx/defconfig index 8424b6623d..37fc8903dd 100755 --- a/nuttx/configs/lm3s8962-ek/nx/defconfig +++ b/nuttx/configs/lm3s8962-ek/nx/defconfig @@ -38,7 +38,8 @@ CONFIG_ARCH="arm" CONFIG_ARCH_ARM=y CONFIG_ARCH_CORTEXM3=y -CONFIG_ARCH_CHIP="lm3s" +CONFIG_ARCH_CHIP="lm" +CONFIG_ARCH_CHIP_LM=y CONFIG_ARCH_CHIP_LM3S=y CONFIG_ARCH_CHIP_LM3S8962=y CONFIG_ARCH_BOARD="lm3s8962-ek" diff --git a/nuttx/configs/lm3s8962-ek/ostest/defconfig b/nuttx/configs/lm3s8962-ek/ostest/defconfig index 73fbff29fb..731003fd0e 100755 --- a/nuttx/configs/lm3s8962-ek/ostest/defconfig +++ b/nuttx/configs/lm3s8962-ek/ostest/defconfig @@ -38,7 +38,8 @@ CONFIG_ARCH="arm" CONFIG_ARCH_ARM=y CONFIG_ARCH_CORTEXM3=y -CONFIG_ARCH_CHIP="lm3s" +CONFIG_ARCH_CHIP="lm" +CONFIG_ARCH_CHIP_LM=y CONFIG_ARCH_CHIP_LM3S=y CONFIG_ARCH_CHIP_LM3S8962=y CONFIG_ARCH_BOARD="lm3s8962-ek" From 8156a2bed16d732d2489f7d6fe410b110c29b1d5 Mon Sep 17 00:00:00 2001 From: patacongo Date: Wed, 9 Jan 2013 12:55:13 +0000 Subject: [PATCH 049/118] Use kconfig- prefix to avoid tool name conflicts (from Jose Pablo Carballo) git-svn-id: http://svn.code.sf.net/p/nuttx/code/trunk@5496 42af7a65-404d-4744-a932-0658087f49c3 --- misc/tools/README.txt | 63 +++++++--- nuttx/Makefile.unix | 6 +- nuttx/Makefile.win | 6 +- nuttx/README.txt | 20 +-- nuttx/arch/arm/src/lm/Kconfig | 10 +- nuttx/configs/amber/README.txt | 2 +- nuttx/configs/ea3131/README.txt | 2 +- nuttx/configs/ea3152/README.txt | 4 +- nuttx/configs/ez80f910200kitg/README.txt | 4 +- nuttx/configs/ez80f910200zco/README.txt | 4 +- nuttx/configs/fire-stm32v2/README.txt | 8 +- nuttx/configs/lm3s6965-ek/README.txt | 12 +- nuttx/configs/mcu123-lpc214x/README.txt | 4 +- nuttx/configs/micropendous3/README.txt | 2 +- nuttx/configs/mirtoo/README.txt | 2 +- nuttx/configs/ntosd-dm320/README.txt | 4 +- nuttx/configs/olimex-lpc1766stk/README.txt | 4 +- nuttx/configs/sim/README.txt | 16 +-- nuttx/configs/stm3220g-eval/README.txt | 8 +- nuttx/configs/stm3240g-eval/README.txt | 6 +- nuttx/configs/stm32f4discovery/README.txt | 16 +-- nuttx/configs/teensy/README.txt | 2 +- nuttx/configs/xtrs/README.txt | 2 +- nuttx/configs/z16f2800100zcog/README.txt | 8 +- nuttx/configs/z80sim/README.txt | 2 +- nuttx/configs/z8encore000zco/README.txt | 4 +- nuttx/configs/z8f64200100kit/README.txt | 4 +- nuttx/configs/zp214xpa/README.txt | 8 +- nuttx/include/spawn.h | 137 +++++++++++++++++++++ nuttx/libc/Kconfig | 28 +++-- nuttx/libc/Makefile | 1 + nuttx/libc/spawn/Make.defs | 46 +++++++ nuttx/tools/README.txt | 8 +- nuttx/tools/kconfig.bat | 6 +- 34 files changed, 341 insertions(+), 118 deletions(-) create mode 100644 nuttx/include/spawn.h create mode 100644 nuttx/libc/spawn/Make.defs diff --git a/misc/tools/README.txt b/misc/tools/README.txt index 512d8ebaab..1546c6f395 100644 --- a/misc/tools/README.txt +++ b/misc/tools/README.txt @@ -1,8 +1,18 @@ misc/tools/README.txt ===================== +Contents: + + o genromfs-0.5.2.tar.gz + o kconfig-frontends + - --program-prefix= + - kconfig-frontends-3.3.0-1-libintl.patch + - kconfig-macos.patch + - kconfig-macos.patch + - kconfig-frontends for Windows + genromfs-0.5.2.tar.gz ---------------------- +===================== This is a snapshot of the genromfs tarball taken from http://sourceforge.net/projects/romfs/. This snapshot is provided to @@ -12,34 +22,60 @@ genromfs-0.5.2.tar.gz from the buildroot. kconfig-frontends ------------------ +================= - This is a snapshot of the kconfig-frontends version 3.6.0 tarball taken + This is a snapshot of the kconfig-frontends version 3.7.0 tarball taken from http://ymorin.is-a-geek.org/projects/kconfig-frontends. General build instructions: cd kconfig-frontends - ./configure --program-prefix= + ./configure make make install - If you do not specify --program-prefix= in the configuration, then the - current kconfig-frontends code will add the prefix kconfig- to the generated - tools. + To suppress the nconf and the graphical interfaces which are not used by + NuttX: - To suppress the graphical interfaces: - - ./configure --disable-gconf --disable-qconf --program-prefix= + ./configure --disable-gconf --disable-qconf make make install + To suppress the graphical interfaces, use static libraries, and disable + creation of other utilities: + + ./configure --disable-shared --enable-static --disable-gconf --disable-qconf --disable-nconf --disable-utils + make + make install + + You may require root privileges to 'make install'. + +--program-prefix= +----------------- + + Beginning somwhere between version 3.3.0 and 3.6.0, the prefix was added + to the kconfig-frontends tools. The default prefix is kconfig-. So, + after 3.3.0, conf becomes kconfig-conf, mconf becomes kconfig-mconf, etc. + All of the NuttX documentation, Makefiles, scripts have been updated to + used this default prefix. + + This introduces an incompatibility with the 3.3.0 version. In the 3.6.0 + timeframe, the configure argument --program-prefix= was added to + eliminated the kconfig- prefix. This, however, caused problems when we + got to the 3.7.0 version which generates a binary called kconfig-diff + (installed at /usr/local/bin). Without the prefix, may conflict with + the standard diff utility (at /bin), depending upon how your PATH + variable is configured. Because of this, we decided to "bite the bullet" + and use the standard prefix at 3.7.0 and later. + + This problem could probably also be avoided using --disable-utils. + kconfig-frontends-3.3.0-1-libintl.patch --------------------------------------- The above build instructions did not work for me under my Cygwin installation with kconfig-frontends-3.3.0. This patch is a awful hack - but will successfully build 'mconf' under Cygwin. + but will successfully build 'kconfig-mconf' under Cygwin. cat kconfig-frontends-3.3.0-1-libintl.patch | patch -p0 cd kconfig-frontends-3.3.0-1 @@ -49,8 +85,7 @@ kconfig-frontends-3.3.0-1-libintl.patch See: http://ymorin.is-a-geek.org/hg/kconfig-frontends/file/tip/docs/known-issues.txt - Update: According to the release notes, version 3.6.0 (and above) - will build on Cygwin with no patches: + Update: Version 3.6.0 (and above) will build on Cygwin with no patches: http://ymorin.is-a-geek.org/download/kconfig-frontends/ @@ -66,7 +101,7 @@ kconfig-macos.patch make install kconfig-frontends for Windows -============================= +----------------------------- From http://tech.groups.yahoo.com/group/nuttx/message/2900: diff --git a/nuttx/Makefile.unix b/nuttx/Makefile.unix index d66c06bd82..47debcccf6 100644 --- a/nuttx/Makefile.unix +++ b/nuttx/Makefile.unix @@ -642,13 +642,13 @@ pass2dep: context tools/mkdeps$(HOSTEXEEXT) # misc/tools/README.txt for additional information. config: - $(Q) APPSDIR=${CONFIG_APPS_DIR} conf Kconfig + $(Q) APPSDIR=${CONFIG_APPS_DIR} kconfig-conf Kconfig oldconfig: - $(Q) APPSDIR=${CONFIG_APPS_DIR} conf --oldconfig Kconfig + $(Q) APPSDIR=${CONFIG_APPS_DIR} kconfig-conf --oldconfig Kconfig menuconfig: - $(Q) APPSDIR=${CONFIG_APPS_DIR} mconf Kconfig + $(Q) APPSDIR=${CONFIG_APPS_DIR} kconfig-mconf Kconfig # export # diff --git a/nuttx/Makefile.win b/nuttx/Makefile.win index 803d073b2d..5c4404f573 100644 --- a/nuttx/Makefile.win +++ b/nuttx/Makefile.win @@ -651,13 +651,13 @@ configenv: $(Q) set APPSDIR=${CONFIG_APPS_DIR} config: configenv - $(Q) conf Kconfig + $(Q) kconfig-conf Kconfig oldconfig: configenv - $(Q) conf --oldconfig Kconfig + $(Q) kconfig-conf --oldconfig Kconfig menuconfig: configenv - $(Q) mconf Kconfig + $(Q) kconfig-mconf Kconfig # export # diff --git a/nuttx/README.txt b/nuttx/README.txt index 0348f7f303..23d0e1a81e 100644 --- a/nuttx/README.txt +++ b/nuttx/README.txt @@ -243,8 +243,8 @@ additional file to the directory the NuttX application package (APPSDIR)): The appconfig file describes the applications that need to be built in the appliction directory (APPSDIR). Not all configurations have an appconfig file. This file is deprecated and will not be - used with new defconfig files produced with the mconf configuration - tool. + used with new defconfig files produced with the kconfig-mconf + configuration tool. General information about configuring NuttX can be found in: @@ -439,14 +439,14 @@ NuttX Configuration Tool under DOS And of course, after you use the configuration tool you need to restore CONFIG_WINDOWS_NATIVE=y and the correct CONFIG_APPS_DIR. - 2) You can, with some effort, run the the Cygwin mconf tool directly - in the CMD.exe shell. In this case, you do not have to modify the - .config file, but there are other complexities: + 2) You can, with some effort, run the the Cygwin kconfig-mconf tool + directly in the CMD.exe shell. In this case, you do not have to + modify the .config file, but there are other complexities: a. You need to temporarily set the Cgywin directories in the PATH - variable then run mconf manually like: + variable then run kconfig-mconf manually like: - mconf Kconfig + kconfig-mconf Kconfig There is a Windows bacht file at tools/kconfig.bat that automates these steps: @@ -454,9 +454,9 @@ NuttX Configuration Tool under DOS tools/kconfig menuconfig b. There is an issue with accessing DOS environment variables from - the Cygwin mconf running in the CMD.exe shell. The following - change to the top-level Kconfig file seems to work around these - problems: + the Cygwin kconfig-mconf running in the CMD.exe shell. The + following change to the top-level Kconfig file seems to work + around these problems: config APPSDIR string diff --git a/nuttx/arch/arm/src/lm/Kconfig b/nuttx/arch/arm/src/lm/Kconfig index 74d1712f32..2d2504c7e0 100644 --- a/nuttx/arch/arm/src/lm/Kconfig +++ b/nuttx/arch/arm/src/lm/Kconfig @@ -60,7 +60,7 @@ config LM3S_DFU bool "DFU" default y -menu "Select LM3S Peripheral Support" +menu "Stellaris Peripheral Support" config LM3S_UART0 bool "UART0" @@ -86,10 +86,10 @@ config LM3S_UART2 default n config LM3S_ETHERNET - bool "LM3S Ethernet" + bool "Stellaris Ethernet" default n ---help--- - This must be set (along with NET) to build the LM3S Ethernet driver. + This must be set (along with NET) to build the Stellaris Ethernet driver. endmenu @@ -134,7 +134,7 @@ config LM3S_DISABLE_GPIOJ_IRQS endmenu if LM3S_ETHERNET -menu "LM3S Ethernet Configuration" +menu "Stellaris Ethernet Configuration" config LM3S_ETHLEDS bool "Ethernet LEDs" @@ -199,7 +199,7 @@ endmenu endif if !SSI0_DISABLE || !SSI1_DISABLE -menu "LM3S SSI Configuration" +menu "Stellaris SSI Configuration" config SSI_POLLWAIT bool "Poll Wait (No-Interrupt) Mode" diff --git a/nuttx/configs/amber/README.txt b/nuttx/configs/amber/README.txt index 56e31ba7f4..9f40dcdd2b 100644 --- a/nuttx/configs/amber/README.txt +++ b/nuttx/configs/amber/README.txt @@ -187,7 +187,7 @@ Atmel AVRISP mkII Connection Toolchains ^^^^^^^^^^ -The toolchain may be selected using the mconf tool (via 'make menuconfig'), +The toolchain may be selected using the kconfig-mconf tool (via 'make menuconfig'), by editing the existing configuration file (defconfig), or by overriding the toolchain on the make commandline with CONFIG_AVR_TOOLCHAIN=. diff --git a/nuttx/configs/ea3131/README.txt b/nuttx/configs/ea3131/README.txt index fcfc0792f3..986b7778cc 100644 --- a/nuttx/configs/ea3131/README.txt +++ b/nuttx/configs/ea3131/README.txt @@ -53,7 +53,7 @@ GNU Toolchain Options If you are not using CONFIG_LPC31_BUILDROOT, then you may also have to modify the PATH in the setenv.h file if your make cannot find the tools. - The toolchain may also be set using the mconf utility (make menuconfig) or by + The toolchain may also be set using the kconfig-mconf utility (make menuconfig) or by passing CONFIG_ARM_TOOLCHAIN= to make, where is one of CODESOURCERYW, CODESOURCERYL, DEVKITARM, BUILDROOT or GNU_EABI as described above. diff --git a/nuttx/configs/ea3152/README.txt b/nuttx/configs/ea3152/README.txt index da57945bde..4f507e7b0f 100644 --- a/nuttx/configs/ea3152/README.txt +++ b/nuttx/configs/ea3152/README.txt @@ -52,8 +52,8 @@ GNU Toolchain Options If you are not using CONFIG_LPC31_BUILDROOT, then you may also have to modify the PATH in the setenv.h file if your make cannot find the tools. - The toolchain may also be set using the mconf utility (make menuconfig) or by - passing CONFIG_ARM_TOOLCHAIN= to make, where is one + The toolchain may also be set using the kconfig-mconf utility (make menuconfig) + or by passing CONFIG_ARM_TOOLCHAIN= to make, where is one of CODESOURCERYW, CODESOURCERYL, DEVKITARM, BUILDROOT or GNU_EABI as described above. diff --git a/nuttx/configs/ez80f910200kitg/README.txt b/nuttx/configs/ez80f910200kitg/README.txt index e314b0fe1a..8d9086b4e9 100644 --- a/nuttx/configs/ez80f910200kitg/README.txt +++ b/nuttx/configs/ez80f910200kitg/README.txt @@ -88,8 +88,8 @@ available: 1. This configuration uses the mconf-based configuration tool. To change this configuration using that tool, you should: - a. Build and install the mconf tool. See nuttx/README.txt and - misc/tools/ + a. Build and install the kconfig-mconf tool. See nuttx/README.txt + and misc/tools/ b. Execute 'make menuconfig' in nuttx/ in order to start the reconfiguration process. diff --git a/nuttx/configs/ez80f910200zco/README.txt b/nuttx/configs/ez80f910200zco/README.txt index 1bc9e56b81..7df5032172 100644 --- a/nuttx/configs/ez80f910200zco/README.txt +++ b/nuttx/configs/ez80f910200zco/README.txt @@ -102,8 +102,8 @@ ostest 1. This configuration uses the mconf-based configuration tool. To change this configuration using that tool, you should: - a. Build and install the mconf tool. See nuttx/README.txt and - misc/tools/ + a. Build and install the kconfig-mconf tool. See nuttx/README.txt + and misc/tools/ b. Execute 'make menuconfig' in nuttx/ in order to start the reconfiguration process. diff --git a/nuttx/configs/fire-stm32v2/README.txt b/nuttx/configs/fire-stm32v2/README.txt index 88b5bf583b..d12a9b27d6 100644 --- a/nuttx/configs/fire-stm32v2/README.txt +++ b/nuttx/configs/fire-stm32v2/README.txt @@ -826,9 +826,9 @@ Where is one of the following: contains support for some built-in applications that can be enabled by making some additional minor change to the configuration file. - Reconfiguring: This configuration uses to the mconf configuration tool to control - the configuration. See the section entitled "NuttX Configuration Tool" - in the top-level README.txt file. + Reconfiguring: This configuration uses to the kconfig-mconf configuration tool + to control the configuration. See the section entitled "NuttX Configuration + Tool" in the top-level README.txt file. Start Delays: If no SD card is present in the slot, or if the network is not connected, then there will be long start-up delays before you get the NSH @@ -842,7 +842,7 @@ Where is one of the following: verified. The ENC28J60 network is not yet functional. Networking is enabled by default in this configuration for testing purposes. To use this configuration, the network must currently be disabled. To do this using - the mconf configuration tool: + the kconfig-mconf configuration tool: > make menuconfig diff --git a/nuttx/configs/lm3s6965-ek/README.txt b/nuttx/configs/lm3s6965-ek/README.txt index 5a9cdbf4e7..e0349f5def 100644 --- a/nuttx/configs/lm3s6965-ek/README.txt +++ b/nuttx/configs/lm3s6965-ek/README.txt @@ -482,8 +482,8 @@ Where is one of the following: 1. This configuration uses the mconf-based configuration tool. To change this configuration using that tool, you should: - a. Build and install the mconf tool. See nuttx/README.txt and - misc/tools/ + a. Build and install the kconfig-mconf tool. See nuttx/README.txt + and misc/tools/ b. Execute 'make menuconfig' in nuttx/ in order to start the reconfiguration process. @@ -512,8 +512,8 @@ Where is one of the following: 1. This configuration uses the mconf-based configuration tool. To change this configuration using that tool, you should: - a. Build and install the mconf tool. See nuttx/README.txt and - misc/tools/ + a. Build and install the kconfig-mconf tool. See nuttx/README.txt + and misc/tools/ b. Execute 'make menuconfig' in nuttx/ in order to start the reconfiguration process. @@ -532,8 +532,8 @@ Where is one of the following: 1. This configuration uses the mconf-based configuration tool. To change this configuration using that tool, you should: - a. Build and install the mconf tool. See nuttx/README.txt and - misc/tools/ + a. Build and install the kconfig-mconf tool. See nuttx/README.txt + and misc/tools/ b. Execute 'make menuconfig' in nuttx/ in order to start the reconfiguration process. diff --git a/nuttx/configs/mcu123-lpc214x/README.txt b/nuttx/configs/mcu123-lpc214x/README.txt index 4c7c608b7f..1c6c9bde86 100644 --- a/nuttx/configs/mcu123-lpc214x/README.txt +++ b/nuttx/configs/mcu123-lpc214x/README.txt @@ -354,8 +354,8 @@ nsh: 1. This configuration uses the mconf-based configuration tool. To change this configuration using that tool, you should: - a. Build and install the mconf tool. See nuttx/README.txt and - misc/tools/ + a. Build and install the kconfig-mconf tool. See nuttx/README.txt + and misc/tools/ b. Execute 'make menuconfig' in nuttx/ in order to start the reconfiguration process. diff --git a/nuttx/configs/micropendous3/README.txt b/nuttx/configs/micropendous3/README.txt index 1b0f2c8ce1..6b586bd64d 100644 --- a/nuttx/configs/micropendous3/README.txt +++ b/nuttx/configs/micropendous3/README.txt @@ -200,7 +200,7 @@ There are several toolchain options. However, testing has been performed using *only* the NuttX buildroot toolchain described below. Therefore, the NuttX buildroot toolchain is the recommended choice. -The toolchain may be selected using the mconf tool (via 'make menuconfig'), +The toolchain may be selected using the kconfig-mconf tool (via 'make menuconfig'), by editing the existing configuration file (defconfig), or by overriding the toolchain on the make commandline with CONFIG_AVR_TOOLCHAIN=. diff --git a/nuttx/configs/mirtoo/README.txt b/nuttx/configs/mirtoo/README.txt index 89c137a03c..6d3ea234e5 100644 --- a/nuttx/configs/mirtoo/README.txt +++ b/nuttx/configs/mirtoo/README.txt @@ -324,7 +324,7 @@ Toolchains ========== Note that in addition to the configuration options listed below, the - toolchain can be configured using the mconf utility ('make menuconfig') + toolchain can be configured using the kconfig-mconf utility ('make menuconfig') or by passing CONFIG_MIPS32_TOOLCHAIN= to make, where is one of GNU_ELF, MICROCHIPL, MICROCHIPW, MICROCHIPL_LITE, MICROCHIPW_LITE, MICROCHIPOPENL or PINGUINOW as described below. diff --git a/nuttx/configs/ntosd-dm320/README.txt b/nuttx/configs/ntosd-dm320/README.txt index d85e53525f..675716154c 100644 --- a/nuttx/configs/ntosd-dm320/README.txt +++ b/nuttx/configs/ntosd-dm320/README.txt @@ -72,8 +72,8 @@ GNU Toolchain Options If you are not using CONFIG_DM320_BUILDROOT, then you may also have to modify the PATH in the setenv.h file if your make cannot find the tools. - The toolchain may also be set using the mconf utility (make menuconfig) or by - passing CONFIG_ARM_TOOLCHAIN= to make, where is one + The toolchain may also be set using the kconfig-mconf utility (make menuconfig) + or by passing CONFIG_ARM_TOOLCHAIN= to make, where is one of CODESOURCERYW, CODESOURCERYL, DEVKITARM, BUILDROOT or GNU_EABI as described above. diff --git a/nuttx/configs/olimex-lpc1766stk/README.txt b/nuttx/configs/olimex-lpc1766stk/README.txt index 35f00e9f2e..13c63d18bd 100644 --- a/nuttx/configs/olimex-lpc1766stk/README.txt +++ b/nuttx/configs/olimex-lpc1766stk/README.txt @@ -904,8 +904,8 @@ Where is one of the following: 1. This configuration uses the mconf-based configuration tool. To change this configuration using that tool, you should: - a. Build and install the mconf tool. See nuttx/README.txt and - misc/tools/ + a. Build and install the kconfig-mconf tool. See nuttx/README.txt + and misc/tools/ b. Execute 'make menuconfig' in nuttx/ in order to start the reconfiguration process. diff --git a/nuttx/configs/sim/README.txt b/nuttx/configs/sim/README.txt index ff756fb4b6..8abfd9c231 100644 --- a/nuttx/configs/sim/README.txt +++ b/nuttx/configs/sim/README.txt @@ -209,8 +209,8 @@ cxxtest 2. This configuration uses the mconf-based configuration tool. To change this configuration using that tool, you should: - a. Build and install the mconf tool. See nuttx/README.txt and - misc/tools/ + a. Build and install the kconfig-mconf tool. See nuttx/README.txt + and misc/tools/ b. Execute 'make menuconfig' in nuttx/ in order to start the reconfiguration process. @@ -455,8 +455,8 @@ nxlines 1. This configuration uses the mconf-based configuration tool. To change this configuration using that tool, you should: - a. Build and install the mconf tool. See nuttx/README.txt and - misc/tools/ + a. Build and install the kconfig-mconf tool. See nuttx/README.txt + and misc/tools/ b. Execute 'make menuconfig' in nuttx/ in order to start the reconfiguration process. @@ -481,8 +481,8 @@ nxwm 1. This configuration uses the mconf-based configuration tool. To change this configuration using that tool, you should: - a. Build and install the mconf tool. See nuttx/README.txt and - misc/tools/ + a. Build and install the kconfig-mconf tool. See nuttx/README.txt + and misc/tools/ b. Execute 'make menuconfig' in nuttx/ in order to start the reconfiguration process. @@ -543,8 +543,8 @@ ostest 1. This configuration uses the mconf-based configuration tool. To change this configuration using that tool, you should: - a. Build and install the mconf tool. See nuttx/README.txt and - misc/tools/ + a. Build and install the kconfig mconf tool. See nuttx/README.txt + and misc/tools/ b. Execute 'make menuconfig' in nuttx/ in order to start the reconfiguration process. diff --git a/nuttx/configs/stm3220g-eval/README.txt b/nuttx/configs/stm3220g-eval/README.txt index e7bdd4de08..40c918582d 100644 --- a/nuttx/configs/stm3220g-eval/README.txt +++ b/nuttx/configs/stm3220g-eval/README.txt @@ -65,8 +65,8 @@ GNU Toolchain Options If you change the default toolchain, then you may also have to modify the PATH in the setenv.h file if your make cannot find the tools. - The toolchain may also be set using the mconf utility (make menuconfig) or by - passing CONFIG_ARMV7M_TOOLCHAIN= to make, where is one + The toolchain may also be set using the kconfig-mconf utility (make menuconfig) + or by passing CONFIG_ARMV7M_TOOLCHAIN= to make, where is one of CODESOURCERYW, CODESOURCERYL, ATOLLOC, DEVKITARM, RAISONANCE, BUILDROOT or GNU_EABI as described above. @@ -1082,8 +1082,8 @@ Where is one of the following: 1. This configuration uses the mconf-based configuration tool. To change this configuration using that tool, you should: - a. Build and install the mconf tool. See nuttx/README.txt and - misc/tools/ + a. Build and install the kconfig-mconf tool. See nuttx/README.txt + and misc/tools/ b. Execute 'make menuconfig' in nuttx/ in order to start the reconfiguration process. diff --git a/nuttx/configs/stm3240g-eval/README.txt b/nuttx/configs/stm3240g-eval/README.txt index 829f3a7773..e8a3c4b257 100644 --- a/nuttx/configs/stm3240g-eval/README.txt +++ b/nuttx/configs/stm3240g-eval/README.txt @@ -951,9 +951,9 @@ Where is one of the following: CONFIG_EXAMPLES_DISCOVER_IPADDR - (not defined) CONFIG_EXAMPLES_DISCOVER_DRIPADDR - Router IP address - NOTE: This configuration uses to the mconf configuration tool to control - the configuration. See the section entitled "NuttX Configuration Tool" - in the top-level README.txt file. + NOTE: This configuration uses to the kconfig-mconf configuration tool to + control the configuration. See the section entitled "NuttX Configuration + Tool" in the top-level README.txt file. nettest: ------- diff --git a/nuttx/configs/stm32f4discovery/README.txt b/nuttx/configs/stm32f4discovery/README.txt index 28072f44b2..ef61b05e60 100644 --- a/nuttx/configs/stm32f4discovery/README.txt +++ b/nuttx/configs/stm32f4discovery/README.txt @@ -1038,8 +1038,8 @@ Where is one of the following: 2. This configuration uses the mconf-based configuration tool. To change this configuration using that tool, you should: - a. Build and install the mconf tool. See nuttx/README.txt and - misc/tools/ + a. Build and install the kconfig-mconf tool. See nuttx/README.txt + and misc/tools/ b. Execute 'make menuconfig' in nuttx/ in order to start the reconfiguration process. @@ -1087,8 +1087,8 @@ Where is one of the following: 1. This configuration uses the mconf-based configuration tool. To change this configuration using that tool, you should: - a. Build and install the mconf tool. See nuttx/README.txt and - misc/tools/ + a. Build and install the kconfig-mconf tool. See nuttx/README.txt + and misc/tools/ b. Execute 'make menuconfig' in nuttx/ in order to start the reconfiguration process. @@ -1121,8 +1121,8 @@ Where is one of the following: 1. This configuration uses the mconf-based configuration tool. To change this configuration using that tool, you should: - a. Build and install the mconf tool. See nuttx/README.txt and - misc/tools/ + a. Build and install the kconfig-mconf tool. See nuttx/README.txt + and misc/tools/ b. Execute 'make menuconfig' in nuttx/ in order to start the reconfiguration process. @@ -1350,8 +1350,8 @@ Where is one of the following: 2. This configuration uses the mconf-based configuration tool. To change this configuration using that tool, you should: - a. Build and install the mconf tool. See nuttx/README.txt and - misc/tools/ + a. Build and install the kconfig-mconf tool. See nuttx/README.txt + and misc/tools/ b. Execute 'make menuconfig' in nuttx/ in order to start the reconfiguration process. diff --git a/nuttx/configs/teensy/README.txt b/nuttx/configs/teensy/README.txt index 951f4a87ec..23e7d6c986 100644 --- a/nuttx/configs/teensy/README.txt +++ b/nuttx/configs/teensy/README.txt @@ -203,7 +203,7 @@ There are several toolchain options. However, testing has been performed using *only* the NuttX buildroot toolchain described below. Therefore, the NuttX buildroot toolchain is the recommended choice. -The toolchain may be selected using the mconf tool (via 'make menuconfig'), +The toolchain may be selected using the kconfig-mconf tool (via 'make menuconfig'), by editing the existing configuration file (defconfig), or by overriding the toolchain on the make commandline with CONFIG_AVR_TOOLCHAIN=. diff --git a/nuttx/configs/xtrs/README.txt b/nuttx/configs/xtrs/README.txt index d462dcab1f..f8b3d0e73d 100644 --- a/nuttx/configs/xtrs/README.txt +++ b/nuttx/configs/xtrs/README.txt @@ -165,7 +165,7 @@ Reconfiguring NuttX These configurations all use the kconfig-frontends, mconf-based configuration tool. To change this configuration using that tool, you should: - a. Build and install the mconf tool. See nuttx/README.txt and + a. Build and install the kconfig-mconf tool. See nuttx/README.txt and misc/tools/README.txt b. Execute 'make menuconfig' in nuttx/ in order to start the reconfiguration diff --git a/nuttx/configs/z16f2800100zcog/README.txt b/nuttx/configs/z16f2800100zcog/README.txt index e12931df20..4d61a41daa 100644 --- a/nuttx/configs/z16f2800100zcog/README.txt +++ b/nuttx/configs/z16f2800100zcog/README.txt @@ -105,8 +105,8 @@ ostest 1. This configuration uses the mconf-based configuration tool. To change this configuration using that tool, you should: - a. Build and install the mconf tool. See nuttx/README.txt and - misc/tools/ + a. Build and install the kconfig-mconf tool. See nuttx/README.txt + and misc/tools/ b. Execute 'make menuconfig' in nuttx/ in order to start the reconfiguration process. @@ -154,8 +154,8 @@ pashello 1. This configuration uses the mconf-based configuration tool. To change this configuration using that tool, you should: - a. Build and install the mconf tool. See nuttx/README.txt and - misc/tools/ + a. Build and install the kconfig-mconf tool. See nuttx/README.txt + and misc/tools/ b. Execute 'make menuconfig' in nuttx/ in order to start the reconfiguration process. diff --git a/nuttx/configs/z80sim/README.txt b/nuttx/configs/z80sim/README.txt index 595a17783b..f4055207cb 100644 --- a/nuttx/configs/z80sim/README.txt +++ b/nuttx/configs/z80sim/README.txt @@ -112,7 +112,7 @@ Reconfiguring NuttX These configurations all use the kconfig-frontends, mconf-based configuration tool. To change this configuration using that tool, you should: - a. Build and install the mconf tool. See nuttx/README.txt and + a. Build and install the kconfig-mconf tool. See nuttx/README.txt and misc/tools/README.txt b. Execute 'make menuconfig' in nuttx/ in order to start the reconfiguration diff --git a/nuttx/configs/z8encore000zco/README.txt b/nuttx/configs/z8encore000zco/README.txt index 7ca50db8ce..70d62ea809 100644 --- a/nuttx/configs/z8encore000zco/README.txt +++ b/nuttx/configs/z8encore000zco/README.txt @@ -73,8 +73,8 @@ available: 1. This configuration uses the mconf-based configuration tool. To change this configuration using that tool, you should: - a. Build and install the mconf tool. See nuttx/README.txt and - misc/tools/ + a. Build and install the kconfig-mconf tool. See nuttx/README.txt + and misc/tools/ b. Execute 'make menuconfig' in nuttx/ in order to start the reconfiguration process. diff --git a/nuttx/configs/z8f64200100kit/README.txt b/nuttx/configs/z8f64200100kit/README.txt index b0f224ad8d..e3c22d87bd 100644 --- a/nuttx/configs/z8f64200100kit/README.txt +++ b/nuttx/configs/z8f64200100kit/README.txt @@ -73,8 +73,8 @@ available: 1. This configuration uses the mconf-based configuration tool. To change this configuration using that tool, you should: - a. Build and install the mconf tool. See nuttx/README.txt and - misc/tools/ + a. Build and install the kconfig-mconf tool. See nuttx/README.txt + and misc/tools/ b. Execute 'make menuconfig' in nuttx/ in order to start the reconfiguration process. diff --git a/nuttx/configs/zp214xpa/README.txt b/nuttx/configs/zp214xpa/README.txt index 58a2242d07..88d03b9de8 100644 --- a/nuttx/configs/zp214xpa/README.txt +++ b/nuttx/configs/zp214xpa/README.txt @@ -303,8 +303,8 @@ Configurations: 1. This configuration uses the mconf-based configuration tool. To change this configuration using that tool, you should: - a. Build and install the mconf tool. See nuttx/README.txt and - misc/tools/ + a. Build and install the kconfig-mconf tool. See nuttx/README.txt + and misc/tools/ b. Execute 'make menuconfig' in nuttx/ in order to start the reconfiguration process. @@ -327,8 +327,8 @@ Configurations: 1. This configuration uses the mconf-based configuration tool. To change this configuration using that tool, you should: - a. Build and install the mconf tool. See nuttx/README.txt and - misc/tools/ + a. Build and install the kconfig-mconf tool. See nuttx/README.txt + and misc/tools/ b. Execute 'make menuconfig' in nuttx/ in order to start the reconfiguration process. diff --git a/nuttx/include/spawn.h b/nuttx/include/spawn.h new file mode 100644 index 0000000000..3463670b5f --- /dev/null +++ b/nuttx/include/spawn.h @@ -0,0 +1,137 @@ +/**************************************************************************** + * include/spawn.h + * + * Copyright (C) 2012 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * 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. + * + ****************************************************************************/ + +#ifndef __INCLUDE_LIBGEN_H +#define __INCLUDE_LIBGEN_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include +#include + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +/* "The spawn.h header shall define the flags that may be set in a + * posix_spawnattr_t object using the posix_spawnattr_setflags() function:" + */ + +#define POSIX_SPAWN_RESETIDS (1 << 0) +#define POSIX_SPAWN_SETPGROUP (1 << 1) +#define POSIX_SPAWN_SETSCHEDPARAM (1 << 2) +#define POSIX_SPAWN_SETSCHEDULER (1 << 3) +#define POSIX_SPAWN_SETSIGDEF (1 << 4) +#define POSIX_SPAWN_SETSIGMASK (1 << 5) + +/**************************************************************************** + * Type Definitions + ****************************************************************************/ +/* "The spawn.h header shall define the posix_spawnattr_t and + * posix_spawn_file_actions_t types used in performing spawn operations. + */ + +struct posix_spawnattr_s +{ +/* To be provided */ +}; +typedef struct posix_spawnattr_s posix_spawnattr_t; + +struct posix_spawn_file_actions_s +{ +/* To be provided */ +}; +typedef struct posix_spawn_file_actions_s posix_spawn_file_actions_t; + +/**************************************************************************** + * Public Function Prototypes + ****************************************************************************/ +/* "The following shall be declared as functions and may also be defined as + * macros. Function prototypes shall be provided." + */ + +#ifdef __cplusplus +extern "C" +{ +#endif + +int posix_spawn(FAR pid_t *, FAR const char *, + FAR const posix_spawn_file_actions_t *, FAR const posix_spawnattr_t *, + FAR char *const [], FAR char *const []); +int posix_spawnp(FAR pid_t *, FAR const char *, + FAR const posix_spawn_file_actions_t *, FAR const posix_spawnattr_t *, + FAR char *const [], FAR char *const []); + +int posix_spawn_file_actions_init(FAR posix_spawn_file_actions_t *); +int posix_spawn_file_actions_destroy(FAR posix_spawn_file_actions_t *); + +int posix_spawn_file_actions_addclose(FAR posix_spawn_file_actions_t *, + int); +int posix_spawn_file_actions_adddup2(FAR posix_spawn_file_actions_t *, + int, int); +int posix_spawn_file_actions_addopen(FAR posix_spawn_file_actions_t *, + int, FAR const char *, int, mode_t); + +int posix_spawnattr_init(FAR posix_spawnattr_t *); +int posix_spawnattr_destroy(FAR posix_spawnattr_t *); + +int posix_spawnattr_getflags(FAR const posix_spawnattr_t *, FAR short *); +int posix_spawnattr_getpgroup(FAR const posix_spawnattr_t *, FAR pid_t *); +int posix_spawnattr_getschedparam(FAR const posix_spawnattr_t *, + FAR struct sched_param *); +int posix_spawnattr_getschedpolicy(FAR const posix_spawnattr_t *, + FAR int *); +int posix_spawnattr_getsigdefault(FAR const posix_spawnattr_t *, + FAR sigset_t *); +int posix_spawnattr_getsigmask(FAR const posix_spawnattr_t *, + FAR sigset_t *); + +int posix_spawnattr_setflags(FAR posix_spawnattr_t *, short); +int posix_spawnattr_setpgroup(FAR posix_spawnattr_t *, pid_t); +int posix_spawnattr_setschedparam(FAR posix_spawnattr_t *, + FAR const struct sched_param *); +int posix_spawnattr_setschedpolicy(FAR posix_spawnattr_t *, int); +int posix_spawnattr_setsigdefault(FAR posix_spawnattr_t *, + FAR const sigset_t *); +int posix_spawnattr_setsigmask(FAR posix_spawnattr_t *, + FAR const sigset_t *); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCLUDE_LIBGEN_H */ diff --git a/nuttx/libc/Kconfig b/nuttx/libc/Kconfig index 699b3ebb26..d739b6351e 100644 --- a/nuttx/libc/Kconfig +++ b/nuttx/libc/Kconfig @@ -72,15 +72,17 @@ config EOL_IS_EITHER_CRLF endchoice config LIBC_EXECFUNCS - bool "Enable exec[l|v] Support" + bool "Enable exec[l|v] / posix_spawn() Support" default n depends on !BINFMT_DISABLE ---help--- Enable support for the exec[l|v] family of functions that can be - used to start other programs, terminating the current program. - Typical usage is (1) first call vfork() to create a new thread, then - (2) call exec[l|v] to replace the new thread with a program from the - file system. + used to start other programs, terminating the current program and + the posix_spawn() familty of functions that can be used start other + programs without terminating the current program. The typical + usage of the exec[l|v] functions is (1) first call vfork() to create + a new thread, then (2) call exec[l|v] to replace the new thread with + a program from the file system. NOTE 1: This two step process start is completely unnecessary in NuttX and is provided only for compatibily with Unix systems. These @@ -89,9 +91,11 @@ config LIBC_EXECFUNCS the new thread will be terminated by the exec[l|v] call, it really served no purpose other than to suport Unix compatility. - NOTE 2: Support for exec[l|v] is conditional because is requires - additional support for symbol tables that will not be available in - the typical system. + The posix_spawn() functions do not have this inefficiency. + + NOTE 2: Support for exec[l|v] and posix_spawn() is conditional + because they require additional support for symbol tables that + will not be available in the typical system. if LIBC_EXECFUNCS @@ -99,8 +103,8 @@ config EXECFUNCS_SYMTAB string "Symbol table used by exec[l|v]" default "g_symtab" ---help--- - The exec[l|v] functions are wrapper functions that (1) call the non- - standard binfmt function 'exec', and then (2) exit(0). The binfmt + The exec[l|v] and posix_spawn() functions are wrapper functions that + call the non-standard binfmt function 'exec'). The binfmt function 'exec' needs to have (1) a symbol table that provides the list of symbols exported by the base code, and (2) the number of symbols in that table. This selection provides the name of that @@ -110,8 +114,8 @@ config EXECFUNCS_NSYMBOLS int "Number of Symbols in the Table" default 0 ---help--- - The exec[l|v] functions are wrapper functions that (1) call the non- - standard binfmt function 'exec', and then (2) exit(0). The binfmt + The exec[l|v] and posix_spawn() functions are wrapper functions that + call the non-standard binfmt function 'exec'). The binfmt function 'exec' needs to have (1) a symbol table that provides the list of symbols exported by the base code, and (2) the number of symbols in that table. This selection provides the number of diff --git a/nuttx/libc/Makefile b/nuttx/libc/Makefile index 22dbba1d91..a76620585f 100644 --- a/nuttx/libc/Makefile +++ b/nuttx/libc/Makefile @@ -57,6 +57,7 @@ include time/Make.defs include libgen/Make.defs include dirent/Make.defs include termios/Make.defs +include spawn/Make.defs include queue/Make.defs include misc/Make.defs diff --git a/nuttx/libc/spawn/Make.defs b/nuttx/libc/spawn/Make.defs new file mode 100644 index 0000000000..17d9f393a6 --- /dev/null +++ b/nuttx/libc/spawn/Make.defs @@ -0,0 +1,46 @@ +############################################################################ +# libc/spawn/Make.defs +# +# Copyright (C) 2013 Gregory Nutt. All rights reserved. +# Author: Gregory Nutt +# +# 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. +# +############################################################################ + +# Add the spawn C files to the build + +ifeq ($(CONFIG_LIBC_EXECFUNCS),y) + +CSRCS += + +# Add the spawn directory to the build + +DEPPATH += --dep-path spawn +VPATH += :spawn +endif diff --git a/nuttx/tools/README.txt b/nuttx/tools/README.txt index 5651ff2f06..8df4a7783c 100644 --- a/nuttx/tools/README.txt +++ b/nuttx/tools/README.txt @@ -445,11 +445,11 @@ kconfig.bat only a few options for the Windows user (see the top-level README.txt file). - You can, with some effort, run the the Cygwin mconf tool directly + You can, with some effort, run the the Cygwin kconfig-mconf tool directly in the CMD.exe shell. In this case, you do not have to modify the .config file, but there are other complexities: You need to temporarily set the Cgywin directories in the PATH variable and - then run mconf outside of the Make system. + then run kconfig-mconf outside of the Make system. kconfig.bat is a Windows batch file at tools/kconfig.bat that automates these steps. It is used from the top-level NuttX directory like: @@ -457,8 +457,8 @@ kconfig.bat tools/kconfig menuconfig NOTE: There is an currently an issue with accessing DOS environment - variables from the Cygwin mconf running in the CMD.exe shell. The - following change to the top-level Kconfig file seems to work around + variables from the Cygwin kconfig-mconf running in the CMD.exe shell. + The following change to the top-level Kconfig file seems to work around these problems: config APPSDIR diff --git a/nuttx/tools/kconfig.bat b/nuttx/tools/kconfig.bat index 65ab60506c..db01e75151 100755 --- a/nuttx/tools/kconfig.bat +++ b/nuttx/tools/kconfig.bat @@ -100,15 +100,15 @@ echo ERROR: Unrecognized action: %action% goto :ShowUsage :DoConfig -conf Kconfig +kconfig-conf Kconfig goto End :DoOldConfig -conf --oldconfig Kconfig +kconfig-conf --oldconfig Kconfig goto End :DoMenuConfig -mconf Kconfig +kconfig-mconf Kconfig goto End :MissingArgument From 51fc8af31f24540bd567bd6d808b8a1fffc4adbc Mon Sep 17 00:00:00 2001 From: patacongo Date: Wed, 9 Jan 2013 14:48:55 +0000 Subject: [PATCH 050/118] Rename LM3S files, variables, and types from lm3s_ to lm_; Rename configuration variables from CONFIG_LM3S_ to CONFIG_LM_ git-svn-id: http://svn.code.sf.net/p/nuttx/code/trunk@5497 42af7a65-404d-4744-a932-0658087f49c3 --- nuttx/Documentation/NuttxPortingGuide.html | 2 +- nuttx/arch/arm/include/lm/irq.h | 18 +- nuttx/arch/arm/src/armv7-m/Toolchain.defs | 8 +- nuttx/arch/arm/src/lm/Kconfig | 56 +- nuttx/arch/arm/src/lm/Make.defs | 9 +- nuttx/arch/arm/src/lm/chip.h | 16 +- nuttx/arch/arm/src/lm/chip/lm3s_pinmap.h | 2 +- .../arm/src/lm/chip/{lm3s_epi.h => lm_epi.h} | 2 +- .../chip/{lm3s_ethernet.h => lm_ethernet.h} | 2 +- .../src/lm/chip/{lm3s_flash.h => lm_flash.h} | 2 +- .../src/lm/chip/{lm3s_gpio.h => lm_gpio.h} | 2 +- .../arm/src/lm/chip/{lm3s_i2c.h => lm_i2c.h} | 2 +- .../arm/src/lm/chip/{lm3s_ssi.h => lm_ssi.h} | 2 +- .../{lm3s_syscontrol.h => lm_syscontrol.h} | 2 +- .../src/lm/chip/{lm3s_timer.h => lm_timer.h} | 2 +- .../src/lm/chip/{lm3s_uart.h => lm_uart.h} | 2 +- nuttx/arch/arm/src/lm/lm3s_vectors.S | 805 ------------------ .../src/lm/{lm3s_dumpgpio.c => lm_dumpgpio.c} | 20 +- .../src/lm/{lm3s_ethernet.c => lm_ethernet.c} | 394 ++++----- nuttx/arch/arm/src/lm/lm_ethernet.h | 4 +- .../arm/src/lm/{lm3s_gpio.c => lm_gpio.c} | 82 +- nuttx/arch/arm/src/lm/lm_gpio.h | 42 +- .../src/lm/{lm3s_gpioirq.c => lm_gpioirq.c} | 124 +-- .../arch/arm/src/lm/{lm3s_irq.c => lm_irq.c} | 56 +- .../src/lm/{lm3s_lowputc.c => lm_lowputc.c} | 24 +- nuttx/arch/arm/src/lm/lm_lowputc.h | 2 +- .../arm/src/lm/{lm3s_serial.c => lm_serial.c} | 62 +- .../arch/arm/src/lm/{lm3s_ssi.c => lm_ssi.c} | 132 +-- nuttx/arch/arm/src/lm/lm_ssi.h | 16 +- .../arm/src/lm/{lm3s_start.c => lm_start.c} | 8 +- .../lm/{lm3s_syscontrol.c => lm_syscontrol.c} | 34 +- nuttx/arch/arm/src/lm/lm_syscontrol.h | 6 +- .../src/lm/{lm3s_timerisr.c => lm_timerisr.c} | 2 +- nuttx/arch/arm/src/lm/lm_vectors.S | 805 ++++++++++++++++++ nuttx/configs/eagle100/README.txt | 38 +- nuttx/configs/eagle100/httpd/defconfig | 42 +- nuttx/configs/eagle100/include/board.h | 12 +- nuttx/configs/eagle100/nettest/defconfig | 42 +- nuttx/configs/eagle100/nsh/defconfig | 42 +- nuttx/configs/eagle100/nxflat/defconfig | 42 +- nuttx/configs/eagle100/ostest/defconfig | 42 +- .../configs/eagle100/src/eagle100_internal.h | 4 +- nuttx/configs/eagle100/src/up_boot.c | 10 +- nuttx/configs/eagle100/src/up_ethernet.c | 8 +- nuttx/configs/eagle100/src/up_leds.c | 20 +- nuttx/configs/eagle100/src/up_ssi.c | 26 +- nuttx/configs/eagle100/thttpd/defconfig | 42 +- nuttx/configs/ekk-lm3s9b96/README.txt | 48 +- nuttx/configs/ekk-lm3s9b96/include/board.h | 12 +- nuttx/configs/ekk-lm3s9b96/nsh/defconfig | 54 +- nuttx/configs/ekk-lm3s9b96/ostest/defconfig | 54 +- .../ekk-lm3s9b96/src/ekklm3s9b96_internal.h | 4 +- nuttx/configs/ekk-lm3s9b96/src/up_boot.c | 10 +- nuttx/configs/ekk-lm3s9b96/src/up_ethernet.c | 8 +- nuttx/configs/ekk-lm3s9b96/src/up_leds.c | 20 +- nuttx/configs/ekk-lm3s9b96/src/up_ssi.c | 26 +- nuttx/configs/lm3s6432-s2e/README.txt | 48 +- nuttx/configs/lm3s6432-s2e/include/board.h | 12 +- nuttx/configs/lm3s6432-s2e/nsh/defconfig | 52 +- nuttx/configs/lm3s6432-s2e/ostest/defconfig | 52 +- .../lm3s6432-s2e/src/lm3s6432s2e_internal.h | 4 +- nuttx/configs/lm3s6432-s2e/src/up_boot.c | 20 +- nuttx/configs/lm3s6432-s2e/src/up_ethernet.c | 8 +- nuttx/configs/lm3s6432-s2e/src/up_leds.c | 22 +- nuttx/configs/lm3s6432-s2e/src/up_ssi.c | 26 +- nuttx/configs/lm3s6965-ek/README.txt | 48 +- nuttx/configs/lm3s6965-ek/include/board.h | 12 +- nuttx/configs/lm3s6965-ek/nsh/defconfig | 48 +- nuttx/configs/lm3s6965-ek/nx/defconfig | 30 +- nuttx/configs/lm3s6965-ek/ostest/defconfig | 30 +- .../lm3s6965-ek/src/lm3s6965ek_internal.h | 4 +- nuttx/configs/lm3s6965-ek/src/up_boot.c | 10 +- nuttx/configs/lm3s6965-ek/src/up_ethernet.c | 8 +- nuttx/configs/lm3s6965-ek/src/up_leds.c | 20 +- nuttx/configs/lm3s6965-ek/src/up_oled.c | 14 +- nuttx/configs/lm3s6965-ek/src/up_ssi.c | 30 +- nuttx/configs/lm3s8962-ek/README.txt | 48 +- nuttx/configs/lm3s8962-ek/include/board.h | 12 +- nuttx/configs/lm3s8962-ek/nsh/defconfig | 54 +- nuttx/configs/lm3s8962-ek/nx/defconfig | 54 +- nuttx/configs/lm3s8962-ek/ostest/defconfig | 54 +- .../lm3s8962-ek/src/lm3s8962ek_internal.h | 4 +- nuttx/configs/lm3s8962-ek/src/up_boot.c | 10 +- nuttx/configs/lm3s8962-ek/src/up_ethernet.c | 8 +- nuttx/configs/lm3s8962-ek/src/up_leds.c | 20 +- nuttx/configs/lm3s8962-ek/src/up_oled.c | 14 +- nuttx/configs/lm3s8962-ek/src/up_ssi.c | 30 +- 87 files changed, 2079 insertions(+), 2080 deletions(-) rename nuttx/arch/arm/src/lm/chip/{lm3s_epi.h => lm_epi.h} (99%) rename nuttx/arch/arm/src/lm/chip/{lm3s_ethernet.h => lm_ethernet.h} (99%) rename nuttx/arch/arm/src/lm/chip/{lm3s_flash.h => lm_flash.h} (99%) rename nuttx/arch/arm/src/lm/chip/{lm3s_gpio.h => lm_gpio.h} (99%) rename nuttx/arch/arm/src/lm/chip/{lm3s_i2c.h => lm_i2c.h} (99%) rename nuttx/arch/arm/src/lm/chip/{lm3s_ssi.h => lm_ssi.h} (99%) rename nuttx/arch/arm/src/lm/chip/{lm3s_syscontrol.h => lm_syscontrol.h} (99%) rename nuttx/arch/arm/src/lm/chip/{lm3s_timer.h => lm_timer.h} (99%) rename nuttx/arch/arm/src/lm/chip/{lm3s_uart.h => lm_uart.h} (99%) delete mode 100644 nuttx/arch/arm/src/lm/lm3s_vectors.S rename nuttx/arch/arm/src/lm/{lm3s_dumpgpio.c => lm_dumpgpio.c} (93%) rename nuttx/arch/arm/src/lm/{lm3s_ethernet.c => lm_ethernet.c} (75%) rename nuttx/arch/arm/src/lm/{lm3s_gpio.c => lm_gpio.c} (93%) rename nuttx/arch/arm/src/lm/{lm3s_gpioirq.c => lm_gpioirq.c} (77%) rename nuttx/arch/arm/src/lm/{lm3s_irq.c => lm_irq.c} (90%) rename nuttx/arch/arm/src/lm/{lm3s_lowputc.c => lm_lowputc.c} (95%) rename nuttx/arch/arm/src/lm/{lm3s_serial.c => lm_serial.c} (96%) rename nuttx/arch/arm/src/lm/{lm3s_ssi.c => lm_ssi.c} (91%) rename nuttx/arch/arm/src/lm/{lm3s_start.c => lm_start.c} (97%) rename nuttx/arch/arm/src/lm/{lm3s_syscontrol.c => lm_syscontrol.c} (94%) rename nuttx/arch/arm/src/lm/{lm3s_timerisr.c => lm_timerisr.c} (99%) create mode 100644 nuttx/arch/arm/src/lm/lm_vectors.S diff --git a/nuttx/Documentation/NuttxPortingGuide.html b/nuttx/Documentation/NuttxPortingGuide.html index 48fafb89f5..b1664f3f09 100644 --- a/nuttx/Documentation/NuttxPortingGuide.html +++ b/nuttx/Documentation/NuttxPortingGuide.html @@ -2901,7 +2901,7 @@ extern void up_ledoff(int led);
        • Examples: - arch/arm/src/chip/lm3s_serial.c, arch/arm/src/lpc214x/lpc214x_serial.c, arch/z16/src/z16f/z16f_serial.c, etc. + arch/arm/src/chip/lm_serial.c, arch/arm/src/lpc214x/lpc214x_serial.c, arch/z16/src/z16f/z16f_serial.c, etc.

        • diff --git a/nuttx/arch/arm/include/lm/irq.h b/nuttx/arch/arm/include/lm/irq.h index a80517e40d..136496fef7 100644 --- a/nuttx/arch/arm/include/lm/irq.h +++ b/nuttx/arch/arm/include/lm/irq.h @@ -308,7 +308,7 @@ * be disabled in order to reduce the size of the implemenation. */ -#ifndef CONFIG_LM3S_DISABLE_GPIOA_IRQS +#ifndef CONFIG_LM_DISABLE_GPIOA_IRQS # define LM3S_IRQ_GPIOA_0 (NR_IRQS + 0) # define LM3S_IRQ_GPIOA_1 (NR_IRQS + 1) # define LM3S_IRQ_GPIOA_2 (NR_IRQS + 2) @@ -322,7 +322,7 @@ # define _NGPIOAIRQS NR_IRQS #endif -#ifndef CONFIG_LM3S_DISABLE_GPIOB_IRQS +#ifndef CONFIG_LM_DISABLE_GPIOB_IRQS # define LM3S_IRQ_GPIOB_0 (_NGPIOAIRQS + 0) # define LM3S_IRQ_GPIOB_1 (_NGPIOAIRQS + 1) # define LM3S_IRQ_GPIOB_2 (_NGPIOAIRQS + 2) @@ -336,7 +336,7 @@ # define _NGPIOBIRQS _NGPIOAIRQS #endif -#ifndef CONFIG_LM3S_DISABLE_GPIOC_IRQS +#ifndef CONFIG_LM_DISABLE_GPIOC_IRQS # define LM3S_IRQ_GPIOC_0 (_NGPIOBIRQS + 0) # define LM3S_IRQ_GPIOC_1 (_NGPIOBIRQS + 1) # define LM3S_IRQ_GPIOC_2 (_NGPIOBIRQS + 2) @@ -350,7 +350,7 @@ # define _NGPIOCIRQS _NGPIOBIRQS #endif -#ifndef CONFIG_LM3S_DISABLE_GPIOD_IRQS +#ifndef CONFIG_LM_DISABLE_GPIOD_IRQS # define LM3S_IRQ_GPIOD_0 (_NGPIOCIRQS + 0) # define LM3S_IRQ_GPIOD_1 (_NGPIOCIRQS + 1) # define LM3S_IRQ_GPIOD_2 (_NGPIOCIRQS + 2) @@ -364,7 +364,7 @@ # define _NGPIODIRQS _NGPIOCIRQS #endif -#ifndef CONFIG_LM3S_DISABLE_GPIOE_IRQS +#ifndef CONFIG_LM_DISABLE_GPIOE_IRQS # define LM3S_IRQ_GPIOE_0 (_NGPIODIRQS + 0) # define LM3S_IRQ_GPIOE_1 (_NGPIODIRQS + 1) # define LM3S_IRQ_GPIOE_2 (_NGPIODIRQS + 2) @@ -378,7 +378,7 @@ # define _NGPIOEIRQS _NGPIODIRQS #endif -#ifndef CONFIG_LM3S_DISABLE_GPIOF_IRQS +#ifndef CONFIG_LM_DISABLE_GPIOF_IRQS # define LM3S_IRQ_GPIOF_0 (_NGPIOEIRQS + 0) # define LM3S_IRQ_GPIOF_1 (_NGPIOEIRQS + 1) # define LM3S_IRQ_GPIOF_2 (_NGPIOEIRQS + 2) @@ -392,7 +392,7 @@ # define _NGPIOFIRQS _NGPIOEIRQS #endif -#ifndef CONFIG_LM3S_DISABLE_GPIOG_IRQS +#ifndef CONFIG_LM_DISABLE_GPIOG_IRQS # define LM3S_IRQ_GPIOG_0 (_NGPIOFIRQS + 0) # define LM3S_IRQ_GPIOG_1 (_NGPIOFIRQS + 1) # define LM3S_IRQ_GPIOG_2 (_NGPIOFIRQS + 2) @@ -406,7 +406,7 @@ # define _NGPIOGIRQS _NGPIOFIRQS #endif -#ifndef CONFIG_LM3S_DISABLE_GPIOH_IRQS +#ifndef CONFIG_LM_DISABLE_GPIOH_IRQS # define LM3S_IRQ_GPIOH_0 (_NGPIOGIRQS + 0) # define LM3S_IRQ_GPIOH_1 (_NGPIOGIRQS + 1) # define LM3S_IRQ_GPIOH_2 (_NGPIOGIRQS + 2) @@ -420,7 +420,7 @@ # define _NGPIOHIRQS _NGPIOGIRQS #endif -#ifndef CONFIG_LM3S_DISABLE_GPIOJ_IRQS +#ifndef CONFIG_LM_DISABLE_GPIOJ_IRQS # define LM3S_IRQ_GPIOJ_0 (_NGPIOHIRQS + 0) # define LM3S_IRQ_GPIOJ_1 (_NGPIOHIRQS + 1) # define LM3S_IRQ_GPIOJ_2 (_NGPIOHIRQS + 2) diff --git a/nuttx/arch/arm/src/armv7-m/Toolchain.defs b/nuttx/arch/arm/src/armv7-m/Toolchain.defs index d7f2ed77f1..45ee9e36ca 100644 --- a/nuttx/arch/arm/src/armv7-m/Toolchain.defs +++ b/nuttx/arch/arm/src/armv7-m/Toolchain.defs @@ -53,7 +53,7 @@ ifeq ($(filter y, \ endif ifeq ($(filter y, \ $(CONFIG_KINETIS_BUILDROOT) \ - $(CONFIG_LM3S_BUILDROOT) \ + $(CONFIG_LM_BUILDROOT) \ $(CONFIG_LPC17_BUILDROOT) \ $(CONFIG_LPC43_BUILDROOT) \ $(CONFIG_SAM3U_BUILDROOT) \ @@ -77,7 +77,7 @@ ifeq ($(filter y, \ endif ifeq ($(filter y, \ $(CONFIG_KINETIS_CODESOURCERYL) \ - $(CONFIG_LM3S_CODESOURCERYL) \ + $(CONFIG_LM_CODESOURCERYL) \ $(CONFIG_LPC17_CODESOURCERYL) \ $(CONFIG_LPC43_CODESOURCERYL) \ $(CONFIG_SAM3U_CODESOURCERYL) \ @@ -88,7 +88,7 @@ ifeq ($(filter y, \ endif ifeq ($(filter y, \ $(CONFIG_KINETIS_CODESOURCERYW) \ - $(CONFIG_LM3S_CODESOURCERYW) \ + $(CONFIG_LM_CODESOURCERYW) \ $(CONFIG_LPC17_CODESOURCERYW) \ $(CONFIG_LPC43_CODESOURCERYW) \ $(CONFIG_SAM3U_CODESOURCERYW) \ @@ -99,7 +99,7 @@ ifeq ($(filter y, \ endif ifeq ($(filter y, \ $(CONFIG_KINETIS_DEVKITARM) \ - $(CONFIG_LM3S_DEVKITARM) \ + $(CONFIG_LM_DEVKITARM) \ $(CONFIG_LPC17_DEVKITARM) \ $(CONFIG_LPC43_DEVKITARM) \ $(CONFIG_SAM3U_DEVKITARM) \ diff --git a/nuttx/arch/arm/src/lm/Kconfig b/nuttx/arch/arm/src/lm/Kconfig index 2d2504c7e0..5d6bccc927 100644 --- a/nuttx/arch/arm/src/lm/Kconfig +++ b/nuttx/arch/arm/src/lm/Kconfig @@ -14,7 +14,7 @@ config ARCH_CHIP_LM3S6918 bool "LM3S6918" select ARCH_CORTEXM3 select ARCH_CHIP_LM3S - select LM3S_HAVE_SSI1 + select LM_HAVE_SSI1 config ARCH_CHIP_LM3S9B96 bool "LM3S9B96" @@ -46,28 +46,28 @@ config ARCH_CHIP_LM3S config ARCH_CHIP_LM4F bool -config LM3S_HAVE_SSI1 +config LM_HAVE_SSI1 bool -config LM3S_REVA2 +config LM_REVA2 bool "Rev A2" default n ---help--- Some early silicon returned an increase LDO voltage or 2.75V to work around a PLL bug -config LM3S_DFU +config LM_DFU bool "DFU" default y menu "Stellaris Peripheral Support" -config LM3S_UART0 +config LM_UART0 bool "UART0" select ARCH_HAVE_UART0 default n -config LM3S_UART1 +config LM_UART1 bool "UART1" select ARCH_HAVE_UART1 default n @@ -80,12 +80,12 @@ config SSI1_DISABLE bool "Disable SSI1" default y -config LM3S_UART2 +config LM_UART2 bool "UART2" select ARCH_HAVE_UART2 default n -config LM3S_ETHERNET +config LM_ETHERNET bool "Stellaris Ethernet" default n ---help--- @@ -95,95 +95,95 @@ endmenu menu "Disable GPIO Interrupts" -config LM3S_DISABLE_GPIOA_IRQS +config LM_DISABLE_GPIOA_IRQS bool "Disable GPIOA IRQs" default n -config LM3S_DISABLE_GPIOB_IRQS +config LM_DISABLE_GPIOB_IRQS bool "Disable GPIOB IRQs" default n -config LM3S_DISABLE_GPIOC_IRQS +config LM_DISABLE_GPIOC_IRQS bool "Disable GPIOC IRQs" default n -config LM3S_DISABLE_GPIOD_IRQS +config LM_DISABLE_GPIOD_IRQS bool "Disable GPIOD IRQs" default n -config LM3S_DISABLE_GPIOE_IRQS +config LM_DISABLE_GPIOE_IRQS bool "Disable GPIOE IRQs" default n -config LM3S_DISABLE_GPIOF_IRQS +config LM_DISABLE_GPIOF_IRQS bool "Disable GPIOF IRQs" default n -config LM3S_DISABLE_GPIOG_IRQS +config LM_DISABLE_GPIOG_IRQS bool "Disable GPIOG IRQs" default n -config LM3S_DISABLE_GPIOH_IRQS +config LM_DISABLE_GPIOH_IRQS bool "Disable GPIOH IRQs" default n -config LM3S_DISABLE_GPIOJ_IRQS +config LM_DISABLE_GPIOJ_IRQS bool "Disable GPIOJ IRQs" default n endmenu -if LM3S_ETHERNET +if LM_ETHERNET menu "Stellaris Ethernet Configuration" -config LM3S_ETHLEDS +config LM_ETHLEDS bool "Ethernet LEDs" default n ---help--- Enable to use Ethernet LEDs on the board. -config LM3S_BOARDMAC +config LM_BOARDMAC bool "Board MAC" default n ---help--- If the board-specific logic can provide a MAC address (via - lm3s_ethernetmac()), then this should be selected. + lm_ethernetmac()), then this should be selected. -config LM3S_ETHHDUPLEX +config LM_ETHHDUPLEX bool "Force Half Duplex" default n ---help--- Set to force half duplex operation -config LM3S_ETHNOAUTOCRC +config LM_ETHNOAUTOCRC bool "Disable auto-CRC" default n ---help--- Set to suppress auto-CRC generation -config LM3S_ETHNOPAD +config LM_ETHNOPAD bool "Disable Tx Padding" default n ---help--- Set to suppress Tx padding -config LM3S_MULTICAST +config LM_MULTICAST bool "Enable Multicast" default n ---help--- Set to enable multicast frames -config LM3S_PROMISCUOUS +config LM_PROMISCUOUS bool "Enable Promiscuous Mode" default n ---help--- Set to enable promiscuous mode -config LM3S_TIMESTAMP +config LM_TIMESTAMP bool "Enable Timestamping" default n -config LM3S_BADCRC +config LM_BADCRC bool "Enable Bad CRC Rejection" default n ---help--- diff --git a/nuttx/arch/arm/src/lm/Make.defs b/nuttx/arch/arm/src/lm/Make.defs index aacbb1c831..e760f7e014 100644 --- a/nuttx/arch/arm/src/lm/Make.defs +++ b/nuttx/arch/arm/src/lm/Make.defs @@ -33,7 +33,7 @@ # ############################################################################ -HEAD_ASRC = lm3s_vectors.S +HEAD_ASRC = lm_vectors.S CMN_ASRCS = up_saveusercontext.S up_fullcontextrestore.S up_switchcontext.S \ vfork.S @@ -55,10 +55,9 @@ CMN_CSRCS += up_elf.c endif CHIP_ASRCS = -CHIP_CSRCS = lm3s_start.c lm3s_syscontrol.c lm3s_irq.c \ - lm3s_gpio.c lm3s_gpioirq.c lm3s_timerisr.c lm3s_lowputc.c \ - lm3s_serial.c lm3s_ssi.c lm3s_dumpgpio.c +CHIP_CSRCS = lm_start.c lm_syscontrol.c lm_irq.c lm_gpio.c lm_gpioirq.c \ + lm_timerisr.c lm_lowputc.c lm_serial.c lm_ssi.c lm_dumpgpio.c ifdef CONFIG_NET -CHIP_CSRCS += lm3s_ethernet.c +CHIP_CSRCS += lm_ethernet.c endif diff --git a/nuttx/arch/arm/src/lm/chip.h b/nuttx/arch/arm/src/lm/chip.h index 5857b30949..b5974b5dcf 100644 --- a/nuttx/arch/arm/src/lm/chip.h +++ b/nuttx/arch/arm/src/lm/chip.h @@ -49,14 +49,14 @@ /* Then get all of the register definitions */ -#include "chip/lm_memorymap.h" /* Memory map */ -#include "chip/lm3s_syscontrol.h" /* System control module */ -#include "chip/lm3s_gpio.h" /* GPIO modules */ -#include "chip/lm3s_uart.h" /* UART modules */ -#include "chip/lm3s_i2c.h" /* I2C modules */ -#include "chip/lm3s_ssi.h" /* SSI modules */ -#include "chip/lm3s_ethernet.h" /* Ethernet MAC and PHY */ -#include "chip/lm3s_flash.h" /* FLASH */ +#include "chip/lm_memorymap.h" /* Memory map */ +#include "chip/lm_syscontrol.h" /* System control module */ +#include "chip/lm_gpio.h" /* GPIO modules */ +#include "chip/lm_uart.h" /* UART modules */ +#include "chip/lm_i2c.h" /* I2C modules */ +#include "chip/lm_ssi.h" /* SSI modules */ +#include "chip/lm_ethernet.h" /* Ethernet MAC and PHY */ +#include "chip/lm_flash.h" /* FLASH */ /* The LM3S69xx only supports 8 priority levels. The hardware priority mechanism * will only look at the upper N bits of the 8-bit priority level (where N is 3 for diff --git a/nuttx/arch/arm/src/lm/chip/lm3s_pinmap.h b/nuttx/arch/arm/src/lm/chip/lm3s_pinmap.h index 85ec1369a3..a478304b08 100644 --- a/nuttx/arch/arm/src/lm/chip/lm3s_pinmap.h +++ b/nuttx/arch/arm/src/lm/chip/lm3s_pinmap.h @@ -46,7 +46,7 @@ * Pre-processor Definitions ************************************************************************************/ -/* The following lists the input value to lm3s_configgpio to setup the alternate, +/* The following lists the input value to lm_configgpio to setup the alternate, * hardware function for each pin. */ diff --git a/nuttx/arch/arm/src/lm/chip/lm3s_epi.h b/nuttx/arch/arm/src/lm/chip/lm_epi.h similarity index 99% rename from nuttx/arch/arm/src/lm/chip/lm3s_epi.h rename to nuttx/arch/arm/src/lm/chip/lm_epi.h index 82fc94f4c7..e369860791 100644 --- a/nuttx/arch/arm/src/lm/chip/lm3s_epi.h +++ b/nuttx/arch/arm/src/lm/chip/lm_epi.h @@ -1,5 +1,5 @@ /************************************************************************************ - * arch/arm/src/lm/chip/lm3s_epi.h + * arch/arm/src/lm/chip/lm_epi.h * * Copyright (C) 2009-2013 Max Neklyudov. All rights reserved. * Author: Max Neklyudov diff --git a/nuttx/arch/arm/src/lm/chip/lm3s_ethernet.h b/nuttx/arch/arm/src/lm/chip/lm_ethernet.h similarity index 99% rename from nuttx/arch/arm/src/lm/chip/lm3s_ethernet.h rename to nuttx/arch/arm/src/lm/chip/lm_ethernet.h index 512e962219..46a101005b 100644 --- a/nuttx/arch/arm/src/lm/chip/lm3s_ethernet.h +++ b/nuttx/arch/arm/src/lm/chip/lm_ethernet.h @@ -1,5 +1,5 @@ /************************************************************************************ - * arch/arm/src/lm/chip/lm3s_ethernet.h + * arch/arm/src/lm/chip/lm_ethernet.h * * Copyright (C) 2009-2010, 2012-2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/arch/arm/src/lm/chip/lm3s_flash.h b/nuttx/arch/arm/src/lm/chip/lm_flash.h similarity index 99% rename from nuttx/arch/arm/src/lm/chip/lm3s_flash.h rename to nuttx/arch/arm/src/lm/chip/lm_flash.h index 2f6dc78fae..0d4808526f 100644 --- a/nuttx/arch/arm/src/lm/chip/lm3s_flash.h +++ b/nuttx/arch/arm/src/lm/chip/lm_flash.h @@ -1,5 +1,5 @@ /************************************************************************************ - * arch/arm/src/lm/chip/lm3s_flash.h + * arch/arm/src/lm/chip/lm_flash.h * * Copyright (C) 2009, 2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/arch/arm/src/lm/chip/lm3s_gpio.h b/nuttx/arch/arm/src/lm/chip/lm_gpio.h similarity index 99% rename from nuttx/arch/arm/src/lm/chip/lm3s_gpio.h rename to nuttx/arch/arm/src/lm/chip/lm_gpio.h index 2c199dae9d..4ca8e8ff96 100644 --- a/nuttx/arch/arm/src/lm/chip/lm3s_gpio.h +++ b/nuttx/arch/arm/src/lm/chip/lm_gpio.h @@ -1,5 +1,5 @@ /************************************************************************************ - * arch/arm/src/lm/chip/lm3s_gpio.h + * arch/arm/src/lm/chip/lm_gpio.h * * Copyright (C) 2009-2010, 2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/arch/arm/src/lm/chip/lm3s_i2c.h b/nuttx/arch/arm/src/lm/chip/lm_i2c.h similarity index 99% rename from nuttx/arch/arm/src/lm/chip/lm3s_i2c.h rename to nuttx/arch/arm/src/lm/chip/lm_i2c.h index e029c4f3f3..919ac1348d 100644 --- a/nuttx/arch/arm/src/lm/chip/lm3s_i2c.h +++ b/nuttx/arch/arm/src/lm/chip/lm_i2c.h @@ -1,5 +1,5 @@ /************************************************************************************ - * arch/arm/src/lm/chip/lm3s_i2c.h + * arch/arm/src/lm/chip/lm_i2c.h * * Copyright (C) 2009, 2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/arch/arm/src/lm/chip/lm3s_ssi.h b/nuttx/arch/arm/src/lm/chip/lm_ssi.h similarity index 99% rename from nuttx/arch/arm/src/lm/chip/lm3s_ssi.h rename to nuttx/arch/arm/src/lm/chip/lm_ssi.h index be5a766e54..b58aec7330 100644 --- a/nuttx/arch/arm/src/lm/chip/lm3s_ssi.h +++ b/nuttx/arch/arm/src/lm/chip/lm_ssi.h @@ -1,5 +1,5 @@ /************************************************************************************ - * arch/arm/src/lm/chip/lm3s_ssi.h + * arch/arm/src/lm/chip/lm_ssi.h * * Copyright (C) 2009, 2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/arch/arm/src/lm/chip/lm3s_syscontrol.h b/nuttx/arch/arm/src/lm/chip/lm_syscontrol.h similarity index 99% rename from nuttx/arch/arm/src/lm/chip/lm3s_syscontrol.h rename to nuttx/arch/arm/src/lm/chip/lm_syscontrol.h index 00a222ee37..6ca8ac3ffd 100644 --- a/nuttx/arch/arm/src/lm/chip/lm3s_syscontrol.h +++ b/nuttx/arch/arm/src/lm/chip/lm_syscontrol.h @@ -1,5 +1,5 @@ /************************************************************************************ - * arch/arm/src/lm/chip/lm3s_syscontrol.h + * arch/arm/src/lm/chip/lm_syscontrol.h * * Copyright (C) 2009-2010, 2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/arch/arm/src/lm/chip/lm3s_timer.h b/nuttx/arch/arm/src/lm/chip/lm_timer.h similarity index 99% rename from nuttx/arch/arm/src/lm/chip/lm3s_timer.h rename to nuttx/arch/arm/src/lm/chip/lm_timer.h index 6be963cc31..f2824ce1fe 100644 --- a/nuttx/arch/arm/src/lm/chip/lm3s_timer.h +++ b/nuttx/arch/arm/src/lm/chip/lm_timer.h @@ -1,5 +1,5 @@ /************************************************************************************ - * arch/arm/src/lm/chip/lm3s_timer.h + * arch/arm/src/lm/chip/lm_timer.h * * Copyright (C) 2012 Max Nekludov. All rights reserved. * Author: Max Nekludov diff --git a/nuttx/arch/arm/src/lm/chip/lm3s_uart.h b/nuttx/arch/arm/src/lm/chip/lm_uart.h similarity index 99% rename from nuttx/arch/arm/src/lm/chip/lm3s_uart.h rename to nuttx/arch/arm/src/lm/chip/lm_uart.h index 98dcbce128..9a03ff063d 100644 --- a/nuttx/arch/arm/src/lm/chip/lm3s_uart.h +++ b/nuttx/arch/arm/src/lm/chip/lm_uart.h @@ -1,5 +1,5 @@ /************************************************************************************ - * arch/arm/src/lm/chip/lm3s_uart.h + * arch/arm/src/lm/chip/lm_uart.h * * Copyright (C) 2009, 2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/arch/arm/src/lm/lm3s_vectors.S b/nuttx/arch/arm/src/lm/lm3s_vectors.S deleted file mode 100644 index fe92fc9547..0000000000 --- a/nuttx/arch/arm/src/lm/lm3s_vectors.S +++ /dev/null @@ -1,805 +0,0 @@ -/************************************************************************************ - * arch/arm/src/lm/lm3s_vectors.S - * arch/arm/src/chip/lm3s_vectors.S - * - * Copyright (C) 2009-2010 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt - * - * 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. - * - ************************************************************************************/ - -/************************************************************************************ - * Included Files - ************************************************************************************/ - -#include -#include - -/************************************************************************************ - * Preprocessor Definitions - ************************************************************************************/ - -/* Memory Map: - * - * 0x0000:0000 - Beginning of FLASH. Address of vectors (if not using bootloader) - * 0x0002:0000 - Address of vectors if using bootloader - * 0x0003:ffff - End of flash - * 0x2000:0000 - Start of SRAM and start of .data (_sdata) - * - End of .data (_edata) abd start of .bss (_sbss) - * - End of .bss (_ebss) and bottom of idle stack - * - _ebss + CONFIG_IDLETHREAD_STACKSIZE = end of idle stack, start of heap - * 0x2000:ffff - End of SRAM and end of heap - */ - -#define IDLE_STACK (_ebss+CONFIG_IDLETHREAD_STACKSIZE-4) -#define HEAP_BASE (_ebss+CONFIG_IDLETHREAD_STACKSIZE-4) - -/* The Cortex-M3 return from interrupt is unusual. We provide the following special - * address to the BX instruction. The particular value also forces a return to - * thread mode and covers state from the main stack point, the MSP (vs. the MSP). - */ - -#define EXC_RETURN 0xfffffff9 - -/************************************************************************************ - * Global Symbols - ************************************************************************************/ - - .globl __start - - .syntax unified - .thumb - .file "lm3s_vectors.S" - -/************************************************************************************ - * Macros - ************************************************************************************/ - -/* On entry into an IRQ, the hardware automatically saves the xPSR, PC, LR, R12, R0-R3 - * registers on the stack, then branches to an instantantiation of the following - * macro. This macro simply loads the IRQ number into R0, then jumps to the common - * IRQ handling logic. - */ - - .macro HANDLER, label, irqno - .thumb_func -\label: - mov r0, #\irqno - b lm3s_irqcommon - .endm - -/************************************************************************************ - * Vectors - ************************************************************************************/ - - .section .vectors, "ax" - .code 16 - .align 2 - .globl lm3s_vectors - .type lm3s_vectors, function - -lm3s_vectors: - -/* Processor Exceptions */ - - .word IDLE_STACK /* Vector 0: Reset stack pointer */ - .word __start /* Vector 1: Reset vector */ - .word lm3s_nmi /* Vector 2: Non-Maskable Interrupt (NMI) */ - .word lm3s_hardfault /* Vector 3: Hard fault */ - .word lm3s_mpu /* Vector 4: Memory management (MPU) */ - .word lm3s_busfault /* Vector 5: Bus fault */ - .word lm3s_usagefault /* Vector 6: Usage fault */ - .word lm3s_reserved /* Vector 7: Reserved */ - .word lm3s_reserved /* Vector 8: Reserved */ - .word lm3s_reserved /* Vector 9: Reserved */ - .word lm3s_reserved /* Vector 10: Reserved */ - .word lm3s_svcall /* Vector 11: SVC call */ - .word lm3s_dbgmonitor /* Vector 12: Debug monitor */ - .word lm3s_reserved /* Vector 13: Reserved */ - .word lm3s_pendsv /* Vector 14: Pendable system service request */ - .word lm3s_systick /* Vector 15: System tick */ - -/* External Interrupts */ - -#if defined(CONFIG_ARCH_CHIP_LM3S6918) - .word lm3s_gpioa /* Vector 16: GPIO Port A */ - .word lm3s_gpiob /* Vector 17: GPIO Port B */ - .word lm3s_gpioc /* Vector 18: GPIO Port C */ - .word lm3s_gpiod /* Vector 19: GPIO Port D */ - .word lm3s_gpioe /* Vector 20: GPIO Port E */ - .word lm3s_uart0 /* Vector 21: UART 0 */ - .word lm3s_uart1 /* Vector 22: UART 1 */ - .word lm3s_ssi0 /* Vector 23: SSI 0 */ - .word lm3s_i2c0 /* Vector 24: I2C 0 */ - .word lm3s_reserved /* Vector 25: Reserved */ - .word lm3s_reserved /* Vector 26: Reserved */ - .word lm3s_reserved /* Vector 27: Reserved */ - .word lm3s_reserved /* Vector 28: Reserved */ - .word lm3s_reserved /* Vector 29: Reserved */ - .word lm3s_adc0 /* Vector 30: ADC Sequence 0 */ - .word lm3s_adc1 /* Vector 31: ADC Sequence 1 */ - .word lm3s_adc2 /* Vector 32: ADC Sequence 2 */ - .word lm3s_adc3 /* Vector 33: ADC Sequence 3 */ - .word lm3s_wdog /* Vector 34: Watchdog Timer */ - .word lm3s_tmr0a /* Vector 35: Timer 0 A */ - .word lm3s_tmr0b /* Vector 36: Timer 0 B */ - .word lm3s_tmr1a /* Vector 37: Timer 1 A */ - .word lm3s_tmr1b /* Vector 38: Timer 1 B */ - .word lm3s_tmr2a /* Vector 39: Timer 2 A */ - .word lm3s_tmr2b /* Vector 40: Timer 3 B */ - .word lm3s_cmp0 /* Vector 41: Analog Comparator 0 */ - .word lm3s_cmp1 /* Vector 42: Analog Comparator 1 */ - .word lm3s_reserved /* Vector 43: Reserved */ - .word lm3s_syscon /* Vector 44: System Control */ - .word lm3s_flashcon /* Vector 45: FLASH Control */ - .word lm3s_gpiof /* Vector 46: GPIO Port F */ - .word lm3s_gpiog /* Vector 47: GPIO Port G */ - .word lm3s_gpioh /* Vector 48: GPIO Port H */ - .word lm3s_reserved /* Vector 49: Reserved */ - .word lm3s_ssi1 /* Vector 50: SSI 1 */ - .word lm3s_tmr3a /* Vector 51: Timer 3 A */ - .word lm3s_tmr3b /* Vector 52: Timer 3 B */ - .word lm3s_i2c1 /* Vector 53: I2C 1 */ - .word lm3s_reserved /* Vector 54: Reserved */ - .word lm3s_reserved /* Vector 55: Reserved */ - .word lm3s_reserved /* Vector 56: Reserved */ - .word lm3s_reserved /* Vector 57: Reserved */ - .word lm3s_eth /* Vector 58: Ethernet Controller */ - .word lm3s_hib /* Vector 59: Hibernation Module */ - .word lm3s_reserved /* Vector 60: Reserved */ - .word lm3s_reserved /* Vector 61: Reserved */ - .word lm3s_reserved /* Vector 62: Reserved */ - .word lm3s_reserved /* Vector 63: Reserved */ - .word lm3s_reserved /* Vector 64: Reserved */ - .word lm3s_reserved /* Vector 65: Reserved */ - .word lm3s_reserved /* Vector 66: Reserved */ - .word lm3s_reserved /* Vector 67: Reserved */ - .word lm3s_reserved /* Vector 68: Reserved */ - .word lm3s_reserved /* Vector 69: Reserved */ - .word lm3s_reserved /* Vector 70: Reserved */ -#elif defined(CONFIG_ARCH_CHIP_LM3S6432) - .word lm3s_gpioa /* Vector 16: GPIO Port A */ - .word lm3s_gpiob /* Vector 17: GPIO Port B */ - .word lm3s_gpioc /* Vector 18: GPIO Port C */ - .word lm3s_gpiod /* Vector 19: GPIO Port D */ - .word lm3s_gpioe /* Vector 20: GPIO Port E */ - .word lm3s_uart0 /* Vector 21: UART 0 */ - .word lm3s_uart1 /* Vector 22: UART 1 */ - .word lm3s_ssi0 /* Vector 23: SSI 0 */ - .word lm3s_i2c0 /* Vector 24: I2C 0 */ - .word lm3s_reserved /* Vector 25: Reserved */ - .word lm3s_pwm0 /* Vector 26: PWM Generator 0 */ - .word lm3s_reserved /* Vector 27: Reserved */ - .word lm3s_reserved /* Vector 28: Reserved */ - .word lm3s_reserved /* Vector 29: Reserved */ - .word lm3s_adc0 /* Vector 30: ADC Sequence 0 */ - .word lm3s_adc1 /* Vector 31: ADC Sequence 1 */ - .word lm3s_adc2 /* Vector 32: ADC Sequence 2 */ - .word lm3s_adc3 /* Vector 33: ADC Sequence 3 */ - .word lm3s_wdog /* Vector 34: Watchdog Timer */ - .word lm3s_tmr0a /* Vector 35: Timer 0 A */ - .word lm3s_tmr0b /* Vector 36: Timer 0 B */ - .word lm3s_tmr1a /* Vector 37: Timer 1 A */ - .word lm3s_tmr1b /* Vector 38: Timer 1 B */ - .word lm3s_tmr2a /* Vector 39: Timer 2 A */ - .word lm3s_tmr2b /* Vector 40: Timer 3 B */ - .word lm3s_cmp0 /* Vector 41: Analog Comparator 0 */ - .word lm3s_cmp1 /* Vector 42: Analog Comparator 1 */ - .word lm3s_reserved /* Vector 43: Reserved */ - .word lm3s_syscon /* Vector 44: System Control */ - .word lm3s_flashcon /* Vector 45: FLASH Control */ - .word lm3s_gpiof /* Vector 46: GPIO Port F */ - .word lm3s_gpiog /* Vector 47: GPIO Port G */ - .word lm3s_reserved /* Vector 48: Reserved */ - .word lm3s_reserved /* Vector 49: Reserved */ - .word lm3s_reserved /* Vector 50: Reserved */ - .word lm3s_reserved /* Vector 51: Reserved */ - .word lm3s_reserved /* Vector 52: Reserved */ - .word lm3s_reserved /* Vector 53: Reserved */ - .word lm3s_reserved /* Vector 54: Reserved */ - .word lm3s_reserved /* Vector 55: Reserved */ - .word lm3s_reserved /* Vector 56: Reserved */ - .word lm3s_reserved /* Vector 57: Reserved */ - .word lm3s_eth /* Vector 58: Ethernet Controller */ - .word lm3s_reserved /* Vector 59: Reserved */ - .word lm3s_reserved /* Vector 60: Reserved */ - .word lm3s_reserved /* Vector 61: Reserved */ - .word lm3s_reserved /* Vector 62: Reserved */ - .word lm3s_reserved /* Vector 63: Reserved */ - .word lm3s_reserved /* Vector 64: Reserved */ - .word lm3s_reserved /* Vector 65: Reserved */ - .word lm3s_reserved /* Vector 66: Reserved */ - .word lm3s_reserved /* Vector 67: Reserved */ - .word lm3s_reserved /* Vector 68: Reserved */ - .word lm3s_reserved /* Vector 69: Reserved */ - .word lm3s_reserved /* Vector 70: Reserved */ -#elif defined(CONFIG_ARCH_CHIP_LM3S6965) - .word lm3s_gpioa /* Vector 16: GPIO Port A */ - .word lm3s_gpiob /* Vector 17: GPIO Port B */ - .word lm3s_gpioc /* Vector 18: GPIO Port C */ - .word lm3s_gpiod /* Vector 19: GPIO Port D */ - .word lm3s_gpioe /* Vector 20: GPIO Port E */ - .word lm3s_uart0 /* Vector 21: UART 0 */ - .word lm3s_uart1 /* Vector 22: UART 1 */ - .word lm3s_ssi0 /* Vector 23: SSI 0 */ - .word lm3s_i2c0 /* Vector 24: I2C 0 */ - .word lm3s_pwmfault /* Vector 25: PWM Fault */ - .word lm3s_pwm0 /* Vector 26: PWM Generator 0 */ - .word lm3s_pwm1 /* Vector 27: PWM Generator 1 */ - .word lm3s_pwm2 /* Vector 28: PWM Generator 2 */ - .word lm3s_qei0 /* Vector 29: QEI0 */ - .word lm3s_adc0 /* Vector 30: ADC Sequence 0 */ - .word lm3s_adc1 /* Vector 31: ADC Sequence 1 */ - .word lm3s_adc2 /* Vector 32: ADC Sequence 2 */ - .word lm3s_adc3 /* Vector 33: ADC Sequence 3 */ - .word lm3s_wdog /* Vector 34: Watchdog Timer */ - .word lm3s_tmr0a /* Vector 35: Timer 0 A */ - .word lm3s_tmr0b /* Vector 36: Timer 0 B */ - .word lm3s_tmr1a /* Vector 37: Timer 1 A */ - .word lm3s_tmr1b /* Vector 38: Timer 1 B */ - .word lm3s_tmr2a /* Vector 39: Timer 2 A */ - .word lm3s_tmr2b /* Vector 40: Timer 3 B */ - .word lm3s_cmp0 /* Vector 41: Analog Comparator 0 */ - .word lm3s_cmp1 /* Vector 42: Analog Comparator 1 */ - .word lm3s_reserved /* Vector 43: Reserved */ - .word lm3s_syscon /* Vector 44: System Control */ - .word lm3s_flashcon /* Vector 45: FLASH Control */ - .word lm3s_gpiof /* Vector 46: GPIO Port F */ - .word lm3s_gpiog /* Vector 47: GPIO Port G */ - .word lm3s_reserved /* Vector 48: Reserved */ - .word lm3s_uart2 /* Vector 49: UART 2 */ - .word lm3s_reserved /* Vector 50: Reserved */ - .word lm3s_tmr3a /* Vector 51: Timer 3 A */ - .word lm3s_tmr3b /* Vector 52: Timer 3 B */ - .word lm3s_i2c1 /* Vector 53: I2C 1 */ - .word lm3s_qei1 /* Vector 54: QEI1 */ - .word lm3s_reserved /* Vector 55: Reserved */ - .word lm3s_reserved /* Vector 56: Reserved */ - .word lm3s_reserved /* Vector 57: Reserved */ - .word lm3s_eth /* Vector 58: Ethernet Controller */ - .word lm3s_hib /* Vector 59: Hibernation Module */ - .word lm3s_reserved /* Vector 60: Reserved */ - .word lm3s_reserved /* Vector 61: Reserved */ - .word lm3s_reserved /* Vector 62: Reserved */ - .word lm3s_reserved /* Vector 63: Reserved */ - .word lm3s_reserved /* Vector 64: Reserved */ - .word lm3s_reserved /* Vector 65: Reserved */ - .word lm3s_reserved /* Vector 66: Reserved */ - .word lm3s_reserved /* Vector 67: Reserved */ - .word lm3s_reserved /* Vector 68: Reserved */ - .word lm3s_reserved /* Vector 69: Reserved */ - .word lm3s_reserved /* Vector 70: Reserved */ -#elif defined(CONFIG_ARCH_CHIP_LM3S9B96) - .word lm3s_gpioa /* Vector 16: GPIO Port A */ - .word lm3s_gpiob /* Vector 17: GPIO Port B */ - .word lm3s_gpioc /* Vector 18: GPIO Port C */ - .word lm3s_gpiod /* Vector 19: GPIO Port D */ - .word lm3s_gpioe /* Vector 20: GPIO Port E */ - .word lm3s_uart0 /* Vector 21: UART 0 */ - .word lm3s_uart1 /* Vector 22: UART 1 */ - .word lm3s_ssi0 /* Vector 23: SSI 0 */ - .word lm3s_i2c0 /* Vector 24: I2C 0 */ - .word lm3s_pwmfault /* Vector 25: PWM Fault */ - .word lm3s_pwm0 /* Vector 26: PWM Generator 0 */ - .word lm3s_pwm1 /* Vector 27: PWM Generator 1 */ - .word lm3s_pwm2 /* Vector 28: PWM Generator 2 */ - .word lm3s_qei0 /* Vector 29: QEI0 */ - .word lm3s_adc0 /* Vector 30: ADC Sequence 0 */ - .word lm3s_adc1 /* Vector 31: ADC Sequence 1 */ - .word lm3s_adc2 /* Vector 32: ADC Sequence 2 */ - .word lm3s_adc3 /* Vector 33: ADC Sequence 3 */ - .word lm3s_wdog /* Vector 34: Watchdog Timer */ - .word lm3s_tmr0a /* Vector 35: Timer 0 A */ - .word lm3s_tmr0b /* Vector 36: Timer 0 B */ - .word lm3s_tmr1a /* Vector 37: Timer 1 A */ - .word lm3s_tmr1b /* Vector 38: Timer 1 B */ - .word lm3s_tmr2a /* Vector 39: Timer 2 A */ - .word lm3s_tmr2b /* Vector 40: Timer 3 B */ - .word lm3s_cmp0 /* Vector 41: Analog Comparator 0 */ - .word lm3s_cmp1 /* Vector 42: Analog Comparator 1 */ - .word lm3s_cmp2 /* Vector 43: Reserved */ - .word lm3s_syscon /* Vector 44: System Control */ - .word lm3s_flashcon /* Vector 45: FLASH Control */ - .word lm3s_gpiof /* Vector 46: GPIO Port F */ - .word lm3s_gpiog /* Vector 47: GPIO Port G */ - .word lm3s_gpioh /* Vector 48: GPIO Port H */ - .word lm3s_uart2 /* Vector 49: UART 2 */ - .word lm3s_ssi1 /* Vector 50: SSI 1 */ - .word lm3s_tmr3a /* Vector 51: Timer 3 A */ - .word lm3s_tmr3b /* Vector 52: Timer 3 B */ - .word lm3s_i2c1 /* Vector 53: I2C 1 */ - .word lm3s_qei1 /* Vector 54: QEI1 */ - .word lm3s_can0 /* Vector 55: CAN 0 */ - .word lm3s_can1 /* Vector 56: CAN 1 */ - .word lm3s_reserved /* Vector 57: Reserved */ - .word lm3s_eth /* Vector 58: Ethernet Controller */ - .word lm3s_reserved /* Vector 59: Reserved */ - .word lm3s_usb /* Vector 60: USB */ - .word lm3s_pwm3 /* Vector 61: PWM 3 */ - .word lm3s_udmasoft /* Vector 62: uDMA Software */ - .word lm3s_udmaerror /* Vector 63: uDMA Error */ - .word lm3s_adc1_0 /* Vector 64: ADC1 Sequence 0 */ - .word lm3s_adc1_1 /* Vector 65: ADC1 Sequence 1 */ - .word lm3s_adc1_2 /* Vector 66: ADC1 Sequence 2 */ - .word lm3s_adc1_3 /* Vector 67: ADC1 Sequence 3 */ - .word lm3s_i2s0 /* Vector 68: I2S 0 */ - .word lm3s_epi /* Vector 69: Reserved */ - .word lm3s_gpioj /* Vector 70: GPIO J */ - .word lm3s_reserved /* Vector 71: Reserved */ - #elif defined(CONFIG_ARCH_CHIP_LM3S8962) - .word lm3s_gpioa /* Vector 16: GPIO Port A */ - .word lm3s_gpiob /* Vector 17: GPIO Port B */ - .word lm3s_gpioc /* Vector 18: GPIO Port C */ - .word lm3s_gpiod /* Vector 19: GPIO Port D */ - .word lm3s_gpioe /* Vector 20: GPIO Port E */ - .word lm3s_uart0 /* Vector 21: UART 0 */ - .word lm3s_uart1 /* Vector 22: UART 1 */ - .word lm3s_ssi0 /* Vector 23: SSI 0 */ - .word lm3s_i2c0 /* Vector 24: I2C 0 */ - .word lm3s_pwmfault /* Vector 25: PWM Fault */ - .word lm3s_pwm0 /* Vector 26: PWM Generator 0 */ - .word lm3s_pwm1 /* Vector 27: PWM Generator 1 */ - .word lm3s_pwm2 /* Vector 28: PWM Generator 2 */ - .word lm3s_qei0 /* Vector 29: QEI0 */ - .word lm3s_adc0 /* Vector 30: ADC Sequence 0 */ - .word lm3s_adc1 /* Vector 31: ADC Sequence 1 */ - .word lm3s_adc2 /* Vector 32: ADC Sequence 2 */ - .word lm3s_adc3 /* Vector 33: ADC Sequence 3 */ - .word lm3s_wdog /* Vector 34: Watchdog Timer */ - .word lm3s_tmr0a /* Vector 35: Timer 0 A */ - .word lm3s_tmr0b /* Vector 36: Timer 0 B */ - .word lm3s_tmr1a /* Vector 37: Timer 1 A */ - .word lm3s_tmr1b /* Vector 38: Timer 1 B */ - .word lm3s_tmr2a /* Vector 39: Timer 2 A */ - .word lm3s_tmr2b /* Vector 40: Timer 3 B */ - .word lm3s_cmp0 /* Vector 41: Analog Comparator 0 */ - .word lm3s_reserved /* Vector 42: Reserved */ - .word lm3s_reserved /* Vector 43: Reserved */ - .word lm3s_syscon /* Vector 44: System Control */ - .word lm3s_flashcon /* Vector 45: FLASH Control */ - .word lm3s_gpiof /* Vector 46: GPIO Port F */ - .word lm3s_gpiog /* Vector 47: GPIO Port G */ - .word lm3s_reserved /* Vector 48: Reserved */ - .word lm3s_reserved /* Vector 49: Reserved */ - .word lm3s_reserved /* Vector 50: Reserved */ - .word lm3s_tmr3a /* Vector 51: Timer 3 A */ - .word lm3s_tmr3b /* Vector 52: Timer 3 B */ - .word lm3s_reserved /* Vector 53: Reserved*/ - .word lm3s_qei1 /* Vector 54: QEI1 */ - .word lm3s_can0 /* Vector 55: Can Controller */ - .word lm3s_reserved /* Vector 56: Reserved */ - .word lm3s_reserved /* Vector 57: Reserved */ - .word lm3s_eth /* Vector 58: Ethernet Controller */ - .word lm3s_hib /* Vector 59: Hibernation Module */ - .word lm3s_reserved /* Vector 60: Reserved */ - .word lm3s_reserved /* Vector 61: Reserved */ - .word lm3s_reserved /* Vector 62: Reserved */ - .word lm3s_reserved /* Vector 63: Reserved */ - .word lm3s_reserved /* Vector 64: Reserved */ - .word lm3s_reserved /* Vector 65: Reserved */ - .word lm3s_reserved /* Vector 66: Reserved */ - .word lm3s_reserved /* Vector 67: Reserved */ - .word lm3s_reserved /* Vector 68: Reserved */ - .word lm3s_reserved /* Vector 69: Reserved */ - .word lm3s_reserved /* Vector 70: Reserved */ -#else -# error "Vectors not specified for this LM3S chip" -#endif - .size lm3s_vectors, .-lm3s_vectors - -/************************************************************************************ - * .text - ************************************************************************************/ - - .text - .type handlers, function - .thumb_func -handlers: - HANDLER lm3s_reserved, LM3S_IRQ_RESERVED /* Unexpected/reserved vector */ - HANDLER lm3s_nmi, LM3S_IRQ_NMI /* Vector 2: Non-Maskable Interrupt (NMI) */ - HANDLER lm3s_hardfault, LM3S_IRQ_HARDFAULT /* Vector 3: Hard fault */ - HANDLER lm3s_mpu, LM3S_IRQ_MEMFAULT /* Vector 4: Memory management (MPU) */ - HANDLER lm3s_busfault, LM3S_IRQ_BUSFAULT /* Vector 5: Bus fault */ - HANDLER lm3s_usagefault, LM3S_IRQ_USAGEFAULT /* Vector 6: Usage fault */ - HANDLER lm3s_svcall, LM3S_IRQ_SVCALL /* Vector 11: SVC call */ - HANDLER lm3s_dbgmonitor, LM3S_IRQ_DBGMONITOR /* Vector 12: Debug Monitor */ - HANDLER lm3s_pendsv, LM3S_IRQ_PENDSV /* Vector 14: Penable system service request */ - HANDLER lm3s_systick, LM3S_IRQ_SYSTICK /* Vector 15: System tick */ - -#if defined(CONFIG_ARCH_CHIP_LM3S6918) - HANDLER lm3s_gpioa, LM3S_IRQ_GPIOA /* Vector 16: GPIO Port A */ - HANDLER lm3s_gpiob, LM3S_IRQ_GPIOB /* Vector 17: GPIO Port B */ - HANDLER lm3s_gpioc, LM3S_IRQ_GPIOC /* Vector 18: GPIO Port C */ - HANDLER lm3s_gpiod, LM3S_IRQ_GPIOD /* Vector 19: GPIO Port D */ - HANDLER lm3s_gpioe, LM3S_IRQ_GPIOE /* Vector 20: GPIO Port E */ - HANDLER lm3s_uart0, LM3S_IRQ_UART0 /* Vector 21: UART 0 */ - HANDLER lm3s_uart1, LM3S_IRQ_UART1 /* Vector 22: UART 1 */ - HANDLER lm3s_ssi0, LM3S_IRQ_SSI0 /* Vector 23: SSI 0 */ - HANDLER lm3s_i2c0, LM3S_IRQ_I2C0 /* Vector 24: I2C 0 */ - HANDLER lm3s_adc0, LM3S_IRQ_ADC0 /* Vector 30: ADC Sequence 0 */ - HANDLER lm3s_adc1, LM3S_IRQ_ADC1 /* Vector 31: ADC Sequence 1 */ - HANDLER lm3s_adc2, LM3S_IRQ_ADC2 /* Vector 32: ADC Sequence 2 */ - HANDLER lm3s_adc3, LM3S_IRQ_ADC3 /* Vector 33: ADC Sequence 3 */ - HANDLER lm3s_wdog, LM3S_IRQ_WDOG /* Vector 34: Watchdog Timer */ - HANDLER lm3s_tmr0a, LM3S_IRQ_TIMER0A /* Vector 35: Timer 0 A */ - HANDLER lm3s_tmr0b, LM3S_IRQ_TIMER0B /* Vector 36: Timer 0 B */ - HANDLER lm3s_tmr1a, LM3S_IRQ_TIMER1A /* Vector 37: Timer 1 A */ - HANDLER lm3s_tmr1b, LM3S_IRQ_TIMER1B /* Vector 38: Timer 1 B */ - HANDLER lm3s_tmr2a, LM3S_IRQ_TIMER2A /* Vector 39: Timer 2 A */ - HANDLER lm3s_tmr2b, LM3S_IRQ_TIMER2B /* Vector 40: Timer 3 B */ - HANDLER lm3s_cmp0, LM3S_IRQ_COMPARE0 /* Vector 41: Analog Comparator 0 */ - HANDLER lm3s_cmp1, LM3S_IRQ_COMPARE1 /* Vector 42: Analog Comparator 1 */ - HANDLER lm3s_syscon, LM3S_IRQ_SYSCON /* Vector 44: System Control */ - HANDLER lm3s_flashcon, LM3S_IRQ_FLASHCON /* Vector 45: FLASH Control */ - HANDLER lm3s_gpiof, LM3S_IRQ_GPIOF /* Vector 46: GPIO Port F */ - HANDLER lm3s_gpiog, LM3S_IRQ_GPIOG /* Vector 47: GPIO Port G */ - HANDLER lm3s_gpioh, LM3S_IRQ_GPIOH /* Vector 48: GPIO Port H */ - HANDLER lm3s_ssi1, LM3S_IRQ_SSI1 /* Vector 50: SSI 1 */ - HANDLER lm3s_tmr3a, LM3S_IRQ_TIMER3A /* Vector 51: Timer 3 A */ - HANDLER lm3s_tmr3b, LM3S_IRQ_TIMER3B /* Vector 52: Timer 3 B */ - HANDLER lm3s_i2c1, LM3S_IRQ_I2C1 /* Vector 53: I2C 1 */ - HANDLER lm3s_eth, LM3S_IRQ_ETHCON /* Vector 58: Ethernet Controller */ - HANDLER lm3s_hib, LM3S_IRQ_HIBERNATE /* Vector 59: Hibernation Module */ -#elif defined(CONFIG_ARCH_CHIP_LM3S6432) - HANDLER lm3s_gpioa, LM3S_IRQ_GPIOA /* Vector 16: GPIO Port A */ - HANDLER lm3s_gpiob, LM3S_IRQ_GPIOB /* Vector 17: GPIO Port B */ - HANDLER lm3s_gpioc, LM3S_IRQ_GPIOC /* Vector 18: GPIO Port C */ - HANDLER lm3s_gpiod, LM3S_IRQ_GPIOD /* Vector 19: GPIO Port D */ - HANDLER lm3s_gpioe, LM3S_IRQ_GPIOE /* Vector 20: GPIO Port E */ - HANDLER lm3s_uart0, LM3S_IRQ_UART0 /* Vector 21: UART 0 */ - HANDLER lm3s_uart1, LM3S_IRQ_UART1 /* Vector 22: UART 1 */ - HANDLER lm3s_ssi0, LM3S_IRQ_SSI0 /* Vector 23: SSI 0 */ - HANDLER lm3s_i2c0, LM3S_IRQ_I2C0 /* Vector 24: I2C 0 */ - HANDLER lm3s_pwm0, LM3S_IRQ_PWM0 /* Vector 26: PWM Generator 0 */ - HANDLER lm3s_adc0, LM3S_IRQ_ADC0 /* Vector 30: ADC Sequence 0 */ - HANDLER lm3s_adc1, LM3S_IRQ_ADC1 /* Vector 31: ADC Sequence 1 */ - HANDLER lm3s_adc2, LM3S_IRQ_ADC2 /* Vector 32: ADC Sequence 2 */ - HANDLER lm3s_adc3, LM3S_IRQ_ADC3 /* Vector 33: ADC Sequence 3 */ - HANDLER lm3s_wdog, LM3S_IRQ_WDOG /* Vector 34: Watchdog Timer */ - HANDLER lm3s_tmr0a, LM3S_IRQ_TIMER0A /* Vector 35: Timer 0 A */ - HANDLER lm3s_tmr0b, LM3S_IRQ_TIMER0B /* Vector 36: Timer 0 B */ - HANDLER lm3s_tmr1a, LM3S_IRQ_TIMER1A /* Vector 37: Timer 1 A */ - HANDLER lm3s_tmr1b, LM3S_IRQ_TIMER1B /* Vector 38: Timer 1 B */ - HANDLER lm3s_tmr2a, LM3S_IRQ_TIMER2A /* Vector 39: Timer 2 A */ - HANDLER lm3s_tmr2b, LM3S_IRQ_TIMER2B /* Vector 40: Timer 3 B */ - HANDLER lm3s_cmp0, LM3S_IRQ_COMPARE0 /* Vector 41: Analog Comparator 0 */ - HANDLER lm3s_cmp1, LM3S_IRQ_COMPARE1 /* Vector 42: Analog Comparator 1 */ - HANDLER lm3s_syscon, LM3S_IRQ_SYSCON /* Vector 44: System Control */ - HANDLER lm3s_flashcon, LM3S_IRQ_FLASHCON /* Vector 45: FLASH Control */ - HANDLER lm3s_gpiof, LM3S_IRQ_GPIOF /* Vector 46: GPIO Port F */ - HANDLER lm3s_gpiog, LM3S_IRQ_GPIOG /* Vector 47: GPIO Port G */ - HANDLER lm3s_eth, LM3S_IRQ_ETHCON /* Vector 58: Ethernet Controller */ -#elif defined(CONFIG_ARCH_CHIP_LM3S6965) - HANDLER lm3s_gpioa, LM3S_IRQ_GPIOA /* Vector 16: GPIO Port A */ - HANDLER lm3s_gpiob, LM3S_IRQ_GPIOB /* Vector 17: GPIO Port B */ - HANDLER lm3s_gpioc, LM3S_IRQ_GPIOC /* Vector 18: GPIO Port C */ - HANDLER lm3s_gpiod, LM3S_IRQ_GPIOD /* Vector 19: GPIO Port D */ - HANDLER lm3s_gpioe, LM3S_IRQ_GPIOE /* Vector 20: GPIO Port E */ - HANDLER lm3s_uart0, LM3S_IRQ_UART0 /* Vector 21: UART 0 */ - HANDLER lm3s_uart1, LM3S_IRQ_UART1 /* Vector 22: UART 1 */ - HANDLER lm3s_ssi0, LM3S_IRQ_SSI0 /* Vector 23: SSI 0 */ - HANDLER lm3s_i2c0, LM3S_IRQ_I2C0 /* Vector 24: I2C 0 */ - HANDLER lm3s_pwmfault, LM3S_IRQ_PWMFAULT /* Vector 25: PWM Fault */ - HANDLER lm3s_pwm0, LM3S_IRQ_PWM0 /* Vector 26: PWM Generator 0 */ - HANDLER lm3s_pwm1, LM3S_IRQ_PWM1 /* Vector 27: PWM Generator 1 */ - HANDLER lm3s_pwm2, LM3S_IRQ_PWM2 /* Vector 28: PWM Generator 2 */ - HANDLER lm3s_qei0, LM3S_IRQ_QEI0 /* Vector 29: QEI 0 */ - HANDLER lm3s_adc0, LM3S_IRQ_ADC0 /* Vector 30: ADC Sequence 0 */ - HANDLER lm3s_adc1, LM3S_IRQ_ADC1 /* Vector 31: ADC Sequence 1 */ - HANDLER lm3s_adc2, LM3S_IRQ_ADC2 /* Vector 32: ADC Sequence 2 */ - HANDLER lm3s_adc3, LM3S_IRQ_ADC3 /* Vector 33: ADC Sequence 3 */ - HANDLER lm3s_wdog, LM3S_IRQ_WDOG /* Vector 34: Watchdog Timer */ - HANDLER lm3s_tmr0a, LM3S_IRQ_TIMER0A /* Vector 35: Timer 0 A */ - HANDLER lm3s_tmr0b, LM3S_IRQ_TIMER0B /* Vector 36: Timer 0 B */ - HANDLER lm3s_tmr1a, LM3S_IRQ_TIMER1A /* Vector 37: Timer 1 A */ - HANDLER lm3s_tmr1b, LM3S_IRQ_TIMER1B /* Vector 38: Timer 1 B */ - HANDLER lm3s_tmr2a, LM3S_IRQ_TIMER2A /* Vector 39: Timer 2 A */ - HANDLER lm3s_tmr2b, LM3S_IRQ_TIMER2B /* Vector 40: Timer 3 B */ - HANDLER lm3s_cmp0, LM3S_IRQ_COMPARE0 /* Vector 41: Analog Comparator 0 */ - HANDLER lm3s_cmp1, LM3S_IRQ_COMPARE1 /* Vector 42: Analog Comparator 1 */ - HANDLER lm3s_syscon, LM3S_IRQ_SYSCON /* Vector 44: System Control */ - HANDLER lm3s_flashcon, LM3S_IRQ_FLASHCON /* Vector 45: FLASH Control */ - HANDLER lm3s_gpiof, LM3S_IRQ_GPIOF /* Vector 46: GPIO Port F */ - HANDLER lm3s_gpiog, LM3S_IRQ_GPIOG /* Vector 47: GPIO Port G */ - HANDLER lm3s_uart2, LM3S_IRQ_UART1 /* Vector 49: UART 1 */ - HANDLER lm3s_tmr3a, LM3S_IRQ_TIMER3A /* Vector 51: Timer 3 A */ - HANDLER lm3s_tmr3b, LM3S_IRQ_TIMER3B /* Vector 52: Timer 3 B */ - HANDLER lm3s_i2c1, LM3S_IRQ_I2C1 /* Vector 53: I2C 1 */ - HANDLER lm3s_qei1, LM3S_IRQ_QEI1 /* Vector 54: QEI 1 */ - HANDLER lm3s_eth, LM3S_IRQ_ETHCON /* Vector 58: Ethernet Controller */ - HANDLER lm3s_hib, LM3S_IRQ_HIBERNATE /* Vector 59: Hibernation Module */ -#elif defined(CONFIG_ARCH_CHIP_LM3S8962) - HANDLER lm3s_gpioa, LM3S_IRQ_GPIOA /* Vector 16: GPIO Port A */ - HANDLER lm3s_gpiob, LM3S_IRQ_GPIOB /* Vector 17: GPIO Port B */ - HANDLER lm3s_gpioc, LM3S_IRQ_GPIOC /* Vector 18: GPIO Port C */ - HANDLER lm3s_gpiod, LM3S_IRQ_GPIOD /* Vector 19: GPIO Port D */ - HANDLER lm3s_gpioe, LM3S_IRQ_GPIOE /* Vector 20: GPIO Port E */ - HANDLER lm3s_uart0, LM3S_IRQ_UART0 /* Vector 21: UART 0 */ - HANDLER lm3s_uart1, LM3S_IRQ_UART1 /* Vector 22: UART 1 */ - HANDLER lm3s_ssi0, LM3S_IRQ_SSI0 /* Vector 23: SSI 0 */ - HANDLER lm3s_i2c0, LM3S_IRQ_I2C0 /* Vector 24: I2C 0 */ - HANDLER lm3s_pwmfault, LM3S_IRQ_PWMFAULT /* Vector 25: PWM Fault */ - HANDLER lm3s_pwm0, LM3S_IRQ_PWM0 /* Vector 26: PWM Generator 0 */ - HANDLER lm3s_pwm1, LM3S_IRQ_PWM1 /* Vector 27: PWM Generator 1 */ - HANDLER lm3s_pwm2, LM3S_IRQ_PWM2 /* Vector 28: PWM Generator 2 */ - HANDLER lm3s_qei0, LM3S_IRQ_QEI0 /* Vector 29: QEI 0 */ - HANDLER lm3s_adc0, LM3S_IRQ_ADC0 /* Vector 30: ADC Sequence 0 */ - HANDLER lm3s_adc1, LM3S_IRQ_ADC1 /* Vector 31: ADC Sequence 1 */ - HANDLER lm3s_adc2, LM3S_IRQ_ADC2 /* Vector 32: ADC Sequence 2 */ - HANDLER lm3s_adc3, LM3S_IRQ_ADC3 /* Vector 33: ADC Sequence 3 */ - HANDLER lm3s_wdog, LM3S_IRQ_WDOG /* Vector 34: Watchdog Timer */ - HANDLER lm3s_tmr0a, LM3S_IRQ_TIMER0A /* Vector 35: Timer 0 A */ - HANDLER lm3s_tmr0b, LM3S_IRQ_TIMER0B /* Vector 36: Timer 0 B */ - HANDLER lm3s_tmr1a, LM3S_IRQ_TIMER1A /* Vector 37: Timer 1 A */ - HANDLER lm3s_tmr1b, LM3S_IRQ_TIMER1B /* Vector 38: Timer 1 B */ - HANDLER lm3s_tmr2a, LM3S_IRQ_TIMER2A /* Vector 39: Timer 2 A */ - HANDLER lm3s_tmr2b, LM3S_IRQ_TIMER2B /* Vector 40: Timer 3 B */ - HANDLER lm3s_cmp0, LM3S_IRQ_COMPARE0 /* Vector 41: Analog Comparator 0 */ - HANDLER lm3s_syscon, LM3S_IRQ_SYSCON /* Vector 44: System Control */ - HANDLER lm3s_flashcon, LM3S_IRQ_FLASHCON /* Vector 45: FLASH Control */ - HANDLER lm3s_gpiof, LM3S_IRQ_GPIOF /* Vector 46: GPIO Port F */ - HANDLER lm3s_gpiog, LM3S_IRQ_GPIOG /* Vector 47: GPIO Port G */ - HANDLER lm3s_uart2, LM3S_IRQ_UART1 /* Vector 49: UART 1 */ - HANDLER lm3s_tmr3a, LM3S_IRQ_TIMER3A /* Vector 51: Timer 3 A */ - HANDLER lm3s_tmr3b, LM3S_IRQ_TIMER3B /* Vector 52: Timer 3 B */ - HANDLER lm3s_i2c1, LM3S_IRQ_I2C1 /* Vector 53: I2C 1 */ - HANDLER lm3s_qei1, LM3S_IRQ_QEI1 /* Vector 54: QEI 1 */ - HANDLER lm3s_can0, LM3S_IRQ_CAN0 /* Vector 55: CAN 0 */ - HANDLER lm3s_eth, LM3S_IRQ_ETHCON /* Vector 58: Ethernet Controller */ - HANDLER lm3s_hib, LM3S_IRQ_HIBERNATE /* Vector 59: Hibernation Module */ -#elif defined(CONFIG_ARCH_CHIP_LM3S9B96) - HANDLER lm3s_gpioa, LM3S_IRQ_GPIOA /* Vector 16: GPIO Port A */ - HANDLER lm3s_gpiob, LM3S_IRQ_GPIOB /* Vector 17: GPIO Port B */ - HANDLER lm3s_gpioc, LM3S_IRQ_GPIOC /* Vector 18: GPIO Port C */ - HANDLER lm3s_gpiod, LM3S_IRQ_GPIOD /* Vector 19: GPIO Port D */ - HANDLER lm3s_gpioe, LM3S_IRQ_GPIOE /* Vector 20: GPIO Port E */ - HANDLER lm3s_uart0, LM3S_IRQ_UART0 /* Vector 21: UART 0 */ - HANDLER lm3s_uart1, LM3S_IRQ_UART1 /* Vector 22: UART 1 */ - HANDLER lm3s_ssi0, LM3S_IRQ_SSI0 /* Vector 23: SSI 0 */ - HANDLER lm3s_i2c0, LM3S_IRQ_I2C0 /* Vector 24: I2C 0 */ - HANDLER lm3s_pwmfault, LM3S_IRQ_PWMFAULT /* Vector 25: PWM Fault */ - HANDLER lm3s_pwm0, LM3S_IRQ_PWM0 /* Vector 26: PWM Generator 0 */ - HANDLER lm3s_pwm1, LM3S_IRQ_PWM1 /* Vector 27: PWM Generator 1 */ - HANDLER lm3s_pwm2, LM3S_IRQ_PWM2 /* Vector 28: PWM Generator 2 */ - HANDLER lm3s_qei0, LM3S_IRQ_QEI0 /* Vector 29: QEI 0 */ - HANDLER lm3s_adc0, LM3S_IRQ_ADC0 /* Vector 30: ADC Sequence 0 */ - HANDLER lm3s_adc1, LM3S_IRQ_ADC1 /* Vector 31: ADC Sequence 1 */ - HANDLER lm3s_adc2, LM3S_IRQ_ADC2 /* Vector 32: ADC Sequence 2 */ - HANDLER lm3s_adc3, LM3S_IRQ_ADC3 /* Vector 33: ADC Sequence 3 */ - HANDLER lm3s_wdog, LM3S_IRQ_WDOG /* Vector 34: Watchdog Timer */ - HANDLER lm3s_tmr0a, LM3S_IRQ_TIMER0A /* Vector 35: Timer 0 A */ - HANDLER lm3s_tmr0b, LM3S_IRQ_TIMER0B /* Vector 36: Timer 0 B */ - HANDLER lm3s_tmr1a, LM3S_IRQ_TIMER1A /* Vector 37: Timer 1 A */ - HANDLER lm3s_tmr1b, LM3S_IRQ_TIMER1B /* Vector 38: Timer 1 B */ - HANDLER lm3s_tmr2a, LM3S_IRQ_TIMER2A /* Vector 39: Timer 2 A */ - HANDLER lm3s_tmr2b, LM3S_IRQ_TIMER2B /* Vector 40: Timer 3 B */ - HANDLER lm3s_cmp0, LM3S_IRQ_COMPARE0 /* Vector 41: Analog Comparator 0 */ - HANDLER lm3s_cmp1, LM3S_IRQ_COMPARE1 /* Vector 42: Analog Comparator 1 */ - HANDLER lm3s_cmp2, LM3S_IRQ_COMPARE2 /* Vector 43: Analog Comparator 2 */ - HANDLER lm3s_syscon, LM3S_IRQ_SYSCON /* Vector 44: System Control */ - HANDLER lm3s_flashcon, LM3S_IRQ_FLASHCON /* Vector 45: FLASH Control */ - HANDLER lm3s_gpiof, LM3S_IRQ_GPIOF /* Vector 46: GPIO Port F */ - HANDLER lm3s_gpiog, LM3S_IRQ_GPIOG /* Vector 47: GPIO Port G */ - HANDLER lm3s_gpioh, LM3S_IRQ_GPIOH /* Vector 48: GPIO Port H */ - HANDLER lm3s_uart2, LM3S_IRQ_UART2 /* Vector 49: UART 2 */ - HANDLER lm3s_ssi1, LM3S_IRQ_SSI1 /* Vector 50: GPIO Port H */ - HANDLER lm3s_tmr3a, LM3S_IRQ_TIMER3A /* Vector 51: Timer 3 A */ - HANDLER lm3s_tmr3b, LM3S_IRQ_TIMER3B /* Vector 52: Timer 3 B */ - HANDLER lm3s_i2c1, LM3S_IRQ_I2C1 /* Vector 53: I2C 1 */ - HANDLER lm3s_qei1, LM3S_IRQ_QEI1 /* Vector 54: QEI 1 */ - HANDLER lm3s_can0, LM3S_IRQ_CAN0 /* Vector 55: CAN 0 */ - HANDLER lm3s_can1, LM3S_IRQ_CAN1 /* Vector 56: CAN 1 */ - HANDLER lm3s_eth, LM3S_IRQ_ETHCON /* Vector 58: Ethernet Controller */ - HANDLER lm3s_usb, LM3S_IRQ_USB /* Vector 60: USB */ - HANDLER lm3s_pwm3, LM3S_IRQ_PWM3 /* Vector 61: PWM 3 */ - HANDLER lm3s_udmasoft, LM3S_IRQ_UDMASOFT /* Vector 62: uDMA Software */ - HANDLER lm3s_udmaerror, LM3S_IRQ_UDMAERROR /* Vector 63: uDMA Error */ - HANDLER lm3s_adc1_0, LM3S_IRQ_ADC1_0 /* Vector 64: ADC1 Sequence 0 */ - HANDLER lm3s_adc1_1, LM3S_IRQ_ADC1_1 /* Vector 65: ADC1 Sequence 1 */ - HANDLER lm3s_adc1_2, LM3S_IRQ_ADC1_2 /* Vector 66: ADC1 Sequence 2 */ - HANDLER lm3s_adc1_3, LM3S_IRQ_ADC1_3 /* Vector 67: ADC1 Sequence 3 */ - HANDLER lm3s_i2s0, LM3S_IRQ_I2S0 /* Vector 68: I2S 0 */ - HANDLER lm3s_epi, LM3S_IRQ_EPI /* Vector 69: EPI */ - HANDLER lm3s_gpioj, LM3S_IRQ_GPIOJ /* Vector 70: GPIO Port J */ -#else -# error "Vectors not specified for this LM3S chip" -#endif - -/* Common IRQ handling logic. On entry here, the return stack is on either - * the PSP or the MSP and looks like the following: - * - * REG_XPSR - * REG_R15 - * REG_R14 - * REG_R12 - * REG_R3 - * REG_R2 - * REG_R1 - * MSP->REG_R0 - * - * And - * R0 contains the IRQ number - * R14 Contains the EXC_RETURN value - * We are in handler mode and the current SP is the MSP - */ - -lm3s_irqcommon: - - /* Complete the context save */ - -#ifdef CONFIG_NUTTX_KERNEL - /* The EXC_RETURN value will be 0xfffffff9 (privileged thread) or 0xfffffff1 - * (handler mode) if the state is on the MSP. It can only be on the PSP if - * EXC_RETURN is 0xfffffffd (unprivileged thread) - */ - - adds r2, r14, #3 /* If R14=0xfffffffd, then r2 == 0 */ - ite ne /* Next two instructions are condition */ - mrsne r1, msp /* R1=The main stack pointer */ - mrseq r1, psp /* R1=The process stack pointer */ -#else - mrs r1, msp /* R1=The main stack pointer */ -#endif - - mov r2, r1 /* R2=Copy of the main/process stack pointer */ - add r2, #HW_XCPT_SIZE /* R2=MSP/PSP before the interrupt was taken */ - mrs r3, primask /* R3=Current PRIMASK setting */ -#ifdef CONFIG_NUTTX_KERNEL - stmdb r1!, {r2-r11,r14} /* Save the remaining registers plus the SP value */ -#else - stmdb r1!, {r2-r11} /* Save the remaining registers plus the SP value */ -#endif - - /* Disable interrupts, select the stack to use for interrupt handling - * and call up_doirq to handle the interrupt - */ - - cpsid i /* Disable further interrupts */ - - /* If CONFIG_ARCH_INTERRUPTSTACK is defined, we will use a special interrupt - * stack pointer. The way that this is done here prohibits nested interrupts! - * Otherwise, we will re-use the main stack for interrupt level processing. - */ - -#if CONFIG_ARCH_INTERRUPTSTACK > 3 - ldr sp, =g_intstackbase - str r1, [sp, #-4]! /* Save the MSP on the interrupt stack */ - bl up_doirq /* R0=IRQ, R1=register save (msp) */ - ldr r1, [sp, #+4]! /* Recover R1=main stack pointer */ -#else - mov sp, r1 /* We are using the main stack pointer */ - bl up_doirq /* R0=IRQ, R1=register save (msp) */ - mov r1, sp /* Recover R1=main stack pointer */ -#endif - - /* On return from up_doirq, R0 will hold a pointer to register context - * array to use for the interrupt return. If that return value is the same - * as current stack pointer, then things are relatively easy. - */ - - cmp r0, r1 /* Context switch? */ - beq 1f /* Branch if no context switch */ - - /* We are returning with a pending context switch. This case is different - * because in this case, the register save structure does not lie on the - * stack but, rather, are within a TCB structure. We'll have to copy some - * values to the stack. - */ - - add r1, r0, #SW_XCPT_SIZE /* R1=Address of HW save area in reg array */ - ldmia r1, {r4-r11} /* Fetch eight registers in HW save area */ - ldr r1, [r0, #(4*REG_SP)] /* R1=Value of SP before interrupt */ - stmdb r1!, {r4-r11} /* Store eight registers in HW save area */ -#ifdef CONFIG_NUTTX_KERNEL - ldmia r0, {r2-r11,r14} /* Recover R4-R11, r14 + 2 temp values */ -#else - ldmia r0, {r2-r11} /* Recover R4-R11 + 2 temp values */ -#endif - b 2f /* Re-join common logic */ - - /* We are returning with no context switch. We simply need to "unwind" - * the same stack frame that we created - */ -1: -#ifdef CONFIG_NUTTX_KERNEL - ldmia r1!, {r2-r11,r14} /* Recover R4-R11, r14 + 2 temp values */ -#else - ldmia r1!, {r2-r11} /* Recover R4-R11 + 2 temp values */ -#endif -2: -#ifdef CONFIG_NUTTX_KERNEL - /* The EXC_RETURN value will be 0xfffffff9 (privileged thread) or 0xfffffff1 - * (handler mode) if the state is on the MSP. It can only be on the PSP if - * EXC_RETURN is 0xfffffffd (unprivileged thread) - */ - - adds r0, r14, #3 /* If R14=0xfffffffd, then r0 == 0 */ - ite ne /* Next two instructions are condition */ - msrne msp, r1 /* R1=The main stack pointer */ - msreq psp, r1 /* R1=The process stack pointer */ -#else - msr msp, r1 /* Recover the return MSP value */ - - /* Preload r14 with the special return value first (so that the return - * actually occurs with interrupts still disabled). - */ - - ldr r14, =EXC_RETURN /* Load the special value */ -#endif - - /* Restore the interrupt state */ - - msr primask, r3 /* Restore interrupts */ - - /* Always return with R14 containing the special value that will: (1) - * return to thread mode, and (2) continue to use the MSP - */ - - bx r14 /* And return */ - .size handlers, .-handlers - -/************************************************************************************ - * Name: up_interruptstack/g_intstackbase - * - * Description: - * Shouldn't happen - * - ************************************************************************************/ - -#if CONFIG_ARCH_INTERRUPTSTACK > 3 - .bss - .global g_intstackbase - .align 4 -up_interruptstack: - .skip (CONFIG_ARCH_INTERRUPTSTACK & ~3) -g_intstackbase: - .size up_interruptstack, .-up_interruptstack -#endif - -/************************************************************************************ - * .rodata - ************************************************************************************/ - - .section .rodata, "a" - -/* Variables: _sbss is the start of the BSS region (see ld.script) _ebss is the end - * of the BSS regsion (see ld.script). The idle task stack starts at the end of BSS - * and is of size CONFIG_IDLETHREAD_STACKSIZE. The IDLE thread is the thread that - * the system boots on and, eventually, becomes the idle, do nothing task that runs - * only when there is nothing else to run. The heap continues from there until the - * end of memory. See g_heapbase below. - */ - - .globl g_heapbase - .type g_heapbase, object -g_heapbase: - .long _ebss+CONFIG_IDLETHREAD_STACKSIZE - .size g_heapbase, .-g_heapbase - - .end diff --git a/nuttx/arch/arm/src/lm/lm3s_dumpgpio.c b/nuttx/arch/arm/src/lm/lm_dumpgpio.c similarity index 93% rename from nuttx/arch/arm/src/lm/lm3s_dumpgpio.c rename to nuttx/arch/arm/src/lm/lm_dumpgpio.c index a84dc59ddb..a3190784b9 100644 --- a/nuttx/arch/arm/src/lm/lm3s_dumpgpio.c +++ b/nuttx/arch/arm/src/lm/lm_dumpgpio.c @@ -1,5 +1,5 @@ /**************************************************************************** - * arch/arm/src/lm/lm3s_dumpgpio.c + * arch/arm/src/lm/lm_dumpgpio.c * * Copyright (C) 2009-2010 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -58,7 +58,7 @@ * Private Types ****************************************************************************/ -/* NOTE: this is duplicated in lm3s_gpio.c */ +/* NOTE: this is duplicated in lm_gpio.c */ #ifdef LM3S_GPIOH_BASE static const uint32_t g_gpiobase[8] = @@ -83,7 +83,7 @@ static const char g_portchar[8] = { 'A', 'B', 'C', 'D', 'E', 'F', 'G', '?' }; ****************************************************************************/ /**************************************************************************** - * Name: lm3s_gpiobaseaddress + * Name: lm_gpiobaseaddress * * Description: * Given a GPIO enumeration value, return the base address of the @@ -91,13 +91,13 @@ static const char g_portchar[8] = { 'A', 'B', 'C', 'D', 'E', 'F', 'G', '?' }; * ****************************************************************************/ -static inline uint32_t lm3s_gpiobaseaddress(int port) +static inline uint32_t lm_gpiobaseaddress(int port) { return g_gpiobase[port & 7]; } /**************************************************************************** - * Name: lm3s_gpioport + * Name: lm_gpioport * * Description: * Given a GPIO enumeration value, return the base address of the @@ -105,7 +105,7 @@ static inline uint32_t lm3s_gpiobaseaddress(int port) * ****************************************************************************/ -static inline uint8_t lm3s_gpioport(int port) +static inline uint8_t lm_gpioport(int port) { return g_portchar[port & 7]; } @@ -115,14 +115,14 @@ static inline uint8_t lm3s_gpioport(int port) ****************************************************************************/ /**************************************************************************** - * Function: lm3s_dumpgpio + * Function: lm_dumpgpio * * Description: * Dump all GPIO registers associated with the provided base address * ****************************************************************************/ -int lm3s_dumpgpio(uint32_t pinset, const char *msg) +int lm_dumpgpio(uint32_t pinset, const char *msg) { irqstate_t flags; unsigned int port = (pinset & GPIO_PORT_MASK) >> GPIO_PORT_SHIFT; @@ -132,7 +132,7 @@ int lm3s_dumpgpio(uint32_t pinset, const char *msg) /* Get the base address associated with the GPIO port */ - base = lm3s_gpiobaseaddress(port); + base = lm_gpiobaseaddress(port); DEBUGASSERT(base != 0); /* The following requires exclusive access to the GPIO registers */ @@ -142,7 +142,7 @@ int lm3s_dumpgpio(uint32_t pinset, const char *msg) enabled = ((rcgc2 & SYSCON_RCGC2_GPIO(port)) != 0); lldbg("GPIO%c pinset: %08x base: %08x -- %s\n", - lm3s_gpioport(port), pinset, base, msg); + lm_gpioport(port), pinset, base, msg); lldbg(" RCGC2: %08x (%s)\n", rcgc2, enabled ? "enabled" : "disabled" ); diff --git a/nuttx/arch/arm/src/lm/lm3s_ethernet.c b/nuttx/arch/arm/src/lm/lm_ethernet.c similarity index 75% rename from nuttx/arch/arm/src/lm/lm3s_ethernet.c rename to nuttx/arch/arm/src/lm/lm_ethernet.c index f6edab5ae2..1d8def2e93 100644 --- a/nuttx/arch/arm/src/lm/lm3s_ethernet.c +++ b/nuttx/arch/arm/src/lm/lm_ethernet.c @@ -1,5 +1,5 @@ /**************************************************************************** - * arch/arm/src/lm/lm3s_ethernet.c + * arch/arm/src/lm/lm_ethernet.c * * Copyright (C) 2009-2010 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -38,7 +38,7 @@ ****************************************************************************/ #include -#if defined(CONFIG_NET) && defined(CONFIG_LM3S_ETHERNET) +#if defined(CONFIG_NET) && defined(CONFIG_LM_ETHERNET) #include #include @@ -66,9 +66,9 @@ * Pre-processor Definitions ****************************************************************************/ -/* Half duplex can be forced if CONFIG_LM3S_ETHHDUPLEX is defined. */ +/* Half duplex can be forced if CONFIG_LM_ETHHDUPLEX is defined. */ -#ifdef CONFIG_LM3S_ETHHDUPLEX +#ifdef CONFIG_LM_ETHHDUPLEX # define LM3S_DUPLEX_SETBITS 0 # define LM3S_DUPLEX_CLRBITS MAC_TCTL_DUPLEX #else @@ -76,9 +76,9 @@ # define LM3S_DUPLEX_CLRBITS 0 #endif -/* Auto CRC generation can be suppressed if CONFIG_LM3S_ETHNOAUTOCRC is definde */ +/* Auto CRC generation can be suppressed if CONFIG_LM_ETHNOAUTOCRC is definde */ -#ifdef CONFIG_LM3S_ETHNOAUTOCRC +#ifdef CONFIG_LM_ETHNOAUTOCRC # define LM3S_CRC_SETBITS 0 # define LM3S_CRC_CLRBITS MAC_TCTL_CRC #else @@ -86,9 +86,9 @@ # define LM3S_CRC_CLRBITS 0 #endif -/* Tx padding can be suppressed if CONFIG_LM3S_ETHNOPAD is defined */ +/* Tx padding can be suppressed if CONFIG_LM_ETHNOPAD is defined */ -#ifdef CONFIG_LM3S_ETHNOPAD +#ifdef CONFIG_LM_ETHNOPAD # define LM3S_PADEN_SETBITS 0 # define LM3S_PADEN_CLRBITS MAC_TCTL_PADEN #else @@ -99,9 +99,9 @@ #define LM3S_TCTCL_SETBITS (LM3S_DUPLEX_SETBITS|LM3S_CRC_SETBITS|LM3S_PADEN_SETBITS) #define LM3S_TCTCL_CLRBITS (LM3S_DUPLEX_CLRBITS|LM3S_CRC_CLRBITS|LM3S_PADEN_CLRBITS) -/* Multicast frames can be enabled by defining CONFIG_LM3S_MULTICAST */ +/* Multicast frames can be enabled by defining CONFIG_LM_MULTICAST */ -#ifdef CONFIG_LM3S_MULTICAST +#ifdef CONFIG_LM_MULTICAST # define LM3S_AMUL_SETBITS MAC_RCTL_AMUL # define LM3S_AMUL_CLRBITS 0 #else @@ -109,9 +109,9 @@ # define LM3S_AMUL_CLRBITS MAC_RCTL_AMUL #endif -/* Promiscuous mode can be enabled by defining CONFIG_LM3S_PROMISCUOUS */ +/* Promiscuous mode can be enabled by defining CONFIG_LM_PROMISCUOUS */ -#ifdef CONFIG_LM3S_PROMISCUOUS +#ifdef CONFIG_LM_PROMISCUOUS # define LM3S_PRMS_SETBITS MAC_RCTL_PRMS # define LM3S_PRMS_CLRBITS 0 #else @@ -119,9 +119,9 @@ # define LM3S_PRMS_CLRBITS MAC_RCTL_PRMS #endif -/* Bad CRC rejection can be enabled by define CONFIG_LM3S_BADCRC */ +/* Bad CRC rejection can be enabled by define CONFIG_LM_BADCRC */ -#ifdef CONFIG_LM3S_BADCRC +#ifdef CONFIG_LM_BADCRC # define LM3S_BADCRC_SETBITS MAC_RCTL_BADCRC # define LM3S_BADCRC_CLRBITS 0 #else @@ -132,12 +132,12 @@ #define LM3S_RCTCL_SETBITS (LM3S_AMUL_SETBITS|LM3S_PRMS_SETBITS|LM3S_BADCRC_SETBITS) #define LM3S_RCTCL_CLRBITS (LM3S_AMUL_CLRBITS|LM3S_PRMS_CLRBITS|LM3S_BADCRC_CLRBITS) -/* CONFIG_LM3S_DUMPPACKET will dump the contents of each packet to the console. */ +/* CONFIG_LM_DUMPPACKET will dump the contents of each packet to the console. */ -#ifdef CONFIG_LM3S_DUMPPACKET -# define lm3s_dumppacket(m,a,n) lib_dumpbuffer(m,a,n) +#ifdef CONFIG_LM_DUMPPACKET +# define lm_dumppacket(m,a,n) lib_dumpbuffer(m,a,n) #else -# define lm3s_dumppacket(m,a,n) +# define lm_dumppacket(m,a,n) #endif /* TX poll deley = 1 seconds. CLK_TCK is the number of clock ticks per second */ @@ -162,7 +162,7 @@ /* EMAC statistics (debug only) */ #if defined(CONFIG_DEBUG) && defined(CONFIG_DEBUG_NET) -struct lm3s_statistics_s +struct lm_statistics_s { uint32_t rx_int; /* Number of Rx interrupts received */ uint32_t rx_packets; /* Number of packets received (sum of the following): */ @@ -182,11 +182,11 @@ struct lm3s_statistics_s # define EMAC_STAT(priv,name) #endif -/* The lm3s_driver_s encapsulates all state information for a single hardware +/* The lm_driver_s encapsulates all state information for a single hardware * interface */ -struct lm3s_driver_s +struct lm_driver_s { /* The following fields would only be necessary on chips that support * multiple Ethernet controllers. @@ -202,7 +202,7 @@ struct lm3s_driver_s WDOG_ID ld_txtimeout; /* TX timeout timer */ #if defined(CONFIG_DEBUG) && defined(CONFIG_DEBUG_NET) - struct lm3s_statistics_s ld_stat; + struct lm_statistics_s ld_stat; #endif /* This holds the information visible to uIP/NuttX */ @@ -214,7 +214,7 @@ struct lm3s_driver_s * Private Data ****************************************************************************/ -static struct lm3s_driver_s g_lm3sdev[LM3S_NETHCONTROLLERS]; +static struct lm_driver_s g_lm3sdev[LM3S_NETHCONTROLLERS]; /**************************************************************************** * Private Function Prototypes @@ -223,42 +223,42 @@ static struct lm3s_driver_s g_lm3sdev[LM3S_NETHCONTROLLERS]; /* Miscellaneous low level helpers */ #if LM3S_NETHCONTROLLERS > 1 -static uint32_t lm3s_ethin(struct lm3s_driver_s *priv, int offset); -static void lm3s_ethout(struct lm3s_driver_s *priv, int offset, uint32_t value); +static uint32_t lm_ethin(struct lm_driver_s *priv, int offset); +static void lm_ethout(struct lm_driver_s *priv, int offset, uint32_t value); #else -static inline uint32_t lm3s_ethin(struct lm3s_driver_s *priv, int offset); -static inline void lm3s_ethout(struct lm3s_driver_s *priv, int offset, uint32_t value); +static inline uint32_t lm_ethin(struct lm_driver_s *priv, int offset); +static inline void lm_ethout(struct lm_driver_s *priv, int offset, uint32_t value); #endif -static void lm3s_ethreset(struct lm3s_driver_s *priv); +static void lm_ethreset(struct lm_driver_s *priv); #if 0 /* Not used */ -static void lm3s_phywrite(struct lm3s_driver_s *priv, int regaddr, uint16_t value); +static void lm_phywrite(struct lm_driver_s *priv, int regaddr, uint16_t value); #endif -static uint16_t lm3s_phyread(struct lm3s_driver_s *priv, int regaddr); +static uint16_t lm_phyread(struct lm_driver_s *priv, int regaddr); /* Common TX logic */ -static int lm3s_transmit(struct lm3s_driver_s *priv); -static int lm3s_uiptxpoll(struct uip_driver_s *dev); +static int lm_transmit(struct lm_driver_s *priv); +static int lm_uiptxpoll(struct uip_driver_s *dev); /* Interrupt handling */ -static void lm3s_receive(struct lm3s_driver_s *priv); -static void lm3s_txdone(struct lm3s_driver_s *priv); -static int lm3s_interrupt(int irq, FAR void *context); +static void lm_receive(struct lm_driver_s *priv); +static void lm_txdone(struct lm_driver_s *priv); +static int lm_interrupt(int irq, FAR void *context); /* Watchdog timer expirations */ -static void lm3s_polltimer(int argc, uint32_t arg, ...); -static void lm3s_txtimeout(int argc, uint32_t arg, ...); +static void lm_polltimer(int argc, uint32_t arg, ...); +static void lm_txtimeout(int argc, uint32_t arg, ...); /* NuttX callback functions */ -static int lm3s_ifup(struct uip_driver_s *dev); -static int lm3s_ifdown(struct uip_driver_s *dev); -static int lm3s_txavail(struct uip_driver_s *dev); +static int lm_ifup(struct uip_driver_s *dev); +static int lm_ifdown(struct uip_driver_s *dev); +static int lm_txavail(struct uip_driver_s *dev); #ifdef CONFIG_NET_IGMP -static int lm3s_addmac(struct uip_driver_s *dev, FAR const uint8_t *mac); -static int lm3s_rmmac(struct uip_driver_s *dev, FAR const uint8_t *mac); +static int lm_addmac(struct uip_driver_s *dev, FAR const uint8_t *mac); +static int lm_rmmac(struct uip_driver_s *dev, FAR const uint8_t *mac); #endif /**************************************************************************** @@ -266,7 +266,7 @@ static int lm3s_rmmac(struct uip_driver_s *dev, FAR const uint8_t *mac); ****************************************************************************/ /**************************************************************************** - * Function: lm3s_ethin + * Function: lm_ethin * * Description: * Read a register from the Ethernet module @@ -281,19 +281,19 @@ static int lm3s_rmmac(struct uip_driver_s *dev, FAR const uint8_t *mac); ****************************************************************************/ #if LM3S_NETHCONTROLLERS > 1 -static uint32_t lm3s_ethin(struct lm3s_driver_s *priv, int offset) +static uint32_t lm_ethin(struct lm_driver_s *priv, int offset) { return getreg32(priv->ld_base + offset); } #else -static inline uint32_t lm3s_ethin(struct lm3s_driver_s *priv, int offset) +static inline uint32_t lm_ethin(struct lm_driver_s *priv, int offset) { return getreg32(LM3S_ETHCON_BASE + offset); } #endif /**************************************************************************** - * Function: lm3s_ethout + * Function: lm_ethout * * Description: * Write a register to the Ethernet module @@ -309,19 +309,19 @@ static inline uint32_t lm3s_ethin(struct lm3s_driver_s *priv, int offset) ****************************************************************************/ #if LM3S_NETHCONTROLLERS > 1 -static void lm3s_ethout(struct lm3s_driver_s *priv, int offset, uint32_t value) +static void lm_ethout(struct lm_driver_s *priv, int offset, uint32_t value) { putreg32(value, priv->ld_base + offset); } #else -static inline void lm3s_ethout(struct lm3s_driver_s *priv, int offset, uint32_t value) +static inline void lm_ethout(struct lm_driver_s *priv, int offset, uint32_t value) { putreg32(value, LM3S_ETHCON_BASE + offset); } #endif /**************************************************************************** - * Function: lm3s_ethreset + * Function: lm_ethreset * * Description: * Configure and reset the Ethernet module, leaving it in a disabled state. @@ -336,7 +336,7 @@ static inline void lm3s_ethout(struct lm3s_driver_s *priv, int offset, uint32_t * ****************************************************************************/ -static void lm3s_ethreset(struct lm3s_driver_s *priv) +static void lm_ethreset(struct lm_driver_s *priv) { irqstate_t flags; uint32_t regval; @@ -375,28 +375,28 @@ static void lm3s_ethreset(struct lm3s_driver_s *priv) /* Enable Port F for Ethernet LEDs: LED0=Bit 3; LED1=Bit 2 */ -#ifdef CONFIG_LM3S_ETHLEDS +#ifdef CONFIG_LM_ETHLEDS /* Configure the pins for the peripheral function */ - lm3s_configgpio(GPIO_ETHPHY_LED0 | GPIO_STRENGTH_2MA | GPIO_PADTYPE_STD); - lm3s_configgpio(GPIO_ETHPHY_LED1 | GPIO_STRENGTH_2MA | GPIO_PADTYPE_STD); + lm_configgpio(GPIO_ETHPHY_LED0 | GPIO_STRENGTH_2MA | GPIO_PADTYPE_STD); + lm_configgpio(GPIO_ETHPHY_LED1 | GPIO_STRENGTH_2MA | GPIO_PADTYPE_STD); #endif /* Disable all Ethernet controller interrupts */ - regval = lm3s_ethin(priv, LM3S_MAC_IM_OFFSET); + regval = lm_ethin(priv, LM3S_MAC_IM_OFFSET); regval &= ~MAC_IM_ALLINTS; - lm3s_ethout(priv, LM3S_MAC_IM_OFFSET, regval); + lm_ethout(priv, LM3S_MAC_IM_OFFSET, regval); /* Clear any pending interrupts (shouldn't be any) */ - regval = lm3s_ethin(priv, LM3S_MAC_RIS_OFFSET); - lm3s_ethout(priv, LM3S_MAC_IACK_OFFSET, regval); + regval = lm_ethin(priv, LM3S_MAC_RIS_OFFSET); + lm_ethout(priv, LM3S_MAC_IACK_OFFSET, regval); irqrestore(flags); } /**************************************************************************** - * Function: lm3s_phywrite + * Function: lm_phywrite * * Description: * Write a 16-bit word to a PHY register @@ -412,31 +412,31 @@ static void lm3s_ethreset(struct lm3s_driver_s *priv) ****************************************************************************/ #if 0 /* Not used */ -static void lm3s_phywrite(struct lm3s_driver_s *priv, int regaddr, uint16_t value) +static void lm_phywrite(struct lm_driver_s *priv, int regaddr, uint16_t value) { /* Wait for any MII transactions in progress to complete */ - while ((lm3s_ethin(priv, LM3S_MAC_MCTL_OFFSET) & MAC_MCTL_START) != 0); + while ((lm_ethin(priv, LM3S_MAC_MCTL_OFFSET) & MAC_MCTL_START) != 0); /* Set up the data to be written */ DEBUGASSERT(value < MAC_MTXD_MASK); - lm3s_ethout(priv, LM3S_MAC_MTXD_OFFSET, value); + lm_ethout(priv, LM3S_MAC_MTXD_OFFSET, value); /* Set up the PHY register address and start the write operation */ regaddr <<= MAC_MCTL_REGADR_SHIFT; DEBUGASSERT((regaddr & MAC_MTXD_MASK) == regaddr); - lm3s_ethout(priv, LM3S_MAC_MCTL_OFFSET, regaddr | MAC_MCTL_WRITE | MAC_MCTL_START); + lm_ethout(priv, LM3S_MAC_MCTL_OFFSET, regaddr | MAC_MCTL_WRITE | MAC_MCTL_START); /* Wait for the write transaction to complete */ - while ((lm3s_ethin(priv, LM3S_MAC_MCTL_OFFSET) & MAC_MCTL_START) != 0); + while ((lm_ethin(priv, LM3S_MAC_MCTL_OFFSET) & MAC_MCTL_START) != 0); } #endif /**************************************************************************** - * Function: lm3s_phyread + * Function: lm_phyread * * Description: * Write a 16-bit word to a PHY register @@ -451,29 +451,29 @@ static void lm3s_phywrite(struct lm3s_driver_s *priv, int regaddr, uint16_t valu * ****************************************************************************/ -static uint16_t lm3s_phyread(struct lm3s_driver_s *priv, int regaddr) +static uint16_t lm_phyread(struct lm_driver_s *priv, int regaddr) { /* Wait for any MII transactions in progress to complete */ - while ((lm3s_ethin(priv, LM3S_MAC_MCTL_OFFSET) & MAC_MCTL_START) != 0); + while ((lm_ethin(priv, LM3S_MAC_MCTL_OFFSET) & MAC_MCTL_START) != 0); /* Set up the PHY register address and start the read operation */ regaddr <<= MAC_MCTL_REGADR_SHIFT; DEBUGASSERT((regaddr & MAC_MTXD_MASK) == regaddr); - lm3s_ethout(priv, LM3S_MAC_MCTL_OFFSET, regaddr | MAC_MCTL_START); + lm_ethout(priv, LM3S_MAC_MCTL_OFFSET, regaddr | MAC_MCTL_START); /* Wait for the write transaction to complete */ - while ((lm3s_ethin(priv, LM3S_MAC_MCTL_OFFSET) & MAC_MCTL_START) != 0); + while ((lm_ethin(priv, LM3S_MAC_MCTL_OFFSET) & MAC_MCTL_START) != 0); /* Read and return the PHY data */ - return (uint16_t)(lm3s_ethin(priv, LM3S_MAC_MRXD_OFFSET) & MAC_MTRD_MASK); + return (uint16_t)(lm_ethin(priv, LM3S_MAC_MRXD_OFFSET) & MAC_MTRD_MASK); } /**************************************************************************** - * Function: lm3s_transmit + * Function: lm_transmit * * Description: * Start hardware transmission. Called either from the txdone interrupt @@ -487,7 +487,7 @@ static uint16_t lm3s_phyread(struct lm3s_driver_s *priv, int regaddr) * ****************************************************************************/ -static int lm3s_transmit(struct lm3s_driver_s *priv) +static int lm_transmit(struct lm_driver_s *priv) { irqstate_t flags; uint32_t regval; @@ -499,12 +499,12 @@ static int lm3s_transmit(struct lm3s_driver_s *priv) /* Verify that the hardware is ready to send another packet */ flags = irqsave(); - if ((lm3s_ethin(priv, LM3S_MAC_TR_OFFSET) & MAC_TR_NEWTX) == 0) + if ((lm_ethin(priv, LM3S_MAC_TR_OFFSET) & MAC_TR_NEWTX) == 0) { /* Increment statistics */ EMAC_STAT(priv, tx_packets); - lm3s_dumppacket("Transmit packet", priv->ld_dev.d_buf, priv->ld_dev.d_len); + lm_dumppacket("Transmit packet", priv->ld_dev.d_buf, priv->ld_dev.d_len); /* Transfer the packet into the Tx FIFO. The LS 16-bits of the first * 32-bit word written to the Tx FIFO contains the Ethernet payload @@ -520,7 +520,7 @@ static int lm3s_transmit(struct lm3s_driver_s *priv) regval = (uint32_t)(pktlen - 14); regval |= ((uint32_t)(*dbuf++) << 16); regval |= ((uint32_t)(*dbuf++) << 24); - lm3s_ethout(priv, LM3S_MAC_DATA_OFFSET, regval); + lm_ethout(priv, LM3S_MAC_DATA_OFFSET, regval); /* Write all of the whole, 32-bit values in the middle of the packet */ @@ -530,7 +530,7 @@ static int lm3s_transmit(struct lm3s_driver_s *priv) * buffer may be un-aligned. */ - lm3s_ethout(priv, LM3S_MAC_DATA_OFFSET, *(uint32_t*)dbuf); + lm_ethout(priv, LM3S_MAC_DATA_OFFSET, *(uint32_t*)dbuf); } /* Write the last, partial word in the FIFO */ @@ -554,16 +554,16 @@ static int lm3s_transmit(struct lm3s_driver_s *priv) regval |= (uint32_t)dbuf[0]; break; } - lm3s_ethout(priv, LM3S_MAC_DATA_OFFSET, regval); + lm_ethout(priv, LM3S_MAC_DATA_OFFSET, regval); } /* Activate the transmitter */ - lm3s_ethout(priv, LM3S_MAC_TR_OFFSET, MAC_TR_NEWTX); + lm_ethout(priv, LM3S_MAC_TR_OFFSET, MAC_TR_NEWTX); /* Setup the TX timeout watchdog (perhaps restarting the timer) */ - (void)wd_start(priv->ld_txtimeout, LM3S_TXTIMEOUT, lm3s_txtimeout, 1, (uint32_t)priv); + (void)wd_start(priv->ld_txtimeout, LM3S_TXTIMEOUT, lm_txtimeout, 1, (uint32_t)priv); ret = OK; } @@ -572,7 +572,7 @@ static int lm3s_transmit(struct lm3s_driver_s *priv) } /**************************************************************************** - * Function: lm3s_uiptxpoll + * Function: lm_uiptxpoll * * Description: * The transmitter is available, check if uIP has any outgoing packets ready @@ -592,9 +592,9 @@ static int lm3s_transmit(struct lm3s_driver_s *priv) * ****************************************************************************/ -static int lm3s_uiptxpoll(struct uip_driver_s *dev) +static int lm_uiptxpoll(struct uip_driver_s *dev) { - struct lm3s_driver_s *priv = (struct lm3s_driver_s *)dev->d_private; + struct lm_driver_s *priv = (struct lm_driver_s *)dev->d_private; int ret = OK; /* If the polling resulted in data that should be sent out on the network, @@ -604,13 +604,13 @@ static int lm3s_uiptxpoll(struct uip_driver_s *dev) nllvdbg("Poll result: d_len=%d\n", priv->ld_dev.d_len); if (priv->ld_dev.d_len > 0) { - /* Send the packet. lm3s_transmit() will return zero if the + /* Send the packet. lm_transmit() will return zero if the * packet was successfully handled. */ - DEBUGASSERT((lm3s_ethin(priv, LM3S_MAC_TR_OFFSET) & MAC_TR_NEWTX) == 0) + DEBUGASSERT((lm_ethin(priv, LM3S_MAC_TR_OFFSET) & MAC_TR_NEWTX) == 0) uip_arp_out(&priv->ld_dev); - ret = lm3s_transmit(priv); + ret = lm_transmit(priv); } /* If zero is returned, the polling will continue until all connections have @@ -621,7 +621,7 @@ static int lm3s_uiptxpoll(struct uip_driver_s *dev) } /**************************************************************************** - * Function: lm3s_receive + * Function: lm_receive * * Description: * An interrupt was received indicating the availability of a new RX packet @@ -636,7 +636,7 @@ static int lm3s_uiptxpoll(struct uip_driver_s *dev) * ****************************************************************************/ -static void lm3s_receive(struct lm3s_driver_s *priv) +static void lm_receive(struct lm_driver_s *priv) { uint32_t regval; uint8_t *dbuf; @@ -645,7 +645,7 @@ static void lm3s_receive(struct lm3s_driver_s *priv) /* Loop while there are incoming packets to be processed */ - while ((lm3s_ethin(priv, LM3S_MAC_NP_OFFSET) & MAC_NP_MASK) != 0) + while ((lm_ethin(priv, LM3S_MAC_NP_OFFSET) & MAC_NP_MASK) != 0) { /* Update statistics */ @@ -665,7 +665,7 @@ static void lm3s_receive(struct lm3s_driver_s *priv) * includes the len/type field (size 2) and the FCS (size 4). */ - regval = lm3s_ethin(priv, LM3S_MAC_DATA_OFFSET); + regval = lm_ethin(priv, LM3S_MAC_DATA_OFFSET); pktlen = (int)(regval & 0x0000ffff); nllvdbg("Receiving packet, pktlen: %d\n", pktlen); @@ -694,7 +694,7 @@ static void lm3s_receive(struct lm3s_driver_s *priv) while (wordlen--) { - (void)lm3s_ethin(priv, LM3S_MAC_DATA_OFFSET); + (void)lm_ethin(priv, LM3S_MAC_DATA_OFFSET); } /* Check for another packet */ @@ -718,7 +718,7 @@ static void lm3s_receive(struct lm3s_driver_s *priv) * buffer may be un-aligned. */ - *(uint32_t*)dbuf = lm3s_ethin(priv, LM3S_MAC_DATA_OFFSET); + *(uint32_t*)dbuf = lm_ethin(priv, LM3S_MAC_DATA_OFFSET); } /* Handle the last, partial word in the FIFO (0-3 bytes) and discard @@ -731,7 +731,7 @@ static void lm3s_receive(struct lm3s_driver_s *priv) * bytes of the FCS into the user buffer. */ - regval = lm3s_ethin(priv, LM3S_MAC_DATA_OFFSET); + regval = lm_ethin(priv, LM3S_MAC_DATA_OFFSET); switch (bytesleft) { default: @@ -752,7 +752,7 @@ static void lm3s_receive(struct lm3s_driver_s *priv) */ priv->ld_dev.d_len = pktlen - 6; - lm3s_dumppacket("Received packet", priv->ld_dev.d_buf, priv->ld_dev.d_len); + lm_dumppacket("Received packet", priv->ld_dev.d_buf, priv->ld_dev.d_len); /* We only accept IP packets of the configured type and ARP packets */ @@ -775,7 +775,7 @@ static void lm3s_receive(struct lm3s_driver_s *priv) if (priv->ld_dev.d_len > 0) { uip_arp_out(&priv->ld_dev); - lm3s_transmit(priv); + lm_transmit(priv); } } else if (ETHBUF->type == htons(UIP_ETHTYPE_ARP)) @@ -791,7 +791,7 @@ static void lm3s_receive(struct lm3s_driver_s *priv) if (priv->ld_dev.d_len > 0) { - lm3s_transmit(priv); + lm_transmit(priv); } } #ifdef CONFIG_DEBUG @@ -805,7 +805,7 @@ static void lm3s_receive(struct lm3s_driver_s *priv) } /**************************************************************************** - * Function: lm3s_txdone + * Function: lm_txdone * * Description: * An interrupt was received indicating that the last TX packet(s) is done @@ -820,7 +820,7 @@ static void lm3s_receive(struct lm3s_driver_s *priv) * ****************************************************************************/ -static void lm3s_txdone(struct lm3s_driver_s *priv) +static void lm_txdone(struct lm_driver_s *priv) { /* Cancel the TX timeout */ @@ -834,15 +834,15 @@ static void lm3s_txdone(struct lm3s_driver_s *priv) * at this point. */ - DEBUGASSERT((lm3s_ethin(priv, LM3S_MAC_TR_OFFSET) & MAC_TR_NEWTX) == 0) + DEBUGASSERT((lm_ethin(priv, LM3S_MAC_TR_OFFSET) & MAC_TR_NEWTX) == 0) /* Then poll uIP for new XMIT data */ - (void)uip_poll(&priv->ld_dev, lm3s_uiptxpoll); + (void)uip_poll(&priv->ld_dev, lm_uiptxpoll); } /**************************************************************************** - * Function: lm3s_interrupt + * Function: lm_interrupt * * Description: * Hardware interrupt handler @@ -858,9 +858,9 @@ static void lm3s_txdone(struct lm3s_driver_s *priv) * ****************************************************************************/ -static int lm3s_interrupt(int irq, FAR void *context) +static int lm_interrupt(int irq, FAR void *context) { - register struct lm3s_driver_s *priv; + register struct lm_driver_s *priv; uint32_t ris; #if LM3S_NETHCONTROLLERS > 1 @@ -871,11 +871,11 @@ static int lm3s_interrupt(int irq, FAR void *context) /* Read the raw interrupt status register */ - ris = lm3s_ethin(priv, LM3S_MAC_RIS_OFFSET); + ris = lm_ethin(priv, LM3S_MAC_RIS_OFFSET); /* Clear all pending interrupts */ - lm3s_ethout(priv, LM3S_MAC_IACK_OFFSET, ris); + lm_ethout(priv, LM3S_MAC_IACK_OFFSET, ris); /* Check for errors */ @@ -898,7 +898,7 @@ static int lm3s_interrupt(int irq, FAR void *context) /* Handle (unmasked) interrupts according to status bit settings */ - ris &= lm3s_ethin(priv, LM3S_MAC_IM_OFFSET); + ris &= lm_ethin(priv, LM3S_MAC_IM_OFFSET); /* Is this an Rx interrupt (meaning that a packet has been received)? */ @@ -907,7 +907,7 @@ static int lm3s_interrupt(int irq, FAR void *context) /* Handle the incoming packet */ EMAC_STAT(priv, rx_int); - lm3s_receive(priv); + lm_receive(priv); } /* Is this an Tx interrupt (meaning that the Tx FIFO is empty)? */ @@ -917,7 +917,7 @@ static int lm3s_interrupt(int irq, FAR void *context) /* Handle the complete of the transmission */ EMAC_STAT(priv, tx_int); - lm3s_txdone(priv); + lm_txdone(priv); } /* Enable Ethernet interrupts (perhaps excluding the TX done interrupt if @@ -928,7 +928,7 @@ static int lm3s_interrupt(int irq, FAR void *context) } /**************************************************************************** - * Function: lm3s_txtimeout + * Function: lm_txtimeout * * Description: * Our TX watchdog timed out. Called from the timer interrupt handler. @@ -945,9 +945,9 @@ static int lm3s_interrupt(int irq, FAR void *context) * ****************************************************************************/ -static void lm3s_txtimeout(int argc, uint32_t arg, ...) +static void lm_txtimeout(int argc, uint32_t arg, ...) { - struct lm3s_driver_s *priv = (struct lm3s_driver_s *)arg; + struct lm_driver_s *priv = (struct lm_driver_s *)arg; /* Increment statistics */ @@ -957,16 +957,16 @@ static void lm3s_txtimeout(int argc, uint32_t arg, ...) /* Then reset the hardware */ DEBUGASSERT(priv->ld_bifup); - lm3s_ifdown(&priv->ld_dev); - lm3s_ifup(&priv->ld_dev); + lm_ifdown(&priv->ld_dev); + lm_ifup(&priv->ld_dev); /* Then poll uIP for new XMIT data */ - (void)uip_poll(&priv->ld_dev, lm3s_uiptxpoll); + (void)uip_poll(&priv->ld_dev, lm_uiptxpoll); } /**************************************************************************** - * Function: lm3s_polltimer + * Function: lm_polltimer * * Description: * Periodic timer handler. Called from the timer interrupt handler. @@ -982,9 +982,9 @@ static void lm3s_txtimeout(int argc, uint32_t arg, ...) * ****************************************************************************/ -static void lm3s_polltimer(int argc, uint32_t arg, ...) +static void lm_polltimer(int argc, uint32_t arg, ...) { - struct lm3s_driver_s *priv = (struct lm3s_driver_s *)arg; + struct lm_driver_s *priv = (struct lm_driver_s *)arg; /* Check if we can send another Tx packet now. The NEWTX bit initiates an * Ethernet transmission once the packet has been placed in the TX FIFO. @@ -994,20 +994,20 @@ static void lm3s_polltimer(int argc, uint32_t arg, ...) * inaccuracies. */ - if ((lm3s_ethin(priv, LM3S_MAC_TR_OFFSET) & MAC_TR_NEWTX) == 0) + if ((lm_ethin(priv, LM3S_MAC_TR_OFFSET) & MAC_TR_NEWTX) == 0) { /* If so, update TCP timing states and poll uIP for new XMIT data */ - (void)uip_timer(&priv->ld_dev, lm3s_uiptxpoll, LM3S_POLLHSEC); + (void)uip_timer(&priv->ld_dev, lm_uiptxpoll, LM3S_POLLHSEC); /* Setup the watchdog poll timer again */ - (void)wd_start(priv->ld_txpoll, LM3S_WDDELAY, lm3s_polltimer, 1, arg); + (void)wd_start(priv->ld_txpoll, LM3S_WDDELAY, lm_polltimer, 1, arg); } } /**************************************************************************** - * Function: lm3s_ifup + * Function: lm_ifup * * Description: * NuttX Callback: Bring up the Ethernet interface when an IP address is @@ -1023,9 +1023,9 @@ static void lm3s_polltimer(int argc, uint32_t arg, ...) * ****************************************************************************/ -static int lm3s_ifup(struct uip_driver_s *dev) +static int lm_ifup(struct uip_driver_s *dev) { - struct lm3s_driver_s *priv = (struct lm3s_driver_s *)dev->d_private; + struct lm_driver_s *priv = (struct lm_driver_s *)dev->d_private; irqstate_t flags; uint32_t regval; uint32_t div; @@ -1038,7 +1038,7 @@ static int lm3s_ifup(struct uip_driver_s *dev) /* Enable and reset the Ethernet controller */ flags = irqsave(); - lm3s_ethreset(priv); + lm_ethreset(priv); /* Set the management clock divider register for access to the PHY * register set. The MDC clock is divided down from the system clock per: @@ -1051,7 +1051,7 @@ static int lm3s_ifup(struct uip_driver_s *dev) */ div = SYSCLK_FREQUENCY / 2 / LM32S_MAX_MDCCLK; - lm3s_ethout(priv, LM3S_MAC_MDV_OFFSET, div); + lm_ethout(priv, LM3S_MAC_MDV_OFFSET, div); nllvdbg("MDV: %08x\n", div); /* Then configure the Ethernet Controller for normal operation @@ -1060,32 +1060,32 @@ static int lm3s_ifup(struct uip_driver_s *dev) * TX Padding Enabled). */ - regval = lm3s_ethin(priv, LM3S_MAC_TCTL_OFFSET); + regval = lm_ethin(priv, LM3S_MAC_TCTL_OFFSET); regval &= ~LM3S_TCTCL_CLRBITS; regval |= LM3S_TCTCL_SETBITS; - lm3s_ethout(priv, LM3S_MAC_TCTL_OFFSET, regval); + lm_ethout(priv, LM3S_MAC_TCTL_OFFSET, regval); nllvdbg("TCTL: %08x\n", regval); /* Setup the receive control register (Disable multicast frames, disable * promiscuous mode, disable bad CRC rejection). */ - regval = lm3s_ethin(priv, LM3S_MAC_RCTL_OFFSET); + regval = lm_ethin(priv, LM3S_MAC_RCTL_OFFSET); regval &= ~LM3S_RCTCL_CLRBITS; regval |= LM3S_RCTCL_SETBITS; - lm3s_ethout(priv, LM3S_MAC_RCTL_OFFSET, regval); + lm_ethout(priv, LM3S_MAC_RCTL_OFFSET, regval); nllvdbg("RCTL: %08x\n", regval); /* Setup the time stamp configuration register */ #ifdef LM3S_ETHTS - regval = lm3s_ethin(priv, LM3S_MAC_TS_OFFSET); -#ifdef CONFIG_LM3S_TIMESTAMP + regval = lm_ethin(priv, LM3S_MAC_TS_OFFSET); +#ifdef CONFIG_LM_TIMESTAMP regval |= MAC_TS_EN; #else regval &= ~(MAC_TS_EN); #endif - lm3s_ethout(priv, LM3S_MAC_TS_OFFSET, regval); + lm_ethout(priv, LM3S_MAC_TS_OFFSET, regval); nllvdbg("TS: %08x\n", regval); #endif @@ -1098,34 +1098,34 @@ static int lm3s_ifup(struct uip_driver_s *dev) nlldbg("Waiting for link\n"); do { - phyreg = lm3s_phyread(priv, MII_MSR); + phyreg = lm_phyread(priv, MII_MSR); } while ((phyreg & MII_MSR_LINKSTATUS) == 0); nlldbg("Link established\n"); /* Reset the receive FIFO */ - regval = lm3s_ethin(priv, LM3S_MAC_RCTL_OFFSET); + regval = lm_ethin(priv, LM3S_MAC_RCTL_OFFSET); regval |= MAC_RCTL_RSTFIFO; - lm3s_ethout(priv, LM3S_MAC_RCTL_OFFSET, regval); + lm_ethout(priv, LM3S_MAC_RCTL_OFFSET, regval); /* Enable the Ethernet receiver */ - regval = lm3s_ethin(priv, LM3S_MAC_RCTL_OFFSET); + regval = lm_ethin(priv, LM3S_MAC_RCTL_OFFSET); regval |= MAC_RCTL_RXEN; - lm3s_ethout(priv, LM3S_MAC_RCTL_OFFSET, regval); + lm_ethout(priv, LM3S_MAC_RCTL_OFFSET, regval); /* Enable the Ethernet transmitter */ - regval = lm3s_ethin(priv, LM3S_MAC_TCTL_OFFSET); + regval = lm_ethin(priv, LM3S_MAC_TCTL_OFFSET); regval |= MAC_TCTL_TXEN; - lm3s_ethout(priv, LM3S_MAC_TCTL_OFFSET, regval); + lm_ethout(priv, LM3S_MAC_TCTL_OFFSET, regval); /* Reset the receive FIFO (again) */ - regval = lm3s_ethin(priv, LM3S_MAC_RCTL_OFFSET); + regval = lm_ethin(priv, LM3S_MAC_RCTL_OFFSET); regval |= MAC_RCTL_RSTFIFO; - lm3s_ethout(priv, LM3S_MAC_RCTL_OFFSET, regval); + lm_ethout(priv, LM3S_MAC_RCTL_OFFSET, regval); /* Enable the Ethernet interrupt */ @@ -1137,9 +1137,9 @@ static int lm3s_ifup(struct uip_driver_s *dev) /* Enable the Ethernet RX packet receipt interrupt */ - regval = lm3s_ethin(priv, LM3S_MAC_IM_OFFSET); + regval = lm_ethin(priv, LM3S_MAC_IM_OFFSET); regval |= MAC_IM_RXINTM; - lm3s_ethout(priv, LM3S_MAC_IM_OFFSET, regval); + lm_ethout(priv, LM3S_MAC_IM_OFFSET, regval); /* Program the hardware with it's MAC address (for filtering) */ @@ -1147,15 +1147,15 @@ static int lm3s_ifup(struct uip_driver_s *dev) (uint32_t)priv->ld_dev.d_mac.ether_addr_octet[2] << 16 | (uint32_t)priv->ld_dev.d_mac.ether_addr_octet[1] << 8 | (uint32_t)priv->ld_dev.d_mac.ether_addr_octet[0]; - lm3s_ethout(priv, LM3S_MAC_IA0_OFFSET, regval); + lm_ethout(priv, LM3S_MAC_IA0_OFFSET, regval); regval = (uint32_t)priv->ld_dev.d_mac.ether_addr_octet[5] << 8 | (uint32_t)priv->ld_dev.d_mac.ether_addr_octet[4]; - lm3s_ethout(priv, LM3S_MAC_IA1_OFFSET, regval); + lm_ethout(priv, LM3S_MAC_IA1_OFFSET, regval); /* Set and activate a timer process */ - (void)wd_start(priv->ld_txpoll, LM3S_WDDELAY, lm3s_polltimer, 1, (uint32_t)priv); + (void)wd_start(priv->ld_txpoll, LM3S_WDDELAY, lm_polltimer, 1, (uint32_t)priv); priv->ld_bifup = true; irqrestore(flags); @@ -1163,11 +1163,11 @@ static int lm3s_ifup(struct uip_driver_s *dev) } /**************************************************************************** - * Function: lm3s_ifdown + * Function: lm_ifdown * * Description: * NuttX Callback: Stop the interface. The only way to restore normal - * behavior is to call lm3s_ifup(). + * behavior is to call lm_ifup(). * * Parameters: * dev - Reference to the NuttX driver state structure @@ -1179,9 +1179,9 @@ static int lm3s_ifup(struct uip_driver_s *dev) * ****************************************************************************/ -static int lm3s_ifdown(struct uip_driver_s *dev) +static int lm_ifdown(struct uip_driver_s *dev) { - struct lm3s_driver_s *priv = (struct lm3s_driver_s *)dev->d_private; + struct lm_driver_s *priv = (struct lm_driver_s *)dev->d_private; irqstate_t flags; uint32_t regval; @@ -1205,38 +1205,38 @@ static int lm3s_ifdown(struct uip_driver_s *dev) /* Disable all Ethernet controller interrupt sources */ - regval = lm3s_ethin(priv, LM3S_MAC_IM_OFFSET); + regval = lm_ethin(priv, LM3S_MAC_IM_OFFSET); regval &= ~MAC_IM_ALLINTS; - lm3s_ethout(priv, LM3S_MAC_IM_OFFSET, regval); + lm_ethout(priv, LM3S_MAC_IM_OFFSET, regval); /* Reset the receive FIFO */ - regval = lm3s_ethin(priv, LM3S_MAC_RCTL_OFFSET); + regval = lm_ethin(priv, LM3S_MAC_RCTL_OFFSET); regval |= MAC_RCTL_RSTFIFO; - lm3s_ethout(priv, LM3S_MAC_RCTL_OFFSET, regval); + lm_ethout(priv, LM3S_MAC_RCTL_OFFSET, regval); /* Disable the Ethernet receiver */ - regval = lm3s_ethin(priv, LM3S_MAC_RCTL_OFFSET); + regval = lm_ethin(priv, LM3S_MAC_RCTL_OFFSET); regval &= ~MAC_RCTL_RXEN; - lm3s_ethout(priv, LM3S_MAC_RCTL_OFFSET, regval); + lm_ethout(priv, LM3S_MAC_RCTL_OFFSET, regval); /* Disable the Ethernet transmitter */ - regval = lm3s_ethin(priv, LM3S_MAC_RCTL_OFFSET); + regval = lm_ethin(priv, LM3S_MAC_RCTL_OFFSET); regval &= ~MAC_TCTL_TXEN; - lm3s_ethout(priv, LM3S_MAC_TCTL_OFFSET, regval); + lm_ethout(priv, LM3S_MAC_TCTL_OFFSET, regval); /* Reset the receive FIFO (again) */ - regval = lm3s_ethin(priv, LM3S_MAC_RCTL_OFFSET); + regval = lm_ethin(priv, LM3S_MAC_RCTL_OFFSET); regval |= MAC_RCTL_RSTFIFO; - lm3s_ethout(priv, LM3S_MAC_RCTL_OFFSET, regval); + lm_ethout(priv, LM3S_MAC_RCTL_OFFSET, regval); /* Clear any pending interrupts */ - regval = lm3s_ethin(priv, LM3S_MAC_RIS_OFFSET); - lm3s_ethout(priv, LM3S_MAC_IACK_OFFSET, regval); + regval = lm_ethin(priv, LM3S_MAC_RIS_OFFSET); + lm_ethout(priv, LM3S_MAC_IACK_OFFSET, regval); /* The interface is now DOWN */ @@ -1246,7 +1246,7 @@ static int lm3s_ifdown(struct uip_driver_s *dev) } /**************************************************************************** - * Function: lm3s_txavail + * Function: lm_txavail * * Description: * Driver callback invoked when new TX data is available. This is a @@ -1264,27 +1264,27 @@ static int lm3s_ifdown(struct uip_driver_s *dev) * ****************************************************************************/ -static int lm3s_txavail(struct uip_driver_s *dev) +static int lm_txavail(struct uip_driver_s *dev) { - struct lm3s_driver_s *priv = (struct lm3s_driver_s *)dev->d_private; + struct lm_driver_s *priv = (struct lm_driver_s *)dev->d_private; irqstate_t flags; /* Ignore the notification if the interface is not yet up or if the Tx FIFO * hardware is not available at this time. The NEWTX bit initiates an * Ethernet transmission once the packet has been placed in the TX FIFO. * This bit is cleared once the transmission has been completed. When the - * transmission completes, lm3s_txdone() will be called and the Tx polling + * transmission completes, lm_txdone() will be called and the Tx polling * will occur at that time. */ flags = irqsave(); - if (priv->ld_bifup && (lm3s_ethin(priv, LM3S_MAC_TR_OFFSET) & MAC_TR_NEWTX) == 0) + if (priv->ld_bifup && (lm_ethin(priv, LM3S_MAC_TR_OFFSET) & MAC_TR_NEWTX) == 0) { /* If the interface is up and we can use the Tx FIFO, then poll uIP * for new Tx data */ - (void)uip_poll(&priv->ld_dev, lm3s_uiptxpoll); + (void)uip_poll(&priv->ld_dev, lm_uiptxpoll); } irqrestore(flags); @@ -1292,7 +1292,7 @@ static int lm3s_txavail(struct uip_driver_s *dev) } /**************************************************************************** - * Function: lm3s_addmac + * Function: lm_addmac * * Description: * NuttX Callback: Add the specified MAC address to the hardware multicast @@ -1310,9 +1310,9 @@ static int lm3s_txavail(struct uip_driver_s *dev) ****************************************************************************/ #ifdef CONFIG_NET_IGMP -static int lm3s_addmac(struct uip_driver_s *dev, FAR const uint8_t *mac) +static int lm_addmac(struct uip_driver_s *dev, FAR const uint8_t *mac) { - FAR struct lm3s_driver_s *priv = (FAR struct lm3s_driver_s *)dev->d_private; + FAR struct lm_driver_s *priv = (FAR struct lm_driver_s *)dev->d_private; /* Add the MAC address to the hardware multicast routing table */ @@ -1322,7 +1322,7 @@ static int lm3s_addmac(struct uip_driver_s *dev, FAR const uint8_t *mac) #endif /**************************************************************************** - * Function: lm3s_rmmac + * Function: lm_rmmac * * Description: * NuttX Callback: Remove the specified MAC address from the hardware multicast @@ -1340,9 +1340,9 @@ static int lm3s_addmac(struct uip_driver_s *dev, FAR const uint8_t *mac) ****************************************************************************/ #ifdef CONFIG_NET_IGMP -static int lm3s_rmmac(struct uip_driver_s *dev, FAR const uint8_t *mac) +static int lm_rmmac(struct uip_driver_s *dev, FAR const uint8_t *mac) { - FAR struct lm3s_driver_s *priv = (FAR struct lm3s_driver_s *)dev->d_private; + FAR struct lm_driver_s *priv = (FAR struct lm_driver_s *)dev->d_private; /* Add the MAC address to the hardware multicast routing table */ @@ -1356,7 +1356,7 @@ static int lm3s_rmmac(struct uip_driver_s *dev, FAR const uint8_t *mac) ****************************************************************************/ /**************************************************************************** - * Function: lm3s_ethinitialize + * Function: lm_ethinitialize * * Description: * Initialize the Ethernet driver for one interface @@ -1372,12 +1372,12 @@ static int lm3s_rmmac(struct uip_driver_s *dev, FAR const uint8_t *mac) ****************************************************************************/ #if LM3S_NETHCONTROLLERS > 1 -int lm3s_ethinitialize(int intf) +int lm_ethinitialize(int intf) #else -static inline int lm3s_ethinitialize(int intf) +static inline int lm_ethinitialize(int intf) #endif { - struct lm3s_driver_s *priv = &g_lm3sdev[intf]; + struct lm_driver_s *priv = &g_lm3sdev[intf]; int ret; /* Check if the Ethernet module is present */ @@ -1393,49 +1393,49 @@ static inline int lm3s_ethinitialize(int intf) /* Initialize the driver structure */ - memset(priv, 0, sizeof(struct lm3s_driver_s)); - priv->ld_dev.d_ifup = lm3s_ifup; /* I/F down callback */ - priv->ld_dev.d_ifdown = lm3s_ifdown; /* I/F up (new IP address) callback */ - priv->ld_dev.d_txavail = lm3s_txavail; /* New TX data callback */ + memset(priv, 0, sizeof(struct lm_driver_s)); + priv->ld_dev.d_ifup = lm_ifup; /* I/F down callback */ + priv->ld_dev.d_ifdown = lm_ifdown; /* I/F up (new IP address) callback */ + priv->ld_dev.d_txavail = lm_txavail; /* New TX data callback */ #ifdef CONFIG_NET_IGMP - priv->ld_dev.d_addmac = lm3s_addmac; /* Add multicast MAC address */ - priv->ld_dev.d_rmmac = lm3s_rmmac; /* Remove multicast MAC address */ + priv->ld_dev.d_addmac = lm_addmac; /* Add multicast MAC address */ + priv->ld_dev.d_rmmac = lm_rmmac; /* Remove multicast MAC address */ #endif - priv->ld_dev.d_private = (void*)priv; /* Used to recover private state from dev */ + priv->ld_dev.d_private = (void*)priv; /* Used to recover private state from dev */ /* Create a watchdog for timing polling for and timing of transmisstions */ #if LM3S_NETHCONTROLLERS > 1 # error "A mechanism to associate base address an IRQ with an interface is needed" - priv->ld_base = ??; /* Ethernet controller base address */ - priv->ld_irq = ??; /* Ethernet controller IRQ number */ + priv->ld_base = ??; /* Ethernet controller base address */ + priv->ld_irq = ??; /* Ethernet controller IRQ number */ #endif - priv->ld_txpoll = wd_create(); /* Create periodic poll timer */ - priv->ld_txtimeout = wd_create(); /* Create TX timeout timer */ + priv->ld_txpoll = wd_create(); /* Create periodic poll timer */ + priv->ld_txtimeout = wd_create(); /* Create TX timeout timer */ /* If the board can provide us with a MAC address, get the address - * from the board now. The MAC will not be applied until lm3s_ifup() + * from the board now. The MAC will not be applied until lm_ifup() * is caleld (and the MAC can be overwritten with a netdev ioctl call). */ -#ifdef CONFIG_LM3S_BOARDMAC - lm3s_ethernetmac(&priv->ld_dev.d_mac); +#ifdef CONFIG_LM_BOARDMAC + lm_ethernetmac(&priv->ld_dev.d_mac); #endif /* Perform minimal, one-time initialization -- just reset the controller and * leave it disabled. The Ethernet controller will be reset and properly - * re-initialized each time lm3s_ifup() is called. + * re-initialized each time lm_ifup() is called. */ - lm3s_ethreset(priv); - lm3s_ifdown(&priv->ld_dev); + lm_ethreset(priv); + lm_ifdown(&priv->ld_dev); /* Attach the IRQ to the driver */ #if LM3S_NETHCONTROLLERS > 1 - ret = irq_attach(priv->irq, lm3s_interrupt); + ret = irq_attach(priv->irq, lm_interrupt); #else - ret = irq_attach(LM3S_IRQ_ETHCON, lm3s_interrupt); + ret = irq_attach(LM3S_IRQ_ETHCON, lm_interrupt); #endif if (ret != 0) { @@ -1464,9 +1464,9 @@ static inline int lm3s_ethinitialize(int intf) #if LM3S_NETHCONTROLLERS == 1 void up_netinitialize(void) { - (void)lm3s_ethinitialize(0); + (void)lm_ethinitialize(0); } #endif -#endif /* CONFIG_NET && CONFIG_LM3S_ETHERNET */ +#endif /* CONFIG_NET && CONFIG_LM_ETHERNET */ diff --git a/nuttx/arch/arm/src/lm/lm_ethernet.h b/nuttx/arch/arm/src/lm/lm_ethernet.h index 29fe4fd17b..e71e9d0777 100644 --- a/nuttx/arch/arm/src/lm/lm_ethernet.h +++ b/nuttx/arch/arm/src/lm/lm_ethernet.h @@ -74,7 +74,7 @@ extern "C" ****************************************************************************/ /**************************************************************************** - * Function: lm3s_ethinitialize + * Function: lm_ethinitialize * * Description: * Initialize the Ethernet driver for one interface. If the LM3S chip @@ -92,7 +92,7 @@ extern "C" * ****************************************************************************/ -int lm3s_ethinitialize(int intf); +int lm_ethinitialize(int intf); #if defined(__cplusplus) } diff --git a/nuttx/arch/arm/src/lm/lm3s_gpio.c b/nuttx/arch/arm/src/lm/lm_gpio.c similarity index 93% rename from nuttx/arch/arm/src/lm/lm3s_gpio.c rename to nuttx/arch/arm/src/lm/lm_gpio.c index 48cbefabf7..499bf07a2e 100644 --- a/nuttx/arch/arm/src/lm/lm3s_gpio.c +++ b/nuttx/arch/arm/src/lm/lm_gpio.c @@ -1,6 +1,6 @@ /**************************************************************************** - * arch/arm/src/lm/lm3s_gpio.c - * arch/arm/src/chip/lm3s_gpio.c + * arch/arm/src/lm/lm_gpio.c + * arch/arm/src/chip/lm_gpio.c * * Copyright (C) 2009-2010 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -169,7 +169,7 @@ static const uint32_t g_gpiobase[LM3S_NPORTS] = ****************************************************************************/ /**************************************************************************** - * Name: lm3s_gpiobaseaddress + * Name: lm_gpiobaseaddress * * Description: * Given a GPIO enumeration value, return the base address of the @@ -177,7 +177,7 @@ static const uint32_t g_gpiobase[LM3S_NPORTS] = * ****************************************************************************/ -static uint32_t lm3s_gpiobaseaddress(unsigned int port) +static uint32_t lm_gpiobaseaddress(unsigned int port) { uint32_t gpiobase = 0; if (port < LM3S_NPORTS) @@ -188,14 +188,14 @@ static uint32_t lm3s_gpiobaseaddress(unsigned int port) } /**************************************************************************** - * Name: lm3s_gpiofunc + * Name: lm_gpiofunc * * Description: * Configure GPIO registers for a specific function * ****************************************************************************/ -static void lm3s_gpiofunc(uint32_t base, uint32_t pinno, const struct gpio_func_s *func) +static void lm_gpiofunc(uint32_t base, uint32_t pinno, const struct gpio_func_s *func) { uint32_t setbit; uint32_t clrbit; @@ -305,14 +305,14 @@ static void lm3s_gpiofunc(uint32_t base, uint32_t pinno, const struct gpio_func_ } /**************************************************************************** - * Name: lm3s_gpiopadstrength + * Name: lm_gpiopadstrength * * Description: * Set up pad strength and pull-ups * ****************************************************************************/ -static inline void lm3s_gpiopadstrength(uint32_t base, uint32_t pin, uint32_t cfgset) +static inline void lm_gpiopadstrength(uint32_t base, uint32_t pin, uint32_t cfgset) { int strength = (cfgset & GPIO_STRENGTH_MASK) >> GPIO_STRENGTH_SHIFT; uint32_t regoffset; @@ -392,19 +392,19 @@ static inline void lm3s_gpiopadstrength(uint32_t base, uint32_t pin, uint32_t cf } /**************************************************************************** - * Name: lm3s_gpiopadtype + * Name: lm_gpiopadtype * * Description: * Set up pad strength and pull-ups. Some of these values may be over- - * written by lm3s_gpiofunc, depending on the function selection. Others + * written by lm_gpiofunc, depending on the function selection. Others * are optional for different function selections. * ****************************************************************************/ -static inline void lm3s_gpiopadtype(uint32_t base, uint32_t pin, uint32_t cfgset) +static inline void lm_gpiopadtype(uint32_t base, uint32_t pin, uint32_t cfgset) { int padtype = (cfgset & GPIO_PADTYPE_MASK) >> GPIO_PADTYPE_SHIFT; -#if 0 /* always overwritten by lm3s_gpiofunc */ +#if 0 /* always overwritten by lm_gpiofunc */ uint32_t odrset; uint32_t odrclr; #endif @@ -412,7 +412,7 @@ static inline void lm3s_gpiopadtype(uint32_t base, uint32_t pin, uint32_t cfgset uint32_t purclr; uint32_t pdrset; uint32_t pdrclr; -#if 0 /* always overwritten by lm3s_gpiofunc */ +#if 0 /* always overwritten by lm_gpiofunc */ uint32_t denset; uint32_t denclr; #endif @@ -420,7 +420,7 @@ static inline void lm3s_gpiopadtype(uint32_t base, uint32_t pin, uint32_t cfgset /* Assume digital GPIO function, push-pull with no pull-up or pull-down */ -#if 0 /* always overwritten by lm3s_gpiofunc */ +#if 0 /* always overwritten by lm_gpiofunc */ odrset = 0; odrclr = pin; #endif @@ -428,7 +428,7 @@ static inline void lm3s_gpiopadtype(uint32_t base, uint32_t pin, uint32_t cfgset purclr = pin; pdrset = 0; pdrclr = pin; -#if 0 /* always overwritten by lm3s_gpiofunc */ +#if 0 /* always overwritten by lm_gpiofunc */ denset = pin; denclr = 0; #endif @@ -455,7 +455,7 @@ static inline void lm3s_gpiopadtype(uint32_t base, uint32_t pin, uint32_t cfgset break; case 3: /* Open-drain */ { -#if 0 /* always overwritten by lm3s_gpiofunc */ +#if 0 /* always overwritten by lm_gpiofunc */ odrset = pin; odrclr = 0; #endif @@ -463,7 +463,7 @@ static inline void lm3s_gpiopadtype(uint32_t base, uint32_t pin, uint32_t cfgset break; case 4: /* Open-drain with weak pull-up */ { -#if 0 /* always overwritten by lm3s_gpiofunc */ +#if 0 /* always overwritten by lm_gpiofunc */ odrset = pin; odrclr = 0; #endif @@ -473,7 +473,7 @@ static inline void lm3s_gpiopadtype(uint32_t base, uint32_t pin, uint32_t cfgset break; case 5: /* Open-drain with weak pull-down */ { -#if 0 /* always overwritten by lm3s_gpiofunc */ +#if 0 /* always overwritten by lm_gpiofunc */ odrset = pin; odrclr = 0; #endif @@ -483,7 +483,7 @@ static inline void lm3s_gpiopadtype(uint32_t base, uint32_t pin, uint32_t cfgset break; case 6: /* Analog comparator */ { -#if 0 /* always overwritten by lm3s_gpiofunc */ +#if 0 /* always overwritten by lm_gpiofunc */ denset = 0; denclr = pin; #endif @@ -502,7 +502,7 @@ static inline void lm3s_gpiopadtype(uint32_t base, uint32_t pin, uint32_t cfgset * drain output when set to 1." */ -#if 0 /* always overwritten by lm3s_gpiofunc */ +#if 0 /* always overwritten by lm_gpiofunc */ regval = getreg32(base + LM3S_GPIO_ODR_OFFSET); regval &= ~odrclr; regval |= odrset; @@ -540,7 +540,7 @@ static inline void lm3s_gpiopadtype(uint32_t base, uint32_t pin, uint32_t cfgset * corresponding GPIODEN bit must be set." */ -#if 0 /* always overwritten by lm3s_gpiofunc */ +#if 0 /* always overwritten by lm_gpiofunc */ regval = getreg32(base + LM3S_GPIO_DEN_OFFSET); regval &= ~denclr; regval |= denset; @@ -549,28 +549,28 @@ static inline void lm3s_gpiopadtype(uint32_t base, uint32_t pin, uint32_t cfgset } /**************************************************************************** - * Name: lm3s_initoutput + * Name: lm_initoutput * * Description: * Set the GPIO output value * ****************************************************************************/ -static inline void lm3s_initoutput(uint32_t cfgset) +static inline void lm_initoutput(uint32_t cfgset) { bool value = ((cfgset & GPIO_VALUE_MASK) != GPIO_VALUE_ZERO); - lm3s_gpiowrite(cfgset, value); + lm_gpiowrite(cfgset, value); } /**************************************************************************** - * Name: lm3s_interrupt + * Name: lm_interrupt * * Description: * Configure the interrupt pin. * ****************************************************************************/ -static inline void lm3s_interrupt(uint32_t base, uint32_t pin, uint32_t cfgset) +static inline void lm_interrupt(uint32_t base, uint32_t pin, uint32_t cfgset) { int inttype = (cfgset & GPIO_INT_MASK) >> GPIO_INT_SHIFT; uint32_t regval; @@ -694,14 +694,14 @@ static inline void lm3s_interrupt(uint32_t base, uint32_t pin, uint32_t cfgset) ****************************************************************************/ /**************************************************************************** - * Name: lm3s_configgpio + * Name: lm_configgpio * * Description: * Configure a GPIO pin based on bit-encoded description of the pin. * ****************************************************************************/ -int lm3s_configgpio(uint32_t cfgset) +int lm_configgpio(uint32_t cfgset) { irqstate_t flags; unsigned int func; @@ -722,7 +722,7 @@ int lm3s_configgpio(uint32_t cfgset) /* Get the base address associated with the GPIO port */ - base = lm3s_gpiobaseaddress(port); + base = lm_gpiobaseaddress(port); DEBUGASSERT(base != 0); /* The following requires exclusive access to the GPIO registers */ @@ -742,25 +742,25 @@ int lm3s_configgpio(uint32_t cfgset) * to perform reconfiguration. */ - lm3s_gpiofunc(base, pinno, &g_funcbits[0]); + lm_gpiofunc(base, pinno, &g_funcbits[0]); /* Then set up pad strengths and pull-ups. These setups should be done before * setting up the function because some function settings will over-ride these * user options. */ - lm3s_gpiopadstrength(base, pin, cfgset); - lm3s_gpiopadtype(base, pin, cfgset); + lm_gpiopadstrength(base, pin, cfgset); + lm_gpiopadtype(base, pin, cfgset); /* Then set up the real pin function */ - lm3s_gpiofunc(base, pinno, &g_funcbits[func]); + lm_gpiofunc(base, pinno, &g_funcbits[func]); /* Special GPIO digital output pins */ if (func == 1 || func == 3) { - lm3s_initoutput(cfgset); + lm_initoutput(cfgset); } @@ -768,7 +768,7 @@ int lm3s_configgpio(uint32_t cfgset) else if (func == 7) { - lm3s_interrupt(base, pin, cfgset); + lm_interrupt(base, pin, cfgset); } irqrestore(flags); @@ -776,14 +776,14 @@ int lm3s_configgpio(uint32_t cfgset) } /**************************************************************************** - * Name: lm3s_gpiowrite + * Name: lm_gpiowrite * * Description: * Write one or zero to the selected GPIO pin * ****************************************************************************/ -void lm3s_gpiowrite(uint32_t pinset, bool value) +void lm_gpiowrite(uint32_t pinset, bool value) { unsigned int port; unsigned int pinno; @@ -796,7 +796,7 @@ void lm3s_gpiowrite(uint32_t pinset, bool value) /* Get the base address associated with the GPIO port */ - base = lm3s_gpiobaseaddress(port); + base = lm_gpiobaseaddress(port); /* "The GPIO DATA register is the data register. In software control mode, * values written in the GPIO DATA register are transferred onto the GPIO @@ -814,14 +814,14 @@ void lm3s_gpiowrite(uint32_t pinset, bool value) } /**************************************************************************** - * Name: lm3s_gpioread + * Name: lm_gpioread * * Description: * Read one or zero from the selected GPIO pin * ****************************************************************************/ -bool lm3s_gpioread(uint32_t pinset, bool value) +bool lm_gpioread(uint32_t pinset, bool value) { unsigned int port; unsigned int pinno; @@ -834,7 +834,7 @@ bool lm3s_gpioread(uint32_t pinset, bool value) /* Get the base address associated with the GPIO port */ - base = lm3s_gpiobaseaddress(port); + base = lm_gpiobaseaddress(port); /* "... the values read from this register are determined for each bit * by the mask bit derived from the address used to access the data register, diff --git a/nuttx/arch/arm/src/lm/lm_gpio.h b/nuttx/arch/arm/src/lm/lm_gpio.h index 9577fd9261..1447eb0654 100644 --- a/nuttx/arch/arm/src/lm/lm_gpio.h +++ b/nuttx/arch/arm/src/lm/lm_gpio.h @@ -53,7 +53,7 @@ * Pre-processor Definitions ************************************************************************************/ -/* Bit-encoded input to lm3s_configgpio() *******************************************/ +/* Bit-encoded input to lm_configgpio() *********************************************/ /* Encoding: * FFFS SPPP IIIn nnnn nnnn nnnn VPPP PBBB @@ -161,57 +161,57 @@ extern "C" { #endif -/**************************************************************************** +/************************************************************************************ * Public Function Prototypes - ****************************************************************************/ + ************************************************************************************/ -/**************************************************************************** - * Name: lm3s_configgpio +/************************************************************************************ + * Name: lm_configgpio * * Description: * Configure a GPIO pin based on bit-encoded description of the pin. * - ****************************************************************************/ + ************************************************************************************/ -int lm3s_configgpio(uint32_t cfgset); +int lm_configgpio(uint32_t cfgset); -/**************************************************************************** - * Name: lm3s_gpiowrite +/************************************************************************************ + * Name: lm_gpiowrite * * Description: * Write one or zero to the selected GPIO pin * - ****************************************************************************/ + ************************************************************************************/ -void lm3s_gpiowrite(uint32_t pinset, bool value); +void lm_gpiowrite(uint32_t pinset, bool value); -/**************************************************************************** - * Name: lm3s_gpioread +/************************************************************************************ + * Name: lm_gpioread * * Description: * Read one or zero from the selected GPIO pin * - ****************************************************************************/ + ************************************************************************************/ -bool lm3s_gpioread(uint32_t pinset, bool value); +bool lm_gpioread(uint32_t pinset, bool value); -/**************************************************************************** - * Function: lm3s_dumpgpio +/************************************************************************************ + * Function: lm_dumpgpio * * Description: * Dump all GPIO registers associated with the provided base address * - ****************************************************************************/ + ************************************************************************************/ -int lm3s_dumpgpio(uint32_t pinset, const char *msg); +int lm_dumpgpio(uint32_t pinset, const char *msg); -/**************************************************************************** +/************************************************************************************ * Name: gpio_irqinitialize * * Description: * Initialize all vectors to the unexpected interrupt handler * - ****************************************************************************/ + ************************************************************************************/ int weak_function gpio_irqinitialize(void); diff --git a/nuttx/arch/arm/src/lm/lm3s_gpioirq.c b/nuttx/arch/arm/src/lm/lm_gpioirq.c similarity index 77% rename from nuttx/arch/arm/src/lm/lm3s_gpioirq.c rename to nuttx/arch/arm/src/lm/lm_gpioirq.c index a54bfe335e..f77f878dea 100644 --- a/nuttx/arch/arm/src/lm/lm3s_gpioirq.c +++ b/nuttx/arch/arm/src/lm/lm_gpioirq.c @@ -1,6 +1,6 @@ /**************************************************************************** - * arch/arm/src/lm/lm3s_gpioirq.c - * arch/arm/src/chip/lm3s_gpioirq.c + * arch/arm/src/lm/lm_gpioirq.c + * arch/arm/src/chip/lm_gpioirq.c * * Copyright (C) 2009-2010, 2012 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -72,25 +72,25 @@ static FAR xcpt_t g_gpioirqvector[NR_GPIO_IRQS]; static const uint32_t g_gpiobase[] = { -#ifndef CONFIG_LM3S_DISABLE_GPIOA_IRQS +#ifndef CONFIG_LM_DISABLE_GPIOA_IRQS LM3S_GPIOA_BASE, #endif -#ifndef CONFIG_LM3S_DISABLE_GPIOB_IRQS +#ifndef CONFIG_LM_DISABLE_GPIOB_IRQS LM3S_GPIOB_BASE, #endif -#ifndef CONFIG_LM3S_DISABLE_GPIOC_IRQS +#ifndef CONFIG_LM_DISABLE_GPIOC_IRQS LM3S_GPIOC_BASE, #endif -#ifndef CONFIG_LM3S_DISABLE_GPIOD_IRQS +#ifndef CONFIG_LM_DISABLE_GPIOD_IRQS LM3S_GPIOD_BASE, #endif -#ifndef CONFIG_LM3S_DISABLE_GPIOE_IRQS +#ifndef CONFIG_LM_DISABLE_GPIOE_IRQS LM3S_GPIOE_BASE, #endif -#ifndef CONFIG_LM3S_DISABLE_GPIOF_IRQS +#ifndef CONFIG_LM_DISABLE_GPIOF_IRQS LM3S_GPIOF_BASE, #endif -#ifndef CONFIG_LM3S_DISABLE_GPIOG_IRQS +#ifndef CONFIG_LM_DISABLE_GPIOG_IRQS LM3S_GPIOG_BASE, #endif @@ -100,10 +100,10 @@ static const uint32_t g_gpiobase[] = * errors! */ -#ifndef CONFIG_LM3S_DISABLE_GPIOH_IRQS +#ifndef CONFIG_LM_DISABLE_GPIOH_IRQS LM3S_GPIOH_BASE, #endif -#ifndef CONFIG_LM3S_DISABLE_GPIOJ_IRQS +#ifndef CONFIG_LM_DISABLE_GPIOJ_IRQS LM3S_GPIOJ_BASE, #endif }; @@ -119,7 +119,7 @@ static const uint32_t g_gpiobase[] = ****************************************************************************/ /**************************************************************************** - * Name: lm3s_gpiobaseaddress + * Name: lm_gpiobaseaddress * * Input: * gpioirq - A pin number in the range of 0 to NR_GPIO_IRQS. @@ -131,7 +131,7 @@ static const uint32_t g_gpiobase[] = * ****************************************************************************/ -static uint32_t lm3s_gpiobaseaddress(unsigned int gpioirq) +static uint32_t lm_gpiobaseaddress(unsigned int gpioirq) { unsigned int ndx = gpioirq >> 3; if (ndx < GPIO_NADDRS) @@ -142,14 +142,14 @@ static uint32_t lm3s_gpiobaseaddress(unsigned int gpioirq) } /**************************************************************************** - * Name: lm3s_gpio*handler + * Name: lm_gpio*handler * * Description: * Handle interrupts on each enabled GPIO port * ****************************************************************************/ -static int lm3s_gpiohandler(uint32_t regbase, int irqbase, void *context) +static int lm_gpiohandler(uint32_t regbase, int irqbase, void *context) { uint32_t mis; int irq; @@ -184,66 +184,66 @@ static int lm3s_gpiohandler(uint32_t regbase, int irqbase, void *context) return OK; } -#ifndef CONFIG_LM3S_DISABLE_GPIOA_IRQS -static int lm3s_gpioahandler(int irq, FAR void *context) +#ifndef CONFIG_LM_DISABLE_GPIOA_IRQS +static int lm_gpioahandler(int irq, FAR void *context) { - return lm3s_gpiohandler(LM3S_GPIOA_BASE, LM3S_IRQ_GPIOA_0, context); + return lm_gpiohandler(LM3S_GPIOA_BASE, LM3S_IRQ_GPIOA_0, context); } #endif -#ifndef CONFIG_LM3S_DISABLE_GPIOB_IRQS -static int lm3s_gpiobhandler(int irq, FAR void *context) +#ifndef CONFIG_LM_DISABLE_GPIOB_IRQS +static int lm_gpiobhandler(int irq, FAR void *context) { - return lm3s_gpiohandler(LM3S_GPIOB_BASE, LM3S_IRQ_GPIOB_0, context); + return lm_gpiohandler(LM3S_GPIOB_BASE, LM3S_IRQ_GPIOB_0, context); } #endif -#ifndef CONFIG_LM3S_DISABLE_GPIOC_IRQS -static int lm3s_gpiochandler(int irq, FAR void *context) +#ifndef CONFIG_LM_DISABLE_GPIOC_IRQS +static int lm_gpiochandler(int irq, FAR void *context) { - return lm3s_gpiohandler(LM3S_GPIOC_BASE, LM3S_IRQ_GPIOC_0, context); + return lm_gpiohandler(LM3S_GPIOC_BASE, LM3S_IRQ_GPIOC_0, context); } #endif -#ifndef CONFIG_LM3S_DISABLE_GPIOD_IRQS -static int lm3s_gpiodhandler(int irq, FAR void *context) +#ifndef CONFIG_LM_DISABLE_GPIOD_IRQS +static int lm_gpiodhandler(int irq, FAR void *context) { - return lm3s_gpiohandler(LM3S_GPIOD_BASE, LM3S_IRQ_GPIOD_0, context); + return lm_gpiohandler(LM3S_GPIOD_BASE, LM3S_IRQ_GPIOD_0, context); } #endif -#ifndef CONFIG_LM3S_DISABLE_GPIOE_IRQS -static int lm3s_gpioehandler(int irq, FAR void *context) +#ifndef CONFIG_LM_DISABLE_GPIOE_IRQS +static int lm_gpioehandler(int irq, FAR void *context) { - return lm3s_gpiohandler(LM3S_GPIOE_BASE, LM3S_IRQ_GPIOE_0, context); + return lm_gpiohandler(LM3S_GPIOE_BASE, LM3S_IRQ_GPIOE_0, context); } #endif -#ifndef CONFIG_LM3S_DISABLE_GPIOF_IRQS -static int lm3s_gpiofhandler(int irq, FAR void *context) +#ifndef CONFIG_LM_DISABLE_GPIOF_IRQS +static int lm_gpiofhandler(int irq, FAR void *context) { - return lm3s_gpiohandler(LM3S_GPIOF_BASE, LM3S_IRQ_GPIOF_0, context); + return lm_gpiohandler(LM3S_GPIOF_BASE, LM3S_IRQ_GPIOF_0, context); } #endif -#ifndef CONFIG_LM3S_DISABLE_GPIOG_IRQS -static int lm3s_gpioghandler(int irq, FAR void *context) +#ifndef CONFIG_LM_DISABLE_GPIOG_IRQS +static int lm_gpioghandler(int irq, FAR void *context) { - return lm3s_gpiohandler(LM3S_GPIOG_BASE, LM3S_IRQ_GPIOG_0, context); + return lm_gpiohandler(LM3S_GPIOG_BASE, LM3S_IRQ_GPIOG_0, context); } #endif -#ifndef CONFIG_LM3S_DISABLE_GPIOH_IRQS -static int lm3s_gpiohhandler(int irq, FAR void *context) +#ifndef CONFIG_LM_DISABLE_GPIOH_IRQS +static int lm_gpiohhandler(int irq, FAR void *context) { - return lm3s_gpiohandler(LM3S_GPIOH_BASE, LM3S_IRQ_GPIOH_0, context); + return lm_gpiohandler(LM3S_GPIOH_BASE, LM3S_IRQ_GPIOH_0, context); } #endif -#ifndef CONFIG_LM3S_DISABLE_GPIOJ_IRQS -static int lm3s_gpiojhandler(int irq, FAR void *context) +#ifndef CONFIG_LM_DISABLE_GPIOJ_IRQS +static int lm_gpiojhandler(int irq, FAR void *context) { - return lm3s_gpiohandler(LM3S_GPIOJ_BASE, LM3S_IRQ_GPIOJ_0, context); + return lm_gpiohandler(LM3S_GPIOJ_BASE, LM3S_IRQ_GPIOJ_0, context); } #endif @@ -274,40 +274,40 @@ int gpio_irqinitialize(void) * interrupts */ -#ifndef CONFIG_LM3S_DISABLE_GPIOA_IRQS - irq_attach(LM3S_IRQ_GPIOA, lm3s_gpioahandler); +#ifndef CONFIG_LM_DISABLE_GPIOA_IRQS + irq_attach(LM3S_IRQ_GPIOA, lm_gpioahandler); up_enable_irq(LM3S_IRQ_GPIOA); #endif -#ifndef CONFIG_LM3S_DISABLE_GPIOB_IRQS - irq_attach(LM3S_IRQ_GPIOB, lm3s_gpiobhandler); +#ifndef CONFIG_LM_DISABLE_GPIOB_IRQS + irq_attach(LM3S_IRQ_GPIOB, lm_gpiobhandler); up_enable_irq(LM3S_IRQ_GPIOB); #endif -#ifndef CONFIG_LM3S_DISABLE_GPIOC_IRQS - irq_attach(LM3S_IRQ_GPIOC, lm3s_gpiochandler); +#ifndef CONFIG_LM_DISABLE_GPIOC_IRQS + irq_attach(LM3S_IRQ_GPIOC, lm_gpiochandler); up_enable_irq(LM3S_IRQ_GPIOC); #endif -#ifndef CONFIG_LM3S_DISABLE_GPIOD_IRQS - irq_attach(LM3S_IRQ_GPIOD, lm3s_gpiodhandler); +#ifndef CONFIG_LM_DISABLE_GPIOD_IRQS + irq_attach(LM3S_IRQ_GPIOD, lm_gpiodhandler); up_enable_irq(LM3S_IRQ_GPIOD); #endif -#ifndef CONFIG_LM3S_DISABLE_GPIOE_IRQS - irq_attach(LM3S_IRQ_GPIOE, lm3s_gpioehandler); +#ifndef CONFIG_LM_DISABLE_GPIOE_IRQS + irq_attach(LM3S_IRQ_GPIOE, lm_gpioehandler); up_enable_irq(LM3S_IRQ_GPIOE); #endif -#ifndef CONFIG_LM3S_DISABLE_GPIOF_IRQS - irq_attach(LM3S_IRQ_GPIOF, lm3s_gpiofhandler); +#ifndef CONFIG_LM_DISABLE_GPIOF_IRQS + irq_attach(LM3S_IRQ_GPIOF, lm_gpiofhandler); up_enable_irq(LM3S_IRQ_GPIOF); #endif -#ifndef CONFIG_LM3S_DISABLE_GPIOG_IRQS - irq_attach(LM3S_IRQ_GPIOG, lm3s_gpioghandler); +#ifndef CONFIG_LM_DISABLE_GPIOG_IRQS + irq_attach(LM3S_IRQ_GPIOG, lm_gpioghandler); up_enable_irq(LM3S_IRQ_GPIOG); #endif -#ifndef CONFIG_LM3S_DISABLE_GPIOH_IRQS - irq_attach(LM3S_IRQ_GPIOH, lm3s_gpiohhandler); +#ifndef CONFIG_LM_DISABLE_GPIOH_IRQS + irq_attach(LM3S_IRQ_GPIOH, lm_gpiohhandler); up_enable_irq(LM3S_IRQ_GPIOH); #endif -#ifndef CONFIG_LM3S_DISABLE_GPIOJ_IRQS - irq_attach(LM3S_IRQ_GPIOJ, lm3s_gpiojhandler); +#ifndef CONFIG_LM_DISABLE_GPIOJ_IRQS + irq_attach(LM3S_IRQ_GPIOJ, lm_gpiojhandler); up_enable_irq(LM3S_IRQ_GPIOJ); #endif @@ -374,7 +374,7 @@ void gpio_irqenable(int irq) { /* Get the base address of the GPIO module associated with this IRQ */ - base = lm3s_gpiobaseaddress(gpioirq); + base = lm_gpiobaseaddress(gpioirq); DEBUGASSERT(base != 0); pin = (1 << (gpioirq & 7)); @@ -413,7 +413,7 @@ void gpio_irqdisable(int irq) { /* Get the base address of the GPIO module associated with this IRQ */ - base = lm3s_gpiobaseaddress(gpioirq); + base = lm_gpiobaseaddress(gpioirq); DEBUGASSERT(base != 0); pin = (1 << (gpioirq & 7)); diff --git a/nuttx/arch/arm/src/lm/lm3s_irq.c b/nuttx/arch/arm/src/lm/lm_irq.c similarity index 90% rename from nuttx/arch/arm/src/lm/lm3s_irq.c rename to nuttx/arch/arm/src/lm/lm_irq.c index 2039d84a85..7009442021 100644 --- a/nuttx/arch/arm/src/lm/lm3s_irq.c +++ b/nuttx/arch/arm/src/lm/lm_irq.c @@ -1,6 +1,6 @@ /**************************************************************************** - * arch/arm/src/lm/lm3s_irq.c - * arch/arm/src/chip/lm3s_irq.c + * arch/arm/src/lm/lm_irq.c + * arch/arm/src/chip/lm_irq.c * * Copyright (C) 2009, 2011 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -88,7 +88,7 @@ volatile uint32_t *current_regs; ****************************************************************************/ /**************************************************************************** - * Name: lm3s_dumpnvic + * Name: lm_dumpnvic * * Description: * Dump some interesting NVIC registers @@ -96,7 +96,7 @@ volatile uint32_t *current_regs; ****************************************************************************/ #if defined(LM3S_IRQ_DEBUG) && defined (CONFIG_DEBUG) -static void lm3s_dumpnvic(const char *msg, int irq) +static void lm_dumpnvic(const char *msg, int irq) { irqstate_t flags; @@ -126,12 +126,12 @@ static void lm3s_dumpnvic(const char *msg, int irq) irqrestore(flags); } #else -# define lm3s_dumpnvic(msg, irq) +# define lm_dumpnvic(msg, irq) #endif /**************************************************************************** - * Name: lm3s_nmi, lm3s_busfault, lm3s_usagefault, lm3s_pendsv, - * lm3s_dbgmonitor, lm3s_pendsv, lm3s_reserved + * Name: lm_nmi, lm_busfault, lm_usagefault, lm_pendsv, + * lm_dbgmonitor, lm_pendsv, lm_reserved * * Description: * Handlers for various execptions. None are handled and all are fatal @@ -141,7 +141,7 @@ static void lm3s_dumpnvic(const char *msg, int irq) ****************************************************************************/ #ifdef CONFIG_DEBUG -static int lm3s_nmi(int irq, FAR void *context) +static int lm_nmi(int irq, FAR void *context) { (void)irqsave(); dbg("PANIC!!! NMI received\n"); @@ -149,7 +149,7 @@ static int lm3s_nmi(int irq, FAR void *context) return 0; } -static int lm3s_busfault(int irq, FAR void *context) +static int lm_busfault(int irq, FAR void *context) { (void)irqsave(); dbg("PANIC!!! Bus fault recived\n"); @@ -157,7 +157,7 @@ static int lm3s_busfault(int irq, FAR void *context) return 0; } -static int lm3s_usagefault(int irq, FAR void *context) +static int lm_usagefault(int irq, FAR void *context) { (void)irqsave(); dbg("PANIC!!! Usage fault received\n"); @@ -165,7 +165,7 @@ static int lm3s_usagefault(int irq, FAR void *context) return 0; } -static int lm3s_pendsv(int irq, FAR void *context) +static int lm_pendsv(int irq, FAR void *context) { (void)irqsave(); dbg("PANIC!!! PendSV received\n"); @@ -173,7 +173,7 @@ static int lm3s_pendsv(int irq, FAR void *context) return 0; } -static int lm3s_dbgmonitor(int irq, FAR void *context) +static int lm_dbgmonitor(int irq, FAR void *context) { (void)irqsave(); dbg("PANIC!!! Debug Monitor receieved\n"); @@ -181,7 +181,7 @@ static int lm3s_dbgmonitor(int irq, FAR void *context) return 0; } -static int lm3s_reserved(int irq, FAR void *context) +static int lm_reserved(int irq, FAR void *context) { (void)irqsave(); dbg("PANIC!!! Reserved interrupt\n"); @@ -191,7 +191,7 @@ static int lm3s_reserved(int irq, FAR void *context) #endif /**************************************************************************** - * Name: lm3s_irqinfo + * Name: lm_irqinfo * * Description: * Given an IRQ number, provide the register and bit setting to enable or @@ -199,7 +199,7 @@ static int lm3s_reserved(int irq, FAR void *context) * ****************************************************************************/ -static int lm3s_irqinfo(int irq, uint32_t *regaddr, uint32_t *bit) +static int lm_irqinfo(int irq, uint32_t *regaddr, uint32_t *bit) { DEBUGASSERT(irq >= LM3S_IRQ_NMI && irq < NR_IRQS); @@ -294,7 +294,7 @@ void up_irqinitialize(void) /* Initialize support for GPIO interrupts if included in this build */ -#ifndef CONFIG_LM3S_DISABLE_GPIO_IRQS +#ifndef CONFIG_LM_DISABLE_GPIO_IRQS #ifdef CONFIG_HAVE_WEAKFUNCTIONS if (gpio_irqinitialize != NULL) #endif @@ -330,18 +330,18 @@ void up_irqinitialize(void) /* Attach all other processor exceptions (except reset and sys tick) */ #ifdef CONFIG_DEBUG - irq_attach(LM3S_IRQ_NMI, lm3s_nmi); + irq_attach(LM3S_IRQ_NMI, lm_nmi); #ifndef CONFIG_ARMV7M_MPU irq_attach(LM3S_IRQ_MEMFAULT, up_memfault); #endif - irq_attach(LM3S_IRQ_BUSFAULT, lm3s_busfault); - irq_attach(LM3S_IRQ_USAGEFAULT, lm3s_usagefault); - irq_attach(LM3S_IRQ_PENDSV, lm3s_pendsv); - irq_attach(LM3S_IRQ_DBGMONITOR, lm3s_dbgmonitor); - irq_attach(LM3S_IRQ_RESERVED, lm3s_reserved); + irq_attach(LM3S_IRQ_BUSFAULT, lm_busfault); + irq_attach(LM3S_IRQ_USAGEFAULT, lm_usagefault); + irq_attach(LM3S_IRQ_PENDSV, lm_pendsv); + irq_attach(LM3S_IRQ_DBGMONITOR, lm_dbgmonitor); + irq_attach(LM3S_IRQ_RESERVED, lm_reserved); #endif - lm3s_dumpnvic("initial", NR_IRQS); + lm_dumpnvic("initial", NR_IRQS); #ifndef CONFIG_SUPPRESS_INTERRUPTS @@ -366,7 +366,7 @@ void up_disable_irq(int irq) uint32_t regval; uint32_t bit; - if (lm3s_irqinfo(irq, ®addr, &bit) == 0) + if (lm_irqinfo(irq, ®addr, &bit) == 0) { /* Clear the appropriate bit in the register to enable the interrupt */ @@ -374,7 +374,7 @@ void up_disable_irq(int irq) regval &= ~bit; putreg32(regval, regaddr); } - lm3s_dumpnvic("disable", irq); + lm_dumpnvic("disable", irq); } /**************************************************************************** @@ -391,7 +391,7 @@ void up_enable_irq(int irq) uint32_t regval; uint32_t bit; - if (lm3s_irqinfo(irq, ®addr, &bit) == 0) + if (lm_irqinfo(irq, ®addr, &bit) == 0) { /* Set the appropriate bit in the register to enable the interrupt */ @@ -399,7 +399,7 @@ void up_enable_irq(int irq) regval |= bit; putreg32(regval, regaddr); } - lm3s_dumpnvic("enable", irq); + lm_dumpnvic("enable", irq); } /**************************************************************************** @@ -452,7 +452,7 @@ int up_prioritize_irq(int irq, int priority) regval |= (priority << shift); putreg32(regval, regaddr); - lm3s_dumpnvic("prioritize", irq); + lm_dumpnvic("prioritize", irq); return OK; } #endif diff --git a/nuttx/arch/arm/src/lm/lm3s_lowputc.c b/nuttx/arch/arm/src/lm/lm_lowputc.c similarity index 95% rename from nuttx/arch/arm/src/lm/lm3s_lowputc.c rename to nuttx/arch/arm/src/lm/lm_lowputc.c index 7f9a826c8f..d2c1f5be55 100644 --- a/nuttx/arch/arm/src/lm/lm3s_lowputc.c +++ b/nuttx/arch/arm/src/lm/lm_lowputc.c @@ -1,5 +1,5 @@ /************************************************************************** - * arch/arm/src/lm/lm3s_lowputc.c + * arch/arm/src/lm/lm_lowputc.c * * Copyright (C) 2009-2010 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -58,26 +58,26 @@ /* Configuration **********************************************************/ #if LM3S_NUARTS < 2 -# undef CONFIG_LM3S_UART1 +# undef CONFIG_LM_UART1 # undef CONFIG_UART1_SERIAL_CONSOLE #endif #if LM3S_NUARTS < 3 -# undef CONFIG_LM3S_UART2 +# undef CONFIG_LM_UART2 # undef CONFIG_UART2_SERIAL_CONSOLE #endif /* Is there a serial console? */ -#if defined(CONFIG_UART0_SERIAL_CONSOLE) && defined(CONFIG_LM3S_UART0) +#if defined(CONFIG_UART0_SERIAL_CONSOLE) && defined(CONFIG_LM_UART0) # undef CONFIG_UART1_SERIAL_CONSOLE # undef CONFIG_UART2_SERIAL_CONSOLE # define HAVE_CONSOLE 1 -#elif defined(CONFIG_UART1_SERIAL_CONSOLE) && defined(CONFIG_LM3S_UART1) +#elif defined(CONFIG_UART1_SERIAL_CONSOLE) && defined(CONFIG_LM_UART1) # undef CONFIG_UART0_SERIAL_CONSOLE # undef CONFIG_UART2_SERIAL_CONSOLE # define HAVE_CONSOLE 1 -#elif defined(CONFIG_UART2_SERIAL_CONSOLE) && defined(CONFIG_LM3S_UART2) +#elif defined(CONFIG_UART2_SERIAL_CONSOLE) && defined(CONFIG_LM_UART2) # undef CONFIG_UART0_SERIAL_CONSOLE # undef CONFIG_UART1_SERIAL_CONSOLE # define HAVE_CONSOLE 1 @@ -259,22 +259,22 @@ void up_lowsetup(void) * this pin configuration -- whether or not a serial console is selected. */ -#ifdef CONFIG_LM3S_UART0 +#ifdef CONFIG_LM_UART0 regval = getreg32(LM3S_SYSCON_RCGC1); regval |= SYSCON_RCGC1_UART0; putreg32(regval, LM3S_SYSCON_RCGC1); - lm3s_configgpio(GPIO_UART0_RX); - lm3s_configgpio(GPIO_UART0_TX); + lm_configgpio(GPIO_UART0_RX); + lm_configgpio(GPIO_UART0_TX); #endif -#ifdef CONFIG_LM3S_UART1 +#ifdef CONFIG_LM_UART1 regval = getreg32(LM3S_SYSCON_RCGC1); regval |= SYSCON_RCGC1_UART1; putreg32(regval, LM3S_SYSCON_RCGC1); - lm3s_configgpio(GPIO_UART1_RX); - lm3s_configgpio(GPIO_UART1_TX); + lm_configgpio(GPIO_UART1_RX); + lm_configgpio(GPIO_UART1_TX); #endif /* Enable the selected console device */ diff --git a/nuttx/arch/arm/src/lm/lm_lowputc.h b/nuttx/arch/arm/src/lm/lm_lowputc.h index b384bbd800..49d6e2df96 100644 --- a/nuttx/arch/arm/src/lm/lm_lowputc.h +++ b/nuttx/arch/arm/src/lm/lm_lowputc.h @@ -1,5 +1,5 @@ /************************************************************************************ - * arch/arm/src/lm/lm3s_lowputc.h + * arch/arm/src/lm/lm_lowputc.h * * Copyright (C) 2009-2010, 2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/arch/arm/src/lm/lm3s_serial.c b/nuttx/arch/arm/src/lm/lm_serial.c similarity index 96% rename from nuttx/arch/arm/src/lm/lm3s_serial.c rename to nuttx/arch/arm/src/lm/lm_serial.c index 79628c765b..e9f6049898 100644 --- a/nuttx/arch/arm/src/lm/lm3s_serial.c +++ b/nuttx/arch/arm/src/lm/lm_serial.c @@ -1,5 +1,5 @@ /**************************************************************************** - * arch/arm/src/lm/lm3s_serial.c + * arch/arm/src/lm/lm_serial.c * * Copyright (C) 2009-2010, 2012 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -67,32 +67,32 @@ /* Some sanity checks *******************************************************/ #if LM3S_NUARTS < 2 -# undef CONFIG_LM3S_UART1 +# undef CONFIG_LM_UART1 # undef CONFIG_UART1_SERIAL_CONSOLE #endif #if LM3S_NUARTS < 3 -# undef CONFIG_LM3S_UART2 +# undef CONFIG_LM_UART2 # undef CONFIG_UART2_SERIAL_CONSOLE #endif /* Is there a UART enabled? */ -#if !defined(CONFIG_LM3S_UART0) && !defined(CONFIG_LM3S_UART1) && !defined(CONFIG_LM3S_UART2) +#if !defined(CONFIG_LM_UART0) && !defined(CONFIG_LM_UART1) && !defined(CONFIG_LM_UART2) # error "No UARTs enabled" #endif /* Is there a serial console? */ -#if defined(CONFIG_UART0_SERIAL_CONSOLE) && defined(CONFIG_LM3S_UART0) +#if defined(CONFIG_UART0_SERIAL_CONSOLE) && defined(CONFIG_LM_UART0) # undef CONFIG_UART1_SERIAL_CONSOLE # undef CONFIG_UART2_SERIAL_CONSOLE # define HAVE_CONSOLE 1 -#elif defined(CONFIG_UART1_SERIAL_CONSOLE) && defined(CONFIG_LM3S_UART1) +#elif defined(CONFIG_UART1_SERIAL_CONSOLE) && defined(CONFIG_LM_UART1) # undef CONFIG_UART0_SERIAL_CONSOLE # undef CONFIG_UART2_SERIAL_CONSOLE # define HAVE_CONSOLE 1 -#elif defined(CONFIG_UART2_SERIAL_CONSOLE) && defined(CONFIG_LM3S_UART2) +#elif defined(CONFIG_UART2_SERIAL_CONSOLE) && defined(CONFIG_LM_UART2) # undef CONFIG_UART0_SERIAL_CONSOLE # undef CONFIG_UART1_SERIAL_CONSOLE # define HAVE_CONSOLE 1 @@ -115,16 +115,16 @@ #if defined(CONFIG_UART0_SERIAL_CONSOLE) # define CONSOLE_DEV g_uart0port /* UART0 is console */ # define TTYS0_DEV g_uart0port /* UART0 is ttyS0 */ -# ifdef CONFIG_LM3S_UART1 +# ifdef CONFIG_LM_UART1 # define TTYS1_DEV g_uart1port /* UART1 is ttyS1 */ -# ifdef CONFIG_LM3S_UART2 +# ifdef CONFIG_LM_UART2 # define TTYS2_DEV g_uart2port /* UART2 is ttyS2 */ # else # undef TTYS2_DEV /* No ttyS2 */ # endif # else # undef TTYS2_DEV /* No ttyS2 */ -# ifdef CONFIG_LM3S_UART2 +# ifdef CONFIG_LM_UART2 # define TTYS1_DEV g_uart2port /* UART2 is ttyS1 */ # else # undef TTYS1_DEV /* No ttyS1 */ @@ -133,16 +133,16 @@ #elif defined(CONFIG_UART1_SERIAL_CONSOLE) # define CONSOLE_DEV g_uart1port /* UART1 is console */ # define TTYS0_DEV g_uart1port /* UART1 is ttyS0 */ -# ifdef CONFIG_LM3S_UART0 +# ifdef CONFIG_LM_UART0 # define TTYS1_DEV g_uart0port /* UART0 is ttyS1 */ -# ifdef CONFIG_LM3S_UART2 +# ifdef CONFIG_LM_UART2 # define TTYS2_DEV g_uart2port /* UART2 is ttyS2 */ # else # undef TTYS2_DEV /* No ttyS2 */ # endif # else # undef TTYS2_DEV /* No ttyS2 */ -# ifdef CONFIG_LM3S_UART2 +# ifdef CONFIG_LM_UART2 # define TTYS1_DEV g_uart2port /* UART2 is ttyS1 */ # else # undef TTYS1_DEV /* No ttyS1 */ @@ -151,49 +151,49 @@ #elif defined(CONFIG_UART2_SERIAL_CONSOLE) # define CONSOLE_DEV g_uart2port /* UART2 is console */ # define TTYS0_DEV g_uart2port /* UART2 is ttyS0 */ -# ifdef CONFIG_LM3S_UART0 +# ifdef CONFIG_LM_UART0 # define TTYS1_DEV g_uart0port /* UART0 is ttyS1 */ -# ifdef CONFIG_LM3S_UART2 +# ifdef CONFIG_LM_UART2 # define TTYS2_DEV g_uart2port /* UART2 is ttyS2 */ # else # undef TTYS2_DEV /* No ttyS2 */ # endif # else # undef TTYS2_DEV /* No ttyS2 */ -# ifdef CONFIG_LM3S_UART2 +# ifdef CONFIG_LM_UART2 # define TTYS1_DEV g_uart2port /* UART2 is ttyS1 */ # else # undef TTYS1_DEV /* No ttyS1 */ # endif # endif -#elifdefined(CONFIG_LM3S_UART0) +#elifdefined(CONFIG_LM_UART0) # undef CONSOLE_DEV /* No console device */ # define TTYS0_DEV g_uart1port /* UART1 is ttyS0 */ -# ifdef CONFIG_LM3S_UART1 +# ifdef CONFIG_LM_UART1 # define TTYS1_DEV g_uart1port /* UART1 is ttyS1 */ -# ifdef CONFIG_LM3S_UART2 +# ifdef CONFIG_LM_UART2 # define TTYS2_DEV g_uart2port /* UART2 is ttyS2 */ # else # undef TTYS2_DEV /* No ttyS2 */ # endif # else # undef TTYS2_DEV /* No ttyS2 */ -# ifdef CONFIG_LM3S_UART2 +# ifdef CONFIG_LM_UART2 # define TTYS1_DEV g_uart2port /* UART2 is ttyS1 */ # else # undef TTYS1_DEV /* No ttyS1 */ # endif # endif -#elifdefined(CONFIG_LM3S_UART1) +#elifdefined(CONFIG_LM_UART1) # undef CONSOLE_DEV /* No console device */ # define TTYS0_DEV g_uart1port /* UART1 is ttyS0 */ # undef TTYS2_DEV /* No ttyS2 */ -# ifdef CONFIG_LM3S_UART2 +# ifdef CONFIG_LM_UART2 # define TTYS1_DEV g_uart2port /* UART2 is ttyS1 */ # else # undef TTYS1_DEV /* No ttyS1 */ # endif -#elifdefined(CONFIG_LM3S_UART2) +#elifdefined(CONFIG_LM_UART2) # undef CONSOLE_DEV /* No console device */ # define TTYS0_DEV g_uart2port /* UART2 is ttyS0 */ # undef TTYS1_DEV /* No ttyS1 */ @@ -261,22 +261,22 @@ struct uart_ops_s g_uart_ops = /* I/O buffers */ -#ifdef CONFIG_LM3S_UART0 +#ifdef CONFIG_LM_UART0 static char g_uart0rxbuffer[CONFIG_UART0_RXBUFSIZE]; static char g_uart0txbuffer[CONFIG_UART0_TXBUFSIZE]; #endif -#ifdef CONFIG_LM3S_UART1 +#ifdef CONFIG_LM_UART1 static char g_uart1rxbuffer[CONFIG_UART1_RXBUFSIZE]; static char g_uart1txbuffer[CONFIG_UART1_TXBUFSIZE]; #endif -#ifdef CONFIG_LM3S_UART2 +#ifdef CONFIG_LM_UART2 static char g_uart2rxbuffer[CONFIG_UART2_RXBUFSIZE]; static char g_uart2txbuffer[CONFIG_UART2_TXBUFSIZE]; #endif /* This describes the state of the LM3S uart0 port. */ -#ifdef CONFIG_LM3S_UART0 +#ifdef CONFIG_LM_UART0 static struct up_dev_s g_uart0priv = { .uartbase = LM3S_UART0_BASE, @@ -306,7 +306,7 @@ static uart_dev_t g_uart0port = /* This describes the state of the LM3S uart1 port. */ -#ifdef CONFIG_LM3S_UART1 +#ifdef CONFIG_LM_UART1 static struct up_dev_s g_uart1priv = { .uartbase = LM3S_UART1_BASE, @@ -336,7 +336,7 @@ static uart_dev_t g_uart1port = /* This describes the state of the LM3S uart1 port. */ -#ifdef CONFIG_LM3S_UART2 +#ifdef CONFIG_LM_UART2 static struct up_dev_s g_uart2priv = { .uartbase = LM3S_UART2_BASE, @@ -686,14 +686,14 @@ static int up_interrupt(int irq, void *context) int passes; bool handled; -#ifdef CONFIG_LM3S_UART0 +#ifdef CONFIG_LM_UART0 if (g_uart0priv.irq == irq) { dev = &g_uart0port; } else #endif -#ifdef CONFIG_LM3S_UART1 +#ifdef CONFIG_LM_UART1 if (g_uart1priv.irq == irq) { dev = &g_uart1port; diff --git a/nuttx/arch/arm/src/lm/lm3s_ssi.c b/nuttx/arch/arm/src/lm/lm_ssi.c similarity index 91% rename from nuttx/arch/arm/src/lm/lm3s_ssi.c rename to nuttx/arch/arm/src/lm/lm_ssi.c index 8cd1cee077..c6f8dcdb16 100644 --- a/nuttx/arch/arm/src/lm/lm3s_ssi.c +++ b/nuttx/arch/arm/src/lm/lm_ssi.c @@ -1,5 +1,5 @@ /**************************************************************************** - * arch/arm/src/lm32/lm3s_ssi.c + * arch/arm/src/lm/lm_ssi.c * * Copyright (C) 2009-2010 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -144,7 +144,7 @@ * Private Type Definitions ****************************************************************************/ -struct lm3s_ssidev_s +struct lm_ssidev_s { const struct spi_ops_s *ops; /* Common SPI operations */ #ifndef CONFIG_SSI_POLLWAIT @@ -167,8 +167,8 @@ struct lm3s_ssidev_s * per word. */ - void (*txword)(struct lm3s_ssidev_s *priv); - void (*rxword)(struct lm3s_ssidev_s *priv); + void (*txword)(struct lm_ssidev_s *priv); + void (*rxword)(struct lm_ssidev_s *priv); #if NSSI_ENABLED > 1 uint32_t base; /* SSI register base address */ @@ -202,15 +202,15 @@ struct lm3s_ssidev_s /* SSI register access */ -static inline uint32_t ssi_getreg(struct lm3s_ssidev_s *priv, +static inline uint32_t ssi_getreg(struct lm_ssidev_s *priv, unsigned int offset); -static inline void ssi_putreg(struct lm3s_ssidev_s *priv, unsigned int offset, +static inline void ssi_putreg(struct lm_ssidev_s *priv, unsigned int offset, uint32_t value); /* Misc helpers */ -static uint32_t ssi_disable(struct lm3s_ssidev_s *priv); -static void ssi_enable(struct lm3s_ssidev_s *priv, uint32_t enable); +static uint32_t ssi_disable(struct lm_ssidev_s *priv); +static void ssi_enable(struct lm_ssidev_s *priv, uint32_t enable); #ifndef CONFIG_SSI_POLLWAIT static void ssi_semtake(sem_t *sem); @@ -219,27 +219,27 @@ static void ssi_semtake(sem_t *sem); /* SSI data transfer */ -static void ssi_txnull(struct lm3s_ssidev_s *priv); -static void ssi_txuint16(struct lm3s_ssidev_s *priv); -static void ssi_txuint8(struct lm3s_ssidev_s *priv); -static void ssi_rxnull(struct lm3s_ssidev_s *priv); -static void ssi_rxuint16(struct lm3s_ssidev_s *priv); -static void ssi_rxuint8(struct lm3s_ssidev_s *priv); -static inline bool ssi_txfifofull(struct lm3s_ssidev_s *priv); -static inline bool ssi_rxfifoempty(struct lm3s_ssidev_s *priv); +static void ssi_txnull(struct lm_ssidev_s *priv); +static void ssi_txuint16(struct lm_ssidev_s *priv); +static void ssi_txuint8(struct lm_ssidev_s *priv); +static void ssi_rxnull(struct lm_ssidev_s *priv); +static void ssi_rxuint16(struct lm_ssidev_s *priv); +static void ssi_rxuint8(struct lm_ssidev_s *priv); +static inline bool ssi_txfifofull(struct lm_ssidev_s *priv); +static inline bool ssi_rxfifoempty(struct lm_ssidev_s *priv); #if CONFIG_SSI_TXLIMIT == 1 && defined(CONFIG_SSI_POLLWAIT) -static inline int ssi_performtx(struct lm3s_ssidev_s *priv); +static inline int ssi_performtx(struct lm_ssidev_s *priv); #else -static int ssi_performtx(struct lm3s_ssidev_s *priv); +static int ssi_performtx(struct lm_ssidev_s *priv); #endif -static inline void ssi_performrx(struct lm3s_ssidev_s *priv); -static int ssi_transfer(struct lm3s_ssidev_s *priv, const void *txbuffer, +static inline void ssi_performrx(struct lm_ssidev_s *priv); +static int ssi_transfer(struct lm_ssidev_s *priv, const void *txbuffer, void *rxbuffer, unsigned int nwords); /* Interrupt handling */ #ifndef CONFIG_SSI_POLLWAIT -static inline struct lm3s_ssidev_s *ssi_mapirq(int irq); +static inline struct lm_ssidev_s *ssi_mapirq(int irq); static int ssi_interrupt(int irq, void *context); #endif @@ -248,14 +248,14 @@ static int ssi_interrupt(int irq, void *context); #ifndef CONFIG_SPI_OWNBUS static int ssi_lock(FAR struct spi_dev_s *dev, bool lock); #endif -static uint32_t ssi_setfrequencyinternal(struct lm3s_ssidev_s *priv, +static uint32_t ssi_setfrequencyinternal(struct lm_ssidev_s *priv, uint32_t frequency); static uint32_t ssi_setfrequency(FAR struct spi_dev_s *dev, uint32_t frequency); -static void ssi_setmodeinternal(struct lm3s_ssidev_s *priv, +static void ssi_setmodeinternal(struct lm_ssidev_s *priv, enum spi_mode_e mode); static void ssi_setmode(FAR struct spi_dev_s *dev, enum spi_mode_e mode); -static void ssi_setbitsinternal(struct lm3s_ssidev_s *priv, int nbits); +static void ssi_setbitsinternal(struct lm_ssidev_s *priv, int nbits); static void ssi_setbits(FAR struct spi_dev_s *dev, int nbits); static uint16_t ssi_send(FAR struct spi_dev_s *dev, uint16_t wd); #ifdef CONFIG_SPI_EXCHANGE @@ -279,13 +279,13 @@ static const struct spi_ops_s g_spiops = #ifndef CONFIG_SPI_OWNBUS .lock = ssi_lock, #endif - .select = lm3s_spiselect, /* Provided externally by board logic */ + .select = lm_spiselect, /* Provided externally by board logic */ .setfrequency = ssi_setfrequency, .setmode = ssi_setmode, .setbits = ssi_setbits, - .status = lm3s_spistatus, /* Provided externally by board logic */ + .status = lm_spistatus, /* Provided externally by board logic */ #ifdef CONFIG_SPI_CMDDATA - .cmddata = lm3s_spicmddata, + .cmddata = lm_spicmddata, #endif .send = ssi_send, #ifdef CONFIG_SPI_EXCHANGE @@ -298,7 +298,7 @@ static const struct spi_ops_s g_spiops = /* This supports is up to two SSI busses/ports */ -static struct lm3s_ssidev_s g_ssidev[] = +static struct lm_ssidev_s g_ssidev[] = { #ifndef CONFIG_SSI0_DISABLE { @@ -347,7 +347,7 @@ static struct lm3s_ssidev_s g_ssidev[] = * ****************************************************************************/ -static inline uint32_t ssi_getreg(struct lm3s_ssidev_s *priv, unsigned int offset) +static inline uint32_t ssi_getreg(struct lm_ssidev_s *priv, unsigned int offset) { #if NSSI_ENABLED > 1 return getreg32(priv->base + offset); @@ -372,7 +372,7 @@ static inline uint32_t ssi_getreg(struct lm3s_ssidev_s *priv, unsigned int offse * ****************************************************************************/ -static inline void ssi_putreg(struct lm3s_ssidev_s *priv, unsigned int offset, uint32_t value) +static inline void ssi_putreg(struct lm_ssidev_s *priv, unsigned int offset, uint32_t value) { #if NSSI_ENABLED > 1 putreg32(value, priv->base + offset); @@ -399,7 +399,7 @@ static inline void ssi_putreg(struct lm3s_ssidev_s *priv, unsigned int offset, u * ****************************************************************************/ -static uint32_t ssi_disable(struct lm3s_ssidev_s *priv) +static uint32_t ssi_disable(struct lm_ssidev_s *priv) { uint32_t retval; uint32_t regval; @@ -428,7 +428,7 @@ static uint32_t ssi_disable(struct lm3s_ssidev_s *priv) * ****************************************************************************/ -static void ssi_enable(struct lm3s_ssidev_s *priv, uint32_t enable) +static void ssi_enable(struct lm_ssidev_s *priv, uint32_t enable) { uint32_t regval = ssi_getreg(priv, LM3S_SSI_CR1_OFFSET); regval &= ~SSI_CR1_SSE; @@ -481,13 +481,13 @@ static void ssi_semtake(sem_t *sem) * ****************************************************************************/ -static void ssi_txnull(struct lm3s_ssidev_s *priv) +static void ssi_txnull(struct lm_ssidev_s *priv) { ssivdbg("TX: ->0xffff\n"); ssi_putreg(priv, LM3S_SSI_DR_OFFSET, 0xffff); } -static void ssi_txuint16(struct lm3s_ssidev_s *priv) +static void ssi_txuint16(struct lm_ssidev_s *priv) { uint16_t *ptr = (uint16_t*)priv->txbuffer; ssivdbg("TX: %p->%04x\n", ptr, *ptr); @@ -495,7 +495,7 @@ static void ssi_txuint16(struct lm3s_ssidev_s *priv) priv->txbuffer = (void*)ptr; } -static void ssi_txuint8(struct lm3s_ssidev_s *priv) +static void ssi_txuint8(struct lm_ssidev_s *priv) { uint8_t *ptr = (uint8_t*)priv->txbuffer; ssivdbg("TX: %p->%02x\n", ptr, *ptr); @@ -520,7 +520,7 @@ static void ssi_txuint8(struct lm3s_ssidev_s *priv) * ****************************************************************************/ -static void ssi_rxnull(struct lm3s_ssidev_s *priv) +static void ssi_rxnull(struct lm_ssidev_s *priv) { #if defined(SSI_DEBUG) && defined(CONFIG_DEBUG_VERBOSE) uint32_t regval = ssi_getreg(priv, LM3S_SSI_DR_OFFSET); @@ -530,7 +530,7 @@ static void ssi_rxnull(struct lm3s_ssidev_s *priv) #endif } -static void ssi_rxuint16(struct lm3s_ssidev_s *priv) +static void ssi_rxuint16(struct lm_ssidev_s *priv) { uint16_t *ptr = (uint16_t*)priv->rxbuffer; *ptr = (uint16_t)ssi_getreg(priv, LM3S_SSI_DR_OFFSET); @@ -538,7 +538,7 @@ static void ssi_rxuint16(struct lm3s_ssidev_s *priv) priv->rxbuffer = (void*)(++ptr); } -static void ssi_rxuint8(struct lm3s_ssidev_s *priv) +static void ssi_rxuint8(struct lm_ssidev_s *priv) { uint8_t *ptr = (uint8_t*)priv->rxbuffer; *ptr = (uint8_t)ssi_getreg(priv, LM3S_SSI_DR_OFFSET); @@ -560,7 +560,7 @@ static void ssi_rxuint8(struct lm3s_ssidev_s *priv) * ****************************************************************************/ -static inline bool ssi_txfifofull(struct lm3s_ssidev_s *priv) +static inline bool ssi_txfifofull(struct lm_ssidev_s *priv) { return (ssi_getreg(priv, LM3S_SSI_SR_OFFSET) & SSI_SR_TNF) == 0; } @@ -579,7 +579,7 @@ static inline bool ssi_txfifofull(struct lm3s_ssidev_s *priv) * ****************************************************************************/ -static inline bool ssi_rxfifoempty(struct lm3s_ssidev_s *priv) +static inline bool ssi_rxfifoempty(struct lm_ssidev_s *priv) { return (ssi_getreg(priv, LM3S_SSI_SR_OFFSET) & SSI_SR_RNE) == 0; } @@ -601,7 +601,7 @@ static inline bool ssi_rxfifoempty(struct lm3s_ssidev_s *priv) ****************************************************************************/ #if CONFIG_SSI_TXLIMIT == 1 && defined(CONFIG_SSI_POLLWAIT) -static inline int ssi_performtx(struct lm3s_ssidev_s *priv) +static inline int ssi_performtx(struct lm_ssidev_s *priv) { /* Check if the Tx FIFO is full and more data to transfer */ @@ -618,7 +618,7 @@ static inline int ssi_performtx(struct lm3s_ssidev_s *priv) #else /* CONFIG_SSI_TXLIMIT == 1 CONFIG_SSI_POLLWAIT */ -static int ssi_performtx(struct lm3s_ssidev_s *priv) +static int ssi_performtx(struct lm_ssidev_s *priv) { #ifndef CONFIG_SSI_POLLWAIT uint32_t regval; @@ -701,7 +701,7 @@ static int ssi_performtx(struct lm3s_ssidev_s *priv) * ****************************************************************************/ -static inline void ssi_performrx(struct lm3s_ssidev_s *priv) +static inline void ssi_performrx(struct lm_ssidev_s *priv) { #ifndef CONFIG_SSI_POLLWAIT uint32_t regval; @@ -778,7 +778,7 @@ static inline void ssi_performrx(struct lm3s_ssidev_s *priv) * ****************************************************************************/ -static int ssi_transfer(struct lm3s_ssidev_s *priv, const void *txbuffer, +static int ssi_transfer(struct lm_ssidev_s *priv, const void *txbuffer, void *rxbuffer, unsigned int nwords) { #ifndef CONFIG_SSI_POLLWAIT @@ -903,7 +903,7 @@ static int ssi_transfer(struct lm3s_ssidev_s *priv, const void *txbuffer, ****************************************************************************/ #ifndef CONFIG_SSI_POLLWAIT -static inline struct lm3s_ssidev_s *ssi_mapirq(int irq) +static inline struct lm_ssidev_s *ssi_mapirq(int irq) { switch (irq) { @@ -944,7 +944,7 @@ static inline struct lm3s_ssidev_s *ssi_mapirq(int irq) #ifndef CONFIG_SSI_POLLWAIT static int ssi_interrupt(int irq, void *context) { - struct lm3s_ssidev_s *priv = ssi_mapirq(irq); + struct lm_ssidev_s *priv = ssi_mapirq(irq); uint32_t regval; int ntxd; @@ -1022,7 +1022,7 @@ static int ssi_interrupt(int irq, void *context) #ifndef CONFIG_SPI_OWNBUS static int ssi_lock(FAR struct spi_dev_s *dev, bool lock) { - FAR struct lm3s_ssidev_s *priv = (FAR struct lm3s_ssidev_s *)dev; + FAR struct lm_ssidev_s *priv = (FAR struct lm_ssidev_s *)dev; if (lock) { @@ -1063,7 +1063,7 @@ static int ssi_lock(FAR struct spi_dev_s *dev, bool lock) * ****************************************************************************/ -static uint32_t ssi_setfrequencyinternal(struct lm3s_ssidev_s *priv, uint32_t frequency) +static uint32_t ssi_setfrequencyinternal(struct lm_ssidev_s *priv, uint32_t frequency) { uint32_t maxdvsr; uint32_t cpsdvsr; @@ -1165,7 +1165,7 @@ static uint32_t ssi_setfrequencyinternal(struct lm3s_ssidev_s *priv, uint32_t fr static uint32_t ssi_setfrequency(FAR struct spi_dev_s *dev, uint32_t frequency) { - struct lm3s_ssidev_s *priv = (struct lm3s_ssidev_s *)dev; + struct lm_ssidev_s *priv = (struct lm_ssidev_s *)dev; uint32_t enable; uint32_t actual; @@ -1195,7 +1195,7 @@ static uint32_t ssi_setfrequency(FAR struct spi_dev_s *dev, uint32_t frequency) * ****************************************************************************/ -static void ssi_setmodeinternal(struct lm3s_ssidev_s *priv, enum spi_mode_e mode) +static void ssi_setmodeinternal(struct lm_ssidev_s *priv, enum spi_mode_e mode) { uint32_t modebits; uint32_t regval; @@ -1251,7 +1251,7 @@ static void ssi_setmodeinternal(struct lm3s_ssidev_s *priv, enum spi_mode_e mode static void ssi_setmode(FAR struct spi_dev_s *dev, enum spi_mode_e mode) { - struct lm3s_ssidev_s *priv = (struct lm3s_ssidev_s *)dev; + struct lm_ssidev_s *priv = (struct lm_ssidev_s *)dev; uint32_t enable; /* NOTE that the SSI must be disabled when setting any configuration registers. */ @@ -1279,7 +1279,7 @@ static void ssi_setmode(FAR struct spi_dev_s *dev, enum spi_mode_e mode) * ****************************************************************************/ -static void ssi_setbitsinternal(struct lm3s_ssidev_s *priv, int nbits) +static void ssi_setbitsinternal(struct lm_ssidev_s *priv, int nbits) { uint32_t regval; @@ -1299,7 +1299,7 @@ static void ssi_setbitsinternal(struct lm3s_ssidev_s *priv, int nbits) static void ssi_setbits(FAR struct spi_dev_s *dev, int nbits) { - struct lm3s_ssidev_s *priv = (struct lm3s_ssidev_s *)dev; + struct lm_ssidev_s *priv = (struct lm_ssidev_s *)dev; uint32_t enable; /* NOTE that the SSI must be disabled when setting any configuration registers. */ @@ -1327,7 +1327,7 @@ static void ssi_setbits(FAR struct spi_dev_s *dev, int nbits) static uint16_t ssi_send(FAR struct spi_dev_s *dev, uint16_t wd) { - struct lm3s_ssidev_s *priv = (struct lm3s_ssidev_s*)dev; + struct lm_ssidev_s *priv = (struct lm_ssidev_s*)dev; uint16_t response = 0; (void)ssi_transfer(priv, &wd, &response, 1); @@ -1358,7 +1358,7 @@ static uint16_t ssi_send(FAR struct spi_dev_s *dev, uint16_t wd) static void ssi_exchange(FAR struct spi_dev_s *dev, FAR const void *txbuffer, FAR void *rxbuffer, size_t nwords) { - struct lm3s_ssidev_s *priv = (struct lm3s_ssidev_s *)dev; + struct lm_ssidev_s *priv = (struct lm_ssidev_s *)dev; (void)ssi_transfer(priv, txbuffer, rxbuffer, nwords); } #endif @@ -1385,7 +1385,7 @@ static void ssi_exchange(FAR struct spi_dev_s *dev, FAR const void *txbuffer, #ifndef CONFIG_SPI_EXCHANGE static void ssi_sndblock(FAR struct spi_dev_s *dev, FAR const void *buffer, size_t nwords) { - struct lm3s_ssidev_s *priv = (struct lm3s_ssidev_s *)dev; + struct lm_ssidev_s *priv = (struct lm_ssidev_s *)dev; (void)ssi_transfer(priv, buffer, NULL, nwords); } #endif @@ -1412,7 +1412,7 @@ static void ssi_sndblock(FAR struct spi_dev_s *dev, FAR const void *buffer, size #ifndef CONFIG_SPI_EXCHANGE static void ssi_recvblock(FAR struct spi_dev_s *dev, FAR void *buffer, size_t nwords) { - struct lm3s_ssidev_s *priv = (struct lm3s_ssidev_s *)dev; + struct lm_ssidev_s *priv = (struct lm_ssidev_s *)dev; (void)ssi_transfer(priv, NULL, buffer, nwords); } #endif @@ -1445,7 +1445,7 @@ static void ssi_recvblock(FAR struct spi_dev_s *dev, FAR void *buffer, size_t nw FAR struct spi_dev_s *up_spiinitialize(int port) { - struct lm3s_ssidev_s *priv; + struct lm_ssidev_s *priv; irqstate_t flags; uint8_t regval; @@ -1473,10 +1473,10 @@ FAR struct spi_dev_s *up_spiinitialize(int port) * logic in this file makes no assumptions about chip select) */ - lm3s_configgpio(GPIO_SSI0_CLK); /* PA2: SSI0 clock (SSI0Clk) */ - /* lm3s_configgpio(GPIO_SSI0_FSS); PA3: SSI0 frame (SSI0Fss) */ - lm3s_configgpio(GPIO_SSI0_RX); /* PA4: SSI0 receive (SSI0Rx) */ - lm3s_configgpio(GPIO_SSI0_TX); /* PA5: SSI0 transmit (SSI0Tx) */ + lm_configgpio(GPIO_SSI0_CLK); /* PA2: SSI0 clock (SSI0Clk) */ + /* lm_configgpio(GPIO_SSI0_FSS); PA3: SSI0 frame (SSI0Fss) */ + lm_configgpio(GPIO_SSI0_RX); /* PA4: SSI0 receive (SSI0Rx) */ + lm_configgpio(GPIO_SSI0_TX); /* PA5: SSI0 transmit (SSI0Tx) */ break; #endif /* CONFIG_SSI0_DISABLE */ @@ -1495,10 +1495,10 @@ FAR struct spi_dev_s *up_spiinitialize(int port) /* Configure SSI1 GPIOs */ - lm3s_configgpio(GPIO_SSI1_CLK); /* PE0: SSI1 clock (SSI1Clk) */ - /* lm3s_configgpio(GPIO_SSI1_FSS); PE1: SSI1 frame (SSI1Fss) */ - lm3s_configgpio(GPIO_SSI1_RX); /* PE2: SSI1 receive (SSI1Rx) */ - lm3s_configgpio(GPIO_SSI1_TX); /* PE3: SSI1 transmit (SSI1Tx) */ + lm_configgpio(GPIO_SSI1_CLK); /* PE0: SSI1 clock (SSI1Clk) */ + /* lm_configgpio(GPIO_SSI1_FSS); PE1: SSI1 frame (SSI1Fss) */ + lm_configgpio(GPIO_SSI1_RX); /* PE2: SSI1 receive (SSI1Rx) */ + lm_configgpio(GPIO_SSI1_TX); /* PE3: SSI1 transmit (SSI1Tx) */ break; #endif /* CONFIG_SSI1_DISABLE */ diff --git a/nuttx/arch/arm/src/lm/lm_ssi.h b/nuttx/arch/arm/src/lm/lm_ssi.h index 4e71198987..07cd2ce77c 100644 --- a/nuttx/arch/arm/src/lm/lm_ssi.h +++ b/nuttx/arch/arm/src/lm/lm_ssi.h @@ -73,20 +73,20 @@ extern "C" ****************************************************************************/ /**************************************************************************** - * The external functions, lm3s_spiselect, lm3s_spistatus, and - * lm3s_spicmddata must be provided by board-specific logic. These are + * The external functions, lm_spiselect, lm_spistatus, and + * lm_spicmddata must be provided by board-specific logic. These are * implementations of the select, status, and cmddata methods of the SPI * interface defined by struct spi_ops_s (see include/nuttx/spi.h). * All other methods (including up_spiinitialize()) are provided by common * logic. To use this common SPI logic on your board: * - * 1. Provide logic in lm3s_boardinitialize() to configure SPI chip select + * 1. Provide logic in lm_boardinitialize() to configure SPI chip select * pins. - * 2. Provide lm3s_spiselect() and lm3s_spistatus() functions in your + * 2. Provide lm_spiselect() and lm_spistatus() functions in your * board-specific logic. These functions will perform chip selection and * status operations using GPIOs in the way your board is configured. * 3. If CONFIG_SPI_CMDDATA is defined in your NuttX configuration, provide - * the lm3s_spicmddata() function in your board-specific logic. This + * the lm_spicmddata() function in your board-specific logic. This * functions will perform cmd/data selection operations using GPIOs in * the way your board is configured. * 4. Add a call to up_spiinitialize() in your low level application @@ -100,10 +100,10 @@ extern "C" struct spi_dev_s; enum spi_dev_e; -void lm3s_spiselect(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected); -uint8_t lm3s_spistatus(FAR struct spi_dev_s *dev, enum spi_dev_e devid); +void lm_spiselect(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected); +uint8_t lm_spistatus(FAR struct spi_dev_s *dev, enum spi_dev_e devid); #ifdef CONFIG_SPI_CMDDATA -int lm3s_spicmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd); +int lm_spicmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd); #endif #if defined(__cplusplus) diff --git a/nuttx/arch/arm/src/lm/lm3s_start.c b/nuttx/arch/arm/src/lm/lm_start.c similarity index 97% rename from nuttx/arch/arm/src/lm/lm3s_start.c rename to nuttx/arch/arm/src/lm/lm_start.c index 4dfe928442..f4985709e8 100644 --- a/nuttx/arch/arm/src/lm/lm3s_start.c +++ b/nuttx/arch/arm/src/lm/lm_start.c @@ -1,6 +1,6 @@ /**************************************************************************** - * arch/arm/src/lm/lm3s_start.c - * arch/arm/src/chip/lm3s_start.c + * arch/arm/src/lm/lm_start.c + * arch/arm/src/chip/lm_start.c * * Copyright (C) 2009, 2012 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -65,7 +65,7 @@ * Public Data ****************************************************************************/ -extern void lm3s_vectors(void); +extern void lm_vectors(void); /**************************************************************************** * Private Functions @@ -139,7 +139,7 @@ void __start(void) /* Initialize onboard resources */ - lm3s_boardinitialize(); + lm_boardinitialize(); showprogress('E'); /* Then start NuttX */ diff --git a/nuttx/arch/arm/src/lm/lm3s_syscontrol.c b/nuttx/arch/arm/src/lm/lm_syscontrol.c similarity index 94% rename from nuttx/arch/arm/src/lm/lm3s_syscontrol.c rename to nuttx/arch/arm/src/lm/lm_syscontrol.c index 87545bec7a..f0d0bd3c97 100644 --- a/nuttx/arch/arm/src/lm/lm3s_syscontrol.c +++ b/nuttx/arch/arm/src/lm/lm_syscontrol.c @@ -1,6 +1,6 @@ /**************************************************************************** - * arch/arm/src/lm/lm3s_syscontrol.c - * arch/arm/src/chip/lm3s_syscontrol.c + * arch/arm/src/lm/lm_syscontrol.c + * arch/arm/src/chip/lm_syscontrol.c * * Copyright (C) 2009 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -78,7 +78,7 @@ ****************************************************************************/ /**************************************************************************** - * Name: lm3s_delay + * Name: lm_delay * * Description: * Wait for the newly selected oscillator(s) to settle. This is tricky because @@ -87,7 +87,7 @@ * ****************************************************************************/ -static inline void lm3s_delay(uint32_t delay) +static inline void lm_delay(uint32_t delay) { __asm__ __volatile__("1:\n" "\tsubs %0, #1\n" @@ -96,7 +96,7 @@ static inline void lm3s_delay(uint32_t delay) } /**************************************************************************** - * Name: lm3s_oscdelay + * Name: lm_oscdelay * * Description: * Wait for the newly selected oscillator(s) to settle. This is tricky because @@ -105,7 +105,7 @@ static inline void lm3s_delay(uint32_t delay) * ****************************************************************************/ -static inline void lm3s_oscdelay(uint32_t rcc, uint32_t rcc2) +static inline void lm_oscdelay(uint32_t rcc, uint32_t rcc2) { /* Wait for the oscillator to stabilize. A smaller delay is used if the * current clock rate is very slow. @@ -138,18 +138,18 @@ static inline void lm3s_oscdelay(uint32_t rcc, uint32_t rcc2) /* Then delay that number of loops */ - lm3s_delay(delay); + lm_delay(delay); } /**************************************************************************** - * Name: lm3s_plllock + * Name: lm_plllock * * Description: * The new RCC values have been selected... wait for the PLL to lock on * ****************************************************************************/ -static inline void lm3s_plllock(void) +static inline void lm_plllock(void) { volatile uint32_t delay; @@ -175,7 +175,7 @@ static inline void lm3s_plllock(void) ****************************************************************************/ /**************************************************************************** - * Name: lm3s_clockconfig + * Name: lm_clockconfig * * Description: * Called to change to new clock based on desired rcc and rcc2 settings. @@ -184,7 +184,7 @@ static inline void lm3s_plllock(void) * ****************************************************************************/ -void lm3s_clockconfig(uint32_t newrcc, uint32_t newrcc2) +void lm_clockconfig(uint32_t newrcc, uint32_t newrcc2) { uint32_t rcc; uint32_t rcc2; @@ -221,7 +221,7 @@ void lm3s_clockconfig(uint32_t newrcc, uint32_t newrcc2) * clock setting, not the one that we are configuring. */ - lm3s_oscdelay(rcc, rcc2); + lm_oscdelay(rcc, rcc2); } /* Set the new crystal value, oscillator source and PLL configuration */ @@ -253,7 +253,7 @@ void lm3s_clockconfig(uint32_t newrcc, uint32_t newrcc2) /* Wait for the new crystal value and oscillator source to take effect */ - lm3s_delay(16); + lm_delay(16); /* Set the requested system divider and disable the non-selected osciallators */ @@ -269,7 +269,7 @@ void lm3s_clockconfig(uint32_t newrcc, uint32_t newrcc2) { /* Yes, wail untill the PLL is locked */ - lm3s_plllock(); + lm_plllock(); /* Then enable the PLL */ @@ -284,7 +284,7 @@ void lm3s_clockconfig(uint32_t newrcc, uint32_t newrcc2) /* Wait for the system divider to be effective */ - lm3s_delay(6); + lm_delay(6); } /**************************************************************************** @@ -298,7 +298,7 @@ void lm3s_clockconfig(uint32_t newrcc, uint32_t newrcc2) void up_clockconfig(void) { -#ifdef CONFIG_LM3S_REVA2 +#ifdef CONFIG_LM_REVA2 /* Some early silicon returned an increase LDO voltage or 2.75V to work * around a PLL bug */ @@ -310,6 +310,6 @@ void up_clockconfig(void) * header file */ - lm3s_clockconfig(LM3S_RCC_VALUE, LM3S_RCC2_VALUE); + lm_clockconfig(LM3S_RCC_VALUE, LM3S_RCC2_VALUE); } diff --git a/nuttx/arch/arm/src/lm/lm_syscontrol.h b/nuttx/arch/arm/src/lm/lm_syscontrol.h index 79cc2349d1..98fbc81cb1 100644 --- a/nuttx/arch/arm/src/lm/lm_syscontrol.h +++ b/nuttx/arch/arm/src/lm/lm_syscontrol.h @@ -1,5 +1,5 @@ /************************************************************************************ - * arch/arm/src/lm/lm3s_syscontrol.h + * arch/arm/src/lm/lm_syscontrol.h * * Copyright (C) 2009-2010, 2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -70,7 +70,7 @@ extern "C" ****************************************************************************/ /**************************************************************************** - * Name: lm3s_clockconfig + * Name: lm_clockconfig * * Description: * Called to change to new clock based on desired rcc and rcc2 settings. @@ -79,7 +79,7 @@ extern "C" * ****************************************************************************/ -void lm3s_clockconfig(uint32_t newrcc, uint32_t newrcc2); +void lm_clockconfig(uint32_t newrcc, uint32_t newrcc2); /**************************************************************************** * Name: up_clockconfig diff --git a/nuttx/arch/arm/src/lm/lm3s_timerisr.c b/nuttx/arch/arm/src/lm/lm_timerisr.c similarity index 99% rename from nuttx/arch/arm/src/lm/lm3s_timerisr.c rename to nuttx/arch/arm/src/lm/lm_timerisr.c index 823d810da2..0469a473b6 100644 --- a/nuttx/arch/arm/src/lm/lm3s_timerisr.c +++ b/nuttx/arch/arm/src/lm/lm_timerisr.c @@ -1,5 +1,5 @@ /**************************************************************************** - * arch/arm/src/lm/lm3s_timerisr.c + * arch/arm/src/lm/lm_timerisr.c * * Copyright (C) 2009 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/nuttx/arch/arm/src/lm/lm_vectors.S b/nuttx/arch/arm/src/lm/lm_vectors.S new file mode 100644 index 0000000000..93350a9ffa --- /dev/null +++ b/nuttx/arch/arm/src/lm/lm_vectors.S @@ -0,0 +1,805 @@ +/************************************************************************************ + * arch/arm/src/lm/lm_vectors.S + * arch/arm/src/chip/lm_vectors.S + * + * Copyright (C) 2009-2010 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * 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. + * + ************************************************************************************/ + +/************************************************************************************ + * Included Files + ************************************************************************************/ + +#include +#include + +/************************************************************************************ + * Preprocessor Definitions + ************************************************************************************/ + +/* Memory Map: + * + * 0x0000:0000 - Beginning of FLASH. Address of vectors (if not using bootloader) + * 0x0002:0000 - Address of vectors if using bootloader + * 0x0003:ffff - End of flash + * 0x2000:0000 - Start of SRAM and start of .data (_sdata) + * - End of .data (_edata) abd start of .bss (_sbss) + * - End of .bss (_ebss) and bottom of idle stack + * - _ebss + CONFIG_IDLETHREAD_STACKSIZE = end of idle stack, start of heap + * 0x2000:ffff - End of SRAM and end of heap + */ + +#define IDLE_STACK (_ebss+CONFIG_IDLETHREAD_STACKSIZE-4) +#define HEAP_BASE (_ebss+CONFIG_IDLETHREAD_STACKSIZE-4) + +/* The Cortex-M3 return from interrupt is unusual. We provide the following special + * address to the BX instruction. The particular value also forces a return to + * thread mode and covers state from the main stack point, the MSP (vs. the MSP). + */ + +#define EXC_RETURN 0xfffffff9 + +/************************************************************************************ + * Global Symbols + ************************************************************************************/ + + .globl __start + + .syntax unified + .thumb + .file "lm_vectors.S" + +/************************************************************************************ + * Macros + ************************************************************************************/ + +/* On entry into an IRQ, the hardware automatically saves the xPSR, PC, LR, R12, R0-R3 + * registers on the stack, then branches to an instantantiation of the following + * macro. This macro simply loads the IRQ number into R0, then jumps to the common + * IRQ handling logic. + */ + + .macro HANDLER, label, irqno + .thumb_func +\label: + mov r0, #\irqno + b lm_irqcommon + .endm + +/************************************************************************************ + * Vectors + ************************************************************************************/ + + .section .vectors, "ax" + .code 16 + .align 2 + .globl lm_vectors + .type lm_vectors, function + +lm_vectors: + +/* Processor Exceptions */ + + .word IDLE_STACK /* Vector 0: Reset stack pointer */ + .word __start /* Vector 1: Reset vector */ + .word lm_nmi /* Vector 2: Non-Maskable Interrupt (NMI) */ + .word lm_hardfault /* Vector 3: Hard fault */ + .word lm_mpu /* Vector 4: Memory management (MPU) */ + .word lm_busfault /* Vector 5: Bus fault */ + .word lm_usagefault /* Vector 6: Usage fault */ + .word lm_reserved /* Vector 7: Reserved */ + .word lm_reserved /* Vector 8: Reserved */ + .word lm_reserved /* Vector 9: Reserved */ + .word lm_reserved /* Vector 10: Reserved */ + .word lm_svcall /* Vector 11: SVC call */ + .word lm_dbgmonitor /* Vector 12: Debug monitor */ + .word lm_reserved /* Vector 13: Reserved */ + .word lm_pendsv /* Vector 14: Pendable system service request */ + .word lm_systick /* Vector 15: System tick */ + +/* External Interrupts */ + +#if defined(CONFIG_ARCH_CHIP_LM3S6918) + .word lm_gpioa /* Vector 16: GPIO Port A */ + .word lm_gpiob /* Vector 17: GPIO Port B */ + .word lm_gpioc /* Vector 18: GPIO Port C */ + .word lm_gpiod /* Vector 19: GPIO Port D */ + .word lm_gpioe /* Vector 20: GPIO Port E */ + .word lm_uart0 /* Vector 21: UART 0 */ + .word lm_uart1 /* Vector 22: UART 1 */ + .word lm_ssi0 /* Vector 23: SSI 0 */ + .word lm_i2c0 /* Vector 24: I2C 0 */ + .word lm_reserved /* Vector 25: Reserved */ + .word lm_reserved /* Vector 26: Reserved */ + .word lm_reserved /* Vector 27: Reserved */ + .word lm_reserved /* Vector 28: Reserved */ + .word lm_reserved /* Vector 29: Reserved */ + .word lm_adc0 /* Vector 30: ADC Sequence 0 */ + .word lm_adc1 /* Vector 31: ADC Sequence 1 */ + .word lm_adc2 /* Vector 32: ADC Sequence 2 */ + .word lm_adc3 /* Vector 33: ADC Sequence 3 */ + .word lm_wdog /* Vector 34: Watchdog Timer */ + .word lm_tmr0a /* Vector 35: Timer 0 A */ + .word lm_tmr0b /* Vector 36: Timer 0 B */ + .word lm_tmr1a /* Vector 37: Timer 1 A */ + .word lm_tmr1b /* Vector 38: Timer 1 B */ + .word lm_tmr2a /* Vector 39: Timer 2 A */ + .word lm_tmr2b /* Vector 40: Timer 3 B */ + .word lm_cmp0 /* Vector 41: Analog Comparator 0 */ + .word lm_cmp1 /* Vector 42: Analog Comparator 1 */ + .word lm_reserved /* Vector 43: Reserved */ + .word lm_syscon /* Vector 44: System Control */ + .word lm_flashcon /* Vector 45: FLASH Control */ + .word lm_gpiof /* Vector 46: GPIO Port F */ + .word lm_gpiog /* Vector 47: GPIO Port G */ + .word lm_gpioh /* Vector 48: GPIO Port H */ + .word lm_reserved /* Vector 49: Reserved */ + .word lm_ssi1 /* Vector 50: SSI 1 */ + .word lm_tmr3a /* Vector 51: Timer 3 A */ + .word lm_tmr3b /* Vector 52: Timer 3 B */ + .word lm_i2c1 /* Vector 53: I2C 1 */ + .word lm_reserved /* Vector 54: Reserved */ + .word lm_reserved /* Vector 55: Reserved */ + .word lm_reserved /* Vector 56: Reserved */ + .word lm_reserved /* Vector 57: Reserved */ + .word lm_eth /* Vector 58: Ethernet Controller */ + .word lm_hib /* Vector 59: Hibernation Module */ + .word lm_reserved /* Vector 60: Reserved */ + .word lm_reserved /* Vector 61: Reserved */ + .word lm_reserved /* Vector 62: Reserved */ + .word lm_reserved /* Vector 63: Reserved */ + .word lm_reserved /* Vector 64: Reserved */ + .word lm_reserved /* Vector 65: Reserved */ + .word lm_reserved /* Vector 66: Reserved */ + .word lm_reserved /* Vector 67: Reserved */ + .word lm_reserved /* Vector 68: Reserved */ + .word lm_reserved /* Vector 69: Reserved */ + .word lm_reserved /* Vector 70: Reserved */ +#elif defined(CONFIG_ARCH_CHIP_LM3S6432) + .word lm_gpioa /* Vector 16: GPIO Port A */ + .word lm_gpiob /* Vector 17: GPIO Port B */ + .word lm_gpioc /* Vector 18: GPIO Port C */ + .word lm_gpiod /* Vector 19: GPIO Port D */ + .word lm_gpioe /* Vector 20: GPIO Port E */ + .word lm_uart0 /* Vector 21: UART 0 */ + .word lm_uart1 /* Vector 22: UART 1 */ + .word lm_ssi0 /* Vector 23: SSI 0 */ + .word lm_i2c0 /* Vector 24: I2C 0 */ + .word lm_reserved /* Vector 25: Reserved */ + .word lm_pwm0 /* Vector 26: PWM Generator 0 */ + .word lm_reserved /* Vector 27: Reserved */ + .word lm_reserved /* Vector 28: Reserved */ + .word lm_reserved /* Vector 29: Reserved */ + .word lm_adc0 /* Vector 30: ADC Sequence 0 */ + .word lm_adc1 /* Vector 31: ADC Sequence 1 */ + .word lm_adc2 /* Vector 32: ADC Sequence 2 */ + .word lm_adc3 /* Vector 33: ADC Sequence 3 */ + .word lm_wdog /* Vector 34: Watchdog Timer */ + .word lm_tmr0a /* Vector 35: Timer 0 A */ + .word lm_tmr0b /* Vector 36: Timer 0 B */ + .word lm_tmr1a /* Vector 37: Timer 1 A */ + .word lm_tmr1b /* Vector 38: Timer 1 B */ + .word lm_tmr2a /* Vector 39: Timer 2 A */ + .word lm_tmr2b /* Vector 40: Timer 3 B */ + .word lm_cmp0 /* Vector 41: Analog Comparator 0 */ + .word lm_cmp1 /* Vector 42: Analog Comparator 1 */ + .word lm_reserved /* Vector 43: Reserved */ + .word lm_syscon /* Vector 44: System Control */ + .word lm_flashcon /* Vector 45: FLASH Control */ + .word lm_gpiof /* Vector 46: GPIO Port F */ + .word lm_gpiog /* Vector 47: GPIO Port G */ + .word lm_reserved /* Vector 48: Reserved */ + .word lm_reserved /* Vector 49: Reserved */ + .word lm_reserved /* Vector 50: Reserved */ + .word lm_reserved /* Vector 51: Reserved */ + .word lm_reserved /* Vector 52: Reserved */ + .word lm_reserved /* Vector 53: Reserved */ + .word lm_reserved /* Vector 54: Reserved */ + .word lm_reserved /* Vector 55: Reserved */ + .word lm_reserved /* Vector 56: Reserved */ + .word lm_reserved /* Vector 57: Reserved */ + .word lm_eth /* Vector 58: Ethernet Controller */ + .word lm_reserved /* Vector 59: Reserved */ + .word lm_reserved /* Vector 60: Reserved */ + .word lm_reserved /* Vector 61: Reserved */ + .word lm_reserved /* Vector 62: Reserved */ + .word lm_reserved /* Vector 63: Reserved */ + .word lm_reserved /* Vector 64: Reserved */ + .word lm_reserved /* Vector 65: Reserved */ + .word lm_reserved /* Vector 66: Reserved */ + .word lm_reserved /* Vector 67: Reserved */ + .word lm_reserved /* Vector 68: Reserved */ + .word lm_reserved /* Vector 69: Reserved */ + .word lm_reserved /* Vector 70: Reserved */ +#elif defined(CONFIG_ARCH_CHIP_LM3S6965) + .word lm_gpioa /* Vector 16: GPIO Port A */ + .word lm_gpiob /* Vector 17: GPIO Port B */ + .word lm_gpioc /* Vector 18: GPIO Port C */ + .word lm_gpiod /* Vector 19: GPIO Port D */ + .word lm_gpioe /* Vector 20: GPIO Port E */ + .word lm_uart0 /* Vector 21: UART 0 */ + .word lm_uart1 /* Vector 22: UART 1 */ + .word lm_ssi0 /* Vector 23: SSI 0 */ + .word lm_i2c0 /* Vector 24: I2C 0 */ + .word lm_pwmfault /* Vector 25: PWM Fault */ + .word lm_pwm0 /* Vector 26: PWM Generator 0 */ + .word lm_pwm1 /* Vector 27: PWM Generator 1 */ + .word lm_pwm2 /* Vector 28: PWM Generator 2 */ + .word lm_qei0 /* Vector 29: QEI0 */ + .word lm_adc0 /* Vector 30: ADC Sequence 0 */ + .word lm_adc1 /* Vector 31: ADC Sequence 1 */ + .word lm_adc2 /* Vector 32: ADC Sequence 2 */ + .word lm_adc3 /* Vector 33: ADC Sequence 3 */ + .word lm_wdog /* Vector 34: Watchdog Timer */ + .word lm_tmr0a /* Vector 35: Timer 0 A */ + .word lm_tmr0b /* Vector 36: Timer 0 B */ + .word lm_tmr1a /* Vector 37: Timer 1 A */ + .word lm_tmr1b /* Vector 38: Timer 1 B */ + .word lm_tmr2a /* Vector 39: Timer 2 A */ + .word lm_tmr2b /* Vector 40: Timer 3 B */ + .word lm_cmp0 /* Vector 41: Analog Comparator 0 */ + .word lm_cmp1 /* Vector 42: Analog Comparator 1 */ + .word lm_reserved /* Vector 43: Reserved */ + .word lm_syscon /* Vector 44: System Control */ + .word lm_flashcon /* Vector 45: FLASH Control */ + .word lm_gpiof /* Vector 46: GPIO Port F */ + .word lm_gpiog /* Vector 47: GPIO Port G */ + .word lm_reserved /* Vector 48: Reserved */ + .word lm_uart2 /* Vector 49: UART 2 */ + .word lm_reserved /* Vector 50: Reserved */ + .word lm_tmr3a /* Vector 51: Timer 3 A */ + .word lm_tmr3b /* Vector 52: Timer 3 B */ + .word lm_i2c1 /* Vector 53: I2C 1 */ + .word lm_qei1 /* Vector 54: QEI1 */ + .word lm_reserved /* Vector 55: Reserved */ + .word lm_reserved /* Vector 56: Reserved */ + .word lm_reserved /* Vector 57: Reserved */ + .word lm_eth /* Vector 58: Ethernet Controller */ + .word lm_hib /* Vector 59: Hibernation Module */ + .word lm_reserved /* Vector 60: Reserved */ + .word lm_reserved /* Vector 61: Reserved */ + .word lm_reserved /* Vector 62: Reserved */ + .word lm_reserved /* Vector 63: Reserved */ + .word lm_reserved /* Vector 64: Reserved */ + .word lm_reserved /* Vector 65: Reserved */ + .word lm_reserved /* Vector 66: Reserved */ + .word lm_reserved /* Vector 67: Reserved */ + .word lm_reserved /* Vector 68: Reserved */ + .word lm_reserved /* Vector 69: Reserved */ + .word lm_reserved /* Vector 70: Reserved */ +#elif defined(CONFIG_ARCH_CHIP_LM3S9B96) + .word lm_gpioa /* Vector 16: GPIO Port A */ + .word lm_gpiob /* Vector 17: GPIO Port B */ + .word lm_gpioc /* Vector 18: GPIO Port C */ + .word lm_gpiod /* Vector 19: GPIO Port D */ + .word lm_gpioe /* Vector 20: GPIO Port E */ + .word lm_uart0 /* Vector 21: UART 0 */ + .word lm_uart1 /* Vector 22: UART 1 */ + .word lm_ssi0 /* Vector 23: SSI 0 */ + .word lm_i2c0 /* Vector 24: I2C 0 */ + .word lm_pwmfault /* Vector 25: PWM Fault */ + .word lm_pwm0 /* Vector 26: PWM Generator 0 */ + .word lm_pwm1 /* Vector 27: PWM Generator 1 */ + .word lm_pwm2 /* Vector 28: PWM Generator 2 */ + .word lm_qei0 /* Vector 29: QEI0 */ + .word lm_adc0 /* Vector 30: ADC Sequence 0 */ + .word lm_adc1 /* Vector 31: ADC Sequence 1 */ + .word lm_adc2 /* Vector 32: ADC Sequence 2 */ + .word lm_adc3 /* Vector 33: ADC Sequence 3 */ + .word lm_wdog /* Vector 34: Watchdog Timer */ + .word lm_tmr0a /* Vector 35: Timer 0 A */ + .word lm_tmr0b /* Vector 36: Timer 0 B */ + .word lm_tmr1a /* Vector 37: Timer 1 A */ + .word lm_tmr1b /* Vector 38: Timer 1 B */ + .word lm_tmr2a /* Vector 39: Timer 2 A */ + .word lm_tmr2b /* Vector 40: Timer 3 B */ + .word lm_cmp0 /* Vector 41: Analog Comparator 0 */ + .word lm_cmp1 /* Vector 42: Analog Comparator 1 */ + .word lm_cmp2 /* Vector 43: Reserved */ + .word lm_syscon /* Vector 44: System Control */ + .word lm_flashcon /* Vector 45: FLASH Control */ + .word lm_gpiof /* Vector 46: GPIO Port F */ + .word lm_gpiog /* Vector 47: GPIO Port G */ + .word lm_gpioh /* Vector 48: GPIO Port H */ + .word lm_uart2 /* Vector 49: UART 2 */ + .word lm_ssi1 /* Vector 50: SSI 1 */ + .word lm_tmr3a /* Vector 51: Timer 3 A */ + .word lm_tmr3b /* Vector 52: Timer 3 B */ + .word lm_i2c1 /* Vector 53: I2C 1 */ + .word lm_qei1 /* Vector 54: QEI1 */ + .word lm_can0 /* Vector 55: CAN 0 */ + .word lm_can1 /* Vector 56: CAN 1 */ + .word lm_reserved /* Vector 57: Reserved */ + .word lm_eth /* Vector 58: Ethernet Controller */ + .word lm_reserved /* Vector 59: Reserved */ + .word lm_usb /* Vector 60: USB */ + .word lm_pwm3 /* Vector 61: PWM 3 */ + .word lm_udmasoft /* Vector 62: uDMA Software */ + .word lm_udmaerror /* Vector 63: uDMA Error */ + .word lm_adc1_0 /* Vector 64: ADC1 Sequence 0 */ + .word lm_adc1_1 /* Vector 65: ADC1 Sequence 1 */ + .word lm_adc1_2 /* Vector 66: ADC1 Sequence 2 */ + .word lm_adc1_3 /* Vector 67: ADC1 Sequence 3 */ + .word lm_i2s0 /* Vector 68: I2S 0 */ + .word lm_epi /* Vector 69: Reserved */ + .word lm_gpioj /* Vector 70: GPIO J */ + .word lm_reserved /* Vector 71: Reserved */ + #elif defined(CONFIG_ARCH_CHIP_LM3S8962) + .word lm_gpioa /* Vector 16: GPIO Port A */ + .word lm_gpiob /* Vector 17: GPIO Port B */ + .word lm_gpioc /* Vector 18: GPIO Port C */ + .word lm_gpiod /* Vector 19: GPIO Port D */ + .word lm_gpioe /* Vector 20: GPIO Port E */ + .word lm_uart0 /* Vector 21: UART 0 */ + .word lm_uart1 /* Vector 22: UART 1 */ + .word lm_ssi0 /* Vector 23: SSI 0 */ + .word lm_i2c0 /* Vector 24: I2C 0 */ + .word lm_pwmfault /* Vector 25: PWM Fault */ + .word lm_pwm0 /* Vector 26: PWM Generator 0 */ + .word lm_pwm1 /* Vector 27: PWM Generator 1 */ + .word lm_pwm2 /* Vector 28: PWM Generator 2 */ + .word lm_qei0 /* Vector 29: QEI0 */ + .word lm_adc0 /* Vector 30: ADC Sequence 0 */ + .word lm_adc1 /* Vector 31: ADC Sequence 1 */ + .word lm_adc2 /* Vector 32: ADC Sequence 2 */ + .word lm_adc3 /* Vector 33: ADC Sequence 3 */ + .word lm_wdog /* Vector 34: Watchdog Timer */ + .word lm_tmr0a /* Vector 35: Timer 0 A */ + .word lm_tmr0b /* Vector 36: Timer 0 B */ + .word lm_tmr1a /* Vector 37: Timer 1 A */ + .word lm_tmr1b /* Vector 38: Timer 1 B */ + .word lm_tmr2a /* Vector 39: Timer 2 A */ + .word lm_tmr2b /* Vector 40: Timer 3 B */ + .word lm_cmp0 /* Vector 41: Analog Comparator 0 */ + .word lm_reserved /* Vector 42: Reserved */ + .word lm_reserved /* Vector 43: Reserved */ + .word lm_syscon /* Vector 44: System Control */ + .word lm_flashcon /* Vector 45: FLASH Control */ + .word lm_gpiof /* Vector 46: GPIO Port F */ + .word lm_gpiog /* Vector 47: GPIO Port G */ + .word lm_reserved /* Vector 48: Reserved */ + .word lm_reserved /* Vector 49: Reserved */ + .word lm_reserved /* Vector 50: Reserved */ + .word lm_tmr3a /* Vector 51: Timer 3 A */ + .word lm_tmr3b /* Vector 52: Timer 3 B */ + .word lm_reserved /* Vector 53: Reserved*/ + .word lm_qei1 /* Vector 54: QEI1 */ + .word lm_can0 /* Vector 55: Can Controller */ + .word lm_reserved /* Vector 56: Reserved */ + .word lm_reserved /* Vector 57: Reserved */ + .word lm_eth /* Vector 58: Ethernet Controller */ + .word lm_hib /* Vector 59: Hibernation Module */ + .word lm_reserved /* Vector 60: Reserved */ + .word lm_reserved /* Vector 61: Reserved */ + .word lm_reserved /* Vector 62: Reserved */ + .word lm_reserved /* Vector 63: Reserved */ + .word lm_reserved /* Vector 64: Reserved */ + .word lm_reserved /* Vector 65: Reserved */ + .word lm_reserved /* Vector 66: Reserved */ + .word lm_reserved /* Vector 67: Reserved */ + .word lm_reserved /* Vector 68: Reserved */ + .word lm_reserved /* Vector 69: Reserved */ + .word lm_reserved /* Vector 70: Reserved */ +#else +# error "Vectors not specified for this LM3S chip" +#endif + .size lm_vectors, .-lm_vectors + +/************************************************************************************ + * .text + ************************************************************************************/ + + .text + .type handlers, function + .thumb_func +handlers: + HANDLER lm_reserved, LM3S_IRQ_RESERVED /* Unexpected/reserved vector */ + HANDLER lm_nmi, LM3S_IRQ_NMI /* Vector 2: Non-Maskable Interrupt (NMI) */ + HANDLER lm_hardfault, LM3S_IRQ_HARDFAULT /* Vector 3: Hard fault */ + HANDLER lm_mpu, LM3S_IRQ_MEMFAULT /* Vector 4: Memory management (MPU) */ + HANDLER lm_busfault, LM3S_IRQ_BUSFAULT /* Vector 5: Bus fault */ + HANDLER lm_usagefault, LM3S_IRQ_USAGEFAULT /* Vector 6: Usage fault */ + HANDLER lm_svcall, LM3S_IRQ_SVCALL /* Vector 11: SVC call */ + HANDLER lm_dbgmonitor, LM3S_IRQ_DBGMONITOR /* Vector 12: Debug Monitor */ + HANDLER lm_pendsv, LM3S_IRQ_PENDSV /* Vector 14: Penable system service request */ + HANDLER lm_systick, LM3S_IRQ_SYSTICK /* Vector 15: System tick */ + +#if defined(CONFIG_ARCH_CHIP_LM3S6918) + HANDLER lm_gpioa, LM3S_IRQ_GPIOA /* Vector 16: GPIO Port A */ + HANDLER lm_gpiob, LM3S_IRQ_GPIOB /* Vector 17: GPIO Port B */ + HANDLER lm_gpioc, LM3S_IRQ_GPIOC /* Vector 18: GPIO Port C */ + HANDLER lm_gpiod, LM3S_IRQ_GPIOD /* Vector 19: GPIO Port D */ + HANDLER lm_gpioe, LM3S_IRQ_GPIOE /* Vector 20: GPIO Port E */ + HANDLER lm_uart0, LM3S_IRQ_UART0 /* Vector 21: UART 0 */ + HANDLER lm_uart1, LM3S_IRQ_UART1 /* Vector 22: UART 1 */ + HANDLER lm_ssi0, LM3S_IRQ_SSI0 /* Vector 23: SSI 0 */ + HANDLER lm_i2c0, LM3S_IRQ_I2C0 /* Vector 24: I2C 0 */ + HANDLER lm_adc0, LM3S_IRQ_ADC0 /* Vector 30: ADC Sequence 0 */ + HANDLER lm_adc1, LM3S_IRQ_ADC1 /* Vector 31: ADC Sequence 1 */ + HANDLER lm_adc2, LM3S_IRQ_ADC2 /* Vector 32: ADC Sequence 2 */ + HANDLER lm_adc3, LM3S_IRQ_ADC3 /* Vector 33: ADC Sequence 3 */ + HANDLER lm_wdog, LM3S_IRQ_WDOG /* Vector 34: Watchdog Timer */ + HANDLER lm_tmr0a, LM3S_IRQ_TIMER0A /* Vector 35: Timer 0 A */ + HANDLER lm_tmr0b, LM3S_IRQ_TIMER0B /* Vector 36: Timer 0 B */ + HANDLER lm_tmr1a, LM3S_IRQ_TIMER1A /* Vector 37: Timer 1 A */ + HANDLER lm_tmr1b, LM3S_IRQ_TIMER1B /* Vector 38: Timer 1 B */ + HANDLER lm_tmr2a, LM3S_IRQ_TIMER2A /* Vector 39: Timer 2 A */ + HANDLER lm_tmr2b, LM3S_IRQ_TIMER2B /* Vector 40: Timer 3 B */ + HANDLER lm_cmp0, LM3S_IRQ_COMPARE0 /* Vector 41: Analog Comparator 0 */ + HANDLER lm_cmp1, LM3S_IRQ_COMPARE1 /* Vector 42: Analog Comparator 1 */ + HANDLER lm_syscon, LM3S_IRQ_SYSCON /* Vector 44: System Control */ + HANDLER lm_flashcon, LM3S_IRQ_FLASHCON /* Vector 45: FLASH Control */ + HANDLER lm_gpiof, LM3S_IRQ_GPIOF /* Vector 46: GPIO Port F */ + HANDLER lm_gpiog, LM3S_IRQ_GPIOG /* Vector 47: GPIO Port G */ + HANDLER lm_gpioh, LM3S_IRQ_GPIOH /* Vector 48: GPIO Port H */ + HANDLER lm_ssi1, LM3S_IRQ_SSI1 /* Vector 50: SSI 1 */ + HANDLER lm_tmr3a, LM3S_IRQ_TIMER3A /* Vector 51: Timer 3 A */ + HANDLER lm_tmr3b, LM3S_IRQ_TIMER3B /* Vector 52: Timer 3 B */ + HANDLER lm_i2c1, LM3S_IRQ_I2C1 /* Vector 53: I2C 1 */ + HANDLER lm_eth, LM3S_IRQ_ETHCON /* Vector 58: Ethernet Controller */ + HANDLER lm_hib, LM3S_IRQ_HIBERNATE /* Vector 59: Hibernation Module */ +#elif defined(CONFIG_ARCH_CHIP_LM3S6432) + HANDLER lm_gpioa, LM3S_IRQ_GPIOA /* Vector 16: GPIO Port A */ + HANDLER lm_gpiob, LM3S_IRQ_GPIOB /* Vector 17: GPIO Port B */ + HANDLER lm_gpioc, LM3S_IRQ_GPIOC /* Vector 18: GPIO Port C */ + HANDLER lm_gpiod, LM3S_IRQ_GPIOD /* Vector 19: GPIO Port D */ + HANDLER lm_gpioe, LM3S_IRQ_GPIOE /* Vector 20: GPIO Port E */ + HANDLER lm_uart0, LM3S_IRQ_UART0 /* Vector 21: UART 0 */ + HANDLER lm_uart1, LM3S_IRQ_UART1 /* Vector 22: UART 1 */ + HANDLER lm_ssi0, LM3S_IRQ_SSI0 /* Vector 23: SSI 0 */ + HANDLER lm_i2c0, LM3S_IRQ_I2C0 /* Vector 24: I2C 0 */ + HANDLER lm_pwm0, LM3S_IRQ_PWM0 /* Vector 26: PWM Generator 0 */ + HANDLER lm_adc0, LM3S_IRQ_ADC0 /* Vector 30: ADC Sequence 0 */ + HANDLER lm_adc1, LM3S_IRQ_ADC1 /* Vector 31: ADC Sequence 1 */ + HANDLER lm_adc2, LM3S_IRQ_ADC2 /* Vector 32: ADC Sequence 2 */ + HANDLER lm_adc3, LM3S_IRQ_ADC3 /* Vector 33: ADC Sequence 3 */ + HANDLER lm_wdog, LM3S_IRQ_WDOG /* Vector 34: Watchdog Timer */ + HANDLER lm_tmr0a, LM3S_IRQ_TIMER0A /* Vector 35: Timer 0 A */ + HANDLER lm_tmr0b, LM3S_IRQ_TIMER0B /* Vector 36: Timer 0 B */ + HANDLER lm_tmr1a, LM3S_IRQ_TIMER1A /* Vector 37: Timer 1 A */ + HANDLER lm_tmr1b, LM3S_IRQ_TIMER1B /* Vector 38: Timer 1 B */ + HANDLER lm_tmr2a, LM3S_IRQ_TIMER2A /* Vector 39: Timer 2 A */ + HANDLER lm_tmr2b, LM3S_IRQ_TIMER2B /* Vector 40: Timer 3 B */ + HANDLER lm_cmp0, LM3S_IRQ_COMPARE0 /* Vector 41: Analog Comparator 0 */ + HANDLER lm_cmp1, LM3S_IRQ_COMPARE1 /* Vector 42: Analog Comparator 1 */ + HANDLER lm_syscon, LM3S_IRQ_SYSCON /* Vector 44: System Control */ + HANDLER lm_flashcon, LM3S_IRQ_FLASHCON /* Vector 45: FLASH Control */ + HANDLER lm_gpiof, LM3S_IRQ_GPIOF /* Vector 46: GPIO Port F */ + HANDLER lm_gpiog, LM3S_IRQ_GPIOG /* Vector 47: GPIO Port G */ + HANDLER lm_eth, LM3S_IRQ_ETHCON /* Vector 58: Ethernet Controller */ +#elif defined(CONFIG_ARCH_CHIP_LM3S6965) + HANDLER lm_gpioa, LM3S_IRQ_GPIOA /* Vector 16: GPIO Port A */ + HANDLER lm_gpiob, LM3S_IRQ_GPIOB /* Vector 17: GPIO Port B */ + HANDLER lm_gpioc, LM3S_IRQ_GPIOC /* Vector 18: GPIO Port C */ + HANDLER lm_gpiod, LM3S_IRQ_GPIOD /* Vector 19: GPIO Port D */ + HANDLER lm_gpioe, LM3S_IRQ_GPIOE /* Vector 20: GPIO Port E */ + HANDLER lm_uart0, LM3S_IRQ_UART0 /* Vector 21: UART 0 */ + HANDLER lm_uart1, LM3S_IRQ_UART1 /* Vector 22: UART 1 */ + HANDLER lm_ssi0, LM3S_IRQ_SSI0 /* Vector 23: SSI 0 */ + HANDLER lm_i2c0, LM3S_IRQ_I2C0 /* Vector 24: I2C 0 */ + HANDLER lm_pwmfault, LM3S_IRQ_PWMFAULT /* Vector 25: PWM Fault */ + HANDLER lm_pwm0, LM3S_IRQ_PWM0 /* Vector 26: PWM Generator 0 */ + HANDLER lm_pwm1, LM3S_IRQ_PWM1 /* Vector 27: PWM Generator 1 */ + HANDLER lm_pwm2, LM3S_IRQ_PWM2 /* Vector 28: PWM Generator 2 */ + HANDLER lm_qei0, LM3S_IRQ_QEI0 /* Vector 29: QEI 0 */ + HANDLER lm_adc0, LM3S_IRQ_ADC0 /* Vector 30: ADC Sequence 0 */ + HANDLER lm_adc1, LM3S_IRQ_ADC1 /* Vector 31: ADC Sequence 1 */ + HANDLER lm_adc2, LM3S_IRQ_ADC2 /* Vector 32: ADC Sequence 2 */ + HANDLER lm_adc3, LM3S_IRQ_ADC3 /* Vector 33: ADC Sequence 3 */ + HANDLER lm_wdog, LM3S_IRQ_WDOG /* Vector 34: Watchdog Timer */ + HANDLER lm_tmr0a, LM3S_IRQ_TIMER0A /* Vector 35: Timer 0 A */ + HANDLER lm_tmr0b, LM3S_IRQ_TIMER0B /* Vector 36: Timer 0 B */ + HANDLER lm_tmr1a, LM3S_IRQ_TIMER1A /* Vector 37: Timer 1 A */ + HANDLER lm_tmr1b, LM3S_IRQ_TIMER1B /* Vector 38: Timer 1 B */ + HANDLER lm_tmr2a, LM3S_IRQ_TIMER2A /* Vector 39: Timer 2 A */ + HANDLER lm_tmr2b, LM3S_IRQ_TIMER2B /* Vector 40: Timer 3 B */ + HANDLER lm_cmp0, LM3S_IRQ_COMPARE0 /* Vector 41: Analog Comparator 0 */ + HANDLER lm_cmp1, LM3S_IRQ_COMPARE1 /* Vector 42: Analog Comparator 1 */ + HANDLER lm_syscon, LM3S_IRQ_SYSCON /* Vector 44: System Control */ + HANDLER lm_flashcon, LM3S_IRQ_FLASHCON /* Vector 45: FLASH Control */ + HANDLER lm_gpiof, LM3S_IRQ_GPIOF /* Vector 46: GPIO Port F */ + HANDLER lm_gpiog, LM3S_IRQ_GPIOG /* Vector 47: GPIO Port G */ + HANDLER lm_uart2, LM3S_IRQ_UART1 /* Vector 49: UART 1 */ + HANDLER lm_tmr3a, LM3S_IRQ_TIMER3A /* Vector 51: Timer 3 A */ + HANDLER lm_tmr3b, LM3S_IRQ_TIMER3B /* Vector 52: Timer 3 B */ + HANDLER lm_i2c1, LM3S_IRQ_I2C1 /* Vector 53: I2C 1 */ + HANDLER lm_qei1, LM3S_IRQ_QEI1 /* Vector 54: QEI 1 */ + HANDLER lm_eth, LM3S_IRQ_ETHCON /* Vector 58: Ethernet Controller */ + HANDLER lm_hib, LM3S_IRQ_HIBERNATE /* Vector 59: Hibernation Module */ +#elif defined(CONFIG_ARCH_CHIP_LM3S8962) + HANDLER lm_gpioa, LM3S_IRQ_GPIOA /* Vector 16: GPIO Port A */ + HANDLER lm_gpiob, LM3S_IRQ_GPIOB /* Vector 17: GPIO Port B */ + HANDLER lm_gpioc, LM3S_IRQ_GPIOC /* Vector 18: GPIO Port C */ + HANDLER lm_gpiod, LM3S_IRQ_GPIOD /* Vector 19: GPIO Port D */ + HANDLER lm_gpioe, LM3S_IRQ_GPIOE /* Vector 20: GPIO Port E */ + HANDLER lm_uart0, LM3S_IRQ_UART0 /* Vector 21: UART 0 */ + HANDLER lm_uart1, LM3S_IRQ_UART1 /* Vector 22: UART 1 */ + HANDLER lm_ssi0, LM3S_IRQ_SSI0 /* Vector 23: SSI 0 */ + HANDLER lm_i2c0, LM3S_IRQ_I2C0 /* Vector 24: I2C 0 */ + HANDLER lm_pwmfault, LM3S_IRQ_PWMFAULT /* Vector 25: PWM Fault */ + HANDLER lm_pwm0, LM3S_IRQ_PWM0 /* Vector 26: PWM Generator 0 */ + HANDLER lm_pwm1, LM3S_IRQ_PWM1 /* Vector 27: PWM Generator 1 */ + HANDLER lm_pwm2, LM3S_IRQ_PWM2 /* Vector 28: PWM Generator 2 */ + HANDLER lm_qei0, LM3S_IRQ_QEI0 /* Vector 29: QEI 0 */ + HANDLER lm_adc0, LM3S_IRQ_ADC0 /* Vector 30: ADC Sequence 0 */ + HANDLER lm_adc1, LM3S_IRQ_ADC1 /* Vector 31: ADC Sequence 1 */ + HANDLER lm_adc2, LM3S_IRQ_ADC2 /* Vector 32: ADC Sequence 2 */ + HANDLER lm_adc3, LM3S_IRQ_ADC3 /* Vector 33: ADC Sequence 3 */ + HANDLER lm_wdog, LM3S_IRQ_WDOG /* Vector 34: Watchdog Timer */ + HANDLER lm_tmr0a, LM3S_IRQ_TIMER0A /* Vector 35: Timer 0 A */ + HANDLER lm_tmr0b, LM3S_IRQ_TIMER0B /* Vector 36: Timer 0 B */ + HANDLER lm_tmr1a, LM3S_IRQ_TIMER1A /* Vector 37: Timer 1 A */ + HANDLER lm_tmr1b, LM3S_IRQ_TIMER1B /* Vector 38: Timer 1 B */ + HANDLER lm_tmr2a, LM3S_IRQ_TIMER2A /* Vector 39: Timer 2 A */ + HANDLER lm_tmr2b, LM3S_IRQ_TIMER2B /* Vector 40: Timer 3 B */ + HANDLER lm_cmp0, LM3S_IRQ_COMPARE0 /* Vector 41: Analog Comparator 0 */ + HANDLER lm_syscon, LM3S_IRQ_SYSCON /* Vector 44: System Control */ + HANDLER lm_flashcon, LM3S_IRQ_FLASHCON /* Vector 45: FLASH Control */ + HANDLER lm_gpiof, LM3S_IRQ_GPIOF /* Vector 46: GPIO Port F */ + HANDLER lm_gpiog, LM3S_IRQ_GPIOG /* Vector 47: GPIO Port G */ + HANDLER lm_uart2, LM3S_IRQ_UART1 /* Vector 49: UART 1 */ + HANDLER lm_tmr3a, LM3S_IRQ_TIMER3A /* Vector 51: Timer 3 A */ + HANDLER lm_tmr3b, LM3S_IRQ_TIMER3B /* Vector 52: Timer 3 B */ + HANDLER lm_i2c1, LM3S_IRQ_I2C1 /* Vector 53: I2C 1 */ + HANDLER lm_qei1, LM3S_IRQ_QEI1 /* Vector 54: QEI 1 */ + HANDLER lm_can0, LM3S_IRQ_CAN0 /* Vector 55: CAN 0 */ + HANDLER lm_eth, LM3S_IRQ_ETHCON /* Vector 58: Ethernet Controller */ + HANDLER lm_hib, LM3S_IRQ_HIBERNATE /* Vector 59: Hibernation Module */ +#elif defined(CONFIG_ARCH_CHIP_LM3S9B96) + HANDLER lm_gpioa, LM3S_IRQ_GPIOA /* Vector 16: GPIO Port A */ + HANDLER lm_gpiob, LM3S_IRQ_GPIOB /* Vector 17: GPIO Port B */ + HANDLER lm_gpioc, LM3S_IRQ_GPIOC /* Vector 18: GPIO Port C */ + HANDLER lm_gpiod, LM3S_IRQ_GPIOD /* Vector 19: GPIO Port D */ + HANDLER lm_gpioe, LM3S_IRQ_GPIOE /* Vector 20: GPIO Port E */ + HANDLER lm_uart0, LM3S_IRQ_UART0 /* Vector 21: UART 0 */ + HANDLER lm_uart1, LM3S_IRQ_UART1 /* Vector 22: UART 1 */ + HANDLER lm_ssi0, LM3S_IRQ_SSI0 /* Vector 23: SSI 0 */ + HANDLER lm_i2c0, LM3S_IRQ_I2C0 /* Vector 24: I2C 0 */ + HANDLER lm_pwmfault, LM3S_IRQ_PWMFAULT /* Vector 25: PWM Fault */ + HANDLER lm_pwm0, LM3S_IRQ_PWM0 /* Vector 26: PWM Generator 0 */ + HANDLER lm_pwm1, LM3S_IRQ_PWM1 /* Vector 27: PWM Generator 1 */ + HANDLER lm_pwm2, LM3S_IRQ_PWM2 /* Vector 28: PWM Generator 2 */ + HANDLER lm_qei0, LM3S_IRQ_QEI0 /* Vector 29: QEI 0 */ + HANDLER lm_adc0, LM3S_IRQ_ADC0 /* Vector 30: ADC Sequence 0 */ + HANDLER lm_adc1, LM3S_IRQ_ADC1 /* Vector 31: ADC Sequence 1 */ + HANDLER lm_adc2, LM3S_IRQ_ADC2 /* Vector 32: ADC Sequence 2 */ + HANDLER lm_adc3, LM3S_IRQ_ADC3 /* Vector 33: ADC Sequence 3 */ + HANDLER lm_wdog, LM3S_IRQ_WDOG /* Vector 34: Watchdog Timer */ + HANDLER lm_tmr0a, LM3S_IRQ_TIMER0A /* Vector 35: Timer 0 A */ + HANDLER lm_tmr0b, LM3S_IRQ_TIMER0B /* Vector 36: Timer 0 B */ + HANDLER lm_tmr1a, LM3S_IRQ_TIMER1A /* Vector 37: Timer 1 A */ + HANDLER lm_tmr1b, LM3S_IRQ_TIMER1B /* Vector 38: Timer 1 B */ + HANDLER lm_tmr2a, LM3S_IRQ_TIMER2A /* Vector 39: Timer 2 A */ + HANDLER lm_tmr2b, LM3S_IRQ_TIMER2B /* Vector 40: Timer 3 B */ + HANDLER lm_cmp0, LM3S_IRQ_COMPARE0 /* Vector 41: Analog Comparator 0 */ + HANDLER lm_cmp1, LM3S_IRQ_COMPARE1 /* Vector 42: Analog Comparator 1 */ + HANDLER lm_cmp2, LM3S_IRQ_COMPARE2 /* Vector 43: Analog Comparator 2 */ + HANDLER lm_syscon, LM3S_IRQ_SYSCON /* Vector 44: System Control */ + HANDLER lm_flashcon, LM3S_IRQ_FLASHCON /* Vector 45: FLASH Control */ + HANDLER lm_gpiof, LM3S_IRQ_GPIOF /* Vector 46: GPIO Port F */ + HANDLER lm_gpiog, LM3S_IRQ_GPIOG /* Vector 47: GPIO Port G */ + HANDLER lm_gpioh, LM3S_IRQ_GPIOH /* Vector 48: GPIO Port H */ + HANDLER lm_uart2, LM3S_IRQ_UART2 /* Vector 49: UART 2 */ + HANDLER lm_ssi1, LM3S_IRQ_SSI1 /* Vector 50: GPIO Port H */ + HANDLER lm_tmr3a, LM3S_IRQ_TIMER3A /* Vector 51: Timer 3 A */ + HANDLER lm_tmr3b, LM3S_IRQ_TIMER3B /* Vector 52: Timer 3 B */ + HANDLER lm_i2c1, LM3S_IRQ_I2C1 /* Vector 53: I2C 1 */ + HANDLER lm_qei1, LM3S_IRQ_QEI1 /* Vector 54: QEI 1 */ + HANDLER lm_can0, LM3S_IRQ_CAN0 /* Vector 55: CAN 0 */ + HANDLER lm_can1, LM3S_IRQ_CAN1 /* Vector 56: CAN 1 */ + HANDLER lm_eth, LM3S_IRQ_ETHCON /* Vector 58: Ethernet Controller */ + HANDLER lm_usb, LM3S_IRQ_USB /* Vector 60: USB */ + HANDLER lm_pwm3, LM3S_IRQ_PWM3 /* Vector 61: PWM 3 */ + HANDLER lm_udmasoft, LM3S_IRQ_UDMASOFT /* Vector 62: uDMA Software */ + HANDLER lm_udmaerror, LM3S_IRQ_UDMAERROR /* Vector 63: uDMA Error */ + HANDLER lm_adc1_0, LM3S_IRQ_ADC1_0 /* Vector 64: ADC1 Sequence 0 */ + HANDLER lm_adc1_1, LM3S_IRQ_ADC1_1 /* Vector 65: ADC1 Sequence 1 */ + HANDLER lm_adc1_2, LM3S_IRQ_ADC1_2 /* Vector 66: ADC1 Sequence 2 */ + HANDLER lm_adc1_3, LM3S_IRQ_ADC1_3 /* Vector 67: ADC1 Sequence 3 */ + HANDLER lm_i2s0, LM3S_IRQ_I2S0 /* Vector 68: I2S 0 */ + HANDLER lm_epi, LM3S_IRQ_EPI /* Vector 69: EPI */ + HANDLER lm_gpioj, LM3S_IRQ_GPIOJ /* Vector 70: GPIO Port J */ +#else +# error "Vectors not specified for this LM3S chip" +#endif + +/* Common IRQ handling logic. On entry here, the return stack is on either + * the PSP or the MSP and looks like the following: + * + * REG_XPSR + * REG_R15 + * REG_R14 + * REG_R12 + * REG_R3 + * REG_R2 + * REG_R1 + * MSP->REG_R0 + * + * And + * R0 contains the IRQ number + * R14 Contains the EXC_RETURN value + * We are in handler mode and the current SP is the MSP + */ + +lm_irqcommon: + + /* Complete the context save */ + +#ifdef CONFIG_NUTTX_KERNEL + /* The EXC_RETURN value will be 0xfffffff9 (privileged thread) or 0xfffffff1 + * (handler mode) if the state is on the MSP. It can only be on the PSP if + * EXC_RETURN is 0xfffffffd (unprivileged thread) + */ + + adds r2, r14, #3 /* If R14=0xfffffffd, then r2 == 0 */ + ite ne /* Next two instructions are condition */ + mrsne r1, msp /* R1=The main stack pointer */ + mrseq r1, psp /* R1=The process stack pointer */ +#else + mrs r1, msp /* R1=The main stack pointer */ +#endif + + mov r2, r1 /* R2=Copy of the main/process stack pointer */ + add r2, #HW_XCPT_SIZE /* R2=MSP/PSP before the interrupt was taken */ + mrs r3, primask /* R3=Current PRIMASK setting */ +#ifdef CONFIG_NUTTX_KERNEL + stmdb r1!, {r2-r11,r14} /* Save the remaining registers plus the SP value */ +#else + stmdb r1!, {r2-r11} /* Save the remaining registers plus the SP value */ +#endif + + /* Disable interrupts, select the stack to use for interrupt handling + * and call up_doirq to handle the interrupt + */ + + cpsid i /* Disable further interrupts */ + + /* If CONFIG_ARCH_INTERRUPTSTACK is defined, we will use a special interrupt + * stack pointer. The way that this is done here prohibits nested interrupts! + * Otherwise, we will re-use the main stack for interrupt level processing. + */ + +#if CONFIG_ARCH_INTERRUPTSTACK > 3 + ldr sp, =g_intstackbase + str r1, [sp, #-4]! /* Save the MSP on the interrupt stack */ + bl up_doirq /* R0=IRQ, R1=register save (msp) */ + ldr r1, [sp, #+4]! /* Recover R1=main stack pointer */ +#else + mov sp, r1 /* We are using the main stack pointer */ + bl up_doirq /* R0=IRQ, R1=register save (msp) */ + mov r1, sp /* Recover R1=main stack pointer */ +#endif + + /* On return from up_doirq, R0 will hold a pointer to register context + * array to use for the interrupt return. If that return value is the same + * as current stack pointer, then things are relatively easy. + */ + + cmp r0, r1 /* Context switch? */ + beq 1f /* Branch if no context switch */ + + /* We are returning with a pending context switch. This case is different + * because in this case, the register save structure does not lie on the + * stack but, rather, are within a TCB structure. We'll have to copy some + * values to the stack. + */ + + add r1, r0, #SW_XCPT_SIZE /* R1=Address of HW save area in reg array */ + ldmia r1, {r4-r11} /* Fetch eight registers in HW save area */ + ldr r1, [r0, #(4*REG_SP)] /* R1=Value of SP before interrupt */ + stmdb r1!, {r4-r11} /* Store eight registers in HW save area */ +#ifdef CONFIG_NUTTX_KERNEL + ldmia r0, {r2-r11,r14} /* Recover R4-R11, r14 + 2 temp values */ +#else + ldmia r0, {r2-r11} /* Recover R4-R11 + 2 temp values */ +#endif + b 2f /* Re-join common logic */ + + /* We are returning with no context switch. We simply need to "unwind" + * the same stack frame that we created + */ +1: +#ifdef CONFIG_NUTTX_KERNEL + ldmia r1!, {r2-r11,r14} /* Recover R4-R11, r14 + 2 temp values */ +#else + ldmia r1!, {r2-r11} /* Recover R4-R11 + 2 temp values */ +#endif +2: +#ifdef CONFIG_NUTTX_KERNEL + /* The EXC_RETURN value will be 0xfffffff9 (privileged thread) or 0xfffffff1 + * (handler mode) if the state is on the MSP. It can only be on the PSP if + * EXC_RETURN is 0xfffffffd (unprivileged thread) + */ + + adds r0, r14, #3 /* If R14=0xfffffffd, then r0 == 0 */ + ite ne /* Next two instructions are condition */ + msrne msp, r1 /* R1=The main stack pointer */ + msreq psp, r1 /* R1=The process stack pointer */ +#else + msr msp, r1 /* Recover the return MSP value */ + + /* Preload r14 with the special return value first (so that the return + * actually occurs with interrupts still disabled). + */ + + ldr r14, =EXC_RETURN /* Load the special value */ +#endif + + /* Restore the interrupt state */ + + msr primask, r3 /* Restore interrupts */ + + /* Always return with R14 containing the special value that will: (1) + * return to thread mode, and (2) continue to use the MSP + */ + + bx r14 /* And return */ + .size handlers, .-handlers + +/************************************************************************************ + * Name: up_interruptstack/g_intstackbase + * + * Description: + * Shouldn't happen + * + ************************************************************************************/ + +#if CONFIG_ARCH_INTERRUPTSTACK > 3 + .bss + .global g_intstackbase + .align 4 +up_interruptstack: + .skip (CONFIG_ARCH_INTERRUPTSTACK & ~3) +g_intstackbase: + .size up_interruptstack, .-up_interruptstack +#endif + +/************************************************************************************ + * .rodata + ************************************************************************************/ + + .section .rodata, "a" + +/* Variables: _sbss is the start of the BSS region (see ld.script) _ebss is the end + * of the BSS regsion (see ld.script). The idle task stack starts at the end of BSS + * and is of size CONFIG_IDLETHREAD_STACKSIZE. The IDLE thread is the thread that + * the system boots on and, eventually, becomes the idle, do nothing task that runs + * only when there is nothing else to run. The heap continues from there until the + * end of memory. See g_heapbase below. + */ + + .globl g_heapbase + .type g_heapbase, object +g_heapbase: + .long _ebss+CONFIG_IDLETHREAD_STACKSIZE + .size g_heapbase, .-g_heapbase + + .end diff --git a/nuttx/configs/eagle100/README.txt b/nuttx/configs/eagle100/README.txt index 3f9da652b4..378f5a25bb 100644 --- a/nuttx/configs/eagle100/README.txt +++ b/nuttx/configs/eagle100/README.txt @@ -334,15 +334,15 @@ Eagle100-specific Configuration Options Additional interrupt support can be disabled if desired to reduce memory footprint. - CONFIG_LM3S_DISABLE_GPIOA_IRQS=n - CONFIG_LM3S_DISABLE_GPIOB_IRQS=n - CONFIG_LM3S_DISABLE_GPIOC_IRQS=n - CONFIG_LM3S_DISABLE_GPIOD_IRQS=n - CONFIG_LM3S_DISABLE_GPIOE_IRQS=n - CONFIG_LM3S_DISABLE_GPIOF_IRQS=n - CONFIG_LM3S_DISABLE_GPIOG_IRQS=n - CONFIG_LM3S_DISABLE_GPIOH_IRQS=y - CONFIG_LM3S_DISABLE_GPIOJ_IRQS=y + CONFIG_LM_DISABLE_GPIOA_IRQS=n + CONFIG_LM_DISABLE_GPIOB_IRQS=n + CONFIG_LM_DISABLE_GPIOC_IRQS=n + CONFIG_LM_DISABLE_GPIOD_IRQS=n + CONFIG_LM_DISABLE_GPIOE_IRQS=n + CONFIG_LM_DISABLE_GPIOF_IRQS=n + CONFIG_LM_DISABLE_GPIOG_IRQS=n + CONFIG_LM_DISABLE_GPIOH_IRQS=y + CONFIG_LM_DISABLE_GPIOJ_IRQS=y LM3S6818 specific device driver settings @@ -367,18 +367,18 @@ Eagle100-specific Configuration Options value is large, then larger values of this setting may cause Rx FIFO overrun errors. Default: half of the Tx FIFO size (4). - CONFIG_LM3S_ETHERNET - This must be set (along with CONFIG_NET) + CONFIG_LM_ETHERNET - This must be set (along with CONFIG_NET) to build the LM3S Ethernet driver - CONFIG_LM3S_ETHLEDS - Enable to use Ethernet LEDs on the board. - CONFIG_LM3S_BOARDMAC - If the board-specific logic can provide + CONFIG_LM_ETHLEDS - Enable to use Ethernet LEDs on the board. + CONFIG_LM_BOARDMAC - If the board-specific logic can provide a MAC address (via lm_ethernetmac()), then this should be selected. - CONFIG_LM3S_ETHHDUPLEX - Set to force half duplex operation - CONFIG_LM3S_ETHNOAUTOCRC - Set to suppress auto-CRC generation - CONFIG_LM3S_ETHNOPAD - Set to suppress Tx padding - CONFIG_LM3S_MULTICAST - Set to enable multicast frames - CONFIG_LM3S_PROMISCUOUS - Set to enable promiscuous mode - CONFIG_LM3S_BADCRC - Set to enable bad CRC rejection. - CONFIG_LM3S_DUMPPACKET - Dump each packet received/sent to the console. + CONFIG_LM_ETHHDUPLEX - Set to force half duplex operation + CONFIG_LM_ETHNOAUTOCRC - Set to suppress auto-CRC generation + CONFIG_LM_ETHNOPAD - Set to suppress Tx padding + CONFIG_LM_MULTICAST - Set to enable multicast frames + CONFIG_LM_PROMISCUOUS - Set to enable promiscuous mode + CONFIG_LM_BADCRC - Set to enable bad CRC rejection. + CONFIG_LM_DUMPPACKET - Dump each packet received/sent to the console. Configurations ^^^^^^^^^^^^^^ diff --git a/nuttx/configs/eagle100/httpd/defconfig b/nuttx/configs/eagle100/httpd/defconfig index cf4f979304..bd0ac7664d 100644 --- a/nuttx/configs/eagle100/httpd/defconfig +++ b/nuttx/configs/eagle100/httpd/defconfig @@ -58,21 +58,21 @@ CONFIG_ARCH_CALIBRATION=n # Disable support for interrupts on GPIOJ which does not # exist on the LM3S6918. Additional interrupt support can be # disabled if desired to reduce memory footprint. -CONFIG_LM3S_DISABLE_GPIOA_IRQS=n -CONFIG_LM3S_DISABLE_GPIOB_IRQS=n -CONFIG_LM3S_DISABLE_GPIOC_IRQS=n -CONFIG_LM3S_DISABLE_GPIOD_IRQS=n -CONFIG_LM3S_DISABLE_GPIOE_IRQS=n -CONFIG_LM3S_DISABLE_GPIOF_IRQS=n -CONFIG_LM3S_DISABLE_GPIOG_IRQS=n -CONFIG_LM3S_DISABLE_GPIOH_IRQS=n -CONFIG_LM3S_DISABLE_GPIOJ_IRQS=y +CONFIG_LM_DISABLE_GPIOA_IRQS=n +CONFIG_LM_DISABLE_GPIOB_IRQS=n +CONFIG_LM_DISABLE_GPIOC_IRQS=n +CONFIG_LM_DISABLE_GPIOD_IRQS=n +CONFIG_LM_DISABLE_GPIOE_IRQS=n +CONFIG_LM_DISABLE_GPIOF_IRQS=n +CONFIG_LM_DISABLE_GPIOG_IRQS=n +CONFIG_LM_DISABLE_GPIOH_IRQS=n +CONFIG_LM_DISABLE_GPIOJ_IRQS=y # # LM3S6918 specific serial device driver settings # -CONFIG_LM3S_UART0=y -CONFIG_LM3S_UART1=n +CONFIG_LM_UART0=y +CONFIG_LM_UART1=n CONFIG_UART0_SERIAL_CONSOLE=y CONFIG_UART1_SERIAL_CONSOLE=n CONFIG_UART0_TXBUFSIZE=256 @@ -99,16 +99,16 @@ CONFIG_SSI_POLLWAIT=y # # LM3S6918 specific serial device driver settings # -CONFIG_LM3S_ETHERNET=y -CONFIG_LM3S_ETHLEDS=n -CONFIG_LM3S_BOARDMAC=y -CONFIG_LM3S_ETHHDUPLEX=n -CONFIG_LM3S_ETHNOAUTOCRC=n -CONFIG_LM3S_ETHNOPAD=n -CONFIG_LM3S_MULTICAST=n -CONFIG_LM3S_PROMISCUOUS=n -CONFIG_LM3S_BADCRC=n -CONFIG_LM3S_DUMPPACKET=n +CONFIG_LM_ETHERNET=y +CONFIG_LM_ETHLEDS=n +CONFIG_LM_BOARDMAC=y +CONFIG_LM_ETHHDUPLEX=n +CONFIG_LM_ETHNOAUTOCRC=n +CONFIG_LM_ETHNOPAD=n +CONFIG_LM_MULTICAST=n +CONFIG_LM_PROMISCUOUS=n +CONFIG_LM_BADCRC=n +CONFIG_LM_DUMPPACKET=n # # General build options diff --git a/nuttx/configs/eagle100/include/board.h b/nuttx/configs/eagle100/include/board.h index 40a12327fb..597f801acc 100644 --- a/nuttx/configs/eagle100/include/board.h +++ b/nuttx/configs/eagle100/include/board.h @@ -112,7 +112,7 @@ #ifndef __ASSEMBLY__ /************************************************************************************ - * Name: lm3s_boardinitialize + * Name: lm_boardinitialize * * Description: * All LM3S architectures must provide the following entry point. This entry point @@ -121,21 +121,21 @@ * ************************************************************************************/ -extern void lm3s_boardinitialize(void); +extern void lm_boardinitialize(void); /************************************************************************************ - * Name: lm3s_ethernetmac + * Name: lm_ethernetmac * * Description: * For the Ethernet Eval Kits, the MAC address will be stored in the non-volatile - * USER0 and USER1 registers. If CONFIG_LM3S_BOARDMAC is defined, this function + * USER0 and USER1 registers. If CONFIG_LM_BOARDMAC is defined, this function * will obtain the MAC address from these registers. * ************************************************************************************/ -#ifdef CONFIG_LM3S_BOARDMAC +#ifdef CONFIG_LM_BOARDMAC struct ether_addr; -extern void lm3s_ethernetmac(struct ether_addr *ethaddr); +extern void lm_ethernetmac(struct ether_addr *ethaddr); #endif #endif /* __ASSEMBLY__ */ diff --git a/nuttx/configs/eagle100/nettest/defconfig b/nuttx/configs/eagle100/nettest/defconfig index a3b50ead6b..9b1f616c6e 100644 --- a/nuttx/configs/eagle100/nettest/defconfig +++ b/nuttx/configs/eagle100/nettest/defconfig @@ -58,21 +58,21 @@ CONFIG_ARCH_CALIBRATION=n # Disable support for interrupts on GPIOJ which does not # exist on the LM3S6918. Additional interrupt support can be # disabled if desired to reduce memory footprint. -CONFIG_LM3S_DISABLE_GPIOA_IRQS=n -CONFIG_LM3S_DISABLE_GPIOB_IRQS=n -CONFIG_LM3S_DISABLE_GPIOC_IRQS=n -CONFIG_LM3S_DISABLE_GPIOD_IRQS=n -CONFIG_LM3S_DISABLE_GPIOE_IRQS=n -CONFIG_LM3S_DISABLE_GPIOF_IRQS=n -CONFIG_LM3S_DISABLE_GPIOG_IRQS=n -CONFIG_LM3S_DISABLE_GPIOH_IRQS=n -CONFIG_LM3S_DISABLE_GPIOJ_IRQS=y +CONFIG_LM_DISABLE_GPIOA_IRQS=n +CONFIG_LM_DISABLE_GPIOB_IRQS=n +CONFIG_LM_DISABLE_GPIOC_IRQS=n +CONFIG_LM_DISABLE_GPIOD_IRQS=n +CONFIG_LM_DISABLE_GPIOE_IRQS=n +CONFIG_LM_DISABLE_GPIOF_IRQS=n +CONFIG_LM_DISABLE_GPIOG_IRQS=n +CONFIG_LM_DISABLE_GPIOH_IRQS=n +CONFIG_LM_DISABLE_GPIOJ_IRQS=y # # LM3S6918 specific serial device driver settings # -CONFIG_LM3S_UART0=y -CONFIG_LM3S_UART1=n +CONFIG_LM_UART0=y +CONFIG_LM_UART1=n CONFIG_UART0_SERIAL_CONSOLE=y CONFIG_UART1_SERIAL_CONSOLE=n CONFIG_UART0_TXBUFSIZE=256 @@ -99,16 +99,16 @@ CONFIG_SSI_POLLWAIT=y # # LM3S6918 specific serial device driver settings # -CONFIG_LM3S_ETHERNET=y -CONFIG_LM3S_ETHLEDS=n -CONFIG_LM3S_BOARDMAC=y -CONFIG_LM3S_ETHHDUPLEX=n -CONFIG_LM3S_ETHNOAUTOCRC=n -CONFIG_LM3S_ETHNOPAD=n -CONFIG_LM3S_MULTICAST=n -CONFIG_LM3S_PROMISCUOUS=n -CONFIG_LM3S_BADCRC=n -CONFIG_LM3S_DUMPPACKET=n +CONFIG_LM_ETHERNET=y +CONFIG_LM_ETHLEDS=n +CONFIG_LM_BOARDMAC=y +CONFIG_LM_ETHHDUPLEX=n +CONFIG_LM_ETHNOAUTOCRC=n +CONFIG_LM_ETHNOPAD=n +CONFIG_LM_MULTICAST=n +CONFIG_LM_PROMISCUOUS=n +CONFIG_LM_BADCRC=n +CONFIG_LM_DUMPPACKET=n # # General build options diff --git a/nuttx/configs/eagle100/nsh/defconfig b/nuttx/configs/eagle100/nsh/defconfig index 342023d6a0..079bbc60e3 100644 --- a/nuttx/configs/eagle100/nsh/defconfig +++ b/nuttx/configs/eagle100/nsh/defconfig @@ -58,21 +58,21 @@ CONFIG_ARCH_CALIBRATION=n # Disable support for interrupts on GPIOJ which does not # exist on the LM3S6918. Additional interrupt support can be # disabled if desired to reduce memory footprint. -CONFIG_LM3S_DISABLE_GPIOA_IRQS=n -CONFIG_LM3S_DISABLE_GPIOB_IRQS=n -CONFIG_LM3S_DISABLE_GPIOC_IRQS=n -CONFIG_LM3S_DISABLE_GPIOD_IRQS=n -CONFIG_LM3S_DISABLE_GPIOE_IRQS=n -CONFIG_LM3S_DISABLE_GPIOF_IRQS=n -CONFIG_LM3S_DISABLE_GPIOG_IRQS=n -CONFIG_LM3S_DISABLE_GPIOH_IRQS=n -CONFIG_LM3S_DISABLE_GPIOJ_IRQS=y +CONFIG_LM_DISABLE_GPIOA_IRQS=n +CONFIG_LM_DISABLE_GPIOB_IRQS=n +CONFIG_LM_DISABLE_GPIOC_IRQS=n +CONFIG_LM_DISABLE_GPIOD_IRQS=n +CONFIG_LM_DISABLE_GPIOE_IRQS=n +CONFIG_LM_DISABLE_GPIOF_IRQS=n +CONFIG_LM_DISABLE_GPIOG_IRQS=n +CONFIG_LM_DISABLE_GPIOH_IRQS=n +CONFIG_LM_DISABLE_GPIOJ_IRQS=y # # LM3S6918 specific serial device driver settings # -CONFIG_LM3S_UART0=y -CONFIG_LM3S_UART1=n +CONFIG_LM_UART0=y +CONFIG_LM_UART1=n CONFIG_UART0_SERIAL_CONSOLE=y CONFIG_UART1_SERIAL_CONSOLE=n CONFIG_UART0_TXBUFSIZE=256 @@ -99,16 +99,16 @@ CONFIG_SSI_POLLWAIT=y # # LM3S6918 specific serial device driver settings # -CONFIG_LM3S_ETHERNET=y -CONFIG_LM3S_ETHLEDS=n -CONFIG_LM3S_BOARDMAC=y -CONFIG_LM3S_ETHHDUPLEX=n -CONFIG_LM3S_ETHNOAUTOCRC=n -CONFIG_LM3S_ETHNOPAD=n -CONFIG_LM3S_MULTICAST=n -CONFIG_LM3S_PROMISCUOUS=n -CONFIG_LM3S_BADCRC=n -CONFIG_LM3S_DUMPPACKET=n +CONFIG_LM_ETHERNET=y +CONFIG_LM_ETHLEDS=n +CONFIG_LM_BOARDMAC=y +CONFIG_LM_ETHHDUPLEX=n +CONFIG_LM_ETHNOAUTOCRC=n +CONFIG_LM_ETHNOPAD=n +CONFIG_LM_MULTICAST=n +CONFIG_LM_PROMISCUOUS=n +CONFIG_LM_BADCRC=n +CONFIG_LM_DUMPPACKET=n # # General build options diff --git a/nuttx/configs/eagle100/nxflat/defconfig b/nuttx/configs/eagle100/nxflat/defconfig index fe02ab4b92..110f906cbe 100644 --- a/nuttx/configs/eagle100/nxflat/defconfig +++ b/nuttx/configs/eagle100/nxflat/defconfig @@ -58,21 +58,21 @@ CONFIG_ARCH_CALIBRATION=n # Disable support for interrupts on GPIOJ which does not # exist on the LM3S6918. Additional interrupt support can be # disabled if desired to reduce memory footprint. -CONFIG_LM3S_DISABLE_GPIOA_IRQS=n -CONFIG_LM3S_DISABLE_GPIOB_IRQS=n -CONFIG_LM3S_DISABLE_GPIOC_IRQS=n -CONFIG_LM3S_DISABLE_GPIOD_IRQS=n -CONFIG_LM3S_DISABLE_GPIOE_IRQS=n -CONFIG_LM3S_DISABLE_GPIOF_IRQS=n -CONFIG_LM3S_DISABLE_GPIOG_IRQS=n -CONFIG_LM3S_DISABLE_GPIOH_IRQS=n -CONFIG_LM3S_DISABLE_GPIOJ_IRQS=y +CONFIG_LM_DISABLE_GPIOA_IRQS=n +CONFIG_LM_DISABLE_GPIOB_IRQS=n +CONFIG_LM_DISABLE_GPIOC_IRQS=n +CONFIG_LM_DISABLE_GPIOD_IRQS=n +CONFIG_LM_DISABLE_GPIOE_IRQS=n +CONFIG_LM_DISABLE_GPIOF_IRQS=n +CONFIG_LM_DISABLE_GPIOG_IRQS=n +CONFIG_LM_DISABLE_GPIOH_IRQS=n +CONFIG_LM_DISABLE_GPIOJ_IRQS=y # # LM3S6918 specific serial device driver settings # -CONFIG_LM3S_UART0=y -CONFIG_LM3S_UART1=n +CONFIG_LM_UART0=y +CONFIG_LM_UART1=n CONFIG_UART0_SERIAL_CONSOLE=y CONFIG_UART1_SERIAL_CONSOLE=n CONFIG_UART0_TXBUFSIZE=256 @@ -99,16 +99,16 @@ CONFIG_SSI_POLLWAIT=y # # LM3S6918 specific serial device driver settings # -CONFIG_LM3S_ETHERNET=n -CONFIG_LM3S_ETHLEDS=n -CONFIG_LM3S_BOARDMAC=y -CONFIG_LM3S_ETHHDUPLEX=n -CONFIG_LM3S_ETHNOAUTOCRC=n -CONFIG_LM3S_ETHNOPAD=n -CONFIG_LM3S_MULTICAST=n -CONFIG_LM3S_PROMISCUOUS=n -CONFIG_LM3S_BADCRC=n -CONFIG_LM3S_DUMPPACKET=n +CONFIG_LM_ETHERNET=n +CONFIG_LM_ETHLEDS=n +CONFIG_LM_BOARDMAC=y +CONFIG_LM_ETHHDUPLEX=n +CONFIG_LM_ETHNOAUTOCRC=n +CONFIG_LM_ETHNOPAD=n +CONFIG_LM_MULTICAST=n +CONFIG_LM_PROMISCUOUS=n +CONFIG_LM_BADCRC=n +CONFIG_LM_DUMPPACKET=n # # General build options diff --git a/nuttx/configs/eagle100/ostest/defconfig b/nuttx/configs/eagle100/ostest/defconfig index 52496c4a32..6d3b4ddad0 100644 --- a/nuttx/configs/eagle100/ostest/defconfig +++ b/nuttx/configs/eagle100/ostest/defconfig @@ -58,21 +58,21 @@ CONFIG_ARCH_CALIBRATION=n # Disable support for interrupts on GPIOJ which does not # exist on the LM3S6918. Additional interrupt support can be # disabled if desired to reduce memory footprint. -CONFIG_LM3S_DISABLE_GPIOA_IRQS=n -CONFIG_LM3S_DISABLE_GPIOB_IRQS=n -CONFIG_LM3S_DISABLE_GPIOC_IRQS=n -CONFIG_LM3S_DISABLE_GPIOD_IRQS=n -CONFIG_LM3S_DISABLE_GPIOE_IRQS=n -CONFIG_LM3S_DISABLE_GPIOF_IRQS=n -CONFIG_LM3S_DISABLE_GPIOG_IRQS=n -CONFIG_LM3S_DISABLE_GPIOH_IRQS=n -CONFIG_LM3S_DISABLE_GPIOJ_IRQS=y +CONFIG_LM_DISABLE_GPIOA_IRQS=n +CONFIG_LM_DISABLE_GPIOB_IRQS=n +CONFIG_LM_DISABLE_GPIOC_IRQS=n +CONFIG_LM_DISABLE_GPIOD_IRQS=n +CONFIG_LM_DISABLE_GPIOE_IRQS=n +CONFIG_LM_DISABLE_GPIOF_IRQS=n +CONFIG_LM_DISABLE_GPIOG_IRQS=n +CONFIG_LM_DISABLE_GPIOH_IRQS=n +CONFIG_LM_DISABLE_GPIOJ_IRQS=y # # LM3S6918 specific serial device driver settings # -CONFIG_LM3S_UART0=y -CONFIG_LM3S_UART1=n +CONFIG_LM_UART0=y +CONFIG_LM_UART1=n CONFIG_UART0_SERIAL_CONSOLE=y CONFIG_UART1_SERIAL_CONSOLE=n CONFIG_UART0_TXBUFSIZE=256 @@ -99,16 +99,16 @@ CONFIG_SSI_POLLWAIT=y # # LM3S6918 specific serial device driver settings # -CONFIG_LM3S_ETHERNET=n -CONFIG_LM3S_ETHLEDS=n -CONFIG_LM3S_BOARDMAC=y -CONFIG_LM3S_ETHHDUPLEX=n -CONFIG_LM3S_ETHNOAUTOCRC=n -CONFIG_LM3S_ETHNOPAD=n -CONFIG_LM3S_MULTICAST=n -CONFIG_LM3S_PROMISCUOUS=n -CONFIG_LM3S_BADCRC=n -CONFIG_LM3S_DUMPPACKET=n +CONFIG_LM_ETHERNET=n +CONFIG_LM_ETHLEDS=n +CONFIG_LM_BOARDMAC=y +CONFIG_LM_ETHHDUPLEX=n +CONFIG_LM_ETHNOAUTOCRC=n +CONFIG_LM_ETHNOPAD=n +CONFIG_LM_MULTICAST=n +CONFIG_LM_PROMISCUOUS=n +CONFIG_LM_BADCRC=n +CONFIG_LM_DUMPPACKET=n # # General build options diff --git a/nuttx/configs/eagle100/src/eagle100_internal.h b/nuttx/configs/eagle100/src/eagle100_internal.h index d8bcd6a810..8a76e2eb54 100644 --- a/nuttx/configs/eagle100/src/eagle100_internal.h +++ b/nuttx/configs/eagle100/src/eagle100_internal.h @@ -81,14 +81,14 @@ #ifndef __ASSEMBLY__ /************************************************************************************ - * Name: lm3s_ssiinitialize + * Name: lm_ssiinitialize * * Description: * Called to configure SPI chip select GPIO pins for the Eagle100 board. * ************************************************************************************/ -extern void weak_function lm3s_ssiinitialize(void); +extern void weak_function lm_ssiinitialize(void); /**************************************************************************** * Name: up_ledinit diff --git a/nuttx/configs/eagle100/src/up_boot.c b/nuttx/configs/eagle100/src/up_boot.c index 44f003e0b0..8fed389f81 100644 --- a/nuttx/configs/eagle100/src/up_boot.c +++ b/nuttx/configs/eagle100/src/up_boot.c @@ -60,7 +60,7 @@ ************************************************************************************/ /************************************************************************************ - * Name: lm3s_boardinitialize + * Name: lm_boardinitialize * * Description: * All LM3S architectures must provide the following entry point. This entry point @@ -68,18 +68,18 @@ * and mapped but before any devices have been initialized. ************************************************************************************/ -void lm3s_boardinitialize(void) +void lm_boardinitialize(void) { /* Configure SPI chip selects if 1) SSI is not disabled, and 2) the weak function - * lm3s_ssiinitialize() has been brought into the link. + * lm_ssiinitialize() has been brought into the link. */ /* The Eagle100 microSD CS is on SSI0 */ #if !defined(CONFIG_SSI0_DISABLE) /* || !defined(CONFIG_SSI1_DISABLE) */ - if (lm3s_ssiinitialize) + if (lm_ssiinitialize) { - lm3s_ssiinitialize(); + lm_ssiinitialize(); } #endif diff --git a/nuttx/configs/eagle100/src/up_ethernet.c b/nuttx/configs/eagle100/src/up_ethernet.c index a071fcca9a..42876b3b5a 100644 --- a/nuttx/configs/eagle100/src/up_ethernet.c +++ b/nuttx/configs/eagle100/src/up_ethernet.c @@ -63,17 +63,17 @@ ************************************************************************************/ /************************************************************************************ - * Name: lm3s_ethernetmac + * Name: lm_ethernetmac * * Description: * For the Ethernet Eval Kits, the MAC address will be stored in the non-volatile - * USER0 and USER1 registers. If CONFIG_LM3S_BOARDMAC is defined, this function + * USER0 and USER1 registers. If CONFIG_LM_BOARDMAC is defined, this function * will obtain the MAC address from these registers. * ************************************************************************************/ -#ifdef CONFIG_LM3S_BOARDMAC -void lm3s_ethernetmac(struct ether_addr *ethaddr) +#ifdef CONFIG_LM_BOARDMAC +void lm_ethernetmac(struct ether_addr *ethaddr) { uint32_t user0; uint32_t user1; diff --git a/nuttx/configs/eagle100/src/up_leds.c b/nuttx/configs/eagle100/src/up_leds.c index 0124b964bd..5566b58b24 100644 --- a/nuttx/configs/eagle100/src/up_leds.c +++ b/nuttx/configs/eagle100/src/up_leds.c @@ -72,7 +72,7 @@ /* Dump GPIO registers */ #ifdef LED_DEBUG -# define led_dumpgpio(m) lm3s_dumpgpio(LED_GPIO, m) +# define led_dumpgpio(m) lm_dumpgpio(LED_GPIO, m) #else # define led_dumpgpio(m) #endif @@ -106,9 +106,9 @@ void up_ledinit(void) /* Configure Port E, Bit 1 as an output, initial value=OFF */ - led_dumpgpio("up_ledinit before lm3s_configgpio()"); - lm3s_configgpio(LED_GPIO); - led_dumpgpio("up_ledinit after lm3s_configgpio()"); + led_dumpgpio("up_ledinit before lm_configgpio()"); + lm_configgpio(LED_GPIO); + led_dumpgpio("up_ledinit after lm_configgpio()"); g_nest = 0; } @@ -132,9 +132,9 @@ void up_ledon(int led) g_nest++; case LED_IRQSENABLED: case LED_STACKCREATED: - led_dumpgpio("up_ledon: before lm3s_gpiowrite()"); - lm3s_gpiowrite(LED_GPIO, false); - led_dumpgpio("up_ledon: after lm3s_gpiowrite()"); + led_dumpgpio("up_ledon: before lm_gpiowrite()"); + lm_gpiowrite(LED_GPIO, false); + led_dumpgpio("up_ledon: after lm_gpiowrite()"); break; } } @@ -160,9 +160,9 @@ void up_ledoff(int led) case LED_PANIC: if (--g_nest <= 0) { - led_dumpgpio("up_ledoff: before lm3s_gpiowrite()"); - lm3s_gpiowrite(LED_GPIO, true); - led_dumpgpio("up_ledoff: after lm3s_gpiowrite()"); + led_dumpgpio("up_ledoff: before lm_gpiowrite()"); + lm_gpiowrite(LED_GPIO, true); + led_dumpgpio("up_ledoff: after lm_gpiowrite()"); } break; } diff --git a/nuttx/configs/eagle100/src/up_ssi.c b/nuttx/configs/eagle100/src/up_ssi.c index b78a0d67ca..c18cf52a52 100644 --- a/nuttx/configs/eagle100/src/up_ssi.c +++ b/nuttx/configs/eagle100/src/up_ssi.c @@ -81,7 +81,7 @@ /* Dump GPIO registers */ #ifdef SSI_VERBOSE -# define ssi_dumpgpio(m) lm3s_dumpgpio(SDCCS_GPIO, m) +# define ssi_dumpgpio(m) lm_dumpgpio(SDCCS_GPIO, m) #else # define ssi_dumpgpio(m) #endif @@ -95,30 +95,30 @@ ************************************************************************************/ /************************************************************************************ - * Name: lm3s_ssiinitialize + * Name: lm_ssiinitialize * * Description: * Called to configure SPI chip select GPIO pins for the Eagle100 board. * ************************************************************************************/ -void weak_function lm3s_ssiinitialize(void) +void weak_function lm_ssiinitialize(void) { /* Configure the SPI-based microSD CS GPIO */ - ssi_dumpgpio("lm3s_ssiinitialize() before lm3s_configgpio()"); - lm3s_configgpio(SDCCS_GPIO); - ssi_dumpgpio("lm3s_ssiinitialize() after lm3s_configgpio()"); + ssi_dumpgpio("lm_ssiinitialize() before lm_configgpio()"); + lm_configgpio(SDCCS_GPIO); + ssi_dumpgpio("lm_ssiinitialize() after lm_configgpio()"); } /**************************************************************************** - * The external functions, lm3s_spiselect and lm3s_spistatus must be provided + * The external functions, lm_spiselect and lm_spistatus must be provided * by board-specific logic. The are implementations of the select and status * methods SPI interface defined by struct spi_ops_s (see include/nuttx/spi.h). * All othermethods (including up_spiinitialize()) are provided by common * logic. To use this common SPI logic on your board: * - * 1. Provide lm3s_spiselect() and lm3s_spistatus() functions in your + * 1. Provide lm_spiselect() and lm_spistatus() functions in your * board-specific logic. This function will perform chip selection and * status operations using GPIOs in the way your board is configured. * 2. Add a call to up_spiinitialize() in your low level initialization @@ -130,20 +130,20 @@ void weak_function lm3s_ssiinitialize(void) * ****************************************************************************/ -void lm3s_spiselect(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected) +void lm_spiselect(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected) { ssidbg("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert"); if (devid == SPIDEV_MMCSD) { /* Assert the CS pin to the card */ - ssi_dumpgpio("lm3s_spiselect() before lm3s_gpiowrite()"); - lm3s_gpiowrite(SDCCS_GPIO, !selected); - ssi_dumpgpio("lm3s_spiselect() after lm3s_gpiowrite()"); + ssi_dumpgpio("lm_spiselect() before lm_gpiowrite()"); + lm_gpiowrite(SDCCS_GPIO, !selected); + ssi_dumpgpio("lm_spiselect() after lm_gpiowrite()"); } } -uint8_t lm3s_spistatus(FAR struct spi_dev_s *dev, enum spi_dev_e devid) +uint8_t lm_spistatus(FAR struct spi_dev_s *dev, enum spi_dev_e devid) { ssidbg("Returning SPI_STATUS_PRESENT\n"); return SPI_STATUS_PRESENT; diff --git a/nuttx/configs/eagle100/thttpd/defconfig b/nuttx/configs/eagle100/thttpd/defconfig index 7efbbed11a..2aca2582ec 100644 --- a/nuttx/configs/eagle100/thttpd/defconfig +++ b/nuttx/configs/eagle100/thttpd/defconfig @@ -58,21 +58,21 @@ CONFIG_ARCH_CALIBRATION=n # Disable support for interrupts on GPIOJ which does not # exist on the LM3S6918. Additional interrupt support can be # disabled if desired to reduce memory footprint. -CONFIG_LM3S_DISABLE_GPIOA_IRQS=n -CONFIG_LM3S_DISABLE_GPIOB_IRQS=n -CONFIG_LM3S_DISABLE_GPIOC_IRQS=n -CONFIG_LM3S_DISABLE_GPIOD_IRQS=n -CONFIG_LM3S_DISABLE_GPIOE_IRQS=n -CONFIG_LM3S_DISABLE_GPIOF_IRQS=n -CONFIG_LM3S_DISABLE_GPIOG_IRQS=n -CONFIG_LM3S_DISABLE_GPIOH_IRQS=n -CONFIG_LM3S_DISABLE_GPIOJ_IRQS=y +CONFIG_LM_DISABLE_GPIOA_IRQS=n +CONFIG_LM_DISABLE_GPIOB_IRQS=n +CONFIG_LM_DISABLE_GPIOC_IRQS=n +CONFIG_LM_DISABLE_GPIOD_IRQS=n +CONFIG_LM_DISABLE_GPIOE_IRQS=n +CONFIG_LM_DISABLE_GPIOF_IRQS=n +CONFIG_LM_DISABLE_GPIOG_IRQS=n +CONFIG_LM_DISABLE_GPIOH_IRQS=n +CONFIG_LM_DISABLE_GPIOJ_IRQS=y # # LM3S6918 specific serial device driver settings # -CONFIG_LM3S_UART0=y -CONFIG_LM3S_UART1=n +CONFIG_LM_UART0=y +CONFIG_LM_UART1=n CONFIG_UART0_SERIAL_CONSOLE=y CONFIG_UART1_SERIAL_CONSOLE=n CONFIG_UART0_TXBUFSIZE=256 @@ -99,16 +99,16 @@ CONFIG_SSI_POLLWAIT=y # # LM3S6918 specific serial device driver settings # -CONFIG_LM3S_ETHERNET=y -CONFIG_LM3S_ETHLEDS=n -CONFIG_LM3S_BOARDMAC=y -CONFIG_LM3S_ETHHDUPLEX=n -CONFIG_LM3S_ETHNOAUTOCRC=n -CONFIG_LM3S_ETHNOPAD=n -CONFIG_LM3S_MULTICAST=n -CONFIG_LM3S_PROMISCUOUS=n -CONFIG_LM3S_BADCRC=n -CONFIG_LM3S_DUMPPACKET=n +CONFIG_LM_ETHERNET=y +CONFIG_LM_ETHLEDS=n +CONFIG_LM_BOARDMAC=y +CONFIG_LM_ETHHDUPLEX=n +CONFIG_LM_ETHNOAUTOCRC=n +CONFIG_LM_ETHNOPAD=n +CONFIG_LM_MULTICAST=n +CONFIG_LM_PROMISCUOUS=n +CONFIG_LM_BADCRC=n +CONFIG_LM_DUMPPACKET=n # # General build options diff --git a/nuttx/configs/ekk-lm3s9b96/README.txt b/nuttx/configs/ekk-lm3s9b96/README.txt index f7896118e7..78f7f7b8cb 100644 --- a/nuttx/configs/ekk-lm3s9b96/README.txt +++ b/nuttx/configs/ekk-lm3s9b96/README.txt @@ -102,12 +102,12 @@ GNU Toolchain Options the CodeSourcery or devkitARM, you simply need to add one of the following configuration options to your .config (or defconfig) file: - CONFIG_LM3S_CODESOURCERYW=y : CodeSourcery under Windows - CONFIG_LM3S_CODESOURCERYL=y : CodeSourcery under Linux - CONFIG_LM3S_DEVKITARM=y : devkitARM under Windows - CONFIG_LM3S_BUILDROOT=y : NuttX buildroot under Linux or Cygwin (default) + CONFIG_LM_CODESOURCERYW=y : CodeSourcery under Windows + CONFIG_LM_CODESOURCERYL=y : CodeSourcery under Linux + CONFIG_LM_DEVKITARM=y : devkitARM under Windows + CONFIG_LM_BUILDROOT=y : NuttX buildroot under Linux or Cygwin (default) - If you are not using CONFIG_LM3S_BUILDROOT, then you may also have to modify + If you are not using CONFIG_LM_BUILDROOT, then you may also have to modify the PATH in the setenv.h file if your make cannot find the tools. NOTE: the CodeSourcery (for Windows) and devkitARM are Windows native toolchains. @@ -352,15 +352,15 @@ Stellaris EKK-LM3S9B96 Evaluation Kit Configuration Options Additional interrupt support can be disabled if desired to reduce memory footprint. - CONFIG_LM3S_DISABLE_GPIOA_IRQS=n - CONFIG_LM3S_DISABLE_GPIOB_IRQS=n - CONFIG_LM3S_DISABLE_GPIOC_IRQS=n - CONFIG_LM3S_DISABLE_GPIOD_IRQS=n - CONFIG_LM3S_DISABLE_GPIOE_IRQS=n - CONFIG_LM3S_DISABLE_GPIOF_IRQS=n - CONFIG_LM3S_DISABLE_GPIOG_IRQS=n - CONFIG_LM3S_DISABLE_GPIOH_IRQS=n - CONFIG_LM3S_DISABLE_GPIOJ_IRQS=y + CONFIG_LM_DISABLE_GPIOA_IRQS=n + CONFIG_LM_DISABLE_GPIOB_IRQS=n + CONFIG_LM_DISABLE_GPIOC_IRQS=n + CONFIG_LM_DISABLE_GPIOD_IRQS=n + CONFIG_LM_DISABLE_GPIOE_IRQS=n + CONFIG_LM_DISABLE_GPIOF_IRQS=n + CONFIG_LM_DISABLE_GPIOG_IRQS=n + CONFIG_LM_DISABLE_GPIOH_IRQS=n + CONFIG_LM_DISABLE_GPIOJ_IRQS=y LM3S6818 specific device driver settings @@ -385,18 +385,18 @@ Stellaris EKK-LM3S9B96 Evaluation Kit Configuration Options value is large, then larger values of this setting may cause Rx FIFO overrun errors. Default: half of the Tx FIFO size (4). - CONFIG_LM3S_ETHERNET - This must be set (along with CONFIG_NET) + CONFIG_LM_ETHERNET - This must be set (along with CONFIG_NET) to build the LM3S Ethernet driver - CONFIG_LM3S_ETHLEDS - Enable to use Ethernet LEDs on the board. - CONFIG_LM3S_BOARDMAC - If the board-specific logic can provide + CONFIG_LM_ETHLEDS - Enable to use Ethernet LEDs on the board. + CONFIG_LM_BOARDMAC - If the board-specific logic can provide a MAC address (via lm_ethernetmac()), then this should be selected. - CONFIG_LM3S_ETHHDUPLEX - Set to force half duplex operation - CONFIG_LM3S_ETHNOAUTOCRC - Set to suppress auto-CRC generation - CONFIG_LM3S_ETHNOPAD - Set to suppress Tx padding - CONFIG_LM3S_MULTICAST - Set to enable multicast frames - CONFIG_LM3S_PROMISCUOUS - Set to enable promiscuous mode - CONFIG_LM3S_BADCRC - Set to enable bad CRC rejection. - CONFIG_LM3S_DUMPPACKET - Dump each packet received/sent to the console. + CONFIG_LM_ETHHDUPLEX - Set to force half duplex operation + CONFIG_LM_ETHNOAUTOCRC - Set to suppress auto-CRC generation + CONFIG_LM_ETHNOPAD - Set to suppress Tx padding + CONFIG_LM_MULTICAST - Set to enable multicast frames + CONFIG_LM_PROMISCUOUS - Set to enable promiscuous mode + CONFIG_LM_BADCRC - Set to enable bad CRC rejection. + CONFIG_LM_DUMPPACKET - Dump each packet received/sent to the console. Configurations ^^^^^^^^^^^^^^ diff --git a/nuttx/configs/ekk-lm3s9b96/include/board.h b/nuttx/configs/ekk-lm3s9b96/include/board.h index 2e6cd93f12..f5c997539b 100644 --- a/nuttx/configs/ekk-lm3s9b96/include/board.h +++ b/nuttx/configs/ekk-lm3s9b96/include/board.h @@ -113,7 +113,7 @@ #ifndef __ASSEMBLY__ /************************************************************************************ - * Name: lm3s_boardinitialize + * Name: lm_boardinitialize * * Description: * All LM3S architectures must provide the following entry point. This entry point @@ -122,21 +122,21 @@ * ************************************************************************************/ -extern void lm3s_boardinitialize(void); +extern void lm_boardinitialize(void); /************************************************************************************ - * Name: lm3s_ethernetmac + * Name: lm_ethernetmac * * Description: * For the Ethernet Eval Kits, the MAC address will be stored in the non-volatile - * USER0 and USER1 registers. If CONFIG_LM3S_BOARDMAC is defined, this function + * USER0 and USER1 registers. If CONFIG_LM_BOARDMAC is defined, this function * will obtain the MAC address from these registers. * ************************************************************************************/ -#ifdef CONFIG_LM3S_BOARDMAC +#ifdef CONFIG_LM_BOARDMAC struct ether_addr; -extern void lm3s_ethernetmac(struct ether_addr *ethaddr); +extern void lm_ethernetmac(struct ether_addr *ethaddr); #endif #endif /* __ASSEMBLY__ */ diff --git a/nuttx/configs/ekk-lm3s9b96/nsh/defconfig b/nuttx/configs/ekk-lm3s9b96/nsh/defconfig index b614c03164..adb9bb5fae 100644 --- a/nuttx/configs/ekk-lm3s9b96/nsh/defconfig +++ b/nuttx/configs/ekk-lm3s9b96/nsh/defconfig @@ -57,32 +57,32 @@ CONFIG_ARCH_CALIBRATION=n # # Identify toolchain and linker options # -CONFIG_LM3S_CODESOURCERYW=n -CONFIG_LM3S_CODESOURCERYL=n -CONFIG_LM3S_DEVKITARM=n -CONFIG_LM3S_BUILDROOT=y -CONFIG_LM3S_DFU=y +CONFIG_LM_CODESOURCERYW=n +CONFIG_LM_CODESOURCERYL=n +CONFIG_LM_DEVKITARM=n +CONFIG_LM_BUILDROOT=y +CONFIG_LM_DFU=y # # Disable support for interrupts on GPIOH and GPIOJ which do not # exist on the LM3S6B96. Additional interrupt support can be # disabled if desired to reduce memory footprint. -CONFIG_LM3S_DISABLE_GPIOA_IRQS=n -CONFIG_LM3S_DISABLE_GPIOB_IRQS=n -CONFIG_LM3S_DISABLE_GPIOC_IRQS=n -CONFIG_LM3S_DISABLE_GPIOD_IRQS=n -CONFIG_LM3S_DISABLE_GPIOE_IRQS=n -CONFIG_LM3S_DISABLE_GPIOF_IRQS=n -CONFIG_LM3S_DISABLE_GPIOG_IRQS=n -CONFIG_LM3S_DISABLE_GPIOH_IRQS=y -CONFIG_LM3S_DISABLE_GPIOJ_IRQS=y +CONFIG_LM_DISABLE_GPIOA_IRQS=n +CONFIG_LM_DISABLE_GPIOB_IRQS=n +CONFIG_LM_DISABLE_GPIOC_IRQS=n +CONFIG_LM_DISABLE_GPIOD_IRQS=n +CONFIG_LM_DISABLE_GPIOE_IRQS=n +CONFIG_LM_DISABLE_GPIOF_IRQS=n +CONFIG_LM_DISABLE_GPIOG_IRQS=n +CONFIG_LM_DISABLE_GPIOH_IRQS=y +CONFIG_LM_DISABLE_GPIOJ_IRQS=y # # LM3S6B96 specific serial device driver settings # -CONFIG_LM3S_UART0=y -CONFIG_LM3S_UART1=n -CONFIG_LM3S_UART2=n +CONFIG_LM_UART0=y +CONFIG_LM_UART1=n +CONFIG_LM_UART2=n CONFIG_UART0_SERIAL_CONSOLE=y CONFIG_UART1_SERIAL_CONSOLE=n CONFIG_UART2_SERIAL_CONSOLE=n @@ -116,16 +116,16 @@ CONFIG_SSI_POLLWAIT=y # # LM3S6B96 specific serial device driver settings # -CONFIG_LM3S_ETHERNET=y -CONFIG_LM3S_ETHLEDS=n -CONFIG_LM3S_BOARDMAC=n -CONFIG_LM3S_ETHHDUPLEX=n -CONFIG_LM3S_ETHNOAUTOCRC=n -CONFIG_LM3S_ETHNOPAD=n -CONFIG_LM3S_MULTICAST=n -CONFIG_LM3S_PROMISCUOUS=n -CONFIG_LM3S_BADCRC=n -CONFIG_LM3S_DUMPPACKET=n +CONFIG_LM_ETHERNET=y +CONFIG_LM_ETHLEDS=n +CONFIG_LM_BOARDMAC=n +CONFIG_LM_ETHHDUPLEX=n +CONFIG_LM_ETHNOAUTOCRC=n +CONFIG_LM_ETHNOPAD=n +CONFIG_LM_MULTICAST=n +CONFIG_LM_PROMISCUOUS=n +CONFIG_LM_BADCRC=n +CONFIG_LM_DUMPPACKET=n # # General build options diff --git a/nuttx/configs/ekk-lm3s9b96/ostest/defconfig b/nuttx/configs/ekk-lm3s9b96/ostest/defconfig index df56223606..8215020366 100644 --- a/nuttx/configs/ekk-lm3s9b96/ostest/defconfig +++ b/nuttx/configs/ekk-lm3s9b96/ostest/defconfig @@ -57,32 +57,32 @@ CONFIG_ARCH_CALIBRATION=n # # Identify toolchain and linker options # -CONFIG_LM3S_CODESOURCERYW=n -CONFIG_LM3S_CODESOURCERYL=n -CONFIG_LM3S_DEVKITARM=n -CONFIG_LM3S_BUILDROOT=y -CONFIG_LM3S_DFU=y +CONFIG_LM_CODESOURCERYW=n +CONFIG_LM_CODESOURCERYL=n +CONFIG_LM_DEVKITARM=n +CONFIG_LM_BUILDROOT=y +CONFIG_LM_DFU=y # # Disable support for interrupts on GPIOH and GPIOJ which do not # exist on the LM3S6B96. Additional interrupt support can be # disabled if desired to reduce memory footprint. -CONFIG_LM3S_DISABLE_GPIOA_IRQS=n -CONFIG_LM3S_DISABLE_GPIOB_IRQS=n -CONFIG_LM3S_DISABLE_GPIOC_IRQS=n -CONFIG_LM3S_DISABLE_GPIOD_IRQS=n -CONFIG_LM3S_DISABLE_GPIOE_IRQS=n -CONFIG_LM3S_DISABLE_GPIOF_IRQS=n -CONFIG_LM3S_DISABLE_GPIOG_IRQS=n -CONFIG_LM3S_DISABLE_GPIOH_IRQS=y -CONFIG_LM3S_DISABLE_GPIOJ_IRQS=y +CONFIG_LM_DISABLE_GPIOA_IRQS=n +CONFIG_LM_DISABLE_GPIOB_IRQS=n +CONFIG_LM_DISABLE_GPIOC_IRQS=n +CONFIG_LM_DISABLE_GPIOD_IRQS=n +CONFIG_LM_DISABLE_GPIOE_IRQS=n +CONFIG_LM_DISABLE_GPIOF_IRQS=n +CONFIG_LM_DISABLE_GPIOG_IRQS=n +CONFIG_LM_DISABLE_GPIOH_IRQS=y +CONFIG_LM_DISABLE_GPIOJ_IRQS=y # # LM3S6B96 specific serial device driver settings # -CONFIG_LM3S_UART0=y -CONFIG_LM3S_UART1=n -CONFIG_LM3S_UART2=n +CONFIG_LM_UART0=y +CONFIG_LM_UART1=n +CONFIG_LM_UART2=n CONFIG_UART0_SERIAL_CONSOLE=y CONFIG_UART1_SERIAL_CONSOLE=n CONFIG_UART2_SERIAL_CONSOLE=n @@ -116,16 +116,16 @@ CONFIG_SSI_POLLWAIT=y # # LM3S6B96 specific serial device driver settings # -CONFIG_LM3S_ETHERNET=n -CONFIG_LM3S_ETHLEDS=n -CONFIG_LM3S_BOARDMAC=y -CONFIG_LM3S_ETHHDUPLEX=n -CONFIG_LM3S_ETHNOAUTOCRC=n -CONFIG_LM3S_ETHNOPAD=n -CONFIG_LM3S_MULTICAST=n -CONFIG_LM3S_PROMISCUOUS=n -CONFIG_LM3S_BADCRC=n -CONFIG_LM3S_DUMPPACKET=n +CONFIG_LM_ETHERNET=n +CONFIG_LM_ETHLEDS=n +CONFIG_LM_BOARDMAC=y +CONFIG_LM_ETHHDUPLEX=n +CONFIG_LM_ETHNOAUTOCRC=n +CONFIG_LM_ETHNOPAD=n +CONFIG_LM_MULTICAST=n +CONFIG_LM_PROMISCUOUS=n +CONFIG_LM_BADCRC=n +CONFIG_LM_DUMPPACKET=n # # General build options diff --git a/nuttx/configs/ekk-lm3s9b96/src/ekklm3s9b96_internal.h b/nuttx/configs/ekk-lm3s9b96/src/ekklm3s9b96_internal.h index 17b0d0e279..d7ab916c83 100644 --- a/nuttx/configs/ekk-lm3s9b96/src/ekklm3s9b96_internal.h +++ b/nuttx/configs/ekk-lm3s9b96/src/ekklm3s9b96_internal.h @@ -102,14 +102,14 @@ #ifndef __ASSEMBLY__ /************************************************************************************ - * Name: lm3s_ssiinitialize + * Name: lm_ssiinitialize * * Description: * Called to configure SPI chip select GPIO pins for the LM3S6965 Eval Kit. * ************************************************************************************/ -extern void weak_function lm3s_ssiinitialize(void); +extern void weak_function lm_ssiinitialize(void); #endif /* __ASSEMBLY__ */ #endif /* __CONFIGS_EKK_LM3S9B96_SRC_EKKLM3S9B96_INTERNAL_H */ diff --git a/nuttx/configs/ekk-lm3s9b96/src/up_boot.c b/nuttx/configs/ekk-lm3s9b96/src/up_boot.c index 528d150e12..16057ccb94 100644 --- a/nuttx/configs/ekk-lm3s9b96/src/up_boot.c +++ b/nuttx/configs/ekk-lm3s9b96/src/up_boot.c @@ -62,7 +62,7 @@ ************************************************************************************/ /************************************************************************************ - * Name: lm3s_boardinitialize + * Name: lm_boardinitialize * * Description: * All LM3S architectures must provide the following entry point. This entry point @@ -70,16 +70,16 @@ * and mapped but before any devices have been initialized. ************************************************************************************/ -void lm3s_boardinitialize(void) +void lm_boardinitialize(void) { /* Configure chip selects if 1) SSI is not disabled, and 2) the weak function - * lm3s_ssiinitialize() has been brought into the link. + * lm_ssiinitialize() has been brought into the link. */ #if !defined(CONFIG_SSI0_DISABLE) || !defined(CONFIG_SSI1_DISABLE) - if (lm3s_ssiinitialize) + if (lm_ssiinitialize) { - lm3s_ssiinitialize(); + lm_ssiinitialize(); } #endif diff --git a/nuttx/configs/ekk-lm3s9b96/src/up_ethernet.c b/nuttx/configs/ekk-lm3s9b96/src/up_ethernet.c index a1963f0d5c..bc4149082f 100644 --- a/nuttx/configs/ekk-lm3s9b96/src/up_ethernet.c +++ b/nuttx/configs/ekk-lm3s9b96/src/up_ethernet.c @@ -64,17 +64,17 @@ ************************************************************************************/ /************************************************************************************ - * Name: lm3s_ethernetmac + * Name: lm_ethernetmac * * Description: * For the Ethernet Eval Kits, the MAC address will be stored in the non-volatile - * USER0 and USER1 registers. If CONFIG_LM3S_BOARDMAC is defined, this function + * USER0 and USER1 registers. If CONFIG_LM_BOARDMAC is defined, this function * will obtain the MAC address from these registers. * ************************************************************************************/ -#ifdef CONFIG_LM3S_BOARDMAC -void lm3s_ethernetmac(struct ether_addr *ethaddr) +#ifdef CONFIG_LM_BOARDMAC +void lm_ethernetmac(struct ether_addr *ethaddr) { uint32_t user0; uint32_t user1; diff --git a/nuttx/configs/ekk-lm3s9b96/src/up_leds.c b/nuttx/configs/ekk-lm3s9b96/src/up_leds.c index 7628fcfe0a..e6abe1a8ac 100644 --- a/nuttx/configs/ekk-lm3s9b96/src/up_leds.c +++ b/nuttx/configs/ekk-lm3s9b96/src/up_leds.c @@ -73,7 +73,7 @@ /* Dump GPIO registers */ #ifdef LED_DEBUG -# define led_dumpgpio(m) lm3s_dumpgpio(LED_GPIO, m) +# define led_dumpgpio(m) lm_dumpgpio(LED_GPIO, m) #else # define led_dumpgpio(m) #endif @@ -103,9 +103,9 @@ void up_ledinit(void) /* Configure Port D, Bit 0 as an output, initial value=OFF */ - led_dumpgpio("up_ledinit before lm3s_configgpio()"); - lm3s_configgpio(LED_GPIO); - led_dumpgpio("up_ledinit after lm3s_configgpio()"); + led_dumpgpio("up_ledinit before lm_configgpio()"); + lm_configgpio(LED_GPIO); + led_dumpgpio("up_ledinit after lm_configgpio()"); g_nest = 0; } @@ -129,9 +129,9 @@ void up_ledon(int led) g_nest++; case LED_IRQSENABLED: case LED_STACKCREATED: - led_dumpgpio("up_ledon: before lm3s_gpiowrite()"); - lm3s_gpiowrite(LED_GPIO, false); - led_dumpgpio("up_ledon: after lm3s_gpiowrite()"); + led_dumpgpio("up_ledon: before lm_gpiowrite()"); + lm_gpiowrite(LED_GPIO, false); + led_dumpgpio("up_ledon: after lm_gpiowrite()"); break; } } @@ -157,9 +157,9 @@ void up_ledoff(int led) case LED_PANIC: if (--g_nest <= 0) { - led_dumpgpio("up_ledoff: before lm3s_gpiowrite()"); - lm3s_gpiowrite(LED_GPIO, true); - led_dumpgpio("up_ledoff: after lm3s_gpiowrite()"); + led_dumpgpio("up_ledoff: before lm_gpiowrite()"); + lm_gpiowrite(LED_GPIO, true); + led_dumpgpio("up_ledoff: after lm_gpiowrite()"); } break; } diff --git a/nuttx/configs/ekk-lm3s9b96/src/up_ssi.c b/nuttx/configs/ekk-lm3s9b96/src/up_ssi.c index 8f297e7a79..d7ee0ef16c 100644 --- a/nuttx/configs/ekk-lm3s9b96/src/up_ssi.c +++ b/nuttx/configs/ekk-lm3s9b96/src/up_ssi.c @@ -81,7 +81,7 @@ #ifdef SSI_VERBOSE #if 0 -# define ssi_dumpgpio(m) lm3s_dumpgpio(SDCCS_GPIO, m) +# define ssi_dumpgpio(m) lm_dumpgpio(SDCCS_GPIO, m) #endif #else # define ssi_dumpgpio(m) @@ -96,31 +96,31 @@ ************************************************************************************/ /************************************************************************************ - * Name: lm3s_ssiinitialize + * Name: lm_ssiinitialize * * Description: * Called to configure chip select GPIO pins for the LM3S9B96 Eval board. * ************************************************************************************/ -void weak_function lm3s_ssiinitialize(void) +void weak_function lm_ssiinitialize(void) { /* Configure the CS GPIO */ #if 0 - ssi_dumpgpio("lm3s_ssiinitialize() Entry"); - ssi_dumpgpio("lm3s_ssiinitialize() Exit"); + ssi_dumpgpio("lm_ssiinitialize() Entry"); + ssi_dumpgpio("lm_ssiinitialize() Exit"); #endif } #if 0 /**************************************************************************** - * The external functions, lm3s_spiselect and lm3s_spistatus must be provided + * The external functions, lm_spiselect and lm_spistatus must be provided * by board-specific logic. The are implementations of the select and status * methods SPI interface defined by struct spi_ops_s (see include/nuttx/spi.h). * All othermethods (including up_spiinitialize()) are provided by common * logic. To use this common SPI logic on your board: * - * 1. Provide lm3s_spiselect() and lm3s_spistatus() functions in your + * 1. Provide lm_spiselect() and lm_spistatus() functions in your * board-specific logic. This function will perform chip selection and * status operations using GPIOs in the way your board is configured. * 2. Add a call to up_spiinitialize() in your low level initialization @@ -132,28 +132,28 @@ void weak_function lm3s_ssiinitialize(void) * ****************************************************************************/ -void lm3s_spiselect(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected) +void lm_spiselect(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected) { ssidbg("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert"); - ssi_dumpgpio("lm3s_spiselect() Entry"); + ssi_dumpgpio("lm_spiselect() Entry"); if (devid == SPIDEV_MMCSD) { /* Assert the CS pin to the card */ - lm3s_gpiowrite(SDCCS_GPIO, !selected); + lm_gpiowrite(SDCCS_GPIO, !selected); } #ifdef CONFIG_NX_LCDDRIVER else if (devid == SPIDEV_DISPLAY) { /* Assert the CS pin to the display */ - lm3s_gpiowrite(OLEDCS_GPIO, !selected); + lm_gpiowrite(OLEDCS_GPIO, !selected); } #endif - ssi_dumpgpio("lm3s_spiselect() Exit"); + ssi_dumpgpio("lm_spiselect() Exit"); } -uint8_t lm3s_spistatus(FAR struct spi_dev_s *dev, enum spi_dev_e devid) +uint8_t lm_spistatus(FAR struct spi_dev_s *dev, enum spi_dev_e devid) { ssidbg("Returning SPI_STATUS_PRESENT\n"); return SPI_STATUS_PRESENT; diff --git a/nuttx/configs/lm3s6432-s2e/README.txt b/nuttx/configs/lm3s6432-s2e/README.txt index 669708c168..29cf80faec 100644 --- a/nuttx/configs/lm3s6432-s2e/README.txt +++ b/nuttx/configs/lm3s6432-s2e/README.txt @@ -97,12 +97,12 @@ GNU Toolchain Options To use a specific toolchain, you simply need to add one of the following configuration options to your .config (or defconfig) file: - CONFIG_LM3S_CODESOURCERYW=y : CodeSourcery under Windows - CONFIG_LM3S_CODESOURCERYL=y : CodeSourcery under Linux or on Mac OS X. - CONFIG_LM3S_DEVKITARM=y : devkitARM under Windows - CONFIG_LM3S_BUILDROOT=y : NuttX buildroot under Linux or Cygwin (default) + CONFIG_LM_CODESOURCERYW=y : CodeSourcery under Windows + CONFIG_LM_CODESOURCERYL=y : CodeSourcery under Linux or on Mac OS X. + CONFIG_LM_DEVKITARM=y : devkitARM under Windows + CONFIG_LM_BUILDROOT=y : NuttX buildroot under Linux or Cygwin (default) - If you are not using CONFIG_LM3S_BUILDROOT, then you may also have to modify + If you are not using CONFIG_LM_BUILDROOT, then you may also have to modify the PATH in the setenv.h file if your make cannot find the tools. NOTE: the CodeSourcery (for Windows) and devkitARM are Windows native toolchains. @@ -346,15 +346,15 @@ Stellaris MDL-S2E Reference Design Configuration Options Additional interrupt support can be disabled if desired to reduce memory footprint - GPIOs C-G are not pinned out on the MDL-S2E board. - CONFIG_LM3S_DISABLE_GPIOA_IRQS=n - CONFIG_LM3S_DISABLE_GPIOB_IRQS=n - CONFIG_LM3S_DISABLE_GPIOC_IRQS=y - CONFIG_LM3S_DISABLE_GPIOD_IRQS=y - CONFIG_LM3S_DISABLE_GPIOE_IRQS=y - CONFIG_LM3S_DISABLE_GPIOF_IRQS=y - CONFIG_LM3S_DISABLE_GPIOG_IRQS=y - CONFIG_LM3S_DISABLE_GPIOH_IRQS=y - CONFIG_LM3S_DISABLE_GPIOJ_IRQS=y + CONFIG_LM_DISABLE_GPIOA_IRQS=n + CONFIG_LM_DISABLE_GPIOB_IRQS=n + CONFIG_LM_DISABLE_GPIOC_IRQS=y + CONFIG_LM_DISABLE_GPIOD_IRQS=y + CONFIG_LM_DISABLE_GPIOE_IRQS=y + CONFIG_LM_DISABLE_GPIOF_IRQS=y + CONFIG_LM_DISABLE_GPIOG_IRQS=y + CONFIG_LM_DISABLE_GPIOH_IRQS=y + CONFIG_LM_DISABLE_GPIOJ_IRQS=y LM3S6432 specific device driver settings @@ -388,18 +388,18 @@ Stellaris MDL-S2E Reference Design Configuration Options value is large, then larger values of this setting may cause Rx FIFO overrun errors. Default: half of the Tx FIFO size (4). - CONFIG_LM3S_ETHERNET - This must be set (along with CONFIG_NET) + CONFIG_LM_ETHERNET - This must be set (along with CONFIG_NET) to build the LM3S Ethernet driver - CONFIG_LM3S_ETHLEDS - Enable to use Ethernet LEDs on the board. - CONFIG_LM3S_BOARDMAC - This should be set in order to use the + CONFIG_LM_ETHLEDS - Enable to use Ethernet LEDs on the board. + CONFIG_LM_BOARDMAC - This should be set in order to use the MAC address configured in the flash USER registers. - CONFIG_LM3S_ETHHDUPLEX - Set to force half duplex operation - CONFIG_LM3S_ETHNOAUTOCRC - Set to suppress auto-CRC generation - CONFIG_LM3S_ETHNOPAD - Set to suppress Tx padding - CONFIG_LM3S_MULTICAST - Set to enable multicast frames - CONFIG_LM3S_PROMISCUOUS - Set to enable promiscuous mode - CONFIG_LM3S_BADCRC - Set to enable bad CRC rejection. - CONFIG_LM3S_DUMPPACKET - Dump each packet received/sent to the console. + CONFIG_LM_ETHHDUPLEX - Set to force half duplex operation + CONFIG_LM_ETHNOAUTOCRC - Set to suppress auto-CRC generation + CONFIG_LM_ETHNOPAD - Set to suppress Tx padding + CONFIG_LM_MULTICAST - Set to enable multicast frames + CONFIG_LM_PROMISCUOUS - Set to enable promiscuous mode + CONFIG_LM_BADCRC - Set to enable bad CRC rejection. + CONFIG_LM_DUMPPACKET - Dump each packet received/sent to the console. Configurations ^^^^^^^^^^^^^^ diff --git a/nuttx/configs/lm3s6432-s2e/include/board.h b/nuttx/configs/lm3s6432-s2e/include/board.h index 06504ec4f8..7fdcabf767 100644 --- a/nuttx/configs/lm3s6432-s2e/include/board.h +++ b/nuttx/configs/lm3s6432-s2e/include/board.h @@ -114,7 +114,7 @@ #ifndef __ASSEMBLY__ /************************************************************************************ - * Name: lm3s_boardinitialize + * Name: lm_boardinitialize * * Description: * All LM3S architectures must provide the following entry point. This entry point @@ -123,21 +123,21 @@ * ************************************************************************************/ -extern void lm3s_boardinitialize(void); +extern void lm_boardinitialize(void); /************************************************************************************ - * Name: lm3s_ethernetmac + * Name: lm_ethernetmac * * Description: * For the MDL-S2E Reference Design, the MAC address will be stored in the - * non-volatile USER0 and USER1 registers. If CONFIG_LM3S_BOARDMAC is defined, + * non-volatile USER0 and USER1 registers. If CONFIG_LM_BOARDMAC is defined, * this function will obtain the MAC address from these registers. * ************************************************************************************/ -#ifdef CONFIG_LM3S_BOARDMAC +#ifdef CONFIG_LM_BOARDMAC struct ether_addr; -extern void lm3s_ethernetmac(struct ether_addr *ethaddr); +extern void lm_ethernetmac(struct ether_addr *ethaddr); #endif #endif /* __ASSEMBLY__ */ diff --git a/nuttx/configs/lm3s6432-s2e/nsh/defconfig b/nuttx/configs/lm3s6432-s2e/nsh/defconfig index edd61eaccb..a09bc6717d 100644 --- a/nuttx/configs/lm3s6432-s2e/nsh/defconfig +++ b/nuttx/configs/lm3s6432-s2e/nsh/defconfig @@ -56,32 +56,32 @@ CONFIG_ARCH_CALIBRATION=n # # Identify toolchain and linker options # -CONFIG_LM3S_CODESOURCERYW=n -CONFIG_LM3S_CODESOURCERYL=y -CONFIG_LM3S_DEVKITARM=n -CONFIG_LM3S_BUILDROOT=n +CONFIG_LM_CODESOURCERYW=n +CONFIG_LM_CODESOURCERYL=y +CONFIG_LM_DEVKITARM=n +CONFIG_LM_BUILDROOT=n # # Disable support for interrupts on GPIOs which do not # exist on the LM3S6432 or are not pinned anywhere useful # on the S2E. # -CONFIG_LM3S_DISABLE_GPIOA_IRQS=n -CONFIG_LM3S_DISABLE_GPIOB_IRQS=n -CONFIG_LM3S_DISABLE_GPIOC_IRQS=y -CONFIG_LM3S_DISABLE_GPIOD_IRQS=y -CONFIG_LM3S_DISABLE_GPIOE_IRQS=y -CONFIG_LM3S_DISABLE_GPIOF_IRQS=y -CONFIG_LM3S_DISABLE_GPIOG_IRQS=y -CONFIG_LM3S_DISABLE_GPIOH_IRQS=y -CONFIG_LM3S_DISABLE_GPIOJ_IRQS=y +CONFIG_LM_DISABLE_GPIOA_IRQS=n +CONFIG_LM_DISABLE_GPIOB_IRQS=n +CONFIG_LM_DISABLE_GPIOC_IRQS=y +CONFIG_LM_DISABLE_GPIOD_IRQS=y +CONFIG_LM_DISABLE_GPIOE_IRQS=y +CONFIG_LM_DISABLE_GPIOF_IRQS=y +CONFIG_LM_DISABLE_GPIOG_IRQS=y +CONFIG_LM_DISABLE_GPIOH_IRQS=y +CONFIG_LM_DISABLE_GPIOJ_IRQS=y # # LM3S6432 specific serial device driver settings # -CONFIG_LM3S_UART0=y -CONFIG_LM3S_UART1=y -CONFIG_LM3S_UART2=n +CONFIG_LM_UART0=y +CONFIG_LM_UART1=y +CONFIG_LM_UART2=n CONFIG_UART0_SERIAL_CONSOLE=n CONFIG_UART1_SERIAL_CONSOLE=y CONFIG_UART2_SERIAL_CONSOLE=n @@ -115,16 +115,16 @@ CONFIG_SSI_POLLWAIT=y # # LM3S6432 specific ethernet device driver settings # -CONFIG_LM3S_ETHERNET=y -CONFIG_LM3S_ETHLEDS=n -CONFIG_LM3S_BOARDMAC=y -CONFIG_LM3S_ETHHDUPLEX=n -CONFIG_LM3S_ETHNOAUTOCRC=n -CONFIG_LM3S_ETHNOPAD=n -CONFIG_LM3S_MULTICAST=n -CONFIG_LM3S_PROMISCUOUS=n -CONFIG_LM3S_BADCRC=n -CONFIG_LM3S_DUMPPACKET=n +CONFIG_LM_ETHERNET=y +CONFIG_LM_ETHLEDS=n +CONFIG_LM_BOARDMAC=y +CONFIG_LM_ETHHDUPLEX=n +CONFIG_LM_ETHNOAUTOCRC=n +CONFIG_LM_ETHNOPAD=n +CONFIG_LM_MULTICAST=n +CONFIG_LM_PROMISCUOUS=n +CONFIG_LM_BADCRC=n +CONFIG_LM_DUMPPACKET=n # # General build options diff --git a/nuttx/configs/lm3s6432-s2e/ostest/defconfig b/nuttx/configs/lm3s6432-s2e/ostest/defconfig index 2d32db81c6..9387fd0868 100644 --- a/nuttx/configs/lm3s6432-s2e/ostest/defconfig +++ b/nuttx/configs/lm3s6432-s2e/ostest/defconfig @@ -56,32 +56,32 @@ CONFIG_ARCH_CALIBRATION=n # # Identify toolchain and linker options # -CONFIG_LM3S_CODESOURCERYW=n -CONFIG_LM3S_CODESOURCERYL=y -CONFIG_LM3S_DEVKITARM=n -CONFIG_LM3S_BUILDROOT=n +CONFIG_LM_CODESOURCERYW=n +CONFIG_LM_CODESOURCERYL=y +CONFIG_LM_DEVKITARM=n +CONFIG_LM_BUILDROOT=n # # Disable support for interrupts on GPIOs which do not # exist on the LM3S6432 or are not pinned anywhere useful # on the S2E. # -CONFIG_LM3S_DISABLE_GPIOA_IRQS=n -CONFIG_LM3S_DISABLE_GPIOB_IRQS=n -CONFIG_LM3S_DISABLE_GPIOC_IRQS=y -CONFIG_LM3S_DISABLE_GPIOD_IRQS=y -CONFIG_LM3S_DISABLE_GPIOE_IRQS=y -CONFIG_LM3S_DISABLE_GPIOF_IRQS=y -CONFIG_LM3S_DISABLE_GPIOG_IRQS=y -CONFIG_LM3S_DISABLE_GPIOH_IRQS=y -CONFIG_LM3S_DISABLE_GPIOJ_IRQS=y +CONFIG_LM_DISABLE_GPIOA_IRQS=n +CONFIG_LM_DISABLE_GPIOB_IRQS=n +CONFIG_LM_DISABLE_GPIOC_IRQS=y +CONFIG_LM_DISABLE_GPIOD_IRQS=y +CONFIG_LM_DISABLE_GPIOE_IRQS=y +CONFIG_LM_DISABLE_GPIOF_IRQS=y +CONFIG_LM_DISABLE_GPIOG_IRQS=y +CONFIG_LM_DISABLE_GPIOH_IRQS=y +CONFIG_LM_DISABLE_GPIOJ_IRQS=y # # LM3S6432 specific serial device driver settings # -CONFIG_LM3S_UART0=y -CONFIG_LM3S_UART1=y -CONFIG_LM3S_UART2=n +CONFIG_LM_UART0=y +CONFIG_LM_UART1=y +CONFIG_LM_UART2=n CONFIG_UART0_SERIAL_CONSOLE=n CONFIG_UART1_SERIAL_CONSOLE=y CONFIG_UART2_SERIAL_CONSOLE=n @@ -115,16 +115,16 @@ CONFIG_SSI_POLLWAIT=y # # LM3S6432 specific ethernet device driver settings # -CONFIG_LM3S_ETHERNET=n -CONFIG_LM3S_ETHLEDS=n -CONFIG_LM3S_BOARDMAC=y -CONFIG_LM3S_ETHHDUPLEX=n -CONFIG_LM3S_ETHNOAUTOCRC=n -CONFIG_LM3S_ETHNOPAD=n -CONFIG_LM3S_MULTICAST=n -CONFIG_LM3S_PROMISCUOUS=n -CONFIG_LM3S_BADCRC=n -CONFIG_LM3S_DUMPPACKET=n +CONFIG_LM_ETHERNET=n +CONFIG_LM_ETHLEDS=n +CONFIG_LM_BOARDMAC=y +CONFIG_LM_ETHHDUPLEX=n +CONFIG_LM_ETHNOAUTOCRC=n +CONFIG_LM_ETHNOPAD=n +CONFIG_LM_MULTICAST=n +CONFIG_LM_PROMISCUOUS=n +CONFIG_LM_BADCRC=n +CONFIG_LM_DUMPPACKET=n # # General build options diff --git a/nuttx/configs/lm3s6432-s2e/src/lm3s6432s2e_internal.h b/nuttx/configs/lm3s6432-s2e/src/lm3s6432s2e_internal.h index f54403c7a8..f95b118ad5 100644 --- a/nuttx/configs/lm3s6432-s2e/src/lm3s6432s2e_internal.h +++ b/nuttx/configs/lm3s6432-s2e/src/lm3s6432s2e_internal.h @@ -112,14 +112,14 @@ #ifndef __ASSEMBLY__ /************************************************************************************ - * Name: lm3s_ssiinitialize + * Name: lm_ssiinitialize * * Description: * Called to configure SPI chip select GPIO pins for the MDL-S2E. * ************************************************************************************/ -extern void weak_function lm3s_ssiinitialize(void); +extern void weak_function lm_ssiinitialize(void); #endif /* __ASSEMBLY__ */ #endif /* __CONFIGS_LM3S6432_S2E_SRC_LM3S6432S2E_INTERNAL_H */ diff --git a/nuttx/configs/lm3s6432-s2e/src/up_boot.c b/nuttx/configs/lm3s6432-s2e/src/up_boot.c index 1845296384..da900282f8 100644 --- a/nuttx/configs/lm3s6432-s2e/src/up_boot.c +++ b/nuttx/configs/lm3s6432-s2e/src/up_boot.c @@ -54,7 +54,7 @@ * Definitions ************************************************************************************/ -#if defined(CONFIG_LM3S_UART1) && !defined(CONFIG_SSI0_DISABLE) +#if defined(CONFIG_LM_UART1) && !defined(CONFIG_SSI0_DISABLE) # error Only one of UART1 and SSI0 can be enabled on this board. #endif @@ -67,7 +67,7 @@ ************************************************************************************/ /************************************************************************************ - * Name: lm3s_boardinitialize + * Name: lm_boardinitialize * * Description: * All LM3S architectures must provide the following entry point. This entry point @@ -75,16 +75,16 @@ * and mapped but before any devices have been initialized. ************************************************************************************/ -void lm3s_boardinitialize(void) +void lm_boardinitialize(void) { /* Configure SPI chip selects if 1) SSI is not disabled, and 2) the weak function - * lm3s_ssiinitialize() has been brought into the link. + * lm_ssiinitialize() has been brought into the link. */ #if !defined(CONFIG_SSI0_DISABLE) - if (lm3s_ssiinitialize) + if (lm_ssiinitialize) { - lm3s_ssiinitialize(); + lm_ssiinitialize(); } #endif @@ -96,8 +96,8 @@ void lm3s_boardinitialize(void) /* Configure serial transciever */ - lm3s_configgpio(XCVR_INV_GPIO); - lm3s_configgpio(XCVR_ENA_GPIO); - lm3s_configgpio(XCVR_ON_GPIO); - lm3s_configgpio(XCVR_OFF_GPIO); + lm_configgpio(XCVR_INV_GPIO); + lm_configgpio(XCVR_ENA_GPIO); + lm_configgpio(XCVR_ON_GPIO); + lm_configgpio(XCVR_OFF_GPIO); } diff --git a/nuttx/configs/lm3s6432-s2e/src/up_ethernet.c b/nuttx/configs/lm3s6432-s2e/src/up_ethernet.c index 09d5040c41..434ffe2c52 100644 --- a/nuttx/configs/lm3s6432-s2e/src/up_ethernet.c +++ b/nuttx/configs/lm3s6432-s2e/src/up_ethernet.c @@ -63,17 +63,17 @@ ************************************************************************************/ /************************************************************************************ - * Name: lm3s_ethernetmac + * Name: lm_ethernetmac * * Description: * For the Ethernet Eval Kits, the MAC address will be stored in the non-volatile - * USER0 and USER1 registers. If CONFIG_LM3S_BOARDMAC is defined, this function + * USER0 and USER1 registers. If CONFIG_LM_BOARDMAC is defined, this function * will obtain the MAC address from these registers. * ************************************************************************************/ -#ifdef CONFIG_LM3S_BOARDMAC -void lm3s_ethernetmac(struct ether_addr *ethaddr) +#ifdef CONFIG_LM_BOARDMAC +void lm_ethernetmac(struct ether_addr *ethaddr) { uint32_t user0; uint32_t user1; diff --git a/nuttx/configs/lm3s6432-s2e/src/up_leds.c b/nuttx/configs/lm3s6432-s2e/src/up_leds.c index 81610db34f..e0dd53f28e 100644 --- a/nuttx/configs/lm3s6432-s2e/src/up_leds.c +++ b/nuttx/configs/lm3s6432-s2e/src/up_leds.c @@ -72,7 +72,7 @@ /* Dump GPIO registers */ #ifdef LED_DEBUG -# define led_dumpgpio(m) lm3s_dumpgpio(LED_GPIO, m) +# define led_dumpgpio(m) lm_dumpgpio(LED_GPIO, m) #else # define led_dumpgpio(m) #endif @@ -102,10 +102,10 @@ void up_ledinit(void) /* Configure Port F, Bit 2 as an output, initial value=OFF */ - led_dumpgpio("up_ledinit before lm3s_configgpio()"); - lm3s_configgpio(LED0_GPIO); - lm3s_configgpio(LED1_GPIO); - led_dumpgpio("up_ledinit after lm3s_configgpio()"); + led_dumpgpio("up_ledinit before lm_configgpio()"); + lm_configgpio(LED0_GPIO); + lm_configgpio(LED1_GPIO); + led_dumpgpio("up_ledinit after lm_configgpio()"); g_nest = 0; } @@ -129,9 +129,9 @@ void up_ledon(int led) g_nest++; case LED_IRQSENABLED: case LED_STACKCREATED: - led_dumpgpio("up_ledon: before lm3s_gpiowrite()"); - lm3s_gpiowrite(LED1_GPIO, false); - led_dumpgpio("up_ledon: after lm3s_gpiowrite()"); + led_dumpgpio("up_ledon: before lm_gpiowrite()"); + lm_gpiowrite(LED1_GPIO, false); + led_dumpgpio("up_ledon: after lm_gpiowrite()"); break; } } @@ -157,9 +157,9 @@ void up_ledoff(int led) case LED_PANIC: if (--g_nest <= 0) { - led_dumpgpio("up_ledoff: before lm3s_gpiowrite()"); - lm3s_gpiowrite(LED1_GPIO, true); - led_dumpgpio("up_ledoff: after lm3s_gpiowrite()"); + led_dumpgpio("up_ledoff: before lm_gpiowrite()"); + lm_gpiowrite(LED1_GPIO, true); + led_dumpgpio("up_ledoff: after lm_gpiowrite()"); } break; } diff --git a/nuttx/configs/lm3s6432-s2e/src/up_ssi.c b/nuttx/configs/lm3s6432-s2e/src/up_ssi.c index a7844a9791..5468e2b4d8 100644 --- a/nuttx/configs/lm3s6432-s2e/src/up_ssi.c +++ b/nuttx/configs/lm3s6432-s2e/src/up_ssi.c @@ -79,7 +79,7 @@ /* Dump GPIO registers */ #ifdef SSI_VERBOSE -# define ssi_dumpgpio(m) lm3s_dumpgpio(SDCCS_GPIO, m) +# define ssi_dumpgpio(m) lm_dumpgpio(SDCCS_GPIO, m) #else # define ssi_dumpgpio(m) #endif @@ -93,30 +93,30 @@ ************************************************************************************/ /************************************************************************************ - * Name: lm3s_ssiinitialize + * Name: lm_ssiinitialize * * Description: * Called to configure SPI chip select GPIO pins for the MDL-S2E. * ************************************************************************************/ -void weak_function lm3s_ssiinitialize(void) +void weak_function lm_ssiinitialize(void) { /* Configure the SPI CS GPIO */ - ssi_dumpgpio("lm3s_ssiinitialize() Entry)"); - lm3s_configgpio(SSICS_GPIO); - ssi_dumpgpio("lm3s_ssiinitialize() Exit"); + ssi_dumpgpio("lm_ssiinitialize() Entry)"); + lm_configgpio(SSICS_GPIO); + ssi_dumpgpio("lm_ssiinitialize() Exit"); } /**************************************************************************** - * The external functions, lm3s_spiselect and lm3s_spistatus must be provided + * The external functions, lm_spiselect and lm_spistatus must be provided * by board-specific logic. The are implementations of the select and status * methods SPI interface defined by struct spi_ops_s (see include/nuttx/spi.h). * All othermethods (including up_spiinitialize()) are provided by common * logic. To use this common SPI logic on your board: * - * 1. Provide lm3s_spiselect() and lm3s_spistatus() functions in your + * 1. Provide lm_spiselect() and lm_spistatus() functions in your * board-specific logic. This function will perform chip selection and * status operations using GPIOs in the way your board is configured. * 2. Add a call to up_spiinitialize() in your low level initialization @@ -128,21 +128,21 @@ void weak_function lm3s_ssiinitialize(void) * ****************************************************************************/ -void lm3s_spiselect(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected) +void lm_spiselect(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected) { ssidbg("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert"); - ssi_dumpgpio("lm3s_spiselect() Entry"); + ssi_dumpgpio("lm_spiselect() Entry"); if (devid == SPIDEV_MMCSD) { /* Assert the CS pin to the card */ - lm3s_gpiowrite(SDCCS_GPIO, !selected); + lm_gpiowrite(SDCCS_GPIO, !selected); } - ssi_dumpgpio("lm3s_spiselect() Exit"); + ssi_dumpgpio("lm_spiselect() Exit"); } -uint8_t lm3s_spistatus(FAR struct spi_dev_s *dev, enum spi_dev_e devid) +uint8_t lm_spistatus(FAR struct spi_dev_s *dev, enum spi_dev_e devid) { ssidbg("Returning SPI_STATUS_PRESENT\n"); return SPI_STATUS_PRESENT; diff --git a/nuttx/configs/lm3s6965-ek/README.txt b/nuttx/configs/lm3s6965-ek/README.txt index e0349f5def..813e11467f 100644 --- a/nuttx/configs/lm3s6965-ek/README.txt +++ b/nuttx/configs/lm3s6965-ek/README.txt @@ -126,12 +126,12 @@ GNU Toolchain Options the CodeSourcery or devkitARM, you simply need to add one of the following configuration options to your .config (or defconfig) file: - CONFIG_LM3S_CODESOURCERYW=y : CodeSourcery under Windows - CONFIG_LM3S_CODESOURCERYL=y : CodeSourcery under Linux - CONFIG_LM3S_DEVKITARM=y : devkitARM under Windows - CONFIG_LM3S_BUILDROOT=y : NuttX buildroot under Linux or Cygwin (default) + CONFIG_LM_CODESOURCERYW=y : CodeSourcery under Windows + CONFIG_LM_CODESOURCERYL=y : CodeSourcery under Linux + CONFIG_LM_DEVKITARM=y : devkitARM under Windows + CONFIG_LM_BUILDROOT=y : NuttX buildroot under Linux or Cygwin (default) - If you are not using CONFIG_LM3S_BUILDROOT, then you may also have to modify + If you are not using CONFIG_LM_BUILDROOT, then you may also have to modify the PATH in the setenv.h file if your make cannot find the tools. NOTE: the CodeSourcery (for Windows) and devkitARM are Windows native toolchains. @@ -415,15 +415,15 @@ Stellaris LM3S6965 Evaluation Kit Configuration Options Additional interrupt support can be disabled if desired to reduce memory footprint. - CONFIG_LM3S_DISABLE_GPIOA_IRQS=n - CONFIG_LM3S_DISABLE_GPIOB_IRQS=n - CONFIG_LM3S_DISABLE_GPIOC_IRQS=n - CONFIG_LM3S_DISABLE_GPIOD_IRQS=n - CONFIG_LM3S_DISABLE_GPIOE_IRQS=n - CONFIG_LM3S_DISABLE_GPIOF_IRQS=n - CONFIG_LM3S_DISABLE_GPIOG_IRQS=n - CONFIG_LM3S_DISABLE_GPIOH_IRQS=n - CONFIG_LM3S_DISABLE_GPIOJ_IRQS=y + CONFIG_LM_DISABLE_GPIOA_IRQS=n + CONFIG_LM_DISABLE_GPIOB_IRQS=n + CONFIG_LM_DISABLE_GPIOC_IRQS=n + CONFIG_LM_DISABLE_GPIOD_IRQS=n + CONFIG_LM_DISABLE_GPIOE_IRQS=n + CONFIG_LM_DISABLE_GPIOF_IRQS=n + CONFIG_LM_DISABLE_GPIOG_IRQS=n + CONFIG_LM_DISABLE_GPIOH_IRQS=n + CONFIG_LM_DISABLE_GPIOJ_IRQS=y LM3S6818 specific device driver settings @@ -448,18 +448,18 @@ Stellaris LM3S6965 Evaluation Kit Configuration Options value is large, then larger values of this setting may cause Rx FIFO overrun errors. Default: half of the Tx FIFO size (4). - CONFIG_LM3S_ETHERNET - This must be set (along with CONFIG_NET) + CONFIG_LM_ETHERNET - This must be set (along with CONFIG_NET) to build the LM3S Ethernet driver - CONFIG_LM3S_ETHLEDS - Enable to use Ethernet LEDs on the board. - CONFIG_LM3S_BOARDMAC - If the board-specific logic can provide + CONFIG_LM_ETHLEDS - Enable to use Ethernet LEDs on the board. + CONFIG_LM_BOARDMAC - If the board-specific logic can provide a MAC address (via lm_ethernetmac()), then this should be selected. - CONFIG_LM3S_ETHHDUPLEX - Set to force half duplex operation - CONFIG_LM3S_ETHNOAUTOCRC - Set to suppress auto-CRC generation - CONFIG_LM3S_ETHNOPAD - Set to suppress Tx padding - CONFIG_LM3S_MULTICAST - Set to enable multicast frames - CONFIG_LM3S_PROMISCUOUS - Set to enable promiscuous mode - CONFIG_LM3S_BADCRC - Set to enable bad CRC rejection. - CONFIG_LM3S_DUMPPACKET - Dump each packet received/sent to the console. + CONFIG_LM_ETHHDUPLEX - Set to force half duplex operation + CONFIG_LM_ETHNOAUTOCRC - Set to suppress auto-CRC generation + CONFIG_LM_ETHNOPAD - Set to suppress Tx padding + CONFIG_LM_MULTICAST - Set to enable multicast frames + CONFIG_LM_PROMISCUOUS - Set to enable promiscuous mode + CONFIG_LM_BADCRC - Set to enable bad CRC rejection. + CONFIG_LM_DUMPPACKET - Dump each packet received/sent to the console. Configurations ^^^^^^^^^^^^^^ diff --git a/nuttx/configs/lm3s6965-ek/include/board.h b/nuttx/configs/lm3s6965-ek/include/board.h index e8eaf9dd1a..808d009ccd 100644 --- a/nuttx/configs/lm3s6965-ek/include/board.h +++ b/nuttx/configs/lm3s6965-ek/include/board.h @@ -112,7 +112,7 @@ #ifndef __ASSEMBLY__ /************************************************************************************ - * Name: lm3s_boardinitialize + * Name: lm_boardinitialize * * Description: * All LM3S architectures must provide the following entry point. This entry point @@ -121,21 +121,21 @@ * ************************************************************************************/ -extern void lm3s_boardinitialize(void); +extern void lm_boardinitialize(void); /************************************************************************************ - * Name: lm3s_ethernetmac + * Name: lm_ethernetmac * * Description: * For the Ethernet Eval Kits, the MAC address will be stored in the non-volatile - * USER0 and USER1 registers. If CONFIG_LM3S_BOARDMAC is defined, this function + * USER0 and USER1 registers. If CONFIG_LM_BOARDMAC is defined, this function * will obtain the MAC address from these registers. * ************************************************************************************/ -#ifdef CONFIG_LM3S_BOARDMAC +#ifdef CONFIG_LM_BOARDMAC struct ether_addr; -extern void lm3s_ethernetmac(struct ether_addr *ethaddr); +extern void lm_ethernetmac(struct ether_addr *ethaddr); #endif #endif /* __ASSEMBLY__ */ diff --git a/nuttx/configs/lm3s6965-ek/nsh/defconfig b/nuttx/configs/lm3s6965-ek/nsh/defconfig index c1827920b9..99f2f50ab4 100755 --- a/nuttx/configs/lm3s6965-ek/nsh/defconfig +++ b/nuttx/configs/lm3s6965-ek/nsh/defconfig @@ -100,44 +100,44 @@ CONFIG_ARMV7M_OABI_TOOLCHAIN=y # CONFIG_ARCH_CHIP_LM3S6432 is not set CONFIG_ARCH_CHIP_LM3S6965=y # CONFIG_ARCH_CHIP_LM3S8962 is not set -# CONFIG_LM3S_REVA2 is not set -CONFIG_LM3S_DFU=y +# CONFIG_LM_REVA2 is not set +CONFIG_LM_DFU=y # # Select LM3S Peripheral Support # -CONFIG_LM3S_UART0=y -# CONFIG_LM3S_UART1 is not set +CONFIG_LM_UART0=y +# CONFIG_LM_UART1 is not set # CONFIG_SSI0_DISABLE is not set CONFIG_SSI1_DISABLE=y -# CONFIG_LM3S_UART2 is not set -CONFIG_LM3S_ETHERNET=y +# CONFIG_LM_UART2 is not set +CONFIG_LM_ETHERNET=y # # Disable GPIO Interrupts # -# CONFIG_LM3S_DISABLE_GPIOA_IRQS is not set -# CONFIG_LM3S_DISABLE_GPIOB_IRQS is not set -# CONFIG_LM3S_DISABLE_GPIOC_IRQS is not set -# CONFIG_LM3S_DISABLE_GPIOD_IRQS is not set -# CONFIG_LM3S_DISABLE_GPIOE_IRQS is not set -# CONFIG_LM3S_DISABLE_GPIOF_IRQS is not set -# CONFIG_LM3S_DISABLE_GPIOG_IRQS is not set -CONFIG_LM3S_DISABLE_GPIOH_IRQS=y -CONFIG_LM3S_DISABLE_GPIOJ_IRQS=y +# CONFIG_LM_DISABLE_GPIOA_IRQS is not set +# CONFIG_LM_DISABLE_GPIOB_IRQS is not set +# CONFIG_LM_DISABLE_GPIOC_IRQS is not set +# CONFIG_LM_DISABLE_GPIOD_IRQS is not set +# CONFIG_LM_DISABLE_GPIOE_IRQS is not set +# CONFIG_LM_DISABLE_GPIOF_IRQS is not set +# CONFIG_LM_DISABLE_GPIOG_IRQS is not set +CONFIG_LM_DISABLE_GPIOH_IRQS=y +CONFIG_LM_DISABLE_GPIOJ_IRQS=y # # LM3S Ethernet Configuration # -# CONFIG_LM3S_ETHLEDS is not set -# CONFIG_LM3S_BOARDMAC is not set -# CONFIG_LM3S_ETHHDUPLEX is not set -# CONFIG_LM3S_ETHNOAUTOCRC is not set -# CONFIG_LM3S_ETHNOPAD is not set -# CONFIG_LM3S_MULTICAST is not set -# CONFIG_LM3S_PROMISCUOUS is not set -# CONFIG_LM3S_TIMESTAMP is not set -# CONFIG_LM3S_BADCRC is not set +# CONFIG_LM_ETHLEDS is not set +# CONFIG_LM_BOARDMAC is not set +# CONFIG_LM_ETHHDUPLEX is not set +# CONFIG_LM_ETHNOAUTOCRC is not set +# CONFIG_LM_ETHNOPAD is not set +# CONFIG_LM_MULTICAST is not set +# CONFIG_LM_PROMISCUOUS is not set +# CONFIG_LM_TIMESTAMP is not set +# CONFIG_LM_BADCRC is not set # CONFIG_M3S_DUMPPACKET is not set # diff --git a/nuttx/configs/lm3s6965-ek/nx/defconfig b/nuttx/configs/lm3s6965-ek/nx/defconfig index e3cac8dd75..b86d06dc9c 100755 --- a/nuttx/configs/lm3s6965-ek/nx/defconfig +++ b/nuttx/configs/lm3s6965-ek/nx/defconfig @@ -100,31 +100,31 @@ CONFIG_ARMV7M_OABI_TOOLCHAIN=y # CONFIG_ARCH_CHIP_LM3S6432 is not set CONFIG_ARCH_CHIP_LM3S6965=y # CONFIG_ARCH_CHIP_LM3S8962 is not set -# CONFIG_LM3S_REVA2 is not set -CONFIG_LM3S_DFU=y +# CONFIG_LM_REVA2 is not set +CONFIG_LM_DFU=y # # Select LM3S Peripheral Support # -CONFIG_LM3S_UART0=y -# CONFIG_LM3S_UART1 is not set +CONFIG_LM_UART0=y +# CONFIG_LM_UART1 is not set # CONFIG_SSI0_DISABLE is not set CONFIG_SSI1_DISABLE=y -# CONFIG_LM3S_UART2 is not set -# CONFIG_LM3S_ETHERNET is not set +# CONFIG_LM_UART2 is not set +# CONFIG_LM_ETHERNET is not set # # Disable GPIO Interrupts # -# CONFIG_LM3S_DISABLE_GPIOA_IRQS is not set -# CONFIG_LM3S_DISABLE_GPIOB_IRQS is not set -# CONFIG_LM3S_DISABLE_GPIOC_IRQS is not set -# CONFIG_LM3S_DISABLE_GPIOD_IRQS is not set -# CONFIG_LM3S_DISABLE_GPIOE_IRQS is not set -# CONFIG_LM3S_DISABLE_GPIOF_IRQS is not set -# CONFIG_LM3S_DISABLE_GPIOG_IRQS is not set -CONFIG_LM3S_DISABLE_GPIOH_IRQS=y -CONFIG_LM3S_DISABLE_GPIOJ_IRQS=y +# CONFIG_LM_DISABLE_GPIOA_IRQS is not set +# CONFIG_LM_DISABLE_GPIOB_IRQS is not set +# CONFIG_LM_DISABLE_GPIOC_IRQS is not set +# CONFIG_LM_DISABLE_GPIOD_IRQS is not set +# CONFIG_LM_DISABLE_GPIOE_IRQS is not set +# CONFIG_LM_DISABLE_GPIOF_IRQS is not set +# CONFIG_LM_DISABLE_GPIOG_IRQS is not set +CONFIG_LM_DISABLE_GPIOH_IRQS=y +CONFIG_LM_DISABLE_GPIOJ_IRQS=y # # LM3S SSI Configuration diff --git a/nuttx/configs/lm3s6965-ek/ostest/defconfig b/nuttx/configs/lm3s6965-ek/ostest/defconfig index 81247c795d..bc433e1166 100755 --- a/nuttx/configs/lm3s6965-ek/ostest/defconfig +++ b/nuttx/configs/lm3s6965-ek/ostest/defconfig @@ -100,31 +100,31 @@ CONFIG_ARMV7M_OABI_TOOLCHAIN=y # CONFIG_ARCH_CHIP_LM3S6432 is not set CONFIG_ARCH_CHIP_LM3S6965=y # CONFIG_ARCH_CHIP_LM3S8962 is not set -# CONFIG_LM3S_REVA2 is not set -CONFIG_LM3S_DFU=y +# CONFIG_LM_REVA2 is not set +CONFIG_LM_DFU=y # # Select LM3S Peripheral Support # -CONFIG_LM3S_UART0=y -# CONFIG_LM3S_UART1 is not set +CONFIG_LM_UART0=y +# CONFIG_LM_UART1 is not set # CONFIG_SSI0_DISABLE is not set CONFIG_SSI1_DISABLE=y -# CONFIG_LM3S_UART2 is not set -# CONFIG_LM3S_ETHERNET is not set +# CONFIG_LM_UART2 is not set +# CONFIG_LM_ETHERNET is not set # # Disable GPIO Interrupts # -# CONFIG_LM3S_DISABLE_GPIOA_IRQS is not set -# CONFIG_LM3S_DISABLE_GPIOB_IRQS is not set -# CONFIG_LM3S_DISABLE_GPIOC_IRQS is not set -# CONFIG_LM3S_DISABLE_GPIOD_IRQS is not set -# CONFIG_LM3S_DISABLE_GPIOE_IRQS is not set -# CONFIG_LM3S_DISABLE_GPIOF_IRQS is not set -# CONFIG_LM3S_DISABLE_GPIOG_IRQS is not set -CONFIG_LM3S_DISABLE_GPIOH_IRQS=y -CONFIG_LM3S_DISABLE_GPIOJ_IRQS=y +# CONFIG_LM_DISABLE_GPIOA_IRQS is not set +# CONFIG_LM_DISABLE_GPIOB_IRQS is not set +# CONFIG_LM_DISABLE_GPIOC_IRQS is not set +# CONFIG_LM_DISABLE_GPIOD_IRQS is not set +# CONFIG_LM_DISABLE_GPIOE_IRQS is not set +# CONFIG_LM_DISABLE_GPIOF_IRQS is not set +# CONFIG_LM_DISABLE_GPIOG_IRQS is not set +CONFIG_LM_DISABLE_GPIOH_IRQS=y +CONFIG_LM_DISABLE_GPIOJ_IRQS=y # # LM3S SSI Configuration diff --git a/nuttx/configs/lm3s6965-ek/src/lm3s6965ek_internal.h b/nuttx/configs/lm3s6965-ek/src/lm3s6965ek_internal.h index 4cd2eddc76..c2fc50df1f 100644 --- a/nuttx/configs/lm3s6965-ek/src/lm3s6965ek_internal.h +++ b/nuttx/configs/lm3s6965-ek/src/lm3s6965ek_internal.h @@ -123,14 +123,14 @@ #ifndef __ASSEMBLY__ /************************************************************************************ - * Name: lm3s_ssiinitialize + * Name: lm_ssiinitialize * * Description: * Called to configure SPI chip select GPIO pins for the LM3S6965 Eval Kit. * ************************************************************************************/ -extern void weak_function lm3s_ssiinitialize(void); +extern void weak_function lm_ssiinitialize(void); #endif /* __ASSEMBLY__ */ #endif /* __CONFIGS_LM3S6965_EK_SRC_LM3S6965EK_INTERNAL_H */ diff --git a/nuttx/configs/lm3s6965-ek/src/up_boot.c b/nuttx/configs/lm3s6965-ek/src/up_boot.c index 7f887be620..7ffd37f170 100644 --- a/nuttx/configs/lm3s6965-ek/src/up_boot.c +++ b/nuttx/configs/lm3s6965-ek/src/up_boot.c @@ -61,7 +61,7 @@ ************************************************************************************/ /************************************************************************************ - * Name: lm3s_boardinitialize + * Name: lm_boardinitialize * * Description: * All LM3S architectures must provide the following entry point. This entry point @@ -69,18 +69,18 @@ * and mapped but before any devices have been initialized. ************************************************************************************/ -void lm3s_boardinitialize(void) +void lm_boardinitialize(void) { /* Configure SPI chip selects if 1) SSI is not disabled, and 2) the weak function - * lm3s_ssiinitialize() has been brought into the link. + * lm_ssiinitialize() has been brought into the link. */ /* The LM3S6965 Eval Kit microSD CS and OLED are on SSI0 (Duh! There is no SSI1) */ #if !defined(CONFIG_SSI0_DISABLE) /* || !defined(CONFIG_SSI1_DISABLE) */ - if (lm3s_ssiinitialize) + if (lm_ssiinitialize) { - lm3s_ssiinitialize(); + lm_ssiinitialize(); } #endif diff --git a/nuttx/configs/lm3s6965-ek/src/up_ethernet.c b/nuttx/configs/lm3s6965-ek/src/up_ethernet.c index 4f402cae70..2d114baaa9 100644 --- a/nuttx/configs/lm3s6965-ek/src/up_ethernet.c +++ b/nuttx/configs/lm3s6965-ek/src/up_ethernet.c @@ -63,17 +63,17 @@ ************************************************************************************/ /************************************************************************************ - * Name: lm3s_ethernetmac + * Name: lm_ethernetmac * * Description: * For the Ethernet Eval Kits, the MAC address will be stored in the non-volatile - * USER0 and USER1 registers. If CONFIG_LM3S_BOARDMAC is defined, this function + * USER0 and USER1 registers. If CONFIG_LM_BOARDMAC is defined, this function * will obtain the MAC address from these registers. * ************************************************************************************/ -#ifdef CONFIG_LM3S_BOARDMAC -void lm3s_ethernetmac(struct ether_addr *ethaddr) +#ifdef CONFIG_LM_BOARDMAC +void lm_ethernetmac(struct ether_addr *ethaddr) { uint32_t user0; uint32_t user1; diff --git a/nuttx/configs/lm3s6965-ek/src/up_leds.c b/nuttx/configs/lm3s6965-ek/src/up_leds.c index efa1eb7388..0e6c5e50f1 100644 --- a/nuttx/configs/lm3s6965-ek/src/up_leds.c +++ b/nuttx/configs/lm3s6965-ek/src/up_leds.c @@ -72,7 +72,7 @@ /* Dump GPIO registers */ #ifdef LED_DEBUG -# define led_dumpgpio(m) lm3s_dumpgpio(LED_GPIO, m) +# define led_dumpgpio(m) lm_dumpgpio(LED_GPIO, m) #else # define led_dumpgpio(m) #endif @@ -102,9 +102,9 @@ void up_ledinit(void) /* Configure Port E, Bit 1 as an output, initial value=OFF */ - led_dumpgpio("up_ledinit before lm3s_configgpio()"); - lm3s_configgpio(LED_GPIO); - led_dumpgpio("up_ledinit after lm3s_configgpio()"); + led_dumpgpio("up_ledinit before lm_configgpio()"); + lm_configgpio(LED_GPIO); + led_dumpgpio("up_ledinit after lm_configgpio()"); g_nest = 0; } @@ -128,9 +128,9 @@ void up_ledon(int led) g_nest++; case LED_IRQSENABLED: case LED_STACKCREATED: - led_dumpgpio("up_ledon: before lm3s_gpiowrite()"); - lm3s_gpiowrite(LED_GPIO, false); - led_dumpgpio("up_ledon: after lm3s_gpiowrite()"); + led_dumpgpio("up_ledon: before lm_gpiowrite()"); + lm_gpiowrite(LED_GPIO, false); + led_dumpgpio("up_ledon: after lm_gpiowrite()"); break; } } @@ -156,9 +156,9 @@ void up_ledoff(int led) case LED_PANIC: if (--g_nest <= 0) { - led_dumpgpio("up_ledoff: before lm3s_gpiowrite()"); - lm3s_gpiowrite(LED_GPIO, true); - led_dumpgpio("up_ledoff: after lm3s_gpiowrite()"); + led_dumpgpio("up_ledoff: before lm_gpiowrite()"); + lm_gpiowrite(LED_GPIO, true); + led_dumpgpio("up_ledoff: after lm_gpiowrite()"); } break; } diff --git a/nuttx/configs/lm3s6965-ek/src/up_oled.c b/nuttx/configs/lm3s6965-ek/src/up_oled.c index 23ce7e036c..07e7859b4a 100644 --- a/nuttx/configs/lm3s6965-ek/src/up_oled.c +++ b/nuttx/configs/lm3s6965-ek/src/up_oled.c @@ -72,8 +72,8 @@ #ifdef CONFIG_LCD_RITDEBUG # define ritdbg(format, arg...) vdbg(format, ##arg) -# define oleddc_dumpgpio(m) lm3s_dumpgpio(OLEDDC_GPIO, m) -# define oledcs_dumpgpio(m) lm3s_dumpgpio(OLEDCS_GPIO, m) +# define oleddc_dumpgpio(m) lm_dumpgpio(OLEDDC_GPIO, m) +# define oledcs_dumpgpio(m) lm_dumpgpio(OLEDCS_GPIO, m) #else # define ritdbg(x...) # define oleddc_dumpgpio(m) @@ -102,8 +102,8 @@ FAR struct lcd_dev_s *up_nxdrvinit(unsigned int devno) oledcs_dumpgpio("up_nxdrvinit: After OLEDCS setup"); oleddc_dumpgpio("up_nxdrvinit: On entry"); - lm3s_configgpio(OLEDDC_GPIO); /* PC7: OLED display data/control select (D/Cn) */ - lm3s_configgpio(OLEDEN_GPIO); /* PC6: Enable +15V needed by OLED (EN+15V) */ + lm_configgpio(OLEDDC_GPIO); /* PC7: OLED display data/control select (D/Cn) */ + lm_configgpio(OLEDEN_GPIO); /* PC6: Enable +15V needed by OLED (EN+15V) */ oleddc_dumpgpio("up_nxdrvinit: After OLEDDC/EN setup"); @@ -137,7 +137,7 @@ FAR struct lcd_dev_s *up_nxdrvinit(unsigned int devno) } /****************************************************************************** - * Name: lm3s_spicmddata + * Name: lm_spicmddata * * Description: * Set or clear the SD1329 D/Cn bit to select data (true) or command @@ -159,13 +159,13 @@ FAR struct lcd_dev_s *up_nxdrvinit(unsigned int devno) * ******************************************************************************/ -int lm3s_spicmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd) +int lm_spicmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd) { if (devid == SPIDEV_DISPLAY) { /* Set GPIO to 1 for data, 0 for command */ - lm3s_gpiowrite(OLEDDC_GPIO, !cmd); + lm_gpiowrite(OLEDDC_GPIO, !cmd); return OK; } return -ENODEV; diff --git a/nuttx/configs/lm3s6965-ek/src/up_ssi.c b/nuttx/configs/lm3s6965-ek/src/up_ssi.c index b52116f145..92138f3a69 100644 --- a/nuttx/configs/lm3s6965-ek/src/up_ssi.c +++ b/nuttx/configs/lm3s6965-ek/src/up_ssi.c @@ -81,7 +81,7 @@ /* Dump GPIO registers */ #ifdef SSI_VERBOSE -# define ssi_dumpgpio(m) lm3s_dumpgpio(SDCCS_GPIO, m) +# define ssi_dumpgpio(m) lm_dumpgpio(SDCCS_GPIO, m) #else # define ssi_dumpgpio(m) #endif @@ -95,33 +95,33 @@ ************************************************************************************/ /************************************************************************************ - * Name: lm3s_ssiinitialize + * Name: lm_ssiinitialize * * Description: * Called to configure SPI chip select GPIO pins for the LM3S6965 Eval Kit. * ************************************************************************************/ -void weak_function lm3s_ssiinitialize(void) +void weak_function lm_ssiinitialize(void) { /* Configure the SPI-based microSD CS GPIO */ - ssi_dumpgpio("lm3s_ssiinitialize() Entry)"); - lm3s_configgpio(SDCCS_GPIO); + ssi_dumpgpio("lm_ssiinitialize() Entry)"); + lm_configgpio(SDCCS_GPIO); #ifdef CONFIG_NX_LCDDRIVER - lm3s_configgpio(OLEDCS_GPIO); + lm_configgpio(OLEDCS_GPIO); #endif - ssi_dumpgpio("lm3s_ssiinitialize() Exit"); + ssi_dumpgpio("lm_ssiinitialize() Exit"); } /**************************************************************************** - * The external functions, lm3s_spiselect and lm3s_spistatus must be provided + * The external functions, lm_spiselect and lm_spistatus must be provided * by board-specific logic. The are implementations of the select and status * methods SPI interface defined by struct spi_ops_s (see include/nuttx/spi.h). * All othermethods (including up_spiinitialize()) are provided by common * logic. To use this common SPI logic on your board: * - * 1. Provide lm3s_spiselect() and lm3s_spistatus() functions in your + * 1. Provide lm_spiselect() and lm_spistatus() functions in your * board-specific logic. This function will perform chip selection and * status operations using GPIOs in the way your board is configured. * 2. Add a call to up_spiinitialize() in your low level initialization @@ -133,29 +133,29 @@ void weak_function lm3s_ssiinitialize(void) * ****************************************************************************/ -void lm3s_spiselect(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected) +void lm_spiselect(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected) { ssidbg("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert"); - ssi_dumpgpio("lm3s_spiselect() Entry"); + ssi_dumpgpio("lm_spiselect() Entry"); if (devid == SPIDEV_MMCSD) { /* Assert the CS pin to the card */ - lm3s_gpiowrite(SDCCS_GPIO, !selected); + lm_gpiowrite(SDCCS_GPIO, !selected); } #ifdef CONFIG_NX_LCDDRIVER else if (devid == SPIDEV_DISPLAY) { /* Assert the CS pin to the display */ - lm3s_gpiowrite(OLEDCS_GPIO, !selected); + lm_gpiowrite(OLEDCS_GPIO, !selected); } #endif - ssi_dumpgpio("lm3s_spiselect() Exit"); + ssi_dumpgpio("lm_spiselect() Exit"); } -uint8_t lm3s_spistatus(FAR struct spi_dev_s *dev, enum spi_dev_e devid) +uint8_t lm_spistatus(FAR struct spi_dev_s *dev, enum spi_dev_e devid) { ssidbg("Returning SPI_STATUS_PRESENT\n"); return SPI_STATUS_PRESENT; diff --git a/nuttx/configs/lm3s8962-ek/README.txt b/nuttx/configs/lm3s8962-ek/README.txt index 0f796e38dc..38ed76aeaa 100644 --- a/nuttx/configs/lm3s8962-ek/README.txt +++ b/nuttx/configs/lm3s8962-ek/README.txt @@ -126,12 +126,12 @@ GNU Toolchain Options the CodeSourcery or devkitARM, you simply need to add one of the following configuration options to your .config (or defconfig) file: - CONFIG_LM3S_CODESOURCERYW=y : CodeSourcery under Windows - CONFIG_LM3S_CODESOURCERYL=y : CodeSourcery under Linux - CONFIG_LM3S_DEVKITARM=y : devkitARM under Windows - CONFIG_LM3S_BUILDROOT=y : NuttX buildroot under Linux or Cygwin (default) + CONFIG_LM_CODESOURCERYW=y : CodeSourcery under Windows + CONFIG_LM_CODESOURCERYL=y : CodeSourcery under Linux + CONFIG_LM_DEVKITARM=y : devkitARM under Windows + CONFIG_LM_BUILDROOT=y : NuttX buildroot under Linux or Cygwin (default) - If you are not using CONFIG_LM3S_BUILDROOT, then you may also have to modify + If you are not using CONFIG_LM_BUILDROOT, then you may also have to modify the PATH in the setenv.h file if your make cannot find the tools. NOTE: the CodeSourcery (for Windows) and devkitARM are Windows native toolchains. @@ -399,15 +399,15 @@ Stellaris LM3S8962 Evaluation Kit Configuration Options Additional interrupt support can be disabled if desired to reduce memory footprint. - CONFIG_LM3S_DISABLE_GPIOA_IRQS=n - CONFIG_LM3S_DISABLE_GPIOB_IRQS=n - CONFIG_LM3S_DISABLE_GPIOC_IRQS=n - CONFIG_LM3S_DISABLE_GPIOD_IRQS=n - CONFIG_LM3S_DISABLE_GPIOE_IRQS=n - CONFIG_LM3S_DISABLE_GPIOF_IRQS=n - CONFIG_LM3S_DISABLE_GPIOG_IRQS=n - CONFIG_LM3S_DISABLE_GPIOH_IRQS=n - CONFIG_LM3S_DISABLE_GPIOJ_IRQS=y + CONFIG_LM_DISABLE_GPIOA_IRQS=n + CONFIG_LM_DISABLE_GPIOB_IRQS=n + CONFIG_LM_DISABLE_GPIOC_IRQS=n + CONFIG_LM_DISABLE_GPIOD_IRQS=n + CONFIG_LM_DISABLE_GPIOE_IRQS=n + CONFIG_LM_DISABLE_GPIOF_IRQS=n + CONFIG_LM_DISABLE_GPIOG_IRQS=n + CONFIG_LM_DISABLE_GPIOH_IRQS=n + CONFIG_LM_DISABLE_GPIOJ_IRQS=y LM3S6818 specific device driver settings @@ -432,18 +432,18 @@ Stellaris LM3S8962 Evaluation Kit Configuration Options value is large, then larger values of this setting may cause Rx FIFO overrun errors. Default: half of the Tx FIFO size (4). - CONFIG_LM3S_ETHERNET - This must be set (along with CONFIG_NET) + CONFIG_LM_ETHERNET - This must be set (along with CONFIG_NET) to build the LM3S Ethernet driver - CONFIG_LM3S_ETHLEDS - Enable to use Ethernet LEDs on the board. - CONFIG_LM3S_BOARDMAC - If the board-specific logic can provide + CONFIG_LM_ETHLEDS - Enable to use Ethernet LEDs on the board. + CONFIG_LM_BOARDMAC - If the board-specific logic can provide a MAC address (via lm_ethernetmac()), then this should be selected. - CONFIG_LM3S_ETHHDUPLEX - Set to force half duplex operation - CONFIG_LM3S_ETHNOAUTOCRC - Set to suppress auto-CRC generation - CONFIG_LM3S_ETHNOPAD - Set to suppress Tx padding - CONFIG_LM3S_MULTICAST - Set to enable multicast frames - CONFIG_LM3S_PROMISCUOUS - Set to enable promiscuous mode - CONFIG_LM3S_BADCRC - Set to enable bad CRC rejection. - CONFIG_LM3S_DUMPPACKET - Dump each packet received/sent to the console. + CONFIG_LM_ETHHDUPLEX - Set to force half duplex operation + CONFIG_LM_ETHNOAUTOCRC - Set to suppress auto-CRC generation + CONFIG_LM_ETHNOPAD - Set to suppress Tx padding + CONFIG_LM_MULTICAST - Set to enable multicast frames + CONFIG_LM_PROMISCUOUS - Set to enable promiscuous mode + CONFIG_LM_BADCRC - Set to enable bad CRC rejection. + CONFIG_LM_DUMPPACKET - Dump each packet received/sent to the console. Configurations ^^^^^^^^^^^^^^ diff --git a/nuttx/configs/lm3s8962-ek/include/board.h b/nuttx/configs/lm3s8962-ek/include/board.h index 0b03f96f04..4d6a0c3024 100644 --- a/nuttx/configs/lm3s8962-ek/include/board.h +++ b/nuttx/configs/lm3s8962-ek/include/board.h @@ -112,7 +112,7 @@ #ifndef __ASSEMBLY__ /************************************************************************************ - * Name: lm3s_boardinitialize + * Name: lm_boardinitialize * * Description: * All LM3S architectures must provide the following entry point. This entry point @@ -121,21 +121,21 @@ * ************************************************************************************/ -extern void lm3s_boardinitialize(void); +extern void lm_boardinitialize(void); /************************************************************************************ - * Name: lm3s_ethernetmac + * Name: lm_ethernetmac * * Description: * For the Ethernet Eval Kits, the MAC address will be stored in the non-volatile - * USER0 and USER1 registers. If CONFIG_LM3S_BOARDMAC is defined, this function + * USER0 and USER1 registers. If CONFIG_LM_BOARDMAC is defined, this function * will obtain the MAC address from these registers. * ************************************************************************************/ -#ifdef CONFIG_LM3S_BOARDMAC +#ifdef CONFIG_LM_BOARDMAC struct ether_addr; -extern void lm3s_ethernetmac(struct ether_addr *ethaddr); +extern void lm_ethernetmac(struct ether_addr *ethaddr); #endif #endif /* __ASSEMBLY__ */ diff --git a/nuttx/configs/lm3s8962-ek/nsh/defconfig b/nuttx/configs/lm3s8962-ek/nsh/defconfig index 1d3df2fa79..4a35f8d4a9 100755 --- a/nuttx/configs/lm3s8962-ek/nsh/defconfig +++ b/nuttx/configs/lm3s8962-ek/nsh/defconfig @@ -56,32 +56,32 @@ CONFIG_ARCH_CALIBRATION=n # # Identify toolchain and linker options # -CONFIG_LM3S_CODESOURCERYW=n -CONFIG_LM3S_CODESOURCERYL=n -CONFIG_LM3S_DEVKITARM=n -CONFIG_LM3S_BUILDROOT=y -CONFIG_LM3S_DFU=y +CONFIG_LM_CODESOURCERYW=n +CONFIG_LM_CODESOURCERYL=n +CONFIG_LM_DEVKITARM=n +CONFIG_LM_BUILDROOT=y +CONFIG_LM_DFU=y # # Disable support for interrupts on GPIOH and GPIOJ which do not # exist on the LM3S6B96. Additional interrupt support can be # disabled if desired to reduce memory footprint. -CONFIG_LM3S_DISABLE_GPIOA_IRQS=n -CONFIG_LM3S_DISABLE_GPIOB_IRQS=n -CONFIG_LM3S_DISABLE_GPIOC_IRQS=n -CONFIG_LM3S_DISABLE_GPIOD_IRQS=n -CONFIG_LM3S_DISABLE_GPIOE_IRQS=n -CONFIG_LM3S_DISABLE_GPIOF_IRQS=n -CONFIG_LM3S_DISABLE_GPIOG_IRQS=n -CONFIG_LM3S_DISABLE_GPIOH_IRQS=y -CONFIG_LM3S_DISABLE_GPIOJ_IRQS=y +CONFIG_LM_DISABLE_GPIOA_IRQS=n +CONFIG_LM_DISABLE_GPIOB_IRQS=n +CONFIG_LM_DISABLE_GPIOC_IRQS=n +CONFIG_LM_DISABLE_GPIOD_IRQS=n +CONFIG_LM_DISABLE_GPIOE_IRQS=n +CONFIG_LM_DISABLE_GPIOF_IRQS=n +CONFIG_LM_DISABLE_GPIOG_IRQS=n +CONFIG_LM_DISABLE_GPIOH_IRQS=y +CONFIG_LM_DISABLE_GPIOJ_IRQS=y # # LM3S8962 specific serial device driver settings # -CONFIG_LM3S_UART0=y -CONFIG_LM3S_UART1=n -CONFIG_LM3S_UART2=n +CONFIG_LM_UART0=y +CONFIG_LM_UART1=n +CONFIG_LM_UART2=n CONFIG_UART0_SERIAL_CONSOLE=y CONFIG_UART1_SERIAL_CONSOLE=n CONFIG_UART2_SERIAL_CONSOLE=n @@ -115,16 +115,16 @@ CONFIG_SSI_POLLWAIT=y # # LM3S8962 specific serial device driver settings # -CONFIG_LM3S_ETHERNET=y -CONFIG_LM3S_ETHLEDS=n -CONFIG_LM3S_BOARDMAC=n -CONFIG_LM3S_ETHHDUPLEX=n -CONFIG_LM3S_ETHNOAUTOCRC=n -CONFIG_LM3S_ETHNOPAD=n -CONFIG_LM3S_MULTICAST=n -CONFIG_LM3S_PROMISCUOUS=n -CONFIG_LM3S_BADCRC=n -CONFIG_LM3S_DUMPPACKET=n +CONFIG_LM_ETHERNET=y +CONFIG_LM_ETHLEDS=n +CONFIG_LM_BOARDMAC=n +CONFIG_LM_ETHHDUPLEX=n +CONFIG_LM_ETHNOAUTOCRC=n +CONFIG_LM_ETHNOPAD=n +CONFIG_LM_MULTICAST=n +CONFIG_LM_PROMISCUOUS=n +CONFIG_LM_BADCRC=n +CONFIG_LM_DUMPPACKET=n # # General build options diff --git a/nuttx/configs/lm3s8962-ek/nx/defconfig b/nuttx/configs/lm3s8962-ek/nx/defconfig index 37fc8903dd..3ca6ade216 100755 --- a/nuttx/configs/lm3s8962-ek/nx/defconfig +++ b/nuttx/configs/lm3s8962-ek/nx/defconfig @@ -56,32 +56,32 @@ CONFIG_ARCH_CALIBRATION=n # # Identify toolchain and linker options # -CONFIG_LM3S_CODESOURCERYW=n -CONFIG_LM3S_CODESOURCERYL=n -CONFIG_LM3S_DEVKITARM=n -CONFIG_LM3S_BUILDROOT=y -CONFIG_LM3S_DFU=y +CONFIG_LM_CODESOURCERYW=n +CONFIG_LM_CODESOURCERYL=n +CONFIG_LM_DEVKITARM=n +CONFIG_LM_BUILDROOT=y +CONFIG_LM_DFU=y # # Disable support for interrupts on GPIOH and GPIOJ which do not # exist on the LM3S6B96. Additional interrupt support can be # disabled if desired to reduce memory footprint. -CONFIG_LM3S_DISABLE_GPIOA_IRQS=n -CONFIG_LM3S_DISABLE_GPIOB_IRQS=n -CONFIG_LM3S_DISABLE_GPIOC_IRQS=n -CONFIG_LM3S_DISABLE_GPIOD_IRQS=n -CONFIG_LM3S_DISABLE_GPIOE_IRQS=n -CONFIG_LM3S_DISABLE_GPIOF_IRQS=n -CONFIG_LM3S_DISABLE_GPIOG_IRQS=n -CONFIG_LM3S_DISABLE_GPIOH_IRQS=y -CONFIG_LM3S_DISABLE_GPIOJ_IRQS=y +CONFIG_LM_DISABLE_GPIOA_IRQS=n +CONFIG_LM_DISABLE_GPIOB_IRQS=n +CONFIG_LM_DISABLE_GPIOC_IRQS=n +CONFIG_LM_DISABLE_GPIOD_IRQS=n +CONFIG_LM_DISABLE_GPIOE_IRQS=n +CONFIG_LM_DISABLE_GPIOF_IRQS=n +CONFIG_LM_DISABLE_GPIOG_IRQS=n +CONFIG_LM_DISABLE_GPIOH_IRQS=y +CONFIG_LM_DISABLE_GPIOJ_IRQS=y # # LM3S8962 specific serial device driver settings # -CONFIG_LM3S_UART0=y -CONFIG_LM3S_UART1=n -CONFIG_LM3S_UART2=n +CONFIG_LM_UART0=y +CONFIG_LM_UART1=n +CONFIG_LM_UART2=n CONFIG_UART0_SERIAL_CONSOLE=y CONFIG_UART1_SERIAL_CONSOLE=n CONFIG_UART2_SERIAL_CONSOLE=n @@ -115,16 +115,16 @@ CONFIG_SSI_POLLWAIT=y # # LM3S8962 specific serial device driver settings # -CONFIG_LM3S_ETHERNET=n -CONFIG_LM3S_ETHLEDS=n -CONFIG_LM3S_BOARDMAC=y -CONFIG_LM3S_ETHHDUPLEX=n -CONFIG_LM3S_ETHNOAUTOCRC=n -CONFIG_LM3S_ETHNOPAD=n -CONFIG_LM3S_MULTICAST=n -CONFIG_LM3S_PROMISCUOUS=n -CONFIG_LM3S_BADCRC=n -CONFIG_LM3S_DUMPPACKET=n +CONFIG_LM_ETHERNET=n +CONFIG_LM_ETHLEDS=n +CONFIG_LM_BOARDMAC=y +CONFIG_LM_ETHHDUPLEX=n +CONFIG_LM_ETHNOAUTOCRC=n +CONFIG_LM_ETHNOPAD=n +CONFIG_LM_MULTICAST=n +CONFIG_LM_PROMISCUOUS=n +CONFIG_LM_BADCRC=n +CONFIG_LM_DUMPPACKET=n # # General build options diff --git a/nuttx/configs/lm3s8962-ek/ostest/defconfig b/nuttx/configs/lm3s8962-ek/ostest/defconfig index 731003fd0e..169ac9c8f5 100755 --- a/nuttx/configs/lm3s8962-ek/ostest/defconfig +++ b/nuttx/configs/lm3s8962-ek/ostest/defconfig @@ -56,32 +56,32 @@ CONFIG_ARCH_CALIBRATION=n # # Identify toolchain and linker options # -CONFIG_LM3S_CODESOURCERYW=n -CONFIG_LM3S_CODESOURCERYL=n -CONFIG_LM3S_DEVKITARM=n -CONFIG_LM3S_BUILDROOT=y -CONFIG_LM3S_DFU=y +CONFIG_LM_CODESOURCERYW=n +CONFIG_LM_CODESOURCERYL=n +CONFIG_LM_DEVKITARM=n +CONFIG_LM_BUILDROOT=y +CONFIG_LM_DFU=y # # Disable support for interrupts on GPIOH and GPIOJ which do not # exist on the LM3S6B96. Additional interrupt support can be # disabled if desired to reduce memory footprint. -CONFIG_LM3S_DISABLE_GPIOA_IRQS=n -CONFIG_LM3S_DISABLE_GPIOB_IRQS=n -CONFIG_LM3S_DISABLE_GPIOC_IRQS=n -CONFIG_LM3S_DISABLE_GPIOD_IRQS=n -CONFIG_LM3S_DISABLE_GPIOE_IRQS=n -CONFIG_LM3S_DISABLE_GPIOF_IRQS=n -CONFIG_LM3S_DISABLE_GPIOG_IRQS=n -CONFIG_LM3S_DISABLE_GPIOH_IRQS=y -CONFIG_LM3S_DISABLE_GPIOJ_IRQS=y +CONFIG_LM_DISABLE_GPIOA_IRQS=n +CONFIG_LM_DISABLE_GPIOB_IRQS=n +CONFIG_LM_DISABLE_GPIOC_IRQS=n +CONFIG_LM_DISABLE_GPIOD_IRQS=n +CONFIG_LM_DISABLE_GPIOE_IRQS=n +CONFIG_LM_DISABLE_GPIOF_IRQS=n +CONFIG_LM_DISABLE_GPIOG_IRQS=n +CONFIG_LM_DISABLE_GPIOH_IRQS=y +CONFIG_LM_DISABLE_GPIOJ_IRQS=y # # LM3S8962 specific serial device driver settings # -CONFIG_LM3S_UART0=y -CONFIG_LM3S_UART1=n -CONFIG_LM3S_UART2=n +CONFIG_LM_UART0=y +CONFIG_LM_UART1=n +CONFIG_LM_UART2=n CONFIG_UART0_SERIAL_CONSOLE=y CONFIG_UART1_SERIAL_CONSOLE=n CONFIG_UART2_SERIAL_CONSOLE=n @@ -115,16 +115,16 @@ CONFIG_SSI_POLLWAIT=y # # LM3S8962 specific serial device driver settings # -CONFIG_LM3S_ETHERNET=n -CONFIG_LM3S_ETHLEDS=n -CONFIG_LM3S_BOARDMAC=y -CONFIG_LM3S_ETHHDUPLEX=n -CONFIG_LM3S_ETHNOAUTOCRC=n -CONFIG_LM3S_ETHNOPAD=n -CONFIG_LM3S_MULTICAST=n -CONFIG_LM3S_PROMISCUOUS=n -CONFIG_LM3S_BADCRC=n -CONFIG_LM3S_DUMPPACKET=n +CONFIG_LM_ETHERNET=n +CONFIG_LM_ETHLEDS=n +CONFIG_LM_BOARDMAC=y +CONFIG_LM_ETHHDUPLEX=n +CONFIG_LM_ETHNOAUTOCRC=n +CONFIG_LM_ETHNOPAD=n +CONFIG_LM_MULTICAST=n +CONFIG_LM_PROMISCUOUS=n +CONFIG_LM_BADCRC=n +CONFIG_LM_DUMPPACKET=n # # General build options diff --git a/nuttx/configs/lm3s8962-ek/src/lm3s8962ek_internal.h b/nuttx/configs/lm3s8962-ek/src/lm3s8962ek_internal.h index 689472f158..7fc8fa331d 100644 --- a/nuttx/configs/lm3s8962-ek/src/lm3s8962ek_internal.h +++ b/nuttx/configs/lm3s8962-ek/src/lm3s8962ek_internal.h @@ -123,14 +123,14 @@ #ifndef __ASSEMBLY__ /************************************************************************************ - * Name: lm3s_ssiinitialize + * Name: lm_ssiinitialize * * Description: * Called to configure SPI chip select GPIO pins for the LM3S8962 Eval Kit. * ************************************************************************************/ -extern void weak_function lm3s_ssiinitialize(void); +extern void weak_function lm_ssiinitialize(void); #endif /* __ASSEMBLY__ */ #endif /* __CONFIGS_LM3S8962_EK_SRC_LM3S8962EK_INTERNAL_H */ diff --git a/nuttx/configs/lm3s8962-ek/src/up_boot.c b/nuttx/configs/lm3s8962-ek/src/up_boot.c index 0a976e8572..8dc5b81cc2 100644 --- a/nuttx/configs/lm3s8962-ek/src/up_boot.c +++ b/nuttx/configs/lm3s8962-ek/src/up_boot.c @@ -61,7 +61,7 @@ ************************************************************************************/ /************************************************************************************ - * Name: lm3s_boardinitialize + * Name: lm_boardinitialize * * Description: * All LM3S architectures must provide the following entry point. This entry point @@ -69,18 +69,18 @@ * and mapped but before any devices have been initialized. ************************************************************************************/ -void lm3s_boardinitialize(void) +void lm_boardinitialize(void) { /* Configure SPI chip selects if 1) SSI is not disabled, and 2) the weak function - * lm3s_ssiinitialize() has been brought into the link. + * lm_ssiinitialize() has been brought into the link. */ /* The LM3S8962 Eval Kit microSD CS and OLED are on SSI0 (Duh! There is no SSI1) */ #if !defined(CONFIG_SSI0_DISABLE) /* || !defined(CONFIG_SSI1_DISABLE) */ - if (lm3s_ssiinitialize) + if (lm_ssiinitialize) { - lm3s_ssiinitialize(); + lm_ssiinitialize(); } #endif diff --git a/nuttx/configs/lm3s8962-ek/src/up_ethernet.c b/nuttx/configs/lm3s8962-ek/src/up_ethernet.c index 2cad50bef9..0d73233a4d 100644 --- a/nuttx/configs/lm3s8962-ek/src/up_ethernet.c +++ b/nuttx/configs/lm3s8962-ek/src/up_ethernet.c @@ -63,17 +63,17 @@ ************************************************************************************/ /************************************************************************************ - * Name: lm3s_ethernetmac + * Name: lm_ethernetmac * * Description: * For the Ethernet Eval Kits, the MAC address will be stored in the non-volatile - * USER0 and USER1 registers. If CONFIG_LM3S_BOARDMAC is defined, this function + * USER0 and USER1 registers. If CONFIG_LM_BOARDMAC is defined, this function * will obtain the MAC address from these registers. * ************************************************************************************/ -#ifdef CONFIG_LM3S_BOARDMAC -void lm3s_ethernetmac(struct ether_addr *ethaddr) +#ifdef CONFIG_LM_BOARDMAC +void lm_ethernetmac(struct ether_addr *ethaddr) { uint32_t user0; uint32_t user1; diff --git a/nuttx/configs/lm3s8962-ek/src/up_leds.c b/nuttx/configs/lm3s8962-ek/src/up_leds.c index d5000d0379..a20617f1e1 100644 --- a/nuttx/configs/lm3s8962-ek/src/up_leds.c +++ b/nuttx/configs/lm3s8962-ek/src/up_leds.c @@ -72,7 +72,7 @@ /* Dump GPIO registers */ #ifdef LED_DEBUG -# define led_dumpgpio(m) lm3s_dumpgpio(LED_GPIO, m) +# define led_dumpgpio(m) lm_dumpgpio(LED_GPIO, m) #else # define led_dumpgpio(m) #endif @@ -102,9 +102,9 @@ void up_ledinit(void) /* Configure Port E, Bit 1 as an output, initial value=OFF */ - led_dumpgpio("up_ledinit before lm3s_configgpio()"); - lm3s_configgpio(LED_GPIO); - led_dumpgpio("up_ledinit after lm3s_configgpio()"); + led_dumpgpio("up_ledinit before lm_configgpio()"); + lm_configgpio(LED_GPIO); + led_dumpgpio("up_ledinit after lm_configgpio()"); g_nest = 0; } @@ -128,9 +128,9 @@ void up_ledon(int led) g_nest++; case LED_IRQSENABLED: case LED_STACKCREATED: - led_dumpgpio("up_ledon: before lm3s_gpiowrite()"); - lm3s_gpiowrite(LED_GPIO, false); - led_dumpgpio("up_ledon: after lm3s_gpiowrite()"); + led_dumpgpio("up_ledon: before lm_gpiowrite()"); + lm_gpiowrite(LED_GPIO, false); + led_dumpgpio("up_ledon: after lm_gpiowrite()"); break; } } @@ -156,9 +156,9 @@ void up_ledoff(int led) case LED_PANIC: if (--g_nest <= 0) { - led_dumpgpio("up_ledoff: before lm3s_gpiowrite()"); - lm3s_gpiowrite(LED_GPIO, true); - led_dumpgpio("up_ledoff: after lm3s_gpiowrite()"); + led_dumpgpio("up_ledoff: before lm_gpiowrite()"); + lm_gpiowrite(LED_GPIO, true); + led_dumpgpio("up_ledoff: after lm_gpiowrite()"); } break; } diff --git a/nuttx/configs/lm3s8962-ek/src/up_oled.c b/nuttx/configs/lm3s8962-ek/src/up_oled.c index 3324b38974..05934e8bd7 100644 --- a/nuttx/configs/lm3s8962-ek/src/up_oled.c +++ b/nuttx/configs/lm3s8962-ek/src/up_oled.c @@ -72,8 +72,8 @@ #ifdef CONFIG_LCD_RITDEBUG # define ritdbg(format, arg...) vdbg(format, ##arg) -# define oleddc_dumpgpio(m) lm3s_dumpgpio(OLEDDC_GPIO, m) -# define oledcs_dumpgpio(m) lm3s_dumpgpio(OLEDCS_GPIO, m) +# define oleddc_dumpgpio(m) lm_dumpgpio(OLEDDC_GPIO, m) +# define oledcs_dumpgpio(m) lm_dumpgpio(OLEDCS_GPIO, m) #else # define ritdbg(x...) # define oleddc_dumpgpio(m) @@ -102,8 +102,8 @@ FAR struct lcd_dev_s *up_nxdrvinit(unsigned int devno) oledcs_dumpgpio("up_nxdrvinit: After OLEDCS setup"); oleddc_dumpgpio("up_nxdrvinit: On entry"); - lm3s_configgpio(OLEDDC_GPIO); /* PC7: OLED display data/control select (D/Cn) */ - lm3s_configgpio(OLEDEN_GPIO); /* PC6: Enable +15V needed by OLED (EN+15V) */ + lm_configgpio(OLEDDC_GPIO); /* PC7: OLED display data/control select (D/Cn) */ + lm_configgpio(OLEDEN_GPIO); /* PC6: Enable +15V needed by OLED (EN+15V) */ oleddc_dumpgpio("up_nxdrvinit: After OLEDDC/EN setup"); @@ -137,7 +137,7 @@ FAR struct lcd_dev_s *up_nxdrvinit(unsigned int devno) } /****************************************************************************** - * Name: lm3s_spicmddata + * Name: lm_spicmddata * * Description: * Set or clear the SD1329 D/Cn bit to select data (true) or command @@ -159,13 +159,13 @@ FAR struct lcd_dev_s *up_nxdrvinit(unsigned int devno) * ******************************************************************************/ -int lm3s_spicmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd) +int lm_spicmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd) { if (devid == SPIDEV_DISPLAY) { /* Set GPIO to 1 for data, 0 for command */ - lm3s_gpiowrite(OLEDDC_GPIO, !cmd); + lm_gpiowrite(OLEDDC_GPIO, !cmd); return OK; } return -ENODEV; diff --git a/nuttx/configs/lm3s8962-ek/src/up_ssi.c b/nuttx/configs/lm3s8962-ek/src/up_ssi.c index 7f78b3477a..50344857a1 100644 --- a/nuttx/configs/lm3s8962-ek/src/up_ssi.c +++ b/nuttx/configs/lm3s8962-ek/src/up_ssi.c @@ -81,7 +81,7 @@ /* Dump GPIO registers */ #ifdef SSI_VERBOSE -# define ssi_dumpgpio(m) lm3s_dumpgpio(SDCCS_GPIO, m) +# define ssi_dumpgpio(m) lm_dumpgpio(SDCCS_GPIO, m) #else # define ssi_dumpgpio(m) #endif @@ -95,33 +95,33 @@ ************************************************************************************/ /************************************************************************************ - * Name: lm3s_ssiinitialize + * Name: lm_ssiinitialize * * Description: * Called to configure SPI chip select GPIO pins for the LM3S8962 Eval Kit. * ************************************************************************************/ -void weak_function lm3s_ssiinitialize(void) +void weak_function lm_ssiinitialize(void) { /* Configure the SPI-based microSD CS GPIO */ - ssi_dumpgpio("lm3s_ssiinitialize() Entry)"); - lm3s_configgpio(SDCCS_GPIO); + ssi_dumpgpio("lm_ssiinitialize() Entry)"); + lm_configgpio(SDCCS_GPIO); #ifdef CONFIG_NX_LCDDRIVER - lm3s_configgpio(OLEDCS_GPIO); + lm_configgpio(OLEDCS_GPIO); #endif - ssi_dumpgpio("lm3s_ssiinitialize() Exit"); + ssi_dumpgpio("lm_ssiinitialize() Exit"); } /**************************************************************************** - * The external functions, lm3s_spiselect and lm3s_spistatus must be provided + * The external functions, lm_spiselect and lm_spistatus must be provided * by board-specific logic. The are implementations of the select and status * methods SPI interface defined by struct spi_ops_s (see include/nuttx/spi.h). * All othermethods (including up_spiinitialize()) are provided by common * logic. To use this common SPI logic on your board: * - * 1. Provide lm3s_spiselect() and lm3s_spistatus() functions in your + * 1. Provide lm_spiselect() and lm_spistatus() functions in your * board-specific logic. This function will perform chip selection and * status operations using GPIOs in the way your board is configured. * 2. Add a call to up_spiinitialize() in your low level initialization @@ -133,29 +133,29 @@ void weak_function lm3s_ssiinitialize(void) * ****************************************************************************/ -void lm3s_spiselect(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected) +void lm_spiselect(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected) { ssidbg("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert"); - ssi_dumpgpio("lm3s_spiselect() Entry"); + ssi_dumpgpio("lm_spiselect() Entry"); if (devid == SPIDEV_MMCSD) { /* Assert the CS pin to the card */ - lm3s_gpiowrite(SDCCS_GPIO, !selected); + lm_gpiowrite(SDCCS_GPIO, !selected); } #ifdef CONFIG_NX_LCDDRIVER else if (devid == SPIDEV_DISPLAY) { /* Assert the CS pin to the display */ - lm3s_gpiowrite(OLEDCS_GPIO, !selected); + lm_gpiowrite(OLEDCS_GPIO, !selected); } #endif - ssi_dumpgpio("lm3s_spiselect() Exit"); + ssi_dumpgpio("lm_spiselect() Exit"); } -uint8_t lm3s_spistatus(FAR struct spi_dev_s *dev, enum spi_dev_e devid) +uint8_t lm_spistatus(FAR struct spi_dev_s *dev, enum spi_dev_e devid) { ssidbg("Returning SPI_STATUS_PRESENT\n"); return SPI_STATUS_PRESENT; From 35cc14be43ed9ed33da6eb63d66627765cf9f157 Mon Sep 17 00:00:00 2001 From: patacongo Date: Wed, 9 Jan 2013 18:15:02 +0000 Subject: [PATCH 051/118] Change naming of all Stellaris pre-processor symbols from LM3S_ to LM_ to make room in the namespace for LM4F git-svn-id: http://svn.code.sf.net/p/nuttx/code/trunk@5498 42af7a65-404d-4744-a932-0658087f49c3 --- nuttx/arch/arm/include/lm/chip.h | 104 +-- nuttx/arch/arm/include/lm/irq.h | 650 +++++++++--------- nuttx/arch/arm/src/lm/chip/lm3s_memorymap.h | 506 +++++++------- nuttx/arch/arm/src/lm/chip/lm3s_pinmap.h | 2 +- nuttx/arch/arm/src/lm/chip/lm_epi.h | 26 +- nuttx/arch/arm/src/lm/chip/lm_ethernet.h | 100 +-- nuttx/arch/arm/src/lm/chip/lm_flash.h | 94 +-- nuttx/arch/arm/src/lm/chip/lm_gpio.h | 646 ++++++++--------- nuttx/arch/arm/src/lm/chip/lm_i2c.h | 142 ++-- nuttx/arch/arm/src/lm/chip/lm_pinmap.h | 2 +- nuttx/arch/arm/src/lm/chip/lm_ssi.h | 262 +++---- nuttx/arch/arm/src/lm/chip/lm_syscontrol.h | 122 ++-- nuttx/arch/arm/src/lm/chip/lm_timer.h | 40 +- nuttx/arch/arm/src/lm/chip/lm_uart.h | 254 +++---- nuttx/arch/arm/src/lm/lm_dumpgpio.c | 28 +- nuttx/arch/arm/src/lm/lm_ethernet.c | 252 +++---- nuttx/arch/arm/src/lm/lm_ethernet.h | 6 +- nuttx/arch/arm/src/lm/lm_gpio.c | 96 +-- nuttx/arch/arm/src/lm/lm_gpioirq.c | 91 ++- nuttx/arch/arm/src/lm/lm_irq.c | 52 +- nuttx/arch/arm/src/lm/lm_lowputc.c | 92 +-- nuttx/arch/arm/src/lm/lm_serial.c | 78 +-- nuttx/arch/arm/src/lm/lm_ssi.c | 112 +-- nuttx/arch/arm/src/lm/lm_syscontrol.c | 30 +- nuttx/arch/arm/src/lm/lm_timerisr.c | 4 +- nuttx/arch/arm/src/lm/lm_vectors.S | 402 +++++------ nuttx/configs/avr32dev1/README.txt | 6 +- nuttx/configs/eagle100/README.txt | 4 +- nuttx/configs/eagle100/include/board.h | 12 +- .../configs/eagle100/src/eagle100_internal.h | 4 +- nuttx/configs/eagle100/src/up_boot.c | 7 +- nuttx/configs/eagle100/src/up_ethernet.c | 4 +- nuttx/configs/ekk-lm3s9b96/README.txt | 8 +- nuttx/configs/ekk-lm3s9b96/include/board.h | 12 +- .../ekk-lm3s9b96/src/ekklm3s9b96_internal.h | 4 +- nuttx/configs/ekk-lm3s9b96/src/up_boot.c | 7 +- nuttx/configs/ekk-lm3s9b96/src/up_ethernet.c | 4 +- nuttx/configs/lm3s6432-s2e/README.txt | 4 +- nuttx/configs/lm3s6432-s2e/include/board.h | 12 +- .../lm3s6432-s2e/src/lm3s6432s2e_internal.h | 2 +- nuttx/configs/lm3s6432-s2e/src/up_boot.c | 7 +- nuttx/configs/lm3s6432-s2e/src/up_ethernet.c | 4 +- nuttx/configs/lm3s6965-ek/README.txt | 8 +- nuttx/configs/lm3s6965-ek/include/board.h | 12 +- nuttx/configs/lm3s6965-ek/nsh/defconfig | 8 +- nuttx/configs/lm3s6965-ek/nx/defconfig | 6 +- nuttx/configs/lm3s6965-ek/ostest/defconfig | 6 +- .../lm3s6965-ek/src/lm3s6965ek_internal.h | 4 +- nuttx/configs/lm3s6965-ek/src/up_boot.c | 7 +- nuttx/configs/lm3s6965-ek/src/up_ethernet.c | 4 +- nuttx/configs/lm3s8962-ek/README.txt | 8 +- nuttx/configs/lm3s8962-ek/include/board.h | 12 +- .../lm3s8962-ek/src/lm3s8962ek_internal.h | 4 +- nuttx/configs/lm3s8962-ek/src/up_boot.c | 7 +- nuttx/configs/lm3s8962-ek/src/up_ethernet.c | 4 +- nuttx/configs/lpcxpresso-lpc1768/README.txt | 2 +- nuttx/configs/lpcxpresso-lpc1768/src/up_ssp.c | 4 +- nuttx/configs/nucleus2g/src/up_ssp.c | 4 +- nuttx/include/nuttx/net/mii.h | 168 ++--- 59 files changed, 2282 insertions(+), 2280 deletions(-) diff --git a/nuttx/arch/arm/include/lm/chip.h b/nuttx/arch/arm/include/lm/chip.h index 9eee51922e..8293c79380 100644 --- a/nuttx/arch/arm/include/lm/chip.h +++ b/nuttx/arch/arm/include/lm/chip.h @@ -49,63 +49,63 @@ /* Get customizations for each supported chip (only the LM3S6918 and 65 right now) */ #if defined(CONFIG_ARCH_CHIP_LM3S6918) -# define LM3S_NTIMERS 4 /* Four general purpose timers */ -# define LM3S_NETHCONTROLLERS 1 /* One Ethernet controller */ -# undef LM3S_ETHTS /* No timestamp register */ -# define LM3S_NSSI 2 /* Two SSI modules */ -# define LM3S_NUARTS 2 /* Two UART modules */ -# define LM3S_NI2C 2 /* Two I2C modules */ -# define LM3S_NADC 1 /* One ADC module */ -# define LM2S_NPWM 0 /* No PWM generator modules */ -# define LM3S_NQEI 0 /* No quadrature encoders */ -# define LM3S_NPORTS 8 /* 8 Ports (GPIOA-H) 5-38 GPIOs */ +# define LM_NTIMERS 4 /* Four general purpose timers */ +# define LM_NETHCONTROLLERS 1 /* One Ethernet controller */ +# undef LM_ETHTS /* No timestamp register */ +# define LM_NSSI 2 /* Two SSI modules */ +# define LM_NUARTS 2 /* Two UART modules */ +# define LM_NI2C 2 /* Two I2C modules */ +# define LM_NADC 1 /* One ADC module */ +# define LM_NPWM 0 /* No PWM generator modules */ +# define LM_NQEI 0 /* No quadrature encoders */ +# define LM_NPORTS 8 /* 8 Ports (GPIOA-H) 5-38 GPIOs */ #elif defined(CONFIG_ARCH_CHIP_LM3S6432) -# define LM3S_NTIMERS 3 /* Three general purpose timers */ -# define LM3S_NETHCONTROLLERS 1 /* One Ethernet controller */ -# undef LM3S_ETHTS /* No timestamp register */ -# define LM3S_NSSI 1 /* One SSI module */ -# define LM3S_NUARTS 2 /* Two UART modules */ -# define LM3S_NI2C 1 /* Two I2C modules */ -# define LM3S_NADC 1 /* One ADC module */ -# define LM2S_NPWM 1 /* One PWM generator module */ -# define LM3S_NQEI 0 /* No quadrature encoders */ -# define LM3S_NPORTS 7 /* 7 Ports (GPIOA-G), 0-42 GPIOs */ +# define LM_NTIMERS 3 /* Three general purpose timers */ +# define LM_NETHCONTROLLERS 1 /* One Ethernet controller */ +# undef LM_ETHTS /* No timestamp register */ +# define LM_NSSI 1 /* One SSI module */ +# define LM_NUARTS 2 /* Two UART modules */ +# define LM_NI2C 1 /* Two I2C modules */ +# define LM_NADC 1 /* One ADC module */ +# define LM_NPWM 1 /* One PWM generator module */ +# define LM_NQEI 0 /* No quadrature encoders */ +# define LM_NPORTS 7 /* 7 Ports (GPIOA-G), 0-42 GPIOs */ #elif defined(CONFIG_ARCH_CHIP_LM3S6965) -# define LM3S_NTIMERS 4 /* Four general purpose timers */ -# define LM3S_NETHCONTROLLERS 1 /* One Ethernet controller */ -# undef LM3S_ETHTS /* No timestamp register */ -# define LM3S_NSSI 1 /* One SSI module */ -# define LM3S_NUARTS 3 /* Three UART modules */ -# define LM3S_NI2C 2 /* Two I2C modules */ -# define LM3S_NADC 1 /* One ADC module */ -# define LM2S_NPWM 3 /* Three PWM generator modules */ -# define LM3S_NQEI 2 /* Two quadrature encoders */ -# define LM3S_NPORTS 7 /* 7 Ports (GPIOA-G), 0-42 GPIOs */ +# define LM_NTIMERS 4 /* Four general purpose timers */ +# define LM_NETHCONTROLLERS 1 /* One Ethernet controller */ +# undef LM_ETHTS /* No timestamp register */ +# define LM_NSSI 1 /* One SSI module */ +# define LM_NUARTS 3 /* Three UART modules */ +# define LM_NI2C 2 /* Two I2C modules */ +# define LM_NADC 1 /* One ADC module */ +# define LM_NPWM 3 /* Three PWM generator modules */ +# define LM_NQEI 2 /* Two quadrature encoders */ +# define LM_NPORTS 7 /* 7 Ports (GPIOA-G), 0-42 GPIOs */ #elif defined(CONFIG_ARCH_CHIP_LM3S9B96) -# define LM3S_NTIMERS 4 /* Four general purpose timers */ -# define LM3S_NETHCONTROLLERS 1 /* One Ethernet controller */ -# undef LM3S_ETHTS /* No timestamp register */ -# define LM3S_NSSI 2 /* Two SSI modules */ -# define LM3S_NUARTS 3 /* Three UART modules */ -# define LM3S_NI2C 2 /* Two I2C modules */ -# define LM3S_NADC 2 /* Two ADC module */ -# define LM3S_CAN 2 /* Two CAN module */ -# define LM3S_NPWM 4 /* Four PWM generator modules */ -# define LM3S_NQEI 2 /* Two quadrature encoders */ -# define LM3S_NPORTS 9 /* 9 Ports (GPIOA-H,J) 0-65 GPIOs */ +# define LM_NTIMERS 4 /* Four general purpose timers */ +# define LM_NETHCONTROLLERS 1 /* One Ethernet controller */ +# undef LM_ETHTS /* No timestamp register */ +# define LM_NSSI 2 /* Two SSI modules */ +# define LM_NUARTS 3 /* Three UART modules */ +# define LM_NI2C 2 /* Two I2C modules */ +# define LM_NADC 2 /* Two ADC module */ +# define LM_CAN 2 /* Two CAN module */ +# define LM_NPWM 4 /* Four PWM generator modules */ +# define LM_NQEI 2 /* Two quadrature encoders */ +# define LM_NPORTS 9 /* 9 Ports (GPIOA-H,J) 0-65 GPIOs */ #elif defined(CONFIG_ARCH_CHIP_LM3S8962) -# define LM3S_NTIMERS 4 /* Four general purpose timers */ -# define LM3S_NETHCONTROLLERS 1 /* One Ethernet controller */ -# define LM3S_NSSI 1 /* One SSI module */ -# define LM3S_NUARTS 3 /* Two UART modules */ -# define LM3S_NI2C 2 /* One I2C module */ -# define LM3S_NADC 1 /* One ADC module */ -# define LM2S_NPWM 3 /* Three PWM generator modules */ -# define LM3S_NQEI 2 /* Two quadrature encoders */ -# define LM3S_NPORTS 7 /* 7 Ports (GPIOA-G), 5-42 GPIOs */ -# define LC3S_CANCONTROLLER 1 /* One CAN controller */ +# define LM_NTIMERS 4 /* Four general purpose timers */ +# define LM_NETHCONTROLLERS 1 /* One Ethernet controller */ +# define LM_NSSI 1 /* One SSI module */ +# define LM_NUARTS 3 /* Two UART modules */ +# define LM_NI2C 2 /* One I2C module */ +# define LM_NADC 1 /* One ADC module */ +# define LM_NPWM 3 /* Three PWM generator modules */ +# define LM_NQEI 2 /* Two quadrature encoders */ +# define LM_NPORTS 7 /* 7 Ports (GPIOA-G), 5-42 GPIOs */ +# define LM_CANCONTROLLER 1 /* One CAN controller */ #else -# error "Capabilities not specified for this LM3S chip" +# error "Capabilities not specified for this Stellaris chip" #endif /************************************************************************************ diff --git a/nuttx/arch/arm/include/lm/irq.h b/nuttx/arch/arm/include/lm/irq.h index 136496fef7..9a5a3d1539 100644 --- a/nuttx/arch/arm/include/lm/irq.h +++ b/nuttx/arch/arm/include/lm/irq.h @@ -58,250 +58,250 @@ /* Processor Exceptions (vectors 0-15) */ -#define LM3S_IRQ_RESERVED (0) /* Reserved vector (only used with CONFIG_DEBUG) */ - /* Vector 0: Reset stack pointer value */ - /* Vector 1: Reset (not handler as an IRQ) */ -#define LM3S_IRQ_NMI (2) /* Vector 2: Non-Maskable Interrupt (NMI) */ -#define LM3S_IRQ_HARDFAULT (3) /* Vector 3: Hard fault */ -#define LM3S_IRQ_MEMFAULT (4) /* Vector 4: Memory management (MPU) */ -#define LM3S_IRQ_BUSFAULT (5) /* Vector 5: Bus fault */ -#define LM3S_IRQ_USAGEFAULT (6) /* Vector 6: Usage fault */ -#define LM3S_IRQ_SVCALL (11) /* Vector 11: SVC call */ -#define LM3S_IRQ_DBGMONITOR (12) /* Vector 12: Debug Monitor */ - /* Vector 13: Reserved */ -#define LM3S_IRQ_PENDSV (14) /* Vector 14: Pendable system service request */ -#define LM3S_IRQ_SYSTICK (15) /* Vector 15: System tick */ +#define LM_IRQ_RESERVED (0) /* Reserved vector (only used with CONFIG_DEBUG) */ + /* Vector 0: Reset stack pointer value */ + /* Vector 1: Reset (not handler as an IRQ) */ +#define LM_IRQ_NMI (2) /* Vector 2: Non-Maskable Interrupt (NMI) */ +#define LM_IRQ_HARDFAULT (3) /* Vector 3: Hard fault */ +#define LM_IRQ_MEMFAULT (4) /* Vector 4: Memory management (MPU) */ +#define LM_IRQ_BUSFAULT (5) /* Vector 5: Bus fault */ +#define LM_IRQ_USAGEFAULT (6) /* Vector 6: Usage fault */ +#define LM_IRQ_SVCALL (11) /* Vector 11: SVC call */ +#define LM_IRQ_DBGMONITOR (12) /* Vector 12: Debug Monitor */ + /* Vector 13: Reserved */ +#define LM_IRQ_PENDSV (14) /* Vector 14: Pendable system service request */ +#define LM_IRQ_SYSTICK (15) /* Vector 15: System tick */ /* External interrupts (vectors >= 16) */ -#define LM3S_IRQ_INTERRUPTS (16) /* Vector number of the first external interrupt */ +#define LM_IRQ_INTERRUPTS (16) /* Vector number of the first external interrupt */ #if defined(CONFIG_ARCH_CHIP_LM3S6918) -# define LM3S_IRQ_GPIOA (16) /* Vector 16: GPIO Port A */ -# define LM3S_IRQ_GPIOB (17) /* Vector 17: GPIO Port B */ -# define LM3S_IRQ_GPIOC (18) /* Vector 18: GPIO Port C */ -# define LM3S_IRQ_GPIOD (19) /* Vector 19: GPIO Port D */ -# define LM3S_IRQ_GPIOE (20) /* Vector 20: GPIO Port E */ -# define LM3S_IRQ_UART0 (21) /* Vector 21: UART 0 */ -# define LM3S_IRQ_UART1 (22) /* Vector 22: UART 1 */ -# define LM3S_IRQ_SSI0 (23) /* Vector 23: SSI 0 */ -# define LM3S_IRQ_I2C0 (24) /* Vector 24: I2C 0 */ - /* Vector 25-29: Reserved */ -# define LM3S_IRQ_ADC0 (30) /* Vector 30: ADC Sequence 0 */ -# define LM3S_IRQ_ADC1 (31) /* Vector 31: ADC Sequence 1 */ -# define LM3S_IRQ_ADC2 (32) /* Vector 32: ADC Sequence 2 */ -# define LM3S_IRQ_ADC3 (33) /* Vector 33: ADC Sequence 3 */ -# define LM3S_IRQ_WDOG (34) /* Vector 34: Watchdog Timer */ -# define LM3S_IRQ_TIMER0A (35) /* Vector 35: Timer 0 A */ -# define LM3S_IRQ_TIMER0B (36) /* Vector 36: Timer 0 B */ -# define LM3S_IRQ_TIMER1A (37) /* Vector 37: Timer 1 A */ -# define LM3S_IRQ_TIMER1B (38) /* Vector 38: Timer 1 B */ -# define LM3S_IRQ_TIMER2A (39) /* Vector 39: Timer 2 A */ -# define LM3S_IRQ_TIMER2B (40) /* Vector 40: Timer 3 B */ -# define LM3S_IRQ_COMPARE0 (41) /* Vector 41: Analog Comparator 0 */ -# define LM3S_IRQ_COMPARE1 (42) /* Vector 42: Analog Comparator 1 */ - /* Vector 43: Reserved */ -# define LM3S_IRQ_SYSCON (44) /* Vector 44: System Control */ -# define LM3S_IRQ_FLASHCON (45) /* Vector 45: FLASH Control */ -# define LM3S_IRQ_GPIOF (46) /* Vector 46: GPIO Port F */ -# define LM3S_IRQ_GPIOG (47) /* Vector 47: GPIO Port G */ -# define LM3S_IRQ_GPIOH (48) /* Vector 48: GPIO Port H */ - /* Vector 49: Reserved */ -# define LM3S_IRQ_SSI1 (50) /* Vector 50: SSI 1 */ -# define LM3S_IRQ_TIMER3A (51) /* Vector 51: Timer 3 A */ -# define LM3S_IRQ_TIMER3B (52) /* Vector 52: Timer 3 B */ -# define LM3S_IRQ_I2C1 (53) /* Vector 53: I2C 1 */ - /* Vectors 54-57: Reserved */ -# define LM3S_IRQ_ETHCON (58) /* Vector 58: Ethernet Controller */ -# define LM3S_IRQ_HIBERNATE (59) /* Vector 59: Hibernation Module */ - /* Vectors 60-70: Reserved */ -# define NR_IRQS (60) /* (Really less because of reserved vectors) */ +# define LM_IRQ_GPIOA (16) /* Vector 16: GPIO Port A */ +# define LM_IRQ_GPIOB (17) /* Vector 17: GPIO Port B */ +# define LM_IRQ_GPIOC (18) /* Vector 18: GPIO Port C */ +# define LM_IRQ_GPIOD (19) /* Vector 19: GPIO Port D */ +# define LM_IRQ_GPIOE (20) /* Vector 20: GPIO Port E */ +# define LM_IRQ_UART0 (21) /* Vector 21: UART 0 */ +# define LM_IRQ_UART1 (22) /* Vector 22: UART 1 */ +# define LM_IRQ_SSI0 (23) /* Vector 23: SSI 0 */ +# define LM_IRQ_I2C0 (24) /* Vector 24: I2C 0 */ + /* Vector 25-29: Reserved */ +# define LM_IRQ_ADC0 (30) /* Vector 30: ADC Sequence 0 */ +# define LM_IRQ_ADC1 (31) /* Vector 31: ADC Sequence 1 */ +# define LM_IRQ_ADC2 (32) /* Vector 32: ADC Sequence 2 */ +# define LM_IRQ_ADC3 (33) /* Vector 33: ADC Sequence 3 */ +# define LM_IRQ_WDOG (34) /* Vector 34: Watchdog Timer */ +# define LM_IRQ_TIMER0A (35) /* Vector 35: Timer 0 A */ +# define LM_IRQ_TIMER0B (36) /* Vector 36: Timer 0 B */ +# define LM_IRQ_TIMER1A (37) /* Vector 37: Timer 1 A */ +# define LM_IRQ_TIMER1B (38) /* Vector 38: Timer 1 B */ +# define LM_IRQ_TIMER2A (39) /* Vector 39: Timer 2 A */ +# define LM_IRQ_TIMER2B (40) /* Vector 40: Timer 3 B */ +# define LM_IRQ_COMPARE0 (41) /* Vector 41: Analog Comparator 0 */ +# define LM_IRQ_COMPARE1 (42) /* Vector 42: Analog Comparator 1 */ + /* Vector 43: Reserved */ +# define LM_IRQ_SYSCON (44) /* Vector 44: System Control */ +# define LM_IRQ_FLASHCON (45) /* Vector 45: FLASH Control */ +# define LM_IRQ_GPIOF (46) /* Vector 46: GPIO Port F */ +# define LM_IRQ_GPIOG (47) /* Vector 47: GPIO Port G */ +# define LM_IRQ_GPIOH (48) /* Vector 48: GPIO Port H */ + /* Vector 49: Reserved */ +# define LM_IRQ_SSI1 (50) /* Vector 50: SSI 1 */ +# define LM_IRQ_TIMER3A (51) /* Vector 51: Timer 3 A */ +# define LM_IRQ_TIMER3B (52) /* Vector 52: Timer 3 B */ +# define LM_IRQ_I2C1 (53) /* Vector 53: I2C 1 */ + /* Vectors 54-57: Reserved */ +# define LM_IRQ_ETHCON (58) /* Vector 58: Ethernet Controller */ +# define LM_IRQ_HIBERNATE (59) /* Vector 59: Hibernation Module */ + /* Vectors 60-70: Reserved */ +# define NR_IRQS (60) /* (Really less because of reserved vectors) */ #elif defined(CONFIG_ARCH_CHIP_LM3S6432) -# define LM3S_IRQ_GPIOA (16) /* Vector 16: GPIO Port A */ -# define LM3S_IRQ_GPIOB (17) /* Vector 17: GPIO Port B */ -# define LM3S_IRQ_GPIOC (18) /* Vector 18: GPIO Port C */ -# define LM3S_IRQ_GPIOD (19) /* Vector 19: GPIO Port D */ -# define LM3S_IRQ_GPIOE (20) /* Vector 20: GPIO Port E */ -# define LM3S_IRQ_UART0 (21) /* Vector 21: UART 0 */ -# define LM3S_IRQ_UART1 (22) /* Vector 22: UART 1 */ -# define LM3S_IRQ_SSI0 (23) /* Vector 23: SSI 0 */ -# define LM3S_IRQ_I2C0 (24) /* Vector 24: I2C 0 */ - /* Vector 25: Reserved */ -# define LM3S_IRQ_PWM0 (26) /* Vector 26: PWM Generator 0 */ - /* Vectors 27-29: Reserved */ -# define LM3S_IRQ_ADC0 (30) /* Vector 30: ADC Sequence 0 */ -# define LM3S_IRQ_ADC1 (31) /* Vector 31: ADC Sequence 1 */ -# define LM3S_IRQ_ADC2 (32) /* Vector 32: ADC Sequence 2 */ -# define LM3S_IRQ_ADC3 (33) /* Vector 33: ADC Sequence 3 */ -# define LM3S_IRQ_WDOG (34) /* Vector 34: Watchdog Timer */ -# define LM3S_IRQ_TIMER0A (35) /* Vector 35: Timer 0 A */ -# define LM3S_IRQ_TIMER0B (36) /* Vector 36: Timer 0 B */ -# define LM3S_IRQ_TIMER1A (37) /* Vector 37: Timer 1 A */ -# define LM3S_IRQ_TIMER1B (38) /* Vector 38: Timer 1 B */ -# define LM3S_IRQ_TIMER2A (39) /* Vector 39: Timer 2 A */ -# define LM3S_IRQ_TIMER2B (40) /* Vector 40: Timer 3 B */ -# define LM3S_IRQ_COMPARE0 (41) /* Vector 41: Analog Comparator 0 */ -# define LM3S_IRQ_COMPARE1 (42) /* Vector 42: Analog Comparator 1 */ - /* Vector 43: Reserved */ -# define LM3S_IRQ_SYSCON (44) /* Vector 44: System Control */ -# define LM3S_IRQ_FLASHCON (45) /* Vector 45: FLASH Control */ -# define LM3S_IRQ_GPIOF (46) /* Vector 46: GPIO Port F */ -# define LM3S_IRQ_GPIOG (47) /* Vector 47: GPIO Port G */ - /* Vectors 48-57: Reserved */ -# define LM3S_IRQ_ETHCON (58) /* Vector 58: Ethernet Controller */ - /* Vectors 59-70: Reserved */ -# define NR_IRQS (60) /* (Really less because of reserved vectors) */ +# define LM_IRQ_GPIOA (16) /* Vector 16: GPIO Port A */ +# define LM_IRQ_GPIOB (17) /* Vector 17: GPIO Port B */ +# define LM_IRQ_GPIOC (18) /* Vector 18: GPIO Port C */ +# define LM_IRQ_GPIOD (19) /* Vector 19: GPIO Port D */ +# define LM_IRQ_GPIOE (20) /* Vector 20: GPIO Port E */ +# define LM_IRQ_UART0 (21) /* Vector 21: UART 0 */ +# define LM_IRQ_UART1 (22) /* Vector 22: UART 1 */ +# define LM_IRQ_SSI0 (23) /* Vector 23: SSI 0 */ +# define LM_IRQ_I2C0 (24) /* Vector 24: I2C 0 */ + /* Vector 25: Reserved */ +# define LM_IRQ_PWM0 (26) /* Vector 26: PWM Generator 0 */ + /* Vectors 27-29: Reserved */ +# define LM_IRQ_ADC0 (30) /* Vector 30: ADC Sequence 0 */ +# define LM_IRQ_ADC1 (31) /* Vector 31: ADC Sequence 1 */ +# define LM_IRQ_ADC2 (32) /* Vector 32: ADC Sequence 2 */ +# define LM_IRQ_ADC3 (33) /* Vector 33: ADC Sequence 3 */ +# define LM_IRQ_WDOG (34) /* Vector 34: Watchdog Timer */ +# define LM_IRQ_TIMER0A (35) /* Vector 35: Timer 0 A */ +# define LM_IRQ_TIMER0B (36) /* Vector 36: Timer 0 B */ +# define LM_IRQ_TIMER1A (37) /* Vector 37: Timer 1 A */ +# define LM_IRQ_TIMER1B (38) /* Vector 38: Timer 1 B */ +# define LM_IRQ_TIMER2A (39) /* Vector 39: Timer 2 A */ +# define LM_IRQ_TIMER2B (40) /* Vector 40: Timer 3 B */ +# define LM_IRQ_COMPARE0 (41) /* Vector 41: Analog Comparator 0 */ +# define LM_IRQ_COMPARE1 (42) /* Vector 42: Analog Comparator 1 */ + /* Vector 43: Reserved */ +# define LM_IRQ_SYSCON (44) /* Vector 44: System Control */ +# define LM_IRQ_FLASHCON (45) /* Vector 45: FLASH Control */ +# define LM_IRQ_GPIOF (46) /* Vector 46: GPIO Port F */ +# define LM_IRQ_GPIOG (47) /* Vector 47: GPIO Port G */ + /* Vectors 48-57: Reserved */ +# define LM_IRQ_ETHCON (58) /* Vector 58: Ethernet Controller */ + /* Vectors 59-70: Reserved */ +# define NR_IRQS (60) /* (Really less because of reserved vectors) */ #elif defined(CONFIG_ARCH_CHIP_LM3S6965) -# define LM3S_IRQ_GPIOA (16) /* Vector 16: GPIO Port A */ -# define LM3S_IRQ_GPIOB (17) /* Vector 17: GPIO Port B */ -# define LM3S_IRQ_GPIOC (18) /* Vector 18: GPIO Port C */ -# define LM3S_IRQ_GPIOD (19) /* Vector 19: GPIO Port D */ -# define LM3S_IRQ_GPIOE (20) /* Vector 20: GPIO Port E */ -# define LM3S_IRQ_UART0 (21) /* Vector 21: UART 0 */ -# define LM3S_IRQ_UART1 (22) /* Vector 22: UART 1 */ -# define LM3S_IRQ_SSI0 (23) /* Vector 23: SSI 0 */ -# define LM3S_IRQ_I2C0 (24) /* Vector 24: I2C 0 */ -# define LM3S_IRQ_PWMFAULT (25) /* Vector 25: PWM Fault */ -# define LM3S_IRQ_PWM0 (26) /* Vector 26: PWM Generator 0 */ -# define LM3S_IRQ_PWM1 (27) /* Vector 27: PWM Generator 1 */ -# define LM3S_IRQ_PWM2 (28) /* Vector 28: PWM Generator 2 */ -# define LM3S_IRQ_QEI0 (29) /* Vector 29: QEI0 */ -# define LM3S_IRQ_ADC0 (30) /* Vector 30: ADC Sequence 0 */ -# define LM3S_IRQ_ADC1 (31) /* Vector 31: ADC Sequence 1 */ -# define LM3S_IRQ_ADC2 (32) /* Vector 32: ADC Sequence 2 */ -# define LM3S_IRQ_ADC3 (33) /* Vector 33: ADC Sequence 3 */ -# define LM3S_IRQ_WDOG (34) /* Vector 34: Watchdog Timer */ -# define LM3S_IRQ_TIMER0A (35) /* Vector 35: Timer 0 A */ -# define LM3S_IRQ_TIMER0B (36) /* Vector 36: Timer 0 B */ -# define LM3S_IRQ_TIMER1A (37) /* Vector 37: Timer 1 A */ -# define LM3S_IRQ_TIMER1B (38) /* Vector 38: Timer 1 B */ -# define LM3S_IRQ_TIMER2A (39) /* Vector 39: Timer 2 A */ -# define LM3S_IRQ_TIMER2B (40) /* Vector 40: Timer 3 B */ -# define LM3S_IRQ_COMPARE0 (41) /* Vector 41: Analog Comparator 0 */ -# define LM3S_IRQ_COMPARE1 (42) /* Vector 42: Analog Comparator 1 */ - /* Vector 43: Reserved */ -# define LM3S_IRQ_SYSCON (44) /* Vector 44: System Control */ -# define LM3S_IRQ_FLASHCON (45) /* Vector 45: FLASH Control */ -# define LM3S_IRQ_GPIOF (46) /* Vector 46: GPIO Port F */ -# define LM3S_IRQ_GPIOG (47) /* Vector 47: GPIO Port G */ - /* Vector 48: Reserved */ -# define LM3S_IRQ_UART2 (49) /* Vector 49: UART 2 */ - /* Vector 50: Reserved */ -# define LM3S_IRQ_TIMER3A (51) /* Vector 51: Timer 3 A */ -# define LM3S_IRQ_TIMER3B (52) /* Vector 52: Timer 3 B */ -# define LM3S_IRQ_I2C1 (53) /* Vector 53: I2C 1 */ -# define LM3S_IRQ_QEI1 (54) /* Vector 54: QEI1 */ - /* Vectors 55-57: Reserved */ -# define LM3S_IRQ_ETHCON (58) /* Vector 58: Ethernet Controller */ -# define LM3S_IRQ_HIBERNATE (59) /* Vector 59: Hibernation Module */ - /* Vectors 60-70: Reserved */ -# define NR_IRQS (60) /* (Really less because of reserved vectors) */ +# define LM_IRQ_GPIOA (16) /* Vector 16: GPIO Port A */ +# define LM_IRQ_GPIOB (17) /* Vector 17: GPIO Port B */ +# define LM_IRQ_GPIOC (18) /* Vector 18: GPIO Port C */ +# define LM_IRQ_GPIOD (19) /* Vector 19: GPIO Port D */ +# define LM_IRQ_GPIOE (20) /* Vector 20: GPIO Port E */ +# define LM_IRQ_UART0 (21) /* Vector 21: UART 0 */ +# define LM_IRQ_UART1 (22) /* Vector 22: UART 1 */ +# define LM_IRQ_SSI0 (23) /* Vector 23: SSI 0 */ +# define LM_IRQ_I2C0 (24) /* Vector 24: I2C 0 */ +# define LM_IRQ_PWMFAULT (25) /* Vector 25: PWM Fault */ +# define LM_IRQ_PWM0 (26) /* Vector 26: PWM Generator 0 */ +# define LM_IRQ_PWM1 (27) /* Vector 27: PWM Generator 1 */ +# define LM_IRQ_PWM2 (28) /* Vector 28: PWM Generator 2 */ +# define LM_IRQ_QEI0 (29) /* Vector 29: QEI0 */ +# define LM_IRQ_ADC0 (30) /* Vector 30: ADC Sequence 0 */ +# define LM_IRQ_ADC1 (31) /* Vector 31: ADC Sequence 1 */ +# define LM_IRQ_ADC2 (32) /* Vector 32: ADC Sequence 2 */ +# define LM_IRQ_ADC3 (33) /* Vector 33: ADC Sequence 3 */ +# define LM_IRQ_WDOG (34) /* Vector 34: Watchdog Timer */ +# define LM_IRQ_TIMER0A (35) /* Vector 35: Timer 0 A */ +# define LM_IRQ_TIMER0B (36) /* Vector 36: Timer 0 B */ +# define LM_IRQ_TIMER1A (37) /* Vector 37: Timer 1 A */ +# define LM_IRQ_TIMER1B (38) /* Vector 38: Timer 1 B */ +# define LM_IRQ_TIMER2A (39) /* Vector 39: Timer 2 A */ +# define LM_IRQ_TIMER2B (40) /* Vector 40: Timer 3 B */ +# define LM_IRQ_COMPARE0 (41) /* Vector 41: Analog Comparator 0 */ +# define LM_IRQ_COMPARE1 (42) /* Vector 42: Analog Comparator 1 */ + /* Vector 43: Reserved */ +# define LM_IRQ_SYSCON (44) /* Vector 44: System Control */ +# define LM_IRQ_FLASHCON (45) /* Vector 45: FLASH Control */ +# define LM_IRQ_GPIOF (46) /* Vector 46: GPIO Port F */ +# define LM_IRQ_GPIOG (47) /* Vector 47: GPIO Port G */ + /* Vector 48: Reserved */ +# define LM_IRQ_UART2 (49) /* Vector 49: UART 2 */ + /* Vector 50: Reserved */ +# define LM_IRQ_TIMER3A (51) /* Vector 51: Timer 3 A */ +# define LM_IRQ_TIMER3B (52) /* Vector 52: Timer 3 B */ +# define LM_IRQ_I2C1 (53) /* Vector 53: I2C 1 */ +# define LM_IRQ_QEI1 (54) /* Vector 54: QEI1 */ + /* Vectors 55-57: Reserved */ +# define LM_IRQ_ETHCON (58) /* Vector 58: Ethernet Controller */ +# define LM_IRQ_HIBERNATE (59) /* Vector 59: Hibernation Module */ + /* Vectors 60-70: Reserved */ +# define NR_IRQS (60) /* (Really less because of reserved vectors) */ #elif defined(CONFIG_ARCH_CHIP_LM3S9B96) -# define LM3S_IRQ_GPIOA (16) /* Vector 16: GPIO Port A */ -# define LM3S_IRQ_GPIOB (17) /* Vector 17: GPIO Port B */ -# define LM3S_IRQ_GPIOC (18) /* Vector 18: GPIO Port C */ -# define LM3S_IRQ_GPIOD (19) /* Vector 19: GPIO Port D */ -# define LM3S_IRQ_GPIOE (20) /* Vector 20: GPIO Port E */ -# define LM3S_IRQ_UART0 (21) /* Vector 21: UART 0 */ -# define LM3S_IRQ_UART1 (22) /* Vector 22: UART 1 */ -# define LM3S_IRQ_SSI0 (23) /* Vector 23: SSI 0 */ -# define LM3S_IRQ_I2C0 (24) /* Vector 24: I2C 0 */ -# define LM3S_IRQ_PWMFAULT (25) /* Vector 25: PWM Fault */ -# define LM3S_IRQ_PWM0 (26) /* Vector 26: PWM Generator 0 */ -# define LM3S_IRQ_PWM1 (27) /* Vector 27: PWM Generator 1 */ -# define LM3S_IRQ_PWM2 (28) /* Vector 28: PWM Generator 2 */ -# define LM3S_IRQ_QEI0 (29) /* Vector 29: QEI0 */ -# define LM3S_IRQ_ADC0 (30) /* Vector 30: ADC0 Sequence 0 */ -# define LM3S_IRQ_ADC1 (31) /* Vector 31: ADC0 Sequence 1 */ -# define LM3S_IRQ_ADC2 (32) /* Vector 32: ADC0 Sequence 2 */ -# define LM3S_IRQ_ADC3 (33) /* Vector 33: ADC0 Sequence 3 */ -# define LM3S_IRQ_WDOG (34) /* Vector 34: Watchdog Timer */ -# define LM3S_IRQ_TIMER0A (35) /* Vector 35: Timer 0 A */ -# define LM3S_IRQ_TIMER0B (36) /* Vector 36: Timer 0 B */ -# define LM3S_IRQ_TIMER1A (37) /* Vector 37: Timer 1 A */ -# define LM3S_IRQ_TIMER1B (38) /* Vector 38: Timer 1 B */ -# define LM3S_IRQ_TIMER2A (39) /* Vector 39: Timer 2 A */ -# define LM3S_IRQ_TIMER2B (40) /* Vector 40: Timer 3 B */ -# define LM3S_IRQ_COMPARE0 (41) /* Vector 41: Analog Comparator 0 */ -# define LM3S_IRQ_COMPARE1 (42) /* Vector 42: Analog Comparator 1 */ -# define LM3S_IRQ_COMPARE2 (43) /* Vector 43: Analog Comparator 3 */ -# define LM3S_IRQ_SYSCON (44) /* Vector 44: System Control */ -# define LM3S_IRQ_FLASHCON (45) /* Vector 45: FLASH Control */ -# define LM3S_IRQ_GPIOF (46) /* Vector 46: GPIO Port F */ -# define LM3S_IRQ_GPIOG (47) /* Vector 47: GPIO Port G */ -# define LM3S_IRQ_GPIOH (48) /* Vector 48: GPIO Port H */ -# define LM3S_IRQ_UART2 (49) /* Vector 49: UART 2 */ -# define LM3S_IRQ_SSI1 (50) /* Vector 50: SSI 1 */ -# define LM3S_IRQ_TIMER3A (51) /* Vector 51: Timer 3 A */ -# define LM3S_IRQ_TIMER3B (52) /* Vector 52: Timer 3 B */ -# define LM3S_IRQ_I2C1 (53) /* Vector 53: I2C 1 */ -# define LM3S_IRQ_QEI1 (54) /* Vector 54: QEI1 */ -# define LM3S_IRQ_CAN0 (55) /* Vector 55: CAN 1 */ -# define LM3S_IRQ_CAN1 (56) /* Vector 56: CAN 2 */ - /* Vector 57: Reserved */ -# define LM3S_IRQ_ETHCON (58) /* Vector 58: Ethernet Controller */ - /* Vector 59: Reserved */ -# define LM3S_IRQ_USB (60) /* Vector 60: USB */ -# define LM3S_IRQ_PWM3 (61) /* Vector 61: PWM Generator 3 */ -# define LM3S_IRQ_UDMASOFT (62) /* Vector 62: uDMA Software */ -# define LM3S_IRQ_UDMAERROR (63) /* Vector 63: uDMA Error */ -# define LM3S_IRQ_ADC1_0 (64) /* Vector 64: ADC1 Sequence 0 */ -# define LM3S_IRQ_ADC1_1 (65) /* Vector 65: ADC1 Sequence 1 */ -# define LM3S_IRQ_ADC1_2 (66) /* Vector 66: ADC1 Sequence 2 */ -# define LM3S_IRQ_ADC1_3 (67) /* Vector 67: ADC1 Sequence 3 */ -# define LM3S_IRQ_I2S0 (68) /* Vector 68: I2S0 */ -# define LM3S_IRQ_EPI (69) /* Vector 69: EPI */ -# define LM3S_IRQ_GPIOJ (70) /* Vector 70: GPIO Port J */ - /* Vector 71: Reserved */ -# define NR_IRQS (71) /* (Really less because of reserved vectors) */ +# define LM_IRQ_GPIOA (16) /* Vector 16: GPIO Port A */ +# define LM_IRQ_GPIOB (17) /* Vector 17: GPIO Port B */ +# define LM_IRQ_GPIOC (18) /* Vector 18: GPIO Port C */ +# define LM_IRQ_GPIOD (19) /* Vector 19: GPIO Port D */ +# define LM_IRQ_GPIOE (20) /* Vector 20: GPIO Port E */ +# define LM_IRQ_UART0 (21) /* Vector 21: UART 0 */ +# define LM_IRQ_UART1 (22) /* Vector 22: UART 1 */ +# define LM_IRQ_SSI0 (23) /* Vector 23: SSI 0 */ +# define LM_IRQ_I2C0 (24) /* Vector 24: I2C 0 */ +# define LM_IRQ_PWMFAULT (25) /* Vector 25: PWM Fault */ +# define LM_IRQ_PWM0 (26) /* Vector 26: PWM Generator 0 */ +# define LM_IRQ_PWM1 (27) /* Vector 27: PWM Generator 1 */ +# define LM_IRQ_PWM2 (28) /* Vector 28: PWM Generator 2 */ +# define LM_IRQ_QEI0 (29) /* Vector 29: QEI0 */ +# define LM_IRQ_ADC0 (30) /* Vector 30: ADC0 Sequence 0 */ +# define LM_IRQ_ADC1 (31) /* Vector 31: ADC0 Sequence 1 */ +# define LM_IRQ_ADC2 (32) /* Vector 32: ADC0 Sequence 2 */ +# define LM_IRQ_ADC3 (33) /* Vector 33: ADC0 Sequence 3 */ +# define LM_IRQ_WDOG (34) /* Vector 34: Watchdog Timer */ +# define LM_IRQ_TIMER0A (35) /* Vector 35: Timer 0 A */ +# define LM_IRQ_TIMER0B (36) /* Vector 36: Timer 0 B */ +# define LM_IRQ_TIMER1A (37) /* Vector 37: Timer 1 A */ +# define LM_IRQ_TIMER1B (38) /* Vector 38: Timer 1 B */ +# define LM_IRQ_TIMER2A (39) /* Vector 39: Timer 2 A */ +# define LM_IRQ_TIMER2B (40) /* Vector 40: Timer 3 B */ +# define LM_IRQ_COMPARE0 (41) /* Vector 41: Analog Comparator 0 */ +# define LM_IRQ_COMPARE1 (42) /* Vector 42: Analog Comparator 1 */ +# define LM_IRQ_COMPARE2 (43) /* Vector 43: Analog Comparator 3 */ +# define LM_IRQ_SYSCON (44) /* Vector 44: System Control */ +# define LM_IRQ_FLASHCON (45) /* Vector 45: FLASH Control */ +# define LM_IRQ_GPIOF (46) /* Vector 46: GPIO Port F */ +# define LM_IRQ_GPIOG (47) /* Vector 47: GPIO Port G */ +# define LM_IRQ_GPIOH (48) /* Vector 48: GPIO Port H */ +# define LM_IRQ_UART2 (49) /* Vector 49: UART 2 */ +# define LM_IRQ_SSI1 (50) /* Vector 50: SSI 1 */ +# define LM_IRQ_TIMER3A (51) /* Vector 51: Timer 3 A */ +# define LM_IRQ_TIMER3B (52) /* Vector 52: Timer 3 B */ +# define LM_IRQ_I2C1 (53) /* Vector 53: I2C 1 */ +# define LM_IRQ_QEI1 (54) /* Vector 54: QEI1 */ +# define LM_IRQ_CAN0 (55) /* Vector 55: CAN 1 */ +# define LM_IRQ_CAN1 (56) /* Vector 56: CAN 2 */ + /* Vector 57: Reserved */ +# define LM_IRQ_ETHCON (58) /* Vector 58: Ethernet Controller */ + /* Vector 59: Reserved */ +# define LM_IRQ_USB (60) /* Vector 60: USB */ +# define LM_IRQ_PWM3 (61) /* Vector 61: PWM Generator 3 */ +# define LM_IRQ_UDMASOFT (62) /* Vector 62: uDMA Software */ +# define LM_IRQ_UDMAERROR (63) /* Vector 63: uDMA Error */ +# define LM_IRQ_ADC1_0 (64) /* Vector 64: ADC1 Sequence 0 */ +# define LM_IRQ_ADC1_1 (65) /* Vector 65: ADC1 Sequence 1 */ +# define LM_IRQ_ADC1_2 (66) /* Vector 66: ADC1 Sequence 2 */ +# define LM_IRQ_ADC1_3 (67) /* Vector 67: ADC1 Sequence 3 */ +# define LM_IRQ_I2S0 (68) /* Vector 68: I2S0 */ +# define LM_IRQ_EPI (69) /* Vector 69: EPI */ +# define LM_IRQ_GPIOJ (70) /* Vector 70: GPIO Port J */ + /* Vector 71: Reserved */ +# define NR_IRQS (71) /* (Really less because of reserved vectors) */ #elif defined(CONFIG_ARCH_CHIP_LM3S8962) -# define LM3S_IRQ_GPIOA (16) /* Vector 16: GPIO Port A */ -# define LM3S_IRQ_GPIOB (17) /* Vector 17: GPIO Port B */ -# define LM3S_IRQ_GPIOC (18) /* Vector 18: GPIO Port C */ -# define LM3S_IRQ_GPIOD (19) /* Vector 19: GPIO Port D */ -# define LM3S_IRQ_GPIOE (20) /* Vector 20: GPIO Port E */ -# define LM3S_IRQ_UART0 (21) /* Vector 21: UART 0 */ -# define LM3S_IRQ_UART1 (22) /* Vector 22: UART 1 */ -# define LM3S_IRQ_SSI0 (23) /* Vector 23: SSI 0 */ -# define LM3S_IRQ_I2C0 (24) /* Vector 24: I2C 0 */ -# define LM3S_IRQ_PWMFAULT (25) /* Vector 25: PWM Fault */ -# define LM3S_IRQ_PWM0 (26) /* Vector 26: PWM Generator 0 */ -# define LM3S_IRQ_PWM1 (27) /* Vector 27: PWM Generator 1 */ -# define LM3S_IRQ_PWM2 (28) /* Vector 28: PWM Generator 2 */ -# define LM3S_IRQ_QEI0 (29) /* Vector 29: QEI0 */ -# define LM3S_IRQ_ADC0 (30) /* Vector 30: ADC Sequence 0 */ -# define LM3S_IRQ_ADC1 (31) /* Vector 31: ADC Sequence 1 */ -# define LM3S_IRQ_ADC2 (32) /* Vector 32: ADC Sequence 2 */ -# define LM3S_IRQ_ADC3 (33) /* Vector 33: ADC Sequence 3 */ -# define LM3S_IRQ_WDOG (34) /* Vector 34: Watchdog Timer */ -# define LM3S_IRQ_TIMER0A (35) /* Vector 35: Timer 0 A */ -# define LM3S_IRQ_TIMER0B (36) /* Vector 36: Timer 0 B */ -# define LM3S_IRQ_TIMER1A (37) /* Vector 37: Timer 1 A */ -# define LM3S_IRQ_TIMER1B (38) /* Vector 38: Timer 1 B */ -# define LM3S_IRQ_TIMER2A (39) /* Vector 39: Timer 2 A */ -# define LM3S_IRQ_TIMER2B (40) /* Vector 40: Timer 3 B */ -# define LM3S_IRQ_COMPARE0 (41) /* Vector 41: Analog Comparator 0 */ - /* Vector 42: Reserved */ - /* Vector 43: Reserved */ -# define LM3S_IRQ_SYSCON (44) /* Vector 44: System Control */ -# define LM3S_IRQ_FLASHCON (45) /* Vector 45: FLASH Control */ -# define LM3S_IRQ_GPIOF (46) /* Vector 46: GPIO Port F */ -# define LM3S_IRQ_GPIOG (47) /* Vector 47: GPIO Port G */ - /* Vector 48: Reserved */ - /* Vector 49: Reserved */ - /* Vector 50: Reserved */ -# define LM3S_IRQ_TIMER3A (51) /* Vector 51: Timer 3 A */ -# define LM3S_IRQ_TIMER3B (52) /* Vector 52: Timer 3 B */ -# define LM3S_IRQ_I2C1 (53) /* Vector 53: I2C 1 */ -# define LM3S_IRQ_QEI1 (54) /* Vector 54: QEI1 */ -# define LM3S_IRQ_CAN0 (54) /* Vector 55: CAN0 */ - /* Vectors 56-57: Reserved */ -# define LM3S_IRQ_ETHCON (58) /* Vector 58: Ethernet Controller */ -# define LM3S_IRQ_HIBERNATE (59) /* Vector 59: Hibernation Module */ - /* Vectors 60-70: Reserved */ -# define NR_IRQS (60) /* (Really less because of reserved vectors) */ +# define LM_IRQ_GPIOA (16) /* Vector 16: GPIO Port A */ +# define LM_IRQ_GPIOB (17) /* Vector 17: GPIO Port B */ +# define LM_IRQ_GPIOC (18) /* Vector 18: GPIO Port C */ +# define LM_IRQ_GPIOD (19) /* Vector 19: GPIO Port D */ +# define LM_IRQ_GPIOE (20) /* Vector 20: GPIO Port E */ +# define LM_IRQ_UART0 (21) /* Vector 21: UART 0 */ +# define LM_IRQ_UART1 (22) /* Vector 22: UART 1 */ +# define LM_IRQ_SSI0 (23) /* Vector 23: SSI 0 */ +# define LM_IRQ_I2C0 (24) /* Vector 24: I2C 0 */ +# define LM_IRQ_PWMFAULT (25) /* Vector 25: PWM Fault */ +# define LM_IRQ_PWM0 (26) /* Vector 26: PWM Generator 0 */ +# define LM_IRQ_PWM1 (27) /* Vector 27: PWM Generator 1 */ +# define LM_IRQ_PWM2 (28) /* Vector 28: PWM Generator 2 */ +# define LM_IRQ_QEI0 (29) /* Vector 29: QEI0 */ +# define LM_IRQ_ADC0 (30) /* Vector 30: ADC Sequence 0 */ +# define LM_IRQ_ADC1 (31) /* Vector 31: ADC Sequence 1 */ +# define LM_IRQ_ADC2 (32) /* Vector 32: ADC Sequence 2 */ +# define LM_IRQ_ADC3 (33) /* Vector 33: ADC Sequence 3 */ +# define LM_IRQ_WDOG (34) /* Vector 34: Watchdog Timer */ +# define LM_IRQ_TIMER0A (35) /* Vector 35: Timer 0 A */ +# define LM_IRQ_TIMER0B (36) /* Vector 36: Timer 0 B */ +# define LM_IRQ_TIMER1A (37) /* Vector 37: Timer 1 A */ +# define LM_IRQ_TIMER1B (38) /* Vector 38: Timer 1 B */ +# define LM_IRQ_TIMER2A (39) /* Vector 39: Timer 2 A */ +# define LM_IRQ_TIMER2B (40) /* Vector 40: Timer 3 B */ +# define LM_IRQ_COMPARE0 (41) /* Vector 41: Analog Comparator 0 */ + /* Vector 42: Reserved */ + /* Vector 43: Reserved */ +# define LM_IRQ_SYSCON (44) /* Vector 44: System Control */ +# define LM_IRQ_FLASHCON (45) /* Vector 45: FLASH Control */ +# define LM_IRQ_GPIOF (46) /* Vector 46: GPIO Port F */ +# define LM_IRQ_GPIOG (47) /* Vector 47: GPIO Port G */ + /* Vector 48: Reserved */ + /* Vector 49: Reserved */ + /* Vector 50: Reserved */ +# define LM_IRQ_TIMER3A (51) /* Vector 51: Timer 3 A */ +# define LM_IRQ_TIMER3B (52) /* Vector 52: Timer 3 B */ +# define LM_IRQ_I2C1 (53) /* Vector 53: I2C 1 */ +# define LM_IRQ_QEI1 (54) /* Vector 54: QEI1 */ +# define LM_IRQ_CAN0 (54) /* Vector 55: CAN0 */ + /* Vectors 56-57: Reserved */ +# define LM_IRQ_ETHCON (58) /* Vector 58: Ethernet Controller */ +# define LM_IRQ_HIBERNATE (59) /* Vector 59: Hibernation Module */ + /* Vectors 60-70: Reserved */ +# define NR_IRQS (60) /* (Really less because of reserved vectors) */ #else -# error "IRQ Numbers not specified for this LM3S chip" +# error "IRQ Numbers not specified for this Stellaris chip" #endif /* GPIO IRQs -- Note that support for individual GPIO ports can @@ -309,132 +309,132 @@ */ #ifndef CONFIG_LM_DISABLE_GPIOA_IRQS -# define LM3S_IRQ_GPIOA_0 (NR_IRQS + 0) -# define LM3S_IRQ_GPIOA_1 (NR_IRQS + 1) -# define LM3S_IRQ_GPIOA_2 (NR_IRQS + 2) -# define LM3S_IRQ_GPIOA_3 (NR_IRQS + 3) -# define LM3S_IRQ_GPIOA_4 (NR_IRQS + 4) -# define LM3S_IRQ_GPIOA_5 (NR_IRQS + 5) -# define LM3S_IRQ_GPIOA_6 (NR_IRQS + 6) -# define LM3S_IRQ_GPIOA_7 (NR_IRQS + 7) -# define _NGPIOAIRQS (NR_IRQS + 8) +# define LM_IRQ_GPIOA_0 (NR_IRQS + 0) +# define LM_IRQ_GPIOA_1 (NR_IRQS + 1) +# define LM_IRQ_GPIOA_2 (NR_IRQS + 2) +# define LM_IRQ_GPIOA_3 (NR_IRQS + 3) +# define LM_IRQ_GPIOA_4 (NR_IRQS + 4) +# define LM_IRQ_GPIOA_5 (NR_IRQS + 5) +# define LM_IRQ_GPIOA_6 (NR_IRQS + 6) +# define LM_IRQ_GPIOA_7 (NR_IRQS + 7) +# define _NGPIOAIRQS (NR_IRQS + 8) #else -# define _NGPIOAIRQS NR_IRQS +# define _NGPIOAIRQS NR_IRQS #endif #ifndef CONFIG_LM_DISABLE_GPIOB_IRQS -# define LM3S_IRQ_GPIOB_0 (_NGPIOAIRQS + 0) -# define LM3S_IRQ_GPIOB_1 (_NGPIOAIRQS + 1) -# define LM3S_IRQ_GPIOB_2 (_NGPIOAIRQS + 2) -# define LM3S_IRQ_GPIOB_3 (_NGPIOAIRQS + 3) -# define LM3S_IRQ_GPIOB_4 (_NGPIOAIRQS + 4) -# define LM3S_IRQ_GPIOB_5 (_NGPIOAIRQS + 5) -# define LM3S_IRQ_GPIOB_6 (_NGPIOAIRQS + 6) -# define LM3S_IRQ_GPIOB_7 (_NGPIOAIRQS + 7) -# define _NGPIOBIRQS (_NGPIOAIRQS + 8) +# define LM_IRQ_GPIOB_0 (_NGPIOAIRQS + 0) +# define LM_IRQ_GPIOB_1 (_NGPIOAIRQS + 1) +# define LM_IRQ_GPIOB_2 (_NGPIOAIRQS + 2) +# define LM_IRQ_GPIOB_3 (_NGPIOAIRQS + 3) +# define LM_IRQ_GPIOB_4 (_NGPIOAIRQS + 4) +# define LM_IRQ_GPIOB_5 (_NGPIOAIRQS + 5) +# define LM_IRQ_GPIOB_6 (_NGPIOAIRQS + 6) +# define LM_IRQ_GPIOB_7 (_NGPIOAIRQS + 7) +# define _NGPIOBIRQS (_NGPIOAIRQS + 8) #else -# define _NGPIOBIRQS _NGPIOAIRQS +# define _NGPIOBIRQS _NGPIOAIRQS #endif #ifndef CONFIG_LM_DISABLE_GPIOC_IRQS -# define LM3S_IRQ_GPIOC_0 (_NGPIOBIRQS + 0) -# define LM3S_IRQ_GPIOC_1 (_NGPIOBIRQS + 1) -# define LM3S_IRQ_GPIOC_2 (_NGPIOBIRQS + 2) -# define LM3S_IRQ_GPIOC_3 (_NGPIOBIRQS + 3) -# define LM3S_IRQ_GPIOC_4 (_NGPIOBIRQS + 4) -# define LM3S_IRQ_GPIOC_5 (_NGPIOBIRQS + 5) -# define LM3S_IRQ_GPIOC_6 (_NGPIOBIRQS + 6) -# define LM3S_IRQ_GPIOC_7 (_NGPIOBIRQS + 7) -# define _NGPIOCIRQS (_NGPIOBIRQS + 8) +# define LM_IRQ_GPIOC_0 (_NGPIOBIRQS + 0) +# define LM_IRQ_GPIOC_1 (_NGPIOBIRQS + 1) +# define LM_IRQ_GPIOC_2 (_NGPIOBIRQS + 2) +# define LM_IRQ_GPIOC_3 (_NGPIOBIRQS + 3) +# define LM_IRQ_GPIOC_4 (_NGPIOBIRQS + 4) +# define LM_IRQ_GPIOC_5 (_NGPIOBIRQS + 5) +# define LM_IRQ_GPIOC_6 (_NGPIOBIRQS + 6) +# define LM_IRQ_GPIOC_7 (_NGPIOBIRQS + 7) +# define _NGPIOCIRQS (_NGPIOBIRQS + 8) #else -# define _NGPIOCIRQS _NGPIOBIRQS +# define _NGPIOCIRQS _NGPIOBIRQS #endif #ifndef CONFIG_LM_DISABLE_GPIOD_IRQS -# define LM3S_IRQ_GPIOD_0 (_NGPIOCIRQS + 0) -# define LM3S_IRQ_GPIOD_1 (_NGPIOCIRQS + 1) -# define LM3S_IRQ_GPIOD_2 (_NGPIOCIRQS + 2) -# define LM3S_IRQ_GPIOD_3 (_NGPIOCIRQS + 3) -# define LM3S_IRQ_GPIOD_4 (_NGPIOCIRQS + 4) -# define LM3S_IRQ_GPIOD_5 (_NGPIOCIRQS + 5) -# define LM3S_IRQ_GPIOD_6 (_NGPIOCIRQS + 6) -# define LM3S_IRQ_GPIOD_7 (_NGPIOCIRQS + 7) -# define _NGPIODIRQS (_NGPIOCIRQS + 8) +# define LM_IRQ_GPIOD_0 (_NGPIOCIRQS + 0) +# define LM_IRQ_GPIOD_1 (_NGPIOCIRQS + 1) +# define LM_IRQ_GPIOD_2 (_NGPIOCIRQS + 2) +# define LM_IRQ_GPIOD_3 (_NGPIOCIRQS + 3) +# define LM_IRQ_GPIOD_4 (_NGPIOCIRQS + 4) +# define LM_IRQ_GPIOD_5 (_NGPIOCIRQS + 5) +# define LM_IRQ_GPIOD_6 (_NGPIOCIRQS + 6) +# define LM_IRQ_GPIOD_7 (_NGPIOCIRQS + 7) +# define _NGPIODIRQS (_NGPIOCIRQS + 8) #else -# define _NGPIODIRQS _NGPIOCIRQS +# define _NGPIODIRQS _NGPIOCIRQS #endif #ifndef CONFIG_LM_DISABLE_GPIOE_IRQS -# define LM3S_IRQ_GPIOE_0 (_NGPIODIRQS + 0) -# define LM3S_IRQ_GPIOE_1 (_NGPIODIRQS + 1) -# define LM3S_IRQ_GPIOE_2 (_NGPIODIRQS + 2) -# define LM3S_IRQ_GPIOE_3 (_NGPIODIRQS + 3) -# define LM3S_IRQ_GPIOE_4 (_NGPIODIRQS + 4) -# define LM3S_IRQ_GPIOE_5 (_NGPIODIRQS + 5) -# define LM3S_IRQ_GPIOE_6 (_NGPIODIRQS + 6) -# define LM3S_IRQ_GPIOE_7 (_NGPIODIRQS + 7) -# define _NGPIOEIRQS (_NGPIODIRQS + 8) +# define LM_IRQ_GPIOE_0 (_NGPIODIRQS + 0) +# define LM_IRQ_GPIOE_1 (_NGPIODIRQS + 1) +# define LM_IRQ_GPIOE_2 (_NGPIODIRQS + 2) +# define LM_IRQ_GPIOE_3 (_NGPIODIRQS + 3) +# define LM_IRQ_GPIOE_4 (_NGPIODIRQS + 4) +# define LM_IRQ_GPIOE_5 (_NGPIODIRQS + 5) +# define LM_IRQ_GPIOE_6 (_NGPIODIRQS + 6) +# define LM_IRQ_GPIOE_7 (_NGPIODIRQS + 7) +# define _NGPIOEIRQS (_NGPIODIRQS + 8) #else -# define _NGPIOEIRQS _NGPIODIRQS +# define _NGPIOEIRQS _NGPIODIRQS #endif #ifndef CONFIG_LM_DISABLE_GPIOF_IRQS -# define LM3S_IRQ_GPIOF_0 (_NGPIOEIRQS + 0) -# define LM3S_IRQ_GPIOF_1 (_NGPIOEIRQS + 1) -# define LM3S_IRQ_GPIOF_2 (_NGPIOEIRQS + 2) -# define LM3S_IRQ_GPIOF_3 (_NGPIOEIRQS + 3) -# define LM3S_IRQ_GPIOF_4 (_NGPIOEIRQS + 4) -# define LM3S_IRQ_GPIOF_5 (_NGPIOEIRQS + 5) -# define LM3S_IRQ_GPIOF_6 (_NGPIOEIRQS + 6) -# define LM3S_IRQ_GPIOF_7 (_NGPIOEIRQS + 7) -# define _NGPIOFIRQS (_NGPIOEIRQS + 8) +# define LM_IRQ_GPIOF_0 (_NGPIOEIRQS + 0) +# define LM_IRQ_GPIOF_1 (_NGPIOEIRQS + 1) +# define LM_IRQ_GPIOF_2 (_NGPIOEIRQS + 2) +# define LM_IRQ_GPIOF_3 (_NGPIOEIRQS + 3) +# define LM_IRQ_GPIOF_4 (_NGPIOEIRQS + 4) +# define LM_IRQ_GPIOF_5 (_NGPIOEIRQS + 5) +# define LM_IRQ_GPIOF_6 (_NGPIOEIRQS + 6) +# define LM_IRQ_GPIOF_7 (_NGPIOEIRQS + 7) +# define _NGPIOFIRQS (_NGPIOEIRQS + 8) #else -# define _NGPIOFIRQS _NGPIOEIRQS +# define _NGPIOFIRQS _NGPIOEIRQS #endif #ifndef CONFIG_LM_DISABLE_GPIOG_IRQS -# define LM3S_IRQ_GPIOG_0 (_NGPIOFIRQS + 0) -# define LM3S_IRQ_GPIOG_1 (_NGPIOFIRQS + 1) -# define LM3S_IRQ_GPIOG_2 (_NGPIOFIRQS + 2) -# define LM3S_IRQ_GPIOG_3 (_NGPIOFIRQS + 3) -# define LM3S_IRQ_GPIOG_4 (_NGPIOFIRQS + 4) -# define LM3S_IRQ_GPIOG_5 (_NGPIOFIRQS + 5) -# define LM3S_IRQ_GPIOG_6 (_NGPIOFIRQS + 6) -# define LM3S_IRQ_GPIOG_7 (_NGPIOFIRQS + 7) -# define _NGPIOGIRQS (_NGPIOFIRQS + 8) +# define LM_IRQ_GPIOG_0 (_NGPIOFIRQS + 0) +# define LM_IRQ_GPIOG_1 (_NGPIOFIRQS + 1) +# define LM_IRQ_GPIOG_2 (_NGPIOFIRQS + 2) +# define LM_IRQ_GPIOG_3 (_NGPIOFIRQS + 3) +# define LM_IRQ_GPIOG_4 (_NGPIOFIRQS + 4) +# define LM_IRQ_GPIOG_5 (_NGPIOFIRQS + 5) +# define LM_IRQ_GPIOG_6 (_NGPIOFIRQS + 6) +# define LM_IRQ_GPIOG_7 (_NGPIOFIRQS + 7) +# define _NGPIOGIRQS (_NGPIOFIRQS + 8) #else -# define _NGPIOGIRQS _NGPIOFIRQS +# define _NGPIOGIRQS _NGPIOFIRQS #endif #ifndef CONFIG_LM_DISABLE_GPIOH_IRQS -# define LM3S_IRQ_GPIOH_0 (_NGPIOGIRQS + 0) -# define LM3S_IRQ_GPIOH_1 (_NGPIOGIRQS + 1) -# define LM3S_IRQ_GPIOH_2 (_NGPIOGIRQS + 2) -# define LM3S_IRQ_GPIOH_3 (_NGPIOGIRQS + 3) -# define LM3S_IRQ_GPIOH_4 (_NGPIOGIRQS + 4) -# define LM3S_IRQ_GPIOH_5 (_NGPIOGIRQS + 5) -# define LM3S_IRQ_GPIOH_6 (_NGPIOGIRQS + 6) -# define LM3S_IRQ_GPIOH_7 (_NGPIOGIRQS + 7) -# define _NGPIOHIRQS (_NGPIOGIRQS + 8) +# define LM_IRQ_GPIOH_0 (_NGPIOGIRQS + 0) +# define LM_IRQ_GPIOH_1 (_NGPIOGIRQS + 1) +# define LM_IRQ_GPIOH_2 (_NGPIOGIRQS + 2) +# define LM_IRQ_GPIOH_3 (_NGPIOGIRQS + 3) +# define LM_IRQ_GPIOH_4 (_NGPIOGIRQS + 4) +# define LM_IRQ_GPIOH_5 (_NGPIOGIRQS + 5) +# define LM_IRQ_GPIOH_6 (_NGPIOGIRQS + 6) +# define LM_IRQ_GPIOH_7 (_NGPIOGIRQS + 7) +# define _NGPIOHIRQS (_NGPIOGIRQS + 8) #else -# define _NGPIOHIRQS _NGPIOGIRQS +# define _NGPIOHIRQS _NGPIOGIRQS #endif #ifndef CONFIG_LM_DISABLE_GPIOJ_IRQS -# define LM3S_IRQ_GPIOJ_0 (_NGPIOHIRQS + 0) -# define LM3S_IRQ_GPIOJ_1 (_NGPIOHIRQS + 1) -# define LM3S_IRQ_GPIOJ_2 (_NGPIOHIRQS + 2) -# define LM3S_IRQ_GPIOJ_3 (_NGPIOHIRQS + 3) -# define LM3S_IRQ_GPIOJ_4 (_NGPIOHIRQS + 4) -# define LM3S_IRQ_GPIOJ_5 (_NGPIOHIRQS + 5) -# define LM3S_IRQ_GPIOJ_6 (_NGPIOHIRQS + 6) -# define LM3S_IRQ_GPIOJ_7 (_NGPIOHIRQS + 7) -# define _NGPIOJIRQS (_NGPIOHIRQS + 8) +# define LM_IRQ_GPIOJ_0 (_NGPIOHIRQS + 0) +# define LM_IRQ_GPIOJ_1 (_NGPIOHIRQS + 1) +# define LM_IRQ_GPIOJ_2 (_NGPIOHIRQS + 2) +# define LM_IRQ_GPIOJ_3 (_NGPIOHIRQS + 3) +# define LM_IRQ_GPIOJ_4 (_NGPIOHIRQS + 4) +# define LM_IRQ_GPIOJ_5 (_NGPIOHIRQS + 5) +# define LM_IRQ_GPIOJ_6 (_NGPIOHIRQS + 6) +# define LM_IRQ_GPIOJ_7 (_NGPIOHIRQS + 7) +# define _NGPIOJIRQS (_NGPIOHIRQS + 8) #else -# define _NGPIOJIRQS _NGPIOHIRQS +# define _NGPIOJIRQS _NGPIOHIRQS #endif -#define NR_GPIO_IRQS (_NGPIOJIRQS - NR_IRQS) +#define NR_GPIO_IRQS (_NGPIOJIRQS - NR_IRQS) /************************************************************************************ * Public Types diff --git a/nuttx/arch/arm/src/lm/chip/lm3s_memorymap.h b/nuttx/arch/arm/src/lm/chip/lm3s_memorymap.h index 51de04a2bd..32b7a9f181 100644 --- a/nuttx/arch/arm/src/lm/chip/lm3s_memorymap.h +++ b/nuttx/arch/arm/src/lm/chip/lm3s_memorymap.h @@ -50,44 +50,44 @@ #if defined(CONFIG_ARCH_CHIP_LM3S6918) || defined(CONFIG_ARCH_CHIP_LM3S6432) || \ defined(CONFIG_ARCH_CHIP_LM3S6965) || defined(CONFIG_ARCH_CHIP_LM3S8962) -# define LM3S_FLASH_BASE 0x00000000 /* -0x0003ffff: On-chip FLASH */ - /* -0x1fffffff: Reserved */ -# define LM3S_SRAM_BASE 0x20000000 /* -0x2000ffff: Bit-banded on-chip SRAM */ - /* -0x21ffffff: Reserved */ -# define LM3S_ASRAM_BASE 0x22000000 /* -0x221fffff: Bit-band alias of 20000000- */ - /* -0x3fffffff: Reserved */ -# define LM3S_PERIPH_BASE 0x40000000 /* -0x4001ffff: FiRM Peripherals */ - /* -0x41ffffff: Peripherals */ -# define LM3S_APERIPH_BASE 0x42000000 /* -0x43ffffff: Bit-band alise of 40000000- */ - /* -0xdfffffff: Reserved */ -# define LM3S_ITM_BASE 0xe0000000 /* -0xe0000fff: Instrumentation Trace Macrocell */ -# define LM3S_DWT_BASE 0xe0001000 /* -0xe0001fff: Data Watchpoint and Trace */ -# define LM3S_FPB_BASE 0xe0002000 /* -0xe0002fff: Flash Patch and Breakpoint */ - /* -0xe000dfff: Reserved */ -# define LM3S_NVIC_BASE 0xe000e000 /* -0xe000efff: Nested Vectored Interrupt Controller */ - /* -0xe003ffff: Reserved */ -# define LM3S_TPIU_BASE 0xe0040000 /* -0xe0040fff: Trace Port Interface Unit */ - /* -0xffffffff: Reserved */ +# define LM_FLASH_BASE 0x00000000 /* -0x0003ffff: On-chip FLASH */ + /* -0x1fffffff: Reserved */ +# define LM_SRAM_BASE 0x20000000 /* -0x2000ffff: Bit-banded on-chip SRAM */ + /* -0x21ffffff: Reserved */ +# define LM_ASRAM_BASE 0x22000000 /* -0x221fffff: Bit-band alias of 20000000- */ + /* -0x3fffffff: Reserved */ +# define LM_PERIPH_BASE 0x40000000 /* -0x4001ffff: FiRM Peripherals */ + /* -0x41ffffff: Peripherals */ +# define LM_APERIPH_BASE 0x42000000 /* -0x43ffffff: Bit-band alise of 40000000- */ + /* -0xdfffffff: Reserved */ +# define LM_ITM_BASE 0xe0000000 /* -0xe0000fff: Instrumentation Trace Macrocell */ +# define LM_DWT_BASE 0xe0001000 /* -0xe0001fff: Data Watchpoint and Trace */ +# define LM_FPB_BASE 0xe0002000 /* -0xe0002fff: Flash Patch and Breakpoint */ + /* -0xe000dfff: Reserved */ +# define LM_NVIC_BASE 0xe000e000 /* -0xe000efff: Nested Vectored Interrupt Controller */ + /* -0xe003ffff: Reserved */ +# define LM_TPIU_BASE 0xe0040000 /* -0xe0040fff: Trace Port Interface Unit */ + /* -0xffffffff: Reserved */ #elif defined(CONFIG_ARCH_CHIP_LM3S9B96) -# define LM3S_FLASH_BASE 0x00000000 /* -0x0003ffff: On-chip FLASH */ - /* -0x1fffffff: Reserved */ -# define LM3S_SRAM_BASE 0x20000000 /* -0x2000ffff: Bit-banded on-chip SRAM */ - /* -0x21ffffff: Reserved */ -# define LM3S_ASRAM_BASE 0x22000000 /* -0x221fffff: Bit-band alias of 20000000- */ - /* -0x3fffffff: Reserved */ -# define LM3S_PERIPH_BASE 0x40000000 /* -0x4001ffff: FiRM Peripherals */ - /* -0x41ffffff: Peripherals */ -# define LM3S_APERIPH_BASE 0x42000000 /* -0x43ffffff: Bit-band alise of 40000000- */ - /* -0x5fffffff: Reserved */ -# define LM3S_EPI0RAM_BASE 0x60000000 /* -0xDfffffff: EPI0 mapped peripheral and RAM */ -# define LM3S_ITM_BASE 0xe0000000 /* -0xe0000fff: Instrumentation Trace Macrocell */ -# define LM3S_DWT_BASE 0xe0001000 /* -0xe0001fff: Data Watchpoint and Trace */ -# define LM3S_FPB_BASE 0xe0002000 /* -0xe0002fff: Flash Patch and Breakpoint */ - /* -0xe000dfff: Reserved */ -# define LM3S_NVIC_BASE 0xe000e000 /* -0xe000efff: Nested Vectored Interrupt Controller */ - /* -0xe003ffff: Reserved */ -# define LM3S_TPIU_BASE 0xe0040000 /* -0xe0040fff: Trace Port Interface Unit */ - /* -0xffffffff: Reserved */ +# define LM_FLASH_BASE 0x00000000 /* -0x0003ffff: On-chip FLASH */ + /* -0x1fffffff: Reserved */ +# define LM_SRAM_BASE 0x20000000 /* -0x2000ffff: Bit-banded on-chip SRAM */ + /* -0x21ffffff: Reserved */ +# define LM_ASRAM_BASE 0x22000000 /* -0x221fffff: Bit-band alias of 20000000- */ + /* -0x3fffffff: Reserved */ +# define LM_PERIPH_BASE 0x40000000 /* -0x4001ffff: FiRM Peripherals */ + /* -0x41ffffff: Peripherals */ +# define LM_APERIPH_BASE 0x42000000 /* -0x43ffffff: Bit-band alise of 40000000- */ + /* -0x5fffffff: Reserved */ +# define LM_EPI0RAM_BASE 0x60000000 /* -0xdfffffff: EPI0 mapped peripheral and RAM */ +# define LM_ITM_BASE 0xe0000000 /* -0xe0000fff: Instrumentation Trace Macrocell */ +# define LM_DWT_BASE 0xe0001000 /* -0xe0001fff: Data Watchpoint and Trace */ +# define LM_FPB_BASE 0xe0002000 /* -0xe0002fff: Flash Patch and Breakpoint */ + /* -0xe000dfff: Reserved */ +# define LM_NVIC_BASE 0xe000e000 /* -0xe000efff: Nested Vectored Interrupt Controller */ + /* -0xe003ffff: Reserved */ +# define LM_TPIU_BASE 0xe0040000 /* -0xe0040fff: Trace Port Interface Unit */ + /* -0xffffffff: Reserved */ #else # error "Memory map not specified for this LM3S chip" #endif @@ -102,247 +102,247 @@ #if defined(CONFIG_ARCH_CHIP_LM3S6918) /* FiRM Peripheral Base Addresses */ -# define LM3S_WDOG_BASE (LM3S_PERIPH_BASE + 0x00000) /* -0x00fff: Watchdog Timer */ - /* -0x03fff: Reserved */ -# define LM3S_GPIOA_BASE (LM3S_PERIPH_BASE + 0x04000) /* -0x04fff: GPIO Port A */ -# define LM3S_GPIOB_BASE (LM3S_PERIPH_BASE + 0x05000) /* -0x05fff: GPIO Port B */ -# define LM3S_GPIOC_BASE (LM3S_PERIPH_BASE + 0x06000) /* -0x06fff: GPIO Port C */ -# define LM3S_GPIOD_BASE (LM3S_PERIPH_BASE + 0x07000) /* -0x07fff: GPIO Port D */ -# define LM3S_SSI0_BASE (LM3S_PERIPH_BASE + 0x08000) /* -0x08fff: SSI0 */ -# define LM3S_SSI1_BASE (LM3S_PERIPH_BASE + 0x09000) /* -0x09fff: SSI1 */ - /* -0x0bfff: Reserved */ -# define LM3S_UART0_BASE (LM3S_PERIPH_BASE + 0x0c000) /* -0x0cfff: UART0 */ -# define LM3S_UART1_BASE (LM3S_PERIPH_BASE + 0x0d000) /* -0x0dfff: UART1 */ - /* -0x1ffff: Reserved */ +# define LM_WDOG_BASE (LM_PERIPH_BASE + 0x00000) /* -0x00fff: Watchdog Timer */ + /* -0x03fff: Reserved */ +# define LM_GPIOA_BASE (LM_PERIPH_BASE + 0x04000) /* -0x04fff: GPIO Port A */ +# define LM_GPIOB_BASE (LM_PERIPH_BASE + 0x05000) /* -0x05fff: GPIO Port B */ +# define LM_GPIOC_BASE (LM_PERIPH_BASE + 0x06000) /* -0x06fff: GPIO Port C */ +# define LM_GPIOD_BASE (LM_PERIPH_BASE + 0x07000) /* -0x07fff: GPIO Port D */ +# define LM_SSI0_BASE (LM_PERIPH_BASE + 0x08000) /* -0x08fff: SSI0 */ +# define LM_SSI1_BASE (LM_PERIPH_BASE + 0x09000) /* -0x09fff: SSI1 */ + /* -0x0bfff: Reserved */ +# define LM_UART0_BASE (LM_PERIPH_BASE + 0x0c000) /* -0x0cfff: UART0 */ +# define LM_UART1_BASE (LM_PERIPH_BASE + 0x0d000) /* -0x0dfff: UART1 */ + /* -0x1ffff: Reserved */ /* Peripheral Base Addresses */ -# define LM3S_I2CM0_BASE (LM3S_PERIPH_BASE + 0x20000) /* -0x207ff: I2C Master 0 */ -# define LM3S_I2CS0_BASE (LM3S_PERIPH_BASE + 0x20800) /* -0x20fff: I2C Slave 0 */ -# define LM3S_I2CM1_BASE (LM3S_PERIPH_BASE + 0x21000) /* -0x217ff: I2C Master 1 */ -# define LM3S_I2CS1_BASE (LM3S_PERIPH_BASE + 0x21800) /* -0x21fff: I2C Slave 1 */ - /* -0x23fff: Reserved */ -# define LM3S_GPIOE_BASE (LM3S_PERIPH_BASE + 0x24000) /* -0x24fff: GPIO Port E */ -# define LM3S_GPIOF_BASE (LM3S_PERIPH_BASE + 0x25000) /* -0x25fff: GPIO Port F */ -# define LM3S_GPIOG_BASE (LM3S_PERIPH_BASE + 0x26000) /* -0x26fff: GPIO Port G */ -# define LM3S_GPIOH_BASE (LM3S_PERIPH_BASE + 0x27000) /* -0x27fff: GPIO Port H */ - /* -0x2ffff: Reserved */ -# define LM3S_TIMER0_BASE (LM3S_PERIPH_BASE + 0x30000) /* -0x30fff: Timer 0 */ -# define LM3S_TIMER1_BASE (LM3S_PERIPH_BASE + 0x31000) /* -0x31fff: Timer 1 */ -# define LM3S_TIMER2_BASE (LM3S_PERIPH_BASE + 0x32000) /* -0x32fff: Timer 2 */ -# define LM3S_TIMER3_BASE (LM3S_PERIPH_BASE + 0x33000) /* -0x33fff: Timer 3 */ - /* -0x37fff: Reserved */ -# define LM3S_ADC_BASE (LM3S_PERIPH_BASE + 0x38000) /* -0x38fff: ADC */ - /* -0x3bfff: Reserved */ -# define LM3S_COMPARE_BASE (LM3S_PERIPH_BASE + 0x3c000) /* -0x3cfff: Analog Comparators */ - /* -0x47fff: Reserved */ -# define LM3S_ETHCON_BASE (LM3S_PERIPH_BASE + 0x48000) /* -0x48fff: Ethernet Controller */ - /* -0xfcfff: Reserved */ -# define LM3S_HIBERNATE_BASE (LM3S_PERIPH_BASE + 0xfc000) /* -0xfcfff: Ethernet Controller */ -# define LM3S_FLASHCON_BASE (LM3S_PERIPH_BASE + 0xfd000) /* -0xfdfff: FLASH Control */ -# define LM3S_SYSCON_BASE (LM3S_PERIPH_BASE + 0xfe000) /* -0xfefff: System Control */ - /* -0x1ffffff: Reserved */ +# define LM_I2CM0_BASE (LM_PERIPH_BASE + 0x20000) /* -0x207ff: I2C Master 0 */ +# define LM_I2CS0_BASE (LM_PERIPH_BASE + 0x20800) /* -0x20fff: I2C Slave 0 */ +# define LM_I2CM1_BASE (LM_PERIPH_BASE + 0x21000) /* -0x217ff: I2C Master 1 */ +# define LM_I2CS1_BASE (LM_PERIPH_BASE + 0x21800) /* -0x21fff: I2C Slave 1 */ + /* -0x23fff: Reserved */ +# define LM_GPIOE_BASE (LM_PERIPH_BASE + 0x24000) /* -0x24fff: GPIO Port E */ +# define LM_GPIOF_BASE (LM_PERIPH_BASE + 0x25000) /* -0x25fff: GPIO Port F */ +# define LM_GPIOG_BASE (LM_PERIPH_BASE + 0x26000) /* -0x26fff: GPIO Port G */ +# define LM_GPIOH_BASE (LM_PERIPH_BASE + 0x27000) /* -0x27fff: GPIO Port H */ + /* -0x2ffff: Reserved */ +# define LM_TIMER0_BASE (LM_PERIPH_BASE + 0x30000) /* -0x30fff: Timer 0 */ +# define LM_TIMER1_BASE (LM_PERIPH_BASE + 0x31000) /* -0x31fff: Timer 1 */ +# define LM_TIMER2_BASE (LM_PERIPH_BASE + 0x32000) /* -0x32fff: Timer 2 */ +# define LM_TIMER3_BASE (LM_PERIPH_BASE + 0x33000) /* -0x33fff: Timer 3 */ + /* -0x37fff: Reserved */ +# define LM_ADC_BASE (LM_PERIPH_BASE + 0x38000) /* -0x38fff: ADC */ + /* -0x3bfff: Reserved */ +# define LM_COMPARE_BASE (LM_PERIPH_BASE + 0x3c000) /* -0x3cfff: Analog Comparators */ + /* -0x47fff: Reserved */ +# define LM_ETHCON_BASE (LM_PERIPH_BASE + 0x48000) /* -0x48fff: Ethernet Controller */ + /* -0xfcfff: Reserved */ +# define LM_HIBERNATE_BASE (LM_PERIPH_BASE + 0xfc000) /* -0xfcfff: Ethernet Controller */ +# define LM_FLASHCON_BASE (LM_PERIPH_BASE + 0xfd000) /* -0xfdfff: FLASH Control */ +# define LM_SYSCON_BASE (LM_PERIPH_BASE + 0xfe000) /* -0xfefff: System Control */ + /* -0x1ffffff: Reserved */ #elif defined(CONFIG_ARCH_CHIP_LM3S6432) /* FiRM Peripheral Base Addresses */ -# define LM3S_WDOG_BASE (LM3S_PERIPH_BASE + 0x00000) /* -0x00fff: Watchdog Timer */ - /* -0x03fff: Reserved */ -# define LM3S_GPIOA_BASE (LM3S_PERIPH_BASE + 0x04000) /* -0x04fff: GPIO Port A */ -# define LM3S_GPIOB_BASE (LM3S_PERIPH_BASE + 0x05000) /* -0x05fff: GPIO Port B */ -# define LM3S_GPIOC_BASE (LM3S_PERIPH_BASE + 0x06000) /* -0x06fff: GPIO Port C */ -# define LM3S_GPIOD_BASE (LM3S_PERIPH_BASE + 0x07000) /* -0x07fff: GPIO Port D */ -# define LM3S_SSI0_BASE (LM3S_PERIPH_BASE + 0x08000) /* -0x08fff: SSI0 */ - /* -0x0bfff: Reserved */ -# define LM3S_UART0_BASE (LM3S_PERIPH_BASE + 0x0c000) /* -0x0cfff: UART0 */ -# define LM3S_UART1_BASE (LM3S_PERIPH_BASE + 0x0d000) /* -0x0dfff: UART1 */ - /* -0x1ffff: Reserved */ +# define LM_WDOG_BASE (LM_PERIPH_BASE + 0x00000) /* -0x00fff: Watchdog Timer */ + /* -0x03fff: Reserved */ +# define LM_GPIOA_BASE (LM_PERIPH_BASE + 0x04000) /* -0x04fff: GPIO Port A */ +# define LM_GPIOB_BASE (LM_PERIPH_BASE + 0x05000) /* -0x05fff: GPIO Port B */ +# define LM_GPIOC_BASE (LM_PERIPH_BASE + 0x06000) /* -0x06fff: GPIO Port C */ +# define LM_GPIOD_BASE (LM_PERIPH_BASE + 0x07000) /* -0x07fff: GPIO Port D */ +# define LM_SSI0_BASE (LM_PERIPH_BASE + 0x08000) /* -0x08fff: SSI0 */ + /* -0x0bfff: Reserved */ +# define LM_UART0_BASE (LM_PERIPH_BASE + 0x0c000) /* -0x0cfff: UART0 */ +# define LM_UART1_BASE (LM_PERIPH_BASE + 0x0d000) /* -0x0dfff: UART1 */ + /* -0x1ffff: Reserved */ /* Peripheral Base Addresses */ -# define LM3S_I2CM0_BASE (LM3S_PERIPH_BASE + 0x20000) /* -0x207ff: I2C Master 0 */ -# define LM3S_I2CS0_BASE (LM3S_PERIPH_BASE + 0x20800) /* -0x20fff: I2C Slave 0 */ - /* -0x23fff: Reserved */ -# define LM3S_GPIOE_BASE (LM3S_PERIPH_BASE + 0x24000) /* -0x24fff: GPIO Port E */ -# define LM3S_GPIOF_BASE (LM3S_PERIPH_BASE + 0x25000) /* -0x25fff: GPIO Port F */ -# define LM3S_GPIOG_BASE (LM3S_PERIPH_BASE + 0x26000) /* -0x26fff: GPIO Port G */ - /* -0x27fff: Reserved */ -# define LM3S_PWM0_BASE (LM3S_PERIPH_BASE + 0x28000) /* -0x28fff: PWM */ - /* -0x2ffff: Reserved */ -# define LM3S_TIMER0_BASE (LM3S_PERIPH_BASE + 0x30000) /* -0x30fff: Timer 0 */ -# define LM3S_TIMER1_BASE (LM3S_PERIPH_BASE + 0x31000) /* -0x31fff: Timer 1 */ -# define LM3S_TIMER2_BASE (LM3S_PERIPH_BASE + 0x32000) /* -0x32fff: Timer 2 */ - /* -0x37fff: Reserved */ -# define LM3S_ADC_BASE (LM3S_PERIPH_BASE + 0x38000) /* -0x38fff: ADC */ - /* -0x3bfff: Reserved */ -# define LM3S_COMPARE_BASE (LM3S_PERIPH_BASE + 0x3c000) /* -0x3cfff: Analog Comparators */ - /* -0x47fff: Reserved */ -# define LM3S_ETHCON_BASE (LM3S_PERIPH_BASE + 0x48000) /* -0x48fff: Ethernet Controller */ - /* -0xfcfff: Reserved */ -# define LM3S_HIBERNATE_BASE (LM3S_PERIPH_BASE + 0xfc000) /* -0xfcfff: Ethernet Controller */ -# define LM3S_FLASHCON_BASE (LM3S_PERIPH_BASE + 0xfd000) /* -0xfdfff: FLASH Control */ -# define LM3S_SYSCON_BASE (LM3S_PERIPH_BASE + 0xfe000) /* -0xfefff: System Control */ - /* -0x1ffffff: Reserved */ +# define LM_I2CM0_BASE (LM_PERIPH_BASE + 0x20000) /* -0x207ff: I2C Master 0 */ +# define LM_I2CS0_BASE (LM_PERIPH_BASE + 0x20800) /* -0x20fff: I2C Slave 0 */ + /* -0x23fff: Reserved */ +# define LM_GPIOE_BASE (LM_PERIPH_BASE + 0x24000) /* -0x24fff: GPIO Port E */ +# define LM_GPIOF_BASE (LM_PERIPH_BASE + 0x25000) /* -0x25fff: GPIO Port F */ +# define LM_GPIOG_BASE (LM_PERIPH_BASE + 0x26000) /* -0x26fff: GPIO Port G */ + /* -0x27fff: Reserved */ +# define LM_PWM0_BASE (LM_PERIPH_BASE + 0x28000) /* -0x28fff: PWM */ + /* -0x2ffff: Reserved */ +# define LM_TIMER0_BASE (LM_PERIPH_BASE + 0x30000) /* -0x30fff: Timer 0 */ +# define LM_TIMER1_BASE (LM_PERIPH_BASE + 0x31000) /* -0x31fff: Timer 1 */ +# define LM_TIMER2_BASE (LM_PERIPH_BASE + 0x32000) /* -0x32fff: Timer 2 */ + /* -0x37fff: Reserved */ +# define LM_ADC_BASE (LM_PERIPH_BASE + 0x38000) /* -0x38fff: ADC */ + /* -0x3bfff: Reserved */ +# define LM_COMPARE_BASE (LM_PERIPH_BASE + 0x3c000) /* -0x3cfff: Analog Comparators */ + /* -0x47fff: Reserved */ +# define LM_ETHCON_BASE (LM_PERIPH_BASE + 0x48000) /* -0x48fff: Ethernet Controller */ + /* -0xfcfff: Reserved */ +# define LM_HIBERNATE_BASE (LM_PERIPH_BASE + 0xfc000) /* -0xfcfff: Ethernet Controller */ +# define LM_FLASHCON_BASE (LM_PERIPH_BASE + 0xfd000) /* -0xfdfff: FLASH Control */ +# define LM_SYSCON_BASE (LM_PERIPH_BASE + 0xfe000) /* -0xfefff: System Control */ + /* -0x1ffffff: Reserved */ #elif defined(CONFIG_ARCH_CHIP_LM3S6965) /* FiRM Peripheral Base Addresses */ -# define LM3S_WDOG_BASE (LM3S_PERIPH_BASE + 0x00000) /* -0x00fff: Watchdog Timer */ - /* -0x03fff: Reserved */ -# define LM3S_GPIOA_BASE (LM3S_PERIPH_BASE + 0x04000) /* -0x04fff: GPIO Port A */ -# define LM3S_GPIOB_BASE (LM3S_PERIPH_BASE + 0x05000) /* -0x05fff: GPIO Port B */ -# define LM3S_GPIOC_BASE (LM3S_PERIPH_BASE + 0x06000) /* -0x06fff: GPIO Port C */ -# define LM3S_GPIOD_BASE (LM3S_PERIPH_BASE + 0x07000) /* -0x07fff: GPIO Port D */ -# define LM3S_SSI0_BASE (LM3S_PERIPH_BASE + 0x08000) /* -0x08fff: SSI0 */ - /* -0x0bfff: Reserved */ -# define LM3S_UART0_BASE (LM3S_PERIPH_BASE + 0x0c000) /* -0x0cfff: UART0 */ -# define LM3S_UART1_BASE (LM3S_PERIPH_BASE + 0x0d000) /* -0x0dfff: UART1 */ -# define LM3S_UART2_BASE (LM3S_PERIPH_BASE + 0x0e000) /* -0x0dfff: UART2 */ - /* -0x1ffff: Reserved */ +# define LM_WDOG_BASE (LM_PERIPH_BASE + 0x00000) /* -0x00fff: Watchdog Timer */ + /* -0x03fff: Reserved */ +# define LM_GPIOA_BASE (LM_PERIPH_BASE + 0x04000) /* -0x04fff: GPIO Port A */ +# define LM_GPIOB_BASE (LM_PERIPH_BASE + 0x05000) /* -0x05fff: GPIO Port B */ +# define LM_GPIOC_BASE (LM_PERIPH_BASE + 0x06000) /* -0x06fff: GPIO Port C */ +# define LM_GPIOD_BASE (LM_PERIPH_BASE + 0x07000) /* -0x07fff: GPIO Port D */ +# define LM_SSI0_BASE (LM_PERIPH_BASE + 0x08000) /* -0x08fff: SSI0 */ + /* -0x0bfff: Reserved */ +# define LM_UART0_BASE (LM_PERIPH_BASE + 0x0c000) /* -0x0cfff: UART0 */ +# define LM_UART1_BASE (LM_PERIPH_BASE + 0x0d000) /* -0x0dfff: UART1 */ +# define LM_UART2_BASE (LM_PERIPH_BASE + 0x0e000) /* -0x0dfff: UART2 */ + /* -0x1ffff: Reserved */ /* Peripheral Base Addresses */ -# define LM3S_I2CM0_BASE (LM3S_PERIPH_BASE + 0x20000) /* -0x207ff: I2C Master 0 */ -# define LM3S_I2CS0_BASE (LM3S_PERIPH_BASE + 0x20800) /* -0x20fff: I2C Slave 0 */ -# define LM3S_I2CM1_BASE (LM3S_PERIPH_BASE + 0x21000) /* -0x217ff: I2C Master 1 */ -# define LM3S_I2CS1_BASE (LM3S_PERIPH_BASE + 0x21800) /* -0x21fff: I2C Slave 1 */ - /* -0x23fff: Reserved */ -# define LM3S_GPIOE_BASE (LM3S_PERIPH_BASE + 0x24000) /* -0x24fff: GPIO Port E */ -# define LM3S_GPIOF_BASE (LM3S_PERIPH_BASE + 0x25000) /* -0x25fff: GPIO Port F */ -# define LM3S_GPIOG_BASE (LM3S_PERIPH_BASE + 0x26000) /* -0x26fff: GPIO Port G */ - /* -0x27fff: Reserved */ -# define LM3S_PWM0_BASE (LM3S_PERIPH_BASE + 0x28000) /* -0x28fff: PWM */ - /* -0x2bfff: Reserved */ -# define LM3S_QEI0_BASE (LM3S_PERIPH_BASE + 0x2c000) /* -0x2cfff: QEI0 */ -# define LM3S_QEI1_BASE (LM3S_PERIPH_BASE + 0x2d000) /* -0x2dfff: QEI1 */ - /* -0x2ffff: Reserved */ -# define LM3S_TIMER0_BASE (LM3S_PERIPH_BASE + 0x30000) /* -0x30fff: Timer 0 */ -# define LM3S_TIMER1_BASE (LM3S_PERIPH_BASE + 0x31000) /* -0x31fff: Timer 1 */ -# define LM3S_TIMER2_BASE (LM3S_PERIPH_BASE + 0x32000) /* -0x32fff: Timer 2 */ -# define LM3S_TIMER3_BASE (LM3S_PERIPH_BASE + 0x33000) /* -0x33fff: Timer 3 */ - /* -0x37fff: Reserved */ -# define LM3S_ADC_BASE (LM3S_PERIPH_BASE + 0x38000) /* -0x38fff: ADC */ - /* -0x3bfff: Reserved */ -# define LM3S_COMPARE_BASE (LM3S_PERIPH_BASE + 0x3c000) /* -0x3cfff: Analog Comparators */ - /* -0x47fff: Reserved */ -# define LM3S_ETHCON_BASE (LM3S_PERIPH_BASE + 0x48000) /* -0x48fff: Ethernet Controller */ - /* -0xfcfff: Reserved */ -# define LM3S_HIBERNATE_BASE (LM3S_PERIPH_BASE + 0xfc000) /* -0xfcfff: Ethernet Controller */ -# define LM3S_FLASHCON_BASE (LM3S_PERIPH_BASE + 0xfd000) /* -0xfdfff: FLASH Control */ -# define LM3S_SYSCON_BASE (LM3S_PERIPH_BASE + 0xfe000) /* -0xfefff: System Control */ - /* -0x1ffffff: Reserved */ +# define LM_I2CM0_BASE (LM_PERIPH_BASE + 0x20000) /* -0x207ff: I2C Master 0 */ +# define LM_I2CS0_BASE (LM_PERIPH_BASE + 0x20800) /* -0x20fff: I2C Slave 0 */ +# define LM_I2CM1_BASE (LM_PERIPH_BASE + 0x21000) /* -0x217ff: I2C Master 1 */ +# define LM_I2CS1_BASE (LM_PERIPH_BASE + 0x21800) /* -0x21fff: I2C Slave 1 */ + /* -0x23fff: Reserved */ +# define LM_GPIOE_BASE (LM_PERIPH_BASE + 0x24000) /* -0x24fff: GPIO Port E */ +# define LM_GPIOF_BASE (LM_PERIPH_BASE + 0x25000) /* -0x25fff: GPIO Port F */ +# define LM_GPIOG_BASE (LM_PERIPH_BASE + 0x26000) /* -0x26fff: GPIO Port G */ + /* -0x27fff: Reserved */ +# define LM_PWM0_BASE (LM_PERIPH_BASE + 0x28000) /* -0x28fff: PWM */ + /* -0x2bfff: Reserved */ +# define LM_QEI0_BASE (LM_PERIPH_BASE + 0x2c000) /* -0x2cfff: QEI0 */ +# define LM_QEI1_BASE (LM_PERIPH_BASE + 0x2d000) /* -0x2dfff: QEI1 */ + /* -0x2ffff: Reserved */ +# define LM_TIMER0_BASE (LM_PERIPH_BASE + 0x30000) /* -0x30fff: Timer 0 */ +# define LM_TIMER1_BASE (LM_PERIPH_BASE + 0x31000) /* -0x31fff: Timer 1 */ +# define LM_TIMER2_BASE (LM_PERIPH_BASE + 0x32000) /* -0x32fff: Timer 2 */ +# define LM_TIMER3_BASE (LM_PERIPH_BASE + 0x33000) /* -0x33fff: Timer 3 */ + /* -0x37fff: Reserved */ +# define LM_ADC_BASE (LM_PERIPH_BASE + 0x38000) /* -0x38fff: ADC */ + /* -0x3bfff: Reserved */ +# define LM_COMPARE_BASE (LM_PERIPH_BASE + 0x3c000) /* -0x3cfff: Analog Comparators */ + /* -0x47fff: Reserved */ +# define LM_ETHCON_BASE (LM_PERIPH_BASE + 0x48000) /* -0x48fff: Ethernet Controller */ + /* -0xfcfff: Reserved */ +# define LM_HIBERNATE_BASE (LM_PERIPH_BASE + 0xfc000) /* -0xfcfff: Ethernet Controller */ +# define LM_FLASHCON_BASE (LM_PERIPH_BASE + 0xfd000) /* -0xfdfff: FLASH Control */ +# define LM_SYSCON_BASE (LM_PERIPH_BASE + 0xfe000) /* -0xfefff: System Control */ + /* -0x1ffffff: Reserved */ #elif defined(CONFIG_ARCH_CHIP_LM3S8962) /* FiRM Peripheral Base Addresses */ -# define LM3S_WDOG_BASE (LM3S_PERIPH_BASE + 0x00000) /* -0x00fff: Watchdog Timer */ - /* -0x03fff: Reserved */ -# define LM3S_GPIOA_BASE (LM3S_PERIPH_BASE + 0x04000) /* -0x04fff: GPIO Port A */ -# define LM3S_GPIOB_BASE (LM3S_PERIPH_BASE + 0x05000) /* -0x05fff: GPIO Port B */ -# define LM3S_GPIOC_BASE (LM3S_PERIPH_BASE + 0x06000) /* -0x06fff: GPIO Port C */ -# define LM3S_GPIOD_BASE (LM3S_PERIPH_BASE + 0x07000) /* -0x07fff: GPIO Port D */ -# define LM3S_SSI0_BASE (LM3S_PERIPH_BASE + 0x08000) /* -0x08fff: SSI0 */ - /* -0x0bfff: Reserved */ -# define LM3S_UART0_BASE (LM3S_PERIPH_BASE + 0x0c000) /* -0x0cfff: UART0 */ -# define LM3S_UART1_BASE (LM3S_PERIPH_BASE + 0x0d000) /* -0x0dfff: UART1 */ - /* -0x1ffff: Reserved */ +# define LM_WDOG_BASE (LM_PERIPH_BASE + 0x00000) /* -0x00fff: Watchdog Timer */ + /* -0x03fff: Reserved */ +# define LM_GPIOA_BASE (LM_PERIPH_BASE + 0x04000) /* -0x04fff: GPIO Port A */ +# define LM_GPIOB_BASE (LM_PERIPH_BASE + 0x05000) /* -0x05fff: GPIO Port B */ +# define LM_GPIOC_BASE (LM_PERIPH_BASE + 0x06000) /* -0x06fff: GPIO Port C */ +# define LM_GPIOD_BASE (LM_PERIPH_BASE + 0x07000) /* -0x07fff: GPIO Port D */ +# define LM_SSI0_BASE (LM_PERIPH_BASE + 0x08000) /* -0x08fff: SSI0 */ + /* -0x0bfff: Reserved */ +# define LM_UART0_BASE (LM_PERIPH_BASE + 0x0c000) /* -0x0cfff: UART0 */ +# define LM_UART1_BASE (LM_PERIPH_BASE + 0x0d000) /* -0x0dfff: UART1 */ + /* -0x1ffff: Reserved */ /* Peripheral Base Addresses */ -# define LM3S_I2CM0_BASE (LM3S_PERIPH_BASE + 0x20000) /* -0x207ff: I2C Master 0 */ -# define LM3S_I2CS0_BASE (LM3S_PERIPH_BASE + 0x20800) /* -0x20fff: I2C Slave 0 */ - /* -0x23fff: Reserved */ -# define LM3S_GPIOE_BASE (LM3S_PERIPH_BASE + 0x24000) /* -0x24fff: GPIO Port E */ -# define LM3S_GPIOF_BASE (LM3S_PERIPH_BASE + 0x25000) /* -0x25fff: GPIO Port F */ -# define LM3S_GPIOG_BASE (LM3S_PERIPH_BASE + 0x26000) /* -0x26fff: GPIO Port G */ - /* -0x27fff: Reserved */ -# define LM3S_PWM0_BASE (LM3S_PERIPH_BASE + 0x28000) /* -0x28fff: PWM */ - /* -0x2bfff: Reserved */ -# define LM3S_QEI0_BASE (LM3S_PERIPH_BASE + 0x2c000) /* -0x2cfff: QEI0 */ -# define LM3S_QEI1_BASE (LM3S_PERIPH_BASE + 0x2d000) /* -0x2dfff: QEI1 */ - /* -0x2ffff: Reserved */ -# define LM3S_TIMER0_BASE (LM3S_PERIPH_BASE + 0x30000) /* -0x30fff: Timer 0 */ -# define LM3S_TIMER1_BASE (LM3S_PERIPH_BASE + 0x31000) /* -0x31fff: Timer 1 */ -# define LM3S_TIMER2_BASE (LM3S_PERIPH_BASE + 0x32000) /* -0x32fff: Timer 2 */ -# define LM3S_TIMER3_BASE (LM3S_PERIPH_BASE + 0x33000) /* -0x33fff: Timer 3 */ - /* -0x37fff: Reserved */ -# define LM3S_ADC_BASE (LM3S_PERIPH_BASE + 0x38000) /* -0x38fff: ADC */ - /* -0x3bfff: Reserved */ -# define LM3S_COMPARE_BASE (LM3S_PERIPH_BASE + 0x3c000) /* -0x3cfff: Analog Comparators */ - /* -0x3fffff: Reserved */ -# define LM3S_CANCON_BASE (LM3S_PERIPH_BASE + 0x40000) /* -0x40fff: CAN Controller */ - /* -0x47fff: Reserved */ -# define LM3S_ETHCON_BASE (LM3S_PERIPH_BASE + 0x48000) /* -0x48fff: Ethernet Controller */ - /* -0xfcfff: Reserved */ -# define LM3S_HIBERNATE_BASE (LM3S_PERIPH_BASE + 0xfc000) /* -0xfcfff: Hibernation Controller */ -# define LM3S_FLASHCON_BASE (LM3S_PERIPH_BASE + 0xfd000) /* -0xfdfff: FLASH Control */ -# define LM3S_SYSCON_BASE (LM3S_PERIPH_BASE + 0xfe000) /* -0xfefff: System Control */ - /* -0x1ffffff: Reserved */ +# define LM_I2CM0_BASE (LM_PERIPH_BASE + 0x20000) /* -0x207ff: I2C Master 0 */ +# define LM_I2CS0_BASE (LM_PERIPH_BASE + 0x20800) /* -0x20fff: I2C Slave 0 */ + /* -0x23fff: Reserved */ +# define LM_GPIOE_BASE (LM_PERIPH_BASE + 0x24000) /* -0x24fff: GPIO Port E */ +# define LM_GPIOF_BASE (LM_PERIPH_BASE + 0x25000) /* -0x25fff: GPIO Port F */ +# define LM_GPIOG_BASE (LM_PERIPH_BASE + 0x26000) /* -0x26fff: GPIO Port G */ + /* -0x27fff: Reserved */ +# define LM_PWM0_BASE (LM_PERIPH_BASE + 0x28000) /* -0x28fff: PWM */ + /* -0x2bfff: Reserved */ +# define LM_QEI0_BASE (LM_PERIPH_BASE + 0x2c000) /* -0x2cfff: QEI0 */ +# define LM_QEI1_BASE (LM_PERIPH_BASE + 0x2d000) /* -0x2dfff: QEI1 */ + /* -0x2ffff: Reserved */ +# define LM_TIMER0_BASE (LM_PERIPH_BASE + 0x30000) /* -0x30fff: Timer 0 */ +# define LM_TIMER1_BASE (LM_PERIPH_BASE + 0x31000) /* -0x31fff: Timer 1 */ +# define LM_TIMER2_BASE (LM_PERIPH_BASE + 0x32000) /* -0x32fff: Timer 2 */ +# define LM_TIMER3_BASE (LM_PERIPH_BASE + 0x33000) /* -0x33fff: Timer 3 */ + /* -0x37fff: Reserved */ +# define LM_ADC_BASE (LM_PERIPH_BASE + 0x38000) /* -0x38fff: ADC */ + /* -0x3bfff: Reserved */ +# define LM_COMPARE_BASE (LM_PERIPH_BASE + 0x3c000) /* -0x3cfff: Analog Comparators */ + /* -0x3fffff: Reserved */ +# define LM_CANCON_BASE (LM_PERIPH_BASE + 0x40000) /* -0x40fff: CAN Controller */ + /* -0x47fff: Reserved */ +# define LM_ETHCON_BASE (LM_PERIPH_BASE + 0x48000) /* -0x48fff: Ethernet Controller */ + /* -0xfcfff: Reserved */ +# define LM_HIBERNATE_BASE (LM_PERIPH_BASE + 0xfc000) /* -0xfcfff: Hibernation Controller */ +# define LM_FLASHCON_BASE (LM_PERIPH_BASE + 0xfd000) /* -0xfdfff: FLASH Control */ +# define LM_SYSCON_BASE (LM_PERIPH_BASE + 0xfe000) /* -0xfefff: System Control */ + /* -0x1ffffff: Reserved */ #elif defined(CONFIG_ARCH_CHIP_LM3S9B96) /* FiRM Peripheral Base Addresses */ -# define LM3S_WDOG_BASE (LM3S_PERIPH_BASE + 0x00000) /* -0x00fff: Watchdog Timer */ - /* -0x03fff: Reserved */ -# define LM3S_GPIOA_BASE (LM3S_PERIPH_BASE + 0x04000) /* -0x04fff: GPIO Port A */ -# define LM3S_GPIOB_BASE (LM3S_PERIPH_BASE + 0x05000) /* -0x05fff: GPIO Port B */ -# define LM3S_GPIOC_BASE (LM3S_PERIPH_BASE + 0x06000) /* -0x06fff: GPIO Port C */ -# define LM3S_GPIOD_BASE (LM3S_PERIPH_BASE + 0x07000) /* -0x07fff: GPIO Port D */ -# define LM3S_SSI0_BASE (LM3S_PERIPH_BASE + 0x08000) /* -0x08fff: SSI0 */ -# define LM3S_SSI1_BASE (LM3S_PERIPH_BASE + 0x09000) /* -0x09fff: SSI0 */ - /* -0x0bfff: Reserved */ -# define LM3S_UART0_BASE (LM3S_PERIPH_BASE + 0x0c000) /* -0x0cfff: UART0 */ -# define LM3S_UART1_BASE (LM3S_PERIPH_BASE + 0x0d000) /* -0x0dfff: UART1 */ -# define LM3S_UART2_BASE (LM3S_PERIPH_BASE + 0x0e000) /* -0x0dfff: UART2 */ - /* -0x1ffff: Reserved */ +# define LM_WDOG_BASE (LM_PERIPH_BASE + 0x00000) /* -0x00fff: Watchdog Timer */ + /* -0x03fff: Reserved */ +# define LM_GPIOA_BASE (LM_PERIPH_BASE + 0x04000) /* -0x04fff: GPIO Port A */ +# define LM_GPIOB_BASE (LM_PERIPH_BASE + 0x05000) /* -0x05fff: GPIO Port B */ +# define LM_GPIOC_BASE (LM_PERIPH_BASE + 0x06000) /* -0x06fff: GPIO Port C */ +# define LM_GPIOD_BASE (LM_PERIPH_BASE + 0x07000) /* -0x07fff: GPIO Port D */ +# define LM_SSI0_BASE (LM_PERIPH_BASE + 0x08000) /* -0x08fff: SSI0 */ +# define LM_SSI1_BASE (LM_PERIPH_BASE + 0x09000) /* -0x09fff: SSI0 */ + /* -0x0bfff: Reserved */ +# define LM_UART0_BASE (LM_PERIPH_BASE + 0x0c000) /* -0x0cfff: UART0 */ +# define LM_UART1_BASE (LM_PERIPH_BASE + 0x0d000) /* -0x0dfff: UART1 */ +# define LM_UART2_BASE (LM_PERIPH_BASE + 0x0e000) /* -0x0dfff: UART2 */ + /* -0x1ffff: Reserved */ /* Peripheral Base Addresses */ -# define LM3S_I2CM0_BASE (LM3S_PERIPH_BASE + 0x20000) /* -0x207ff: I2C Master 0 */ -# define LM3S_I2CS0_BASE (LM3S_PERIPH_BASE + 0x20800) /* -0x20fff: I2C Slave 0 */ -# define LM3S_I2CM1_BASE (LM3S_PERIPH_BASE + 0x21000) /* -0x217ff: I2C Master 1 */ -# define LM3S_I2CS1_BASE (LM3S_PERIPH_BASE + 0x21800) /* -0x21fff: I2C Slave 1 */ - /* -0x23fff: Reserved */ -# define LM3S_GPIOE_BASE (LM3S_PERIPH_BASE + 0x24000) /* -0x24fff: GPIO Port E */ -# define LM3S_GPIOF_BASE (LM3S_PERIPH_BASE + 0x25000) /* -0x25fff: GPIO Port F */ -# define LM3S_GPIOG_BASE (LM3S_PERIPH_BASE + 0x26000) /* -0x26fff: GPIO Port G */ -# define LM3S_GPIOH_BASE (LM3S_PERIPH_BASE + 0x27000) /* -0x27fff: GPIO Port H */ +# define LM_I2CM0_BASE (LM_PERIPH_BASE + 0x20000) /* -0x207ff: I2C Master 0 */ +# define LM_I2CS0_BASE (LM_PERIPH_BASE + 0x20800) /* -0x20fff: I2C Slave 0 */ +# define LM_I2CM1_BASE (LM_PERIPH_BASE + 0x21000) /* -0x217ff: I2C Master 1 */ +# define LM_I2CS1_BASE (LM_PERIPH_BASE + 0x21800) /* -0x21fff: I2C Slave 1 */ + /* -0x23fff: Reserved */ +# define LM_GPIOE_BASE (LM_PERIPH_BASE + 0x24000) /* -0x24fff: GPIO Port E */ +# define LM_GPIOF_BASE (LM_PERIPH_BASE + 0x25000) /* -0x25fff: GPIO Port F */ +# define LM_GPIOG_BASE (LM_PERIPH_BASE + 0x26000) /* -0x26fff: GPIO Port G */ +# define LM_GPIOH_BASE (LM_PERIPH_BASE + 0x27000) /* -0x27fff: GPIO Port H */ -# define LM3S_PWM0_BASE (LM3S_PERIPH_BASE + 0x28000) /* -0x28fff: PWM */ - /* -0x2bfff: Reserved */ -# define LM3S_QEI0_BASE (LM3S_PERIPH_BASE + 0x2c000) /* -0x2cfff: QEI0 */ -# define LM3S_QEI1_BASE (LM3S_PERIPH_BASE + 0x2d000) /* -0x2dfff: QEI1 */ - /* -0x2ffff: Reserved */ -# define LM3S_TIMER0_BASE (LM3S_PERIPH_BASE + 0x30000) /* -0x30fff: Timer 0 */ -# define LM3S_TIMER1_BASE (LM3S_PERIPH_BASE + 0x31000) /* -0x31fff: Timer 1 */ -# define LM3S_TIMER2_BASE (LM3S_PERIPH_BASE + 0x32000) /* -0x32fff: Timer 2 */ -# define LM3S_TIMER3_BASE (LM3S_PERIPH_BASE + 0x33000) /* -0x33fff: Timer 3 */ - /* -0x37fff: Reserved */ -# define LM3S_ADC0_BASE (LM3S_PERIPH_BASE + 0x38000) /* -0x38fff: ADC 0 */ -# define LM3S_ADC1_BASE (LM3S_PERIPH_BASE + 0x39000) /* -0x39fff: ADC 1 */ - /* -0x3bfff: Reserved */ -# define LM3S_COMPARE_BASE (LM3S_PERIPH_BASE + 0x3c000) /* -0x3cfff: Analog Comparators */ -# define LM3S_GPIOJ_BASE (LM3S_PERIPH_BASE + 0x3d000) /* -0x3dfff: GPIO Port J */ - /* -0x3ffff: Reserved */ -# define LM3S_CAN0_BASE (LM3S_PERIPH_BASE + 0x40000) /* -0x40fff: CAN 0 */ -# define LM3S_CAN1_BASE (LM3S_PERIPH_BASE + 0x41000) /* -0x41fff: CAN 1 */ - /* -0x47fff: Reserved */ -# define LM3S_ETHCON_BASE (LM3S_PERIPH_BASE + 0x48000) /* -0x48fff: Ethernet Controller */ - /* -0x49fff: Reserved */ -# define LM3S_USB_BASE (LM3S_PERIPH_BASE + 0x50000) /* -0x50fff: USB */ - /* -0x53fff: Reserved */ -# define LM3S_I2S0_BASE (LM3S_PERIPH_BASE + 0x54000) /* -0x54fff: I2S 0 */ - /* -0x57fff: Reserved */ -# define LM3S_GPIOAAHB_BASE (LM3S_PERIPH_BASE + 0x58000) /* -0x58fff: GPIO Port A (AHB aperture) */ -# define LM3S_GPIOBAHB_BASE (LM3S_PERIPH_BASE + 0x59000) /* -0x59fff: GPIO Port B (AHB aperture) */ -# define LM3S_GPIOCAHB_BASE (LM3S_PERIPH_BASE + 0x5A000) /* -0x5afff: GPIO Port C (AHB aperture) */ -# define LM3S_GPIODAHB_BASE (LM3S_PERIPH_BASE + 0x5B000) /* -0x5bfff: GPIO Port D (AHB aperture) */ -# define LM3S_GPIOEAHB_BASE (LM3S_PERIPH_BASE + 0x5C000) /* -0x5cfff: GPIO Port E (AHB aperture) */ -# define LM3S_GPIOFAHB_BASE (LM3S_PERIPH_BASE + 0x5D000) /* -0x5dfff: GPIO Port F (AHB aperture) */ -# define LM3S_GPIOGAHB_BASE (LM3S_PERIPH_BASE + 0x5E000) /* -0x5efff: GPIO Port G (AHB aperture) */ -# define LM3S_GPIOHAHB_BASE (LM3S_PERIPH_BASE + 0x5F000) /* -0x5ffff: GPIO Port H (AHB aperture) */ -# define LM3S_GPIOJAHB_BASE (LM3S_PERIPH_BASE + 0x60000) /* -0x60fff: GPIO Port J (AHB aperture) */ - /* -0xcffff: Reserved */ -# define LM3S_EPI0_BASE (LM3S_PERIPH_BASE + 0xD0000) /* -0xd0fff: EPI 0 */ - /* -0xfcfff: Reserved */ -# define LM3S_FLASHCON_BASE (LM3S_PERIPH_BASE + 0xfd000) /* -0xfdfff: FLASH Control */ -# define LM3S_SYSCON_BASE (LM3S_PERIPH_BASE + 0xfe000) /* -0xfefff: System Control */ -# define LM3S_UDMA_BASE (LM3S_PERIPH_BASE + 0xff000) /* -0xfffff: System Control */ - /* -0x1ffffff: Reserved */ +# define LM_PWM0_BASE (LM_PERIPH_BASE + 0x28000) /* -0x28fff: PWM */ + /* -0x2bfff: Reserved */ +# define LM_QEI0_BASE (LM_PERIPH_BASE + 0x2c000) /* -0x2cfff: QEI0 */ +# define LM_QEI1_BASE (LM_PERIPH_BASE + 0x2d000) /* -0x2dfff: QEI1 */ + /* -0x2ffff: Reserved */ +# define LM_TIMER0_BASE (LM_PERIPH_BASE + 0x30000) /* -0x30fff: Timer 0 */ +# define LM_TIMER1_BASE (LM_PERIPH_BASE + 0x31000) /* -0x31fff: Timer 1 */ +# define LM_TIMER2_BASE (LM_PERIPH_BASE + 0x32000) /* -0x32fff: Timer 2 */ +# define LM_TIMER3_BASE (LM_PERIPH_BASE + 0x33000) /* -0x33fff: Timer 3 */ + /* -0x37fff: Reserved */ +# define LM_ADC0_BASE (LM_PERIPH_BASE + 0x38000) /* -0x38fff: ADC 0 */ +# define LM_ADC1_BASE (LM_PERIPH_BASE + 0x39000) /* -0x39fff: ADC 1 */ + /* -0x3bfff: Reserved */ +# define LM_COMPARE_BASE (LM_PERIPH_BASE + 0x3c000) /* -0x3cfff: Analog Comparators */ +# define LM_GPIOJ_BASE (LM_PERIPH_BASE + 0x3d000) /* -0x3dfff: GPIO Port J */ + /* -0x3ffff: Reserved */ +# define LM_CAN0_BASE (LM_PERIPH_BASE + 0x40000) /* -0x40fff: CAN 0 */ +# define LM_CAN1_BASE (LM_PERIPH_BASE + 0x41000) /* -0x41fff: CAN 1 */ + /* -0x47fff: Reserved */ +# define LM_ETHCON_BASE (LM_PERIPH_BASE + 0x48000) /* -0x48fff: Ethernet Controller */ + /* -0x49fff: Reserved */ +# define LM_USB_BASE (LM_PERIPH_BASE + 0x50000) /* -0x50fff: USB */ + /* -0x53fff: Reserved */ +# define LM_I2S0_BASE (LM_PERIPH_BASE + 0x54000) /* -0x54fff: I2S 0 */ + /* -0x57fff: Reserved */ +# define LM_GPIOAAHB_BASE (LM_PERIPH_BASE + 0x58000) /* -0x58fff: GPIO Port A (AHB aperture) */ +# define LM_GPIOBAHB_BASE (LM_PERIPH_BASE + 0x59000) /* -0x59fff: GPIO Port B (AHB aperture) */ +# define LM_GPIOCAHB_BASE (LM_PERIPH_BASE + 0x5A000) /* -0x5afff: GPIO Port C (AHB aperture) */ +# define LM_GPIODAHB_BASE (LM_PERIPH_BASE + 0x5B000) /* -0x5bfff: GPIO Port D (AHB aperture) */ +# define LM_GPIOEAHB_BASE (LM_PERIPH_BASE + 0x5C000) /* -0x5cfff: GPIO Port E (AHB aperture) */ +# define LM_GPIOFAHB_BASE (LM_PERIPH_BASE + 0x5D000) /* -0x5dfff: GPIO Port F (AHB aperture) */ +# define LM_GPIOGAHB_BASE (LM_PERIPH_BASE + 0x5E000) /* -0x5efff: GPIO Port G (AHB aperture) */ +# define LM_GPIOHAHB_BASE (LM_PERIPH_BASE + 0x5F000) /* -0x5ffff: GPIO Port H (AHB aperture) */ +# define LM_GPIOJAHB_BASE (LM_PERIPH_BASE + 0x60000) /* -0x60fff: GPIO Port J (AHB aperture) */ + /* -0xcffff: Reserved */ +# define LM_EPI0_BASE (LM_PERIPH_BASE + 0xD0000) /* -0xd0fff: EPI 0 */ + /* -0xfcfff: Reserved */ +# define LM_FLASHCON_BASE (LM_PERIPH_BASE + 0xfd000) /* -0xfdfff: FLASH Control */ +# define LM_SYSCON_BASE (LM_PERIPH_BASE + 0xfe000) /* -0xfefff: System Control */ +# define LM_UDMA_BASE (LM_PERIPH_BASE + 0xff000) /* -0xfffff: System Control */ + /* -0x1ffffff: Reserved */ #else -# error "Peripheral base addresses not specified for this LM3S chip" +# error "Peripheral base addresses not specified for this Stellaris chip" #endif /************************************************************************************ diff --git a/nuttx/arch/arm/src/lm/chip/lm3s_pinmap.h b/nuttx/arch/arm/src/lm/chip/lm3s_pinmap.h index a478304b08..ca1d530646 100644 --- a/nuttx/arch/arm/src/lm/chip/lm3s_pinmap.h +++ b/nuttx/arch/arm/src/lm/chip/lm3s_pinmap.h @@ -263,7 +263,7 @@ # define GPIO_ETHPHY_LED0 (GPIO_FUNC_PFOUTPUT | GPIO_PORTF | 3) /* PF3: LED0 */ # define GPIO_PWM0_1 (GPIO_FUNC_PFOUTPUT | GPIO_PORTG | 1) /* PG1:PWM Generator 0, PWM1 */ #else -# error "Unknown LM3S chip" +# error "Unknown Stellaris chip" #endif /************************************************************************************ diff --git a/nuttx/arch/arm/src/lm/chip/lm_epi.h b/nuttx/arch/arm/src/lm/chip/lm_epi.h index e369860791..47d7906155 100644 --- a/nuttx/arch/arm/src/lm/chip/lm_epi.h +++ b/nuttx/arch/arm/src/lm/chip/lm_epi.h @@ -33,8 +33,8 @@ * ************************************************************************************/ -#ifndef __ARCH_ARM_SRC_LM_CHIP_LM3S_EPI_H -#define __ARCH_ARM_SRC_LM_CHIP_LM3S_EPI_H +#ifndef __ARCH_ARM_SRC_LM_CHIP_LM_EPI_H +#define __ARCH_ARM_SRC_LM_CHIP_LM_EPI_H /************************************************************************************ * Included Files @@ -46,19 +46,19 @@ /* External Peripheral Interface Register Offsets ***********************************/ -#define LM3S_EPI_CFG_OFFSET 0x000 -#define LM3S_EPI_SDRAMCFG_OFFSET 0x010 -#define LM3S_EPI_ADDRMAP_OFFSET 0x01C -#define LM3S_EPI_STAT_OFFSET 0x060 -#define LM3S_EPI_BAUD_OFFSET 0x004 +#define LM_EPI_CFG_OFFSET 0x000 +#define LM_EPI_SDRAMCFG_OFFSET 0x010 +#define LM_EPI_ADDRMAP_OFFSET 0x01C +#define LM_EPI_STAT_OFFSET 0x060 +#define LM_EPI_BAUD_OFFSET 0x004 /* External Peripheral Interface Register Addresses *********************************/ -#define LM3S_EPI0_CFG (LM3S_EPI0_BASE + LM3S_EPI_CFG_OFFSET) -#define LM3S_EPI0_SDRAMCFG (LM3S_EPI0_BASE + LM3S_EPI_SDRAMCFG_OFFSET) -#define LM3S_EPI0_ADDRMAP (LM3S_EPI0_BASE + LM3S_EPI_ADDRMAP_OFFSET) -#define LM3S_EPI0_STAT (LM3S_EPI0_BASE + LM3S_EPI_STAT_OFFSET) -#define LM3S_EPI0_BAUD (LM3S_EPI0_BASE + LM3S_EPI_BAUD_OFFSET) +#define LM_EPI0_CFG (LM_EPI0_BASE + LM_EPI_CFG_OFFSET) +#define LM_EPI0_SDRAMCFG (LM_EPI0_BASE + LM_EPI_SDRAMCFG_OFFSET) +#define LM_EPI0_ADDRMAP (LM_EPI0_BASE + LM_EPI_ADDRMAP_OFFSET) +#define LM_EPI0_STAT (LM_EPI0_BASE + LM_EPI_STAT_OFFSET) +#define LM_EPI0_BAUD (LM_EPI0_BASE + LM_EPI_BAUD_OFFSET) /* External Peripheral Interface Register Bit Definitions ***************************/ @@ -110,4 +110,4 @@ #define EPI_BAUD_COUNT0_MASK (0xFFFF << EPI_BAUD_COUNT0_SHIFT) # define EPI_BAUD_COUNT0(n) ((n) << EPI_BAUD_COUNT0_SHIFT) -#endif /* __ARCH_ARM_SRC_LM_CHIP_LM3S_EPI_H */ +#endif /* __ARCH_ARM_SRC_LM_CHIP_LM_EPI_H */ diff --git a/nuttx/arch/arm/src/lm/chip/lm_ethernet.h b/nuttx/arch/arm/src/lm/chip/lm_ethernet.h index 46a101005b..02908d222a 100644 --- a/nuttx/arch/arm/src/lm/chip/lm_ethernet.h +++ b/nuttx/arch/arm/src/lm/chip/lm_ethernet.h @@ -33,8 +33,8 @@ * ************************************************************************************/ -#ifndef __ARCH_ARM_SRC_LM_CHIP_LM3S_ETHERNET_H -#define __ARCH_ARM_SRC_LM_CHIP_LM3S_ETHERNET_H +#ifndef __ARCH_ARM_SRC_LM_CHIP_LM_ETHERNET_H +#define __ARCH_ARM_SRC_LM_CHIP_LM_ETHERNET_H /************************************************************************************ * Included Files @@ -53,63 +53,63 @@ /* Ethernet MAC Register Offsets */ -#define LM3S_MAC_RIS_OFFSET 0x000 /* Ethernet MAC Raw Interrupt Status */ -#define LM3S_MAC_IACK_OFFSET 0x000 /* Ethernet MAC Acknowledge */ -#define LM3S_MAC_IM_OFFSET 0x004 /* Ethernet MAC Interrupt Mask */ -#define LM3S_MAC_RCTL_OFFSET 0x008 /* Ethernet MAC Receive Control */ -#define LM3S_MAC_TCTL_OFFSET 0x00c /* Ethernet MAC Transmit Control */ -#define LM3S_MAC_DATA_OFFSET 0x010 /* Ethernet MAC Data */ -#define LM3S_MAC_IA0_OFFSET 0x014 /* Ethernet MAC Individual Address 0 */ -#define LM3S_MAC_IA1_OFFSET 0x018 /* Ethernet MAC Individual Address 1 */ -#define LM3S_MAC_THR_OFFSET 0x01c /* Ethernet MAC Threshold */ -#define LM3S_MAC_MCTL_OFFSET 0x020 /* Ethernet MAC Management Control */ -#define LM3S_MAC_MDV_OFFSET 0x024 /* Ethernet MAC Management Divider */ -#define LM3S_MAC_MTXD_OFFSET 0x02c /* Ethernet MAC Management Transmit Data */ -#define LM3S_MAC_MRXD_OFFSET 0x030 /* Ethernet MAC Management Receive Data */ -#define LM3S_MAC_NP_OFFSET 0x034 /* Ethernet MAC Number of Packets */ -#define LM3S_MAC_TR_OFFSET 0x038 /* Ethernet MAC Transmission Request */ -#ifdef LM3S_ETHTS -# define LM3S_MAC_TS_OFFSET 0x03c /* Ethernet MAC Time Stamp Configuration */ +#define LM_MAC_RIS_OFFSET 0x000 /* Ethernet MAC Raw Interrupt Status */ +#define LM_MAC_IACK_OFFSET 0x000 /* Ethernet MAC Acknowledge */ +#define LM_MAC_IM_OFFSET 0x004 /* Ethernet MAC Interrupt Mask */ +#define LM_MAC_RCTL_OFFSET 0x008 /* Ethernet MAC Receive Control */ +#define LM_MAC_TCTL_OFFSET 0x00c /* Ethernet MAC Transmit Control */ +#define LM_MAC_DATA_OFFSET 0x010 /* Ethernet MAC Data */ +#define LM_MAC_IA0_OFFSET 0x014 /* Ethernet MAC Individual Address 0 */ +#define LM_MAC_IA1_OFFSET 0x018 /* Ethernet MAC Individual Address 1 */ +#define LM_MAC_THR_OFFSET 0x01c /* Ethernet MAC Threshold */ +#define LM_MAC_MCTL_OFFSET 0x020 /* Ethernet MAC Management Control */ +#define LM_MAC_MDV_OFFSET 0x024 /* Ethernet MAC Management Divider */ +#define LM_MAC_MTXD_OFFSET 0x02c /* Ethernet MAC Management Transmit Data */ +#define LM_MAC_MRXD_OFFSET 0x030 /* Ethernet MAC Management Receive Data */ +#define LM_MAC_NP_OFFSET 0x034 /* Ethernet MAC Number of Packets */ +#define LM_MAC_TR_OFFSET 0x038 /* Ethernet MAC Transmission Request */ +#ifdef LM_ETHTS +# define LM_MAC_TS_OFFSET 0x03c /* Ethernet MAC Time Stamp Configuration */ #endif /* MII Management Register Offsets (see include/nuttx/net/mii.h) */ /* Ethernet Controller Register Addresses *******************************************/ -#define LM3S_MAC_RIS (LM3S_ETHCON_BASE + LM3S_MAC_RIS_OFFSET) -#define LM3S_MAC_IACK (LM3S_ETHCON_BASE + LM3S_MAC_IACK_OFFSET) -#define LM3S_MAC_IM (LM3S_ETHCON_BASE + LM3S_MAC_IM_OFFSET) -#define LM3S_MAC_RCTL (LM3S_ETHCON_BASE + LM3S_MAC_RCTL_OFFSET) -#define LM3S_MAC_TCTL (LM3S_ETHCON_BASE + LM3S_MAC_TCTL_OFFSET) -#define LM3S_MAC_DATA (LM3S_ETHCON_BASE + LM3S_MAC_DATA_OFFSET) -#define LM3S_MAC_IA0 (LM3S_ETHCON_BASE + LM3S_MAC_IA0_OFFSET) -#define LM3S_MAC_IA1 (LM3S_ETHCON_BASE + LM3S_MAC_IA1_OFFSET) -#define LM3S_MAC_THR (LM3S_ETHCON_BASE + LM3S_MAC_THR_OFFSET) -#define LM3S_MAC_MCTL (LM3S_ETHCON_BASE + LM3S_MAC_MCTL_OFFSET) -#define LM3S_MAC_MDV (LM3S_ETHCON_BASE + LM3S_MAC_MDV_OFFSET) -#define LM3S_MAC_MTXD (LM3S_ETHCON_BASE + LM3S_MAC_MTXD_OFFSET) -#define LM3S_MAC_MRXD (LM3S_ETHCON_BASE + LM3S_MAC_MRXD_OFFSET) -#define LM3S_MAC_NP (LM3S_ETHCON_BASE + LM3S_MAC_NP_OFFSET) -#define LM3S_MAC_TR (LM3S_ETHCON_BASE + LM3S_MAC_TR_OFFSET) -#ifdef LM3S_ETHTS -# define LM3S_MAC_TS (LM3S_ETHCON_BASE + LM3S_MAC_TS_OFFSET) +#define LM_MAC_RIS (LM_ETHCON_BASE + LM_MAC_RIS_OFFSET) +#define LM_MAC_IACK (LM_ETHCON_BASE + LM_MAC_IACK_OFFSET) +#define LM_MAC_IM (LM_ETHCON_BASE + LM_MAC_IM_OFFSET) +#define LM_MAC_RCTL (LM_ETHCON_BASE + LM_MAC_RCTL_OFFSET) +#define LM_MAC_TCTL (LM_ETHCON_BASE + LM_MAC_TCTL_OFFSET) +#define LM_MAC_DATA (LM_ETHCON_BASE + LM_MAC_DATA_OFFSET) +#define LM_MAC_IA0 (LM_ETHCON_BASE + LM_MAC_IA0_OFFSET) +#define LM_MAC_IA1 (LM_ETHCON_BASE + LM_MAC_IA1_OFFSET) +#define LM_MAC_THR (LM_ETHCON_BASE + LM_MAC_THR_OFFSET) +#define LM_MAC_MCTL (LM_ETHCON_BASE + LM_MAC_MCTL_OFFSET) +#define LM_MAC_MDV (LM_ETHCON_BASE + LM_MAC_MDV_OFFSET) +#define LM_MAC_MTXD (LM_ETHCON_BASE + LM_MAC_MTXD_OFFSET) +#define LM_MAC_MRXD (LM_ETHCON_BASE + LM_MAC_MRXD_OFFSET) +#define LM_MAC_NP (LM_ETHCON_BASE + LM_MAC_NP_OFFSET) +#define LM_MAC_TR (LM_ETHCON_BASE + LM_MAC_TR_OFFSET) +#ifdef LM_ETHTS +# define LM_MAC_TS (LM_ETHCON_BASE + LM_MAC_TS_OFFSET) #endif /* Memory Mapped MII Management Registers */ -#define MAC_MII_MCR (LM3S_ETHCON_BASE + MII_MCR) -#define MAC_MII_MSR (LM3S_ETHCON_BASE + MII_MSR) -#define MAC_MII_PHYID1 (LM3S_ETHCON_BASE + MII_PHYID1) -#define MAC_MII_PHYID2 (LM3S_ETHCON_BASE + MII_PHYID2) -#define MAC_MII_ADVERTISE (LM3S_ETHCON_BASE + MII_ADVERTISE) -#define MAC_MII_LPA (LM3S_ETHCON_BASE + MII_LPA) -#define MAC_MII_EXPANSION (LM3S_ETHCON_BASE + MII_EXPANSION) -#define MAC_MII_VSPECIFIC (LM3S_ETHCON_BASE + MII_LM3S_VSPECIFIC) -#define MAC_MII_INTCS (LM3S_ETHCON_BASE + MII_LM3S_INTCS) -#define MAC_MII_DIAGNOSTIC (LM3S_ETHCON_BASE + MII_LM3S_DIAGNOSTIC) -#define MAC_MII_XCVRCONTROL (LM3S_ETHCON_BASE + MII_LM3S_XCVRCONTROL) -#define MAC_MII_LEDCONFIG (LM3S_ETHCON_BASE + MII_LM3S_LEDCONFIG) -#define MAC_MII_MDICONTROL (LM3S_ETHCON_BASE + MII_LM3S_MDICONTROL) +#define MAC_MII_MCR (LM_ETHCON_BASE + MII_MCR) +#define MAC_MII_MSR (LM_ETHCON_BASE + MII_MSR) +#define MAC_MII_PHYID1 (LM_ETHCON_BASE + MII_PHYID1) +#define MAC_MII_PHYID2 (LM_ETHCON_BASE + MII_PHYID2) +#define MAC_MII_ADVERTISE (LM_ETHCON_BASE + MII_ADVERTISE) +#define MAC_MII_LPA (LM_ETHCON_BASE + MII_LPA) +#define MAC_MII_EXPANSION (LM_ETHCON_BASE + MII_EXPANSION) +#define MAC_MII_VSPECIFIC (LM_ETHCON_BASE + MII_LM_VSPECIFIC) +#define MAC_MII_INTCS (LM_ETHCON_BASE + MII_LM_INTCS) +#define MAC_MII_DIAGNOSTIC (LM_ETHCON_BASE + MII_LM_DIAGNOSTIC) +#define MAC_MII_XCVRCONTROL (LM_ETHCON_BASE + MII_LM_XCVRCONTROL) +#define MAC_MII_LEDCONFIG (LM_ETHCON_BASE + MII_LM_LEDCONFIG) +#define MAC_MII_MDICONTROL (LM_ETHCON_BASE + MII_LM_MDICONTROL) /* Ethernet Controller Register Bit Definitions *************************************/ @@ -200,4 +200,4 @@ * Public Function Prototypes ************************************************************************************/ -#endif /* __ARCH_ARM_SRC_LM_CHIP_LM3S_ETHERNET_H */ +#endif /* __ARCH_ARM_SRC_LM_CHIP_LM_ETHERNET_H */ diff --git a/nuttx/arch/arm/src/lm/chip/lm_flash.h b/nuttx/arch/arm/src/lm/chip/lm_flash.h index 0d4808526f..e5869bb0e5 100644 --- a/nuttx/arch/arm/src/lm/chip/lm_flash.h +++ b/nuttx/arch/arm/src/lm/chip/lm_flash.h @@ -33,8 +33,8 @@ * ************************************************************************************/ -#ifndef __ARCH_ARM_SRC_LM_CHIP_LM3S_FLASH_H -#define __ARCH_ARM_SRC_LM_CHIP_LM3S_FLASH_H +#ifndef __ARCH_ARM_SRC_LM_CHIP_LM_FLASH_H +#define __ARCH_ARM_SRC_LM_CHIP_LM_FLASH_H /************************************************************************************ * Included Files @@ -49,66 +49,66 @@ /* FLASH register offsets ***********************************************************/ /* The FMA, FMD, FMC, FCRIS, FCIM, and FCMISC registers are relative to the Flash - * control base address of LM3S_FLASHCON_BASE. + * control base address of LM_FLASHCON_BASE. */ -#define LM3S_FLASH_FMA_OFFSET 0x000 /* Flash memory address */ -#define LM3S_FLASH_FMD_OFFSET 0x004 /* Flash memory data */ -#define LM3S_FLASH_FMC_OFFSET 0x008 /* Flash memory control */ -#define LM3S_FLASH_FCRIS_OFFSET 0x00c /* Flash controller raw interrupt status */ -#define LM3S_FLASH_FCIM_OFFSET 0x010 /* Flash controller interrupt mask */ -#define LM3S_FLASH_FCMISC_OFFSET 0x014 /* Flash controller masked interrupt status and clear */ */ +#define LM_FLASH_FMA_OFFSET 0x000 /* Flash memory address */ +#define LM_FLASH_FMD_OFFSET 0x004 /* Flash memory data */ +#define LM_FLASH_FMC_OFFSET 0x008 /* Flash memory control */ +#define LM_FLASH_FCRIS_OFFSET 0x00c /* Flash controller raw interrupt status */ +#define LM_FLASH_FCIM_OFFSET 0x010 /* Flash controller interrupt mask */ +#define LM_FLASH_FCMISC_OFFSET 0x014 /* Flash controller masked interrupt status and clear */ /* The FMPREn, FMPPEn, USECRL, USER_DBG, and USER_REGn registers are relative to the - * System Control base address of LM3S_SYSCON_BASE + * System Control base address of LM_SYSCON_BASE */ -#define LM3S_FLASH_FMPRE_OFFSET 0x130 /* Flash memory protection read enable */ -#define LM3S_FLASH_FMPPE_OFFSET 0x134 /* Flash memory protection program enable */ -#define LM3S_FLASH_USECRL_OFFSET 0x140 /* USec Reload */ -#define LM3S_FLASH_USERDBG_OFFSET 0x1d0 /* User Debug */ -#define LM3S_FLASH_USERREG0_OFFSET 0x1e0 /* User Register 0 */ -#define LM3S_FLASH_USERREG1_OFFSET 0x1e4 /* User Register 1 */ -#define LM3S_FLASH_FMPRE0_OFFSET 0x200 /* Flash Memory Protection Read Enable 0 */ -#define LM3S_FLASH_FMPRE1_OFFSET 0x204 /* Flash Memory Protection Read Enable 1 */ -#define LM3S_FLASH_FMPRE2_OFFSET 0x208 /* Flash Memory Protection Read Enable 2 */ -#define LM3S_FLASH_FMPRE3_OFFSET 0x20c /* Flash Memory Protection Read Enable 3 */ -#define LM3S_FLASH_FMPPE0_OFFSET 0x400 /* Flash Memory Protection Program Enable 0 */ -#define LM3S_FLASH_FMPPE1_OFFSET 0x404 /* Flash Memory Protection Program Enable 1 */ -#define LM3S_FLASH_FMPPE2_OFFSET 0x408 /* Flash Memory Protection Program Enable 2 */ -#define LM3S_FLASH_FMPPE3_OFFSET 0x40c /* Flash Memory Protection Program Enable 3 */ +#define LM_FLASH_FMPRE_OFFSET 0x130 /* Flash memory protection read enable */ +#define LM_FLASH_FMPPE_OFFSET 0x134 /* Flash memory protection program enable */ +#define LM_FLASH_USECRL_OFFSET 0x140 /* USec Reload */ +#define LM_FLASH_USERDBG_OFFSET 0x1d0 /* User Debug */ +#define LM_FLASH_USERREG0_OFFSET 0x1e0 /* User Register 0 */ +#define LM_FLASH_USERREG1_OFFSET 0x1e4 /* User Register 1 */ +#define LM_FLASH_FMPRE0_OFFSET 0x200 /* Flash Memory Protection Read Enable 0 */ +#define LM_FLASH_FMPRE1_OFFSET 0x204 /* Flash Memory Protection Read Enable 1 */ +#define LM_FLASH_FMPRE2_OFFSET 0x208 /* Flash Memory Protection Read Enable 2 */ +#define LM_FLASH_FMPRE3_OFFSET 0x20c /* Flash Memory Protection Read Enable 3 */ +#define LM_FLASH_FMPPE0_OFFSET 0x400 /* Flash Memory Protection Program Enable 0 */ +#define LM_FLASH_FMPPE1_OFFSET 0x404 /* Flash Memory Protection Program Enable 1 */ +#define LM_FLASH_FMPPE2_OFFSET 0x408 /* Flash Memory Protection Program Enable 2 */ +#define LM_FLASH_FMPPE3_OFFSET 0x40c /* Flash Memory Protection Program Enable 3 */ /* FLASH register addresses *********************************************************/ /* The FMA, FMD, FMC, FCRIS, FCIM, and FCMISC registers are relative to the Flash - * control base address of LM3S_FLASHCON_BASE. + * control base address of LM_FLASHCON_BASE. */ -#define LM3S_FLASH_FMA (LM3S_FLASHCON_BASE + LM3S_FLASH_FMA_OFFSET) -#define LM3S_FLASH_FMD (LM3S_FLASHCON_BASE + LM3S_FLASH_FMD_OFFSET) -#define LM3S_FLASH_FMC (LM3S_FLASHCON_BASE + LM3S_FLASH_FMC_OFFSET) -#define LM3S_FLASH_FCRIS (LM3S_FLASHCON_BASE + LM3S_FLASH_FCRIS_OFFSET) -#define LM3S_FLASH_FCIM (LM3S_FLASHCON_BASE + LM3S_FLASH_FCIM_OFFSET) -#define LM3S_FLASH_FCMISC (LM3S_FLASHCON_BASE + LM3S_FLASH_FCMISC_OFFSET) +#define LM_FLASH_FMA (LM_FLASHCON_BASE + LM_FLASH_FMA_OFFSET) +#define LM_FLASH_FMD (LM_FLASHCON_BASE + LM_FLASH_FMD_OFFSET) +#define LM_FLASH_FMC (LM_FLASHCON_BASE + LM_FLASH_FMC_OFFSET) +#define LM_FLASH_FCRIS (LM_FLASHCON_BASE + LM_FLASH_FCRIS_OFFSET) +#define LM_FLASH_FCIM (LM_FLASHCON_BASE + LM_FLASH_FCIM_OFFSET) +#define LM_FLASH_FCMISC (LM_FLASHCON_BASE + LM_FLASH_FCMISC_OFFSET) /* The FMPREn, FMPPEn, USECRL, USER_DBG, and USER_REGn registers are relative to the - * System Control base address of LM3S_SYSCON_BASE + * System Control base address of LM_SYSCON_BASE */ -#define LM3S_FLASH_FMPRE (LM3S_SYSCON_BASE + LM3S_FLASH_FMPRE_OFFSET) -#define LM3S_FLASH_FMPPE (LM3S_SYSCON_BASE + LM3S_FLASH_FMPPE_OFFSET) -#define LM3S_FLASH_USECRL (LM3S_SYSCON_BASE + LM3S_FLASH_USECRL_OFFSET) -#define LM3S_FLASH_USERDBG (LM3S_SYSCON_BASE + LM3S_FLASH_USERDBG_OFFSET) -#define LM3S_FLASH_USERREG0 (LM3S_SYSCON_BASE + LM3S_FLASH_USERREG0_OFFSET) -#define LM3S_FLASH_USERREG1 (LM3S_SYSCON_BASE + LM3S_FLASH_USERREG1_OFFSET) -#define LM3S_FLASH_FMPRE0 (LM3S_SYSCON_BASE + LM3S_FLASH_FMPRE0_OFFSET) -#define LM3S_FLASH_FMPRE1 (LM3S_SYSCON_BASE + LM3S_FLASH_FMPRE1_OFFSET) -#define LM3S_FLASH_FMPRE2 (LM3S_SYSCON_BASE + LM3S_FLASH_FMPRE2_OFFSET) -#define LM3S_FLASH_FMPRE3 (LM3S_SYSCON_BASE + LM3S_FLASH_FMPRE3_OFFSET) -#define LM3S_FLASH_FMPPE0 (LM3S_SYSCON_BASE + LM3S_FLASH_FMPPE0_OFFSET) -#define LM3S_FLASH_FMPPE1 (LM3S_SYSCON_BASE + LM3S_FLASH_FMPPE1_OFFSET) -#define LM3S_FLASH_FMPPE2 (LM3S_SYSCON_BASE + LM3S_FLASH_FMPPE2_OFFSET) -#define LM3S_FLASH_FMPPE3 (LM3S_SYSCON_BASE + LM3S_FLASH_FMPPE3_OFFSET) +#define LM_FLASH_FMPRE (LM_SYSCON_BASE + LM_FLASH_FMPRE_OFFSET) +#define LM_FLASH_FMPPE (LM_SYSCON_BASE + LM_FLASH_FMPPE_OFFSET) +#define LM_FLASH_USECRL (LM_SYSCON_BASE + LM_FLASH_USECRL_OFFSET) +#define LM_FLASH_USERDBG (LM_SYSCON_BASE + LM_FLASH_USERDBG_OFFSET) +#define LM_FLASH_USERREG0 (LM_SYSCON_BASE + LM_FLASH_USERREG0_OFFSET) +#define LM_FLASH_USERREG1 (LM_SYSCON_BASE + LM_FLASH_USERREG1_OFFSET) +#define LM_FLASH_FMPRE0 (LM_SYSCON_BASE + LM_FLASH_FMPRE0_OFFSET) +#define LM_FLASH_FMPRE1 (LM_SYSCON_BASE + LM_FLASH_FMPRE1_OFFSET) +#define LM_FLASH_FMPRE2 (LM_SYSCON_BASE + LM_FLASH_FMPRE2_OFFSET) +#define LM_FLASH_FMPRE3 (LM_SYSCON_BASE + LM_FLASH_FMPRE3_OFFSET) +#define LM_FLASH_FMPPE0 (LM_SYSCON_BASE + LM_FLASH_FMPPE0_OFFSET) +#define LM_FLASH_FMPPE1 (LM_SYSCON_BASE + LM_FLASH_FMPPE1_OFFSET) +#define LM_FLASH_FMPPE2 (LM_SYSCON_BASE + LM_FLASH_FMPPE2_OFFSET) +#define LM_FLASH_FMPPE3 (LM_SYSCON_BASE + LM_FLASH_FMPPE3_OFFSET) /* FLASH register bit defitiions ****************************************************/ /* To be provided */ @@ -125,4 +125,4 @@ * Public Function Prototypes ************************************************************************************/ -#endif /* __ARCH_ARM_SRC_LM_CHIP_LM3S_FLASH_H */ +#endif /* __ARCH_ARM_SRC_LM_CHIP_LM_FLASH_H */ diff --git a/nuttx/arch/arm/src/lm/chip/lm_gpio.h b/nuttx/arch/arm/src/lm/chip/lm_gpio.h index 4ca8e8ff96..30b850fcad 100644 --- a/nuttx/arch/arm/src/lm/chip/lm_gpio.h +++ b/nuttx/arch/arm/src/lm/chip/lm_gpio.h @@ -33,8 +33,8 @@ * ************************************************************************************/ -#ifndef __ARCH_ARM_SRC_LM_CHIP_LM3S_GPIO_H -#define __ARCH_ARM_SRC_LM_CHIP_LM3S_GPIO_H +#ifndef __ARCH_ARM_SRC_LM_CHIP_LM_GPIO_H +#define __ARCH_ARM_SRC_LM_CHIP_LM_GPIO_H /************************************************************************************ * Included Files @@ -48,337 +48,337 @@ /* GPIO Register Offsets ************************************************************/ -#define LM3S_GPIO_DATA_OFFSET 0x000 /* GPIO Data */ -#define LM3S_GPIO_DIR_OFFSET 0x400 /* GPIO Direction */ -#define LM3S_GPIO_IS_OFFSET 0x404 /* GPIO Interrupt Sense */ -#define LM3S_GPIO_IBE_OFFSET 0x408 /* GPIO Interrupt Both Edges */ -#define LM3S_GPIO_IEV_OFFSET 0x40c /* GPIO Interrupt Event */ -#define LM3S_GPIO_IM_OFFSET 0x410 /* GPIO Interrupt Mask */ -#define LM3S_GPIO_RIS_OFFSET 0x414 /* GPIO Raw Interrupt Status */ -#define LM3S_GPIO_MIS_OFFSET 0x418 /* GPIO Masked Interrupt Status */ -#define LM3S_GPIO_ICR_OFFSET 0x41c /* GPIO Interrupt Clear */ -#define LM3S_GPIO_AFSEL_OFFSET 0x420 /* GPIO Alternate Function */ -#define LM3S_GPIO_DR2R_OFFSET 0x500 /* Select GPIO 2-mA Drive Select */ -#define LM3S_GPIO_DR4R_OFFSET 0x504 /* GPIO 4-mA Drive Select */ -#define LM3S_GPIO_DR8R_OFFSET 0x508 /* GPIO 8-mA Drive Select */ -#define LM3S_GPIO_ODR_OFFSET 0x50c /* GPIO Open Drain Select */ -#define LM3S_GPIO_PUR_OFFSET 0x510 /* GPIO Pull-Up Select */ -#define LM3S_GPIO_PDR_OFFSET 0x514 /* GPIO Pull-Down Select */ -#define LM3S_GPIO_SLR_OFFSET 0x518 /* GPIO Slew Rate Control Select */ -#define LM3S_GPIO_DEN_OFFSET 0x51C /* GPIO Digital Enable */ -#define LM3S_GPIO_LOCK_OFFSET 0x520 /* GPIO Lock */ -#define LM3S_GPIO_CR_OFFSET 0x524 /* GPIO Commit */ -#define LM3S_GPIO_PERIPHID4_OFFSET 0xfd0 /* GPIO Peripheral Identification 4 */ -#define LM3S_GPIO_PERIPHID5_OFFSET 0xfd4 /* GPIO Peripheral Identification 5 */ -#define LM3S_GPIO_PERIPHID6_OFFSET 0xfd8 /* GPIO Peripheral Identification 6 */ -#define LM3S_GPIO_PERIPHID7_OFFSET 0xfdc /* GPIO Peripheral Identification 7 */ -#define LM3S_GPIO_PERIPHID0_OFFSET 0xfe0 /* GPIO Peripheral Identification 0 */ -#define LM3S_GPIO_PERIPHID1_OFFSET 0xfe4 /* GPIO Peripheral Identification 1 */ -#define LM3S_GPIO_PERIPHID2_OFFSET 0xfe8 /* GPIO Peripheral Identification 2 */ -#define LM3S_GPIO_PERIPHID3_OFFSET 0xfec /* GPIO Peripheral Identification 3 */ -#define LM3S_GPIO_PCELLID0_OFFSET 0xff0 /* GPIO PrimeCell Identification 0 */ -#define LM3S_GPIO_PCELLID1_OFFSET 0xff4 /* GPIO PrimeCell Identification 1 */ -#define LM3S_GPIO_PCELLID2_OFFSET 0xff8 /* GPIO PrimeCell Identification 2 */ -#define LM3S_GPIO_PCELLID3_OFFSET 0xffc /* GPIO PrimeCell Identification 3*/ +#define LM_GPIO_DATA_OFFSET 0x000 /* GPIO Data */ +#define LM_GPIO_DIR_OFFSET 0x400 /* GPIO Direction */ +#define LM_GPIO_IS_OFFSET 0x404 /* GPIO Interrupt Sense */ +#define LM_GPIO_IBE_OFFSET 0x408 /* GPIO Interrupt Both Edges */ +#define LM_GPIO_IEV_OFFSET 0x40c /* GPIO Interrupt Event */ +#define LM_GPIO_IM_OFFSET 0x410 /* GPIO Interrupt Mask */ +#define LM_GPIO_RIS_OFFSET 0x414 /* GPIO Raw Interrupt Status */ +#define LM_GPIO_MIS_OFFSET 0x418 /* GPIO Masked Interrupt Status */ +#define LM_GPIO_ICR_OFFSET 0x41c /* GPIO Interrupt Clear */ +#define LM_GPIO_AFSEL_OFFSET 0x420 /* GPIO Alternate Function */ +#define LM_GPIO_DR2R_OFFSET 0x500 /* Select GPIO 2-mA Drive Select */ +#define LM_GPIO_DR4R_OFFSET 0x504 /* GPIO 4-mA Drive Select */ +#define LM_GPIO_DR8R_OFFSET 0x508 /* GPIO 8-mA Drive Select */ +#define LM_GPIO_ODR_OFFSET 0x50c /* GPIO Open Drain Select */ +#define LM_GPIO_PUR_OFFSET 0x510 /* GPIO Pull-Up Select */ +#define LM_GPIO_PDR_OFFSET 0x514 /* GPIO Pull-Down Select */ +#define LM_GPIO_SLR_OFFSET 0x518 /* GPIO Slew Rate Control Select */ +#define LM_GPIO_DEN_OFFSET 0x51C /* GPIO Digital Enable */ +#define LM_GPIO_LOCK_OFFSET 0x520 /* GPIO Lock */ +#define LM_GPIO_CR_OFFSET 0x524 /* GPIO Commit */ +#define LM_GPIO_PERIPHID4_OFFSET 0xfd0 /* GPIO Peripheral Identification 4 */ +#define LM_GPIO_PERIPHID5_OFFSET 0xfd4 /* GPIO Peripheral Identification 5 */ +#define LM_GPIO_PERIPHID6_OFFSET 0xfd8 /* GPIO Peripheral Identification 6 */ +#define LM_GPIO_PERIPHID7_OFFSET 0xfdc /* GPIO Peripheral Identification 7 */ +#define LM_GPIO_PERIPHID0_OFFSET 0xfe0 /* GPIO Peripheral Identification 0 */ +#define LM_GPIO_PERIPHID1_OFFSET 0xfe4 /* GPIO Peripheral Identification 1 */ +#define LM_GPIO_PERIPHID2_OFFSET 0xfe8 /* GPIO Peripheral Identification 2 */ +#define LM_GPIO_PERIPHID3_OFFSET 0xfec /* GPIO Peripheral Identification 3 */ +#define LM_GPIO_PCELLID0_OFFSET 0xff0 /* GPIO PrimeCell Identification 0 */ +#define LM_GPIO_PCELLID1_OFFSET 0xff4 /* GPIO PrimeCell Identification 1 */ +#define LM_GPIO_PCELLID2_OFFSET 0xff8 /* GPIO PrimeCell Identification 2 */ +#define LM_GPIO_PCELLID3_OFFSET 0xffc /* GPIO PrimeCell Identification 3*/ /* GPIO Register Addresses **********************************************************/ -#define LM3S_GPIOA_DATA (LM3S_GPIOA_BASE + LM3S_GPIO_DATA_OFFSET) -#define LM3S_GPIOA_DIR (LM3S_GPIOA_BASE + LM3S_GPIO_DIR_OFFSET) -#define LM3S_GPIOA_IS (LM3S_GPIOA_BASE + LM3S_GPIO_IS_OFFSET) -#define LM3S_GPIOA_IBE (LM3S_GPIOA_BASE + LM3S_GPIO_IBE_OFFSET) -#define LM3S_GPIOA_IEV (LM3S_GPIOA_BASE + LM3S_GPIO_IEV_OFFSET) -#define LM3S_GPIOA_IM (LM3S_GPIOA_BASE + LM3S_GPIO_IM_OFFSET) -#define LM3S_GPIOA_RIS (LM3S_GPIOA_BASE + LM3S_GPIO_RIS_OFFSET) -#define LM3S_GPIOA_MIS (LM3S_GPIOA_BASE + LM3S_GPIO_MIS_OFFSET) -#define LM3S_GPIOA_ICR (LM3S_GPIOA_BASE + LM3S_GPIO_ICR_OFFSET) -#define LM3S_GPIOA_AFSEL (LM3S_GPIOA_BASE + LM3S_GPIO_AFSEL_OFFSET) -#define LM3S_GPIOA_DR2R (LM3S_GPIOA_BASE + LM3S_GPIO_DR2R_OFFSET) -#define LM3S_GPIOA_DR4R (LM3S_GPIOA_BASE + LM3S_GPIO_DR4R_OFFSET) -#define LM3S_GPIOA_DR8R (LM3S_GPIOA_BASE + LM3S_GPIO_DR8R_OFFSET) -#define LM3S_GPIOA_ODR (LM3S_GPIOA_BASE + LM3S_GPIO_ODR_OFFSET) -#define LM3S_GPIOA_PUR (LM3S_GPIOA_BASE + LM3S_GPIO_PUR_OFFSET) -#define LM3S_GPIOA_PDR (LM3S_GPIOA_BASE + LM3S_GPIO_PDR_OFFSET) -#define LM3S_GPIOA_SLR (LM3S_GPIOA_BASE + LM3S_GPIO_SLR_OFFSET) -#define LM3S_GPIOA_DEN (LM3S_GPIOA_BASE + LM3S_GPIO_DEN_OFFSET) -#define LM3S_GPIOA_LOCK (LM3S_GPIOA_BASE + LM3S_GPIO_LOCK_OFFSET) -#define LM3S_GPIOA_CR (LM3S_GPIOA_BASE + LM3S_GPIO_CR_OFFSET) -#define LM3S_GPIOA_PERIPHID4 (LM3S_GPIOA_BASE + LM3S_GPIO_PERIPHID4_OFFSET) -#define LM3S_GPIOA_PERIPHID5 (LM3S_GPIOA_BASE + LM3S_GPIO_PERIPHID5_OFFSET) -#define LM3S_GPIOA_PERIPHID6 (LM3S_GPIOA_BASE + LM3S_GPIO_PERIPHID6_OFFSET) -#define LM3S_GPIOA_PERIPHID7 (LM3S_GPIOA_BASE + LM3S_GPIO_PERIPHID7_OFFSET) -#define LM3S_GPIOA_PERIPHID0 (LM3S_GPIOA_BASE + LM3S_GPIO_PERIPHID0_OFFSET) -#define LM3S_GPIOA_PERIPHID1 (LM3S_GPIOA_BASE + LM3S_GPIO_PERIPHID1_OFFSET) -#define LM3S_GPIOA_PERIPHID2 (LM3S_GPIOA_BASE + LM3S_GPIO_PERIPHID2_OFFSET) -#define LM3S_GPIOA_PERIPHID3 (LM3S_GPIOA_BASE + LM3S_GPIO_PERIPHID3_OFFSET) -#define LM3S_GPIOA_PCELLID0 (LM3S_GPIOA_BASE + LM3S_GPIO_PCELLID0_OFFSET) -#define LM3S_GPIOA_PCELLID1 (LM3S_GPIOA_BASE + LM3S_GPIO_PCELLID1_OFFSET) -#define LM3S_GPIOA_PCELLID2 (LM3S_GPIOA_BASE + LM3S_GPIO_PCELLID2_OFFSET) -#define LM3S_GPIOA_PCELLID3 (LM3S_GPIOA_BASE + LM3S_GPIO_PCELLID3_OFFSET) +#define LM_GPIOA_DATA (LM_GPIOA_BASE + LM_GPIO_DATA_OFFSET) +#define LM_GPIOA_DIR (LM_GPIOA_BASE + LM_GPIO_DIR_OFFSET) +#define LM_GPIOA_IS (LM_GPIOA_BASE + LM_GPIO_IS_OFFSET) +#define LM_GPIOA_IBE (LM_GPIOA_BASE + LM_GPIO_IBE_OFFSET) +#define LM_GPIOA_IEV (LM_GPIOA_BASE + LM_GPIO_IEV_OFFSET) +#define LM_GPIOA_IM (LM_GPIOA_BASE + LM_GPIO_IM_OFFSET) +#define LM_GPIOA_RIS (LM_GPIOA_BASE + LM_GPIO_RIS_OFFSET) +#define LM_GPIOA_MIS (LM_GPIOA_BASE + LM_GPIO_MIS_OFFSET) +#define LM_GPIOA_ICR (LM_GPIOA_BASE + LM_GPIO_ICR_OFFSET) +#define LM_GPIOA_AFSEL (LM_GPIOA_BASE + LM_GPIO_AFSEL_OFFSET) +#define LM_GPIOA_DR2R (LM_GPIOA_BASE + LM_GPIO_DR2R_OFFSET) +#define LM_GPIOA_DR4R (LM_GPIOA_BASE + LM_GPIO_DR4R_OFFSET) +#define LM_GPIOA_DR8R (LM_GPIOA_BASE + LM_GPIO_DR8R_OFFSET) +#define LM_GPIOA_ODR (LM_GPIOA_BASE + LM_GPIO_ODR_OFFSET) +#define LM_GPIOA_PUR (LM_GPIOA_BASE + LM_GPIO_PUR_OFFSET) +#define LM_GPIOA_PDR (LM_GPIOA_BASE + LM_GPIO_PDR_OFFSET) +#define LM_GPIOA_SLR (LM_GPIOA_BASE + LM_GPIO_SLR_OFFSET) +#define LM_GPIOA_DEN (LM_GPIOA_BASE + LM_GPIO_DEN_OFFSET) +#define LM_GPIOA_LOCK (LM_GPIOA_BASE + LM_GPIO_LOCK_OFFSET) +#define LM_GPIOA_CR (LM_GPIOA_BASE + LM_GPIO_CR_OFFSET) +#define LM_GPIOA_PERIPHID4 (LM_GPIOA_BASE + LM_GPIO_PERIPHID4_OFFSET) +#define LM_GPIOA_PERIPHID5 (LM_GPIOA_BASE + LM_GPIO_PERIPHID5_OFFSET) +#define LM_GPIOA_PERIPHID6 (LM_GPIOA_BASE + LM_GPIO_PERIPHID6_OFFSET) +#define LM_GPIOA_PERIPHID7 (LM_GPIOA_BASE + LM_GPIO_PERIPHID7_OFFSET) +#define LM_GPIOA_PERIPHID0 (LM_GPIOA_BASE + LM_GPIO_PERIPHID0_OFFSET) +#define LM_GPIOA_PERIPHID1 (LM_GPIOA_BASE + LM_GPIO_PERIPHID1_OFFSET) +#define LM_GPIOA_PERIPHID2 (LM_GPIOA_BASE + LM_GPIO_PERIPHID2_OFFSET) +#define LM_GPIOA_PERIPHID3 (LM_GPIOA_BASE + LM_GPIO_PERIPHID3_OFFSET) +#define LM_GPIOA_PCELLID0 (LM_GPIOA_BASE + LM_GPIO_PCELLID0_OFFSET) +#define LM_GPIOA_PCELLID1 (LM_GPIOA_BASE + LM_GPIO_PCELLID1_OFFSET) +#define LM_GPIOA_PCELLID2 (LM_GPIOA_BASE + LM_GPIO_PCELLID2_OFFSET) +#define LM_GPIOA_PCELLID3 (LM_GPIOA_BASE + LM_GPIO_PCELLID3_OFFSET) -#define LM3S_GPIOB_DATA (LM3S_GPIOB_BASE + LM3S_GPIO_DATA_OFFSET) -#define LM3S_GPIOB_DIR (LM3S_GPIOB_BASE + LM3S_GPIO_DIR_OFFSET) -#define LM3S_GPIOB_IS (LM3S_GPIOB_BASE + LM3S_GPIO_IS_OFFSET) -#define LM3S_GPIOB_IBE (LM3S_GPIOB_BASE + LM3S_GPIO_IBE_OFFSET) -#define LM3S_GPIOB_IEV (LM3S_GPIOB_BASE + LM3S_GPIO_IEV_OFFSET) -#define LM3S_GPIOB_IM (LM3S_GPIOB_BASE + LM3S_GPIO_IM_OFFSET) -#define LM3S_GPIOB_RIS (LM3S_GPIOB_BASE + LM3S_GPIO_RIS_OFFSET) -#define LM3S_GPIOB_MIS (LM3S_GPIOB_BASE + LM3S_GPIO_MIS_OFFSET) -#define LM3S_GPIOB_ICR (LM3S_GPIOB_BASE + LM3S_GPIO_ICR_OFFSET) -#define LM3S_GPIOB_AFSEL (LM3S_GPIOB_BASE + LM3S_GPIO_AFSEL_OFFSET) -#define LM3S_GPIOB_DR2R (LM3S_GPIOB_BASE + LM3S_GPIO_DR2R_OFFSET) -#define LM3S_GPIOB_DR4R (LM3S_GPIOB_BASE + LM3S_GPIO_DR4R_OFFSET) -#define LM3S_GPIOB_DR8R (LM3S_GPIOB_BASE + LM3S_GPIO_DR8R_OFFSET) -#define LM3S_GPIOB_ODR (LM3S_GPIOB_BASE + LM3S_GPIO_ODR_OFFSET) -#define LM3S_GPIOB_PUR (LM3S_GPIOB_BASE + LM3S_GPIO_PUR_OFFSET) -#define LM3S_GPIOB_PDR (LM3S_GPIOB_BASE + LM3S_GPIO_PDR_OFFSET) -#define LM3S_GPIOB_SLR (LM3S_GPIOB_BASE + LM3S_GPIO_SLR_OFFSET) -#define LM3S_GPIOB_DEN (LM3S_GPIOB_BASE + LM3S_GPIO_DEN_OFFSET) -#define LM3S_GPIOB_LOCK (LM3S_GPIOB_BASE + LM3S_GPIO_LOCK_OFFSET) -#define LM3S_GPIOB_CR (LM3S_GPIOB_BASE + LM3S_GPIO_CR_OFFSET) -#define LM3S_GPIOB_PERIPHID4 (LM3S_GPIOB_BASE + LM3S_GPIO_PERIPHID4_OFFSET) -#define LM3S_GPIOB_PERIPHID5 (LM3S_GPIOB_BASE + LM3S_GPIO_PERIPHID5_OFFSET) -#define LM3S_GPIOB_PERIPHID6 (LM3S_GPIOB_BASE + LM3S_GPIO_PERIPHID6_OFFSET) -#define LM3S_GPIOB_PERIPHID7 (LM3S_GPIOB_BASE + LM3S_GPIO_PERIPHID7_OFFSET) -#define LM3S_GPIOB_PERIPHID0 (LM3S_GPIOB_BASE + LM3S_GPIO_PERIPHID0_OFFSET) -#define LM3S_GPIOB_PERIPHID1 (LM3S_GPIOB_BASE + LM3S_GPIO_PERIPHID1_OFFSET) -#define LM3S_GPIOB_PERIPHID2 (LM3S_GPIOB_BASE + LM3S_GPIO_PERIPHID2_OFFSET) -#define LM3S_GPIOB_PERIPHID3 (LM3S_GPIOB_BASE + LM3S_GPIO_PERIPHID3_OFFSET) -#define LM3S_GPIOB_PCELLID0 (LM3S_GPIOB_BASE + LM3S_GPIO_PCELLID0_OFFSET) -#define LM3S_GPIOB_PCELLID1 (LM3S_GPIOB_BASE + LM3S_GPIO_PCELLID1_OFFSET) -#define LM3S_GPIOB_PCELLID2 (LM3S_GPIOB_BASE + LM3S_GPIO_PCELLID2_OFFSET) -#define LM3S_GPIOB_PCELLID3 (LM3S_GPIOB_BASE + LM3S_GPIO_PCELLID3_OFFSET) +#define LM_GPIOB_DATA (LM_GPIOB_BASE + LM_GPIO_DATA_OFFSET) +#define LM_GPIOB_DIR (LM_GPIOB_BASE + LM_GPIO_DIR_OFFSET) +#define LM_GPIOB_IS (LM_GPIOB_BASE + LM_GPIO_IS_OFFSET) +#define LM_GPIOB_IBE (LM_GPIOB_BASE + LM_GPIO_IBE_OFFSET) +#define LM_GPIOB_IEV (LM_GPIOB_BASE + LM_GPIO_IEV_OFFSET) +#define LM_GPIOB_IM (LM_GPIOB_BASE + LM_GPIO_IM_OFFSET) +#define LM_GPIOB_RIS (LM_GPIOB_BASE + LM_GPIO_RIS_OFFSET) +#define LM_GPIOB_MIS (LM_GPIOB_BASE + LM_GPIO_MIS_OFFSET) +#define LM_GPIOB_ICR (LM_GPIOB_BASE + LM_GPIO_ICR_OFFSET) +#define LM_GPIOB_AFSEL (LM_GPIOB_BASE + LM_GPIO_AFSEL_OFFSET) +#define LM_GPIOB_DR2R (LM_GPIOB_BASE + LM_GPIO_DR2R_OFFSET) +#define LM_GPIOB_DR4R (LM_GPIOB_BASE + LM_GPIO_DR4R_OFFSET) +#define LM_GPIOB_DR8R (LM_GPIOB_BASE + LM_GPIO_DR8R_OFFSET) +#define LM_GPIOB_ODR (LM_GPIOB_BASE + LM_GPIO_ODR_OFFSET) +#define LM_GPIOB_PUR (LM_GPIOB_BASE + LM_GPIO_PUR_OFFSET) +#define LM_GPIOB_PDR (LM_GPIOB_BASE + LM_GPIO_PDR_OFFSET) +#define LM_GPIOB_SLR (LM_GPIOB_BASE + LM_GPIO_SLR_OFFSET) +#define LM_GPIOB_DEN (LM_GPIOB_BASE + LM_GPIO_DEN_OFFSET) +#define LM_GPIOB_LOCK (LM_GPIOB_BASE + LM_GPIO_LOCK_OFFSET) +#define LM_GPIOB_CR (LM_GPIOB_BASE + LM_GPIO_CR_OFFSET) +#define LM_GPIOB_PERIPHID4 (LM_GPIOB_BASE + LM_GPIO_PERIPHID4_OFFSET) +#define LM_GPIOB_PERIPHID5 (LM_GPIOB_BASE + LM_GPIO_PERIPHID5_OFFSET) +#define LM_GPIOB_PERIPHID6 (LM_GPIOB_BASE + LM_GPIO_PERIPHID6_OFFSET) +#define LM_GPIOB_PERIPHID7 (LM_GPIOB_BASE + LM_GPIO_PERIPHID7_OFFSET) +#define LM_GPIOB_PERIPHID0 (LM_GPIOB_BASE + LM_GPIO_PERIPHID0_OFFSET) +#define LM_GPIOB_PERIPHID1 (LM_GPIOB_BASE + LM_GPIO_PERIPHID1_OFFSET) +#define LM_GPIOB_PERIPHID2 (LM_GPIOB_BASE + LM_GPIO_PERIPHID2_OFFSET) +#define LM_GPIOB_PERIPHID3 (LM_GPIOB_BASE + LM_GPIO_PERIPHID3_OFFSET) +#define LM_GPIOB_PCELLID0 (LM_GPIOB_BASE + LM_GPIO_PCELLID0_OFFSET) +#define LM_GPIOB_PCELLID1 (LM_GPIOB_BASE + LM_GPIO_PCELLID1_OFFSET) +#define LM_GPIOB_PCELLID2 (LM_GPIOB_BASE + LM_GPIO_PCELLID2_OFFSET) +#define LM_GPIOB_PCELLID3 (LM_GPIOB_BASE + LM_GPIO_PCELLID3_OFFSET) -#define LM3S_GPIOC_DATA (LM3S_GPIOC_BASE + LM3S_GPIO_DATA_OFFSET) -#define LM3S_GPIOC_DIR (LM3S_GPIOC_BASE + LM3S_GPIO_DIR_OFFSET) -#define LM3S_GPIOC_IS (LM3S_GPIOC_BASE + LM3S_GPIO_IS_OFFSET) -#define LM3S_GPIOC_IBE (LM3S_GPIOC_BASE + LM3S_GPIO_IBE_OFFSET) -#define LM3S_GPIOC_IEV (LM3S_GPIOC_BASE + LM3S_GPIO_IEV_OFFSET) -#define LM3S_GPIOC_IM (LM3S_GPIOC_BASE + LM3S_GPIO_IM_OFFSET) -#define LM3S_GPIOC_RIS (LM3S_GPIOC_BASE + LM3S_GPIO_RIS_OFFSET) -#define LM3S_GPIOC_MIS (LM3S_GPIOC_BASE + LM3S_GPIO_MIS_OFFSET) -#define LM3S_GPIOC_ICR (LM3S_GPIOC_BASE + LM3S_GPIO_ICR_OFFSET) -#define LM3S_GPIOC_AFSEL (LM3S_GPIOC_BASE + LM3S_GPIO_AFSEL_OFFSET) -#define LM3S_GPIOC_DR2R (LM3S_GPIOC_BASE + LM3S_GPIO_DR2R_OFFSET) -#define LM3S_GPIOC_DR4R (LM3S_GPIOC_BASE + LM3S_GPIO_DR4R_OFFSET) -#define LM3S_GPIOC_DR8R (LM3S_GPIOC_BASE + LM3S_GPIO_DR8R_OFFSET) -#define LM3S_GPIOC_ODR (LM3S_GPIOC_BASE + LM3S_GPIO_ODR_OFFSET) -#define LM3S_GPIOC_PUR (LM3S_GPIOC_BASE + LM3S_GPIO_PUR_OFFSET) -#define LM3S_GPIOC_PDR (LM3S_GPIOC_BASE + LM3S_GPIO_PDR_OFFSET) -#define LM3S_GPIOC_SLR (LM3S_GPIOC_BASE + LM3S_GPIO_SLR_OFFSET) -#define LM3S_GPIOC_DEN (LM3S_GPIOC_BASE + LM3S_GPIO_DEN_OFFSET) -#define LM3S_GPIOC_LOCK (LM3S_GPIOC_BASE + LM3S_GPIO_LOCK_OFFSET) -#define LM3S_GPIOC_CR (LM3S_GPIOC_BASE + LM3S_GPIO_CR_OFFSET) -#define LM3S_GPIOC_PERIPHID4 (LM3S_GPIOC_BASE + LM3S_GPIO_PERIPHID4_OFFSET) -#define LM3S_GPIOC_PERIPHID5 (LM3S_GPIOC_BASE + LM3S_GPIO_PERIPHID5_OFFSET) -#define LM3S_GPIOC_PERIPHID6 (LM3S_GPIOC_BASE + LM3S_GPIO_PERIPHID6_OFFSET) -#define LM3S_GPIOC_PERIPHID7 (LM3S_GPIOC_BASE + LM3S_GPIO_PERIPHID7_OFFSET) -#define LM3S_GPIOC_PERIPHID0 (LM3S_GPIOC_BASE + LM3S_GPIO_PERIPHID0_OFFSET) -#define LM3S_GPIOC_PERIPHID1 (LM3S_GPIOC_BASE + LM3S_GPIO_PERIPHID1_OFFSET) -#define LM3S_GPIOC_PERIPHID2 (LM3S_GPIOC_BASE + LM3S_GPIO_PERIPHID2_OFFSET) -#define LM3S_GPIOC_PERIPHID3 (LM3S_GPIOC_BASE + LM3S_GPIO_PERIPHID3_OFFSET) -#define LM3S_GPIOC_PCELLID0 (LM3S_GPIOC_BASE + LM3S_GPIO_PCELLID0_OFFSET) -#define LM3S_GPIOC_PCELLID1 (LM3S_GPIOC_BASE + LM3S_GPIO_PCELLID1_OFFSET) -#define LM3S_GPIOC_PCELLID2 (LM3S_GPIOC_BASE + LM3S_GPIO_PCELLID2_OFFSET) -#define LM3S_GPIOC_PCELLID3 (LM3S_GPIOC_BASE + LM3S_GPIO_PCELLID3_OFFSET) +#define LM_GPIOC_DATA (LM_GPIOC_BASE + LM_GPIO_DATA_OFFSET) +#define LM_GPIOC_DIR (LM_GPIOC_BASE + LM_GPIO_DIR_OFFSET) +#define LM_GPIOC_IS (LM_GPIOC_BASE + LM_GPIO_IS_OFFSET) +#define LM_GPIOC_IBE (LM_GPIOC_BASE + LM_GPIO_IBE_OFFSET) +#define LM_GPIOC_IEV (LM_GPIOC_BASE + LM_GPIO_IEV_OFFSET) +#define LM_GPIOC_IM (LM_GPIOC_BASE + LM_GPIO_IM_OFFSET) +#define LM_GPIOC_RIS (LM_GPIOC_BASE + LM_GPIO_RIS_OFFSET) +#define LM_GPIOC_MIS (LM_GPIOC_BASE + LM_GPIO_MIS_OFFSET) +#define LM_GPIOC_ICR (LM_GPIOC_BASE + LM_GPIO_ICR_OFFSET) +#define LM_GPIOC_AFSEL (LM_GPIOC_BASE + LM_GPIO_AFSEL_OFFSET) +#define LM_GPIOC_DR2R (LM_GPIOC_BASE + LM_GPIO_DR2R_OFFSET) +#define LM_GPIOC_DR4R (LM_GPIOC_BASE + LM_GPIO_DR4R_OFFSET) +#define LM_GPIOC_DR8R (LM_GPIOC_BASE + LM_GPIO_DR8R_OFFSET) +#define LM_GPIOC_ODR (LM_GPIOC_BASE + LM_GPIO_ODR_OFFSET) +#define LM_GPIOC_PUR (LM_GPIOC_BASE + LM_GPIO_PUR_OFFSET) +#define LM_GPIOC_PDR (LM_GPIOC_BASE + LM_GPIO_PDR_OFFSET) +#define LM_GPIOC_SLR (LM_GPIOC_BASE + LM_GPIO_SLR_OFFSET) +#define LM_GPIOC_DEN (LM_GPIOC_BASE + LM_GPIO_DEN_OFFSET) +#define LM_GPIOC_LOCK (LM_GPIOC_BASE + LM_GPIO_LOCK_OFFSET) +#define LM_GPIOC_CR (LM_GPIOC_BASE + LM_GPIO_CR_OFFSET) +#define LM_GPIOC_PERIPHID4 (LM_GPIOC_BASE + LM_GPIO_PERIPHID4_OFFSET) +#define LM_GPIOC_PERIPHID5 (LM_GPIOC_BASE + LM_GPIO_PERIPHID5_OFFSET) +#define LM_GPIOC_PERIPHID6 (LM_GPIOC_BASE + LM_GPIO_PERIPHID6_OFFSET) +#define LM_GPIOC_PERIPHID7 (LM_GPIOC_BASE + LM_GPIO_PERIPHID7_OFFSET) +#define LM_GPIOC_PERIPHID0 (LM_GPIOC_BASE + LM_GPIO_PERIPHID0_OFFSET) +#define LM_GPIOC_PERIPHID1 (LM_GPIOC_BASE + LM_GPIO_PERIPHID1_OFFSET) +#define LM_GPIOC_PERIPHID2 (LM_GPIOC_BASE + LM_GPIO_PERIPHID2_OFFSET) +#define LM_GPIOC_PERIPHID3 (LM_GPIOC_BASE + LM_GPIO_PERIPHID3_OFFSET) +#define LM_GPIOC_PCELLID0 (LM_GPIOC_BASE + LM_GPIO_PCELLID0_OFFSET) +#define LM_GPIOC_PCELLID1 (LM_GPIOC_BASE + LM_GPIO_PCELLID1_OFFSET) +#define LM_GPIOC_PCELLID2 (LM_GPIOC_BASE + LM_GPIO_PCELLID2_OFFSET) +#define LM_GPIOC_PCELLID3 (LM_GPIOC_BASE + LM_GPIO_PCELLID3_OFFSET) -#define LM3S_GPIOD_DATA (LM3S_GPIOD_BASE + LM3S_GPIO_DATA_OFFSET) -#define LM3S_GPIOD_DIR (LM3S_GPIOD_BASE + LM3S_GPIO_DIR_OFFSET) -#define LM3S_GPIOD_IS (LM3S_GPIOD_BASE + LM3S_GPIO_IS_OFFSET) -#define LM3S_GPIOD_IBE (LM3S_GPIOD_BASE + LM3S_GPIO_IBE_OFFSET) -#define LM3S_GPIOD_IEV (LM3S_GPIOD_BASE + LM3S_GPIO_IEV_OFFSET) -#define LM3S_GPIOD_IM (LM3S_GPIOD_BASE + LM3S_GPIO_IM_OFFSET) -#define LM3S_GPIOD_RIS (LM3S_GPIOD_BASE + LM3S_GPIO_RIS_OFFSET) -#define LM3S_GPIOD_MIS (LM3S_GPIOD_BASE + LM3S_GPIO_MIS_OFFSET) -#define LM3S_GPIOD_ICR (LM3S_GPIOD_BASE + LM3S_GPIO_ICR_OFFSET) -#define LM3S_GPIOD_AFSEL (LM3S_GPIOD_BASE + LM3S_GPIO_AFSEL_OFFSET) -#define LM3S_GPIOD_DR2R (LM3S_GPIOD_BASE + LM3S_GPIO_DR2R_OFFSET) -#define LM3S_GPIOD_DR4R (LM3S_GPIOD_BASE + LM3S_GPIO_DR4R_OFFSET) -#define LM3S_GPIOD_DR8R (LM3S_GPIOD_BASE + LM3S_GPIO_DR8R_OFFSET) -#define LM3S_GPIOD_ODR (LM3S_GPIOD_BASE + LM3S_GPIO_ODR_OFFSET) -#define LM3S_GPIOD_PUR (LM3S_GPIOD_BASE + LM3S_GPIO_PUR_OFFSET) -#define LM3S_GPIOD_PDR (LM3S_GPIOD_BASE + LM3S_GPIO_PDR_OFFSET) -#define LM3S_GPIOD_SLR (LM3S_GPIOD_BASE + LM3S_GPIO_SLR_OFFSET) -#define LM3S_GPIOD_DEN (LM3S_GPIOD_BASE + LM3S_GPIO_DEN_OFFSET) -#define LM3S_GPIOD_LOCK (LM3S_GPIOD_BASE + LM3S_GPIO_LOCK_OFFSET) -#define LM3S_GPIOD_CR (LM3S_GPIOD_BASE + LM3S_GPIO_CR_OFFSET) -#define LM3S_GPIOD_PERIPHID4 (LM3S_GPIOD_BASE + LM3S_GPIO_PERIPHID4_OFFSET) -#define LM3S_GPIOD_PERIPHID5 (LM3S_GPIOD_BASE + LM3S_GPIO_PERIPHID5_OFFSET) -#define LM3S_GPIOD_PERIPHID6 (LM3S_GPIOD_BASE + LM3S_GPIO_PERIPHID6_OFFSET) -#define LM3S_GPIOD_PERIPHID7 (LM3S_GPIOD_BASE + LM3S_GPIO_PERIPHID7_OFFSET) -#define LM3S_GPIOD_PERIPHID0 (LM3S_GPIOD_BASE + LM3S_GPIO_PERIPHID0_OFFSET) -#define LM3S_GPIOD_PERIPHID1 (LM3S_GPIOD_BASE + LM3S_GPIO_PERIPHID1_OFFSET) -#define LM3S_GPIOD_PERIPHID2 (LM3S_GPIOD_BASE + LM3S_GPIO_PERIPHID2_OFFSET) -#define LM3S_GPIOD_PERIPHID3 (LM3S_GPIOD_BASE + LM3S_GPIO_PERIPHID3_OFFSET) -#define LM3S_GPIOD_PCELLID0 (LM3S_GPIOD_BASE + LM3S_GPIO_PCELLID0_OFFSET) -#define LM3S_GPIOD_PCELLID1 (LM3S_GPIOD_BASE + LM3S_GPIO_PCELLID1_OFFSET) -#define LM3S_GPIOD_PCELLID2 (LM3S_GPIOD_BASE + LM3S_GPIO_PCELLID2_OFFSET) -#define LM3S_GPIOD_PCELLID3 (LM3S_GPIOD_BASE + LM3S_GPIO_PCELLID3_OFFSET) +#define LM_GPIOD_DATA (LM_GPIOD_BASE + LM_GPIO_DATA_OFFSET) +#define LM_GPIOD_DIR (LM_GPIOD_BASE + LM_GPIO_DIR_OFFSET) +#define LM_GPIOD_IS (LM_GPIOD_BASE + LM_GPIO_IS_OFFSET) +#define LM_GPIOD_IBE (LM_GPIOD_BASE + LM_GPIO_IBE_OFFSET) +#define LM_GPIOD_IEV (LM_GPIOD_BASE + LM_GPIO_IEV_OFFSET) +#define LM_GPIOD_IM (LM_GPIOD_BASE + LM_GPIO_IM_OFFSET) +#define LM_GPIOD_RIS (LM_GPIOD_BASE + LM_GPIO_RIS_OFFSET) +#define LM_GPIOD_MIS (LM_GPIOD_BASE + LM_GPIO_MIS_OFFSET) +#define LM_GPIOD_ICR (LM_GPIOD_BASE + LM_GPIO_ICR_OFFSET) +#define LM_GPIOD_AFSEL (LM_GPIOD_BASE + LM_GPIO_AFSEL_OFFSET) +#define LM_GPIOD_DR2R (LM_GPIOD_BASE + LM_GPIO_DR2R_OFFSET) +#define LM_GPIOD_DR4R (LM_GPIOD_BASE + LM_GPIO_DR4R_OFFSET) +#define LM_GPIOD_DR8R (LM_GPIOD_BASE + LM_GPIO_DR8R_OFFSET) +#define LM_GPIOD_ODR (LM_GPIOD_BASE + LM_GPIO_ODR_OFFSET) +#define LM_GPIOD_PUR (LM_GPIOD_BASE + LM_GPIO_PUR_OFFSET) +#define LM_GPIOD_PDR (LM_GPIOD_BASE + LM_GPIO_PDR_OFFSET) +#define LM_GPIOD_SLR (LM_GPIOD_BASE + LM_GPIO_SLR_OFFSET) +#define LM_GPIOD_DEN (LM_GPIOD_BASE + LM_GPIO_DEN_OFFSET) +#define LM_GPIOD_LOCK (LM_GPIOD_BASE + LM_GPIO_LOCK_OFFSET) +#define LM_GPIOD_CR (LM_GPIOD_BASE + LM_GPIO_CR_OFFSET) +#define LM_GPIOD_PERIPHID4 (LM_GPIOD_BASE + LM_GPIO_PERIPHID4_OFFSET) +#define LM_GPIOD_PERIPHID5 (LM_GPIOD_BASE + LM_GPIO_PERIPHID5_OFFSET) +#define LM_GPIOD_PERIPHID6 (LM_GPIOD_BASE + LM_GPIO_PERIPHID6_OFFSET) +#define LM_GPIOD_PERIPHID7 (LM_GPIOD_BASE + LM_GPIO_PERIPHID7_OFFSET) +#define LM_GPIOD_PERIPHID0 (LM_GPIOD_BASE + LM_GPIO_PERIPHID0_OFFSET) +#define LM_GPIOD_PERIPHID1 (LM_GPIOD_BASE + LM_GPIO_PERIPHID1_OFFSET) +#define LM_GPIOD_PERIPHID2 (LM_GPIOD_BASE + LM_GPIO_PERIPHID2_OFFSET) +#define LM_GPIOD_PERIPHID3 (LM_GPIOD_BASE + LM_GPIO_PERIPHID3_OFFSET) +#define LM_GPIOD_PCELLID0 (LM_GPIOD_BASE + LM_GPIO_PCELLID0_OFFSET) +#define LM_GPIOD_PCELLID1 (LM_GPIOD_BASE + LM_GPIO_PCELLID1_OFFSET) +#define LM_GPIOD_PCELLID2 (LM_GPIOD_BASE + LM_GPIO_PCELLID2_OFFSET) +#define LM_GPIOD_PCELLID3 (LM_GPIOD_BASE + LM_GPIO_PCELLID3_OFFSET) -#define LM3S_GPIOE_DATA (LM3S_GPIOE_BASE + LM3S_GPIO_DATA_OFFSET) -#define LM3S_GPIOE_DIR (LM3S_GPIOE_BASE + LM3S_GPIO_DIR_OFFSET) -#define LM3S_GPIOE_IS (LM3S_GPIOE_BASE + LM3S_GPIO_IS_OFFSET) -#define LM3S_GPIOE_IBE (LM3S_GPIOE_BASE + LM3S_GPIO_IBE_OFFSET) -#define LM3S_GPIOE_IEV (LM3S_GPIOE_BASE + LM3S_GPIO_IEV_OFFSET) -#define LM3S_GPIOE_IM (LM3S_GPIOE_BASE + LM3S_GPIO_IM_OFFSET) -#define LM3S_GPIOE_RIS (LM3S_GPIOE_BASE + LM3S_GPIO_RIS_OFFSET) -#define LM3S_GPIOE_MIS (LM3S_GPIOE_BASE + LM3S_GPIO_MIS_OFFSET) -#define LM3S_GPIOE_ICR (LM3S_GPIOE_BASE + LM3S_GPIO_ICR_OFFSET) -#define LM3S_GPIOE_AFSEL (LM3S_GPIOE_BASE + LM3S_GPIO_AFSEL_OFFSET) -#define LM3S_GPIOE_DR2R (LM3S_GPIOE_BASE + LM3S_GPIO_DR2R_OFFSET) -#define LM3S_GPIOE_DR4R (LM3S_GPIOE_BASE + LM3S_GPIO_DR4R_OFFSET) -#define LM3S_GPIOE_DR8R (LM3S_GPIOE_BASE + LM3S_GPIO_DR8R_OFFSET) -#define LM3S_GPIOE_ODR (LM3S_GPIOE_BASE + LM3S_GPIO_ODR_OFFSET) -#define LM3S_GPIOE_PUR (LM3S_GPIOE_BASE + LM3S_GPIO_PUR_OFFSET) -#define LM3S_GPIOE_PDR (LM3S_GPIOE_BASE + LM3S_GPIO_PDR_OFFSET) -#define LM3S_GPIOE_SLR (LM3S_GPIOE_BASE + LM3S_GPIO_SLR_OFFSET) -#define LM3S_GPIOE_DEN (LM3S_GPIOE_BASE + LM3S_GPIO_DEN_OFFSET) -#define LM3S_GPIOE_LOCK (LM3S_GPIOE_BASE + LM3S_GPIO_LOCK_OFFSET) -#define LM3S_GPIOE_CR (LM3S_GPIOE_BASE + LM3S_GPIO_CR_OFFSET) -#define LM3S_GPIOE_PERIPHID4 (LM3S_GPIOE_BASE + LM3S_GPIO_PERIPHID4_OFFSET) -#define LM3S_GPIOE_PERIPHID5 (LM3S_GPIOE_BASE + LM3S_GPIO_PERIPHID5_OFFSET) -#define LM3S_GPIOE_PERIPHID6 (LM3S_GPIOE_BASE + LM3S_GPIO_PERIPHID6_OFFSET) -#define LM3S_GPIOE_PERIPHID7 (LM3S_GPIOE_BASE + LM3S_GPIO_PERIPHID7_OFFSET) -#define LM3S_GPIOE_PERIPHID0 (LM3S_GPIOE_BASE + LM3S_GPIO_PERIPHID0_OFFSET) -#define LM3S_GPIOE_PERIPHID1 (LM3S_GPIOE_BASE + LM3S_GPIO_PERIPHID1_OFFSET) -#define LM3S_GPIOE_PERIPHID2 (LM3S_GPIOE_BASE + LM3S_GPIO_PERIPHID2_OFFSET) -#define LM3S_GPIOE_PERIPHID3 (LM3S_GPIOE_BASE + LM3S_GPIO_PERIPHID3_OFFSET) -#define LM3S_GPIOE_PCELLID0 (LM3S_GPIOE_BASE + LM3S_GPIO_PCELLID0_OFFSET) -#define LM3S_GPIOE_PCELLID1 (LM3S_GPIOE_BASE + LM3S_GPIO_PCELLID1_OFFSET) -#define LM3S_GPIOE_PCELLID2 (LM3S_GPIOE_BASE + LM3S_GPIO_PCELLID2_OFFSET) -#define LM3S_GPIOE_PCELLID3 (LM3S_GPIOE_BASE + LM3S_GPIO_PCELLID3_OFFSET) +#define LM_GPIOE_DATA (LM_GPIOE_BASE + LM_GPIO_DATA_OFFSET) +#define LM_GPIOE_DIR (LM_GPIOE_BASE + LM_GPIO_DIR_OFFSET) +#define LM_GPIOE_IS (LM_GPIOE_BASE + LM_GPIO_IS_OFFSET) +#define LM_GPIOE_IBE (LM_GPIOE_BASE + LM_GPIO_IBE_OFFSET) +#define LM_GPIOE_IEV (LM_GPIOE_BASE + LM_GPIO_IEV_OFFSET) +#define LM_GPIOE_IM (LM_GPIOE_BASE + LM_GPIO_IM_OFFSET) +#define LM_GPIOE_RIS (LM_GPIOE_BASE + LM_GPIO_RIS_OFFSET) +#define LM_GPIOE_MIS (LM_GPIOE_BASE + LM_GPIO_MIS_OFFSET) +#define LM_GPIOE_ICR (LM_GPIOE_BASE + LM_GPIO_ICR_OFFSET) +#define LM_GPIOE_AFSEL (LM_GPIOE_BASE + LM_GPIO_AFSEL_OFFSET) +#define LM_GPIOE_DR2R (LM_GPIOE_BASE + LM_GPIO_DR2R_OFFSET) +#define LM_GPIOE_DR4R (LM_GPIOE_BASE + LM_GPIO_DR4R_OFFSET) +#define LM_GPIOE_DR8R (LM_GPIOE_BASE + LM_GPIO_DR8R_OFFSET) +#define LM_GPIOE_ODR (LM_GPIOE_BASE + LM_GPIO_ODR_OFFSET) +#define LM_GPIOE_PUR (LM_GPIOE_BASE + LM_GPIO_PUR_OFFSET) +#define LM_GPIOE_PDR (LM_GPIOE_BASE + LM_GPIO_PDR_OFFSET) +#define LM_GPIOE_SLR (LM_GPIOE_BASE + LM_GPIO_SLR_OFFSET) +#define LM_GPIOE_DEN (LM_GPIOE_BASE + LM_GPIO_DEN_OFFSET) +#define LM_GPIOE_LOCK (LM_GPIOE_BASE + LM_GPIO_LOCK_OFFSET) +#define LM_GPIOE_CR (LM_GPIOE_BASE + LM_GPIO_CR_OFFSET) +#define LM_GPIOE_PERIPHID4 (LM_GPIOE_BASE + LM_GPIO_PERIPHID4_OFFSET) +#define LM_GPIOE_PERIPHID5 (LM_GPIOE_BASE + LM_GPIO_PERIPHID5_OFFSET) +#define LM_GPIOE_PERIPHID6 (LM_GPIOE_BASE + LM_GPIO_PERIPHID6_OFFSET) +#define LM_GPIOE_PERIPHID7 (LM_GPIOE_BASE + LM_GPIO_PERIPHID7_OFFSET) +#define LM_GPIOE_PERIPHID0 (LM_GPIOE_BASE + LM_GPIO_PERIPHID0_OFFSET) +#define LM_GPIOE_PERIPHID1 (LM_GPIOE_BASE + LM_GPIO_PERIPHID1_OFFSET) +#define LM_GPIOE_PERIPHID2 (LM_GPIOE_BASE + LM_GPIO_PERIPHID2_OFFSET) +#define LM_GPIOE_PERIPHID3 (LM_GPIOE_BASE + LM_GPIO_PERIPHID3_OFFSET) +#define LM_GPIOE_PCELLID0 (LM_GPIOE_BASE + LM_GPIO_PCELLID0_OFFSET) +#define LM_GPIOE_PCELLID1 (LM_GPIOE_BASE + LM_GPIO_PCELLID1_OFFSET) +#define LM_GPIOE_PCELLID2 (LM_GPIOE_BASE + LM_GPIO_PCELLID2_OFFSET) +#define LM_GPIOE_PCELLID3 (LM_GPIOE_BASE + LM_GPIO_PCELLID3_OFFSET) -#define LM3S_GPIOF_DATA (LM3S_GPIOF_BASE + LM3S_GPIO_DATA_OFFSET) -#define LM3S_GPIOF_DIR (LM3S_GPIOF_BASE + LM3S_GPIO_DIR_OFFSET) -#define LM3S_GPIOF_IS (LM3S_GPIOF_BASE + LM3S_GPIO_IS_OFFSET) -#define LM3S_GPIOF_IBE (LM3S_GPIOF_BASE + LM3S_GPIO_IBE_OFFSET) -#define LM3S_GPIOF_IEV (LM3S_GPIOF_BASE + LM3S_GPIO_IEV_OFFSET) -#define LM3S_GPIOF_IM (LM3S_GPIOF_BASE + LM3S_GPIO_IM_OFFSET) -#define LM3S_GPIOF_RIS (LM3S_GPIOF_BASE + LM3S_GPIO_RIS_OFFSET) -#define LM3S_GPIOF_MIS (LM3S_GPIOF_BASE + LM3S_GPIO_MIS_OFFSET) -#define LM3S_GPIOF_ICR (LM3S_GPIOF_BASE + LM3S_GPIO_ICR_OFFSET) -#define LM3S_GPIOF_AFSEL (LM3S_GPIOF_BASE + LM3S_GPIO_AFSEL_OFFSET) -#define LM3S_GPIOF_DR2R (LM3S_GPIOF_BASE + LM3S_GPIO_DR2R_OFFSET) -#define LM3S_GPIOF_DR4R (LM3S_GPIOF_BASE + LM3S_GPIO_DR4R_OFFSET) -#define LM3S_GPIOF_DR8R (LM3S_GPIOF_BASE + LM3S_GPIO_DR8R_OFFSET) -#define LM3S_GPIOF_ODR (LM3S_GPIOF_BASE + LM3S_GPIO_ODR_OFFSET) -#define LM3S_GPIOF_PUR (LM3S_GPIOF_BASE + LM3S_GPIO_PUR_OFFSET) -#define LM3S_GPIOF_PDR (LM3S_GPIOF_BASE + LM3S_GPIO_PDR_OFFSET) -#define LM3S_GPIOF_SLR (LM3S_GPIOF_BASE + LM3S_GPIO_SLR_OFFSET) -#define LM3S_GPIOF_DEN (LM3S_GPIOF_BASE + LM3S_GPIO_DEN_OFFSET) -#define LM3S_GPIOF_LOCK (LM3S_GPIOF_BASE + LM3S_GPIO_LOCK_OFFSET) -#define LM3S_GPIOF_CR (LM3S_GPIOF_BASE + LM3S_GPIO_CR_OFFSET) -#define LM3S_GPIOF_PERIPHID4 (LM3S_GPIOF_BASE + LM3S_GPIO_PERIPHID4_OFFSET) -#define LM3S_GPIOF_PERIPHID5 (LM3S_GPIOF_BASE + LM3S_GPIO_PERIPHID5_OFFSET) -#define LM3S_GPIOF_PERIPHID6 (LM3S_GPIOF_BASE + LM3S_GPIO_PERIPHID6_OFFSET) -#define LM3S_GPIOF_PERIPHID7 (LM3S_GPIOF_BASE + LM3S_GPIO_PERIPHID7_OFFSET) -#define LM3S_GPIOF_PERIPHID0 (LM3S_GPIOF_BASE + LM3S_GPIO_PERIPHID0_OFFSET) -#define LM3S_GPIOF_PERIPHID1 (LM3S_GPIOF_BASE + LM3S_GPIO_PERIPHID1_OFFSET) -#define LM3S_GPIOF_PERIPHID2 (LM3S_GPIOF_BASE + LM3S_GPIO_PERIPHID2_OFFSET) -#define LM3S_GPIOF_PERIPHID3 (LM3S_GPIOF_BASE + LM3S_GPIO_PERIPHID3_OFFSET) -#define LM3S_GPIOF_PCELLID0 (LM3S_GPIOF_BASE + LM3S_GPIO_PCELLID0_OFFSET) -#define LM3S_GPIOF_PCELLID1 (LM3S_GPIOF_BASE + LM3S_GPIO_PCELLID1_OFFSET) -#define LM3S_GPIOF_PCELLID2 (LM3S_GPIOF_BASE + LM3S_GPIO_PCELLID2_OFFSET) -#define LM3S_GPIOF_PCELLID3 (LM3S_GPIOF_BASE + LM3S_GPIO_PCELLID3_OFFSET) +#define LM_GPIOF_DATA (LM_GPIOF_BASE + LM_GPIO_DATA_OFFSET) +#define LM_GPIOF_DIR (LM_GPIOF_BASE + LM_GPIO_DIR_OFFSET) +#define LM_GPIOF_IS (LM_GPIOF_BASE + LM_GPIO_IS_OFFSET) +#define LM_GPIOF_IBE (LM_GPIOF_BASE + LM_GPIO_IBE_OFFSET) +#define LM_GPIOF_IEV (LM_GPIOF_BASE + LM_GPIO_IEV_OFFSET) +#define LM_GPIOF_IM (LM_GPIOF_BASE + LM_GPIO_IM_OFFSET) +#define LM_GPIOF_RIS (LM_GPIOF_BASE + LM_GPIO_RIS_OFFSET) +#define LM_GPIOF_MIS (LM_GPIOF_BASE + LM_GPIO_MIS_OFFSET) +#define LM_GPIOF_ICR (LM_GPIOF_BASE + LM_GPIO_ICR_OFFSET) +#define LM_GPIOF_AFSEL (LM_GPIOF_BASE + LM_GPIO_AFSEL_OFFSET) +#define LM_GPIOF_DR2R (LM_GPIOF_BASE + LM_GPIO_DR2R_OFFSET) +#define LM_GPIOF_DR4R (LM_GPIOF_BASE + LM_GPIO_DR4R_OFFSET) +#define LM_GPIOF_DR8R (LM_GPIOF_BASE + LM_GPIO_DR8R_OFFSET) +#define LM_GPIOF_ODR (LM_GPIOF_BASE + LM_GPIO_ODR_OFFSET) +#define LM_GPIOF_PUR (LM_GPIOF_BASE + LM_GPIO_PUR_OFFSET) +#define LM_GPIOF_PDR (LM_GPIOF_BASE + LM_GPIO_PDR_OFFSET) +#define LM_GPIOF_SLR (LM_GPIOF_BASE + LM_GPIO_SLR_OFFSET) +#define LM_GPIOF_DEN (LM_GPIOF_BASE + LM_GPIO_DEN_OFFSET) +#define LM_GPIOF_LOCK (LM_GPIOF_BASE + LM_GPIO_LOCK_OFFSET) +#define LM_GPIOF_CR (LM_GPIOF_BASE + LM_GPIO_CR_OFFSET) +#define LM_GPIOF_PERIPHID4 (LM_GPIOF_BASE + LM_GPIO_PERIPHID4_OFFSET) +#define LM_GPIOF_PERIPHID5 (LM_GPIOF_BASE + LM_GPIO_PERIPHID5_OFFSET) +#define LM_GPIOF_PERIPHID6 (LM_GPIOF_BASE + LM_GPIO_PERIPHID6_OFFSET) +#define LM_GPIOF_PERIPHID7 (LM_GPIOF_BASE + LM_GPIO_PERIPHID7_OFFSET) +#define LM_GPIOF_PERIPHID0 (LM_GPIOF_BASE + LM_GPIO_PERIPHID0_OFFSET) +#define LM_GPIOF_PERIPHID1 (LM_GPIOF_BASE + LM_GPIO_PERIPHID1_OFFSET) +#define LM_GPIOF_PERIPHID2 (LM_GPIOF_BASE + LM_GPIO_PERIPHID2_OFFSET) +#define LM_GPIOF_PERIPHID3 (LM_GPIOF_BASE + LM_GPIO_PERIPHID3_OFFSET) +#define LM_GPIOF_PCELLID0 (LM_GPIOF_BASE + LM_GPIO_PCELLID0_OFFSET) +#define LM_GPIOF_PCELLID1 (LM_GPIOF_BASE + LM_GPIO_PCELLID1_OFFSET) +#define LM_GPIOF_PCELLID2 (LM_GPIOF_BASE + LM_GPIO_PCELLID2_OFFSET) +#define LM_GPIOF_PCELLID3 (LM_GPIOF_BASE + LM_GPIO_PCELLID3_OFFSET) -#define LM3S_GPIOG_DATA (LM3S_GPIOG_BASE + LM3S_GPIO_DATA_OFFSET) -#define LM3S_GPIOG_DIR (LM3S_GPIOG_BASE + LM3S_GPIO_DIR_OFFSET) -#define LM3S_GPIOG_IS (LM3S_GPIOG_BASE + LM3S_GPIO_IS_OFFSET) -#define LM3S_GPIOG_IBE (LM3S_GPIOG_BASE + LM3S_GPIO_IBE_OFFSET) -#define LM3S_GPIOG_IEV (LM3S_GPIOG_BASE + LM3S_GPIO_IEV_OFFSET) -#define LM3S_GPIOG_IM (LM3S_GPIOG_BASE + LM3S_GPIO_IM_OFFSET) -#define LM3S_GPIOG_RIS (LM3S_GPIOG_BASE + LM3S_GPIO_RIS_OFFSET) -#define LM3S_GPIOG_MIS (LM3S_GPIOG_BASE + LM3S_GPIO_MIS_OFFSET) -#define LM3S_GPIOG_ICR (LM3S_GPIOG_BASE + LM3S_GPIO_ICR_OFFSET) -#define LM3S_GPIOG_AFSEL (LM3S_GPIOG_BASE + LM3S_GPIO_AFSEL_OFFSET) -#define LM3S_GPIOG_DR2R (LM3S_GPIOG_BASE + LM3S_GPIO_DR2R_OFFSET) -#define LM3S_GPIOG_DR4R (LM3S_GPIOG_BASE + LM3S_GPIO_DR4R_OFFSET) -#define LM3S_GPIOG_DR8R (LM3S_GPIOG_BASE + LM3S_GPIO_DR8R_OFFSET) -#define LM3S_GPIOG_ODR (LM3S_GPIOG_BASE + LM3S_GPIO_ODR_OFFSET) -#define LM3S_GPIOG_PUR (LM3S_GPIOG_BASE + LM3S_GPIO_PUR_OFFSET) -#define LM3S_GPIOG_PDR (LM3S_GPIOG_BASE + LM3S_GPIO_PDR_OFFSET) -#define LM3S_GPIOG_SLR (LM3S_GPIOG_BASE + LM3S_GPIO_SLR_OFFSET) -#define LM3S_GPIOG_DEN (LM3S_GPIOG_BASE + LM3S_GPIO_DEN_OFFSET) -#define LM3S_GPIOG_LOCK (LM3S_GPIOG_BASE + LM3S_GPIO_LOCK_OFFSET) -#define LM3S_GPIOG_CR (LM3S_GPIOG_BASE + LM3S_GPIO_CR_OFFSET) -#define LM3S_GPIOG_PERIPHID4 (LM3S_GPIOG_BASE + LM3S_GPIO_PERIPHID4_OFFSET) -#define LM3S_GPIOG_PERIPHID5 (LM3S_GPIOG_BASE + LM3S_GPIO_PERIPHID5_OFFSET) -#define LM3S_GPIOG_PERIPHID6 (LM3S_GPIOG_BASE + LM3S_GPIO_PERIPHID6_OFFSET) -#define LM3S_GPIOG_PERIPHID7 (LM3S_GPIOG_BASE + LM3S_GPIO_PERIPHID7_OFFSET) -#define LM3S_GPIOG_PERIPHID0 (LM3S_GPIOG_BASE + LM3S_GPIO_PERIPHID0_OFFSET) -#define LM3S_GPIOG_PERIPHID1 (LM3S_GPIOG_BASE + LM3S_GPIO_PERIPHID1_OFFSET) -#define LM3S_GPIOG_PERIPHID2 (LM3S_GPIOG_BASE + LM3S_GPIO_PERIPHID2_OFFSET) -#define LM3S_GPIOG_PERIPHID3 (LM3S_GPIOG_BASE + LM3S_GPIO_PERIPHID3_OFFSET) -#define LM3S_GPIOG_PCELLID0 (LM3S_GPIOG_BASE + LM3S_GPIO_PCELLID0_OFFSET) -#define LM3S_GPIOG_PCELLID1 (LM3S_GPIOG_BASE + LM3S_GPIO_PCELLID1_OFFSET) -#define LM3S_GPIOG_PCELLID2 (LM3S_GPIOG_BASE + LM3S_GPIO_PCELLID2_OFFSET) -#define LM3S_GPIOG_PCELLID3 (LM3S_GPIOG_BASE + LM3S_GPIO_PCELLID3_OFFSET) +#define LM_GPIOG_DATA (LM_GPIOG_BASE + LM_GPIO_DATA_OFFSET) +#define LM_GPIOG_DIR (LM_GPIOG_BASE + LM_GPIO_DIR_OFFSET) +#define LM_GPIOG_IS (LM_GPIOG_BASE + LM_GPIO_IS_OFFSET) +#define LM_GPIOG_IBE (LM_GPIOG_BASE + LM_GPIO_IBE_OFFSET) +#define LM_GPIOG_IEV (LM_GPIOG_BASE + LM_GPIO_IEV_OFFSET) +#define LM_GPIOG_IM (LM_GPIOG_BASE + LM_GPIO_IM_OFFSET) +#define LM_GPIOG_RIS (LM_GPIOG_BASE + LM_GPIO_RIS_OFFSET) +#define LM_GPIOG_MIS (LM_GPIOG_BASE + LM_GPIO_MIS_OFFSET) +#define LM_GPIOG_ICR (LM_GPIOG_BASE + LM_GPIO_ICR_OFFSET) +#define LM_GPIOG_AFSEL (LM_GPIOG_BASE + LM_GPIO_AFSEL_OFFSET) +#define LM_GPIOG_DR2R (LM_GPIOG_BASE + LM_GPIO_DR2R_OFFSET) +#define LM_GPIOG_DR4R (LM_GPIOG_BASE + LM_GPIO_DR4R_OFFSET) +#define LM_GPIOG_DR8R (LM_GPIOG_BASE + LM_GPIO_DR8R_OFFSET) +#define LM_GPIOG_ODR (LM_GPIOG_BASE + LM_GPIO_ODR_OFFSET) +#define LM_GPIOG_PUR (LM_GPIOG_BASE + LM_GPIO_PUR_OFFSET) +#define LM_GPIOG_PDR (LM_GPIOG_BASE + LM_GPIO_PDR_OFFSET) +#define LM_GPIOG_SLR (LM_GPIOG_BASE + LM_GPIO_SLR_OFFSET) +#define LM_GPIOG_DEN (LM_GPIOG_BASE + LM_GPIO_DEN_OFFSET) +#define LM_GPIOG_LOCK (LM_GPIOG_BASE + LM_GPIO_LOCK_OFFSET) +#define LM_GPIOG_CR (LM_GPIOG_BASE + LM_GPIO_CR_OFFSET) +#define LM_GPIOG_PERIPHID4 (LM_GPIOG_BASE + LM_GPIO_PERIPHID4_OFFSET) +#define LM_GPIOG_PERIPHID5 (LM_GPIOG_BASE + LM_GPIO_PERIPHID5_OFFSET) +#define LM_GPIOG_PERIPHID6 (LM_GPIOG_BASE + LM_GPIO_PERIPHID6_OFFSET) +#define LM_GPIOG_PERIPHID7 (LM_GPIOG_BASE + LM_GPIO_PERIPHID7_OFFSET) +#define LM_GPIOG_PERIPHID0 (LM_GPIOG_BASE + LM_GPIO_PERIPHID0_OFFSET) +#define LM_GPIOG_PERIPHID1 (LM_GPIOG_BASE + LM_GPIO_PERIPHID1_OFFSET) +#define LM_GPIOG_PERIPHID2 (LM_GPIOG_BASE + LM_GPIO_PERIPHID2_OFFSET) +#define LM_GPIOG_PERIPHID3 (LM_GPIOG_BASE + LM_GPIO_PERIPHID3_OFFSET) +#define LM_GPIOG_PCELLID0 (LM_GPIOG_BASE + LM_GPIO_PCELLID0_OFFSET) +#define LM_GPIOG_PCELLID1 (LM_GPIOG_BASE + LM_GPIO_PCELLID1_OFFSET) +#define LM_GPIOG_PCELLID2 (LM_GPIOG_BASE + LM_GPIO_PCELLID2_OFFSET) +#define LM_GPIOG_PCELLID3 (LM_GPIOG_BASE + LM_GPIO_PCELLID3_OFFSET) -#define LM3S_GPIOH_DATA (LM3S_GPIOH_BASE + LM3S_GPIO_DATA_OFFSET) -#define LM3S_GPIOH_DIR (LM3S_GPIOH_BASE + LM3S_GPIO_DIR_OFFSET) -#define LM3S_GPIOH_IS (LM3S_GPIOH_BASE + LM3S_GPIO_IS_OFFSET) -#define LM3S_GPIOH_IBE (LM3S_GPIOH_BASE + LM3S_GPIO_IBE_OFFSET) -#define LM3S_GPIOH_IEV (LM3S_GPIOH_BASE + LM3S_GPIO_IEV_OFFSET) -#define LM3S_GPIOH_IM (LM3S_GPIOH_BASE + LM3S_GPIO_IM_OFFSET) -#define LM3S_GPIOH_RIS (LM3S_GPIOH_BASE + LM3S_GPIO_RIS_OFFSET) -#define LM3S_GPIOH_MIS (LM3S_GPIOH_BASE + LM3S_GPIO_MIS_OFFSET) -#define LM3S_GPIOH_ICR (LM3S_GPIOH_BASE + LM3S_GPIO_ICR_OFFSET) -#define LM3S_GPIOH_AFSEL (LM3S_GPIOH_BASE + LM3S_GPIO_AFSEL_OFFSET) -#define LM3S_GPIOH_DR2R (LM3S_GPIOH_BASE + LM3S_GPIO_DR2R_OFFSET) -#define LM3S_GPIOH_DR4R (LM3S_GPIOH_BASE + LM3S_GPIO_DR4R_OFFSET) -#define LM3S_GPIOH_DR8R (LM3S_GPIOH_BASE + LM3S_GPIO_DR8R_OFFSET) -#define LM3S_GPIOH_ODR (LM3S_GPIOH_BASE + LM3S_GPIO_ODR_OFFSET) -#define LM3S_GPIOH_PUR (LM3S_GPIOH_BASE + LM3S_GPIO_PUR_OFFSET) -#define LM3S_GPIOH_PDR (LM3S_GPIOH_BASE + LM3S_GPIO_PDR_OFFSET) -#define LM3S_GPIOH_SLR (LM3S_GPIOH_BASE + LM3S_GPIO_SLR_OFFSET) -#define LM3S_GPIOH_DEN (LM3S_GPIOH_BASE + LM3S_GPIO_DEN_OFFSET) -#define LM3S_GPIOH_LOCK (LM3S_GPIOH_BASE + LM3S_GPIO_LOCK_OFFSET) -#define LM3S_GPIOH_CR (LM3S_GPIOH_BASE + LM3S_GPIO_CR_OFFSET) -#define LM3S_GPIOH_PERIPHID4 (LM3S_GPIOH_BASE + LM3S_GPIO_PERIPHID4_OFFSET) -#define LM3S_GPIOH_PERIPHID5 (LM3S_GPIOH_BASE + LM3S_GPIO_PERIPHID5_OFFSET) -#define LM3S_GPIOH_PERIPHID6 (LM3S_GPIOH_BASE + LM3S_GPIO_PERIPHID6_OFFSET) -#define LM3S_GPIOH_PERIPHID7 (LM3S_GPIOH_BASE + LM3S_GPIO_PERIPHID7_OFFSET) -#define LM3S_GPIOH_PERIPHID0 (LM3S_GPIOH_BASE + LM3S_GPIO_PERIPHID0_OFFSET) -#define LM3S_GPIOH_PERIPHID1 (LM3S_GPIOH_BASE + LM3S_GPIO_PERIPHID1_OFFSET) -#define LM3S_GPIOH_PERIPHID2 (LM3S_GPIOH_BASE + LM3S_GPIO_PERIPHID2_OFFSET) -#define LM3S_GPIOH_PERIPHID3 (LM3S_GPIOH_BASE + LM3S_GPIO_PERIPHID3_OFFSET) -#define LM3S_GPIOH_PCELLID0 (LM3S_GPIOH_BASE + LM3S_GPIO_PCELLID0_OFFSET) -#define LM3S_GPIOH_PCELLID1 (LM3S_GPIOH_BASE + LM3S_GPIO_PCELLID1_OFFSET) -#define LM3S_GPIOH_PCELLID2 (LM3S_GPIOH_BASE + LM3S_GPIO_PCELLID2_OFFSET) -#define LM3S_GPIOH_PCELLID3 (LM3S_GPIOH_BASE + LM3S_GPIO_PCELLID3_OFFSET) +#define LM_GPIOH_DATA (LM_GPIOH_BASE + LM_GPIO_DATA_OFFSET) +#define LM_GPIOH_DIR (LM_GPIOH_BASE + LM_GPIO_DIR_OFFSET) +#define LM_GPIOH_IS (LM_GPIOH_BASE + LM_GPIO_IS_OFFSET) +#define LM_GPIOH_IBE (LM_GPIOH_BASE + LM_GPIO_IBE_OFFSET) +#define LM_GPIOH_IEV (LM_GPIOH_BASE + LM_GPIO_IEV_OFFSET) +#define LM_GPIOH_IM (LM_GPIOH_BASE + LM_GPIO_IM_OFFSET) +#define LM_GPIOH_RIS (LM_GPIOH_BASE + LM_GPIO_RIS_OFFSET) +#define LM_GPIOH_MIS (LM_GPIOH_BASE + LM_GPIO_MIS_OFFSET) +#define LM_GPIOH_ICR (LM_GPIOH_BASE + LM_GPIO_ICR_OFFSET) +#define LM_GPIOH_AFSEL (LM_GPIOH_BASE + LM_GPIO_AFSEL_OFFSET) +#define LM_GPIOH_DR2R (LM_GPIOH_BASE + LM_GPIO_DR2R_OFFSET) +#define LM_GPIOH_DR4R (LM_GPIOH_BASE + LM_GPIO_DR4R_OFFSET) +#define LM_GPIOH_DR8R (LM_GPIOH_BASE + LM_GPIO_DR8R_OFFSET) +#define LM_GPIOH_ODR (LM_GPIOH_BASE + LM_GPIO_ODR_OFFSET) +#define LM_GPIOH_PUR (LM_GPIOH_BASE + LM_GPIO_PUR_OFFSET) +#define LM_GPIOH_PDR (LM_GPIOH_BASE + LM_GPIO_PDR_OFFSET) +#define LM_GPIOH_SLR (LM_GPIOH_BASE + LM_GPIO_SLR_OFFSET) +#define LM_GPIOH_DEN (LM_GPIOH_BASE + LM_GPIO_DEN_OFFSET) +#define LM_GPIOH_LOCK (LM_GPIOH_BASE + LM_GPIO_LOCK_OFFSET) +#define LM_GPIOH_CR (LM_GPIOH_BASE + LM_GPIO_CR_OFFSET) +#define LM_GPIOH_PERIPHID4 (LM_GPIOH_BASE + LM_GPIO_PERIPHID4_OFFSET) +#define LM_GPIOH_PERIPHID5 (LM_GPIOH_BASE + LM_GPIO_PERIPHID5_OFFSET) +#define LM_GPIOH_PERIPHID6 (LM_GPIOH_BASE + LM_GPIO_PERIPHID6_OFFSET) +#define LM_GPIOH_PERIPHID7 (LM_GPIOH_BASE + LM_GPIO_PERIPHID7_OFFSET) +#define LM_GPIOH_PERIPHID0 (LM_GPIOH_BASE + LM_GPIO_PERIPHID0_OFFSET) +#define LM_GPIOH_PERIPHID1 (LM_GPIOH_BASE + LM_GPIO_PERIPHID1_OFFSET) +#define LM_GPIOH_PERIPHID2 (LM_GPIOH_BASE + LM_GPIO_PERIPHID2_OFFSET) +#define LM_GPIOH_PERIPHID3 (LM_GPIOH_BASE + LM_GPIO_PERIPHID3_OFFSET) +#define LM_GPIOH_PCELLID0 (LM_GPIOH_BASE + LM_GPIO_PCELLID0_OFFSET) +#define LM_GPIOH_PCELLID1 (LM_GPIOH_BASE + LM_GPIO_PCELLID1_OFFSET) +#define LM_GPIOH_PCELLID2 (LM_GPIOH_BASE + LM_GPIO_PCELLID2_OFFSET) +#define LM_GPIOH_PCELLID3 (LM_GPIOH_BASE + LM_GPIO_PCELLID3_OFFSET) -#define LM3S_GPIOJ_DATA (LM3S_GPIOJ_BASE + LM3S_GPIO_DATA_OFFSET) -#define LM3S_GPIOJ_DIR (LM3S_GPIOJ_BASE + LM3S_GPIO_DIR_OFFSET) -#define LM3S_GPIOJ_IS (LM3S_GPIOJ_BASE + LM3S_GPIO_IS_OFFSET) -#define LM3S_GPIOJ_IBE (LM3S_GPIOJ_BASE + LM3S_GPIO_IBE_OFFSET) -#define LM3S_GPIOJ_IEV (LM3S_GPIOJ_BASE + LM3S_GPIO_IEV_OFFSET) -#define LM3S_GPIOJ_IM (LM3S_GPIOJ_BASE + LM3S_GPIO_IM_OFFSET) -#define LM3S_GPIOJ_RIS (LM3S_GPIOJ_BASE + LM3S_GPIO_RIS_OFFSET) -#define LM3S_GPIOJ_MIS (LM3S_GPIOJ_BASE + LM3S_GPIO_MIS_OFFSET) -#define LM3S_GPIOJ_ICR (LM3S_GPIOJ_BASE + LM3S_GPIO_ICR_OFFSET) -#define LM3S_GPIOJ_AFSEL (LM3S_GPIOJ_BASE + LM3S_GPIO_AFSEL_OFFSET) -#define LM3S_GPIOJ_DR2R (LM3S_GPIOJ_BASE + LM3S_GPIO_DR2R_OFFSET) -#define LM3S_GPIOJ_DR4R (LM3S_GPIOJ_BASE + LM3S_GPIO_DR4R_OFFSET) -#define LM3S_GPIOJ_DR8R (LM3S_GPIOJ_BASE + LM3S_GPIO_DR8R_OFFSET) -#define LM3S_GPIOJ_ODR (LM3S_GPIOJ_BASE + LM3S_GPIO_ODR_OFFSET) -#define LM3S_GPIOJ_PUR (LM3S_GPIOJ_BASE + LM3S_GPIO_PUR_OFFSET) -#define LM3S_GPIOJ_PDR (LM3S_GPIOJ_BASE + LM3S_GPIO_PDR_OFFSET) -#define LM3S_GPIOJ_SLR (LM3S_GPIOJ_BASE + LM3S_GPIO_SLR_OFFSET) -#define LM3S_GPIOJ_DEN (LM3S_GPIOJ_BASE + LM3S_GPIO_DEN_OFFSET) -#define LM3S_GPIOJ_LOCK (LM3S_GPIOJ_BASE + LM3S_GPIO_LOCK_OFFSET) -#define LM3S_GPIOJ_CR (LM3S_GPIOJ_BASE + LM3S_GPIO_CR_OFFSET) -#define LM3S_GPIOJ_PERIPHID4 (LM3S_GPIOJ_BASE + LM3S_GPIO_PERIPHID4_OFFSET) -#define LM3S_GPIOJ_PERIPHID5 (LM3S_GPIOJ_BASE + LM3S_GPIO_PERIPHID5_OFFSET) -#define LM3S_GPIOJ_PERIPHID6 (LM3S_GPIOJ_BASE + LM3S_GPIO_PERIPHID6_OFFSET) -#define LM3S_GPIOJ_PERIPHID7 (LM3S_GPIOJ_BASE + LM3S_GPIO_PERIPHID7_OFFSET) -#define LM3S_GPIOJ_PERIPHID0 (LM3S_GPIOJ_BASE + LM3S_GPIO_PERIPHID0_OFFSET) -#define LM3S_GPIOJ_PERIPHID1 (LM3S_GPIOJ_BASE + LM3S_GPIO_PERIPHID1_OFFSET) -#define LM3S_GPIOJ_PERIPHID2 (LM3S_GPIOJ_BASE + LM3S_GPIO_PERIPHID2_OFFSET) -#define LM3S_GPIOJ_PERIPHID3 (LM3S_GPIOJ_BASE + LM3S_GPIO_PERIPHID3_OFFSET) -#define LM3S_GPIOJ_PCELLID0 (LM3S_GPIOJ_BASE + LM3S_GPIO_PCELLID0_OFFSET) -#define LM3S_GPIOJ_PCELLID1 (LM3S_GPIOJ_BASE + LM3S_GPIO_PCELLID1_OFFSET) -#define LM3S_GPIOJ_PCELLID2 (LM3S_GPIOJ_BASE + LM3S_GPIO_PCELLID2_OFFSET) -#define LM3S_GPIOJ_PCELLID3 (LM3S_GPIOJ_BASE + LM3S_GPIO_PCELLID3_OFFSET) +#define LM_GPIOJ_DATA (LM_GPIOJ_BASE + LM_GPIO_DATA_OFFSET) +#define LM_GPIOJ_DIR (LM_GPIOJ_BASE + LM_GPIO_DIR_OFFSET) +#define LM_GPIOJ_IS (LM_GPIOJ_BASE + LM_GPIO_IS_OFFSET) +#define LM_GPIOJ_IBE (LM_GPIOJ_BASE + LM_GPIO_IBE_OFFSET) +#define LM_GPIOJ_IEV (LM_GPIOJ_BASE + LM_GPIO_IEV_OFFSET) +#define LM_GPIOJ_IM (LM_GPIOJ_BASE + LM_GPIO_IM_OFFSET) +#define LM_GPIOJ_RIS (LM_GPIOJ_BASE + LM_GPIO_RIS_OFFSET) +#define LM_GPIOJ_MIS (LM_GPIOJ_BASE + LM_GPIO_MIS_OFFSET) +#define LM_GPIOJ_ICR (LM_GPIOJ_BASE + LM_GPIO_ICR_OFFSET) +#define LM_GPIOJ_AFSEL (LM_GPIOJ_BASE + LM_GPIO_AFSEL_OFFSET) +#define LM_GPIOJ_DR2R (LM_GPIOJ_BASE + LM_GPIO_DR2R_OFFSET) +#define LM_GPIOJ_DR4R (LM_GPIOJ_BASE + LM_GPIO_DR4R_OFFSET) +#define LM_GPIOJ_DR8R (LM_GPIOJ_BASE + LM_GPIO_DR8R_OFFSET) +#define LM_GPIOJ_ODR (LM_GPIOJ_BASE + LM_GPIO_ODR_OFFSET) +#define LM_GPIOJ_PUR (LM_GPIOJ_BASE + LM_GPIO_PUR_OFFSET) +#define LM_GPIOJ_PDR (LM_GPIOJ_BASE + LM_GPIO_PDR_OFFSET) +#define LM_GPIOJ_SLR (LM_GPIOJ_BASE + LM_GPIO_SLR_OFFSET) +#define LM_GPIOJ_DEN (LM_GPIOJ_BASE + LM_GPIO_DEN_OFFSET) +#define LM_GPIOJ_LOCK (LM_GPIOJ_BASE + LM_GPIO_LOCK_OFFSET) +#define LM_GPIOJ_CR (LM_GPIOJ_BASE + LM_GPIO_CR_OFFSET) +#define LM_GPIOJ_PERIPHID4 (LM_GPIOJ_BASE + LM_GPIO_PERIPHID4_OFFSET) +#define LM_GPIOJ_PERIPHID5 (LM_GPIOJ_BASE + LM_GPIO_PERIPHID5_OFFSET) +#define LM_GPIOJ_PERIPHID6 (LM_GPIOJ_BASE + LM_GPIO_PERIPHID6_OFFSET) +#define LM_GPIOJ_PERIPHID7 (LM_GPIOJ_BASE + LM_GPIO_PERIPHID7_OFFSET) +#define LM_GPIOJ_PERIPHID0 (LM_GPIOJ_BASE + LM_GPIO_PERIPHID0_OFFSET) +#define LM_GPIOJ_PERIPHID1 (LM_GPIOJ_BASE + LM_GPIO_PERIPHID1_OFFSET) +#define LM_GPIOJ_PERIPHID2 (LM_GPIOJ_BASE + LM_GPIO_PERIPHID2_OFFSET) +#define LM_GPIOJ_PERIPHID3 (LM_GPIOJ_BASE + LM_GPIO_PERIPHID3_OFFSET) +#define LM_GPIOJ_PCELLID0 (LM_GPIOJ_BASE + LM_GPIO_PCELLID0_OFFSET) +#define LM_GPIOJ_PCELLID1 (LM_GPIOJ_BASE + LM_GPIO_PCELLID1_OFFSET) +#define LM_GPIOJ_PCELLID2 (LM_GPIOJ_BASE + LM_GPIO_PCELLID2_OFFSET) +#define LM_GPIOJ_PCELLID3 (LM_GPIOJ_BASE + LM_GPIO_PCELLID3_OFFSET) /************************************************************************************ * Public Types @@ -392,4 +392,4 @@ * Public Function Prototypes ************************************************************************************/ -#endif /* __ARCH_ARM_SRC_LM_CHIP_LM3S_GPIO_H */ +#endif /* __ARCH_ARM_SRC_LM_CHIP_LM_GPIO_H */ diff --git a/nuttx/arch/arm/src/lm/chip/lm_i2c.h b/nuttx/arch/arm/src/lm/chip/lm_i2c.h index 919ac1348d..88ce31b778 100644 --- a/nuttx/arch/arm/src/lm/chip/lm_i2c.h +++ b/nuttx/arch/arm/src/lm/chip/lm_i2c.h @@ -33,8 +33,8 @@ * ************************************************************************************/ -#ifndef __ARCH_ARM_SRC_LM_CHIP_LM3S_I2C_H -#define __ARCH_ARM_SRC_LM_CHIP_LM3S_I2C_H +#ifndef __ARCH_ARM_SRC_LM_CHIP_LM_I2C_H +#define __ARCH_ARM_SRC_LM_CHIP_LM_I2C_H /************************************************************************************ * Included Files @@ -50,99 +50,99 @@ /* I2C Master */ -#define LM3S_I2CM_SA_OFFSET 0x000 /* I2C Master Slave Address */ -#define LM3S_I2CM_CS_OFFSET 0x004 /* I2C Master Control/Status */ -#define LM3S_I2CM_DR_OFFSET 0x008 /* I2C Master Data */ -#define LM3S_I2CM_TPR_OFFSET 0x00c /* I2C Master Timer Period */ -#define LM3S_I2CM_IMR_OFFSET 0x010 /* I2C Master Interrupt Mask */ -#define LM3S_I2CM_RIS_OFFSET 0x014 /* I2C Master Raw Interrupt Status */ -#define LM3S_I2CM_MIS_OFFSET 0x018 /* I2C Master Masked Interrupt Status */ -#define LM3S_I2CM_ICR_OFFSET 0x01c /* I2C Master Interrupt Clear */ -#define LM3S_I2CM_CR_OFFSET 0x020 /* I2C Master Configuration */ +#define LM_I2CM_SA_OFFSET 0x000 /* I2C Master Slave Address */ +#define LM_I2CM_CS_OFFSET 0x004 /* I2C Master Control/Status */ +#define LM_I2CM_DR_OFFSET 0x008 /* I2C Master Data */ +#define LM_I2CM_TPR_OFFSET 0x00c /* I2C Master Timer Period */ +#define LM_I2CM_IMR_OFFSET 0x010 /* I2C Master Interrupt Mask */ +#define LM_I2CM_RIS_OFFSET 0x014 /* I2C Master Raw Interrupt Status */ +#define LM_I2CM_MIS_OFFSET 0x018 /* I2C Master Masked Interrupt Status */ +#define LM_I2CM_ICR_OFFSET 0x01c /* I2C Master Interrupt Clear */ +#define LM_I2CM_CR_OFFSET 0x020 /* I2C Master Configuration */ /* I2C Slave */ -#define LM3S_I2CS_OAR_OFFSET 0x000 /* I2C Slave Own Address */ -#define LM3S_I2CS_CSR_OFFSET 0x004 /* I2C Slave Control/Status */ -#define LM3S_I2CS_DR_OFFSET 0x008 /* I2C Slave Data */ -#define LM3S_I2CS_IMR_OFFSET 0x00c /* I2C Slave Interrupt Mask */ -#define LM3S_I2CS_RIS_OFFSET 0x010 /* I2C Slave Raw Interrupt Status */ -#define LM3S_I2CS_MIS_OFFSET 0x014 /* I2C Slave Masked Interrupt Status */ -#define LM3S_I2CS_ICR_OFFSET 0x018 /* I2C Slave Interrupt Clear */ +#define LM_I2CS_OAR_OFFSET 0x000 /* I2C Slave Own Address */ +#define LM_I2CS_CSR_OFFSET 0x004 /* I2C Slave Control/Status */ +#define LM_I2CS_DR_OFFSET 0x008 /* I2C Slave Data */ +#define LM_I2CS_IMR_OFFSET 0x00c /* I2C Slave Interrupt Mask */ +#define LM_I2CS_RIS_OFFSET 0x010 /* I2C Slave Raw Interrupt Status */ +#define LM_I2CS_MIS_OFFSET 0x014 /* I2C Slave Masked Interrupt Status */ +#define LM_I2CS_ICR_OFFSET 0x018 /* I2C Slave Interrupt Clear */ /* I2C Register Addresses ***********************************************************/ -#if LM3S_NI2C > 0 +#if LM_NI2C > 0 /* I2C Master */ -#define LM3S_I2CM_BASE(n) (LM3S_I2CM0_BASE + (n)*0x1000) -#define LM3S_I2CM_SA(n) (LM3S_I2CM_BASE(n) + LM3S_I2CM_SA_OFFSET) -#define LM3S_I2CM_CS(n) (LM3S_I2CM_BASE(n) + LM3S_I2CM_CS_OFFSET) -#define LM3S_I2CM_DR(n) (LM3S_I2CM_BASE(n) + LM3S_I2CM_DR_OFFSET) -#define LM3S_I2CM_TPR(n) (LM3S_I2CM_BASE(n) + LM3S_I2CM_TPR_OFFSET) -#define LM3S_I2CM_IMR(n) (LM3S_I2CM_BASE(n) + LM3S_I2CM_IMR_OFFSET) -#define LM3S_I2CM_RIS(n) (LM3S_I2CM_BASE(n) + LM3S_I2CM_RIS_OFFSET) -#define LM3S_I2CM_MIS(n) (LM3S_I2CM_BASE(n) + LM3S_I2CM_MIS_OFFSET) -#define LM3S_I2CM_ICR(n) (LM3S_I2CM_BASE(n) + LM3S_I2CM_ICR_OFFSET) -#define LM3S_I2CM_CR(n) (LM3S_I2CM_BASE(n) + LM3S_I2CM_CR_OFFSET) +#define LM_I2CM_BASE(n) (LM_I2CM0_BASE + (n)*0x1000) +#define LM_I2CM_SA(n) (LM_I2CM_BASE(n) + LM_I2CM_SA_OFFSET) +#define LM_I2CM_CS(n) (LM_I2CM_BASE(n) + LM_I2CM_CS_OFFSET) +#define LM_I2CM_DR(n) (LM_I2CM_BASE(n) + LM_I2CM_DR_OFFSET) +#define LM_I2CM_TPR(n) (LM_I2CM_BASE(n) + LM_I2CM_TPR_OFFSET) +#define LM_I2CM_IMR(n) (LM_I2CM_BASE(n) + LM_I2CM_IMR_OFFSET) +#define LM_I2CM_RIS(n) (LM_I2CM_BASE(n) + LM_I2CM_RIS_OFFSET) +#define LM_I2CM_MIS(n) (LM_I2CM_BASE(n) + LM_I2CM_MIS_OFFSET) +#define LM_I2CM_ICR(n) (LM_I2CM_BASE(n) + LM_I2CM_ICR_OFFSET) +#define LM_I2CM_CR(n) (LM_I2CM_BASE(n) + LM_I2CM_CR_OFFSET) /* I2C Slave */ -#define LM3S_I2CS_BASE(n) (LM3S_I2CS0_BASE + (n)*0x1000) -#define LM3S_I2CS_OAR(n) (LM3S_I2CS_BASE(n) + LM3S_I2CS_OAR_OFFSET) -#define LM3S_I2CS_CSR(n) (LM3S_I2CS_BASE(n) + LM3S_I2CS_CSR_OFFSET) -#define LM3S_I2CS_DR(n) (LM3S_I2CS_BASE(n) + LM3S_I2CS_DR_OFFSET) -#define LM3S_I2CS_IMR(n) (LM3S_I2CS_BASE(n) + LM3S_I2CS_IMR_OFFSET) -#define LM3S_I2CS_RIS(n) (LM3S_I2CS_BASE(n) + LM3S_I2CS_RIS_OFFSET) -#define LM3S_I2CS_MIS(n) (LM3S_I2CS_BASE(n) + LM3S_I2CS_MIS_OFFSET) -#define LM3S_I2CS_ICR(n) (LM3S_I2CS_BASE(n) + LM3S_I2CS_ICR_OFFSET) +#define LM_I2CS_BASE(n) (LM_I2CS0_BASE + (n)*0x1000) +#define LM_I2CS_OAR(n) (LM_I2CS_BASE(n) + LM_I2CS_OAR_OFFSET) +#define LM_I2CS_CSR(n) (LM_I2CS_BASE(n) + LM_I2CS_CSR_OFFSET) +#define LM_I2CS_DR(n) (LM_I2CS_BASE(n) + LM_I2CS_DR_OFFSET) +#define LM_I2CS_IMR(n) (LM_I2CS_BASE(n) + LM_I2CS_IMR_OFFSET) +#define LM_I2CS_RIS(n) (LM_I2CS_BASE(n) + LM_I2CS_RIS_OFFSET) +#define LM_I2CS_MIS(n) (LM_I2CS_BASE(n) + LM_I2CS_MIS_OFFSET) +#define LM_I2CS_ICR(n) (LM_I2CS_BASE(n) + LM_I2CS_ICR_OFFSET) /* I2C0 Master */ -#define LM3S_I2CM0_SA (LM3S_I2CM0_BASE + LM3S_I2CM_SA_OFFSET) -#define LM3S_I2CM0_CS (LM3S_I2CM0_BASE + LM3S_I2CM_CS_OFFSET) -#define LM3S_I2CM0_DR (LM3S_I2CM0_BASE + LM3S_I2CM_DR_OFFSET) -#define LM3S_I2CM0_TPR (LM3S_I2CM0_BASE + LM3S_I2CM_TPR_OFFSET) -#define LM3S_I2CM0_IMR (LM3S_I2CM0_BASE + LM3S_I2CM_IMR_OFFSET) -#define LM3S_I2CM0_RIS (LM3S_I2CM0_BASE + LM3S_I2CM_RIS_OFFSET) -#define LM3S_I2CM0_MIS (LM3S_I2CM0_BASE + LM3S_I2CM_MIS_OFFSET) -#define LM3S_I2CM0_ICR (LM3S_I2CM0_BASE + LM3S_I2CM_ICR_OFFSET) -#define LM3S_I2CM0_CR (LM3S_I2CM0_BASE + LM3S_I2CM_CR_OFFSET) +#define LM_I2CM0_SA (LM_I2CM0_BASE + LM_I2CM_SA_OFFSET) +#define LM_I2CM0_CS (LM_I2CM0_BASE + LM_I2CM_CS_OFFSET) +#define LM_I2CM0_DR (LM_I2CM0_BASE + LM_I2CM_DR_OFFSET) +#define LM_I2CM0_TPR (LM_I2CM0_BASE + LM_I2CM_TPR_OFFSET) +#define LM_I2CM0_IMR (LM_I2CM0_BASE + LM_I2CM_IMR_OFFSET) +#define LM_I2CM0_RIS (LM_I2CM0_BASE + LM_I2CM_RIS_OFFSET) +#define LM_I2CM0_MIS (LM_I2CM0_BASE + LM_I2CM_MIS_OFFSET) +#define LM_I2CM0_ICR (LM_I2CM0_BASE + LM_I2CM_ICR_OFFSET) +#define LM_I2CM0_CR (LM_I2CM0_BASE + LM_I2CM_CR_OFFSET) /* I2C0 Slave */ -#define LM3S_I2CS0_OAR (LM3S_I2CS0_BASE + LM3S_I2CS_OAR_OFFSET) -#define LM3S_I2CS0_CSR (LM3S_I2CS0_BASE + LM3S_I2CS_CSR_OFFSET) -#define LM3S_I2CS0_DR (LM3S_I2CS0_BASE + LM3S_I2CS_DR_OFFSET) -#define LM3S_I2CS0_IMR (LM3S_I2CS0_BASE + LM3S_I2CS_IMR_OFFSET) -#define LM3S_I2CS0_RIS (LM3S_I2CS0_BASE + LM3S_I2CS_RIS_OFFSET) -#define LM3S_I2CS0_MIS (LM3S_I2CS0_BASE + LM3S_I2CS_MIS_OFFSET) -#define LM3S_I2CS0_ICR (LM3S_I2CS0_BASE + LM3S_I2CS_ICR_OFFSET) +#define LM_I2CS0_OAR (LM_I2CS0_BASE + LM_I2CS_OAR_OFFSET) +#define LM_I2CS0_CSR (LM_I2CS0_BASE + LM_I2CS_CSR_OFFSET) +#define LM_I2CS0_DR (LM_I2CS0_BASE + LM_I2CS_DR_OFFSET) +#define LM_I2CS0_IMR (LM_I2CS0_BASE + LM_I2CS_IMR_OFFSET) +#define LM_I2CS0_RIS (LM_I2CS0_BASE + LM_I2CS_RIS_OFFSET) +#define LM_I2CS0_MIS (LM_I2CS0_BASE + LM_I2CS_MIS_OFFSET) +#define LM_I2CS0_ICR (LM_I2CS0_BASE + LM_I2CS_ICR_OFFSET) -#if LM3S_NI2C > 1 +#if LM_NI2C > 1 /* I2C1 Master */ -#define LM3S_I2CM1_SA (LM3S_I2CM1_BASE + LM3S_I2CM_SA_OFFSET) -#define LM3S_I2CM1_CS (LM3S_I2CM1_BASE + LM3S_I2CM_CS_OFFSET) -#define LM3S_I2CM1_DR (LM3S_I2CM1_BASE + LM3S_I2CM_DR_OFFSET) -#define LM3S_I2CM1_TPR (LM3S_I2CM1_BASE + LM3S_I2CM_TPR_OFFSET) -#define LM3S_I2CM1_IMR (LM3S_I2CM1_BASE + LM3S_I2CM_IMR_OFFSET) -#define LM3S_I2CM1_RIS (LM3S_I2CM1_BASE + LM3S_I2CM_RIS_OFFSET) -#define LM3S_I2CM1_MIS (LM3S_I2CM1_BASE + LM3S_I2CM_MIS_OFFSET) -#define LM3S_I2CM1_ICR (LM3S_I2CM1_BASE + LM3S_I2CM_ICR_OFFSET) -#define LM3S_I2CM1_CR (LM3S_I2CM1_BASE + LM3S_I2CM_CR_OFFSET) +#define LM_I2CM1_SA (LM_I2CM1_BASE + LM_I2CM_SA_OFFSET) +#define LM_I2CM1_CS (LM_I2CM1_BASE + LM_I2CM_CS_OFFSET) +#define LM_I2CM1_DR (LM_I2CM1_BASE + LM_I2CM_DR_OFFSET) +#define LM_I2CM1_TPR (LM_I2CM1_BASE + LM_I2CM_TPR_OFFSET) +#define LM_I2CM1_IMR (LM_I2CM1_BASE + LM_I2CM_IMR_OFFSET) +#define LM_I2CM1_RIS (LM_I2CM1_BASE + LM_I2CM_RIS_OFFSET) +#define LM_I2CM1_MIS (LM_I2CM1_BASE + LM_I2CM_MIS_OFFSET) +#define LM_I2CM1_ICR (LM_I2CM1_BASE + LM_I2CM_ICR_OFFSET) +#define LM_I2CM1_CR (LM_I2CM1_BASE + LM_I2CM_CR_OFFSET) /* I2C1 Slave */ -#define LM3S_I2CS1_OAR (LM3S_I2CS1_BASE + LM3S_I2CS_OAR_OFFSET) -#define LM3S_I2CS1_CSR (LM3S_I2CS1_BASE + LM3S_I2CS_CSR_OFFSET) -#define LM3S_I2CS1_DR (LM3S_I2CS1_BASE + LM3S_I2CS_DR_OFFSET) -#define LM3S_I2CS1_IMR (LM3S_I2CS1_BASE + LM3S_I2CS_IMR_OFFSET) -#define LM3S_I2CS1_RIS (LM3S_I2CS1_BASE + LM3S_I2CS_RIS_OFFSET) -#define LM3S_I2CS1_MIS (LM3S_I2CS1_BASE + LM3S_I2CS_MIS_OFFSET) -#define LM3S_I2CS1_ICR (LM3S_I2CS1_BASE + LM3S_I2CS_ICR_OFFSET) +#define LM_I2CS1_OAR (LM_I2CS1_BASE + LM_I2CS_OAR_OFFSET) +#define LM_I2CS1_CSR (LM_I2CS1_BASE + LM_I2CS_CSR_OFFSET) +#define LM_I2CS1_DR (LM_I2CS1_BASE + LM_I2CS_DR_OFFSET) +#define LM_I2CS1_IMR (LM_I2CS1_BASE + LM_I2CS_IMR_OFFSET) +#define LM_I2CS1_RIS (LM_I2CS1_BASE + LM_I2CS_RIS_OFFSET) +#define LM_I2CS1_MIS (LM_I2CS1_BASE + LM_I2CS_MIS_OFFSET) +#define LM_I2CS1_ICR (LM_I2CS1_BASE + LM_I2CS_ICR_OFFSET) #endif #endif @@ -244,4 +244,4 @@ * Public Function Prototypes ****************************************************************************/ -#endif /* __ARCH_ARM_SRC_LM_CHIP_LM3S_I2C_H */ +#endif /* __ARCH_ARM_SRC_LM_CHIP_LM_I2C_H */ diff --git a/nuttx/arch/arm/src/lm/chip/lm_pinmap.h b/nuttx/arch/arm/src/lm/chip/lm_pinmap.h index b8154dd9f5..311d6fcdc8 100644 --- a/nuttx/arch/arm/src/lm/chip/lm_pinmap.h +++ b/nuttx/arch/arm/src/lm/chip/lm_pinmap.h @@ -42,7 +42,7 @@ #include -/* Include the memory map file for the specific Stellaris chip */ +/* Include the pin mapping file for the specific Stellaris chip */ #ifdef CONFIG_ARCH_CHIP_LM3S # include "chip/lm3s_pinmap.h" diff --git a/nuttx/arch/arm/src/lm/chip/lm_ssi.h b/nuttx/arch/arm/src/lm/chip/lm_ssi.h index b58aec7330..5243bf1120 100644 --- a/nuttx/arch/arm/src/lm/chip/lm_ssi.h +++ b/nuttx/arch/arm/src/lm/chip/lm_ssi.h @@ -33,8 +33,8 @@ * ************************************************************************************/ -#ifndef __ARCH_ARM_SRC_LM_CHIP_LM3S_SSI_H -#define __ARCH_ARM_SRC_LM_CHIP_LM3S_SSI_H +#ifndef __ARCH_ARM_SRC_LM_CHIP_LM_SSI_H +#define __ARCH_ARM_SRC_LM_CHIP_LM_SSI_H /************************************************************************************ * Included Files @@ -43,7 +43,7 @@ #include #include -#if LM3S_NSSI > 0 +#if LM_NSSI > 0 /************************************************************************************ * Definitions @@ -51,173 +51,173 @@ /* SSI register offsets *************************************************************/ -#define LM3S_SSI_CR0_OFFSET 0x000 /* SSI Control 0 */ -#define LM3S_SSI_CR1_OFFSET 0x004 /* SSI Control 1 */ -#define LM3S_SSI_DR_OFFSET 0x008 /* SSI Data */ -#define LM3S_SSI_SR_OFFSET 0x00c /* SSI Status */ -#define LM3S_SSI_CPSR_OFFSET 0x010 /* SSI Clock Prescale */ -#define LM3S_SSI_IM_OFFSET 0x014 /* SSI Interrupt Mask */ -#define LM3S_SSI_RIS_OFFSET 0x018 /* SSI Raw Interrupt Status */ -#define LM3S_SSI_MIS_OFFSET 0x01c /* SSI Masked Interrupt Status */ -#define LM3S_SSI_ICR_OFFSET 0x020 /* SSI Interrupt Clear */ -#define LM3S_SSI_PERIPHID4_OFFSET 0xfd0 /* SSI Peripheral Identification 4 */ -#define LM3S_SSI_PERIPHID5_OFFSET 0xfd4 /* SSI Peripheral Identification 5 */ -#define LM3S_SSI_PERIPHID6_OFFSET 0xfd8 /* SSI Peripheral Identification 6 */ -#define LM3S_SSI_PERIPHID7_OFFSET 0xfdc /* SSI Peripheral Identification 7 */ -#define LM3S_SSI_PERIPHID0_OFFSET 0xfe0 /* SSI Peripheral Identification 0 */ -#define LM3S_SSI_PERIPHID1_OFFSET 0xfe4 /* SSI Peripheral Identification 1 */ -#define LM3S_SSI_PERIPHID2_OFFSET 0xfe8 /* SSI Peripheral Identification 2 */ -#define LM3S_SSI_PERIPHID3_OFFSET 0xfec /* SSI Peripheral Identification 3 */ -#define LM3S_SSI_PCELLID0_OFFSET 0xff0 /* SSI PrimeCell Identification 0 */ -#define LM3S_SSI_PCELLID1_OFFSET 0xff4 /* SSI PrimeCell Identification 1 */ -#define LM3S_SSI_PCELLID2_OFFSET 0xff8 /* SSI PrimeCell Identification 2 */ -#define LM3S_SSI_PCELLID3_OFFSET 0xffc /* SSI PrimeCell Identification 3 */ +#define LM_SSI_CR0_OFFSET 0x000 /* SSI Control 0 */ +#define LM_SSI_CR1_OFFSET 0x004 /* SSI Control 1 */ +#define LM_SSI_DR_OFFSET 0x008 /* SSI Data */ +#define LM_SSI_SR_OFFSET 0x00c /* SSI Status */ +#define LM_SSI_CPSR_OFFSET 0x010 /* SSI Clock Prescale */ +#define LM_SSI_IM_OFFSET 0x014 /* SSI Interrupt Mask */ +#define LM_SSI_RIS_OFFSET 0x018 /* SSI Raw Interrupt Status */ +#define LM_SSI_MIS_OFFSET 0x01c /* SSI Masked Interrupt Status */ +#define LM_SSI_ICR_OFFSET 0x020 /* SSI Interrupt Clear */ +#define LM_SSI_PERIPHID4_OFFSET 0xfd0 /* SSI Peripheral Identification 4 */ +#define LM_SSI_PERIPHID5_OFFSET 0xfd4 /* SSI Peripheral Identification 5 */ +#define LM_SSI_PERIPHID6_OFFSET 0xfd8 /* SSI Peripheral Identification 6 */ +#define LM_SSI_PERIPHID7_OFFSET 0xfdc /* SSI Peripheral Identification 7 */ +#define LM_SSI_PERIPHID0_OFFSET 0xfe0 /* SSI Peripheral Identification 0 */ +#define LM_SSI_PERIPHID1_OFFSET 0xfe4 /* SSI Peripheral Identification 1 */ +#define LM_SSI_PERIPHID2_OFFSET 0xfe8 /* SSI Peripheral Identification 2 */ +#define LM_SSI_PERIPHID3_OFFSET 0xfec /* SSI Peripheral Identification 3 */ +#define LM_SSI_PCELLID0_OFFSET 0xff0 /* SSI PrimeCell Identification 0 */ +#define LM_SSI_PCELLID1_OFFSET 0xff4 /* SSI PrimeCell Identification 1 */ +#define LM_SSI_PCELLID2_OFFSET 0xff8 /* SSI PrimeCell Identification 2 */ +#define LM_SSI_PCELLID3_OFFSET 0xffc /* SSI PrimeCell Identification 3 */ /* SSI register addresses ***********************************************************/ -#define LM3S_SSI0_CR0 (LM3S_SSI0_BASE + LM3S_SSI_CR0_OFFSET) -#define LM3S_SSI0_CR1 (LM3S_SSI0_BASE + LM3S_SSI_CR1_OFFSET) -#define LM3S_SSI0_DR (LM3S_SSI0_BASE + LM3S_SSI_DR_OFFSET) -#define LM3S_SSI0_SR (LM3S_SSI0_BASE + LM3S_SSI_SR_OFFSET) -#define LM3S_SSI0_CPSR (LM3S_SSI0_BASE + LM3S_SSI_CPSR_OFFSET) -#define LM3S_SSI0_IM (LM3S_SSI0_BASE + LM3S_SSI_IM_OFFSET) -#define LM3S_SSI0_RIS (LM3S_SSI0_BASE + LM3S_SSI_RIS_OFFSET) -#define LM3S_SSI0_MIS (LM3S_SSI0_BASE + LM3S_SSI_MIS_OFFSET) -#define LM3S_SSI0_ICR (LM3S_SSI0_BASE + LM3S_SSI_ICR_OFFSET) -#define LM3S_SSI0_PERIPHID4 (LM3S_SSI0_BASE + LM3S_SSI_PERIPHID4_OFFSET) -#define LM3S_SSI0_PERIPHID5 (LM3S_SSI0_BASE + LM3S_SSI_PERIPHID5_OFFSET) -#define LM3S_SSI0_PERIPHID6 (LM3S_SSI0_BASE + LM3S_SSI_PERIPHID6_OFFSET) -#define LM3S_SSI0_PERIPHID7 (LM3S_SSI0_BASE + LM3S_SSI_PERIPHID7_OFFSET) -#define LM3S_SSI0_PERIPHID0 (LM3S_SSI0_BASE + LM3S_SSI_PERIPHID0_OFFSET) -#define LM3S_SSI0_PERIPHID1 (LM3S_SSI0_BASE + LM3S_SSI_PERIPHID1_OFFSET) -#define LM3S_SSI0_PERIPHID2 (LM3S_SSI0_BASE + LM3S_SSI_PERIPHID2_OFFSET) -#define LM3S_SSI0_PERIPHID3 (LM3S_SSI0_BASE + LM3S_SSI_PERIPHID3_OFFSET) -#define LM3S_SSI0_PCELLID0 (LM3S_SSI0_BASE + LM3S_SSI_PCELLID0_OFFSET) -#define LM3S_SSI0_PCELLID1 (LM3S_SSI0_BASE + LM3S_SSI_PCELLID1_OFFSET) -#define LM3S_SSI0_PCELLID2 (LM3S_SSI0_BASE + LM3S_SSI_PCELLID2_OFFSET) -#define LM3S_SSI0_PCELLID3 (LM3S_SSI0_BASE + LM3S_SSI_PCELLID3_OFFSET) +#define LM_SSI0_CR0 (LM_SSI0_BASE + LM_SSI_CR0_OFFSET) +#define LM_SSI0_CR1 (LM_SSI0_BASE + LM_SSI_CR1_OFFSET) +#define LM_SSI0_DR (LM_SSI0_BASE + LM_SSI_DR_OFFSET) +#define LM_SSI0_SR (LM_SSI0_BASE + LM_SSI_SR_OFFSET) +#define LM_SSI0_CPSR (LM_SSI0_BASE + LM_SSI_CPSR_OFFSET) +#define LM_SSI0_IM (LM_SSI0_BASE + LM_SSI_IM_OFFSET) +#define LM_SSI0_RIS (LM_SSI0_BASE + LM_SSI_RIS_OFFSET) +#define LM_SSI0_MIS (LM_SSI0_BASE + LM_SSI_MIS_OFFSET) +#define LM_SSI0_ICR (LM_SSI0_BASE + LM_SSI_ICR_OFFSET) +#define LM_SSI0_PERIPHID4 (LM_SSI0_BASE + LM_SSI_PERIPHID4_OFFSET) +#define LM_SSI0_PERIPHID5 (LM_SSI0_BASE + LM_SSI_PERIPHID5_OFFSET) +#define LM_SSI0_PERIPHID6 (LM_SSI0_BASE + LM_SSI_PERIPHID6_OFFSET) +#define LM_SSI0_PERIPHID7 (LM_SSI0_BASE + LM_SSI_PERIPHID7_OFFSET) +#define LM_SSI0_PERIPHID0 (LM_SSI0_BASE + LM_SSI_PERIPHID0_OFFSET) +#define LM_SSI0_PERIPHID1 (LM_SSI0_BASE + LM_SSI_PERIPHID1_OFFSET) +#define LM_SSI0_PERIPHID2 (LM_SSI0_BASE + LM_SSI_PERIPHID2_OFFSET) +#define LM_SSI0_PERIPHID3 (LM_SSI0_BASE + LM_SSI_PERIPHID3_OFFSET) +#define LM_SSI0_PCELLID0 (LM_SSI0_BASE + LM_SSI_PCELLID0_OFFSET) +#define LM_SSI0_PCELLID1 (LM_SSI0_BASE + LM_SSI_PCELLID1_OFFSET) +#define LM_SSI0_PCELLID2 (LM_SSI0_BASE + LM_SSI_PCELLID2_OFFSET) +#define LM_SSI0_PCELLID3 (LM_SSI0_BASE + LM_SSI_PCELLID3_OFFSET) -#if LM3S_NSSI > 1 -#define LM3S_SSI1_CR0 (LM3S_SSI1_BASE + LM3S_SSI_CR0_OFFSET) -#define LM3S_SSI1_CR1 (LM3S_SSI1_BASE + LM3S_SSI_CR1_OFFSET) -#define LM3S_SSI1_DR (LM3S_SSI1_BASE + LM3S_SSI_DR_OFFSET) -#define LM3S_SSI1_SR (LM3S_SSI1_BASE + LM3S_SSI_SR_OFFSET) -#define LM3S_SSI1_CPSR (LM3S_SSI1_BASE + LM3S_SSI_CPSR_OFFSET) -#define LM3S_SSI1_IM (LM3S_SSI1_BASE + LM3S_SSI_IM_OFFSET) -#define LM3S_SSI1_RIS (LM3S_SSI1_BASE + LM3S_SSI_RIS_OFFSET) -#define LM3S_SSI1_MIS (LM3S_SSI1_BASE + LM3S_SSI_MIS_OFFSET) -#define LM3S_SSI1_ICR (LM3S_SSI1_BASE + LM3S_SSI_ICR_OFFSET) -#define LM3S_SSI1_PERIPHID4 (LM3S_SSI1_BASE + LM3S_SSI_PERIPHID4_OFFSET) -#define LM3S_SSI1_PERIPHID5 (LM3S_SSI1_BASE + LM3S_SSI_PERIPHID5_OFFSET) -#define LM3S_SSI1_PERIPHID6 (LM3S_SSI1_BASE + LM3S_SSI_PERIPHID6_OFFSET) -#define LM3S_SSI1_PERIPHID7 (LM3S_SSI1_BASE + LM3S_SSI_PERIPHID7_OFFSET) -#define LM3S_SSI1_PERIPHID0 (LM3S_SSI1_BASE + LM3S_SSI_PERIPHID0_OFFSET) -#define LM3S_SSI1_PERIPHID1 (LM3S_SSI1_BASE + LM3S_SSI_PERIPHID1_OFFSET) -#define LM3S_SSI1_PERIPHID2 (LM3S_SSI1_BASE + LM3S_SSI_PERIPHID2_OFFSET) -#define LM3S_SSI1_PERIPHID3 (LM3S_SSI1_BASE + LM3S_SSI_PERIPHID3_OFFSET) -#define LM3S_SSI1_PCELLID0 (LM3S_SSI1_BASE + LM3S_SSI_PCELLID0_OFFSET) -#define LM3S_SSI1_PCELLID1 (LM3S_SSI1_BASE + LM3S_SSI_PCELLID1_OFFSET) -#define LM3S_SSI1_PCELLID2 (LM3S_SSI1_BASE + LM3S_SSI_PCELLID2_OFFSET) -#define LM3S_SSI1_PCELLID3 (LM3S_SSI1_BASE + LM3S_SSI_PCELLID3_OFFSET) +#if LM_NSSI > 1 +#define LM_SSI1_CR0 (LM_SSI1_BASE + LM_SSI_CR0_OFFSET) +#define LM_SSI1_CR1 (LM_SSI1_BASE + LM_SSI_CR1_OFFSET) +#define LM_SSI1_DR (LM_SSI1_BASE + LM_SSI_DR_OFFSET) +#define LM_SSI1_SR (LM_SSI1_BASE + LM_SSI_SR_OFFSET) +#define LM_SSI1_CPSR (LM_SSI1_BASE + LM_SSI_CPSR_OFFSET) +#define LM_SSI1_IM (LM_SSI1_BASE + LM_SSI_IM_OFFSET) +#define LM_SSI1_RIS (LM_SSI1_BASE + LM_SSI_RIS_OFFSET) +#define LM_SSI1_MIS (LM_SSI1_BASE + LM_SSI_MIS_OFFSET) +#define LM_SSI1_ICR (LM_SSI1_BASE + LM_SSI_ICR_OFFSET) +#define LM_SSI1_PERIPHID4 (LM_SSI1_BASE + LM_SSI_PERIPHID4_OFFSET) +#define LM_SSI1_PERIPHID5 (LM_SSI1_BASE + LM_SSI_PERIPHID5_OFFSET) +#define LM_SSI1_PERIPHID6 (LM_SSI1_BASE + LM_SSI_PERIPHID6_OFFSET) +#define LM_SSI1_PERIPHID7 (LM_SSI1_BASE + LM_SSI_PERIPHID7_OFFSET) +#define LM_SSI1_PERIPHID0 (LM_SSI1_BASE + LM_SSI_PERIPHID0_OFFSET) +#define LM_SSI1_PERIPHID1 (LM_SSI1_BASE + LM_SSI_PERIPHID1_OFFSET) +#define LM_SSI1_PERIPHID2 (LM_SSI1_BASE + LM_SSI_PERIPHID2_OFFSET) +#define LM_SSI1_PERIPHID3 (LM_SSI1_BASE + LM_SSI_PERIPHID3_OFFSET) +#define LM_SSI1_PCELLID0 (LM_SSI1_BASE + LM_SSI_PCELLID0_OFFSET) +#define LM_SSI1_PCELLID1 (LM_SSI1_BASE + LM_SSI_PCELLID1_OFFSET) +#define LM_SSI1_PCELLID2 (LM_SSI1_BASE + LM_SSI_PCELLID2_OFFSET) +#define LM_SSI1_PCELLID3 (LM_SSI1_BASE + LM_SSI_PCELLID3_OFFSET) -#define LM3S_SSI_BASE(n) (LM3S_SSI0_BASE + (n)*0x01000) +#define LM_SSI_BASE(n) (LM_SSI0_BASE + (n)*0x01000) -#define LM3S_SSI_CR0(n) (LM3S_SSI_BASE(n) + LM3S_SSI_CR0_OFFSET) -#define LM3S_SSI_CR1(n) (LM3S_SSI_BASE(n) + LM3S_SSI_CR1_OFFSET) -#define LM3S_SSI_DR(n) (LM3S_SSI_BASE(n) + LM3S_SSI_DR_OFFSET) -#define LM3S_SSI_SR(n) (LM3S_SSI_BASE(n) + LM3S_SSI_SR_OFFSET) -#define LM3S_SSI_CPSR(n) (LM3S_SSI_BASE(n) + LM3S_SSI_CPSR_OFFSET) -#define LM3S_SSI_IM(n) (LM3S_SSI_BASE(n) + LM3S_SSI_IM_OFFSET) -#define LM3S_SSI_RIS(n) (LM3S_SSI_BASE(n) + LM3S_SSI_RIS_OFFSET) -#define LM3S_SSI_MIS(n) (LM3S_SSI_BASE(n) + LM3S_SSI_MIS_OFFSET) -#define LM3S_SSI_ICR(n) (LM3S_SSI_BASE(n) + LM3S_SSI_ICR_OFFSET) -#define LM3S_SSI_PERIPHID4(n) (LM3S_SSI_BASE(n) + LM3S_SSI_PERIPHID4_OFFSET) -#define LM3S_SSI_PERIPHID5(n) (LM3S_SSI_BASE(n) + LM3S_SSI_PERIPHID5_OFFSET) -#define LM3S_SSI_PERIPHID6(n) (LM3S_SSI_BASE(n) + LM3S_SSI_PERIPHID6_OFFSET) -#define LM3S_SSI_PERIPHID7(n) (LM3S_SSI_BASE(n) + LM3S_SSI_PERIPHID7_OFFSET) -#define LM3S_SSI_PERIPHID0(n) (LM3S_SSI_BASE(n) + LM3S_SSI_PERIPHID0_OFFSET) -#define LM3S_SSI_PERIPHID1(n) (LM3S_SSI_BASE(n) + LM3S_SSI_PERIPHID1_OFFSET) -#define LM3S_SSI_PERIPHID2(n) (LM3S_SSI_BASE(n) + LM3S_SSI_PERIPHID2_OFFSET) -#define LM3S_SSI_PERIPHID3(n) (LM3S_SSI_BASE(n) + LM3S_SSI_PERIPHID3_OFFSET) -#define LM3S_SSI_PCELLID0(n) (LM3S_SSI_BASE(n) + LM3S_SSI_PCELLID0_OFFSET) -#define LM3S_SSI_PCELLID1(n) (LM3S_SSI_BASE(n) + LM3S_SSI_PCELLID1_OFFSET) -#define LM3S_SSI_PCELLID2(n) (LM3S_SSI_BASE(n) + LM3S_SSI_PCELLID2_OFFSET) -#define LM3S_SSI_PCELLID3(n) (LM3S_SSI_BASE(n) + LM3S_SSI_PCELLID3_OFFSET) -#endif /* LM3S_NSSI > 1 */ +#define LM_SSI_CR0(n) (LM_SSI_BASE(n) + LM_SSI_CR0_OFFSET) +#define LM_SSI_CR1(n) (LM_SSI_BASE(n) + LM_SSI_CR1_OFFSET) +#define LM_SSI_DR(n) (LM_SSI_BASE(n) + LM_SSI_DR_OFFSET) +#define LM_SSI_SR(n) (LM_SSI_BASE(n) + LM_SSI_SR_OFFSET) +#define LM_SSI_CPSR(n) (LM_SSI_BASE(n) + LM_SSI_CPSR_OFFSET) +#define LM_SSI_IM(n) (LM_SSI_BASE(n) + LM_SSI_IM_OFFSET) +#define LM_SSI_RIS(n) (LM_SSI_BASE(n) + LM_SSI_RIS_OFFSET) +#define LM_SSI_MIS(n) (LM_SSI_BASE(n) + LM_SSI_MIS_OFFSET) +#define LM_SSI_ICR(n) (LM_SSI_BASE(n) + LM_SSI_ICR_OFFSET) +#define LM_SSI_PERIPHID4(n) (LM_SSI_BASE(n) + LM_SSI_PERIPHID4_OFFSET) +#define LM_SSI_PERIPHID5(n) (LM_SSI_BASE(n) + LM_SSI_PERIPHID5_OFFSET) +#define LM_SSI_PERIPHID6(n) (LM_SSI_BASE(n) + LM_SSI_PERIPHID6_OFFSET) +#define LM_SSI_PERIPHID7(n) (LM_SSI_BASE(n) + LM_SSI_PERIPHID7_OFFSET) +#define LM_SSI_PERIPHID0(n) (LM_SSI_BASE(n) + LM_SSI_PERIPHID0_OFFSET) +#define LM_SSI_PERIPHID1(n) (LM_SSI_BASE(n) + LM_SSI_PERIPHID1_OFFSET) +#define LM_SSI_PERIPHID2(n) (LM_SSI_BASE(n) + LM_SSI_PERIPHID2_OFFSET) +#define LM_SSI_PERIPHID3(n) (LM_SSI_BASE(n) + LM_SSI_PERIPHID3_OFFSET) +#define LM_SSI_PCELLID0(n) (LM_SSI_BASE(n) + LM_SSI_PCELLID0_OFFSET) +#define LM_SSI_PCELLID1(n) (LM_SSI_BASE(n) + LM_SSI_PCELLID1_OFFSET) +#define LM_SSI_PCELLID2(n) (LM_SSI_BASE(n) + LM_SSI_PCELLID2_OFFSET) +#define LM_SSI_PCELLID3(n) (LM_SSI_BASE(n) + LM_SSI_PCELLID3_OFFSET) +#endif /* LM_NSSI > 1 */ /* SSI register bit defitiions ******************************************************/ /* SSI Control 0 (SSICR0), offset 0x000 */ -#define SSI_CR0_DSS_SHIFT 0 /* Bits 3-0: SSI Data Size Select */ -#define SSI_CR0_DSS_MASK (0x0f << SSI_CR0_DSS_SHIFT) -#define SSI_CR0_DSS(n) ((n-1) << SSI_CR0_DSS_SHIFT) /* n={4,5,..16} */ -#define SSI_CR0_FRF_SHIFT 4 /* Bits 5-4: SSI Frame Format Select */ -#define SSI_CR0_FRF_MASK (3 << SSI_CR0_FRF_SHIFT) -#define SSI_CR0_FRF_SPI (0 << SSI_CR0_FRF_SHIFT) /* Freescale SPI format */ -#define SSI_CR0_FRF_SSFF (1 << SSI_CR0_FRF_SHIFT) /* TI synchronous serial fram format */ -#define SSI_CR0_FRF_UWIRE (2 << SSI_CR0_FRF_SHIFT) /* MICROWIRE frame format */ -#define SSI_CR0_SPO (1 << 6) /* Bit 6: SSI Serial Clock Polarity */ -#define SSI_CR0_SPH (1 << 7) /* Bit 7: SSI Serial Clock Phase */ -#define SSI_CR0_SCR_SHIFT 8 /* Bits 15-8: SSI Serial Clock Rate */ -#define SSI_CR0_SCR_MASK (0xff << SSI_CR0_SCR_SHIFT) +#define SSI_CR0_DSS_SHIFT 0 /* Bits 3-0: SSI Data Size Select */ +#define SSI_CR0_DSS_MASK (0x0f << SSI_CR0_DSS_SHIFT) +#define SSI_CR0_DSS(n) ((n-1) << SSI_CR0_DSS_SHIFT) /* n={4,5,..16} */ +#define SSI_CR0_FRF_SHIFT 4 /* Bits 5-4: SSI Frame Format Select */ +#define SSI_CR0_FRF_MASK (3 << SSI_CR0_FRF_SHIFT) +#define SSI_CR0_FRF_SPI (0 << SSI_CR0_FRF_SHIFT) /* Freescale SPI format */ +#define SSI_CR0_FRF_SSFF (1 << SSI_CR0_FRF_SHIFT) /* TI synchronous serial fram format */ +#define SSI_CR0_FRF_UWIRE (2 << SSI_CR0_FRF_SHIFT) /* MICROWIRE frame format */ +#define SSI_CR0_SPO (1 << 6) /* Bit 6: SSI Serial Clock Polarity */ +#define SSI_CR0_SPH (1 << 7) /* Bit 7: SSI Serial Clock Phase */ +#define SSI_CR0_SCR_SHIFT 8 /* Bits 15-8: SSI Serial Clock Rate */ +#define SSI_CR0_SCR_MASK (0xff << SSI_CR0_SCR_SHIFT) /* SSI Control 1 (SSICR1), offset 0x004 */ -#define SSI_CR1_LBM (1 << 0) /* Bit 0: SSI Loopback Mode */ -#define SSI_CR1_SSE (1 << 1) /* Bit 1: SSI Synchronous Serial Port Enable */ -#define SSI_CR1_MS (1 << 2) /* Bit 2: SSI Master/Slave Select slave */ -#define SSI_CR1_SOD (1 << 3) /* Bit 3: SSI Slave Mode Output Disable */ +#define SSI_CR1_LBM (1 << 0) /* Bit 0: SSI Loopback Mode */ +#define SSI_CR1_SSE (1 << 1) /* Bit 1: SSI Synchronous Serial Port Enable */ +#define SSI_CR1_MS (1 << 2) /* Bit 2: SSI Master/Slave Select slave */ +#define SSI_CR1_SOD (1 << 3) /* Bit 3: SSI Slave Mode Output Disable */ /* SSI Data (SSIDR), offset 0x008 */ -#define SSI_DR_MASK 0xffff /* Bits 15-0: SSI data */ +#define SSI_DR_MASK 0xffff /* Bits 15-0: SSI data */ /* SSI Status (SSISR), offset 0x00c */ -#define SSI_SR_TFE (1 << 0) /* Bit 0: SSI Transmit FIFO Empty */ -#define SSI_SR_TNF (1 << 1) /* Bit 1: SSI Transmit FIFO Not Full */ -#define SSI_SR_RNE (1 << 2) /* Bit 2: SSI Receive FIFO Not Empty */ -#define SSI_SR_RFF (1 << 3) /* Bit 3: SSI Receive FIFO Full */ -#define SSI_SR_BSY (1 << 4) /* Bit 4: SSI Busy Bit */ +#define SSI_SR_TFE (1 << 0) /* Bit 0: SSI Transmit FIFO Empty */ +#define SSI_SR_TNF (1 << 1) /* Bit 1: SSI Transmit FIFO Not Full */ +#define SSI_SR_RNE (1 << 2) /* Bit 2: SSI Receive FIFO Not Empty */ +#define SSI_SR_RFF (1 << 3) /* Bit 3: SSI Receive FIFO Full */ +#define SSI_SR_BSY (1 << 4) /* Bit 4: SSI Busy Bit */ /* SSI Clock Prescale (SSICPSR), offset 0x010 */ -#define SSI_CPSR_DIV_MASK 0xff /* Bits 7-0: SSI Clock Prescale Divisor */ +#define SSI_CPSR_DIV_MASK 0xff /* Bits 7-0: SSI Clock Prescale Divisor */ /* SSI Interrupt Mask (SSIIM), offset 0x014 */ -#define SSI_IM_ROR (1 << 0) /* Bit 0: SSI Receive Overrun Interrupt Mask */ -#define SSI_IM_RT (1 << 1) /* Bit 1: SSI Receive Time-Out Interrupt Mask */ -#define SSI_IM_RX (1 << 2) /* Bit 2: SSI Receive FIFO Interrupt Mask */ -#define SSI_IM_TX (1 << 3) /* Bit 3: SSI Transmit FIFO Interrupt Mask */ +#define SSI_IM_ROR (1 << 0) /* Bit 0: SSI Receive Overrun Interrupt Mask */ +#define SSI_IM_RT (1 << 1) /* Bit 1: SSI Receive Time-Out Interrupt Mask */ +#define SSI_IM_RX (1 << 2) /* Bit 2: SSI Receive FIFO Interrupt Mask */ +#define SSI_IM_TX (1 << 3) /* Bit 3: SSI Transmit FIFO Interrupt Mask */ /* SSI Raw Interrupt Status (SSIRIS), offset 0x018 */ -#define SSI_RIS_ROR (1 << 0) /* Bit 0: SSI Receive Overrun Raw Interrupt Status */ -#define SSI_RIS_RT (1 << 1) /* Bit 1: SSI Receive Time-Out Raw Interrupt Status */ -#define SSI_RIS_RX (1 << 2) /* Bit 2: SSI Receive FIFO Raw Interrupt Status */ -#define SSI_RIS_TX (1 << 3) /* Bit 3: SSI Transmit FIFO Raw Interrupt Status */ +#define SSI_RIS_ROR (1 << 0) /* Bit 0: SSI Receive Overrun Raw Interrupt Status */ +#define SSI_RIS_RT (1 << 1) /* Bit 1: SSI Receive Time-Out Raw Interrupt Status */ +#define SSI_RIS_RX (1 << 2) /* Bit 2: SSI Receive FIFO Raw Interrupt Status */ +#define SSI_RIS_TX (1 << 3) /* Bit 3: SSI Transmit FIFO Raw Interrupt Status */ /* SSI Masked Interrupt Status (SSIMIS), offset 0x01c */ -#define SSI_MIS_ROR (1 << 0) /* Bit 0: SSI Receive Overrun Masked Interrupt Status */ -#define SSI_MIS_RT (1 << 1) /* Bit 1: SSI Receive Time-Out Masked Interrupt Status */ -#define SSI_MIS_RX (1 << 2) /* Bit 2: SSI Receive FIFO Masked Interrupt Status */ -#define SSI_MIS_TX (1 << 3) /* Bit 3: SSI Transmit FIFO Masked Interrupt Status */ +#define SSI_MIS_ROR (1 << 0) /* Bit 0: SSI Receive Overrun Masked Interrupt Status */ +#define SSI_MIS_RT (1 << 1) /* Bit 1: SSI Receive Time-Out Masked Interrupt Status */ +#define SSI_MIS_RX (1 << 2) /* Bit 2: SSI Receive FIFO Masked Interrupt Status */ +#define SSI_MIS_TX (1 << 3) /* Bit 3: SSI Transmit FIFO Masked Interrupt Status */ /* SSI Interrupt Clear (SSIICR), offset 0x020 */ -#define SSI_ICR_ROR (1 << 0) /* Bit 0: SSI Receive Overrun Interrupt Clear */ -#define SSI_ICR_RT (1 << 1) /* Bit 1: SSI Receive Time-Out Interrupt Clear */ +#define SSI_ICR_ROR (1 << 0) /* Bit 0: SSI Receive Overrun Interrupt Clear */ +#define SSI_ICR_RT (1 << 1) /* Bit 1: SSI Receive Time-Out Interrupt Clear */ /* SSI Peripheral Identification n (SSIPERIPHIDn), offset 0xfd0-0xfec */ -#define SSI_PERIPHID_MASK 0xff /* Bits 7-0: SSI Peripheral ID n */ +#define SSI_PERIPHID_MASK 0xff /* Bits 7-0: SSI Peripheral ID n */ /* SSI PrimeCell Identification n (SSIPCELLIDn), offset 0xff0-0xffc */ -#define SSI_PCELLID_MASK 0xff /* Bits 7-0: SSI Prime cell ID */ +#define SSI_PCELLID_MASK 0xff /* Bits 7-0: SSI Prime cell ID */ /************************************************************************************ * Public Types @@ -231,5 +231,5 @@ * Public Function Prototypes ************************************************************************************/ -#endif /* LM3S_NSSI > 0 */ -#endif /* __ARCH_ARM_SRC_LM_CHIP_LM3S_SSI_H */ +#endif /* LM_NSSI > 0 */ +#endif /* __ARCH_ARM_SRC_LM_CHIP_LM_SSI_H */ diff --git a/nuttx/arch/arm/src/lm/chip/lm_syscontrol.h b/nuttx/arch/arm/src/lm/chip/lm_syscontrol.h index 6ca8ac3ffd..444a1271c9 100644 --- a/nuttx/arch/arm/src/lm/chip/lm_syscontrol.h +++ b/nuttx/arch/arm/src/lm/chip/lm_syscontrol.h @@ -33,8 +33,8 @@ * ************************************************************************************/ -#ifndef __ARCH_ARM_SRC_LM_CHIP_LM3S_SYSCONTROL_H -#define __ARCH_ARM_SRC_LM_CHIP_LM3S_SYSCONTROL_H +#ifndef __ARCH_ARM_SRC_LM_CHIP_LM_SYSCONTROL_H +#define __ARCH_ARM_SRC_LM_CHIP_LM_SYSCONTROL_H /************************************************************************************ * Included Files @@ -48,67 +48,67 @@ /* System Control Register Offsets **************************************************/ -#define LM3S_SYSCON_DID0_OFFSET 0x000 /* Device Identification 0 */ -#define LM3S_SYSCON_DID1_OFFSET 0x004 /* Device Identification 1 */ -#define LM3S_SYSCON_DC0_OFFSET 0x008 /* Device Capabilities 0 */ -#define LM3S_SYSCON_DC1_OFFSET 0x010 /* Device Capabilities 1 */ -#define LM3S_SYSCON_DC2_OFFSET 0x014 /* Device Capabilities 2 */ -#define LM3S_SYSCON_DC3_OFFSET 0x018 /* Device Capabilities 3 */ -#define LM3S_SYSCON_DC4_OFFSET 0x01c /* Device Capabilities 4 */ -#define LM3S_SYSCON_PBORCTL_OFFSET 0x030 /* Brown-Out Reset Control */ -#define LM3S_SYSCON_LDOPCTL_OFFSET 0x034 /* LDO Power Control */ -#define LM3S_SYSCON_SRCR0_OFFSET 0x040 /* Software Reset Control 0 */ -#define LM3S_SYSCON_SRCR1_OFFSET 0x044 /* Software Reset Control 1 */ -#define LM3S_SYSCON_SRCR2_OFFSET 0x048 /* Software Reset Control 2*/ -#define LM3S_SYSCON_RIS_OFFSET 0x050 /* Raw Interrupt Status */ -#define LM3S_SYSCON_IMC_OFFSET 0x054 /* Interrupt Mask Control */ -#define LM3S_SYSCON_MISC_OFFSET 0x058 /* Masked Interrupt Status and Clear */ -#define LM3S_SYSCON_RESC_OFFSET 0x05c /* Reset Cause */ -#define LM3S_SYSCON_RCC_OFFSET 0x060 /* Run-Mode Clock Configuration */ -#define LM3S_SYSCON_PLLCFG_OFFSET 0x064 /* XTAL to PLL Translation */ -#define LM3S_SYSCON_RCC2_OFFSET 0x070 /* Run-Mode Clock Configuration 2 */ -#define LM3S_SYSCON_RCGC0_OFFSET 0x100 /* Run Mode Clock Gating Control Register 0 */ -#define LM3S_SYSCON_RCGC1_OFFSET 0x104 /* Run Mode Clock Gating Control Register 1 */ -#define LM3S_SYSCON_RCGC2_OFFSET 0x108 /* Run Mode Clock Gating Control Register 2 */ -#define LM3S_SYSCON_SCGC0_OFFSET 0x110 /* Sleep Mode Clock Gating Control Register 0 */ -#define LM3S_SYSCON_SCGC1_OFFSET 0x114 /* Sleep Mode Clock Gating Control Register 1 */ -#define LM3S_SYSCON_SCGC2_OFFSET 0x118 /* Sleep Mode Clock Gating Control Register 2 */ -#define LM3S_SYSCON_DCGC0_OFFSET 0x120 /* Deep Sleep Mode Clock Gating Control Register 0 */ -#define LM3S_SYSCON_DCGC1_OFFSET 0x124 /* Deep Sleep Mode Clock Gating Control Register 1 */ -#define LM3S_SYSCON_DCGC2_OFFSET 0x128 /* Deep Sleep Mode Clock Gating Control Register 2 */ -#define LM3S_SYSCON_DSLPCLKCFG_OFFSET 0x144 /* Deep Sleep Clock Configuration*/ +#define LM_SYSCON_DID0_OFFSET 0x000 /* Device Identification 0 */ +#define LM_SYSCON_DID1_OFFSET 0x004 /* Device Identification 1 */ +#define LM_SYSCON_DC0_OFFSET 0x008 /* Device Capabilities 0 */ +#define LM_SYSCON_DC1_OFFSET 0x010 /* Device Capabilities 1 */ +#define LM_SYSCON_DC2_OFFSET 0x014 /* Device Capabilities 2 */ +#define LM_SYSCON_DC3_OFFSET 0x018 /* Device Capabilities 3 */ +#define LM_SYSCON_DC4_OFFSET 0x01c /* Device Capabilities 4 */ +#define LM_SYSCON_PBORCTL_OFFSET 0x030 /* Brown-Out Reset Control */ +#define LM_SYSCON_LDOPCTL_OFFSET 0x034 /* LDO Power Control */ +#define LM_SYSCON_SRCR0_OFFSET 0x040 /* Software Reset Control 0 */ +#define LM_SYSCON_SRCR1_OFFSET 0x044 /* Software Reset Control 1 */ +#define LM_SYSCON_SRCR2_OFFSET 0x048 /* Software Reset Control 2*/ +#define LM_SYSCON_RIS_OFFSET 0x050 /* Raw Interrupt Status */ +#define LM_SYSCON_IMC_OFFSET 0x054 /* Interrupt Mask Control */ +#define LM_SYSCON_MISC_OFFSET 0x058 /* Masked Interrupt Status and Clear */ +#define LM_SYSCON_RESC_OFFSET 0x05c /* Reset Cause */ +#define LM_SYSCON_RCC_OFFSET 0x060 /* Run-Mode Clock Configuration */ +#define LM_SYSCON_PLLCFG_OFFSET 0x064 /* XTAL to PLL Translation */ +#define LM_SYSCON_RCC2_OFFSET 0x070 /* Run-Mode Clock Configuration 2 */ +#define LM_SYSCON_RCGC0_OFFSET 0x100 /* Run Mode Clock Gating Control Register 0 */ +#define LM_SYSCON_RCGC1_OFFSET 0x104 /* Run Mode Clock Gating Control Register 1 */ +#define LM_SYSCON_RCGC2_OFFSET 0x108 /* Run Mode Clock Gating Control Register 2 */ +#define LM_SYSCON_SCGC0_OFFSET 0x110 /* Sleep Mode Clock Gating Control Register 0 */ +#define LM_SYSCON_SCGC1_OFFSET 0x114 /* Sleep Mode Clock Gating Control Register 1 */ +#define LM_SYSCON_SCGC2_OFFSET 0x118 /* Sleep Mode Clock Gating Control Register 2 */ +#define LM_SYSCON_DCGC0_OFFSET 0x120 /* Deep Sleep Mode Clock Gating Control Register 0 */ +#define LM_SYSCON_DCGC1_OFFSET 0x124 /* Deep Sleep Mode Clock Gating Control Register 1 */ +#define LM_SYSCON_DCGC2_OFFSET 0x128 /* Deep Sleep Mode Clock Gating Control Register 2 */ +#define LM_SYSCON_DSLPCLKCFG_OFFSET 0x144 /* Deep Sleep Clock Configuration*/ /* System Control Register Addresses ************************************************/ -#define LM3S_SYSCON_DID0 (LM3S_SYSCON_BASE + LM3S_SYSCON_DID0_OFFSET) -#define LM3S_SYSCON_DID1 (LM3S_SYSCON_BASE + LM3S_SYSCON_DID1_OFFSET) -#define LM3S_SYSCON_DC0 (LM3S_SYSCON_BASE + LM3S_SYSCON_DC0_OFFSET) -#define LM3S_SYSCON_DC1 (LM3S_SYSCON_BASE + LM3S_SYSCON_DC1_OFFSET) -#define LM3S_SYSCON_DC2 (LM3S_SYSCON_BASE + LM3S_SYSCON_DC2_OFFSET) -#define LM3S_SYSCON_DC3 (LM3S_SYSCON_BASE + LM3S_SYSCON_DC3_OFFSET) -#define LM3S_SYSCON_DC4 (LM3S_SYSCON_BASE + LM3S_SYSCON_DC4_OFFSET) -#define LM3S_SYSCON_PBORCTL (LM3S_SYSCON_BASE + LM3S_SYSCON_PBORCTL_OFFSET) -#define LM3S_SYSCON_LDOPCTL (LM3S_SYSCON_BASE + LM3S_SYSCON_LDOPCTL_OFFSET) -#define LM3S_SYSCON_SRCR0 (LM3S_SYSCON_BASE + LM3S_SYSCON_SRCR0_OFFSET) -#define LM3S_SYSCON_SRCR1 (LM3S_SYSCON_BASE + LM3S_SYSCON_SRCR1_OFFSET) -#define LM3S_SYSCON_SRCR2 (LM3S_SYSCON_BASE + LM3S_SYSCON_SRCR2_OFFSET) -#define LM3S_SYSCON_RIS (LM3S_SYSCON_BASE + LM3S_SYSCON_RIS_OFFSET) -#define LM3S_SYSCON_IMC (LM3S_SYSCON_BASE + LM3S_SYSCON_IMC_OFFSET) -#define LM3S_SYSCON_MISC (LM3S_SYSCON_BASE + LM3S_SYSCON_MISC_OFFSET) -#define LM3S_SYSCON_RESC (LM3S_SYSCON_BASE + LM3S_SYSCON_RESC_OFFSET) -#define LM3S_SYSCON_RCC (LM3S_SYSCON_BASE + LM3S_SYSCON_RCC_OFFSET) -#define LM3S_SYSCON_PLLCFG (LM3S_SYSCON_BASE + LM3S_SYSCON_PLLCFG_OFFSET) -#define LM3S_SYSCON_RCC2 (LM3S_SYSCON_BASE + LM3S_SYSCON_RCC2_OFFSET) -#define LM3S_SYSCON_RCGC0 (LM3S_SYSCON_BASE + LM3S_SYSCON_RCGC0_OFFSET) -#define LM3S_SYSCON_RCGC1 (LM3S_SYSCON_BASE + LM3S_SYSCON_RCGC1_OFFSET) -#define LM3S_SYSCON_RCGC2 (LM3S_SYSCON_BASE + LM3S_SYSCON_RCGC2_OFFSET) -#define LM3S_SYSCON_SCGC0 (LM3S_SYSCON_BASE + LM3S_SYSCON_SCGC0_OFFSET) -#define LM3S_SYSCON_SCGC1 (LM3S_SYSCON_BASE + LM3S_SYSCON_SCGC1_OFFSET) -#define LM3S_SYSCON_SCGC2 (LM3S_SYSCON_BASE + LM3S_SYSCON_SCGC2_OFFSET) -#define LM3S_SYSCON_DCGC0 (LM3S_SYSCON_BASE + LM3S_SYSCON_DCGC0_OFFSET) -#define LM3S_SYSCON_DCGC1 (LM3S_SYSCON_BASE + LM3S_SYSCON_DCGC1_OFFSET) -#define LM3S_SYSCON_DCGC2 (LM3S_SYSCON_BASE + LM3S_SYSCON_DCGC2_OFFSET) -#define LM3S_SYSCON_DSLPCLKCFG (LM3S_SYSCON_BASE + LM3S_SYSCON_DSLPCLKCFG_OFFSET) +#define LM_SYSCON_DID0 (LM_SYSCON_BASE + LM_SYSCON_DID0_OFFSET) +#define LM_SYSCON_DID1 (LM_SYSCON_BASE + LM_SYSCON_DID1_OFFSET) +#define LM_SYSCON_DC0 (LM_SYSCON_BASE + LM_SYSCON_DC0_OFFSET) +#define LM_SYSCON_DC1 (LM_SYSCON_BASE + LM_SYSCON_DC1_OFFSET) +#define LM_SYSCON_DC2 (LM_SYSCON_BASE + LM_SYSCON_DC2_OFFSET) +#define LM_SYSCON_DC3 (LM_SYSCON_BASE + LM_SYSCON_DC3_OFFSET) +#define LM_SYSCON_DC4 (LM_SYSCON_BASE + LM_SYSCON_DC4_OFFSET) +#define LM_SYSCON_PBORCTL (LM_SYSCON_BASE + LM_SYSCON_PBORCTL_OFFSET) +#define LM_SYSCON_LDOPCTL (LM_SYSCON_BASE + LM_SYSCON_LDOPCTL_OFFSET) +#define LM_SYSCON_SRCR0 (LM_SYSCON_BASE + LM_SYSCON_SRCR0_OFFSET) +#define LM_SYSCON_SRCR1 (LM_SYSCON_BASE + LM_SYSCON_SRCR1_OFFSET) +#define LM_SYSCON_SRCR2 (LM_SYSCON_BASE + LM_SYSCON_SRCR2_OFFSET) +#define LM_SYSCON_RIS (LM_SYSCON_BASE + LM_SYSCON_RIS_OFFSET) +#define LM_SYSCON_IMC (LM_SYSCON_BASE + LM_SYSCON_IMC_OFFSET) +#define LM_SYSCON_MISC (LM_SYSCON_BASE + LM_SYSCON_MISC_OFFSET) +#define LM_SYSCON_RESC (LM_SYSCON_BASE + LM_SYSCON_RESC_OFFSET) +#define LM_SYSCON_RCC (LM_SYSCON_BASE + LM_SYSCON_RCC_OFFSET) +#define LM_SYSCON_PLLCFG (LM_SYSCON_BASE + LM_SYSCON_PLLCFG_OFFSET) +#define LM_SYSCON_RCC2 (LM_SYSCON_BASE + LM_SYSCON_RCC2_OFFSET) +#define LM_SYSCON_RCGC0 (LM_SYSCON_BASE + LM_SYSCON_RCGC0_OFFSET) +#define LM_SYSCON_RCGC1 (LM_SYSCON_BASE + LM_SYSCON_RCGC1_OFFSET) +#define LM_SYSCON_RCGC2 (LM_SYSCON_BASE + LM_SYSCON_RCGC2_OFFSET) +#define LM_SYSCON_SCGC0 (LM_SYSCON_BASE + LM_SYSCON_SCGC0_OFFSET) +#define LM_SYSCON_SCGC1 (LM_SYSCON_BASE + LM_SYSCON_SCGC1_OFFSET) +#define LM_SYSCON_SCGC2 (LM_SYSCON_BASE + LM_SYSCON_SCGC2_OFFSET) +#define LM_SYSCON_DCGC0 (LM_SYSCON_BASE + LM_SYSCON_DCGC0_OFFSET) +#define LM_SYSCON_DCGC1 (LM_SYSCON_BASE + LM_SYSCON_DCGC1_OFFSET) +#define LM_SYSCON_DCGC2 (LM_SYSCON_BASE + LM_SYSCON_DCGC2_OFFSET) +#define LM_SYSCON_DSLPCLKCFG (LM_SYSCON_BASE + LM_SYSCON_DSLPCLKCFG_OFFSET) /* System Control Register Bit Definitions ******************************************/ @@ -492,4 +492,4 @@ * Public Functions ************************************************************************************/ -#endif /* __ARCH_ARM_SRC_LM_CHIP_LM3S_SYSCONTROL_H */ +#endif /* __ARCH_ARM_SRC_LM_CHIP_LM_SYSCONTROL_H */ diff --git a/nuttx/arch/arm/src/lm/chip/lm_timer.h b/nuttx/arch/arm/src/lm/chip/lm_timer.h index f2824ce1fe..5ed68f13a0 100644 --- a/nuttx/arch/arm/src/lm/chip/lm_timer.h +++ b/nuttx/arch/arm/src/lm/chip/lm_timer.h @@ -33,8 +33,8 @@ * ************************************************************************************/ -#ifndef __ARCH_ARM_SRC_LM_CHIP_LM3S_TIMER_H -#define __ARCH_ARM_SRC_LM_CHIP_LM3S_TIMER_H +#ifndef __ARCH_ARM_SRC_LM_CHIP_LM_TIMER_H +#define __ARCH_ARM_SRC_LM_CHIP_LM_TIMER_H /************************************************************************************ * Included Files @@ -46,27 +46,27 @@ /* Timer register offsets ***********************************************************/ -#define TIMER_GPTMCFG_OFFSET 0x000 -#define TIMER_GPTMTAMR_OFFSET 0x004 -#define TIMER_GPTMCTL_OFFSET 0x00C -#define TIMER_GPTMIMR_OFFSET 0x018 -#define TIMER_GPTMRIS_OFFSET 0x01C -#define TIMER_GPTMICR_OFFSET 0x024 -#define TIMER_GPTMTAILR_OFFSET 0x028 -#define TIMER_GPTMTAR_OFFSET 0x048 +#define LM_TIMER_GPTMCFG_OFFSET 0x000 +#define LM_TIMER_GPTMTAMR_OFFSET 0x004 +#define LM_TIMER_GPTMCTL_OFFSET 0x00c +#define LM_TIMER_GPTMIMR_OFFSET 0x018 +#define LM_TIMER_GPTMRIS_OFFSET 0x01c +#define LM_TIMER_GPTMICR_OFFSET 0x024 +#define LM_TIMER_GPTMTAILR_OFFSET 0x028 +#define LM_TIMER_GPTMTAR_OFFSET 0x048 /* SSI register addresses ***********************************************************/ -#define LM3S_TIMER_BASE(n) (LM3S_TIMER0_BASE + (n)*0x01000) +#define LM_TIMER_BASE(n) (LM_TIMER0_BASE + (n)*0x01000) -#define LM3S_TIMER_GPTMCFG(n) (LM3S_TIMER_BASE(n) + TIMER_GPTMCFG_OFFSET) -#define LM3S_TIMER_GPTMTAMR(n) (LM3S_TIMER_BASE(n) + TIMER_GPTMTAMR_OFFSET) -#define LM3S_TIMER_GPTMCTL(n) (LM3S_TIMER_BASE(n) + TIMER_GPTMCTL_OFFSET) -#define LM3S_TIMER_GPTMIMR(n) (LM3S_TIMER_BASE(n) + TIMER_GPTMIMR_OFFSET) -#define LM3S_TIMER_GPTMRIS(n) (LM3S_TIMER_BASE(n) + TIMER_GPTMRIS_OFFSET) -#define LM3S_TIMER_GPTMICR(n) (LM3S_TIMER_BASE(n) + TIMER_GPTMICR_OFFSET) -#define LM3S_TIMER_GPTMTAILR(n) (LM3S_TIMER_BASE(n) + TIMER_GPTMTAILR_OFFSET) -#define LM3S_TIMER_GPTMTAR(n) (LM3S_TIMER_BASE(n) + TIMER_GPTMTAR_OFFSET) +#define LM_TIMER_GPTMCFG(n) (LM_TIMER_BASE(n) + LM_TIMER_GPTMCFG_OFFSET) +#define LM_TIMER_GPTMTAMR(n) (LM_TIMER_BASE(n) + LM_TIMER_GPTMTAMR_OFFSET) +#define LM_TIMER_GPTMCTL(n) (LM_TIMER_BASE(n) + LM_TIMER_GPTMCTL_OFFSET) +#define LM_TIMER_GPTMIMR(n) (LM_TIMER_BASE(n) + LM_TIMER_GPTMIMR_OFFSET) +#define LM_TIMER_GPTMRIS(n) (LM_TIMER_BASE(n) + LM_TIMER_GPTMRIS_OFFSET) +#define LM_TIMER_GPTMICR(n) (LM_TIMER_BASE(n) + LM_TIMER_GPTMICR_OFFSET) +#define LM_TIMER_GPTMTAILR(n) (LM_TIMER_BASE(n) + LM_TIMER_GPTMTAILR_OFFSET) +#define LM_TIMER_GPTMTAR(n) (LM_TIMER_BASE(n) + LM_TIMER_GPTMTAR_OFFSET) /* SSI register bit defitiions ******************************************************/ @@ -122,4 +122,4 @@ #define TIMER_GPTMICR_TATOCINT_SHIFT 0 /* Bits 0: GPTM Timer A Time-Out Raw Interrupt Clear*/ #define TIMER_GPTMICR_TATOCINT_MASK (0x01 << TIMER_GPTMICR_TATOCINT_SHIFT) -#endif /* __ARCH_ARM_SRC_LM_CHIP_LM3S_TIMER_H */ +#endif /* __ARCH_ARM_SRC_LM_CHIP_LM_TIMER_H */ diff --git a/nuttx/arch/arm/src/lm/chip/lm_uart.h b/nuttx/arch/arm/src/lm/chip/lm_uart.h index 9a03ff063d..2ad0652946 100644 --- a/nuttx/arch/arm/src/lm/chip/lm_uart.h +++ b/nuttx/arch/arm/src/lm/chip/lm_uart.h @@ -33,8 +33,8 @@ * ************************************************************************************/ -#ifndef __ARCH_ARM_SRC_LM_CHIP_LM3S_UART_H -#define __ARCH_ARM_SRC_LM_CHIP_LM3S_UART_H +#ifndef __ARCH_ARM_SRC_LM_CHIP_LM_UART_H +#define __ARCH_ARM_SRC_LM_CHIP_LM_UART_H /************************************************************************************ * Included Files @@ -48,117 +48,117 @@ /* UART register offsets ************************************************************/ -#define LM3S_UART_DR_OFFSET 0x000 /* UART Data */ -#define LM3S_UART_RSR_OFFSET 0x004 /* UART Receive Status */ -#define LM3S_UART_ECR_OFFSET 0x004 /* UART Error Clear */ -#define LM3S_UART_FR_OFFSET 0x018 /* UART Flag */ -#define LM3S_UART_ILPR_OFFSET 0x020 /* UART IrDA Low-Power Register */ -#define LM3S_UART_IBRD_OFFSET 0x024 /* UART Integer Baud-Rate Divisor*/ -#define LM3S_UART_FBRD_OFFSET 0x028 /* UART Fractional Baud-Rate Divisor */ -#define LM3S_UART_LCRH_OFFSET 0x02c /* UART Line Control */ -#define LM3S_UART_CTL_OFFSET 0x030 /* UART Control */ -#define LM3S_UART_IFLS_OFFSET 0x034 /* UART Interrupt FIFO Level Select */ -#define LM3S_UART_IM_OFFSET 0x038 /* UART Interrupt Mask */ -#define LM3S_UART_RIS_OFFSET 0x03c /* UART Raw Interrupt Status */ -#define LM3S_UART_MIS_OFFSET 0x040 /* UART Masked Interrupt Status */ -#define LM3S_UART_ICR_OFFSET 0x044 /* UART Interrupt Clear */ -#define LM3S_UART_PERIPHID4_OFFSET 0xfd0 /* UART Peripheral Identification 4 */ -#define LM3S_UART_PERIPHID5_OFFSET 0xfd4 /* UART Peripheral Identification 5 */ -#define LM3S_UART_PERIPHID6_OFFSET 0xfd8 /* UART Peripheral Identification 6 */ -#define LM3S_UART_PERIPHID7_OFFSET 0xfdc /* UART Peripheral Identification 7 */ -#define LM3S_UART_PERIPHID0_OFFSET 0xfe0 /* UART Peripheral Identification 0 */ -#define LM3S_UART_PERIPHID1_OFFSET 0xfe4 /* UART Peripheral Identification 1 */ -#define LM3S_UART_PERIPHID2_OFFSET 0xfe8 /* UART Peripheral Identification 2 */ -#define LM3S_UART_PERIPHID3_OFFSET 0xfec /* UART Peripheral Identification 3 */ -#define LM3S_UART_PCELLID0_OFFSET 0xff0 /* UART PrimeCell Identification 0 */ -#define LM3S_UART_PCELLID1_OFFSET 0xff4 /* UART PrimeCell Identification 1 */ -#define LM3S_UART_PCELLID2_OFFSET 0xff8 /* UART PrimeCell Identification 2 */ -#define LM3S_UART_PCELLID3_OFFSET 0xffc /* UART PrimeCell Identification 3 */ +#define LM_UART_DR_OFFSET 0x000 /* UART Data */ +#define LM_UART_RSR_OFFSET 0x004 /* UART Receive Status */ +#define LM_UART_ECR_OFFSET 0x004 /* UART Error Clear */ +#define LM_UART_FR_OFFSET 0x018 /* UART Flag */ +#define LM_UART_ILPR_OFFSET 0x020 /* UART IrDA Low-Power Register */ +#define LM_UART_IBRD_OFFSET 0x024 /* UART Integer Baud-Rate Divisor*/ +#define LM_UART_FBRD_OFFSET 0x028 /* UART Fractional Baud-Rate Divisor */ +#define LM_UART_LCRH_OFFSET 0x02c /* UART Line Control */ +#define LM_UART_CTL_OFFSET 0x030 /* UART Control */ +#define LM_UART_IFLS_OFFSET 0x034 /* UART Interrupt FIFO Level Select */ +#define LM_UART_IM_OFFSET 0x038 /* UART Interrupt Mask */ +#define LM_UART_RIS_OFFSET 0x03c /* UART Raw Interrupt Status */ +#define LM_UART_MIS_OFFSET 0x040 /* UART Masked Interrupt Status */ +#define LM_UART_ICR_OFFSET 0x044 /* UART Interrupt Clear */ +#define LM_UART_PERIPHID4_OFFSET 0xfd0 /* UART Peripheral Identification 4 */ +#define LM_UART_PERIPHID5_OFFSET 0xfd4 /* UART Peripheral Identification 5 */ +#define LM_UART_PERIPHID6_OFFSET 0xfd8 /* UART Peripheral Identification 6 */ +#define LM_UART_PERIPHID7_OFFSET 0xfdc /* UART Peripheral Identification 7 */ +#define LM_UART_PERIPHID0_OFFSET 0xfe0 /* UART Peripheral Identification 0 */ +#define LM_UART_PERIPHID1_OFFSET 0xfe4 /* UART Peripheral Identification 1 */ +#define LM_UART_PERIPHID2_OFFSET 0xfe8 /* UART Peripheral Identification 2 */ +#define LM_UART_PERIPHID3_OFFSET 0xfec /* UART Peripheral Identification 3 */ +#define LM_UART_PCELLID0_OFFSET 0xff0 /* UART PrimeCell Identification 0 */ +#define LM_UART_PCELLID1_OFFSET 0xff4 /* UART PrimeCell Identification 1 */ +#define LM_UART_PCELLID2_OFFSET 0xff8 /* UART PrimeCell Identification 2 */ +#define LM_UART_PCELLID3_OFFSET 0xffc /* UART PrimeCell Identification 3 */ /* UART register addresses **********************************************************/ -#define LM3S_UART_BASE(n) (LM3S_UART0_BASE + (n)*0x01000) +#define LM_UART_BASE(n) (LM_UART0_BASE + (n)*0x01000) -#define LM3S_UART_DR(n) (LM3S_UART_BASE(n) + LM3S_UART_DR_OFFSET) -#define LM3S_UART_RSR(n) (LM3S_UART_BASE(n) + LM3S_UART_RSR_OFFSET) -#define LM3S_UART_ECR(n) (LM3S_UART_BASE(n) + LM3S_UART_ECR_OFFSET) -#define LM3S_UART_FR(n) (LM3S_UART_BASE(n) + LM3S_UART_FR_OFFSET) -#define LM3S_UART_ILPR(n) (LM3S_UART_BASE(n) + LM3S_UART_ILPR_OFFSET) -#define LM3S_UART_IBRD(n) (LM3S_UART_BASE(n) + LM3S_UART_IBRD_OFFSET) -#define LM3S_UART_FBRD(n) (LM3S_UART_BASE(n) + LM3S_UART_FBRD_OFFSET) -#define LM3S_UART_LCRH(n) (LM3S_UART_BASE(n) + LM3S_UART_LCRH_OFFSET) -#define LM3S_UART_CTL(n) (LM3S_UART_BASE(n) + LM3S_UART_CTL_OFFSET) -#define LM3S_UART_IFLS(n) (LM3S_UART_BASE(n) + LM3S_UART_IFLS_OFFSET) -#define LM3S_UART_IM(n) (LM3S_UART_BASE(n) + LM3S_UART_IM_OFFSET) -#define LM3S_UART_RIS(n) (LM3S_UART_BASE(n) + LM3S_UART_RIS_OFFSET) -#define LM3S_UART_MIS(n) (LM3S_UART_BASE(n) + LM3S_UART_MIS_OFFSET) -#define LM3S_UART_ICR(n) (LM3S_UART_BASE(n) + LM3S_UART_ICR_OFFSET) -#define LM3S_UART_PERIPHID4(n) (LM3S_UART_BASE(n) + LM3S_UART_PERIPHID4_OFFSET) -#define LM3S_UART_PERIPHID5(n) (LM3S_UART_BASE(n) + LM3S_UART_PERIPHID5_OFFSET) -#define LM3S_UART_PERIPHID6(n) (LM3S_UART_BASE(n) + LM3S_UART_PERIPHID6_OFFSET) -#define LM3S_UART_PERIPHID7(n) (LM3S_UART_BASE(n) + LM3S_UART_PERIPHID7_OFFSET) -#define LM3S_UART_PERIPHID0(n) (LM3S_UART_BASE(n) + LM3S_UART_PERIPHID0_OFFSET) -#define LM3S_UART_PERIPHID1(n) (LM3S_UART_BASE(n) + LM3S_UART_PERIPHID1_OFFSET) -#define LM3S_UART_PERIPHID2(n) (LM3S_UART_BASE(n) + LM3S_UART_PERIPHID2_OFFSET) -#define LM3S_UART_PERIPHID3(n) (LM3S_UART_BASE(n) + LM3S_UART_PERIPHID3_OFFSET) -#define LM3S_UART_PCELLID0(n) (LM3S_UART_BASE(n) + LM3S_UART_PCELLID0_OFFSET) -#define LM3S_UART_PCELLID1(n) (LM3S_UART_BASE(n) + LM3S_UART_PCELLID1_OFFSET) -#define LM3S_UART_PCELLID2(n) (LM3S_UART_BASE(n) + LM3S_UART_PCELLID2_OFFSET) -#define LM3S_UART_PCELLID3(n) (LM3S_UART_BASE(n) + LM3S_UART_PCELLID3_OFFSET) +#define LM_UART_DR(n) (LM_UART_BASE(n) + LM_UART_DR_OFFSET) +#define LM_UART_RSR(n) (LM_UART_BASE(n) + LM_UART_RSR_OFFSET) +#define LM_UART_ECR(n) (LM_UART_BASE(n) + LM_UART_ECR_OFFSET) +#define LM_UART_FR(n) (LM_UART_BASE(n) + LM_UART_FR_OFFSET) +#define LM_UART_ILPR(n) (LM_UART_BASE(n) + LM_UART_ILPR_OFFSET) +#define LM_UART_IBRD(n) (LM_UART_BASE(n) + LM_UART_IBRD_OFFSET) +#define LM_UART_FBRD(n) (LM_UART_BASE(n) + LM_UART_FBRD_OFFSET) +#define LM_UART_LCRH(n) (LM_UART_BASE(n) + LM_UART_LCRH_OFFSET) +#define LM_UART_CTL(n) (LM_UART_BASE(n) + LM_UART_CTL_OFFSET) +#define LM_UART_IFLS(n) (LM_UART_BASE(n) + LM_UART_IFLS_OFFSET) +#define LM_UART_IM(n) (LM_UART_BASE(n) + LM_UART_IM_OFFSET) +#define LM_UART_RIS(n) (LM_UART_BASE(n) + LM_UART_RIS_OFFSET) +#define LM_UART_MIS(n) (LM_UART_BASE(n) + LM_UART_MIS_OFFSET) +#define LM_UART_ICR(n) (LM_UART_BASE(n) + LM_UART_ICR_OFFSET) +#define LM_UART_PERIPHID4(n) (LM_UART_BASE(n) + LM_UART_PERIPHID4_OFFSET) +#define LM_UART_PERIPHID5(n) (LM_UART_BASE(n) + LM_UART_PERIPHID5_OFFSET) +#define LM_UART_PERIPHID6(n) (LM_UART_BASE(n) + LM_UART_PERIPHID6_OFFSET) +#define LM_UART_PERIPHID7(n) (LM_UART_BASE(n) + LM_UART_PERIPHID7_OFFSET) +#define LM_UART_PERIPHID0(n) (LM_UART_BASE(n) + LM_UART_PERIPHID0_OFFSET) +#define LM_UART_PERIPHID1(n) (LM_UART_BASE(n) + LM_UART_PERIPHID1_OFFSET) +#define LM_UART_PERIPHID2(n) (LM_UART_BASE(n) + LM_UART_PERIPHID2_OFFSET) +#define LM_UART_PERIPHID3(n) (LM_UART_BASE(n) + LM_UART_PERIPHID3_OFFSET) +#define LM_UART_PCELLID0(n) (LM_UART_BASE(n) + LM_UART_PCELLID0_OFFSET) +#define LM_UART_PCELLID1(n) (LM_UART_BASE(n) + LM_UART_PCELLID1_OFFSET) +#define LM_UART_PCELLID2(n) (LM_UART_BASE(n) + LM_UART_PCELLID2_OFFSET) +#define LM_UART_PCELLID3(n) (LM_UART_BASE(n) + LM_UART_PCELLID3_OFFSET) -#define LM3S_UART0_DR (LM3S_UART0_BASE + LM3S_UART_TDR_OFFSET) -#define LM3S_UART0_RSR (LM3S_UART0_BASE + LM3S_UART_RSR_OFFSET) -#define LM3S_UART0_ECR (LM3S_UART0_BASE + LM3S_UART_ECR_OFFSET) -#define LM3S_UART0_FR (LM3S_UART0_BASE + LM3S_UART_FR_OFFSET) -#define LM3S_UART0_ILPR (LM3S_UART0_BASE + LM3S_UART_ILPR_OFFSET) -#define LM3S_UART0_IBRD (LM3S_UART0_BASE + LM3S_UART_IBRD_OFFSET) -#define LM3S_UART0_FBRD (LM3S_UART0_BASE + LM3S_UART_FBRD_OFFSET) -#define LM3S_UART0_LCRH (LM3S_UART0_BASE + LM3S_UART_LCRH_OFFSET) -#define LM3S_UART0_CTL (LM3S_UART0_BASE + LM3S_UART_CTL_OFFSET) -#define LM3S_UART0_IFLS (LM3S_UART0_BASE + LM3S_UART_IFLS_OFFSET) -#define LM3S_UART0_IM (LM3S_UART0_BASE + LM3S_UART_IM_OFFSET) -#define LM3S_UART0_RIS (LM3S_UART0_BASE + LM3S_UART_RIS_OFFSET) -#define LM3S_UART0_MIS (LM3S_UART0_BASE + LM3S_UART_MIS_OFFSET) -#define LM3S_UART0_ICR (LM3S_UART0_BASE + LM3S_UART_ICR_OFFSET) -#define LM3S_UART0_PERIPHID4 (LM3S_UART0_BASE + LM3S_UART_PERIPHID4_OFFSET) -#define LM3S_UART0_PERIPHID5 (LM3S_UART0_BASE + LM3S_UART_PERIPHID5_OFFSET) -#define LM3S_UART0_PERIPHID6 (LM3S_UART0_BASE + LM3S_UART_PERIPHID6_OFFSET) -#define LM3S_UART0_PERIPHID7 (LM3S_UART0_BASE + LM3S_UART_PERIPHID7_OFFSET) -#define LM3S_UART0_PERIPHID0 (LM3S_UART0_BASE + LM3S_UART_PERIPHID0_OFFSET) -#define LM3S_UART0_PERIPHID1 (LM3S_UART0_BASE + LM3S_UART_PERIPHID1_OFFSET) -#define LM3S_UART0_PERIPHID2 (LM3S_UART0_BASE + LM3S_UART_PERIPHID2_OFFSET) -#define LM3S_UART0_PERIPHID3 (LM3S_UART0_BASE + LM3S_UART_PERIPHID3_OFFSET) -#define LM3S_UART0_PCELLID0 (LM3S_UART0_BASE + LM3S_UART_PCELLID0_OFFSET) -#define LM3S_UART0_PCELLID1 (LM3S_UART0_BASE + LM3S_UART_PCELLID1_OFFSET) -#define LM3S_UART0_PCELLID2 (LM3S_UART0_BASE + LM3S_UART_PCELLID2_OFFSET) -#define LM3S_UART0_PCELLID3 (LM3S_UART0_BASE + LM3S_UART_PCELLID3_OFFSET) +#define LM_UART0_DR (LM_UART0_BASE + LM_UART_TDR_OFFSET) +#define LM_UART0_RSR (LM_UART0_BASE + LM_UART_RSR_OFFSET) +#define LM_UART0_ECR (LM_UART0_BASE + LM_UART_ECR_OFFSET) +#define LM_UART0_FR (LM_UART0_BASE + LM_UART_FR_OFFSET) +#define LM_UART0_ILPR (LM_UART0_BASE + LM_UART_ILPR_OFFSET) +#define LM_UART0_IBRD (LM_UART0_BASE + LM_UART_IBRD_OFFSET) +#define LM_UART0_FBRD (LM_UART0_BASE + LM_UART_FBRD_OFFSET) +#define LM_UART0_LCRH (LM_UART0_BASE + LM_UART_LCRH_OFFSET) +#define LM_UART0_CTL (LM_UART0_BASE + LM_UART_CTL_OFFSET) +#define LM_UART0_IFLS (LM_UART0_BASE + LM_UART_IFLS_OFFSET) +#define LM_UART0_IM (LM_UART0_BASE + LM_UART_IM_OFFSET) +#define LM_UART0_RIS (LM_UART0_BASE + LM_UART_RIS_OFFSET) +#define LM_UART0_MIS (LM_UART0_BASE + LM_UART_MIS_OFFSET) +#define LM_UART0_ICR (LM_UART0_BASE + LM_UART_ICR_OFFSET) +#define LM_UART0_PERIPHID4 (LM_UART0_BASE + LM_UART_PERIPHID4_OFFSET) +#define LM_UART0_PERIPHID5 (LM_UART0_BASE + LM_UART_PERIPHID5_OFFSET) +#define LM_UART0_PERIPHID6 (LM_UART0_BASE + LM_UART_PERIPHID6_OFFSET) +#define LM_UART0_PERIPHID7 (LM_UART0_BASE + LM_UART_PERIPHID7_OFFSET) +#define LM_UART0_PERIPHID0 (LM_UART0_BASE + LM_UART_PERIPHID0_OFFSET) +#define LM_UART0_PERIPHID1 (LM_UART0_BASE + LM_UART_PERIPHID1_OFFSET) +#define LM_UART0_PERIPHID2 (LM_UART0_BASE + LM_UART_PERIPHID2_OFFSET) +#define LM_UART0_PERIPHID3 (LM_UART0_BASE + LM_UART_PERIPHID3_OFFSET) +#define LM_UART0_PCELLID0 (LM_UART0_BASE + LM_UART_PCELLID0_OFFSET) +#define LM_UART0_PCELLID1 (LM_UART0_BASE + LM_UART_PCELLID1_OFFSET) +#define LM_UART0_PCELLID2 (LM_UART0_BASE + LM_UART_PCELLID2_OFFSET) +#define LM_UART0_PCELLID3 (LM_UART0_BASE + LM_UART_PCELLID3_OFFSET) -#define LM3S_UART1_DR (LM3S_UART1_BASE + LM3S_UART_DR_OFFSET) -#define LM3S_UART1_RSR (LM3S_UART1_BASE + LM3S_UART_RSR_OFFSET) -#define LM3S_UART1_ECR (LM3S_UART1_BASE + LM3S_UART_ECR_OFFSET) -#define LM3S_UART1_FR (LM3S_UART1_BASE + LM3S_UART_FR_OFFSET) -#define LM3S_UART1_ILPR (LM3S_UART1_BASE + LM3S_UART_ILPR_OFFSET) -#define LM3S_UART1_IBRD (LM3S_UART1_BASE + LM3S_UART_IBRD_OFFSET) -#define LM3S_UART1_FBRD (LM3S_UART1_BASE + LM3S_UART_FBRD_OFFSET) -#define LM3S_UART1_LCRH (LM3S_UART1_BASE + LM3S_UART_LCRH_OFFSET) -#define LM3S_UART1_CTL (LM3S_UART1_BASE + LM3S_UART_CTL_OFFSET) -#define LM3S_UART1_IFLS (LM3S_UART1_BASE + LM3S_UART_IFLS_OFFSET) -#define LM3S_UART1_IM (LM3S_UART1_BASE + LM3S_UART_IM_OFFSET) -#define LM3S_UART1_RIS (LM3S_UART1_BASE + LM3S_UART_RIS_OFFSET) -#define LM3S_UART1_MIS (LM3S_UART1_BASE + LM3S_UART_MIS_OFFSET) -#define LM3S_UART1_ICR (LM3S_UART1_BASE + LM3S_UART_ICR_OFFSET) -#define LM3S_UART1_PERIPHID4 (LM3S_UART1_BASE + LM3S_UART_PERIPHID4_OFFSET) -#define LM3S_UART1_PERIPHID5 (LM3S_UART1_BASE + LM3S_UART_PERIPHID5_OFFSET) -#define LM3S_UART1_PERIPHID6 (LM3S_UART1_BASE + LM3S_UART_PERIPHID6_OFFSET) -#define LM3S_UART1_PERIPHID7 (LM3S_UART1_BASE + LM3S_UART_PERIPHID7_OFFSET) -#define LM3S_UART1_PERIPHID0 (LM3S_UART1_BASE + LM3S_UART_PERIPHID0_OFFSET) -#define LM3S_UART1_PERIPHID1 (LM3S_UART1_BASE + LM3S_UART_PERIPHID1_OFFSET) -#define LM3S_UART1_PERIPHID2 (LM3S_UART1_BASE + LM3S_UART_PERIPHID2_OFFSET) -#define LM3S_UART1_PERIPHID3 (LM3S_UART1_BASE + LM3S_UART_PERIPHID3_OFFSET) -#define LM3S_UART1_PCELLID0 (LM3S_UART1_BASE + LM3S_UART_PCELLID0_OFFSET) -#define LM3S_UART1_PCELLID1 (LM3S_UART1_BASE + LM3S_UART_PCELLID1_OFFSET) -#define LM3S_UART1_PCELLID2 (LM3S_UART1_BASE + LM3S_UART_PCELLID2_OFFSET) -#define LM3S_UART1_PCELLID3 (LM3S_UART1_BASE + LM3S_UART_PCELLID3_OFFSET) +#define LM_UART1_DR (LM_UART1_BASE + LM_UART_DR_OFFSET) +#define LM_UART1_RSR (LM_UART1_BASE + LM_UART_RSR_OFFSET) +#define LM_UART1_ECR (LM_UART1_BASE + LM_UART_ECR_OFFSET) +#define LM_UART1_FR (LM_UART1_BASE + LM_UART_FR_OFFSET) +#define LM_UART1_ILPR (LM_UART1_BASE + LM_UART_ILPR_OFFSET) +#define LM_UART1_IBRD (LM_UART1_BASE + LM_UART_IBRD_OFFSET) +#define LM_UART1_FBRD (LM_UART1_BASE + LM_UART_FBRD_OFFSET) +#define LM_UART1_LCRH (LM_UART1_BASE + LM_UART_LCRH_OFFSET) +#define LM_UART1_CTL (LM_UART1_BASE + LM_UART_CTL_OFFSET) +#define LM_UART1_IFLS (LM_UART1_BASE + LM_UART_IFLS_OFFSET) +#define LM_UART1_IM (LM_UART1_BASE + LM_UART_IM_OFFSET) +#define LM_UART1_RIS (LM_UART1_BASE + LM_UART_RIS_OFFSET) +#define LM_UART1_MIS (LM_UART1_BASE + LM_UART_MIS_OFFSET) +#define LM_UART1_ICR (LM_UART1_BASE + LM_UART_ICR_OFFSET) +#define LM_UART1_PERIPHID4 (LM_UART1_BASE + LM_UART_PERIPHID4_OFFSET) +#define LM_UART1_PERIPHID5 (LM_UART1_BASE + LM_UART_PERIPHID5_OFFSET) +#define LM_UART1_PERIPHID6 (LM_UART1_BASE + LM_UART_PERIPHID6_OFFSET) +#define LM_UART1_PERIPHID7 (LM_UART1_BASE + LM_UART_PERIPHID7_OFFSET) +#define LM_UART1_PERIPHID0 (LM_UART1_BASE + LM_UART_PERIPHID0_OFFSET) +#define LM_UART1_PERIPHID1 (LM_UART1_BASE + LM_UART_PERIPHID1_OFFSET) +#define LM_UART1_PERIPHID2 (LM_UART1_BASE + LM_UART_PERIPHID2_OFFSET) +#define LM_UART1_PERIPHID3 (LM_UART1_BASE + LM_UART_PERIPHID3_OFFSET) +#define LM_UART1_PCELLID0 (LM_UART1_BASE + LM_UART_PCELLID0_OFFSET) +#define LM_UART1_PCELLID1 (LM_UART1_BASE + LM_UART_PCELLID1_OFFSET) +#define LM_UART1_PCELLID2 (LM_UART1_BASE + LM_UART_PCELLID2_OFFSET) +#define LM_UART1_PCELLID3 (LM_UART1_BASE + LM_UART_PCELLID3_OFFSET) /* UART register bit settings *******************************************************/ @@ -275,62 +275,62 @@ /* UART Interrupt Clear (ICR), offset 0x044 */ -#define UART_ICR_RXIC (1 << 4) /* Bit 4: Receive Interrupt Clear */ -#define UART_ICR_TXIC (1 << 5) /* Bit 5: Transmit Interrupt Clear */ -#define UART_ICR_RTIC (1 << 6) /* Bit 6: Receive Time-Out Interrupt Clear */ -#define UART_ICR_FEIC (1 << 7) /* Bit 7: Framing Error Interrupt Clear */ -#define UART_ICR_PEIC (1 << 8) /* Bit 8: Parity Error Interrupt Clear */ -#define UART_ICR_BEIC (1 << 9) /* Bit 9: Break Error Interrupt Clear */ -#define UART_ICR_OEIC (1 << 10) /* Bit 10: Overrun Error Interrupt Clear +#define UART_ICR_RXIC (1 << 4) /* Bit 4: Receive Interrupt Clear */ +#define UART_ICR_TXIC (1 << 5) /* Bit 5: Transmit Interrupt Clear */ +#define UART_ICR_RTIC (1 << 6) /* Bit 6: Receive Time-Out Interrupt Clear */ +#define UART_ICR_FEIC (1 << 7) /* Bit 7: Framing Error Interrupt Clear */ +#define UART_ICR_PEIC (1 << 8) /* Bit 8: Parity Error Interrupt Clear */ +#define UART_ICR_BEIC (1 << 9) /* Bit 9: Break Error Interrupt Clear */ +#define UART_ICR_OEIC (1 << 10) /* Bit 10: Overrun Error Interrupt Clear */ /* UART Peripheral Identification 4 (PERIPHID4), offset 0xfd0 */ -#define UART_PERIPHID4_MASK (0xff) /* UART Peripheral ID Register[7:0] */ +#define UART_PERIPHID4_MASK (0xff) /* UART Peripheral ID Register[7:0] */ /* UART Peripheral Identification 5 (UARTPERIPHID5), offset 0xfd4 */ -#define UART_PERIPHID5_MASK (0xff) /* UART Peripheral ID Register[15:8] */ +#define UART_PERIPHID5_MASK (0xff) /* UART Peripheral ID Register[15:8] */ /* UART Peripheral Identification 6 (UARTPERIPHID6), offset 0xfd8 */ -#define UART_PERIPHID6_MASK (0xff) /* UART Peripheral ID Register[23:16] */ +#define UART_PERIPHID6_MASK (0xff) /* UART Peripheral ID Register[23:16] */ /* UART Peripheral Identification 7 (UARTPERIPHID7), offset 0xfdc */ -#define UART_PERIPHID7_MASK (0xff) /* UART Peripheral ID Register[31:24] */ +#define UART_PERIPHID7_MASK (0xff) /* UART Peripheral ID Register[31:24] */ /* UART Peripheral Identification 0 (UARTPERIPHID0), offset 0xfe0 */ -#define UART_PERIPHID0_MASK (0xff) /* UART Peripheral ID Register[7:0] */ +#define UART_PERIPHID0_MASK (0xff) /* UART Peripheral ID Register[7:0] */ /* UART Peripheral Identification 1 (UARTPERIPHID1), offset 0xfe4 */ -#define UART_PERIPHID1_MASK (0xff) /* UART Peripheral ID Register[15:8] */ +#define UART_PERIPHID1_MASK (0xff) /* UART Peripheral ID Register[15:8] */ /* UART Peripheral Identification 2 (UARTPERIPHID2), offset 0xfe8 */ -#define UART_PERIPHID2_MASK (0xff) /* UART Peripheral ID Register[23:16] */ +#define UART_PERIPHID2_MASK (0xff) /* UART Peripheral ID Register[23:16] */ /* UART Peripheral Identification 3 (UARTPERIPHID3), offset 0xfec */ -#define UART_PERIPHID3_MASK (0xff) /* UART Peripheral ID Register[31:24] */ +#define UART_PERIPHID3_MASK (0xff) /* UART Peripheral ID Register[31:24] */ /* UART PrimeCell Identification 0 (CELLID0), offset 0xff0 */ -#define UART_CELLID0_MASK (0xff) /* UART PrimeCell ID Register[7:0] */ +#define UART_CELLID0_MASK (0xff) /* UART PrimeCell ID Register[7:0] */ /* UART PrimeCell Identification 1 (UARTPCELLID1), offset 0xff4 */ -#define UART_CELLID1_MASK (0xff) /* UART PrimeCell ID Register[15:8] */ +#define UART_CELLID1_MASK (0xff) /* UART PrimeCell ID Register[15:8] */ /* UART PrimeCell Identification 2 (UARTPCELLID2), offset 0xff8 */ -#define UART_CELLID02MASK (0xff) /* UART PrimeCell ID Register[23:16] */ +#define UART_CELLID02MASK (0xff) /* UART PrimeCell ID Register[23:16] */ /* UART PrimeCell Identification 3 (UARTPCELLID3), offset 0xffc */ -#define UART_CELLID3_MASK (0xff) /* UART PrimeCell ID Register[31:24] */ +#define UART_CELLID3_MASK (0xff) /* UART PrimeCell ID Register[31:24] */ /************************************************************************************ * Public Types @@ -344,4 +344,4 @@ * Public Functions ************************************************************************************/ -#endif /* __ARCH_ARM_SRC_LM_CHIP_LM3S_UART_H */ +#endif /* __ARCH_ARM_SRC_LM_CHIP_LM_UART_H */ diff --git a/nuttx/arch/arm/src/lm/lm_dumpgpio.c b/nuttx/arch/arm/src/lm/lm_dumpgpio.c index a3190784b9..f71e9c9a08 100644 --- a/nuttx/arch/arm/src/lm/lm_dumpgpio.c +++ b/nuttx/arch/arm/src/lm/lm_dumpgpio.c @@ -60,19 +60,19 @@ /* NOTE: this is duplicated in lm_gpio.c */ -#ifdef LM3S_GPIOH_BASE +#ifdef LM_GPIOH_BASE static const uint32_t g_gpiobase[8] = { - LM3S_GPIOA_BASE, LM3S_GPIOB_BASE, LM3S_GPIOC_BASE, LM3S_GPIOD_BASE, - LM3S_GPIOE_BASE, LM3S_GPIOF_BASE, LM3S_GPIOG_BASE, LM3S_GPIOH_BASE, + LM_GPIOA_BASE, LM_GPIOB_BASE, LM_GPIOC_BASE, LM_GPIOD_BASE, + LM_GPIOE_BASE, LM_GPIOF_BASE, LM_GPIOG_BASE, LM_GPIOH_BASE, }; static const char g_portchar[8] = { 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H' }; #else static const uint32_t g_gpiobase[8] = { - LM3S_GPIOA_BASE, LM3S_GPIOB_BASE, LM3S_GPIOC_BASE, LM3S_GPIOD_BASE, - LM3S_GPIOE_BASE, LM3S_GPIOF_BASE, LM3S_GPIOG_BASE, 0, + LM_GPIOA_BASE, LM_GPIOB_BASE, LM_GPIOC_BASE, LM_GPIOD_BASE, + LM_GPIOE_BASE, LM_GPIOF_BASE, LM_GPIOG_BASE, 0, }; static const char g_portchar[8] = { 'A', 'B', 'C', 'D', 'E', 'F', 'G', '?' }; @@ -138,7 +138,7 @@ int lm_dumpgpio(uint32_t pinset, const char *msg) /* The following requires exclusive access to the GPIO registers */ flags = irqsave(); - rcgc2 = getreg32(LM3S_SYSCON_RCGC2); + rcgc2 = getreg32(LM_SYSCON_RCGC2); enabled = ((rcgc2 & SYSCON_RCGC2_GPIO(port)) != 0); lldbg("GPIO%c pinset: %08x base: %08x -- %s\n", @@ -151,16 +151,16 @@ int lm_dumpgpio(uint32_t pinset, const char *msg) if (enabled) { lldbg(" AFSEL: %02x DEN: %02x DIR: %02x DATA: %02x\n", - getreg32(base + LM3S_GPIO_AFSEL_OFFSET), getreg32(base + LM3S_GPIO_DEN_OFFSET), - getreg32(base + LM3S_GPIO_DIR_OFFSET), getreg32(base + LM3S_GPIO_DATA_OFFSET + 0x3fc)); + getreg32(base + LM_GPIO_AFSEL_OFFSET), getreg32(base + LM_GPIO_DEN_OFFSET), + getreg32(base + LM_GPIO_DIR_OFFSET), getreg32(base + LM_GPIO_DATA_OFFSET + 0x3fc)); lldbg(" IS: %02x IBE: %02x IEV: %02x IM: %02x RIS: %08x MIS: %08x\n", - getreg32(base + LM3S_GPIO_IEV_OFFSET), getreg32(base + LM3S_GPIO_IM_OFFSET), - getreg32(base + LM3S_GPIO_RIS_OFFSET), getreg32(base + LM3S_GPIO_MIS_OFFSET)); + getreg32(base + LM_GPIO_IEV_OFFSET), getreg32(base + LM_GPIO_IM_OFFSET), + getreg32(base + LM_GPIO_RIS_OFFSET), getreg32(base + LM_GPIO_MIS_OFFSET)); lldbg(" 2MA: %02x 4MA: %02x 8MA: %02x ODR: %02x PUR %02x PDR: %02x SLR: %02x\n", - getreg32(base + LM3S_GPIO_DR2R_OFFSET), getreg32(base + LM3S_GPIO_DR4R_OFFSET), - getreg32(base + LM3S_GPIO_DR8R_OFFSET), getreg32(base + LM3S_GPIO_ODR_OFFSET), - getreg32(base + LM3S_GPIO_PUR_OFFSET), getreg32(base + LM3S_GPIO_PDR_OFFSET), - getreg32(base + LM3S_GPIO_SLR_OFFSET)); + getreg32(base + LM_GPIO_DR2R_OFFSET), getreg32(base + LM_GPIO_DR4R_OFFSET), + getreg32(base + LM_GPIO_DR8R_OFFSET), getreg32(base + LM_GPIO_ODR_OFFSET), + getreg32(base + LM_GPIO_PUR_OFFSET), getreg32(base + LM_GPIO_PDR_OFFSET), + getreg32(base + LM_GPIO_SLR_OFFSET)); } irqrestore(flags); return OK; diff --git a/nuttx/arch/arm/src/lm/lm_ethernet.c b/nuttx/arch/arm/src/lm/lm_ethernet.c index 1d8def2e93..861d64d950 100644 --- a/nuttx/arch/arm/src/lm/lm_ethernet.c +++ b/nuttx/arch/arm/src/lm/lm_ethernet.c @@ -69,68 +69,68 @@ /* Half duplex can be forced if CONFIG_LM_ETHHDUPLEX is defined. */ #ifdef CONFIG_LM_ETHHDUPLEX -# define LM3S_DUPLEX_SETBITS 0 -# define LM3S_DUPLEX_CLRBITS MAC_TCTL_DUPLEX +# define LM_DUPLEX_SETBITS 0 +# define LM_DUPLEX_CLRBITS MAC_TCTL_DUPLEX #else -# define LM3S_DUPLEX_SETBITS MAC_TCTL_DUPLEX -# define LM3S_DUPLEX_CLRBITS 0 +# define LM_DUPLEX_SETBITS MAC_TCTL_DUPLEX +# define LM_DUPLEX_CLRBITS 0 #endif /* Auto CRC generation can be suppressed if CONFIG_LM_ETHNOAUTOCRC is definde */ #ifdef CONFIG_LM_ETHNOAUTOCRC -# define LM3S_CRC_SETBITS 0 -# define LM3S_CRC_CLRBITS MAC_TCTL_CRC +# define LM_CRC_SETBITS 0 +# define LM_CRC_CLRBITS MAC_TCTL_CRC #else -# define LM3S_CRC_SETBITS MAC_TCTL_CRC -# define LM3S_CRC_CLRBITS 0 +# define LM_CRC_SETBITS MAC_TCTL_CRC +# define LM_CRC_CLRBITS 0 #endif /* Tx padding can be suppressed if CONFIG_LM_ETHNOPAD is defined */ #ifdef CONFIG_LM_ETHNOPAD -# define LM3S_PADEN_SETBITS 0 -# define LM3S_PADEN_CLRBITS MAC_TCTL_PADEN +# define LM_PADEN_SETBITS 0 +# define LM_PADEN_CLRBITS MAC_TCTL_PADEN #else -# define LM3S_PADEN_SETBITS MAC_TCTL_PADEN -# define LM3S_PADEN_CLRBITS 0 +# define LM_PADEN_SETBITS MAC_TCTL_PADEN +# define LM_PADEN_CLRBITS 0 #endif -#define LM3S_TCTCL_SETBITS (LM3S_DUPLEX_SETBITS|LM3S_CRC_SETBITS|LM3S_PADEN_SETBITS) -#define LM3S_TCTCL_CLRBITS (LM3S_DUPLEX_CLRBITS|LM3S_CRC_CLRBITS|LM3S_PADEN_CLRBITS) +#define LM_TCTCL_SETBITS (LM_DUPLEX_SETBITS|LM_CRC_SETBITS|LM_PADEN_SETBITS) +#define LM_TCTCL_CLRBITS (LM_DUPLEX_CLRBITS|LM_CRC_CLRBITS|LM_PADEN_CLRBITS) /* Multicast frames can be enabled by defining CONFIG_LM_MULTICAST */ #ifdef CONFIG_LM_MULTICAST -# define LM3S_AMUL_SETBITS MAC_RCTL_AMUL -# define LM3S_AMUL_CLRBITS 0 +# define LM_AMUL_SETBITS MAC_RCTL_AMUL +# define LM_AMUL_CLRBITS 0 #else -# define LM3S_AMUL_SETBITS 0 -# define LM3S_AMUL_CLRBITS MAC_RCTL_AMUL +# define LM_AMUL_SETBITS 0 +# define LM_AMUL_CLRBITS MAC_RCTL_AMUL #endif /* Promiscuous mode can be enabled by defining CONFIG_LM_PROMISCUOUS */ #ifdef CONFIG_LM_PROMISCUOUS -# define LM3S_PRMS_SETBITS MAC_RCTL_PRMS -# define LM3S_PRMS_CLRBITS 0 +# define LM_PRMS_SETBITS MAC_RCTL_PRMS +# define LM_PRMS_CLRBITS 0 #else -# define LM3S_PRMS_SETBITS 0 -# define LM3S_PRMS_CLRBITS MAC_RCTL_PRMS +# define LM_PRMS_SETBITS 0 +# define LM_PRMS_CLRBITS MAC_RCTL_PRMS #endif /* Bad CRC rejection can be enabled by define CONFIG_LM_BADCRC */ #ifdef CONFIG_LM_BADCRC -# define LM3S_BADCRC_SETBITS MAC_RCTL_BADCRC -# define LM3S_BADCRC_CLRBITS 0 +# define LM_BADCRC_SETBITS MAC_RCTL_BADCRC +# define LM_BADCRC_CLRBITS 0 #else -# define LM3S_BADCRC_SETBITS 0 -# define LM3S_BADCRC_CLRBITS MAC_RCTL_BADCRC +# define LM_BADCRC_SETBITS 0 +# define LM_BADCRC_CLRBITS MAC_RCTL_BADCRC #endif -#define LM3S_RCTCL_SETBITS (LM3S_AMUL_SETBITS|LM3S_PRMS_SETBITS|LM3S_BADCRC_SETBITS) -#define LM3S_RCTCL_CLRBITS (LM3S_AMUL_CLRBITS|LM3S_PRMS_CLRBITS|LM3S_BADCRC_CLRBITS) +#define LM_RCTCL_SETBITS (LM_AMUL_SETBITS|LM_PRMS_SETBITS|LM_BADCRC_SETBITS) +#define LM_RCTCL_CLRBITS (LM_AMUL_CLRBITS|LM_PRMS_CLRBITS|LM_BADCRC_CLRBITS) /* CONFIG_LM_DUMPPACKET will dump the contents of each packet to the console. */ @@ -142,12 +142,12 @@ /* TX poll deley = 1 seconds. CLK_TCK is the number of clock ticks per second */ -#define LM3S_WDDELAY (1*CLK_TCK) -#define LM3S_POLLHSEC (1*2) +#define LM_WDDELAY (1*CLK_TCK) +#define LM_POLLHSEC (1*2) /* TX timeout = 1 minute */ -#define LM3S_TXTIMEOUT (60*CLK_TCK) +#define LM_TXTIMEOUT (60*CLK_TCK) /* This is a helper pointer for accessing the contents of the Ethernet header */ @@ -192,7 +192,7 @@ struct lm_driver_s * multiple Ethernet controllers. */ -#if LM3S_NETHCONTROLLERS > 1 +#if LM_NETHCONTROLLERS > 1 uint32_t ld_base; /* Ethernet controller base address */ int ld_irq; /* Ethernet controller IRQ */ #endif @@ -214,7 +214,7 @@ struct lm_driver_s * Private Data ****************************************************************************/ -static struct lm_driver_s g_lm3sdev[LM3S_NETHCONTROLLERS]; +static struct lm_driver_s g_lm3sdev[LM_NETHCONTROLLERS]; /**************************************************************************** * Private Function Prototypes @@ -222,7 +222,7 @@ static struct lm_driver_s g_lm3sdev[LM3S_NETHCONTROLLERS]; /* Miscellaneous low level helpers */ -#if LM3S_NETHCONTROLLERS > 1 +#if LM_NETHCONTROLLERS > 1 static uint32_t lm_ethin(struct lm_driver_s *priv, int offset); static void lm_ethout(struct lm_driver_s *priv, int offset, uint32_t value); #else @@ -280,7 +280,7 @@ static int lm_rmmac(struct uip_driver_s *dev, FAR const uint8_t *mac); * ****************************************************************************/ -#if LM3S_NETHCONTROLLERS > 1 +#if LM_NETHCONTROLLERS > 1 static uint32_t lm_ethin(struct lm_driver_s *priv, int offset) { return getreg32(priv->ld_base + offset); @@ -288,7 +288,7 @@ static uint32_t lm_ethin(struct lm_driver_s *priv, int offset) #else static inline uint32_t lm_ethin(struct lm_driver_s *priv, int offset) { - return getreg32(LM3S_ETHCON_BASE + offset); + return getreg32(LM_ETHCON_BASE + offset); } #endif @@ -308,7 +308,7 @@ static inline uint32_t lm_ethin(struct lm_driver_s *priv, int offset) * ****************************************************************************/ -#if LM3S_NETHCONTROLLERS > 1 +#if LM_NETHCONTROLLERS > 1 static void lm_ethout(struct lm_driver_s *priv, int offset, uint32_t value) { putreg32(value, priv->ld_base + offset); @@ -316,7 +316,7 @@ static void lm_ethout(struct lm_driver_s *priv, int offset, uint32_t value) #else static inline void lm_ethout(struct lm_driver_s *priv, int offset, uint32_t value) { - putreg32(value, LM3S_ETHCON_BASE + offset); + putreg32(value, LM_ETHCON_BASE + offset); } #endif @@ -341,23 +341,23 @@ static void lm_ethreset(struct lm_driver_s *priv) irqstate_t flags; uint32_t regval; -#if LM3S_NETHCONTROLLERS > 1 +#if LM_NETHCONTROLLERS > 1 # error "If multiple interfaces are supported, this function would have to be redesigned" #endif /* Make sure that clocking is enabled for the Ethernet (and PHY) peripherals */ flags = irqsave(); - regval = getreg32(LM3S_SYSCON_RCGC2); + regval = getreg32(LM_SYSCON_RCGC2); regval |= (SYSCON_RCGC2_EMAC0|SYSCON_RCGC2_EPHY0); - putreg32(regval, LM3S_SYSCON_RCGC2); + putreg32(regval, LM_SYSCON_RCGC2); nllvdbg("RCGC2: %08x\n", regval); /* Put the Ethernet controller into the reset state */ - regval = getreg32(LM3S_SYSCON_SRCR2); + regval = getreg32(LM_SYSCON_SRCR2); regval |= (SYSCON_SRCR2_EMAC0|SYSCON_SRCR2_EPHY0); - putreg32(regval, LM3S_SYSCON_SRCR2); + putreg32(regval, LM_SYSCON_SRCR2); /* Wait just a bit. This is a much longer delay than necessary */ @@ -366,7 +366,7 @@ static void lm_ethreset(struct lm_driver_s *priv) /* Then take the Ethernet controller out of the reset state */ regval &= ~(SYSCON_SRCR2_EMAC0|SYSCON_SRCR2_EPHY0); - putreg32(regval, LM3S_SYSCON_SRCR2); + putreg32(regval, LM_SYSCON_SRCR2); nllvdbg("SRCR2: %08x\n", regval); /* Wait just a bit, again. If we touch the ethernet too soon, we may busfault. */ @@ -384,14 +384,14 @@ static void lm_ethreset(struct lm_driver_s *priv) /* Disable all Ethernet controller interrupts */ - regval = lm_ethin(priv, LM3S_MAC_IM_OFFSET); + regval = lm_ethin(priv, LM_MAC_IM_OFFSET); regval &= ~MAC_IM_ALLINTS; - lm_ethout(priv, LM3S_MAC_IM_OFFSET, regval); + lm_ethout(priv, LM_MAC_IM_OFFSET, regval); /* Clear any pending interrupts (shouldn't be any) */ - regval = lm_ethin(priv, LM3S_MAC_RIS_OFFSET); - lm_ethout(priv, LM3S_MAC_IACK_OFFSET, regval); + regval = lm_ethin(priv, LM_MAC_RIS_OFFSET); + lm_ethout(priv, LM_MAC_IACK_OFFSET, regval); irqrestore(flags); } @@ -416,22 +416,22 @@ static void lm_phywrite(struct lm_driver_s *priv, int regaddr, uint16_t value) { /* Wait for any MII transactions in progress to complete */ - while ((lm_ethin(priv, LM3S_MAC_MCTL_OFFSET) & MAC_MCTL_START) != 0); + while ((lm_ethin(priv, LM_MAC_MCTL_OFFSET) & MAC_MCTL_START) != 0); /* Set up the data to be written */ DEBUGASSERT(value < MAC_MTXD_MASK); - lm_ethout(priv, LM3S_MAC_MTXD_OFFSET, value); + lm_ethout(priv, LM_MAC_MTXD_OFFSET, value); /* Set up the PHY register address and start the write operation */ regaddr <<= MAC_MCTL_REGADR_SHIFT; DEBUGASSERT((regaddr & MAC_MTXD_MASK) == regaddr); - lm_ethout(priv, LM3S_MAC_MCTL_OFFSET, regaddr | MAC_MCTL_WRITE | MAC_MCTL_START); + lm_ethout(priv, LM_MAC_MCTL_OFFSET, regaddr | MAC_MCTL_WRITE | MAC_MCTL_START); /* Wait for the write transaction to complete */ - while ((lm_ethin(priv, LM3S_MAC_MCTL_OFFSET) & MAC_MCTL_START) != 0); + while ((lm_ethin(priv, LM_MAC_MCTL_OFFSET) & MAC_MCTL_START) != 0); } #endif @@ -455,21 +455,21 @@ static uint16_t lm_phyread(struct lm_driver_s *priv, int regaddr) { /* Wait for any MII transactions in progress to complete */ - while ((lm_ethin(priv, LM3S_MAC_MCTL_OFFSET) & MAC_MCTL_START) != 0); + while ((lm_ethin(priv, LM_MAC_MCTL_OFFSET) & MAC_MCTL_START) != 0); /* Set up the PHY register address and start the read operation */ regaddr <<= MAC_MCTL_REGADR_SHIFT; DEBUGASSERT((regaddr & MAC_MTXD_MASK) == regaddr); - lm_ethout(priv, LM3S_MAC_MCTL_OFFSET, regaddr | MAC_MCTL_START); + lm_ethout(priv, LM_MAC_MCTL_OFFSET, regaddr | MAC_MCTL_START); /* Wait for the write transaction to complete */ - while ((lm_ethin(priv, LM3S_MAC_MCTL_OFFSET) & MAC_MCTL_START) != 0); + while ((lm_ethin(priv, LM_MAC_MCTL_OFFSET) & MAC_MCTL_START) != 0); /* Read and return the PHY data */ - return (uint16_t)(lm_ethin(priv, LM3S_MAC_MRXD_OFFSET) & MAC_MTRD_MASK); + return (uint16_t)(lm_ethin(priv, LM_MAC_MRXD_OFFSET) & MAC_MTRD_MASK); } /**************************************************************************** @@ -499,7 +499,7 @@ static int lm_transmit(struct lm_driver_s *priv) /* Verify that the hardware is ready to send another packet */ flags = irqsave(); - if ((lm_ethin(priv, LM3S_MAC_TR_OFFSET) & MAC_TR_NEWTX) == 0) + if ((lm_ethin(priv, LM_MAC_TR_OFFSET) & MAC_TR_NEWTX) == 0) { /* Increment statistics */ @@ -520,7 +520,7 @@ static int lm_transmit(struct lm_driver_s *priv) regval = (uint32_t)(pktlen - 14); regval |= ((uint32_t)(*dbuf++) << 16); regval |= ((uint32_t)(*dbuf++) << 24); - lm_ethout(priv, LM3S_MAC_DATA_OFFSET, regval); + lm_ethout(priv, LM_MAC_DATA_OFFSET, regval); /* Write all of the whole, 32-bit values in the middle of the packet */ @@ -530,7 +530,7 @@ static int lm_transmit(struct lm_driver_s *priv) * buffer may be un-aligned. */ - lm_ethout(priv, LM3S_MAC_DATA_OFFSET, *(uint32_t*)dbuf); + lm_ethout(priv, LM_MAC_DATA_OFFSET, *(uint32_t*)dbuf); } /* Write the last, partial word in the FIFO */ @@ -554,16 +554,16 @@ static int lm_transmit(struct lm_driver_s *priv) regval |= (uint32_t)dbuf[0]; break; } - lm_ethout(priv, LM3S_MAC_DATA_OFFSET, regval); + lm_ethout(priv, LM_MAC_DATA_OFFSET, regval); } /* Activate the transmitter */ - lm_ethout(priv, LM3S_MAC_TR_OFFSET, MAC_TR_NEWTX); + lm_ethout(priv, LM_MAC_TR_OFFSET, MAC_TR_NEWTX); /* Setup the TX timeout watchdog (perhaps restarting the timer) */ - (void)wd_start(priv->ld_txtimeout, LM3S_TXTIMEOUT, lm_txtimeout, 1, (uint32_t)priv); + (void)wd_start(priv->ld_txtimeout, LM_TXTIMEOUT, lm_txtimeout, 1, (uint32_t)priv); ret = OK; } @@ -608,7 +608,7 @@ static int lm_uiptxpoll(struct uip_driver_s *dev) * packet was successfully handled. */ - DEBUGASSERT((lm_ethin(priv, LM3S_MAC_TR_OFFSET) & MAC_TR_NEWTX) == 0) + DEBUGASSERT((lm_ethin(priv, LM_MAC_TR_OFFSET) & MAC_TR_NEWTX) == 0) uip_arp_out(&priv->ld_dev); ret = lm_transmit(priv); } @@ -645,7 +645,7 @@ static void lm_receive(struct lm_driver_s *priv) /* Loop while there are incoming packets to be processed */ - while ((lm_ethin(priv, LM3S_MAC_NP_OFFSET) & MAC_NP_MASK) != 0) + while ((lm_ethin(priv, LM_MAC_NP_OFFSET) & MAC_NP_MASK) != 0) { /* Update statistics */ @@ -665,7 +665,7 @@ static void lm_receive(struct lm_driver_s *priv) * includes the len/type field (size 2) and the FCS (size 4). */ - regval = lm_ethin(priv, LM3S_MAC_DATA_OFFSET); + regval = lm_ethin(priv, LM_MAC_DATA_OFFSET); pktlen = (int)(regval & 0x0000ffff); nllvdbg("Receiving packet, pktlen: %d\n", pktlen); @@ -694,7 +694,7 @@ static void lm_receive(struct lm_driver_s *priv) while (wordlen--) { - (void)lm_ethin(priv, LM3S_MAC_DATA_OFFSET); + (void)lm_ethin(priv, LM_MAC_DATA_OFFSET); } /* Check for another packet */ @@ -718,7 +718,7 @@ static void lm_receive(struct lm_driver_s *priv) * buffer may be un-aligned. */ - *(uint32_t*)dbuf = lm_ethin(priv, LM3S_MAC_DATA_OFFSET); + *(uint32_t*)dbuf = lm_ethin(priv, LM_MAC_DATA_OFFSET); } /* Handle the last, partial word in the FIFO (0-3 bytes) and discard @@ -731,7 +731,7 @@ static void lm_receive(struct lm_driver_s *priv) * bytes of the FCS into the user buffer. */ - regval = lm_ethin(priv, LM3S_MAC_DATA_OFFSET); + regval = lm_ethin(priv, LM_MAC_DATA_OFFSET); switch (bytesleft) { default: @@ -834,7 +834,7 @@ static void lm_txdone(struct lm_driver_s *priv) * at this point. */ - DEBUGASSERT((lm_ethin(priv, LM3S_MAC_TR_OFFSET) & MAC_TR_NEWTX) == 0) + DEBUGASSERT((lm_ethin(priv, LM_MAC_TR_OFFSET) & MAC_TR_NEWTX) == 0) /* Then poll uIP for new XMIT data */ @@ -863,7 +863,7 @@ static int lm_interrupt(int irq, FAR void *context) register struct lm_driver_s *priv; uint32_t ris; -#if LM3S_NETHCONTROLLERS > 1 +#if LM_NETHCONTROLLERS > 1 # error "A mechanism to associate and interface with an IRQ is needed" #else priv = &g_lm3sdev[0]; @@ -871,11 +871,11 @@ static int lm_interrupt(int irq, FAR void *context) /* Read the raw interrupt status register */ - ris = lm_ethin(priv, LM3S_MAC_RIS_OFFSET); + ris = lm_ethin(priv, LM_MAC_RIS_OFFSET); /* Clear all pending interrupts */ - lm_ethout(priv, LM3S_MAC_IACK_OFFSET, ris); + lm_ethout(priv, LM_MAC_IACK_OFFSET, ris); /* Check for errors */ @@ -898,7 +898,7 @@ static int lm_interrupt(int irq, FAR void *context) /* Handle (unmasked) interrupts according to status bit settings */ - ris &= lm_ethin(priv, LM3S_MAC_IM_OFFSET); + ris &= lm_ethin(priv, LM_MAC_IM_OFFSET); /* Is this an Rx interrupt (meaning that a packet has been received)? */ @@ -994,15 +994,15 @@ static void lm_polltimer(int argc, uint32_t arg, ...) * inaccuracies. */ - if ((lm_ethin(priv, LM3S_MAC_TR_OFFSET) & MAC_TR_NEWTX) == 0) + if ((lm_ethin(priv, LM_MAC_TR_OFFSET) & MAC_TR_NEWTX) == 0) { /* If so, update TCP timing states and poll uIP for new XMIT data */ - (void)uip_timer(&priv->ld_dev, lm_uiptxpoll, LM3S_POLLHSEC); + (void)uip_timer(&priv->ld_dev, lm_uiptxpoll, LM_POLLHSEC); /* Setup the watchdog poll timer again */ - (void)wd_start(priv->ld_txpoll, LM3S_WDDELAY, lm_polltimer, 1, arg); + (void)wd_start(priv->ld_txpoll, LM_WDDELAY, lm_polltimer, 1, arg); } } @@ -1051,7 +1051,7 @@ static int lm_ifup(struct uip_driver_s *dev) */ div = SYSCLK_FREQUENCY / 2 / LM32S_MAX_MDCCLK; - lm_ethout(priv, LM3S_MAC_MDV_OFFSET, div); + lm_ethout(priv, LM_MAC_MDV_OFFSET, div); nllvdbg("MDV: %08x\n", div); /* Then configure the Ethernet Controller for normal operation @@ -1060,32 +1060,32 @@ static int lm_ifup(struct uip_driver_s *dev) * TX Padding Enabled). */ - regval = lm_ethin(priv, LM3S_MAC_TCTL_OFFSET); - regval &= ~LM3S_TCTCL_CLRBITS; - regval |= LM3S_TCTCL_SETBITS; - lm_ethout(priv, LM3S_MAC_TCTL_OFFSET, regval); + regval = lm_ethin(priv, LM_MAC_TCTL_OFFSET); + regval &= ~LM_TCTCL_CLRBITS; + regval |= LM_TCTCL_SETBITS; + lm_ethout(priv, LM_MAC_TCTL_OFFSET, regval); nllvdbg("TCTL: %08x\n", regval); /* Setup the receive control register (Disable multicast frames, disable * promiscuous mode, disable bad CRC rejection). */ - regval = lm_ethin(priv, LM3S_MAC_RCTL_OFFSET); - regval &= ~LM3S_RCTCL_CLRBITS; - regval |= LM3S_RCTCL_SETBITS; - lm_ethout(priv, LM3S_MAC_RCTL_OFFSET, regval); + regval = lm_ethin(priv, LM_MAC_RCTL_OFFSET); + regval &= ~LM_RCTCL_CLRBITS; + regval |= LM_RCTCL_SETBITS; + lm_ethout(priv, LM_MAC_RCTL_OFFSET, regval); nllvdbg("RCTL: %08x\n", regval); /* Setup the time stamp configuration register */ -#ifdef LM3S_ETHTS - regval = lm_ethin(priv, LM3S_MAC_TS_OFFSET); +#ifdef LM_ETHTS + regval = lm_ethin(priv, LM_MAC_TS_OFFSET); #ifdef CONFIG_LM_TIMESTAMP regval |= MAC_TS_EN; #else regval &= ~(MAC_TS_EN); #endif - lm_ethout(priv, LM3S_MAC_TS_OFFSET, regval); + lm_ethout(priv, LM_MAC_TS_OFFSET, regval); nllvdbg("TS: %08x\n", regval); #endif @@ -1105,41 +1105,41 @@ static int lm_ifup(struct uip_driver_s *dev) /* Reset the receive FIFO */ - regval = lm_ethin(priv, LM3S_MAC_RCTL_OFFSET); + regval = lm_ethin(priv, LM_MAC_RCTL_OFFSET); regval |= MAC_RCTL_RSTFIFO; - lm_ethout(priv, LM3S_MAC_RCTL_OFFSET, regval); + lm_ethout(priv, LM_MAC_RCTL_OFFSET, regval); /* Enable the Ethernet receiver */ - regval = lm_ethin(priv, LM3S_MAC_RCTL_OFFSET); + regval = lm_ethin(priv, LM_MAC_RCTL_OFFSET); regval |= MAC_RCTL_RXEN; - lm_ethout(priv, LM3S_MAC_RCTL_OFFSET, regval); + lm_ethout(priv, LM_MAC_RCTL_OFFSET, regval); /* Enable the Ethernet transmitter */ - regval = lm_ethin(priv, LM3S_MAC_TCTL_OFFSET); + regval = lm_ethin(priv, LM_MAC_TCTL_OFFSET); regval |= MAC_TCTL_TXEN; - lm_ethout(priv, LM3S_MAC_TCTL_OFFSET, regval); + lm_ethout(priv, LM_MAC_TCTL_OFFSET, regval); /* Reset the receive FIFO (again) */ - regval = lm_ethin(priv, LM3S_MAC_RCTL_OFFSET); + regval = lm_ethin(priv, LM_MAC_RCTL_OFFSET); regval |= MAC_RCTL_RSTFIFO; - lm_ethout(priv, LM3S_MAC_RCTL_OFFSET, regval); + lm_ethout(priv, LM_MAC_RCTL_OFFSET, regval); /* Enable the Ethernet interrupt */ -#if LM3S_NETHCONTROLLERS > 1 +#if LM_NETHCONTROLLERS > 1 up_enable_irq(priv->irq); #else - up_enable_irq(LM3S_IRQ_ETHCON); + up_enable_irq(LM_IRQ_ETHCON); #endif /* Enable the Ethernet RX packet receipt interrupt */ - regval = lm_ethin(priv, LM3S_MAC_IM_OFFSET); + regval = lm_ethin(priv, LM_MAC_IM_OFFSET); regval |= MAC_IM_RXINTM; - lm_ethout(priv, LM3S_MAC_IM_OFFSET, regval); + lm_ethout(priv, LM_MAC_IM_OFFSET, regval); /* Program the hardware with it's MAC address (for filtering) */ @@ -1147,15 +1147,15 @@ static int lm_ifup(struct uip_driver_s *dev) (uint32_t)priv->ld_dev.d_mac.ether_addr_octet[2] << 16 | (uint32_t)priv->ld_dev.d_mac.ether_addr_octet[1] << 8 | (uint32_t)priv->ld_dev.d_mac.ether_addr_octet[0]; - lm_ethout(priv, LM3S_MAC_IA0_OFFSET, regval); + lm_ethout(priv, LM_MAC_IA0_OFFSET, regval); regval = (uint32_t)priv->ld_dev.d_mac.ether_addr_octet[5] << 8 | (uint32_t)priv->ld_dev.d_mac.ether_addr_octet[4]; - lm_ethout(priv, LM3S_MAC_IA1_OFFSET, regval); + lm_ethout(priv, LM_MAC_IA1_OFFSET, regval); /* Set and activate a timer process */ - (void)wd_start(priv->ld_txpoll, LM3S_WDDELAY, lm_polltimer, 1, (uint32_t)priv); + (void)wd_start(priv->ld_txpoll, LM_WDDELAY, lm_polltimer, 1, (uint32_t)priv); priv->ld_bifup = true; irqrestore(flags); @@ -1197,46 +1197,46 @@ static int lm_ifdown(struct uip_driver_s *dev) /* Disable the Ethernet interrupt */ -#if LM3S_NETHCONTROLLERS > 1 +#if LM_NETHCONTROLLERS > 1 up_disable_irq(priv->irq); #else - up_disable_irq(LM3S_IRQ_ETHCON); + up_disable_irq(LM_IRQ_ETHCON); #endif /* Disable all Ethernet controller interrupt sources */ - regval = lm_ethin(priv, LM3S_MAC_IM_OFFSET); + regval = lm_ethin(priv, LM_MAC_IM_OFFSET); regval &= ~MAC_IM_ALLINTS; - lm_ethout(priv, LM3S_MAC_IM_OFFSET, regval); + lm_ethout(priv, LM_MAC_IM_OFFSET, regval); /* Reset the receive FIFO */ - regval = lm_ethin(priv, LM3S_MAC_RCTL_OFFSET); + regval = lm_ethin(priv, LM_MAC_RCTL_OFFSET); regval |= MAC_RCTL_RSTFIFO; - lm_ethout(priv, LM3S_MAC_RCTL_OFFSET, regval); + lm_ethout(priv, LM_MAC_RCTL_OFFSET, regval); /* Disable the Ethernet receiver */ - regval = lm_ethin(priv, LM3S_MAC_RCTL_OFFSET); + regval = lm_ethin(priv, LM_MAC_RCTL_OFFSET); regval &= ~MAC_RCTL_RXEN; - lm_ethout(priv, LM3S_MAC_RCTL_OFFSET, regval); + lm_ethout(priv, LM_MAC_RCTL_OFFSET, regval); /* Disable the Ethernet transmitter */ - regval = lm_ethin(priv, LM3S_MAC_RCTL_OFFSET); + regval = lm_ethin(priv, LM_MAC_RCTL_OFFSET); regval &= ~MAC_TCTL_TXEN; - lm_ethout(priv, LM3S_MAC_TCTL_OFFSET, regval); + lm_ethout(priv, LM_MAC_TCTL_OFFSET, regval); /* Reset the receive FIFO (again) */ - regval = lm_ethin(priv, LM3S_MAC_RCTL_OFFSET); + regval = lm_ethin(priv, LM_MAC_RCTL_OFFSET); regval |= MAC_RCTL_RSTFIFO; - lm_ethout(priv, LM3S_MAC_RCTL_OFFSET, regval); + lm_ethout(priv, LM_MAC_RCTL_OFFSET, regval); /* Clear any pending interrupts */ - regval = lm_ethin(priv, LM3S_MAC_RIS_OFFSET); - lm_ethout(priv, LM3S_MAC_IACK_OFFSET, regval); + regval = lm_ethin(priv, LM_MAC_RIS_OFFSET); + lm_ethout(priv, LM_MAC_IACK_OFFSET, regval); /* The interface is now DOWN */ @@ -1278,7 +1278,7 @@ static int lm_txavail(struct uip_driver_s *dev) */ flags = irqsave(); - if (priv->ld_bifup && (lm_ethin(priv, LM3S_MAC_TR_OFFSET) & MAC_TR_NEWTX) == 0) + if (priv->ld_bifup && (lm_ethin(priv, LM_MAC_TR_OFFSET) & MAC_TR_NEWTX) == 0) { /* If the interface is up and we can use the Tx FIFO, then poll uIP * for new Tx data @@ -1371,7 +1371,7 @@ static int lm_rmmac(struct uip_driver_s *dev, FAR const uint8_t *mac) * ****************************************************************************/ -#if LM3S_NETHCONTROLLERS > 1 +#if LM_NETHCONTROLLERS > 1 int lm_ethinitialize(int intf) #else static inline int lm_ethinitialize(int intf) @@ -1384,12 +1384,12 @@ static inline int lm_ethinitialize(int intf) ndbg("Setting up eth%d\n", intf); -#if LM3S_NETHCONTROLLERS > 1 +#if LM_NETHCONTROLLERS > 1 # error "This debug check only works with one interface" #else - DEBUGASSERT((getreg32(LM3S_SYSCON_DC4) & (SYSCON_DC4_EMAC0|SYSCON_DC4_EPHY0)) == (SYSCON_DC4_EMAC0|SYSCON_DC4_EPHY0)); + DEBUGASSERT((getreg32(LM_SYSCON_DC4) & (SYSCON_DC4_EMAC0|SYSCON_DC4_EPHY0)) == (SYSCON_DC4_EMAC0|SYSCON_DC4_EPHY0)); #endif - DEBUGASSERT((unsigned)intf < LM3S_NETHCONTROLLERS); + DEBUGASSERT((unsigned)intf < LM_NETHCONTROLLERS); /* Initialize the driver structure */ @@ -1405,7 +1405,7 @@ static inline int lm_ethinitialize(int intf) /* Create a watchdog for timing polling for and timing of transmisstions */ -#if LM3S_NETHCONTROLLERS > 1 +#if LM_NETHCONTROLLERS > 1 # error "A mechanism to associate base address an IRQ with an interface is needed" priv->ld_base = ??; /* Ethernet controller base address */ priv->ld_irq = ??; /* Ethernet controller IRQ number */ @@ -1432,10 +1432,10 @@ static inline int lm_ethinitialize(int intf) /* Attach the IRQ to the driver */ -#if LM3S_NETHCONTROLLERS > 1 +#if LM_NETHCONTROLLERS > 1 ret = irq_attach(priv->irq, lm_interrupt); #else - ret = irq_attach(LM3S_IRQ_ETHCON, lm_interrupt); + ret = irq_attach(LM_IRQ_ETHCON, lm_interrupt); #endif if (ret != 0) { @@ -1461,7 +1461,7 @@ static inline int lm_ethinitialize(int intf) * ************************************************************************************/ -#if LM3S_NETHCONTROLLERS == 1 +#if LM_NETHCONTROLLERS == 1 void up_netinitialize(void) { (void)lm_ethinitialize(0); diff --git a/nuttx/arch/arm/src/lm/lm_ethernet.h b/nuttx/arch/arm/src/lm/lm_ethernet.h index e71e9d0777..e3cc650677 100644 --- a/nuttx/arch/arm/src/lm/lm_ethernet.h +++ b/nuttx/arch/arm/src/lm/lm_ethernet.h @@ -44,7 +44,7 @@ #include "chip.h" -#if LM3S_NETHCONTROLLERS > 1 +#if LM_NETHCONTROLLERS > 1 /************************************************************************************ * Pre-processor Definitions @@ -77,7 +77,7 @@ extern "C" * Function: lm_ethinitialize * * Description: - * Initialize the Ethernet driver for one interface. If the LM3S chip + * Initialize the Ethernet driver for one interface. If the Stellaris chip * supports multiple Ethernet controllers, then bould specific logic * must implement up_netinitialize() and call this function to initialize * the desiresed interfaces. @@ -99,5 +99,5 @@ int lm_ethinitialize(int intf); #endif #endif /* __ASSEMBLY__ */ -#endif /* LM3S_NETHCONTROLLERS > 1 */ +#endif /* LM_NETHCONTROLLERS > 1 */ #endif /* __ARCH_ARM_SRC_LM_LM_ETHERNET_H */ diff --git a/nuttx/arch/arm/src/lm/lm_gpio.c b/nuttx/arch/arm/src/lm/lm_gpio.c index 499bf07a2e..be851e67c4 100644 --- a/nuttx/arch/arm/src/lm/lm_gpio.c +++ b/nuttx/arch/arm/src/lm/lm_gpio.c @@ -140,23 +140,23 @@ static const struct gpio_func_s g_funcbits[] = {GPIO_INTERRUPT_SETBITS, GPIO_INTERRUPT_CLRBITS}, /* GPIO_FUNC_INTERRUPT */ }; -static const uint32_t g_gpiobase[LM3S_NPORTS] = +static const uint32_t g_gpiobase[LM_NPORTS] = { - /* All support LM3S parts have at least 7 ports, GPIOA-G */ + /* All support Stellaris parts have at least 7 ports, GPIOA-G */ - LM3S_GPIOA_BASE, LM3S_GPIOB_BASE, LM3S_GPIOC_BASE, LM3S_GPIOD_BASE, - LM3S_GPIOE_BASE, LM3S_GPIOF_BASE, LM3S_GPIOG_BASE, + LM_GPIOA_BASE, LM_GPIOB_BASE, LM_GPIOC_BASE, LM_GPIOD_BASE, + LM_GPIOE_BASE, LM_GPIOF_BASE, LM_GPIOG_BASE, /* GPIOH exists on the LM3S6918 and th LM3S6B96, but not on the LM3S6965 or LM3S8962*/ -#if LM3S_NPORTS > 7 - LM3S_GPIOH_BASE, +#if LM_NPORTS > 7 + LM_GPIOH_BASE, #endif /* GPIOJ exists on the LM3S6B96, but not on the LM3S6918 or LM3S6965 or LM3S8962*/ -#if LM3S_NPORTS > 8 - LM3S_GPIOJ_BASE, +#if LM_NPORTS > 8 + LM_GPIOJ_BASE, #endif }; @@ -180,7 +180,7 @@ static const uint32_t g_gpiobase[LM3S_NPORTS] = static uint32_t lm_gpiobaseaddress(unsigned int port) { uint32_t gpiobase = 0; - if (port < LM3S_NPORTS) + if (port < LM_NPORTS) { gpiobase = g_gpiobase[port]; } @@ -215,10 +215,10 @@ static void lm_gpiofunc(uint32_t base, uint32_t pinno, const struct gpio_func_s setbit = (((uint32_t)func->setbits >> ODR_SHIFT) & 1) << pinno; clrbit = (((uint32_t)func->clrbits >> ODR_SHIFT) & 1) << pinno; - regval = getreg32(base + LM3S_GPIO_ODR_OFFSET); + regval = getreg32(base + LM_GPIO_ODR_OFFSET); regval &= ~clrbit; regval |= setbit; - putreg32(regval, base + LM3S_GPIO_ODR_OFFSET); + putreg32(regval, base + LM_GPIO_ODR_OFFSET); /* Set/clear the GPIO PUR bit. "The GPIOPUR register is the pull-up control * register. When a bit is set to 1, it enables a weak pull-up resistor on the @@ -231,10 +231,10 @@ static void lm_gpiofunc(uint32_t base, uint32_t pinno, const struct gpio_func_s if (setbit || clrbit) { - regval = getreg32(base + LM3S_GPIO_PUR_OFFSET); + regval = getreg32(base + LM_GPIO_PUR_OFFSET); regval &= ~clrbit; regval |= setbit; - putreg32(regval, base + LM3S_GPIO_PUR_OFFSET); + putreg32(regval, base + LM_GPIO_PUR_OFFSET); } /* Set/clear the GPIO PDR bit. "The GPIOPDR register is the pull-down control @@ -248,10 +248,10 @@ static void lm_gpiofunc(uint32_t base, uint32_t pinno, const struct gpio_func_s if (setbit || clrbit) { - regval = getreg32(base + LM3S_GPIO_PDR_OFFSET); + regval = getreg32(base + LM_GPIO_PDR_OFFSET); regval &= ~clrbit; regval |= setbit; - putreg32(regval, base + LM3S_GPIO_PDR_OFFSET); + putreg32(regval, base + LM_GPIO_PDR_OFFSET); } /* Set/clear the GPIO DEN bit. "The GPIODEN register is the digital enable @@ -266,10 +266,10 @@ static void lm_gpiofunc(uint32_t base, uint32_t pinno, const struct gpio_func_s setbit = (((uint32_t)func->setbits >> DEN_SHIFT) & 1) << pinno; clrbit = (((uint32_t)func->clrbits >> DEN_SHIFT) & 1) << pinno; - regval = getreg32(base + LM3S_GPIO_DEN_OFFSET); + regval = getreg32(base + LM_GPIO_DEN_OFFSET); regval &= ~clrbit; regval |= setbit; - putreg32(regval, base + LM3S_GPIO_DEN_OFFSET); + putreg32(regval, base + LM_GPIO_DEN_OFFSET); /* Set/clear/ignore the GPIO DIR bit. "The GPIODIR register is the data * direction register. Bits set to 1 in the GPIODIR register configure @@ -281,10 +281,10 @@ static void lm_gpiofunc(uint32_t base, uint32_t pinno, const struct gpio_func_s setbit = (((uint32_t)func->setbits >> DIR_SHIFT) & 1) << pinno; clrbit = (((uint32_t)func->clrbits >> DIR_SHIFT) & 1) << pinno; - regval = getreg32(base + LM3S_GPIO_DIR_OFFSET); + regval = getreg32(base + LM_GPIO_DIR_OFFSET); regval &= ~clrbit; regval |= setbit; - putreg32(regval, base + LM3S_GPIO_DIR_OFFSET); + putreg32(regval, base + LM_GPIO_DIR_OFFSET); /* Set/clear/ignore the GPIO AFSEL bit. "The GPIOAFSEL register is the mode * control select register. Writing a 1 to any bit in this register selects @@ -298,10 +298,10 @@ static void lm_gpiofunc(uint32_t base, uint32_t pinno, const struct gpio_func_s setbit = (((uint32_t)func->setbits >> AFSEL_SHIFT) & 1) << pinno; clrbit = (((uint32_t)func->clrbits >> AFSEL_SHIFT) & 1) << pinno; - regval = getreg32(base + LM3S_GPIO_AFSEL_OFFSET); + regval = getreg32(base + LM_GPIO_AFSEL_OFFSET); regval &= ~clrbit; regval |= setbit; - putreg32(regval, base + LM3S_GPIO_AFSEL_OFFSET); + putreg32(regval, base + LM_GPIO_AFSEL_OFFSET); } /**************************************************************************** @@ -336,7 +336,7 @@ static inline void lm_gpiopadstrength(uint32_t base, uint32_t pin, uint32_t cfgs * DRV8 bit in the GPIODR8R register are automatically cleared by hardware." */ - regoffset = LM3S_GPIO_DR2R_OFFSET; + regoffset = LM_GPIO_DR2R_OFFSET; } break; @@ -349,7 +349,7 @@ static inline void lm_gpiopadstrength(uint32_t base, uint32_t pin, uint32_t cfgs * in the GPIO DR8R register are automatically cleared by hardware." */ - regoffset = LM3S_GPIO_DR4R_OFFSET; + regoffset = LM_GPIO_DR4R_OFFSET; } break; @@ -374,7 +374,7 @@ static inline void lm_gpiopadstrength(uint32_t base, uint32_t pin, uint32_t cfgs * DRV4 bit in the GPIO DR4R register are automatically cleared by hardware." */ - regoffset = LM3S_GPIO_DR8R_OFFSET; + regoffset = LM_GPIO_DR8R_OFFSET; } break; } @@ -385,10 +385,10 @@ static inline void lm_gpiopadstrength(uint32_t base, uint32_t pin, uint32_t cfgs regval |= pin; putreg32(regval, base + regoffset); - regval = getreg32(base + LM3S_GPIO_SLR_OFFSET); + regval = getreg32(base + LM_GPIO_SLR_OFFSET); regval &= slrclr; regval |= slrset; - putreg32(regval, base + LM3S_GPIO_SLR_OFFSET); + putreg32(regval, base + LM_GPIO_SLR_OFFSET); } /**************************************************************************** @@ -503,10 +503,10 @@ static inline void lm_gpiopadtype(uint32_t base, uint32_t pin, uint32_t cfgset) */ #if 0 /* always overwritten by lm_gpiofunc */ - regval = getreg32(base + LM3S_GPIO_ODR_OFFSET); + regval = getreg32(base + LM_GPIO_ODR_OFFSET); regval &= ~odrclr; regval |= odrset; - putreg32(regval, base + LM3S_GPIO_ODR_OFFSET); + putreg32(regval, base + LM_GPIO_ODR_OFFSET); #endif /* Set/clear the GPIO PUR bit. "The GPIOPUR register is the pull-up control @@ -515,10 +515,10 @@ static inline void lm_gpiopadtype(uint32_t base, uint32_t pin, uint32_t cfgset) * corresponding bit in the GPIO Pull-Down Select (GPIOPDR) register ..." */ - regval = getreg32(base + LM3S_GPIO_PUR_OFFSET); + regval = getreg32(base + LM_GPIO_PUR_OFFSET); regval &= ~purclr; regval |= purset; - putreg32(regval, base + LM3S_GPIO_PUR_OFFSET); + putreg32(regval, base + LM_GPIO_PUR_OFFSET); /* Set/clear the GPIO PDR bit. "The GPIOPDR register is the pull-down control * register. When a bit is set to 1, it enables a weak pull-down resistor on the @@ -526,10 +526,10 @@ static inline void lm_gpiopadtype(uint32_t base, uint32_t pin, uint32_t cfgset) * the corresponding bit in the GPIO Pull-Up Select (GPIOPUR) register ..." */ - regval = getreg32(base + LM3S_GPIO_PDR_OFFSET); + regval = getreg32(base + LM_GPIO_PDR_OFFSET); regval &= ~pdrclr; regval |= pdrset; - putreg32(regval, base + LM3S_GPIO_PDR_OFFSET); + putreg32(regval, base + LM_GPIO_PDR_OFFSET); /* Set/clear the GPIO DEN bit. "The GPIODEN register is the digital enable * register. By default, with the exception of the GPIO signals used for JTAG/SWD @@ -541,10 +541,10 @@ static inline void lm_gpiopadtype(uint32_t base, uint32_t pin, uint32_t cfgset) */ #if 0 /* always overwritten by lm_gpiofunc */ - regval = getreg32(base + LM3S_GPIO_DEN_OFFSET); + regval = getreg32(base + LM_GPIO_DEN_OFFSET); regval &= ~denclr; regval |= denset; - putreg32(regval, base + LM3S_GPIO_DEN_OFFSET); + putreg32(regval, base + LM_GPIO_DEN_OFFSET); #endif } @@ -589,18 +589,18 @@ static inline void lm_interrupt(uint32_t base, uint32_t pin, uint32_t cfgset) * on that pin. All bits are cleared by a reset." */ - regval = getreg32(base + LM3S_GPIO_IM_OFFSET); + regval = getreg32(base + LM_GPIO_IM_OFFSET); regval &= ~pin; - putreg32(regval, base + LM3S_GPIO_IM_OFFSET); + putreg32(regval, base + LM_GPIO_IM_OFFSET); /* "The GPIOICR register is the interrupt clear register. Writing a 1 to a bit * in this register clears the corresponding interrupt edge detection logic * register. Writing a 0 has no effect." */ - regval = getreg32(base + LM3S_GPIO_ICR_OFFSET); + regval = getreg32(base + LM_GPIO_ICR_OFFSET); regval |= pin; - putreg32(regval, base + LM3S_GPIO_ICR_OFFSET); + putreg32(regval, base + LM_GPIO_ICR_OFFSET); /* Assume rising edge */ @@ -656,10 +656,10 @@ static inline void lm_interrupt(uint32_t base, uint32_t pin, uint32_t cfgset) * by a reset. */ - regval = getreg32(base + LM3S_GPIO_IS_OFFSET); + regval = getreg32(base + LM_GPIO_IS_OFFSET); regval &= isclr; regval |= isset; - putreg32(regval, base + LM3S_GPIO_IS_OFFSET); + putreg32(regval, base + LM_GPIO_IS_OFFSET); /* "The GPIO IBE register is the interrupt both-edges register. When the * corresponding bit in the GPIO Interrupt Sense (GPIO IS) register ... is @@ -670,10 +670,10 @@ static inline void lm_interrupt(uint32_t base, uint32_t pin, uint32_t cfgset) * are cleared by a reset. */ - regval = getreg32(base + LM3S_GPIO_IBE_OFFSET); + regval = getreg32(base + LM_GPIO_IBE_OFFSET); regval &= ibeclr; regval |= ibeset; - putreg32(regval, base + LM3S_GPIO_IBE_OFFSET); + putreg32(regval, base + LM_GPIO_IBE_OFFSET); /* "The GPIOIEV register is the interrupt event register. Bits set to * High in GPIO IEV configure the corresponding pin to detect rising edges @@ -683,10 +683,10 @@ static inline void lm_interrupt(uint32_t base, uint32_t pin, uint32_t cfgset) * value in GPIOIS. All bits are cleared by a reset. */ - regval = getreg32(base + LM3S_GPIO_IEV_OFFSET); + regval = getreg32(base + LM_GPIO_IEV_OFFSET); regval &= iveclr; regval |= iveset; - putreg32(regval, base + LM3S_GPIO_IEV_OFFSET); + putreg32(regval, base + LM_GPIO_IEV_OFFSET); } /**************************************************************************** @@ -734,9 +734,9 @@ int lm_configgpio(uint32_t cfgset) * in the RCGC2 register." */ - regval = getreg32(LM3S_SYSCON_RCGC2); + regval = getreg32(LM_SYSCON_RCGC2); regval |= SYSCON_RCGC2_GPIO(port); - putreg32(regval, LM3S_SYSCON_RCGC2); + putreg32(regval, LM_SYSCON_RCGC2); /* First, set the port to digital input. This is the safest state in which * to perform reconfiguration. @@ -810,7 +810,7 @@ void lm_gpiowrite(uint32_t pinset, bool value) * "... All bits are cleared by a reset." */ - putreg32((uint32_t)value << pinno, base + LM3S_GPIO_DATA_OFFSET + (1 << (pinno + 2))); + putreg32((uint32_t)value << pinno, base + LM_GPIO_DATA_OFFSET + (1 << (pinno + 2))); } /**************************************************************************** @@ -849,6 +849,6 @@ bool lm_gpioread(uint32_t pinset, bool value) * are cleared by a reset." */ - return (getreg32(base + LM3S_GPIO_DATA_OFFSET + (1 << (pinno + 2))) != 0); + return (getreg32(base + LM_GPIO_DATA_OFFSET + (1 << (pinno + 2))) != 0); } diff --git a/nuttx/arch/arm/src/lm/lm_gpioirq.c b/nuttx/arch/arm/src/lm/lm_gpioirq.c index f77f878dea..e8423f4c08 100644 --- a/nuttx/arch/arm/src/lm/lm_gpioirq.c +++ b/nuttx/arch/arm/src/lm/lm_gpioirq.c @@ -73,38 +73,38 @@ static FAR xcpt_t g_gpioirqvector[NR_GPIO_IRQS]; static const uint32_t g_gpiobase[] = { #ifndef CONFIG_LM_DISABLE_GPIOA_IRQS - LM3S_GPIOA_BASE, + LM_GPIOA_BASE, #endif #ifndef CONFIG_LM_DISABLE_GPIOB_IRQS - LM3S_GPIOB_BASE, + LM_GPIOB_BASE, #endif #ifndef CONFIG_LM_DISABLE_GPIOC_IRQS - LM3S_GPIOC_BASE, + LM_GPIOC_BASE, #endif #ifndef CONFIG_LM_DISABLE_GPIOD_IRQS - LM3S_GPIOD_BASE, + LM_GPIOD_BASE, #endif #ifndef CONFIG_LM_DISABLE_GPIOE_IRQS - LM3S_GPIOE_BASE, + LM_GPIOE_BASE, #endif #ifndef CONFIG_LM_DISABLE_GPIOF_IRQS - LM3S_GPIOF_BASE, + LM_GPIOF_BASE, #endif #ifndef CONFIG_LM_DISABLE_GPIOG_IRQS - LM3S_GPIOG_BASE, + LM_GPIOG_BASE, #endif - /* NOTE: Not all LM3S architectures support GPIOs above GPIOG. If the chip - * does not support these higher ports, then they must be disabled in the - * configuration. Otherwise, the following will likely cause compilation + /* NOTE: Not all Stellaris architectures support GPIOs above GPIOG. If the + * chip does not support these higher ports, then they must be disabled in + * the configuration. Otherwise, the following will likely cause compilation * errors! */ #ifndef CONFIG_LM_DISABLE_GPIOH_IRQS - LM3S_GPIOH_BASE, + LM_GPIOH_BASE, #endif #ifndef CONFIG_LM_DISABLE_GPIOJ_IRQS - LM3S_GPIOJ_BASE, + LM_GPIOJ_BASE, #endif }; @@ -161,7 +161,7 @@ static int lm_gpiohandler(uint32_t regbase, int irqbase, void *context) * either no interrupt has been generated, or the interrupt is masked." */ - mis = getreg32(regbase + LM3S_GPIO_MIS_OFFSET) & 0xff; + mis = getreg32(regbase + LM_GPIO_MIS_OFFSET) & 0xff; /* Clear all GPIO interrupts that we are going to process. "The GPIO ICR * register is the interrupt clear register. Writing a 1 to a bit in this @@ -169,7 +169,7 @@ static int lm_gpiohandler(uint32_t regbase, int irqbase, void *context) * Writing a 0 has no effect." */ - putreg32(mis, regbase + LM3S_GPIO_ICR_OFFSET); + putreg32(mis, regbase + LM_GPIO_ICR_OFFSET); /* Now process each IRQ pending in the MIS */ @@ -187,63 +187,63 @@ static int lm_gpiohandler(uint32_t regbase, int irqbase, void *context) #ifndef CONFIG_LM_DISABLE_GPIOA_IRQS static int lm_gpioahandler(int irq, FAR void *context) { - return lm_gpiohandler(LM3S_GPIOA_BASE, LM3S_IRQ_GPIOA_0, context); + return lm_gpiohandler(LM_GPIOA_BASE, LM_IRQ_GPIOA_0, context); } #endif #ifndef CONFIG_LM_DISABLE_GPIOB_IRQS static int lm_gpiobhandler(int irq, FAR void *context) { - return lm_gpiohandler(LM3S_GPIOB_BASE, LM3S_IRQ_GPIOB_0, context); + return lm_gpiohandler(LM_GPIOB_BASE, LM_IRQ_GPIOB_0, context); } #endif #ifndef CONFIG_LM_DISABLE_GPIOC_IRQS static int lm_gpiochandler(int irq, FAR void *context) { - return lm_gpiohandler(LM3S_GPIOC_BASE, LM3S_IRQ_GPIOC_0, context); + return lm_gpiohandler(LM_GPIOC_BASE, LM_IRQ_GPIOC_0, context); } #endif #ifndef CONFIG_LM_DISABLE_GPIOD_IRQS static int lm_gpiodhandler(int irq, FAR void *context) { - return lm_gpiohandler(LM3S_GPIOD_BASE, LM3S_IRQ_GPIOD_0, context); + return lm_gpiohandler(LM_GPIOD_BASE, LM_IRQ_GPIOD_0, context); } #endif #ifndef CONFIG_LM_DISABLE_GPIOE_IRQS static int lm_gpioehandler(int irq, FAR void *context) { - return lm_gpiohandler(LM3S_GPIOE_BASE, LM3S_IRQ_GPIOE_0, context); + return lm_gpiohandler(LM_GPIOE_BASE, LM_IRQ_GPIOE_0, context); } #endif #ifndef CONFIG_LM_DISABLE_GPIOF_IRQS static int lm_gpiofhandler(int irq, FAR void *context) { - return lm_gpiohandler(LM3S_GPIOF_BASE, LM3S_IRQ_GPIOF_0, context); + return lm_gpiohandler(LM_GPIOF_BASE, LM_IRQ_GPIOF_0, context); } #endif #ifndef CONFIG_LM_DISABLE_GPIOG_IRQS static int lm_gpioghandler(int irq, FAR void *context) { - return lm_gpiohandler(LM3S_GPIOG_BASE, LM3S_IRQ_GPIOG_0, context); + return lm_gpiohandler(LM_GPIOG_BASE, LM_IRQ_GPIOG_0, context); } #endif #ifndef CONFIG_LM_DISABLE_GPIOH_IRQS static int lm_gpiohhandler(int irq, FAR void *context) { - return lm_gpiohandler(LM3S_GPIOH_BASE, LM3S_IRQ_GPIOH_0, context); + return lm_gpiohandler(LM_GPIOH_BASE, LM_IRQ_GPIOH_0, context); } #endif #ifndef CONFIG_LM_DISABLE_GPIOJ_IRQS static int lm_gpiojhandler(int irq, FAR void *context) { - return lm_gpiohandler(LM3S_GPIOJ_BASE, LM3S_IRQ_GPIOJ_0, context); + return lm_gpiohandler(LM_GPIOJ_BASE, LM_IRQ_GPIOJ_0, context); } #endif @@ -275,40 +275,40 @@ int gpio_irqinitialize(void) */ #ifndef CONFIG_LM_DISABLE_GPIOA_IRQS - irq_attach(LM3S_IRQ_GPIOA, lm_gpioahandler); - up_enable_irq(LM3S_IRQ_GPIOA); + irq_attach(LM_IRQ_GPIOA, lm_gpioahandler); + up_enable_irq(LM_IRQ_GPIOA); #endif #ifndef CONFIG_LM_DISABLE_GPIOB_IRQS - irq_attach(LM3S_IRQ_GPIOB, lm_gpiobhandler); - up_enable_irq(LM3S_IRQ_GPIOB); + irq_attach(LM_IRQ_GPIOB, lm_gpiobhandler); + up_enable_irq(LM_IRQ_GPIOB); #endif #ifndef CONFIG_LM_DISABLE_GPIOC_IRQS - irq_attach(LM3S_IRQ_GPIOC, lm_gpiochandler); - up_enable_irq(LM3S_IRQ_GPIOC); + irq_attach(LM_IRQ_GPIOC, lm_gpiochandler); + up_enable_irq(LM_IRQ_GPIOC); #endif #ifndef CONFIG_LM_DISABLE_GPIOD_IRQS - irq_attach(LM3S_IRQ_GPIOD, lm_gpiodhandler); - up_enable_irq(LM3S_IRQ_GPIOD); + irq_attach(LM_IRQ_GPIOD, lm_gpiodhandler); + up_enable_irq(LM_IRQ_GPIOD); #endif #ifndef CONFIG_LM_DISABLE_GPIOE_IRQS - irq_attach(LM3S_IRQ_GPIOE, lm_gpioehandler); - up_enable_irq(LM3S_IRQ_GPIOE); + irq_attach(LM_IRQ_GPIOE, lm_gpioehandler); + up_enable_irq(LM_IRQ_GPIOE); #endif #ifndef CONFIG_LM_DISABLE_GPIOF_IRQS - irq_attach(LM3S_IRQ_GPIOF, lm_gpiofhandler); - up_enable_irq(LM3S_IRQ_GPIOF); + irq_attach(LM_IRQ_GPIOF, lm_gpiofhandler); + up_enable_irq(LM_IRQ_GPIOF); #endif #ifndef CONFIG_LM_DISABLE_GPIOG_IRQS - irq_attach(LM3S_IRQ_GPIOG, lm_gpioghandler); - up_enable_irq(LM3S_IRQ_GPIOG); + irq_attach(LM_IRQ_GPIOG, lm_gpioghandler); + up_enable_irq(LM_IRQ_GPIOG); #endif #ifndef CONFIG_LM_DISABLE_GPIOH_IRQS - irq_attach(LM3S_IRQ_GPIOH, lm_gpiohhandler); - up_enable_irq(LM3S_IRQ_GPIOH); + irq_attach(LM_IRQ_GPIOH, lm_gpiohhandler); + up_enable_irq(LM_IRQ_GPIOH); #endif #ifndef CONFIG_LM_DISABLE_GPIOJ_IRQS - irq_attach(LM3S_IRQ_GPIOJ, lm_gpiojhandler); - up_enable_irq(LM3S_IRQ_GPIOJ); + irq_attach(LM_IRQ_GPIOJ, lm_gpiojhandler); + up_enable_irq(LM_IRQ_GPIOJ); #endif return OK; @@ -386,9 +386,9 @@ void gpio_irqenable(int irq) */ flags = irqsave(); - regval = getreg32(base + LM3S_GPIO_IM_OFFSET); + regval = getreg32(base + LM_GPIO_IM_OFFSET); regval |= pin; - putreg32(regval, base + LM3S_GPIO_IM_OFFSET); + putreg32(regval, base + LM_GPIO_IM_OFFSET); irqrestore(flags); } } @@ -425,10 +425,9 @@ void gpio_irqdisable(int irq) */ flags = irqsave(); - regval = getreg32(base + LM3S_GPIO_IM_OFFSET); + regval = getreg32(base + LM_GPIO_IM_OFFSET); regval &= ~pin; - putreg32(regval, base + LM3S_GPIO_IM_OFFSET); + putreg32(regval, base + LM_GPIO_IM_OFFSET); irqrestore(flags); } } - diff --git a/nuttx/arch/arm/src/lm/lm_irq.c b/nuttx/arch/arm/src/lm/lm_irq.c index 7009442021..fa8e271bc8 100644 --- a/nuttx/arch/arm/src/lm/lm_irq.c +++ b/nuttx/arch/arm/src/lm/lm_irq.c @@ -63,7 +63,7 @@ * bringup */ -#undef LM3S_IRQ_DEBUG +#undef LM_IRQ_DEBUG /* Get a 32-bit version of the default priority */ @@ -95,7 +95,7 @@ volatile uint32_t *current_regs; * ****************************************************************************/ -#if defined(LM3S_IRQ_DEBUG) && defined (CONFIG_DEBUG) +#if defined(LM_IRQ_DEBUG) && defined (CONFIG_DEBUG) static void lm_dumpnvic(const char *msg, int irq) { irqstate_t flags; @@ -201,21 +201,21 @@ static int lm_reserved(int irq, FAR void *context) static int lm_irqinfo(int irq, uint32_t *regaddr, uint32_t *bit) { - DEBUGASSERT(irq >= LM3S_IRQ_NMI && irq < NR_IRQS); + DEBUGASSERT(irq >= LM_IRQ_NMI && irq < NR_IRQS); /* Check for external interrupt */ - if (irq >= LM3S_IRQ_INTERRUPTS) + if (irq >= LM_IRQ_INTERRUPTS) { - if (irq < LM3S_IRQ_INTERRUPTS + 32) + if (irq < LM_IRQ_INTERRUPTS + 32) { *regaddr = NVIC_IRQ0_31_ENABLE; - *bit = 1 << (irq - LM3S_IRQ_INTERRUPTS); + *bit = 1 << (irq - LM_IRQ_INTERRUPTS); } else if (irq < NR_IRQS) { *regaddr = NVIC_IRQ32_63_ENABLE; - *bit = 1 << (irq - LM3S_IRQ_INTERRUPTS - 32); + *bit = 1 << (irq - LM_IRQ_INTERRUPTS - 32); } else { @@ -228,19 +228,19 @@ static int lm_irqinfo(int irq, uint32_t *regaddr, uint32_t *bit) else { *regaddr = NVIC_SYSHCON; - if (irq == LM3S_IRQ_MEMFAULT) + if (irq == LM_IRQ_MEMFAULT) { *bit = NVIC_SYSHCON_MEMFAULTENA; } - else if (irq == LM3S_IRQ_BUSFAULT) + else if (irq == LM_IRQ_BUSFAULT) { *bit = NVIC_SYSHCON_BUSFAULTENA; } - else if (irq == LM3S_IRQ_USAGEFAULT) + else if (irq == LM_IRQ_USAGEFAULT) { *bit = NVIC_SYSHCON_USGFAULTENA; } - else if (irq == LM3S_IRQ_SYSTICK) + else if (irq == LM_IRQ_SYSTICK) { *regaddr = NVIC_SYSTICK_CTRL; *bit = NVIC_SYSTICK_CTRL_ENABLE; @@ -309,13 +309,13 @@ void up_irqinitialize(void) * under certain conditions. */ - irq_attach(LM3S_IRQ_SVCALL, up_svcall); - irq_attach(LM3S_IRQ_HARDFAULT, up_hardfault); + irq_attach(LM_IRQ_SVCALL, up_svcall); + irq_attach(LM_IRQ_HARDFAULT, up_hardfault); /* Set the priority of the SVCall interrupt */ #ifdef CONFIG_ARCH_IRQPRIO -/* up_prioritize_irq(LM3S_IRQ_PENDSV, NVIC_SYSH_PRIORITY_MIN); */ +/* up_prioritize_irq(LM_IRQ_PENDSV, NVIC_SYSH_PRIORITY_MIN); */ #endif /* If the MPU is enabled, then attach and enable the Memory Management @@ -323,22 +323,22 @@ void up_irqinitialize(void) */ #ifdef CONFIG_ARMV7M_MPU - irq_attach(LM3S_IRQ_MEMFAULT, up_memfault); - up_enable_irq(LM3S_IRQ_MEMFAULT); + irq_attach(LM_IRQ_MEMFAULT, up_memfault); + up_enable_irq(LM_IRQ_MEMFAULT); #endif /* Attach all other processor exceptions (except reset and sys tick) */ #ifdef CONFIG_DEBUG - irq_attach(LM3S_IRQ_NMI, lm_nmi); + irq_attach(LM_IRQ_NMI, lm_nmi); #ifndef CONFIG_ARMV7M_MPU - irq_attach(LM3S_IRQ_MEMFAULT, up_memfault); + irq_attach(LM_IRQ_MEMFAULT, up_memfault); #endif - irq_attach(LM3S_IRQ_BUSFAULT, lm_busfault); - irq_attach(LM3S_IRQ_USAGEFAULT, lm_usagefault); - irq_attach(LM3S_IRQ_PENDSV, lm_pendsv); - irq_attach(LM3S_IRQ_DBGMONITOR, lm_dbgmonitor); - irq_attach(LM3S_IRQ_RESERVED, lm_reserved); + irq_attach(LM_IRQ_BUSFAULT, lm_busfault); + irq_attach(LM_IRQ_USAGEFAULT, lm_usagefault); + irq_attach(LM_IRQ_PENDSV, lm_pendsv); + irq_attach(LM_IRQ_DBGMONITOR, lm_dbgmonitor); + irq_attach(LM_IRQ_RESERVED, lm_reserved); #endif lm_dumpnvic("initial", NR_IRQS); @@ -433,16 +433,16 @@ int up_prioritize_irq(int irq, int priority) uint32_t regval; int shift; - DEBUGASSERT(irq >= LM3S_IRQ_MEMFAULT && irq < NR_IRQS && (unsigned)priority <= NVIC_SYSH_PRIORITY_MIN); + DEBUGASSERT(irq >= LM_IRQ_MEMFAULT && irq < NR_IRQS && (unsigned)priority <= NVIC_SYSH_PRIORITY_MIN); - if (irq < LM3S_IRQ_INTERRUPTS) + if (irq < LM_IRQ_INTERRUPTS) { irq -= 4; regaddr = NVIC_SYSH_PRIORITY(irq); } else { - irq -= LM3S_IRQ_INTERRUPTS; + irq -= LM_IRQ_INTERRUPTS; regaddr = NVIC_IRQ_PRIORITY(irq); } diff --git a/nuttx/arch/arm/src/lm/lm_lowputc.c b/nuttx/arch/arm/src/lm/lm_lowputc.c index d2c1f5be55..d461cd52eb 100644 --- a/nuttx/arch/arm/src/lm/lm_lowputc.c +++ b/nuttx/arch/arm/src/lm/lm_lowputc.c @@ -57,12 +57,12 @@ /* Configuration **********************************************************/ -#if LM3S_NUARTS < 2 +#if LM_NUARTS < 2 # undef CONFIG_LM_UART1 # undef CONFIG_UART1_SERIAL_CONSOLE #endif -#if LM3S_NUARTS < 3 +#if LM_NUARTS < 3 # undef CONFIG_LM_UART2 # undef CONFIG_UART2_SERIAL_CONSOLE #endif @@ -92,52 +92,52 @@ /* Select UART parameters for the selected console */ #if defined(CONFIG_UART0_SERIAL_CONSOLE) -# define LM3S_CONSOLE_BASE LM3S_UART0_BASE -# define LM3S_CONSOLE_BAUD CONFIG_UART0_BAUD -# define LM3S_CONSOLE_BITS CONFIG_UART0_BITS -# define LM3S_CONSOLE_PARITY CONFIG_UART0_PARITY -# define LM3S_CONSOLE_2STOP CONFIG_UART0_2STOP +# define LM_CONSOLE_BASE LM_UART0_BASE +# define LM_CONSOLE_BAUD CONFIG_UART0_BAUD +# define LM_CONSOLE_BITS CONFIG_UART0_BITS +# define LM_CONSOLE_PARITY CONFIG_UART0_PARITY +# define LM_CONSOLE_2STOP CONFIG_UART0_2STOP #elif defined(CONFIG_UART1_SERIAL_CONSOLE) -# define LM3S_CONSOLE_BASE LM3S_UART1_BASE -# define LM3S_CONSOLE_BAUD CONFIG_UART1_BAUD -# define LM3S_CONSOLE_BITS CONFIG_UART1_BITS -# define LM3S_CONSOLE_PARITY CONFIG_UART1_PARITY -# define LM3S_CONSOLE_2STOP CONFIG_UART1_2STOP +# define LM_CONSOLE_BASE LM_UART1_BASE +# define LM_CONSOLE_BAUD CONFIG_UART1_BAUD +# define LM_CONSOLE_BITS CONFIG_UART1_BITS +# define LM_CONSOLE_PARITY CONFIG_UART1_PARITY +# define LM_CONSOLE_2STOP CONFIG_UART1_2STOP #elif defined(CONFIG_UART2_SERIAL_CONSOLE) -# define LM3S_CONSOLE_BASE LM3S_UART2_BASE -# define LM3S_CONSOLE_BAUD CONFIG_UART2_BAUD -# define LM3S_CONSOLE_BITS CONFIG_UART2_BITS -# define LM3S_CONSOLE_PARITY CONFIG_UART2_PARITY -# define LM3S_CONSOLE_2STOP CONFIG_UART2_2STOP +# define LM_CONSOLE_BASE LM_UART2_BASE +# define LM_CONSOLE_BAUD CONFIG_UART2_BAUD +# define LM_CONSOLE_BITS CONFIG_UART2_BITS +# define LM_CONSOLE_PARITY CONFIG_UART2_PARITY +# define LM_CONSOLE_2STOP CONFIG_UART2_2STOP #else # error "No CONFIG_UARTn_SERIAL_CONSOLE Setting" #endif /* Get LCRH settings */ -#if LM3S_CONSOLE_BITS == 5 +#if LM_CONSOLE_BITS == 5 # define UART_LCRH_NBITS UART_LCRH_WLEN_5BITS -#elif LM3S_CONSOLE_BITS == 6 +#elif LM_CONSOLE_BITS == 6 # define UART_LCRH_NBITS UART_LCRH_WLEN_6BITS -#elif LM3S_CONSOLE_BITS == 7 +#elif LM_CONSOLE_BITS == 7 # define UART_LCRH_NBITS UART_LCRH_WLEN_7BITS -#elif LM3S_CONSOLE_BITS == 8 +#elif LM_CONSOLE_BITS == 8 # define UART_LCRH_NBITS UART_LCRH_WLEN_8BITS #else # error "Number of bits not supported" #endif -#if LM3S_CONSOLE_PARITY == 0 +#if LM_CONSOLE_PARITY == 0 # define UART_LCRH_PARITY (0) -#elif LM3S_CONSOLE_PARITY == 1 +#elif LM_CONSOLE_PARITY == 1 # define UART_LCRH_PARITY UART_LCRH_PEN -#elif LM3S_CONSOLE_PARITY == 2 +#elif LM_CONSOLE_PARITY == 2 # define UART_LCRH_PARITY (UART_LCRH_PEN|UART_LCRH_EPS) #else # error "Invalid parity selection" #endif -#if LM3S_CONSOLE_2STOP != 0 +#if LM_CONSOLE_2STOP != 0 # define UART_LCRH_NSTOP UART_LCRH_STP2 #else # define UART_LCRH_NSTOP (0) @@ -177,17 +177,17 @@ * divisor must be followed by a write to the UARTLCRH register for the changes to take effect. ..." */ -#define LM3S_BRDDEN (16 * LM3S_CONSOLE_BAUD) -#define LM3S_BRDI (SYSCLK_FREQUENCY / LM3S_BRDDEN) -#define LM3S_REMAINDER (SYSCLK_FREQUENCY - LM3S_BRDDEN * LM3S_BRDI) -#define LM3S_DIVFRAC ((LM3S_REMAINDER * 64 + (LM3S_BRDDEN/2)) / LM3S_BRDDEN) +#define LM_BRDDEN (16 * LM_CONSOLE_BAUD) +#define LM_BRDI (SYSCLK_FREQUENCY / LM_BRDDEN) +#define LM_REMAINDER (SYSCLK_FREQUENCY - LM_BRDDEN * LM_BRDI) +#define LM_DIVFRAC ((LM_REMAINDER * 64 + (LM_BRDDEN/2)) / LM_BRDDEN) -/* For example: LM3S_CONSOLE_BAUD = 115,200, SYSCLK_FREQUENCY = 50,000,000: +/* For example: LM_CONSOLE_BAUD = 115,200, SYSCLK_FREQUENCY = 50,000,000: * - * LM3S_BRDDEN = (16 * 115,200) = 1,843,200 - * LM3S_BRDI = 50,000,000 / 1,843,200 = 27 - * LM3S_REMAINDER = 50,000,000 - 1,843,200 * 27 = 233,600 - * LM3S_DIVFRAC = (233,600 * 64 + 921,600) / 1,843,200 = 8 + * LM_BRDDEN = (16 * 115,200) = 1,843,200 + * LM_BRDI = 50,000,000 / 1,843,200 = 27 + * LM_REMAINDER = 50,000,000 - 1,843,200 * 27 = 233,600 + * LM_DIVFRAC = (233,600 * 64 + 921,600) / 1,843,200 = 8 * * Which should yied BAUD = 50,000,000 / (16 * (27 + 8/64)) = 115207.37 */ @@ -229,11 +229,11 @@ void up_lowputc(char ch) #ifdef HAVE_CONSOLE /* Wait until the TX FIFO is not full */ - while ((getreg32(LM3S_CONSOLE_BASE+LM3S_UART_FR_OFFSET) & UART_FR_TXFF) != 0); + while ((getreg32(LM_CONSOLE_BASE+LM_UART_FR_OFFSET) & UART_FR_TXFF) != 0); /* Then send the character */ - putreg32((uint32_t)ch, LM3S_CONSOLE_BASE+LM3S_UART_DR_OFFSET); + putreg32((uint32_t)ch, LM_CONSOLE_BASE+LM_UART_DR_OFFSET); #endif } @@ -260,18 +260,18 @@ void up_lowsetup(void) */ #ifdef CONFIG_LM_UART0 - regval = getreg32(LM3S_SYSCON_RCGC1); + regval = getreg32(LM_SYSCON_RCGC1); regval |= SYSCON_RCGC1_UART0; - putreg32(regval, LM3S_SYSCON_RCGC1); + putreg32(regval, LM_SYSCON_RCGC1); lm_configgpio(GPIO_UART0_RX); lm_configgpio(GPIO_UART0_TX); #endif #ifdef CONFIG_LM_UART1 - regval = getreg32(LM3S_SYSCON_RCGC1); + regval = getreg32(LM_SYSCON_RCGC1); regval |= SYSCON_RCGC1_UART1; - putreg32(regval, LM3S_SYSCON_RCGC1); + putreg32(regval, LM_SYSCON_RCGC1); lm_configgpio(GPIO_UART1_RX); lm_configgpio(GPIO_UART1_TX); @@ -282,26 +282,26 @@ void up_lowsetup(void) #if defined(HAVE_CONSOLE) && !defined(CONFIG_SUPPRESS_UART_CONFIG) /* Disable the UART by clearing the UARTEN bit in the UART CTL register */ - ctl = getreg32(LM3S_CONSOLE_BASE+LM3S_UART_CTL_OFFSET); + ctl = getreg32(LM_CONSOLE_BASE+LM_UART_CTL_OFFSET); ctl &= ~UART_CTL_UARTEN; - putreg32(ctl, LM3S_CONSOLE_BASE+LM3S_UART_CTL_OFFSET); + putreg32(ctl, LM_CONSOLE_BASE+LM_UART_CTL_OFFSET); /* Write the integer portion of the BRD to the UART IBRD register */ - putreg32(LM3S_BRDI, LM3S_CONSOLE_BASE+LM3S_UART_IBRD_OFFSET); + putreg32(LM_BRDI, LM_CONSOLE_BASE+LM_UART_IBRD_OFFSET); /* Write the fractional portion of the BRD to the UART FBRD register */ - putreg32(LM3S_DIVFRAC, LM3S_CONSOLE_BASE+LM3S_UART_FBRD_OFFSET); + putreg32(LM_DIVFRAC, LM_CONSOLE_BASE+LM_UART_FBRD_OFFSET); /* Write the desired serial parameters to the UART LCRH register */ - putreg32(UART_LCRH_VALUE, LM3S_CONSOLE_BASE+LM3S_UART_LCRH_OFFSET); + putreg32(UART_LCRH_VALUE, LM_CONSOLE_BASE+LM_UART_LCRH_OFFSET); /* Enable the UART by setting the UARTEN bit in the UART CTL register */ ctl |= (UART_CTL_UARTEN|UART_CTL_TXE|UART_CTL_RXE); - putreg32(ctl, LM3S_CONSOLE_BASE+LM3S_UART_CTL_OFFSET); + putreg32(ctl, LM_CONSOLE_BASE+LM_UART_CTL_OFFSET); #endif } diff --git a/nuttx/arch/arm/src/lm/lm_serial.c b/nuttx/arch/arm/src/lm/lm_serial.c index e9f6049898..ede47a8cac 100644 --- a/nuttx/arch/arm/src/lm/lm_serial.c +++ b/nuttx/arch/arm/src/lm/lm_serial.c @@ -66,12 +66,12 @@ /* Some sanity checks *******************************************************/ -#if LM3S_NUARTS < 2 +#if LM_NUARTS < 2 # undef CONFIG_LM_UART1 # undef CONFIG_UART1_SERIAL_CONSOLE #endif -#if LM3S_NUARTS < 3 +#if LM_NUARTS < 3 # undef CONFIG_LM_UART2 # undef CONFIG_UART2_SERIAL_CONSOLE #endif @@ -274,14 +274,14 @@ static char g_uart2rxbuffer[CONFIG_UART2_RXBUFSIZE]; static char g_uart2txbuffer[CONFIG_UART2_TXBUFSIZE]; #endif -/* This describes the state of the LM3S uart0 port. */ +/* This describes the state of the Stellaris uart0 port. */ #ifdef CONFIG_LM_UART0 static struct up_dev_s g_uart0priv = { - .uartbase = LM3S_UART0_BASE, + .uartbase = LM_UART0_BASE, .baud = CONFIG_UART0_BAUD, - .irq = LM3S_IRQ_UART0, + .irq = LM_IRQ_UART0, .parity = CONFIG_UART0_PARITY, .bits = CONFIG_UART0_BITS, .stopbits2 = CONFIG_UART0_2STOP, @@ -304,14 +304,14 @@ static uart_dev_t g_uart0port = }; #endif -/* This describes the state of the LM3S uart1 port. */ +/* This describes the state of the Stellaris uart1 port. */ #ifdef CONFIG_LM_UART1 static struct up_dev_s g_uart1priv = { - .uartbase = LM3S_UART1_BASE, + .uartbase = LM_UART1_BASE, .baud = CONFIG_UART1_BAUD, - .irq = LM3S_IRQ_UART1, + .irq = LM_IRQ_UART1, .parity = CONFIG_UART1_PARITY, .bits = CONFIG_UART1_BITS, .stopbits2 = CONFIG_UART1_2STOP, @@ -334,14 +334,14 @@ static uart_dev_t g_uart1port = }; #endif -/* This describes the state of the LM3S uart1 port. */ +/* This describes the state of the Stellaris uart1 port. */ #ifdef CONFIG_LM_UART2 static struct up_dev_s g_uart2priv = { - .uartbase = LM3S_UART2_BASE, + .uartbase = LM_UART2_BASE, .baud = CONFIG_UART2_BAUD, - .irq = LM3S_IRQ_UART2, + .irq = LM_IRQ_UART2, .parity = CONFIG_UART2_PARITY, .bits = CONFIG_UART2_BITS, .stopbits2 = CONFIG_UART2_2STOP, @@ -402,7 +402,7 @@ static inline void up_disableuartint(struct up_dev_s *priv, uint32_t *im) /* Disable all interrupts */ priv->im = 0; - up_serialout(priv, LM3S_UART_IM_OFFSET, 0); + up_serialout(priv, LM_UART_IM_OFFSET, 0); } /**************************************************************************** @@ -412,7 +412,7 @@ static inline void up_disableuartint(struct up_dev_s *priv, uint32_t *im) static inline void up_restoreuartint(struct up_dev_s *priv, uint32_t im) { priv->im = im; - up_serialout(priv, LM3S_UART_IM_OFFSET, im); + up_serialout(priv, LM_UART_IM_OFFSET, im); } /**************************************************************************** @@ -430,7 +430,7 @@ static inline void up_waittxnotfull(struct up_dev_s *priv) { /* Check Tx FIFO is full */ - if ((up_serialin(priv, LM3S_UART_FR_OFFSET) & UART_FR_TXFF) == 0) + if ((up_serialin(priv, LM_UART_FR_OFFSET) & UART_FR_TXFF) == 0) { /* The Tx FIFO is not full... return */ @@ -471,9 +471,9 @@ static int up_setup(struct uart_dev_s *dev) /* Disable the UART by clearing the UARTEN bit in the UART CTL register */ - ctl = up_serialin(priv, LM3S_UART_CTL_OFFSET); + ctl = up_serialin(priv, LM_UART_CTL_OFFSET); ctl &= ~UART_CTL_UARTEN; - up_serialout(priv, LM3S_UART_CTL_OFFSET, ctl); + up_serialout(priv, LM_UART_CTL_OFFSET, ctl); /* Calculate BAUD rate from the SYS clock: * @@ -517,8 +517,8 @@ static int up_setup(struct uart_dev_s *dev) remainder = SYSCLK_FREQUENCY - den * brdi; divfrac = ((remainder << 6) + (den >> 1)) / den; - up_serialout(priv, LM3S_UART_IBRD_OFFSET, brdi); - up_serialout(priv, LM3S_UART_FBRD_OFFSET, divfrac); + up_serialout(priv, LM_UART_IBRD_OFFSET, brdi); + up_serialout(priv, LM_UART_FBRD_OFFSET, divfrac); /* Set up the LCRH register */ @@ -558,14 +558,14 @@ static int up_setup(struct uart_dev_s *dev) lcrh |= UART_LCRH_STP2; } - up_serialout(priv, LM3S_UART_LCRH_OFFSET, lcrh); + up_serialout(priv, LM_UART_LCRH_OFFSET, lcrh); #endif /* Set the UART to interrupt whenever the TX FIFO is almost empty or when * any character is received. */ - up_serialout(priv, LM3S_UART_IFLS_OFFSET, UART_IFLS_TXIFLSEL_18th|UART_IFLS_RXIFLSEL_18th); + up_serialout(priv, LM_UART_IFLS_OFFSET, UART_IFLS_TXIFLSEL_18th|UART_IFLS_RXIFLSEL_18th); /* Flush the Rx and Tx FIFOs -- How do you do that?*/ @@ -575,27 +575,27 @@ static int up_setup(struct uart_dev_s *dev) * yet because the interrupt is still disabled at the interrupt controller. */ - up_serialout(priv, LM3S_UART_IM_OFFSET, UART_IM_RXIM|UART_IM_RTIM); + up_serialout(priv, LM_UART_IM_OFFSET, UART_IM_RXIM|UART_IM_RTIM); /* Enable the FIFOs */ #ifdef CONFIG_SUPPRESS_UART_CONFIG - lcrh = up_serialin(priv, LM3S_UART_LCRH_OFFSET); + lcrh = up_serialin(priv, LM_UART_LCRH_OFFSET); #endif lcrh |= UART_LCRH_FEN; - up_serialout(priv, LM3S_UART_LCRH_OFFSET, lcrh); + up_serialout(priv, LM_UART_LCRH_OFFSET, lcrh); /* Enable Rx, Tx, and the UART */ #ifdef CONFIG_SUPPRESS_UART_CONFIG - ctl = up_serialin(priv, LM3S_UART_CTL_OFFSET); + ctl = up_serialin(priv, LM_UART_CTL_OFFSET); #endif ctl |= (UART_CTL_UARTEN|UART_CTL_TXE|UART_CTL_RXE); - up_serialout(priv, LM3S_UART_CTL_OFFSET, ctl); + up_serialout(priv, LM_UART_CTL_OFFSET, ctl); /* Set up the cache IM value */ - priv->im = up_serialin(priv, LM3S_UART_IM_OFFSET); + priv->im = up_serialin(priv, LM_UART_IM_OFFSET); return OK; } @@ -716,8 +716,8 @@ static int up_interrupt(int irq, void *context) /* Get the masked UART status and clear the pending interrupts. */ - mis = up_serialin(priv, LM3S_UART_MIS_OFFSET); - up_serialout(priv, LM3S_UART_ICR_OFFSET, mis); + mis = up_serialin(priv, LM_UART_MIS_OFFSET); + up_serialout(priv, LM_UART_ICR_OFFSET, mis); /* Handle incoming, receive bytes (with or without timeout) */ @@ -797,7 +797,7 @@ static int up_receive(struct uart_dev_s *dev, uint32_t *status) /* Get the Rx byte + 4 bits of error information. Return those in status */ - rxd = up_serialin(priv, LM3S_UART_DR_OFFSET); + rxd = up_serialin(priv, LM_UART_DR_OFFSET); *status = rxd; /* The lower 8bits of the Rx data is the actual recevied byte */ @@ -830,7 +830,7 @@ static void up_rxint(struct uart_dev_s *dev, bool enable) { priv->im &= ~(UART_IM_RXIM|UART_IM_RTIM); } - up_serialout(priv, LM3S_UART_IM_OFFSET, priv->im); + up_serialout(priv, LM_UART_IM_OFFSET, priv->im); } /**************************************************************************** @@ -844,7 +844,7 @@ static void up_rxint(struct uart_dev_s *dev, bool enable) static bool up_rxavailable(struct uart_dev_s *dev) { struct up_dev_s *priv = (struct up_dev_s*)dev->priv; - return ((up_serialin(priv, LM3S_UART_FR_OFFSET) & UART_FR_RXFE) == 0); + return ((up_serialin(priv, LM_UART_FR_OFFSET) & UART_FR_RXFE) == 0); } /**************************************************************************** @@ -858,7 +858,7 @@ static bool up_rxavailable(struct uart_dev_s *dev) static void up_send(struct uart_dev_s *dev, int ch) { struct up_dev_s *priv = (struct up_dev_s*)dev->priv; - up_serialout(priv, LM3S_UART_DR_OFFSET, (uint32_t)ch); + up_serialout(priv, LM_UART_DR_OFFSET, (uint32_t)ch); } /**************************************************************************** @@ -881,11 +881,11 @@ static void up_txint(struct uart_dev_s *dev, bool enable) #ifndef CONFIG_SUPPRESS_SERIAL_INTS priv->im |= UART_IM_TXIM; - up_serialout(priv, LM3S_UART_IM_OFFSET, priv->im); + up_serialout(priv, LM_UART_IM_OFFSET, priv->im); /* The serial driver wants an interrupt here, but will not get get * one unless we "prime the pump." I believe that this is because - * behave like a level interrupt and the LM3S interrupts behave + * behave like a level interrupt and the Stellaris interrupts behave * (at least by default) like edge interrupts. * * In any event, faking a TX interrupt here solves the problem; @@ -901,7 +901,7 @@ static void up_txint(struct uart_dev_s *dev, bool enable) /* Disable the TX interrupt */ priv->im &= ~UART_IM_TXIM; - up_serialout(priv, LM3S_UART_IM_OFFSET, priv->im); + up_serialout(priv, LM_UART_IM_OFFSET, priv->im); } irqrestore(flags); } @@ -917,7 +917,7 @@ static void up_txint(struct uart_dev_s *dev, bool enable) static bool up_txready(struct uart_dev_s *dev) { struct up_dev_s *priv = (struct up_dev_s*)dev->priv; - return ((up_serialin(priv, LM3S_UART_FR_OFFSET) & UART_FR_TXFF) == 0); + return ((up_serialin(priv, LM_UART_FR_OFFSET) & UART_FR_TXFF) == 0); } /**************************************************************************** @@ -931,7 +931,7 @@ static bool up_txready(struct uart_dev_s *dev) static bool up_txempty(struct uart_dev_s *dev) { struct up_dev_s *priv = (struct up_dev_s*)dev->priv; - return ((up_serialin(priv, LM3S_UART_FR_OFFSET) & UART_FR_TXFE) != 0); + return ((up_serialin(priv, LM_UART_FR_OFFSET) & UART_FR_TXFE) != 0); } /**************************************************************************** @@ -1016,7 +1016,7 @@ int up_putc(int ch) up_disableuartint(priv, &im); up_waittxnotfull(priv); - up_serialout(priv, LM3S_UART_DR_OFFSET, (uint32_t)ch); + up_serialout(priv, LM_UART_DR_OFFSET, (uint32_t)ch); /* Check for LF */ @@ -1025,7 +1025,7 @@ int up_putc(int ch) /* Add CR */ up_waittxnotfull(priv); - up_serialout(priv, LM3S_UART_DR_OFFSET, (uint32_t)'\r'); + up_serialout(priv, LM_UART_DR_OFFSET, (uint32_t)'\r'); } up_waittxnotfull(priv); diff --git a/nuttx/arch/arm/src/lm/lm_ssi.c b/nuttx/arch/arm/src/lm/lm_ssi.c index c6f8dcdb16..dae08e0927 100644 --- a/nuttx/arch/arm/src/lm/lm_ssi.c +++ b/nuttx/arch/arm/src/lm/lm_ssi.c @@ -83,12 +83,12 @@ * such case, the following must be expanded). */ -#if LM3S_NSSI == 0 +#if LM_NSSI == 0 # undef CONFIG_SSI0_DISABLE # define CONFIG_SSI0_DISABLE 1 # undef CONFIG_SSI1_DISABLE # define CONFIG_SSI1_DISABLE 1 -#elif LM3S_NSSI == 1 +#elif LM_NSSI == 1 # undef CONFIG_SSI1_DISABLE # define CONFIG_SSI1_DISABLE 1 #endif @@ -102,15 +102,15 @@ # define NSSI_ENABLED 2 /* Two SSI interfaces: SSI0 & SSI1 */ # else # define NSSI_ENABLED 1 /* One SSI interface: SSI0 */ -# define SSI_BASE LM3S_SSI0_BASE -# define SSI_IRQ LM3S_IRQ_SSI0 +# define SSI_BASE LM_SSI0_BASE +# define SSI_IRQ LM_IRQ_SSI0 # endif #else # ifndef CONFIG_SSI1_DISABLE # define SSI1_NDX 0 /* Index to SSI1 in g_ssidev[] */ # define NSSI_ENABLED 1 /* One SSI interface: SSI1 */ -# define SSI_BASE LM3S_SSI1_BASE -# define SSI_IRQ LM3S_IRQ_SSI1 +# define SSI_BASE LM_SSI1_BASE +# define SSI_IRQ LM_IRQ_SSI1 # else # define NSSI_ENABLED 0 /* No SSI interfaces */ # endif @@ -124,19 +124,19 @@ /* The number of (16-bit) words that will fit in the Tx FIFO */ -#define LM3S_TXFIFO_WORDS 8 +#define LM_TXFIFO_WORDS 8 /* Configuration settings */ #ifndef CONFIG_SSI_TXLIMIT -# define CONFIG_SSI_TXLIMIT (LM3S_TXFIFO_WORDS/2) +# define CONFIG_SSI_TXLIMIT (LM_TXFIFO_WORDS/2) #endif -#if CONFIG_SSI_TXLIMIT < 1 || CONFIG_SSI_TXLIMIT > LM3S_TXFIFO_WORDS +#if CONFIG_SSI_TXLIMIT < 1 || CONFIG_SSI_TXLIMIT > LM_TXFIFO_WORDS # error "Invalid range for CONFIG_SSI_TXLIMIT" #endif -#if CONFIG_SSI_TXLIMIT && CONFIG_SSI_TXLIMIT < (LM3S_TXFIFO_WORDS/2) +#if CONFIG_SSI_TXLIMIT && CONFIG_SSI_TXLIMIT < (LM_TXFIFO_WORDS/2) # error "CONFIG_SSI_TXLIMIT must be at least half the TX FIFO size" #endif @@ -304,10 +304,10 @@ static struct lm_ssidev_s g_ssidev[] = { .ops = &g_spiops, #if NSSI_ENABLED > 1 - .base = LM3S_SSI0_BASE, + .base = LM_SSI0_BASE, #endif #if !defined(CONFIG_SSI_POLLWAIT) && NSSI_ENABLED > 1 - .irq = LM3S_IRQ_SSI0, + .irq = LM_IRQ_SSI0, #endif }, #endif @@ -315,10 +315,10 @@ static struct lm_ssidev_s g_ssidev[] = { .ops = &g_spiops, #if NSSI_ENABLED > 1 - .base = LM3S_SSI1_BASE, + .base = LM_SSI1_BASE, #endif #if !defined(CONFIG_SSI_POLLWAIT) && NSSI_ENABLED > 1 - .irq = LM3S_IRQ_SSI1, + .irq = LM_IRQ_SSI1, #endif }, #endif @@ -404,9 +404,9 @@ static uint32_t ssi_disable(struct lm_ssidev_s *priv) uint32_t retval; uint32_t regval; - retval = ssi_getreg(priv, LM3S_SSI_CR1_OFFSET); + retval = ssi_getreg(priv, LM_SSI_CR1_OFFSET); regval = (retval & ~SSI_CR1_SSE); - ssi_putreg(priv, LM3S_SSI_CR1_OFFSET, regval); + ssi_putreg(priv, LM_SSI_CR1_OFFSET, regval); ssivdbg("CR1: %08x\n", regval); return retval; } @@ -430,10 +430,10 @@ static uint32_t ssi_disable(struct lm_ssidev_s *priv) static void ssi_enable(struct lm_ssidev_s *priv, uint32_t enable) { - uint32_t regval = ssi_getreg(priv, LM3S_SSI_CR1_OFFSET); + uint32_t regval = ssi_getreg(priv, LM_SSI_CR1_OFFSET); regval &= ~SSI_CR1_SSE; regval |= (enable & SSI_CR1_SSE); - ssi_putreg(priv, LM3S_SSI_CR1_OFFSET, regval); + ssi_putreg(priv, LM_SSI_CR1_OFFSET, regval); ssivdbg("CR1: %08x\n", regval); } @@ -484,14 +484,14 @@ static void ssi_semtake(sem_t *sem) static void ssi_txnull(struct lm_ssidev_s *priv) { ssivdbg("TX: ->0xffff\n"); - ssi_putreg(priv, LM3S_SSI_DR_OFFSET, 0xffff); + ssi_putreg(priv, LM_SSI_DR_OFFSET, 0xffff); } static void ssi_txuint16(struct lm_ssidev_s *priv) { uint16_t *ptr = (uint16_t*)priv->txbuffer; ssivdbg("TX: %p->%04x\n", ptr, *ptr); - ssi_putreg(priv, LM3S_SSI_DR_OFFSET, (uint32_t)(*ptr++)); + ssi_putreg(priv, LM_SSI_DR_OFFSET, (uint32_t)(*ptr++)); priv->txbuffer = (void*)ptr; } @@ -499,7 +499,7 @@ static void ssi_txuint8(struct lm_ssidev_s *priv) { uint8_t *ptr = (uint8_t*)priv->txbuffer; ssivdbg("TX: %p->%02x\n", ptr, *ptr); - ssi_putreg(priv, LM3S_SSI_DR_OFFSET, (uint32_t)(*ptr++)); + ssi_putreg(priv, LM_SSI_DR_OFFSET, (uint32_t)(*ptr++)); priv->txbuffer = (void*)ptr; } @@ -523,17 +523,17 @@ static void ssi_txuint8(struct lm_ssidev_s *priv) static void ssi_rxnull(struct lm_ssidev_s *priv) { #if defined(SSI_DEBUG) && defined(CONFIG_DEBUG_VERBOSE) - uint32_t regval = ssi_getreg(priv, LM3S_SSI_DR_OFFSET); + uint32_t regval = ssi_getreg(priv, LM_SSI_DR_OFFSET); ssivdbg("RX: discard %04x\n", regval); #else - (void)ssi_getreg(priv, LM3S_SSI_DR_OFFSET); + (void)ssi_getreg(priv, LM_SSI_DR_OFFSET); #endif } static void ssi_rxuint16(struct lm_ssidev_s *priv) { uint16_t *ptr = (uint16_t*)priv->rxbuffer; - *ptr = (uint16_t)ssi_getreg(priv, LM3S_SSI_DR_OFFSET); + *ptr = (uint16_t)ssi_getreg(priv, LM_SSI_DR_OFFSET); ssivdbg("RX: %p<-%04x\n", ptr, *ptr); priv->rxbuffer = (void*)(++ptr); } @@ -541,7 +541,7 @@ static void ssi_rxuint16(struct lm_ssidev_s *priv) static void ssi_rxuint8(struct lm_ssidev_s *priv) { uint8_t *ptr = (uint8_t*)priv->rxbuffer; - *ptr = (uint8_t)ssi_getreg(priv, LM3S_SSI_DR_OFFSET); + *ptr = (uint8_t)ssi_getreg(priv, LM_SSI_DR_OFFSET); ssivdbg("RX: %p<-%02x\n", ptr, *ptr); priv->rxbuffer = (void*)(++ptr); } @@ -562,7 +562,7 @@ static void ssi_rxuint8(struct lm_ssidev_s *priv) static inline bool ssi_txfifofull(struct lm_ssidev_s *priv) { - return (ssi_getreg(priv, LM3S_SSI_SR_OFFSET) & SSI_SR_TNF) == 0; + return (ssi_getreg(priv, LM_SSI_SR_OFFSET) & SSI_SR_TNF) == 0; } /**************************************************************************** @@ -581,7 +581,7 @@ static inline bool ssi_txfifofull(struct lm_ssidev_s *priv) static inline bool ssi_rxfifoempty(struct lm_ssidev_s *priv) { - return (ssi_getreg(priv, LM3S_SSI_SR_OFFSET) & SSI_SR_RNE) == 0; + return (ssi_getreg(priv, LM_SSI_SR_OFFSET) & SSI_SR_RNE) == 0; } /**************************************************************************** @@ -657,7 +657,7 @@ static int ssi_performtx(struct lm_ssidev_s *priv) /* Check again... Now have all of the Tx words been sent? */ #ifndef CONFIG_SSI_POLLWAIT - regval = ssi_getreg(priv, LM3S_SSI_IM_OFFSET); + regval = ssi_getreg(priv, LM_SSI_IM_OFFSET); if (priv->ntxwords > 0) { /* No.. Enable the Tx FIFO interrupt. This interrupt occurs @@ -678,7 +678,7 @@ static int ssi_performtx(struct lm_ssidev_s *priv) regval &= ~(SSI_IM_TX|SSI_RIS_ROR); } - ssi_putreg(priv, LM3S_SSI_IM_OFFSET, regval); + ssi_putreg(priv, LM_SSI_IM_OFFSET, regval); #endif /* CONFIG_SSI_POLLWAIT */ } return ntxd; @@ -728,7 +728,7 @@ static inline void ssi_performrx(struct lm_ssidev_s *priv) */ #ifndef CONFIG_SSI_POLLWAIT - regval = ssi_getreg(priv, LM3S_SSI_IM_OFFSET); + regval = ssi_getreg(priv, LM_SSI_IM_OFFSET); if (priv->ntxwords == 0 && priv->nrxwords < priv->nwords) { /* There are no more outgoing words to send, but there are @@ -751,7 +751,7 @@ static inline void ssi_performrx(struct lm_ssidev_s *priv) regval &= ~(SSI_IM_RX|SSI_IM_RT); } - ssi_putreg(priv, LM3S_SSI_IM_OFFSET, regval); + ssi_putreg(priv, LM_SSI_IM_OFFSET, regval); #endif /* CONFIG_SSI_POLLWAIT */ } @@ -829,7 +829,7 @@ static int ssi_transfer(struct lm_ssidev_s *priv, const void *txbuffer, flags = irqsave(); ssivdbg("ntxwords: %d nrxwords: %d nwords: %d SR: %08x\n", priv->ntxwords, priv->nrxwords, priv->nwords, - ssi_getreg(priv, LM3S_SSI_SR_OFFSET)); + ssi_getreg(priv, LM_SSI_SR_OFFSET)); ntxd = ssi_performtx(priv); @@ -842,8 +842,8 @@ static int ssi_transfer(struct lm_ssidev_s *priv, const void *txbuffer, ssivdbg("ntxwords: %d nrxwords: %d nwords: %d SR: %08x IM: %08x\n", priv->ntxwords, priv->nrxwords, priv->nwords, - ssi_getreg(priv, LM3S_SSI_SR_OFFSET), - ssi_getreg(priv, LM3S_SSI_IM_OFFSET)); + ssi_getreg(priv, LM_SSI_SR_OFFSET), + ssi_getreg(priv, LM_SSI_IM_OFFSET)); /* Wait for the transfer to complete. Since there is no handshake * with SPI, the following should complete even if there are problems @@ -908,11 +908,11 @@ static inline struct lm_ssidev_s *ssi_mapirq(int irq) switch (irq) { #ifndef CONFIG_SSI0_DISABLE - case LM3S_IRQ_SSI0: + case LM_IRQ_SSI0: return &g_ssidev[SSI0_NDX]; #endif #ifndef CONFIG_SSI1_DISABLE - case LM3S_IRQ_SSI1: + case LM_IRQ_SSI1: return &g_ssidev[SSI1_NDX]; #endif default: @@ -952,8 +952,8 @@ static int ssi_interrupt(int irq, void *context) /* Clear pending interrupts */ - regval = ssi_getreg(priv, LM3S_SSI_RIS_OFFSET); - ssi_putreg(priv, LM3S_SSI_ICR_OFFSET, regval); + regval = ssi_getreg(priv, LM_SSI_RIS_OFFSET); + ssi_putreg(priv, LM_SSI_ICR_OFFSET, regval); /* Check for Rx FIFO overruns */ @@ -966,7 +966,7 @@ static int ssi_interrupt(int irq, void *context) ssivdbg("ntxwords: %d nrxwords: %d nwords: %d SR: %08x\n", priv->ntxwords, priv->nrxwords, priv->nwords, - ssi_getreg(priv, LM3S_SSI_SR_OFFSET)); + ssi_getreg(priv, LM_SSI_SR_OFFSET)); /* Handle outgoing Tx FIFO transfers */ @@ -978,8 +978,8 @@ static int ssi_interrupt(int irq, void *context) ssivdbg("ntxwords: %d nrxwords: %d nwords: %d SR: %08x IM: %08x\n", priv->ntxwords, priv->nrxwords, priv->nwords, - ssi_getreg(priv, LM3S_SSI_SR_OFFSET), - ssi_getreg(priv, LM3S_SSI_IM_OFFSET)); + ssi_getreg(priv, LM_SSI_SR_OFFSET), + ssi_getreg(priv, LM_SSI_IM_OFFSET)); /* Check if the transfer is complete */ @@ -987,7 +987,7 @@ static int ssi_interrupt(int irq, void *context) { /* Yes.. Disable all SSI interrupt sources */ - ssi_putreg(priv, LM3S_SSI_IM_OFFSET, 0); + ssi_putreg(priv, LM_SSI_IM_OFFSET, 0); /* Wake up the waiting thread */ @@ -1135,14 +1135,14 @@ static uint32_t ssi_setfrequencyinternal(struct lm_ssidev_s *priv, uint32_t freq /* Set CPDVSR */ DEBUGASSERT(cpsdvsr < 255); - ssi_putreg(priv, LM3S_SSI_CPSR_OFFSET, cpsdvsr); + ssi_putreg(priv, LM_SSI_CPSR_OFFSET, cpsdvsr); /* Set SCR */ - regval = ssi_getreg(priv, LM3S_SSI_CR0_OFFSET); + regval = ssi_getreg(priv, LM_SSI_CR0_OFFSET); regval &= ~SSI_CR0_SCR_MASK; regval |= (scr << SSI_CR0_SCR_SHIFT); - ssi_putreg(priv, LM3S_SSI_CR0_OFFSET, regval); + ssi_putreg(priv, LM_SSI_CR0_OFFSET, regval); ssivdbg("CR0: %08x CPSR: %08x\n", regval, cpsdvsr); /* Calcluate the actual frequency */ @@ -1235,10 +1235,10 @@ static void ssi_setmodeinternal(struct lm_ssidev_s *priv, enum spi_mode_e mode) /* Then set the selected mode: Freescale SPI format, mode0-3 */ - regval = ssi_getreg(priv, LM3S_SSI_CR0_OFFSET); + regval = ssi_getreg(priv, LM_SSI_CR0_OFFSET); regval &= ~(SSI_CR0_FRF_MASK|SSI_CR0_SPH|SSI_CR0_SPO); regval |= modebits; - ssi_putreg(priv, LM3S_SSI_CR0_OFFSET, regval); + ssi_putreg(priv, LM_SSI_CR0_OFFSET, regval); ssivdbg("CR0: %08x\n", regval); /* Save the mode so that subsequent re-configuratins will be faster */ @@ -1287,10 +1287,10 @@ static void ssi_setbitsinternal(struct lm_ssidev_s *priv, int nbits) DEBUGASSERT(priv); if (nbits != priv->nbits && nbits >=4 && nbits <= 16) { - regval = ssi_getreg(priv, LM3S_SSI_CR0_OFFSET); + regval = ssi_getreg(priv, LM_SSI_CR0_OFFSET); regval &= ~SSI_CR0_DSS_MASK; regval |= ((nbits - 1) << SSI_CR0_DSS_SHIFT); - ssi_putreg(priv, LM3S_SSI_CR0_OFFSET, regval); + ssi_putreg(priv, LM_SSI_CR0_OFFSET, regval); ssivdbg("CR0: %08x\n", regval); priv->nbits = nbits; @@ -1464,9 +1464,9 @@ FAR struct spi_dev_s *up_spiinitialize(int port) /* Enable the SSI0 peripheral */ - regval = getreg32(LM3S_SYSCON_RCGC1); + regval = getreg32(LM_SYSCON_RCGC1); regval |= SYSCON_RCGC1_SSI0; - putreg32(regval, LM3S_SYSCON_RCGC1); + putreg32(regval, LM_SYSCON_RCGC1); ssivdbg("RCGC1: %08x\n", regval); /* Configure SSI0 GPIOs (NOTE that SS is not initialized here, the @@ -1488,9 +1488,9 @@ FAR struct spi_dev_s *up_spiinitialize(int port) /* Enable the SSI1 peripheral */ - regval = getreg32(LM3S_SYSCON_RCGC1); + regval = getreg32(LM_SYSCON_RCGC1); regval |= SYSCON_RCGC1_SSI1; - putreg32(regval, LM3S_SYSCON_RCGC1); + putreg32(regval, LM_SYSCON_RCGC1); ssivdbg("RCGC1: %08x\n", regval); /* Configure SSI1 GPIOs */ @@ -1518,11 +1518,11 @@ FAR struct spi_dev_s *up_spiinitialize(int port) /* Set all CR1 fields to reset state. This will be master mode. */ - ssi_putreg(priv, LM3S_SSI_CR1_OFFSET, 0); + ssi_putreg(priv, LM_SSI_CR1_OFFSET, 0); /* Set all CR0 fields to the reset state. This will also select Freescale SPI mode. */ - ssi_putreg(priv, LM3S_SSI_CR0_OFFSET, 0); + ssi_putreg(priv, LM_SSI_CR0_OFFSET, 0); /* Set the initial mode to mode 0. The application may override * this initial setting using the setmode() method. @@ -1547,7 +1547,7 @@ FAR struct spi_dev_s *up_spiinitialize(int port) * while there is an SSI transfer in progress. */ - ssi_putreg(priv, LM3S_SSI_IM_OFFSET, 0); + ssi_putreg(priv, LM_SSI_IM_OFFSET, 0); /* Attach the interrupt */ diff --git a/nuttx/arch/arm/src/lm/lm_syscontrol.c b/nuttx/arch/arm/src/lm/lm_syscontrol.c index f0d0bd3c97..2ded66c8e0 100644 --- a/nuttx/arch/arm/src/lm/lm_syscontrol.c +++ b/nuttx/arch/arm/src/lm/lm_syscontrol.c @@ -159,7 +159,7 @@ static inline void lm_plllock(void) { /* Check if the PLL is locked on */ - if ((getreg32(LM3S_SYSCON_RIS) & SYSCON_RIS_PLLLRIS) != 0) + if ((getreg32(LM_SYSCON_RIS) & SYSCON_RIS_PLLLRIS) != 0) { /* Yes.. return now */ @@ -191,17 +191,17 @@ void lm_clockconfig(uint32_t newrcc, uint32_t newrcc2) /* Get the current values of the RCC and RCC2 registers */ - rcc = getreg32(LM3S_SYSCON_RCC); - rcc2 = getreg32(LM3S_SYSCON_RCC2); + rcc = getreg32(LM_SYSCON_RCC); + rcc2 = getreg32(LM_SYSCON_RCC2); /* Temporarily bypass the PLL and system clock dividers */ rcc |= SYSCON_RCC_BYPASS; rcc &= ~(SYSCON_RCC_USESYSDIV); - putreg32(rcc, LM3S_SYSCON_RCC); + putreg32(rcc, LM_SYSCON_RCC); rcc2 |= SYSCON_RCC2_BYPASS2; - putreg32(rcc2, LM3S_SYSCON_RCC2); + putreg32(rcc2, LM_SYSCON_RCC2); /* We are probably using the main oscillator. The main oscillator is disabled on * reset and so probably must be enabled here. The internal oscillator is enabled @@ -214,7 +214,7 @@ void lm_clockconfig(uint32_t newrcc, uint32_t newrcc2) /* Enable any selected osciallators (but don't disable any yet) */ rcc &= (~RCC_OSCMASK | (newrcc & RCC_OSCMASK)); - putreg32(rcc, LM3S_SYSCON_RCC); + putreg32(rcc, LM_SYSCON_RCC); /* Wait for the newly selected oscillator(s) to settle. This is tricky because * the time that we wait can be significant and is determined by the previous @@ -234,7 +234,7 @@ void lm_clockconfig(uint32_t newrcc, uint32_t newrcc2) /* Clear the PLL lock interrupt */ - putreg32(SYSCON_MISC_PLLLMIS, LM3S_SYSCON_MISC); + putreg32(SYSCON_MISC_PLLLMIS, LM_SYSCON_MISC); /* Write the new RCC/RCC2 values. Order depends upon whether RCC2 or RCC * is currently enabled. @@ -242,13 +242,13 @@ void lm_clockconfig(uint32_t newrcc, uint32_t newrcc2) if (rcc2 & SYSCON_RCC2_USERCC2) { - putreg32(rcc2, LM3S_SYSCON_RCC2); - putreg32(rcc, LM3S_SYSCON_RCC); + putreg32(rcc2, LM_SYSCON_RCC2); + putreg32(rcc, LM_SYSCON_RCC); } else { - putreg32(rcc, LM3S_SYSCON_RCC); - putreg32(rcc2, LM3S_SYSCON_RCC2); + putreg32(rcc, LM_SYSCON_RCC); + putreg32(rcc2, LM_SYSCON_RCC2); } /* Wait for the new crystal value and oscillator source to take effect */ @@ -279,8 +279,8 @@ void lm_clockconfig(uint32_t newrcc, uint32_t newrcc2) /* Now we can set the final RCC/RCC2 values */ - putreg32(rcc, LM3S_SYSCON_RCC); - putreg32(rcc2, LM3S_SYSCON_RCC2); + putreg32(rcc, LM_SYSCON_RCC); + putreg32(rcc2, LM_SYSCON_RCC2); /* Wait for the system divider to be effective */ @@ -303,13 +303,13 @@ void up_clockconfig(void) * around a PLL bug */ - putreg32(SYSCON_LPDOPCTL_2750MV, LM3S_SYSCON_LDOPCTL); + putreg32(SYSCON_LPDOPCTL_2750MV, LM_SYSCON_LDOPCTL); #endif /* Set the clocking to run with the default settings provided in the board.h * header file */ - lm_clockconfig(LM3S_RCC_VALUE, LM3S_RCC2_VALUE); + lm_clockconfig(LM_RCC_VALUE, LM_RCC2_VALUE); } diff --git a/nuttx/arch/arm/src/lm/lm_timerisr.c b/nuttx/arch/arm/src/lm/lm_timerisr.c index 0469a473b6..49e11e5c5a 100644 --- a/nuttx/arch/arm/src/lm/lm_timerisr.c +++ b/nuttx/arch/arm/src/lm/lm_timerisr.c @@ -130,7 +130,7 @@ void up_timerinit(void) /* Attach the timer interrupt vector */ - (void)irq_attach(LM3S_IRQ_SYSTICK, (xcpt_t)up_timerisr); + (void)irq_attach(LM_IRQ_SYSTICK, (xcpt_t)up_timerisr); /* Enable SysTick interrupts */ @@ -138,5 +138,5 @@ void up_timerinit(void) /* And enable the timer interrupt */ - up_enable_irq(LM3S_IRQ_SYSTICK); + up_enable_irq(LM_IRQ_SYSTICK); } diff --git a/nuttx/arch/arm/src/lm/lm_vectors.S b/nuttx/arch/arm/src/lm/lm_vectors.S index 93350a9ffa..fecff0428c 100644 --- a/nuttx/arch/arm/src/lm/lm_vectors.S +++ b/nuttx/arch/arm/src/lm/lm_vectors.S @@ -421,214 +421,214 @@ lm_vectors: .type handlers, function .thumb_func handlers: - HANDLER lm_reserved, LM3S_IRQ_RESERVED /* Unexpected/reserved vector */ - HANDLER lm_nmi, LM3S_IRQ_NMI /* Vector 2: Non-Maskable Interrupt (NMI) */ - HANDLER lm_hardfault, LM3S_IRQ_HARDFAULT /* Vector 3: Hard fault */ - HANDLER lm_mpu, LM3S_IRQ_MEMFAULT /* Vector 4: Memory management (MPU) */ - HANDLER lm_busfault, LM3S_IRQ_BUSFAULT /* Vector 5: Bus fault */ - HANDLER lm_usagefault, LM3S_IRQ_USAGEFAULT /* Vector 6: Usage fault */ - HANDLER lm_svcall, LM3S_IRQ_SVCALL /* Vector 11: SVC call */ - HANDLER lm_dbgmonitor, LM3S_IRQ_DBGMONITOR /* Vector 12: Debug Monitor */ - HANDLER lm_pendsv, LM3S_IRQ_PENDSV /* Vector 14: Penable system service request */ - HANDLER lm_systick, LM3S_IRQ_SYSTICK /* Vector 15: System tick */ + HANDLER lm_reserved, LM_IRQ_RESERVED /* Unexpected/reserved vector */ + HANDLER lm_nmi, LM_IRQ_NMI /* Vector 2: Non-Maskable Interrupt (NMI) */ + HANDLER lm_hardfault, LM_IRQ_HARDFAULT /* Vector 3: Hard fault */ + HANDLER lm_mpu, LM_IRQ_MEMFAULT /* Vector 4: Memory management (MPU) */ + HANDLER lm_busfault, LM_IRQ_BUSFAULT /* Vector 5: Bus fault */ + HANDLER lm_usagefault, LM_IRQ_USAGEFAULT /* Vector 6: Usage fault */ + HANDLER lm_svcall, LM_IRQ_SVCALL /* Vector 11: SVC call */ + HANDLER lm_dbgmonitor, LM_IRQ_DBGMONITOR /* Vector 12: Debug Monitor */ + HANDLER lm_pendsv, LM_IRQ_PENDSV /* Vector 14: Penable system service request */ + HANDLER lm_systick, LM_IRQ_SYSTICK /* Vector 15: System tick */ #if defined(CONFIG_ARCH_CHIP_LM3S6918) - HANDLER lm_gpioa, LM3S_IRQ_GPIOA /* Vector 16: GPIO Port A */ - HANDLER lm_gpiob, LM3S_IRQ_GPIOB /* Vector 17: GPIO Port B */ - HANDLER lm_gpioc, LM3S_IRQ_GPIOC /* Vector 18: GPIO Port C */ - HANDLER lm_gpiod, LM3S_IRQ_GPIOD /* Vector 19: GPIO Port D */ - HANDLER lm_gpioe, LM3S_IRQ_GPIOE /* Vector 20: GPIO Port E */ - HANDLER lm_uart0, LM3S_IRQ_UART0 /* Vector 21: UART 0 */ - HANDLER lm_uart1, LM3S_IRQ_UART1 /* Vector 22: UART 1 */ - HANDLER lm_ssi0, LM3S_IRQ_SSI0 /* Vector 23: SSI 0 */ - HANDLER lm_i2c0, LM3S_IRQ_I2C0 /* Vector 24: I2C 0 */ - HANDLER lm_adc0, LM3S_IRQ_ADC0 /* Vector 30: ADC Sequence 0 */ - HANDLER lm_adc1, LM3S_IRQ_ADC1 /* Vector 31: ADC Sequence 1 */ - HANDLER lm_adc2, LM3S_IRQ_ADC2 /* Vector 32: ADC Sequence 2 */ - HANDLER lm_adc3, LM3S_IRQ_ADC3 /* Vector 33: ADC Sequence 3 */ - HANDLER lm_wdog, LM3S_IRQ_WDOG /* Vector 34: Watchdog Timer */ - HANDLER lm_tmr0a, LM3S_IRQ_TIMER0A /* Vector 35: Timer 0 A */ - HANDLER lm_tmr0b, LM3S_IRQ_TIMER0B /* Vector 36: Timer 0 B */ - HANDLER lm_tmr1a, LM3S_IRQ_TIMER1A /* Vector 37: Timer 1 A */ - HANDLER lm_tmr1b, LM3S_IRQ_TIMER1B /* Vector 38: Timer 1 B */ - HANDLER lm_tmr2a, LM3S_IRQ_TIMER2A /* Vector 39: Timer 2 A */ - HANDLER lm_tmr2b, LM3S_IRQ_TIMER2B /* Vector 40: Timer 3 B */ - HANDLER lm_cmp0, LM3S_IRQ_COMPARE0 /* Vector 41: Analog Comparator 0 */ - HANDLER lm_cmp1, LM3S_IRQ_COMPARE1 /* Vector 42: Analog Comparator 1 */ - HANDLER lm_syscon, LM3S_IRQ_SYSCON /* Vector 44: System Control */ - HANDLER lm_flashcon, LM3S_IRQ_FLASHCON /* Vector 45: FLASH Control */ - HANDLER lm_gpiof, LM3S_IRQ_GPIOF /* Vector 46: GPIO Port F */ - HANDLER lm_gpiog, LM3S_IRQ_GPIOG /* Vector 47: GPIO Port G */ - HANDLER lm_gpioh, LM3S_IRQ_GPIOH /* Vector 48: GPIO Port H */ - HANDLER lm_ssi1, LM3S_IRQ_SSI1 /* Vector 50: SSI 1 */ - HANDLER lm_tmr3a, LM3S_IRQ_TIMER3A /* Vector 51: Timer 3 A */ - HANDLER lm_tmr3b, LM3S_IRQ_TIMER3B /* Vector 52: Timer 3 B */ - HANDLER lm_i2c1, LM3S_IRQ_I2C1 /* Vector 53: I2C 1 */ - HANDLER lm_eth, LM3S_IRQ_ETHCON /* Vector 58: Ethernet Controller */ - HANDLER lm_hib, LM3S_IRQ_HIBERNATE /* Vector 59: Hibernation Module */ + HANDLER lm_gpioa, LM_IRQ_GPIOA /* Vector 16: GPIO Port A */ + HANDLER lm_gpiob, LM_IRQ_GPIOB /* Vector 17: GPIO Port B */ + HANDLER lm_gpioc, LM_IRQ_GPIOC /* Vector 18: GPIO Port C */ + HANDLER lm_gpiod, LM_IRQ_GPIOD /* Vector 19: GPIO Port D */ + HANDLER lm_gpioe, LM_IRQ_GPIOE /* Vector 20: GPIO Port E */ + HANDLER lm_uart0, LM_IRQ_UART0 /* Vector 21: UART 0 */ + HANDLER lm_uart1, LM_IRQ_UART1 /* Vector 22: UART 1 */ + HANDLER lm_ssi0, LM_IRQ_SSI0 /* Vector 23: SSI 0 */ + HANDLER lm_i2c0, LM_IRQ_I2C0 /* Vector 24: I2C 0 */ + HANDLER lm_adc0, LM_IRQ_ADC0 /* Vector 30: ADC Sequence 0 */ + HANDLER lm_adc1, LM_IRQ_ADC1 /* Vector 31: ADC Sequence 1 */ + HANDLER lm_adc2, LM_IRQ_ADC2 /* Vector 32: ADC Sequence 2 */ + HANDLER lm_adc3, LM_IRQ_ADC3 /* Vector 33: ADC Sequence 3 */ + HANDLER lm_wdog, LM_IRQ_WDOG /* Vector 34: Watchdog Timer */ + HANDLER lm_tmr0a, LM_IRQ_TIMER0A /* Vector 35: Timer 0 A */ + HANDLER lm_tmr0b, LM_IRQ_TIMER0B /* Vector 36: Timer 0 B */ + HANDLER lm_tmr1a, LM_IRQ_TIMER1A /* Vector 37: Timer 1 A */ + HANDLER lm_tmr1b, LM_IRQ_TIMER1B /* Vector 38: Timer 1 B */ + HANDLER lm_tmr2a, LM_IRQ_TIMER2A /* Vector 39: Timer 2 A */ + HANDLER lm_tmr2b, LM_IRQ_TIMER2B /* Vector 40: Timer 3 B */ + HANDLER lm_cmp0, LM_IRQ_COMPARE0 /* Vector 41: Analog Comparator 0 */ + HANDLER lm_cmp1, LM_IRQ_COMPARE1 /* Vector 42: Analog Comparator 1 */ + HANDLER lm_syscon, LM_IRQ_SYSCON /* Vector 44: System Control */ + HANDLER lm_flashcon, LM_IRQ_FLASHCON /* Vector 45: FLASH Control */ + HANDLER lm_gpiof, LM_IRQ_GPIOF /* Vector 46: GPIO Port F */ + HANDLER lm_gpiog, LM_IRQ_GPIOG /* Vector 47: GPIO Port G */ + HANDLER lm_gpioh, LM_IRQ_GPIOH /* Vector 48: GPIO Port H */ + HANDLER lm_ssi1, LM_IRQ_SSI1 /* Vector 50: SSI 1 */ + HANDLER lm_tmr3a, LM_IRQ_TIMER3A /* Vector 51: Timer 3 A */ + HANDLER lm_tmr3b, LM_IRQ_TIMER3B /* Vector 52: Timer 3 B */ + HANDLER lm_i2c1, LM_IRQ_I2C1 /* Vector 53: I2C 1 */ + HANDLER lm_eth, LM_IRQ_ETHCON /* Vector 58: Ethernet Controller */ + HANDLER lm_hib, LM_IRQ_HIBERNATE /* Vector 59: Hibernation Module */ #elif defined(CONFIG_ARCH_CHIP_LM3S6432) - HANDLER lm_gpioa, LM3S_IRQ_GPIOA /* Vector 16: GPIO Port A */ - HANDLER lm_gpiob, LM3S_IRQ_GPIOB /* Vector 17: GPIO Port B */ - HANDLER lm_gpioc, LM3S_IRQ_GPIOC /* Vector 18: GPIO Port C */ - HANDLER lm_gpiod, LM3S_IRQ_GPIOD /* Vector 19: GPIO Port D */ - HANDLER lm_gpioe, LM3S_IRQ_GPIOE /* Vector 20: GPIO Port E */ - HANDLER lm_uart0, LM3S_IRQ_UART0 /* Vector 21: UART 0 */ - HANDLER lm_uart1, LM3S_IRQ_UART1 /* Vector 22: UART 1 */ - HANDLER lm_ssi0, LM3S_IRQ_SSI0 /* Vector 23: SSI 0 */ - HANDLER lm_i2c0, LM3S_IRQ_I2C0 /* Vector 24: I2C 0 */ - HANDLER lm_pwm0, LM3S_IRQ_PWM0 /* Vector 26: PWM Generator 0 */ - HANDLER lm_adc0, LM3S_IRQ_ADC0 /* Vector 30: ADC Sequence 0 */ - HANDLER lm_adc1, LM3S_IRQ_ADC1 /* Vector 31: ADC Sequence 1 */ - HANDLER lm_adc2, LM3S_IRQ_ADC2 /* Vector 32: ADC Sequence 2 */ - HANDLER lm_adc3, LM3S_IRQ_ADC3 /* Vector 33: ADC Sequence 3 */ - HANDLER lm_wdog, LM3S_IRQ_WDOG /* Vector 34: Watchdog Timer */ - HANDLER lm_tmr0a, LM3S_IRQ_TIMER0A /* Vector 35: Timer 0 A */ - HANDLER lm_tmr0b, LM3S_IRQ_TIMER0B /* Vector 36: Timer 0 B */ - HANDLER lm_tmr1a, LM3S_IRQ_TIMER1A /* Vector 37: Timer 1 A */ - HANDLER lm_tmr1b, LM3S_IRQ_TIMER1B /* Vector 38: Timer 1 B */ - HANDLER lm_tmr2a, LM3S_IRQ_TIMER2A /* Vector 39: Timer 2 A */ - HANDLER lm_tmr2b, LM3S_IRQ_TIMER2B /* Vector 40: Timer 3 B */ - HANDLER lm_cmp0, LM3S_IRQ_COMPARE0 /* Vector 41: Analog Comparator 0 */ - HANDLER lm_cmp1, LM3S_IRQ_COMPARE1 /* Vector 42: Analog Comparator 1 */ - HANDLER lm_syscon, LM3S_IRQ_SYSCON /* Vector 44: System Control */ - HANDLER lm_flashcon, LM3S_IRQ_FLASHCON /* Vector 45: FLASH Control */ - HANDLER lm_gpiof, LM3S_IRQ_GPIOF /* Vector 46: GPIO Port F */ - HANDLER lm_gpiog, LM3S_IRQ_GPIOG /* Vector 47: GPIO Port G */ - HANDLER lm_eth, LM3S_IRQ_ETHCON /* Vector 58: Ethernet Controller */ + HANDLER lm_gpioa, LM_IRQ_GPIOA /* Vector 16: GPIO Port A */ + HANDLER lm_gpiob, LM_IRQ_GPIOB /* Vector 17: GPIO Port B */ + HANDLER lm_gpioc, LM_IRQ_GPIOC /* Vector 18: GPIO Port C */ + HANDLER lm_gpiod, LM_IRQ_GPIOD /* Vector 19: GPIO Port D */ + HANDLER lm_gpioe, LM_IRQ_GPIOE /* Vector 20: GPIO Port E */ + HANDLER lm_uart0, LM_IRQ_UART0 /* Vector 21: UART 0 */ + HANDLER lm_uart1, LM_IRQ_UART1 /* Vector 22: UART 1 */ + HANDLER lm_ssi0, LM_IRQ_SSI0 /* Vector 23: SSI 0 */ + HANDLER lm_i2c0, LM_IRQ_I2C0 /* Vector 24: I2C 0 */ + HANDLER lm_pwm0, LM_IRQ_PWM0 /* Vector 26: PWM Generator 0 */ + HANDLER lm_adc0, LM_IRQ_ADC0 /* Vector 30: ADC Sequence 0 */ + HANDLER lm_adc1, LM_IRQ_ADC1 /* Vector 31: ADC Sequence 1 */ + HANDLER lm_adc2, LM_IRQ_ADC2 /* Vector 32: ADC Sequence 2 */ + HANDLER lm_adc3, LM_IRQ_ADC3 /* Vector 33: ADC Sequence 3 */ + HANDLER lm_wdog, LM_IRQ_WDOG /* Vector 34: Watchdog Timer */ + HANDLER lm_tmr0a, LM_IRQ_TIMER0A /* Vector 35: Timer 0 A */ + HANDLER lm_tmr0b, LM_IRQ_TIMER0B /* Vector 36: Timer 0 B */ + HANDLER lm_tmr1a, LM_IRQ_TIMER1A /* Vector 37: Timer 1 A */ + HANDLER lm_tmr1b, LM_IRQ_TIMER1B /* Vector 38: Timer 1 B */ + HANDLER lm_tmr2a, LM_IRQ_TIMER2A /* Vector 39: Timer 2 A */ + HANDLER lm_tmr2b, LM_IRQ_TIMER2B /* Vector 40: Timer 3 B */ + HANDLER lm_cmp0, LM_IRQ_COMPARE0 /* Vector 41: Analog Comparator 0 */ + HANDLER lm_cmp1, LM_IRQ_COMPARE1 /* Vector 42: Analog Comparator 1 */ + HANDLER lm_syscon, LM_IRQ_SYSCON /* Vector 44: System Control */ + HANDLER lm_flashcon, LM_IRQ_FLASHCON /* Vector 45: FLASH Control */ + HANDLER lm_gpiof, LM_IRQ_GPIOF /* Vector 46: GPIO Port F */ + HANDLER lm_gpiog, LM_IRQ_GPIOG /* Vector 47: GPIO Port G */ + HANDLER lm_eth, LM_IRQ_ETHCON /* Vector 58: Ethernet Controller */ #elif defined(CONFIG_ARCH_CHIP_LM3S6965) - HANDLER lm_gpioa, LM3S_IRQ_GPIOA /* Vector 16: GPIO Port A */ - HANDLER lm_gpiob, LM3S_IRQ_GPIOB /* Vector 17: GPIO Port B */ - HANDLER lm_gpioc, LM3S_IRQ_GPIOC /* Vector 18: GPIO Port C */ - HANDLER lm_gpiod, LM3S_IRQ_GPIOD /* Vector 19: GPIO Port D */ - HANDLER lm_gpioe, LM3S_IRQ_GPIOE /* Vector 20: GPIO Port E */ - HANDLER lm_uart0, LM3S_IRQ_UART0 /* Vector 21: UART 0 */ - HANDLER lm_uart1, LM3S_IRQ_UART1 /* Vector 22: UART 1 */ - HANDLER lm_ssi0, LM3S_IRQ_SSI0 /* Vector 23: SSI 0 */ - HANDLER lm_i2c0, LM3S_IRQ_I2C0 /* Vector 24: I2C 0 */ - HANDLER lm_pwmfault, LM3S_IRQ_PWMFAULT /* Vector 25: PWM Fault */ - HANDLER lm_pwm0, LM3S_IRQ_PWM0 /* Vector 26: PWM Generator 0 */ - HANDLER lm_pwm1, LM3S_IRQ_PWM1 /* Vector 27: PWM Generator 1 */ - HANDLER lm_pwm2, LM3S_IRQ_PWM2 /* Vector 28: PWM Generator 2 */ - HANDLER lm_qei0, LM3S_IRQ_QEI0 /* Vector 29: QEI 0 */ - HANDLER lm_adc0, LM3S_IRQ_ADC0 /* Vector 30: ADC Sequence 0 */ - HANDLER lm_adc1, LM3S_IRQ_ADC1 /* Vector 31: ADC Sequence 1 */ - HANDLER lm_adc2, LM3S_IRQ_ADC2 /* Vector 32: ADC Sequence 2 */ - HANDLER lm_adc3, LM3S_IRQ_ADC3 /* Vector 33: ADC Sequence 3 */ - HANDLER lm_wdog, LM3S_IRQ_WDOG /* Vector 34: Watchdog Timer */ - HANDLER lm_tmr0a, LM3S_IRQ_TIMER0A /* Vector 35: Timer 0 A */ - HANDLER lm_tmr0b, LM3S_IRQ_TIMER0B /* Vector 36: Timer 0 B */ - HANDLER lm_tmr1a, LM3S_IRQ_TIMER1A /* Vector 37: Timer 1 A */ - HANDLER lm_tmr1b, LM3S_IRQ_TIMER1B /* Vector 38: Timer 1 B */ - HANDLER lm_tmr2a, LM3S_IRQ_TIMER2A /* Vector 39: Timer 2 A */ - HANDLER lm_tmr2b, LM3S_IRQ_TIMER2B /* Vector 40: Timer 3 B */ - HANDLER lm_cmp0, LM3S_IRQ_COMPARE0 /* Vector 41: Analog Comparator 0 */ - HANDLER lm_cmp1, LM3S_IRQ_COMPARE1 /* Vector 42: Analog Comparator 1 */ - HANDLER lm_syscon, LM3S_IRQ_SYSCON /* Vector 44: System Control */ - HANDLER lm_flashcon, LM3S_IRQ_FLASHCON /* Vector 45: FLASH Control */ - HANDLER lm_gpiof, LM3S_IRQ_GPIOF /* Vector 46: GPIO Port F */ - HANDLER lm_gpiog, LM3S_IRQ_GPIOG /* Vector 47: GPIO Port G */ - HANDLER lm_uart2, LM3S_IRQ_UART1 /* Vector 49: UART 1 */ - HANDLER lm_tmr3a, LM3S_IRQ_TIMER3A /* Vector 51: Timer 3 A */ - HANDLER lm_tmr3b, LM3S_IRQ_TIMER3B /* Vector 52: Timer 3 B */ - HANDLER lm_i2c1, LM3S_IRQ_I2C1 /* Vector 53: I2C 1 */ - HANDLER lm_qei1, LM3S_IRQ_QEI1 /* Vector 54: QEI 1 */ - HANDLER lm_eth, LM3S_IRQ_ETHCON /* Vector 58: Ethernet Controller */ - HANDLER lm_hib, LM3S_IRQ_HIBERNATE /* Vector 59: Hibernation Module */ + HANDLER lm_gpioa, LM_IRQ_GPIOA /* Vector 16: GPIO Port A */ + HANDLER lm_gpiob, LM_IRQ_GPIOB /* Vector 17: GPIO Port B */ + HANDLER lm_gpioc, LM_IRQ_GPIOC /* Vector 18: GPIO Port C */ + HANDLER lm_gpiod, LM_IRQ_GPIOD /* Vector 19: GPIO Port D */ + HANDLER lm_gpioe, LM_IRQ_GPIOE /* Vector 20: GPIO Port E */ + HANDLER lm_uart0, LM_IRQ_UART0 /* Vector 21: UART 0 */ + HANDLER lm_uart1, LM_IRQ_UART1 /* Vector 22: UART 1 */ + HANDLER lm_ssi0, LM_IRQ_SSI0 /* Vector 23: SSI 0 */ + HANDLER lm_i2c0, LM_IRQ_I2C0 /* Vector 24: I2C 0 */ + HANDLER lm_pwmfault, LM_IRQ_PWMFAULT /* Vector 25: PWM Fault */ + HANDLER lm_pwm0, LM_IRQ_PWM0 /* Vector 26: PWM Generator 0 */ + HANDLER lm_pwm1, LM_IRQ_PWM1 /* Vector 27: PWM Generator 1 */ + HANDLER lm_pwm2, LM_IRQ_PWM2 /* Vector 28: PWM Generator 2 */ + HANDLER lm_qei0, LM_IRQ_QEI0 /* Vector 29: QEI 0 */ + HANDLER lm_adc0, LM_IRQ_ADC0 /* Vector 30: ADC Sequence 0 */ + HANDLER lm_adc1, LM_IRQ_ADC1 /* Vector 31: ADC Sequence 1 */ + HANDLER lm_adc2, LM_IRQ_ADC2 /* Vector 32: ADC Sequence 2 */ + HANDLER lm_adc3, LM_IRQ_ADC3 /* Vector 33: ADC Sequence 3 */ + HANDLER lm_wdog, LM_IRQ_WDOG /* Vector 34: Watchdog Timer */ + HANDLER lm_tmr0a, LM_IRQ_TIMER0A /* Vector 35: Timer 0 A */ + HANDLER lm_tmr0b, LM_IRQ_TIMER0B /* Vector 36: Timer 0 B */ + HANDLER lm_tmr1a, LM_IRQ_TIMER1A /* Vector 37: Timer 1 A */ + HANDLER lm_tmr1b, LM_IRQ_TIMER1B /* Vector 38: Timer 1 B */ + HANDLER lm_tmr2a, LM_IRQ_TIMER2A /* Vector 39: Timer 2 A */ + HANDLER lm_tmr2b, LM_IRQ_TIMER2B /* Vector 40: Timer 3 B */ + HANDLER lm_cmp0, LM_IRQ_COMPARE0 /* Vector 41: Analog Comparator 0 */ + HANDLER lm_cmp1, LM_IRQ_COMPARE1 /* Vector 42: Analog Comparator 1 */ + HANDLER lm_syscon, LM_IRQ_SYSCON /* Vector 44: System Control */ + HANDLER lm_flashcon, LM_IRQ_FLASHCON /* Vector 45: FLASH Control */ + HANDLER lm_gpiof, LM_IRQ_GPIOF /* Vector 46: GPIO Port F */ + HANDLER lm_gpiog, LM_IRQ_GPIOG /* Vector 47: GPIO Port G */ + HANDLER lm_uart2, LM_IRQ_UART1 /* Vector 49: UART 1 */ + HANDLER lm_tmr3a, LM_IRQ_TIMER3A /* Vector 51: Timer 3 A */ + HANDLER lm_tmr3b, LM_IRQ_TIMER3B /* Vector 52: Timer 3 B */ + HANDLER lm_i2c1, LM_IRQ_I2C1 /* Vector 53: I2C 1 */ + HANDLER lm_qei1, LM_IRQ_QEI1 /* Vector 54: QEI 1 */ + HANDLER lm_eth, LM_IRQ_ETHCON /* Vector 58: Ethernet Controller */ + HANDLER lm_hib, LM_IRQ_HIBERNATE /* Vector 59: Hibernation Module */ #elif defined(CONFIG_ARCH_CHIP_LM3S8962) - HANDLER lm_gpioa, LM3S_IRQ_GPIOA /* Vector 16: GPIO Port A */ - HANDLER lm_gpiob, LM3S_IRQ_GPIOB /* Vector 17: GPIO Port B */ - HANDLER lm_gpioc, LM3S_IRQ_GPIOC /* Vector 18: GPIO Port C */ - HANDLER lm_gpiod, LM3S_IRQ_GPIOD /* Vector 19: GPIO Port D */ - HANDLER lm_gpioe, LM3S_IRQ_GPIOE /* Vector 20: GPIO Port E */ - HANDLER lm_uart0, LM3S_IRQ_UART0 /* Vector 21: UART 0 */ - HANDLER lm_uart1, LM3S_IRQ_UART1 /* Vector 22: UART 1 */ - HANDLER lm_ssi0, LM3S_IRQ_SSI0 /* Vector 23: SSI 0 */ - HANDLER lm_i2c0, LM3S_IRQ_I2C0 /* Vector 24: I2C 0 */ - HANDLER lm_pwmfault, LM3S_IRQ_PWMFAULT /* Vector 25: PWM Fault */ - HANDLER lm_pwm0, LM3S_IRQ_PWM0 /* Vector 26: PWM Generator 0 */ - HANDLER lm_pwm1, LM3S_IRQ_PWM1 /* Vector 27: PWM Generator 1 */ - HANDLER lm_pwm2, LM3S_IRQ_PWM2 /* Vector 28: PWM Generator 2 */ - HANDLER lm_qei0, LM3S_IRQ_QEI0 /* Vector 29: QEI 0 */ - HANDLER lm_adc0, LM3S_IRQ_ADC0 /* Vector 30: ADC Sequence 0 */ - HANDLER lm_adc1, LM3S_IRQ_ADC1 /* Vector 31: ADC Sequence 1 */ - HANDLER lm_adc2, LM3S_IRQ_ADC2 /* Vector 32: ADC Sequence 2 */ - HANDLER lm_adc3, LM3S_IRQ_ADC3 /* Vector 33: ADC Sequence 3 */ - HANDLER lm_wdog, LM3S_IRQ_WDOG /* Vector 34: Watchdog Timer */ - HANDLER lm_tmr0a, LM3S_IRQ_TIMER0A /* Vector 35: Timer 0 A */ - HANDLER lm_tmr0b, LM3S_IRQ_TIMER0B /* Vector 36: Timer 0 B */ - HANDLER lm_tmr1a, LM3S_IRQ_TIMER1A /* Vector 37: Timer 1 A */ - HANDLER lm_tmr1b, LM3S_IRQ_TIMER1B /* Vector 38: Timer 1 B */ - HANDLER lm_tmr2a, LM3S_IRQ_TIMER2A /* Vector 39: Timer 2 A */ - HANDLER lm_tmr2b, LM3S_IRQ_TIMER2B /* Vector 40: Timer 3 B */ - HANDLER lm_cmp0, LM3S_IRQ_COMPARE0 /* Vector 41: Analog Comparator 0 */ - HANDLER lm_syscon, LM3S_IRQ_SYSCON /* Vector 44: System Control */ - HANDLER lm_flashcon, LM3S_IRQ_FLASHCON /* Vector 45: FLASH Control */ - HANDLER lm_gpiof, LM3S_IRQ_GPIOF /* Vector 46: GPIO Port F */ - HANDLER lm_gpiog, LM3S_IRQ_GPIOG /* Vector 47: GPIO Port G */ - HANDLER lm_uart2, LM3S_IRQ_UART1 /* Vector 49: UART 1 */ - HANDLER lm_tmr3a, LM3S_IRQ_TIMER3A /* Vector 51: Timer 3 A */ - HANDLER lm_tmr3b, LM3S_IRQ_TIMER3B /* Vector 52: Timer 3 B */ - HANDLER lm_i2c1, LM3S_IRQ_I2C1 /* Vector 53: I2C 1 */ - HANDLER lm_qei1, LM3S_IRQ_QEI1 /* Vector 54: QEI 1 */ - HANDLER lm_can0, LM3S_IRQ_CAN0 /* Vector 55: CAN 0 */ - HANDLER lm_eth, LM3S_IRQ_ETHCON /* Vector 58: Ethernet Controller */ - HANDLER lm_hib, LM3S_IRQ_HIBERNATE /* Vector 59: Hibernation Module */ + HANDLER lm_gpioa, LM_IRQ_GPIOA /* Vector 16: GPIO Port A */ + HANDLER lm_gpiob, LM_IRQ_GPIOB /* Vector 17: GPIO Port B */ + HANDLER lm_gpioc, LM_IRQ_GPIOC /* Vector 18: GPIO Port C */ + HANDLER lm_gpiod, LM_IRQ_GPIOD /* Vector 19: GPIO Port D */ + HANDLER lm_gpioe, LM_IRQ_GPIOE /* Vector 20: GPIO Port E */ + HANDLER lm_uart0, LM_IRQ_UART0 /* Vector 21: UART 0 */ + HANDLER lm_uart1, LM_IRQ_UART1 /* Vector 22: UART 1 */ + HANDLER lm_ssi0, LM_IRQ_SSI0 /* Vector 23: SSI 0 */ + HANDLER lm_i2c0, LM_IRQ_I2C0 /* Vector 24: I2C 0 */ + HANDLER lm_pwmfault, LM_IRQ_PWMFAULT /* Vector 25: PWM Fault */ + HANDLER lm_pwm0, LM_IRQ_PWM0 /* Vector 26: PWM Generator 0 */ + HANDLER lm_pwm1, LM_IRQ_PWM1 /* Vector 27: PWM Generator 1 */ + HANDLER lm_pwm2, LM_IRQ_PWM2 /* Vector 28: PWM Generator 2 */ + HANDLER lm_qei0, LM_IRQ_QEI0 /* Vector 29: QEI 0 */ + HANDLER lm_adc0, LM_IRQ_ADC0 /* Vector 30: ADC Sequence 0 */ + HANDLER lm_adc1, LM_IRQ_ADC1 /* Vector 31: ADC Sequence 1 */ + HANDLER lm_adc2, LM_IRQ_ADC2 /* Vector 32: ADC Sequence 2 */ + HANDLER lm_adc3, LM_IRQ_ADC3 /* Vector 33: ADC Sequence 3 */ + HANDLER lm_wdog, LM_IRQ_WDOG /* Vector 34: Watchdog Timer */ + HANDLER lm_tmr0a, LM_IRQ_TIMER0A /* Vector 35: Timer 0 A */ + HANDLER lm_tmr0b, LM_IRQ_TIMER0B /* Vector 36: Timer 0 B */ + HANDLER lm_tmr1a, LM_IRQ_TIMER1A /* Vector 37: Timer 1 A */ + HANDLER lm_tmr1b, LM_IRQ_TIMER1B /* Vector 38: Timer 1 B */ + HANDLER lm_tmr2a, LM_IRQ_TIMER2A /* Vector 39: Timer 2 A */ + HANDLER lm_tmr2b, LM_IRQ_TIMER2B /* Vector 40: Timer 3 B */ + HANDLER lm_cmp0, LM_IRQ_COMPARE0 /* Vector 41: Analog Comparator 0 */ + HANDLER lm_syscon, LM_IRQ_SYSCON /* Vector 44: System Control */ + HANDLER lm_flashcon, LM_IRQ_FLASHCON /* Vector 45: FLASH Control */ + HANDLER lm_gpiof, LM_IRQ_GPIOF /* Vector 46: GPIO Port F */ + HANDLER lm_gpiog, LM_IRQ_GPIOG /* Vector 47: GPIO Port G */ + HANDLER lm_uart2, LM_IRQ_UART1 /* Vector 49: UART 1 */ + HANDLER lm_tmr3a, LM_IRQ_TIMER3A /* Vector 51: Timer 3 A */ + HANDLER lm_tmr3b, LM_IRQ_TIMER3B /* Vector 52: Timer 3 B */ + HANDLER lm_i2c1, LM_IRQ_I2C1 /* Vector 53: I2C 1 */ + HANDLER lm_qei1, LM_IRQ_QEI1 /* Vector 54: QEI 1 */ + HANDLER lm_can0, LM_IRQ_CAN0 /* Vector 55: CAN 0 */ + HANDLER lm_eth, LM_IRQ_ETHCON /* Vector 58: Ethernet Controller */ + HANDLER lm_hib, LM_IRQ_HIBERNATE /* Vector 59: Hibernation Module */ #elif defined(CONFIG_ARCH_CHIP_LM3S9B96) - HANDLER lm_gpioa, LM3S_IRQ_GPIOA /* Vector 16: GPIO Port A */ - HANDLER lm_gpiob, LM3S_IRQ_GPIOB /* Vector 17: GPIO Port B */ - HANDLER lm_gpioc, LM3S_IRQ_GPIOC /* Vector 18: GPIO Port C */ - HANDLER lm_gpiod, LM3S_IRQ_GPIOD /* Vector 19: GPIO Port D */ - HANDLER lm_gpioe, LM3S_IRQ_GPIOE /* Vector 20: GPIO Port E */ - HANDLER lm_uart0, LM3S_IRQ_UART0 /* Vector 21: UART 0 */ - HANDLER lm_uart1, LM3S_IRQ_UART1 /* Vector 22: UART 1 */ - HANDLER lm_ssi0, LM3S_IRQ_SSI0 /* Vector 23: SSI 0 */ - HANDLER lm_i2c0, LM3S_IRQ_I2C0 /* Vector 24: I2C 0 */ - HANDLER lm_pwmfault, LM3S_IRQ_PWMFAULT /* Vector 25: PWM Fault */ - HANDLER lm_pwm0, LM3S_IRQ_PWM0 /* Vector 26: PWM Generator 0 */ - HANDLER lm_pwm1, LM3S_IRQ_PWM1 /* Vector 27: PWM Generator 1 */ - HANDLER lm_pwm2, LM3S_IRQ_PWM2 /* Vector 28: PWM Generator 2 */ - HANDLER lm_qei0, LM3S_IRQ_QEI0 /* Vector 29: QEI 0 */ - HANDLER lm_adc0, LM3S_IRQ_ADC0 /* Vector 30: ADC Sequence 0 */ - HANDLER lm_adc1, LM3S_IRQ_ADC1 /* Vector 31: ADC Sequence 1 */ - HANDLER lm_adc2, LM3S_IRQ_ADC2 /* Vector 32: ADC Sequence 2 */ - HANDLER lm_adc3, LM3S_IRQ_ADC3 /* Vector 33: ADC Sequence 3 */ - HANDLER lm_wdog, LM3S_IRQ_WDOG /* Vector 34: Watchdog Timer */ - HANDLER lm_tmr0a, LM3S_IRQ_TIMER0A /* Vector 35: Timer 0 A */ - HANDLER lm_tmr0b, LM3S_IRQ_TIMER0B /* Vector 36: Timer 0 B */ - HANDLER lm_tmr1a, LM3S_IRQ_TIMER1A /* Vector 37: Timer 1 A */ - HANDLER lm_tmr1b, LM3S_IRQ_TIMER1B /* Vector 38: Timer 1 B */ - HANDLER lm_tmr2a, LM3S_IRQ_TIMER2A /* Vector 39: Timer 2 A */ - HANDLER lm_tmr2b, LM3S_IRQ_TIMER2B /* Vector 40: Timer 3 B */ - HANDLER lm_cmp0, LM3S_IRQ_COMPARE0 /* Vector 41: Analog Comparator 0 */ - HANDLER lm_cmp1, LM3S_IRQ_COMPARE1 /* Vector 42: Analog Comparator 1 */ - HANDLER lm_cmp2, LM3S_IRQ_COMPARE2 /* Vector 43: Analog Comparator 2 */ - HANDLER lm_syscon, LM3S_IRQ_SYSCON /* Vector 44: System Control */ - HANDLER lm_flashcon, LM3S_IRQ_FLASHCON /* Vector 45: FLASH Control */ - HANDLER lm_gpiof, LM3S_IRQ_GPIOF /* Vector 46: GPIO Port F */ - HANDLER lm_gpiog, LM3S_IRQ_GPIOG /* Vector 47: GPIO Port G */ - HANDLER lm_gpioh, LM3S_IRQ_GPIOH /* Vector 48: GPIO Port H */ - HANDLER lm_uart2, LM3S_IRQ_UART2 /* Vector 49: UART 2 */ - HANDLER lm_ssi1, LM3S_IRQ_SSI1 /* Vector 50: GPIO Port H */ - HANDLER lm_tmr3a, LM3S_IRQ_TIMER3A /* Vector 51: Timer 3 A */ - HANDLER lm_tmr3b, LM3S_IRQ_TIMER3B /* Vector 52: Timer 3 B */ - HANDLER lm_i2c1, LM3S_IRQ_I2C1 /* Vector 53: I2C 1 */ - HANDLER lm_qei1, LM3S_IRQ_QEI1 /* Vector 54: QEI 1 */ - HANDLER lm_can0, LM3S_IRQ_CAN0 /* Vector 55: CAN 0 */ - HANDLER lm_can1, LM3S_IRQ_CAN1 /* Vector 56: CAN 1 */ - HANDLER lm_eth, LM3S_IRQ_ETHCON /* Vector 58: Ethernet Controller */ - HANDLER lm_usb, LM3S_IRQ_USB /* Vector 60: USB */ - HANDLER lm_pwm3, LM3S_IRQ_PWM3 /* Vector 61: PWM 3 */ - HANDLER lm_udmasoft, LM3S_IRQ_UDMASOFT /* Vector 62: uDMA Software */ - HANDLER lm_udmaerror, LM3S_IRQ_UDMAERROR /* Vector 63: uDMA Error */ - HANDLER lm_adc1_0, LM3S_IRQ_ADC1_0 /* Vector 64: ADC1 Sequence 0 */ - HANDLER lm_adc1_1, LM3S_IRQ_ADC1_1 /* Vector 65: ADC1 Sequence 1 */ - HANDLER lm_adc1_2, LM3S_IRQ_ADC1_2 /* Vector 66: ADC1 Sequence 2 */ - HANDLER lm_adc1_3, LM3S_IRQ_ADC1_3 /* Vector 67: ADC1 Sequence 3 */ - HANDLER lm_i2s0, LM3S_IRQ_I2S0 /* Vector 68: I2S 0 */ - HANDLER lm_epi, LM3S_IRQ_EPI /* Vector 69: EPI */ - HANDLER lm_gpioj, LM3S_IRQ_GPIOJ /* Vector 70: GPIO Port J */ + HANDLER lm_gpioa, LM_IRQ_GPIOA /* Vector 16: GPIO Port A */ + HANDLER lm_gpiob, LM_IRQ_GPIOB /* Vector 17: GPIO Port B */ + HANDLER lm_gpioc, LM_IRQ_GPIOC /* Vector 18: GPIO Port C */ + HANDLER lm_gpiod, LM_IRQ_GPIOD /* Vector 19: GPIO Port D */ + HANDLER lm_gpioe, LM_IRQ_GPIOE /* Vector 20: GPIO Port E */ + HANDLER lm_uart0, LM_IRQ_UART0 /* Vector 21: UART 0 */ + HANDLER lm_uart1, LM_IRQ_UART1 /* Vector 22: UART 1 */ + HANDLER lm_ssi0, LM_IRQ_SSI0 /* Vector 23: SSI 0 */ + HANDLER lm_i2c0, LM_IRQ_I2C0 /* Vector 24: I2C 0 */ + HANDLER lm_pwmfault, LM_IRQ_PWMFAULT /* Vector 25: PWM Fault */ + HANDLER lm_pwm0, LM_IRQ_PWM0 /* Vector 26: PWM Generator 0 */ + HANDLER lm_pwm1, LM_IRQ_PWM1 /* Vector 27: PWM Generator 1 */ + HANDLER lm_pwm2, LM_IRQ_PWM2 /* Vector 28: PWM Generator 2 */ + HANDLER lm_qei0, LM_IRQ_QEI0 /* Vector 29: QEI 0 */ + HANDLER lm_adc0, LM_IRQ_ADC0 /* Vector 30: ADC Sequence 0 */ + HANDLER lm_adc1, LM_IRQ_ADC1 /* Vector 31: ADC Sequence 1 */ + HANDLER lm_adc2, LM_IRQ_ADC2 /* Vector 32: ADC Sequence 2 */ + HANDLER lm_adc3, LM_IRQ_ADC3 /* Vector 33: ADC Sequence 3 */ + HANDLER lm_wdog, LM_IRQ_WDOG /* Vector 34: Watchdog Timer */ + HANDLER lm_tmr0a, LM_IRQ_TIMER0A /* Vector 35: Timer 0 A */ + HANDLER lm_tmr0b, LM_IRQ_TIMER0B /* Vector 36: Timer 0 B */ + HANDLER lm_tmr1a, LM_IRQ_TIMER1A /* Vector 37: Timer 1 A */ + HANDLER lm_tmr1b, LM_IRQ_TIMER1B /* Vector 38: Timer 1 B */ + HANDLER lm_tmr2a, LM_IRQ_TIMER2A /* Vector 39: Timer 2 A */ + HANDLER lm_tmr2b, LM_IRQ_TIMER2B /* Vector 40: Timer 3 B */ + HANDLER lm_cmp0, LM_IRQ_COMPARE0 /* Vector 41: Analog Comparator 0 */ + HANDLER lm_cmp1, LM_IRQ_COMPARE1 /* Vector 42: Analog Comparator 1 */ + HANDLER lm_cmp2, LM_IRQ_COMPARE2 /* Vector 43: Analog Comparator 2 */ + HANDLER lm_syscon, LM_IRQ_SYSCON /* Vector 44: System Control */ + HANDLER lm_flashcon, LM_IRQ_FLASHCON /* Vector 45: FLASH Control */ + HANDLER lm_gpiof, LM_IRQ_GPIOF /* Vector 46: GPIO Port F */ + HANDLER lm_gpiog, LM_IRQ_GPIOG /* Vector 47: GPIO Port G */ + HANDLER lm_gpioh, LM_IRQ_GPIOH /* Vector 48: GPIO Port H */ + HANDLER lm_uart2, LM_IRQ_UART2 /* Vector 49: UART 2 */ + HANDLER lm_ssi1, LM_IRQ_SSI1 /* Vector 50: GPIO Port H */ + HANDLER lm_tmr3a, LM_IRQ_TIMER3A /* Vector 51: Timer 3 A */ + HANDLER lm_tmr3b, LM_IRQ_TIMER3B /* Vector 52: Timer 3 B */ + HANDLER lm_i2c1, LM_IRQ_I2C1 /* Vector 53: I2C 1 */ + HANDLER lm_qei1, LM_IRQ_QEI1 /* Vector 54: QEI 1 */ + HANDLER lm_can0, LM_IRQ_CAN0 /* Vector 55: CAN 0 */ + HANDLER lm_can1, LM_IRQ_CAN1 /* Vector 56: CAN 1 */ + HANDLER lm_eth, LM_IRQ_ETHCON /* Vector 58: Ethernet Controller */ + HANDLER lm_usb, LM_IRQ_USB /* Vector 60: USB */ + HANDLER lm_pwm3, LM_IRQ_PWM3 /* Vector 61: PWM 3 */ + HANDLER lm_udmasoft, LM_IRQ_UDMASOFT /* Vector 62: uDMA Software */ + HANDLER lm_udmaerror, LM_IRQ_UDMAERROR /* Vector 63: uDMA Error */ + HANDLER lm_adc1_0, LM_IRQ_ADC1_0 /* Vector 64: ADC1 Sequence 0 */ + HANDLER lm_adc1_1, LM_IRQ_ADC1_1 /* Vector 65: ADC1 Sequence 1 */ + HANDLER lm_adc1_2, LM_IRQ_ADC1_2 /* Vector 66: ADC1 Sequence 2 */ + HANDLER lm_adc1_3, LM_IRQ_ADC1_3 /* Vector 67: ADC1 Sequence 3 */ + HANDLER lm_i2s0, LM_IRQ_I2S0 /* Vector 68: I2S 0 */ + HANDLER lm_epi, LM_IRQ_EPI /* Vector 69: EPI */ + HANDLER lm_gpioj, LM_IRQ_GPIOJ /* Vector 70: GPIO Port J */ #else -# error "Vectors not specified for this LM3S chip" +# error "Vectors not specified for this Stellaris chip" #endif /* Common IRQ handling logic. On entry here, the return stack is on either diff --git a/nuttx/configs/avr32dev1/README.txt b/nuttx/configs/avr32dev1/README.txt index 37e15dc9b5..1f52ff0c2c 100644 --- a/nuttx/configs/avr32dev1/README.txt +++ b/nuttx/configs/avr32dev1/README.txt @@ -431,14 +431,16 @@ AVR32DEV1 Configuration Options Configurations ^^^^^^^^^^^^^^ -Each Stellaris LM3S6965 Evaluation Kit configuration is maintained in a -sudirectory and can be selected as follow: +Each Atmel AVR32DEV configuration is maintained in a sudirectory and +can be selected as follow: cd tools ./configure.sh avr32dev1/ cd - . ./setenv.sh +(Or configure.bat in a native Windows environment). + Where is one of the following: nsh: diff --git a/nuttx/configs/eagle100/README.txt b/nuttx/configs/eagle100/README.txt index 378f5a25bb..8ed581e98a 100644 --- a/nuttx/configs/eagle100/README.txt +++ b/nuttx/configs/eagle100/README.txt @@ -344,7 +344,7 @@ Eagle100-specific Configuration Options CONFIG_LM_DISABLE_GPIOH_IRQS=y CONFIG_LM_DISABLE_GPIOJ_IRQS=y - LM3S6818 specific device driver settings + LM3S6918 specific device driver settings CONFIG_UARTn_SERIAL_CONSOLE - selects the UARTn for the console and ttys0 (default is the UART0). @@ -368,7 +368,7 @@ Eagle100-specific Configuration Options Rx FIFO overrun errors. Default: half of the Tx FIFO size (4). CONFIG_LM_ETHERNET - This must be set (along with CONFIG_NET) - to build the LM3S Ethernet driver + to build the Stellaris Ethernet driver CONFIG_LM_ETHLEDS - Enable to use Ethernet LEDs on the board. CONFIG_LM_BOARDMAC - If the board-specific logic can provide a MAC address (via lm_ethernetmac()), then this should be selected. diff --git a/nuttx/configs/eagle100/include/board.h b/nuttx/configs/eagle100/include/board.h index 597f801acc..e7d9414a0e 100644 --- a/nuttx/configs/eagle100/include/board.h +++ b/nuttx/configs/eagle100/include/board.h @@ -63,7 +63,7 @@ * of (400 / 2) / 4 = 50MHz */ -#define LM3S_SYSDIV 4 +#define LM_SYSDIV 4 #define SYSCLK_FREQUENCY 50000000 /* 50MHz */ /* Other RCC settings: @@ -74,7 +74,7 @@ * - No auto-clock gating reset */ -#define LM3S_RCC_VALUE (SYSCON_RCC_OSCSRC | SYSCON_RCC_XTAL | SYSCON_RCC_USESYSDIV | SYSCON_RCC_SYSDIV(LM3S_SYSDIV)) +#define LM_RCC_VALUE (SYSCON_RCC_OSCSRC | SYSCON_RCC_XTAL | SYSCON_RCC_USESYSDIV | SYSCON_RCC_SYSDIV(LM_SYSDIV)) /* RCC2 settings -- RCC2 not used. Other RCC2 settings * @@ -83,7 +83,7 @@ * - Not using RCC2 */ -#define LM3S_RCC2_VALUE (SYSCON_RCC2_OSCSRC | SYSCON_RCC2_SYSDIV(LM3S_SYSDIV)) +#define LM_RCC2_VALUE (SYSCON_RCC2_OSCSRC | SYSCON_RCC2_SYSDIV(LM_SYSDIV)) /* LED definitions ******************************************************************/ @@ -115,9 +115,9 @@ * Name: lm_boardinitialize * * Description: - * All LM3S architectures must provide the following entry point. This entry point - * is called early in the intitialization -- after all memory has been configured - * and mapped but before any devices have been initialized. + * All Stellaris architectures must provide the following entry point. This entry + * point is called early in the intitialization -- after all memory has been + * configured and mapped but before any devices have been initialized. * ************************************************************************************/ diff --git a/nuttx/configs/eagle100/src/eagle100_internal.h b/nuttx/configs/eagle100/src/eagle100_internal.h index 8a76e2eb54..48da6b9f7e 100644 --- a/nuttx/configs/eagle100/src/eagle100_internal.h +++ b/nuttx/configs/eagle100/src/eagle100_internal.h @@ -56,12 +56,12 @@ * expanded). */ -#if LM3S_NSSI == 0 +#if LM_NSSI == 0 # undef CONFIG_SSI0_DISABLE # define CONFIG_SSI0_DISABLE 1 # undef CONFIG_SSI1_DISABLE # define CONFIG_SSI1_DISABLE 1 -#elif LM3S_NSSI == 1 +#elif LM_NSSI == 1 # undef CONFIG_SSI1_DISABLE # define CONFIG_SSI1_DISABLE 1 #endif diff --git a/nuttx/configs/eagle100/src/up_boot.c b/nuttx/configs/eagle100/src/up_boot.c index 8fed389f81..bd46bf2887 100644 --- a/nuttx/configs/eagle100/src/up_boot.c +++ b/nuttx/configs/eagle100/src/up_boot.c @@ -63,9 +63,10 @@ * Name: lm_boardinitialize * * Description: - * All LM3S architectures must provide the following entry point. This entry point - * is called early in the intitialization -- after all memory has been configured - * and mapped but before any devices have been initialized. + * All Stellaris architectures must provide the following entry point. This entry + * point is called early in the intitialization -- after all memory has been + * configured and mapped but before any devices have been initialized. + * ************************************************************************************/ void lm_boardinitialize(void) diff --git a/nuttx/configs/eagle100/src/up_ethernet.c b/nuttx/configs/eagle100/src/up_ethernet.c index 42876b3b5a..c3cea86e87 100644 --- a/nuttx/configs/eagle100/src/up_ethernet.c +++ b/nuttx/configs/eagle100/src/up_ethernet.c @@ -80,8 +80,8 @@ void lm_ethernetmac(struct ether_addr *ethaddr) /* Get the current value of the user registers */ - user0 = getreg32(LM3S_FLASH_USERREG0); - user1 = getreg32(LM3S_FLASH_USERREG1); + user0 = getreg32(LM_FLASH_USERREG0); + user1 = getreg32(LM_FLASH_USERREG1); nlldbg("user: %06x:%06x\n", user1 & 0x00ffffff, user0 & 0x00ffffff); DEBUGASSERT(user0 != 0xffffffff && user1 != 0xffffffff); diff --git a/nuttx/configs/ekk-lm3s9b96/README.txt b/nuttx/configs/ekk-lm3s9b96/README.txt index 78f7f7b8cb..01aa1496cd 100644 --- a/nuttx/configs/ekk-lm3s9b96/README.txt +++ b/nuttx/configs/ekk-lm3s9b96/README.txt @@ -324,7 +324,7 @@ Stellaris EKK-LM3S9B96 Evaluation Kit Configuration Options CONFIG_DRAM_START=0x20000000 - CONFIG_ARCH_IRQPRIO - The LM3S6918 supports interrupt prioritization + CONFIG_ARCH_IRQPRIO - The LM3S9B96 supports interrupt prioritization CONFIG_ARCH_IRQPRIO=y @@ -348,7 +348,7 @@ Stellaris EKK-LM3S9B96 Evaluation Kit Configuration Options the delay actually is 100 seconds. There are configurations for disabling support for interrupts GPIO ports. - GPIOJ must be disabled because it does not exist on the LM3S6918. + GPIOJ must be disabled because it does not exist on the LM3S9B96. Additional interrupt support can be disabled if desired to reduce memory footprint. @@ -362,7 +362,7 @@ Stellaris EKK-LM3S9B96 Evaluation Kit Configuration Options CONFIG_LM_DISABLE_GPIOH_IRQS=n CONFIG_LM_DISABLE_GPIOJ_IRQS=y - LM3S6818 specific device driver settings + LM3S9B96 specific device driver settings CONFIG_UARTn_SERIAL_CONSOLE - selects the UARTn for the console and ttys0 (default is the UART0). @@ -386,7 +386,7 @@ Stellaris EKK-LM3S9B96 Evaluation Kit Configuration Options Rx FIFO overrun errors. Default: half of the Tx FIFO size (4). CONFIG_LM_ETHERNET - This must be set (along with CONFIG_NET) - to build the LM3S Ethernet driver + to build the Stellaris Ethernet driver CONFIG_LM_ETHLEDS - Enable to use Ethernet LEDs on the board. CONFIG_LM_BOARDMAC - If the board-specific logic can provide a MAC address (via lm_ethernetmac()), then this should be selected. diff --git a/nuttx/configs/ekk-lm3s9b96/include/board.h b/nuttx/configs/ekk-lm3s9b96/include/board.h index f5c997539b..c2fe521c7a 100644 --- a/nuttx/configs/ekk-lm3s9b96/include/board.h +++ b/nuttx/configs/ekk-lm3s9b96/include/board.h @@ -64,7 +64,7 @@ * of (400 / 2) / 4 = 50MHz */ -#define LM3S_SYSDIV 4 +#define LM_SYSDIV 4 #define SYSCLK_FREQUENCY 50000000 /* 50MHz */ /* Other RCC settings: @@ -75,7 +75,7 @@ * - No auto-clock gating reset */ -#define LM3S_RCC_VALUE (SYSCON_RCC_OSCSRC | SYSCON_RCC_XTAL | SYSCON_RCC_USESYSDIV | SYSCON_RCC_SYSDIV(LM3S_SYSDIV)) +#define LM_RCC_VALUE (SYSCON_RCC_OSCSRC | SYSCON_RCC_XTAL | SYSCON_RCC_USESYSDIV | SYSCON_RCC_SYSDIV(LM_SYSDIV)) /* RCC2 settings -- RCC2 not used. Other RCC2 settings * @@ -84,7 +84,7 @@ * - Not using RCC2 */ -#define LM3S_RCC2_VALUE (SYSCON_RCC2_OSCSRC | SYSCON_RCC2_SYSDIV(LM3S_SYSDIV)) +#define LM_RCC2_VALUE (SYSCON_RCC2_OSCSRC | SYSCON_RCC2_SYSDIV(LM_SYSDIV)) /* LED definitions ******************************************************************/ @@ -116,9 +116,9 @@ * Name: lm_boardinitialize * * Description: - * All LM3S architectures must provide the following entry point. This entry point - * is called early in the intitialization -- after all memory has been configured - * and mapped but before any devices have been initialized. + * All Stellaris architectures must provide the following entry point. This entry + * point is called early in the intitialization -- after all memory has been + * configured and mapped but before any devices have been initialized. * ************************************************************************************/ diff --git a/nuttx/configs/ekk-lm3s9b96/src/ekklm3s9b96_internal.h b/nuttx/configs/ekk-lm3s9b96/src/ekklm3s9b96_internal.h index d7ab916c83..a353020b88 100644 --- a/nuttx/configs/ekk-lm3s9b96/src/ekklm3s9b96_internal.h +++ b/nuttx/configs/ekk-lm3s9b96/src/ekklm3s9b96_internal.h @@ -57,12 +57,12 @@ * expanded). */ -#if LM3S_NSSI == 0 +#if LM_NSSI == 0 # undef CONFIG_SSI0_DISABLE # define CONFIG_SSI0_DISABLE 1 # undef CONFIG_SSI1_DISABLE # define CONFIG_SSI1_DISABLE 1 -#elif LM3S_NSSI == 1 +#elif LM_NSSI == 1 # undef CONFIG_SSI1_DISABLE # define CONFIG_SSI1_DISABLE 1 #endif diff --git a/nuttx/configs/ekk-lm3s9b96/src/up_boot.c b/nuttx/configs/ekk-lm3s9b96/src/up_boot.c index 16057ccb94..312f63adc4 100644 --- a/nuttx/configs/ekk-lm3s9b96/src/up_boot.c +++ b/nuttx/configs/ekk-lm3s9b96/src/up_boot.c @@ -65,9 +65,10 @@ * Name: lm_boardinitialize * * Description: - * All LM3S architectures must provide the following entry point. This entry point - * is called early in the intitialization -- after all memory has been configured - * and mapped but before any devices have been initialized. + * All Stellaris architectures must provide the following entry point. This entry + * point is called early in the intitialization -- after all memory has been + * configured and mapped but before any devices have been initialized. + * ************************************************************************************/ void lm_boardinitialize(void) diff --git a/nuttx/configs/ekk-lm3s9b96/src/up_ethernet.c b/nuttx/configs/ekk-lm3s9b96/src/up_ethernet.c index bc4149082f..7350738033 100644 --- a/nuttx/configs/ekk-lm3s9b96/src/up_ethernet.c +++ b/nuttx/configs/ekk-lm3s9b96/src/up_ethernet.c @@ -81,8 +81,8 @@ void lm_ethernetmac(struct ether_addr *ethaddr) /* Get the current value of the user registers */ - user0 = getreg32(LM3S_FLASH_USERREG0); - user1 = getreg32(LM3S_FLASH_USERREG1); + user0 = getreg32(LM_FLASH_USERREG0); + user1 = getreg32(LM_FLASH_USERREG1); nlldbg("user: %06x:%06x\n", user1 & 0x00ffffff, user0 & 0x00ffffff); DEBUGASSERT(user0 != 0xffffffff && user1 != 0xffffffff); diff --git a/nuttx/configs/lm3s6432-s2e/README.txt b/nuttx/configs/lm3s6432-s2e/README.txt index 29cf80faec..7241856b05 100644 --- a/nuttx/configs/lm3s6432-s2e/README.txt +++ b/nuttx/configs/lm3s6432-s2e/README.txt @@ -318,7 +318,7 @@ Stellaris MDL-S2E Reference Design Configuration Options CONFIG_DRAM_START=0x20000000 - CONFIG_ARCH_IRQPRIO - The LM3S6918 supports interrupt prioritization + CONFIG_ARCH_IRQPRIO - The LM3S6432 supports interrupt prioritization CONFIG_ARCH_IRQPRIO=y @@ -389,7 +389,7 @@ Stellaris MDL-S2E Reference Design Configuration Options Rx FIFO overrun errors. Default: half of the Tx FIFO size (4). CONFIG_LM_ETHERNET - This must be set (along with CONFIG_NET) - to build the LM3S Ethernet driver + to build the Stellaris Ethernet driver CONFIG_LM_ETHLEDS - Enable to use Ethernet LEDs on the board. CONFIG_LM_BOARDMAC - This should be set in order to use the MAC address configured in the flash USER registers. diff --git a/nuttx/configs/lm3s6432-s2e/include/board.h b/nuttx/configs/lm3s6432-s2e/include/board.h index 7fdcabf767..a3d5603614 100644 --- a/nuttx/configs/lm3s6432-s2e/include/board.h +++ b/nuttx/configs/lm3s6432-s2e/include/board.h @@ -63,7 +63,7 @@ * of (400 / 2) / 4 = 50MHz */ -#define LM3S_SYSDIV 4 +#define LM_SYSDIV 4 #define SYSCLK_FREQUENCY 50000000 /* 50MHz */ /* Other RCC settings: @@ -74,7 +74,7 @@ * - No auto-clock gating reset */ -#define LM3S_RCC_VALUE (SYSCON_RCC_OSCSRC | SYSCON_RCC_XTAL | SYSCON_RCC_USESYSDIV | SYSCON_RCC_SYSDIV(LM3S_SYSDIV)) +#define LM_RCC_VALUE (SYSCON_RCC_OSCSRC | SYSCON_RCC_XTAL | SYSCON_RCC_USESYSDIV | SYSCON_RCC_SYSDIV(LM_SYSDIV)) /* RCC2 settings -- RCC2 not used. Other RCC2 settings * @@ -83,7 +83,7 @@ * - Not using RCC2 */ -#define LM3S_RCC2_VALUE (SYSCON_RCC2_OSCSRC | SYSCON_RCC2_SYSDIV(LM3S_SYSDIV)) +#define LM_RCC2_VALUE (SYSCON_RCC2_OSCSRC | SYSCON_RCC2_SYSDIV(LM_SYSDIV)) /* LED definitions ******************************************************************/ @@ -117,9 +117,9 @@ * Name: lm_boardinitialize * * Description: - * All LM3S architectures must provide the following entry point. This entry point - * is called early in the intitialization -- after all memory has been configured - * and mapped but before any devices have been initialized. + * All Stellaris architectures must provide the following entry point. This entry + * point is called early in the intitialization -- after all memory has been + * configured and mapped but before any devices have been initialized. * ************************************************************************************/ diff --git a/nuttx/configs/lm3s6432-s2e/src/lm3s6432s2e_internal.h b/nuttx/configs/lm3s6432-s2e/src/lm3s6432s2e_internal.h index f95b118ad5..3f05bdc63a 100644 --- a/nuttx/configs/lm3s6432-s2e/src/lm3s6432s2e_internal.h +++ b/nuttx/configs/lm3s6432-s2e/src/lm3s6432s2e_internal.h @@ -55,7 +55,7 @@ * expanded). */ -#if LM3S_NSSI == 0 +#if LM_NSSI == 0 # undef CONFIG_SSI0_DISABLE # define CONFIG_SSI0_DISABLE 1 #endif diff --git a/nuttx/configs/lm3s6432-s2e/src/up_boot.c b/nuttx/configs/lm3s6432-s2e/src/up_boot.c index da900282f8..60be9c3cf0 100644 --- a/nuttx/configs/lm3s6432-s2e/src/up_boot.c +++ b/nuttx/configs/lm3s6432-s2e/src/up_boot.c @@ -70,9 +70,10 @@ * Name: lm_boardinitialize * * Description: - * All LM3S architectures must provide the following entry point. This entry point - * is called early in the intitialization -- after all memory has been configured - * and mapped but before any devices have been initialized. + * All Stellaris architectures must provide the following entry point. This entry + * point is called early in the intitialization -- after all memory has been + * configured and mapped but before any devices have been initialized. + * ************************************************************************************/ void lm_boardinitialize(void) diff --git a/nuttx/configs/lm3s6432-s2e/src/up_ethernet.c b/nuttx/configs/lm3s6432-s2e/src/up_ethernet.c index 434ffe2c52..54c88a37bc 100644 --- a/nuttx/configs/lm3s6432-s2e/src/up_ethernet.c +++ b/nuttx/configs/lm3s6432-s2e/src/up_ethernet.c @@ -80,8 +80,8 @@ void lm_ethernetmac(struct ether_addr *ethaddr) /* Get the current value of the user registers */ - user0 = getreg32(LM3S_FLASH_USERREG0); - user1 = getreg32(LM3S_FLASH_USERREG1); + user0 = getreg32(LM_FLASH_USERREG0); + user1 = getreg32(LM_FLASH_USERREG1); nlldbg("user: %06x:%06x\n", user1 & 0x00ffffff, user0 & 0x00ffffff); DEBUGASSERT(user0 != 0xffffffff && user1 != 0xffffffff); diff --git a/nuttx/configs/lm3s6965-ek/README.txt b/nuttx/configs/lm3s6965-ek/README.txt index 813e11467f..77f034bf5d 100644 --- a/nuttx/configs/lm3s6965-ek/README.txt +++ b/nuttx/configs/lm3s6965-ek/README.txt @@ -387,7 +387,7 @@ Stellaris LM3S6965 Evaluation Kit Configuration Options CONFIG_DRAM_START=0x20000000 - CONFIG_ARCH_IRQPRIO - The LM3S6918 supports interrupt prioritization + CONFIG_ARCH_IRQPRIO - The LM3S6965 supports interrupt prioritization CONFIG_ARCH_IRQPRIO=y @@ -411,7 +411,7 @@ Stellaris LM3S6965 Evaluation Kit Configuration Options the delay actually is 100 seconds. There are configurations for disabling support for interrupts GPIO ports. - GPIOJ must be disabled because it does not exist on the LM3S6918. + GPIOJ must be disabled because it does not exist on the LM3S6965. Additional interrupt support can be disabled if desired to reduce memory footprint. @@ -425,7 +425,7 @@ Stellaris LM3S6965 Evaluation Kit Configuration Options CONFIG_LM_DISABLE_GPIOH_IRQS=n CONFIG_LM_DISABLE_GPIOJ_IRQS=y - LM3S6818 specific device driver settings + LM3S6965 specific device driver settings CONFIG_UARTn_SERIAL_CONSOLE - selects the UARTn for the console and ttys0 (default is the UART0). @@ -449,7 +449,7 @@ Stellaris LM3S6965 Evaluation Kit Configuration Options Rx FIFO overrun errors. Default: half of the Tx FIFO size (4). CONFIG_LM_ETHERNET - This must be set (along with CONFIG_NET) - to build the LM3S Ethernet driver + to build the Stellaris Ethernet driver CONFIG_LM_ETHLEDS - Enable to use Ethernet LEDs on the board. CONFIG_LM_BOARDMAC - If the board-specific logic can provide a MAC address (via lm_ethernetmac()), then this should be selected. diff --git a/nuttx/configs/lm3s6965-ek/include/board.h b/nuttx/configs/lm3s6965-ek/include/board.h index 808d009ccd..112c40b7a0 100644 --- a/nuttx/configs/lm3s6965-ek/include/board.h +++ b/nuttx/configs/lm3s6965-ek/include/board.h @@ -63,7 +63,7 @@ * of (400 / 2) / 4 = 50MHz */ -#define LM3S_SYSDIV 4 +#define LM_SYSDIV 4 #define SYSCLK_FREQUENCY 50000000 /* 50MHz */ /* Other RCC settings: @@ -74,7 +74,7 @@ * - No auto-clock gating reset */ -#define LM3S_RCC_VALUE (SYSCON_RCC_OSCSRC | SYSCON_RCC_XTAL | SYSCON_RCC_USESYSDIV | SYSCON_RCC_SYSDIV(LM3S_SYSDIV)) +#define LM_RCC_VALUE (SYSCON_RCC_OSCSRC | SYSCON_RCC_XTAL | SYSCON_RCC_USESYSDIV | SYSCON_RCC_SYSDIV(LM_SYSDIV)) /* RCC2 settings -- RCC2 not used. Other RCC2 settings * @@ -83,7 +83,7 @@ * - Not using RCC2 */ -#define LM3S_RCC2_VALUE (SYSCON_RCC2_OSCSRC | SYSCON_RCC2_SYSDIV(LM3S_SYSDIV)) +#define LM_RCC2_VALUE (SYSCON_RCC2_OSCSRC | SYSCON_RCC2_SYSDIV(LM_SYSDIV)) /* LED definitions ******************************************************************/ @@ -115,9 +115,9 @@ * Name: lm_boardinitialize * * Description: - * All LM3S architectures must provide the following entry point. This entry point - * is called early in the intitialization -- after all memory has been configured - * and mapped but before any devices have been initialized. + * All Stellaris architectures must provide the following entry point. This entry + * point is called early in the intitialization -- after all memory has been + * configured and mapped but before any devices have been initialized. * ************************************************************************************/ diff --git a/nuttx/configs/lm3s6965-ek/nsh/defconfig b/nuttx/configs/lm3s6965-ek/nsh/defconfig index 99f2f50ab4..5c288f95dd 100755 --- a/nuttx/configs/lm3s6965-ek/nsh/defconfig +++ b/nuttx/configs/lm3s6965-ek/nsh/defconfig @@ -93,7 +93,7 @@ CONFIG_ARMV7M_TOOLCHAIN_BUILDROOT=y CONFIG_ARMV7M_OABI_TOOLCHAIN=y # -# LM3S Configuration Options +# Stellaris Configuration Options # # CONFIG_ARCH_CHIP_LM3S6918 is not set # CONFIG_ARCH_CHIP_LM3S9B96 is not set @@ -104,7 +104,7 @@ CONFIG_ARCH_CHIP_LM3S6965=y CONFIG_LM_DFU=y # -# Select LM3S Peripheral Support +# Select Stellaris Peripheral Support # CONFIG_LM_UART0=y # CONFIG_LM_UART1 is not set @@ -127,7 +127,7 @@ CONFIG_LM_DISABLE_GPIOH_IRQS=y CONFIG_LM_DISABLE_GPIOJ_IRQS=y # -# LM3S Ethernet Configuration +# Stellaris Ethernet Configuration # # CONFIG_LM_ETHLEDS is not set # CONFIG_LM_BOARDMAC is not set @@ -141,7 +141,7 @@ CONFIG_LM_DISABLE_GPIOJ_IRQS=y # CONFIG_M3S_DUMPPACKET is not set # -# LM3S SSI Configuration +# Stellaris SSI Configuration # CONFIG_SSI_POLLWAIT=y CONFIG_SSI_TXLIMIT=4 diff --git a/nuttx/configs/lm3s6965-ek/nx/defconfig b/nuttx/configs/lm3s6965-ek/nx/defconfig index b86d06dc9c..b123800e07 100755 --- a/nuttx/configs/lm3s6965-ek/nx/defconfig +++ b/nuttx/configs/lm3s6965-ek/nx/defconfig @@ -93,7 +93,7 @@ CONFIG_ARMV7M_TOOLCHAIN_BUILDROOT=y CONFIG_ARMV7M_OABI_TOOLCHAIN=y # -# LM3S Configuration Options +# Stellaris Configuration Options # # CONFIG_ARCH_CHIP_LM3S6918 is not set # CONFIG_ARCH_CHIP_LM3S9B96 is not set @@ -104,7 +104,7 @@ CONFIG_ARCH_CHIP_LM3S6965=y CONFIG_LM_DFU=y # -# Select LM3S Peripheral Support +# Select Stellaris Peripheral Support # CONFIG_LM_UART0=y # CONFIG_LM_UART1 is not set @@ -127,7 +127,7 @@ CONFIG_LM_DISABLE_GPIOH_IRQS=y CONFIG_LM_DISABLE_GPIOJ_IRQS=y # -# LM3S SSI Configuration +# Stellaris SSI Configuration # CONFIG_SSI_POLLWAIT=y CONFIG_SSI_TXLIMIT=4 diff --git a/nuttx/configs/lm3s6965-ek/ostest/defconfig b/nuttx/configs/lm3s6965-ek/ostest/defconfig index bc433e1166..67633c9166 100755 --- a/nuttx/configs/lm3s6965-ek/ostest/defconfig +++ b/nuttx/configs/lm3s6965-ek/ostest/defconfig @@ -93,7 +93,7 @@ CONFIG_ARMV7M_TOOLCHAIN_BUILDROOT=y CONFIG_ARMV7M_OABI_TOOLCHAIN=y # -# LM3S Configuration Options +# Stellaris Configuration Options # # CONFIG_ARCH_CHIP_LM3S6918 is not set # CONFIG_ARCH_CHIP_LM3S9B96 is not set @@ -104,7 +104,7 @@ CONFIG_ARCH_CHIP_LM3S6965=y CONFIG_LM_DFU=y # -# Select LM3S Peripheral Support +# Select Stellaris Peripheral Support # CONFIG_LM_UART0=y # CONFIG_LM_UART1 is not set @@ -127,7 +127,7 @@ CONFIG_LM_DISABLE_GPIOH_IRQS=y CONFIG_LM_DISABLE_GPIOJ_IRQS=y # -# LM3S SSI Configuration +# Stellaris SSI Configuration # CONFIG_SSI_POLLWAIT=y CONFIG_SSI_TXLIMIT=4 diff --git a/nuttx/configs/lm3s6965-ek/src/lm3s6965ek_internal.h b/nuttx/configs/lm3s6965-ek/src/lm3s6965ek_internal.h index c2fc50df1f..00d55ed408 100644 --- a/nuttx/configs/lm3s6965-ek/src/lm3s6965ek_internal.h +++ b/nuttx/configs/lm3s6965-ek/src/lm3s6965ek_internal.h @@ -56,12 +56,12 @@ * expanded). */ -#if LM3S_NSSI == 0 +#if LM_NSSI == 0 # undef CONFIG_SSI0_DISABLE # define CONFIG_SSI0_DISABLE 1 # undef CONFIG_SSI1_DISABLE # define CONFIG_SSI1_DISABLE 1 -#elif LM3S_NSSI == 1 +#elif LM_NSSI == 1 # undef CONFIG_SSI1_DISABLE # define CONFIG_SSI1_DISABLE 1 #endif diff --git a/nuttx/configs/lm3s6965-ek/src/up_boot.c b/nuttx/configs/lm3s6965-ek/src/up_boot.c index 7ffd37f170..6229a2a59c 100644 --- a/nuttx/configs/lm3s6965-ek/src/up_boot.c +++ b/nuttx/configs/lm3s6965-ek/src/up_boot.c @@ -64,9 +64,10 @@ * Name: lm_boardinitialize * * Description: - * All LM3S architectures must provide the following entry point. This entry point - * is called early in the intitialization -- after all memory has been configured - * and mapped but before any devices have been initialized. + * All Stellaris architectures must provide the following entry point. This entry + * point is called early in the intitialization -- after all memory has been + * configured and mapped but before any devices have been initialized. + * ************************************************************************************/ void lm_boardinitialize(void) diff --git a/nuttx/configs/lm3s6965-ek/src/up_ethernet.c b/nuttx/configs/lm3s6965-ek/src/up_ethernet.c index 2d114baaa9..81d6cda26c 100644 --- a/nuttx/configs/lm3s6965-ek/src/up_ethernet.c +++ b/nuttx/configs/lm3s6965-ek/src/up_ethernet.c @@ -80,8 +80,8 @@ void lm_ethernetmac(struct ether_addr *ethaddr) /* Get the current value of the user registers */ - user0 = getreg32(LM3S_FLASH_USERREG0); - user1 = getreg32(LM3S_FLASH_USERREG1); + user0 = getreg32(LM_FLASH_USERREG0); + user1 = getreg32(LM_FLASH_USERREG1); nlldbg("user: %06x:%06x\n", user1 & 0x00ffffff, user0 & 0x00ffffff); DEBUGASSERT(user0 != 0xffffffff && user1 != 0xffffffff); diff --git a/nuttx/configs/lm3s8962-ek/README.txt b/nuttx/configs/lm3s8962-ek/README.txt index 38ed76aeaa..e8a0091c6c 100644 --- a/nuttx/configs/lm3s8962-ek/README.txt +++ b/nuttx/configs/lm3s8962-ek/README.txt @@ -371,7 +371,7 @@ Stellaris LM3S8962 Evaluation Kit Configuration Options CONFIG_DRAM_START=0x20000000 - CONFIG_ARCH_IRQPRIO - The LM3S6918 supports interrupt prioritization + CONFIG_ARCH_IRQPRIO - The LM3S8962 supports interrupt prioritization CONFIG_ARCH_IRQPRIO=y @@ -395,7 +395,7 @@ Stellaris LM3S8962 Evaluation Kit Configuration Options the delay actually is 100 seconds. There are configurations for disabling support for interrupts GPIO ports. - GPIOJ must be disabled because it does not exist on the LM3S6918. + GPIOJ must be disabled because it does not exist on the LM3S8962. Additional interrupt support can be disabled if desired to reduce memory footprint. @@ -409,7 +409,7 @@ Stellaris LM3S8962 Evaluation Kit Configuration Options CONFIG_LM_DISABLE_GPIOH_IRQS=n CONFIG_LM_DISABLE_GPIOJ_IRQS=y - LM3S6818 specific device driver settings + LM3S8962 specific device driver settings CONFIG_UARTn_SERIAL_CONSOLE - selects the UARTn for the console and ttys0 (default is the UART0). @@ -433,7 +433,7 @@ Stellaris LM3S8962 Evaluation Kit Configuration Options Rx FIFO overrun errors. Default: half of the Tx FIFO size (4). CONFIG_LM_ETHERNET - This must be set (along with CONFIG_NET) - to build the LM3S Ethernet driver + to build the Stellaris Ethernet driver CONFIG_LM_ETHLEDS - Enable to use Ethernet LEDs on the board. CONFIG_LM_BOARDMAC - If the board-specific logic can provide a MAC address (via lm_ethernetmac()), then this should be selected. diff --git a/nuttx/configs/lm3s8962-ek/include/board.h b/nuttx/configs/lm3s8962-ek/include/board.h index 4d6a0c3024..9c4adeaa7a 100644 --- a/nuttx/configs/lm3s8962-ek/include/board.h +++ b/nuttx/configs/lm3s8962-ek/include/board.h @@ -63,7 +63,7 @@ * of (400 / 2) / 4 = 50MHz */ -#define LM3S_SYSDIV 4 +#define LM_SYSDIV 4 #define SYSCLK_FREQUENCY 50000000 /* 50MHz */ /* Other RCC settings: @@ -74,7 +74,7 @@ * - No auto-clock gating reset */ -#define LM3S_RCC_VALUE (SYSCON_RCC_OSCSRC | SYSCON_RCC_XTAL | SYSCON_RCC_USESYSDIV | SYSCON_RCC_SYSDIV(LM3S_SYSDIV)) +#define LM_RCC_VALUE (SYSCON_RCC_OSCSRC | SYSCON_RCC_XTAL | SYSCON_RCC_USESYSDIV | SYSCON_RCC_SYSDIV(LM_SYSDIV)) /* RCC2 settings -- RCC2 not used. Other RCC2 settings * @@ -83,7 +83,7 @@ * - Not using RCC2 */ -#define LM3S_RCC2_VALUE (SYSCON_RCC2_OSCSRC | SYSCON_RCC2_SYSDIV(LM3S_SYSDIV)) +#define LM_RCC2_VALUE (SYSCON_RCC2_OSCSRC | SYSCON_RCC2_SYSDIV(LM_SYSDIV)) /* LED definitions ******************************************************************/ @@ -115,9 +115,9 @@ * Name: lm_boardinitialize * * Description: - * All LM3S architectures must provide the following entry point. This entry point - * is called early in the intitialization -- after all memory has been configured - * and mapped but before any devices have been initialized. + * All Stellaris architectures must provide the following entry point. This entry + * point is called early in the intitialization -- after all memory has been + * configured and mapped but before any devices have been initialized. * ************************************************************************************/ diff --git a/nuttx/configs/lm3s8962-ek/src/lm3s8962ek_internal.h b/nuttx/configs/lm3s8962-ek/src/lm3s8962ek_internal.h index 7fc8fa331d..3f989bc136 100644 --- a/nuttx/configs/lm3s8962-ek/src/lm3s8962ek_internal.h +++ b/nuttx/configs/lm3s8962-ek/src/lm3s8962ek_internal.h @@ -56,12 +56,12 @@ * expanded). */ -#if LM3S_NSSI == 0 +#if LM_NSSI == 0 # undef CONFIG_SSI0_DISABLE # define CONFIG_SSI0_DISABLE 1 # undef CONFIG_SSI1_DISABLE # define CONFIG_SSI1_DISABLE 1 -#elif LM3S_NSSI == 1 +#elif LM_NSSI == 1 # undef CONFIG_SSI1_DISABLE # define CONFIG_SSI1_DISABLE 1 #endif diff --git a/nuttx/configs/lm3s8962-ek/src/up_boot.c b/nuttx/configs/lm3s8962-ek/src/up_boot.c index 8dc5b81cc2..655aa6993c 100644 --- a/nuttx/configs/lm3s8962-ek/src/up_boot.c +++ b/nuttx/configs/lm3s8962-ek/src/up_boot.c @@ -64,9 +64,10 @@ * Name: lm_boardinitialize * * Description: - * All LM3S architectures must provide the following entry point. This entry point - * is called early in the intitialization -- after all memory has been configured - * and mapped but before any devices have been initialized. + * All Stellaris architectures must provide the following entry point. This entry + * point is called early in the intitialization -- after all memory has been + * configured and mapped but before any devices have been initialized. + * ************************************************************************************/ void lm_boardinitialize(void) diff --git a/nuttx/configs/lm3s8962-ek/src/up_ethernet.c b/nuttx/configs/lm3s8962-ek/src/up_ethernet.c index 0d73233a4d..63c681af90 100644 --- a/nuttx/configs/lm3s8962-ek/src/up_ethernet.c +++ b/nuttx/configs/lm3s8962-ek/src/up_ethernet.c @@ -80,8 +80,8 @@ void lm_ethernetmac(struct ether_addr *ethaddr) /* Get the current value of the user registers */ - user0 = getreg32(LM3S_FLASH_USERREG0); - user1 = getreg32(LM3S_FLASH_USERREG1); + user0 = getreg32(LM_FLASH_USERREG0); + user1 = getreg32(LM_FLASH_USERREG1); nlldbg("user: %06x:%06x\n", user1 & 0x00ffffff, user0 & 0x00ffffff); DEBUGASSERT(user0 != 0xffffffff && user1 != 0xffffffff); diff --git a/nuttx/configs/lpcxpresso-lpc1768/README.txt b/nuttx/configs/lpcxpresso-lpc1768/README.txt index ca0c0fdbd6..1d9c0cbc26 100644 --- a/nuttx/configs/lpcxpresso-lpc1768/README.txt +++ b/nuttx/configs/lpcxpresso-lpc1768/README.txt @@ -361,7 +361,7 @@ Code Red IDE crt_emu_cm3_nxp (for LPC17xx parts) crt_emu_a7_nxp (for LPC21/22/23/24 parts) crt_emu_a9_nxp (for LPC31/32 and LPC29xx parts) - crt_emu_cm3_lmi (for TI Stellaris LM3S parts + crt_emu_cm3_lmi (for TI Stellaris parts) wire is one of: diff --git a/nuttx/configs/lpcxpresso-lpc1768/src/up_ssp.c b/nuttx/configs/lpcxpresso-lpc1768/src/up_ssp.c index 894404cc2b..7b5f02e31c 100644 --- a/nuttx/configs/lpcxpresso-lpc1768/src/up_ssp.c +++ b/nuttx/configs/lpcxpresso-lpc1768/src/up_ssp.c @@ -52,8 +52,6 @@ #include "lpc17_internal.h" #include "lpcxpresso_internal.h" -/* The LM3S6965 Eval Kit microSD CS is on SSI0 */ - #if defined(CONFIG_LPC17_SSP0) || defined(CONFIG_LPC17_SSP1) /************************************************************************************ @@ -98,7 +96,7 @@ * Name: lpc17_sspinitialize * * Description: - * Called to configure SPI chip select GPIO pins for the LM3S6965 Eval Kit. + * Called to configure SPI chip select GPIO pins for the LPCXpresso. * ************************************************************************************/ diff --git a/nuttx/configs/nucleus2g/src/up_ssp.c b/nuttx/configs/nucleus2g/src/up_ssp.c index 5515d49686..13a7681301 100644 --- a/nuttx/configs/nucleus2g/src/up_ssp.c +++ b/nuttx/configs/nucleus2g/src/up_ssp.c @@ -52,8 +52,6 @@ #include "lpc17_internal.h" #include "nucleus2g_internal.h" -/* The LM3S6965 Eval Kit microSD CS is on SSI0 */ - #if defined(CONFIG_LPC17_SSP0) || defined(CONFIG_LPC17_SSP1) /************************************************************************************ @@ -98,7 +96,7 @@ * Name: lpc17_sspinitialize * * Description: - * Called to configure SPI chip select GPIO pins for the LM3S6965 Eval Kit. + * Called to configure SPI chip select GPIO pins for the Nucleus 2G. * ************************************************************************************/ diff --git a/nuttx/include/nuttx/net/mii.h b/nuttx/include/nuttx/net/mii.h index 6a5fc6e896..de4dcdfd72 100644 --- a/nuttx/include/nuttx/net/mii.h +++ b/nuttx/include/nuttx/net/mii.h @@ -112,12 +112,12 @@ /* Luminary LM3S6918 built-in PHY: 0x07-0x0f, 0x14-0x16, 0x19-0x1f reserved */ -#define MII_LM3S_VSPECIFIC 0x10 /* Vendor-Specific */ -#define MII_LM3S_INTCS 0x11 /* Interrupt control/status */ -#define MII_LM3S_DIAGNOSTIC 0x12 /* Diagnostic */ -#define MII_LM3S_XCVRCONTROL 0x13 /* Transceiver Control */ -#define MII_LM3S_LEDCONFIG 0x17 /* LED Configuration */ -#define MII_LM3S_MDICONTROL 0x18 /* Ethernet PHY Management MDI/MDIX Control */ +#define MII_LM_VSPECIFIC 0x10 /* Vendor-Specific */ +#define MII_LM_INTCS 0x11 /* Interrupt control/status */ +#define MII_LM_DIAGNOSTIC 0x12 /* Diagnostic */ +#define MII_LM_XCVRCONTROL 0x13 /* Transceiver Control */ +#define MII_LM_LEDCONFIG 0x17 /* LED Configuration */ +#define MII_LM_MDICONTROL 0x18 /* Ethernet PHY Management MDI/MDIX Control */ /* Micrel KS8721: 0x15, 0x1b, and 0x1f */ @@ -323,79 +323,79 @@ /* LM3S6918-specific register bit settings **********************************/ /* LM3S6918 Vendor-Specific, address 0x10 */ -#define LM3S_VSPECIFIC_RXCC (1 << 0) /* Bit 0: Receive Clock Control*/ -#define LM3S_VSPECIFIC_PCSBP (1 << 1) /* Bit 1: PCS Bypass */ -#define LM3S_VSPECIFIC_RVSPOL (1 << 4) /* Bit 4: Receive Data Polarity */ -#define LM3S_VSPECIFIC_APOL (1 << 5) /* Bit 5: Auto-Polarity Disable */ -#define LM3S_VSPECIFIC_NL10 (1 << 10) /* Bit 10: Natural Loopback Mode */ -#define LM3S_VSPECIFIC_SQEI (1 << 11) /* Bit 11: SQE Inhibit Testing */ -#define LM3S_VSPECIFIC_TXHIM (1 << 12) /* Bit 12: Transmit High Impedance Mode */ -#define LM3S_VSPECIFIC_INPOL (1 << 14) /* Bit 14: Interrupt Polarity Value*/ -#define LM3S_VSPECIFIC_RPTR (1 << 15) /* Bit 15: Repeater mode*/ +#define LM_VSPECIFIC_RXCC (1 << 0) /* Bit 0: Receive Clock Control*/ +#define LM_VSPECIFIC_PCSBP (1 << 1) /* Bit 1: PCS Bypass */ +#define LM_VSPECIFIC_RVSPOL (1 << 4) /* Bit 4: Receive Data Polarity */ +#define LM_VSPECIFIC_APOL (1 << 5) /* Bit 5: Auto-Polarity Disable */ +#define LM_VSPECIFIC_NL10 (1 << 10) /* Bit 10: Natural Loopback Mode */ +#define LM_VSPECIFIC_SQEI (1 << 11) /* Bit 11: SQE Inhibit Testing */ +#define LM_VSPECIFIC_TXHIM (1 << 12) /* Bit 12: Transmit High Impedance Mode */ +#define LM_VSPECIFIC_INPOL (1 << 14) /* Bit 14: Interrupt Polarity Value*/ +#define LM_VSPECIFIC_RPTR (1 << 15) /* Bit 15: Repeater mode*/ /* LM3S6918 Interrupt Control/Status, address 0x11 */ -#define LM3S_INTCS_ANEGCOMPINT (1 << 0) /* Bit 0: Auto-Negotiation Complete Interrupt */ -#define LM3S_INTCS_RFAULTINT (1 << 1) /* Bit 1: Remote Fault Interrupt */ -#define LM3S_INTCS_LSCHGINT (1 << 2) /* Bit 2: Link Status Change Interrupt */ -#define LM3S_INTCS_LPACKINT (1 << 3) /* Bit 3: LP Acknowledge Interrupt */ -#define LM3S_INTCS_PDFINT (1 << 4) /* Bit 4: Parallel Detection Fault Interrupt */ -#define LM3S_INTCS_PRXINT (1 << 5) /* Bit 5: Page Receive Interrupt */ -#define LM3S_INTCS_RXERINT (1 << 6) /* Bit 6: Receive Error Interrupt */ -#define LM3S_INTCS_JABBERINT (1 << 7) /* Bit 7: Jabber Event Interrupt */ -#define LM3S_INTCS_ANEGCOMPIE (1 << 8) /* Bit 8: Auto-Negotiation Complete Interrupt Enable */ -#define LM3S_INTCS_RFAULTIE (1 << 9) /* Bit 9: Remote Fault Interrupt Enable */ -#define LM3S_INTCS_LSCHGIE (1 << 10) /* Bit 10: Link Status Change Interrupt Enable */ -#define LM3S_INTCS_LPACKIE (1 << 11) /* Bit 11: LP Acknowledge Interrupt Enable */ -#define LM3S_INTCS_PDFIE (1 << 12) /* Bit 12: Parallel Detection Fault Interrupt Enable */ -#define LM3S_INTCS_PRXIE (1 << 13) /* Bit 13: Page Received Interrupt Enable */ -#define LM3S_INTCS_RXERIE (1 << 14) /* Bit 14: Receive Error Interrupt Enable */ -#define LM3S_INTCS_JABBERIE (1 << 15) /* Bit 15: Jabber Interrupt Enable */ +#define LM_INTCS_ANEGCOMPINT (1 << 0) /* Bit 0: Auto-Negotiation Complete Interrupt */ +#define LM_INTCS_RFAULTINT (1 << 1) /* Bit 1: Remote Fault Interrupt */ +#define LM_INTCS_LSCHGINT (1 << 2) /* Bit 2: Link Status Change Interrupt */ +#define LM_INTCS_LPACKINT (1 << 3) /* Bit 3: LP Acknowledge Interrupt */ +#define LM_INTCS_PDFINT (1 << 4) /* Bit 4: Parallel Detection Fault Interrupt */ +#define LM_INTCS_PRXINT (1 << 5) /* Bit 5: Page Receive Interrupt */ +#define LM_INTCS_RXERINT (1 << 6) /* Bit 6: Receive Error Interrupt */ +#define LM_INTCS_JABBERINT (1 << 7) /* Bit 7: Jabber Event Interrupt */ +#define LM_INTCS_ANEGCOMPIE (1 << 8) /* Bit 8: Auto-Negotiation Complete Interrupt Enable */ +#define LM_INTCS_RFAULTIE (1 << 9) /* Bit 9: Remote Fault Interrupt Enable */ +#define LM_INTCS_LSCHGIE (1 << 10) /* Bit 10: Link Status Change Interrupt Enable */ +#define LM_INTCS_LPACKIE (1 << 11) /* Bit 11: LP Acknowledge Interrupt Enable */ +#define LM_INTCS_PDFIE (1 << 12) /* Bit 12: Parallel Detection Fault Interrupt Enable */ +#define LM_INTCS_PRXIE (1 << 13) /* Bit 13: Page Received Interrupt Enable */ +#define LM_INTCS_RXERIE (1 << 14) /* Bit 14: Receive Error Interrupt Enable */ +#define LM_INTCS_JABBERIE (1 << 15) /* Bit 15: Jabber Interrupt Enable */ /* LM3S6918 Diagnostic, address 0x12 */ -#define LM3S_DIAGNOSTIC_RX_LOCK (1 << 8) /* Bit 8: Receive PLL Lock */ -#define LM3S_DIAGNOSTIC_RXSD (1 << 9) /* Bit 9: Receive Detection */ -#define LM3S_DIAGNOSTIC_RATE (1 << 10) /* Bit 10: Rate */ -#define LM3S_DIAGNOSTIC_DPLX (1 << 11) /* Bit 11: Duplex Mode */ -#define LM3S_DIAGNOSTIC_ANEGF (1 << 12) /* Bit 12: Auto-Negotiation Failure */ +#define LM_DIAGNOSTIC_RX_LOCK (1 << 8) /* Bit 8: Receive PLL Lock */ +#define LM_DIAGNOSTIC_RXSD (1 << 9) /* Bit 9: Receive Detection */ +#define LM_DIAGNOSTIC_RATE (1 << 10) /* Bit 10: Rate */ +#define LM_DIAGNOSTIC_DPLX (1 << 11) /* Bit 11: Duplex Mode */ +#define LM_DIAGNOSTIC_ANEGF (1 << 12) /* Bit 12: Auto-Negotiation Failure */ /* LM3S6918 Transceiver Control, address 0x13 */ -#define LM3S_XCVRCONTROL_TXO_SHIFT 14 /* Bits 15-14: Transmit Amplitude Selection */ -#define LM3S_XCVRCONTROL_TXO_MASK (3 << LM3S_XCVRCONTROL_TXO_SHIFT) -#define LM3S_XCVRCONTROL_TXO_00DB (0 << LM3S_XCVRCONTROL_TXO_SHIFT) /* Gain 0.0dB of insertion loss */ -#define LM3S_XCVRCONTROL_TXO_04DB (1 << LM3S_XCVRCONTROL_TXO_SHIFT) /* Gain 0.4dB of insertion loss */ -#define LM3S_XCVRCONTROL_TXO_08DB (2 << LM3S_XCVRCONTROL_TXO_SHIFT) /* Gain 0.8dB of insertion loss */ -#define LM3S_XCVRCONTROL_TXO_12DB (3 << LM3S_XCVRCONTROL_TXO_SHIFT) /* Gain 1.2dB of insertion loss */ +#define LM_XCVRCONTROL_TXO_SHIFT 14 /* Bits 15-14: Transmit Amplitude Selection */ +#define LM_XCVRCONTROL_TXO_MASK (3 << LM_XCVRCONTROL_TXO_SHIFT) +#define LM_XCVRCONTROL_TXO_00DB (0 << LM_XCVRCONTROL_TXO_SHIFT) /* Gain 0.0dB of insertion loss */ +#define LM_XCVRCONTROL_TXO_04DB (1 << LM_XCVRCONTROL_TXO_SHIFT) /* Gain 0.4dB of insertion loss */ +#define LM_XCVRCONTROL_TXO_08DB (2 << LM_XCVRCONTROL_TXO_SHIFT) /* Gain 0.8dB of insertion loss */ +#define LM_XCVRCONTROL_TXO_12DB (3 << LM_XCVRCONTROL_TXO_SHIFT) /* Gain 1.2dB of insertion loss */ /* LM3S6918 LED Configuration, address 0x17 */ -#define LM3S_LEDCONFIG_LED0_SHIFT (0) /* Bits 3-0: LED0 Source */ -#define LM3S_LEDCONFIG_LED0_MASK (0x0f << LM3S_LEDCONFIG_LED0_SHIFT) -#define LM3S_LEDCONFIG_LED0_LINKOK (0 << LM3S_LEDCONFIG_LED0_SHIFT) /* Link OK */ -#define LM3S_LEDCONFIG_LED0_RXTX (1 << LM3S_LEDCONFIG_LED0_SHIFT) /* RX or TX activity */ -#define LM3S_LEDCONFIG_LED0_100BASET (5 << LM3S_LEDCONFIG_LED0_SHIFT) /* 100BASE-TX mode */ -#define LM3S_LEDCONFIG_LED0_10BASET (6 << LM3S_LEDCONFIG_LED0_SHIFT) /* 10BASE-T mode */ -#define LM3S_LEDCONFIG_LED0_FDUPLEX (7 << LM3S_LEDCONFIG_LED0_SHIFT) /* Full duplex */ -#define LM3S_LEDCONFIG_LED0_OKRXTX (8 << LM3S_LEDCONFIG_LED0_SHIFT) /* Full duplex */ -#define LM3S_LEDCONFIG_LED1_SHIFT (4) /* Bits 7-4: LED1 Source */ -#define LM3S_LEDCONFIG_LED1_MASK (0x0f << LM3S_LEDCONFIG_LED1_SHIFT) -#define LM3S_LEDCONFIG_LED1_LINKOK (0 << LM3S_LEDCONFIG_LED1_SHIFT) /* Link OK */ -#define LM3S_LEDCONFIG_LED1_RXTX (1 << LM3S_LEDCONFIG_LED1_SHIFT) /* RX or TX activity */ -#define LM3S_LEDCONFIG_LED1_100BASET (5 << LM3S_LEDCONFIG_LED1_SHIFT) /* 100BASE-TX mode */ -#define LM3S_LEDCONFIG_LED1_10BASET (6 << LM3S_LEDCONFIG_LED1_SHIFT) /* 10BASE-T mode */ -#define LM3S_LEDCONFIG_LED1_FDUPLEX (7 << LM3S_LEDCONFIG_LED1_SHIFT) /* Full duplex */ -#define LM3S_LEDCONFIG_LED1_OKRXTX (8 << LM3S_LEDCONFIG_LED1_SHIFT) /* Full duplex */ +#define LM_LEDCONFIG_LED0_SHIFT (0) /* Bits 3-0: LED0 Source */ +#define LM_LEDCONFIG_LED0_MASK (0x0f << LM_LEDCONFIG_LED0_SHIFT) +#define LM_LEDCONFIG_LED0_LINKOK (0 << LM_LEDCONFIG_LED0_SHIFT) /* Link OK */ +#define LM_LEDCONFIG_LED0_RXTX (1 << LM_LEDCONFIG_LED0_SHIFT) /* RX or TX activity */ +#define LM_LEDCONFIG_LED0_100BASET (5 << LM_LEDCONFIG_LED0_SHIFT) /* 100BASE-TX mode */ +#define LM_LEDCONFIG_LED0_10BASET (6 << LM_LEDCONFIG_LED0_SHIFT) /* 10BASE-T mode */ +#define LM_LEDCONFIG_LED0_FDUPLEX (7 << LM_LEDCONFIG_LED0_SHIFT) /* Full duplex */ +#define LM_LEDCONFIG_LED0_OKRXTX (8 << LM_LEDCONFIG_LED0_SHIFT) /* Full duplex */ +#define LM_LEDCONFIG_LED1_SHIFT (4) /* Bits 7-4: LED1 Source */ +#define LM_LEDCONFIG_LED1_MASK (0x0f << LM_LEDCONFIG_LED1_SHIFT) +#define LM_LEDCONFIG_LED1_LINKOK (0 << LM_LEDCONFIG_LED1_SHIFT) /* Link OK */ +#define LM_LEDCONFIG_LED1_RXTX (1 << LM_LEDCONFIG_LED1_SHIFT) /* RX or TX activity */ +#define LM_LEDCONFIG_LED1_100BASET (5 << LM_LEDCONFIG_LED1_SHIFT) /* 100BASE-TX mode */ +#define LM_LEDCONFIG_LED1_10BASET (6 << LM_LEDCONFIG_LED1_SHIFT) /* 10BASE-T mode */ +#define LM_LEDCONFIG_LED1_FDUPLEX (7 << LM_LEDCONFIG_LED1_SHIFT) /* Full duplex */ +#define LM_LEDCONFIG_LED1_OKRXTX (8 << LM_LEDCONFIG_LED1_SHIFT) /* Full duplex */ /* LM3S6918 MDI/MDIX Control, address 0x18 */ -#define LM3S_MDICONTROL_MDIXSD_SHIFT (0) /* Bits 3-0: Auto-Switching Seed */ -#define LM3S_MDICONTROL_MDIXSD_MASK (0x0f << LM3S_MDICONTROL_MDIXSD_SHIFT) -#define LM3S_MDICONTROL_MDIXCM (1 << 4) /* Bit 4: Auto-Switching Complete */ -#define LM3S_MDICONTROL_MDIX (1 << 5) /* Bit 5: Auto-Switching Configuration */ -#define LM3S_MDICONTROL_AUTOSW (1 << 6) /* Bit 6: Auto-Switching Enable */ -#define LM3S_MDICONTROL_PDMODE (1 << 7) /* Bit 7: Parallel Detection Mode */ +#define LM_MDICONTROL_MDIXSD_SHIFT (0) /* Bits 3-0: Auto-Switching Seed */ +#define LM_MDICONTROL_MDIXSD_MASK (0x0f << LM_MDICONTROL_MDIXSD_SHIFT) +#define LM_MDICONTROL_MDIXCM (1 << 4) /* Bit 4: Auto-Switching Complete */ +#define LM_MDICONTROL_MDIX (1 << 5) /* Bit 5: Auto-Switching Configuration */ +#define LM_MDICONTROL_AUTOSW (1 << 6) /* Bit 6: Auto-Switching Enable */ +#define LM_MDICONTROL_PDMODE (1 << 7) /* Bit 7: Parallel Detection Mode */ /* KS8921-specific register bit settings ************************************/ /* KS8921 MII Control register bit definitions (not in 802.3) */ @@ -430,26 +430,26 @@ /* KS8921 10BASE-TX PHY control register */ -#define KS8721_10BTCR_BIT0 (1 << 0) /* Bit 0: xxx */ -#define KS8721_10BTCR_BIT1 (1 << 1) /* Bit 1: xxx */ -#define KS8721_10BTCR_MODE_SHIFT (2) /* Bits 2-4: Operation Mode Indication */ -#define KS8721_10BTCR_MODE_MASK (7 << KS8721_10BTCR_MODE_SHIFT) -# define KS8721_10BTCR_MODE_ANEG (0 << KS8721_10BTCR_MODE_SHIFT) /* Still in auto-negotiation */ -# define KS8721_10BTCR_MODE_10BTHD (1 << KS8721_10BTCR_MODE_SHIFT) /* 10BASE-T half-duplex */ -# define KS8721_10BTCR_MODE_100BTHD (2 << KS8721_10BTCR_MODE_SHIFT) /* 100BASE_t half-duplex */ -# define KS8721_10BTCR_MODE_DEFAULT (3 << KS8721_10BTCR_MODE_SHIFT) /* Default */ -# define KS8721_10BTCR_MODE_10BTFD (5 << KS8721_10BTCR_MODE_SHIFT) /* 10BASE-T full duplex */ -# define KS8721_10BTCR_MODE_100BTFD (6 << KS8721_10BTCR_MODE_SHIFT) /* 100BASE-T full duplex */ -# define KS8721_10BTCR_MODE_ISOLATE (7 << KS8721_10BTCR_MODE_SHIFT) /* PHY/MII isolate */ -#define KS8721_10BTCR_ISOLATE (1 << 5) /* Bit 5: PHY isolate */ -#define KS8721_10BTCR_PAUSE (1 << 6) /* Bit 6: Enable pause */ -#define KS8721_10BTCR_ANEGCOMP (1 << 7) /* Bit 7: Auto-negotiation complete */ -#define KS8721_10BTCR_JABBERE (1 << 8) /* Bit 8: Enable Jabber */ -#define KS8721_10BTCR_INTLVL (1 << 9) /* Bit 9: Interrupt level */ -#define KS8721_10BTCR_POWER (1 << 10) /* Bit 10: Power saving */ -#define KS8721_10BTCR_FORCE (1 << 11) /* Bit 11: Force link */ -#define KS8721_10BTCR_ENERGY (1 << 12) /* Bit 12: Energy detect */ -#define KS8721_10BTCR_PAIRSWAPD (1 << 13) /* Bit 13: Pairswap disable */ +#define KS8721_10BTCR_BIT0 (1 << 0) /* Bit 0: xxx */ +#define KS8721_10BTCR_BIT1 (1 << 1) /* Bit 1: xxx */ +#define KS8721_10BTCR_MODE_SHIFT (2) /* Bits 2-4: Operation Mode Indication */ +#define KS8721_10BTCR_MODE_MASK (7 << KS8721_10BTCR_MODE_SHIFT) +# define KS8721_10BTCR_MODE_ANEG (0 << KS8721_10BTCR_MODE_SHIFT) /* Still in auto-negotiation */ +# define KS8721_10BTCR_MODE_10BTHD (1 << KS8721_10BTCR_MODE_SHIFT) /* 10BASE-T half-duplex */ +# define KS8721_10BTCR_MODE_100BTHD (2 << KS8721_10BTCR_MODE_SHIFT) /* 100BASE_t half-duplex */ +# define KS8721_10BTCR_MODE_DEFAULT (3 << KS8721_10BTCR_MODE_SHIFT) /* Default */ +# define KS8721_10BTCR_MODE_10BTFD (5 << KS8721_10BTCR_MODE_SHIFT) /* 10BASE-T full duplex */ +# define KS8721_10BTCR_MODE_100BTFD (6 << KS8721_10BTCR_MODE_SHIFT) /* 100BASE-T full duplex */ +# define KS8721_10BTCR_MODE_ISOLATE (7 << KS8721_10BTCR_MODE_SHIFT) /* PHY/MII isolate */ +#define KS8721_10BTCR_ISOLATE (1 << 5) /* Bit 5: PHY isolate */ +#define KS8721_10BTCR_PAUSE (1 << 6) /* Bit 6: Enable pause */ +#define KS8721_10BTCR_ANEGCOMP (1 << 7) /* Bit 7: Auto-negotiation complete */ +#define KS8721_10BTCR_JABBERE (1 << 8) /* Bit 8: Enable Jabber */ +#define KS8721_10BTCR_INTLVL (1 << 9) /* Bit 9: Interrupt level */ +#define KS8721_10BTCR_POWER (1 << 10) /* Bit 10: Power saving */ +#define KS8721_10BTCR_FORCE (1 << 11) /* Bit 11: Force link */ +#define KS8721_10BTCR_ENERGY (1 << 12) /* Bit 12: Energy detect */ +#define KS8721_10BTCR_PAIRSWAPD (1 << 13) /* Bit 13: Pairswap disable */ /**************************************************************************** * Type Definitions From d844f61f8ad81de5bf2b4353763ca92634fb73f4 Mon Sep 17 00:00:00 2001 From: patacongo Date: Wed, 9 Jan 2013 19:49:16 +0000 Subject: [PATCH 052/118] Re-partition Stellaris vector logic git-svn-id: http://svn.code.sf.net/p/nuttx/code/trunk@5499 42af7a65-404d-4744-a932-0658087f49c3 --- nuttx/arch/arm/include/lm/irq.h | 281 +----------- nuttx/arch/arm/include/lm/lm3s_irq.h | 424 ++++++++++++++++++ nuttx/arch/arm/src/lm/chip/lm3s_vectors.h | 439 +++++++++++++++++++ nuttx/arch/arm/src/lm/chip/lm_memorymap.h | 4 +- nuttx/arch/arm/src/lm/chip/lm_pinmap.h | 4 +- nuttx/arch/arm/src/lm/chip/lm_vectors.h | 64 +++ nuttx/arch/arm/src/lm/lm_vectors.S | 498 +--------------------- 7 files changed, 963 insertions(+), 751 deletions(-) create mode 100644 nuttx/arch/arm/include/lm/lm3s_irq.h create mode 100644 nuttx/arch/arm/src/lm/chip/lm3s_vectors.h create mode 100644 nuttx/arch/arm/src/lm/chip/lm_vectors.h diff --git a/nuttx/arch/arm/include/lm/irq.h b/nuttx/arch/arm/include/lm/irq.h index 9a5a3d1539..3b984a8262 100644 --- a/nuttx/arch/arm/include/lm/irq.h +++ b/nuttx/arch/arm/include/lm/irq.h @@ -33,10 +33,6 @@ * ************************************************************************************/ -/* This file should never be included directed but, rather, - * only indirectly through nuttx/irq.h - */ - #ifndef __ARCH_ARM_INCLUDE_LM_IRQ_H #define __ARCH_ARM_INCLUDE_LM_IRQ_H @@ -47,263 +43,18 @@ #include #include -/************************************************************************************ - * Definitions - ************************************************************************************/ - -/* IRQ numbers. The IRQ number corresponds vector number and hence map directly to - * bits in the NVIC. This does, however, waste several words of memory in the IRQ - * to handle mapping tables. - */ - -/* Processor Exceptions (vectors 0-15) */ - -#define LM_IRQ_RESERVED (0) /* Reserved vector (only used with CONFIG_DEBUG) */ - /* Vector 0: Reset stack pointer value */ - /* Vector 1: Reset (not handler as an IRQ) */ -#define LM_IRQ_NMI (2) /* Vector 2: Non-Maskable Interrupt (NMI) */ -#define LM_IRQ_HARDFAULT (3) /* Vector 3: Hard fault */ -#define LM_IRQ_MEMFAULT (4) /* Vector 4: Memory management (MPU) */ -#define LM_IRQ_BUSFAULT (5) /* Vector 5: Bus fault */ -#define LM_IRQ_USAGEFAULT (6) /* Vector 6: Usage fault */ -#define LM_IRQ_SVCALL (11) /* Vector 11: SVC call */ -#define LM_IRQ_DBGMONITOR (12) /* Vector 12: Debug Monitor */ - /* Vector 13: Reserved */ -#define LM_IRQ_PENDSV (14) /* Vector 14: Pendable system service request */ -#define LM_IRQ_SYSTICK (15) /* Vector 15: System tick */ - -/* External interrupts (vectors >= 16) */ - -#define LM_IRQ_INTERRUPTS (16) /* Vector number of the first external interrupt */ -#if defined(CONFIG_ARCH_CHIP_LM3S6918) - -# define LM_IRQ_GPIOA (16) /* Vector 16: GPIO Port A */ -# define LM_IRQ_GPIOB (17) /* Vector 17: GPIO Port B */ -# define LM_IRQ_GPIOC (18) /* Vector 18: GPIO Port C */ -# define LM_IRQ_GPIOD (19) /* Vector 19: GPIO Port D */ -# define LM_IRQ_GPIOE (20) /* Vector 20: GPIO Port E */ -# define LM_IRQ_UART0 (21) /* Vector 21: UART 0 */ -# define LM_IRQ_UART1 (22) /* Vector 22: UART 1 */ -# define LM_IRQ_SSI0 (23) /* Vector 23: SSI 0 */ -# define LM_IRQ_I2C0 (24) /* Vector 24: I2C 0 */ - /* Vector 25-29: Reserved */ -# define LM_IRQ_ADC0 (30) /* Vector 30: ADC Sequence 0 */ -# define LM_IRQ_ADC1 (31) /* Vector 31: ADC Sequence 1 */ -# define LM_IRQ_ADC2 (32) /* Vector 32: ADC Sequence 2 */ -# define LM_IRQ_ADC3 (33) /* Vector 33: ADC Sequence 3 */ -# define LM_IRQ_WDOG (34) /* Vector 34: Watchdog Timer */ -# define LM_IRQ_TIMER0A (35) /* Vector 35: Timer 0 A */ -# define LM_IRQ_TIMER0B (36) /* Vector 36: Timer 0 B */ -# define LM_IRQ_TIMER1A (37) /* Vector 37: Timer 1 A */ -# define LM_IRQ_TIMER1B (38) /* Vector 38: Timer 1 B */ -# define LM_IRQ_TIMER2A (39) /* Vector 39: Timer 2 A */ -# define LM_IRQ_TIMER2B (40) /* Vector 40: Timer 3 B */ -# define LM_IRQ_COMPARE0 (41) /* Vector 41: Analog Comparator 0 */ -# define LM_IRQ_COMPARE1 (42) /* Vector 42: Analog Comparator 1 */ - /* Vector 43: Reserved */ -# define LM_IRQ_SYSCON (44) /* Vector 44: System Control */ -# define LM_IRQ_FLASHCON (45) /* Vector 45: FLASH Control */ -# define LM_IRQ_GPIOF (46) /* Vector 46: GPIO Port F */ -# define LM_IRQ_GPIOG (47) /* Vector 47: GPIO Port G */ -# define LM_IRQ_GPIOH (48) /* Vector 48: GPIO Port H */ - /* Vector 49: Reserved */ -# define LM_IRQ_SSI1 (50) /* Vector 50: SSI 1 */ -# define LM_IRQ_TIMER3A (51) /* Vector 51: Timer 3 A */ -# define LM_IRQ_TIMER3B (52) /* Vector 52: Timer 3 B */ -# define LM_IRQ_I2C1 (53) /* Vector 53: I2C 1 */ - /* Vectors 54-57: Reserved */ -# define LM_IRQ_ETHCON (58) /* Vector 58: Ethernet Controller */ -# define LM_IRQ_HIBERNATE (59) /* Vector 59: Hibernation Module */ - /* Vectors 60-70: Reserved */ -# define NR_IRQS (60) /* (Really less because of reserved vectors) */ -#elif defined(CONFIG_ARCH_CHIP_LM3S6432) -# define LM_IRQ_GPIOA (16) /* Vector 16: GPIO Port A */ -# define LM_IRQ_GPIOB (17) /* Vector 17: GPIO Port B */ -# define LM_IRQ_GPIOC (18) /* Vector 18: GPIO Port C */ -# define LM_IRQ_GPIOD (19) /* Vector 19: GPIO Port D */ -# define LM_IRQ_GPIOE (20) /* Vector 20: GPIO Port E */ -# define LM_IRQ_UART0 (21) /* Vector 21: UART 0 */ -# define LM_IRQ_UART1 (22) /* Vector 22: UART 1 */ -# define LM_IRQ_SSI0 (23) /* Vector 23: SSI 0 */ -# define LM_IRQ_I2C0 (24) /* Vector 24: I2C 0 */ - /* Vector 25: Reserved */ -# define LM_IRQ_PWM0 (26) /* Vector 26: PWM Generator 0 */ - /* Vectors 27-29: Reserved */ -# define LM_IRQ_ADC0 (30) /* Vector 30: ADC Sequence 0 */ -# define LM_IRQ_ADC1 (31) /* Vector 31: ADC Sequence 1 */ -# define LM_IRQ_ADC2 (32) /* Vector 32: ADC Sequence 2 */ -# define LM_IRQ_ADC3 (33) /* Vector 33: ADC Sequence 3 */ -# define LM_IRQ_WDOG (34) /* Vector 34: Watchdog Timer */ -# define LM_IRQ_TIMER0A (35) /* Vector 35: Timer 0 A */ -# define LM_IRQ_TIMER0B (36) /* Vector 36: Timer 0 B */ -# define LM_IRQ_TIMER1A (37) /* Vector 37: Timer 1 A */ -# define LM_IRQ_TIMER1B (38) /* Vector 38: Timer 1 B */ -# define LM_IRQ_TIMER2A (39) /* Vector 39: Timer 2 A */ -# define LM_IRQ_TIMER2B (40) /* Vector 40: Timer 3 B */ -# define LM_IRQ_COMPARE0 (41) /* Vector 41: Analog Comparator 0 */ -# define LM_IRQ_COMPARE1 (42) /* Vector 42: Analog Comparator 1 */ - /* Vector 43: Reserved */ -# define LM_IRQ_SYSCON (44) /* Vector 44: System Control */ -# define LM_IRQ_FLASHCON (45) /* Vector 45: FLASH Control */ -# define LM_IRQ_GPIOF (46) /* Vector 46: GPIO Port F */ -# define LM_IRQ_GPIOG (47) /* Vector 47: GPIO Port G */ - /* Vectors 48-57: Reserved */ -# define LM_IRQ_ETHCON (58) /* Vector 58: Ethernet Controller */ - /* Vectors 59-70: Reserved */ -# define NR_IRQS (60) /* (Really less because of reserved vectors) */ -#elif defined(CONFIG_ARCH_CHIP_LM3S6965) -# define LM_IRQ_GPIOA (16) /* Vector 16: GPIO Port A */ -# define LM_IRQ_GPIOB (17) /* Vector 17: GPIO Port B */ -# define LM_IRQ_GPIOC (18) /* Vector 18: GPIO Port C */ -# define LM_IRQ_GPIOD (19) /* Vector 19: GPIO Port D */ -# define LM_IRQ_GPIOE (20) /* Vector 20: GPIO Port E */ -# define LM_IRQ_UART0 (21) /* Vector 21: UART 0 */ -# define LM_IRQ_UART1 (22) /* Vector 22: UART 1 */ -# define LM_IRQ_SSI0 (23) /* Vector 23: SSI 0 */ -# define LM_IRQ_I2C0 (24) /* Vector 24: I2C 0 */ -# define LM_IRQ_PWMFAULT (25) /* Vector 25: PWM Fault */ -# define LM_IRQ_PWM0 (26) /* Vector 26: PWM Generator 0 */ -# define LM_IRQ_PWM1 (27) /* Vector 27: PWM Generator 1 */ -# define LM_IRQ_PWM2 (28) /* Vector 28: PWM Generator 2 */ -# define LM_IRQ_QEI0 (29) /* Vector 29: QEI0 */ -# define LM_IRQ_ADC0 (30) /* Vector 30: ADC Sequence 0 */ -# define LM_IRQ_ADC1 (31) /* Vector 31: ADC Sequence 1 */ -# define LM_IRQ_ADC2 (32) /* Vector 32: ADC Sequence 2 */ -# define LM_IRQ_ADC3 (33) /* Vector 33: ADC Sequence 3 */ -# define LM_IRQ_WDOG (34) /* Vector 34: Watchdog Timer */ -# define LM_IRQ_TIMER0A (35) /* Vector 35: Timer 0 A */ -# define LM_IRQ_TIMER0B (36) /* Vector 36: Timer 0 B */ -# define LM_IRQ_TIMER1A (37) /* Vector 37: Timer 1 A */ -# define LM_IRQ_TIMER1B (38) /* Vector 38: Timer 1 B */ -# define LM_IRQ_TIMER2A (39) /* Vector 39: Timer 2 A */ -# define LM_IRQ_TIMER2B (40) /* Vector 40: Timer 3 B */ -# define LM_IRQ_COMPARE0 (41) /* Vector 41: Analog Comparator 0 */ -# define LM_IRQ_COMPARE1 (42) /* Vector 42: Analog Comparator 1 */ - /* Vector 43: Reserved */ -# define LM_IRQ_SYSCON (44) /* Vector 44: System Control */ -# define LM_IRQ_FLASHCON (45) /* Vector 45: FLASH Control */ -# define LM_IRQ_GPIOF (46) /* Vector 46: GPIO Port F */ -# define LM_IRQ_GPIOG (47) /* Vector 47: GPIO Port G */ - /* Vector 48: Reserved */ -# define LM_IRQ_UART2 (49) /* Vector 49: UART 2 */ - /* Vector 50: Reserved */ -# define LM_IRQ_TIMER3A (51) /* Vector 51: Timer 3 A */ -# define LM_IRQ_TIMER3B (52) /* Vector 52: Timer 3 B */ -# define LM_IRQ_I2C1 (53) /* Vector 53: I2C 1 */ -# define LM_IRQ_QEI1 (54) /* Vector 54: QEI1 */ - /* Vectors 55-57: Reserved */ -# define LM_IRQ_ETHCON (58) /* Vector 58: Ethernet Controller */ -# define LM_IRQ_HIBERNATE (59) /* Vector 59: Hibernation Module */ - /* Vectors 60-70: Reserved */ -# define NR_IRQS (60) /* (Really less because of reserved vectors) */ -#elif defined(CONFIG_ARCH_CHIP_LM3S9B96) -# define LM_IRQ_GPIOA (16) /* Vector 16: GPIO Port A */ -# define LM_IRQ_GPIOB (17) /* Vector 17: GPIO Port B */ -# define LM_IRQ_GPIOC (18) /* Vector 18: GPIO Port C */ -# define LM_IRQ_GPIOD (19) /* Vector 19: GPIO Port D */ -# define LM_IRQ_GPIOE (20) /* Vector 20: GPIO Port E */ -# define LM_IRQ_UART0 (21) /* Vector 21: UART 0 */ -# define LM_IRQ_UART1 (22) /* Vector 22: UART 1 */ -# define LM_IRQ_SSI0 (23) /* Vector 23: SSI 0 */ -# define LM_IRQ_I2C0 (24) /* Vector 24: I2C 0 */ -# define LM_IRQ_PWMFAULT (25) /* Vector 25: PWM Fault */ -# define LM_IRQ_PWM0 (26) /* Vector 26: PWM Generator 0 */ -# define LM_IRQ_PWM1 (27) /* Vector 27: PWM Generator 1 */ -# define LM_IRQ_PWM2 (28) /* Vector 28: PWM Generator 2 */ -# define LM_IRQ_QEI0 (29) /* Vector 29: QEI0 */ -# define LM_IRQ_ADC0 (30) /* Vector 30: ADC0 Sequence 0 */ -# define LM_IRQ_ADC1 (31) /* Vector 31: ADC0 Sequence 1 */ -# define LM_IRQ_ADC2 (32) /* Vector 32: ADC0 Sequence 2 */ -# define LM_IRQ_ADC3 (33) /* Vector 33: ADC0 Sequence 3 */ -# define LM_IRQ_WDOG (34) /* Vector 34: Watchdog Timer */ -# define LM_IRQ_TIMER0A (35) /* Vector 35: Timer 0 A */ -# define LM_IRQ_TIMER0B (36) /* Vector 36: Timer 0 B */ -# define LM_IRQ_TIMER1A (37) /* Vector 37: Timer 1 A */ -# define LM_IRQ_TIMER1B (38) /* Vector 38: Timer 1 B */ -# define LM_IRQ_TIMER2A (39) /* Vector 39: Timer 2 A */ -# define LM_IRQ_TIMER2B (40) /* Vector 40: Timer 3 B */ -# define LM_IRQ_COMPARE0 (41) /* Vector 41: Analog Comparator 0 */ -# define LM_IRQ_COMPARE1 (42) /* Vector 42: Analog Comparator 1 */ -# define LM_IRQ_COMPARE2 (43) /* Vector 43: Analog Comparator 3 */ -# define LM_IRQ_SYSCON (44) /* Vector 44: System Control */ -# define LM_IRQ_FLASHCON (45) /* Vector 45: FLASH Control */ -# define LM_IRQ_GPIOF (46) /* Vector 46: GPIO Port F */ -# define LM_IRQ_GPIOG (47) /* Vector 47: GPIO Port G */ -# define LM_IRQ_GPIOH (48) /* Vector 48: GPIO Port H */ -# define LM_IRQ_UART2 (49) /* Vector 49: UART 2 */ -# define LM_IRQ_SSI1 (50) /* Vector 50: SSI 1 */ -# define LM_IRQ_TIMER3A (51) /* Vector 51: Timer 3 A */ -# define LM_IRQ_TIMER3B (52) /* Vector 52: Timer 3 B */ -# define LM_IRQ_I2C1 (53) /* Vector 53: I2C 1 */ -# define LM_IRQ_QEI1 (54) /* Vector 54: QEI1 */ -# define LM_IRQ_CAN0 (55) /* Vector 55: CAN 1 */ -# define LM_IRQ_CAN1 (56) /* Vector 56: CAN 2 */ - /* Vector 57: Reserved */ -# define LM_IRQ_ETHCON (58) /* Vector 58: Ethernet Controller */ - /* Vector 59: Reserved */ -# define LM_IRQ_USB (60) /* Vector 60: USB */ -# define LM_IRQ_PWM3 (61) /* Vector 61: PWM Generator 3 */ -# define LM_IRQ_UDMASOFT (62) /* Vector 62: uDMA Software */ -# define LM_IRQ_UDMAERROR (63) /* Vector 63: uDMA Error */ -# define LM_IRQ_ADC1_0 (64) /* Vector 64: ADC1 Sequence 0 */ -# define LM_IRQ_ADC1_1 (65) /* Vector 65: ADC1 Sequence 1 */ -# define LM_IRQ_ADC1_2 (66) /* Vector 66: ADC1 Sequence 2 */ -# define LM_IRQ_ADC1_3 (67) /* Vector 67: ADC1 Sequence 3 */ -# define LM_IRQ_I2S0 (68) /* Vector 68: I2S0 */ -# define LM_IRQ_EPI (69) /* Vector 69: EPI */ -# define LM_IRQ_GPIOJ (70) /* Vector 70: GPIO Port J */ - /* Vector 71: Reserved */ -# define NR_IRQS (71) /* (Really less because of reserved vectors) */ -#elif defined(CONFIG_ARCH_CHIP_LM3S8962) -# define LM_IRQ_GPIOA (16) /* Vector 16: GPIO Port A */ -# define LM_IRQ_GPIOB (17) /* Vector 17: GPIO Port B */ -# define LM_IRQ_GPIOC (18) /* Vector 18: GPIO Port C */ -# define LM_IRQ_GPIOD (19) /* Vector 19: GPIO Port D */ -# define LM_IRQ_GPIOE (20) /* Vector 20: GPIO Port E */ -# define LM_IRQ_UART0 (21) /* Vector 21: UART 0 */ -# define LM_IRQ_UART1 (22) /* Vector 22: UART 1 */ -# define LM_IRQ_SSI0 (23) /* Vector 23: SSI 0 */ -# define LM_IRQ_I2C0 (24) /* Vector 24: I2C 0 */ -# define LM_IRQ_PWMFAULT (25) /* Vector 25: PWM Fault */ -# define LM_IRQ_PWM0 (26) /* Vector 26: PWM Generator 0 */ -# define LM_IRQ_PWM1 (27) /* Vector 27: PWM Generator 1 */ -# define LM_IRQ_PWM2 (28) /* Vector 28: PWM Generator 2 */ -# define LM_IRQ_QEI0 (29) /* Vector 29: QEI0 */ -# define LM_IRQ_ADC0 (30) /* Vector 30: ADC Sequence 0 */ -# define LM_IRQ_ADC1 (31) /* Vector 31: ADC Sequence 1 */ -# define LM_IRQ_ADC2 (32) /* Vector 32: ADC Sequence 2 */ -# define LM_IRQ_ADC3 (33) /* Vector 33: ADC Sequence 3 */ -# define LM_IRQ_WDOG (34) /* Vector 34: Watchdog Timer */ -# define LM_IRQ_TIMER0A (35) /* Vector 35: Timer 0 A */ -# define LM_IRQ_TIMER0B (36) /* Vector 36: Timer 0 B */ -# define LM_IRQ_TIMER1A (37) /* Vector 37: Timer 1 A */ -# define LM_IRQ_TIMER1B (38) /* Vector 38: Timer 1 B */ -# define LM_IRQ_TIMER2A (39) /* Vector 39: Timer 2 A */ -# define LM_IRQ_TIMER2B (40) /* Vector 40: Timer 3 B */ -# define LM_IRQ_COMPARE0 (41) /* Vector 41: Analog Comparator 0 */ - /* Vector 42: Reserved */ - /* Vector 43: Reserved */ -# define LM_IRQ_SYSCON (44) /* Vector 44: System Control */ -# define LM_IRQ_FLASHCON (45) /* Vector 45: FLASH Control */ -# define LM_IRQ_GPIOF (46) /* Vector 46: GPIO Port F */ -# define LM_IRQ_GPIOG (47) /* Vector 47: GPIO Port G */ - /* Vector 48: Reserved */ - /* Vector 49: Reserved */ - /* Vector 50: Reserved */ -# define LM_IRQ_TIMER3A (51) /* Vector 51: Timer 3 A */ -# define LM_IRQ_TIMER3B (52) /* Vector 52: Timer 3 B */ -# define LM_IRQ_I2C1 (53) /* Vector 53: I2C 1 */ -# define LM_IRQ_QEI1 (54) /* Vector 54: QEI1 */ -# define LM_IRQ_CAN0 (54) /* Vector 55: CAN0 */ - /* Vectors 56-57: Reserved */ -# define LM_IRQ_ETHCON (58) /* Vector 58: Ethernet Controller */ -# define LM_IRQ_HIBERNATE (59) /* Vector 59: Hibernation Module */ - /* Vectors 60-70: Reserved */ -# define NR_IRQS (60) /* (Really less because of reserved vectors) */ +#if defined(CONFIG_ARCH_CHIP_LM3S) +# include +#elif defined(CONFIG_ARCH_CHIP_LM4F) +# include #else -# error "IRQ Numbers not specified for this Stellaris chip" +# error "Unsupported Stellaris IRQ file" #endif +/************************************************************************************ + * Pre-processor Definitions + ************************************************************************************/ + /* GPIO IRQs -- Note that support for individual GPIO ports can * be disabled in order to reduce the size of the implemenation. */ @@ -446,10 +197,8 @@ #ifndef __ASSEMBLY__ #ifdef __cplusplus -#define EXTERN extern "C" -extern "C" { -#else -#define EXTERN extern +extern "C" +{ #endif /************************************************************************************ @@ -464,7 +213,7 @@ extern "C" { * ****************************************************************************/ -EXTERN int gpio_irqattach(int irq, xcpt_t isr); +int gpio_irqattach(int irq, xcpt_t isr); #define gpio_irqdetach(isr) gpio_irqattach(isr, NULL) /**************************************************************************** @@ -475,7 +224,7 @@ EXTERN int gpio_irqattach(int irq, xcpt_t isr); * ****************************************************************************/ -EXTERN void gpio_irqenable(int irq); +void gpio_irqenable(int irq); /**************************************************************************** * Name: gpio_irqdisable @@ -485,13 +234,11 @@ EXTERN void gpio_irqenable(int irq); * ****************************************************************************/ -EXTERN void gpio_irqdisable(int irq); +void gpio_irqdisable(int irq); -#undef EXTERN #ifdef __cplusplus } #endif #endif #endif /* __ARCH_ARM_INCLUDE_LM_IRQ_H */ - diff --git a/nuttx/arch/arm/include/lm/lm3s_irq.h b/nuttx/arch/arm/include/lm/lm3s_irq.h new file mode 100644 index 0000000000..a9d0640d99 --- /dev/null +++ b/nuttx/arch/arm/include/lm/lm3s_irq.h @@ -0,0 +1,424 @@ +/************************************************************************************ + * arch/arm/include/lm/lm3s_irq.h + * + * Copyright (C) 2013 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * 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. + * + ************************************************************************************/ + +#ifndef __ARCH_ARM_INCLUDE_LM_LM3S_IRQ_H +#define __ARCH_ARM_INCLUDE_LM_LM3S_IRQ_H + +/************************************************************************************ + * Included Files + ************************************************************************************/ + +#include + +/************************************************************************************ + * Definitions + ************************************************************************************/ + +/* IRQ numbers. The IRQ number corresponds vector number and hence map directly to + * bits in the NVIC. This does, however, waste several words of memory in the IRQ + * to handle mapping tables. + */ + +/* Processor Exceptions (vectors 0-15) */ + +#define LM_IRQ_RESERVED (0) /* Reserved vector (only used with CONFIG_DEBUG) */ + /* Vector 0: Reset stack pointer value */ + /* Vector 1: Reset (not handler as an IRQ) */ +#define LM_IRQ_NMI (2) /* Vector 2: Non-Maskable Interrupt (NMI) */ +#define LM_IRQ_HARDFAULT (3) /* Vector 3: Hard fault */ +#define LM_IRQ_MEMFAULT (4) /* Vector 4: Memory management (MPU) */ +#define LM_IRQ_BUSFAULT (5) /* Vector 5: Bus fault */ +#define LM_IRQ_USAGEFAULT (6) /* Vector 6: Usage fault */ +#define LM_IRQ_SVCALL (11) /* Vector 11: SVC call */ +#define LM_IRQ_DBGMONITOR (12) /* Vector 12: Debug Monitor */ + /* Vector 13: Reserved */ +#define LM_IRQ_PENDSV (14) /* Vector 14: Pendable system service request */ +#define LM_IRQ_SYSTICK (15) /* Vector 15: System tick */ + +/* External interrupts (vectors >= 16) */ + +#define LM_IRQ_INTERRUPTS (16) /* Vector number of the first external interrupt */ +#if defined(CONFIG_ARCH_CHIP_LM3S6918) + +# define LM_IRQ_GPIOA (16) /* Vector 16: GPIO Port A */ +# define LM_IRQ_GPIOB (17) /* Vector 17: GPIO Port B */ +# define LM_IRQ_GPIOC (18) /* Vector 18: GPIO Port C */ +# define LM_IRQ_GPIOD (19) /* Vector 19: GPIO Port D */ + +# define LM_IRQ_GPIOE (20) /* Vector 20: GPIO Port E */ +# define LM_IRQ_UART0 (21) /* Vector 21: UART 0 */ +# define LM_IRQ_UART1 (22) /* Vector 22: UART 1 */ +# define LM_IRQ_SSI0 (23) /* Vector 23: SSI 0 */ +# define LM_IRQ_I2C0 (24) /* Vector 24: I2C 0 */ +# define LM_RESERVED_25 (25) /* Vector 25: Reserved */ +# define LM_RESERVED_26 (26) /* Vector 26: Reserved */ +# define LM_RESERVED_27 (27) /* Vector 27: Reserved */ +# define LM_RESERVED_28 (28) /* Vector 28: Reserved */ +# define LM_RESERVED_29 (29) /* Vector 29: Reserved */ + +# define LM_IRQ_ADC0 (30) /* Vector 30: ADC Sequence 0 */ +# define LM_IRQ_ADC1 (31) /* Vector 31: ADC Sequence 1 */ +# define LM_IRQ_ADC2 (32) /* Vector 32: ADC Sequence 2 */ +# define LM_IRQ_ADC3 (33) /* Vector 33: ADC Sequence 3 */ +# define LM_IRQ_WDOG (34) /* Vector 34: Watchdog Timer */ +# define LM_IRQ_TIMER0A (35) /* Vector 35: Timer 0 A */ +# define LM_IRQ_TIMER0B (36) /* Vector 36: Timer 0 B */ +# define LM_IRQ_TIMER1A (37) /* Vector 37: Timer 1 A */ +# define LM_IRQ_TIMER1B (38) /* Vector 38: Timer 1 B */ +# define LM_IRQ_TIMER2A (39) /* Vector 39: Timer 2 A */ +# define LM_IRQ_TIMER2B (40) /* Vector 40: Timer 3 B */ + +# define LM_IRQ_COMPARE0 (41) /* Vector 41: Analog Comparator 0 */ +# define LM_IRQ_COMPARE1 (42) /* Vector 42: Analog Comparator 1 */ +# define LM_RESERVED_43 (43) /* Vector 43: Reserved */ +# define LM_IRQ_SYSCON (44) /* Vector 44: System Control */ +# define LM_IRQ_FLASHCON (45) /* Vector 45: FLASH Control */ +# define LM_IRQ_GPIOF (46) /* Vector 46: GPIO Port F */ +# define LM_IRQ_GPIOG (47) /* Vector 47: GPIO Port G */ +# define LM_IRQ_GPIOH (48) /* Vector 48: GPIO Port H */ +# define LM_RESERVED_49 (49) /* Vector 49: Reserved */ + +# define LM_IRQ_SSI1 (50) /* Vector 50: SSI 1 */ +# define LM_IRQ_TIMER3A (51) /* Vector 51: Timer 3 A */ +# define LM_IRQ_TIMER3B (52) /* Vector 52: Timer 3 B */ +# define LM_IRQ_I2C1 (53) /* Vector 53: I2C 1 */ +# define LM_RESERVED_54 (54) /* Vector 54: Reserved */ +# define LM_RESERVED_55 (55) /* Vector 55: Reserved */ +# define LM_RESERVED_56 (56) /* Vector 56: Reserved */ +# define LM_RESERVED_57 (57) /* Vector 57: Reserved */ +# define LM_IRQ_ETHCON (58) /* Vector 58: Ethernet Controller */ +# define LM_IRQ_HIBERNATE (59) /* Vector 59: Hibernation Module */ + +# define LM_RESERVED_60 (60) /* Vector 60: Reserved */ +# define LM_RESERVED_61 (61) /* Vector 61: Reserved */ +# define LM_RESERVED_62 (62) /* Vector 62: Reserved */ +# define LM_RESERVED_63 (63) /* Vector 63: Reserved */ +# define LM_RESERVED_64 (64) /* Vector 64: Reserved */ +# define LM_RESERVED_65 (65) /* Vector 65: Reserved */ +# define LM_RESERVED_66 (66) /* Vector 66: Reserved */ +# define LM_RESERVED_67 (67) /* Vector 67: Reserved */ +# define LM_RESERVED_68 (68) /* Vector 68: Reserved */ +# define LM_RESERVED_69 (69) /* Vector 69: Reserved */ + +# define LM_RESERVED_70 (70) /* Vector 70: Reserved */ + +# define NR_IRQS (60) /* (Really less because of reserved vectors) */ + +#elif defined(CONFIG_ARCH_CHIP_LM3S6432) +# define LM_IRQ_GPIOA (16) /* Vector 16: GPIO Port A */ +# define LM_IRQ_GPIOB (17) /* Vector 17: GPIO Port B */ +# define LM_IRQ_GPIOC (18) /* Vector 18: GPIO Port C */ +# define LM_IRQ_GPIOD (19) /* Vector 19: GPIO Port D */ + +# define LM_IRQ_GPIOE (20) /* Vector 20: GPIO Port E */ +# define LM_IRQ_UART0 (21) /* Vector 21: UART 0 */ +# define LM_IRQ_UART1 (22) /* Vector 22: UART 1 */ +# define LM_IRQ_SSI0 (23) /* Vector 23: SSI 0 */ +# define LM_IRQ_I2C0 (24) /* Vector 24: I2C 0 */ +# define LM_RESERVED_25 (25) /* Vector 25: Reserved */ +# define LM_IRQ_PWM0 (26) /* Vector 26: PWM Generator 0 */ +# define LM_RESERVED_27 (27) /* Vector 27: Reserved */ +# define LM_RESERVED_28 (28) /* Vector 28: Reserved */ +# define LM_RESERVED_29 (29) /* Vector 29: Reserved */ + +# define LM_IRQ_ADC0 (30) /* Vector 30: ADC Sequence 0 */ +# define LM_IRQ_ADC1 (31) /* Vector 31: ADC Sequence 1 */ +# define LM_IRQ_ADC2 (32) /* Vector 32: ADC Sequence 2 */ +# define LM_IRQ_ADC3 (33) /* Vector 33: ADC Sequence 3 */ +# define LM_IRQ_WDOG (34) /* Vector 34: Watchdog Timer */ +# define LM_IRQ_TIMER0A (35) /* Vector 35: Timer 0 A */ +# define LM_IRQ_TIMER0B (36) /* Vector 36: Timer 0 B */ +# define LM_IRQ_TIMER1A (37) /* Vector 37: Timer 1 A */ +# define LM_IRQ_TIMER1B (38) /* Vector 38: Timer 1 B */ +# define LM_IRQ_TIMER2A (39) /* Vector 39: Timer 2 A */ + +# define LM_IRQ_TIMER2B (40) /* Vector 40: Timer 3 B */ +# define LM_IRQ_COMPARE0 (41) /* Vector 41: Analog Comparator 0 */ +# define LM_IRQ_COMPARE1 (42) /* Vector 42: Analog Comparator 1 */ +# define LM_RESERVED_43 (43) /* Vector 43: Reserved */ +# define LM_IRQ_SYSCON (44) /* Vector 44: System Control */ +# define LM_IRQ_FLASHCON (45) /* Vector 45: FLASH Control */ +# define LM_IRQ_GPIOF (46) /* Vector 46: GPIO Port F */ +# define LM_IRQ_GPIOG (47) /* Vector 47: GPIO Port G */ +# define LM_RESERVED_48 (48) /* Vector 48: Reserved */ +# define LM_RESERVED_49 (49) /* Vector 49: Reserved */ + +# define LM_RESERVED_50 (50) /* Vector 50: Reserved */ +# define LM_RESERVED_51 (51) /* Vector 51: Reserved */ +# define LM_RESERVED_52 (52) /* Vector 52: Reserved */ +# define LM_RESERVED_53 (53) /* Vector 53: Reserved */ +# define LM_RESERVED_54 (54) /* Vector 54: Reserved */ +# define LM_RESERVED_55 (55) /* Vector 55: Reserved */ +# define LM_RESERVED_56 (56) /* Vector 56: Reserved */ +# define LM_RESERVED_57 (57) /* Vector 57: Reserved */ +# define LM_IRQ_ETHCON (58) /* Vector 58: Ethernet Controller */ +# define LM_RESERVED_59 (59) /* Vector 59: Reserved */ + +# define LM_RESERVED_60 (60) /* Vector 60: Reserved */ +# define LM_RESERVED_61 (61) /* Vector 61: Reserved */ +# define LM_RESERVED_62 (62) /* Vector 62: Reserved */ +# define LM_RESERVED_63 (63) /* Vector 63: Reserved */ +# define LM_RESERVED_64 (64) /* Vector 64: Reserved */ +# define LM_RESERVED_65 (65) /* Vector 65: Reserved */ +# define LM_RESERVED_66 (66) /* Vector 66: Reserved */ +# define LM_RESERVED_67 (67) /* Vector 67: Reserved */ +# define LM_RESERVED_68 (68) /* Vector 68: Reserved */ +# define LM_RESERVED_69 (69) /* Vector 69: Reserved */ + +# define LM_RESERVED_70 (70) /* Vector 70: Reserved */ + +# define NR_IRQS (60) /* (Really less because of reserved vectors) */ +#elif defined(CONFIG_ARCH_CHIP_LM3S6965) +# define LM_IRQ_GPIOA (16) /* Vector 16: GPIO Port A */ +# define LM_IRQ_GPIOB (17) /* Vector 17: GPIO Port B */ +# define LM_IRQ_GPIOC (18) /* Vector 18: GPIO Port C */ +# define LM_IRQ_GPIOD (19) /* Vector 19: GPIO Port D */ +# define LM_IRQ_GPIOE (20) /* Vector 20: GPIO Port E */ + +# define LM_IRQ_UART0 (21) /* Vector 21: UART 0 */ +# define LM_IRQ_UART1 (22) /* Vector 22: UART 1 */ +# define LM_IRQ_SSI0 (23) /* Vector 23: SSI 0 */ +# define LM_IRQ_I2C0 (24) /* Vector 24: I2C 0 */ +# define LM_IRQ_PWMFAULT (25) /* Vector 25: PWM Fault */ +# define LM_IRQ_PWM0 (26) /* Vector 26: PWM Generator 0 */ +# define LM_IRQ_PWM1 (27) /* Vector 27: PWM Generator 1 */ +# define LM_IRQ_PWM2 (28) /* Vector 28: PWM Generator 2 */ +# define LM_IRQ_QEI0 (29) /* Vector 29: QEI0 */ + +# define LM_IRQ_ADC0 (30) /* Vector 30: ADC Sequence 0 */ +# define LM_IRQ_ADC1 (31) /* Vector 31: ADC Sequence 1 */ +# define LM_IRQ_ADC2 (32) /* Vector 32: ADC Sequence 2 */ +# define LM_IRQ_ADC3 (33) /* Vector 33: ADC Sequence 3 */ +# define LM_IRQ_WDOG (34) /* Vector 34: Watchdog Timer */ +# define LM_IRQ_TIMER0A (35) /* Vector 35: Timer 0 A */ +# define LM_IRQ_TIMER0B (36) /* Vector 36: Timer 0 B */ +# define LM_IRQ_TIMER1A (37) /* Vector 37: Timer 1 A */ +# define LM_IRQ_TIMER1B (38) /* Vector 38: Timer 1 B */ +# define LM_IRQ_TIMER2A (39) /* Vector 39: Timer 2 A */ + +# define LM_IRQ_TIMER2B (40) /* Vector 40: Timer 3 B */ +# define LM_IRQ_COMPARE0 (41) /* Vector 41: Analog Comparator 0 */ +# define LM_IRQ_COMPARE1 (42) /* Vector 42: Analog Comparator 1 */ +# define LM_RESERVED_43 (43) /* Vector 43: Reserved */ +# define LM_IRQ_SYSCON (44) /* Vector 44: System Control */ +# define LM_IRQ_FLASHCON (45) /* Vector 45: FLASH Control */ +# define LM_IRQ_GPIOF (46) /* Vector 46: GPIO Port F */ +# define LM_IRQ_GPIOG (47) /* Vector 47: GPIO Port G */ +# define LM_RESERVED_48 (48) /* Vector 48: Reserved */ +# define LM_IRQ_UART2 (49) /* Vector 49: UART 2 */ + +# define LM_RESERVED_50 (50) /* Vector 50: Reserved */ +# define LM_IRQ_TIMER3A (51) /* Vector 51: Timer 3 A */ +# define LM_IRQ_TIMER3B (52) /* Vector 52: Timer 3 B */ +# define LM_IRQ_I2C1 (53) /* Vector 53: I2C 1 */ +# define LM_IRQ_QEI1 (54) /* Vector 54: QEI1 */ +# define LM_RESERVED_55 (55) /* Vector 55: Reserved */ +# define LM_RESERVED_56 (56) /* Vector 56: Reserved */ +# define LM_RESERVED_57 (57) /* Vector 57: Reserved */ +# define LM_IRQ_ETHCON (58) /* Vector 58: Ethernet Controller */ +# define LM_IRQ_HIBERNATE (59) /* Vector 59: Hibernation Module */ + +# define LM_RESERVED_60 (60) /* Vector 60: Reserved */ +# define LM_RESERVED_61 (61) /* Vector 61: Reserved */ +# define LM_RESERVED_62 (62) /* Vector 62: Reserved */ +# define LM_RESERVED_63 (63) /* Vector 63: Reserved */ +# define LM_RESERVED_64 (64) /* Vector 64: Reserved */ +# define LM_RESERVED_65 (65) /* Vector 65: Reserved */ +# define LM_RESERVED_66 (66) /* Vector 66: Reserved */ +# define LM_RESERVED_67 (67) /* Vector 67: Reserved */ +# define LM_RESERVED_68 (68) /* Vector 68: Reserved */ +# define LM_RESERVED_69 (69) /* Vector 69: Reserved */ + +# define LM_RESERVED_70 (70) /* Vector 70: Reserved */ + +# define NR_IRQS (60) /* (Really less because of reserved vectors) */ +#elif defined(CONFIG_ARCH_CHIP_LM3S9B96) +# define LM_IRQ_GPIOA (16) /* Vector 16: GPIO Port A */ +# define LM_IRQ_GPIOB (17) /* Vector 17: GPIO Port B */ +# define LM_IRQ_GPIOC (18) /* Vector 18: GPIO Port C */ +# define LM_IRQ_GPIOD (19) /* Vector 19: GPIO Port D */ + +# define LM_IRQ_GPIOE (20) /* Vector 20: GPIO Port E */ +# define LM_IRQ_UART0 (21) /* Vector 21: UART 0 */ +# define LM_IRQ_UART1 (22) /* Vector 22: UART 1 */ +# define LM_IRQ_SSI0 (23) /* Vector 23: SSI 0 */ +# define LM_IRQ_I2C0 (24) /* Vector 24: I2C 0 */ +# define LM_IRQ_PWMFAULT (25) /* Vector 25: PWM Fault */ +# define LM_IRQ_PWM0 (26) /* Vector 26: PWM Generator 0 */ +# define LM_IRQ_PWM1 (27) /* Vector 27: PWM Generator 1 */ +# define LM_IRQ_PWM2 (28) /* Vector 28: PWM Generator 2 */ +# define LM_IRQ_QEI0 (29) /* Vector 29: QEI0 */ + +# define LM_IRQ_ADC0 (30) /* Vector 30: ADC0 Sequence 0 */ +# define LM_IRQ_ADC1 (31) /* Vector 31: ADC0 Sequence 1 */ +# define LM_IRQ_ADC2 (32) /* Vector 32: ADC0 Sequence 2 */ +# define LM_IRQ_ADC3 (33) /* Vector 33: ADC0 Sequence 3 */ +# define LM_IRQ_WDOG (34) /* Vector 34: Watchdog Timer */ +# define LM_IRQ_TIMER0A (35) /* Vector 35: Timer 0 A */ +# define LM_IRQ_TIMER0B (36) /* Vector 36: Timer 0 B */ +# define LM_IRQ_TIMER1A (37) /* Vector 37: Timer 1 A */ +# define LM_IRQ_TIMER1B (38) /* Vector 38: Timer 1 B */ +# define LM_IRQ_TIMER2A (39) /* Vector 39: Timer 2 A */ + +# define LM_IRQ_TIMER2B (40) /* Vector 40: Timer 3 B */ +# define LM_IRQ_COMPARE0 (41) /* Vector 41: Analog Comparator 0 */ +# define LM_IRQ_COMPARE1 (42) /* Vector 42: Analog Comparator 1 */ +# define LM_IRQ_COMPARE2 (43) /* Vector 43: Analog Comparator 3 */ +# define LM_IRQ_SYSCON (44) /* Vector 44: System Control */ +# define LM_IRQ_FLASHCON (45) /* Vector 45: FLASH Control */ +# define LM_IRQ_GPIOF (46) /* Vector 46: GPIO Port F */ +# define LM_IRQ_GPIOG (47) /* Vector 47: GPIO Port G */ +# define LM_IRQ_GPIOH (48) /* Vector 48: GPIO Port H */ +# define LM_IRQ_UART2 (49) /* Vector 49: UART 2 */ + +# define LM_IRQ_SSI1 (50) /* Vector 50: SSI 1 */ +# define LM_IRQ_TIMER3A (51) /* Vector 51: Timer 3 A */ +# define LM_IRQ_TIMER3B (52) /* Vector 52: Timer 3 B */ +# define LM_IRQ_I2C1 (53) /* Vector 53: I2C 1 */ +# define LM_IRQ_QEI1 (54) /* Vector 54: QEI1 */ +# define LM_IRQ_CAN0 (55) /* Vector 55: CAN 1 */ +# define LM_IRQ_CAN1 (56) /* Vector 56: CAN 2 */ +# define LM_RESERVED_57 (57) /* Vector 57: Reserved */ +# define LM_IRQ_ETHCON (58) /* Vector 58: Ethernet Controller */ +# define LM_RESERVED_59 (59) /* Vector 59: Reserved */ + +# define LM_IRQ_USB (60) /* Vector 60: USB */ +# define LM_IRQ_PWM3 (61) /* Vector 61: PWM Generator 3 */ +# define LM_IRQ_UDMASOFT (62) /* Vector 62: uDMA Software */ +# define LM_IRQ_UDMAERROR (63) /* Vector 63: uDMA Error */ +# define LM_IRQ_ADC1_0 (64) /* Vector 64: ADC1 Sequence 0 */ +# define LM_IRQ_ADC1_1 (65) /* Vector 65: ADC1 Sequence 1 */ +# define LM_IRQ_ADC1_2 (66) /* Vector 66: ADC1 Sequence 2 */ +# define LM_IRQ_ADC1_3 (67) /* Vector 67: ADC1 Sequence 3 */ +# define LM_IRQ_I2S0 (68) /* Vector 68: I2S0 */ +# define LM_IRQ_EPI (69) /* Vector 69: EPI */ + +# define LM_IRQ_GPIOJ (70) /* Vector 70: GPIO Port J */ +# define LM_RESERVED_71 (71) /* Vector 71: Reserved */ + +# define NR_IRQS (71) /* (Really less because of reserved vectors) */ +#elif defined(CONFIG_ARCH_CHIP_LM3S8962) +# define LM_IRQ_GPIOA (16) /* Vector 16: GPIO Port A */ +# define LM_IRQ_GPIOB (17) /* Vector 17: GPIO Port B */ +# define LM_IRQ_GPIOC (18) /* Vector 18: GPIO Port C */ +# define LM_IRQ_GPIOD (19) /* Vector 19: GPIO Port D */ + +# define LM_IRQ_GPIOE (20) /* Vector 20: GPIO Port E */ +# define LM_IRQ_UART0 (21) /* Vector 21: UART 0 */ +# define LM_IRQ_UART1 (22) /* Vector 22: UART 1 */ +# define LM_IRQ_SSI0 (23) /* Vector 23: SSI 0 */ +# define LM_IRQ_I2C0 (24) /* Vector 24: I2C 0 */ +# define LM_IRQ_PWMFAULT (25) /* Vector 25: PWM Fault */ +# define LM_IRQ_PWM0 (26) /* Vector 26: PWM Generator 0 */ +# define LM_IRQ_PWM1 (27) /* Vector 27: PWM Generator 1 */ +# define LM_IRQ_PWM2 (28) /* Vector 28: PWM Generator 2 */ +# define LM_IRQ_QEI0 (29) /* Vector 29: QEI0 */ + +# define LM_IRQ_ADC0 (30) /* Vector 30: ADC Sequence 0 */ +# define LM_IRQ_ADC1 (31) /* Vector 31: ADC Sequence 1 */ +# define LM_IRQ_ADC2 (32) /* Vector 32: ADC Sequence 2 */ +# define LM_IRQ_ADC3 (33) /* Vector 33: ADC Sequence 3 */ +# define LM_IRQ_WDOG (34) /* Vector 34: Watchdog Timer */ +# define LM_IRQ_TIMER0A (35) /* Vector 35: Timer 0 A */ +# define LM_IRQ_TIMER0B (36) /* Vector 36: Timer 0 B */ +# define LM_IRQ_TIMER1A (37) /* Vector 37: Timer 1 A */ +# define LM_IRQ_TIMER1B (38) /* Vector 38: Timer 1 B */ +# define LM_IRQ_TIMER2A (39) /* Vector 39: Timer 2 A */ +# define LM_IRQ_TIMER2B (40) /* Vector 40: Timer 3 B */ + +# define LM_IRQ_COMPARE0 (41) /* Vector 41: Analog Comparator 0 */ +# define LM_RESERVED_42 (42) /* Vector 42: Reserved */ +# define LM_RESERVED_43 (43) /* Vector 43: Reserved */ +# define LM_IRQ_SYSCON (44) /* Vector 44: System Control */ +# define LM_IRQ_FLASHCON (45) /* Vector 45: FLASH Control */ +# define LM_IRQ_GPIOF (46) /* Vector 46: GPIO Port F */ +# define LM_IRQ_GPIOG (47) /* Vector 47: GPIO Port G */ +# define LM_RESERVED_48 (48) /* Vector 48: Reserved */ +# define LM_RESERVED_49 (49) /* Vector 49: Reserved */ + +# define LM_RESERVED_50 (50) /* Vector 50: Reserved */ +# define LM_IRQ_TIMER3A (51) /* Vector 51: Timer 3 A */ +# define LM_IRQ_TIMER3B (52) /* Vector 52: Timer 3 B */ +# define LM_IRQ_I2C1 (53) /* Vector 53: I2C 1 */ +# define LM_IRQ_QEI1 (54) /* Vector 54: QEI1 */ +# define LM_IRQ_CAN0 (54) /* Vector 55: CAN0 */ +# define LM_RESERVED_56 (56) /* Vector 56: Reserved */ +# define LM_RESERVED_57 (57) /* Vector 57: Reserved */ +# define LM_IRQ_ETHCON (58) /* Vector 58: Ethernet Controller */ +# define LM_IRQ_HIBERNATE (59) /* Vector 59: Hibernation Module */ + +# define LM_RESERVED_60 (60) /* Vector 60: Reserved */ +# define LM_RESERVED_61 (61) /* Vector 61: Reserved */ +# define LM_RESERVED_62 (62) /* Vector 62: Reserved */ +# define LM_RESERVED_63 (63) /* Vector 63: Reserved */ +# define LM_RESERVED_64 (64) /* Vector 64: Reserved */ +# define LM_RESERVED_65 (65) /* Vector 65: Reserved */ +# define LM_RESERVED_66 (66) /* Vector 66: Reserved */ +# define LM_RESERVED_67 (67) /* Vector 67: Reserved */ +# define LM_RESERVED_68 (68) /* Vector 68: Reserved */ +# define LM_RESERVED_69 (69) /* Vector 69: Reserved */ + +# define LM_RESERVED_70 (70) /* Vector 70: Reserved */ + +# define NR_IRQS (60) /* (Really less because of reserved vectors) */ +#else +# error "IRQ Numbers not specified for this Stellaris chip" +#endif + +/************************************************************************************ + * Public Types + ************************************************************************************/ + +/************************************************************************************ + * Public Data + ************************************************************************************/ + +#ifndef __ASSEMBLY__ +#ifdef __cplusplus +extern "C" +{ +#endif + +/************************************************************************************ + * Public Functions + ************************************************************************************/ + +#ifdef __cplusplus +} +#endif +#endif + +#endif /* __ARCH_ARM_INCLUDE_LM_LM3S_IRQ_H */ + diff --git a/nuttx/arch/arm/src/lm/chip/lm3s_vectors.h b/nuttx/arch/arm/src/lm/chip/lm3s_vectors.h new file mode 100644 index 0000000000..58447793d9 --- /dev/null +++ b/nuttx/arch/arm/src/lm/chip/lm3s_vectors.h @@ -0,0 +1,439 @@ +/************************************************************************************ + * arch/arm/src/lm/chip/lm3s_vectors.S + * + * Copyright (C) 2013 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * 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. + * + ************************************************************************************/ + +/************************************************************************************ + * Preprocessor Definitions + ************************************************************************************/ + +/************************************************************************************ + * Vectors + ************************************************************************************/ + +/* This file is included by lm_vectors.S. It provides the macro VECTOR that + * supplies ach Stellaris vector in terms of a (lower-case) ISR label and an + * (upper-case) IRQ number as defined in arch/arm/include/lm/lm3s_irq.h. + * lm_vectors.S will define the VECTOR in different ways in order to generate + * the interrupt vectors and handlers in their final form. + */ + +#if defined(CONFIG_ARCH_CHIP_LM3S6918) + +/* If the common ARMv7-M vector handling is used, then all it needs is the following + * definition that provides the number of supported vectors. + */ + +#ifdef CONFIG_ARMV7M_CMNVECTOR + +/* Reserve 71 interrupt table entries for I/O interrupts. */ + +# define ARMV7M_PERIPHERAL_INTERRUPTS 71 + +#else + +VECTOR(lm_gpioa, LM_IRQ_GPIOA) /* Vector 16: GPIO Port A */ +VECTOR(lm_gpiob, LM_IRQ_GPIOB) /* Vector 17: GPIO Port B */ +VECTOR(lm_gpioc, LM_IRQ_GPIOC) /* Vector 18: GPIO Port C */ +VECTOR(lm_gpiod, LM_IRQ_GPIOD) /* Vector 19: GPIO Port D */ + +VECTOR(lm_gpioe, LM_IRQ_GPIOE) /* Vector 20: GPIO Port E */ +VECTOR(lm_uart0, LM_IRQ_UART0) /* Vector 21: UART 0 */ +VECTOR(lm_uart1, LM_IRQ_UART1) /* Vector 22: UART 1 */ +VECTOR(lm_ssi0, LM_IRQ_SSI0) /* Vector 23: SSI 0 */ +VECTOR(lm_i2c0, LM_IRQ_I2C0) /* Vector 24: I2C 0 */ +UNUSED(LM_RESERVED_25) /* Vector 25: Reserved */ +UNUSED(LM_RESERVED_26) /* Vector 26: Reserved */ +UNUSED(LM_RESERVED_27) /* Vector 27: Reserved */ +UNUSED(LM_RESERVED_28) /* Vector 28: Reserved */ +UNUSED(LM_RESERVED_29) /* Vector 29: Reserved */ + +VECTOR(lm_adc0, LM_IRQ_ADC0) /* Vector 30: ADC Sequence 0 */ +VECTOR(lm_adc1, LM_IRQ_ADC1) /* Vector 31: ADC Sequence 1 */ +VECTOR(lm_adc2, LM_IRQ_ADC2) /* Vector 32: ADC Sequence 2 */ +VECTOR(lm_adc3, LM_IRQ_ADC3) /* Vector 33: ADC Sequence 3 */ +VECTOR(lm_wdog, LM_IRQ_WDOG) /* Vector 34: Watchdog Timer */ +VECTOR(lm_tmr0a, LM_IRQ_TIMER0A) /* Vector 35: Timer 0 A */ +VECTOR(lm_tmr0b, LM_IRQ_TIMER0B) /* Vector 36: Timer 0 B */ +VECTOR(lm_tmr1a, LM_IRQ_TIMER1A) /* Vector 37: Timer 1 A */ +VECTOR(lm_tmr1b, LM_IRQ_TIMER1B) /* Vector 38: Timer 1 B */ +VECTOR(lm_tmr2a, LM_IRQ_TIMER2A) /* Vector 39: Timer 2 A */ + +VECTOR(lm_tmr2b, LM_IRQ_TIMER2B) /* Vector 40: Timer 3 B */ +VECTOR(lm_cmp0, LM_IRQ_COMPARE0) /* Vector 41: Analog Comparator 0 */ +VECTOR(lm_cmp1, LM_IRQ_COMPARE1) /* Vector 42: Analog Comparator 1 */ +UNUSED(LM_RESERVED_43) /* Vector 43: Reserved */ +VECTOR(lm_syscon, LM_IRQ_SYSCON) /* Vector 44: System Control */ +VECTOR(lm_flashcon, LM_IRQ_FLASHCON) /* Vector 45: FLASH Control */ +VECTOR(lm_gpiof, LM_IRQ_GPIOF) /* Vector 46: GPIO Port F */ +VECTOR(lm_gpiog, LM_IRQ_GPIOG) /* Vector 47: GPIO Port G */ +VECTOR(lm_gpioh, LM_IRQ_GPIOH) /* Vector 48: GPIO Port H */ +UNUSED(LM_RESERVED_49) /* Vector 49: Reserved */ + +VECTOR(lm_ssi1, LM_IRQ_SSI1) /* Vector 50: SSI 1 */ +VECTOR(lm_tmr3a, LM_IRQ_TIMER3A) /* Vector 51: Timer 3 A */ +VECTOR(lm_tmr3b, LM_IRQ_TIMER3B) /* Vector 52: Timer 3 B */ +VECTOR(lm_i2c1, LM_IRQ_I2C1) /* Vector 53: I2C 1 */ +UNUSED(LM_RESERVED_54) /* Vector 54: Reserved */ +UNUSED(LM_RESERVED_55) /* Vector 55: Reserved */ +UNUSED(LM_RESERVED_56) /* Vector 56: Reserved */ +UNUSED(LM_RESERVED_57) /* Vector 57: Reserved */ +VECTOR(lm_eth, LM_IRQ_ETHCON) /* Vector 58: Ethernet Controller */ +VECTOR(lm_hib, LM_IRQ_HIBERNATE) /* Vector 59: Hibernation Module */ + +UNUSED(LM_RESERVED_60) /* Vector 60: Reserved */ +UNUSED(LM_RESERVED_61) /* Vector 61: Reserved */ +UNUSED(LM_RESERVED_62) /* Vector 62: Reserved */ +UNUSED(LM_RESERVED_63) /* Vector 63: Reserved */ +UNUSED(LM_RESERVED_64) /* Vector 64: Reserved */ +UNUSED(LM_RESERVED_65) /* Vector 65: Reserved */ +UNUSED(LM_RESERVED_66) /* Vector 66: Reserved */ +UNUSED(LM_RESERVED_67) /* Vector 67: Reserved */ +UNUSED(LM_RESERVED_68) /* Vector 68: Reserved */ +UNUSED(LM_RESERVED_69) /* Vector 69: Reserved */ + +UNUSED(LM_RESERVED_70) /* Vector 70: Reserved */ +#endif + +#elif defined(CONFIG_ARCH_CHIP_LM3S6432) + +/* If the common ARMv7-M vector handling is used, then all it needs is the following + * definition that provides the number of supported vectors. + */ + +#ifdef CONFIG_ARMV7M_CMNVECTOR + +/* Reserve 71 interrupt table entries for I/O interrupts. */ + +# define ARMV7M_PERIPHERAL_INTERRUPTS 71 + +#else + +VECTOR(lm_gpioa, LM_IRQ_GPIOA) /* Vector 16: GPIO Port A */ +VECTOR(lm_gpiob, LM_IRQ_GPIOB) /* Vector 17: GPIO Port B */ +VECTOR(lm_gpioc, LM_IRQ_GPIOC) /* Vector 18: GPIO Port C */ +VECTOR(lm_gpiod, LM_IRQ_GPIOD) /* Vector 19: GPIO Port D */ + +VECTOR(lm_gpioe, LM_IRQ_GPIOE) /* Vector 20: GPIO Port E */ +VECTOR(lm_uart0, LM_IRQ_UART0) /* Vector 21: UART 0 */ +VECTOR(lm_uart1, LM_IRQ_UART1) /* Vector 22: UART 1 */ +VECTOR(lm_ssi0, LM_IRQ_SSI0) /* Vector 23: SSI 0 */ +VECTOR(lm_i2c0, LM_IRQ_I2C0) /* Vector 24: I2C 0 */ +UNUSED(LM_RESERVED_25) /* Vector 25: Reserved */ +VECTOR(lm_pwm0, LM_IRQ_PWM0) /* Vector 26: PWM Generator 0 */ +UNUSED(LM_RESERVED_27) /* Vector 27: Reserved */ +UNUSED(LM_RESERVED_28) /* Vector 28: Reserved */ +UNUSED(LM_RESERVED_29) /* Vector 29: Reserved */ + +VECTOR(lm_adc0, LM_IRQ_ADC0) /* Vector 30: ADC Sequence 0 */ +VECTOR(lm_adc1, LM_IRQ_ADC1) /* Vector 31: ADC Sequence 1 */ +VECTOR(lm_adc2, LM_IRQ_ADC2) /* Vector 32: ADC Sequence 2 */ +VECTOR(lm_adc3, LM_IRQ_ADC3) /* Vector 33: ADC Sequence 3 */ +VECTOR(lm_wdog, LM_IRQ_WDOG) /* Vector 34: Watchdog Timer */ +VECTOR(lm_tmr0a, LM_IRQ_TIMER0A) /* Vector 35: Timer 0 A */ +VECTOR(lm_tmr0b, LM_IRQ_TIMER0B) /* Vector 36: Timer 0 B */ +VECTOR(lm_tmr1a, LM_IRQ_TIMER1A) /* Vector 37: Timer 1 A */ +VECTOR(lm_tmr1b, LM_IRQ_TIMER1B) /* Vector 38: Timer 1 B */ +VECTOR(lm_tmr2a, LM_IRQ_TIMER2A) /* Vector 39: Timer 2 A */ + +VECTOR(lm_tmr2b, LM_IRQ_TIMER2B) /* Vector 40: Timer 3 B */ +VECTOR(lm_cmp0, LM_IRQ_COMPARE0) /* Vector 41: Analog Comparator 0 */ +VECTOR(lm_cmp1, LM_IRQ_COMPARE1) /* Vector 42: Analog Comparator 1 */ +UNUSED(LM_RESERVED_43) /* Vector 43: Reserved */ +VECTOR(lm_syscon, LM_IRQ_SYSCON) /* Vector 44: System Control */ +VECTOR(lm_flashcon, LM_IRQ_FLASHCON) /* Vector 45: FLASH Control */ +VECTOR(lm_gpiof, LM_IRQ_GPIOF) /* Vector 46: GPIO Port F */ +VECTOR(lm_gpiog, LM_IRQ_GPIOG) /* Vector 47: GPIO Port G */ +UNUSED(LM_RESERVED_48) /* Vector 48: Reserved */ +UNUSED(LM_RESERVED_49) /* Vector 49: Reserved */ + +UNUSED(LM_RESERVED_50) /* Vector 50: Reserved */ +UNUSED(LM_RESERVED_51) /* Vector 51: Reserved */ +UNUSED(LM_RESERVED_52) /* Vector 52: Reserved */ +UNUSED(LM_RESERVED_53) /* Vector 53: Reserved */ +UNUSED(LM_RESERVED_54) /* Vector 54: Reserved */ +UNUSED(LM_RESERVED_55) /* Vector 55: Reserved */ +UNUSED(LM_RESERVED_56) /* Vector 56: Reserved */ +UNUSED(LM_RESERVED_57) /* Vector 57: Reserved */ +VECTOR(lm_eth, LM_IRQ_ETHCON) /* Vector 58: Ethernet Controller */ +UNUSED(LM_RESERVED_59) /* Vector 59: Reserved */ + +UNUSED(LM_RESERVED_60) /* Vector 60: Reserved */ +UNUSED(LM_RESERVED_61) /* Vector 61: Reserved */ +UNUSED(LM_RESERVED_62) /* Vector 62: Reserved */ +UNUSED(LM_RESERVED_63) /* Vector 63: Reserved */ +UNUSED(LM_RESERVED_64) /* Vector 64: Reserved */ +UNUSED(LM_RESERVED_65) /* Vector 65: Reserved */ +UNUSED(LM_RESERVED_66) /* Vector 66: Reserved */ +UNUSED(LM_RESERVED_67) /* Vector 67: Reserved */ +UNUSED(LM_RESERVED_68) /* Vector 68: Reserved */ +UNUSED(LM_RESERVED_69) /* Vector 69: Reserved */ + +UNUSED(LM_RESERVED_70) /* Vector 70: Reserved */ +#endif + +#elif defined(CONFIG_ARCH_CHIP_LM3S6965) + +/* If the common ARMv7-M vector handling is used, then all it needs is the following + * definition that provides the number of supported vectors. + */ + +#ifdef CONFIG_ARMV7M_CMNVECTOR + +/* Reserve 71 interrupt table entries for I/O interrupts. */ + +# define ARMV7M_PERIPHERAL_INTERRUPTS 71 + +#else + +VECTOR(lm_gpioa, LM_IRQ_GPIOA) /* Vector 16: GPIO Port A */ +VECTOR(lm_gpiob, LM_IRQ_GPIOB) /* Vector 17: GPIO Port B */ +VECTOR(lm_gpioc, LM_IRQ_GPIOC) /* Vector 18: GPIO Port C */ +VECTOR(lm_gpiod, LM_IRQ_GPIOD) /* Vector 19: GPIO Port D */ + +VECTOR(lm_gpioe, LM_IRQ_GPIOE) /* Vector 20: GPIO Port E */ +VECTOR(lm_uart0, LM_IRQ_UART0) /* Vector 21: UART 0 */ +VECTOR(lm_uart1, LM_IRQ_UART1) /* Vector 22: UART 1 */ +VECTOR(lm_ssi0, LM_IRQ_SSI0) /* Vector 23: SSI 0 */ +VECTOR(lm_i2c0, LM_IRQ_I2C0) /* Vector 24: I2C 0 */ +VECTOR(lm_pwmfault, LM_IRQ_PWMFAULT) /* Vector 25: PWM Fault */ +VECTOR(lm_pwm0, LM_IRQ_PWM0) /* Vector 26: PWM Generator 0 */ +VECTOR(lm_pwm1, LM_IRQ_PWM1) /* Vector 27: PWM Generator 1 */ +VECTOR(lm_pwm2, LM_IRQ_PWM2) /* Vector 28: PWM Generator 2 */ +VECTOR(lm_qei0, LM_IRQ_QEI0) /* Vector 29: QEI 0 */ + +VECTOR(lm_adc0, LM_IRQ_ADC0) /* Vector 30: ADC Sequence 0 */ +VECTOR(lm_adc1, LM_IRQ_ADC1) /* Vector 31: ADC Sequence 1 */ +VECTOR(lm_adc2, LM_IRQ_ADC2) /* Vector 32: ADC Sequence 2 */ +VECTOR(lm_adc3, LM_IRQ_ADC3) /* Vector 33: ADC Sequence 3 */ +VECTOR(lm_wdog, LM_IRQ_WDOG) /* Vector 34: Watchdog Timer */ +VECTOR(lm_tmr0a, LM_IRQ_TIMER0A) /* Vector 35: Timer 0 A */ +VECTOR(lm_tmr0b, LM_IRQ_TIMER0B) /* Vector 36: Timer 0 B */ +VECTOR(lm_tmr1a, LM_IRQ_TIMER1A) /* Vector 37: Timer 1 A */ +VECTOR(lm_tmr1b, LM_IRQ_TIMER1B) /* Vector 38: Timer 1 B */ +VECTOR(lm_tmr2a, LM_IRQ_TIMER2A) /* Vector 39: Timer 2 A */ + +VECTOR(lm_tmr2b, LM_IRQ_TIMER2B) /* Vector 40: Timer 3 B */ +VECTOR(lm_cmp0, LM_IRQ_COMPARE0) /* Vector 41: Analog Comparator 0 */ +VECTOR(lm_cmp1, LM_IRQ_COMPARE1) /* Vector 42: Analog Comparator 1 */ +UNUSED(LM_RESERVED_43) /* Vector 43: Reserved */ +VECTOR(lm_syscon, LM_IRQ_SYSCON) /* Vector 44: System Control */ +VECTOR(lm_flashcon, LM_IRQ_FLASHCON) /* Vector 45: FLASH Control */ +VECTOR(lm_gpiof, LM_IRQ_GPIOF) /* Vector 46: GPIO Port F */ +VECTOR(lm_gpiog, LM_IRQ_GPIOG) /* Vector 47: GPIO Port G */ +UNUSED(LM_RESERVED_48) /* Vector 48: Reserved */ +VECTOR(lm_uart2, LM_IRQ_UART1) /* Vector 49: UART 1 */ + +UNUSED(LM_RESERVED_50) /* Vector 50: Reserved */ +VECTOR(lm_tmr3a, LM_IRQ_TIMER3A) /* Vector 51: Timer 3 A */ +VECTOR(lm_tmr3b, LM_IRQ_TIMER3B) /* Vector 52: Timer 3 B */ +VECTOR(lm_i2c1, LM_IRQ_I2C1) /* Vector 53: I2C 1 */ +VECTOR(lm_qei1, LM_IRQ_QEI1) /* Vector 54: QEI 1 */ +UNUSED(LM_RESERVED_55) /* Vector 55: Reserved */ +UNUSED(LM_RESERVED_56) /* Vector 56: Reserved */ +UNUSED(LM_RESERVED_57) /* Vector 57: Reserved */ +VECTOR(lm_eth, LM_IRQ_ETHCON) /* Vector 58: Ethernet Controller */ +VECTOR(lm_hib, LM_IRQ_HIBERNATE) /* Vector 59: Hibernation Module */ + +UNUSED(LM_RESERVED_60) /* Vector 60: Reserved */ +UNUSED(LM_RESERVED_61) /* Vector 61: Reserved */ +UNUSED(LM_RESERVED_62) /* Vector 62: Reserved */ +UNUSED(LM_RESERVED_63) /* Vector 63: Reserved */ +UNUSED(LM_RESERVED_64) /* Vector 64: Reserved */ +UNUSED(LM_RESERVED_65) /* Vector 65: Reserved */ +UNUSED(LM_RESERVED_66) /* Vector 66: Reserved */ +UNUSED(LM_RESERVED_67) /* Vector 67: Reserved */ +UNUSED(LM_RESERVED_68) /* Vector 68: Reserved */ +UNUSED(LM_RESERVED_69) /* Vector 69: Reserved */ + +UNUSED(LM_RESERVED_70) /* Vector 70: Reserved */ +#endif + +#elif defined(CONFIG_ARCH_CHIP_LM3S8962) + +/* If the common ARMv7-M vector handling is used, then all it needs is the following + * definition that provides the number of supported vectors. + */ + +#ifdef CONFIG_ARMV7M_CMNVECTOR + +/* Reserve 71 interrupt table entries for I/O interrupts. */ + +# define ARMV7M_PERIPHERAL_INTERRUPTS 71 + +#else + +VECTOR(lm_gpioa, LM_IRQ_GPIOA) /* Vector 16: GPIO Port A */ +VECTOR(lm_gpiob, LM_IRQ_GPIOB) /* Vector 17: GPIO Port B */ +VECTOR(lm_gpioc, LM_IRQ_GPIOC) /* Vector 18: GPIO Port C */ +VECTOR(lm_gpiod, LM_IRQ_GPIOD) /* Vector 19: GPIO Port D */ + +VECTOR(lm_gpioe, LM_IRQ_GPIOE) /* Vector 20: GPIO Port E */ +VECTOR(lm_uart0, LM_IRQ_UART0) /* Vector 21: UART 0 */ +VECTOR(lm_uart1, LM_IRQ_UART1) /* Vector 22: UART 1 */ +VECTOR(lm_ssi0, LM_IRQ_SSI0) /* Vector 23: SSI 0 */ +VECTOR(lm_i2c0, LM_IRQ_I2C0) /* Vector 24: I2C 0 */ +VECTOR(lm_pwmfault, LM_IRQ_PWMFAULT) /* Vector 25: PWM Fault */ +VECTOR(lm_pwm0, LM_IRQ_PWM0) /* Vector 26: PWM Generator 0 */ +VECTOR(lm_pwm1, LM_IRQ_PWM1) /* Vector 27: PWM Generator 1 */ +VECTOR(lm_pwm2, LM_IRQ_PWM2) /* Vector 28: PWM Generator 2 */ +VECTOR(lm_qei0, LM_IRQ_QEI0) /* Vector 29: QEI 0 */ + +VECTOR(lm_adc0, LM_IRQ_ADC0) /* Vector 30: ADC Sequence 0 */ +VECTOR(lm_adc1, LM_IRQ_ADC1) /* Vector 31: ADC Sequence 1 */ +VECTOR(lm_adc2, LM_IRQ_ADC2) /* Vector 32: ADC Sequence 2 */ +VECTOR(lm_adc3, LM_IRQ_ADC3) /* Vector 33: ADC Sequence 3 */ +VECTOR(lm_wdog, LM_IRQ_WDOG) /* Vector 34: Watchdog Timer */ +VECTOR(lm_tmr0a, LM_IRQ_TIMER0A) /* Vector 35: Timer 0 A */ +VECTOR(lm_tmr0b, LM_IRQ_TIMER0B) /* Vector 36: Timer 0 B */ +VECTOR(lm_tmr1a, LM_IRQ_TIMER1A) /* Vector 37: Timer 1 A */ +VECTOR(lm_tmr1b, LM_IRQ_TIMER1B) /* Vector 38: Timer 1 B */ +VECTOR(lm_tmr2a, LM_IRQ_TIMER2A) /* Vector 39: Timer 2 A */ + +VECTOR(lm_tmr2b, LM_IRQ_TIMER2B) /* Vector 40: Timer 3 B */ +VECTOR(lm_cmp0, LM_IRQ_COMPARE0) /* Vector 41: Analog Comparator 0 */ +UNUSED(LM_RESERVED_42) /* Vector 42: Reserved */ +UNUSED(LM_RESERVED_43) /* Vector 43: Reserved */ +VECTOR(lm_syscon, LM_IRQ_SYSCON) /* Vector 44: System Control */ +VECTOR(lm_flashcon, LM_IRQ_FLASHCON) /* Vector 45: FLASH Control */ +VECTOR(lm_gpiof, LM_IRQ_GPIOF) /* Vector 46: GPIO Port F */ +VECTOR(lm_gpiog, LM_IRQ_GPIOG) /* Vector 47: GPIO Port G */ +UNUSED(LM_RESERVED_48) /* Vector 48: Reserved */ +UNUSED(LM_RESERVED_49) /* Vector 49: Reserved */ + +UNUSED(LM_RESERVED_50) /* Vector 50: Reserved */ +VECTOR(lm_tmr3a, LM_IRQ_TIMER3A) /* Vector 51: Timer 3 A */ +VECTOR(lm_tmr3b, LM_IRQ_TIMER3B) /* Vector 52: Timer 3 B */ +VECTOR(lm_i2c1, LM_IRQ_I2C1) /* Vector 53: I2C 1 */ +VECTOR(lm_qei1, LM_IRQ_QEI1) /* Vector 54: QEI 1 */ +VECTOR(lm_can0, LM_IRQ_CAN0) /* Vector 55: CAN 0 */ +UNUSED(LM_RESERVED_56) /* Vector 56: Reserved */ +UNUSED(LM_RESERVED_57) /* Vector 57: Reserved */ +VECTOR(lm_eth, LM_IRQ_ETHCON) /* Vector 58: Ethernet Controller */ +VECTOR(lm_hib, LM_IRQ_HIBERNATE) /* Vector 59: Hibernation Module */ + +UNUSED(LM_RESERVED_60) /* Vector 60: Reserved */ +UNUSED(LM_RESERVED_61) /* Vector 61: Reserved */ +UNUSED(LM_RESERVED_62) /* Vector 62: Reserved */ +UNUSED(LM_RESERVED_63) /* Vector 63: Reserved */ +UNUSED(LM_RESERVED_64) /* Vector 64: Reserved */ +UNUSED(LM_RESERVED_65) /* Vector 65: Reserved */ +UNUSED(LM_RESERVED_66) /* Vector 66: Reserved */ +UNUSED(LM_RESERVED_67) /* Vector 67: Reserved */ +UNUSED(LM_RESERVED_68) /* Vector 68: Reserved */ +UNUSED(LM_RESERVED_69) /* Vector 69: Reserved */ + +UNUSED(LM_RESERVED_70) /* Vector 70: Reserved */ +#endif + +#elif defined(CONFIG_ARCH_CHIP_LM3S9B96) + +/* If the common ARMv7-M vector handling is used, then all it needs is the following + * definition that provides the number of supported vectors. + */ + +#ifdef CONFIG_ARMV7M_CMNVECTOR + +/* Reserve 72 interrupt table entries for I/O interrupts. */ + +# define ARMV7M_PERIPHERAL_INTERRUPTS 72 + +#else + +VECTOR(lm_gpioa, LM_IRQ_GPIOA) /* Vector 16: GPIO Port A */ +VECTOR(lm_gpiob, LM_IRQ_GPIOB) /* Vector 17: GPIO Port B */ +VECTOR(lm_gpioc, LM_IRQ_GPIOC) /* Vector 18: GPIO Port C */ +VECTOR(lm_gpiod, LM_IRQ_GPIOD) /* Vector 19: GPIO Port D */ +VECTOR(lm_gpioe, LM_IRQ_GPIOE) /* Vector 20: GPIO Port E */ + +VECTOR(lm_uart0, LM_IRQ_UART0) /* Vector 21: UART 0 */ +VECTOR(lm_uart1, LM_IRQ_UART1) /* Vector 22: UART 1 */ +VECTOR(lm_ssi0, LM_IRQ_SSI0) /* Vector 23: SSI 0 */ +VECTOR(lm_i2c0, LM_IRQ_I2C0) /* Vector 24: I2C 0 */ +VECTOR(lm_pwmfault, LM_IRQ_PWMFAULT) /* Vector 25: PWM Fault */ +VECTOR(lm_pwm0, LM_IRQ_PWM0) /* Vector 26: PWM Generator 0 */ +VECTOR(lm_pwm1, LM_IRQ_PWM1) /* Vector 27: PWM Generator 1 */ +VECTOR(lm_pwm2, LM_IRQ_PWM2) /* Vector 28: PWM Generator 2 */ +VECTOR(lm_qei0, LM_IRQ_QEI0) /* Vector 29: QEI 0 */ + +VECTOR(lm_adc0, LM_IRQ_ADC0) /* Vector 30: ADC Sequence 0 */ +VECTOR(lm_adc1, LM_IRQ_ADC1) /* Vector 31: ADC Sequence 1 */ +VECTOR(lm_adc2, LM_IRQ_ADC2) /* Vector 32: ADC Sequence 2 */ +VECTOR(lm_adc3, LM_IRQ_ADC3) /* Vector 33: ADC Sequence 3 */ +VECTOR(lm_wdog, LM_IRQ_WDOG) /* Vector 34: Watchdog Timer */ +VECTOR(lm_tmr0a, LM_IRQ_TIMER0A) /* Vector 35: Timer 0 A */ +VECTOR(lm_tmr0b, LM_IRQ_TIMER0B) /* Vector 36: Timer 0 B */ +VECTOR(lm_tmr1a, LM_IRQ_TIMER1A) /* Vector 37: Timer 1 A */ +VECTOR(lm_tmr1b, LM_IRQ_TIMER1B) /* Vector 38: Timer 1 B */ +VECTOR(lm_tmr2a, LM_IRQ_TIMER2A) /* Vector 39: Timer 2 A */ + +VECTOR(lm_tmr2b, LM_IRQ_TIMER2B) /* Vector 40: Timer 3 B */ +VECTOR(lm_cmp0, LM_IRQ_COMPARE0) /* Vector 41: Analog Comparator 0 */ +VECTOR(lm_cmp1, LM_IRQ_COMPARE1) /* Vector 42: Analog Comparator 1 */ +VECTOR(lm_cmp2, LM_IRQ_COMPARE2) /* Vector 43: Analog Comparator 2 */ +VECTOR(lm_syscon, LM_IRQ_SYSCON) /* Vector 44: System Control */ +VECTOR(lm_flashcon, LM_IRQ_FLASHCON) /* Vector 45: FLASH Control */ +VECTOR(lm_gpiof, LM_IRQ_GPIOF) /* Vector 46: GPIO Port F */ +VECTOR(lm_gpiog, LM_IRQ_GPIOG) /* Vector 47: GPIO Port G */ +VECTOR(lm_gpioh, LM_IRQ_GPIOH) /* Vector 48: GPIO Port H */ +VECTOR(lm_uart2, LM_IRQ_UART2) /* Vector 49: UART 2 */ + +VECTOR(lm_ssi1, LM_IRQ_SSI1) /* Vector 50: GPIO Port H */ +VECTOR(lm_tmr3a, LM_IRQ_TIMER3A) /* Vector 51: Timer 3 A */ +VECTOR(lm_tmr3b, LM_IRQ_TIMER3B) /* Vector 52: Timer 3 B */ +VECTOR(lm_i2c1, LM_IRQ_I2C1) /* Vector 53: I2C 1 */ +VECTOR(lm_qei1, LM_IRQ_QEI1) /* Vector 54: QEI 1 */ +VECTOR(lm_can0, LM_IRQ_CAN0) /* Vector 55: CAN 0 */ +VECTOR(lm_can1, LM_IRQ_CAN1) /* Vector 56: CAN 1 */ +UNUSED(LM_RESERVED_57) /* Vector 57: Reserved */ +VECTOR(lm_eth, LM_IRQ_ETHCON) /* Vector 58: Ethernet Controller */ +UNUSED(LM_RESERVED_59) /* Vector 59: Reserved */ + +VECTOR(lm_usb, LM_IRQ_USB) /* Vector 60: USB */ +VECTOR(lm_pwm3, LM_IRQ_PWM3) /* Vector 61: PWM 3 */ +VECTOR(lm_udmasoft, LM_IRQ_UDMASOFT) /* Vector 62: uDMA Software */ +VECTOR(lm_udmaerror, LM_IRQ_UDMAERROR) /* Vector 63: uDMA Error */ +VECTOR(lm_adc1_0, LM_IRQ_ADC1_0) /* Vector 64: ADC1 Sequence 0 */ +VECTOR(lm_adc1_1, LM_IRQ_ADC1_1) /* Vector 65: ADC1 Sequence 1 */ +VECTOR(lm_adc1_2, LM_IRQ_ADC1_2) /* Vector 66: ADC1 Sequence 2 */ +VECTOR(lm_adc1_3, LM_IRQ_ADC1_3) /* Vector 67: ADC1 Sequence 3 */ +VECTOR(lm_i2s0, LM_IRQ_I2S0) /* Vector 68: I2S 0 */ +VECTOR(lm_epi, LM_IRQ_EPI) /* Vector 69: EPI */ + +VECTOR(lm_gpioj, LM_IRQ_GPIOJ) /* Vector 70: GPIO Port J */ +UNUSED(LM_RESERVED_71) /* Vector 71: Reserved */ +#endif + +#else +# error "Vectors not specified for this Stellaris chip" +#endif diff --git a/nuttx/arch/arm/src/lm/chip/lm_memorymap.h b/nuttx/arch/arm/src/lm/chip/lm_memorymap.h index 530ecdf647..d8257fc025 100644 --- a/nuttx/arch/arm/src/lm/chip/lm_memorymap.h +++ b/nuttx/arch/arm/src/lm/chip/lm_memorymap.h @@ -44,8 +44,10 @@ /* Include the memory map file for the specific Stellaris chip */ -#ifdef CONFIG_ARCH_CHIP_LM3S +#if defined(CONFIG_ARCH_CHIP_LM3S) # include "chip/lm3s_memorymap.h" +#elif defined(CONFIG_ARCH_CHIP_LM4F) +# include "chip/lm4f_memorymap.h" #else # error "Unsupported Stellaris memory map" #endif diff --git a/nuttx/arch/arm/src/lm/chip/lm_pinmap.h b/nuttx/arch/arm/src/lm/chip/lm_pinmap.h index 311d6fcdc8..00b42e73bb 100644 --- a/nuttx/arch/arm/src/lm/chip/lm_pinmap.h +++ b/nuttx/arch/arm/src/lm/chip/lm_pinmap.h @@ -44,8 +44,10 @@ /* Include the pin mapping file for the specific Stellaris chip */ -#ifdef CONFIG_ARCH_CHIP_LM3S +#if defined(CONFIG_ARCH_CHIP_LM3S) # include "chip/lm3s_pinmap.h" +#elif defined(CONFIG_ARCH_CHIP_LM4F) +# include "chip/lm4f_pinmap.h" #else # error "Unsupported Stellaris PIN mapping" #endif diff --git a/nuttx/arch/arm/src/lm/chip/lm_vectors.h b/nuttx/arch/arm/src/lm/chip/lm_vectors.h new file mode 100644 index 0000000000..97227bf293 --- /dev/null +++ b/nuttx/arch/arm/src/lm/chip/lm_vectors.h @@ -0,0 +1,64 @@ +/************************************************************************************ + * arch/arm/src/lm/chip/lm_vectors.h + * + * Copyright (C) 2013 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * 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. + * + ************************************************************************************/ + +/************************************************************************************ + * Included Files + ************************************************************************************/ + +/* Include the vector file for the specific Stellaris chip */ + +#if defined(CONFIG_ARCH_CHIP_LM3S) +# include "chip/lm3s_vectors.h" +#elif defined(CONFIG_ARCH_CHIP_LM4F) +# include "chip/lm4f_vectors.h" +#else +# error "Unsupported Stellaris vector file" +#endif + +/************************************************************************************ + * Pre-processor Definitions + ************************************************************************************/ + +/************************************************************************************ + * Public Types + ************************************************************************************/ + +/************************************************************************************ + * Public Data + ************************************************************************************/ + +/************************************************************************************ + * Public Function Prototypes + ************************************************************************************/ diff --git a/nuttx/arch/arm/src/lm/lm_vectors.S b/nuttx/arch/arm/src/lm/lm_vectors.S index fecff0428c..d3798fbb7b 100644 --- a/nuttx/arch/arm/src/lm/lm_vectors.S +++ b/nuttx/arch/arm/src/lm/lm_vectors.S @@ -127,290 +127,15 @@ lm_vectors: /* External Interrupts */ -#if defined(CONFIG_ARCH_CHIP_LM3S6918) - .word lm_gpioa /* Vector 16: GPIO Port A */ - .word lm_gpiob /* Vector 17: GPIO Port B */ - .word lm_gpioc /* Vector 18: GPIO Port C */ - .word lm_gpiod /* Vector 19: GPIO Port D */ - .word lm_gpioe /* Vector 20: GPIO Port E */ - .word lm_uart0 /* Vector 21: UART 0 */ - .word lm_uart1 /* Vector 22: UART 1 */ - .word lm_ssi0 /* Vector 23: SSI 0 */ - .word lm_i2c0 /* Vector 24: I2C 0 */ - .word lm_reserved /* Vector 25: Reserved */ - .word lm_reserved /* Vector 26: Reserved */ - .word lm_reserved /* Vector 27: Reserved */ - .word lm_reserved /* Vector 28: Reserved */ - .word lm_reserved /* Vector 29: Reserved */ - .word lm_adc0 /* Vector 30: ADC Sequence 0 */ - .word lm_adc1 /* Vector 31: ADC Sequence 1 */ - .word lm_adc2 /* Vector 32: ADC Sequence 2 */ - .word lm_adc3 /* Vector 33: ADC Sequence 3 */ - .word lm_wdog /* Vector 34: Watchdog Timer */ - .word lm_tmr0a /* Vector 35: Timer 0 A */ - .word lm_tmr0b /* Vector 36: Timer 0 B */ - .word lm_tmr1a /* Vector 37: Timer 1 A */ - .word lm_tmr1b /* Vector 38: Timer 1 B */ - .word lm_tmr2a /* Vector 39: Timer 2 A */ - .word lm_tmr2b /* Vector 40: Timer 3 B */ - .word lm_cmp0 /* Vector 41: Analog Comparator 0 */ - .word lm_cmp1 /* Vector 42: Analog Comparator 1 */ - .word lm_reserved /* Vector 43: Reserved */ - .word lm_syscon /* Vector 44: System Control */ - .word lm_flashcon /* Vector 45: FLASH Control */ - .word lm_gpiof /* Vector 46: GPIO Port F */ - .word lm_gpiog /* Vector 47: GPIO Port G */ - .word lm_gpioh /* Vector 48: GPIO Port H */ - .word lm_reserved /* Vector 49: Reserved */ - .word lm_ssi1 /* Vector 50: SSI 1 */ - .word lm_tmr3a /* Vector 51: Timer 3 A */ - .word lm_tmr3b /* Vector 52: Timer 3 B */ - .word lm_i2c1 /* Vector 53: I2C 1 */ - .word lm_reserved /* Vector 54: Reserved */ - .word lm_reserved /* Vector 55: Reserved */ - .word lm_reserved /* Vector 56: Reserved */ - .word lm_reserved /* Vector 57: Reserved */ - .word lm_eth /* Vector 58: Ethernet Controller */ - .word lm_hib /* Vector 59: Hibernation Module */ - .word lm_reserved /* Vector 60: Reserved */ - .word lm_reserved /* Vector 61: Reserved */ - .word lm_reserved /* Vector 62: Reserved */ - .word lm_reserved /* Vector 63: Reserved */ - .word lm_reserved /* Vector 64: Reserved */ - .word lm_reserved /* Vector 65: Reserved */ - .word lm_reserved /* Vector 66: Reserved */ - .word lm_reserved /* Vector 67: Reserved */ - .word lm_reserved /* Vector 68: Reserved */ - .word lm_reserved /* Vector 69: Reserved */ - .word lm_reserved /* Vector 70: Reserved */ -#elif defined(CONFIG_ARCH_CHIP_LM3S6432) - .word lm_gpioa /* Vector 16: GPIO Port A */ - .word lm_gpiob /* Vector 17: GPIO Port B */ - .word lm_gpioc /* Vector 18: GPIO Port C */ - .word lm_gpiod /* Vector 19: GPIO Port D */ - .word lm_gpioe /* Vector 20: GPIO Port E */ - .word lm_uart0 /* Vector 21: UART 0 */ - .word lm_uart1 /* Vector 22: UART 1 */ - .word lm_ssi0 /* Vector 23: SSI 0 */ - .word lm_i2c0 /* Vector 24: I2C 0 */ - .word lm_reserved /* Vector 25: Reserved */ - .word lm_pwm0 /* Vector 26: PWM Generator 0 */ - .word lm_reserved /* Vector 27: Reserved */ - .word lm_reserved /* Vector 28: Reserved */ - .word lm_reserved /* Vector 29: Reserved */ - .word lm_adc0 /* Vector 30: ADC Sequence 0 */ - .word lm_adc1 /* Vector 31: ADC Sequence 1 */ - .word lm_adc2 /* Vector 32: ADC Sequence 2 */ - .word lm_adc3 /* Vector 33: ADC Sequence 3 */ - .word lm_wdog /* Vector 34: Watchdog Timer */ - .word lm_tmr0a /* Vector 35: Timer 0 A */ - .word lm_tmr0b /* Vector 36: Timer 0 B */ - .word lm_tmr1a /* Vector 37: Timer 1 A */ - .word lm_tmr1b /* Vector 38: Timer 1 B */ - .word lm_tmr2a /* Vector 39: Timer 2 A */ - .word lm_tmr2b /* Vector 40: Timer 3 B */ - .word lm_cmp0 /* Vector 41: Analog Comparator 0 */ - .word lm_cmp1 /* Vector 42: Analog Comparator 1 */ - .word lm_reserved /* Vector 43: Reserved */ - .word lm_syscon /* Vector 44: System Control */ - .word lm_flashcon /* Vector 45: FLASH Control */ - .word lm_gpiof /* Vector 46: GPIO Port F */ - .word lm_gpiog /* Vector 47: GPIO Port G */ - .word lm_reserved /* Vector 48: Reserved */ - .word lm_reserved /* Vector 49: Reserved */ - .word lm_reserved /* Vector 50: Reserved */ - .word lm_reserved /* Vector 51: Reserved */ - .word lm_reserved /* Vector 52: Reserved */ - .word lm_reserved /* Vector 53: Reserved */ - .word lm_reserved /* Vector 54: Reserved */ - .word lm_reserved /* Vector 55: Reserved */ - .word lm_reserved /* Vector 56: Reserved */ - .word lm_reserved /* Vector 57: Reserved */ - .word lm_eth /* Vector 58: Ethernet Controller */ - .word lm_reserved /* Vector 59: Reserved */ - .word lm_reserved /* Vector 60: Reserved */ - .word lm_reserved /* Vector 61: Reserved */ - .word lm_reserved /* Vector 62: Reserved */ - .word lm_reserved /* Vector 63: Reserved */ - .word lm_reserved /* Vector 64: Reserved */ - .word lm_reserved /* Vector 65: Reserved */ - .word lm_reserved /* Vector 66: Reserved */ - .word lm_reserved /* Vector 67: Reserved */ - .word lm_reserved /* Vector 68: Reserved */ - .word lm_reserved /* Vector 69: Reserved */ - .word lm_reserved /* Vector 70: Reserved */ -#elif defined(CONFIG_ARCH_CHIP_LM3S6965) - .word lm_gpioa /* Vector 16: GPIO Port A */ - .word lm_gpiob /* Vector 17: GPIO Port B */ - .word lm_gpioc /* Vector 18: GPIO Port C */ - .word lm_gpiod /* Vector 19: GPIO Port D */ - .word lm_gpioe /* Vector 20: GPIO Port E */ - .word lm_uart0 /* Vector 21: UART 0 */ - .word lm_uart1 /* Vector 22: UART 1 */ - .word lm_ssi0 /* Vector 23: SSI 0 */ - .word lm_i2c0 /* Vector 24: I2C 0 */ - .word lm_pwmfault /* Vector 25: PWM Fault */ - .word lm_pwm0 /* Vector 26: PWM Generator 0 */ - .word lm_pwm1 /* Vector 27: PWM Generator 1 */ - .word lm_pwm2 /* Vector 28: PWM Generator 2 */ - .word lm_qei0 /* Vector 29: QEI0 */ - .word lm_adc0 /* Vector 30: ADC Sequence 0 */ - .word lm_adc1 /* Vector 31: ADC Sequence 1 */ - .word lm_adc2 /* Vector 32: ADC Sequence 2 */ - .word lm_adc3 /* Vector 33: ADC Sequence 3 */ - .word lm_wdog /* Vector 34: Watchdog Timer */ - .word lm_tmr0a /* Vector 35: Timer 0 A */ - .word lm_tmr0b /* Vector 36: Timer 0 B */ - .word lm_tmr1a /* Vector 37: Timer 1 A */ - .word lm_tmr1b /* Vector 38: Timer 1 B */ - .word lm_tmr2a /* Vector 39: Timer 2 A */ - .word lm_tmr2b /* Vector 40: Timer 3 B */ - .word lm_cmp0 /* Vector 41: Analog Comparator 0 */ - .word lm_cmp1 /* Vector 42: Analog Comparator 1 */ - .word lm_reserved /* Vector 43: Reserved */ - .word lm_syscon /* Vector 44: System Control */ - .word lm_flashcon /* Vector 45: FLASH Control */ - .word lm_gpiof /* Vector 46: GPIO Port F */ - .word lm_gpiog /* Vector 47: GPIO Port G */ - .word lm_reserved /* Vector 48: Reserved */ - .word lm_uart2 /* Vector 49: UART 2 */ - .word lm_reserved /* Vector 50: Reserved */ - .word lm_tmr3a /* Vector 51: Timer 3 A */ - .word lm_tmr3b /* Vector 52: Timer 3 B */ - .word lm_i2c1 /* Vector 53: I2C 1 */ - .word lm_qei1 /* Vector 54: QEI1 */ - .word lm_reserved /* Vector 55: Reserved */ - .word lm_reserved /* Vector 56: Reserved */ - .word lm_reserved /* Vector 57: Reserved */ - .word lm_eth /* Vector 58: Ethernet Controller */ - .word lm_hib /* Vector 59: Hibernation Module */ - .word lm_reserved /* Vector 60: Reserved */ - .word lm_reserved /* Vector 61: Reserved */ - .word lm_reserved /* Vector 62: Reserved */ - .word lm_reserved /* Vector 63: Reserved */ - .word lm_reserved /* Vector 64: Reserved */ - .word lm_reserved /* Vector 65: Reserved */ - .word lm_reserved /* Vector 66: Reserved */ - .word lm_reserved /* Vector 67: Reserved */ - .word lm_reserved /* Vector 68: Reserved */ - .word lm_reserved /* Vector 69: Reserved */ - .word lm_reserved /* Vector 70: Reserved */ -#elif defined(CONFIG_ARCH_CHIP_LM3S9B96) - .word lm_gpioa /* Vector 16: GPIO Port A */ - .word lm_gpiob /* Vector 17: GPIO Port B */ - .word lm_gpioc /* Vector 18: GPIO Port C */ - .word lm_gpiod /* Vector 19: GPIO Port D */ - .word lm_gpioe /* Vector 20: GPIO Port E */ - .word lm_uart0 /* Vector 21: UART 0 */ - .word lm_uart1 /* Vector 22: UART 1 */ - .word lm_ssi0 /* Vector 23: SSI 0 */ - .word lm_i2c0 /* Vector 24: I2C 0 */ - .word lm_pwmfault /* Vector 25: PWM Fault */ - .word lm_pwm0 /* Vector 26: PWM Generator 0 */ - .word lm_pwm1 /* Vector 27: PWM Generator 1 */ - .word lm_pwm2 /* Vector 28: PWM Generator 2 */ - .word lm_qei0 /* Vector 29: QEI0 */ - .word lm_adc0 /* Vector 30: ADC Sequence 0 */ - .word lm_adc1 /* Vector 31: ADC Sequence 1 */ - .word lm_adc2 /* Vector 32: ADC Sequence 2 */ - .word lm_adc3 /* Vector 33: ADC Sequence 3 */ - .word lm_wdog /* Vector 34: Watchdog Timer */ - .word lm_tmr0a /* Vector 35: Timer 0 A */ - .word lm_tmr0b /* Vector 36: Timer 0 B */ - .word lm_tmr1a /* Vector 37: Timer 1 A */ - .word lm_tmr1b /* Vector 38: Timer 1 B */ - .word lm_tmr2a /* Vector 39: Timer 2 A */ - .word lm_tmr2b /* Vector 40: Timer 3 B */ - .word lm_cmp0 /* Vector 41: Analog Comparator 0 */ - .word lm_cmp1 /* Vector 42: Analog Comparator 1 */ - .word lm_cmp2 /* Vector 43: Reserved */ - .word lm_syscon /* Vector 44: System Control */ - .word lm_flashcon /* Vector 45: FLASH Control */ - .word lm_gpiof /* Vector 46: GPIO Port F */ - .word lm_gpiog /* Vector 47: GPIO Port G */ - .word lm_gpioh /* Vector 48: GPIO Port H */ - .word lm_uart2 /* Vector 49: UART 2 */ - .word lm_ssi1 /* Vector 50: SSI 1 */ - .word lm_tmr3a /* Vector 51: Timer 3 A */ - .word lm_tmr3b /* Vector 52: Timer 3 B */ - .word lm_i2c1 /* Vector 53: I2C 1 */ - .word lm_qei1 /* Vector 54: QEI1 */ - .word lm_can0 /* Vector 55: CAN 0 */ - .word lm_can1 /* Vector 56: CAN 1 */ - .word lm_reserved /* Vector 57: Reserved */ - .word lm_eth /* Vector 58: Ethernet Controller */ - .word lm_reserved /* Vector 59: Reserved */ - .word lm_usb /* Vector 60: USB */ - .word lm_pwm3 /* Vector 61: PWM 3 */ - .word lm_udmasoft /* Vector 62: uDMA Software */ - .word lm_udmaerror /* Vector 63: uDMA Error */ - .word lm_adc1_0 /* Vector 64: ADC1 Sequence 0 */ - .word lm_adc1_1 /* Vector 65: ADC1 Sequence 1 */ - .word lm_adc1_2 /* Vector 66: ADC1 Sequence 2 */ - .word lm_adc1_3 /* Vector 67: ADC1 Sequence 3 */ - .word lm_i2s0 /* Vector 68: I2S 0 */ - .word lm_epi /* Vector 69: Reserved */ - .word lm_gpioj /* Vector 70: GPIO J */ - .word lm_reserved /* Vector 71: Reserved */ - #elif defined(CONFIG_ARCH_CHIP_LM3S8962) - .word lm_gpioa /* Vector 16: GPIO Port A */ - .word lm_gpiob /* Vector 17: GPIO Port B */ - .word lm_gpioc /* Vector 18: GPIO Port C */ - .word lm_gpiod /* Vector 19: GPIO Port D */ - .word lm_gpioe /* Vector 20: GPIO Port E */ - .word lm_uart0 /* Vector 21: UART 0 */ - .word lm_uart1 /* Vector 22: UART 1 */ - .word lm_ssi0 /* Vector 23: SSI 0 */ - .word lm_i2c0 /* Vector 24: I2C 0 */ - .word lm_pwmfault /* Vector 25: PWM Fault */ - .word lm_pwm0 /* Vector 26: PWM Generator 0 */ - .word lm_pwm1 /* Vector 27: PWM Generator 1 */ - .word lm_pwm2 /* Vector 28: PWM Generator 2 */ - .word lm_qei0 /* Vector 29: QEI0 */ - .word lm_adc0 /* Vector 30: ADC Sequence 0 */ - .word lm_adc1 /* Vector 31: ADC Sequence 1 */ - .word lm_adc2 /* Vector 32: ADC Sequence 2 */ - .word lm_adc3 /* Vector 33: ADC Sequence 3 */ - .word lm_wdog /* Vector 34: Watchdog Timer */ - .word lm_tmr0a /* Vector 35: Timer 0 A */ - .word lm_tmr0b /* Vector 36: Timer 0 B */ - .word lm_tmr1a /* Vector 37: Timer 1 A */ - .word lm_tmr1b /* Vector 38: Timer 1 B */ - .word lm_tmr2a /* Vector 39: Timer 2 A */ - .word lm_tmr2b /* Vector 40: Timer 3 B */ - .word lm_cmp0 /* Vector 41: Analog Comparator 0 */ - .word lm_reserved /* Vector 42: Reserved */ - .word lm_reserved /* Vector 43: Reserved */ - .word lm_syscon /* Vector 44: System Control */ - .word lm_flashcon /* Vector 45: FLASH Control */ - .word lm_gpiof /* Vector 46: GPIO Port F */ - .word lm_gpiog /* Vector 47: GPIO Port G */ - .word lm_reserved /* Vector 48: Reserved */ - .word lm_reserved /* Vector 49: Reserved */ - .word lm_reserved /* Vector 50: Reserved */ - .word lm_tmr3a /* Vector 51: Timer 3 A */ - .word lm_tmr3b /* Vector 52: Timer 3 B */ - .word lm_reserved /* Vector 53: Reserved*/ - .word lm_qei1 /* Vector 54: QEI1 */ - .word lm_can0 /* Vector 55: Can Controller */ - .word lm_reserved /* Vector 56: Reserved */ - .word lm_reserved /* Vector 57: Reserved */ - .word lm_eth /* Vector 58: Ethernet Controller */ - .word lm_hib /* Vector 59: Hibernation Module */ - .word lm_reserved /* Vector 60: Reserved */ - .word lm_reserved /* Vector 61: Reserved */ - .word lm_reserved /* Vector 62: Reserved */ - .word lm_reserved /* Vector 63: Reserved */ - .word lm_reserved /* Vector 64: Reserved */ - .word lm_reserved /* Vector 65: Reserved */ - .word lm_reserved /* Vector 66: Reserved */ - .word lm_reserved /* Vector 67: Reserved */ - .word lm_reserved /* Vector 68: Reserved */ - .word lm_reserved /* Vector 69: Reserved */ - .word lm_reserved /* Vector 70: Reserved */ -#else -# error "Vectors not specified for this LM3S chip" -#endif +/* External Interrupts */ + +#undef VECTOR +#define VECTOR(l,i) .word l + +#undef UNUSED +#define UNUSED(i) .word lm_reserved + +#include "chip/chip/lm_vectors.h" .size lm_vectors, .-lm_vectors /************************************************************************************ @@ -432,204 +157,13 @@ handlers: HANDLER lm_pendsv, LM_IRQ_PENDSV /* Vector 14: Penable system service request */ HANDLER lm_systick, LM_IRQ_SYSTICK /* Vector 15: System tick */ -#if defined(CONFIG_ARCH_CHIP_LM3S6918) - HANDLER lm_gpioa, LM_IRQ_GPIOA /* Vector 16: GPIO Port A */ - HANDLER lm_gpiob, LM_IRQ_GPIOB /* Vector 17: GPIO Port B */ - HANDLER lm_gpioc, LM_IRQ_GPIOC /* Vector 18: GPIO Port C */ - HANDLER lm_gpiod, LM_IRQ_GPIOD /* Vector 19: GPIO Port D */ - HANDLER lm_gpioe, LM_IRQ_GPIOE /* Vector 20: GPIO Port E */ - HANDLER lm_uart0, LM_IRQ_UART0 /* Vector 21: UART 0 */ - HANDLER lm_uart1, LM_IRQ_UART1 /* Vector 22: UART 1 */ - HANDLER lm_ssi0, LM_IRQ_SSI0 /* Vector 23: SSI 0 */ - HANDLER lm_i2c0, LM_IRQ_I2C0 /* Vector 24: I2C 0 */ - HANDLER lm_adc0, LM_IRQ_ADC0 /* Vector 30: ADC Sequence 0 */ - HANDLER lm_adc1, LM_IRQ_ADC1 /* Vector 31: ADC Sequence 1 */ - HANDLER lm_adc2, LM_IRQ_ADC2 /* Vector 32: ADC Sequence 2 */ - HANDLER lm_adc3, LM_IRQ_ADC3 /* Vector 33: ADC Sequence 3 */ - HANDLER lm_wdog, LM_IRQ_WDOG /* Vector 34: Watchdog Timer */ - HANDLER lm_tmr0a, LM_IRQ_TIMER0A /* Vector 35: Timer 0 A */ - HANDLER lm_tmr0b, LM_IRQ_TIMER0B /* Vector 36: Timer 0 B */ - HANDLER lm_tmr1a, LM_IRQ_TIMER1A /* Vector 37: Timer 1 A */ - HANDLER lm_tmr1b, LM_IRQ_TIMER1B /* Vector 38: Timer 1 B */ - HANDLER lm_tmr2a, LM_IRQ_TIMER2A /* Vector 39: Timer 2 A */ - HANDLER lm_tmr2b, LM_IRQ_TIMER2B /* Vector 40: Timer 3 B */ - HANDLER lm_cmp0, LM_IRQ_COMPARE0 /* Vector 41: Analog Comparator 0 */ - HANDLER lm_cmp1, LM_IRQ_COMPARE1 /* Vector 42: Analog Comparator 1 */ - HANDLER lm_syscon, LM_IRQ_SYSCON /* Vector 44: System Control */ - HANDLER lm_flashcon, LM_IRQ_FLASHCON /* Vector 45: FLASH Control */ - HANDLER lm_gpiof, LM_IRQ_GPIOF /* Vector 46: GPIO Port F */ - HANDLER lm_gpiog, LM_IRQ_GPIOG /* Vector 47: GPIO Port G */ - HANDLER lm_gpioh, LM_IRQ_GPIOH /* Vector 48: GPIO Port H */ - HANDLER lm_ssi1, LM_IRQ_SSI1 /* Vector 50: SSI 1 */ - HANDLER lm_tmr3a, LM_IRQ_TIMER3A /* Vector 51: Timer 3 A */ - HANDLER lm_tmr3b, LM_IRQ_TIMER3B /* Vector 52: Timer 3 B */ - HANDLER lm_i2c1, LM_IRQ_I2C1 /* Vector 53: I2C 1 */ - HANDLER lm_eth, LM_IRQ_ETHCON /* Vector 58: Ethernet Controller */ - HANDLER lm_hib, LM_IRQ_HIBERNATE /* Vector 59: Hibernation Module */ -#elif defined(CONFIG_ARCH_CHIP_LM3S6432) - HANDLER lm_gpioa, LM_IRQ_GPIOA /* Vector 16: GPIO Port A */ - HANDLER lm_gpiob, LM_IRQ_GPIOB /* Vector 17: GPIO Port B */ - HANDLER lm_gpioc, LM_IRQ_GPIOC /* Vector 18: GPIO Port C */ - HANDLER lm_gpiod, LM_IRQ_GPIOD /* Vector 19: GPIO Port D */ - HANDLER lm_gpioe, LM_IRQ_GPIOE /* Vector 20: GPIO Port E */ - HANDLER lm_uart0, LM_IRQ_UART0 /* Vector 21: UART 0 */ - HANDLER lm_uart1, LM_IRQ_UART1 /* Vector 22: UART 1 */ - HANDLER lm_ssi0, LM_IRQ_SSI0 /* Vector 23: SSI 0 */ - HANDLER lm_i2c0, LM_IRQ_I2C0 /* Vector 24: I2C 0 */ - HANDLER lm_pwm0, LM_IRQ_PWM0 /* Vector 26: PWM Generator 0 */ - HANDLER lm_adc0, LM_IRQ_ADC0 /* Vector 30: ADC Sequence 0 */ - HANDLER lm_adc1, LM_IRQ_ADC1 /* Vector 31: ADC Sequence 1 */ - HANDLER lm_adc2, LM_IRQ_ADC2 /* Vector 32: ADC Sequence 2 */ - HANDLER lm_adc3, LM_IRQ_ADC3 /* Vector 33: ADC Sequence 3 */ - HANDLER lm_wdog, LM_IRQ_WDOG /* Vector 34: Watchdog Timer */ - HANDLER lm_tmr0a, LM_IRQ_TIMER0A /* Vector 35: Timer 0 A */ - HANDLER lm_tmr0b, LM_IRQ_TIMER0B /* Vector 36: Timer 0 B */ - HANDLER lm_tmr1a, LM_IRQ_TIMER1A /* Vector 37: Timer 1 A */ - HANDLER lm_tmr1b, LM_IRQ_TIMER1B /* Vector 38: Timer 1 B */ - HANDLER lm_tmr2a, LM_IRQ_TIMER2A /* Vector 39: Timer 2 A */ - HANDLER lm_tmr2b, LM_IRQ_TIMER2B /* Vector 40: Timer 3 B */ - HANDLER lm_cmp0, LM_IRQ_COMPARE0 /* Vector 41: Analog Comparator 0 */ - HANDLER lm_cmp1, LM_IRQ_COMPARE1 /* Vector 42: Analog Comparator 1 */ - HANDLER lm_syscon, LM_IRQ_SYSCON /* Vector 44: System Control */ - HANDLER lm_flashcon, LM_IRQ_FLASHCON /* Vector 45: FLASH Control */ - HANDLER lm_gpiof, LM_IRQ_GPIOF /* Vector 46: GPIO Port F */ - HANDLER lm_gpiog, LM_IRQ_GPIOG /* Vector 47: GPIO Port G */ - HANDLER lm_eth, LM_IRQ_ETHCON /* Vector 58: Ethernet Controller */ -#elif defined(CONFIG_ARCH_CHIP_LM3S6965) - HANDLER lm_gpioa, LM_IRQ_GPIOA /* Vector 16: GPIO Port A */ - HANDLER lm_gpiob, LM_IRQ_GPIOB /* Vector 17: GPIO Port B */ - HANDLER lm_gpioc, LM_IRQ_GPIOC /* Vector 18: GPIO Port C */ - HANDLER lm_gpiod, LM_IRQ_GPIOD /* Vector 19: GPIO Port D */ - HANDLER lm_gpioe, LM_IRQ_GPIOE /* Vector 20: GPIO Port E */ - HANDLER lm_uart0, LM_IRQ_UART0 /* Vector 21: UART 0 */ - HANDLER lm_uart1, LM_IRQ_UART1 /* Vector 22: UART 1 */ - HANDLER lm_ssi0, LM_IRQ_SSI0 /* Vector 23: SSI 0 */ - HANDLER lm_i2c0, LM_IRQ_I2C0 /* Vector 24: I2C 0 */ - HANDLER lm_pwmfault, LM_IRQ_PWMFAULT /* Vector 25: PWM Fault */ - HANDLER lm_pwm0, LM_IRQ_PWM0 /* Vector 26: PWM Generator 0 */ - HANDLER lm_pwm1, LM_IRQ_PWM1 /* Vector 27: PWM Generator 1 */ - HANDLER lm_pwm2, LM_IRQ_PWM2 /* Vector 28: PWM Generator 2 */ - HANDLER lm_qei0, LM_IRQ_QEI0 /* Vector 29: QEI 0 */ - HANDLER lm_adc0, LM_IRQ_ADC0 /* Vector 30: ADC Sequence 0 */ - HANDLER lm_adc1, LM_IRQ_ADC1 /* Vector 31: ADC Sequence 1 */ - HANDLER lm_adc2, LM_IRQ_ADC2 /* Vector 32: ADC Sequence 2 */ - HANDLER lm_adc3, LM_IRQ_ADC3 /* Vector 33: ADC Sequence 3 */ - HANDLER lm_wdog, LM_IRQ_WDOG /* Vector 34: Watchdog Timer */ - HANDLER lm_tmr0a, LM_IRQ_TIMER0A /* Vector 35: Timer 0 A */ - HANDLER lm_tmr0b, LM_IRQ_TIMER0B /* Vector 36: Timer 0 B */ - HANDLER lm_tmr1a, LM_IRQ_TIMER1A /* Vector 37: Timer 1 A */ - HANDLER lm_tmr1b, LM_IRQ_TIMER1B /* Vector 38: Timer 1 B */ - HANDLER lm_tmr2a, LM_IRQ_TIMER2A /* Vector 39: Timer 2 A */ - HANDLER lm_tmr2b, LM_IRQ_TIMER2B /* Vector 40: Timer 3 B */ - HANDLER lm_cmp0, LM_IRQ_COMPARE0 /* Vector 41: Analog Comparator 0 */ - HANDLER lm_cmp1, LM_IRQ_COMPARE1 /* Vector 42: Analog Comparator 1 */ - HANDLER lm_syscon, LM_IRQ_SYSCON /* Vector 44: System Control */ - HANDLER lm_flashcon, LM_IRQ_FLASHCON /* Vector 45: FLASH Control */ - HANDLER lm_gpiof, LM_IRQ_GPIOF /* Vector 46: GPIO Port F */ - HANDLER lm_gpiog, LM_IRQ_GPIOG /* Vector 47: GPIO Port G */ - HANDLER lm_uart2, LM_IRQ_UART1 /* Vector 49: UART 1 */ - HANDLER lm_tmr3a, LM_IRQ_TIMER3A /* Vector 51: Timer 3 A */ - HANDLER lm_tmr3b, LM_IRQ_TIMER3B /* Vector 52: Timer 3 B */ - HANDLER lm_i2c1, LM_IRQ_I2C1 /* Vector 53: I2C 1 */ - HANDLER lm_qei1, LM_IRQ_QEI1 /* Vector 54: QEI 1 */ - HANDLER lm_eth, LM_IRQ_ETHCON /* Vector 58: Ethernet Controller */ - HANDLER lm_hib, LM_IRQ_HIBERNATE /* Vector 59: Hibernation Module */ -#elif defined(CONFIG_ARCH_CHIP_LM3S8962) - HANDLER lm_gpioa, LM_IRQ_GPIOA /* Vector 16: GPIO Port A */ - HANDLER lm_gpiob, LM_IRQ_GPIOB /* Vector 17: GPIO Port B */ - HANDLER lm_gpioc, LM_IRQ_GPIOC /* Vector 18: GPIO Port C */ - HANDLER lm_gpiod, LM_IRQ_GPIOD /* Vector 19: GPIO Port D */ - HANDLER lm_gpioe, LM_IRQ_GPIOE /* Vector 20: GPIO Port E */ - HANDLER lm_uart0, LM_IRQ_UART0 /* Vector 21: UART 0 */ - HANDLER lm_uart1, LM_IRQ_UART1 /* Vector 22: UART 1 */ - HANDLER lm_ssi0, LM_IRQ_SSI0 /* Vector 23: SSI 0 */ - HANDLER lm_i2c0, LM_IRQ_I2C0 /* Vector 24: I2C 0 */ - HANDLER lm_pwmfault, LM_IRQ_PWMFAULT /* Vector 25: PWM Fault */ - HANDLER lm_pwm0, LM_IRQ_PWM0 /* Vector 26: PWM Generator 0 */ - HANDLER lm_pwm1, LM_IRQ_PWM1 /* Vector 27: PWM Generator 1 */ - HANDLER lm_pwm2, LM_IRQ_PWM2 /* Vector 28: PWM Generator 2 */ - HANDLER lm_qei0, LM_IRQ_QEI0 /* Vector 29: QEI 0 */ - HANDLER lm_adc0, LM_IRQ_ADC0 /* Vector 30: ADC Sequence 0 */ - HANDLER lm_adc1, LM_IRQ_ADC1 /* Vector 31: ADC Sequence 1 */ - HANDLER lm_adc2, LM_IRQ_ADC2 /* Vector 32: ADC Sequence 2 */ - HANDLER lm_adc3, LM_IRQ_ADC3 /* Vector 33: ADC Sequence 3 */ - HANDLER lm_wdog, LM_IRQ_WDOG /* Vector 34: Watchdog Timer */ - HANDLER lm_tmr0a, LM_IRQ_TIMER0A /* Vector 35: Timer 0 A */ - HANDLER lm_tmr0b, LM_IRQ_TIMER0B /* Vector 36: Timer 0 B */ - HANDLER lm_tmr1a, LM_IRQ_TIMER1A /* Vector 37: Timer 1 A */ - HANDLER lm_tmr1b, LM_IRQ_TIMER1B /* Vector 38: Timer 1 B */ - HANDLER lm_tmr2a, LM_IRQ_TIMER2A /* Vector 39: Timer 2 A */ - HANDLER lm_tmr2b, LM_IRQ_TIMER2B /* Vector 40: Timer 3 B */ - HANDLER lm_cmp0, LM_IRQ_COMPARE0 /* Vector 41: Analog Comparator 0 */ - HANDLER lm_syscon, LM_IRQ_SYSCON /* Vector 44: System Control */ - HANDLER lm_flashcon, LM_IRQ_FLASHCON /* Vector 45: FLASH Control */ - HANDLER lm_gpiof, LM_IRQ_GPIOF /* Vector 46: GPIO Port F */ - HANDLER lm_gpiog, LM_IRQ_GPIOG /* Vector 47: GPIO Port G */ - HANDLER lm_uart2, LM_IRQ_UART1 /* Vector 49: UART 1 */ - HANDLER lm_tmr3a, LM_IRQ_TIMER3A /* Vector 51: Timer 3 A */ - HANDLER lm_tmr3b, LM_IRQ_TIMER3B /* Vector 52: Timer 3 B */ - HANDLER lm_i2c1, LM_IRQ_I2C1 /* Vector 53: I2C 1 */ - HANDLER lm_qei1, LM_IRQ_QEI1 /* Vector 54: QEI 1 */ - HANDLER lm_can0, LM_IRQ_CAN0 /* Vector 55: CAN 0 */ - HANDLER lm_eth, LM_IRQ_ETHCON /* Vector 58: Ethernet Controller */ - HANDLER lm_hib, LM_IRQ_HIBERNATE /* Vector 59: Hibernation Module */ -#elif defined(CONFIG_ARCH_CHIP_LM3S9B96) - HANDLER lm_gpioa, LM_IRQ_GPIOA /* Vector 16: GPIO Port A */ - HANDLER lm_gpiob, LM_IRQ_GPIOB /* Vector 17: GPIO Port B */ - HANDLER lm_gpioc, LM_IRQ_GPIOC /* Vector 18: GPIO Port C */ - HANDLER lm_gpiod, LM_IRQ_GPIOD /* Vector 19: GPIO Port D */ - HANDLER lm_gpioe, LM_IRQ_GPIOE /* Vector 20: GPIO Port E */ - HANDLER lm_uart0, LM_IRQ_UART0 /* Vector 21: UART 0 */ - HANDLER lm_uart1, LM_IRQ_UART1 /* Vector 22: UART 1 */ - HANDLER lm_ssi0, LM_IRQ_SSI0 /* Vector 23: SSI 0 */ - HANDLER lm_i2c0, LM_IRQ_I2C0 /* Vector 24: I2C 0 */ - HANDLER lm_pwmfault, LM_IRQ_PWMFAULT /* Vector 25: PWM Fault */ - HANDLER lm_pwm0, LM_IRQ_PWM0 /* Vector 26: PWM Generator 0 */ - HANDLER lm_pwm1, LM_IRQ_PWM1 /* Vector 27: PWM Generator 1 */ - HANDLER lm_pwm2, LM_IRQ_PWM2 /* Vector 28: PWM Generator 2 */ - HANDLER lm_qei0, LM_IRQ_QEI0 /* Vector 29: QEI 0 */ - HANDLER lm_adc0, LM_IRQ_ADC0 /* Vector 30: ADC Sequence 0 */ - HANDLER lm_adc1, LM_IRQ_ADC1 /* Vector 31: ADC Sequence 1 */ - HANDLER lm_adc2, LM_IRQ_ADC2 /* Vector 32: ADC Sequence 2 */ - HANDLER lm_adc3, LM_IRQ_ADC3 /* Vector 33: ADC Sequence 3 */ - HANDLER lm_wdog, LM_IRQ_WDOG /* Vector 34: Watchdog Timer */ - HANDLER lm_tmr0a, LM_IRQ_TIMER0A /* Vector 35: Timer 0 A */ - HANDLER lm_tmr0b, LM_IRQ_TIMER0B /* Vector 36: Timer 0 B */ - HANDLER lm_tmr1a, LM_IRQ_TIMER1A /* Vector 37: Timer 1 A */ - HANDLER lm_tmr1b, LM_IRQ_TIMER1B /* Vector 38: Timer 1 B */ - HANDLER lm_tmr2a, LM_IRQ_TIMER2A /* Vector 39: Timer 2 A */ - HANDLER lm_tmr2b, LM_IRQ_TIMER2B /* Vector 40: Timer 3 B */ - HANDLER lm_cmp0, LM_IRQ_COMPARE0 /* Vector 41: Analog Comparator 0 */ - HANDLER lm_cmp1, LM_IRQ_COMPARE1 /* Vector 42: Analog Comparator 1 */ - HANDLER lm_cmp2, LM_IRQ_COMPARE2 /* Vector 43: Analog Comparator 2 */ - HANDLER lm_syscon, LM_IRQ_SYSCON /* Vector 44: System Control */ - HANDLER lm_flashcon, LM_IRQ_FLASHCON /* Vector 45: FLASH Control */ - HANDLER lm_gpiof, LM_IRQ_GPIOF /* Vector 46: GPIO Port F */ - HANDLER lm_gpiog, LM_IRQ_GPIOG /* Vector 47: GPIO Port G */ - HANDLER lm_gpioh, LM_IRQ_GPIOH /* Vector 48: GPIO Port H */ - HANDLER lm_uart2, LM_IRQ_UART2 /* Vector 49: UART 2 */ - HANDLER lm_ssi1, LM_IRQ_SSI1 /* Vector 50: GPIO Port H */ - HANDLER lm_tmr3a, LM_IRQ_TIMER3A /* Vector 51: Timer 3 A */ - HANDLER lm_tmr3b, LM_IRQ_TIMER3B /* Vector 52: Timer 3 B */ - HANDLER lm_i2c1, LM_IRQ_I2C1 /* Vector 53: I2C 1 */ - HANDLER lm_qei1, LM_IRQ_QEI1 /* Vector 54: QEI 1 */ - HANDLER lm_can0, LM_IRQ_CAN0 /* Vector 55: CAN 0 */ - HANDLER lm_can1, LM_IRQ_CAN1 /* Vector 56: CAN 1 */ - HANDLER lm_eth, LM_IRQ_ETHCON /* Vector 58: Ethernet Controller */ - HANDLER lm_usb, LM_IRQ_USB /* Vector 60: USB */ - HANDLER lm_pwm3, LM_IRQ_PWM3 /* Vector 61: PWM 3 */ - HANDLER lm_udmasoft, LM_IRQ_UDMASOFT /* Vector 62: uDMA Software */ - HANDLER lm_udmaerror, LM_IRQ_UDMAERROR /* Vector 63: uDMA Error */ - HANDLER lm_adc1_0, LM_IRQ_ADC1_0 /* Vector 64: ADC1 Sequence 0 */ - HANDLER lm_adc1_1, LM_IRQ_ADC1_1 /* Vector 65: ADC1 Sequence 1 */ - HANDLER lm_adc1_2, LM_IRQ_ADC1_2 /* Vector 66: ADC1 Sequence 2 */ - HANDLER lm_adc1_3, LM_IRQ_ADC1_3 /* Vector 67: ADC1 Sequence 3 */ - HANDLER lm_i2s0, LM_IRQ_I2S0 /* Vector 68: I2S 0 */ - HANDLER lm_epi, LM_IRQ_EPI /* Vector 69: EPI */ - HANDLER lm_gpioj, LM_IRQ_GPIOJ /* Vector 70: GPIO Port J */ -#else -# error "Vectors not specified for this Stellaris chip" -#endif +#undef VECTOR +#define VECTOR(l,i) HANDLER l, i + +#undef UNUSED +#define UNUSED(i) + +#include "chip/chip/lm_vectors.h" /* Common IRQ handling logic. On entry here, the return stack is on either * the PSP or the MSP and looks like the following: From 44fdf6fc7a8188577cc968233b3ee123e688ab71 Mon Sep 17 00:00:00 2001 From: patacongo Date: Wed, 9 Jan 2013 21:31:36 +0000 Subject: [PATCH 053/118] Add file action logic which will eventually be needed to support posix_spawn() git-svn-id: http://svn.code.sf.net/p/nuttx/code/trunk@5500 42af7a65-404d-4744-a932-0658087f49c3 --- nuttx/ChangeLog | 1 + nuttx/configs/sim/ostest/defconfig | 14 ++- nuttx/include/spawn.h | 28 ++++-- nuttx/libc/spawn/Make.defs | 3 +- nuttx/libc/spawn/lib_psfa_addaction.c | 91 +++++++++++++++++++ nuttx/libc/spawn/lib_psfa_addclose.c | 100 +++++++++++++++++++++ nuttx/libc/spawn/lib_psfa_adddup2.c | 104 ++++++++++++++++++++++ nuttx/libc/spawn/lib_psfa_addopen.c | 119 +++++++++++++++++++++++++ nuttx/libc/spawn/lib_psfa_destroy.c | 96 ++++++++++++++++++++ nuttx/libc/spawn/lib_psfa_init.c | 70 +++++++++++++++ nuttx/libc/spawn/spawn.h | 121 ++++++++++++++++++++++++++ 11 files changed, 735 insertions(+), 12 deletions(-) create mode 100644 nuttx/libc/spawn/lib_psfa_addaction.c create mode 100644 nuttx/libc/spawn/lib_psfa_addclose.c create mode 100644 nuttx/libc/spawn/lib_psfa_adddup2.c create mode 100644 nuttx/libc/spawn/lib_psfa_addopen.c create mode 100644 nuttx/libc/spawn/lib_psfa_destroy.c create mode 100644 nuttx/libc/spawn/lib_psfa_init.c create mode 100644 nuttx/libc/spawn/spawn.h diff --git a/nuttx/ChangeLog b/nuttx/ChangeLog index 35bf422538..3d124073b8 100644 --- a/nuttx/ChangeLog +++ b/nuttx/ChangeLog @@ -3896,4 +3896,5 @@ * arch/arm/src/lm: Rename the arch/arm/src/lm3s directory to arch/arm/src/lm so that is can support other members of the Stellaris family. + * libc/spawn: Add file action interfaces needed by posix_spawn(). diff --git a/nuttx/configs/sim/ostest/defconfig b/nuttx/configs/sim/ostest/defconfig index 55687c366a..43d78e6a22 100644 --- a/nuttx/configs/sim/ostest/defconfig +++ b/nuttx/configs/sim/ostest/defconfig @@ -90,6 +90,7 @@ CONFIG_BOARD_LOOPSPERMSEC=100 # CONFIG_ARCH_IRQPRIO is not set # CONFIG_CUSTOM_STACK is not set # CONFIG_ADDRENV is not set +# CONFIG_ARCH_HAVE_VFORK is not set # CONFIG_ARCH_STACKDUMP is not set # CONFIG_ENDIAN_BIG is not set @@ -266,6 +267,10 @@ CONFIG_MM_REGIONS=1 # # Library Routines # + +# +# Standard C Library Options +# CONFIG_STDIO_BUFFER_SIZE=1024 CONFIG_STDIO_LINEBUFFER=y CONFIG_NUNGET_CHARS=2 @@ -277,6 +282,7 @@ CONFIG_LIB_HOMEDIR="/" # CONFIG_EOL_IS_LF is not set # CONFIG_EOL_IS_BOTH_CRLF is not set CONFIG_EOL_IS_EITHER_CRLF=y +# CONFIG_LIBC_EXECFUNCS is not set # CONFIG_LIBC_STRERROR is not set # CONFIG_LIBC_PERROR_STDOUT is not set CONFIG_ARCH_LOWPUTC=y @@ -284,6 +290,11 @@ CONFIG_LIB_SENDFILE_BUFSIZE=512 # CONFIG_ARCH_ROMGETC is not set # CONFIG_ARCH_OPTIMIZED_FUNCTIONS is not set +# +# Non-standard Helper Functions +# +# CONFIG_LIB_KBDCODEC is not set + # # Basic CXX Support # @@ -295,7 +306,7 @@ CONFIG_LIB_SENDFILE_BUFSIZE=512 # # -# Named Applications +# Built-In Applications # # CONFIG_BUILTIN is not set @@ -356,7 +367,6 @@ CONFIG_EXAMPLES_OSTEST_RR_RUNS=10 # CONFIG_EXAMPLES_USBMSC is not set # CONFIG_EXAMPLES_USBTERM is not set # CONFIG_EXAMPLES_WATCHDOG is not set -# CONFIG_EXAMPLES_WLAN is not set # # Interpreters diff --git a/nuttx/include/spawn.h b/nuttx/include/spawn.h index 3463670b5f..d453fb5823 100644 --- a/nuttx/include/spawn.h +++ b/nuttx/include/spawn.h @@ -33,14 +33,16 @@ * ****************************************************************************/ -#ifndef __INCLUDE_LIBGEN_H -#define __INCLUDE_LIBGEN_H +#ifndef __INCLUDE_SPAWN_H +#define __INCLUDE_SPAWN_H /**************************************************************************** * Included Files ****************************************************************************/ #include + +#include #include /**************************************************************************** @@ -67,15 +69,23 @@ struct posix_spawnattr_s { -/* To be provided */ + uint8_t flags; + uint8_t priority; + pid_t group; + sigset_t sigset; }; + typedef struct posix_spawnattr_s posix_spawnattr_t; -struct posix_spawn_file_actions_s -{ -/* To be provided */ -}; -typedef struct posix_spawn_file_actions_s posix_spawn_file_actions_t; +/* posix_spawn_file_actions_addclose(), posix_spawn_file_actions_adddup2(), + * and posix_spawn_file_actions_addopen() will allocate memory and append + * a new file action to an instance of posix_spawn_file_actions_t. The + * internal representation of these structures is not exposed to the user. + * The user need only know that the size sizeof(posix_spawn_file_actions_t) + * will hold a pointer to data. + */ + +typedef FAR void *posix_spawn_file_actions_t; /**************************************************************************** * Public Function Prototypes @@ -134,4 +144,4 @@ int posix_spawnattr_setsigmask(FAR posix_spawnattr_t *, } #endif -#endif /* __INCLUDE_LIBGEN_H */ +#endif /* __INCLUDE_SPAWN_H */ diff --git a/nuttx/libc/spawn/Make.defs b/nuttx/libc/spawn/Make.defs index 17d9f393a6..0952fda472 100644 --- a/nuttx/libc/spawn/Make.defs +++ b/nuttx/libc/spawn/Make.defs @@ -37,7 +37,8 @@ ifeq ($(CONFIG_LIBC_EXECFUNCS),y) -CSRCS += +CSRCS += lib_psfa_addaction.c lib_psfa_addclose.c lib_psfa_adddup2.c +CSRCS += lib_psfa_addopen.c lib_psfa_destroy.c lib_psfa_init.c # Add the spawn directory to the build diff --git a/nuttx/libc/spawn/lib_psfa_addaction.c b/nuttx/libc/spawn/lib_psfa_addaction.c new file mode 100644 index 0000000000..3f297d7cf8 --- /dev/null +++ b/nuttx/libc/spawn/lib_psfa_addaction.c @@ -0,0 +1,91 @@ +/**************************************************************************** + * libc/string/lib_psfa_addaction.c + * + * Copyright (C) 2013 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * 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. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include + +#include "spawn/spawn.h" + +/**************************************************************************** + * Global Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: add_file_action + * + * Description: + * Add the file action to the end for the file action list. + * + * Input Parameters: + * file_actions - The head of the file action list. + * entry - The file action to be added + * + * Returned Value: + * None + * + ****************************************************************************/ + +void add_file_action(FAR posix_spawn_file_actions_t *file_actions, + FAR struct spawn_general_file_action_s *entry) +{ + FAR struct spawn_general_file_action_s *prev; + FAR struct spawn_general_file_action_s *next; + + /* Find the end of the list */ + + for (prev = NULL, next = (FAR struct spawn_general_file_action_s *)*file_actions; + next; + prev = next, next = next->flink); + + /* Here next is NULL and prev points to the last entry in the list (or + * is NULL if the list is empty). + */ + + if (prev) + { + prev->flink = entry; + } + else + { + *file_actions = (posix_spawn_file_actions_t)entry; + } + + entry->flink = NULL; +} diff --git a/nuttx/libc/spawn/lib_psfa_addclose.c b/nuttx/libc/spawn/lib_psfa_addclose.c new file mode 100644 index 0000000000..225885cb1a --- /dev/null +++ b/nuttx/libc/spawn/lib_psfa_addclose.c @@ -0,0 +1,100 @@ +/**************************************************************************** + * libc/string/lib_psfa_addclose.c + * + * Copyright (C) 2013 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * 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. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include +#include +#include +#include + +#include "spawn/spawn.h" + +/**************************************************************************** + * Global Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: posix_spawn_file_actions_addclose + * + * Description: + * The posix_spawn_file_actions_addclose() function adds a close operation + * to the list of operations associated with the object referenced by + * file_actions, for subsequent use in a call to posix_spawn(2) or + * posix_spawnp(2). The descriptor referred to by fd is closed as if + * close() had been called on it prior to the new child process starting + * execution. + * + * Input Parameters: + * file_actions - The posix_spawn_file_actions_t to append the action. + * fd - The file descriptor to be closed. + * + * Returned Value: + * On success, these functions return 0; on failure they return an error + * number from . + * + ****************************************************************************/ + +int posix_spawn_file_actions_addclose(FAR posix_spawn_file_actions_t *file_actions, + int fd) +{ + FAR struct spawn_close_file_action_s *entry; + + DEBUGASSERT(file_actions && fd >= 0 && fd < CONFIG_NFILE_DESCRIPTORS); + + /* Allocate the action list entry */ + + entry = (FAR struct spawn_close_file_action_s *) + zalloc(sizeof(struct spawn_close_file_action_s)); + + if (!entry) + { + return ENOMEM; + } + + /* Initialize the file action entry */ + + entry->action = SPAWN_FILE_ACTION_CLOSE; + entry->fd = fd; + + /* And add it to the file action list */ + + add_file_action(file_actions, (FAR struct spawn_general_file_action_s *)entry); + return OK; +} diff --git a/nuttx/libc/spawn/lib_psfa_adddup2.c b/nuttx/libc/spawn/lib_psfa_adddup2.c new file mode 100644 index 0000000000..966f456aff --- /dev/null +++ b/nuttx/libc/spawn/lib_psfa_adddup2.c @@ -0,0 +1,104 @@ +/**************************************************************************** + * libc/string/lib_psfa_adddup2.c + * + * Copyright (C) 2013 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * 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. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include +#include +#include +#include + +#include "spawn/spawn.h" + +/**************************************************************************** + * Global Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: posix_spawn_file_actions_adddup2 + * + * Description: + * The posix_spawn_file_actions_adddup2() function adds a dup2 operation to + * the list of operations associated with the object referenced by + * file_actions, for subsequent use in a call to posix_spawn(2) or + * posix_spawnp(2). The descriptor referred to by fd2 is created as + * if dup2() had been called on fd1 prior to the new child process + * starting execution. + * + * Input Parameters: + * file_actions - The posix_spawn_file_actions_t to append the action. + * fd1 - The first file descriptor to be argument to dup2. + * fd2 - The first file descriptor to be argument to dup2. + * + * Returned Value: + * On success, these functions return 0; on failure they return an error + * number from . + * + ****************************************************************************/ + +int posix_spawn_file_actions_adddup2(FAR posix_spawn_file_actions_t *file_actions, + int fd1, int fd2) +{ + FAR struct spawn_dup2_file_action_s *entry; + + DEBUGASSERT(file_actions && + fd1 >= 0 && fd1 < CONFIG_NFILE_DESCRIPTORS && + fd2 >= 0 && fd2 < CONFIG_NFILE_DESCRIPTORS); + + /* Allocate the action list entry */ + + entry = (FAR struct spawn_dup2_file_action_s *) + zalloc(sizeof(struct spawn_close_file_action_s)); + + if (!entry) + { + return ENOMEM; + } + + /* Initialize the file action entry */ + + entry->action = SPAWN_FILE_ACTION_DUP2; + entry->fd1 = fd1; + entry->fd2 = fd2; + + /* And add it to the file action list */ + + add_file_action(file_actions, (FAR struct spawn_general_file_action_s *)entry); + return OK; +} diff --git a/nuttx/libc/spawn/lib_psfa_addopen.c b/nuttx/libc/spawn/lib_psfa_addopen.c new file mode 100644 index 0000000000..bcb2012913 --- /dev/null +++ b/nuttx/libc/spawn/lib_psfa_addopen.c @@ -0,0 +1,119 @@ +/**************************************************************************** + * libc/string/lib_psfa_addopen.c + * + * Copyright (C) 2013 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * 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. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include +#include +#include +#include +#include + +#include "spawn/spawn.h" + +/**************************************************************************** + * Global Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: posix_spawn_file_actions_addopen + * + * Description: + * The posix_spawn_file_actions_addopen() function adds an open operation + * to the list of operations associated with the object referenced by + * file_actions, for subsequent use in a call to posix_spawn(2) or + * posix_spawnp(2). The descriptor referred to by fd is opened using + * the path, oflag, and mode arguments as if open() had been called on it + * prior to the new child process starting execution. The string path is + * copied by the posix_spawn_file_actions_addopen() function during this + * process, so storage need not be persistent in the caller. + * + * Input Parameters: + * file_actions - The posix_spawn_file_actions_t to append the action. + * fd - The path to be opened. + * path - The first file descriptor to be argument to dup2. + * oflags - Open flags + * mode - File creation mode + * + * Returned Value: + * On success, these functions return 0; on failure they return an error + * number from . + * + ****************************************************************************/ + +int posix_spawn_file_actions_addopen(FAR posix_spawn_file_actions_t *file_actions, + int fd, FAR const char *path, int oflags, + mode_t mode) +{ + FAR struct spawn_open_file_action_s *entry; + size_t len; + size_t alloc; + + DEBUGASSERT(file_actions && path && + fd >= 0 && fd < CONFIG_NFILE_DESCRIPTORS); + + /* Get the size of the action including storage for the path plus its NUL + * terminating character. + */ + + len = strlen(path); + alloc = SIZEOF_OPEN_FILE_ACTION_S(len); + + /* Allocate the action list entry of this size */ + + entry = (FAR struct spawn_open_file_action_s *)zalloc(alloc); + + if (!entry) + { + return ENOMEM; + } + + /* Initialize the file action entry */ + + entry->action = SPAWN_FILE_ACTION_OPEN; + entry->fd = fd; + entry->oflags = oflags; + entry->mode = mode; + strncpy(entry->path, path, len+1); + + /* And add it to the file action list */ + + add_file_action(file_actions, (FAR struct spawn_general_file_action_s *)entry); + return OK; +} diff --git a/nuttx/libc/spawn/lib_psfa_destroy.c b/nuttx/libc/spawn/lib_psfa_destroy.c new file mode 100644 index 0000000000..5d0a644d8b --- /dev/null +++ b/nuttx/libc/spawn/lib_psfa_destroy.c @@ -0,0 +1,96 @@ +/**************************************************************************** + * libc/string/lib_psfa_destroy.c + * + * Copyright (C) 2012 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * 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. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include +#include +#include + +#include "spawn/spawn.h" + +/**************************************************************************** + * Global Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: posix_spawn_file_actions_destroy + * + * Description: + * The posix_spawn_file_actions_destroy() function destroys the object + * referenced by file_actions which was previously intialized by + * posix_spawn_file_actions_init(), returning any resources obtained at the + * time of initialization to the system for subsequent reuse. A + * posix_spawn_file_actions_t may be reinitialized after having been + * destroyed, but must not be reused after destruction, unless it has been + * reinitialized. + * + * Input Parameters: + * file_actions - The posix_spawn_file_actions_t to be destroyed. + * + * Returned Value: + * On success, these functions return 0; on failure they return an error + * number from . + * + ****************************************************************************/ + +int posix_spawn_file_actions_destroy(FAR posix_spawn_file_actions_t *file_actions) +{ + FAR struct spawn_general_file_action_s *curr; + FAR struct spawn_general_file_action_s *next; + + DEBUGASSERT(file_actions); + + /* Destroy each file action, one at a time */ + + for (curr = (FAR struct spawn_general_file_action_s *)*file_actions; + curr; + curr = next) + { + /* Get the pointer to the next element before destroying the current one */ + + next = curr->flink; + free(curr); + } + + /* Mark the list empty */ + + *file_actions = NULL; + return OK; +} diff --git a/nuttx/libc/spawn/lib_psfa_init.c b/nuttx/libc/spawn/lib_psfa_init.c new file mode 100644 index 0000000000..860045b52f --- /dev/null +++ b/nuttx/libc/spawn/lib_psfa_init.c @@ -0,0 +1,70 @@ +/**************************************************************************** + * libc/string/lib_psfa_init.c + * + * Copyright (C) 2013 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * 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. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include + +/**************************************************************************** + * Global Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: posix_spawn_file_actions_init + * + * Description: + * The posix_spawn_file_actions_init() function initializes the object + * referenced by file_actions, to an empty set of file actions for + * subsequent use in a call to posix_spawn(2) or posix_spawnp(2). + * + * Input Parameters: + * file_actions - The address of the posix_spawn_file_actions_t to be + * initialized. + * + * Returned Value: + * On success, these functions return 0; on failure they return an error + * number from . + * + ****************************************************************************/ + +int posix_spawn_file_actions_init(FAR posix_spawn_file_actions_t *file_actions) +{ + file_actions = NULL; + return OK; +} diff --git a/nuttx/libc/spawn/spawn.h b/nuttx/libc/spawn/spawn.h new file mode 100644 index 0000000000..5d0159ff28 --- /dev/null +++ b/nuttx/libc/spawn/spawn.h @@ -0,0 +1,121 @@ +/**************************************************************************** + * libc/spawn/spawn.h + * + * Copyright (C) 2012 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * 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. + * + ****************************************************************************/ + +#ifndef __LIBC_SPAWN_SPAWN_H +#define __LIBC_SPAWN_SPAWN_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +/**************************************************************************** + * Type Definitions + ****************************************************************************/ +/* This enumerator identifies a file action */ + +enum spawn_file_actions_e +{ + SPAWN_FILE_ACTION_NONE = 0, + SPAWN_FILE_ACTION_CLOSE, + SPAWN_FILE_ACTION_DUP2, + SPAWN_FILE_ACTION_OPEN +}; + +/* posix_spawn_file_actions_addclose(), posix_spawn_file_actions_adddup2(), + * and posix_spawn_file_actions_addopen() will allocate memory and append + * a new file action to an instance of posix_spawn_file_actions_t. The + * internal representation of these structures are defined below: + */ + +struct spawn_general_file_action_s +{ + FAR struct spawn_general_file_action_s *flink; /* Supports a singly linked list */ + enum spawn_file_actions_e action; /* A member of enum spawn_file_actions_e */ +}; + +struct spawn_close_file_action_s +{ + FAR struct spawn_general_file_action_s *flink; /* Supports a singly linked list */ + enum spawn_file_actions_e action; /* SPAWN_FILE_ACTION_CLOSE */ + int fd; /* The file descriptor to close */ +}; + +struct spawn_dup2_file_action_s +{ + FAR struct spawn_general_file_action_s *flink; /* Supports a singly linked list */ + enum spawn_file_actions_e action; /* SPAWN_FILE_ACTION_DUP2 */ + int fd1; /* The first file descriptor for dup2() */ + int fd2; /* The second file descriptor for dup2() */ +}; + +struct spawn_open_file_action_s +{ + FAR struct spawn_general_file_action_s *flink; /* Supports a singly linked list */ + enum spawn_file_actions_e action; /* SPAWN_FILE_ACTION_OPEN */ + int fd; /* The file descriptor after opening */ + int oflags; /* Open flags */ + mode_t mode; /* File creation mode */ + char path[1]; /* Start of the path to be + * opened */ +}; + +#define SIZEOF_OPEN_FILE_ACTION_S(n) \ + (sizeof(struct spawn_open_file_action_s) + (n)) + +/**************************************************************************** + * Public Function Prototypes + ****************************************************************************/ + +#ifdef __cplusplus +extern "C" +{ +#endif + +void add_file_action(FAR posix_spawn_file_actions_t *file_action, + FAR struct spawn_general_file_action_s *entry); + +#ifdef __cplusplus +} +#endif + +#endif /* __LIBC_SPAWN_SPAWN_H */ From 5ac907eb398c40e4aaecf788d6c9e473eac051a0 Mon Sep 17 00:00:00 2001 From: patacongo Date: Thu, 10 Jan 2013 00:45:11 +0000 Subject: [PATCH 054/118] Add spawn attribute logic which will eventually be needed to support posix_spawn() git-svn-id: http://svn.code.sf.net/p/nuttx/code/trunk@5501 42af7a65-404d-4744-a932-0658087f49c3 --- nuttx/Documentation/NuttX.html | 14 +-- nuttx/README.txt | 12 +-- nuttx/configs/stm32f4discovery/README.txt | 4 +- nuttx/include/spawn.h | 37 ++++++-- nuttx/libc/spawn/Make.defs | 5 ++ nuttx/libc/spawn/lib_psa_getflags.c | 72 +++++++++++++++ nuttx/libc/spawn/lib_psa_getschedparam.c | 74 ++++++++++++++++ nuttx/libc/spawn/lib_psa_getschedpolicy.c | 73 ++++++++++++++++ nuttx/libc/spawn/lib_psa_getsigdefault.c | 74 ++++++++++++++++ nuttx/libc/spawn/lib_psa_getsigmask.c | 74 ++++++++++++++++ nuttx/libc/spawn/lib_psa_init.c | 102 ++++++++++++++++++++++ nuttx/libc/spawn/lib_psa_setflags.c | 71 +++++++++++++++ nuttx/libc/spawn/lib_psa_setschedparam.c | 74 ++++++++++++++++ nuttx/libc/spawn/lib_psa_setschedpolicy.c | 72 +++++++++++++++ nuttx/libc/spawn/lib_psa_setsigdefault.c | 74 ++++++++++++++++ nuttx/libc/spawn/lib_psa_setsigmask.c | 74 ++++++++++++++++ nuttx/libc/spawn/lib_psfa_addclose.c | 4 +- nuttx/libc/spawn/lib_psfa_adddup2.c | 4 +- nuttx/libc/spawn/lib_psfa_init.c | 2 +- 19 files changed, 891 insertions(+), 25 deletions(-) create mode 100644 nuttx/libc/spawn/lib_psa_getflags.c create mode 100644 nuttx/libc/spawn/lib_psa_getschedparam.c create mode 100644 nuttx/libc/spawn/lib_psa_getschedpolicy.c create mode 100644 nuttx/libc/spawn/lib_psa_getsigdefault.c create mode 100644 nuttx/libc/spawn/lib_psa_getsigmask.c create mode 100644 nuttx/libc/spawn/lib_psa_init.c create mode 100644 nuttx/libc/spawn/lib_psa_setflags.c create mode 100644 nuttx/libc/spawn/lib_psa_setschedparam.c create mode 100644 nuttx/libc/spawn/lib_psa_setschedpolicy.c create mode 100644 nuttx/libc/spawn/lib_psa_setsigdefault.c create mode 100644 nuttx/libc/spawn/lib_psa_setsigmask.c diff --git a/nuttx/Documentation/NuttX.html b/nuttx/Documentation/NuttX.html index 21f732c970..f6e9a41bae 100644 --- a/nuttx/Documentation/NuttX.html +++ b/nuttx/Documentation/NuttX.html @@ -1239,8 +1239,8 @@ svn checkout -r5447 http://svn.code.sf.net/p/nuttx/code/trunk nuttx-code
        • New top-level Makefiles: Makefile.unix and Makefile.win (along with numerous changes to other make-related files). - This adds basic support for building NuttX natively under Windows from a CMD.exe window (rather than in a POSIX-like environment). - This build: (1) Uses all Windows style paths, (2) Uses primarily Windows batch commands from CMD.exe, with (3) a few extensions from GNUWin32. + This adds basic support for building NuttX natively under from Windows console (rather than in a POSIX-like environment). + This build: (1) Uses all Windows style paths, (2) Uses primarily standard Windows batch commands with (3) a few additional commands from GNUWin32 (such as GNU make).

          This capability should still be considered a work in progress because: (1) It has not been verfied on all targets and tools, and (2) it still lacks some of the creature-comforts of the more mature environments (like a functional configure.sh script and make menuconfig support). @@ -3202,7 +3202,7 @@ avr, m68k, m68hc11, m68hc12, m9s12, blackfin, m32c, h8, and SuperH ports.

        • - Build support has been added to support building natively in a Windes CMD.exe rather than in a POSIX-like environment. + Build support has been added to support building natively in a Windows console rather than in a POSIX-like environment.

          This build: @@ -3221,10 +3221,10 @@ avr, m68k, m68hc11, m68hc12, m9s12, blackfin, m32c, h8, and SuperH ports.

          • - CMD.exe Shell. - The build must be performed in a Windows CMD.execmd shell that comes with Windows. - I prefer the ConEmu command shell which can be downloaded from: + Windows Console. + The build must be performed in a Windows console window. + This may be using the standard CMD.exe terminal that comes with Windows. + I prefer the ConEmu terminal which can be downloaded from: http://code.google.com/p/conemu-maximus5/
          • diff --git a/nuttx/README.txt b/nuttx/README.txt index 23d0e1a81e..2ff473fa0e 100644 --- a/nuttx/README.txt +++ b/nuttx/README.txt @@ -421,7 +421,7 @@ NuttX Configuration Tool under DOS ---------------------------------- Recent versions of NuttX support building NuttX from a native Windows - CMD.exe shell (see "Native Windows Build" below). But kconfig-frontends + console window (see "Native Windows Build" below). But kconfig-frontends is a Linux tool. There have been some successes building a Windows native version of the kconfig-frontends tool, but that is not ready for prime time. @@ -440,8 +440,8 @@ NuttX Configuration Tool under DOS restore CONFIG_WINDOWS_NATIVE=y and the correct CONFIG_APPS_DIR. 2) You can, with some effort, run the the Cygwin kconfig-mconf tool - directly in the CMD.exe shell. In this case, you do not have to - modify the .config file, but there are other complexities: + directly in the Windows console window. In this case, you do not + have to modify the .config file, but there are other complexities: a. You need to temporarily set the Cgywin directories in the PATH variable then run kconfig-mconf manually like: @@ -454,7 +454,7 @@ NuttX Configuration Tool under DOS tools/kconfig menuconfig b. There is an issue with accessing DOS environment variables from - the Cygwin kconfig-mconf running in the CMD.exe shell. The + the Cygwin kconfig-mconf running in the Windows console. The following change to the top-level Kconfig file seems to work around these problems: @@ -680,8 +680,8 @@ Native Windows Build - A few extensions from GNUWin32 In this build, you cannot use a Cygwin or MSYS shell. Rather the build must - be performed in a Windows CMD shell. Here is a better shell than than the - standard issue, CMD shell: ConEmu which can be downloaded from: + be performed in a Windows console window. Here is a better terminal than the + standard issue, CMD.exe terminal: ConEmu which can be downloaded from: http://code.google.com/p/conemu-maximus5/ Build Tools. The build still relies on some Unix-like commands. I use diff --git a/nuttx/configs/stm32f4discovery/README.txt b/nuttx/configs/stm32f4discovery/README.txt index ef61b05e60..c1d484279a 100644 --- a/nuttx/configs/stm32f4discovery/README.txt +++ b/nuttx/configs/stm32f4discovery/README.txt @@ -1468,8 +1468,8 @@ Where is one of the following: - A few extensions from GNUWin32 (or MSYS is you prefer) In this build, you cannot use a Cygwin or MSYS shell. Rather the build must - be performed in a Windows CMD shell. Here is a better shell than than the - standard issue, CMD shell: ConEmu which can be downloaded from: + be performed in a Windows console. Here is a better shell than than the + standard issue, CMD.exe shell: ConEmu which can be downloaded from: http://code.google.com/p/conemu-maximus5/ CONFIG_HOST_WINDOWS=y : Windows diff --git a/nuttx/include/spawn.h b/nuttx/include/spawn.h index d453fb5823..24b68585e8 100644 --- a/nuttx/include/spawn.h +++ b/nuttx/include/spawn.h @@ -43,7 +43,10 @@ #include #include + +#include #include +#include /**************************************************************************** * Pre-processor Definitions @@ -65,14 +68,18 @@ ****************************************************************************/ /* "The spawn.h header shall define the posix_spawnattr_t and * posix_spawn_file_actions_t types used in performing spawn operations. + * + * The internal structure underlying the posix_spawnattr_t is exposed here + * because the user will be required to allocate this memory. */ struct posix_spawnattr_s { uint8_t flags; uint8_t priority; - pid_t group; - sigset_t sigset; + uint8_t policy; + sigset_t sigdefault; + sigset_t sigmask; }; typedef struct posix_spawnattr_s posix_spawnattr_t; @@ -99,6 +106,8 @@ extern "C" { #endif +/* posix_spawn[p] interfaces ************************************************/ + int posix_spawn(FAR pid_t *, FAR const char *, FAR const posix_spawn_file_actions_t *, FAR const posix_spawnattr_t *, FAR char *const [], FAR char *const []); @@ -106,9 +115,14 @@ int posix_spawnp(FAR pid_t *, FAR const char *, FAR const posix_spawn_file_actions_t *, FAR const posix_spawnattr_t *, FAR char *const [], FAR char *const []); +/* File action interfaces ***************************************************/ +/* File action initialization and destruction */ + int posix_spawn_file_actions_init(FAR posix_spawn_file_actions_t *); int posix_spawn_file_actions_destroy(FAR posix_spawn_file_actions_t *); +/* Add file action interfaces */ + int posix_spawn_file_actions_addclose(FAR posix_spawn_file_actions_t *, int); int posix_spawn_file_actions_adddup2(FAR posix_spawn_file_actions_t *, @@ -116,11 +130,22 @@ int posix_spawn_file_actions_adddup2(FAR posix_spawn_file_actions_t *, int posix_spawn_file_actions_addopen(FAR posix_spawn_file_actions_t *, int, FAR const char *, int, mode_t); +/* Spawn attributes interfaces **********************************************/ +/* Spawn attributes initialization and destruction */ + int posix_spawnattr_init(FAR posix_spawnattr_t *); -int posix_spawnattr_destroy(FAR posix_spawnattr_t *); + +/* int posix_spawnattr_destroy(FAR posix_spawnattr_t *); */ +#ifdef CONFIG_DEBUG +# define posix_spawnattr_destroy(attr) (attr ? 0 : EINVAL) +#else +# define posix_spawnattr_destroy(attr) (0) +#endif + +/* Get spawn attributes interfaces */ int posix_spawnattr_getflags(FAR const posix_spawnattr_t *, FAR short *); -int posix_spawnattr_getpgroup(FAR const posix_spawnattr_t *, FAR pid_t *); +#define posix_spawnattr_getpgroup(attr,group) (ENOSYS) int posix_spawnattr_getschedparam(FAR const posix_spawnattr_t *, FAR struct sched_param *); int posix_spawnattr_getschedpolicy(FAR const posix_spawnattr_t *, @@ -130,8 +155,10 @@ int posix_spawnattr_getsigdefault(FAR const posix_spawnattr_t *, int posix_spawnattr_getsigmask(FAR const posix_spawnattr_t *, FAR sigset_t *); +/* Set spawn attributes interfaces */ + int posix_spawnattr_setflags(FAR posix_spawnattr_t *, short); -int posix_spawnattr_setpgroup(FAR posix_spawnattr_t *, pid_t); +#define posix_spawnattr_setpgroup(attr,group) (ENOSYS) int posix_spawnattr_setschedparam(FAR posix_spawnattr_t *, FAR const struct sched_param *); int posix_spawnattr_setschedpolicy(FAR posix_spawnattr_t *, int); diff --git a/nuttx/libc/spawn/Make.defs b/nuttx/libc/spawn/Make.defs index 0952fda472..4c59b4487d 100644 --- a/nuttx/libc/spawn/Make.defs +++ b/nuttx/libc/spawn/Make.defs @@ -40,6 +40,11 @@ ifeq ($(CONFIG_LIBC_EXECFUNCS),y) CSRCS += lib_psfa_addaction.c lib_psfa_addclose.c lib_psfa_adddup2.c CSRCS += lib_psfa_addopen.c lib_psfa_destroy.c lib_psfa_init.c +CSRCS += lib_psa_getflags.c lib_psa_getschedparam.c lib_psa_getschedpolicy.c +CSRCS += lib_psa_getsigdefault.c lib_psa_getsigmask.c lib_psa_init.c +CSRCS += lib_psa_setflags.c lib_psa_setschedparam.c lib_psa_setschedpolicy.c +CSRCS += lib_psa_setsigdefault.c lib_psa_setsigmask.c + # Add the spawn directory to the build DEPPATH += --dep-path spawn diff --git a/nuttx/libc/spawn/lib_psa_getflags.c b/nuttx/libc/spawn/lib_psa_getflags.c new file mode 100644 index 0000000000..f0e07f0c22 --- /dev/null +++ b/nuttx/libc/spawn/lib_psa_getflags.c @@ -0,0 +1,72 @@ +/**************************************************************************** + * libc/string/lib_psa_getflags.c + * + * Copyright (C) 2013 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * 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. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include +#include + +/**************************************************************************** + * Global Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: posix_spawnattr_getflags + * + * Description: + * The posix_spawnattr_getflags() function will obtain the value of the + * spawn-flags attribute from the attributes object referenced by attr. + * + * Input Parameters: + * attr - The address spawn attributes to be queried. + * flags - The location to return the spawn flags + * + * Returned Value: + * On success, these functions return 0; on failure they return an error + * number from . + * + ****************************************************************************/ + +int posix_spawnattr_getflags(FAR const posix_spawnattr_t *attr, + FAR short *flags) +{ + DEBUGASSERT(attr && flags); + *flags = (short)attr->flags; + return OK; +} diff --git a/nuttx/libc/spawn/lib_psa_getschedparam.c b/nuttx/libc/spawn/lib_psa_getschedparam.c new file mode 100644 index 0000000000..65cec47f14 --- /dev/null +++ b/nuttx/libc/spawn/lib_psa_getschedparam.c @@ -0,0 +1,74 @@ +/**************************************************************************** + * libc/string/lib_psa_getschedparam.c + * + * Copyright (C) 2013 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * 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. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include +#include +#include + +/**************************************************************************** + * Global Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: posix_spawnattr_getschedparam + * + * Description: + * The posix_spawnattr_getschedparam() function will obtain the value of + * the spawn-schedparam attribute from the attributes object referenced + * by attr. + * + * Input Parameters: + * attr - The address spawn attributes to be queried. + * flags - The location to return the sched_priority value. + * + * Returned Value: + * On success, these functions return 0; on failure they return an error + * number from . + * + ****************************************************************************/ + +int posix_spawnattr_getschedparam(FAR const posix_spawnattr_t *attr, + FAR struct sched_param *param) +{ + DEBUGASSERT(attr && param); + param->sched_priority = attr->priority; + return OK; +} diff --git a/nuttx/libc/spawn/lib_psa_getschedpolicy.c b/nuttx/libc/spawn/lib_psa_getschedpolicy.c new file mode 100644 index 0000000000..8f36456664 --- /dev/null +++ b/nuttx/libc/spawn/lib_psa_getschedpolicy.c @@ -0,0 +1,73 @@ +/**************************************************************************** + * libc/string/lib_psa_getschedpolicy.c + * + * Copyright (C) 2013 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * 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. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include +#include + +/**************************************************************************** + * Global Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: posix_spawnattr_getschedpolicy + * + * Description: + * The posix_spawnattr_getschedpolicy() function shall obtain the value + * of the spawn-schedpolicy attribute from the attributes object referenced + * by attr. + * + * Input Parameters: + * attr - The address spawn attributes to be queried. + * policy - The location to return the scheduler policy + * + * Returned Value: + * On success, these functions return 0; on failure they return an error + * number from . + * + ****************************************************************************/ + +int posix_spawnattr_getschedpolicy(FAR const posix_spawnattr_t *attr, + FAR int *policy) +{ + DEBUGASSERT(attr && policy); + *policy = (int)attr->policy; + return OK; +} diff --git a/nuttx/libc/spawn/lib_psa_getsigdefault.c b/nuttx/libc/spawn/lib_psa_getsigdefault.c new file mode 100644 index 0000000000..73ebcc7370 --- /dev/null +++ b/nuttx/libc/spawn/lib_psa_getsigdefault.c @@ -0,0 +1,74 @@ +/**************************************************************************** + * libc/string/lib_psa_getsigdefault.c + * + * Copyright (C) 2013 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * 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. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include +#include +#include + +/**************************************************************************** + * Global Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: posix_spawnattr_getsigdefault + * + * Description: + * The posix_spawnattr_getsigdefault() function will obtain the value of + * the spawn-sigdefault attribute from the attributes object referenced + * by attr. + * + * Input Parameters: + * attr - The address spawn attributes to be queried. + * sigdefault - The location to return the signal set + * + * Returned Value: + * On success, these functions return 0; on failure they return an error + * number from . + * + ****************************************************************************/ + +int posix_spawnattr_getsigdefault(FAR const posix_spawnattr_t *attr, + FAR sigset_t *sigdefault) +{ + DEBUGASSERT(attr && sigdefault); + *sigdefault = attr->sigdefault; + return OK; +} diff --git a/nuttx/libc/spawn/lib_psa_getsigmask.c b/nuttx/libc/spawn/lib_psa_getsigmask.c new file mode 100644 index 0000000000..4ab383e762 --- /dev/null +++ b/nuttx/libc/spawn/lib_psa_getsigmask.c @@ -0,0 +1,74 @@ +/**************************************************************************** + * libc/string/lib_psa_getsigmask.c + * + * Copyright (C) 2013 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * 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. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include +#include +#include + +/**************************************************************************** + * Global Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: posix_spawnattr_getsigmask + * + * Description: + * The posix_spawnattr_getsigdefault() function will obtain the value of + * the spawn-sigmask attribute from the attributes object referenced + * by attr. + * + * Input Parameters: + * attr - The address spawn attributes to be queried. + * sigmask - The location to return the spawn flags + * + * Returned Value: + * On success, these functions return 0; on failure they return an error + * number from . + * + ****************************************************************************/ + +int posix_spawnattr_getsigmask(FAR const posix_spawnattr_t *attr, + FAR sigset_t *sigmask) +{ + DEBUGASSERT(attr && sigmask); + *sigmask = attr->sigmask; + return OK; +} diff --git a/nuttx/libc/spawn/lib_psa_init.c b/nuttx/libc/spawn/lib_psa_init.c new file mode 100644 index 0000000000..95f9dad336 --- /dev/null +++ b/nuttx/libc/spawn/lib_psa_init.c @@ -0,0 +1,102 @@ +/**************************************************************************** + * libc/string/lib_psa_init.c + * + * Copyright (C) 2013 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * 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. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include +#include +#include +#include +#include +#include + +/**************************************************************************** + * Global Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: posix_spawnattr_init + * + * Description: + * The posix_spawnattr_init() function initializes the object referenced + * by attr, to an empty set of spawn attributes for subsequent use in a + * call to posix_spawn() or posix_spawnp(). + * + * Input Parameters: + * attr - The address spawn attributes to be initialized. + * + * Returned Value: + * On success, these functions return 0; on failure they return an error + * number from . + * + ****************************************************************************/ + +int posix_spawnattr_init(posix_spawnattr_t *attr) +{ + struct sched_param param; + int ret; + + DEBUGASSERT(attr); + + /* Flags: None */ + + attr->flags = 0; + + /* Signal sets. Don't really matter unless flags are set (then the settings + * are not really our responsibility). + */ + + sigemptyset(&attr->sigdefault); + sigemptyset(&attr->sigmask); + + /* Set the default scheduler policy to the policy of this task */ + + attr->policy = sched_getscheduler(0); + + /* Set the default priority to the same priority as this task */ + + ret = sched_getparam(0, ¶m); + if (ret < 0) + { + return errno; + } + + attr->priority = param.sched_priority; + return OK; +} diff --git a/nuttx/libc/spawn/lib_psa_setflags.c b/nuttx/libc/spawn/lib_psa_setflags.c new file mode 100644 index 0000000000..34b71d841c --- /dev/null +++ b/nuttx/libc/spawn/lib_psa_setflags.c @@ -0,0 +1,71 @@ +/**************************************************************************** + * libc/string/lib_psa_setflags.c + * + * Copyright (C) 2013 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * 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. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include +#include + +/**************************************************************************** + * Global Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: posix_spawnattr_setflags + * + * Description: + * The posix_spawnattr_setflags() function will set the spawn-flags + * attribute in an initialized attributes object referenced by attr. + * + * Input Parameters: + * attr - The address spawn attributes to be used. + * flags - The new value of the spawn flags + * + * Returned Value: + * On success, these functions return 0; on failure they return an error + * number from . + * + ****************************************************************************/ + +int posix_spawnattr_setflags(FAR posix_spawnattr_t *attr, short flags) +{ + DEBUGASSERT(attr && (flags & ~0xff) == 0); + attr->flags = (uint8_t)flags; + return OK; +} diff --git a/nuttx/libc/spawn/lib_psa_setschedparam.c b/nuttx/libc/spawn/lib_psa_setschedparam.c new file mode 100644 index 0000000000..8d3356aafd --- /dev/null +++ b/nuttx/libc/spawn/lib_psa_setschedparam.c @@ -0,0 +1,74 @@ +/**************************************************************************** + * libc/string/lib_psa_setschedparam.c + * + * Copyright (C) 2013 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * 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. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include +#include +#include + +/**************************************************************************** + * Global Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: posix_spawnattr_setschedparam + * + * Description: + * The posix_spawnattr_setschedparam() function shall set the spawn- + * schedparam attribute in an initialized attributes object referenced + * by attr. + * + * Input Parameters: + * attr - The address spawn attributes to be used. + * parm - The new sched_priority to set. + * + * Returned Value: + * On success, these functions return 0; on failure they return an error + * number from . + * + ****************************************************************************/ + +int posix_spawnattr_setschedparam(FAR posix_spawnattr_t *attr, + FAR const struct sched_param *param) +{ + DEBUGASSERT(attr && param && (unsigned)param->sched_priority <= 0xff); + attr->priority = (uint8_t)param->sched_priority; + return OK; +} diff --git a/nuttx/libc/spawn/lib_psa_setschedpolicy.c b/nuttx/libc/spawn/lib_psa_setschedpolicy.c new file mode 100644 index 0000000000..136a6f0fdb --- /dev/null +++ b/nuttx/libc/spawn/lib_psa_setschedpolicy.c @@ -0,0 +1,72 @@ +/**************************************************************************** + * libc/string/lib_psa_setschedpolicy.c + * + * Copyright (C) 2013 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * 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. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include +#include + +/**************************************************************************** + * Global Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: posix_spawnattr_setschedpolicy + * + * Description: + * The posix_spawnattr_setschedpolicy() function will set the spawn- + * schedpolicy attribute in an initialized attributes object referenced + * by attr. + * + * Input Parameters: + * attr - The address spawn attributes to be used. + * flags - The new value of the spawn flags + * + * Returned Value: + * On success, these functions return 0; on failure they return an error + * number from . + * + ****************************************************************************/ + +int posix_spawnattr_setschedpolicy(FAR posix_spawnattr_t *attr, int policy) +{ + DEBUGASSERT(attr && (policy == SCHED_FIFO || policy == SCHED_RR)); + attr->policy = (uint8_t)policy; + return OK; +} diff --git a/nuttx/libc/spawn/lib_psa_setsigdefault.c b/nuttx/libc/spawn/lib_psa_setsigdefault.c new file mode 100644 index 0000000000..c927c66959 --- /dev/null +++ b/nuttx/libc/spawn/lib_psa_setsigdefault.c @@ -0,0 +1,74 @@ +/**************************************************************************** + * libc/string/lib_psa_setsigdefault.c + * + * Copyright (C) 2013 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * 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. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include +#include +#include + +/**************************************************************************** + * Global Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: posix_spawnattr_setsigdefault + * + * Description: + * The posix_spawnattr_setsigdefault() function will set the spawn- + * sigdefault attribute in an initialized attributes object referenced + * by attr. + * + * Input Parameters: + * attr - The address spawn attributes to be used. + * flags - The new value of the default signal set + * + * Returned Value: + * On success, these functions return 0; on failure they return an error + * number from . + * + ****************************************************************************/ + +int posix_spawnattr_setsigdefault(FAR posix_spawnattr_t *attr, + FAR const sigset_t *sigdefault) +{ + DEBUGASSERT(attr && sigdefault); + attr->sigdefault = *sigdefault; + return OK; +} diff --git a/nuttx/libc/spawn/lib_psa_setsigmask.c b/nuttx/libc/spawn/lib_psa_setsigmask.c new file mode 100644 index 0000000000..d3ddff4e30 --- /dev/null +++ b/nuttx/libc/spawn/lib_psa_setsigmask.c @@ -0,0 +1,74 @@ +/**************************************************************************** + * libc/string/lib_psa_setsigmask.c + * + * Copyright (C) 2013 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * 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. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include +#include +#include + +/**************************************************************************** + * Global Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: posix_spawnattr_setsigmask + * + * Description: + * The posix_spawnattr_setsigmask() function will set the spawn- + * sigmask attribute in an initialized attributes object referenced + * by attr. + * + * Input Parameters: + * attr - The address spawn attributes to be used. + * flags - The new value of the default signal set + * + * Returned Value: + * On success, these functions return 0; on failure they return an error + * number from . + * + ****************************************************************************/ + +int posix_spawnattr_setsigmask(FAR posix_spawnattr_t *attr, + FAR const sigset_t *sigmask) +{ + DEBUGASSERT(attr && sigmask); + attr->sigmask = *sigmask; + return OK; +} diff --git a/nuttx/libc/spawn/lib_psfa_addclose.c b/nuttx/libc/spawn/lib_psfa_addclose.c index 225885cb1a..bf22a153a8 100644 --- a/nuttx/libc/spawn/lib_psfa_addclose.c +++ b/nuttx/libc/spawn/lib_psfa_addclose.c @@ -56,8 +56,8 @@ * Description: * The posix_spawn_file_actions_addclose() function adds a close operation * to the list of operations associated with the object referenced by - * file_actions, for subsequent use in a call to posix_spawn(2) or - * posix_spawnp(2). The descriptor referred to by fd is closed as if + * file_actions, for subsequent use in a call to posix_spawn() or + * posix_spawnp(). The descriptor referred to by fd is closed as if * close() had been called on it prior to the new child process starting * execution. * diff --git a/nuttx/libc/spawn/lib_psfa_adddup2.c b/nuttx/libc/spawn/lib_psfa_adddup2.c index 966f456aff..fc788a4e9d 100644 --- a/nuttx/libc/spawn/lib_psfa_adddup2.c +++ b/nuttx/libc/spawn/lib_psfa_adddup2.c @@ -56,8 +56,8 @@ * Description: * The posix_spawn_file_actions_adddup2() function adds a dup2 operation to * the list of operations associated with the object referenced by - * file_actions, for subsequent use in a call to posix_spawn(2) or - * posix_spawnp(2). The descriptor referred to by fd2 is created as + * file_actions, for subsequent use in a call to posix_spawn() or + * posix_spawnp(). The descriptor referred to by fd2 is created as * if dup2() had been called on fd1 prior to the new child process * starting execution. * diff --git a/nuttx/libc/spawn/lib_psfa_init.c b/nuttx/libc/spawn/lib_psfa_init.c index 860045b52f..cb638d6e7b 100644 --- a/nuttx/libc/spawn/lib_psfa_init.c +++ b/nuttx/libc/spawn/lib_psfa_init.c @@ -51,7 +51,7 @@ * Description: * The posix_spawn_file_actions_init() function initializes the object * referenced by file_actions, to an empty set of file actions for - * subsequent use in a call to posix_spawn(2) or posix_spawnp(2). + * subsequent use in a call to posix_spawn() or posix_spawnp(). * * Input Parameters: * file_actions - The address of the posix_spawn_file_actions_t to be From 35c5bb8e0f177643ec8d182d5a8fe2a813a3a2ad Mon Sep 17 00:00:00 2001 From: patacongo Date: Thu, 10 Jan 2013 14:07:30 +0000 Subject: [PATCH 055/118] Fix rounding in clock_time2ticks(). From Mike Smith. git-svn-id: http://svn.code.sf.net/p/nuttx/code/trunk@5502 42af7a65-404d-4744-a932-0658087f49c3 --- nuttx/ChangeLog | 2 ++ nuttx/sched/clock_time2ticks.c | 42 ++++++++++++++++++++++++++++++---- 2 files changed, 40 insertions(+), 4 deletions(-) diff --git a/nuttx/ChangeLog b/nuttx/ChangeLog index 3d124073b8..758e8c862e 100644 --- a/nuttx/ChangeLog +++ b/nuttx/ChangeLog @@ -3897,4 +3897,6 @@ arch/arm/src/lm so that is can support other members of the Stellaris family. * libc/spawn: Add file action interfaces needed by posix_spawn(). + * sched/clock_time2ticks.c: Another case where time was being + rounded down instead of up (from Mikek Smith). diff --git a/nuttx/sched/clock_time2ticks.c b/nuttx/sched/clock_time2ticks.c index 383264d513..012f4e4f1a 100644 --- a/nuttx/sched/clock_time2ticks.c +++ b/nuttx/sched/clock_time2ticks.c @@ -89,14 +89,48 @@ int clock_time2ticks(FAR const struct timespec *reltime, FAR int *ticks) { +#ifdef CONFIG_HAVE_LONG_LONG + int64_t relnsec; + + /* Convert the relative time into nanoseconds. The range of the int64_t is + * sufficiently large that there is no real need for range checking. + */ + + relnsec = (int64_t)reltime->tv_sec * NSEC_PER_SEC + + (int64_t)reltime->tv_nsec; + + /* Convert nanoseconds to clock ticks, rounding up to the smallest integer + * that is greater than or equal to the exact number of tick. + */ + + *ticks = (int)((relnsec + NSEC_PER_TICK - 1) / NSEC_PER_TICK); + return OK; +#else int32_t relusec; - /* Convert the relative time into microseconds.*/ + /* This function uses an int32_t to only the relative time in microseconds. + * that means that the maximum supported relative time is 2,147,487.647 + * seconds + */ - relusec = reltime->tv_sec * USEC_PER_SEC + reltime->tv_nsec / NSEC_PER_USEC; +#if 0 // overkill + DEBUGASSERT(reltime->tv_sec < 2147487 || + reltime->tv_sec == 2147487 && + reltime->tv_nsec <= 647 * NSEC_PER_MSEC); +#endif - /* Convert microseconds to clock ticks */ + /* Convert the relative time into microseconds, rounding up to the smallest + * value that is greater than or equal to the exact number of microseconds. + */ - *ticks = relusec / USEC_PER_TICK; + relusec = reltime->tv_sec * USEC_PER_SEC + + (reltime->tv_nsec + NSEC_PER_USEC - 1) / NSEC_PER_USEC; + + /* Convert microseconds to clock ticks, rounding up to the smallest integer + * that is greater than or equal to the exact number of tick. + */ + + *ticks = (int)((relusec + USEC_PER_TICK - 1) / USEC_PER_TICK); return OK; +#endif } From 91cfebc978d02d83323ce3f95e02d819c5eded0e Mon Sep 17 00:00:00 2001 From: patacongo Date: Thu, 10 Jan 2013 15:26:09 +0000 Subject: [PATCH 056/118] Removed posix_spawn signal masks - they cannot be supported in NuttX; Add skeleton for posix_spawn proposer - still incomplete git-svn-id: http://svn.code.sf.net/p/nuttx/code/trunk@5503 42af7a65-404d-4744-a932-0658087f49c3 --- nuttx/ChangeLog | 2 +- nuttx/include/spawn.h | 84 ++++++------ nuttx/libc/spawn/Make.defs | 7 +- nuttx/libc/spawn/lib_ps.c | 158 +++++++++++++++++++++++ nuttx/libc/spawn/lib_psa_getsigdefault.c | 74 ----------- nuttx/libc/spawn/lib_psa_getsigmask.c | 74 ----------- nuttx/libc/spawn/lib_psa_init.c | 8 -- nuttx/libc/spawn/lib_psa_setsigdefault.c | 74 ----------- nuttx/libc/spawn/lib_psa_setsigmask.c | 74 ----------- 9 files changed, 205 insertions(+), 350 deletions(-) create mode 100644 nuttx/libc/spawn/lib_ps.c delete mode 100644 nuttx/libc/spawn/lib_psa_getsigdefault.c delete mode 100644 nuttx/libc/spawn/lib_psa_getsigmask.c delete mode 100644 nuttx/libc/spawn/lib_psa_setsigdefault.c delete mode 100644 nuttx/libc/spawn/lib_psa_setsigmask.c diff --git a/nuttx/ChangeLog b/nuttx/ChangeLog index 758e8c862e..92fbb56df8 100644 --- a/nuttx/ChangeLog +++ b/nuttx/ChangeLog @@ -3898,5 +3898,5 @@ Stellaris family. * libc/spawn: Add file action interfaces needed by posix_spawn(). * sched/clock_time2ticks.c: Another case where time was being - rounded down instead of up (from Mikek Smith). + rounded down instead of up (from Mike Smith). diff --git a/nuttx/include/spawn.h b/nuttx/include/spawn.h index 24b68585e8..91092eeb01 100644 --- a/nuttx/include/spawn.h +++ b/nuttx/include/spawn.h @@ -1,7 +1,7 @@ /**************************************************************************** * include/spawn.h * - * Copyright (C) 2012 Gregory Nutt. All rights reserved. + * Copyright (C) 2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -45,7 +45,6 @@ #include #include -#include #include /**************************************************************************** @@ -56,12 +55,12 @@ * posix_spawnattr_t object using the posix_spawnattr_setflags() function:" */ -#define POSIX_SPAWN_RESETIDS (1 << 0) -#define POSIX_SPAWN_SETPGROUP (1 << 1) -#define POSIX_SPAWN_SETSCHEDPARAM (1 << 2) -#define POSIX_SPAWN_SETSCHEDULER (1 << 3) -#define POSIX_SPAWN_SETSIGDEF (1 << 4) -#define POSIX_SPAWN_SETSIGMASK (1 << 5) +#define POSIX_SPAWN_RESETIDS (1 << 0) /* 1: Reset effective user ID */ +#define POSIX_SPAWN_SETPGROUP (1 << 1) /* 1: Set process group */ +#define POSIX_SPAWN_SETSCHEDPARAM (1 << 2) /* 1: Set task's priority */ +#define POSIX_SPAWN_SETSCHEDULER (1 << 3) /* 1: Set task's scheduler policy */ +#define POSIX_SPAWN_SETSIGDEF (1 << 4) /* 1: Set default signal actions */ +#define POSIX_SPAWN_SETSIGMASK (1 << 5) /* 1: Set sigmask *./ /**************************************************************************** * Type Definitions @@ -78,8 +77,6 @@ struct posix_spawnattr_s uint8_t flags; uint8_t priority; uint8_t policy; - sigset_t sigdefault; - sigset_t sigmask; }; typedef struct posix_spawnattr_s posix_spawnattr_t; @@ -108,32 +105,39 @@ extern "C" /* posix_spawn[p] interfaces ************************************************/ -int posix_spawn(FAR pid_t *, FAR const char *, - FAR const posix_spawn_file_actions_t *, FAR const posix_spawnattr_t *, - FAR char *const [], FAR char *const []); -int posix_spawnp(FAR pid_t *, FAR const char *, - FAR const posix_spawn_file_actions_t *, FAR const posix_spawnattr_t *, - FAR char *const [], FAR char *const []); +#ifdef CONFIG_BINFMT_EXEPATH +int posix_spawnp(FAR pid_t *pid, FAR const char *path, + FAR const posix_spawn_file_actions_t *file_actions, + FAR const posix_spawnattr_t * attr, + FAR char *const argv[], FAR char *const envp[]); +#define posix_spawn(pid,path,file_actions,attr,argv,envp) \ + posix_spawnp(pid,path,file_actions,attr,argv,envp) +#else +int posix_spawn(FAR pid_t *pid, FAR const char *path, + FAR const posix_spawn_file_actions_t *file_actions, + FAR const posix_spawnattr_t *attr, + FAR char *const argv[], FAR char *const envp[]); +#endif /* File action interfaces ***************************************************/ /* File action initialization and destruction */ -int posix_spawn_file_actions_init(FAR posix_spawn_file_actions_t *); -int posix_spawn_file_actions_destroy(FAR posix_spawn_file_actions_t *); +int posix_spawn_file_actions_init(FAR posix_spawn_file_actions_t *file_actions); +int posix_spawn_file_actions_destroy(FAR posix_spawn_file_actions_t *file_actions); /* Add file action interfaces */ -int posix_spawn_file_actions_addclose(FAR posix_spawn_file_actions_t *, - int); -int posix_spawn_file_actions_adddup2(FAR posix_spawn_file_actions_t *, - int, int); -int posix_spawn_file_actions_addopen(FAR posix_spawn_file_actions_t *, - int, FAR const char *, int, mode_t); +int posix_spawn_file_actions_addclose(FAR posix_spawn_file_actions_t *file_actions, + int fd); +int posix_spawn_file_actions_adddup2(FAR posix_spawn_file_actions_t *file_actions, + int fd1, int fd2); +int posix_spawn_file_actions_addopen(FAR posix_spawn_file_actions_t *file_actions, + int fd, FAR const char *path, int oflags, mode_t mode); /* Spawn attributes interfaces **********************************************/ /* Spawn attributes initialization and destruction */ -int posix_spawnattr_init(FAR posix_spawnattr_t *); +int posix_spawnattr_init(FAR posix_spawnattr_t *attr); /* int posix_spawnattr_destroy(FAR posix_spawnattr_t *); */ #ifdef CONFIG_DEBUG @@ -144,28 +148,24 @@ int posix_spawnattr_init(FAR posix_spawnattr_t *); /* Get spawn attributes interfaces */ -int posix_spawnattr_getflags(FAR const posix_spawnattr_t *, FAR short *); +int posix_spawnattr_getflags(FAR const posix_spawnattr_t *attr, FAR short *flags); #define posix_spawnattr_getpgroup(attr,group) (ENOSYS) -int posix_spawnattr_getschedparam(FAR const posix_spawnattr_t *, - FAR struct sched_param *); -int posix_spawnattr_getschedpolicy(FAR const posix_spawnattr_t *, - FAR int *); -int posix_spawnattr_getsigdefault(FAR const posix_spawnattr_t *, - FAR sigset_t *); -int posix_spawnattr_getsigmask(FAR const posix_spawnattr_t *, - FAR sigset_t *); +int posix_spawnattr_getschedparam(FAR const posix_spawnattr_t *attr, + FAR struct sched_param *param); +int posix_spawnattr_getschedpolicy(FAR const posix_spawnattr_t *attr, + FAR int *policy); +#define posix_spawnattr_getsigdefault(attr,sigdefault) (ENOSYS) +#define posix_spawnattr_getsigmask(attr,sigmask) (ENOSYS) /* Set spawn attributes interfaces */ -int posix_spawnattr_setflags(FAR posix_spawnattr_t *, short); +int posix_spawnattr_setflags(FAR posix_spawnattr_t *attr, short flags); #define posix_spawnattr_setpgroup(attr,group) (ENOSYS) -int posix_spawnattr_setschedparam(FAR posix_spawnattr_t *, - FAR const struct sched_param *); -int posix_spawnattr_setschedpolicy(FAR posix_spawnattr_t *, int); -int posix_spawnattr_setsigdefault(FAR posix_spawnattr_t *, - FAR const sigset_t *); -int posix_spawnattr_setsigmask(FAR posix_spawnattr_t *, - FAR const sigset_t *); +int posix_spawnattr_setschedparam(FAR posix_spawnattr_t *attr, + FAR const struct sched_param *param); +int posix_spawnattr_setschedpolicy(FAR posix_spawnattr_t *attr, int policy); +#define posix_spawnattr_setsigdefault(attr,sigdefault) (ENOSYS) +#define posix_spawnattr_setsigmask(attr,sigmask) (ENOSYS) #ifdef __cplusplus } diff --git a/nuttx/libc/spawn/Make.defs b/nuttx/libc/spawn/Make.defs index 4c59b4487d..21bc316fa6 100644 --- a/nuttx/libc/spawn/Make.defs +++ b/nuttx/libc/spawn/Make.defs @@ -37,13 +37,14 @@ ifeq ($(CONFIG_LIBC_EXECFUNCS),y) +CSRCS += lib_ps.c + CSRCS += lib_psfa_addaction.c lib_psfa_addclose.c lib_psfa_adddup2.c CSRCS += lib_psfa_addopen.c lib_psfa_destroy.c lib_psfa_init.c CSRCS += lib_psa_getflags.c lib_psa_getschedparam.c lib_psa_getschedpolicy.c -CSRCS += lib_psa_getsigdefault.c lib_psa_getsigmask.c lib_psa_init.c -CSRCS += lib_psa_setflags.c lib_psa_setschedparam.c lib_psa_setschedpolicy.c -CSRCS += lib_psa_setsigdefault.c lib_psa_setsigmask.c +CSRCS += lib_psa_init.c lib_psa_setflags.c lib_psa_setschedparam.c +CSRCS += lib_psa_setschedpolicy.c # Add the spawn directory to the build diff --git a/nuttx/libc/spawn/lib_ps.c b/nuttx/libc/spawn/lib_ps.c new file mode 100644 index 0000000000..e04ed77ad4 --- /dev/null +++ b/nuttx/libc/spawn/lib_ps.c @@ -0,0 +1,158 @@ +/**************************************************************************** + * libc/string/lib_ps.c + * + * Copyright (C) 2013 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * 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. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include + +/**************************************************************************** + * Global Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: posix_spawn + * + * Description: + * The posix_spawn() and posix_spawnp() functions will create a new, + * child task, constructed a regular executable file. + * + * Input Parameters: + * + * pid - Upon successful completion, posix_spawn() and posix_spawnp() will + * return the task ID of the child task to the parent task, in the + * variable pointed to by a non-NULL 'pid' argument. If the 'pid' + * argument is a null pointer, the process ID of the child is not + * returned to the caller. + * + * path - The 'path' argument to posix_spawn() is the absolute path that + * identifies the file to execute. The 'path' argument to posix_spawnp() + * may also be a relative path and will be used to construct a pathname + * that identifies the file to execute. In the case of a relative path, + * the path prefix for the file will be obtained by a search of the + * directories passed as the environment variable PATH. + * + * NOTE: NuttX provides only one implementation: If + * CONFIG_BINFMT_EXEPATH is defined, then only posix_spawnp() behavior + * is supported; otherwise, only posix_spawn behavior is supported. + * + * file_actions - If 'file_actions' is a null pointer, then file + * descriptors open in the calling process will remain open in the + * child process (unless CONFIG_FDCLONE_STDIO is defined). If + * 'file_actions' is not NULL, then the file descriptors open in the + * child process will be those open in the calling process as modified + * by the spawn file actions object pointed to by file_actions. + * + * attr - If the value of the 'attr' parameter is NULL, the all default + * values for the POSIX spawn attributes will be used. Otherwise, the + * attributes will be set according to the spawn flags. The + * posix_spawnattr_t spawn attributes object type is defined in spawn.h. + * It will contains these attributes, not all of which are supported by + * NuttX: + * + * - POSIX_SPAWN_SETPGROUP: Setting of the new tasks process group is + * not supported. NuttX does not support process groups. + * - POSIX_SPAWN_SETSCHEDPARAM: Set new tasks priority to the sched_param + * value. + * - POSIX_SPAWN_SETSCHEDULER: Set the new tasks scheduler priority to + * the sched_policy value. + * - POSIX_SPAWN_RESETIDS: Resetting of effective user ID of the child + * process is not supported. NuttX does not support effective user + * IDs. + * - POSIX_SPAWN_SETSIGMASK: Setting the initial signal mask of the new + * task is not supported. NuttX does support signal masks, but there + * is no mechanism in place now to do this. + * - POSIX_SPAWN_SETSIGDEF: Resetting signal default actions is not + * supported. NuttX does not support default signal actions. + * + * argv - argv[] is the argument list for the new task. argv[] is an + * array of pointers to null-terminated strings. The list is terminated + * with a null pointer. The value in argv[0] should point to a filename + * that is associated with the process image being started by the + * posix_spawn() or posix_spawnp() functions. + * + * envp - The envp[] argument is not used by NuttX and may be NULL. In + * standard implementations, envp[] is an array of character pointers to + * null-terminated strings that provide the environment for the new + * process image. The environment array is terminated by a null pointer. + * In NuttX, the envp[] argument is ignored and the new task will simply + * inherit the environment of the parent task. + * + * Returned Value: + * posix_spawn() and posix_spawnp() will return zero on success. + * Otherwise, an error number will be returned as the function return + * value to indicate the error: + * + * - EINVAL: The value specified by 'file_actions' or 'attr' is invalid. + * - Any errors that might have been return if vfork() and excec[l|v]() + * had been called. + * + * Assumptions/Limitations: + * - NuttX provides only posix_spawn() or posix_spawnp() behavior + * depending upon the setting of CONFIG_BINFMT_EXEPATH: If + * CONFIG_BINFMT_EXEPATH is defined, then only posix_spawnp() behavior + * is supported; otherwise, only posix_spawn behavior is supported. + * - The 'envp' argument is not used and the 'environ' variable is not + * altered (NuttX does not support the 'environ' variable. + * - Process groups are not supported (POSIX_SPAWN_SETPGROUP). + * - Effective user IDs are not supported (POSIX_SPAWN_RESETIDS). + * - Signal masks and signal default actions cannot be modified in the + * newly executed task (POSIX_SPAWN_SETSIGDEF and POSIX_SPAWN_SETSIGMASK). + * + * POSIX Compatibility + * - The value of the argv[0] received by the child task is assigned by + * NuttX. For the caller of posix_spawn(), the provided argv[0] will + * correspond to argv[1] received by the new task. + * + ****************************************************************************/ + +#ifdef CONFIG_BINFMT_EXEPATH +int posix_spawnp(FAR pid_t *pid, FAR const char *path, + FAR const posix_spawn_file_actions_t *file_actions, + FAR const posix_spawnattr_t *attr, + FAR char *const argv[], FAR char *const envp[]) +#else +int posix_spawn(FAR pid_t *pid, FAR const char *path, + FAR const posix_spawn_file_actions_t *file_actions, + FAR const posix_spawnattr_t *attr, + FAR char *const argv[], FAR char *const envp[]) +#endif +{ +#warning "Missing Logic" + return OK; +} diff --git a/nuttx/libc/spawn/lib_psa_getsigdefault.c b/nuttx/libc/spawn/lib_psa_getsigdefault.c deleted file mode 100644 index 73ebcc7370..0000000000 --- a/nuttx/libc/spawn/lib_psa_getsigdefault.c +++ /dev/null @@ -1,74 +0,0 @@ -/**************************************************************************** - * libc/string/lib_psa_getsigdefault.c - * - * Copyright (C) 2013 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt - * - * 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. - * - ****************************************************************************/ - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include - -#include -#include -#include - -/**************************************************************************** - * Global Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: posix_spawnattr_getsigdefault - * - * Description: - * The posix_spawnattr_getsigdefault() function will obtain the value of - * the spawn-sigdefault attribute from the attributes object referenced - * by attr. - * - * Input Parameters: - * attr - The address spawn attributes to be queried. - * sigdefault - The location to return the signal set - * - * Returned Value: - * On success, these functions return 0; on failure they return an error - * number from . - * - ****************************************************************************/ - -int posix_spawnattr_getsigdefault(FAR const posix_spawnattr_t *attr, - FAR sigset_t *sigdefault) -{ - DEBUGASSERT(attr && sigdefault); - *sigdefault = attr->sigdefault; - return OK; -} diff --git a/nuttx/libc/spawn/lib_psa_getsigmask.c b/nuttx/libc/spawn/lib_psa_getsigmask.c deleted file mode 100644 index 4ab383e762..0000000000 --- a/nuttx/libc/spawn/lib_psa_getsigmask.c +++ /dev/null @@ -1,74 +0,0 @@ -/**************************************************************************** - * libc/string/lib_psa_getsigmask.c - * - * Copyright (C) 2013 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt - * - * 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. - * - ****************************************************************************/ - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include - -#include -#include -#include - -/**************************************************************************** - * Global Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: posix_spawnattr_getsigmask - * - * Description: - * The posix_spawnattr_getsigdefault() function will obtain the value of - * the spawn-sigmask attribute from the attributes object referenced - * by attr. - * - * Input Parameters: - * attr - The address spawn attributes to be queried. - * sigmask - The location to return the spawn flags - * - * Returned Value: - * On success, these functions return 0; on failure they return an error - * number from . - * - ****************************************************************************/ - -int posix_spawnattr_getsigmask(FAR const posix_spawnattr_t *attr, - FAR sigset_t *sigmask) -{ - DEBUGASSERT(attr && sigmask); - *sigmask = attr->sigmask; - return OK; -} diff --git a/nuttx/libc/spawn/lib_psa_init.c b/nuttx/libc/spawn/lib_psa_init.c index 95f9dad336..8aabfd090d 100644 --- a/nuttx/libc/spawn/lib_psa_init.c +++ b/nuttx/libc/spawn/lib_psa_init.c @@ -40,7 +40,6 @@ #include #include -#include #include #include #include @@ -78,13 +77,6 @@ int posix_spawnattr_init(posix_spawnattr_t *attr) attr->flags = 0; - /* Signal sets. Don't really matter unless flags are set (then the settings - * are not really our responsibility). - */ - - sigemptyset(&attr->sigdefault); - sigemptyset(&attr->sigmask); - /* Set the default scheduler policy to the policy of this task */ attr->policy = sched_getscheduler(0); diff --git a/nuttx/libc/spawn/lib_psa_setsigdefault.c b/nuttx/libc/spawn/lib_psa_setsigdefault.c deleted file mode 100644 index c927c66959..0000000000 --- a/nuttx/libc/spawn/lib_psa_setsigdefault.c +++ /dev/null @@ -1,74 +0,0 @@ -/**************************************************************************** - * libc/string/lib_psa_setsigdefault.c - * - * Copyright (C) 2013 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt - * - * 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. - * - ****************************************************************************/ - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include - -#include -#include -#include - -/**************************************************************************** - * Global Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: posix_spawnattr_setsigdefault - * - * Description: - * The posix_spawnattr_setsigdefault() function will set the spawn- - * sigdefault attribute in an initialized attributes object referenced - * by attr. - * - * Input Parameters: - * attr - The address spawn attributes to be used. - * flags - The new value of the default signal set - * - * Returned Value: - * On success, these functions return 0; on failure they return an error - * number from . - * - ****************************************************************************/ - -int posix_spawnattr_setsigdefault(FAR posix_spawnattr_t *attr, - FAR const sigset_t *sigdefault) -{ - DEBUGASSERT(attr && sigdefault); - attr->sigdefault = *sigdefault; - return OK; -} diff --git a/nuttx/libc/spawn/lib_psa_setsigmask.c b/nuttx/libc/spawn/lib_psa_setsigmask.c deleted file mode 100644 index d3ddff4e30..0000000000 --- a/nuttx/libc/spawn/lib_psa_setsigmask.c +++ /dev/null @@ -1,74 +0,0 @@ -/**************************************************************************** - * libc/string/lib_psa_setsigmask.c - * - * Copyright (C) 2013 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt - * - * 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. - * - ****************************************************************************/ - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include - -#include -#include -#include - -/**************************************************************************** - * Global Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: posix_spawnattr_setsigmask - * - * Description: - * The posix_spawnattr_setsigmask() function will set the spawn- - * sigmask attribute in an initialized attributes object referenced - * by attr. - * - * Input Parameters: - * attr - The address spawn attributes to be used. - * flags - The new value of the default signal set - * - * Returned Value: - * On success, these functions return 0; on failure they return an error - * number from . - * - ****************************************************************************/ - -int posix_spawnattr_setsigmask(FAR posix_spawnattr_t *attr, - FAR const sigset_t *sigmask) -{ - DEBUGASSERT(attr && sigmask); - attr->sigmask = *sigmask; - return OK; -} From 322e9d18c7371f9fb27cd57ca894191d564b75c3 Mon Sep 17 00:00:00 2001 From: patacongo Date: Thu, 10 Jan 2013 17:37:29 +0000 Subject: [PATCH 057/118] Completes implementation of posix_spawn. Still untested and undocumented git-svn-id: http://svn.code.sf.net/p/nuttx/code/trunk@5504 42af7a65-404d-4744-a932-0658087f49c3 --- nuttx/ChangeLog | 4 + nuttx/TODO | 13 +- nuttx/drivers/usbdev/pl2303.c | 20 +- nuttx/libc/Kconfig | 8 + nuttx/libc/spawn/lib_ps.c | 415 +++++++++++++++++++++++++++++++++- nuttx/libc/unistd/lib_execv.c | 4 +- 6 files changed, 445 insertions(+), 19 deletions(-) diff --git a/nuttx/ChangeLog b/nuttx/ChangeLog index 92fbb56df8..421b1ca60b 100644 --- a/nuttx/ChangeLog +++ b/nuttx/ChangeLog @@ -3899,4 +3899,8 @@ * libc/spawn: Add file action interfaces needed by posix_spawn(). * sched/clock_time2ticks.c: Another case where time was being rounded down instead of up (from Mike Smith). + * libc/spawn: Implementation of posix_spawn() is complete but + untested and undocumented. + * drivers/usbdev/pl2303.c: Fix typols in the PL2303 driver + (from Max Holtzberg). diff --git a/nuttx/TODO b/nuttx/TODO index 72eb845bc2..c10b101ccd 100644 --- a/nuttx/TODO +++ b/nuttx/TODO @@ -6,7 +6,7 @@ standards, things that could be improved, and ideas for enhancements. nuttx/ - (11) Task/Scheduler (sched/) + (12) Task/Scheduler (sched/) (1) Memory Managment (mm/) (2) Signals (sched/, arch/) (2) pthreads (sched/) @@ -189,6 +189,17 @@ o Task/Scheduler (sched/) Status: Open Priority: Medium Low for now + Title: INHERITANCE of sigmask + Description: New tasks/threads do not inherit the parent's signal mask. + This behavior is required under POSIX. + + Also, related: Setting of the initial sigmask was not + implemented in posix_spawn (libc/spawn) because of this. + Status: Open + Priority: Low, make medium-low. These kinds of behaviors are not + common in tiny embedded RTOSs. And it has always been + like this and no one has complained so far. + o Memory Managment (mm/) ^^^^^^^^^^^^^^^^^^^^^^ diff --git a/nuttx/drivers/usbdev/pl2303.c b/nuttx/drivers/usbdev/pl2303.c index 95f26c1854..d10539fa7f 100644 --- a/nuttx/drivers/usbdev/pl2303.c +++ b/nuttx/drivers/usbdev/pl2303.c @@ -333,7 +333,7 @@ static void usbclass_wrcomplete(FAR struct usbdev_ep_s *ep, /* USB class device ********************************************************/ -static int usbclass_bind(FAR struct usbdevclass_driver_s *driver, +static int usbclass_bind(FAR struct usbdevclass_driver_s *driver, FAR struct usbdev_s *dev); static void usbclass_unbind(FAR struct usbdevclass_driver_s *driver, FAR struct usbdev_s *dev); @@ -1295,7 +1295,7 @@ static int usbclass_bind(FAR struct usbdevclass_driver_s *driver, priv->usbdev = dev; /* Save the reference to our private data structure in EP0 so that it - * can be recovered in ep0 completion events (Unless we are part of + * can be recovered in ep0 completion events (Unless we are part of * a composite device and, in that case, the composite device owns * EP0). */ @@ -1859,7 +1859,7 @@ static void usbclass_disconnect(FAR struct usbdevclass_driver_s *driver, * re-enumerated. */ - DEV_CONNECT(dev); + DEV_CONNECT(dev); } /**************************************************************************** @@ -1878,7 +1878,7 @@ static int usbser_setup(FAR struct uart_dev_s *dev) { FAR struct pl2303_dev_s *priv; - usbtrace(PL2303_CLASSASPI_SETUP, 0); + usbtrace(PL2303_CLASSAPI_SETUP, 0); /* Sanity check */ @@ -1919,7 +1919,7 @@ static int usbser_setup(FAR struct uart_dev_s *dev) static void usbser_shutdown(FAR struct uart_dev_s *dev) { - usbtrace(PL2303_CLASSASPI_SHUTDOWN, 0); + usbtrace(PL2303_CLASSAPI_SHUTDOWN, 0); /* Sanity check */ @@ -1941,7 +1941,7 @@ static void usbser_shutdown(FAR struct uart_dev_s *dev) static int usbser_attach(FAR struct uart_dev_s *dev) { - usbtrace(PL2303_CLASSASPI_ATTACH, 0); + usbtrace(PL2303_CLASSAPI_ATTACH, 0); return OK; } @@ -1955,7 +1955,7 @@ static int usbser_attach(FAR struct uart_dev_s *dev) static void usbser_detach(FAR struct uart_dev_s *dev) { - usbtrace(PL2303_CLASSASPI_DETACH, 0); + usbtrace(PL2303_CLASSAPI_DETACH, 0); } /**************************************************************************** @@ -1981,7 +1981,7 @@ static void usbser_rxint(FAR struct uart_dev_s *dev, bool enable) FAR uart_dev_t *serdev; irqstate_t flags; - usbtrace(PL2303_CLASSASPI_RXINT, (uint16_t)enable); + usbtrace(PL2303_CLASSAPI_RXINT, (uint16_t)enable); /* Sanity check */ @@ -2072,7 +2072,7 @@ static void usbser_txint(FAR struct uart_dev_s *dev, bool enable) { FAR struct pl2303_dev_s *priv; - usbtrace(PL2303_CLASSASPI_TXINT, (uint16_t)enable); + usbtrace(PL2303_CLASSAPI_TXINT, (uint16_t)enable); /* Sanity checks */ @@ -2117,7 +2117,7 @@ static bool usbser_txempty(FAR struct uart_dev_s *dev) { FAR struct pl2303_dev_s *priv = (FAR struct pl2303_dev_s*)dev->priv; - usbtrace(PL2303_CLASSASPI_TXEMPTY, 0); + usbtrace(PL2303_CLASSAPI_TXEMPTY, 0); #if CONFIG_DEBUG if (!priv) diff --git a/nuttx/libc/Kconfig b/nuttx/libc/Kconfig index d739b6351e..2f091f1c7d 100644 --- a/nuttx/libc/Kconfig +++ b/nuttx/libc/Kconfig @@ -121,6 +121,14 @@ config EXECFUNCS_NSYMBOLS symbols in that table. This selection provides the number of symbols in the symbol table. +config POSIX_SPAWN_STACKSIZE + int "posix_spawn Stack Size" + default 768 + ---help--- + If posix_spawn[p] uses I/O redirection options, then it will require + an intermediary/proxy task to muck with the file descriptors. This + configuration item specifies the stack size used for the proxy. + endif config LIBC_STRERROR diff --git a/nuttx/libc/spawn/lib_ps.c b/nuttx/libc/spawn/lib_ps.c index e04ed77ad4..e73d1eef00 100644 --- a/nuttx/libc/spawn/lib_ps.c +++ b/nuttx/libc/spawn/lib_ps.c @@ -39,10 +39,349 @@ #include +#include +#include +#include #include +#include +#include +#include + +#include + +#include "spawn/spawn.h" /**************************************************************************** - * Global Functions + * Private Types + ****************************************************************************/ + +struct spawn_parms_s +{ + int result; + FAR pid_t *pid; + FAR const char *path; + FAR const posix_spawn_file_actions_t *file_actions; + FAR const posix_spawnattr_t *attr; + FAR char *const *argv; +}; + +/**************************************************************************** + * Public Data + ****************************************************************************/ + +extern struct symtab_s CONFIG_EXECFUNCS_SYMTAB; + +/**************************************************************************** + * Private Data + ****************************************************************************/ + +static sem_t g_ps_parmsem = SEM_INITIALIZER(1); +static sem_t g_ps_execsem = SEM_INITIALIZER(0); +static struct spawn_parms_s g_ps_parms; + +/**************************************************************************** + * Private Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: ps_semtake and ps_semgive + * + * Description: + * Give and take semaphores + * + * Input Parameters: + * + * sem - The semaphore to act on. + * + * Returned Value: + * None + * + ****************************************************************************/ + +static void ps_semtake(FAR sem_t *sem) +{ + int ret; + + do + { + ret = sem_wait(sem); + ASSERT(ret == 0 || errno == EINTR); + } + while (ret != 0); +} + +#define ps_semgive(sem) sem_post(sem) + +/**************************************************************************** + * Name: ps_exec + * + * Description: + * Execute the task from the file system. + * + * Input Parameters: + * + * pidp - Upon successful completion, this will return the task ID of the + * child task in the variable pointed to by a non-NULL 'pid' argument.| + * + * path - The 'path' argument identifies the file to execute. If + * CONFIG_BINFMT_EXEPATH is defined, this may be either a relative or + * or an absolute path. Otherwise, it must be an absolute path. + * + * attr - If the value of the 'attr' parameter is NULL, the all default + * values for the POSIX spawn attributes will be used. Otherwise, the + * attributes will be set according to the spawn flags. The + * following spawn flags are supported: + * + * - POSIX_SPAWN_SETSCHEDPARAM: Set new tasks priority to the sched_param + * value. + * - POSIX_SPAWN_SETSCHEDULER: Set the new tasks scheduler priority to + * the sched_policy value. + * + * argv - argv[] is the argument list for the new task. argv[] is an + * array of pointers to null-terminated strings. The list is terminated + * with a null pointer. + * + * Returned Value: + * This function will return zero on success. Otherwise, an error number + * will be returned as the function return value to indicate the error. + * This errno value may be that set by execv(), sched_setpolicy(), or + * sched_setparam(). + * + ****************************************************************************/ + +static int ps_exec(FAR pid_t *pidp, FAR const char *path, + FAR const posix_spawnattr_t *attr, + FAR char *const argv[]) +{ + struct sched_param param; + int pid; + int ret = OK; + + DEBUGASSERT(path); + + /* Disable pre-emption so that we can modify the task parameters after + * we start the new task; the new task will not actually begin execution + * until we re-enable pre-emption. + */ + + sched_lock(); + + /* Start the task */ + + pid = exec(path, (FAR const char **)argv, &CONFIG_EXECFUNCS_SYMTAB, + CONFIG_EXECFUNCS_NSYMBOLS); + + if (pid < 0) + { + ret = errno; + sdbg("exec failed: %d\n", ret); + goto errout; + } + + /* Return the task ID to the caller */ + + if (pid) + { + *pidp = pid; + } + + /* Now set the attributes. Note that we ignore all of the return values + * here because we have already successfully started the task. If we + * return an error value, then we would also have to stop the task. + */ + + if (attr) + { + /* If we are only setting the priority, then call sched_setparm() + * to set the priority of the of the new task. + */ + + if ((attr->flags & POSIX_SPAWN_SETSCHEDPARAM) != 0) + { + /* Get the priority from the attrributes */ + + param.sched_priority = attr->priority; + + /* If we are setting *both* the priority and the scheduler, + * then we will call sched_setscheduler() below. + */ + + if ((attr->flags & POSIX_SPAWN_SETSCHEDULER) == 0) + { + (void)sched_setparam(pid, ¶m); + } + } + + /* If we are only changing the scheduling policy, then reset + * the priority to the default value (the same as this thread) in + * preparation for the sched_setscheduler() call below. + */ + + else if ((attr->flags & POSIX_SPAWN_SETSCHEDULER) != 0) + { + (void)sched_getparam(0, ¶m); + } + + /* Are we setting the scheduling policy? If so, use the priority + * setting determined above. + */ + + if ((attr->flags & POSIX_SPAWN_SETSCHEDULER) != 0) + { + (void)sched_setscheduler(pid, attr->policy, ¶m); + } + } + + /* Re-enable pre-emption and return */ + +errout: + sched_unlock(); + return OK; +} + +/**************************************************************************** + * Name: spawn_close, spawn_dup2, and spawn_open + * + * Description: + * Implement individual file actions + * + * Input Parameters: + * action - describes the action to be performed + * + * Returned Value: + * posix_spawn() and posix_spawnp() will return zero on success. + * Otherwise, an error number will be returned as the function return + * value to indicate the error. + * + ****************************************************************************/ + +static inline int spawn_close(FAR struct spawn_close_file_action_s *action) +{ + /* The return value from close() is ignored */ + + (void)close(action->fd); + return OK; +} + +static inline int spawn_dup2(FAR struct spawn_dup2_file_action_s *action) +{ + /* Perform the dup */ + + int ret = dup2(action->fd1, action->fd2); + if (ret < 0) + { + return errno; + } + + return OK; +} + +static inline int spawn_open(FAR struct spawn_open_file_action_s *action) +{ + int fd; + int ret = OK; + + /* Open the file */ + + fd = open(action->path, action->oflags, action->mode); + if (fd < 0) + { + ret = errno; + } + + /* Does the return file descriptor happen to match the required file + * desciptor number? + */ + + else if (fd != action->fd) + { + /* No.. dup2 to get the correct file number */ + + ret = dup2(fd, action->fd); + if (ret < 0) + { + ret = errno; + } + + close(fd); + } + + return ret; +} + +/**************************************************************************** + * Name: spawn_proxy + * + * Description: + * Perform file_actions, then execute the task from the file system. + * + * Input Parameters: + * Standard task start-up parameters + * + * Returned Value: + * Standard task return value. + * + ****************************************************************************/ + +static int spawn_proxy(int argc, char *argv[]) +{ + FAR struct spawn_general_file_action_s *entry; + int ret; + + /* Perform I/O redirection. We get here only if the file_actions parameter + * to posix_spawn[p] was non-NULL. + */ + + DEBUGASSERT(g_ps_parms.file_actions); + + /* Execute each file action */ + + for (entry = (FAR struct spawn_general_file_action_s *)*g_ps_parms.file_actions; + entry && ret == OK; + entry = entry->flink) + { + switch (entry->action) + { + case SPAWN_FILE_ACTION_CLOSE: + ret = spawn_close((FAR struct spawn_close_file_action_s *)entry); + break; + + case SPAWN_FILE_ACTION_DUP2: + ret = spawn_dup2((FAR struct spawn_dup2_file_action_s *)entry); + break; + + case SPAWN_FILE_ACTION_OPEN: + ret = spawn_open((FAR struct spawn_open_file_action_s *)entry); + break; + + case SPAWN_FILE_ACTION_NONE: + default: + ret = EINVAL; + break; + } + } + + /* Check for failures */ + + if (ret == OK) + { + /* Start the task */ + + ret = ps_exec(g_ps_parms.pid, g_ps_parms.path, g_ps_parms.attr, + g_ps_parms.argv); + } + + /* Post the semaphore to inform the parent task that we have completed + * what we need to do. + */ + + g_ps_parms.result = ret; + ps_semgive(&g_ps_execsem); + return 0; +} + +/**************************************************************************** + * Public Functions ****************************************************************************/ /**************************************************************************** @@ -102,9 +441,7 @@ * * argv - argv[] is the argument list for the new task. argv[] is an * array of pointers to null-terminated strings. The list is terminated - * with a null pointer. The value in argv[0] should point to a filename - * that is associated with the process image being started by the - * posix_spawn() or posix_spawnp() functions. + * with a null pointer. * * envp - The envp[] argument is not used by NuttX and may be NULL. In * standard implementations, envp[] is an array of character pointers to @@ -153,6 +490,72 @@ int posix_spawn(FAR pid_t *pid, FAR const char *path, FAR char *const argv[], FAR char *const envp[]) #endif { -#warning "Missing Logic" - return OK; + struct sched_param param; + pid_t proxy; + int ret; + + DEBUGASSERT(path); + + /* If there are no file actions to be performed, then start the new child + * task directory form the parent task. + */ + + if (!file_actions) + { + return ps_exec(pid, path, attr, argv); + } + + /* Otherwise, we will have to go through an intermediary/proxy task in order + * to perform the I/O redirection. This would be a natural place to fork(). + * However, true fork() behavior requires an MMU and most implementations + * of vfork() are not capable of these operations. + * + * Even without fork(), we can still do the job, but parameter passing is + * messier. Unfortunately, there is no (clean) way to pass binary values + * as a task parameter, so we will use a semaphore-protected global + * structure. + */ + + /* Get exclusive access to the global parameter structure */ + + ps_semtake(&g_ps_parmsem); + + /* Populate the parameter structure */ + + g_ps_parms.result = ENOSYS; + g_ps_parms.pid = pid; + g_ps_parms.path = path; + g_ps_parms.file_actions = file_actions; + g_ps_parms.attr = attr; + g_ps_parms.argv = argv; + + /* Get the priority of this (parent) task */ + + ret = sched_getparam(0, ¶m); + if (ret < 0) + { + ps_semgive(&g_ps_parmsem); + return errno; + } + + /* Start the intermediary/proxy task at the same priority as the parent task. */ + + proxy = TASK_CREATE("spawn_proxy", param.sched_priority, + CONFIG_POSIX_SPAWN_STACKSIZE, (main_t)spawn_proxy, + (const char **)NULL); + if (proxy < 0) + { + ps_semgive(&g_ps_parmsem); + return errno; + } + + /* Wait for the proxy to complete its job */ + + ps_semtake(&g_ps_execsem); + + /* Get the result and relinquish our access to the parameter structure */ + + ret = g_ps_parms.result; + ps_semgive(&g_ps_parmsem); + return ret; } diff --git a/nuttx/libc/unistd/lib_execv.c b/nuttx/libc/unistd/lib_execv.c index b0f4136f12..6d09bf4815 100644 --- a/nuttx/libc/unistd/lib_execv.c +++ b/nuttx/libc/unistd/lib_execv.c @@ -68,7 +68,7 @@ #endif /**************************************************************************** - * Global Variables + * Public Variables ****************************************************************************/ extern struct symtab_s CONFIG_EXECFUNCS_SYMTAB; @@ -78,7 +78,7 @@ extern struct symtab_s CONFIG_EXECFUNCS_SYMTAB; ****************************************************************************/ /**************************************************************************** - * Global Functions + * Public Functions ****************************************************************************/ /**************************************************************************** From 9f8f8fc6dc5c2057f61fe04bf1109a8590ef93d0 Mon Sep 17 00:00:00 2001 From: patacongo Date: Thu, 10 Jan 2013 18:31:08 +0000 Subject: [PATCH 058/118] Add missing support for signal masks to posix_spawn. git-svn-id: http://svn.code.sf.net/p/nuttx/code/trunk@5505 42af7a65-404d-4744-a932-0658087f49c3 --- nuttx/TODO | 15 +---- nuttx/include/spawn.h | 18 +++++- nuttx/libc/spawn/Make.defs | 4 ++ nuttx/libc/spawn/lib_ps.c | 83 +++++++++++++++++---------- nuttx/libc/spawn/lib_psa_getsigmask.c | 78 +++++++++++++++++++++++++ nuttx/libc/spawn/lib_psa_setsigmask.c | 79 +++++++++++++++++++++++++ nuttx/sched/task_setup.c | 4 +- 7 files changed, 235 insertions(+), 46 deletions(-) create mode 100644 nuttx/libc/spawn/lib_psa_getsigmask.c create mode 100644 nuttx/libc/spawn/lib_psa_setsigmask.c diff --git a/nuttx/TODO b/nuttx/TODO index c10b101ccd..9295f6206b 100644 --- a/nuttx/TODO +++ b/nuttx/TODO @@ -1,4 +1,4 @@ -NuttX TODO List (Last updated January 8, 2013) +NuttX TODO List (Last updated January 10, 2013) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ This file summarizes known NuttX bugs, limitations, inconsistencies with @@ -6,7 +6,7 @@ standards, things that could be improved, and ideas for enhancements. nuttx/ - (12) Task/Scheduler (sched/) + (11) Task/Scheduler (sched/) (1) Memory Managment (mm/) (2) Signals (sched/, arch/) (2) pthreads (sched/) @@ -189,17 +189,6 @@ o Task/Scheduler (sched/) Status: Open Priority: Medium Low for now - Title: INHERITANCE of sigmask - Description: New tasks/threads do not inherit the parent's signal mask. - This behavior is required under POSIX. - - Also, related: Setting of the initial sigmask was not - implemented in posix_spawn (libc/spawn) because of this. - Status: Open - Priority: Low, make medium-low. These kinds of behaviors are not - common in tiny embedded RTOSs. And it has always been - like this and no one has complained so far. - o Memory Managment (mm/) ^^^^^^^^^^^^^^^^^^^^^^ diff --git a/nuttx/include/spawn.h b/nuttx/include/spawn.h index 91092eeb01..3978424fbf 100644 --- a/nuttx/include/spawn.h +++ b/nuttx/include/spawn.h @@ -45,6 +45,7 @@ #include #include +#include #include /**************************************************************************** @@ -77,6 +78,9 @@ struct posix_spawnattr_s uint8_t flags; uint8_t priority; uint8_t policy; +#ifndef CONFIG_DISABLE_SIGNALS + sigset_t sigmask; +#endif }; typedef struct posix_spawnattr_s posix_spawnattr_t; @@ -155,7 +159,12 @@ int posix_spawnattr_getschedparam(FAR const posix_spawnattr_t *attr, int posix_spawnattr_getschedpolicy(FAR const posix_spawnattr_t *attr, FAR int *policy); #define posix_spawnattr_getsigdefault(attr,sigdefault) (ENOSYS) -#define posix_spawnattr_getsigmask(attr,sigmask) (ENOSYS) +#ifndef CONFIG_DISABLE_SIGNALS +int posix_spawnattr_getsigmask(FAR const posix_spawnattr_t *attr, + FAR sigset_t *sigmask); +#else +# define posix_spawnattr_getsigmask(attr,sigmask) (ENOSYS) +#endif /* Set spawn attributes interfaces */ @@ -165,7 +174,12 @@ int posix_spawnattr_setschedparam(FAR posix_spawnattr_t *attr, FAR const struct sched_param *param); int posix_spawnattr_setschedpolicy(FAR posix_spawnattr_t *attr, int policy); #define posix_spawnattr_setsigdefault(attr,sigdefault) (ENOSYS) -#define posix_spawnattr_setsigmask(attr,sigmask) (ENOSYS) +#ifndef CONFIG_DISABLE_SIGNALS +int posix_spawnattr_setsigmask(FAR posix_spawnattr_t *attr, + FAR const sigset_t *sigmask); +#else +# define posix_spawnattr_setsigmask(attr,sigmask) (ENOSYS) +#endif #ifdef __cplusplus } diff --git a/nuttx/libc/spawn/Make.defs b/nuttx/libc/spawn/Make.defs index 21bc316fa6..2cf75c410d 100644 --- a/nuttx/libc/spawn/Make.defs +++ b/nuttx/libc/spawn/Make.defs @@ -46,6 +46,10 @@ CSRCS += lib_psa_getflags.c lib_psa_getschedparam.c lib_psa_getschedpolicy.c CSRCS += lib_psa_init.c lib_psa_setflags.c lib_psa_setschedparam.c CSRCS += lib_psa_setschedpolicy.c +ifneq ($(CONFIG_DISABLE_SIGNALS),y) +CSRCS += lib_psa_getsigmask.c lib_psa_setsigmask.c +endif + # Add the spawn directory to the build DEPPATH += --dep-path spawn diff --git a/nuttx/libc/spawn/lib_ps.c b/nuttx/libc/spawn/lib_ps.c index e73d1eef00..b0f6e1b07f 100644 --- a/nuttx/libc/spawn/lib_ps.c +++ b/nuttx/libc/spawn/lib_ps.c @@ -40,6 +40,7 @@ #include #include +#include #include #include #include @@ -137,6 +138,8 @@ static void ps_semtake(FAR sem_t *sem) * - POSIX_SPAWN_SETSCHEDULER: Set the new tasks scheduler priority to * the sched_policy value. * + * NOTE: POSIX_SPAWN_SETSIGMASK is handled in ps_proxy(). + * * argv - argv[] is the argument list for the new task. argv[] is an * array of pointers to null-terminated strings. The list is terminated * with a null pointer. @@ -326,38 +329,59 @@ static inline int spawn_open(FAR struct spawn_open_file_action_s *action) static int spawn_proxy(int argc, char *argv[]) { FAR struct spawn_general_file_action_s *entry; + FAR const posix_spawnattr_t *attr = g_ps_parms.attr; int ret; - /* Perform I/O redirection. We get here only if the file_actions parameter - * to posix_spawn[p] was non-NULL. + /* Perform file actions and/or set a custom signal mask. We get here only + * if the file_actions parameter to posix_spawn[p] was non-NULL and/or the + * option to change the signal mask was selected. */ +#ifndef CONFIG_DISABLE_SIGNALS + DEBUGASSERT(g_ps_parms.file_actions || + (attr && (attr->flags & POSIX_SPAWN_SETSIGMASK) != 0)); +#else DEBUGASSERT(g_ps_parms.file_actions); +#endif - /* Execute each file action */ + /* Check if we need to change the signal mask */ - for (entry = (FAR struct spawn_general_file_action_s *)*g_ps_parms.file_actions; - entry && ret == OK; - entry = entry->flink) +#ifndef CONFIG_DISABLE_SIGNALS + if (attr && (attr->flags & POSIX_SPAWN_SETSIGMASK) != 0) { - switch (entry->action) + (void)sigprocmask(SIG_SETMASK, &attr->sigmask, NULL); + } + + /* Were we also requested to perform file actions? */ + + if (g_ps_parms.file_actions) +#endif + { + /* Execute each file action */ + + for (entry = (FAR struct spawn_general_file_action_s *)*g_ps_parms.file_actions; + entry && ret == OK; + entry = entry->flink) { - case SPAWN_FILE_ACTION_CLOSE: - ret = spawn_close((FAR struct spawn_close_file_action_s *)entry); - break; + switch (entry->action) + { + case SPAWN_FILE_ACTION_CLOSE: + ret = spawn_close((FAR struct spawn_close_file_action_s *)entry); + break; - case SPAWN_FILE_ACTION_DUP2: - ret = spawn_dup2((FAR struct spawn_dup2_file_action_s *)entry); - break; + case SPAWN_FILE_ACTION_DUP2: + ret = spawn_dup2((FAR struct spawn_dup2_file_action_s *)entry); + break; - case SPAWN_FILE_ACTION_OPEN: - ret = spawn_open((FAR struct spawn_open_file_action_s *)entry); - break; + case SPAWN_FILE_ACTION_OPEN: + ret = spawn_open((FAR struct spawn_open_file_action_s *)entry); + break; - case SPAWN_FILE_ACTION_NONE: - default: - ret = EINVAL; - break; + case SPAWN_FILE_ACTION_NONE: + default: + ret = EINVAL; + break; + } } } @@ -367,8 +391,7 @@ static int spawn_proxy(int argc, char *argv[]) { /* Start the task */ - ret = ps_exec(g_ps_parms.pid, g_ps_parms.path, g_ps_parms.attr, - g_ps_parms.argv); + ret = ps_exec(g_ps_parms.pid, g_ps_parms.path, attr, g_ps_parms.argv); } /* Post the semaphore to inform the parent task that we have completed @@ -424,18 +447,16 @@ static int spawn_proxy(int argc, char *argv[]) * It will contains these attributes, not all of which are supported by * NuttX: * - * - POSIX_SPAWN_SETPGROUP: Setting of the new tasks process group is + * - POSIX_SPAWN_SETPGROUP: Setting of the new task's process group is * not supported. NuttX does not support process groups. * - POSIX_SPAWN_SETSCHEDPARAM: Set new tasks priority to the sched_param * value. - * - POSIX_SPAWN_SETSCHEDULER: Set the new tasks scheduler priority to + * - POSIX_SPAWN_SETSCHEDULER: Set the new task's scheduler priority to * the sched_policy value. * - POSIX_SPAWN_RESETIDS: Resetting of effective user ID of the child * process is not supported. NuttX does not support effective user * IDs. - * - POSIX_SPAWN_SETSIGMASK: Setting the initial signal mask of the new - * task is not supported. NuttX does support signal masks, but there - * is no mechanism in place now to do this. + * - POSIX_SPAWN_SETSIGMASK: Set the new task's signal mask. * - POSIX_SPAWN_SETSIGDEF: Resetting signal default actions is not * supported. NuttX does not support default signal actions. * @@ -496,11 +517,15 @@ int posix_spawn(FAR pid_t *pid, FAR const char *path, DEBUGASSERT(path); - /* If there are no file actions to be performed, then start the new child - * task directory form the parent task. + /* If there are no file actions to be performed and there is no change to + * the signal mask, then start the new child task directly from the parent task. */ +#ifndef CONFIG_DISABLE_SIGNALS + if (!file_actions && (attr->flags & POSIX_SPAWN_SETSIGMASK) == 0) +#else if (!file_actions) +#endif { return ps_exec(pid, path, attr, argv); } diff --git a/nuttx/libc/spawn/lib_psa_getsigmask.c b/nuttx/libc/spawn/lib_psa_getsigmask.c new file mode 100644 index 0000000000..3c831075ee --- /dev/null +++ b/nuttx/libc/spawn/lib_psa_getsigmask.c @@ -0,0 +1,78 @@ +/**************************************************************************** + * libc/string/lib_psa_getsigmask.c + * + * Copyright (C) 2013 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * 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. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include +#include +#include + +#ifndef CONFIG_DISABLE_SIGNALS + +/**************************************************************************** + * Global Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: posix_spawnattr_getsigmask + * + * Description: + * The posix_spawnattr_getsigdefault() function will obtain the value of + * the spawn-sigmask attribute from the attributes object referenced + * by attr. + * + * Input Parameters: + * attr - The address spawn attributes to be queried. + * sigmask - The location to return the spawn flags + * + * Returned Value: + * On success, these functions return 0; on failure they return an error + * number from . + * + ****************************************************************************/ + +int posix_spawnattr_getsigmask(FAR const posix_spawnattr_t *attr, + FAR sigset_t *sigmask) +{ + DEBUGASSERT(attr && sigmask); + *sigmask = attr->sigmask; + return OK; +} + +#endif /* !CONFIG_DISABLE_SIGNALS */ diff --git a/nuttx/libc/spawn/lib_psa_setsigmask.c b/nuttx/libc/spawn/lib_psa_setsigmask.c new file mode 100644 index 0000000000..28b7daf779 --- /dev/null +++ b/nuttx/libc/spawn/lib_psa_setsigmask.c @@ -0,0 +1,79 @@ +/**************************************************************************** + * libc/string/lib_psa_setsigmask.c + * + * Copyright (C) 2013 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * 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. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include +#include +#include + +#ifndef CONFIG_DISABLE_SIGNALS + +/**************************************************************************** + * Global Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: posix_spawnattr_setsigmask + * + * Description: + * The posix_spawnattr_setsigmask() function will set the spawn- + * sigmask attribute in an initialized attributes object referenced + * by attr. + * + * Input Parameters: + * attr - The address spawn attributes to be used. + * flags - The new value of the default signal set + * + * Returned Value: + * On success, these functions return 0; on failure they return an error + * number from . + * + ****************************************************************************/ + +int posix_spawnattr_setsigmask(FAR posix_spawnattr_t *attr, + FAR const sigset_t *sigmask) +{ + DEBUGASSERT(attr && sigmask); + attr->sigmask = *sigmask; + return OK; +} + +#endif /* !CONFIG_DISABLE_SIGNALS */ + diff --git a/nuttx/sched/task_setup.c b/nuttx/sched/task_setup.c index a37fb165a6..8721b39ec1 100644 --- a/nuttx/sched/task_setup.c +++ b/nuttx/sched/task_setup.c @@ -231,8 +231,8 @@ int task_schedsetup(FAR _TCB *tcb, int priority, start_t start, main_t main) tcb->start = start; tcb->entry.main = main; - /* exec() and pthread_create() inherit the signal mask of the - * parent thread. I suppose that task_create() should as well. + /* exec(), pthread_create(), task_create(), and vfork() all + * inherit the signal mask of the parent thread. */ #ifndef CONFIG_DISABLE_SIGNALS From 6f241ed0443cc265d7a079f4bbf8d2d67be939ff Mon Sep 17 00:00:00 2001 From: patacongo Date: Thu, 10 Jan 2013 20:00:08 +0000 Subject: [PATCH 059/118] Add interfaces to dynamically change symbol tables used by posix_spawn, execv, and execl. This is needed for testing. git-svn-id: http://svn.code.sf.net/p/nuttx/code/trunk@5506 42af7a65-404d-4744-a932-0658087f49c3 --- apps/examples/Make.defs | 4 + apps/examples/Makefile | 4 +- apps/examples/README.txt | 84 ++++++++++++++++- nuttx/include/unistd.h | 6 ++ nuttx/libc/spawn/lib_ps.c | 53 +++++++++-- nuttx/libc/spawn/spawn.h | 2 +- nuttx/libc/unistd/Make.defs | 2 +- nuttx/libc/unistd/lib_execsymtab.c | 147 +++++++++++++++++++++++++++++ nuttx/libc/unistd/lib_execv.c | 31 ++---- 9 files changed, 292 insertions(+), 41 deletions(-) create mode 100644 nuttx/libc/unistd/lib_execsymtab.c diff --git a/apps/examples/Make.defs b/apps/examples/Make.defs index de2b8939fe..68d4d43406 100644 --- a/apps/examples/Make.defs +++ b/apps/examples/Make.defs @@ -182,6 +182,10 @@ ifeq ($(CONFIG_EXAMPLES_PWM),y) CONFIGURED_APPS += examples/pwm endif +ifeq ($(CONFIG_EXAMPLES_POSIXSPAWN),y) +CONFIGURED_APPS += examples/posix_spawn +endif + ifeq ($(CONFIG_EXAMPLES_QENCODER),y) CONFIGURED_APPS += examples/qencoder endif diff --git a/apps/examples/Makefile b/apps/examples/Makefile index 99312af7ab..a11dbf2405 100644 --- a/apps/examples/Makefile +++ b/apps/examples/Makefile @@ -40,8 +40,8 @@ SUBDIRS = adc buttons can cdcacm composite cxxtest dhcpd discover elf ftpc SUBDIRS += ftpd hello helloxx hidkbd igmp json keypadtest lcdrw mm modbus mount SUBDIRS += nettest nsh null nx nxconsole nxffs nxflat nxhello nximage -SUBDIRS += nxlines nxtext ostest pashello pipe poll pwm qencoder relays -SUBDIRS += rgmp romfs serloop telnetd thttpd tiff touchscreen udp uip +SUBDIRS += nxlines nxtext ostest pashello pipe poll pwm posix_spawn qencoder +SUBDIRS += relays rgmp romfs serloop telnetd thttpd tiff touchscreen udp uip SUBDIRS += usbserial sendmail usbstorage usbterm watchdog wget wgetjson # Sub-directories that might need context setup. Directories may need diff --git a/apps/examples/README.txt b/apps/examples/README.txt index 7bfba721a6..5c6332ee33 100644 --- a/apps/examples/README.txt +++ b/apps/examples/README.txt @@ -329,10 +329,10 @@ examples/elf each program in the ROMFS file system is executed. Requires CONFIG_ELF. Other configuration options: - CONFIG_EXAMPLES_ELF_DEVMINOR - The minor device number of the ROMFS block. - For example, the N in /dev/ramN. Used for registering the RAM block driver - that will hold the ROMFS file system containing the ELF executables to be - tested. Default: 0 + CONFIG_EXAMPLES_ELF_DEVMINOR - The minor device number of the ROMFS block + driver. For example, the N in /dev/ramN. Used for registering the RAM + block driver that will hold the ROMFS file system containing the ELF + executables to be tested. Default: 0 CONFIG_EXAMPLES_ELF_DEVPATH - The path to the ROMFS block driver device. This must match EXAMPLES_ELF_DEVMINOR. Used for registering the RAM block driver @@ -348,7 +348,7 @@ examples/elf Similarly for C++ flags which must be provided in CXXELFFLAGS. - 2. Your top-level nuttx/Make.defs file must alos include an approproate definition, + 2. Your top-level nuttx/Make.defs file must also include an approproate definition, LDELFFLAGS, to generate a relocatable ELF object. With GNU LD, this should include '-r' and '-e main' (or _main on some platforms). @@ -1202,6 +1202,80 @@ examples/poll CONFIGURED_APPS += uiplib +examples/posix_spawn +^^^^^^^^^^^^^^^^^^^^ + + This is a simple test of the posix_spawn() API. The example derives from + examples/elf. As a result, these tests are built using the relocatable + ELF format installed in a ROMFS file system. At run time, the test program + in the ROMFS file system is spawned using posix_spawn(). + + Requires: + + CONFIG_BINFMT_DISABLE=n - Don't disable the binary loader + CONFIG_ELF=y - Enable ELF binary loader + CONFIG_LIBC_EXECFUNCS=y - Enable support for posix_spawn + CONFIG_EXECFUNCS_SYMTAB="exports" - The name of the symbol table + created by the test. + CONFIG_EXECFUNCS_NSYMBOLS=10 - Value does not matter, it will be + corrected at runtime. + CONFIG_POSIX_SPAWN_STACKSIZE=768 - This default setting. + + Test-specific configuration options: + + CONFIG_EXAMPLES_POSIXSPAWN_DEVMINOR - The minor device number of the ROMFS + block. driver. For example, the N in /dev/ramN. Used for registering the + RAM block driver that will hold the ROMFS file system containing the ELF + executables to be tested. Default: 0 + + CONFIG_EXAMPLES_POSIXSPAWN_DEVPATH - The path to the ROMFS block driver + device. This must match EXAMPLES_POSIXSPAWN_DEVMINOR. Used for + registering the RAM block driver that will hold the ROMFS file system + containing the ELF executables to be tested. Default: "/dev/ram0" + + NOTES: + + 1. CFLAGS should be provided in CELFFLAGS. RAM and FLASH memory regions + may require long allcs. For ARM, this might be: + + CELFFLAGS = $(CFLAGS) -mlong-calls + + Similarly for C++ flags which must be provided in CXXELFFLAGS. + + 2. Your top-level nuttx/Make.defs file must also include an approproate + definition, LDELFFLAGS, to generate a relocatable ELF object. With GNU + LD, this should include '-r' and '-e main' (or _main on some platforms). + + LDELFFLAGS = -r -e main + + If you use GCC to link, you make also need to include '-nostdlib' or + '-nostartfiles' and '-nodefaultlibs'. + + 3. This example also requires genromfs. genromfs can be build as part of the + nuttx toolchain. Or can built from the genromfs sources that can be found + at misc/tools/genromfs-0.5.2.tar.gz. In any event, the PATH variable must + include the path to the genromfs executable. + + 4. ELF size: The ELF files in this example are, be default, quite large + because they include a lot of "build garbage". You can greatly reduce the + size of the ELF binaries are using the 'objcopy --strip-unneeded' command to + remove un-necessary information from the ELF files. + + 5. Simulator. You cannot use this example with the the NuttX simulator on + Cygwin. That is because the Cygwin GCC does not generate ELF file but + rather some Windows-native binary format. + + If you really want to do this, you can create a NuttX x86 buildroot toolchain + and use that be build the ELF executables for the ROMFS file system. + + 6. Linker scripts. You might also want to use a linker scripts to combine + sections better. An example linker script is at nuttx/binfmt/libelf/gnu-elf.ld. + That example might have to be tuned for your particular linker output to + position additional sections correctly. The GNU LD LDELFFLAGS then might + be: + + LDELFFLAGS = -r -e main -T$(TOPDIR)/binfmt/libelf/gnu-elf.ld + examples/pwm ^^^^^^^^^^^^ diff --git a/nuttx/include/unistd.h b/nuttx/include/unistd.h index d2ace79fa3..c5289624bd 100644 --- a/nuttx/include/unistd.h +++ b/nuttx/include/unistd.h @@ -165,6 +165,12 @@ EXTERN int rmdir(FAR const char *pathname); #ifdef CONFIG_LIBC_EXECFUNCS EXTERN int execl(FAR const char *path, ...); EXTERN int execv(FAR const char *path, FAR char *const argv[]); + +/* Non-standard functions to manage symbol tables */ + +struct symtab_s; /* See include/nuttx/binfmt/symtab.h */ +EXTERN void exec_getsymtab(FAR struct symtab_s **symtab, FAR int *nsymbols); +EXTERN void exec_setsymtab(FAR const struct symtab_s *symtab, int nsymbols); #endif /* Other */ diff --git a/nuttx/libc/spawn/lib_ps.c b/nuttx/libc/spawn/lib_ps.c index b0f6e1b07f..7509d67377 100644 --- a/nuttx/libc/spawn/lib_ps.c +++ b/nuttx/libc/spawn/lib_ps.c @@ -157,11 +157,17 @@ static int ps_exec(FAR pid_t *pidp, FAR const char *path, FAR char *const argv[]) { struct sched_param param; + FAR struct symtab_s *symtab; + int nsymbols; int pid; int ret = OK; DEBUGASSERT(path); + /* Get the current symbol table selection */ + + exec_getsymtab(&symtab, &nsymbols); + /* Disable pre-emption so that we can modify the task parameters after * we start the new task; the new task will not actually begin execution * until we re-enable pre-emption. @@ -171,13 +177,11 @@ static int ps_exec(FAR pid_t *pidp, FAR const char *path, /* Start the task */ - pid = exec(path, (FAR const char **)argv, &CONFIG_EXECFUNCS_SYMTAB, - CONFIG_EXECFUNCS_NSYMBOLS); - + pid = exec(path, (FAR const char **)argv, symtab, nsymbols); if (pid < 0) { ret = errno; - sdbg("exec failed: %d\n", ret); + sdbg("ERROR: exec failed: %d\n", ret); goto errout; } @@ -211,6 +215,9 @@ static int ps_exec(FAR pid_t *pidp, FAR const char *path, if ((attr->flags & POSIX_SPAWN_SETSCHEDULER) == 0) { + svdbg("Setting priority=%d for pid=%d\n", + param.sched_priority, pid); + (void)sched_setparam(pid, ¶m); } } @@ -231,6 +238,9 @@ static int ps_exec(FAR pid_t *pidp, FAR const char *path, if ((attr->flags & POSIX_SPAWN_SETSCHEDULER) != 0) { + svdbg("Setting policy=%d priority=%d for pid=%d\n", + attr->policy, param.sched_priority, pid); + (void)sched_setscheduler(pid, attr->policy, ¶m); } } @@ -262,18 +272,27 @@ static inline int spawn_close(FAR struct spawn_close_file_action_s *action) { /* The return value from close() is ignored */ + svdbg("Closing fd=%d\n", action->fd); + (void)close(action->fd); return OK; } static inline int spawn_dup2(FAR struct spawn_dup2_file_action_s *action) { + int ret; + /* Perform the dup */ - int ret = dup2(action->fd1, action->fd2); + svdbg("Dup'ing %d->%d\n", action->fd1, action->fd2); + + ret = dup2(action->fd1, action->fd2); if (ret < 0) { - return errno; + int errcode = errno; + + sdbg("ERROR: dup2 failed: %d\n", errcode); + return errcode; } return OK; @@ -286,10 +305,14 @@ static inline int spawn_open(FAR struct spawn_open_file_action_s *action) /* Open the file */ + svdbg("Open'ing path=%s oflags=%04x mode=%04x\n", + action->path, action->oflags, action->mode); + fd = open(action->path, action->oflags, action->mode); if (fd < 0) { ret = errno; + sdbg("ERROR: open failed: %d\n", ret); } /* Does the return file descriptor happen to match the required file @@ -300,12 +323,16 @@ static inline int spawn_open(FAR struct spawn_open_file_action_s *action) { /* No.. dup2 to get the correct file number */ + svdbg("Dup'ing %d->%d\n", fd, action->fd); + ret = dup2(fd, action->fd); if (ret < 0) { ret = errno; + sdbg("ERROR: dup2 failed: %d\n", ret); } + svdbg("Closing fd=%d\n", fd); close(fd); } @@ -379,6 +406,7 @@ static int spawn_proxy(int argc, char *argv[]) case SPAWN_FILE_ACTION_NONE: default: + sdbg("ERROR: Unknown action: %d\n", entry->action); ret = EINVAL; break; } @@ -517,6 +545,9 @@ int posix_spawn(FAR pid_t *pid, FAR const char *path, DEBUGASSERT(path); + svdbg("pid=%p path=%s file_actions=%p attr=%p argv=%p\n", + pid, path, file_actions, attr, argv); + /* If there are no file actions to be performed and there is no change to * the signal mask, then start the new child task directly from the parent task. */ @@ -559,8 +590,11 @@ int posix_spawn(FAR pid_t *pid, FAR const char *path, ret = sched_getparam(0, ¶m); if (ret < 0) { + int errcode = errno; + + sdbg("ERROR: sched_getparam failed: %d\n", errcode); ps_semgive(&g_ps_parmsem); - return errno; + return errcode; } /* Start the intermediary/proxy task at the same priority as the parent task. */ @@ -570,8 +604,11 @@ int posix_spawn(FAR pid_t *pid, FAR const char *path, (const char **)NULL); if (proxy < 0) { + int errcode = errno; + + sdbg("ERROR: Failed to start spawn_proxy: %d\n", errcode); ps_semgive(&g_ps_parmsem); - return errno; + return errcode; } /* Wait for the proxy to complete its job */ diff --git a/nuttx/libc/spawn/spawn.h b/nuttx/libc/spawn/spawn.h index 5d0159ff28..3f4e195cc7 100644 --- a/nuttx/libc/spawn/spawn.h +++ b/nuttx/libc/spawn/spawn.h @@ -1,7 +1,7 @@ /**************************************************************************** * libc/spawn/spawn.h * - * Copyright (C) 2012 Gregory Nutt. All rights reserved. + * Copyright (C) 2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without diff --git a/nuttx/libc/unistd/Make.defs b/nuttx/libc/unistd/Make.defs index 3811673bf5..ee3ac0fc93 100644 --- a/nuttx/libc/unistd/Make.defs +++ b/nuttx/libc/unistd/Make.defs @@ -43,7 +43,7 @@ CSRCS += lib_chdir.c lib_getcwd.c endif ifeq ($(CONFIG_LIBC_EXECFUNCS),y) -CSRCS += lib_execl.c lib_execv.c +CSRCS += lib_execl.c lib_execv.c lib_execsymtab.c endif endif diff --git a/nuttx/libc/unistd/lib_execsymtab.c b/nuttx/libc/unistd/lib_execsymtab.c new file mode 100644 index 0000000000..e95107d15e --- /dev/null +++ b/nuttx/libc/unistd/lib_execsymtab.c @@ -0,0 +1,147 @@ +/**************************************************************************** + * libc/unistd/lib_execsymtab.c + * + * Copyright (C) 2013 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * 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. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include + +#include +#include + +#ifdef CONFIG_LIBC_EXECFUNCS + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ +/* If CONFIG_LIBC_EXECFUNCS is defined in the configuration, then the + * following must also be defined: + */ + +/* Symbol table used by exec[l|v] */ + +#ifndef CONFIG_EXECFUNCS_SYMTAB +# error "CONFIG_EXECFUNCS_SYMTAB must be defined" +#endif + +/* Number of Symbols in the Table */ + +#ifndef CONFIG_EXECFUNCS_NSYMBOLS +# error "CONFIG_EXECFUNCS_NSYMBOLS must be defined" +#endif + +/**************************************************************************** + * Public Variables + ****************************************************************************/ + +extern struct symtab_s CONFIG_EXECFUNCS_SYMTAB; + +/**************************************************************************** + * Private Data + ****************************************************************************/ + +static FAR struct symtab_s *g_exec_symtab = &CONFIG_EXECFUNCS_SYMTAB; +static int g_exec_nsymbols = CONFIG_EXECFUNCS_NSYMBOLS; + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: exec_getsymtab + * + * Description: + * Get the current symbol table selection as an atomic operation. + * + * Input Parameters: + * symtab - The location to store the symbol table. + * nsymbols - The location to store the number of symbols in the symbol table. + * + * Returned Value: + * None + * + ****************************************************************************/ + +void exec_getsymtab(FAR struct symtab_s **symtab, FAR int *nsymbols) +{ + irqstate_t flags; + + DEBUGASSERT(symtab && nsymbols); + + /* Disable interrupts very briefly so that both the symbol table and its + * size are returned as a single atomic operation. + */ + + flags = irqsave(); + *symtab = g_exec_symtab; + *nsymbols = g_exec_nsymbols; + irqrestore(flags); +} + +/**************************************************************************** + * Name: exec_setsymtab + * + * Description: + * Select a new symbol table selection as an atomic operation. + * + * Input Parameters: + * symtab - The new symbol table. + * nsymbols - The number of symbols in the symbol table. + * + * Returned Value: + * None + * + ****************************************************************************/ + +void exec_setsymtab(FAR const struct symtab_s *symtab, int nsymbols) +{ + irqstate_t flags; + + DEBUGASSERT(symtab); + + /* Disable interrupts very briefly so that both the symbol table and its + * size are set as a single atomic operation. + */ + + flags = irqsave(); + g_exec_symtab = symtab; + g_exec_nsymbols = nsymbols; + irqrestore(flags); +} + +#endif /* CONFIG_LIBC_EXECFUNCS */ \ No newline at end of file diff --git a/nuttx/libc/unistd/lib_execv.c b/nuttx/libc/unistd/lib_execv.c index 6d09bf4815..e35138be5e 100644 --- a/nuttx/libc/unistd/lib_execv.c +++ b/nuttx/libc/unistd/lib_execv.c @@ -51,27 +51,6 @@ /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ -/* If CONFIG_LIBC_EXECFUNCS is defined in the configuration, then the - * following must also be defined: - */ - -/* Symbol table used by exec[l|v] */ - -#ifndef CONFIG_EXECFUNCS_SYMTAB -# error "CONFIG_EXECFUNCS_SYMTAB must be defined" -#endif - -/* Number of Symbols in the Table */ - -#ifndef CONFIG_EXECFUNCS_NSYMBOLS -# error "CONFIG_EXECFUNCS_NSYMBOLS must be defined" -#endif - -/**************************************************************************** - * Public Variables - ****************************************************************************/ - -extern struct symtab_s CONFIG_EXECFUNCS_SYMTAB; /**************************************************************************** * Private Variables @@ -140,13 +119,17 @@ extern struct symtab_s CONFIG_EXECFUNCS_SYMTAB; int execv(FAR const char *path, FAR char *const argv[]) { + FAR struct symtab_s *symtab; + int nsymbols; int ret; + /* Get the current symbol table selection */ + + exec_getsymtab(&symtab, &nsymbols); + /* Start the task */ - ret = exec(path, (FAR const char **)argv, - &CONFIG_EXECFUNCS_SYMTAB, CONFIG_EXECFUNCS_NSYMBOLS); - + ret = exec(path, (FAR const char **)argv, symtab, nsymbols); if (ret < 0) { sdbg("exec failed: %d\n", errno); From f011bd7ef6f91261969ae08655016b8a7b41a796 Mon Sep 17 00:00:00 2001 From: patacongo Date: Thu, 10 Jan 2013 21:39:57 +0000 Subject: [PATCH 060/118] Added a test of posix_spawn() git-svn-id: http://svn.code.sf.net/p/nuttx/code/trunk@5507 42af7a65-404d-4744-a932-0658087f49c3 --- apps/ChangeLog.txt | 1 + apps/examples/Kconfig | 1 + apps/examples/elf/tests/Makefile | 18 +- apps/examples/elf/tests/mksymtab.sh | 18 +- apps/examples/nxflat/tests/Makefile | 4 +- apps/examples/posix_spawn/Kconfig | 29 + apps/examples/posix_spawn/Makefile | 110 +++ apps/examples/posix_spawn/filesystem/Makefile | 85 +++ .../posix_spawn/filesystem/mksymtab.sh | 51 ++ .../posix_spawn/filesystem/program/Makefile | 59 ++ .../posix_spawn/filesystem/program/program.c | 60 ++ .../posix_spawn/filesystem/testdata.txt | 2 + apps/examples/posix_spawn/spawn_main.c | 356 ++++++++++ nuttx/ChangeLog | 2 + .../stm32f4discovery/posix_spawn/Make.defs | 130 ++++ .../stm32f4discovery/posix_spawn/defconfig | 625 ++++++++++++++++++ .../stm32f4discovery/posix_spawn/setenv.sh | 79 +++ nuttx/libc/unistd/lib_execsymtab.c | 6 +- 18 files changed, 1605 insertions(+), 31 deletions(-) create mode 100644 apps/examples/posix_spawn/Kconfig create mode 100644 apps/examples/posix_spawn/Makefile create mode 100644 apps/examples/posix_spawn/filesystem/Makefile create mode 100755 apps/examples/posix_spawn/filesystem/mksymtab.sh create mode 100644 apps/examples/posix_spawn/filesystem/program/Makefile create mode 100644 apps/examples/posix_spawn/filesystem/program/program.c create mode 100644 apps/examples/posix_spawn/filesystem/testdata.txt create mode 100644 apps/examples/posix_spawn/spawn_main.c create mode 100644 nuttx/configs/stm32f4discovery/posix_spawn/Make.defs create mode 100644 nuttx/configs/stm32f4discovery/posix_spawn/defconfig create mode 100755 nuttx/configs/stm32f4discovery/posix_spawn/setenv.sh diff --git a/apps/ChangeLog.txt b/apps/ChangeLog.txt index cd15b430db..6b63527a7e 100644 --- a/apps/ChangeLog.txt +++ b/apps/ChangeLog.txt @@ -461,4 +461,5 @@ the USB HID keyboard report data. * apps/examples/wlan: Remove non-functional example. * apps/examples/ostest/vfork.c: Added a test of vfork(). + * apps/exampes/posix_spawn: Added a test of poxis_spawn(). diff --git a/apps/examples/Kconfig b/apps/examples/Kconfig index b0cbd70886..ec0a97dd46 100644 --- a/apps/examples/Kconfig +++ b/apps/examples/Kconfig @@ -39,6 +39,7 @@ source "$APPSDIR/examples/pashello/Kconfig" source "$APPSDIR/examples/pipe/Kconfig" source "$APPSDIR/examples/poll/Kconfig" source "$APPSDIR/examples/pwm/Kconfig" +source "$APPSDIR/examples/posix_spawn/Kconfig" source "$APPSDIR/examples/qencoder/Kconfig" source "$APPSDIR/examples/relays/Kconfig" source "$APPSDIR/examples/rgmp/Kconfig" diff --git a/apps/examples/elf/tests/Makefile b/apps/examples/elf/tests/Makefile index 778dd64802..7551995064 100644 --- a/apps/examples/elf/tests/Makefile +++ b/apps/examples/elf/tests/Makefile @@ -66,7 +66,7 @@ SYMTAB_SRC = $(TESTS_DIR)/symtab.c define DIR_template $(1)_$(2): - @$(MAKE) -C $(1) $(3) TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)" ROMFS_DIR="$(ROMFS_DIR)" CROSSDEV=$(CROSSDEV) + $(Q) $(MAKE) -C $(1) $(3) TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)" ROMFS_DIR="$(ROMFS_DIR)" CROSSDEV=$(CROSSDEV) endef all: $(ROMFS_HDR) $(DIRLIST_HDR) $(SYMTAB_SRC) @@ -87,7 +87,7 @@ install: $(foreach DIR, $(BUILD_SUBDIRS), $(DIR)_install) # Create the romfs directory $(ROMFS_DIR): - @mkdir $(ROMFS_DIR) + $(Q) mkdir $(ROMFS_DIR) # Populate the romfs directory @@ -96,25 +96,25 @@ populate: $(ROMFS_DIR) build install # Create the romfs.img file from the populated romfs directory $(ROMFS_IMG): populate - @genromfs -f $@ -d $(ROMFS_DIR) -V "ELFTEST" + $(Q) genromfs -f $@ -d $(ROMFS_DIR) -V "ELFTEST" # Create the romfs.h header file from the romfs.img file $(ROMFS_HDR) : $(ROMFS_IMG) - @(cd $(TESTS_DIR); xxd -i romfs.img | sed -e "s/^unsigned/static const unsigned/g" >$@) + $(Q) (cd $(TESTS_DIR); xxd -i romfs.img | sed -e "s/^unsigned/static const unsigned/g" >$@) # Create the dirlist.h header file from the romfs directory $(DIRLIST_HDR) : populate - @$(TESTS_DIR)/mkdirlist.sh $(ROMFS_DIR) >$@ + $(Q) $(TESTS_DIR)/mkdirlist.sh $(ROMFS_DIR) >$@ -# Create the exported symbol table list from the derived *-thunk.S files +# Create the exported symbol table $(SYMTAB_SRC): build - @$(TESTS_DIR)/mksymtab.sh -t varlist.tmp $(ROMFS_DIR) >$@ + $(Q) $(TESTS_DIR)/mksymtab.sh $(ROMFS_DIR) >$@ # Clean each subdirectory clean: $(foreach DIR, $(ALL_SUBDIRS), $(DIR)_clean) - @rm -f $(ROMFS_HDR) $(ROMFS_IMG) $(SYMTAB_SRC) varlist.tmp - @rm -rf $(ROMFS_DIR) $(DIRLIST_HDR) + $(Q) rm -f $(ROMFS_HDR) $(DIRLIST_HDR) $(ROMFS_IMG) $(SYMTAB_SRC) + $(Q) rm -rf $(ROMFS_DIR) diff --git a/apps/examples/elf/tests/mksymtab.sh b/apps/examples/elf/tests/mksymtab.sh index 56be10f73d..51408a89cb 100755 --- a/apps/examples/elf/tests/mksymtab.sh +++ b/apps/examples/elf/tests/mksymtab.sh @@ -1,22 +1,6 @@ #!/bin/bash -usage="Usage: $0 [-t ] " - -# Check for the optional tempory file name - -tmpfile=varlist.tmp -if [ "X${1}" = "X-t" ]; then - shift - tmpfile=$1 - shift - - if [ -z "$tmpfile" ]; then - echo "ERROR: Missing " - echo "" - echo $usage - exit 1 - fi -fi +usage="Usage: $0 " # Check for the required ROMFS directory path diff --git a/apps/examples/nxflat/tests/Makefile b/apps/examples/nxflat/tests/Makefile index 4979c7fd47..53e43288f9 100644 --- a/apps/examples/nxflat/tests/Makefile +++ b/apps/examples/nxflat/tests/Makefile @@ -97,7 +97,7 @@ $(SYMTAB): build # Clean each subdirectory clean: $(foreach DIR, $(SUBDIRS), $(DIR)_clean) - @rm -f $(ROMFS_HDR) $(ROMFS_IMG) $(SYMTAB) - @rm -rf $(ROMFS_DIR) $(ROMFS_DIRLIST) + @rm -f $(ROMFS_HDR) $(ROMFS_DIRLIST) $(ROMFS_IMG) $(SYMTAB) + @rm -rf $(ROMFS_DIR) diff --git a/apps/examples/posix_spawn/Kconfig b/apps/examples/posix_spawn/Kconfig new file mode 100644 index 0000000000..5080659132 --- /dev/null +++ b/apps/examples/posix_spawn/Kconfig @@ -0,0 +1,29 @@ +# +# For a description of the syntax of this configuration file, +# see misc/tools/kconfig-language.txt. +# + +config EXAMPLES_POSIXSPAWN + bool "posix_spawn Unit Test" + default n + ---help--- + Enable the posix_spawn() unit test + +if EXAMPLES_POSIXSPAWN +config EXAMPLES_POSIXSPAWN_DEVMINOR + int "ROMFS Minor Device Number" + default 0 + ---help--- + The minor device number of the ROMFS block. For example, the N in /dev/ramN. + Used for registering the RAM block driver that will hold the ROMFS file system + containing the ELF executables to be tested. Default: 0 + +config EXAMPLES_POSIXSPAWN_DEVPATH + string "ROMFS Devie Path" + default "/dev/ram0" + ---help--- + The path to the ROMFS block driver device. This must match EXAMPLES_POSIXSPAWN_DEVMINOR. + Used for registering the RAM block driver that will hold the ROMFS file system + containing the ELF executables to be tested. Default: "/dev/ram0" + +endif diff --git a/apps/examples/posix_spawn/Makefile b/apps/examples/posix_spawn/Makefile new file mode 100644 index 0000000000..d21c8f8560 --- /dev/null +++ b/apps/examples/posix_spawn/Makefile @@ -0,0 +1,110 @@ +############################################################################ +# apps/examples/posix_spawn/Makefile +# +# Copyright (C) 2013 Gregory Nutt. All rights reserved. +# Author: Gregory Nutt +# +# 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 +-include $(TOPDIR)/Make.defs +include $(APPDIR)/Make.defs + +# ELF Example + +ASRCS = +CSRCS = spawn_main.c symtab.c + +AOBJS = $(ASRCS:.S=$(OBJEXT)) +COBJS = $(CSRCS:.c=$(OBJEXT)) + +SRCS = $(ASRCS) $(CSRCS) +OBJS = $(AOBJS) $(COBJS) + +ifeq ($(CONFIG_WINDOWS_NATIVE),y) + BIN = ..\..\libapps$(LIBEXT) +else +ifeq ($(WINTOOL),y) + BIN = ..\\..\\libapps$(LIBEXT) +else + BIN = ../../libapps$(LIBEXT) +endif +endif + +ROOTDEPPATH = --dep-path . --dep-path filesystem + +# Build targets + +VPATH = filesystem + +all: .built +.PHONY: really_build clean_filesystem clean depend distclean + +$(AOBJS): %$(OBJEXT): %.S + $(call ASSEMBLE, $<, $@) + +$(COBJS): %$(OBJEXT): %.c + $(call COMPILE, $<, $@) + +# This is a little messy. The build is broken into two pieces: (1) the +# filesystem/ subdir build that auto-generates several files, and (2) the real +# build. This is done because we need a fresh build context after auto- +# generating the source files. + +really_build: $(OBJS) + $(call ARCHIVE, $(BIN), $(OBJS)) + @touch .built + +.built: + @$(MAKE) -C filesystem TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)" CROSSDEV=$(CROSSDEV) + @$(MAKE) TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)" really_build + +context: + +# We can't make dependencies in this directory because the required +# header files may not yet exist. + +.depend: + @touch $@ + +depend: .depend + +clean_filesystem: + @$(MAKE) -C filesystem TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)" CROSSDEV=$(CROSSDEV) clean + +clean: clean_filesystem + $(call DELFILE, .built) + $(call CLEAN) + +distclean: clean + $(call DELFILE, Make.dep) + $(call DELFILE, .depend) + +-include Make.dep diff --git a/apps/examples/posix_spawn/filesystem/Makefile b/apps/examples/posix_spawn/filesystem/Makefile new file mode 100644 index 0000000000..19a02bb80b --- /dev/null +++ b/apps/examples/posix_spawn/filesystem/Makefile @@ -0,0 +1,85 @@ +############################################################################ +# apps/examples/posix_spawn/filesystem/Makefile +# +# Copyright (C) 2013 Gregory Nutt. All rights reserved. +# Author: Gregory Nutt +# +# 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)/Make.defs +include $(APPDIR)$(DELIM)Make.defs + +SPAWN_DIR = $(APPDIR)$(DELIM)examples$(DELIM)posix_spawn +FILESYSTEM_DIR = $(SPAWN_DIR)$(DELIM)filesystem +ROMFS_DIR = $(FILESYSTEM_DIR)$(DELIM)romfs +ROMFS_IMG = $(FILESYSTEM_DIR)$(DELIM)romfs.img +ROMFS_HDR = $(FILESYSTEM_DIR)$(DELIM)romfs.h +SYMTAB_SRC = $(FILESYSTEM_DIR)$(DELIM)symtab.c + +all: $(ROMFS_HDR) $(SYMTAB_SRC) +.PHONY: all program clean install populate + +# Create the romfs directory + +$(ROMFS_DIR): + $(Q) mkdir $(ROMFS_DIR) + +# Build the test program + +program: $(ROMFS_DIR) + $(Q) $(MAKE) -C program program TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)" ROMFS_DIR="$(ROMFS_DIR)" + +# Install the test program in the romfs directory + +install: program testdata.txt + $(Q) $(MAKE) -C program install TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)" ROMFS_DIR="$(ROMFS_DIR)" + $(Q) install --mode=0644 testdata.txt $(ROMFS_DIR)/testdata.txt + +# Create the romfs.img file from the romfs directory + +$(ROMFS_IMG): install + $(Q) genromfs -f $@ -d $(ROMFS_DIR) -V "POSIXSPAWN" + +# Create the romfs.h header file from the romfs.img file + +$(ROMFS_HDR) : $(ROMFS_IMG) + $(Q) (cd $(FILESYSTEM_DIR); xxd -i romfs.img | sed -e "s/^unsigned/static const unsigned/g" >$@) + +# Create the exported symbol table + +$(SYMTAB_SRC): program + $(Q) $(FILESYSTEM_DIR)$(DELIM)mksymtab.sh $(ROMFS_DIR) >$@ + +# Clean each subdirectory + +clean: + $(Q) $(MAKE) -C program clean TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)" ROMFS_DIR="$(ROMFS_DIR)" + $(Q) rm -f $(ROMFS_HDR) $(ROMFS_IMG) $(SYMTAB_SRC) + $(Q) rm -rf $(ROMFS_DIR) diff --git a/apps/examples/posix_spawn/filesystem/mksymtab.sh b/apps/examples/posix_spawn/filesystem/mksymtab.sh new file mode 100755 index 0000000000..51408a89cb --- /dev/null +++ b/apps/examples/posix_spawn/filesystem/mksymtab.sh @@ -0,0 +1,51 @@ +#!/bin/bash + +usage="Usage: $0 " + +# Check for the required ROMFS directory path + +dir=$1 +if [ -z "$dir" ]; then + echo "ERROR: Missing " + echo "" + echo $usage + exit 1 +fi + +if [ ! -d "$dir" ]; then + echo "ERROR: Directory $dir does not exist" + echo "" + echo $usage + exit 1 +fi + +# Extract all of the undefined symbols from the ELF files and create a +# list of sorted, unique undefined variable names. + +varlist=`find ${dir} -executable -type f | xargs nm | fgrep ' U ' | sed -e "s/^[ ]*//g" | cut -d' ' -f2 | sort | uniq` + +# Now output the symbol table as a structure in a C source file. All +# undefined symbols are declared as void* types. If the toolchain does +# any kind of checking for function vs. data objects, then this could +# faile + +echo "#include " +echo "#include " +echo "" + +for var in $varlist; do + echo "extern void *${var};" +done + +echo "" +echo "const struct symtab_s exports[] = " +echo "{" + +for var in $varlist; do + echo " {\"${var}\", &${var}}," +done + +echo "};" +echo "" +echo "const int nexports = sizeof(exports) / sizeof(struct symtab_s);" + diff --git a/apps/examples/posix_spawn/filesystem/program/Makefile b/apps/examples/posix_spawn/filesystem/program/Makefile new file mode 100644 index 0000000000..cf55797b2b --- /dev/null +++ b/apps/examples/posix_spawn/filesystem/program/Makefile @@ -0,0 +1,59 @@ +############################################################################ +# examples/posix_spawn/filesystem/program/Makefile +# +# Copyright (C) 2013 Gregory Nutt. All rights reserved. +# Author: Gregory Nutt +# +# 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)/Make.defs + +BIN = program + +SRCS = $(BIN).c +OBJS = $(SRCS:.c=.o) + +all: $(BIN) + +$(OBJS): %.o: %.c + @echo "CC: $<" + $(Q) $(CC) -c $(CELFFLAGS) $< -o $@ + +$(BIN): $(OBJS) + @echo "LD: $<" + $(Q) $(LD) $(LDELFFLAGS) -o $@ $^ + +clean: + $(call DELFILE, $(BIN)) + $(call CLEAN) + +install: + $(Q) mkdir -p $(ROMFS_DIR) + $(Q) install --mode=0755 $(BIN) $(ROMFS_DIR)/$(BIN) diff --git a/apps/examples/posix_spawn/filesystem/program/program.c b/apps/examples/posix_spawn/filesystem/program/program.c new file mode 100644 index 0000000000..f63b559c84 --- /dev/null +++ b/apps/examples/posix_spawn/filesystem/program/program.c @@ -0,0 +1,60 @@ +/**************************************************************************** + * examples/posix_spawn/filesystem/program/program.c + * + * Copyright (C) 2013 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * 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. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +int main(int argc, char **argv) +{ + int ch; + + /* stdin should have been redirected to testdata.txt. Read and print until + * we hit the end of file. + */ + + while ((ch = getchar()) != EOF) + { + putchar(ch); + } + + return 0; +} diff --git a/apps/examples/posix_spawn/filesystem/testdata.txt b/apps/examples/posix_spawn/filesystem/testdata.txt new file mode 100644 index 0000000000..bb581fbb51 --- /dev/null +++ b/apps/examples/posix_spawn/filesystem/testdata.txt @@ -0,0 +1,2 @@ +Now is the time for all good men to come to the aid of their party. + diff --git a/apps/examples/posix_spawn/spawn_main.c b/apps/examples/posix_spawn/spawn_main.c new file mode 100644 index 0000000000..3e3a7b1b12 --- /dev/null +++ b/apps/examples/posix_spawn/spawn_main.c @@ -0,0 +1,356 @@ +/**************************************************************************** + * examples/posix_spawn/spawn_main.c + * + * Copyright (C) 2013 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * 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. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include +#include + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include "filesystem/romfs.h" + +/**************************************************************************** + * Definitions + ****************************************************************************/ + +/* Check configuration. This is not all of the configuration settings that + * are required -- only the more obvious. + */ + +#if CONFIG_NFILE_DESCRIPTORS < 1 +# error "You must provide file descriptors via CONFIG_NFILE_DESCRIPTORS in your configuration file" +#endif + +#ifdef CONFIG_BINFMT_DISABLE +# error "The binary loader is disabled (CONFIG_BINFMT_DISABLE)!" +#endif + +#ifndef CONFIG_ELF +# error "You must select CONFIG_ELF in your configuration file" +#endif + +#ifndef CONFIG_FS_ROMFS +# error "You must select CONFIG_FS_ROMFS in your configuration file" +#endif + +#ifdef CONFIG_DISABLE_MOUNTPOINT +# error "You must not disable mountpoints via CONFIG_DISABLE_MOUNTPOINT in your configuration file" +#endif + +#ifdef CONFIG_BINFMT_DISABLE +# error "You must not disable loadable modules via CONFIG_BINFMT_DISABLE in your configuration file" +#endif + +/* Describe the ROMFS file system */ + +#define SECTORSIZE 512 +#define NSECTORS(b) (((b)+SECTORSIZE-1)/SECTORSIZE) +#define MOUNTPT "/mnt/romfs" + +#ifndef CONFIG_EXAMPLES_ELF_DEVMINOR +# define CONFIG_EXAMPLES_ELF_DEVMINOR 0 +#endif + +#ifndef CONFIG_EXAMPLES_ELF_DEVPATH +# define CONFIG_EXAMPLES_ELF_DEVPATH "/dev/ram0" +#endif + +/* If CONFIG_DEBUG is enabled, use dbg instead of printf so that the + * output will be synchronous with the debug output. + */ + +#ifdef CONFIG_CPP_HAVE_VARARGS +# ifdef CONFIG_DEBUG +# define message(format, arg...) dbg(format, ##arg) +# define err(format, arg...) dbg(format, ##arg) +# else +# define message(format, arg...) printf(format, ##arg) +# define err(format, arg...) fprintf(stderr, format, ##arg) +# endif +#else +# ifdef CONFIG_DEBUG +# define message dbg +# define err dbg +# else +# define message printf +# define err printf +# endif +#endif + +/**************************************************************************** + * Private Types + ****************************************************************************/ + +/**************************************************************************** + * Private Data + ****************************************************************************/ + +static unsigned int g_mminitial; /* Initial memory usage */ +static unsigned int g_mmstep; /* Memory Usage at beginning of test step */ + +static const char delimiter[] = + "****************************************************************************"; +static const char program[] = "program"; +static const char data[] = "testdata.txt"; + +static char fullpath[128]; + +/**************************************************************************** + * Symbols from Auto-Generated Code + ****************************************************************************/ + +extern const struct symtab_s exports[]; +extern const int nexports; + +/**************************************************************************** + * Private Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: mm_update + ****************************************************************************/ + +static void mm_update(FAR unsigned int *previous, FAR const char *msg) +{ + struct mallinfo mmcurrent; + + /* Get the current memory usage */ + +#ifdef CONFIG_CAN_PASS_STRUCTS + mmcurrent = mallinfo(); +#else + (void)mallinfo(&mmcurrent); +#endif + + /* Show the change from the previous time */ + + printf("\nMemory Usage %s:\n", msg); + printf(" Before: %8u After: %8u Change: %8d\n", + *previous, mmcurrent.uordblks, (int)mmcurrent.uordblks - (int)*previous); + + /* Set up for the next test */ + + *previous = mmcurrent.uordblks; +} + +/**************************************************************************** + * Name: mm_initmonitor + ****************************************************************************/ + +static void mm_initmonitor(void) +{ + struct mallinfo mmcurrent; + +#ifdef CONFIG_CAN_PASS_STRUCTS + mmcurrent = mallinfo(); +#else + (void)mallinfo(&mmcurrent); +#endif + + g_mminitial = mmcurrent.uordblks; + g_mmstep = mmcurrent.uordblks; + + printf("Initial memory usage: %d\n", mmcurrent.uordblks); +} + +/**************************************************************************** + * Name: testheader + ****************************************************************************/ + +static inline void testheader(FAR const char *progname) +{ + message("\n%s\n* Executing %s\n%s\n\n", delimiter, progname, delimiter); +} + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: spawn_main + ****************************************************************************/ + +int spawn_main(int argc, char *argv[]) +{ + posix_spawn_file_actions_t file_actions; + posix_spawnattr_t attr; + FAR const char *filepath; + pid_t pid; + int ret; + + /* Initialize the memory monitor */ + + mm_initmonitor(); + + /* Initialize the ELF binary loader */ + + message("Initializing the ELF binary loader\n"); + ret = elf_initialize(); + if (ret < 0) + { + err("ERROR: Initialization of the ELF loader failed: %d\n", ret); + exit(1); + } + + mm_update(&g_mmstep, "after elf_initialize"); + + /* Create a ROM disk for the ROMFS filesystem */ + + message("Registering romdisk at /dev/ram%d\n", CONFIG_EXAMPLES_ELF_DEVMINOR); + ret = romdisk_register(CONFIG_EXAMPLES_ELF_DEVMINOR, (FAR uint8_t *)romfs_img, + NSECTORS(romfs_img_len), SECTORSIZE); + if (ret < 0) + { + err("ERROR: romdisk_register failed: %d\n", ret); + elf_uninitialize(); + exit(1); + } + + mm_update(&g_mmstep, "after romdisk_register"); + + /* Mount the file system */ + + message("Mounting ROMFS filesystem at target=%s with source=%s\n", + MOUNTPT, CONFIG_EXAMPLES_ELF_DEVPATH); + + ret = mount(CONFIG_EXAMPLES_ELF_DEVPATH, MOUNTPT, "romfs", MS_RDONLY, NULL); + if (ret < 0) + { + err("ERROR: mount(%s,%s,romfs) failed: %s\n", + CONFIG_EXAMPLES_ELF_DEVPATH, MOUNTPT, errno); + elf_uninitialize(); + } + + mm_update(&g_mmstep, "after mount"); + + /* Does the system support the PATH variable? Has the PATH variable + * already been set? If YES and NO, then set the PATH variable to + * the ROMFS mountpoint. + */ + +#if defined(CONFIG_BINFMT_EXEPATH) && !defined(CONFIG_PATH_INITIAL) + (void)setenv("PATH", MOUNTPT, 1); +#endif + + /* Make sure that we are using our symbol take */ + + exec_setsymtab(exports, nexports); + + /* Output a seperated so that we can clearly discriminate the output of + * this program from the others. + */ + + testheader(program); + + /* Initialize the attributes file actions structure */ + + ret = posix_spawn_file_actions_init(&file_actions); + if (ret != 0) + { + err("ERROR: posix_spawn_file_actions_init failed: %d\n", ret); + } + + ret = posix_spawnattr_init(&attr); + if (ret != 0) + { + err("ERROR: posix_spawnattr_init failed: %d\n", ret); + } + + /* Set up to close stdin (0) and open testdata.txt as the program input */ + + ret = posix_spawn_file_actions_addclose(&file_actions, 0); + if (ret != 0) + { + err("ERROR: posix_spawn_file_actions_addclose failed: %d\n", ret); + } + + snprintf(fullpath, 128, "%s/%s", MOUNTPT, data); + ret = posix_spawn_file_actions_addopen(&file_actions, 0, fullpath, O_RDONLY, 0644); + if (ret != 0) + { + err("ERROR: posix_spawn_file_actions_addopen failed: %d\n", ret); + } + + /* If the binary loader does not support the PATH variable, then + * create the full path to the executable program. Otherwise, + * use the relative path so that the binary loader will have to + * search the PATH variable to find the executable. + */ + +#ifdef CONFIG_BINFMT_EXEPATH + filepath = program; +#else + snprintf(fullpath, 128, "%s/%s", MOUNTPT, program); + filepath = fullpath; +#endif + + /* Execute the program */ + + mm_update(&g_mmstep, "before posix_spawn"); + + ret = posix_spawn(&pid, filepath, &file_actions, &attr, NULL, NULL); + if (ret != 0) + { + err("ERROR: posix_spawn failed: %d\n", ret); + } + + sleep(1); + mm_update(&g_mmstep, "after posix_spawn"); + + /* Clean-up */ + + (void)posix_spawn_file_actions_destroy(&file_actions); + (void)posix_spawnattr_destroy(&attr); + elf_uninitialize(); + + mm_update(&g_mmstep, "End-of-Test"); + return 0; +} diff --git a/nuttx/ChangeLog b/nuttx/ChangeLog index 421b1ca60b..7ddc4901e8 100644 --- a/nuttx/ChangeLog +++ b/nuttx/ChangeLog @@ -3903,4 +3903,6 @@ untested and undocumented. * drivers/usbdev/pl2303.c: Fix typols in the PL2303 driver (from Max Holtzberg). + * configs/stm32f4discovery/posix_spawn: Added a configuration + that can be used for testing posix_spawn(). diff --git a/nuttx/configs/stm32f4discovery/posix_spawn/Make.defs b/nuttx/configs/stm32f4discovery/posix_spawn/Make.defs new file mode 100644 index 0000000000..34b9f7febe --- /dev/null +++ b/nuttx/configs/stm32f4discovery/posix_spawn/Make.defs @@ -0,0 +1,130 @@ +############################################################################ +# configs/stm32f4discovery/posix_spawn/Make.defs +# +# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved. +# Author: Gregory Nutt +# +# 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 +include ${TOPDIR}/tools/Config.mk +include ${TOPDIR}/arch/arm/src/armv7-m/Toolchain.defs + +LDSCRIPT = ld.script + +ifeq ($(WINTOOL),y) + # Windows-native toolchains + DIRLINK = $(TOPDIR)/tools/copydir.sh + DIRUNLINK = $(TOPDIR)/tools/unlink.sh + MKDEP = $(TOPDIR)/tools/mknulldeps.sh + ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" + ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}" + ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/scripts/$(LDSCRIPT)}" + MAXOPTIMIZATION = -O2 +else + # Linux/Cygwin-native toolchain + MKDEP = $(TOPDIR)/tools/mkdeps.sh + ARCHINCLUDES = -I. -isystem $(TOPDIR)/include + ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx + ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/scripts/$(LDSCRIPT) +endif + +CC = $(CROSSDEV)gcc +CXX = $(CROSSDEV)g++ +CPP = $(CROSSDEV)gcc -E +LD = $(CROSSDEV)ld +AR = $(ARCROSSDEV)ar rcs +NM = $(ARCROSSDEV)nm +OBJCOPY = $(CROSSDEV)objcopy +OBJDUMP = $(CROSSDEV)objdump + +ARCHCCVERSION = ${shell $(CC) -v 2>&1 | sed -n '/^gcc version/p' | sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q'} +ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1} + +ifeq ($(CONFIG_DEBUG_SYMBOLS),y) + ARCHOPTIMIZATION = -g +else + ARCHOPTIMIZATION = $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer +endif + +ARCHCFLAGS = -fno-builtin +ARCHCXXFLAGS = -fno-builtin -fno-exceptions -fno-rtti +ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow +ARCHWARNINGSXX = -Wall -Wshadow +ARCHDEFINES = +ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10 + +CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe +CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS) +CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe +CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS) +CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) +AFLAGS = $(CFLAGS) -D__ASSEMBLY__ + +# NXFLAT module definitions + +NXFLATLDFLAGS1 = -r -d -warn-common +NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat-pcrel.ld -no-check-sections +LDNXFLATFLAGS = -e main -s 2048 + +# ELF module definitions + +CELFFLAGS = $(CFLAGS) -mlong-calls # --target1-abs +CXXELFFLAGS = $(CXXFLAGS) -mlong-calls # --target1-abs + +LDELFFLAGS = -r -e main +ifeq ($(WINTOOL),y) + LDELFFLAGS += -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/scripts/gnu-elf.ld}" +else + LDELFFLAGS += -T $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/scripts/gnu-elf.ld +endif + +# File extensions + +OBJEXT = .o +LIBEXT = .a +EXEEXT = + +# Linker flags + +ifneq ($(CROSSDEV),arm-nuttx-elf-) + LDFLAGS += -nostartfiles -nodefaultlibs +endif +ifeq ($(CONFIG_DEBUG_SYMBOLS),y) + LDFLAGS += -g +endif + +# Host tools + +HOSTCC = gcc +HOSTINCLUDES = -I. +HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe +HOSTLDFLAGS = + diff --git a/nuttx/configs/stm32f4discovery/posix_spawn/defconfig b/nuttx/configs/stm32f4discovery/posix_spawn/defconfig new file mode 100644 index 0000000000..b908393d87 --- /dev/null +++ b/nuttx/configs/stm32f4discovery/posix_spawn/defconfig @@ -0,0 +1,625 @@ +# +# Automatically generated file; DO NOT EDIT. +# Nuttx/ Configuration +# +CONFIG_NUTTX_NEWCONFIG=y + +# +# Build Setup +# +# CONFIG_EXPERIMENTAL is not set +# CONFIG_HOST_LINUX is not set +# CONFIG_HOST_OSX is not set +CONFIG_HOST_WINDOWS=y +# CONFIG_HOST_OTHER is not set +# CONFIG_WINDOWS_NATIVE is not set +CONFIG_WINDOWS_CYGWIN=y +# CONFIG_WINDOWS_MSYS is not set +# CONFIG_WINDOWS_OTHER is not set + +# +# Build Configuration +# +# CONFIG_APPS_DIR="../apps" +# CONFIG_BUILD_2PASS is not set + +# +# Binary Output Formats +# +# CONFIG_RRLOAD_BINARY is not set +CONFIG_INTELHEX_BINARY=y +# CONFIG_MOTOROLA_SREC is not set +# CONFIG_RAW_BINARY is not set + +# +# Customize Header Files +# +# CONFIG_ARCH_STDBOOL_H is not set +# CONFIG_ARCH_MATH_H is not set +# CONFIG_ARCH_FLOAT_H is not set +# CONFIG_ARCH_STDARG_H is not set + +# +# Debug Options +# +# CONFIG_DEBUG is not set +# CONFIG_DEBUG_SYMBOLS is not set + +# +# System Type +# +# CONFIG_ARCH_8051 is not set +CONFIG_ARCH_ARM=y +# CONFIG_ARCH_AVR is not set +# CONFIG_ARCH_HC is not set +# CONFIG_ARCH_MIPS is not set +# CONFIG_ARCH_RGMP is not set +# CONFIG_ARCH_SH is not set +# CONFIG_ARCH_SIM is not set +# CONFIG_ARCH_X86 is not set +# CONFIG_ARCH_Z16 is not set +# CONFIG_ARCH_Z80 is not set +CONFIG_ARCH="arm" + +# +# ARM Options +# +# CONFIG_ARCH_CHIP_C5471 is not set +# CONFIG_ARCH_CHIP_CALYPSO is not set +# CONFIG_ARCH_CHIP_DM320 is not set +# CONFIG_ARCH_CHIP_IMX is not set +# CONFIG_ARCH_CHIP_KINETIS is not set +# CONFIG_ARCH_CHIP_LM is not set +# CONFIG_ARCH_CHIP_LPC17XX is not set +# CONFIG_ARCH_CHIP_LPC214X is not set +# CONFIG_ARCH_CHIP_LPC2378 is not set +# CONFIG_ARCH_CHIP_LPC31XX is not set +# CONFIG_ARCH_CHIP_LPC43XX is not set +# CONFIG_ARCH_CHIP_SAM3U is not set +CONFIG_ARCH_CHIP_STM32=y +# CONFIG_ARCH_CHIP_STR71X is not set +CONFIG_ARCH_CORTEXM4=y +CONFIG_ARCH_FAMILY="armv7-m" +CONFIG_ARCH_CHIP="stm32" +CONFIG_ARCH_HAVE_CMNVECTOR=y +# CONFIG_ARMV7M_CMNVECTOR is not set +# CONFIG_ARCH_FPU is not set +CONFIG_ARCH_HAVE_MPU=y +# CONFIG_ARMV7M_MPU is not set +CONFIG_BOARD_LOOPSPERMSEC=16717 +# CONFIG_ARCH_CALIBRATION is not set + +# +# ARMV7M Configuration Options +# +# CONFIG_ARMV7M_TOOLCHAIN_ATOLLIC is not set +# CONFIG_ARMV7M_TOOLCHAIN_BUILDROOT is not set +# CONFIG_ARMV7M_TOOLCHAIN_CODEREDW is not set +CONFIG_ARMV7M_TOOLCHAIN_CODESOURCERYW=y +# CONFIG_ARMV7M_TOOLCHAIN_DEVKITARM is not set +# CONFIG_ARMV7M_TOOLCHAIN_GNU_EABI is not set +# CONFIG_ARMV7M_TOOLCHAIN_RAISONANCE is not set +# CONFIG_SERIAL_TERMIOS is not set + +# +# STM32 Configuration Options +# +# CONFIG_ARCH_CHIP_STM32F100C8 is not set +# CONFIG_ARCH_CHIP_STM32F100CB is not set +# CONFIG_ARCH_CHIP_STM32F100R8 is not set +# CONFIG_ARCH_CHIP_STM32F100RB is not set +# CONFIG_ARCH_CHIP_STM32F100RC is not set +# CONFIG_ARCH_CHIP_STM32F100RD is not set +# CONFIG_ARCH_CHIP_STM32F100RE is not set +# CONFIG_ARCH_CHIP_STM32F100V8 is not set +# CONFIG_ARCH_CHIP_STM32F100VB is not set +# CONFIG_ARCH_CHIP_STM32F100VC is not set +# CONFIG_ARCH_CHIP_STM32F100VD is not set +# CONFIG_ARCH_CHIP_STM32F100VE is not set +# CONFIG_ARCH_CHIP_STM32F103RET6 is not set +# CONFIG_ARCH_CHIP_STM32F103VCT6 is not set +# CONFIG_ARCH_CHIP_STM32F103VET6 is not set +# CONFIG_ARCH_CHIP_STM32F103ZET6 is not set +# CONFIG_ARCH_CHIP_STM32F105VBT7 is not set +# CONFIG_ARCH_CHIP_STM32F107VC is not set +# CONFIG_ARCH_CHIP_STM32F207IG is not set +# CONFIG_ARCH_CHIP_STM32F405RG is not set +# CONFIG_ARCH_CHIP_STM32F405VG is not set +# CONFIG_ARCH_CHIP_STM32F405ZG is not set +# CONFIG_ARCH_CHIP_STM32F407VE is not set +CONFIG_ARCH_CHIP_STM32F407VG=y +# CONFIG_ARCH_CHIP_STM32F407ZE is not set +# CONFIG_ARCH_CHIP_STM32F407ZG is not set +# CONFIG_ARCH_CHIP_STM32F407IE is not set +# CONFIG_ARCH_CHIP_STM32F407IG is not set +CONFIG_STM32_STM32F40XX=y +# CONFIG_STM32_DFU is not set + +# +# STM32 Peripheral Support +# +# CONFIG_STM32_ADC1 is not set +# CONFIG_STM32_ADC2 is not set +# CONFIG_STM32_ADC3 is not set +# CONFIG_STM32_BKPSRAM is not set +# CONFIG_STM32_CAN1 is not set +# CONFIG_STM32_CAN2 is not set +# CONFIG_STM32_CCMDATARAM is not set +# CONFIG_STM32_CRC is not set +# CONFIG_STM32_CRYP is not set +# CONFIG_STM32_DMA1 is not set +# CONFIG_STM32_DMA2 is not set +# CONFIG_STM32_DAC1 is not set +# CONFIG_STM32_DAC2 is not set +# CONFIG_STM32_DCMI is not set +# CONFIG_STM32_ETHMAC is not set +# CONFIG_STM32_FSMC is not set +# CONFIG_STM32_HASH is not set +# CONFIG_STM32_I2C1 is not set +# CONFIG_STM32_I2C2 is not set +# CONFIG_STM32_I2C3 is not set +# CONFIG_STM32_IWDG is not set +# CONFIG_STM32_OTGFS is not set +# CONFIG_STM32_OTGHS is not set +# CONFIG_STM32_PWR is not set +# CONFIG_STM32_RNG is not set +# CONFIG_STM32_SDIO is not set +# CONFIG_STM32_SPI1 is not set +# CONFIG_STM32_SPI2 is not set +# CONFIG_STM32_SPI3 is not set +CONFIG_STM32_SYSCFG=y +# CONFIG_STM32_TIM1 is not set +# CONFIG_STM32_TIM2 is not set +# CONFIG_STM32_TIM3 is not set +# CONFIG_STM32_TIM4 is not set +# CONFIG_STM32_TIM5 is not set +# CONFIG_STM32_TIM6 is not set +# CONFIG_STM32_TIM7 is not set +# CONFIG_STM32_TIM8 is not set +# CONFIG_STM32_TIM9 is not set +# CONFIG_STM32_TIM10 is not set +# CONFIG_STM32_TIM11 is not set +# CONFIG_STM32_TIM12 is not set +# CONFIG_STM32_TIM13 is not set +# CONFIG_STM32_TIM14 is not set +# CONFIG_STM32_USART1 is not set +CONFIG_STM32_USART2=y +# CONFIG_STM32_USART3 is not set +# CONFIG_STM32_UART4 is not set +# CONFIG_STM32_UART5 is not set +# CONFIG_STM32_USART6 is not set +# CONFIG_STM32_WWDG is not set + +# +# Alternate Pin Mapping +# +# CONFIG_STM32_FLASH_PREFETCH is not set +# CONFIG_STM32_JTAG_DISABLE is not set +# CONFIG_STM32_JTAG_FULL_ENABLE is not set +# CONFIG_STM32_JTAG_NOJNTRST_ENABLE is not set +CONFIG_STM32_JTAG_SW_ENABLE=y +# CONFIG_STM32_FORCEPOWER is not set +# CONFIG_ARCH_BOARD_STM32_CUSTOM_CLOCKCONFIG is not set +CONFIG_STM32_CCMEXCLUDE=y + +# +# U[S]ART Configuration +# +# CONFIG_USART2_RS485 is not set + +# +# USB Host Configuration +# + +# +# Architecture Options +# +# CONFIG_ARCH_NOINTC is not set +# CONFIG_ARCH_DMA is not set +CONFIG_ARCH_IRQPRIO=y +# CONFIG_CUSTOM_STACK is not set +# CONFIG_ADDRENV is not set +CONFIG_ARCH_HAVE_VFORK=y +CONFIG_ARCH_STACKDUMP=y +# CONFIG_ENDIAN_BIG is not set + +# +# Board Settings +# +CONFIG_DRAM_START=0x20000000 +CONFIG_DRAM_SIZE=114688 +CONFIG_ARCH_HAVE_INTERRUPTSTACK=y +CONFIG_ARCH_INTERRUPTSTACK=0 + +# +# Boot options +# +# CONFIG_BOOT_RUNFROMEXTSRAM is not set +CONFIG_BOOT_RUNFROMFLASH=y +# CONFIG_BOOT_RUNFROMISRAM is not set +# CONFIG_BOOT_RUNFROMSDRAM is not set +# CONFIG_BOOT_COPYTORAM is not set + +# +# Board Selection +# +CONFIG_ARCH_BOARD_STM32F4_DISCOVERY=y +# CONFIG_ARCH_BOARD_CUSTOM is not set +CONFIG_ARCH_BOARD="stm32f4discovery" + +# +# Common Board Options +# +CONFIG_ARCH_HAVE_LEDS=y +CONFIG_ARCH_LEDS=y +CONFIG_ARCH_HAVE_BUTTONS=y +# CONFIG_ARCH_BUTTONS is not set +CONFIG_ARCH_HAVE_IRQBUTTONS=y + +# +# Board-Specific Options +# + +# +# RTOS Features +# +CONFIG_MSEC_PER_TICK=10 +CONFIG_RR_INTERVAL=200 +# CONFIG_SCHED_INSTRUMENTATION is not set +CONFIG_TASK_NAME_SIZE=0 +# CONFIG_JULIAN_TIME is not set +CONFIG_START_YEAR=2012 +CONFIG_START_MONTH=10 +CONFIG_START_DAY=26 +CONFIG_DEV_CONSOLE=y +# CONFIG_MUTEX_TYPES is not set +# CONFIG_PRIORITY_INHERITANCE is not set +# CONFIG_FDCLONE_DISABLE is not set +# CONFIG_FDCLONE_STDIO is not set +CONFIG_SDCLONE_DISABLE=y +# CONFIG_SCHED_WORKQUEUE is not set +# CONFIG_SCHED_WAITPID is not set +# CONFIG_SCHED_ATEXIT is not set +# CONFIG_SCHED_ONEXIT is not set +CONFIG_USER_ENTRYPOINT="spawn_main" +CONFIG_DISABLE_OS_API=y +# CONFIG_DISABLE_CLOCK is not set +# CONFIG_DISABLE_POSIX_TIMERS is not set +# CONFIG_DISABLE_PTHREAD is not set +# CONFIG_DISABLE_SIGNALS is not set +# CONFIG_DISABLE_MQUEUE is not set +# CONFIG_DISABLE_MOUNTPOINT is not set +# CONFIG_DISABLE_ENVIRON is not set +# CONFIG_DISABLE_POLL is not set + +# +# Sizes of configurable things (0 disables) +# +CONFIG_MAX_TASKS=16 +CONFIG_MAX_TASK_ARGS=4 +CONFIG_NPTHREAD_KEYS=4 +CONFIG_NFILE_DESCRIPTORS=8 +CONFIG_NFILE_STREAMS=8 +CONFIG_NAME_MAX=32 +CONFIG_PREALLOC_MQ_MSGS=4 +CONFIG_MQ_MAXMSGSIZE=32 +CONFIG_MAX_WDOGPARMS=2 +CONFIG_PREALLOC_WDOGS=4 +CONFIG_PREALLOC_TIMERS=4 + +# +# Stack and heap information +# +CONFIG_IDLETHREAD_STACKSIZE=1024 +CONFIG_USERMAIN_STACKSIZE=2048 +CONFIG_PTHREAD_STACK_MIN=256 +CONFIG_PTHREAD_STACK_DEFAULT=2048 + +# +# Device Drivers +# +CONFIG_DEV_NULL=y +# CONFIG_DEV_ZERO is not set +# CONFIG_LOOP is not set +# CONFIG_RAMDISK is not set +# CONFIG_CAN is not set +# CONFIG_PWM is not set +# CONFIG_I2C is not set +CONFIG_ARCH_HAVE_I2CRESET=y +# CONFIG_SPI is not set +# CONFIG_RTC is not set +# CONFIG_WATCHDOG is not set +# CONFIG_ANALOG is not set +# CONFIG_BCH is not set +# CONFIG_INPUT is not set +# CONFIG_LCD is not set +# CONFIG_MMCSD is not set +# CONFIG_MTD is not set +# CONFIG_PIPES is not set +# CONFIG_PM is not set +# CONFIG_POWER is not set +# CONFIG_SENSORS is not set +# CONFIG_SERCOMM_CONSOLE is not set +CONFIG_SERIAL=y +CONFIG_DEV_LOWCONSOLE=y +# CONFIG_16550_UART is not set +CONFIG_ARCH_HAVE_USART2=y +CONFIG_MCU_SERIAL=y +CONFIG_USART2_SERIAL_CONSOLE=y +# CONFIG_NO_SERIAL_CONSOLE is not set + +# +# USART2 Configuration +# +CONFIG_USART2_RXBUFSIZE=128 +CONFIG_USART2_TXBUFSIZE=128 +CONFIG_USART2_BAUD=115200 +CONFIG_USART2_BITS=8 +CONFIG_USART2_PARITY=0 +CONFIG_USART2_2STOP=0 +# CONFIG_USBDEV is not set +# CONFIG_USBHOST is not set +# CONFIG_WIRELESS is not set + +# +# System Logging Device Options +# + +# +# System Logging +# +# CONFIG_RAMLOG is not set + +# +# Networking Support +# +# CONFIG_NET is not set + +# +# File Systems +# + +# +# File system configuration +# +# CONFIG_FS_FAT is not set +# CONFIG_FS_RAMMAP is not set +# CONFIG_FS_NXFFS is not set +CONFIG_FS_ROMFS=y + +# +# System Logging +# +# CONFIG_SYSLOG is not set + +# +# Graphics Support +# +# CONFIG_NX is not set + +# +# Memory Management +# +# CONFIG_MM_SMALL is not set +CONFIG_MM_REGIONS=2 +# CONFIG_GRAN is not set + +# +# Binary Formats +# +# CONFIG_BINFMT_DISABLE is not set +CONFIG_BINFMT_EXEPATH=y +CONFIG_PATH_INITIAL="/mnt/romfs" +# CONFIG_NXFLAT is not set +CONFIG_ELF=y +CONFIG_ELF_ALIGN_LOG2=2 +CONFIG_ELF_STACKSIZE=2048 +CONFIG_ELF_BUFFERSIZE=128 +CONFIG_ELF_BUFFERINCR=32 +# CONFIG_PIC is not set +CONFIG_BINFMT_CONSTRUCTORS=y +CONFIG_SYMTAB_ORDEREDBYNAME=y + +# +# Library Routines +# + +# +# Standard C Library Options +# +CONFIG_STDIO_BUFFER_SIZE=256 +CONFIG_STDIO_LINEBUFFER=y +CONFIG_NUNGET_CHARS=2 +CONFIG_LIB_HOMEDIR="/" +# CONFIG_LIBM is not set +# CONFIG_NOPRINTF_FIELDWIDTH is not set +# CONFIG_LIBC_FLOATINGPOINT is not set +# CONFIG_EOL_IS_CR is not set +# CONFIG_EOL_IS_LF is not set +# CONFIG_EOL_IS_BOTH_CRLF is not set +CONFIG_EOL_IS_EITHER_CRLF=y +CONFIG_LIBC_EXECFUNCS=y +CONFIG_EXECFUNCS_SYMTAB="exports" +CONFIG_EXECFUNCS_NSYMBOLS=10 +CONFIG_POSIX_SPAWN_STACKSIZE=768 +# CONFIG_LIBC_STRERROR is not set +# CONFIG_LIBC_PERROR_STDOUT is not set +CONFIG_ARCH_LOWPUTC=y +CONFIG_LIB_SENDFILE_BUFSIZE=512 +# CONFIG_ARCH_ROMGETC is not set +# CONFIG_ARCH_OPTIMIZED_FUNCTIONS is not set + +# +# Non-standard Helper Functions +# +# CONFIG_LIB_KBDCODEC is not set + +# +# Basic CXX Support +# +# CONFIG_C99_BOOL8 is not set +CONFIG_HAVE_CXX=y +# CONFIG_HAVE_CXXINITIALIZE is not set +# CONFIG_CXX_NEWLONG is not set + +# +# uClibc++ Standard C++ Library +# +# CONFIG_UCLIBCXX is not set + +# +# Application Configuration +# + +# +# Built-In Applications +# +# CONFIG_BUILTIN is not set + +# +# Examples +# +# CONFIG_EXAMPLES_BUTTONS is not set +# CONFIG_EXAMPLES_CAN is not set +# CONFIG_EXAMPLES_CDCACM is not set +# CONFIG_EXAMPLES_COMPOSITE is not set +# CONFIG_EXAMPLES_CXXTEST is not set +# CONFIG_EXAMPLES_DHCPD is not set +# CONFIG_EXAMPLES_ELF is not set +# CONFIG_EXAMPLES_FTPC is not set +# CONFIG_EXAMPLES_FTPD is not set +# CONFIG_EXAMPLES_HELLO is not set +# CONFIG_EXAMPLES_HELLOXX is not set +# CONFIG_EXAMPLES_JSON is not set +# CONFIG_EXAMPLES_HIDKBD is not set +# CONFIG_EXAMPLES_KEYPADTEST is not set +# CONFIG_EXAMPLES_IGMP is not set +# CONFIG_EXAMPLES_LCDRW is not set +# CONFIG_EXAMPLES_MM is not set +# CONFIG_EXAMPLES_MOUNT is not set +# CONFIG_EXAMPLES_MODBUS is not set +# CONFIG_EXAMPLES_NETTEST is not set +# CONFIG_EXAMPLES_NSH is not set +# CONFIG_EXAMPLES_NULL is not set +# CONFIG_EXAMPLES_NX is not set +# CONFIG_EXAMPLES_NXCONSOLE is not set +# CONFIG_EXAMPLES_NXFFS is not set +# CONFIG_EXAMPLES_NXFLAT is not set +# CONFIG_EXAMPLES_NXHELLO is not set +# CONFIG_EXAMPLES_NXIMAGE is not set +# CONFIG_EXAMPLES_NXLINES is not set +# CONFIG_EXAMPLES_NXTEXT is not set +# CONFIG_EXAMPLES_OSTEST is not set +# CONFIG_EXAMPLES_PASHELLO is not set +# CONFIG_EXAMPLES_PIPE is not set +# CONFIG_EXAMPLES_POLL is not set +CONFIG_EXAMPLES_POSIXSPAWN=y +CONFIG_EXAMPLES_POSIXSPAWN_DEVMINOR=0 +CONFIG_EXAMPLES_POSIXSPAWN_DEVPATH="/dev/ram0" +# CONFIG_EXAMPLES_QENCODER is not set +# CONFIG_EXAMPLES_RGMP is not set +# CONFIG_EXAMPLES_ROMFS is not set +# CONFIG_EXAMPLES_SENDMAIL is not set +# CONFIG_EXAMPLES_SERLOOP is not set +# CONFIG_EXAMPLES_TELNETD is not set +# CONFIG_EXAMPLES_THTTPD is not set +# CONFIG_EXAMPLES_TIFF is not set +# CONFIG_EXAMPLES_TOUCHSCREEN is not set +# CONFIG_EXAMPLES_UDP is not set +# CONFIG_EXAMPLES_UIP is not set +# CONFIG_EXAMPLES_USBSERIAL is not set +# CONFIG_EXAMPLES_USBMSC is not set +# CONFIG_EXAMPLES_USBTERM is not set +# CONFIG_EXAMPLES_WATCHDOG is not set + +# +# Interpreters +# + +# +# Interpreters +# +# CONFIG_INTERPRETERS_FICL is not set +# CONFIG_INTERPRETERS_PCODE is not set + +# +# Network Utilities +# + +# +# Networking Utilities +# +# CONFIG_NETUTILS_CODECS is not set +# CONFIG_NETUTILS_DHCPC is not set +# CONFIG_NETUTILS_DHCPD is not set +# CONFIG_NETUTILS_FTPC is not set +# CONFIG_NETUTILS_FTPD is not set +# CONFIG_NETUTILS_JSON is not set +# CONFIG_NETUTILS_RESOLV is not set +# CONFIG_NETUTILS_SMTP is not set +# CONFIG_NETUTILS_TELNETD is not set +# CONFIG_NETUTILS_TFTPC is not set +# CONFIG_NETUTILS_THTTPD is not set +# CONFIG_NETUTILS_UIPLIB is not set +# CONFIG_NETUTILS_WEBCLIENT is not set + +# +# ModBus +# + +# +# FreeModbus +# +# CONFIG_MODBUS is not set + +# +# NSH Library +# +# CONFIG_NSH_LIBRARY is not set + +# +# NxWidgets/NxWM +# + +# +# System NSH Add-Ons +# + +# +# Custom Free Memory Command +# +# CONFIG_SYSTEM_FREE is not set + +# +# I2C tool +# + +# +# FLASH Program Installation +# +# CONFIG_SYSTEM_INSTALL is not set + +# +# readline() +# +# CONFIG_SYSTEM_READLINE is not set + +# +# Power Off +# +# CONFIG_SYSTEM_POWEROFF is not set + +# +# RAMTRON +# +# CONFIG_SYSTEM_RAMTRON is not set + +# +# SD Card +# +# CONFIG_SYSTEM_SDCARD is not set + +# +# Sysinfo +# +# CONFIG_SYSTEM_SYSINFO is not set diff --git a/nuttx/configs/stm32f4discovery/posix_spawn/setenv.sh b/nuttx/configs/stm32f4discovery/posix_spawn/setenv.sh new file mode 100755 index 0000000000..c06a15c9c9 --- /dev/null +++ b/nuttx/configs/stm32f4discovery/posix_spawn/setenv.sh @@ -0,0 +1,79 @@ +#!/bin/bash +# configs/stm32f4discovery/posix_spawn/setenv.sh +# +# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved. +# Author: Gregory Nutt +# +# 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. +# + +if [ "$_" = "$0" ] ; then + echo "You must source this script, not run it!" 1>&2 + exit 1 +fi + +WD=`pwd` +if [ ! -x "setenv.sh" ]; then + echo "This script must be executed from the top-level NuttX build directory" + exit 1 +fi + +if [ -z "${PATH_ORIG}" ]; then + export PATH_ORIG="${PATH}" +fi + +# This is the Cygwin path to the location where I installed the RIDE +# toolchain under windows. You will also have to edit this if you install +# the RIDE toolchain in any other location +#export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/Raisonance/Ride/arm-gcc/bin" + +# This is the Cygwin path to the location where I installed the CodeSourcery +# toolchain under windows. You will also have to edit this if you install +# the CodeSourcery toolchain in any other location +export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/CodeSourcery/Sourcery G++ Lite/bin" + +# These are the Cygwin paths to the locations where I installed the Atollic +# toolchain under windows. You will also have to edit this if you install +# the Atollic toolchain in any other location. /usr/bin is added before +# the Atollic bin path because there is are binaries named gcc.exe and g++.exe +# at those locations as well. +#export TOOLCHAIN_BIN="/usr/bin:/cygdrive/c/Program Files (x86)/Atollic/TrueSTUDIO for ARM Pro 2.3.0/ARMTools/bin" +#export TOOLCHAIN_BIN="/usr/bin:/cygdrive/c/Program Files (x86)/Atollic/TrueSTUDIO for STMicroelectronics STM32 Lite 2.3.0/ARMTools/bin" + +# This is the Cygwin path to the location where I build the buildroot +# toolchain. +#export TOOLCHAIN_BIN="${WD}/../misc/buildroot/build_arm_nofpu/staging_dir/bin" + +# This the the Cygwin path to the location where I built genromfs. If you use +# the buildroot toolchain, then genromfs can probably be found in TOOLCHAIN_DIR +export GENROMFS_PATH="${WD}/../misc/buildroot/build_arm_nofpu/staging_dir/bin" + +# Add the path to the toolchain to the PATH varialble +export PATH="${TOOLCHAIN_BIN}:${GENROMFS_PATH}:/sbin:/usr/sbin:${PATH_ORIG}" + +echo "PATH : ${PATH}" diff --git a/nuttx/libc/unistd/lib_execsymtab.c b/nuttx/libc/unistd/lib_execsymtab.c index e95107d15e..7abb2d74e9 100644 --- a/nuttx/libc/unistd/lib_execsymtab.c +++ b/nuttx/libc/unistd/lib_execsymtab.c @@ -107,7 +107,7 @@ void exec_getsymtab(FAR struct symtab_s **symtab, FAR int *nsymbols) * size are returned as a single atomic operation. */ - flags = irqsave(); + flags = irqsave(); *symtab = g_exec_symtab; *nsymbols = g_exec_nsymbols; irqrestore(flags); @@ -138,8 +138,8 @@ void exec_setsymtab(FAR const struct symtab_s *symtab, int nsymbols) * size are set as a single atomic operation. */ - flags = irqsave(); - g_exec_symtab = symtab; + flags = irqsave(); + g_exec_symtab = symtab; g_exec_nsymbols = nsymbols; irqrestore(flags); } From 7609c9a19206ff0c19ef2e6cba4d6a5207d5cf30 Mon Sep 17 00:00:00 2001 From: patacongo Date: Thu, 10 Jan 2013 23:06:23 +0000 Subject: [PATCH 061/118] Fix problem with initialization of file actions git-svn-id: http://svn.code.sf.net/p/nuttx/code/trunk@5508 42af7a65-404d-4744-a932-0658087f49c3 --- apps/examples/posix_spawn/spawn_main.c | 4 ++++ nuttx/libc/spawn/lib_psfa_init.c | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/apps/examples/posix_spawn/spawn_main.c b/apps/examples/posix_spawn/spawn_main.c index 3e3a7b1b12..6081452324 100644 --- a/apps/examples/posix_spawn/spawn_main.c +++ b/apps/examples/posix_spawn/spawn_main.c @@ -304,6 +304,8 @@ int spawn_main(int argc, char *argv[]) err("ERROR: posix_spawnattr_init failed: %d\n", ret); } + mm_update(&g_mmstep, "after file_action/attr init"); + /* Set up to close stdin (0) and open testdata.txt as the program input */ ret = posix_spawn_file_actions_addclose(&file_actions, 0); @@ -319,6 +321,8 @@ int spawn_main(int argc, char *argv[]) err("ERROR: posix_spawn_file_actions_addopen failed: %d\n", ret); } + mm_update(&g_mmstep, "after adding file_actions"); + /* If the binary loader does not support the PATH variable, then * create the full path to the executable program. Otherwise, * use the relative path so that the binary loader will have to diff --git a/nuttx/libc/spawn/lib_psfa_init.c b/nuttx/libc/spawn/lib_psfa_init.c index cb638d6e7b..4e23703aec 100644 --- a/nuttx/libc/spawn/lib_psfa_init.c +++ b/nuttx/libc/spawn/lib_psfa_init.c @@ -65,6 +65,6 @@ int posix_spawn_file_actions_init(FAR posix_spawn_file_actions_t *file_actions) { - file_actions = NULL; + *file_actions = NULL; return OK; } From b26d1e14537568d79c5d805939408ecfca966072 Mon Sep 17 00:00:00 2001 From: patacongo Date: Fri, 11 Jan 2013 13:30:23 +0000 Subject: [PATCH 062/118] Update STM32 F1 DMA to parity with F2/F4 git-svn-id: http://svn.code.sf.net/p/nuttx/code/trunk@5509 42af7a65-404d-4744-a932-0658087f49c3 --- nuttx/arch/arm/src/stm32/stm32_serial.c | 121 ++++++++++++++------- nuttx/arch/arm/src/stm32/stm32_uart.h | 7 +- nuttx/arch/arm/src/stm32/stm32f10xxx_dma.c | 56 ++++++++-- nuttx/arch/arm/src/stm32/stm32f40xxx_dma.c | 11 +- 4 files changed, 137 insertions(+), 58 deletions(-) diff --git a/nuttx/arch/arm/src/stm32/stm32_serial.c b/nuttx/arch/arm/src/stm32/stm32_serial.c index c7f97b25ac..e86fbcf6f8 100644 --- a/nuttx/arch/arm/src/stm32/stm32_serial.c +++ b/nuttx/arch/arm/src/stm32/stm32_serial.c @@ -79,22 +79,22 @@ #if SERIAL_HAVE_DMA -/* Verify that DMA has been enabled an the DMA channel has been defined. - * NOTE: These assignments may only be true for the F4. +# if defined(CONFIG_STM32_STM32F20XX) || defined(CONFIG_STM32_STM32F40XX) +/* Verify that DMA has been enabled and the DMA channel has been defined. */ -# if defined(CONFIG_USART1_RXDMA) || defined(CONFIG_USART6_RXDMA) -# ifndef CONFIG_STM32_DMA2 -# error STM32 USART1/6 receive DMA requires CONFIG_STM32_DMA2 +# if defined(CONFIG_USART1_RXDMA) || defined(CONFIG_USART6_RXDMA) +# ifndef CONFIG_STM32_DMA2 +# error STM32 USART1/6 receive DMA requires CONFIG_STM32_DMA2 +# endif # endif -# endif -# if defined(CONFIG_USART2_RXDMA) || defined(CONFIG_USART3_RXDMA) || \ +# if defined(CONFIG_USART2_RXDMA) || defined(CONFIG_USART3_RXDMA) || \ defined(CONFIG_UART4_RXDMA) || defined(CONFIG_UART5_RXDMA) -# ifndef CONFIG_STM32_DMA1 -# error STM32 USART2/3/4/5 receive DMA requires CONFIG_STM32_DMA1 +# ifndef CONFIG_STM32_DMA1 +# error STM32 USART2/3/4/5 receive DMA requires CONFIG_STM32_DMA1 +# endif # endif -# endif /* Currently RS-485 support cannot be enabled when RXDMA is in use due to lack * of testing - RS-485 support was developed on STM32F1x @@ -114,28 +114,52 @@ * the following in the board.h file. */ -# if defined(CONFIG_USART1_RXDMA) && !defined(DMAMAP_USART1_RX) -# error "USART1 DMA channel not defined (DMAMAP_USART1_RX)" -# endif +# if defined(CONFIG_USART1_RXDMA) && !defined(DMAMAP_USART1_RX) +# error "USART1 DMA channel not defined (DMAMAP_USART1_RX)" +# endif -# if defined(CONFIG_USART2_RXDMA) && !defined(DMAMAP_USART2_RX) -# error "USART2 DMA channel not defined (DMAMAP_USART2_RX)" -# endif +# if defined(CONFIG_USART2_RXDMA) && !defined(DMAMAP_USART2_RX) +# error "USART2 DMA channel not defined (DMAMAP_USART2_RX)" +# endif -# if defined(CONFIG_USART3_RXDMA) && !defined(DMAMAP_USART3_RX) -# error "USART3 DMA channel not defined (DMAMAP_USART3_RX)" -# endif +# if defined(CONFIG_USART3_RXDMA) && !defined(DMAMAP_USART3_RX) +# error "USART3 DMA channel not defined (DMAMAP_USART3_RX)" +# endif -# if defined(CONFIG_UART4_RXDMA) && !defined(DMAMAP_UART4_RX) -# error "UART4 DMA channel not defined (DMAMAP_UART4_RX)" -# endif +# if defined(CONFIG_UART4_RXDMA) && !defined(DMAMAP_UART4_RX) +# error "UART4 DMA channel not defined (DMAMAP_UART4_RX)" +# endif -# if defined(CONFIG_UART5_RXDMA) && !defined(DMAMAP_UART5_RX) -# error "UART5 DMA channel not defined (DMAMAP_UART5_RX)" -# endif +# if defined(CONFIG_UART5_RXDMA) && !defined(DMAMAP_UART5_RX) +# error "UART5 DMA channel not defined (DMAMAP_UART5_RX)" +# endif + +# if defined(CONFIG_USART6_RXDMA) && !defined(DMAMAP_USART6_RX) +# error "USART6 DMA channel not defined (DMAMAP_USART6_RX)" +# endif + +# elif defined(CONFIG_STM32_STM32F10XX) + +# if defined(CONFIG_USART1_RXDMA) || defined(CONFIG_USART2_RXDMA) || \ + defined(CONFIG_USART3_RXDMA) +# ifndef CONFIG_STM32_DMA1 +# error STM32 USART1/2/3 receive DMA requires CONFIG_STM32_DMA1 +# endif +# endif + +# if defined(CONFIG_UART4_RXDMA) +# ifndef CONFIG_STM32_DMA2 +# error STM32 USART4 receive DMA requires CONFIG_STM32_DMA2 +# endif +# endif + +/* There are no optional DMA channel assignments for the F1 */ + +# define DMAMAP_USART1_RX DMACHAN_USART1_RX +# define DMAMAP_USART2_RX DMACHAN_USART2_RX +# define DMAMAP_USART3_RX DMACHAN_USART3_RX +# define DMAMAP_UART4_RX DMACHAN_USART4_RX -# if defined(CONFIG_USART6_RXDMA) && !defined(DMAMAP_USART6_RX) -# error "USART6 DMA channel not defined (DMAMAP_USART6_RX)" # endif /* The DMA buffer size when using RX DMA to emulate a FIFO. @@ -169,6 +193,27 @@ # error "Unknown STM32 DMA" # endif +/* DMA control word */ + +# if defined(CONFIG_STM32_STM32F20XX) || defined(CONFIG_STM32_STM32F40XX) +# define SERIAL_DMA_CONTROL_WORD \ + (DMA_SCR_DIR_P2M | \ + DMA_SCR_CIRC | \ + DMA_SCR_MINC | \ + DMA_SCR_PSIZE_8BITS | \ + DMA_SCR_MSIZE_8BITS | \ + CONFIG_USART_DMAPRIO | \ + DMA_SCR_PBURST_SINGLE | \ + DMA_SCR_MBURST_SINGLE) +# else +# define SERIAL_DMA_CONTROL_WORD \ + (DMA_CCR_CIRC | \ + DMA_CCR_MINC | \ + DMA_CCR_PSIZE_8BITS | \ + DMA_CCR_MSIZE_8BITS | \ + CONFIG_USART_DMAPRIO) +# endif + #endif /* Power management definitions */ @@ -1056,12 +1101,15 @@ static int up_dma_setup(struct uart_dev_s *dev) int result; uint32_t regval; - /* Do the basic UART setup first */ + /* Do the basic UART setup first, unless we are the console */ - result = up_setup(dev); - if (result != OK) - { - return result; + if (!dev->isconsole) + { + result = up_setup(dev); + if (result != OK) + { + return result; + } } /* Acquire the DMA channel. This should always succeed. */ @@ -1074,14 +1122,7 @@ static int up_dma_setup(struct uart_dev_s *dev) priv->usartbase + STM32_USART_DR_OFFSET, (uint32_t)priv->rxfifo, RXDMA_BUFFER_SIZE, - DMA_SCR_DIR_P2M | - DMA_SCR_CIRC | - DMA_SCR_MINC | - DMA_SCR_PSIZE_8BITS | - DMA_SCR_MSIZE_8BITS | - CONFIG_USART_DMAPRIO | - DMA_SCR_PBURST_SINGLE | - DMA_SCR_MBURST_SINGLE); + SERIAL_DMA_CONTROL_WORD); /* Reset our DMA shadow pointer to match the address just * programmed above. diff --git a/nuttx/arch/arm/src/stm32/stm32_uart.h b/nuttx/arch/arm/src/stm32/stm32_uart.h index 8ff6a9975f..a26ea20099 100644 --- a/nuttx/arch/arm/src/stm32/stm32_uart.h +++ b/nuttx/arch/arm/src/stm32/stm32_uart.h @@ -140,12 +140,9 @@ # undef HAVE_CONSOLE #endif -/* DMA support is only provided if CONFIG_ARCH_DMA is in the NuttX configuration. - * Furthermore, DMA support is currently only implemented for the F4 (but could be - * extended to the F1 and F2 with a little effort in the DMA code. - */ +/* DMA support is only provided if CONFIG_ARCH_DMA is in the NuttX configuration */ -#if !defined(HAVE_UART) || !defined(CONFIG_ARCH_DMA) || !defined(CONFIG_STM32_STM32F40XX) +#if !defined(HAVE_UART) || !defined(CONFIG_ARCH_DMA) # undef CONFIG_USART1_RXDMA # undef CONFIG_USART2_RXDMA # undef CONFIG_USART3_RXDMA diff --git a/nuttx/arch/arm/src/stm32/stm32f10xxx_dma.c b/nuttx/arch/arm/src/stm32/stm32f10xxx_dma.c index 89b279beaa..13324b8ac0 100644 --- a/nuttx/arch/arm/src/stm32/stm32f10xxx_dma.c +++ b/nuttx/arch/arm/src/stm32/stm32f10xxx_dma.c @@ -303,13 +303,13 @@ static int stm32_dmainterrupt(int irq, void *context) } dmach = &g_dma[chndx]; - /* Get the interrupt status (for this channel only) -- not currently used */ + /* Get the interrupt status (for this channel only) */ isr = dmabase_getreg(dmach, STM32_DMA_ISR_OFFSET) & DMA_ISR_CHAN_MASK(dmach->chan); - /* Disable the DMA channel */ + /* Clear the interrupts we are handling */ - stm32_dmachandisable(dmach); + dmabase_putreg(dmach, STM32_DMA_IFCR_OFFSET, isr); /* Invoke the callback */ @@ -528,14 +528,34 @@ void stm32_dmastart(DMA_HANDLE handle, dma_callback_t callback, void *arg, bool ccr = dmachan_getreg(dmach, STM32_DMACHAN_CCR_OFFSET); ccr |= DMA_CCR_EN; - /* Once half of the bytes are transferred, the half-transfer flag (HTIF) is - * set and an interrupt is generated if the Half-Transfer Interrupt Enable - * bit (HTIE) is set. At the end of the transfer, the Transfer Complete Flag - * (TCIF) is set and an interrupt is generated if the Transfer Complete - * Interrupt Enable bit (TCIE) is set. + /* In normal mode, interrupt at either half or full completion. In circular mode, + * always interrupt on buffer wrap, and optionally interrupt at the halfway point. */ - ccr |= (half ? (DMA_CCR_HTIE|DMA_CCR_TEIE) : (DMA_CCR_TCIE|DMA_CCR_TEIE)); + if ((ccr & DMA_CCR_CIRC) == 0) + { + /* Once half of the bytes are transferred, the half-transfer flag (HTIF) is + * set and an interrupt is generated if the Half-Transfer Interrupt Enable + * bit (HTIE) is set. At the end of the transfer, the Transfer Complete Flag + * (TCIF) is set and an interrupt is generated if the Transfer Complete + * Interrupt Enable bit (TCIE) is set. + */ + + ccr |= (half ? (DMA_CCR_HTIE|DMA_CCR_TEIE) : (DMA_CCR_TCIE|DMA_CCR_TEIE)); + + } + else + { + /* In nonstop mode, when the transfer completes it immediately resets + * and starts again. The transfer-complete interrupt is thus always + * enabled, and the half-complete interrupt can be used in circular + * mode to determine when the buffer is half-full, or in double-buffered + * mode to determine when one of the two buffers is full. + */ + + ccr |= (half ? DMA_CCR_HTIE : 0) | DMA_CCR_TCIE | DMA_CCR_TEIE; + } + dmachan_putreg(dmach, STM32_DMACHAN_CCR_OFFSET, ccr); } @@ -558,6 +578,24 @@ void stm32_dmastop(DMA_HANDLE handle) stm32_dmachandisable(dmach); } +/**************************************************************************** + * Name: stm32_dmaresidual + * + * Description: + * Returns the number of bytes remaining to be transferred + * + * Assumptions: + * - DMA handle allocated by stm32_dmachannel() + * + ****************************************************************************/ + +size_t stm32_dmaresidual(DMA_HANDLE handle) +{ + struct stm32_dma_s *dmach = (struct stm32_dma_s *)handle; + + return dmachan_getreg(dmach, STM32_DMACHAN_CNDTR_OFFSET); +} + /**************************************************************************** * Name: stm32_dmasample * diff --git a/nuttx/arch/arm/src/stm32/stm32f40xxx_dma.c b/nuttx/arch/arm/src/stm32/stm32f40xxx_dma.c index dcbbf1856f..40fce8cb54 100644 --- a/nuttx/arch/arm/src/stm32/stm32f40xxx_dma.c +++ b/nuttx/arch/arm/src/stm32/stm32f40xxx_dma.c @@ -94,7 +94,6 @@ struct stm32_dma_s uint8_t irq; /* DMA stream IRQ number */ uint8_t shift; /* ISR/IFCR bit shift value */ uint8_t channel; /* DMA channel number (0-7) */ - bool nonstop; /* Stream is configured in a non-stopping mode. */ sem_t sem; /* Used to wait for DMA channel to become available */ uint32_t base; /* DMA register channel base address */ dma_callback_t callback; /* Callback invoked when the DMA completes */ @@ -728,7 +727,6 @@ void stm32_dmasetup(DMA_HANDLE handle, uint32_t paddr, uint32_t maddr, DMA_SCR_DBM|DMA_SCR_CIRC| DMA_SCR_PBURST_MASK|DMA_SCR_MBURST_MASK); regval |= scr; - dmast->nonstop = (scr & (DMA_SCR_DBM|DMA_SCR_CIRC)) != 0; dmast_putreg(dmast, STM32_DMA_SCR_OFFSET, regval); } @@ -764,7 +762,12 @@ void stm32_dmastart(DMA_HANDLE handle, dma_callback_t callback, void *arg, bool scr = dmast_getreg(dmast, STM32_DMA_SCR_OFFSET); scr |= DMA_SCR_EN; - if (!dmast->nonstop) + /* In normal mode, interrupt at either half or full completion. In circular + * and double-buffered modes, always interrupt on buffer wrap, and optionally + * interrupt at the halfway point. + */ + + if ((scr & (DMA_SCR_DBM|DMA_SCR_CIRC)) == 0) { /* Once half of the bytes are transferred, the half-transfer flag (HTIF) is * set and an interrupt is generated if the Half-Transfer Interrupt Enable @@ -777,7 +780,7 @@ void stm32_dmastart(DMA_HANDLE handle, dma_callback_t callback, void *arg, bool } else { - /* In nonstop mode, when the transfer completes it immediately resets + /* In non-stop modes, when the transfer completes it immediately resets * and starts again. The transfer-complete interrupt is thus always * enabled, and the half-complete interrupt can be used in circular * mode to determine when the buffer is half-full, or in double-buffered From e7a5090e55f7db78164fda2696af414c3e083806 Mon Sep 17 00:00:00 2001 From: patacongo Date: Fri, 11 Jan 2013 16:53:44 +0000 Subject: [PATCH 063/118] Various changes while debugging posix_spawn git-svn-id: http://svn.code.sf.net/p/nuttx/code/trunk@5510 42af7a65-404d-4744-a932-0658087f49c3 --- apps/examples/elf/tests/hello/hello.c | 12 +- apps/examples/posix_spawn/Makefile | 17 +-- apps/examples/posix_spawn/filesystem/Makefile | 25 ++-- .../posix_spawn/filesystem/hello/Makefile | 59 ++++++++ .../posix_spawn/filesystem/hello/hello.c | 78 +++++++++++ .../filesystem/{program => redirect}/Makefile | 4 +- .../program.c => redirect/redirect.c} | 5 +- apps/examples/posix_spawn/spawn_main.c | 118 ++++++++++++++-- nuttx/ChangeLog | 2 + nuttx/include/spawn.h | 12 +- nuttx/libc/spawn/Make.defs | 8 ++ nuttx/libc/spawn/lib_ps.c | 13 +- nuttx/libc/spawn/lib_psa_dump.c | 127 +++++++++++++++++ nuttx/libc/spawn/lib_psa_init.c | 3 +- nuttx/libc/spawn/lib_psfa_dump.c | 129 ++++++++++++++++++ nuttx/sched/task_vfork.c | 61 +++++++++ 16 files changed, 629 insertions(+), 44 deletions(-) create mode 100644 apps/examples/posix_spawn/filesystem/hello/Makefile create mode 100644 apps/examples/posix_spawn/filesystem/hello/hello.c rename apps/examples/posix_spawn/filesystem/{program => redirect}/Makefile (96%) rename apps/examples/posix_spawn/filesystem/{program/program.c => redirect/redirect.c} (93%) create mode 100644 nuttx/libc/spawn/lib_psa_dump.c create mode 100644 nuttx/libc/spawn/lib_psfa_dump.c diff --git a/apps/examples/elf/tests/hello/hello.c b/apps/examples/elf/tests/hello/hello.c index 6b1d079d8a..bc4953e126 100644 --- a/apps/examples/elf/tests/hello/hello.c +++ b/apps/examples/elf/tests/hello/hello.c @@ -63,13 +63,13 @@ int main(int argc, char **argv) { printf("argv[%d]\t= ", i); if (argv[i]) - { - printf("(0x%p) \"%s\"\n", argv[i], argv[i]); - } + { + printf("(0x%p) \"%s\"\n", argv[i], argv[i]); + } else - { - printf("NULL?\n"); - } + { + printf("NULL?\n"); + } } printf("argv[%d]\t= 0x%p\n", argc, argv[argc]); diff --git a/apps/examples/posix_spawn/Makefile b/apps/examples/posix_spawn/Makefile index d21c8f8560..bda3376d23 100644 --- a/apps/examples/posix_spawn/Makefile +++ b/apps/examples/posix_spawn/Makefile @@ -64,8 +64,8 @@ ROOTDEPPATH = --dep-path . --dep-path filesystem VPATH = filesystem -all: .built -.PHONY: really_build clean_filesystem clean depend distclean +all: build +.PHONY: build clean_filesystem clean depend distclean $(AOBJS): %$(OBJEXT): %.S $(call ASSEMBLE, $<, $@) @@ -74,17 +74,16 @@ $(COBJS): %$(OBJEXT): %.c $(call COMPILE, $<, $@) # This is a little messy. The build is broken into two pieces: (1) the -# filesystem/ subdir build that auto-generates several files, and (2) the real +# filesystem/ subdir build that auto-generates several files, and (2) the library # build. This is done because we need a fresh build context after auto- # generating the source files. -really_build: $(OBJS) +build_lib: $(OBJS) $(call ARCHIVE, $(BIN), $(OBJS)) - @touch .built -.built: +build: @$(MAKE) -C filesystem TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)" CROSSDEV=$(CROSSDEV) - @$(MAKE) TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)" really_build + @$(MAKE) TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)" build_lib context: @@ -100,11 +99,13 @@ clean_filesystem: @$(MAKE) -C filesystem TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)" CROSSDEV=$(CROSSDEV) clean clean: clean_filesystem - $(call DELFILE, .built) $(call CLEAN) distclean: clean $(call DELFILE, Make.dep) $(call DELFILE, .depend) +# There are no dependencies in this directory. We should are code some of +# more important dependencies here: + -include Make.dep diff --git a/apps/examples/posix_spawn/filesystem/Makefile b/apps/examples/posix_spawn/filesystem/Makefile index 19a02bb80b..2005d060fa 100644 --- a/apps/examples/posix_spawn/filesystem/Makefile +++ b/apps/examples/posix_spawn/filesystem/Makefile @@ -44,22 +44,28 @@ ROMFS_HDR = $(FILESYSTEM_DIR)$(DELIM)romfs.h SYMTAB_SRC = $(FILESYSTEM_DIR)$(DELIM)symtab.c all: $(ROMFS_HDR) $(SYMTAB_SRC) -.PHONY: all program clean install populate +.PHONY: all hello redirect clean install populate # Create the romfs directory $(ROMFS_DIR): $(Q) mkdir $(ROMFS_DIR) -# Build the test program +# Build the hello test program -program: $(ROMFS_DIR) - $(Q) $(MAKE) -C program program TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)" ROMFS_DIR="$(ROMFS_DIR)" +hello: $(ROMFS_DIR) + $(Q) $(MAKE) -C hello hello TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)" ROMFS_DIR="$(ROMFS_DIR)" -# Install the test program in the romfs directory +# Build the redirection test program -install: program testdata.txt - $(Q) $(MAKE) -C program install TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)" ROMFS_DIR="$(ROMFS_DIR)" +redirect: $(ROMFS_DIR) + $(Q) $(MAKE) -C redirect redirect TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)" ROMFS_DIR="$(ROMFS_DIR)" + +# Install the test programs in the romfs directory + +install: hello redirect testdata.txt + $(Q) $(MAKE) -C hello install TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)" ROMFS_DIR="$(ROMFS_DIR)" + $(Q) $(MAKE) -C redirect install TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)" ROMFS_DIR="$(ROMFS_DIR)" $(Q) install --mode=0644 testdata.txt $(ROMFS_DIR)/testdata.txt # Create the romfs.img file from the romfs directory @@ -74,12 +80,13 @@ $(ROMFS_HDR) : $(ROMFS_IMG) # Create the exported symbol table -$(SYMTAB_SRC): program +$(SYMTAB_SRC): hello/hello redirect/redirect testdata.txt $(Q) $(FILESYSTEM_DIR)$(DELIM)mksymtab.sh $(ROMFS_DIR) >$@ # Clean each subdirectory clean: - $(Q) $(MAKE) -C program clean TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)" ROMFS_DIR="$(ROMFS_DIR)" + $(Q) $(MAKE) -C hello clean TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)" ROMFS_DIR="$(ROMFS_DIR)" + $(Q) $(MAKE) -C redirect clean TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)" ROMFS_DIR="$(ROMFS_DIR)" $(Q) rm -f $(ROMFS_HDR) $(ROMFS_IMG) $(SYMTAB_SRC) $(Q) rm -rf $(ROMFS_DIR) diff --git a/apps/examples/posix_spawn/filesystem/hello/Makefile b/apps/examples/posix_spawn/filesystem/hello/Makefile new file mode 100644 index 0000000000..5cd80411b0 --- /dev/null +++ b/apps/examples/posix_spawn/filesystem/hello/Makefile @@ -0,0 +1,59 @@ +############################################################################ +# examples/elf/tests/hello/Makefile +# +# Copyright (C) 2012 Gregory Nutt. All rights reserved. +# Author: Gregory Nutt +# +# 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)/Make.defs + +BIN = hello + +SRCS = $(BIN).c +OBJS = $(SRCS:.c=.o) + +all: $(BIN) + +$(OBJS): %.o: %.c + @echo "CC: $<" + $(Q) $(CC) -c $(CELFFLAGS) $< -o $@ + +$(BIN): $(OBJS) + @echo "LD: $<" + $(Q) $(LD) $(LDELFFLAGS) -o $@ $^ + +clean: + $(call DELFILE, $(BIN)) + $(call CLEAN) + +install: + $(Q) mkdir -p $(ROMFS_DIR) + $(Q) install $(BIN) $(ROMFS_DIR)/$(BIN) diff --git a/apps/examples/posix_spawn/filesystem/hello/hello.c b/apps/examples/posix_spawn/filesystem/hello/hello.c new file mode 100644 index 0000000000..1b269d85ff --- /dev/null +++ b/apps/examples/posix_spawn/filesystem/hello/hello.c @@ -0,0 +1,78 @@ +/**************************************************************************** + * examples/posix_spawn/filesystem/hello/hello.c + * + * Copyright (C) 2013 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * 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. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include +#include + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +int main(int argc, char **argv) +{ + int i; + + /* Mandatory "Hello, world!" */ + + puts("Getting ready to say \"Hello, world\"\n"); + printf("Hello, world!\n"); + puts("It has been said.\n"); + + /* Print arguments */ + + printf("argc\t= %d\n", argc); + printf("argv\t= 0x%p\n", argv); + + for (i = 0; i < argc; i++) + { + printf("argv[%d]\t= ", i); + if (argv[i]) + { + printf("(0x%p) \"%s\"\n", argv[i], argv[i]); + } + else + { + printf("NULL?\n"); + } + } + + printf("argv[%d]\t= 0x%p\n", argc, argv[argc]); + printf("Goodbye, world!\n"); + return 0; +} diff --git a/apps/examples/posix_spawn/filesystem/program/Makefile b/apps/examples/posix_spawn/filesystem/redirect/Makefile similarity index 96% rename from apps/examples/posix_spawn/filesystem/program/Makefile rename to apps/examples/posix_spawn/filesystem/redirect/Makefile index cf55797b2b..421ff014a7 100644 --- a/apps/examples/posix_spawn/filesystem/program/Makefile +++ b/apps/examples/posix_spawn/filesystem/redirect/Makefile @@ -1,5 +1,5 @@ ############################################################################ -# examples/posix_spawn/filesystem/program/Makefile +# examples/posix_spawn/filesystem/redirect/Makefile # # Copyright (C) 2013 Gregory Nutt. All rights reserved. # Author: Gregory Nutt @@ -35,7 +35,7 @@ -include $(TOPDIR)/Make.defs -BIN = program +BIN = redirect SRCS = $(BIN).c OBJS = $(SRCS:.c=.o) diff --git a/apps/examples/posix_spawn/filesystem/program/program.c b/apps/examples/posix_spawn/filesystem/redirect/redirect.c similarity index 93% rename from apps/examples/posix_spawn/filesystem/program/program.c rename to apps/examples/posix_spawn/filesystem/redirect/redirect.c index f63b559c84..61638df799 100644 --- a/apps/examples/posix_spawn/filesystem/program/program.c +++ b/apps/examples/posix_spawn/filesystem/redirect/redirect.c @@ -1,5 +1,5 @@ /**************************************************************************** - * examples/posix_spawn/filesystem/program/program.c + * examples/posix_spawn/filesystem/redirect/redirect.c * * Copyright (C) 2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -47,6 +47,8 @@ int main(int argc, char **argv) { int ch; + printf("Entering the stdin redirection test\n"); + /* stdin should have been redirected to testdata.txt. Read and print until * we hit the end of file. */ @@ -56,5 +58,6 @@ int main(int argc, char **argv) putchar(ch); } + printf("Exit-ing the stdin redirection test\n"); return 0; } diff --git a/apps/examples/posix_spawn/spawn_main.c b/apps/examples/posix_spawn/spawn_main.c index 6081452324..6f8859516f 100644 --- a/apps/examples/posix_spawn/spawn_main.c +++ b/apps/examples/posix_spawn/spawn_main.c @@ -138,11 +138,15 @@ static unsigned int g_mmstep; /* Memory Usage at beginning of test step */ static const char delimiter[] = "****************************************************************************"; -static const char program[] = "program"; -static const char data[] = "testdata.txt"; +static const char g_redirect[] = "redirect"; +static const char g_hello[] = "hello"; +static const char g_data[] = "testdata.txt"; static char fullpath[128]; +static char * const g_argv[4] = + { "Argument 1", "Argument 2", "Argument 3", NULL }; + /**************************************************************************** * Symbols from Auto-Generated Code ****************************************************************************/ @@ -284,11 +288,15 @@ int spawn_main(int argc, char *argv[]) exec_setsymtab(exports, nexports); + /************************************************************************* + * Case 1: Simple program with arguments + *************************************************************************/ + /* Output a seperated so that we can clearly discriminate the output of * this program from the others. */ - testheader(program); + testheader(g_hello); /* Initialize the attributes file actions structure */ @@ -297,12 +305,86 @@ int spawn_main(int argc, char *argv[]) { err("ERROR: posix_spawn_file_actions_init failed: %d\n", ret); } + posix_spawn_file_actions_dump(&file_actions); ret = posix_spawnattr_init(&attr); if (ret != 0) { err("ERROR: posix_spawnattr_init failed: %d\n", ret); } + posix_spawnattr_dump(&attr); + + mm_update(&g_mmstep, "after file_action/attr init"); + + /* If the binary loader does not support the PATH variable, then + * create the full path to the executable program. Otherwise, + * use the relative path so that the binary loader will have to + * search the PATH variable to find the executable. + */ + +#ifdef CONFIG_BINFMT_EXEPATH + filepath = g_hello; +#else + snprintf(fullpath, 128, "%s/%s", MOUNTPT, g_hello); + filepath = fullpath; +#endif + + /* Execute the program */ + + mm_update(&g_mmstep, "before posix_spawn"); + + ret = posix_spawn(&pid, filepath, &file_actions, &attr, NULL, (FAR char * const*)&g_argv); + if (ret != 0) + { + err("ERROR: posix_spawn failed: %d\n", ret); + } + + sleep(4); + mm_update(&g_mmstep, "after posix_spawn"); + + /* Free attibutes and file actions */ + + ret = posix_spawn_file_actions_destroy(&file_actions); + if (ret != 0) + { + err("ERROR: posix_spawn_file_actions_destroy failed: %d\n", ret); + } + posix_spawn_file_actions_dump(&file_actions); + + ret = posix_spawnattr_destroy(&attr); + if (ret != 0) + { + err("ERROR: posix_spawnattr_destroy failed: %d\n", ret); + } + posix_spawnattr_dump(&attr); + + mm_update(&g_mmstep, "after file_action/attr destruction"); + + /************************************************************************* + * Case 2: Simple program with redirection of stdin + *************************************************************************/ + + /* Output a seperated so that we can clearly discriminate the output of + * this program from the others. + */ + + testheader(g_redirect); + + /* Initialize the attributes file actions structure */ + + ret = posix_spawn_file_actions_init(&file_actions); + if (ret != 0) + { + err("ERROR: posix_spawn_file_actions_init failed: %d\n", ret); + } + posix_spawn_file_actions_dump(&file_actions); + + ret = posix_spawnattr_init(&attr); + if (ret != 0) + { + err("ERROR: posix_spawnattr_init failed: %d\n", ret); + } + posix_spawnattr_dump(&attr); mm_update(&g_mmstep, "after file_action/attr init"); @@ -313,13 +395,15 @@ int spawn_main(int argc, char *argv[]) { err("ERROR: posix_spawn_file_actions_addclose failed: %d\n", ret); } + posix_spawn_file_actions_dump(&file_actions); - snprintf(fullpath, 128, "%s/%s", MOUNTPT, data); + snprintf(fullpath, 128, "%s/%s", MOUNTPT, g_data); ret = posix_spawn_file_actions_addopen(&file_actions, 0, fullpath, O_RDONLY, 0644); if (ret != 0) { err("ERROR: posix_spawn_file_actions_addopen failed: %d\n", ret); } + posix_spawn_file_actions_dump(&file_actions); mm_update(&g_mmstep, "after adding file_actions"); @@ -330,9 +414,9 @@ int spawn_main(int argc, char *argv[]) */ #ifdef CONFIG_BINFMT_EXEPATH - filepath = program; + filepath = g_redirect; #else - snprintf(fullpath, 128, "%s/%s", MOUNTPT, program); + snprintf(fullpath, 128, "%s/%s", MOUNTPT, g_redirect); filepath = fullpath; #endif @@ -346,13 +430,29 @@ int spawn_main(int argc, char *argv[]) err("ERROR: posix_spawn failed: %d\n", ret); } - sleep(1); + sleep(2); mm_update(&g_mmstep, "after posix_spawn"); + /* Free attibutes and file actions */ + + ret = posix_spawn_file_actions_destroy(&file_actions); + if (ret != 0) + { + err("ERROR: posix_spawn_file_actions_destroy failed: %d\n", ret); + } + posix_spawn_file_actions_dump(&file_actions); + + ret = posix_spawnattr_destroy(&attr); + if (ret != 0) + { + err("ERROR: posix_spawnattr_destroy failed: %d\n", ret); + } + posix_spawnattr_dump(&attr); + + mm_update(&g_mmstep, "after file_action/attr destruction"); + /* Clean-up */ - (void)posix_spawn_file_actions_destroy(&file_actions); - (void)posix_spawnattr_destroy(&attr); elf_uninitialize(); mm_update(&g_mmstep, "End-of-Test"); diff --git a/nuttx/ChangeLog b/nuttx/ChangeLog index 7ddc4901e8..63aac89f54 100644 --- a/nuttx/ChangeLog +++ b/nuttx/ChangeLog @@ -3905,4 +3905,6 @@ (from Max Holtzberg). * configs/stm32f4discovery/posix_spawn: Added a configuration that can be used for testing posix_spawn(). + * arch/arm/src/stm32: Bring F1 support for general DMA and serial + DMA in paricular up to parity with F2/F4 (from Mike Smith). diff --git a/nuttx/include/spawn.h b/nuttx/include/spawn.h index 3978424fbf..39ed9be15c 100644 --- a/nuttx/include/spawn.h +++ b/nuttx/include/spawn.h @@ -61,7 +61,7 @@ #define POSIX_SPAWN_SETSCHEDPARAM (1 << 2) /* 1: Set task's priority */ #define POSIX_SPAWN_SETSCHEDULER (1 << 3) /* 1: Set task's scheduler policy */ #define POSIX_SPAWN_SETSIGDEF (1 << 4) /* 1: Set default signal actions */ -#define POSIX_SPAWN_SETSIGMASK (1 << 5) /* 1: Set sigmask *./ +#define POSIX_SPAWN_SETSIGMASK (1 << 5) /* 1: Set sigmask */ /**************************************************************************** * Type Definitions @@ -181,6 +181,16 @@ int posix_spawnattr_setsigmask(FAR posix_spawnattr_t *attr, # define posix_spawnattr_setsigmask(attr,sigmask) (ENOSYS) #endif +/* Non standard debug functions */ + +#ifdef CONFIG_DEBUG +void posix_spawn_file_actions_dump(FAR posix_spawn_file_actions_t *file_actions); +void posix_spawnattr_dump(FAR posix_spawnattr_t *attr); +#else +# define posix_spawn_file_actions_dump(fa) +# define posix_spawnattr_dump(a) +#endif + #ifdef __cplusplus } #endif diff --git a/nuttx/libc/spawn/Make.defs b/nuttx/libc/spawn/Make.defs index 2cf75c410d..99ee781ce2 100644 --- a/nuttx/libc/spawn/Make.defs +++ b/nuttx/libc/spawn/Make.defs @@ -42,6 +42,10 @@ CSRCS += lib_ps.c CSRCS += lib_psfa_addaction.c lib_psfa_addclose.c lib_psfa_adddup2.c CSRCS += lib_psfa_addopen.c lib_psfa_destroy.c lib_psfa_init.c +ifeq ($(CONFIG_DEBUG),y) +CSRCS += lib_psfa_dump.c +endif + CSRCS += lib_psa_getflags.c lib_psa_getschedparam.c lib_psa_getschedpolicy.c CSRCS += lib_psa_init.c lib_psa_setflags.c lib_psa_setschedparam.c CSRCS += lib_psa_setschedpolicy.c @@ -50,6 +54,10 @@ ifneq ($(CONFIG_DISABLE_SIGNALS),y) CSRCS += lib_psa_getsigmask.c lib_psa_setsigmask.c endif +ifeq ($(CONFIG_DEBUG),y) +CSRCS += lib_psa_dump.c +endif + # Add the spawn directory to the build DEPPATH += --dep-path spawn diff --git a/nuttx/libc/spawn/lib_ps.c b/nuttx/libc/spawn/lib_ps.c index 7509d67377..a6a0590d4a 100644 --- a/nuttx/libc/spawn/lib_ps.c +++ b/nuttx/libc/spawn/lib_ps.c @@ -357,7 +357,7 @@ static int spawn_proxy(int argc, char *argv[]) { FAR struct spawn_general_file_action_s *entry; FAR const posix_spawnattr_t *attr = g_ps_parms.attr; - int ret; + int ret = OK; /* Perform file actions and/or set a custom signal mask. We get here only * if the file_actions parameter to posix_spawn[p] was non-NULL and/or the @@ -365,10 +365,10 @@ static int spawn_proxy(int argc, char *argv[]) */ #ifndef CONFIG_DISABLE_SIGNALS - DEBUGASSERT(g_ps_parms.file_actions || + DEBUGASSERT((g_ps_parms.file_actions && *g_ps_parms.file_actions) || (attr && (attr->flags & POSIX_SPAWN_SETSIGMASK) != 0)); #else - DEBUGASSERT(g_ps_parms.file_actions); + DEBUGASSERT(g_ps_parms.file_actions && *g_ps_parms.file_actions); #endif /* Check if we need to change the signal mask */ @@ -553,9 +553,10 @@ int posix_spawn(FAR pid_t *pid, FAR const char *path, */ #ifndef CONFIG_DISABLE_SIGNALS - if (!file_actions && (attr->flags & POSIX_SPAWN_SETSIGMASK) == 0) + if ((file_actions == NULL || *file_actions == NULL) && + (attr == NULL || (attr->flags & POSIX_SPAWN_SETSIGMASK) == 0)) #else - if (!file_actions) + if (file_actions == NULL || *file_actions == NULL) #endif { return ps_exec(pid, path, attr, argv); @@ -601,7 +602,7 @@ int posix_spawn(FAR pid_t *pid, FAR const char *path, proxy = TASK_CREATE("spawn_proxy", param.sched_priority, CONFIG_POSIX_SPAWN_STACKSIZE, (main_t)spawn_proxy, - (const char **)NULL); + (FAR const char **)NULL); if (proxy < 0) { int errcode = errno; diff --git a/nuttx/libc/spawn/lib_psa_dump.c b/nuttx/libc/spawn/lib_psa_dump.c new file mode 100644 index 0000000000..03770c6ff8 --- /dev/null +++ b/nuttx/libc/spawn/lib_psa_dump.c @@ -0,0 +1,127 @@ +/**************************************************************************** + * libc/string/lib_psa_dump.c + * + * Copyright (C) 2013 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * 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. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include +#include + +#ifdef CONFIG_DEBUG + +/**************************************************************************** + * Global Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: posix_spawnattr_dump + * + * Description: + * Show the current attributes. + * + * Input Parameters: + * attr - The address of the spawn attributes to be dumped. + * + * Returned Value: + * None + * + ****************************************************************************/ + +void posix_spawnattr_dump(posix_spawnattr_t *attr) +{ + dbg("attr[%p]:\n", attr); + dbg(" flags: %04x\n", attr->flags); + if (attr->flags == 0) + { + dbg(" None\n"); + } + else + { + if ((attr->flags & POSIX_SPAWN_RESETIDS) != 0) + { + dbg(" POSIX_SPAWN_RESETIDS\n"); + } + + if ((attr->flags & POSIX_SPAWN_SETPGROUP) != 0) + { + dbg(" POSIX_SPAWN_SETPGROUP\n"); + } + + if ((attr->flags & POSIX_SPAWN_SETSCHEDPARAM) != 0) + { + dbg(" POSIX_SPAWN_SETSCHEDPARAM\n"); + } + + if ((attr->flags & POSIX_SPAWN_SETSCHEDULER) != 0) + { + dbg(" POSIX_SPAWN_SETSCHEDULER\n"); + } + + if ((attr->flags & POSIX_SPAWN_SETSIGDEF) != 0) + { + dbg(" POSIX_SPAWN_SETSIGDEF\n"); + } + + if ((attr->flags & POSIX_SPAWN_SETSIGMASK) != 0) + { + dbg(" POSIX_SPAWN_SETSIGMASK\n"); + } + } + + dbg(" priority: %d\n", attr->priority); + + dbg(" policy: %d\n", attr->policy); + if (attr->policy == SCHED_FIFO) + { + dbg(" SCHED_FIFO\n"); + } + else if (attr->policy == SCHED_RR) + { + dbg(" SCHED_RR\n"); + } + else + { + dbg(" Unrecognized\n"); + } + +#ifndef CONFIG_DISABLE_SIGNALS + dbg(" sigmask: %08x\n", attr->sigmask); +#endif +}; + +#endif /* CONFIG_DEBUG */ \ No newline at end of file diff --git a/nuttx/libc/spawn/lib_psa_init.c b/nuttx/libc/spawn/lib_psa_init.c index 8aabfd090d..f76188c52b 100644 --- a/nuttx/libc/spawn/lib_psa_init.c +++ b/nuttx/libc/spawn/lib_psa_init.c @@ -43,7 +43,6 @@ #include #include #include -#include /**************************************************************************** * Global Functions @@ -58,7 +57,7 @@ * call to posix_spawn() or posix_spawnp(). * * Input Parameters: - * attr - The address spawn attributes to be initialized. + * attr - The address of the spawn attributes to be initialized. * * Returned Value: * On success, these functions return 0; on failure they return an error diff --git a/nuttx/libc/spawn/lib_psfa_dump.c b/nuttx/libc/spawn/lib_psfa_dump.c new file mode 100644 index 0000000000..d7bf1576de --- /dev/null +++ b/nuttx/libc/spawn/lib_psfa_dump.c @@ -0,0 +1,129 @@ +/**************************************************************************** + * libc/string/lib_psfa_dump.c + * + * Copyright (C) 2013 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * 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. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include +#include +#include + +#include "spawn/spawn.h" + +#ifdef CONFIG_DEBUG + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: lib_psfa_dump + * + * Description: + * Show the entryent file actions. + * + * Input Parameters: + * file_actions - The address of the file_actions to be dumped. + * + * Returned Value: + * None + * + ****************************************************************************/ + +void posix_spawn_file_actions_dump(FAR posix_spawn_file_actions_t *file_actions) +{ + FAR struct spawn_general_file_action_s *entry; + + DEBUGASSERT(file_actions); + + dbg("File Actions[%p->%p]:\n", file_actions, *file_actions); + if (!*file_actions) + { + dbg(" NONE\n"); + return; + } + + /* Destroy each file action, one at a time */ + + for (entry = (FAR struct spawn_general_file_action_s *)*file_actions; + entry; + entry = entry->flink) + { + switch (entry->action) + { + case SPAWN_FILE_ACTION_CLOSE: + { + FAR struct spawn_close_file_action_s *action = + (FAR struct spawn_close_file_action_s *)entry; + + dbg(" CLOSE: fd=%d\n", action->fd); + } + break; + + case SPAWN_FILE_ACTION_DUP2: + { + FAR struct spawn_dup2_file_action_s *action = + (FAR struct spawn_dup2_file_action_s *)entry; + + dbg(" DUP2: %d->%d\n", action->fd1, action->fd2); + } + break; + + case SPAWN_FILE_ACTION_OPEN: + { + FAR struct spawn_open_file_action_s *action = + (FAR struct spawn_open_file_action_s *)entry; + + svdbg(" OPEN: path=%s oflags=%04x mode=%04x fd=%d\n", + action->path, action->oflags, action->mode, action->fd); + } + break; + + case SPAWN_FILE_ACTION_NONE: + default: + dbg(" ERROR: Unknown action: %d\n", entry->action); + break; + } + } +} + +#endif /* CONFIG_DEBUG */ \ No newline at end of file diff --git a/nuttx/sched/task_vfork.c b/nuttx/sched/task_vfork.c index 64f6f06366..0ea09b0487 100644 --- a/nuttx/sched/task_vfork.c +++ b/nuttx/sched/task_vfork.c @@ -218,6 +218,9 @@ pid_t task_vforkstart(FAR _TCB *child) #endif FAR const char *name; pid_t pid; +#ifdef CONFIG_SCHED_WAITPID + int rc; +#endif int ret; svdbg("Starting Child TCB=%p, parent=%p\n", child, g_readytorun.head); @@ -246,6 +249,64 @@ pid_t task_vforkstart(FAR _TCB *child) return ERROR; } + /* Since the child task has the same priority as the parent task, it is + * now ready to run, but has not yet ran. It is a requirement that + * the parent enivornment be stable while vfork runs; the child thread + * is still dependent on things in the parent thread... like the pointers + * into parent thread's stack which will still appear in the child's + * registers and environment. + * + * We do not have SIG_CHILD, so we have to do some silly things here. + * The simplest way to make sure that the child thread runs to completion + * is simply to yield here. Since the child can only do exit() or + * execv/l(), that should be all that is needed. + * + * Hmmm.. this is probably not sufficient. What if we are running + * SCHED_RR? What if the child thread is suspeneded and rescheduled + * after the parent thread again? + */ + +#ifdef CONFIG_SCHED_WAITPID + + /* We can also exploit a bug in the execv() implementation: The PID + * of the task exec'ed by the child will not be the same as the PID of + * the child task. Therefore, waitpid() on the child task's PID will + * accomplish what we need to do. + */ + + rc = 0; + +#ifdef CONFIG_DEBUG + ret = waitpid(pid, &rc, 0); + if (ret < 0) + { + sdbg("ERROR: waitpid failed: %d\n", errno); + } +#else + (void)waitpid(pid, &rc, 0); +#endif + +#else + /* Again exploiting that execv() bug: Check if the child thread is + * still running. + */ + + while ((ret = kill(pid, 0)) == OK) + { + /* Yes.. then we can yield to it -- assuming that it has not lowered + * its priority. sleep(0) might be a safer thing to do since it does + * not depend on prioirities: It will halt the parent thread for one + * system clock tick. This will delay the return to the parent thread. + */ + +#ifndef CONFIG_DISABLE_SIGNALS + sleep(0); +#else + sched_yield(); +#endif + } +#endif + return pid; } From 43e22b2b98bacc15438133b5823d545806c8d092 Mon Sep 17 00:00:00 2001 From: patacongo Date: Fri, 11 Jan 2013 19:08:51 +0000 Subject: [PATCH 064/118] Fix an error handling bug in the fread logic git-svn-id: http://svn.code.sf.net/p/nuttx/code/trunk@5511 42af7a65-404d-4744-a932-0658087f49c3 --- apps/examples/posix_spawn/Makefile | 25 ++++++++++++++++--- apps/examples/posix_spawn/filesystem/Makefile | 20 ++++++--------- apps/examples/posix_spawn/spawn_main.c | 16 +++++++++++- nuttx/ChangeLog | 5 +++- nuttx/TODO | 14 +++++++++-- nuttx/libc/misc/lib_filesem.c | 16 ++++++------ nuttx/libc/misc/lib_streamsem.c | 2 -- nuttx/libc/stdio/lib_libfread.c | 3 ++- 8 files changed, 71 insertions(+), 30 deletions(-) diff --git a/apps/examples/posix_spawn/Makefile b/apps/examples/posix_spawn/Makefile index bda3376d23..0bfa36e554 100644 --- a/apps/examples/posix_spawn/Makefile +++ b/apps/examples/posix_spawn/Makefile @@ -105,7 +105,26 @@ distclean: clean $(call DELFILE, Make.dep) $(call DELFILE, .depend) -# There are no dependencies in this directory. We should are code some of -# more important dependencies here: +# There are no dependencies in this directory. Some of more important +# and more obvious dependencies are hard-coded here: --include Make.dep +spawn_main.o: spawn_main.c \ + $(TOPDIR)/include/nuttx/config.h \ + $(TOPDIR)/include/nuttx/compiler.h \ + $(TOPDIR)/include/sys/mount.h \ + $(TOPDIR)/include/stdio.h \ + $(TOPDIR)/include/stdlib.h \ + $(TOPDIR)/include/unistd.h \ + $(TOPDIR)/include/string.h \ + $(TOPDIR)/include/fcntl.h \ + $(TOPDIR)/include/spawn.h \ + $(TOPDIR)/include/debug.h \ + $(TOPDIR)/include/errno.h \ + $(TOPDIR)/include/nuttx/ramdisk.h \ + $(TOPDIR)/include/nuttx/binfmt/elf.h \ + $(TOPDIR)/include/nuttx/binfmt/symtab.h \ + filesystem/romfs.h + +symtab.o: filesystem/symtab.c \ + $(TOPDIR)/include/nuttx/compiler.h \ + $(TOPDIR)/include/nuttx/binfmt/symtab.h diff --git a/apps/examples/posix_spawn/filesystem/Makefile b/apps/examples/posix_spawn/filesystem/Makefile index 2005d060fa..26897426c3 100644 --- a/apps/examples/posix_spawn/filesystem/Makefile +++ b/apps/examples/posix_spawn/filesystem/Makefile @@ -44,7 +44,7 @@ ROMFS_HDR = $(FILESYSTEM_DIR)$(DELIM)romfs.h SYMTAB_SRC = $(FILESYSTEM_DIR)$(DELIM)symtab.c all: $(ROMFS_HDR) $(SYMTAB_SRC) -.PHONY: all hello redirect clean install populate +.PHONY: all hello/hello redirect/redirect clean populate # Create the romfs directory @@ -53,24 +53,20 @@ $(ROMFS_DIR): # Build the hello test program -hello: $(ROMFS_DIR) +hello/hello: $(Q) $(MAKE) -C hello hello TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)" ROMFS_DIR="$(ROMFS_DIR)" # Build the redirection test program -redirect: $(ROMFS_DIR) +redirect/redirect: $(Q) $(MAKE) -C redirect redirect TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)" ROMFS_DIR="$(ROMFS_DIR)" -# Install the test programs in the romfs directory - -install: hello redirect testdata.txt - $(Q) $(MAKE) -C hello install TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)" ROMFS_DIR="$(ROMFS_DIR)" - $(Q) $(MAKE) -C redirect install TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)" ROMFS_DIR="$(ROMFS_DIR)" - $(Q) install --mode=0644 testdata.txt $(ROMFS_DIR)/testdata.txt - # Create the romfs.img file from the romfs directory -$(ROMFS_IMG): install +$(ROMFS_IMG): hello/hello redirect/redirect testdata.txt $(ROMFS_DIR) + $(Q) $(MAKE) -C hello install TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)" ROMFS_DIR="$(ROMFS_DIR)" + $(Q) $(MAKE) -C redirect install TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)" ROMFS_DIR="$(ROMFS_DIR)" + $(Q) install --mode=0644 testdata.txt $(ROMFS_DIR)/testdata.txt $(Q) genromfs -f $@ -d $(ROMFS_DIR) -V "POSIXSPAWN" # Create the romfs.h header file from the romfs.img file @@ -80,7 +76,7 @@ $(ROMFS_HDR) : $(ROMFS_IMG) # Create the exported symbol table -$(SYMTAB_SRC): hello/hello redirect/redirect testdata.txt +$(SYMTAB_SRC): $(ROMFS_DIR)/hello $(ROMFS_DIR)/redirect $(ROMFS_DIR)/testdata.txt $(Q) $(FILESYSTEM_DIR)$(DELIM)mksymtab.sh $(ROMFS_DIR) >$@ # Clean each subdirectory diff --git a/apps/examples/posix_spawn/spawn_main.c b/apps/examples/posix_spawn/spawn_main.c index 6f8859516f..1506fe4993 100644 --- a/apps/examples/posix_spawn/spawn_main.c +++ b/apps/examples/posix_spawn/spawn_main.c @@ -89,6 +89,15 @@ # error "You must not disable loadable modules via CONFIG_BINFMT_DISABLE in your configuration file" #endif +/* The redirection test does not work. This is because it tries to redirect + * file as stdin. That won't work now because (1) the file descriptors must + * be dup'ed when the new task is created, and (2) there is no support in + * place for dup'ing file descriptors for anything other than sockets and + * character drivers. This is a bug! + */ + +#define FILE_DUP_BUG 1 + /* Describe the ROMFS file system */ #define SECTORSIZE 512 @@ -138,7 +147,9 @@ static unsigned int g_mmstep; /* Memory Usage at beginning of test step */ static const char delimiter[] = "****************************************************************************"; +#ifndef FILE_DUP_BUG static const char g_redirect[] = "redirect"; +#endif static const char g_hello[] = "hello"; static const char g_data[] = "testdata.txt"; @@ -361,9 +372,11 @@ int spawn_main(int argc, char *argv[]) mm_update(&g_mmstep, "after file_action/attr destruction"); /************************************************************************* - * Case 2: Simple program with redirection of stdin + * Case 2: Simple program with redirection of stdin to a file input *************************************************************************/ +#ifndef FILE_DUP_BUG + /* Output a seperated so that we can clearly discriminate the output of * this program from the others. */ @@ -450,6 +463,7 @@ int spawn_main(int argc, char *argv[]) posix_spawnattr_dump(&attr); mm_update(&g_mmstep, "after file_action/attr destruction"); +#endif /* Clean-up */ diff --git a/nuttx/ChangeLog b/nuttx/ChangeLog index 63aac89f54..40a24d8f10 100644 --- a/nuttx/ChangeLog +++ b/nuttx/ChangeLog @@ -3907,4 +3907,7 @@ that can be used for testing posix_spawn(). * arch/arm/src/stm32: Bring F1 support for general DMA and serial DMA in paricular up to parity with F2/F4 (from Mike Smith). - + * libc/stdio/lib_libfread.c: Correct some error handling when + lib_fread() was passed a bad stream. Needed to move the + releasing of a semaphore inside of some conditional logic + (cosmetic). diff --git a/nuttx/TODO b/nuttx/TODO index 9295f6206b..e257cef79f 100644 --- a/nuttx/TODO +++ b/nuttx/TODO @@ -1,4 +1,4 @@ -NuttX TODO List (Last updated January 10, 2013) +NuttX TODO List (Last updated January 11, 2013) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ This file summarizes known NuttX bugs, limitations, inconsistencies with @@ -15,7 +15,7 @@ nuttx/ (17) Network (net/, drivers/net) (4) USB (drivers/usbdev, drivers/usbhost) (12) Libraries (libc/, ) - (9) File system/Generic drivers (fs/, drivers/) + (10) File system/Generic drivers (fs/, drivers/) (5) Graphics subystem (graphics/) (1) Pascal add-on (pcode/) (1) Documentation (Documentation/) @@ -863,6 +863,16 @@ o File system / Generic drivers (fs/, drivers/) Status: Open Priority: Medium + Title: dup AND dup2 WILL NOT WORK ON FILES IN A MOUNTED VOLUME + Description: The current implementation of dup() and dup2() will only + work with open device drivers and sockets. It will not + work with open files in a file system. + + A limitation that results from this is that you cannot + redirect I/O to an from and file. + Status: Open + Priority: High + o Graphics subystem (graphics/) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/nuttx/libc/misc/lib_filesem.c b/nuttx/libc/misc/lib_filesem.c index 5cc4624ec6..f38ff5f238 100644 --- a/nuttx/libc/misc/lib_filesem.c +++ b/nuttx/libc/misc/lib_filesem.c @@ -67,8 +67,8 @@ void lib_sem_initialize(FAR struct file_struct *stream) { - /* Initialize the LIB semaphore to one (to support one-at- - * a-time access to private data sets. + /* Initialize the LIB semaphore to one (to support one-at-a-time access + * to private data sets. */ (void)sem_init(&stream->fs_sem, 0, 1); @@ -98,13 +98,13 @@ void lib_take_semaphore(FAR struct file_struct *stream) /* Take the semaphore (perhaps waiting) */ while (sem_wait(&stream->fs_sem) != 0) - { - /* The only case that an error should occr here is if - * the wait was awakened by a signal. - */ + { + /* The only case that an error should occr here is if the wait + * was awakened by a signal. + */ - ASSERT(get_errno() == EINTR); - } + ASSERT(get_errno() == EINTR); + } /* We have it. Claim the stak and return */ diff --git a/nuttx/libc/misc/lib_streamsem.c b/nuttx/libc/misc/lib_streamsem.c index e38298bdbb..3397f99074 100644 --- a/nuttx/libc/misc/lib_streamsem.c +++ b/nuttx/libc/misc/lib_streamsem.c @@ -86,5 +86,3 @@ void stream_semgive(FAR struct streamlist *list) { sem_post(&list->sl_sem); } - - diff --git a/nuttx/libc/stdio/lib_libfread.c b/nuttx/libc/stdio/lib_libfread.c index bc6479037d..3e851bf177 100644 --- a/nuttx/libc/stdio/lib_libfread.c +++ b/nuttx/libc/stdio/lib_libfread.c @@ -301,9 +301,10 @@ ssize_t lib_fread(FAR void *ptr, size_t count, FAR FILE *stream) { stream->fs_flags |= __FS_FLAG_EOF; } + + lib_give_semaphore(stream); } - lib_give_semaphore(stream); return bytes_read; /* Error exits */ From db161f73bc2608dbb8ad8c022609198f7f0b3f95 Mon Sep 17 00:00:00 2001 From: patacongo Date: Fri, 11 Jan 2013 21:51:54 +0000 Subject: [PATCH 065/118] Documentation update git-svn-id: http://svn.code.sf.net/p/nuttx/code/trunk@5512 42af7a65-404d-4744-a932-0658087f49c3 --- nuttx/Documentation/NuttxUserGuide.html | 748 +++++++++++++++++++++-- nuttx/TODO | 12 +- nuttx/include/spawn.h | 2 +- nuttx/libc/spawn/lib_ps.c | 13 +- nuttx/libc/spawn/lib_psa_getschedparam.c | 2 +- nuttx/libc/spawn/lib_psa_getsigmask.c | 2 +- nuttx/libc/spawn/lib_psa_setschedparam.c | 4 +- nuttx/libc/spawn/lib_psfa_addopen.c | 8 +- nuttx/libc/spawn/lib_psfa_init.c | 2 +- 9 files changed, 722 insertions(+), 71 deletions(-) diff --git a/nuttx/Documentation/NuttxUserGuide.html b/nuttx/Documentation/NuttxUserGuide.html index 89bc08942a..c6eabd29a5 100644 --- a/nuttx/Documentation/NuttxUserGuide.html +++ b/nuttx/Documentation/NuttxUserGuide.html @@ -13,7 +13,7 @@

            NuttX Operating System

            User's Manual

            by

            Gregory Nutt

            -

            Last Updated: January 8, 2013

            +

            Last Updated: January 11, 2013

          @@ -193,18 +193,52 @@ paragraphs.

          Task Control Interfaces. The following task control interfaces are provided by NuttX:

          +

          + Non-standard task control interfaces inspired by VxWorks interfaces: +

          +

          + Standard interfaces +

          + +

          + Standard vfork and exec[v|l] interfaces: +

          + +

          + Standard posix_spawn interfaces: +

          + +

          2.1.1 task_create

          @@ -472,53 +506,7 @@ STATUS taskDelete(int tid);
        • Deletion of self is supported, but only because task_delete() will re-direct processing to exit(). -

          2.1.5 exit

          - -

          -Function Prototype: -

          -    #include <sched.h>
          -    void exit(int code);
          -
          -    #include <nuttx/unistd.h>
          -    void _exit(int code);
          -
          - -

          -Description: This function causes the calling task to cease -to exist -- its stack and TCB will be deallocated. exit differs from -_exit in that it flushes streams, closes file descriptors and will -execute any function registered with atexit() or on_exit(). -

          -Input Parameters: -

            -
          • code. (ignored) -
          - -

          -Returned Value: None. - -

          -Assumptions/Limitations: - -

          -POSIX Compatibility: This is equivalent to the ANSI interface: -

          -    void exit(int code);
          -
          -And the UNIX interface: -
          -    void _exit(int code);
          -
          - -

          - The NuttX exit() differs from ANSI exit() in the following ways: -

          -
            -
          • The code parameter is ignored. -
          - -

          2.1.6 task_restart

          +

          2.1.5 task_restart

          Function Prototype:

            @@ -588,6 +576,52 @@ VxWorks provides the following similar interface:
               
             
          +

          2.1.6 exit

          + +

          +Function Prototype: +

          +    #include <sched.h>
          +    void exit(int code);
          +
          +    #include <nuttx/unistd.h>
          +    void _exit(int code);
          +
          + +

          +Description: This function causes the calling task to cease +to exist -- its stack and TCB will be deallocated. exit differs from +_exit in that it flushes streams, closes file descriptors and will +execute any function registered with atexit() or on_exit(). +

          +Input Parameters: +

            +
          • code. (ignored) +
          + +

          +Returned Value: None. + +

          +Assumptions/Limitations: + +

          +POSIX Compatibility: This is equivalent to the ANSI interface: +

          +    void exit(int code);
          +
          +And the UNIX interface: +
          +    void _exit(int code);
          +
          + +

          + The NuttX exit() differs from ANSI exit() in the following ways: +

          +
            +
          • The code parameter is ignored. +
          +

          2.1.7 getpid

          @@ -780,6 +814,595 @@ int execl(FAR const char *path, ...); There are, however, several compatibility issues as detailed in the description of execv().

          +

          2.1.11 posix_spawn and posix_spawnp

          +

          + Function Prototype: +

          +
            +#include <spawn.h>
            +int posix_spawn(FAR pid_t *pid, FAR const char *path,
            +      FAR const posix_spawn_file_actions_t *file_actions,
            +      FAR const posix_spawnattr_t *attr,
            +      FAR char *const argv[], FAR char *const envp[]);
            +int posix_spawnp(FAR pid_t *pid, FAR const char *file,
            +      FAR const posix_spawn_file_actions_t *file_actions,
            +      FAR const posix_spawnattr_t *attr,
            +      FAR char *const argv[], FAR char *const envp[]);
            +
          +

          + Description: + The posix_spawn() and posix_spawnp() functions will create a new, child task, constructed from a regular executable file.

          +

          +

          + Input Parameters: +

          +
            +
          • +

            + pid: + Upon successful completion, posix_spawn() and posix_spawnp() will return the task ID of the child task to the parent task, in the variable pointed to by a non-NULL pid argument. + If the pid argument is a null pointer, the process ID of the child is not returned to the caller. +

            +
          • +
          • +

            + path or file: + The path argument to posix_spawn() is the absolute path that identifies the file to execute. + The file argument to posix_spawnp() may also be a relative path and will be used to construct a pathname that identifies the file to execute. + In the case of a relative path, the path prefix for the file will be obtained by a search of the directories passed as the environment variable PATH. +

            +

            + NOTE: NuttX provides only one implementation: + If CONFIG_BINFMT_EXEPATH is defined, then only posix_spawnp() behavior is supported; otherwise, only posix_spawn behavior is supported. +

          • +
          • +

            + file_actions: + If file_actions is a null pointer, then file descriptors open in the calling process will remain open in the child process (unless CONFIG_FDCLONE_STDIO is defined). + If file_actions is not NULL, then the file descriptors open in the child process will be those open in the calling process as modified by the spawn file actions object pointed to by file_actions. +

            +
          • +
          • +

            + attr: + If the value of the attr parameter is NULL, the all default values for the POSIX spawn attributes will be used. + Otherwise, the attributes will be set according to the spawn flags. + The posix_spawnattr_t spawn attributes object type is defined in spawn.h. + It will contains these attributes, not all of which are supported by NuttX: +

            +
              +
            • + POSIX_SPAWN_SETPGROUP: + Setting of the new task's process group is not supported. + NuttX does not support process groups. +
            • +
            • + POSIX_SPAWN_SETSCHEDPARAM: + Set new tasks priority to the sched_param value. +
            • +
            • + POSIX_SPAWN_SETSCHEDULER: + Set the new task's scheduler policy to the sched_policy value. +
            • +
            • + POSIX_SPAWN_RESETIDS + Resetting of the effective user ID of the child process is not supported. + NuttX does not support effective user IDs. +
            • +
            • + POSIX_SPAWN_SETSIGMASK: + Set the new task's signal mask. +
            • +
            • + POSIX_SPAWN_SETSIGDEF: + Resetting signal default actions is not supported. + NuttX does not support default signal actions. +
            • +
            +
          • +
          • +

            + argv: + argv[] is the argument list for the new task. argv[] is an array of pointers to null-terminated strings. + The list is terminated with a null pointer. +

            +
          • +
          • +

            + envp: + The envp[] argument is not used by NuttX and may be NULL. + In standard implementations, envp[] is an array of character pointers to null-terminated strings that provide the environment for the new process image. + The environment array is terminated by a null pointer. + In NuttX, the envp[] argument is ignored and the new task will inherit the environment of the parent task unconditionally.

            +
          • +
          +

          + Returned Value: + posix_spawn() and posix_spawnp() will return zero on success. + Otherwise, an error number will be returned as the function return value to indicate the error: +

          +
            +
          • + EINVAL: + The value specified by file_actions or attr is invalid. +
          • +
          • + Any errors that might have been return if vfork() and excec[l|v]() had been called. +
          • +
          +

          + Assumptions/Limitations: +

          +
            +
          • + NuttX provides only posix_spawn() or posix_spawnp() behavior depending upon the setting of CONFIG_BINFMT_EXEPATH: + If CONFIG_BINFMT_EXEPATH is defined, then only posix_spawnp() behavior is supported; otherwise, only posix_spawn() behavior is supported. +
          • +
          • + The envp argument is not used and the environ variable is not altered (NuttX does not support the environ variable). +
          • +
          • + Process groups are not supported (See POSIX_SPAWN_SETPGROUP above). +
          • +
          • + Effective user IDs are not supported (See POSIX_SPAWN_RESETIDS above). +
          • +
          • + Signal default actions cannot be modified in the newly task executed because NuttX does not support default signal actions (See POSIX_SPAWN_SETSIGDEF). +
          • +
          +

          + POSIX Compatibility: + The value of the argv[0] received by the child task is assigned by NuttX. + For the caller of posix_spawn(), the provided argv[0] will correspond to argv[1] received by the new task. +

          + +

          2.1.12 posix_spawn_file_actions_init

          +

          + Function Prototype: +

          +
            +#include <spawn.h>
            +int posix_spawn_file_actions_init(FAR posix_spawn_file_actions_t *file_actions);
            +
          +

          + Description: + The posix_spawn_file_actions_init() function initializes the object referenced by file_actions to an empty set of file actions for subsequent use in a call to posix_spawn() or posix_spawnp(). +

          +

          + Input Parameters: +

          +
            +
          • + file_actions: + The address of the posix_spawn_file_actions_t to be initialized. +
          • +
          +

          + Returned Value: + On success, this function returns 0; on failure it will return an error number from <errno.h>. +

          + +

          2.1.13 posix_spawn_file_actions_destroy

          +

          + Function Prototype: +

          +
            +#include <spawn.h>
            +int posix_spawn_file_actions_destroy(FAR posix_spawn_file_actions_t *file_actions);
            +
          +

          + Description: + The posix_spawn_file_actions_destroy() function destroys the object referenced by file_actions which was previously intialized by posix_spawn_file_actions_init(), returning any resources obtained at the time of initialization to the system for subsequent reuse. + A posix_spawn_file_actions_t may be reinitialized after having been destroyed, but must not be reused after destruction, unless it has been reinitialized. +

          +

          + Input Parameters: +

          +
            +
          • + file_actions: + The address of the posix_spawn_file_actions_t to be destroyed. +
          • +
          +

          + Returned Value: + On success, this function returns 0; on failure it will return an error number from <errno.h> +

          + +

          2.1.14 posix_spawn_file_actions_addclose

          +

          + Function Prototype: +

          +
            +#include <spawn.h>
            +int posix_spawn_file_actions_addclose(FAR posix_spawn_file_actions_t *file_actions, int fd);
            +
          +

          + Description: + The posix_spawn_file_actions_addclose() function adds a close operation to the list of operations associated with the object referenced by file_actions, for subsequent use in a call to posix_spawn() or posix_spawnp(). + The descriptor referred to by fd is closed as if close() had been called on it prior to the new child process starting execution. +

          +

          + Input Parameters: +

          +
            +
          • + file_actions: + The address of the posix_spawn_file_actions_t object to which the close operation will be appended. +
          • +
          • + fd: + The file descriptor to be closed. +
          • +
          +

          + Returned Value: + On success, this function returns 0; on failure it will return an error number from <errno.h> +

          + +

          2.1.15 posix_spawn_file_actions_adddup2

          +

          + Function Prototype: +

          +
            +#include <spawn.h>
            +int posix_spawn_file_actions_adddup2(FAR posix_spawn_file_actions_t *file_actions, int fd1, int fd2);
            +
          +

          + Description: + The posix_spawn_file_actions_adddup2() function adds a dup2 operation to the list of operations associated with the object referenced by file_actions, for subsequent use in a call to posix_spawn() or posix_spawnp(). + The descriptor referred to by fd2 is created as if dup2() had been called on fd1 prior to the new child process starting execution. +

          +

          + Input Parameters: +

          +
            +
          • + file_actions: + The address of the posix_spawn_file_actions_t object to which the dup2 operation will be appended. +
          • +
          • + fd1: + The file descriptor to be be duplicated. + The first file descriptor to be argument to dup2(). +
          • +
          • + fd2: + The file descriptor to be be created. + The second file descriptor to be argument to dup2(). +
          • +
          +

          + Returned Value: + On success, this function returns 0; on failure it will return an error number from <errno.h> +

          + +

          2.1.16 posix_spawn_file_actions_addopen

          +

          + Function Prototype: +

          +
            +#include <spawn.h>
            +int posix_spawn_file_actions_addopen(FAR posix_spawn_file_actions_t *file_actions,
            +      int fd, FAR const char *path, int oflags, mode_t mode);
            +
          +

          + Description: + The posix_spawn_file_actions_addopen() function adds an open operation to the list of operations associated with the object referenced by file_actions, for subsequent use in a call to posix_spawn() or posix_spawnp(). + The descriptor referred to by fd is opened using the path, oflag, and mode arguments as if open() had been called on it prior to the new child process starting execution. + The string path is copied by the posix_spawn_file_actions_addopen() function during this process, so storage need not be persistent in the caller. +

          +

          + Input Parameters: +

          +
            +
          • + file_actions: + The address of the posix_spawn_file_actions_t object to which the open operation will be appended. +
          • +
          • + fd: + The file descriptor to be opened. +
          • +
          • + path: + The path to be opened. +
          • +
          • + oflags: + Open flags. +
          • +
          • + mode: + File creation mode/ +
          • +
          +

          + Returned Value: + On success, this function returns 0; on failure it will return an error number from <errno.h> +

          + +

          2.1.17 posix_spawnattr_init

          +

          + Function Prototype: +

          +
            +#include <spawn.h>
            +int posix_spawnattr_init(FAR posix_spawnattr_t *attr);
            +
          +

          + Description: + The posix_spawnattr_init() function initializes the object referenced by attr, to an empty set of spawn attributes for subsequent use in a call to posix_spawn() or posix_spawnp(). +

          +

          + Then the spawn attributes are no longer needed, they should be destroyed by calling posix_spawnattr_destroyed(). + In NuttX, however, posix_spawnattr_destroyed() is just stub: +

          +
            +#define posix_spawnattr_destroy(attr) (0)
            +
          +

          + For portability, the convention of calling posix_spawnattr_destroyed() when the attributes are not longer needed should still be followed. +

          +

          + Input Parameters: +

          +
            +
          • + attr: + The address of the spawn attributes to be initialized. +
          • +
          +

          + Returned Value: + On success, this function returns 0; on failure it will return an error number from <errno.h> +

          + +

          2.1.18 posix_spawnattr_getflags

          +

          + Function Prototype: +

          +
            +#include <spawn.h>
            +int posix_spawnattr_getflags(FAR const posix_spawnattr_t *attr, FAR short *flags);
            +
          +

          + Description: + The posix_spawnattr_getflags() function will obtain the value of the spawn-flags attribute from the attributes object referenced by attr. +

          +

          + Input Parameters: +

          +
            +
          • + attr: + The address spawn attributes to be queried. +
          • +
          • + flags: + The location to return the spawn flags +
          • +
          +

          + Returned Value: + On success, this function returns 0; on failure it will return an error number from <errno.h> +

          + +

          2.1.19 posix_spawnattr_getschedparam

          +

          + Function Prototype: +

          +
            +#include <spawn.h>
            +int posix_spawnattr_getschedparam(FAR const posix_spawnattr_t *attr, FAR struct sched_param *param);
            +
          +

          + Description: + The posix_spawnattr_getschedparam() function will obtain the value of the spawn-schedparam attribute from the attributes object referenced by attr. +

          +

          + Input Parameters: +

          +
            +
          • + attr: + The address spawn attributes to be queried. +
          • +
          • + param: + The location to return the spawn-schedparam value. +
          • +
          +

          + Returned Value: + On success, this function returns 0; on failure it will return an error number from <errno.h> +

          + +

          2.1.20 posix_spawnattr_getschedpolicy

          +

          + Function Prototype: +

          +
            +#include <spawn.h>
            +int posix_spawnattr_getschedpolicy(FAR const posix_spawnattr_t *attr, FAR int *policy);
            +
          +

          + Description: + The posix_spawnattr_getschedpolicy() function will obtain the value of the spawn-schedpolicy attribute from the attributes object referenced by attr. +

          +

          + Input Parameters: +

          +
            +
          • + attr: + The address spawn attributes to be queried. +
          • +
          • + policy: + The location to return the spawn-schedpolicy value. +
          • +
          +

          + Returned Value: + On success, this function returns 0; on failure it will return an error number from <errno.h> +

          + +

          2.1.21 posix_spawnattr_getsigmask

          +

          + Function Prototype: +

          +
            +#include <spawn.h>
            +#ifndef CONFIG_DISABLE_SIGNALS
            +int posix_spawnattr_getsigmask(FAR const posix_spawnattr_t *attr, FAR sigset_t *sigmask);
            +#endif
            +
          +

          + Description: + The posix_spawnattr_getsigdefault() function will obtain the value of the spawn-sigmask attribute from the attributes object referenced by attr. +

          +

          + Input Parameters: +

          +
            +
          • + attr: + The address spawn attributes to be queried. +
          • +
          • + sigmask: + The location to return the spawn-sigmask value. +
          • +
          +

          + Returned Value: + On success, this function returns 0; on failure it will return an error number from <errno.h> +

          + +

          2.1.22 posix_spawnattr_setflags

          +

          + Function Prototype: +

          +
            +#include <spawn.h>
            +int posix_spawnattr_setflags(FAR posix_spawnattr_t *attr, short flags);
            +
          +

          + Description: + The posix_spawnattr_setflags() function will set the spawn-flags attribute in an initialized attributes object referenced by attr. +

          +

          + Input Parameters: +

          +
            +
          • + attr: + The address spawn attributes to be used. +
          • +
          • + flags: + The new value of the spawn-flags attribute. +
          • +
          +

          + Returned Value: + On success, this function returns 0; on failure it will return an error number from <errno.h> +

          + +

          2.1.23 posix_spawnattr_setschedparam

          +

          + Function Prototype: +

          +
            +#include <spawn.h>
            +int posix_spawnattr_setschedparam(FAR posix_spawnattr_t *attr, FAR const struct sched_param *param);
            +
          +

          + Description: + The posix_spawnattr_setschedparam() function will set the spawn-schedparam attribute in an initialized attributes object referenced by attr. +

          +

          + Input Parameters: +

          +
            +
          • + attr: + The address spawn attributes to be used. +
          • +
          • + param: + The new value of the spawn-schedparam attribute. +
          • +
          +

          + Returned Value: + On success, this function returns 0; on failure it will return an error number from <errno.h> +

          + +

          2.1.24 posix_spawnattr_setschedpolicy

          +

          + Function Prototype: +

          +
            +#include <spawn.h>
            +int posix_spawnattr_setschedpolicy(FAR posix_spawnattr_t *attr, int policy);
            +
          +

          + Description: + The posix_spawnattr_setschedpolicy() function will set the spawn-schedpolicy attribute in an initialized attributes object referenced by attr. +

          +

          + Input Parameters: +

          +
            +
          • + attr: + The address spawn attributes to be used. +
          • +
          • + policy: + The new value of the spawn-schedpolicy attribute. +
          • +
          +

          + Returned Value: + On success, this function returns 0; on failure it will return an error number from <errno.h> +

          + +

          2.1.25 posix_spawnattr_setsigmask

          +

          + Function Prototype: +

          +
            +#include <spawn.h>
            +#ifndef CONFIG_DISABLE_SIGNALS
            +int posix_spawnattr_setsigmask(FAR posix_spawnattr_t *attr, FAR const sigset_t *sigmask);
            +#endif
            +
          +

          + Description: + The posix_spawnattr_setsigmask() function will set the spawn-sigmask attribute in an initialized attributes object referenced by attr. +

          +

          + Input Parameters: +

          +
            +
          • + attr: + The address spawn attributes to be used. +
          • +
          • + sigmask: + The new value of the spawn-sigmask attribute. +
          • +
          +

          + Returned Value: + On success, this function returns 0; on failure it will return an error number from <errno.h> +

          + - + + -
          @@ -8395,13 +9018,30 @@ notify a task when a message is available on a queue.
        • on_exit
        • open
        • opendir
        • -
        • OS Interfaces
        • pause
        • pipe
        • poll
        • poll.h
        • +
          +
        • posix_spawn
        • +
        • posix_spawn_file_actions_addclose
        • +
        • posix_spawn_file_actions_adddup2
        • +
        • posix_spawn_file_actions_addopen
        • +
        • posix_spawn_file_actions_destroy
        • +
        • posix_spawn_file_actions_init
        • +
        • posix_spawnattr_init
        • +
        • posix_spawnattr_destroy
        • +
        • posix_spawnattr_getflags
        • +
        • posix_spawnattr_getschedparam
        • +
        • posix_spawnattr_getschedpolicy
        • +
        • posix_spawnattr_getsigmask
        • +
        • posix_spawnattr_setflags
        • +
        • posix_spawnattr_setschedparam
        • +
        • posix_spawnattr_setschedpolicy
        • +
        • posix_spawnattr_setsigmask
        • +
        • posix_spawnp
        • printf
        • Pthread Interfaces
        • pthread_attr_destroy
        • @@ -8467,6 +9107,8 @@ notify a task when a message is available on a queue.
        • recv
        • recvfrom
        • rename
        • +
        • rmdir
        • rewinddir
        • ROM disk driver
        • @@ -8474,8 +9116,6 @@ notify a task when a message is available on a queue.
        • sched_getparam
        • sched_get_priority_max
        • sched_get_priority_min
        • -
        • sched_get_rr_interval
        • sched_lockcount
        • sched_lock
        • diff --git a/nuttx/TODO b/nuttx/TODO index e257cef79f..92b7ab4f57 100644 --- a/nuttx/TODO +++ b/nuttx/TODO @@ -866,7 +866,17 @@ o File system / Generic drivers (fs/, drivers/) Title: dup AND dup2 WILL NOT WORK ON FILES IN A MOUNTED VOLUME Description: The current implementation of dup() and dup2() will only work with open device drivers and sockets. It will not - work with open files in a file system. + work with open files in a file system. Support for dup'ing + open files on a mounted volume has not been implemented yet. + + There is a stubbed out, partial implemenation in fs/fs_files.c. + In would perform the dup2() operation by re-opening the file + and setting the file pointer. The logic, however, would require + that we remember the (relative) path to the file in the mounted + volume for each open file. + + An option might to add a dup() method to the file system + mountpoint interface. A limitation that results from this is that you cannot redirect I/O to an from and file. diff --git a/nuttx/include/spawn.h b/nuttx/include/spawn.h index 39ed9be15c..5e0ce3416c 100644 --- a/nuttx/include/spawn.h +++ b/nuttx/include/spawn.h @@ -112,7 +112,7 @@ extern "C" #ifdef CONFIG_BINFMT_EXEPATH int posix_spawnp(FAR pid_t *pid, FAR const char *path, FAR const posix_spawn_file_actions_t *file_actions, - FAR const posix_spawnattr_t * attr, + FAR const posix_spawnattr_t *attr, FAR char *const argv[], FAR char *const envp[]); #define posix_spawn(pid,path,file_actions,attr,argv,envp) \ posix_spawnp(pid,path,file_actions,attr,argv,envp) diff --git a/nuttx/libc/spawn/lib_ps.c b/nuttx/libc/spawn/lib_ps.c index a6a0590d4a..dfe57089e2 100644 --- a/nuttx/libc/spawn/lib_ps.c +++ b/nuttx/libc/spawn/lib_ps.c @@ -440,7 +440,7 @@ static int spawn_proxy(int argc, char *argv[]) * * Description: * The posix_spawn() and posix_spawnp() functions will create a new, - * child task, constructed a regular executable file. + * child task, constructed from a regular executable file. * * Input Parameters: * @@ -479,9 +479,9 @@ static int spawn_proxy(int argc, char *argv[]) * not supported. NuttX does not support process groups. * - POSIX_SPAWN_SETSCHEDPARAM: Set new tasks priority to the sched_param * value. - * - POSIX_SPAWN_SETSCHEDULER: Set the new task's scheduler priority to + * - POSIX_SPAWN_SETSCHEDULER: Set the new task's scheduler policy to * the sched_policy value. - * - POSIX_SPAWN_RESETIDS: Resetting of effective user ID of the child + * - POSIX_SPAWN_RESETIDS: Resetting of the effective user ID of the child * process is not supported. NuttX does not support effective user * IDs. * - POSIX_SPAWN_SETSIGMASK: Set the new task's signal mask. @@ -514,11 +514,12 @@ static int spawn_proxy(int argc, char *argv[]) * CONFIG_BINFMT_EXEPATH is defined, then only posix_spawnp() behavior * is supported; otherwise, only posix_spawn behavior is supported. * - The 'envp' argument is not used and the 'environ' variable is not - * altered (NuttX does not support the 'environ' variable. + * altered (NuttX does not support the 'environ' variable). * - Process groups are not supported (POSIX_SPAWN_SETPGROUP). * - Effective user IDs are not supported (POSIX_SPAWN_RESETIDS). - * - Signal masks and signal default actions cannot be modified in the - * newly executed task (POSIX_SPAWN_SETSIGDEF and POSIX_SPAWN_SETSIGMASK). + * - Signal default actions cannot be modified in the newly task executed + * because NuttX does not support default signal actions + * (POSIX_SPAWN_SETSIGDEF). * * POSIX Compatibility * - The value of the argv[0] received by the child task is assigned by diff --git a/nuttx/libc/spawn/lib_psa_getschedparam.c b/nuttx/libc/spawn/lib_psa_getschedparam.c index 65cec47f14..ed8cb1f700 100644 --- a/nuttx/libc/spawn/lib_psa_getschedparam.c +++ b/nuttx/libc/spawn/lib_psa_getschedparam.c @@ -57,7 +57,7 @@ * * Input Parameters: * attr - The address spawn attributes to be queried. - * flags - The location to return the sched_priority value. + * flags - The location to return the spawn-schedparam value. * * Returned Value: * On success, these functions return 0; on failure they return an error diff --git a/nuttx/libc/spawn/lib_psa_getsigmask.c b/nuttx/libc/spawn/lib_psa_getsigmask.c index 3c831075ee..dd3495b4d0 100644 --- a/nuttx/libc/spawn/lib_psa_getsigmask.c +++ b/nuttx/libc/spawn/lib_psa_getsigmask.c @@ -59,7 +59,7 @@ * * Input Parameters: * attr - The address spawn attributes to be queried. - * sigmask - The location to return the spawn flags + * sigmask - The location to return the signal mask * * Returned Value: * On success, these functions return 0; on failure they return an error diff --git a/nuttx/libc/spawn/lib_psa_setschedparam.c b/nuttx/libc/spawn/lib_psa_setschedparam.c index 8d3356aafd..5e992e8a92 100644 --- a/nuttx/libc/spawn/lib_psa_setschedparam.c +++ b/nuttx/libc/spawn/lib_psa_setschedparam.c @@ -56,8 +56,8 @@ * by attr. * * Input Parameters: - * attr - The address spawn attributes to be used. - * parm - The new sched_priority to set. + * attr - The address spawn attributes to be used. + * param - The new sched_priority to set. * * Returned Value: * On success, these functions return 0; on failure they return an error diff --git a/nuttx/libc/spawn/lib_psfa_addopen.c b/nuttx/libc/spawn/lib_psfa_addopen.c index bcb2012913..385e1cfc33 100644 --- a/nuttx/libc/spawn/lib_psfa_addopen.c +++ b/nuttx/libc/spawn/lib_psfa_addopen.c @@ -57,8 +57,8 @@ * Description: * The posix_spawn_file_actions_addopen() function adds an open operation * to the list of operations associated with the object referenced by - * file_actions, for subsequent use in a call to posix_spawn(2) or - * posix_spawnp(2). The descriptor referred to by fd is opened using + * file_actions, for subsequent use in a call to posix_spawn() or + * posix_spawnp(). The descriptor referred to by fd is opened using * the path, oflag, and mode arguments as if open() had been called on it * prior to the new child process starting execution. The string path is * copied by the posix_spawn_file_actions_addopen() function during this @@ -66,8 +66,8 @@ * * Input Parameters: * file_actions - The posix_spawn_file_actions_t to append the action. - * fd - The path to be opened. - * path - The first file descriptor to be argument to dup2. + * fd - The file descriptor to be opened. + * path - The path to be opened. * oflags - Open flags * mode - File creation mode * diff --git a/nuttx/libc/spawn/lib_psfa_init.c b/nuttx/libc/spawn/lib_psfa_init.c index 4e23703aec..5c902125a8 100644 --- a/nuttx/libc/spawn/lib_psfa_init.c +++ b/nuttx/libc/spawn/lib_psfa_init.c @@ -50,7 +50,7 @@ * * Description: * The posix_spawn_file_actions_init() function initializes the object - * referenced by file_actions, to an empty set of file actions for + * referenced by file_actions to an empty set of file actions for * subsequent use in a call to posix_spawn() or posix_spawnp(). * * Input Parameters: From b58281cab8add0af82167282126132b069170dd6 Mon Sep 17 00:00:00 2001 From: patacongo Date: Sat, 12 Jan 2013 19:58:45 +0000 Subject: [PATCH 066/118] Fix a *critical* bug in the task exit logic. Implements SIGCHILD git-svn-id: http://svn.code.sf.net/p/nuttx/code/trunk@5513 42af7a65-404d-4744-a932-0658087f49c3 --- apps/ChangeLog.txt | 2 + apps/examples/ostest/sighand.c | 58 ++++++++++++++++ nuttx/ChangeLog | 11 +++ nuttx/Documentation/NuttxPortingGuide.html | 50 ++++++++++++-- nuttx/configs/README.txt | 24 ++++++- nuttx/configs/amber/hello/defconfig | 2 +- nuttx/configs/avr32dev1/nsh/defconfig | 2 +- nuttx/configs/avr32dev1/ostest/defconfig | 2 +- nuttx/configs/cloudctrl/nsh/defconfig | 2 +- nuttx/configs/demo9s12ne64/ostest/defconfig | 2 +- nuttx/configs/ea3131/nsh/defconfig | 2 +- nuttx/configs/ea3131/ostest/defconfig | 2 +- nuttx/configs/ea3131/pgnsh/defconfig | 2 +- nuttx/configs/ea3131/usbserial/defconfig | 2 +- nuttx/configs/ea3131/usbstorage/defconfig | 2 +- nuttx/configs/ea3152/ostest/defconfig | 2 +- nuttx/configs/fire-stm32v2/nsh/defconfig | 2 +- nuttx/configs/hymini-stm32v/buttons/defconfig | 2 +- nuttx/configs/hymini-stm32v/nsh/defconfig | 2 +- nuttx/configs/hymini-stm32v/nsh2/defconfig | 2 +- nuttx/configs/hymini-stm32v/nx/defconfig | 2 +- nuttx/configs/hymini-stm32v/nxlines/defconfig | 2 +- .../configs/hymini-stm32v/usbserial/defconfig | 2 +- .../hymini-stm32v/usbstorage/defconfig | 2 +- nuttx/configs/kwikstik-k40/ostest/defconfig | 2 +- nuttx/configs/lincoln60/nsh/defconfig | 2 +- nuttx/configs/lincoln60/ostest/defconfig | 2 +- nuttx/configs/lpc4330-xplorer/nsh/defconfig | 2 +- .../configs/lpc4330-xplorer/ostest/defconfig | 2 +- .../lpcxpresso-lpc1768/dhcpd/defconfig | 2 +- .../configs/lpcxpresso-lpc1768/nsh/defconfig | 2 +- nuttx/configs/lpcxpresso-lpc1768/nx/defconfig | 2 +- .../lpcxpresso-lpc1768/ostest/defconfig | 2 +- .../lpcxpresso-lpc1768/thttpd/defconfig | 2 +- .../lpcxpresso-lpc1768/usbstorage/defconfig | 2 +- nuttx/configs/mbed/hidkbd/defconfig | 2 +- nuttx/configs/mbed/nsh/defconfig | 2 +- nuttx/configs/micropendous3/hello/defconfig | 2 +- nuttx/configs/mirtoo/nsh/defconfig | 2 +- nuttx/configs/mirtoo/nxffs/defconfig | 2 +- nuttx/configs/mirtoo/ostest/defconfig | 2 +- nuttx/configs/ne64badge/ostest/defconfig | 2 +- nuttx/configs/nucleus2g/nsh/defconfig | 2 +- nuttx/configs/nucleus2g/ostest/defconfig | 2 +- nuttx/configs/nucleus2g/usbserial/defconfig | 2 +- nuttx/configs/nucleus2g/usbstorage/defconfig | 2 +- .../configs/olimex-lpc1766stk/ftpc/defconfig | 2 +- .../olimex-lpc1766stk/hidkbd/defconfig | 2 +- .../olimex-lpc1766stk/nettest/defconfig | 2 +- nuttx/configs/olimex-lpc1766stk/nsh/defconfig | 2 +- nuttx/configs/olimex-lpc1766stk/nx/defconfig | 2 +- .../olimex-lpc1766stk/ostest/defconfig | 2 +- .../olimex-lpc1766stk/slip-httpd/defconfig | 2 +- .../olimex-lpc1766stk/thttpd/defconfig | 2 +- .../olimex-lpc1766stk/usbserial/defconfig | 2 +- .../olimex-lpc1766stk/usbstorage/defconfig | 2 +- nuttx/configs/olimex-stm32-p107/nsh/defconfig | 2 +- .../olimex-stm32-p107/ostest/defconfig | 2 +- .../configs/olimex-strp711/nettest/defconfig | 2 +- nuttx/configs/pcblogic-pic32mx/nsh/defconfig | 2 +- .../configs/pcblogic-pic32mx/ostest/defconfig | 2 +- nuttx/configs/pic32-starterkit/nsh/defconfig | 2 +- nuttx/configs/pic32-starterkit/nsh2/defconfig | 2 +- .../configs/pic32-starterkit/ostest/defconfig | 2 +- nuttx/configs/pic32mx7mmb/nsh/defconfig | 2 +- nuttx/configs/pic32mx7mmb/ostest/defconfig | 2 +- nuttx/configs/sam3u-ek/knsh/defconfig | 2 +- nuttx/configs/sam3u-ek/nsh/defconfig | 2 +- nuttx/configs/sam3u-ek/nx/defconfig | 2 +- nuttx/configs/sam3u-ek/ostest/defconfig | 2 +- nuttx/configs/sam3u-ek/touchscreen/defconfig | 2 +- nuttx/configs/shenzhou/nsh/defconfig | 2 +- nuttx/configs/shenzhou/nxwm/defconfig | 2 +- nuttx/configs/shenzhou/thttpd/defconfig | 2 +- nuttx/configs/sim/nsh/defconfig | 2 +- nuttx/configs/sim/nsh2/defconfig | 2 +- nuttx/configs/sim/ostest/defconfig | 13 +++- nuttx/configs/stm3210e-eval/RIDE/defconfig | 2 +- nuttx/configs/stm3210e-eval/buttons/defconfig | 2 +- .../configs/stm3210e-eval/composite/defconfig | 2 +- nuttx/configs/stm3210e-eval/nsh/defconfig | 2 +- nuttx/configs/stm3210e-eval/nsh2/defconfig | 2 +- nuttx/configs/stm3210e-eval/nx/defconfig | 2 +- .../configs/stm3210e-eval/nxconsole/defconfig | 2 +- nuttx/configs/stm3210e-eval/nxlines/defconfig | 2 +- nuttx/configs/stm3210e-eval/nxtext/defconfig | 2 +- nuttx/configs/stm3210e-eval/ostest/defconfig | 2 +- nuttx/configs/stm3210e-eval/pm/defconfig | 2 +- .../configs/stm3210e-eval/usbserial/defconfig | 2 +- .../stm3210e-eval/usbstorage/defconfig | 2 +- nuttx/configs/stm3220g-eval/dhcpd/defconfig | 2 +- nuttx/configs/stm3220g-eval/nettest/defconfig | 2 +- nuttx/configs/stm3220g-eval/nsh/defconfig | 2 +- nuttx/configs/stm3220g-eval/nsh2/defconfig | 2 +- nuttx/configs/stm3220g-eval/nxwm/defconfig | 2 +- nuttx/configs/stm3220g-eval/ostest/defconfig | 2 +- nuttx/configs/stm3220g-eval/telnetd/defconfig | 2 +- nuttx/configs/stm3240g-eval/dhcpd/defconfig | 2 +- nuttx/configs/stm3240g-eval/nettest/defconfig | 2 +- nuttx/configs/stm3240g-eval/nsh/defconfig | 2 +- nuttx/configs/stm3240g-eval/nsh2/defconfig | 2 +- .../configs/stm3240g-eval/nxconsole/defconfig | 2 +- nuttx/configs/stm3240g-eval/nxwm/defconfig | 2 +- nuttx/configs/stm3240g-eval/ostest/defconfig | 2 +- nuttx/configs/stm3240g-eval/telnetd/defconfig | 2 +- .../configs/stm3240g-eval/webserver/defconfig | 2 +- .../configs/stm32f100rc_generic/nsh/defconfig | 2 +- nuttx/configs/stm32f4discovery/README.txt | 26 +++++++ nuttx/configs/stm32f4discovery/nsh/defconfig | 2 +- nuttx/configs/stm32f4discovery/pm/defconfig | 2 +- .../stm32f4discovery/posix_spawn/defconfig | 2 +- nuttx/configs/sure-pic32mx/nsh/defconfig | 2 +- nuttx/configs/sure-pic32mx/ostest/defconfig | 2 +- nuttx/configs/sure-pic32mx/usbnsh/defconfig | 2 +- nuttx/configs/teensy/hello/defconfig | 2 +- nuttx/configs/teensy/nsh/defconfig | 2 +- nuttx/configs/teensy/usbstorage/defconfig | 2 +- nuttx/configs/twr-k60n512/nsh/defconfig | 2 +- nuttx/configs/twr-k60n512/ostest/defconfig | 2 +- nuttx/configs/ubw32/nsh/defconfig | 2 +- nuttx/configs/ubw32/ostest/defconfig | 2 +- nuttx/configs/vsn/nsh/defconfig | 2 +- nuttx/include/nuttx/sched.h | 3 + nuttx/include/nuttx/wqueue.h | 2 +- nuttx/include/signal.h | 68 +++++++++++------- nuttx/libc/Kconfig | 5 +- nuttx/sched/Kconfig | 69 ++++++++++++++++--- nuttx/sched/sched_unlock.c | 1 + nuttx/sched/sig_kill.c | 7 ++ nuttx/sched/sig_mqnotempty.c | 7 ++ nuttx/sched/sig_queue.c | 13 +++- nuttx/sched/sig_timedwait.c | 4 ++ nuttx/sched/task_deletecurrent.c | 16 ++++- nuttx/sched/task_exithook.c | 55 +++++++++++++++ nuttx/sched/task_setup.c | 36 +++++++++- nuttx/sched/timer_settime.c | 4 ++ 136 files changed, 540 insertions(+), 164 deletions(-) diff --git a/apps/ChangeLog.txt b/apps/ChangeLog.txt index 6b63527a7e..65d4d6134e 100644 --- a/apps/ChangeLog.txt +++ b/apps/ChangeLog.txt @@ -462,4 +462,6 @@ * apps/examples/wlan: Remove non-functional example. * apps/examples/ostest/vfork.c: Added a test of vfork(). * apps/exampes/posix_spawn: Added a test of poxis_spawn(). + * apps/examples/ostest: Extend signal handler test to catch + death-of-child signals (SIGCHLD). diff --git a/apps/examples/ostest/sighand.c b/apps/examples/ostest/sighand.c index eabfe56464..63d9590d9a 100644 --- a/apps/examples/ostest/sighand.c +++ b/apps/examples/ostest/sighand.c @@ -54,12 +54,32 @@ static sem_t sem; static bool sigreceived = false; static bool threadexited = false; +#ifdef CONFIG_SCHED_HAVE_PARENT +static void death_of_child(int signo, siginfo_t *info, void *ucontext) +{ + /* Use of printf in a signal handler is NOT safe! It can cause deadlocks! */ + + if (info) + { + printf("death_of_child: PID %d received signal=%d code=%d pid=%d status=%d\n", + getpid(), signo, info->si_code, info->si_pid, info->si_status); + } + else + { + printf("death_of_child: PID %d received signal=%d (no info?)\n", + getpid(), signo); + } +} +#endif + static void wakeup_action(int signo, siginfo_t *info, void *ucontext) { sigset_t oldset; sigset_t allsigs; int status; + /* Use of printf in a signal handler is NOT safe! It can cause deadlocks! */ + printf("wakeup_action: Received signal %d\n" , signo); sigreceived = true; @@ -186,6 +206,11 @@ static int waiter_main(int argc, char *argv[]) void sighand_test(void) { +#ifdef CONFIG_SCHED_HAVE_PARENT + struct sigaction act; + struct sigaction oact; + sigset_t sigset; +#endif struct sched_param param; union sigval sigvalue; pid_t waiterpid; @@ -195,6 +220,32 @@ void sighand_test(void) printf("sighand_test: Initializing semaphore to 0\n" ); sem_init(&sem, 0, 0); +#ifdef CONFIG_SCHED_HAVE_PARENT + printf("sighand_test: Unmasking SIGCHLD\n"); + + (void)sigemptyset(&sigset); + (void)sigaddset(&sigset, SIGCHLD); + status = sigprocmask(SIG_UNBLOCK, &sigset, NULL); + if (status != OK) + { + printf("sighand_test: ERROR sigprocmask failed, status=%d\n", + status); + } + + printf("sighand_test: Registering SIGCHLD handler\n" ); + act.sa_sigaction = death_of_child; + act.sa_flags = SA_SIGINFO; + + (void)sigfillset(&act.sa_mask); + (void)sigdelset(&act.sa_mask, SIGCHLD); + + status = sigaction(SIGCHLD, &act, &oact); + if (status != OK) + { + printf("waiter_main: ERROR sigaction failed, status=%d\n" , status); + } +#endif + /* Start waiter thread */ printf("sighand_test: Starting waiter task\n" ); @@ -262,6 +313,13 @@ void sighand_test(void) printf("sighand_test: ERROR signal handler did not run\n" ); } + /* Detach the signal handler */ + +#ifdef CONFIG_SCHED_HAVE_PARENT + act.sa_sigaction = SIG_DFL; + status = sigaction(SIGCHLD, &act, &oact); +#endif + printf("sighand_test: done\n" ); FFLUSH(); } diff --git a/nuttx/ChangeLog b/nuttx/ChangeLog index 40a24d8f10..921b7014bd 100644 --- a/nuttx/ChangeLog +++ b/nuttx/ChangeLog @@ -3911,3 +3911,14 @@ lib_fread() was passed a bad stream. Needed to move the releasing of a semaphore inside of some conditional logic (cosmetic). + * include/nuttx/sched.h, sched/task_setup.c, and sched/task_exithook.c: + Add support for remembering the parent task and sending + SIGCHLD to the parent when the task exists. + * sched/task_exithook.c: Fixed a *critical* bug. Here is + the scenario: (1) sched_lock() is called increments the lockcount + on the current TCB (i.e., the one at the head of the ready to run + list), (2) sched_mergepending is called which may change the task + at the head of the readytorun list, then (2) sched_lock() is called + which decrements the lockcount on the wrong TCB. The failure case + that I saw was that pre-emption got disabled in the IDLE thread, + locking up the whole system. diff --git a/nuttx/Documentation/NuttxPortingGuide.html b/nuttx/Documentation/NuttxPortingGuide.html index b1664f3f09..0b67eddb74 100644 --- a/nuttx/Documentation/NuttxPortingGuide.html +++ b/nuttx/Documentation/NuttxPortingGuide.html @@ -12,7 +12,7 @@

          NuttX RTOS Porting Guide

          -

          Last Updated: January 4, 2013

          +

          Last Updated: January 12, 2013

          @@ -4480,6 +4480,11 @@ build task name to save in the TCB. Useful if scheduler instrumentation is selected. Set to zero to disable.
        • +
        • + CONFIG_SCHED_HAVE_PARENT: Remember the ID of the parent thread when a new child thread is created. + This support enables a few minor features (such as SIGCHLD) and slightly increases the size of the Task Control Block (TCB) of every task to hold the ID of the parent thread. + Default: disabled. +
        • CONFIG_SYSTEM_TIME16: The range of system time is, by default, 32-bits. @@ -4582,7 +4587,7 @@ build
        • CONFIG_SIG_SIGWORK: The signal number that will be used to wake-up - the worker thread. Default: 4 + the worker thread. Default: 17
        • CONFIG_SCHED_LPWORK: If CONFIG_SCHED_WORKQUEUE is defined, then a single work queue is created by default. @@ -4624,9 +4629,41 @@ build user_start.
        • +

          + Signal Numbers: +

          +
            +
          • + CONFIG_SIG_SIGUSR1: + Value of standard user signal 1 (SIGUSR1). Default: 1 +
          • +
          • + CONFIG_SIG_SIGUSR2: + Value of standard user signal 2 (SIGUSR2). Default: 2 +
          • +
          • + CONFIG_SIG_SIGALARM: + Default the standard signal used with POSIX timers (SIGALRM). Default: 3 +
          • +
          • + CONFIG_SIG_SIGCHLD: + The SIGCHLD signal is sent to the parent of a child process when it exits, is interrupted (stopped), or resumes after being interrupted. + Default: 4 +
          • +
          • + CONFIG_SIG_SIGCONDTIMEDOUT: + This non-standard signal number is used in the implementation of pthread_cond_timedwait(). + Default 16. +
          • +
          • + CONFIG_SIG_SIGWORK: + SIGWORK is a non-standard signal used to wake up the internal NuttX worker thread. + Default: 17. +
          • +

          - Binary Loaders: + Binary Loaders:

          • @@ -4680,7 +4717,7 @@ build

          - System Logging: + System Logging:

          • @@ -4737,7 +4774,7 @@ build

          - Kernel build options: + Kernel build options:

          • @@ -4748,7 +4785,7 @@ build

          - OS setup related to on-demand paging: + OS setup related to on-demand paging:

          • @@ -4906,6 +4943,7 @@ build

          + Disabling OS Features. The following can be used to disable categories of APIs supported by the OS. If the compiler supports weak functions, then it should not be necessary to disable functions unless you want to diff --git a/nuttx/configs/README.txt b/nuttx/configs/README.txt index 6e7526ed0e..2724cf5a3c 100644 --- a/nuttx/configs/README.txt +++ b/nuttx/configs/README.txt @@ -334,6 +334,11 @@ defconfig -- This is a configuration file similar to the Linux CONFIG_TASK_NAME_SIZE - Specifies that maximum size of a task name to save in the TCB. Useful if scheduler instrumentation is selected. Set to zero to disable. + CONFIG_SCHED_HAVE_PARENT - Remember the ID of the parent thread + when a new child thread is created. This support enables a + few minor features (such as SIGCHLD) and slightly increases + the size of the Task Control Block (TCB) of every task to hold + the ID of the parent thread. Default: disabled. CONFIG_START_YEAR, CONFIG_START_MONTH, CONFIG_START_DAY - Used to initialize the internal time logic. CONFIG_GREGORIAN_TIME - Enables Gregorian time conversions. @@ -400,7 +405,7 @@ defconfig -- This is a configuration file similar to the Linux CONFIG_SCHED_WORKSTACKSIZE - The stack size allocated for the worker thread. Default: CONFIG_IDLETHREAD_STACKSIZE. CONFIG_SIG_SIGWORK - The signal number that will be used to wake-up - the worker thread. Default: 4 + the worker thread. Default: 17 CONFIG_SCHED_LPWORK. If CONFIG_SCHED_WORKQUEUE is defined, then a single work queue is created by default. If CONFIG_SCHED_LPWORK is also defined then an additional, lower-priority work queue will also be created. This @@ -426,6 +431,23 @@ defconfig -- This is a configuration file similar to the Linux where 'app' is the application name. If not defined, CONFIG_USER_ENTRYPOINT defaults to user_start. + Signal Numbers: + + CONFIG_SIG_SIGUSR1 - Value of standard user signal 1 (SIGUSR1). + Default: 1 + CONFIG_SIG_SIGUSR2 - Value of standard user signal 2 (SIGUSR2). + Default: 2 + CONFIG_SIG_SIGALARM - Default the standard signal used with POSIX + timers (SIGALRM). Default: 3 + CONFIG_SIG_SIGCHLD - The SIGCHLD signal is sent to the parent of a child + process when it exits, is interrupted (stopped), or resumes after being + interrupted. Default: 4 + + CONFIG_SIG_SIGCONDTIMEDOUT - This non-standard signal number is used in + the implementation of pthread_cond_timedwait(). Default 16. + CONFIG_SIG_SIGWORK - SIGWORK is a non-standard signal used to wake up + the internal NuttX worker thread. Default: 17. + Binary Loaders: CONFIG_BINFMT_DISABLE - By default, support for loadable binary formats is built. diff --git a/nuttx/configs/amber/hello/defconfig b/nuttx/configs/amber/hello/defconfig index 5d028e321c..7e3d4ad70c 100644 --- a/nuttx/configs/amber/hello/defconfig +++ b/nuttx/configs/amber/hello/defconfig @@ -142,7 +142,7 @@ CONFIG_SCHED_WORKQUEUE=n CONFIG_SCHED_WORKPRIORITY=192 CONFIG_SCHED_WORKPERIOD=50000 CONFIG_SCHED_WORKSTACKSIZE=1024 -CONFIG_SIG_SIGWORK=4 +CONFIG_SIG_SIGWORK=17 # # Settings for nxflat diff --git a/nuttx/configs/avr32dev1/nsh/defconfig b/nuttx/configs/avr32dev1/nsh/defconfig index 2b66316c31..acca1fbac3 100755 --- a/nuttx/configs/avr32dev1/nsh/defconfig +++ b/nuttx/configs/avr32dev1/nsh/defconfig @@ -168,7 +168,7 @@ CONFIG_SCHED_WORKQUEUE=n CONFIG_SCHED_WORKPRIORITY=192 CONFIG_SCHED_WORKPERIOD=50000 CONFIG_SCHED_WORKSTACKSIZE=1024 -CONFIG_SIG_SIGWORK=4 +CONFIG_SIG_SIGWORK=17 # # The following can be used to disable categories of diff --git a/nuttx/configs/avr32dev1/ostest/defconfig b/nuttx/configs/avr32dev1/ostest/defconfig index 9b67be09ea..084c662332 100755 --- a/nuttx/configs/avr32dev1/ostest/defconfig +++ b/nuttx/configs/avr32dev1/ostest/defconfig @@ -168,7 +168,7 @@ CONFIG_SCHED_WORKQUEUE=n CONFIG_SCHED_WORKPRIORITY=192 CONFIG_SCHED_WORKPERIOD=50000 CONFIG_SCHED_WORKSTACKSIZE=1024 -CONFIG_SIG_SIGWORK=4 +CONFIG_SIG_SIGWORK=17 # # The following can be used to disable categories of diff --git a/nuttx/configs/cloudctrl/nsh/defconfig b/nuttx/configs/cloudctrl/nsh/defconfig index 99c7eb7901..8f145d3ab9 100644 --- a/nuttx/configs/cloudctrl/nsh/defconfig +++ b/nuttx/configs/cloudctrl/nsh/defconfig @@ -273,7 +273,7 @@ CONFIG_SCHED_WORKQUEUE=y CONFIG_SCHED_WORKPRIORITY=192 CONFIG_SCHED_WORKPERIOD=50000 CONFIG_SCHED_WORKSTACKSIZE=2048 -CONFIG_SIG_SIGWORK=4 +CONFIG_SIG_SIGWORK=17 # CONFIG_SCHED_LPWORK is not set CONFIG_SCHED_WAITPID=y # CONFIG_SCHED_ATEXIT is not set diff --git a/nuttx/configs/demo9s12ne64/ostest/defconfig b/nuttx/configs/demo9s12ne64/ostest/defconfig index 9c9668aacc..79224989f2 100755 --- a/nuttx/configs/demo9s12ne64/ostest/defconfig +++ b/nuttx/configs/demo9s12ne64/ostest/defconfig @@ -142,7 +142,7 @@ CONFIG_SCHED_WORKQUEUE=n CONFIG_SCHED_WORKPRIORITY=192 CONFIG_SCHED_WORKPERIOD=50000 CONFIG_SCHED_WORKSTACKSIZE=256 -CONFIG_SIG_SIGWORK=4 +CONFIG_SIG_SIGWORK=17 # # The following can be used to disable categories of diff --git a/nuttx/configs/ea3131/nsh/defconfig b/nuttx/configs/ea3131/nsh/defconfig index 735af431b0..8c7b351af4 100644 --- a/nuttx/configs/ea3131/nsh/defconfig +++ b/nuttx/configs/ea3131/nsh/defconfig @@ -141,7 +141,7 @@ CONFIG_SCHED_WORKQUEUE=n CONFIG_SCHED_WORKPRIORITY=192 CONFIG_SCHED_WORKPERIOD=50000 CONFIG_SCHED_WORKSTACKSIZE=1024 -CONFIG_SIG_SIGWORK=4 +CONFIG_SIG_SIGWORK=17 # # The following can be used to disable categories of diff --git a/nuttx/configs/ea3131/ostest/defconfig b/nuttx/configs/ea3131/ostest/defconfig index 2f73ad5c9e..19838ceab4 100644 --- a/nuttx/configs/ea3131/ostest/defconfig +++ b/nuttx/configs/ea3131/ostest/defconfig @@ -141,7 +141,7 @@ CONFIG_SCHED_WORKQUEUE=n CONFIG_SCHED_WORKPRIORITY=192 CONFIG_SCHED_WORKPERIOD=50000 CONFIG_SCHED_WORKSTACKSIZE=1024 -CONFIG_SIG_SIGWORK=4 +CONFIG_SIG_SIGWORK=17 # # The following can be used to disable categories of diff --git a/nuttx/configs/ea3131/pgnsh/defconfig b/nuttx/configs/ea3131/pgnsh/defconfig index 32f89c5001..1cc2bec7e2 100644 --- a/nuttx/configs/ea3131/pgnsh/defconfig +++ b/nuttx/configs/ea3131/pgnsh/defconfig @@ -156,7 +156,7 @@ CONFIG_SCHED_WORKQUEUE=n CONFIG_SCHED_WORKPRIORITY=192 CONFIG_SCHED_WORKPERIOD=50000 CONFIG_SCHED_WORKSTACKSIZE=1024 -CONFIG_SIG_SIGWORK=4 +CONFIG_SIG_SIGWORK=17 # # OS setup related to on-demand paging: diff --git a/nuttx/configs/ea3131/usbserial/defconfig b/nuttx/configs/ea3131/usbserial/defconfig index 3d33a1b67d..a82f69877a 100644 --- a/nuttx/configs/ea3131/usbserial/defconfig +++ b/nuttx/configs/ea3131/usbserial/defconfig @@ -143,7 +143,7 @@ CONFIG_SCHED_WORKQUEUE=y CONFIG_SCHED_WORKPRIORITY=192 CONFIG_SCHED_WORKPERIOD=50000 CONFIG_SCHED_WORKSTACKSIZE=1024 -CONFIG_SIG_SIGWORK=4 +CONFIG_SIG_SIGWORK=17 # # The following can be used to disable categories of diff --git a/nuttx/configs/ea3131/usbstorage/defconfig b/nuttx/configs/ea3131/usbstorage/defconfig index 8d9933f555..a957fb3ab8 100644 --- a/nuttx/configs/ea3131/usbstorage/defconfig +++ b/nuttx/configs/ea3131/usbstorage/defconfig @@ -144,7 +144,7 @@ CONFIG_SCHED_WORKQUEUE=n CONFIG_SCHED_WORKPRIORITY=192 CONFIG_SCHED_WORKPERIOD=50000 CONFIG_SCHED_WORKSTACKSIZE=1024 -CONFIG_SIG_SIGWORK=4 +CONFIG_SIG_SIGWORK=17 # # The following can be used to disable categories of diff --git a/nuttx/configs/ea3152/ostest/defconfig b/nuttx/configs/ea3152/ostest/defconfig index d85fd58218..6d0bb63f05 100644 --- a/nuttx/configs/ea3152/ostest/defconfig +++ b/nuttx/configs/ea3152/ostest/defconfig @@ -142,7 +142,7 @@ CONFIG_SCHED_WORKQUEUE=n CONFIG_SCHED_WORKPRIORITY=192 CONFIG_SCHED_WORKPERIOD=50000 CONFIG_SCHED_WORKSTACKSIZE=1024 -CONFIG_SIG_SIGWORK=4 +CONFIG_SIG_SIGWORK=17 # # The following can be used to disable categories of diff --git a/nuttx/configs/fire-stm32v2/nsh/defconfig b/nuttx/configs/fire-stm32v2/nsh/defconfig index c42bb15696..2660984968 100644 --- a/nuttx/configs/fire-stm32v2/nsh/defconfig +++ b/nuttx/configs/fire-stm32v2/nsh/defconfig @@ -266,7 +266,7 @@ CONFIG_SCHED_WORKQUEUE=y CONFIG_SCHED_WORKPRIORITY=192 CONFIG_SCHED_WORKPERIOD=50000 CONFIG_SCHED_WORKSTACKSIZE=1024 -CONFIG_SIG_SIGWORK=4 +CONFIG_SIG_SIGWORK=17 # CONFIG_SCHED_LPWORK is not set CONFIG_SCHED_WAITPID=y # CONFIG_SCHED_ATEXIT is not set diff --git a/nuttx/configs/hymini-stm32v/buttons/defconfig b/nuttx/configs/hymini-stm32v/buttons/defconfig index bbd6c2319d..e90ded32ad 100644 --- a/nuttx/configs/hymini-stm32v/buttons/defconfig +++ b/nuttx/configs/hymini-stm32v/buttons/defconfig @@ -194,7 +194,7 @@ CONFIG_SCHED_WORKQUEUE=n CONFIG_SCHED_WORKPRIORITY=192 CONFIG_SCHED_WORKPERIOD=50000 CONFIG_SCHED_WORKSTACKSIZE=1024 -CONFIG_SIG_SIGWORK=4 +CONFIG_SIG_SIGWORK=17 # # The following can be used to disable categories of diff --git a/nuttx/configs/hymini-stm32v/nsh/defconfig b/nuttx/configs/hymini-stm32v/nsh/defconfig index ca589278af..eeb3b09ffd 100755 --- a/nuttx/configs/hymini-stm32v/nsh/defconfig +++ b/nuttx/configs/hymini-stm32v/nsh/defconfig @@ -192,7 +192,7 @@ CONFIG_SCHED_WORKQUEUE=y CONFIG_SCHED_WORKPRIORITY=192 CONFIG_SCHED_WORKPERIOD=50000 CONFIG_SCHED_WORKSTACKSIZE=1024 -CONFIG_SIG_SIGWORK=4 +CONFIG_SIG_SIGWORK=17 # # The following can be used to disable categories of diff --git a/nuttx/configs/hymini-stm32v/nsh2/defconfig b/nuttx/configs/hymini-stm32v/nsh2/defconfig index 5a8c0bea25..ecf4c3a3d8 100644 --- a/nuttx/configs/hymini-stm32v/nsh2/defconfig +++ b/nuttx/configs/hymini-stm32v/nsh2/defconfig @@ -202,7 +202,7 @@ CONFIG_SCHED_WORKQUEUE=y CONFIG_SCHED_WORKPRIORITY=192 CONFIG_SCHED_WORKPERIOD=50000 CONFIG_SCHED_WORKSTACKSIZE=1024 -CONFIG_SIG_SIGWORK=4 +CONFIG_SIG_SIGWORK=17 CONFIG_SCHED_WAITPID=y CONFIG_SCHED_ATEXIT=n diff --git a/nuttx/configs/hymini-stm32v/nx/defconfig b/nuttx/configs/hymini-stm32v/nx/defconfig index 28b08582cd..c6e0491420 100644 --- a/nuttx/configs/hymini-stm32v/nx/defconfig +++ b/nuttx/configs/hymini-stm32v/nx/defconfig @@ -193,7 +193,7 @@ CONFIG_SCHED_WORKQUEUE=y CONFIG_SCHED_WORKPRIORITY=192 CONFIG_SCHED_WORKPERIOD=50000 CONFIG_SCHED_WORKSTACKSIZE=1024 -CONFIG_SIG_SIGWORK=4 +CONFIG_SIG_SIGWORK=17 # # Settings for NXFLAT diff --git a/nuttx/configs/hymini-stm32v/nxlines/defconfig b/nuttx/configs/hymini-stm32v/nxlines/defconfig index 880efb7d81..fb968c483a 100644 --- a/nuttx/configs/hymini-stm32v/nxlines/defconfig +++ b/nuttx/configs/hymini-stm32v/nxlines/defconfig @@ -197,7 +197,7 @@ CONFIG_SCHED_WORKQUEUE=y CONFIG_SCHED_WORKPRIORITY=192 CONFIG_SCHED_WORKPERIOD=50000 CONFIG_SCHED_WORKSTACKSIZE=1024 -CONFIG_SIG_SIGWORK=4 +CONFIG_SIG_SIGWORK=17 # # Settings for NXFLAT diff --git a/nuttx/configs/hymini-stm32v/usbserial/defconfig b/nuttx/configs/hymini-stm32v/usbserial/defconfig index 732c1e8b6f..0c7317a007 100755 --- a/nuttx/configs/hymini-stm32v/usbserial/defconfig +++ b/nuttx/configs/hymini-stm32v/usbserial/defconfig @@ -195,7 +195,7 @@ CONFIG_SCHED_WORKQUEUE=n CONFIG_SCHED_WORKPRIORITY=192 CONFIG_SCHED_WORKPERIOD=50000 CONFIG_SCHED_WORKSTACKSIZE=1024 -CONFIG_SIG_SIGWORK=4 +CONFIG_SIG_SIGWORK=17 # # The following can be used to disable categories of diff --git a/nuttx/configs/hymini-stm32v/usbstorage/defconfig b/nuttx/configs/hymini-stm32v/usbstorage/defconfig index 7e49de0e87..16f43a1ce8 100755 --- a/nuttx/configs/hymini-stm32v/usbstorage/defconfig +++ b/nuttx/configs/hymini-stm32v/usbstorage/defconfig @@ -195,7 +195,7 @@ CONFIG_SCHED_WORKQUEUE=y CONFIG_SCHED_WORKPRIORITY=192 CONFIG_SCHED_WORKPERIOD=50000 CONFIG_SCHED_WORKSTACKSIZE=1024 -CONFIG_SIG_SIGWORK=4 +CONFIG_SIG_SIGWORK=17 # # Settings for NXFLAT diff --git a/nuttx/configs/kwikstik-k40/ostest/defconfig b/nuttx/configs/kwikstik-k40/ostest/defconfig index 759cff20b0..5f0291cedc 100755 --- a/nuttx/configs/kwikstik-k40/ostest/defconfig +++ b/nuttx/configs/kwikstik-k40/ostest/defconfig @@ -204,7 +204,7 @@ CONFIG_SCHED_WORKQUEUE=n CONFIG_SCHED_WORKPRIORITY=192 CONFIG_SCHED_WORKPERIOD=50000 CONFIG_SCHED_WORKSTACKSIZE=1024 -CONFIG_SIG_SIGWORK=4 +CONFIG_SIG_SIGWORK=17 # # The following can be used to disable categories of diff --git a/nuttx/configs/lincoln60/nsh/defconfig b/nuttx/configs/lincoln60/nsh/defconfig index e5009f8d6e..908b01e3a5 100644 --- a/nuttx/configs/lincoln60/nsh/defconfig +++ b/nuttx/configs/lincoln60/nsh/defconfig @@ -181,7 +181,7 @@ CONFIG_SCHED_WORKQUEUE=n CONFIG_SCHED_WORKPRIORITY=192 CONFIG_SCHED_WORKPERIOD=50000 CONFIG_SCHED_WORKSTACKSIZE=1024 -CONFIG_SIG_SIGWORK=4 +CONFIG_SIG_SIGWORK=17 # # The following can be used to disable categories of diff --git a/nuttx/configs/lincoln60/ostest/defconfig b/nuttx/configs/lincoln60/ostest/defconfig index 986f9bf438..ea42f57638 100644 --- a/nuttx/configs/lincoln60/ostest/defconfig +++ b/nuttx/configs/lincoln60/ostest/defconfig @@ -187,7 +187,7 @@ CONFIG_SCHED_WORKQUEUE=n CONFIG_SCHED_WORKPRIORITY=192 CONFIG_SCHED_WORKPERIOD=50000 CONFIG_SCHED_WORKSTACKSIZE=1024 -CONFIG_SIG_SIGWORK=4 +CONFIG_SIG_SIGWORK=17 # # The following can be used to disable categories of diff --git a/nuttx/configs/lpc4330-xplorer/nsh/defconfig b/nuttx/configs/lpc4330-xplorer/nsh/defconfig index 0afcbae892..78b9e3f715 100644 --- a/nuttx/configs/lpc4330-xplorer/nsh/defconfig +++ b/nuttx/configs/lpc4330-xplorer/nsh/defconfig @@ -227,7 +227,7 @@ CONFIG_SCHED_WORKQUEUE=n CONFIG_SCHED_WORKPRIORITY=192 CONFIG_SCHED_WORKPERIOD=50000 CONFIG_SCHED_WORKSTACKSIZE=2048 -CONFIG_SIG_SIGWORK=4 +CONFIG_SIG_SIGWORK=17 CONFIG_SCHED_WAITPID=y CONFIG_SCHED_ATEXIT=n diff --git a/nuttx/configs/lpc4330-xplorer/ostest/defconfig b/nuttx/configs/lpc4330-xplorer/ostest/defconfig index 76d3f11e95..342fe04a08 100644 --- a/nuttx/configs/lpc4330-xplorer/ostest/defconfig +++ b/nuttx/configs/lpc4330-xplorer/ostest/defconfig @@ -224,7 +224,7 @@ CONFIG_SCHED_WORKQUEUE=n CONFIG_SCHED_WORKPRIORITY=192 CONFIG_SCHED_WORKPERIOD=50000 CONFIG_SCHED_WORKSTACKSIZE=2048 -CONFIG_SIG_SIGWORK=4 +CONFIG_SIG_SIGWORK=17 CONFIG_SCHED_WAITPID=n CONFIG_SCHED_ATEXIT=n diff --git a/nuttx/configs/lpcxpresso-lpc1768/dhcpd/defconfig b/nuttx/configs/lpcxpresso-lpc1768/dhcpd/defconfig index f56dfca1ba..2e0d2eea66 100755 --- a/nuttx/configs/lpcxpresso-lpc1768/dhcpd/defconfig +++ b/nuttx/configs/lpcxpresso-lpc1768/dhcpd/defconfig @@ -186,7 +186,7 @@ CONFIG_SCHED_WORKQUEUE=n CONFIG_SCHED_WORKPRIORITY=192 CONFIG_SCHED_WORKPERIOD=50000 CONFIG_SCHED_WORKSTACKSIZE=1024 -CONFIG_SIG_SIGWORK=4 +CONFIG_SIG_SIGWORK=17 # # Settings for nxflat diff --git a/nuttx/configs/lpcxpresso-lpc1768/nsh/defconfig b/nuttx/configs/lpcxpresso-lpc1768/nsh/defconfig index ef70b55080..23f375a47a 100755 --- a/nuttx/configs/lpcxpresso-lpc1768/nsh/defconfig +++ b/nuttx/configs/lpcxpresso-lpc1768/nsh/defconfig @@ -189,7 +189,7 @@ CONFIG_SCHED_WORKQUEUE=n CONFIG_SCHED_WORKPRIORITY=192 CONFIG_SCHED_WORKPERIOD=50000 CONFIG_SCHED_WORKSTACKSIZE=1024 -CONFIG_SIG_SIGWORK=4 +CONFIG_SIG_SIGWORK=17 # # The following can be used to disable categories of diff --git a/nuttx/configs/lpcxpresso-lpc1768/nx/defconfig b/nuttx/configs/lpcxpresso-lpc1768/nx/defconfig index a0d3cd2836..3f8474103a 100755 --- a/nuttx/configs/lpcxpresso-lpc1768/nx/defconfig +++ b/nuttx/configs/lpcxpresso-lpc1768/nx/defconfig @@ -191,7 +191,7 @@ CONFIG_SCHED_WORKQUEUE=n CONFIG_SCHED_WORKPRIORITY=192 CONFIG_SCHED_WORKPERIOD=50000 CONFIG_SCHED_WORKSTACKSIZE=1024 -CONFIG_SIG_SIGWORK=4 +CONFIG_SIG_SIGWORK=17 # # Settings for nxflat diff --git a/nuttx/configs/lpcxpresso-lpc1768/ostest/defconfig b/nuttx/configs/lpcxpresso-lpc1768/ostest/defconfig index 660bd6c8b4..10b63eb2d1 100755 --- a/nuttx/configs/lpcxpresso-lpc1768/ostest/defconfig +++ b/nuttx/configs/lpcxpresso-lpc1768/ostest/defconfig @@ -184,7 +184,7 @@ CONFIG_SCHED_WORKQUEUE=n CONFIG_SCHED_WORKPRIORITY=192 CONFIG_SCHED_WORKPERIOD=50000 CONFIG_SCHED_WORKSTACKSIZE=1024 -CONFIG_SIG_SIGWORK=4 +CONFIG_SIG_SIGWORK=17 # # Settings for nxflat diff --git a/nuttx/configs/lpcxpresso-lpc1768/thttpd/defconfig b/nuttx/configs/lpcxpresso-lpc1768/thttpd/defconfig index 7558691560..b6ea25948f 100755 --- a/nuttx/configs/lpcxpresso-lpc1768/thttpd/defconfig +++ b/nuttx/configs/lpcxpresso-lpc1768/thttpd/defconfig @@ -186,7 +186,7 @@ CONFIG_SCHED_WORKQUEUE=n CONFIG_SCHED_WORKPRIORITY=192 CONFIG_SCHED_WORKPERIOD=50000 CONFIG_SCHED_WORKSTACKSIZE=1024 -CONFIG_SIG_SIGWORK=4 +CONFIG_SIG_SIGWORK=17 # # Settings for nxflat diff --git a/nuttx/configs/lpcxpresso-lpc1768/usbstorage/defconfig b/nuttx/configs/lpcxpresso-lpc1768/usbstorage/defconfig index 004d92cb34..9e4bcb15d6 100755 --- a/nuttx/configs/lpcxpresso-lpc1768/usbstorage/defconfig +++ b/nuttx/configs/lpcxpresso-lpc1768/usbstorage/defconfig @@ -187,7 +187,7 @@ CONFIG_SCHED_WORKQUEUE=n CONFIG_SCHED_WORKPRIORITY=192 CONFIG_SCHED_WORKPERIOD=50000 CONFIG_SCHED_WORKSTACKSIZE=1024 -CONFIG_SIG_SIGWORK=4 +CONFIG_SIG_SIGWORK=17 # # The following can be used to disable categories of diff --git a/nuttx/configs/mbed/hidkbd/defconfig b/nuttx/configs/mbed/hidkbd/defconfig index ba0af97cac..b4bf00872d 100644 --- a/nuttx/configs/mbed/hidkbd/defconfig +++ b/nuttx/configs/mbed/hidkbd/defconfig @@ -186,7 +186,7 @@ CONFIG_SCHED_WORKQUEUE=y CONFIG_SCHED_WORKPRIORITY=192 CONFIG_SCHED_WORKPERIOD=50000 CONFIG_SCHED_WORKSTACKSIZE=1024 -CONFIG_SIG_SIGWORK=4 +CONFIG_SIG_SIGWORK=17 # # The following can be used to disable categories of diff --git a/nuttx/configs/mbed/nsh/defconfig b/nuttx/configs/mbed/nsh/defconfig index a1168dd197..2156af80ef 100755 --- a/nuttx/configs/mbed/nsh/defconfig +++ b/nuttx/configs/mbed/nsh/defconfig @@ -181,7 +181,7 @@ CONFIG_SCHED_WORKQUEUE=n CONFIG_SCHED_WORKPRIORITY=192 CONFIG_SCHED_WORKPERIOD=50000 CONFIG_SCHED_WORKSTACKSIZE=1024 -CONFIG_SIG_SIGWORK=4 +CONFIG_SIG_SIGWORK=17 # # The following can be used to disable categories of diff --git a/nuttx/configs/micropendous3/hello/defconfig b/nuttx/configs/micropendous3/hello/defconfig index ea8faf8f52..ebc755abcc 100644 --- a/nuttx/configs/micropendous3/hello/defconfig +++ b/nuttx/configs/micropendous3/hello/defconfig @@ -137,7 +137,7 @@ CONFIG_SCHED_WORKQUEUE=n CONFIG_SCHED_WORKPRIORITY=192 CONFIG_SCHED_WORKPERIOD=50000 CONFIG_SCHED_WORKSTACKSIZE=1024 -CONFIG_SIG_SIGWORK=4 +CONFIG_SIG_SIGWORK=17 # # Settings for nxflat diff --git a/nuttx/configs/mirtoo/nsh/defconfig b/nuttx/configs/mirtoo/nsh/defconfig index f2e2b8991b..94a6b8b173 100644 --- a/nuttx/configs/mirtoo/nsh/defconfig +++ b/nuttx/configs/mirtoo/nsh/defconfig @@ -200,7 +200,7 @@ CONFIG_SCHED_WORKQUEUE=n CONFIG_SCHED_WORKPRIORITY=192 CONFIG_SCHED_WORKPERIOD=50000 CONFIG_SCHED_WORKSTACKSIZE=1024 -CONFIG_SIG_SIGWORK=4 +CONFIG_SIG_SIGWORK=17 CONFIG_SCHED_WAITPID=y CONFIG_SCHED_ATEXIT=n diff --git a/nuttx/configs/mirtoo/nxffs/defconfig b/nuttx/configs/mirtoo/nxffs/defconfig index 29de6f1e72..d633e56d9b 100644 --- a/nuttx/configs/mirtoo/nxffs/defconfig +++ b/nuttx/configs/mirtoo/nxffs/defconfig @@ -200,7 +200,7 @@ CONFIG_SCHED_WORKQUEUE=n CONFIG_SCHED_WORKPRIORITY=192 CONFIG_SCHED_WORKPERIOD=50000 CONFIG_SCHED_WORKSTACKSIZE=1024 -CONFIG_SIG_SIGWORK=4 +CONFIG_SIG_SIGWORK=17 CONFIG_SCHED_WAITPID=n CONFIG_SCHED_ATEXIT=n diff --git a/nuttx/configs/mirtoo/ostest/defconfig b/nuttx/configs/mirtoo/ostest/defconfig index dfe7a25c54..471dab4448 100644 --- a/nuttx/configs/mirtoo/ostest/defconfig +++ b/nuttx/configs/mirtoo/ostest/defconfig @@ -190,7 +190,7 @@ CONFIG_SCHED_WORKQUEUE=n CONFIG_SCHED_WORKPRIORITY=192 CONFIG_SCHED_WORKPERIOD=50000 CONFIG_SCHED_WORKSTACKSIZE=1024 -CONFIG_SIG_SIGWORK=4 +CONFIG_SIG_SIGWORK=17 CONFIG_SCHED_WAITPID=n CONFIG_SCHED_ATEXIT=n diff --git a/nuttx/configs/ne64badge/ostest/defconfig b/nuttx/configs/ne64badge/ostest/defconfig index 78e10f87ca..e6e0df700e 100755 --- a/nuttx/configs/ne64badge/ostest/defconfig +++ b/nuttx/configs/ne64badge/ostest/defconfig @@ -148,7 +148,7 @@ CONFIG_SCHED_WORKQUEUE=n CONFIG_SCHED_WORKPRIORITY=192 CONFIG_SCHED_WORKPERIOD=50000 CONFIG_SCHED_WORKSTACKSIZE=256 -CONFIG_SIG_SIGWORK=4 +CONFIG_SIG_SIGWORK=17 # # The following can be used to disable categories of diff --git a/nuttx/configs/nucleus2g/nsh/defconfig b/nuttx/configs/nucleus2g/nsh/defconfig index cc747e0c8c..2c440bc7f2 100755 --- a/nuttx/configs/nucleus2g/nsh/defconfig +++ b/nuttx/configs/nucleus2g/nsh/defconfig @@ -182,7 +182,7 @@ CONFIG_SCHED_WORKQUEUE=n CONFIG_SCHED_WORKPRIORITY=192 CONFIG_SCHED_WORKPERIOD=50000 CONFIG_SCHED_WORKSTACKSIZE=1024 -CONFIG_SIG_SIGWORK=4 +CONFIG_SIG_SIGWORK=17 # # The following can be used to disable categories of diff --git a/nuttx/configs/nucleus2g/ostest/defconfig b/nuttx/configs/nucleus2g/ostest/defconfig index 3d777de9cc..c32b1e715f 100755 --- a/nuttx/configs/nucleus2g/ostest/defconfig +++ b/nuttx/configs/nucleus2g/ostest/defconfig @@ -181,7 +181,7 @@ CONFIG_SCHED_WORKQUEUE=n CONFIG_SCHED_WORKPRIORITY=192 CONFIG_SCHED_WORKPERIOD=50000 CONFIG_SCHED_WORKSTACKSIZE=1024 -CONFIG_SIG_SIGWORK=4 +CONFIG_SIG_SIGWORK=17 # # The following can be used to disable categories of diff --git a/nuttx/configs/nucleus2g/usbserial/defconfig b/nuttx/configs/nucleus2g/usbserial/defconfig index e5762e8bcb..abe9ac0203 100755 --- a/nuttx/configs/nucleus2g/usbserial/defconfig +++ b/nuttx/configs/nucleus2g/usbserial/defconfig @@ -182,7 +182,7 @@ CONFIG_SCHED_WORKQUEUE=n CONFIG_SCHED_WORKPRIORITY=192 CONFIG_SCHED_WORKPERIOD=50000 CONFIG_SCHED_WORKSTACKSIZE=1024 -CONFIG_SIG_SIGWORK=4 +CONFIG_SIG_SIGWORK=17 # # The following can be used to disable categories of diff --git a/nuttx/configs/nucleus2g/usbstorage/defconfig b/nuttx/configs/nucleus2g/usbstorage/defconfig index 88c54bccc7..adab8f4f0e 100755 --- a/nuttx/configs/nucleus2g/usbstorage/defconfig +++ b/nuttx/configs/nucleus2g/usbstorage/defconfig @@ -183,7 +183,7 @@ CONFIG_SCHED_WORKQUEUE=n CONFIG_SCHED_WORKPRIORITY=192 CONFIG_SCHED_WORKPERIOD=50000 CONFIG_SCHED_WORKSTACKSIZE=1024 -CONFIG_SIG_SIGWORK=4 +CONFIG_SIG_SIGWORK=17 # # The following can be used to disable categories of diff --git a/nuttx/configs/olimex-lpc1766stk/ftpc/defconfig b/nuttx/configs/olimex-lpc1766stk/ftpc/defconfig index 36c5eefc4f..8ff0d95aaf 100755 --- a/nuttx/configs/olimex-lpc1766stk/ftpc/defconfig +++ b/nuttx/configs/olimex-lpc1766stk/ftpc/defconfig @@ -192,7 +192,7 @@ CONFIG_SCHED_WORKQUEUE=n CONFIG_SCHED_WORKPRIORITY=192 CONFIG_SCHED_WORKPERIOD=50000 CONFIG_SCHED_WORKSTACKSIZE=1024 -CONFIG_SIG_SIGWORK=4 +CONFIG_SIG_SIGWORK=17 CONFIG_SCHED_WAITPID=y # diff --git a/nuttx/configs/olimex-lpc1766stk/hidkbd/defconfig b/nuttx/configs/olimex-lpc1766stk/hidkbd/defconfig index 35a7bfc3db..6346011879 100755 --- a/nuttx/configs/olimex-lpc1766stk/hidkbd/defconfig +++ b/nuttx/configs/olimex-lpc1766stk/hidkbd/defconfig @@ -262,7 +262,7 @@ CONFIG_SCHED_WORKQUEUE=y CONFIG_SCHED_WORKPRIORITY=192 CONFIG_SCHED_WORKPERIOD=50000 CONFIG_SCHED_WORKSTACKSIZE=1024 -CONFIG_SIG_SIGWORK=4 +CONFIG_SIG_SIGWORK=17 # CONFIG_SCHED_LPWORK is not set # CONFIG_SCHED_WAITPID is not set # CONFIG_SCHED_ATEXIT is not set diff --git a/nuttx/configs/olimex-lpc1766stk/nettest/defconfig b/nuttx/configs/olimex-lpc1766stk/nettest/defconfig index f89d265b00..4ab823b8c7 100755 --- a/nuttx/configs/olimex-lpc1766stk/nettest/defconfig +++ b/nuttx/configs/olimex-lpc1766stk/nettest/defconfig @@ -192,7 +192,7 @@ CONFIG_SCHED_WORKQUEUE=n CONFIG_SCHED_WORKPRIORITY=192 CONFIG_SCHED_WORKPERIOD=50000 CONFIG_SCHED_WORKSTACKSIZE=1024 -CONFIG_SIG_SIGWORK=4 +CONFIG_SIG_SIGWORK=17 # # The following can be used to disable categories of diff --git a/nuttx/configs/olimex-lpc1766stk/nsh/defconfig b/nuttx/configs/olimex-lpc1766stk/nsh/defconfig index 0d82b458ba..096f08a8a8 100755 --- a/nuttx/configs/olimex-lpc1766stk/nsh/defconfig +++ b/nuttx/configs/olimex-lpc1766stk/nsh/defconfig @@ -194,7 +194,7 @@ CONFIG_SCHED_WORKQUEUE=n CONFIG_SCHED_WORKPRIORITY=192 CONFIG_SCHED_WORKPERIOD=50000 CONFIG_SCHED_WORKSTACKSIZE=1024 -CONFIG_SIG_SIGWORK=4 +CONFIG_SIG_SIGWORK=17 CONFIG_SCHED_WAITPID=y CONFIG_SCHED_ATEXIT=n diff --git a/nuttx/configs/olimex-lpc1766stk/nx/defconfig b/nuttx/configs/olimex-lpc1766stk/nx/defconfig index 55c480fe3a..28ad229d6b 100755 --- a/nuttx/configs/olimex-lpc1766stk/nx/defconfig +++ b/nuttx/configs/olimex-lpc1766stk/nx/defconfig @@ -197,7 +197,7 @@ CONFIG_SCHED_WORKQUEUE=n CONFIG_SCHED_WORKPRIORITY=192 CONFIG_SCHED_WORKPERIOD=50000 CONFIG_SCHED_WORKSTACKSIZE=1024 -CONFIG_SIG_SIGWORK=4 +CONFIG_SIG_SIGWORK=17 # # The following can be used to disable categories of diff --git a/nuttx/configs/olimex-lpc1766stk/ostest/defconfig b/nuttx/configs/olimex-lpc1766stk/ostest/defconfig index 32e2cacc58..02732e74a5 100755 --- a/nuttx/configs/olimex-lpc1766stk/ostest/defconfig +++ b/nuttx/configs/olimex-lpc1766stk/ostest/defconfig @@ -187,7 +187,7 @@ CONFIG_SCHED_WORKQUEUE=n CONFIG_SCHED_WORKPRIORITY=192 CONFIG_SCHED_WORKPERIOD=50000 CONFIG_SCHED_WORKSTACKSIZE=1024 -CONFIG_SIG_SIGWORK=4 +CONFIG_SIG_SIGWORK=17 # # The following can be used to disable categories of diff --git a/nuttx/configs/olimex-lpc1766stk/slip-httpd/defconfig b/nuttx/configs/olimex-lpc1766stk/slip-httpd/defconfig index ff2674c793..9becdee046 100755 --- a/nuttx/configs/olimex-lpc1766stk/slip-httpd/defconfig +++ b/nuttx/configs/olimex-lpc1766stk/slip-httpd/defconfig @@ -190,7 +190,7 @@ CONFIG_SCHED_WORKQUEUE=n CONFIG_SCHED_WORKPRIORITY=192 CONFIG_SCHED_WORKPERIOD=50000 CONFIG_SCHED_WORKSTACKSIZE=2048 -CONFIG_SIG_SIGWORK=4 +CONFIG_SIG_SIGWORK=17 # # Settings for nxflat diff --git a/nuttx/configs/olimex-lpc1766stk/thttpd/defconfig b/nuttx/configs/olimex-lpc1766stk/thttpd/defconfig index 936dba3593..fe42a861f9 100755 --- a/nuttx/configs/olimex-lpc1766stk/thttpd/defconfig +++ b/nuttx/configs/olimex-lpc1766stk/thttpd/defconfig @@ -188,7 +188,7 @@ CONFIG_SCHED_WORKQUEUE=n CONFIG_SCHED_WORKPRIORITY=192 CONFIG_SCHED_WORKPERIOD=50000 CONFIG_SCHED_WORKSTACKSIZE=1024 -CONFIG_SIG_SIGWORK=4 +CONFIG_SIG_SIGWORK=17 # # Settings for nxflat diff --git a/nuttx/configs/olimex-lpc1766stk/usbserial/defconfig b/nuttx/configs/olimex-lpc1766stk/usbserial/defconfig index 603a1562a6..995cbad598 100755 --- a/nuttx/configs/olimex-lpc1766stk/usbserial/defconfig +++ b/nuttx/configs/olimex-lpc1766stk/usbserial/defconfig @@ -188,7 +188,7 @@ CONFIG_SCHED_WORKQUEUE=n CONFIG_SCHED_WORKPRIORITY=192 CONFIG_SCHED_WORKPERIOD=50000 CONFIG_SCHED_WORKSTACKSIZE=1024 -CONFIG_SIG_SIGWORK=4 +CONFIG_SIG_SIGWORK=17 # # The following can be used to disable categories of diff --git a/nuttx/configs/olimex-lpc1766stk/usbstorage/defconfig b/nuttx/configs/olimex-lpc1766stk/usbstorage/defconfig index 2c29d2ffd1..e11c2c404e 100755 --- a/nuttx/configs/olimex-lpc1766stk/usbstorage/defconfig +++ b/nuttx/configs/olimex-lpc1766stk/usbstorage/defconfig @@ -189,7 +189,7 @@ CONFIG_SCHED_WORKQUEUE=n CONFIG_SCHED_WORKPRIORITY=192 CONFIG_SCHED_WORKPERIOD=50000 CONFIG_SCHED_WORKSTACKSIZE=1024 -CONFIG_SIG_SIGWORK=4 +CONFIG_SIG_SIGWORK=17 # # The following can be used to disable categories of diff --git a/nuttx/configs/olimex-stm32-p107/nsh/defconfig b/nuttx/configs/olimex-stm32-p107/nsh/defconfig index 7aaae25140..0a831ce9fc 100644 --- a/nuttx/configs/olimex-stm32-p107/nsh/defconfig +++ b/nuttx/configs/olimex-stm32-p107/nsh/defconfig @@ -234,7 +234,7 @@ CONFIG_SCHED_WORKQUEUE=y CONFIG_SCHED_WORKPRIORITY=192 CONFIG_SCHED_WORKPERIOD=50000 CONFIG_SCHED_WORKSTACKSIZE=1024 -CONFIG_SIG_SIGWORK=4 +CONFIG_SIG_SIGWORK=17 # # The following can be used to disable categories of diff --git a/nuttx/configs/olimex-stm32-p107/ostest/defconfig b/nuttx/configs/olimex-stm32-p107/ostest/defconfig index d4bba38fbb..272832381e 100644 --- a/nuttx/configs/olimex-stm32-p107/ostest/defconfig +++ b/nuttx/configs/olimex-stm32-p107/ostest/defconfig @@ -242,7 +242,7 @@ CONFIG_SCHED_WORKQUEUE=n CONFIG_SCHED_WORKPRIORITY=192 CONFIG_SCHED_WORKPERIOD=50000 CONFIG_SCHED_WORKSTACKSIZE=1024 -CONFIG_SIG_SIGWORK=4 +CONFIG_SIG_SIGWORK=17 # # The following can be used to disable categories of diff --git a/nuttx/configs/olimex-strp711/nettest/defconfig b/nuttx/configs/olimex-strp711/nettest/defconfig index 4d73540b80..a8767c7be1 100755 --- a/nuttx/configs/olimex-strp711/nettest/defconfig +++ b/nuttx/configs/olimex-strp711/nettest/defconfig @@ -160,7 +160,7 @@ CONFIG_SCHED_WORKQUEUE=y CONFIG_SCHED_WORKPRIORITY=192 CONFIG_SCHED_WORKPERIOD=50000 CONFIG_SCHED_WORKSTACKSIZE=1024 -CONFIG_SIG_SIGWORK=4 +CONFIG_SIG_SIGWORK=17 # # The following can be used to disable categories of diff --git a/nuttx/configs/pcblogic-pic32mx/nsh/defconfig b/nuttx/configs/pcblogic-pic32mx/nsh/defconfig index b4bd30ae84..7bce554ac7 100644 --- a/nuttx/configs/pcblogic-pic32mx/nsh/defconfig +++ b/nuttx/configs/pcblogic-pic32mx/nsh/defconfig @@ -189,7 +189,7 @@ CONFIG_SCHED_WORKQUEUE=n CONFIG_SCHED_WORKPRIORITY=192 CONFIG_SCHED_WORKPERIOD=50000 CONFIG_SCHED_WORKSTACKSIZE=1024 -CONFIG_SIG_SIGWORK=4 +CONFIG_SIG_SIGWORK=17 CONFIG_SCHED_WAITPID=y CONFIG_SCHED_ATEXIT=n diff --git a/nuttx/configs/pcblogic-pic32mx/ostest/defconfig b/nuttx/configs/pcblogic-pic32mx/ostest/defconfig index 08bdccddd7..730b8134a9 100644 --- a/nuttx/configs/pcblogic-pic32mx/ostest/defconfig +++ b/nuttx/configs/pcblogic-pic32mx/ostest/defconfig @@ -187,7 +187,7 @@ CONFIG_SCHED_WORKQUEUE=n CONFIG_SCHED_WORKPRIORITY=192 CONFIG_SCHED_WORKPERIOD=50000 CONFIG_SCHED_WORKSTACKSIZE=1024 -CONFIG_SIG_SIGWORK=4 +CONFIG_SIG_SIGWORK=17 # # Settings for nxflat diff --git a/nuttx/configs/pic32-starterkit/nsh/defconfig b/nuttx/configs/pic32-starterkit/nsh/defconfig index f2cd275601..32220d89ba 100644 --- a/nuttx/configs/pic32-starterkit/nsh/defconfig +++ b/nuttx/configs/pic32-starterkit/nsh/defconfig @@ -253,7 +253,7 @@ CONFIG_SCHED_WORKQUEUE=n CONFIG_SCHED_WORKPRIORITY=192 CONFIG_SCHED_WORKPERIOD=50000 CONFIG_SCHED_WORKSTACKSIZE=1024 -CONFIG_SIG_SIGWORK=4 +CONFIG_SIG_SIGWORK=17 CONFIG_SCHED_WAITPID=y CONFIG_SCHED_ATEXIT=n diff --git a/nuttx/configs/pic32-starterkit/nsh2/defconfig b/nuttx/configs/pic32-starterkit/nsh2/defconfig index 6f227f638d..a7a1ff18a8 100644 --- a/nuttx/configs/pic32-starterkit/nsh2/defconfig +++ b/nuttx/configs/pic32-starterkit/nsh2/defconfig @@ -252,7 +252,7 @@ CONFIG_SCHED_WORKQUEUE=n CONFIG_SCHED_WORKPRIORITY=192 CONFIG_SCHED_WORKPERIOD=50000 CONFIG_SCHED_WORKSTACKSIZE=1024 -CONFIG_SIG_SIGWORK=4 +CONFIG_SIG_SIGWORK=17 CONFIG_SCHED_WAITPID=y CONFIG_SCHED_ATEXIT=n diff --git a/nuttx/configs/pic32-starterkit/ostest/defconfig b/nuttx/configs/pic32-starterkit/ostest/defconfig index 922cb8901a..3a55de491e 100644 --- a/nuttx/configs/pic32-starterkit/ostest/defconfig +++ b/nuttx/configs/pic32-starterkit/ostest/defconfig @@ -250,7 +250,7 @@ CONFIG_SCHED_WORKQUEUE=n CONFIG_SCHED_WORKPRIORITY=192 CONFIG_SCHED_WORKPERIOD=50000 CONFIG_SCHED_WORKSTACKSIZE=1024 -CONFIG_SIG_SIGWORK=4 +CONFIG_SIG_SIGWORK=17 CONFIG_SCHED_WAITPID=n CONFIG_SCHED_ATEXIT=n diff --git a/nuttx/configs/pic32mx7mmb/nsh/defconfig b/nuttx/configs/pic32mx7mmb/nsh/defconfig index aa7fc23df9..d39f8bc405 100644 --- a/nuttx/configs/pic32mx7mmb/nsh/defconfig +++ b/nuttx/configs/pic32mx7mmb/nsh/defconfig @@ -259,7 +259,7 @@ CONFIG_SCHED_WORKQUEUE=n CONFIG_SCHED_WORKPRIORITY=192 CONFIG_SCHED_WORKPERIOD=50000 CONFIG_SCHED_WORKSTACKSIZE=2048 -CONFIG_SIG_SIGWORK=4 +CONFIG_SIG_SIGWORK=17 CONFIG_SCHED_WAITPID=y CONFIG_SCHED_ATEXIT=n diff --git a/nuttx/configs/pic32mx7mmb/ostest/defconfig b/nuttx/configs/pic32mx7mmb/ostest/defconfig index 1d656380d6..b3cecf98d4 100644 --- a/nuttx/configs/pic32mx7mmb/ostest/defconfig +++ b/nuttx/configs/pic32mx7mmb/ostest/defconfig @@ -250,7 +250,7 @@ CONFIG_SCHED_WORKQUEUE=n CONFIG_SCHED_WORKPRIORITY=192 CONFIG_SCHED_WORKPERIOD=50000 CONFIG_SCHED_WORKSTACKSIZE=1024 -CONFIG_SIG_SIGWORK=4 +CONFIG_SIG_SIGWORK=17 CONFIG_SCHED_WAITPID=n CONFIG_SCHED_ATEXIT=n diff --git a/nuttx/configs/sam3u-ek/knsh/defconfig b/nuttx/configs/sam3u-ek/knsh/defconfig index e61180407f..30f60f0e32 100755 --- a/nuttx/configs/sam3u-ek/knsh/defconfig +++ b/nuttx/configs/sam3u-ek/knsh/defconfig @@ -186,7 +186,7 @@ CONFIG_SCHED_WORKQUEUE=n CONFIG_SCHED_WORKPRIORITY=192 CONFIG_SCHED_WORKPERIOD=50000 CONFIG_SCHED_WORKSTACKSIZE=1024 -CONFIG_SIG_SIGWORK=4 +CONFIG_SIG_SIGWORK=17 # # These NSH commands are (temporarily) disable because more support is needed diff --git a/nuttx/configs/sam3u-ek/nsh/defconfig b/nuttx/configs/sam3u-ek/nsh/defconfig index 288df5957f..9715984649 100755 --- a/nuttx/configs/sam3u-ek/nsh/defconfig +++ b/nuttx/configs/sam3u-ek/nsh/defconfig @@ -171,7 +171,7 @@ CONFIG_SCHED_WORKQUEUE=n CONFIG_SCHED_WORKPRIORITY=192 CONFIG_SCHED_WORKPERIOD=50000 CONFIG_SCHED_WORKSTACKSIZE=1024 -CONFIG_SIG_SIGWORK=4 +CONFIG_SIG_SIGWORK=17 # # The following can be used to disable categories of diff --git a/nuttx/configs/sam3u-ek/nx/defconfig b/nuttx/configs/sam3u-ek/nx/defconfig index 7b56b9d41b..dd55d9c932 100755 --- a/nuttx/configs/sam3u-ek/nx/defconfig +++ b/nuttx/configs/sam3u-ek/nx/defconfig @@ -172,7 +172,7 @@ CONFIG_SCHED_WORKQUEUE=n CONFIG_SCHED_WORKPRIORITY=192 CONFIG_SCHED_WORKPERIOD=50000 CONFIG_SCHED_WORKSTACKSIZE=1024 -CONFIG_SIG_SIGWORK=4 +CONFIG_SIG_SIGWORK=17 # # The following can be used to disable categories of diff --git a/nuttx/configs/sam3u-ek/ostest/defconfig b/nuttx/configs/sam3u-ek/ostest/defconfig index b2e9a5184f..bf15cb1a59 100755 --- a/nuttx/configs/sam3u-ek/ostest/defconfig +++ b/nuttx/configs/sam3u-ek/ostest/defconfig @@ -172,7 +172,7 @@ CONFIG_SCHED_WORKQUEUE=n CONFIG_SCHED_WORKPRIORITY=192 CONFIG_SCHED_WORKPERIOD=50000 CONFIG_SCHED_WORKSTACKSIZE=1024 -CONFIG_SIG_SIGWORK=4 +CONFIG_SIG_SIGWORK=17 # # The following can be used to disable categories of diff --git a/nuttx/configs/sam3u-ek/touchscreen/defconfig b/nuttx/configs/sam3u-ek/touchscreen/defconfig index e89db8c4b3..414eadb6eb 100755 --- a/nuttx/configs/sam3u-ek/touchscreen/defconfig +++ b/nuttx/configs/sam3u-ek/touchscreen/defconfig @@ -180,7 +180,7 @@ CONFIG_SCHED_WORKQUEUE=y CONFIG_SCHED_WORKPRIORITY=192 CONFIG_SCHED_WORKPERIOD=50000 CONFIG_SCHED_WORKSTACKSIZE=1024 -CONFIG_SIG_SIGWORK=4 +CONFIG_SIG_SIGWORK=17 CONFIG_SCHED_WAITPID=y CONFIG_SCHED_ATEXIT=n diff --git a/nuttx/configs/shenzhou/nsh/defconfig b/nuttx/configs/shenzhou/nsh/defconfig index c54d714d0d..383522b6f1 100644 --- a/nuttx/configs/shenzhou/nsh/defconfig +++ b/nuttx/configs/shenzhou/nsh/defconfig @@ -273,7 +273,7 @@ CONFIG_SCHED_WORKQUEUE=y CONFIG_SCHED_WORKPRIORITY=192 CONFIG_SCHED_WORKPERIOD=50000 CONFIG_SCHED_WORKSTACKSIZE=2048 -CONFIG_SIG_SIGWORK=4 +CONFIG_SIG_SIGWORK=17 # CONFIG_SCHED_LPWORK is not set CONFIG_SCHED_WAITPID=y # CONFIG_SCHED_ATEXIT is not set diff --git a/nuttx/configs/shenzhou/nxwm/defconfig b/nuttx/configs/shenzhou/nxwm/defconfig index 9753277470..b9bf72aebb 100644 --- a/nuttx/configs/shenzhou/nxwm/defconfig +++ b/nuttx/configs/shenzhou/nxwm/defconfig @@ -309,7 +309,7 @@ CONFIG_SCHED_WORKQUEUE=y CONFIG_SCHED_WORKPRIORITY=192 CONFIG_SCHED_WORKPERIOD=50000 CONFIG_SCHED_WORKSTACKSIZE=1024 -CONFIG_SIG_SIGWORK=4 +CONFIG_SIG_SIGWORK=17 # CONFIG_SCHED_LPWORK is not set # CONFIG_SCHED_WAITPID is not set # CONFIG_SCHED_ATEXIT is not set diff --git a/nuttx/configs/shenzhou/thttpd/defconfig b/nuttx/configs/shenzhou/thttpd/defconfig index 958ab02ed1..d7af34821e 100644 --- a/nuttx/configs/shenzhou/thttpd/defconfig +++ b/nuttx/configs/shenzhou/thttpd/defconfig @@ -260,7 +260,7 @@ CONFIG_SCHED_WORKQUEUE=y CONFIG_SCHED_WORKPRIORITY=192 CONFIG_SCHED_WORKPERIOD=50000 CONFIG_SCHED_WORKSTACKSIZE=2048 -CONFIG_SIG_SIGWORK=4 +CONFIG_SIG_SIGWORK=17 # CONFIG_SCHED_LPWORK is not set CONFIG_SCHED_WAITPID=y # CONFIG_SCHED_ATEXIT is not set diff --git a/nuttx/configs/sim/nsh/defconfig b/nuttx/configs/sim/nsh/defconfig index a60edd4ac5..2d627a66de 100644 --- a/nuttx/configs/sim/nsh/defconfig +++ b/nuttx/configs/sim/nsh/defconfig @@ -72,7 +72,7 @@ CONFIG_SCHED_WORKQUEUE=n CONFIG_SCHED_WORKPRIORITY=192 CONFIG_SCHED_WORKPERIOD=50000 CONFIG_SCHED_WORKSTACKSIZE=1024 -CONFIG_SIG_SIGWORK=4 +CONFIG_SIG_SIGWORK=17 CONFIG_SCHED_WAITPID=n CONFIG_SCHED_ATEXIT=n CONFIG_SCHED_ONEXIT=n diff --git a/nuttx/configs/sim/nsh2/defconfig b/nuttx/configs/sim/nsh2/defconfig index e5dcce322a..c9e5b343f0 100644 --- a/nuttx/configs/sim/nsh2/defconfig +++ b/nuttx/configs/sim/nsh2/defconfig @@ -91,7 +91,7 @@ CONFIG_PRIORITY_INHERITANCE=n CONFIG_SEM_PREALLOCHOLDERS=0 CONFIG_SEM_NNESTPRIO=0 CONFIG_FDCLONE_DISABLE=n -CONFIG_SIG_SIGWORK=4 +CONFIG_SIG_SIGWORK=17 CONFIG_FDCLONE_STDIO=n CONFIG_SDCLONE_DISABLE=y CONFIG_SCHED_WORKQUEUE=n diff --git a/nuttx/configs/sim/ostest/defconfig b/nuttx/configs/sim/ostest/defconfig index 43d78e6a22..5cea9a6d44 100644 --- a/nuttx/configs/sim/ostest/defconfig +++ b/nuttx/configs/sim/ostest/defconfig @@ -57,7 +57,7 @@ CONFIG_DEBUG_VERBOSE=y # # CONFIG_DEBUG_ANALOG is not set # CONFIG_DEBUG_DMA is not set -# CONFIG_DEBUG_SYMBOLS is not set +CONFIG_DEBUG_SYMBOLS=y # # System Type @@ -131,6 +131,7 @@ CONFIG_MSEC_PER_TICK=10 CONFIG_RR_INTERVAL=0 # CONFIG_SCHED_INSTRUMENTATION is not set CONFIG_TASK_NAME_SIZE=32 +CONFIG_SCHED_HAVE_PARENT=y # CONFIG_JULIAN_TIME is not set CONFIG_START_YEAR=2007 CONFIG_START_MONTH=2 @@ -156,6 +157,15 @@ CONFIG_DISABLE_OS_API=y # CONFIG_DISABLE_ENVIRON is not set CONFIG_DISABLE_POLL=y +# +# Signal Numbers +# +CONFIG_SIG_SIGUSR1=1 +CONFIG_SIG_SIGUSR2=2 +CONFIG_SIG_SIGALARM=3 +CONFIG_SIG_SIGCHLD=4 +CONFIG_SIG_SIGCONDTIMEDOUT=16 + # # Sizes of configurable things (0 disables) # @@ -352,6 +362,7 @@ CONFIG_EXAMPLES_OSTEST_RR_RUNS=10 # CONFIG_EXAMPLES_PASHELLO is not set # CONFIG_EXAMPLES_PIPE is not set # CONFIG_EXAMPLES_POLL is not set +# CONFIG_EXAMPLES_POSIXSPAWN is not set # CONFIG_EXAMPLES_QENCODER is not set # CONFIG_EXAMPLES_RGMP is not set # CONFIG_EXAMPLES_ROMFS is not set diff --git a/nuttx/configs/stm3210e-eval/RIDE/defconfig b/nuttx/configs/stm3210e-eval/RIDE/defconfig index e71540c24c..6d84e7c362 100755 --- a/nuttx/configs/stm3210e-eval/RIDE/defconfig +++ b/nuttx/configs/stm3210e-eval/RIDE/defconfig @@ -200,7 +200,7 @@ CONFIG_SCHED_WORKQUEUE=n CONFIG_SCHED_WORKPRIORITY=192 CONFIG_SCHED_WORKPERIOD=50000 CONFIG_SCHED_WORKSTACKSIZE=1024 -CONFIG_SIG_SIGWORK=4 +CONFIG_SIG_SIGWORK=17 # # The following can be used to disable categories of diff --git a/nuttx/configs/stm3210e-eval/buttons/defconfig b/nuttx/configs/stm3210e-eval/buttons/defconfig index 0d6882b5d1..37e19171fe 100644 --- a/nuttx/configs/stm3210e-eval/buttons/defconfig +++ b/nuttx/configs/stm3210e-eval/buttons/defconfig @@ -210,7 +210,7 @@ CONFIG_SCHED_WORKQUEUE=n CONFIG_SCHED_WORKPRIORITY=192 CONFIG_SCHED_WORKPERIOD=50000 CONFIG_SCHED_WORKSTACKSIZE=1024 -CONFIG_SIG_SIGWORK=4 +CONFIG_SIG_SIGWORK=17 # # The following can be used to disable categories of diff --git a/nuttx/configs/stm3210e-eval/composite/defconfig b/nuttx/configs/stm3210e-eval/composite/defconfig index 2db58aee50..7fee337943 100755 --- a/nuttx/configs/stm3210e-eval/composite/defconfig +++ b/nuttx/configs/stm3210e-eval/composite/defconfig @@ -210,7 +210,7 @@ CONFIG_SCHED_WORKQUEUE=y CONFIG_SCHED_WORKPRIORITY=192 CONFIG_SCHED_WORKPERIOD=50000 CONFIG_SCHED_WORKSTACKSIZE=1024 -CONFIG_SIG_SIGWORK=4 +CONFIG_SIG_SIGWORK=17 # # Settings for NXFLAT diff --git a/nuttx/configs/stm3210e-eval/nsh/defconfig b/nuttx/configs/stm3210e-eval/nsh/defconfig index 52fdd777f4..b5e52e4944 100755 --- a/nuttx/configs/stm3210e-eval/nsh/defconfig +++ b/nuttx/configs/stm3210e-eval/nsh/defconfig @@ -208,7 +208,7 @@ CONFIG_SCHED_WORKQUEUE=y CONFIG_SCHED_WORKPRIORITY=192 CONFIG_SCHED_WORKPERIOD=50000 CONFIG_SCHED_WORKSTACKSIZE=1024 -CONFIG_SIG_SIGWORK=4 +CONFIG_SIG_SIGWORK=17 # # The following can be used to disable categories of diff --git a/nuttx/configs/stm3210e-eval/nsh2/defconfig b/nuttx/configs/stm3210e-eval/nsh2/defconfig index 18e42d539c..30a0bb3276 100644 --- a/nuttx/configs/stm3210e-eval/nsh2/defconfig +++ b/nuttx/configs/stm3210e-eval/nsh2/defconfig @@ -255,7 +255,7 @@ CONFIG_SCHED_WORKQUEUE=y CONFIG_SCHED_WORKPRIORITY=192 CONFIG_SCHED_WORKPERIOD=50000 CONFIG_SCHED_WORKSTACKSIZE=1024 -CONFIG_SIG_SIGWORK=4 +CONFIG_SIG_SIGWORK=17 CONFIG_SCHED_WAITPID=y CONFIG_SCHED_ATEXIT=n diff --git a/nuttx/configs/stm3210e-eval/nx/defconfig b/nuttx/configs/stm3210e-eval/nx/defconfig index 68a3ad9b54..0ad42dfbe5 100644 --- a/nuttx/configs/stm3210e-eval/nx/defconfig +++ b/nuttx/configs/stm3210e-eval/nx/defconfig @@ -209,7 +209,7 @@ CONFIG_SCHED_WORKQUEUE=y CONFIG_SCHED_WORKPRIORITY=192 CONFIG_SCHED_WORKPERIOD=50000 CONFIG_SCHED_WORKSTACKSIZE=1024 -CONFIG_SIG_SIGWORK=4 +CONFIG_SIG_SIGWORK=17 # # Settings for NXFLAT diff --git a/nuttx/configs/stm3210e-eval/nxconsole/defconfig b/nuttx/configs/stm3210e-eval/nxconsole/defconfig index 9cb8689c6b..7dd5878bf4 100644 --- a/nuttx/configs/stm3210e-eval/nxconsole/defconfig +++ b/nuttx/configs/stm3210e-eval/nxconsole/defconfig @@ -209,7 +209,7 @@ CONFIG_SCHED_WORKQUEUE=y CONFIG_SCHED_WORKPRIORITY=192 CONFIG_SCHED_WORKPERIOD=50000 CONFIG_SCHED_WORKSTACKSIZE=1024 -CONFIG_SIG_SIGWORK=4 +CONFIG_SIG_SIGWORK=17 # # Settings for NXFLAT diff --git a/nuttx/configs/stm3210e-eval/nxlines/defconfig b/nuttx/configs/stm3210e-eval/nxlines/defconfig index ab42612f3d..068a17acb4 100644 --- a/nuttx/configs/stm3210e-eval/nxlines/defconfig +++ b/nuttx/configs/stm3210e-eval/nxlines/defconfig @@ -209,7 +209,7 @@ CONFIG_SCHED_WORKQUEUE=y CONFIG_SCHED_WORKPRIORITY=192 CONFIG_SCHED_WORKPERIOD=50000 CONFIG_SCHED_WORKSTACKSIZE=1024 -CONFIG_SIG_SIGWORK=4 +CONFIG_SIG_SIGWORK=17 # # Settings for NXFLAT diff --git a/nuttx/configs/stm3210e-eval/nxtext/defconfig b/nuttx/configs/stm3210e-eval/nxtext/defconfig index c00e9b1e87..b6f88a3cac 100644 --- a/nuttx/configs/stm3210e-eval/nxtext/defconfig +++ b/nuttx/configs/stm3210e-eval/nxtext/defconfig @@ -209,7 +209,7 @@ CONFIG_SCHED_WORKQUEUE=y CONFIG_SCHED_WORKPRIORITY=192 CONFIG_SCHED_WORKPERIOD=50000 CONFIG_SCHED_WORKSTACKSIZE=1024 -CONFIG_SIG_SIGWORK=4 +CONFIG_SIG_SIGWORK=17 # # Settings for NXFLAT diff --git a/nuttx/configs/stm3210e-eval/ostest/defconfig b/nuttx/configs/stm3210e-eval/ostest/defconfig index 8ed1795a6b..0553b1a984 100755 --- a/nuttx/configs/stm3210e-eval/ostest/defconfig +++ b/nuttx/configs/stm3210e-eval/ostest/defconfig @@ -220,7 +220,7 @@ CONFIG_SCHED_WORKQUEUE=n CONFIG_SCHED_WORKPRIORITY=192 CONFIG_SCHED_WORKPERIOD=50000 CONFIG_SCHED_WORKSTACKSIZE=1024 -CONFIG_SIG_SIGWORK=4 +CONFIG_SIG_SIGWORK=17 # # The following can be used to disable categories of diff --git a/nuttx/configs/stm3210e-eval/pm/defconfig b/nuttx/configs/stm3210e-eval/pm/defconfig index 7babce8f67..61bd995c8b 100644 --- a/nuttx/configs/stm3210e-eval/pm/defconfig +++ b/nuttx/configs/stm3210e-eval/pm/defconfig @@ -265,7 +265,7 @@ CONFIG_SCHED_WORKQUEUE=y CONFIG_SCHED_WORKPRIORITY=192 CONFIG_SCHED_WORKPERIOD=50000 CONFIG_SCHED_WORKSTACKSIZE=1024 -CONFIG_SIG_SIGWORK=4 +CONFIG_SIG_SIGWORK=17 CONFIG_SCHED_WAITPID=y CONFIG_SCHED_ATEXIT=n diff --git a/nuttx/configs/stm3210e-eval/usbserial/defconfig b/nuttx/configs/stm3210e-eval/usbserial/defconfig index b41b41f508..94059c07c3 100755 --- a/nuttx/configs/stm3210e-eval/usbserial/defconfig +++ b/nuttx/configs/stm3210e-eval/usbserial/defconfig @@ -210,7 +210,7 @@ CONFIG_SCHED_WORKQUEUE=n CONFIG_SCHED_WORKPRIORITY=192 CONFIG_SCHED_WORKPERIOD=50000 CONFIG_SCHED_WORKSTACKSIZE=1024 -CONFIG_SIG_SIGWORK=4 +CONFIG_SIG_SIGWORK=17 # # The following can be used to disable categories of diff --git a/nuttx/configs/stm3210e-eval/usbstorage/defconfig b/nuttx/configs/stm3210e-eval/usbstorage/defconfig index 9f927d7e30..5c1ed5fb29 100755 --- a/nuttx/configs/stm3210e-eval/usbstorage/defconfig +++ b/nuttx/configs/stm3210e-eval/usbstorage/defconfig @@ -210,7 +210,7 @@ CONFIG_SCHED_WORKQUEUE=y CONFIG_SCHED_WORKPRIORITY=192 CONFIG_SCHED_WORKPERIOD=50000 CONFIG_SCHED_WORKSTACKSIZE=1024 -CONFIG_SIG_SIGWORK=4 +CONFIG_SIG_SIGWORK=17 # # Settings for NXFLAT diff --git a/nuttx/configs/stm3220g-eval/dhcpd/defconfig b/nuttx/configs/stm3220g-eval/dhcpd/defconfig index 04f243d718..29baf9af06 100644 --- a/nuttx/configs/stm3220g-eval/dhcpd/defconfig +++ b/nuttx/configs/stm3220g-eval/dhcpd/defconfig @@ -262,7 +262,7 @@ CONFIG_SCHED_WORKQUEUE=n CONFIG_SCHED_WORKPRIORITY=192 CONFIG_SCHED_WORKPERIOD=50000 CONFIG_SCHED_WORKSTACKSIZE=1024 -CONFIG_SIG_SIGWORK=4 +CONFIG_SIG_SIGWORK=17 CONFIG_SCHED_WAITPID=y CONFIG_SCHED_ATEXIT=n diff --git a/nuttx/configs/stm3220g-eval/nettest/defconfig b/nuttx/configs/stm3220g-eval/nettest/defconfig index 201df86b0b..08e04ad0ed 100644 --- a/nuttx/configs/stm3220g-eval/nettest/defconfig +++ b/nuttx/configs/stm3220g-eval/nettest/defconfig @@ -262,7 +262,7 @@ CONFIG_SCHED_WORKQUEUE=n CONFIG_SCHED_WORKPRIORITY=192 CONFIG_SCHED_WORKPERIOD=50000 CONFIG_SCHED_WORKSTACKSIZE=1024 -CONFIG_SIG_SIGWORK=4 +CONFIG_SIG_SIGWORK=17 CONFIG_SCHED_WAITPID=y CONFIG_SCHED_ATEXIT=n diff --git a/nuttx/configs/stm3220g-eval/nsh/defconfig b/nuttx/configs/stm3220g-eval/nsh/defconfig index 8baf52f7e8..bd9d028605 100644 --- a/nuttx/configs/stm3220g-eval/nsh/defconfig +++ b/nuttx/configs/stm3220g-eval/nsh/defconfig @@ -297,7 +297,7 @@ CONFIG_SCHED_WORKQUEUE=n CONFIG_SCHED_WORKPRIORITY=192 CONFIG_SCHED_WORKPERIOD=50000 CONFIG_SCHED_WORKSTACKSIZE=2048 -CONFIG_SIG_SIGWORK=4 +CONFIG_SIG_SIGWORK=17 CONFIG_SCHED_WAITPID=y CONFIG_SCHED_ATEXIT=n diff --git a/nuttx/configs/stm3220g-eval/nsh2/defconfig b/nuttx/configs/stm3220g-eval/nsh2/defconfig index c273ce60f8..b5fe843bca 100644 --- a/nuttx/configs/stm3220g-eval/nsh2/defconfig +++ b/nuttx/configs/stm3220g-eval/nsh2/defconfig @@ -296,7 +296,7 @@ CONFIG_SCHED_WORKQUEUE=y CONFIG_SCHED_WORKPRIORITY=192 CONFIG_SCHED_WORKPERIOD=50000 CONFIG_SCHED_WORKSTACKSIZE=2048 -CONFIG_SIG_SIGWORK=4 +CONFIG_SIG_SIGWORK=17 CONFIG_SCHED_WAITPID=y CONFIG_SCHED_ATEXIT=n diff --git a/nuttx/configs/stm3220g-eval/nxwm/defconfig b/nuttx/configs/stm3220g-eval/nxwm/defconfig index ab061f07a3..145792ddb0 100644 --- a/nuttx/configs/stm3220g-eval/nxwm/defconfig +++ b/nuttx/configs/stm3220g-eval/nxwm/defconfig @@ -316,7 +316,7 @@ CONFIG_SCHED_WORKQUEUE=y CONFIG_SCHED_WORKPRIORITY=192 CONFIG_SCHED_WORKPERIOD=50000 CONFIG_SCHED_WORKSTACKSIZE=2048 -CONFIG_SIG_SIGWORK=4 +CONFIG_SIG_SIGWORK=17 # CONFIG_SCHED_LPWORK is not set CONFIG_SCHED_WAITPID=y # CONFIG_SCHED_ATEXIT is not set diff --git a/nuttx/configs/stm3220g-eval/ostest/defconfig b/nuttx/configs/stm3220g-eval/ostest/defconfig index 2393d0a69e..f63f96c9af 100644 --- a/nuttx/configs/stm3220g-eval/ostest/defconfig +++ b/nuttx/configs/stm3220g-eval/ostest/defconfig @@ -261,7 +261,7 @@ CONFIG_SCHED_WORKQUEUE=n CONFIG_SCHED_WORKPRIORITY=192 CONFIG_SCHED_WORKPERIOD=50000 CONFIG_SCHED_WORKSTACKSIZE=1024 -CONFIG_SIG_SIGWORK=4 +CONFIG_SIG_SIGWORK=17 CONFIG_SCHED_WAITPID=n CONFIG_SCHED_ATEXIT=n diff --git a/nuttx/configs/stm3220g-eval/telnetd/defconfig b/nuttx/configs/stm3220g-eval/telnetd/defconfig index 1401dc6e7d..f529198f17 100644 --- a/nuttx/configs/stm3220g-eval/telnetd/defconfig +++ b/nuttx/configs/stm3220g-eval/telnetd/defconfig @@ -262,7 +262,7 @@ CONFIG_SCHED_WORKQUEUE=n CONFIG_SCHED_WORKPRIORITY=192 CONFIG_SCHED_WORKPERIOD=50000 CONFIG_SCHED_WORKSTACKSIZE=1024 -CONFIG_SIG_SIGWORK=4 +CONFIG_SIG_SIGWORK=17 CONFIG_SCHED_WAITPID=y CONFIG_SCHED_ATEXIT=n diff --git a/nuttx/configs/stm3240g-eval/dhcpd/defconfig b/nuttx/configs/stm3240g-eval/dhcpd/defconfig index 80293f66a5..5199cf85c3 100644 --- a/nuttx/configs/stm3240g-eval/dhcpd/defconfig +++ b/nuttx/configs/stm3240g-eval/dhcpd/defconfig @@ -268,7 +268,7 @@ CONFIG_SCHED_WORKQUEUE=n CONFIG_SCHED_WORKPRIORITY=192 CONFIG_SCHED_WORKPERIOD=50000 CONFIG_SCHED_WORKSTACKSIZE=1024 -CONFIG_SIG_SIGWORK=4 +CONFIG_SIG_SIGWORK=17 CONFIG_SCHED_WAITPID=y CONFIG_SCHED_ATEXIT=n diff --git a/nuttx/configs/stm3240g-eval/nettest/defconfig b/nuttx/configs/stm3240g-eval/nettest/defconfig index 81a53bd680..c5e0da795a 100644 --- a/nuttx/configs/stm3240g-eval/nettest/defconfig +++ b/nuttx/configs/stm3240g-eval/nettest/defconfig @@ -268,7 +268,7 @@ CONFIG_SCHED_WORKQUEUE=n CONFIG_SCHED_WORKPRIORITY=192 CONFIG_SCHED_WORKPERIOD=50000 CONFIG_SCHED_WORKSTACKSIZE=1024 -CONFIG_SIG_SIGWORK=4 +CONFIG_SIG_SIGWORK=17 CONFIG_SCHED_WAITPID=y CONFIG_SCHED_ATEXIT=n diff --git a/nuttx/configs/stm3240g-eval/nsh/defconfig b/nuttx/configs/stm3240g-eval/nsh/defconfig index 54eb1d56f4..6c19ed531d 100644 --- a/nuttx/configs/stm3240g-eval/nsh/defconfig +++ b/nuttx/configs/stm3240g-eval/nsh/defconfig @@ -301,7 +301,7 @@ CONFIG_SCHED_WORKQUEUE=n CONFIG_SCHED_WORKPRIORITY=192 CONFIG_SCHED_WORKPERIOD=50000 CONFIG_SCHED_WORKSTACKSIZE=2048 -CONFIG_SIG_SIGWORK=4 +CONFIG_SIG_SIGWORK=17 CONFIG_SCHED_WAITPID=y CONFIG_SCHED_ATEXIT=n CONFIG_DEV_RANDOM=y diff --git a/nuttx/configs/stm3240g-eval/nsh2/defconfig b/nuttx/configs/stm3240g-eval/nsh2/defconfig index ba64456157..08690ade3f 100644 --- a/nuttx/configs/stm3240g-eval/nsh2/defconfig +++ b/nuttx/configs/stm3240g-eval/nsh2/defconfig @@ -302,7 +302,7 @@ CONFIG_SCHED_WORKQUEUE=y CONFIG_SCHED_WORKPRIORITY=192 CONFIG_SCHED_WORKPERIOD=50000 CONFIG_SCHED_WORKSTACKSIZE=1024 -CONFIG_SIG_SIGWORK=4 +CONFIG_SIG_SIGWORK=17 CONFIG_SCHED_WAITPID=y CONFIG_SCHED_ATEXIT=n diff --git a/nuttx/configs/stm3240g-eval/nxconsole/defconfig b/nuttx/configs/stm3240g-eval/nxconsole/defconfig index f8a1fb7d5b..202fa4378c 100644 --- a/nuttx/configs/stm3240g-eval/nxconsole/defconfig +++ b/nuttx/configs/stm3240g-eval/nxconsole/defconfig @@ -301,7 +301,7 @@ CONFIG_SCHED_WORKQUEUE=n CONFIG_SCHED_WORKPRIORITY=192 CONFIG_SCHED_WORKPERIOD=50000 CONFIG_SCHED_WORKSTACKSIZE=1024 -CONFIG_SIG_SIGWORK=4 +CONFIG_SIG_SIGWORK=17 CONFIG_SCHED_WAITPID=y CONFIG_SCHED_ATEXIT=n diff --git a/nuttx/configs/stm3240g-eval/nxwm/defconfig b/nuttx/configs/stm3240g-eval/nxwm/defconfig index 5dfdb28fc3..a220af2d1c 100644 --- a/nuttx/configs/stm3240g-eval/nxwm/defconfig +++ b/nuttx/configs/stm3240g-eval/nxwm/defconfig @@ -302,7 +302,7 @@ CONFIG_SCHED_WORKQUEUE=y CONFIG_SCHED_WORKPRIORITY=192 CONFIG_SCHED_WORKPERIOD=50000 CONFIG_SCHED_WORKSTACKSIZE=2048 -CONFIG_SIG_SIGWORK=4 +CONFIG_SIG_SIGWORK=17 CONFIG_SCHED_WAITPID=y CONFIG_SCHED_ATEXIT=n CONFIG_SCHED_ONEXIT=y diff --git a/nuttx/configs/stm3240g-eval/ostest/defconfig b/nuttx/configs/stm3240g-eval/ostest/defconfig index 38b51e84b0..fcc54aa4bd 100644 --- a/nuttx/configs/stm3240g-eval/ostest/defconfig +++ b/nuttx/configs/stm3240g-eval/ostest/defconfig @@ -266,7 +266,7 @@ CONFIG_SCHED_WORKQUEUE=n CONFIG_SCHED_WORKPRIORITY=192 CONFIG_SCHED_WORKPERIOD=50000 CONFIG_SCHED_WORKSTACKSIZE=1024 -CONFIG_SIG_SIGWORK=4 +CONFIG_SIG_SIGWORK=17 CONFIG_SCHED_WAITPID=n CONFIG_SCHED_ATEXIT=n diff --git a/nuttx/configs/stm3240g-eval/telnetd/defconfig b/nuttx/configs/stm3240g-eval/telnetd/defconfig index 471845c144..5aef41c27b 100644 --- a/nuttx/configs/stm3240g-eval/telnetd/defconfig +++ b/nuttx/configs/stm3240g-eval/telnetd/defconfig @@ -268,7 +268,7 @@ CONFIG_SCHED_WORKQUEUE=n CONFIG_SCHED_WORKPRIORITY=192 CONFIG_SCHED_WORKPERIOD=50000 CONFIG_SCHED_WORKSTACKSIZE=1024 -CONFIG_SIG_SIGWORK=4 +CONFIG_SIG_SIGWORK=17 CONFIG_SCHED_WAITPID=y CONFIG_SCHED_ATEXIT=n diff --git a/nuttx/configs/stm3240g-eval/webserver/defconfig b/nuttx/configs/stm3240g-eval/webserver/defconfig index e9cbbf93d4..6d09968e9f 100644 --- a/nuttx/configs/stm3240g-eval/webserver/defconfig +++ b/nuttx/configs/stm3240g-eval/webserver/defconfig @@ -302,7 +302,7 @@ CONFIG_SCHED_WORKQUEUE=n CONFIG_SCHED_WORKPRIORITY=192 CONFIG_SCHED_WORKPERIOD=50000 CONFIG_SCHED_WORKSTACKSIZE=2048 -CONFIG_SIG_SIGWORK=4 +CONFIG_SIG_SIGWORK=17 CONFIG_SCHED_WAITPID=y CONFIG_SCHED_ATEXIT=n diff --git a/nuttx/configs/stm32f100rc_generic/nsh/defconfig b/nuttx/configs/stm32f100rc_generic/nsh/defconfig index 65ac9a73d8..12193e7ed8 100644 --- a/nuttx/configs/stm32f100rc_generic/nsh/defconfig +++ b/nuttx/configs/stm32f100rc_generic/nsh/defconfig @@ -249,7 +249,7 @@ CONFIG_SCHED_WORKQUEUE=y CONFIG_SCHED_WORKPRIORITY=192 CONFIG_SCHED_WORKPERIOD=50000 CONFIG_SCHED_WORKSTACKSIZE=1024 -CONFIG_SIG_SIGWORK=4 +CONFIG_SIG_SIGWORK=17 # CONFIG_SCHED_LPWORK is not set CONFIG_SCHED_WAITPID=y # CONFIG_SCHED_ATEXIT is not set diff --git a/nuttx/configs/stm32f4discovery/README.txt b/nuttx/configs/stm32f4discovery/README.txt index c1d484279a..39fb41d786 100644 --- a/nuttx/configs/stm32f4discovery/README.txt +++ b/nuttx/configs/stm32f4discovery/README.txt @@ -1447,6 +1447,32 @@ Where is one of the following: STANDBY mode. This used of the RTC alarm could conflict with other uses of the RTC alarm in your application. + + posix_spawn: + ------------ + This configuration directory, performs a simple test os the posix_spawn + interface using apps/examples/posix_spawn. + + NOTES: + + 1. This configuration uses the mconf-based configuration tool. To + change this configuration using that tool, you should: + + a. Build and install the kconfig-mconf tool. See nuttx/README.txt + and misc/tools/ + + b. Execute 'make menuconfig' in nuttx/ in order to start the + reconfiguration process. + + 2. Default toolchain: + + CONFIG_HOST_WINDOWS=y : Builds under windows + CONFIG_WINDOWS_CYGWIN=y : Using Cygwin and + CONFIG_STM32_CODESOURCERYW=y : The native Windows CodeSourcery toolchain + + 3. By default, this project assumes that you are *NOT* using the DFU + bootloader. + winbuild: -------- diff --git a/nuttx/configs/stm32f4discovery/nsh/defconfig b/nuttx/configs/stm32f4discovery/nsh/defconfig index 8967fd01c5..98034e22eb 100644 --- a/nuttx/configs/stm32f4discovery/nsh/defconfig +++ b/nuttx/configs/stm32f4discovery/nsh/defconfig @@ -282,7 +282,7 @@ CONFIG_SCHED_WORKQUEUE=n CONFIG_SCHED_WORKPRIORITY=192 CONFIG_SCHED_WORKPERIOD=50000 CONFIG_SCHED_WORKSTACKSIZE=1024 -CONFIG_SIG_SIGWORK=4 +CONFIG_SIG_SIGWORK=17 CONFIG_SCHED_WAITPID=y CONFIG_SCHED_ATEXIT=n diff --git a/nuttx/configs/stm32f4discovery/pm/defconfig b/nuttx/configs/stm32f4discovery/pm/defconfig index 105eb4d37c..3e24168cde 100644 --- a/nuttx/configs/stm32f4discovery/pm/defconfig +++ b/nuttx/configs/stm32f4discovery/pm/defconfig @@ -283,7 +283,7 @@ CONFIG_SCHED_WORKQUEUE=y CONFIG_SCHED_WORKPRIORITY=192 CONFIG_SCHED_WORKPERIOD=50000 CONFIG_SCHED_WORKSTACKSIZE=1024 -CONFIG_SIG_SIGWORK=4 +CONFIG_SIG_SIGWORK=17 CONFIG_SCHED_WAITPID=y CONFIG_SCHED_ATEXIT=n diff --git a/nuttx/configs/stm32f4discovery/posix_spawn/defconfig b/nuttx/configs/stm32f4discovery/posix_spawn/defconfig index b908393d87..9e30ada8a4 100644 --- a/nuttx/configs/stm32f4discovery/posix_spawn/defconfig +++ b/nuttx/configs/stm32f4discovery/posix_spawn/defconfig @@ -441,7 +441,7 @@ CONFIG_EOL_IS_EITHER_CRLF=y CONFIG_LIBC_EXECFUNCS=y CONFIG_EXECFUNCS_SYMTAB="exports" CONFIG_EXECFUNCS_NSYMBOLS=10 -CONFIG_POSIX_SPAWN_STACKSIZE=768 +CONFIG_POSIX_SPAWN_STACKSIZE=1024 # CONFIG_LIBC_STRERROR is not set # CONFIG_LIBC_PERROR_STDOUT is not set CONFIG_ARCH_LOWPUTC=y diff --git a/nuttx/configs/sure-pic32mx/nsh/defconfig b/nuttx/configs/sure-pic32mx/nsh/defconfig index 050f302479..60c4dc53d6 100644 --- a/nuttx/configs/sure-pic32mx/nsh/defconfig +++ b/nuttx/configs/sure-pic32mx/nsh/defconfig @@ -202,7 +202,7 @@ CONFIG_SCHED_WORKQUEUE=n CONFIG_SCHED_WORKPRIORITY=192 CONFIG_SCHED_WORKPERIOD=50000 CONFIG_SCHED_WORKSTACKSIZE=1024 -CONFIG_SIG_SIGWORK=4 +CONFIG_SIG_SIGWORK=17 CONFIG_SCHED_WAITPID=y CONFIG_SCHED_ATEXIT=n diff --git a/nuttx/configs/sure-pic32mx/ostest/defconfig b/nuttx/configs/sure-pic32mx/ostest/defconfig index eb386e2327..1bca11c479 100644 --- a/nuttx/configs/sure-pic32mx/ostest/defconfig +++ b/nuttx/configs/sure-pic32mx/ostest/defconfig @@ -188,7 +188,7 @@ CONFIG_SCHED_WORKQUEUE=n CONFIG_SCHED_WORKPRIORITY=192 CONFIG_SCHED_WORKPERIOD=50000 CONFIG_SCHED_WORKSTACKSIZE=1024 -CONFIG_SIG_SIGWORK=4 +CONFIG_SIG_SIGWORK=17 # # Settings for nxflat diff --git a/nuttx/configs/sure-pic32mx/usbnsh/defconfig b/nuttx/configs/sure-pic32mx/usbnsh/defconfig index 2b28b94c72..978e165413 100644 --- a/nuttx/configs/sure-pic32mx/usbnsh/defconfig +++ b/nuttx/configs/sure-pic32mx/usbnsh/defconfig @@ -199,7 +199,7 @@ CONFIG_SCHED_WORKQUEUE=n CONFIG_SCHED_WORKPRIORITY=192 CONFIG_SCHED_WORKPERIOD=50000 CONFIG_SCHED_WORKSTACKSIZE=1024 -CONFIG_SIG_SIGWORK=4 +CONFIG_SIG_SIGWORK=17 CONFIG_SCHED_WAITPID=y CONFIG_SCHED_ATEXIT=n diff --git a/nuttx/configs/teensy/hello/defconfig b/nuttx/configs/teensy/hello/defconfig index 93376ac575..8fafe1a104 100644 --- a/nuttx/configs/teensy/hello/defconfig +++ b/nuttx/configs/teensy/hello/defconfig @@ -137,7 +137,7 @@ CONFIG_SCHED_WORKQUEUE=n CONFIG_SCHED_WORKPRIORITY=192 CONFIG_SCHED_WORKPERIOD=50000 CONFIG_SCHED_WORKSTACKSIZE=1024 -CONFIG_SIG_SIGWORK=4 +CONFIG_SIG_SIGWORK=17 # # Settings for nxflat diff --git a/nuttx/configs/teensy/nsh/defconfig b/nuttx/configs/teensy/nsh/defconfig index ffcd94c1dc..faeb0b1030 100755 --- a/nuttx/configs/teensy/nsh/defconfig +++ b/nuttx/configs/teensy/nsh/defconfig @@ -137,7 +137,7 @@ CONFIG_SCHED_WORKQUEUE=n CONFIG_SCHED_WORKPRIORITY=192 CONFIG_SCHED_WORKPERIOD=50000 CONFIG_SCHED_WORKSTACKSIZE=1024 -CONFIG_SIG_SIGWORK=4 +CONFIG_SIG_SIGWORK=17 # # Settings for NXFLAT diff --git a/nuttx/configs/teensy/usbstorage/defconfig b/nuttx/configs/teensy/usbstorage/defconfig index dba45073f9..1f01868976 100755 --- a/nuttx/configs/teensy/usbstorage/defconfig +++ b/nuttx/configs/teensy/usbstorage/defconfig @@ -138,7 +138,7 @@ CONFIG_SCHED_WORKQUEUE=n CONFIG_SCHED_WORKPRIORITY=192 CONFIG_SCHED_WORKPERIOD=50000 CONFIG_SCHED_WORKSTACKSIZE=1024 -CONFIG_SIG_SIGWORK=4 +CONFIG_SIG_SIGWORK=17 # # Settings for NXFLAT diff --git a/nuttx/configs/twr-k60n512/nsh/defconfig b/nuttx/configs/twr-k60n512/nsh/defconfig index aeb0c5359a..7a4bb3b3a7 100644 --- a/nuttx/configs/twr-k60n512/nsh/defconfig +++ b/nuttx/configs/twr-k60n512/nsh/defconfig @@ -204,7 +204,7 @@ CONFIG_SCHED_WORKQUEUE=n CONFIG_SCHED_WORKPRIORITY=192 CONFIG_SCHED_WORKPERIOD=50000 CONFIG_SCHED_WORKSTACKSIZE=1024 -CONFIG_SIG_SIGWORK=4 +CONFIG_SIG_SIGWORK=17 # # The following can be used to disable categories of diff --git a/nuttx/configs/twr-k60n512/ostest/defconfig b/nuttx/configs/twr-k60n512/ostest/defconfig index 9cf37c763b..355e5773b4 100644 --- a/nuttx/configs/twr-k60n512/ostest/defconfig +++ b/nuttx/configs/twr-k60n512/ostest/defconfig @@ -203,7 +203,7 @@ CONFIG_SCHED_WORKQUEUE=n CONFIG_SCHED_WORKPRIORITY=192 CONFIG_SCHED_WORKPERIOD=50000 CONFIG_SCHED_WORKSTACKSIZE=1024 -CONFIG_SIG_SIGWORK=4 +CONFIG_SIG_SIGWORK=17 # # The following can be used to disable categories of diff --git a/nuttx/configs/ubw32/nsh/defconfig b/nuttx/configs/ubw32/nsh/defconfig index 320b7e2669..ad18c12b6a 100644 --- a/nuttx/configs/ubw32/nsh/defconfig +++ b/nuttx/configs/ubw32/nsh/defconfig @@ -189,7 +189,7 @@ CONFIG_SCHED_WORKQUEUE=n CONFIG_SCHED_WORKPRIORITY=192 CONFIG_SCHED_WORKPERIOD=50000 CONFIG_SCHED_WORKSTACKSIZE=1024 -CONFIG_SIG_SIGWORK=4 +CONFIG_SIG_SIGWORK=17 CONFIG_SCHED_WAITPID=y CONFIG_SCHED_ATEXIT=n diff --git a/nuttx/configs/ubw32/ostest/defconfig b/nuttx/configs/ubw32/ostest/defconfig index 71f2867001..60322d4f6a 100644 --- a/nuttx/configs/ubw32/ostest/defconfig +++ b/nuttx/configs/ubw32/ostest/defconfig @@ -188,7 +188,7 @@ CONFIG_SCHED_WORKQUEUE=n CONFIG_SCHED_WORKPRIORITY=192 CONFIG_SCHED_WORKPERIOD=50000 CONFIG_SCHED_WORKSTACKSIZE=1024 -CONFIG_SIG_SIGWORK=4 +CONFIG_SIG_SIGWORK=17 CONFIG_SCHED_WAITPID=n CONFIG_SCHED_ATEXIT=n diff --git a/nuttx/configs/vsn/nsh/defconfig b/nuttx/configs/vsn/nsh/defconfig index fa5570596a..2b7d8a20cd 100755 --- a/nuttx/configs/vsn/nsh/defconfig +++ b/nuttx/configs/vsn/nsh/defconfig @@ -247,7 +247,7 @@ CONFIG_SCHED_WORKQUEUE=y CONFIG_SCHED_WORKPRIORITY=192 CONFIG_SCHED_WORKPERIOD=50000 CONFIG_SCHED_WORKSTACKSIZE=1024 -CONFIG_SIG_SIGWORK=4 +CONFIG_SIG_SIGWORK=17 CONFIG_SCHED_WAITPID=y # # The following can be used to disable categories of diff --git a/nuttx/include/nuttx/sched.h b/nuttx/include/nuttx/sched.h index 940bf1f1b7..6c67e15005 100644 --- a/nuttx/include/nuttx/sched.h +++ b/nuttx/include/nuttx/sched.h @@ -202,6 +202,9 @@ struct _TCB /* Task Management Fields *****************************************************/ pid_t pid; /* This is the ID of the thread */ +#ifdef CONFIG_SCHED_HAVE_PARENT + pid_t parent; /* This is the ID of the parent thread */ +#endif start_t start; /* Thread start function */ entry_t entry; /* Entry Point into the thread */ diff --git a/nuttx/include/nuttx/wqueue.h b/nuttx/include/nuttx/wqueue.h index c509bf197b..d56901d89a 100644 --- a/nuttx/include/nuttx/wqueue.h +++ b/nuttx/include/nuttx/wqueue.h @@ -68,7 +68,7 @@ * CONFIG_SCHED_WORKSTACKSIZE - The stack size allocated for the worker * thread. Default: CONFIG_IDLETHREAD_STACKSIZE. * CONFIG_SIG_SIGWORK - The signal number that will be used to wake-up - * the worker thread. Default: 4 + * the worker thread. Default: 17 * * CONFIG_SCHED_LPWORK. If CONFIG_SCHED_WORKQUEUE is defined, then a single * work queue is created by default. If CONFIG_SCHED_LPWORK is also defined diff --git a/nuttx/include/signal.h b/nuttx/include/signal.h index 02b2223430..30726105bb 100644 --- a/nuttx/include/signal.h +++ b/nuttx/include/signal.h @@ -66,44 +66,56 @@ /* A few of the real time signals are used within the OS. They have * default values that can be overridden from the configuration file. The - * rest are all user signals: + * rest are all user signals. + * + * These are semi-standard signal definitions: */ #ifndef CONFIG_SIG_SIGUSR1 -#define SIGUSR1 0 /* User signal 1 */ +# define SIGUSR1 1 /* User signal 1 */ #else -#define SIGUSR1 CONFIG_SIG_SIGUSR1 +# define SIGUSR1 CONFIG_SIG_SIGUSR1 #endif #ifndef CONFIG_SIG_SIGUSR2 -#define SIGUSR2 1 /* User signal 2 */ +# define SIGUSR2 2 /* User signal 2 */ #else -#define SIGUSR2 CONFIG_SIG_SIGUSR2 +# define SIGUSR2 CONFIG_SIG_SIGUSR2 #endif #ifndef CONFIG_SIG_SIGALARM -#define SIGALRM 2 /* Default signal used with POSIX timers (used only */ +# define SIGALRM 3 /* Default signal used with POSIX timers (used only */ /* no other signal is provided) */ #else -#define SIGALRM CONFIG_SIG_SIGALARM +# define SIGALRM CONFIG_SIG_SIGALARM #endif -#ifndef CONFIG_DISABLE_PTHREAD -#ifndef CONFIG_SIG_SIGCONDTIMEDOUT -#define SIGCONDTIMEDOUT 3 /* Used in the implementation of pthread_cond_timedwait */ -#else -#define SIGCONDTIMEDOUT CONFIG_SIG_SIGCONDTIMEDOUT +#ifdef CONFIG_SCHED_HAVE_PARENT +# ifndef CONFIG_SIG_SIGCHLD +# define SIGCHLD 4 /* Used by child threads to signal parent thread */ +# else +# define SIGCHLD CONFIG_SIG_SIGCHLD +# endif #endif + +/* The following are non-standard signal definitions */ + +#ifndef CONFIG_DISABLE_PTHREAD +# ifndef CONFIG_SIG_SIGCONDTIMEDOUT +# define SIGCONDTIMEDOUT 16 /* Used in the implementation of pthread_cond_timedwait */ +# else +# define SIGCONDTIMEDOUT CONFIG_SIG_SIGCONDTIMEDOUT +# endif #endif /* SIGWORK is used to wake up various internal, NuttX worker thread */ #if defined(CONFIG_SCHED_WORKQUEUE) || defined(CONFIG_PAGING) -#ifndef CONFIG_SIG_SIGWORK -#define SIGWORK 4 /* Used to wake up the work queue */ -#else -#define SIGWORK CONFIG_SIG_SIGWORK -#endif +# ifndef CONFIG_SIG_SIGWORK +# define SIGWORK 17 /* Used to wake up the work queue */ +# else +# define SIGWORK CONFIG_SIG_SIGWORK +# endif #endif /* sigprocmask() "how" definitions. Only one of the following can be specified: */ @@ -122,12 +134,18 @@ /* These are the possible values of the signfo si_code field */ -#define SI_USER 0 /* Signal sent from kill, raise, or abort */ -#define SI_QUEUE 1 /* Signal sent from sigqueue */ -#define SI_TIMER 2 /* Signal is result of timer expiration */ -#define SI_ASYNCIO 3 /* Signal is the result of asynch IO completion */ -#define SI_MESGQ 4 /* Signal generated by arrival of a message on an */ - /* empty message queue */ +#define SI_USER 0 /* Signal sent from kill, raise, or abort */ +#define SI_QUEUE 1 /* Signal sent from sigqueue */ +#define SI_TIMER 2 /* Signal is result of timer expiration */ +#define SI_ASYNCIO 3 /* Signal is the result of asynch IO completion */ +#define SI_MESGQ 4 /* Signal generated by arrival of a message on an */ + /* empty message queue */ +#define CLD_EXITED 5 /* Child has exited (SIGCHLD only) */ +#define CLD_KILLED 6 /* Child was killed (SIGCHLD only) */ +#define CLD_DUMPED 7 /* Child terminated abnormally (SIGCHLD only) */ +#define CLD_TRAPPED 8 /* Traced child has trapped (SIGCHLD only) */ +#define CLD_STOPPED 9 /* Child has stopped (SIGCHLD only) */ +#define CLD_CONTINUED 10 /* Stopped child had continued (SIGCHLD only) */ /* Values for the sigev_notify field of struct sigevent */ @@ -175,6 +193,10 @@ struct siginfo uint8_t si_signo; /* Identifies signal */ uint8_t si_code; /* Source: SI_USER, SI_QUEUE, SI_TIMER, SI_ASYNCIO, or SI_MESGQ */ union sigval si_value; /* Data passed with signal */ +#ifdef CONFIG_SCHED_HAVE_PARENT + pid_t si_pid; /* Sending task ID */ + int si_status; /* Exit value or signal (SIGCHLD only). */ +#endif }; typedef struct siginfo siginfo_t; diff --git a/nuttx/libc/Kconfig b/nuttx/libc/Kconfig index 2f091f1c7d..72a6a5346e 100644 --- a/nuttx/libc/Kconfig +++ b/nuttx/libc/Kconfig @@ -123,11 +123,12 @@ config EXECFUNCS_NSYMBOLS config POSIX_SPAWN_STACKSIZE int "posix_spawn Stack Size" - default 768 + default 1024 ---help--- If posix_spawn[p] uses I/O redirection options, then it will require an intermediary/proxy task to muck with the file descriptors. This - configuration item specifies the stack size used for the proxy. + configuration item specifies the stack size used for the proxy. Default: + 1024 bytes. endif diff --git a/nuttx/sched/Kconfig b/nuttx/sched/Kconfig index bfaec3b5d5..69621a1fa1 100644 --- a/nuttx/sched/Kconfig +++ b/nuttx/sched/Kconfig @@ -38,6 +38,16 @@ config TASK_NAME_SIZE Useful if scheduler instrumentation is selected. Set to zero to disable. +config SCHED_HAVE_PARENT + bool "Remember Parent" + default n + ---help--- + Remember the ID of the parent thread when a new child thread is + created. This support enables a few minor features (such as + SIGCHLD) and slightly increases the size of the Task Control Block + (TCB) of every task to hold the ID of the parent thread. Default: + disabled. + config JULIAN_TIME bool "Enables Julian time conversions" default n @@ -127,6 +137,7 @@ config SDCLONE_DISABLE config SCHED_WORKQUEUE bool "Enable worker thread" default n + depends on !DISABLE_SIGNALS ---help--- Create a dedicated "worker" thread to handle delayed processing from interrupt handlers. This feature is required for some drivers but, if there are no @@ -158,14 +169,6 @@ config SCHED_WORKSTACKSIZE ---help--- The stack size allocated for the worker thread. Default: 2K. -config SIG_SIGWORK - int "Worker thread wakeup signal" - default 4 - depends on SCHED_WORKQUEUE - ---help--- - The signal number that will be used to wake-up the worker thread. - Default: 4 - config SCHED_LPWORK bool "Enable a lower priority worker thread" default n @@ -310,6 +313,56 @@ config DISABLE_POLL depends on DISABLE_OS_API default n +if !DISABLE_SIGNALS +comment "Signal Numbers" + +config SIG_SIGUSR1 + int "SIGUSR1" + default 1 + ---help--- + Value of standard user signal 1 (SIGUSR1). Default: 1 + +config SIG_SIGUSR2 + int "SIGUSR2" + default 2 + ---help--- + Value of standard user signal 2 (SIGUSR2). Default: 2 + +config SIG_SIGALARM + int "SIGALRM" + default 3 + ---help--- + Default the signal number used with POSIX timers (SIGALRM). + Default: 3 + +config SIG_SIGCHLD + int "SIGCHLD" + default 4 + depends on SCHED_HAVE_PARENT + ---help--- + The SIGCHLD signal is sent to the parent of a child process when it + exits, is interrupted (stopped), or resumes after being interrupted. + Default: 4 + +config SIG_SIGCONDTIMEDOUT + int "SIGCONDTIMEDOUT" + default 16 + depends on !DISABLE_PTHREAD + ---help--- + This non-standard signal number is used the implementation of + pthread_cond_timedwait(). Default 16. + +config SIG_SIGWORK + int "SIGWORK" + default 17 + depends on SCHED_WORKQUEUE + ---help--- + SIGWORK is a non-standard signal used to wake up the internal NuttX + worker thread. This setting specifies the signal number that will be + used for SIGWORK. Default: 17 + +endif + comment "Sizes of configurable things (0 disables)" config MAX_TASKS diff --git a/nuttx/sched/sched_unlock.c b/nuttx/sched/sched_unlock.c index 9a52e8358d..5eafcfc9e7 100644 --- a/nuttx/sched/sched_unlock.c +++ b/nuttx/sched/sched_unlock.c @@ -126,5 +126,6 @@ int sched_unlock(void) irqrestore(flags); } + return OK; } diff --git a/nuttx/sched/sig_kill.c b/nuttx/sched/sig_kill.c index 17921015fb..b3d74d8a18 100644 --- a/nuttx/sched/sig_kill.c +++ b/nuttx/sched/sig_kill.c @@ -84,6 +84,9 @@ int kill(pid_t pid, int signo) { +#ifdef CONFIG_SCHED_HAVE_PARENT + FAR _TCB *rtcb = (FAR _TCB *)g_readytorun.head; +#endif FAR _TCB *stcb; siginfo_t info; int ret = ERROR; @@ -124,6 +127,10 @@ int kill(pid_t pid, int signo) info.si_signo = signo; info.si_code = SI_USER; info.si_value.sival_ptr = NULL; +#ifdef CONFIG_SCHED_HAVE_PARENT + info.si_pid = rtcb->pid; + info.si_status = OK; +#endif /* Send the signal */ diff --git a/nuttx/sched/sig_mqnotempty.c b/nuttx/sched/sig_mqnotempty.c index 9a1fd7243b..f7ae6fd0dd 100644 --- a/nuttx/sched/sig_mqnotempty.c +++ b/nuttx/sched/sig_mqnotempty.c @@ -88,6 +88,9 @@ int sig_mqnotempty (int pid, int signo, union sigval value) int sig_mqnotempty (int pid, int signo, void *sival_ptr) #endif { +#ifdef CONFIG_SCHED_HAVE_PARENT + FAR _TCB *rtcb = (FAR _TCB *)g_readytorun.head; +#endif FAR _TCB *stcb; siginfo_t info; int ret = ERROR; @@ -113,6 +116,10 @@ int sig_mqnotempty (int pid, int signo, void *sival_ptr) #else info.si_value.sival_ptr = sival_ptr; #endif +#ifdef CONFIG_SCHED_HAVE_PARENT + info.si_pid = rtcb->pid; + info.si_status = OK; +#endif /* Verify that we can perform the signalling operation */ diff --git a/nuttx/sched/sig_queue.c b/nuttx/sched/sig_queue.c index dee1c798a2..db404238e2 100644 --- a/nuttx/sched/sig_queue.c +++ b/nuttx/sched/sig_queue.c @@ -111,6 +111,9 @@ int sigqueue (int pid, int signo, union sigval value) int sigqueue(int pid, int signo, void *sival_ptr) #endif { +#ifdef CONFIG_SCHED_HAVE_PARENT + FAR _TCB *rtcb = (FAR _TCB *)g_readytorun.head; +#endif FAR _TCB *stcb; siginfo_t info; int ret = ERROR; @@ -142,13 +145,17 @@ int sigqueue(int pid, int signo, void *sival_ptr) /* Create the siginfo structure */ - info.si_signo = signo; - info.si_code = SI_QUEUE; + info.si_signo = signo; + info.si_code = SI_QUEUE; #ifdef CONFIG_CAN_PASS_STRUCTS - info.si_value = value; + info.si_value = value; #else info.si_value.sival_ptr = sival_ptr; #endif +#ifdef CONFIG_SCHED_HAVE_PARENT + info.si_pid = rtcb->pid; + info.si_status = OK; +#endif /* Send the signal */ diff --git a/nuttx/sched/sig_timedwait.c b/nuttx/sched/sig_timedwait.c index d7610cd491..b07b8f2a1f 100644 --- a/nuttx/sched/sig_timedwait.c +++ b/nuttx/sched/sig_timedwait.c @@ -120,6 +120,10 @@ static void sig_timeout(int argc, uint32_t itcb) u.wtcb->sigunbinfo.si_signo = SIG_WAIT_TIMEOUT; u.wtcb->sigunbinfo.si_code = SI_TIMER; u.wtcb->sigunbinfo.si_value.sival_int = 0; +#ifdef CONFIG_SCHED_HAVE_PARENT + u.wtcb->sigunbinfo.si_pid = 0; /* Not applicable */ + u.wtcb->sigunbinfo.si_status = OK; +#endif up_unblock_task(u.wtcb); } } diff --git a/nuttx/sched/task_deletecurrent.c b/nuttx/sched/task_deletecurrent.c index 77025f5e0a..7ecfb26cc4 100644 --- a/nuttx/sched/task_deletecurrent.c +++ b/nuttx/sched/task_deletecurrent.c @@ -90,6 +90,9 @@ * Return Value: * OK on success; or ERROR on failure * + * Assumeptions: + * Interrupts are disabled. + * ****************************************************************************/ int task_deletecurrent(void) @@ -108,7 +111,7 @@ int task_deletecurrent(void) (void)sched_removereadytorun(dtcb); rtcb = (FAR _TCB*)g_readytorun.head; - /* We are not in a bad state -- the head of the ready to run task list + /* We are now in a bad state -- the head of the ready to run task list * does not correspond to the thread that is running. Disabling pre- * emption on this TCB and marking the new ready-to-run task as not * running (see, for example, get_errno_ptr()). @@ -132,9 +135,16 @@ int task_deletecurrent(void) (void)sched_mergepending(); } - /* Now calling sched_unlock() should have no effect */ + /* We can't use sched_unlock() to decrement the lock count because the + * sched_mergepending() call above might have changed the task at the + * head of the ready-to-run list. Furthermore, we should not need to + * perform the unlock action anyway because we know that the pending + * task list is empty. So all we really need to do is to decrement + * the lockcount on rctb. + */ - sched_unlock(); + DEBUGASSERT(rtcb->lockcount > 0); + rtcb->lockcount--; return OK; } diff --git a/nuttx/sched/task_exithook.c b/nuttx/sched/task_exithook.c index 3bde8fb7a5..9ce2e5899c 100644 --- a/nuttx/sched/task_exithook.c +++ b/nuttx/sched/task_exithook.c @@ -41,6 +41,7 @@ #include #include +#include #include #include @@ -187,6 +188,56 @@ static inline void task_onexit(FAR _TCB *tcb, int status) # define task_onexit(tcb,status) #endif +/**************************************************************************** + * Name: task_sigchild + * + * Description: + * Send the SIGCHILD signal to the parent thread + * + ****************************************************************************/ + +#ifdef CONFIG_SCHED_HAVE_PARENT +static inline void task_sigchild(FAR _TCB *tcb, int status) +{ + FAR _TCB *ptcb; + siginfo_t info; + + /* Keep things stationary through the following */ + + sched_lock(); + + /* Get the TCB of the receiving task */ + + ptcb = sched_gettcb(tcb->parent); + if (!ptcb) + { + /* The parent no longer exists... bail */ + + sched_unlock(); + return; + } + + /* Create the siginfo structure. We don't actually know the cause. That + * is a bug. Let's just say that the child task just exit-ted for now. + */ + + info.si_signo = SIGCHLD; + info.si_code = CLD_EXITED; + info.si_value.sival_ptr = NULL; + info.si_pid = tcb->pid; + info.si_status = status; + + /* Send the signal. We need to use this internal interface so that we can + * provide the correct si_code value with the signal. + */ + + (void)sig_received(ptcb, &info); + sched_unlock(); +} +#else +# define task_sigchild(tcb,status) +#endif + /**************************************************************************** * Name: task_exitwakeup * @@ -259,6 +310,10 @@ void task_exithook(FAR _TCB *tcb, int status) task_atexit(tcb); + /* Send SIGCHLD to the parent of the exiting task */ + + task_sigchild(tcb, status); + /* Call any registered on_exit function(s) */ task_onexit(tcb, status); diff --git a/nuttx/sched/task_setup.c b/nuttx/sched/task_setup.c index 8721b39ec1..c5dd8ca3a8 100644 --- a/nuttx/sched/task_setup.c +++ b/nuttx/sched/task_setup.c @@ -146,6 +146,34 @@ static int task_assignpid(FAR _TCB *tcb) return ERROR; } +/**************************************************************************** + * Name: task_saveparent + * + * Description: + * Save the task ID of the parent task in the child task's TCB. + * + * Parameters: + * tcb - The TCB of the new, child task. + * + * Returned Value: + * None + * + * Assumptions: + * The parent of the new task is the task at the head of the ready-to-run + * list. + * + ****************************************************************************/ + +#ifdef CONFIG_SCHED_HAVE_PARENT +static inline void task_saveparent(FAR _TCB *tcb) +{ + FAR _TCB *rtcb = (FAR _TCB*)g_readytorun.head; + tcb->parent = rtcb->pid; +} +#else +# define task_saveparent(tcb) +#endif + /**************************************************************************** * Name: task_dupdspace * @@ -161,6 +189,8 @@ static int task_assignpid(FAR _TCB *tcb) * None * * Assumptions: + * The parent of the new task is the task at the head of the ready-to-run + * list. * ****************************************************************************/ @@ -231,6 +261,10 @@ int task_schedsetup(FAR _TCB *tcb, int priority, start_t start, main_t main) tcb->start = start; tcb->entry.main = main; + /* Save the task ID of the parent task in the TCB */ + + task_saveparent(tcb); + /* exec(), pthread_create(), task_create(), and vfork() all * inherit the signal mask of the parent thread. */ @@ -243,7 +277,7 @@ int task_schedsetup(FAR _TCB *tcb, int priority, start_t start, main_t main) * until it is activated. */ - tcb->task_state = TSTATE_TASK_INVALID; + tcb->task_state = TSTATE_TASK_INVALID; /* Clone the parent tasks D-Space (if it was running PIC). This * must be done before calling up_initial_state() so that the diff --git a/nuttx/sched/timer_settime.c b/nuttx/sched/timer_settime.c index 1814ba8988..f09842ad44 100644 --- a/nuttx/sched/timer_settime.c +++ b/nuttx/sched/timer_settime.c @@ -113,6 +113,10 @@ static void inline timer_sigqueue(FAR struct posix_timer_s *timer) #else info.si_value.sival_ptr = timer->pt_value.sival_ptr; #endif +#ifdef CONFIG_SCHED_HAVE_PARENT + info.si_pid = 0; /* Not applicable */ + info.si_status = OK; +#endif /* Send the signal */ From ffda55b34a9a8a4a84f4cbc1da3836b944baec46 Mon Sep 17 00:00:00 2001 From: patacongo Date: Sun, 13 Jan 2013 00:35:47 +0000 Subject: [PATCH 067/118] Cosmetic cleanup from SIGCHLD changes git-svn-id: http://svn.code.sf.net/p/nuttx/code/trunk@5514 42af7a65-404d-4744-a932-0658087f49c3 --- apps/examples/ostest/sighand.c | 7 ++++++- nuttx/ChangeLog | 2 +- nuttx/sched/task_deletecurrent.c | 6 ++++-- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/apps/examples/ostest/sighand.c b/apps/examples/ostest/sighand.c index 63d9590d9a..32b182c21c 100644 --- a/apps/examples/ostest/sighand.c +++ b/apps/examples/ostest/sighand.c @@ -57,7 +57,12 @@ static bool threadexited = false; #ifdef CONFIG_SCHED_HAVE_PARENT static void death_of_child(int signo, siginfo_t *info, void *ucontext) { - /* Use of printf in a signal handler is NOT safe! It can cause deadlocks! */ + /* Use of printf in a signal handler is NOT safe! It can cause deadlocks! + * Also, signals are not queued by NuttX. As a consequence, some + * notifications will get lost (or the info data can be overwrittedn)! + * Because POSIX does not require signals to be queued, I do not think + * that this is a bug (the overwriting is a bug, however). + */ if (info) { diff --git a/nuttx/ChangeLog b/nuttx/ChangeLog index 921b7014bd..7deb9fa946 100644 --- a/nuttx/ChangeLog +++ b/nuttx/ChangeLog @@ -3918,7 +3918,7 @@ the scenario: (1) sched_lock() is called increments the lockcount on the current TCB (i.e., the one at the head of the ready to run list), (2) sched_mergepending is called which may change the task - at the head of the readytorun list, then (2) sched_lock() is called + at the head of the readytorun list, then (2) sched_unlock() is called which decrements the lockcount on the wrong TCB. The failure case that I saw was that pre-emption got disabled in the IDLE thread, locking up the whole system. diff --git a/nuttx/sched/task_deletecurrent.c b/nuttx/sched/task_deletecurrent.c index 7ecfb26cc4..e1e06acf67 100644 --- a/nuttx/sched/task_deletecurrent.c +++ b/nuttx/sched/task_deletecurrent.c @@ -115,9 +115,12 @@ int task_deletecurrent(void) * does not correspond to the thread that is running. Disabling pre- * emption on this TCB and marking the new ready-to-run task as not * running (see, for example, get_errno_ptr()). + * + * We disable pre-emption here by directly incrementing the lockcount + * (vs. calling sched_lock()). */ - sched_lock(); + rtcb->lockcount++; rtcb->task_state = TSTATE_TASK_READYTORUN; /* Move the TCB to the specified blocked task list and delete it */ @@ -143,7 +146,6 @@ int task_deletecurrent(void) * the lockcount on rctb. */ - DEBUGASSERT(rtcb->lockcount > 0); rtcb->lockcount--; return OK; } From b3f3dd123c181fe851f0a9756bed7acd4ba4ef7d Mon Sep 17 00:00:00 2001 From: patacongo Date: Sun, 13 Jan 2013 18:53:00 +0000 Subject: [PATCH 068/118] Use SIGCHLD with waitpid(); implemented wait() and waitid() git-svn-id: http://svn.code.sf.net/p/nuttx/code/trunk@5515 42af7a65-404d-4744-a932-0658087f49c3 --- apps/ChangeLog.txt | 3 +- apps/examples/ostest/Makefile | 4 + apps/examples/ostest/ostest.h | 42 ++-- apps/examples/ostest/ostest_main.c | 8 + apps/examples/ostest/waitpid.c | 269 +++++++++++++++++++++ nuttx/ChangeLog | 7 + nuttx/Documentation/NuttX.html | 8 +- nuttx/Documentation/NuttxPortingGuide.html | 10 +- nuttx/Documentation/NuttxUserGuide.html | 181 +++++++++++++- nuttx/TODO | 13 +- nuttx/configs/README.txt | 16 +- nuttx/configs/sim/ostest/defconfig | 2 +- nuttx/include/nuttx/sched.h | 5 +- nuttx/include/sys/types.h | 4 +- nuttx/include/sys/wait.h | 10 +- nuttx/sched/Kconfig | 14 +- nuttx/sched/Makefile | 5 +- nuttx/sched/os_internal.h | 6 +- nuttx/sched/sched_wait.c | 90 +++++++ nuttx/sched/sched_waitid.c | 256 ++++++++++++++++++++ nuttx/sched/sched_waitpid.c | 194 +++++++++++++-- nuttx/sched/task_exithook.c | 24 +- nuttx/sched/task_setup.c | 3 + 23 files changed, 1079 insertions(+), 95 deletions(-) create mode 100644 apps/examples/ostest/waitpid.c create mode 100644 nuttx/sched/sched_wait.c create mode 100644 nuttx/sched/sched_waitid.c diff --git a/apps/ChangeLog.txt b/apps/ChangeLog.txt index 65d4d6134e..70381a79da 100644 --- a/apps/ChangeLog.txt +++ b/apps/ChangeLog.txt @@ -464,4 +464,5 @@ * apps/exampes/posix_spawn: Added a test of poxis_spawn(). * apps/examples/ostest: Extend signal handler test to catch death-of-child signals (SIGCHLD). - + * apps/examples/ostest/waitpid.c: Add a test for waitpid(), waitid(), + and wait(). diff --git a/apps/examples/ostest/Makefile b/apps/examples/ostest/Makefile index b7ba9a9a87..5a8ff72931 100644 --- a/apps/examples/ostest/Makefile +++ b/apps/examples/ostest/Makefile @@ -52,6 +52,10 @@ ifeq ($(CONFIG_ARCH_FPU),y) CSRCS += fpu.c endif +ifeq ($(CONFIG_SCHED_WAITPID),y) +CSRCS += waitpid.c +endif + ifneq ($(CONFIG_DISABLE_PTHREAD),y) CSRCS += cancel.c cond.c mutex.c sem.c barrier.c ifneq ($(CONFIG_RR_INTERVAL),0) diff --git a/apps/examples/ostest/ostest.h b/apps/examples/ostest/ostest.h index bc46a3860c..5217f0a0cb 100644 --- a/apps/examples/ostest/ostest.h +++ b/apps/examples/ostest/ostest.h @@ -105,68 +105,74 @@ /* dev_null.c ***************************************************************/ -extern int dev_null(void); +int dev_null(void); /* fpu.c ********************************************************************/ -extern void fpu_test(void); +void fpu_test(void); + +/* waitpid.c ****************************************************************/ + +#ifdef CONFIG_SCHED_WAITPID +int waitpid_test(void); +#endif /* mutex.c ******************************************************************/ -extern void mutex_test(void); +void mutex_test(void); /* rmutex.c ******************************************************************/ -extern void recursive_mutex_test(void); +void recursive_mutex_test(void); /* sem.c ********************************************************************/ -extern void sem_test(void); +void sem_test(void); /* cond.c *******************************************************************/ -extern void cond_test(void); +void cond_test(void); /* mqueue.c *****************************************************************/ -extern void mqueue_test(void); +void mqueue_test(void); /* timedmqueue.c ************************************************************/ -extern void timedmqueue_test(void); +void timedmqueue_test(void); /* cancel.c *****************************************************************/ -extern void cancel_test(void); +void cancel_test(void); /* timedwait.c **************************************************************/ -extern void timedwait_test(void); +void timedwait_test(void); /* sighand.c ****************************************************************/ -extern void sighand_test(void); +void sighand_test(void); /* posixtimers.c ************************************************************/ -extern void timer_test(void); +void timer_test(void); /* roundrobin.c *************************************************************/ -extern void rr_test(void); +void rr_test(void); /* barrier.c ****************************************************************/ -extern void barrier_test(void); +void barrier_test(void); /* prioinherit.c ************************************************************/ -extern void priority_inheritance(void); +void priority_inheritance(void); /* vfork.c ******************************************************************/ #ifdef CONFIG_ARCH_HAVE_VFORK -extern int vfork_test(void); +int vfork_test(void); #endif /* APIs exported (conditionally) by the OS specifically for testing of @@ -174,8 +180,8 @@ extern int vfork_test(void); */ #if defined(CONFIG_DEBUG) && defined(CONFIG_PRIORITY_INHERITANCE) && defined(CONFIG_SEM_PHDEBUG) -extern void sem_enumholders(FAR sem_t *sem); -extern int sem_nfreeholders(void); +void sem_enumholders(FAR sem_t *sem); +int sem_nfreeholders(void); #else # define sem_enumholders(sem) # define sem_nfreeholders() diff --git a/apps/examples/ostest/ostest_main.c b/apps/examples/ostest/ostest_main.c index ca44353c3d..aab1ff0457 100644 --- a/apps/examples/ostest/ostest_main.c +++ b/apps/examples/ostest/ostest_main.c @@ -301,6 +301,14 @@ static int user_main(int argc, char *argv[]) check_test_memory_usage(); #endif +#ifdef CONFIG_SCHED_WAITPID + /* Check waitpid() and friends */ + + printf("\nuser_main: waitpid test\n"); + waitpid_test(); + check_test_memory_usage(); +#endif + #ifndef CONFIG_DISABLE_PTHREAD /* Verify pthreads and pthread mutex */ diff --git a/apps/examples/ostest/waitpid.c b/apps/examples/ostest/waitpid.c new file mode 100644 index 0000000000..e53b49213a --- /dev/null +++ b/apps/examples/ostest/waitpid.c @@ -0,0 +1,269 @@ +/**************************************************************************** + * examples/ostest/waitpid.c + * + * Copyright (C) 2013 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * 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. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include +#include +#include +#include +#include + +#include "ostest.h" + +#ifdef CONFIG_SCHED_WAITPID + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +#define RETURN_STATUS 14 +#define NCHILDREN 3 +#define PRIORITY 100 + +/**************************************************************************** + * Private Data + ****************************************************************************/ + +static int g_waitpids[NCHILDREN]; + +/**************************************************************************** + * Priviate Functions + ****************************************************************************/ + +static int waitpid_main(int argc, char *argv[]) +{ + pid_t me = getpid(); + + printf("waitpid_main: PID %d Started\n", me); + sleep(3); + printf("waitpid_main: PID %d exitting with result=%d\n", me, RETURN_STATUS); + return RETURN_STATUS; +} + +static void waitpid_start_children(void) +{ + int ret; + int i; + + for (i = 0; i < NCHILDREN; i++) + { + ret = TASK_CREATE("waitpid", PRIORITY, STACKSIZE, waitpid_main, NULL); + if (ret < 0) + { + printf("waitpid_start_child: ERROR Failed to start user_main\n"); + } + else + { + printf("waitpid_start_child: Started waitpid_main at PID=%d\n", ret); + } + + g_waitpids[i] = ret; + } +} + +static void waitpid_last(void) +{ + int stat_loc; + int ret; + + printf("waitpid_last: Waiting for PID=%d with waitpid()\n", + g_waitpids[NCHILDREN-1]); + + ret = (int)waitpid(g_waitpids[NCHILDREN-1], &stat_loc, 0); + if (ret < 0) + { + int errcode = errno; + printf("waitpid_last: ERROR: PID %d waitpid failed: %d\n", + g_waitpids[NCHILDREN-1], errcode); + } + else if (stat_loc != RETURN_STATUS) + { + printf("waitpid_last: ERROR: PID %d return status is %d, expected %d\n", + g_waitpids[NCHILDREN-1], stat_loc, RETURN_STATUS); + } + else + { + printf("waitpid_last: PID %d waitpid succeeded with stat_loc=%d\n", + g_waitpids[NCHILDREN-1], stat_loc); + } +} + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +int waitpid_test(void) +{ +#ifdef CONFIG_SCHED_HAVE_PARENT + siginfo_t info; +#endif + int stat_loc; + int ret; + + /* Start the children and wait for first one to complete */ + + printf("\nTest waitpid()\n"); + waitpid_start_children(); + + printf("waitpid_test: Waiting for PID=%d with waitpid()\n", g_waitpids[0]); + ret = (int)waitpid(g_waitpids[0], &stat_loc, 0); + if (ret < 0) + { + int errcode = errno; + printf("waitpid_test: ERROR: PID %d waitpid failed: %d\n", + g_waitpids[0], errcode); + } + else if (ret != g_waitpids[0]) + { + printf("waitpid_test: ERROR: PID %d wait returned PID %d\n", + g_waitpids[0], ret); + } + else if (stat_loc != RETURN_STATUS) + { + printf("waitpid_test: ERROR: PID %d return status is %d, expected %d\n", + g_waitpids[0], stat_loc, RETURN_STATUS); + } + else + { + printf("waitpid_test: PID %d waitpid succeeded with stat_loc=%d\n", + g_waitpids[0], stat_loc); + } + + /* Wait a big to make sure that the other threads complete */ + + waitpid_last(); + sleep(1); + +#ifdef CONFIG_SCHED_HAVE_PARENT + /* Start the children and wait for first one to complete */ + + printf("\nTest waitid(P_PID)\n"); + waitpid_start_children(); + + printf("waitpid_test: Waiting for PID=%d with waitid()\n", g_waitpids[0]); + ret = waitid(P_PID, (id_t)g_waitpids[0], &info, WEXITED); + if (ret < 0) + { + int errcode = errno; + printf("waitpid_test: ERROR: PID %d waitid failed: %d\n", + g_waitpids[0], errcode); + } + else if (info.si_pid != g_waitpids[0]) + { + printf("waitpid_test: ERROR: PID %d waitid returned PID %d\n", + g_waitpids[0], info.si_pid); + } + else if (info.si_status != RETURN_STATUS) + { + printf("waitpid_test: ERROR: PID %d return status is %d, expected %d\n", + info.si_pid, info.si_status, RETURN_STATUS); + } + else + { + printf("waitpid_test: waitid PID %d succeeded with si_status=%d\n", + info.si_pid, info.si_status); + } + + /* Wait a big to make sure that the other threads complete */ + + waitpid_last(); + sleep(1); + + /* Start the children and wait for any one to complete */ + + printf("\nTest waitid(P_ALL)\n"); + waitpid_start_children(); + + printf("waitpid_test: Waiting for any child with waitid()\n"); + ret = waitid(P_ALL, 0, &info, WEXITED); + if (ret < 0) + { + int errcode = errno; + printf("waitpid_test: ERROR: waitid failed: %d\n", errcode); + } + else if (info.si_status != RETURN_STATUS) + { + printf("waitpid_test: ERROR: PID %d return status is %d, expected %d\n", + info.si_pid, info.si_status, RETURN_STATUS); + } + else + { + printf("waitpid_test: PID %d waitid succeeded with si_status=%d\n", + info.si_pid, info.si_status); + } + + /* Wait a big to make sure that the other threads complete */ + + waitpid_last(); + sleep(1); + + /* Start the children and wait for first one to complete */ + + printf("\nTest wait()\n"); + waitpid_start_children(); + + printf("waitpid_test: Waiting for any child with wait()\n"); + ret = (int)wait(&stat_loc); + if (ret < 0) + { + int errcode = errno; + printf("waitpid_test: ERROR: wait failed: %d\n", errcode); + } + else if (stat_loc != RETURN_STATUS) + { + printf("waitpid_test: ERROR: PID %d return status is %d, expected %d\n", + ret, stat_loc, RETURN_STATUS); + } + else + { + printf("waitpid_test: PID %d wait succeeded with stat_loc=%d\n", + ret, stat_loc); + } + + /* Wait a big to make sure that the other threads complete */ + + waitpid_last(); + sleep(1); +#endif + + return 0; +} + +#endif /* CONFIG_SCHED_WAITPID */ diff --git a/nuttx/ChangeLog b/nuttx/ChangeLog index 7deb9fa946..e8d4f7309c 100644 --- a/nuttx/ChangeLog +++ b/nuttx/ChangeLog @@ -3922,3 +3922,10 @@ which decrements the lockcount on the wrong TCB. The failure case that I saw was that pre-emption got disabled in the IDLE thread, locking up the whole system. + * sched/sched_waitpid.c: Use SIGCHLD instead of a semaphore. This + is a much more spec-compliant implemenation. However, there are + some issues with overruning signals because NuttX does not support + queueing of signals (POSIX does not require it). I think it may + need to. + * sched/sched_waitid.c and sched_wait.c: Add support for waitid() + and wait(). See issues with waitpid() above. diff --git a/nuttx/Documentation/NuttX.html b/nuttx/Documentation/NuttX.html index f6e9a41bae..22651de79e 100644 --- a/nuttx/Documentation/NuttX.html +++ b/nuttx/Documentation/NuttX.html @@ -286,7 +286,7 @@

        • Easily extensible to new processor architectures, SoC architecture, or board architectures. - A Porting Guide is available. + A Porting Guide is available.

        • -

        • Power management sub-system.
        • +
        • Power management sub-system.
        • Porting GuidePorting Guide
          @@ -4482,7 +4482,8 @@ build
        • CONFIG_SCHED_HAVE_PARENT: Remember the ID of the parent thread when a new child thread is created. - This support enables a few minor features (such as SIGCHLD) and slightly increases the size of the Task Control Block (TCB) of every task to hold the ID of the parent thread. + This support enables some additional features (such as SIGCHLD) and modifies the behavior of other interfaces. + For example, it makes waitpid() more standards complete by restricting the waited-for tasks to the children of the caller. Default: disabled.
        • @@ -4601,10 +4602,11 @@ build CONFIG_SCHED_LPWORKPERIOD: How often the lower priority worker thread checks for work in units of microseconds. Default: 50*1000 (50 MS).
        • - CONFIG_SCHED_LPWORKSTACKSIZE - The stack size allocated for the lower priority worker thread. Default: CONFIG_IDLETHREAD_STACKSIZE. + CONFIG_SCHED_LPWORKSTACKSIZE: The stack size allocated for the lower priority worker thread. Default: CONFIG_IDLETHREAD_STACKSIZE.
        • - CONFIG_SCHED_WAITPID: Enables the waitpid() API + CONFIG_SCHED_WAITPID: Enables the waitpid() interface in a default, non-standard mode (non-standard in the sense that the waited for PID need not be child of the caller). + If SCHED_HAVE_PARENT is also defined, then this setting will modify the behavior or waitpid() (making more spec compliant) and will enable the waitid() and waitp() interfaces as well.
        • CONFIG_SCHED_ATEXIT: Enables the atexit() API diff --git a/nuttx/Documentation/NuttxUserGuide.html b/nuttx/Documentation/NuttxUserGuide.html index c6eabd29a5..3cfb63f11e 100644 --- a/nuttx/Documentation/NuttxUserGuide.html +++ b/nuttx/Documentation/NuttxUserGuide.html @@ -13,7 +13,7 @@

          NuttX Operating System

          User's Manual

          by

          Gregory Nutt

          -

          Last Updated: January 11, 2013

          +

          Last Updated: January 13, 2013

          @@ -1776,8 +1776,10 @@ priority of the calling task is returned.

          Task synchronization interfaces

          2.3.1 sched_lock

          @@ -1886,10 +1888,12 @@ on this thread of execution. Description:

          - The following discussion is a general description of the waitpid() interface. - However, as of this writing, the implementation of waitpid() is fragmentary (but usable). - It simply supports waiting for any task to complete execution. - NuttX does not support any concept of parent/child processes or of process groups nor signals related to child processes (SIGCHLD). + The following discussion is a general description of the waitpid() interface. + However, as of this writing, the implementation of waitpid() is incomplete (but usable). + If CONFIG_SCHED_HAVE_PARENT is defined, waitpid() will be a little more compliant to specifications. + Without CONFIG_SCHED_HAVE_PARENT, waitpid() simply supports waiting for any task to complete execution. + With CONFIG_SCHED_HAVE_PARENT, waitpid() will use SIGCHLD and can, therefore, wait for any child of the parent to complete. + The implementation is incomplete in either case, however: NuttX does not support any concept of process groups. Nor does NuttX retain the status of exited tasks so if waitpid() is called after a task has exited, then no status will be available. The options argument is currently ignored.
          @@ -2038,7 +2042,158 @@ on this thread of execution. Comparable to the POSIX interface of the same name, but the implementation is incomplete (as detailed above).

          -

          2.3.5 atexit

          +

          2.3.5 waitid

        • +

          +Function Prototype: +

          +    #include <sys/wait.h>
          +    #ifdef CONFIG_SCHED_HAVE_PARENT
          +    int waitid(idtype_t idtype, id_t id, FAR siginfo_t *info, int options);
          +    #endif
          +
          +

          + Description: +

          +
          + The following discussion is a general description of the waitid() interface. + However, as of this writing, the implementation of waitid() is incomplete (but usable). + If CONFIG_SCHED_HAVE_PARENT is defined, waitid() will be a little more compliant to specifications. + waitpid() simply supports waiting a specific child task (P_PID or for any child task P_ALL to complete execution. + SIGCHLD is used. + The implementation is incomplete in either case, however: NuttX does not support any concept of process groups. + Nor does NuttX retain the status of exited tasks so if waitpid() is called after a task has exited, then no status will be available. + The options argument is currently ignored. +
          +

          + The waitid() function suspends the calling thread until one child of the process containing the calling thread changes state. + It records the current state of a child in the structure pointed to by info. + If a child process changed state prior to the call to waitid(), waitid() returns immediately. + If more than one thread is suspended in wait() or waitpid() waiting termination of the same process, exactly one thread will return the process status at the time of the target process termination +

          +

          + The idtype and id arguments are used to specify which children waitid() will wait for. +

          +

          +

            +
          • + If idtype is P_PID, waitid() will wait for the child with a process ID equal to (pid_t)id. +
          • +
          • + If idtype is P_PGID, waitid() will wait for any child with a process group ID equal to (pid_t)id. +
          • +
          • + If idtype is P_ALL, waitid() will wait for any children and id is ignored. +
          +

          + The options argument is used to specify which state changes waitid() will will wait for. + It is formed by OR-ing together one or more of the following flags: +

          +
            +
          • + WEXITED: + Wait for processes that have exited. +
          • +
          • + WSTOPPED: + Status will be returned for any child that has stopped upon receipt of a signal. +
          • +
          • + WCONTINUES: + Status will be returned for any child that was stopped and has been continued. +
          • +
          • + WNOHANG: + Return immediately if there are no children to wait for. +
          • +
          • + WNOWAIT: + Keep the process whose status is returned in info in a waitable state. + This will not affect the state of the process; + the process may be waited for again after this call completes. +
          • +
          + The info argument must point to a siginfo_t structure. + If waitid() returns because a child process was found that satisfied the conditions indicated by the arguments idtype and options, then the structure pointed to by info will be filled in by the system with the status of the process. + The si_signo member will always be equal to SIGCHLD. +

          +

          + Input Parameters: + See the description above. +

          +

          + Returned Value: + If waitid() returns due to the change of state of one of its children, 0 is returned. + Otherwise, -1 is returned and errno is set to indicate the error. +

          +

          + The waitid() function will fail if: +

          +
            +
          • + ECHILD: +
          • + The calling process has no existing unwaited-for child processes. +
          • + EINTR: +
          • + The waitid() function was interrupted by a signal. +
          • + EINVAL: + An invalid value was specified for options, or idtype and id specify an invalid set of processes. +
          • +
          +

          + Assumptions/Limitations: +

          + POSIX Compatibility: + Comparable to the POSIX interface of the same name, but the implementation is incomplete (as detailed in the description above). +

          + +

          2.3.6 wait

          +

          +Function Prototype: +

          +    #include <sys/wait.h>
          +    #ifdef CONFIG_SCHED_HAVE_PARENT
          +    pid_t wait(FAR int *stat_loc);
          +    #endif
          +
          +

          + Description: +

          +
          + The following discussion is a general description of the wait() interface. + However, as of this writing, the implementation of wait() is incomplete (but usable). + wait() is based on waitpaid(). + See the description of waitpaid() for further information. +
          +

          + The wait() function will suspend execution of the calling thread until status information for one of its terminated child processes is available, or until delivery of a signal whose action is either to execute a signal-catching function or to terminate the process. + If more than one thread is suspended in wait() awaiting termination of the same process, exactly one thread will return the process status at the time of the target process termination. + If status information is available prior to the call towait(), return will be immediate. +

          +

          + The waitpid() function will behave identically to wait(), if its pid argument is (pid_t)-1 and the options argument is 0. + Otherwise, its behavior will be modified by the values of the pid and options arguments. +

          +

          + Input Parameters: +

          +
            +
          • stat_loc. The location to return the exit status
          • +
          +

          + Returned Value: + See the values returned by waitpaid(). +

          +

          + Assumptions/Limitations: +

          + POSIX Compatibility: + Comparable to the POSIX interface of the same name, but the implementation is incomplete (as detailed in the description waitpaid()). +

          + +

          2.3.7 atexit

          Function Prototype: @@ -2077,7 +2232,7 @@ on this thread of execution.

        • atexit() functions are not inherited when a new task is created.
        • -

          2.3.6 on_exit

          +

          2.3.8 on_exit

          Function Prototype: @@ -9023,9 +9178,9 @@ notify a task when a message is available on a queue.

        • pipe
        • poll
        • poll.h
        • +
        • posix_spawn
        • -
        • posix_spawn
        • posix_spawn_file_actions_addclose
        • posix_spawn_file_actions_adddup2
        • posix_spawn_file_actions_addopen
        • @@ -9107,10 +9262,10 @@ notify a task when a message is available on a queue.
        • recv
        • recvfrom
        • rename
        • - -
        • rmdir
        • rewinddir
        • + +
        • ROM disk driver
        • ROMFS
        • sched_getparam
        • @@ -9183,6 +9338,8 @@ notify a task when a message is available on a queue.
        • vfprintf
        • vprintf
        • vsprintf
        • +
        • wait
        • +
        • waitid
        • waitpid
        • Watchdog Timer Interfaces
        • wd_cancel
        • diff --git a/nuttx/TODO b/nuttx/TODO index 92b7ab4f57..88324c06bc 100644 --- a/nuttx/TODO +++ b/nuttx/TODO @@ -6,7 +6,7 @@ standards, things that could be improved, and ideas for enhancements. nuttx/ - (11) Task/Scheduler (sched/) + (10) Task/Scheduler (sched/) (1) Memory Managment (mm/) (2) Signals (sched/, arch/) (2) pthreads (sched/) @@ -58,17 +58,6 @@ o Task/Scheduler (sched/) Status: Closed. No, this behavior will not be implemented. Priority: Medium, required for good emulation of process/pthread model. - Title: WAIT.H - Description: Implement sys/wait.h and functions. Consider implementing wait, - waitpid, waitid. At present, a parent has no information about - child tasks. - - Update: A simple but usable version of waitpid() has been included. - This version is not compliant with all specifications and can be - enabled with CONFIG_SCHED_WAITPID. - Status: Open, however no further work is planned. - Priority: Low - Title: MISSING ERRNO SETTINGS Description: Several APIs do not set errno. Need to review all APIs. Update: These are being fixed as they are encountered. There is diff --git a/nuttx/configs/README.txt b/nuttx/configs/README.txt index 2724cf5a3c..4800f02eeb 100644 --- a/nuttx/configs/README.txt +++ b/nuttx/configs/README.txt @@ -335,10 +335,11 @@ defconfig -- This is a configuration file similar to the Linux task name to save in the TCB. Useful if scheduler instrumentation is selected. Set to zero to disable. CONFIG_SCHED_HAVE_PARENT - Remember the ID of the parent thread - when a new child thread is created. This support enables a - few minor features (such as SIGCHLD) and slightly increases - the size of the Task Control Block (TCB) of every task to hold - the ID of the parent thread. Default: disabled. + when a new child thread is created. This support enables some + additional features (such as SIGCHLD) and modifies the behavior + of other interfaces. For example, it makes waitpid() more + standards complete by restricting the waited-for tasks to the + children of the caller. Default: disabled. CONFIG_START_YEAR, CONFIG_START_MONTH, CONFIG_START_DAY - Used to initialize the internal time logic. CONFIG_GREGORIAN_TIME - Enables Gregorian time conversions. @@ -417,7 +418,12 @@ defconfig -- This is a configuration file similar to the Linux checks for work in units of microseconds. Default: 50*1000 (50 MS). CONFIG_SCHED_LPWORKSTACKSIZE - The stack size allocated for the lower priority worker thread. Default: CONFIG_IDLETHREAD_STACKSIZE. - CONFIG_SCHED_WAITPID - Enables the waitpid() API + CONFIG_SCHED_WAITPID - Enables the waitpid() interface in a default, + non-standard mode (non-standard in the sense that the waited for + PID need not be child of the caller). If SCHED_HAVE_PARENT is + also defined, then this setting will modify the behavior or + waitpid() (making more spec compliant) and will enable the + waitid() and wait() interfaces as well. CONFIG_SCHED_ATEXIT - Enables the atexit() API CONFIG_SCHED_ATEXIT_MAX - By default if CONFIG_SCHED_ATEXIT is selected, only a single atexit() function is supported. That number diff --git a/nuttx/configs/sim/ostest/defconfig b/nuttx/configs/sim/ostest/defconfig index 5cea9a6d44..c8d5c501d7 100644 --- a/nuttx/configs/sim/ostest/defconfig +++ b/nuttx/configs/sim/ostest/defconfig @@ -143,7 +143,7 @@ CONFIG_MUTEX_TYPES=y # CONFIG_FDCLONE_STDIO is not set CONFIG_SDCLONE_DISABLE=y # CONFIG_SCHED_WORKQUEUE is not set -# CONFIG_SCHED_WAITPID is not set +CONFIG_SCHED_WAITPID=y # CONFIG_SCHED_ATEXIT is not set # CONFIG_SCHED_ONEXIT is not set CONFIG_USER_ENTRYPOINT="ostest_main" diff --git a/nuttx/include/nuttx/sched.h b/nuttx/include/nuttx/sched.h index 6c67e15005..b2ec1cee4d 100644 --- a/nuttx/include/nuttx/sched.h +++ b/nuttx/include/nuttx/sched.h @@ -1,7 +1,7 @@ /******************************************************************************** * include/nuttx/sched.h * - * Copyright (C) 2007-2012 Gregory Nutt. All rights reserved. + * Copyright (C) 2007-2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -204,6 +204,7 @@ struct _TCB pid_t pid; /* This is the ID of the thread */ #ifdef CONFIG_SCHED_HAVE_PARENT pid_t parent; /* This is the ID of the parent thread */ + uint16_t nchildren; /* This is the number active children */ #endif start_t start; /* Thread start function */ entry_t entry; /* Entry Point into the thread */ @@ -226,7 +227,7 @@ struct _TCB # endif #endif -#ifdef CONFIG_SCHED_WAITPID +#if defined(CONFIG_SCHED_WAITPID) && !defined(CONFIG_SCHED_HAVE_PARENT) sem_t exitsem; /* Support for waitpid */ int *stat_loc; /* Location to return exit status */ #endif diff --git a/nuttx/include/sys/types.h b/nuttx/include/sys/types.h index 2ae69d4a7e..95feee72ef 100644 --- a/nuttx/include/sys/types.h +++ b/nuttx/include/sys/types.h @@ -154,7 +154,9 @@ typedef uint16_t dev_t; typedef uint16_t ino_t; -/* pid_t is used for process IDs and process group IDs */ +/* pid_t is used for process IDs and process group IDs. It must be signed because + * negative PID values are used to represent invalid PIDs. + */ typedef int pid_t; diff --git a/nuttx/include/sys/wait.h b/nuttx/include/sys/wait.h index 6af1e971e4..2476adef96 100644 --- a/nuttx/include/sys/wait.h +++ b/nuttx/include/sys/wait.h @@ -1,7 +1,7 @@ /**************************************************************************** * include/sys/wait.h * - * Copyright (C) 2011 Gregory Nutt. All rights reserved. + * Copyright (C) 2011, 2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -66,7 +66,7 @@ #define WTERMSIG(s) (false) /* Return signal number that caused process to terminate */ /* The following symbolic constants are possible values for the options - * argument to waitpi(1) (1) and/or waitid() (2), + * argument to waitpid() (1) and/or waitid() (2), */ #define WCONTINUED (1 << 0) /* Status for child that has been continued (1)(2) */ @@ -104,9 +104,9 @@ extern "C" { #define EXTERN extern #endif -EXTERN pid_t wait(int *stat_loc); -EXTERN int waitid(idtype_t idtype, id_t id, siginfo_t *siginfo, int options); -EXTERN pid_t waitpid(pid_t pid, int *stat_loc, int options); +EXTERN pid_t wait(FAR int *stat_loc); +EXTERN int waitid(idtype_t idtype, id_t id, FAR siginfo_t *info, int options); +EXTERN pid_t waitpid(pid_t pid, FAR int *stat_loc, int options); #undef EXTERN #if defined(__cplusplus) diff --git a/nuttx/sched/Kconfig b/nuttx/sched/Kconfig index 69621a1fa1..6d53a03aa7 100644 --- a/nuttx/sched/Kconfig +++ b/nuttx/sched/Kconfig @@ -43,9 +43,10 @@ config SCHED_HAVE_PARENT default n ---help--- Remember the ID of the parent thread when a new child thread is - created. This support enables a few minor features (such as - SIGCHLD) and slightly increases the size of the Task Control Block - (TCB) of every task to hold the ID of the parent thread. Default: + created. This support enables some additional features (such as + SIGCHLD) and modifies the behavior of other interfaces. For + example, it makes waitpid() more standards complete by restricting + the waited-for tasks to the children of the caller. Default: disabled. config JULIAN_TIME @@ -206,7 +207,12 @@ config SCHED_WAITPID bool "Enable waitpid() API" default n ---help--- - Enables the waitpid() API + Enables the waitpid() interface in a default, non-standard mode + (non-standard in the sense that the waited for PID need not be child + of the caller). If SCHED_HAVE_PARENT is also defined, then this + setting will modify the behavior or waitpid() (making more spec + compliant) and will enable the waitid() and wait() interfaces as + well. config SCHED_ATEXIT bool "Enable atexit() API" diff --git a/nuttx/sched/Makefile b/nuttx/sched/Makefile index 23d1e9938e..3d6b58bacf 100644 --- a/nuttx/sched/Makefile +++ b/nuttx/sched/Makefile @@ -1,7 +1,7 @@ ############################################################################ # sched/Makefile # -# Copyright (C) 2007-2012 Gregory Nutt. All rights reserved. +# Copyright (C) 2007-2013 Gregory Nutt. All rights reserved. # Author: Gregory Nutt # # Redistribution and use in source and binary forms, with or without @@ -69,6 +69,9 @@ endif ifeq ($(CONFIG_SCHED_WAITPID),y) SCHED_SRCS += sched_waitpid.c +ifeq ($(CONFIG_SCHED_HAVE_PARENT),y) +SCHED_SRCS += sched_waitid.c sched_wait.c +endif endif ENV_SRCS = env_getenvironptr.c env_dup.c env_share.c env_release.c \ diff --git a/nuttx/sched/os_internal.h b/nuttx/sched/os_internal.h index 13b8083cff..32d9fb4ac3 100644 --- a/nuttx/sched/os_internal.h +++ b/nuttx/sched/os_internal.h @@ -83,10 +83,10 @@ enum os_crash_codes_e OSERR_BADREPRIORITIZESTATE /* Attempt to reprioritize in bad state or priority */ }; -/* Special task IDS */ +/* Special task IDS. Any negative PID is invalid. */ -#define NULL_TASK_PROCESS_ID 0 -#define INVALID_PROCESS_ID 0 +#define NULL_TASK_PROCESS_ID (pid_t)0 +#define INVALID_PROCESS_ID (pid_t)-1 /* Although task IDs can take the (positive, non-zero) * range of pid_t, the number of tasks that will be supported diff --git a/nuttx/sched/sched_wait.c b/nuttx/sched/sched_wait.c new file mode 100644 index 0000000000..813d4f8427 --- /dev/null +++ b/nuttx/sched/sched_wait.c @@ -0,0 +1,90 @@ +/***************************************************************************** + * sched/sched_wait.c + * + * Copyright (C) 2013 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * 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. + * + *****************************************************************************/ + +/***************************************************************************** + * Included Files + *****************************************************************************/ + +#include + +#include +#include +#include + +#include + +#include "os_internal.h" + +#if defined(CONFIG_SCHED_WAITPID) && defined(CONFIG_SCHED_HAVE_PARENT) + +/***************************************************************************** + * Private Functions + *****************************************************************************/ + +/***************************************************************************** + * Public Functions + *****************************************************************************/ + +/***************************************************************************** + * Name: wait + * + * Description: + * The wait() function will suspend execution of the calling thread until + * status information for one of its terminated child processes is + * available, or until delivery of a signal whose action is either to + * execute a signal-catching function or to terminate the process. If more + * than one thread is suspended in wait() or waitpid() awaiting termination + * of the same process, exactly one thread will return the process status + * at the time of the target process termination. If status information is + * available prior to the call to wait(), return will be immediate. + * + * The waitpid() function will behave identically to wait(), if the pid + * argument is (pid_t)-1 and the options argument is 0. Otherwise, its + * behaviour will be modified by the values of the pid and options arguments. + * + * Input Parameters: + * stat_loc - The location to return the exit status + * + * Returned Value: + * See waitpid(); + * + *****************************************************************************/ + +pid_t wait(FAR int *stat_loc) +{ + return waitpid((pid_t)-1, stat_loc, 0); +} + +#endif /* CONFIG_SCHED_WAITPID && CONFIG_SCHED_HAVE_PARENT*/ diff --git a/nuttx/sched/sched_waitid.c b/nuttx/sched/sched_waitid.c new file mode 100644 index 0000000000..eabc69afea --- /dev/null +++ b/nuttx/sched/sched_waitid.c @@ -0,0 +1,256 @@ +/***************************************************************************** + * sched/sched_waitid.c + * + * Copyright (C) 2013 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * 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. + * + *****************************************************************************/ + +/***************************************************************************** + * Included Files + *****************************************************************************/ + +#include + +#include +#include +#include + +#include + +#include "os_internal.h" + +#if defined(CONFIG_SCHED_WAITPID) && defined(CONFIG_SCHED_HAVE_PARENT) + +/***************************************************************************** + * Private Functions + *****************************************************************************/ + +/***************************************************************************** + * Public Functions + *****************************************************************************/ + +/***************************************************************************** + * Name: waitid + * + * Description: + * The waitid() function suspends the calling thread until one child of + * the process containing the calling thread changes state. It records the + * current state of a child in the structure pointed to by 'info'. If a + * child process changed state prior to the call to waitid(), waitid() + * returns immediately. If more than one thread is suspended in wait() or + * waitpid() waiting termination of the same process, exactly one thread + * will return the process status at the time of the target process + * termination + * + * The idtype and id arguments are used to specify which children waitid() + * will wait for. + * + * If idtype is P_PID, waitid() will wait for the child with a process + * ID equal to (pid_t)id. + * + * If idtype is P_PGID, waitid() will wait for any child with a process + * group ID equal to (pid_t)id. + * + * If idtype is P_ALL, waitid() will wait for any children and id is + * ignored. + * + * The options argument is used to specify which state changes waitid() + * will will wait for. It is formed by OR-ing together one or more of the + * following flags: + * + * WEXITED - Wait for processes that have exited. + * WSTOPPED - Status will be returned for any child that has stopped + * upon receipt of a signal. + * WCONTINUED - Status will be returned for any child that was stopped + * and has been continued. + * WNOHANG - Return immediately if there are no children to wait for. + * WNOWAIT - Keep the process whose status is returned in 'info' in a + * waitable state. This will not affect the state of the process; the + * process may be waited for again after this call completes. + * + * The 'info' argument must point to a siginfo_t structure. If waitid() + * returns because a child process was found that satisfied the conditions + * indicated by the arguments idtype and options, then the structure pointed + * to by 'info' will be filled in by the system with the status of the + * process. The si_signo member will always be equal to SIGCHLD. + * + * Input Parameters: + * See description. + * + * Returned Value: + * If waitid() returns due to the change of state of one of its children, + * 0 is returned. Otherwise, -1 is returned and errno is set to indicate + * the error. + * + * The waitid() function will fail if: + * + * ECHILD - The calling process has no existing unwaited-for child + * processes. + * EINTR - The waitid() function was interrupted by a signal. + * EINVAL - An invalid value was specified for options, or idtype and id + * specify an invalid set of processes. + * + *****************************************************************************/ + +int waitid(idtype_t idtype, id_t id, siginfo_t *info, int options) +{ + FAR _TCB *rtcb = (FAR _TCB *)g_readytorun.head; + sigset_t sigset; + int err; + int ret; + + /* MISSING LOGIC: If WNOHANG is provided in the options, then this function + * should returned immediately. However, there is no mechanism available now + * know if the thread has child: The children remember their parents (if + * CONFIG_SCHED_HAVE_PARENT) but the parents do not remember their children. + */ + + /* None of the options are supported except for WEXITED (which must be + * provided. Currently SIGCHILD always reports CLD_EXITED so we cannot + * distinguish any other events. + */ + +#ifdef CONFIG_DEBUG + if (options != WEXITED) + { + set_errno(ENOSYS); + return ERROR; + } +#endif + + /* Create a signal set that contains only SIGCHLD */ + + (void)sigemptyset(&sigset); + (void)sigaddset(&sigset, SIGCHLD); + + /* Disable pre-emption so that nothing changes while the loop executes */ + + sched_lock(); + + /* Verify that this task actually has children and that the the requeste + * TCB is actually a child of this task. + */ + + if (rtcb->nchildren == 0) + { + err = ECHILD; + goto errout_with_errno; + } + else if (idtype == P_PID) + { + /* Get the TCB corresponding to this PID and make sure it is our child. */ + + FAR _TCB *ctcb = sched_gettcb((pid_t)id); + if (!ctcb || ctcb->parent != rtcb->pid) + { + err = ECHILD; + goto errout_with_errno; + } + } + + /* Loop until the child that we are waiting for dies */ + + for (;;) + { + /* Check if the task has already died. Signals are not queued in + * NuttX. So a possibility is that the child has died and we + * missed the death of child signal (we got some other signal + * instead). + */ + + if (rtcb->nchildren == 0 || + (idtype == P_PID && (ret = kill((pid_t)id, 0)) < 0)) + { + /* We know that the child task was running okay we stared, + * so we must have lost the signal. What can we do? + * Let's claim we were interrupted by a signal. + */ + + err = EINTR; + goto errout_with_errno; + } + + /* Wait for any death-of-child signal */ + + ret = sigwaitinfo(&sigset, info); + if (ret < 0) + { + goto errout; + } + + /* Make there this was SIGCHLD */ + + if (info->si_signo == SIGCHLD) + { + /* Yes.. Are we waiting for the death of a specific child? */ + + if (idtype == P_PID) + { + /* Was this the death of the thread we were waiting for? */ + + if (info->si_pid == (pid_t)id) + { + /* Yes... return success */ + + break; + } + } + + /* Are we waiting for any child to change state? */ + + else if (idtype == P_ALL) + { + /* Return success */ + + break; + } + + /* Other ID types are not supported */ + + else /* if (idtype == P_PGID) */ + { + set_errno(ENOSYS); + goto errout; + } + } + } + + sched_unlock(); + return OK; + +errout_with_errno: + set_errno(err); +errout: + sched_unlock(); + return ERROR; +} + +#endif /* CONFIG_SCHED_WAITPID && CONFIG_SCHED_HAVE_PARENT*/ diff --git a/nuttx/sched/sched_waitpid.c b/nuttx/sched/sched_waitpid.c index 692ef64102..dc715b2e92 100644 --- a/nuttx/sched/sched_waitpid.c +++ b/nuttx/sched/sched_waitpid.c @@ -1,7 +1,7 @@ /***************************************************************************** * sched/sched_waitpid.c * - * Copyright (C) 2011-2012 Gregory Nutt. All rights reserved. + * Copyright (C) 2011-2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -41,13 +41,14 @@ #include #include +#include #include #include #include "os_internal.h" -#ifdef CONFIG_SCHED_WAITPID /* Experimental */ +#ifdef CONFIG_SCHED_WAITPID /***************************************************************************** * Private Functions @@ -58,7 +59,7 @@ *****************************************************************************/ /***************************************************************************** - * Name: sched_waitpid + * Name: waitpid * * Description: * @@ -172,10 +173,16 @@ * *****************************************************************************/ -/***************************************************************************/ -/* NOTE: This is a partially functional, experimental version of waitpid() */ -/***************************************************************************/ +/*************************************************************************** + * NOTE: This is a partially functional, experimental version of waitpid() + * + * If there is no SIGCHLD signal supported (CONFIG_SCHED_HAVE_PARENT not + * defined), then waitpid() is still available, but does not obey the + * restriction that the pid be a child of the caller. + * + ***************************************************************************/ +#ifndef CONFIG_SCHED_HAVE_PARENT pid_t waitpid(pid_t pid, int *stat_loc, int options) { _TCB *tcb; @@ -183,26 +190,31 @@ pid_t waitpid(pid_t pid, int *stat_loc, int options) int err; int ret; - /* Disable pre-emption so that nothing changes in the following tests */ - - sched_lock(); - tcb = sched_gettcb(pid); - if (!tcb) - { - err = ECHILD; - goto errout_with_errno; - } + DEBUGASSERT(stat_loc); /* None of the options are supported */ #ifdef CONFIG_DEBUG if (options != 0) { - err = ENOSYS; - goto errout_with_errno; + set_errno(ENOSYS); + return ERROR; } #endif + /* Disable pre-emption so that nothing changes in the following tests */ + + sched_lock(); + + /* Get the TCB corresponding to this PID */ + + tcb = sched_gettcb(pid); + if (!tcb) + { + err = ECHILD; + goto errout_with_errno; + } + /* "If more than one thread is suspended in waitpid() awaiting termination of * the same process, exactly one thread will return the process status at the * time of the target process termination." Hmmm.. what do we return to the @@ -245,4 +257,152 @@ errout: return ERROR; } +/*************************************************************************** + * + * If CONFIG_SCHED_HAVE_PARENT is defined, then waitpid will use the SIGHCLD + * signal. It can also handle the pid == (pid_t)-1 arguement. This is + * slightly more spec-compliant. + * + * But then I have to be concerned about the fact that NuttX does not queue + * signals. This means that a flurry of signals can cause signals to be + * lost (or to have the data in the struct siginfo to be overwritten by + * the next signal). + * + ***************************************************************************/ + +#else +pid_t waitpid(pid_t pid, int *stat_loc, int options) +{ + FAR _TCB *rtcb = (FAR _TCB *)g_readytorun.head; + FAR struct siginfo info; + sigset_t sigset; + int err; + int ret; + + DEBUGASSERT(stat_loc); + + /* None of the options are supported */ + +#ifdef CONFIG_DEBUG + if (options != 0) + { + set_errno(ENOSYS); + return ERROR; + } +#endif + + /* Create a signal set that contains only SIGCHLD */ + + (void)sigemptyset(&sigset); + (void)sigaddset(&sigset, SIGCHLD); + + /* Disable pre-emption so that nothing changes while the loop executes */ + + sched_lock(); + + /* Verify that this task actually has children and that the the requeste + * TCB is actually a child of this task. + */ + + if (rtcb->nchildren == 0) + { + err = ECHILD; + goto errout_with_errno; + } + else if (pid != (pid_t)-1) + { + /* Get the TCB corresponding to this PID and make sure it is our child. */ + + FAR _TCB *ctcb = sched_gettcb(pid); + if (!ctcb || ctcb->parent != rtcb->pid) + { + err = ECHILD; + goto errout_with_errno; + } + } + + /* Loop until the child that we are waiting for dies */ + + for (;;) + { + /* Check if the task has already died. Signals are not queued in + * NuttX. So a possibility is that the child has died and we + * missed the death of child signal (we got some other signal + * instead). + */ + + if (pid == (pid_t)-1) + { + /* We are waiting for any child, check if there are still + * chilren. + */ + + if (rtcb->nchildren == 0) + { + /* There were one or more children when we started so they + * must have exit'ed. There are just no bread crumbs left + * behind to tell us the PID(s) of the existed children. + * Reporting ECHLD is about all we can do in this case. + */ + + err = ECHILD; + goto errout_with_errno; + } + } + else + { + /* We are waiting for a specific PID. We can use kill() with + * signal number 0 to determine if that task is still alive. + */ + + ret = kill(pid, 0); + if (ret < 0) + { + /* It is no longer running. We know that the child task was + * running okay when we started, so we must have lost the + * signal. In this case, we know that the task exit'ed, but + * we do not know its exit status. It would be better to + * reported ECHILD that bogus status. + */ + + err = ECHILD; + goto errout_with_errno; + } + } + + /* Wait for any death-of-child signal */ + + ret = sigwaitinfo(&sigset, &info); + if (ret < 0) + { + goto errout_with_lock; + } + + /* Was this the death of the thread we were waiting for? In the of + * pid == (pid_t)-1, we are waiting for any child thread. + */ + + if (info.si_signo == SIGCHLD && + (pid == (pid_t)-1 || info.si_pid == pid)) + { + /* Yes... return the status and PID (in the event it was -1) */ + + *stat_loc = info.si_status; + pid = info.si_pid; + break; + } + } + + sched_unlock(); + return (int)pid; + +errout_with_errno: + set_errno(err); + +errout_with_lock: + sched_unlock(); + return ERROR; +} +#endif /* CONFIG_SCHED_HAVE_PARENT */ + #endif /* CONFIG_SCHED_WAITPID */ diff --git a/nuttx/sched/task_exithook.c b/nuttx/sched/task_exithook.c index 9ce2e5899c..1106f28852 100644 --- a/nuttx/sched/task_exithook.c +++ b/nuttx/sched/task_exithook.c @@ -217,6 +217,20 @@ static inline void task_sigchild(FAR _TCB *tcb, int status) return; } + /* Decrement the number of children from this parent */ + + DEBUGASSERT(ptcb->nchildren > 0); + ptcb->nchildren--; + + /* Set the parent to an impossible PID. We do this because under certain + * conditions, task_exithook() can be called multiple times. If this + * function is called again, sched_gettcb() will fail on the invalid + * parent PID above, nchildren will be decremented once and all will be + * well. + */ + + tcb->parent = INVALID_PROCESS_ID; + /* Create the siginfo structure. We don't actually know the cause. That * is a bug. Let's just say that the child task just exit-ted for now. */ @@ -246,7 +260,7 @@ static inline void task_sigchild(FAR _TCB *tcb, int status) * ****************************************************************************/ -#ifdef CONFIG_SCHED_WAITPID +#if defined(CONFIG_SCHED_WAITPID) && !defined(CONFIG_SCHED_HAVE_PARENT) static inline void task_exitwakeup(FAR _TCB *tcb, int status) { /* Wakeup any tasks waiting for this task to exit */ @@ -310,14 +324,14 @@ void task_exithook(FAR _TCB *tcb, int status) task_atexit(tcb); - /* Send SIGCHLD to the parent of the exiting task */ - - task_sigchild(tcb, status); - /* Call any registered on_exit function(s) */ task_onexit(tcb, status); + /* Send SIGCHLD to the parent of the exit-ing task */ + + task_sigchild(tcb, status); + /* Wakeup any tasks waiting for this task to exit */ task_exitwakeup(tcb, status); diff --git a/nuttx/sched/task_setup.c b/nuttx/sched/task_setup.c index c5dd8ca3a8..92897f0ae6 100644 --- a/nuttx/sched/task_setup.c +++ b/nuttx/sched/task_setup.c @@ -168,7 +168,10 @@ static int task_assignpid(FAR _TCB *tcb) static inline void task_saveparent(FAR _TCB *tcb) { FAR _TCB *rtcb = (FAR _TCB*)g_readytorun.head; + + DEBUGASSERT(rtcb->nchildren < UINT16_MAX); tcb->parent = rtcb->pid; + rtcb->nchildren++; } #else # define task_saveparent(tcb) From 930f9a13511a6d9bc2e44fadef42f6345d921667 Mon Sep 17 00:00:00 2001 From: patacongo Date: Mon, 14 Jan 2013 15:42:03 +0000 Subject: [PATCH 069/118] Add support for dup2'ing files. Infrastructure and ROMFS done. Still need FAT, BINFS, NXFFS, and NFS git-svn-id: http://svn.code.sf.net/p/nuttx/code/trunk@5516 42af7a65-404d-4744-a932-0658087f49c3 --- apps/ChangeLog.txt | 1 + apps/builtin/binfs.c | 4 +- apps/examples/posix_spawn/spawn_main.c | 14 -- nuttx/ChangeLog | 11 ++ nuttx/TODO | 47 ++++- nuttx/fs/fat/fs_fat32.c | 40 ++-- nuttx/fs/fs_files.c | 18 +- nuttx/fs/nfs/nfs_vfsops.c | 2 + nuttx/fs/nxffs/nxffs_initialize.c | 2 + nuttx/fs/romfs/fs_romfs.c | 245 ++++++++++++++++++------- nuttx/fs/romfs/fs_romfs.h | 1 - nuttx/fs/romfs/fs_romfsutil.c | 12 +- nuttx/include/nuttx/fs/fs.h | 1 + nuttx/include/unistd.h | 2 +- nuttx/libc/spawn/lib_ps.c | 4 +- nuttx/libc/unistd/lib_execsymtab.c | 6 +- nuttx/libc/unistd/lib_execv.c | 4 +- 17 files changed, 266 insertions(+), 148 deletions(-) diff --git a/apps/ChangeLog.txt b/apps/ChangeLog.txt index 70381a79da..bf329a40db 100644 --- a/apps/ChangeLog.txt +++ b/apps/ChangeLog.txt @@ -466,3 +466,4 @@ death-of-child signals (SIGCHLD). * apps/examples/ostest/waitpid.c: Add a test for waitpid(), waitid(), and wait(). + * builtin/binfs.c: Add hooks for dup() method (not implemented). diff --git a/apps/builtin/binfs.c b/apps/builtin/binfs.c index 501f0a4b93..4159c96630 100644 --- a/apps/builtin/binfs.c +++ b/apps/builtin/binfs.c @@ -1,7 +1,7 @@ /**************************************************************************** * apps/builtin/binfs.c * - * Copyright (C) 2011-2012 Gregory Nutt. All rights reserved. + * Copyright (C) 2011-2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -118,7 +118,9 @@ const struct mountpt_operations binfs_operations = NULL, /* write */ NULL, /* seek */ binfs_ioctl, /* ioctl */ + NULL, /* sync */ + NULL, /* dup */ binfs_opendir, /* opendir */ NULL, /* closedir */ diff --git a/apps/examples/posix_spawn/spawn_main.c b/apps/examples/posix_spawn/spawn_main.c index 1506fe4993..0ca5f91074 100644 --- a/apps/examples/posix_spawn/spawn_main.c +++ b/apps/examples/posix_spawn/spawn_main.c @@ -89,15 +89,6 @@ # error "You must not disable loadable modules via CONFIG_BINFMT_DISABLE in your configuration file" #endif -/* The redirection test does not work. This is because it tries to redirect - * file as stdin. That won't work now because (1) the file descriptors must - * be dup'ed when the new task is created, and (2) there is no support in - * place for dup'ing file descriptors for anything other than sockets and - * character drivers. This is a bug! - */ - -#define FILE_DUP_BUG 1 - /* Describe the ROMFS file system */ #define SECTORSIZE 512 @@ -147,9 +138,7 @@ static unsigned int g_mmstep; /* Memory Usage at beginning of test step */ static const char delimiter[] = "****************************************************************************"; -#ifndef FILE_DUP_BUG static const char g_redirect[] = "redirect"; -#endif static const char g_hello[] = "hello"; static const char g_data[] = "testdata.txt"; @@ -375,8 +364,6 @@ int spawn_main(int argc, char *argv[]) * Case 2: Simple program with redirection of stdin to a file input *************************************************************************/ -#ifndef FILE_DUP_BUG - /* Output a seperated so that we can clearly discriminate the output of * this program from the others. */ @@ -463,7 +450,6 @@ int spawn_main(int argc, char *argv[]) posix_spawnattr_dump(&attr); mm_update(&g_mmstep, "after file_action/attr destruction"); -#endif /* Clean-up */ diff --git a/nuttx/ChangeLog b/nuttx/ChangeLog index e8d4f7309c..cb0244e204 100644 --- a/nuttx/ChangeLog +++ b/nuttx/ChangeLog @@ -3929,3 +3929,14 @@ need to. * sched/sched_waitid.c and sched_wait.c: Add support for waitid() and wait(). See issues with waitpid() above. + * include/nuttx/fs/fs.h and fs/fs_files.c: Add a dup() method to + the struct mountpt_operations. When dup'ing a file that resides + on a mounted volume, let the file system's dup() method do the + work. + * fs/romfs/fs_romfs.c: Implemented the dup() method for the ROMFS + file system. + * fs/fat/fs_fat32.c, fs/nxffs/nxffs_initialize, and + fs/nfs/nfs_vfsops.c: Add hooks for dup() method (not yet + implemented). + * fs/romfs: Remove the rf_open flag. It looks good, but actually + does nothing. diff --git a/nuttx/TODO b/nuttx/TODO index 88324c06bc..28a9ce68b8 100644 --- a/nuttx/TODO +++ b/nuttx/TODO @@ -1,4 +1,4 @@ -NuttX TODO List (Last updated January 11, 2013) +NuttX TODO List (Last updated January 13, 2013) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ This file summarizes known NuttX bugs, limitations, inconsistencies with @@ -8,7 +8,7 @@ nuttx/ (10) Task/Scheduler (sched/) (1) Memory Managment (mm/) - (2) Signals (sched/, arch/) + (3) Signals (sched/, arch/) (2) pthreads (sched/) (2) C++ Support (6) Binary loaders (binfmt/) @@ -99,13 +99,6 @@ o Task/Scheduler (sched/) someone gets motivated and drives the change. Priority: Low - Title: posix_spawn() - Description: This would be a good interface to add to NuttX. It is really - just a re-packaging of the existing, non-standard NuttX exec() - function. - Status: Open. There are no plans to implement this capabilitiey now. - Priority: Medium low. - Title: pause() NON-COMPLIANCE Description: In the POSIX description of this function is the pause() function will suspend the calling thread until delivery of a signal whose @@ -178,6 +171,30 @@ o Task/Scheduler (sched/) Status: Open Priority: Medium Low for now + Title: RETAINING TASK EXIT STATUS + Description: When a task exists, its exit status should be retained in + so data structure until it is reaped (via waitpid(), or + similar interface) or until the parent thread exists. + + You would think that this should be a clone of the existing + pthread join logic. Howver there is no need for zombies + in NuttX so, the status if the parent has already exit'ed. + + At present, exit status is not retained. If waitpid() + is called after the child task has exit'ed it simpley + returns with the ECHLD error. That is not too bad, but + does not tell you what the exit status was. + + A work-around is to: + 1) Call sched_lock() to disable pre-emption. + 2) Start the task (it cannot run because pre-emption is + disbled. + 3) Call waitpid(); + 4) Call sched_unlock() to re-enable pre-emption. + + Status: Open + Priority: Low + o Memory Managment (mm/) ^^^^^^^^^^^^^^^^^^^^^^ @@ -249,7 +266,9 @@ o Signals (sched/, arch/) Title: STANDARD SIGNALS Description: 'Standard' signals and signal actions are not supported. - (e.g., SIGINT, SIGCHLD, SIGSEGV, etc). + (e.g., SIGINT, SIGSEGV, etc). + + Update: SIG_CHLD is support if configured. Status: Open. No changes are planned. Priority: Low, required by standards but not so critical for an embedded system. @@ -262,6 +281,14 @@ o Signals (sched/, arch/) are required by the POSIX standard. Priority: Low for now + Title: SIGNAL NUMBERING + Description: In signal.h, the range of valid signals is listed as 0-31. However, + in many interfaces, 0 is not a valid signal number. The valid + signal number should be 1-32. The signal set operations would need + to map bits appropriately. + Status: Open + Priority: Low. Even if there are only 31 usable signals, that is still a lot. + o pthreads (sched/) ^^^^^^^^^^^^^^^^^ diff --git a/nuttx/fs/fat/fs_fat32.c b/nuttx/fs/fat/fs_fat32.c index 0c28cea678..788e6bebc7 100644 --- a/nuttx/fs/fat/fs_fat32.c +++ b/nuttx/fs/fat/fs_fat32.c @@ -121,28 +121,30 @@ static int fat_stat(struct inode *mountpt, const char *relpath, struct stat const struct mountpt_operations fat_operations = { - fat_open, - fat_close, - fat_read, - fat_write, - fat_seek, - fat_ioctl, - fat_sync, + fat_open, /* open */ + fat_close, /* close */ + fat_read, /* read */ + fat_write, /* write */ + fat_seek, /* seek */ + fat_ioctl, /* ioctl */ - fat_opendir, - NULL, - fat_readdir, - fat_rewinddir, + fat_sync, /* sync */ + NULL, /* dup */ - fat_bind, - fat_unbind, - fat_statfs, + fat_opendir, /* opendir */ + NULL, /* closedir */ + fat_readdir, /* readdir */ + fat_rewinddir, /* rewinddir */ - fat_unlink, - fat_mkdir, - fat_rmdir, - fat_rename, - fat_stat + fat_bind, /* bind */ + fat_unbind, /* unbind */ + fat_statfs, /* statfs */ + + fat_unlink, /* unlinke */ + fat_mkdir, /* mkdir */ + fat_rmdir, /* rmdir */ + fat_rename, /* rename */ + fat_stat /* stat */ }; /**************************************************************************** diff --git a/nuttx/fs/fs_files.c b/nuttx/fs/fs_files.c index 4da2d28a52..06addb1efc 100644 --- a/nuttx/fs/fs_files.c +++ b/nuttx/fs/fs_files.c @@ -1,7 +1,7 @@ /**************************************************************************** * fs/fs_files.c * - * Copyright (C) 2007-2009, 2011-2012 Gregory Nutt. All rights reserved. + * Copyright (C) 2007-2009, 2011-2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -284,14 +284,6 @@ int files_dup(FAR struct file *filep1, FAR struct file *filep2) goto errout; } -#ifndef CONFIG_DISABLE_MOUNTPOINT - if (INODE_IS_MOUNTPT(filep1->f_inode)) - { - err = ENOSYS; /* Not yet supported */ - goto errout; - } -#endif - list = sched_getfiles(); if (!list) { @@ -331,18 +323,16 @@ int files_dup(FAR struct file *filep1, FAR struct file *filep2) if (inode->u.i_ops && inode->u.i_ops->open) { #ifndef CONFIG_DISABLE_MOUNTPOINT -#if 0 /* Not implemented */ if (INODE_IS_MOUNTPT(inode)) { - /* Open a file on the mountpoint */ + /* Dup the open file on the in the new file structure */ - ret = inode->u.i_mops->open(filep2, ?, filep2->f_oflags, ?); + ret = inode->u.i_mops->dup(filep1, filep2); } else -#endif #endif { - /* Open the pseudo file or device driver */ + /* (Re-)open the pseudo file or device driver */ ret = inode->u.i_ops->open(filep2); } diff --git a/nuttx/fs/nfs/nfs_vfsops.c b/nuttx/fs/nfs/nfs_vfsops.c index 3cd5a47dc3..efb026c7f7 100644 --- a/nuttx/fs/nfs/nfs_vfsops.c +++ b/nuttx/fs/nfs/nfs_vfsops.c @@ -166,7 +166,9 @@ const struct mountpt_operations nfs_operations = nfs_write, /* write */ NULL, /* seek */ NULL, /* ioctl */ + NULL, /* sync */ + NULL, /* dup */ nfs_opendir, /* opendir */ NULL, /* closedir */ diff --git a/nuttx/fs/nxffs/nxffs_initialize.c b/nuttx/fs/nxffs/nxffs_initialize.c index 6d93a318aa..0aa424869a 100644 --- a/nuttx/fs/nxffs/nxffs_initialize.c +++ b/nuttx/fs/nxffs/nxffs_initialize.c @@ -82,7 +82,9 @@ const struct mountpt_operations nxffs_operations = nxffs_write, /* write */ NULL, /* seek -- Use f_pos in struct file */ nxffs_ioctl, /* ioctl */ + NULL, /* sync -- No buffered data */ + NULL, /* dup -- not implemented */ nxffs_opendir, /* opendir */ NULL, /* closedir */ diff --git a/nuttx/fs/romfs/fs_romfs.c b/nuttx/fs/romfs/fs_romfs.c index b95619d759..de87c7fec8 100644 --- a/nuttx/fs/romfs/fs_romfs.c +++ b/nuttx/fs/romfs/fs_romfs.c @@ -70,24 +70,33 @@ * Private Function Prototypes ****************************************************************************/ -static int romfs_open(FAR struct file *filep, const char *relpath, +static int romfs_open(FAR struct file *filep, FAR const char *relpath, int oflags, mode_t mode); static int romfs_close(FAR struct file *filep); -static ssize_t romfs_read(FAR struct file *filep, char *buffer, size_t buflen); +static ssize_t romfs_read(FAR struct file *filep, FAR char *buffer, + size_t buflen); static off_t romfs_seek(FAR struct file *filep, off_t offset, int whence); -static int romfs_ioctl(FAR struct file *filep, int cmd, unsigned long arg); +static int romfs_ioctl(FAR struct file *filep, int cmd, + unsigned long arg); -static int romfs_opendir(struct inode *mountpt, const char *relpath, - struct fs_dirent_s *dir); -static int romfs_readdir(struct inode *mountpt, struct fs_dirent_s *dir); -static int romfs_rewinddir(struct inode *mountpt, struct fs_dirent_s *dir); +static int romfs_dup(FAR const struct file *oldp, FAR struct file *newp); -static int romfs_bind(FAR struct inode *blkdriver, const void *data, - void **handle); -static int romfs_unbind(void *handle, FAR struct inode **blkdriver); -static int romfs_statfs(struct inode *mountpt, struct statfs *buf); +static int romfs_opendir(FAR struct inode *mountpt, + FAR const char *relpath, + FAR struct fs_dirent_s *dir); +static int romfs_readdir(FAR struct inode *mountpt, + FAR struct fs_dirent_s *dir); +static int romfs_rewinddir(FAR struct inode *mountpt, + FAR struct fs_dirent_s *dir); -static int romfs_stat(struct inode *mountpt, const char *relpath, struct stat *buf); +static int romfs_bind(FAR struct inode *blkdriver, FAR const void *data, + FAR void **handle); +static int romfs_unbind(FAR void *handle, FAR struct inode **blkdriver); +static int romfs_statfs(FAR struct inode *mountpt, + FAR struct statfs *buf); + +static int romfs_stat(FAR struct inode *mountpt, FAR const char *relpath, + FAR struct stat *buf); /**************************************************************************** * Private Variables @@ -110,7 +119,9 @@ const struct mountpt_operations romfs_operations = NULL, /* write */ romfs_seek, /* seek */ romfs_ioctl, /* ioctl */ + NULL, /* sync */ + romfs_dup, /* dup */ romfs_opendir, /* opendir */ NULL, /* closedir */ @@ -136,13 +147,13 @@ const struct mountpt_operations romfs_operations = * Name: romfs_open ****************************************************************************/ -static int romfs_open(FAR struct file *filep, const char *relpath, - int oflags, mode_t mode) +static int romfs_open(FAR struct file *filep, FAR const char *relpath, + int oflags, mode_t mode) { - struct romfs_dirinfo_s dirinfo; - struct romfs_mountpt_s *rm; - struct romfs_file_s *rf; - int ret; + struct romfs_dirinfo_s dirinfo; + FAR struct romfs_mountpt_s *rm; + FAR struct romfs_file_s *rf; + int ret; fvdbg("Open '%s'\n", relpath); @@ -150,11 +161,11 @@ static int romfs_open(FAR struct file *filep, const char *relpath, DEBUGASSERT(filep->f_priv == NULL && filep->f_inode != NULL); - /* mountpoint private data from the inode reference from the file + /* Get mountpoint private data from the inode reference from the file * structure */ - rm = (struct romfs_mountpt_s*)filep->f_inode->i_private; + rm = (FAR struct romfs_mountpt_s*)filep->f_inode->i_private; DEBUGASSERT(rm != NULL); @@ -214,7 +225,7 @@ static int romfs_open(FAR struct file *filep, const char *relpath, * file. */ - rf = (struct romfs_file_s *)zalloc(sizeof(struct romfs_file_s)); + rf = (FAR struct romfs_file_s *)zalloc(sizeof(struct romfs_file_s)); if (!rf) { fdbg("Failed to allocate private data\n", ret); @@ -226,8 +237,7 @@ static int romfs_open(FAR struct file *filep, const char *relpath, * non-zero elements) */ - rf->rf_open = true; - rf->rf_size = dirinfo.rd_size; + rf->rf_size = dirinfo.rd_size; /* Get the start of the file data */ @@ -277,9 +287,9 @@ errout_with_semaphore: static int romfs_close(FAR struct file *filep) { - struct romfs_mountpt_s *rm; - struct romfs_file_s *rf; - int ret = OK; + FAR struct romfs_mountpt_s *rm; + FAR struct romfs_file_s *rf; + int ret = OK; fvdbg("Closing\n"); @@ -321,19 +331,20 @@ static int romfs_close(FAR struct file *filep) * Name: romfs_read ****************************************************************************/ -static ssize_t romfs_read(FAR struct file *filep, char *buffer, size_t buflen) +static ssize_t romfs_read(FAR struct file *filep, FAR char *buffer, + size_t buflen) { - struct romfs_mountpt_s *rm; - struct romfs_file_s *rf; - unsigned int bytesread; - unsigned int readsize; - unsigned int nsectors; - uint32_t offset; - size_t bytesleft; - off_t sector; - uint8_t *userbuffer = (uint8_t*)buffer; - int sectorndx; - int ret; + FAR struct romfs_mountpt_s *rm; + FAR struct romfs_file_s *rf; + unsigned int bytesread; + unsigned int readsize; + unsigned int nsectors; + uint32_t offset; + size_t bytesleft; + off_t sector; + FAR uint8_t *userbuffer = (FAR uint8_t*)buffer; + int sectorndx; + int ret; fvdbg("Read %d bytes from offset %d\n", buflen, filep->f_pos); @@ -467,10 +478,10 @@ errout_with_semaphore: static off_t romfs_seek(FAR struct file *filep, off_t offset, int whence) { - struct romfs_mountpt_s *rm; - struct romfs_file_s *rf; - off_t position; - int ret; + FAR struct romfs_mountpt_s *rm; + FAR struct romfs_file_s *rf; + off_t position; + int ret; fvdbg("Seek to offset: %d whence: %d\n", offset, whence); @@ -548,9 +559,9 @@ errout_with_semaphore: static int romfs_ioctl(FAR struct file *filep, int cmd, unsigned long arg) { - struct romfs_mountpt_s *rm; - struct romfs_file_s *rf; - FAR void **ppv = (FAR void**)arg; + FAR struct romfs_mountpt_s *rm; + FAR struct romfs_file_s *rf; + FAR void **ppv = (FAR void**)arg; fvdbg("cmd: %d arg: %08lx\n", cmd, arg); @@ -581,6 +592,95 @@ static int romfs_ioctl(FAR struct file *filep, int cmd, unsigned long arg) return -ENOTTY; } +/**************************************************************************** + * Name: romfs_dup + ****************************************************************************/ + +static int romfs_dup(FAR const struct file *oldp, FAR struct file *newp) +{ + FAR struct romfs_mountpt_s *rm; + FAR struct romfs_file_s *oldrf; + FAR struct romfs_file_s *newrf; + int ret; + + fvdbg("Dup %p->%p\n", oldp, newp); + + /* Sanity checks */ + + DEBUGASSERT(oldp->f_priv != NULL && + newp->f_priv == NULL && + newp->f_inode != NULL); + + /* Get mountpoint private data from the inode reference from the file + * structure + */ + + rm = (FAR struct romfs_mountpt_s*)newp->f_inode->i_private; + DEBUGASSERT(rm != NULL); + + /* Check if the mount is still healthy */ + + romfs_semtake(rm); + ret = romfs_checkmount(rm); + if (ret != OK) + { + fdbg("romfs_checkmount failed: %d\n", ret); + goto errout_with_semaphore; + } + + /* Recover the old private data from the old struct file instance */ + + oldrf = oldp->f_priv; + + /* Create an new instance of the file private data to describe the new + * dup'ed file. + */ + + newrf = (FAR struct romfs_file_s *)malloc(sizeof(struct romfs_file_s)); + if (!newrf) + { + fdbg("Failed to allocate private data\n", ret); + ret = -ENOMEM; + goto errout_with_semaphore; + } + + /* Copy all file private data (except for the buffer) */ + + newrf->rf_startoffset = oldrf->rf_startoffset; + newrf->rf_size = oldrf->rf_size; + + /* Configure buffering to support access to this file */ + + ret = romfs_fileconfigure(rm, newrf); + if (ret < 0) + { + fdbg("Failed configure buffering: %d\n", ret); + goto errout_with_semaphore; + } + + /* Attach the new private date to the new struct file instance */ + + newp->f_priv = newrf; + + /* Then insert the new instance into the mountpoint structure. + * It needs to be there (1) to handle error conditions that effect + * all files, and (2) to inform the umount logic that we are busy + * (but a simple reference count could have done that). + */ + + newrf->rf_next = rm->rm_head; + rm->rm_head = newrf->rf_next; + + romfs_semgive(rm); + return OK; + + /* Error exits */ + +errout_with_semaphore: + romfs_semgive(rm); + return ret; +} + /**************************************************************************** * Name: romfs_opendir * @@ -589,12 +689,12 @@ static int romfs_ioctl(FAR struct file *filep, int cmd, unsigned long arg) * ****************************************************************************/ -static int romfs_opendir(struct inode *mountpt, const char *relpath, - struct fs_dirent_s *dir) +static int romfs_opendir(FAR struct inode *mountpt, FAR const char *relpath, + FAR struct fs_dirent_s *dir) { - struct romfs_mountpt_s *rm; - struct romfs_dirinfo_s dirinfo; - int ret; + FAR struct romfs_mountpt_s *rm; + FAR struct romfs_dirinfo_s dirinfo; + int ret; fvdbg("relpath: '%s'\n", relpath); @@ -654,14 +754,15 @@ errout_with_semaphore: * ****************************************************************************/ -static int romfs_readdir(struct inode *mountpt, struct fs_dirent_s *dir) +static int romfs_readdir(FAR struct inode *mountpt, + FAR struct fs_dirent_s *dir) { - struct romfs_mountpt_s *rm; - uint32_t linkoffset; - uint32_t next; - uint32_t info; - uint32_t size; - int ret; + FAR struct romfs_mountpt_s *rm; + uint32_t linkoffset; + uint32_t next; + uint32_t info; + uint32_t size; + int ret; fvdbg("Entry\n"); @@ -749,9 +850,10 @@ errout_with_semaphore: * ****************************************************************************/ -static int romfs_rewinddir(struct inode *mountpt, struct fs_dirent_s *dir) +static int romfs_rewinddir(FAR struct inode *mountpt, + FAR struct fs_dirent_s *dir) { - struct romfs_mountpt_s *rm; + FAR struct romfs_mountpt_s *rm; int ret; fvdbg("Entry\n"); @@ -788,8 +890,8 @@ static int romfs_rewinddir(struct inode *mountpt, struct fs_dirent_s *dir) * ****************************************************************************/ -static int romfs_bind(FAR struct inode *blkdriver, const void *data, - void **handle) +static int romfs_bind(FAR struct inode *blkdriver, FAR const void *data, + FAR void **handle) { struct romfs_mountpt_s *rm; int ret; @@ -813,7 +915,7 @@ static int romfs_bind(FAR struct inode *blkdriver, const void *data, /* Create an instance of the mountpt state structure */ - rm = (struct romfs_mountpt_s *)zalloc(sizeof(struct romfs_mountpt_s)); + rm = (FAR struct romfs_mountpt_s *)zalloc(sizeof(struct romfs_mountpt_s)); if (!rm) { fdbg("Failed to allocate mountpoint structure\n"); @@ -874,9 +976,9 @@ errout_with_sem: * ****************************************************************************/ -static int romfs_unbind(void *handle, FAR struct inode **blkdriver) +static int romfs_unbind(FAR void *handle, FAR struct inode **blkdriver) { - struct romfs_mountpt_s *rm = (struct romfs_mountpt_s*)handle; + FAR struct romfs_mountpt_s *rm = (FAR struct romfs_mountpt_s*)handle; int ret; fvdbg("Entry\n"); @@ -948,10 +1050,10 @@ static int romfs_unbind(void *handle, FAR struct inode **blkdriver) * ****************************************************************************/ -static int romfs_statfs(struct inode *mountpt, struct statfs *buf) +static int romfs_statfs(FAR struct inode *mountpt, FAR struct statfs *buf) { - struct romfs_mountpt_s *rm; - int ret; + FAR struct romfs_mountpt_s *rm; + int ret; fvdbg("Entry\n"); @@ -1004,11 +1106,12 @@ errout_with_semaphore: * ****************************************************************************/ -static int romfs_stat(struct inode *mountpt, const char *relpath, struct stat *buf) +static int romfs_stat(FAR struct inode *mountpt, FAR const char *relpath, + FAR struct stat *buf) { - struct romfs_mountpt_s *rm; - struct romfs_dirinfo_s dirinfo; - int ret; + FAR struct romfs_mountpt_s *rm; + FAR struct romfs_dirinfo_s dirinfo; + int ret; fvdbg("Entry\n"); diff --git a/nuttx/fs/romfs/fs_romfs.h b/nuttx/fs/romfs/fs_romfs.h index 4081517fb8..6a337d2c5c 100644 --- a/nuttx/fs/romfs/fs_romfs.h +++ b/nuttx/fs/romfs/fs_romfs.h @@ -159,7 +159,6 @@ struct romfs_mountpt_s struct romfs_file_s { struct romfs_file_s *rf_next; /* Retained in a singly linked list */ - bool rf_open; /* true: The file is (still) open */ uint32_t rf_startoffset; /* Offset to the start of the file data */ uint32_t rf_size; /* Size of the file in bytes */ uint32_t rf_cachesector; /* Current sector in the rf_buffer */ diff --git a/nuttx/fs/romfs/fs_romfsutil.c b/nuttx/fs/romfs/fs_romfsutil.c index 6ea114b5e1..4857fb6d33 100644 --- a/nuttx/fs/romfs/fs_romfsutil.c +++ b/nuttx/fs/romfs/fs_romfsutil.c @@ -613,7 +613,7 @@ int romfs_fsconfigure(struct romfs_mountpt_s *rm) } /**************************************************************************** - * Name: romfs_ffileconfigure + * Name: romfs_fileconfigure * * Desciption: * This function is called as part of the ROMFS file open operation It @@ -649,6 +649,7 @@ int romfs_fileconfigure(struct romfs_mountpt_s *rm, struct romfs_file_s *rf) return -ENOMEM; } } + return OK; } @@ -663,7 +664,6 @@ int romfs_fileconfigure(struct romfs_mountpt_s *rm, struct romfs_file_s *rf) int romfs_checkmount(struct romfs_mountpt_s *rm) { - struct romfs_file_s *file; struct inode *inode; struct geometry geo; int ret; @@ -692,14 +692,8 @@ int romfs_checkmount(struct romfs_mountpt_s *rm) /* If we get here, the mount is NOT healthy */ rm->rm_mounted = false; - - /* Make sure that this is flagged in every opened file */ - - for (file = rm->rm_head; file; file = file->rf_next) - { - file->rf_open = false; - } } + return -ENODEV; } diff --git a/nuttx/include/nuttx/fs/fs.h b/nuttx/include/nuttx/fs/fs.h index 1759310bc2..3138a8412c 100644 --- a/nuttx/include/nuttx/fs/fs.h +++ b/nuttx/include/nuttx/fs/fs.h @@ -161,6 +161,7 @@ struct mountpt_operations */ int (*sync)(FAR struct file *filp); + int (*dup)(FAR const struct file *oldp, FAR struct file *newp); /* Directory operations */ diff --git a/nuttx/include/unistd.h b/nuttx/include/unistd.h index c5289624bd..46eb14cddf 100644 --- a/nuttx/include/unistd.h +++ b/nuttx/include/unistd.h @@ -169,7 +169,7 @@ EXTERN int execv(FAR const char *path, FAR char *const argv[]); /* Non-standard functions to manage symbol tables */ struct symtab_s; /* See include/nuttx/binfmt/symtab.h */ -EXTERN void exec_getsymtab(FAR struct symtab_s **symtab, FAR int *nsymbols); +EXTERN void exec_getsymtab(FAR const struct symtab_s **symtab, FAR int *nsymbols); EXTERN void exec_setsymtab(FAR const struct symtab_s *symtab, int nsymbols); #endif diff --git a/nuttx/libc/spawn/lib_ps.c b/nuttx/libc/spawn/lib_ps.c index dfe57089e2..638b27f871 100644 --- a/nuttx/libc/spawn/lib_ps.c +++ b/nuttx/libc/spawn/lib_ps.c @@ -70,8 +70,6 @@ struct spawn_parms_s * Public Data ****************************************************************************/ -extern struct symtab_s CONFIG_EXECFUNCS_SYMTAB; - /**************************************************************************** * Private Data ****************************************************************************/ @@ -157,7 +155,7 @@ static int ps_exec(FAR pid_t *pidp, FAR const char *path, FAR char *const argv[]) { struct sched_param param; - FAR struct symtab_s *symtab; + FAR const struct symtab_s *symtab; int nsymbols; int pid; int ret = OK; diff --git a/nuttx/libc/unistd/lib_execsymtab.c b/nuttx/libc/unistd/lib_execsymtab.c index 7abb2d74e9..34b798bb4a 100644 --- a/nuttx/libc/unistd/lib_execsymtab.c +++ b/nuttx/libc/unistd/lib_execsymtab.c @@ -69,13 +69,13 @@ * Public Variables ****************************************************************************/ -extern struct symtab_s CONFIG_EXECFUNCS_SYMTAB; +extern const struct symtab_s CONFIG_EXECFUNCS_SYMTAB; /**************************************************************************** * Private Data ****************************************************************************/ -static FAR struct symtab_s *g_exec_symtab = &CONFIG_EXECFUNCS_SYMTAB; +static FAR const struct symtab_s *g_exec_symtab = &CONFIG_EXECFUNCS_SYMTAB; static int g_exec_nsymbols = CONFIG_EXECFUNCS_NSYMBOLS; /**************************************************************************** @@ -97,7 +97,7 @@ static int g_exec_nsymbols = CONFIG_EXECFUNCS_NSYMBOLS; * ****************************************************************************/ -void exec_getsymtab(FAR struct symtab_s **symtab, FAR int *nsymbols) +void exec_getsymtab(FAR const struct symtab_s **symtab, FAR int *nsymbols) { irqstate_t flags; diff --git a/nuttx/libc/unistd/lib_execv.c b/nuttx/libc/unistd/lib_execv.c index e35138be5e..48b0899137 100644 --- a/nuttx/libc/unistd/lib_execv.c +++ b/nuttx/libc/unistd/lib_execv.c @@ -119,7 +119,7 @@ int execv(FAR const char *path, FAR char *const argv[]) { - FAR struct symtab_s *symtab; + FAR const struct symtab_s *symtab; int nsymbols; int ret; @@ -148,4 +148,4 @@ int execv(FAR const char *path, FAR char *const argv[]) return ERROR; } -#endif /* CONFIG_LIBC_EXECFUNCS */ \ No newline at end of file +#endif /* CONFIG_LIBC_EXECFUNCS */ From cc3614dfe8f67033dca8c7c1f40c3367a0d3ca06 Mon Sep 17 00:00:00 2001 From: patacongo Date: Mon, 14 Jan 2013 19:22:32 +0000 Subject: [PATCH 070/118] Finish dup logic for open files; fix bug in sigtimedwait(), would return wrong signo value if the signal was already pending git-svn-id: http://svn.code.sf.net/p/nuttx/code/trunk@5517 42af7a65-404d-4744-a932-0658087f49c3 --- apps/builtin/Kconfig | 15 ++++ apps/builtin/binfs.c | 37 ++++++++- nuttx/ChangeLog | 9 +++ nuttx/TODO | 24 +----- nuttx/fs/fat/fs_fat32.c | 126 +++++++++++++++++++++++++++++- nuttx/fs/fat/fs_fat32.h | 1 - nuttx/fs/fat/fs_fat32util.c | 10 +-- nuttx/fs/nfs/nfs_node.h | 3 +- nuttx/fs/nfs/nfs_util.c | 9 +-- nuttx/fs/nfs/nfs_vfsops.c | 106 ++++++++++++++++++++++--- nuttx/fs/nfs/rpc_clnt.c | 28 +++---- nuttx/fs/nxffs/nxffs.h | 41 +++++----- nuttx/fs/nxffs/nxffs_initialize.c | 4 +- nuttx/fs/nxffs/nxffs_open.c | 62 ++++++++++++++- nuttx/fs/romfs/fs_romfs.c | 2 +- nuttx/include/nuttx/fs/fs.h | 2 +- nuttx/sched/mq_initialize.c | 4 +- nuttx/sched/sig_timedwait.c | 2 +- nuttx/sched/task_vfork.c | 2 +- 19 files changed, 384 insertions(+), 103 deletions(-) diff --git a/apps/builtin/Kconfig b/apps/builtin/Kconfig index 8310e6df9b..5b262734d5 100644 --- a/apps/builtin/Kconfig +++ b/apps/builtin/Kconfig @@ -12,4 +12,19 @@ config BUILTIN to support built-in applications in the NuttShell (NSH). if BUILTIN + + config APPS_BINDIR + bool "BINFS File System" + default n + ---help--- + The BINFS file system is current just a toy. The BINFS may, for example, + be mount at /bin. Then all of the built-in applications will appear as + executable file in /bin if you list them from NSH like: + + nsh> ls -l /bin + + At present, the BINFS supports nothing more than that. It is planned, + however, to support execution of the builtin applications from BINFS as + well (via a binfmt/ loader). However, that is down the road. + endif diff --git a/apps/builtin/binfs.c b/apps/builtin/binfs.c index 4159c96630..365021c7f8 100644 --- a/apps/builtin/binfs.c +++ b/apps/builtin/binfs.c @@ -85,6 +85,8 @@ static int binfs_close(FAR struct file *filep); static ssize_t binfs_read(FAR struct file *filep, char *buffer, size_t buflen); static int binfs_ioctl(FAR struct file *filep, int cmd, unsigned long arg); +static int binfs_dup(FAR const struct file *oldp, FAR struct file *newp); + static int binfs_opendir(struct inode *mountpt, const char *relpath, struct fs_dirent_s *dir); static int binfs_readdir(struct inode *mountpt, struct fs_dirent_s *dir); @@ -120,7 +122,7 @@ const struct mountpt_operations binfs_operations = binfs_ioctl, /* ioctl */ NULL, /* sync */ - NULL, /* dup */ + binfs_dup, /* dup */ binfs_opendir, /* opendir */ NULL, /* closedir */ @@ -296,6 +298,39 @@ static int binfs_ioctl(FAR struct file *filep, int cmd, unsigned long arg) return -ENOTTY; } +/**************************************************************************** + * Name: binfs_dup + * + * Description: + * Duplicate open file data in the new file structure. + * + ****************************************************************************/ + +static int binfs_dup(FAR const struct file *oldp, FAR struct file *newp) +{ + struct binfs_state_s *bm; + int ret = -ENOSYS; + + fvdbg("Dup %p->%p\n", oldp, newp); + + /* Sanity checks */ + + DEBUGASSERT(oldp->f_priv == NULL && oldp->f_inode != NULL); + + /* mountpoint private data from the inode reference from the file + * structure + */ + + bm = (struct binfs_state_s*)oldp->f_inode->i_private; + DEBUGASSERT(bm != NULL); + + /* Opening of elements within the pseudo-file system is not yet supported + * and, hence, neither is dup'ing the opened file. + */ + + return ret; +} + /**************************************************************************** * Name: binfs_opendir * diff --git a/nuttx/ChangeLog b/nuttx/ChangeLog index cb0244e204..4ba0fe985f 100644 --- a/nuttx/ChangeLog +++ b/nuttx/ChangeLog @@ -3940,3 +3940,12 @@ implemented). * fs/romfs: Remove the rf_open flag. It looks good, but actually does nothing. + * fs/fat: Remove the ff_open flag. Same story as for the ROMFS + rf_open flag. + * fs/fat/fs_fat32.c, fs/nxffs/nxffs_initialize, and + fs/nfs/nfs_vfsops.c: Completed implementation of the dup() methods. + There is still no good test available. + * sched/sig_timedwait.c: sigtimedwait() would return a bad signal + number if the signal was already pending when the function was + called. + called. diff --git a/nuttx/TODO b/nuttx/TODO index 28a9ce68b8..0d02e10e6c 100644 --- a/nuttx/TODO +++ b/nuttx/TODO @@ -1,4 +1,4 @@ -NuttX TODO List (Last updated January 13, 2013) +NuttX TODO List (Last updated January 14, 2013) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ This file summarizes known NuttX bugs, limitations, inconsistencies with @@ -15,7 +15,7 @@ nuttx/ (17) Network (net/, drivers/net) (4) USB (drivers/usbdev, drivers/usbhost) (12) Libraries (libc/, ) - (10) File system/Generic drivers (fs/, drivers/) + (9) File system/Generic drivers (fs/, drivers/) (5) Graphics subystem (graphics/) (1) Pascal add-on (pcode/) (1) Documentation (Documentation/) @@ -879,26 +879,6 @@ o File system / Generic drivers (fs/, drivers/) Status: Open Priority: Medium - Title: dup AND dup2 WILL NOT WORK ON FILES IN A MOUNTED VOLUME - Description: The current implementation of dup() and dup2() will only - work with open device drivers and sockets. It will not - work with open files in a file system. Support for dup'ing - open files on a mounted volume has not been implemented yet. - - There is a stubbed out, partial implemenation in fs/fs_files.c. - In would perform the dup2() operation by re-opening the file - and setting the file pointer. The logic, however, would require - that we remember the (relative) path to the file in the mounted - volume for each open file. - - An option might to add a dup() method to the file system - mountpoint interface. - - A limitation that results from this is that you cannot - redirect I/O to an from and file. - Status: Open - Priority: High - o Graphics subystem (graphics/) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/nuttx/fs/fat/fs_fat32.c b/nuttx/fs/fat/fs_fat32.c index 788e6bebc7..7164a9f8fb 100644 --- a/nuttx/fs/fat/fs_fat32.c +++ b/nuttx/fs/fat/fs_fat32.c @@ -1,7 +1,7 @@ /**************************************************************************** * fs/fat/fs_fat32.c * - * Copyright (C) 2007-2009, 2011-2012 Gregory Nutt. All rights reserved. + * Copyright (C) 2007-2009, 2011-2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * References: @@ -86,7 +86,9 @@ static ssize_t fat_write(FAR struct file *filep, const char *buffer, size_t buflen); static off_t fat_seek(FAR struct file *filep, off_t offset, int whence); static int fat_ioctl(FAR struct file *filep, int cmd, unsigned long arg); + static int fat_sync(FAR struct file *filep); +static int fat_dup(FAR const struct file *oldp, FAR struct file *newp); static int fat_opendir(struct inode *mountpt, const char *relpath, struct fs_dirent_s *dir); @@ -129,7 +131,7 @@ const struct mountpt_operations fat_operations = fat_ioctl, /* ioctl */ fat_sync, /* sync */ - NULL, /* dup */ + fat_dup, /* dup */ fat_opendir, /* opendir */ NULL, /* closedir */ @@ -313,7 +315,6 @@ static int fat_open(FAR struct file *filep, const char *relpath, /* Initialize the file private data (only need to initialize non-zero elements) */ - ff->ff_open = true; ff->ff_oflags = oflags; /* Save information that can be used later to recover the directory entry */ @@ -898,6 +899,7 @@ static off_t fat_seek(FAR struct file *filep, off_t offset, int whence) DEBUGASSERT(fs != NULL); /* Map the offset according to the whence option */ + switch (whence) { case SEEK_SET: /* The offset is set to offset bytes. */ @@ -971,6 +973,7 @@ static off_t fat_seek(FAR struct file *filep, off_t offset, int whence) ret = cluster; goto errout_with_semaphore; } + ff->ff_startcluster = cluster; } @@ -1232,6 +1235,123 @@ errout_with_semaphore: return ret; } +/**************************************************************************** + * Name: fat_dup + * + * Description: Duplicate open file data in the new file structure. + * + ****************************************************************************/ + +static int fat_dup(FAR const struct file *oldp, FAR struct file *newp) +{ + FAR struct fat_mountpt_s *fs; + FAR struct fat_file_s *oldff; + FAR struct fat_file_s *newff; + int ret; + + fvdbg("Dup %p->%p\n", oldp, newp); + + /* Sanity checks */ + + DEBUGASSERT(oldp->f_priv != NULL && + newp->f_priv == NULL && + newp->f_inode != NULL); + + /* Recover our private data from the struct file instance */ + + fs = (struct fat_mountpt_s *)oldp->f_inode->i_private; + DEBUGASSERT(fs != NULL); + + /* Check if the mount is still healthy */ + + fat_semtake(fs); + ret = fat_checkmount(fs); + if (ret != OK) + { + goto errout_with_semaphore; + } + + /* Recover the old private data from the old struct file instance */ + + oldff = oldp->f_priv; + + /* Create a new instance of the file private date to describe the + * dup'ed file. + */ + + newff = (struct fat_file_s *)kmalloc(sizeof(struct fat_file_s)); + if (!newff) + { + ret = -ENOMEM; + goto errout_with_semaphore; + } + + /* Create a file buffer to support partial sector accesses */ + + newff->ff_buffer = (uint8_t*)fat_io_alloc(fs->fs_hwsectorsize); + if (!newff->ff_buffer) + { + ret = -ENOMEM; + goto errout_with_struct; + } + + /* Copy the rest of the open open file state from the old file structure. + * There are some assumptions and potential issues here: + * + * 1) We assume that the higher level logic has copied the elements of + * the file structure, in particular, the file position. + * 2) There is a problem with ff_size if there are multiple opened + * file structures, each believing they know the size of the file. + * If one instance modifies the file length, then the new size of + * the opened file will be unknown to the other. That is a lurking + * bug! + * + * One good solution to this might be to add a refernce count to the + * file structure. Then, instead of dup'ing the whole structure + * as is done here, just increment the reference count on the + * structure. The would have to be integrated with open logic as + * well, however, so that the same file structure is re-used if the + * file is re-opened. + */ + + newff->ff_bflags = 0; + newff->ff_oflags = oldff->ff_oflags; + newff->ff_sectorsincluster = oldff->ff_sectorsincluster; + newff->ff_dirindex = oldff->ff_dirindex; + newff->ff_currentcluster = oldff->ff_currentcluster; + newff->ff_dirsector = oldff->ff_dirsector; + newff->ff_size = oldff->ff_size; + newff->ff_currentsector = 0; + newff->ff_cachesector = 0; + + /* Attach the private date to the struct file instance */ + + newp->f_priv = newff; + + /* Then insert the new instance into the mountpoint structure. + * It needs to be there (1) to handle error conditions that effect + * all files, and (2) to inform the umount logic that we are busy + * (but a simple reference count could have done that). + */ + + newff->ff_next = fs->fs_head; + fs->fs_head = newff->ff_next; + + fat_semgive(fs); + return OK; + + /* Error exits -- goto's are nasty things, but they sure can make error + * handling a lot simpler. + */ + +errout_with_struct: + kfree(newff); + +errout_with_semaphore: + fat_semgive(fs); + return ret; +} + /**************************************************************************** * Name: fat_opendir * diff --git a/nuttx/fs/fat/fs_fat32.h b/nuttx/fs/fat/fs_fat32.h index 71a21333ba..81f3f46758 100644 --- a/nuttx/fs/fat/fs_fat32.h +++ b/nuttx/fs/fat/fs_fat32.h @@ -752,7 +752,6 @@ struct fat_mountpt_s struct fat_file_s { struct fat_file_s *ff_next; /* Retained in a singly linked list */ - bool ff_open; /* true: The file is (still) open */ uint8_t ff_bflags; /* The file buffer flags */ uint8_t ff_oflags; /* Flags provided when file was opened */ uint8_t ff_sectorsincluster; /* Sectors remaining in cluster */ diff --git a/nuttx/fs/fat/fs_fat32util.c b/nuttx/fs/fat/fs_fat32util.c index 7231456d74..9aa1d39924 100644 --- a/nuttx/fs/fat/fs_fat32util.c +++ b/nuttx/fs/fat/fs_fat32util.c @@ -692,8 +692,6 @@ int fat_checkmount(struct fat_mountpt_s *fs) if (fs && fs->fs_mounted) { - struct fat_file_s *file; - /* We still think the mount is healthy. Check an see if this is * still the case */ @@ -715,14 +713,8 @@ int fat_checkmount(struct fat_mountpt_s *fs) /* If we get here, the mount is NOT healthy */ fs->fs_mounted = false; - - /* Make sure that this is flagged in every opened file */ - - for (file = fs->fs_head; file; file = file->ff_next) - { - file->ff_open = false; - } } + return -ENODEV; } diff --git a/nuttx/fs/nfs/nfs_node.h b/nuttx/fs/nfs/nfs_node.h index 4ae9e162c2..408bd1993e 100644 --- a/nuttx/fs/nfs/nfs_node.h +++ b/nuttx/fs/nfs/nfs_node.h @@ -1,7 +1,7 @@ /**************************************************************************** * fs/nfs/nfs_node.h * - * Copyright (C) 2012 Gregory Nutt. All rights reserved. + * Copyright (C) 2012-2013 Gregory Nutt. All rights reserved. * Copyright (C) 2012 Jose Pablo Rojas Vargas. All rights reserved. * Author: Jose Pablo Rojas Vargas * Gregory Nutt @@ -70,6 +70,7 @@ struct nfsnode { struct nfsnode *n_next; /* Retained in a singly linked list. */ + uint8_t n_crefs; /* Reference count (for nfs_dup) */ uint8_t n_type; /* File type */ uint8_t n_fhsize; /* Size in bytes of the file handle */ uint8_t n_flags; /* Node flags */ diff --git a/nuttx/fs/nfs/nfs_util.c b/nuttx/fs/nfs/nfs_util.c index 73fda72a7d..e7d28b3d73 100644 --- a/nuttx/fs/nfs/nfs_util.c +++ b/nuttx/fs/nfs/nfs_util.c @@ -1,7 +1,7 @@ /**************************************************************************** * fs/nfs/nfs_util.c * - * Copyright (C) 2012 Gregory Nutt. All rights reserved. + * Copyright (C) 2012-2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -213,7 +213,6 @@ int nfs_request(struct nfsmount *nmp, int procnum, { struct rpcclnt *clnt = nmp->nm_rpcclnt; struct nfs_reply_header replyh; - int trylater_delay; int error; tryagain: @@ -250,12 +249,6 @@ tryagain: if (error == EAGAIN) { error = 0; - trylater_delay *= NFS_TIMEOUTMUL; - if (trylater_delay > NFS_MAXTIMEO) - { - trylater_delay = NFS_MAXTIMEO; - } - goto tryagain; } diff --git a/nuttx/fs/nfs/nfs_vfsops.c b/nuttx/fs/nfs/nfs_vfsops.c index efb026c7f7..01e999ac84 100644 --- a/nuttx/fs/nfs/nfs_vfsops.c +++ b/nuttx/fs/nfs/nfs_vfsops.c @@ -1,7 +1,7 @@ /**************************************************************************** * fs/nfs/nfs_vfsops.c * - * Copyright (C) 2012 Gregory Nutt. All rights reserved. + * Copyright (C) 2012-2013 Gregory Nutt. All rights reserved. * Copyright (C) 2012 Jose Pablo Rojas Vargas. All rights reserved. * Author: Jose Pablo Rojas Vargas * Gregory Nutt @@ -133,6 +133,7 @@ static int nfs_close(FAR struct file *filep); static ssize_t nfs_read(FAR struct file *filep, char *buffer, size_t buflen); static ssize_t nfs_write(FAR struct file *filep, const char *buffer, size_t buflen); +static int nfs_dup(FAR const struct file *oldp, FAR struct file *newp); static int nfs_opendir(struct inode *mountpt, const char *relpath, struct fs_dirent_s *dir); static int nfs_readdir(struct inode *mountpt, struct fs_dirent_s *dir); @@ -168,7 +169,7 @@ const struct mountpt_operations nfs_operations = NULL, /* ioctl */ NULL, /* sync */ - NULL, /* dup */ + nfs_dup, /* dup */ nfs_opendir, /* opendir */ NULL, /* closedir */ @@ -359,7 +360,7 @@ static int nfs_filecreate(FAR struct nfsmount *nmp, struct nfsnode *np, /* Save the attributes in the file data structure */ - tmp = *ptr++; /* handle_follows */ + tmp = *ptr; /* handle_follows */ if (!tmp) { fdbg("WARNING: no file attributes\n"); @@ -369,7 +370,6 @@ static int nfs_filecreate(FAR struct nfsmount *nmp, struct nfsnode *np, /* Initialize the file attributes */ nfs_attrupdate(np, (FAR struct nfs_fattr *)ptr); - ptr += uint32_increment(sizeof(struct nfs_fattr)); } /* Any following dir_wcc data is ignored for now */ @@ -412,7 +412,7 @@ static int nfs_filetruncate(FAR struct nfsmount *nmp, struct nfsnode *np) reqlen += (int)np->n_fhsize; ptr += uint32_increment(np->n_fhsize); - /* Copy the variable-length attribtes */ + /* Copy the variable-length attributes */ *ptr++ = nfs_false; /* Don't change mode */ *ptr++ = nfs_false; /* Don't change uid */ @@ -423,7 +423,7 @@ static int nfs_filetruncate(FAR struct nfsmount *nmp, struct nfsnode *np) *ptr++ = HTONL(NFSV3SATTRTIME_TOSERVER); /* Use the server's time */ *ptr++ = HTONL(NFSV3SATTRTIME_TOSERVER); /* Use the server's time */ *ptr++ = nfs_false; /* No guard value */ - reqlen += 9*sizeof(uint32_t) + reqlen += 9 * sizeof(uint32_t); /* Perform the SETATTR RPC */ @@ -553,9 +553,9 @@ static int nfs_fileopen(FAR struct nfsmount *nmp, struct nfsnode *np, static int nfs_open(FAR struct file *filep, FAR const char *relpath, int oflags, mode_t mode) { - struct nfsmount *nmp; - struct nfsnode *np = NULL; - int error; + struct nfsmount *nmp; + struct nfsnode *np; + int error; /* Sanity checks */ @@ -634,6 +634,8 @@ static int nfs_open(FAR struct file *filep, FAR const char *relpath, * non-zero elements) */ + np->n_crefs = 1; + /* Attach the private data to the struct file instance */ filep->f_priv = np; @@ -656,6 +658,7 @@ errout_with_semaphore: { kfree(np); } + nfs_semgive(nmp); return -error; } @@ -693,8 +696,22 @@ static int nfs_close(FAR struct file *filep) nfs_semtake(nmp); - /* Find our file structure in the list of file structures containted in the - * mount structure. + /* Decrement the reference count. If the reference count would not + * decrement to zero, then that is all we have to do. + */ + + if (np->n_crefs > 1) + { + np->n_crefs--; + nfs_semgive(nmp); + return OK; + } + + /* There are no more references to the file structure. Now we need to + * free up all resources associated with the open file. + * + * First, find our file structure in the list of file structures + * containted in the mount structure. */ for (prev = NULL, curr = nmp->nm_head; curr; prev = curr, curr = curr->n_next) @@ -759,8 +776,8 @@ static ssize_t nfs_read(FAR struct file *filep, char *buffer, size_t buflen) /* Recover our private data from the struct file instance */ - nmp = (struct nfsmount*) filep->f_inode->i_private; - np = (struct nfsnode*) filep->f_priv; + nmp = (struct nfsmount*)filep->f_inode->i_private; + np = (struct nfsnode*)filep->f_priv; DEBUGASSERT(nmp != NULL); @@ -1093,6 +1110,66 @@ errout_with_semaphore: return -error; } +/**************************************************************************** + * Name: binfs_dup + * + * Description: + * Duplicate open file data in the new file structure. + * + ****************************************************************************/ + +static int nfs_dup(FAR const struct file *oldp, FAR struct file *newp) +{ + struct nfsmount *nmp; + FAR struct nfsnode *np; + int error; + + fvdbg("Dup %p->%p\n", oldp, newp); + + /* Sanity checks */ + + DEBUGASSERT(oldp->f_priv != NULL && oldp->f_inode != NULL); + + /* Recover our private data from the struct file instance */ + + nmp = (struct nfsmount*)oldp->f_inode->i_private; + np = (struct nfsnode*)oldp->f_priv; + + DEBUGASSERT(nmp != NULL); + + /* Check if the mount is still healthy */ + + nfs_semtake(nmp); + error = nfs_checkmount(nmp); + if (error != OK) + { + fdbg("ERROR: nfs_checkmount failed: %d\n", error); + nfs_semgive(nmp); + return -error; + } + + /* Increment the reference count on the NFS node structure */ + + DEBUGASSERT(np->n_crefs < 0xff); + np->n_crefs++; + + /* And save this as the file data for the new node */ + + newp->f_priv = np; + + /* Then insert the new instance at the head of the list in the mountpoint + * tructure. It needs to be there (1) to handle error conditions that effect + * all files, and (2) to inform the umount logic that we are busy. We + * cannot unmount the file system if this list is not empty! + */ + + np->n_next = nmp->nm_head; + nmp->nm_head = np; + + nfs_semgive(nmp); + return OK; +} + /**************************************************************************** * Name: nfs_opendir * @@ -1756,12 +1833,15 @@ bad: { kfree(nmp->nm_so); } + if (nmp->nm_rpcclnt) { kfree(nmp->nm_rpcclnt); } + kfree(nmp); } + return error; } diff --git a/nuttx/fs/nfs/rpc_clnt.c b/nuttx/fs/nfs/rpc_clnt.c index 0e2a394bad..9c2ada4f29 100644 --- a/nuttx/fs/nfs/rpc_clnt.c +++ b/nuttx/fs/nfs/rpc_clnt.c @@ -1,7 +1,7 @@ /**************************************************************************** * fs/nfs/rpc_clnt.c * - * Copyright (C) 2012 Gregory Nutt. All rights reserved. + * Copyright (C) 2012-2013 Gregory Nutt. All rights reserved. * Copyright (C) 2012 Jose Pablo Rojas Vargas. All rights reserved. * Author: Jose Pablo Rojas Vargas * Gregory Nutt @@ -224,8 +224,6 @@ static int rpcclnt_receive(FAR struct rpcclnt *rpc, FAR struct sockaddr *aname, static int rpcclnt_reply(FAR struct rpcclnt *rpc, int procid, int prog, FAR void *reply, size_t resplen) { - FAR struct rpc_reply_header *replyheader; - uint32_t rxid; int error; /* Get the next RPC reply from the socket */ @@ -235,22 +233,22 @@ static int rpcclnt_reply(FAR struct rpcclnt *rpc, int procid, int prog, { fdbg("ERROR: rpcclnt_receive returned: %d\n", error); - /* If we failed because of a timeout, then try sending the CALL - * message again. - */ + /* If we failed because of a timeout, then try sending the CALL + * message again. + */ - if (error == EAGAIN || error == ETIMEDOUT) - { - rpc->rc_timeout = true; - } - } + if (error == EAGAIN || error == ETIMEDOUT) + { + rpc->rc_timeout = true; + } + } /* Get the xid and check that it is an RPC replysvr */ else { - replyheader = (FAR struct rpc_reply_header *)reply; - rxid = replyheader->rp_xid; + FAR struct rpc_reply_header *replyheader = + (FAR struct rpc_reply_header *)reply; if (replyheader->rp_direction != rpc_reply) { @@ -260,7 +258,7 @@ static int rpcclnt_reply(FAR struct rpcclnt *rpc, int procid, int prog, } } - return OK; + return error; } /**************************************************************************** @@ -275,7 +273,6 @@ static uint32_t rpcclnt_newxid(void) { static uint32_t rpcclnt_xid = 0; static uint32_t rpcclnt_xid_touched = 0; - int xidp = 0; srand(time(NULL)); if ((rpcclnt_xid == 0) && (rpcclnt_xid_touched == 0)) @@ -285,6 +282,7 @@ static uint32_t rpcclnt_newxid(void) } else { + int xidp = 0; do { xidp = rand(); diff --git a/nuttx/fs/nxffs/nxffs.h b/nuttx/fs/nxffs/nxffs.h index 616dc7197b..083e00fa7f 100644 --- a/nuttx/fs/nxffs/nxffs.h +++ b/nuttx/fs/nxffs/nxffs.h @@ -1,7 +1,7 @@ /**************************************************************************** * fs/nxffs/nxffs.h * - * Copyright (C) 2011 Gregory Nutt. All rights reserved. + * Copyright (C) 2011, 2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * References: Linux/Documentation/filesystems/romfs.txt @@ -1044,6 +1044,7 @@ extern int nxffs_pack(FAR struct nxffs_volume_s *volume); * - nxffs_read() is defined in nxffs_read.c * - nxffs_write() is defined in nxffs_write.c * - nxffs_ioctl() is defined in nxffs_ioctl.c + * - nxffs_dup() is defined in nxffs_open.c * - nxffs_opendir(), nxffs_readdir(), and nxffs_rewindir() are defined in * nxffs_dirent.c * - nxffs_bind() and nxffs_unbind() are defined in nxffs_initialize.c @@ -1058,25 +1059,25 @@ struct fs_dirent_s; struct statfs; struct stat; -extern int nxffs_open(FAR struct file *filep, FAR const char *relpath, - int oflags, mode_t mode); -extern int nxffs_close(FAR struct file *filep); -extern ssize_t nxffs_read(FAR struct file *filep, FAR char *buffer, - size_t buflen); -extern ssize_t nxffs_write(FAR struct file *filep, FAR const char *buffer, - size_t buflen); -extern int nxffs_ioctl(FAR struct file *filep, int cmd, unsigned long arg); -extern int nxffs_opendir(FAR struct inode *mountpt, FAR const char *relpath, - FAR struct fs_dirent_s *dir); -extern int nxffs_readdir(FAR struct inode *mountpt, FAR struct fs_dirent_s *dir); -extern int nxffs_rewinddir(FAR struct inode *mountpt, FAR struct fs_dirent_s *dir); -extern int nxffs_bind(FAR struct inode *blkdriver, FAR const void *data, - FAR void **handle); -extern int nxffs_unbind(FAR void *handle, FAR struct inode **blkdriver); -extern int nxffs_statfs(FAR struct inode *mountpt, FAR struct statfs *buf); -extern int nxffs_stat(FAR struct inode *mountpt, FAR const char *relpath, - FAR struct stat *buf); -extern int nxffs_unlink(FAR struct inode *mountpt, FAR const char *relpath); +int nxffs_open(FAR struct file *filep, FAR const char *relpath, int oflags, + mode_t mode); +int nxffs_close(FAR struct file *filep); +ssize_t nxffs_read(FAR struct file *filep, FAR char *buffer, size_t buflen); +ssize_t nxffs_write(FAR struct file *filep, FAR const char *buffer, + size_t buflen); +int nxffs_ioctl(FAR struct file *filep, int cmd, unsigned long arg); +int nxffs_dup(FAR const struct file *oldp, FAR struct file *newp); +int nxffs_opendir(FAR struct inode *mountpt, FAR const char *relpath, + FAR struct fs_dirent_s *dir); +int nxffs_readdir(FAR struct inode *mountpt, FAR struct fs_dirent_s *dir); +int nxffs_rewinddir(FAR struct inode *mountpt, FAR struct fs_dirent_s *dir); +int nxffs_bind(FAR struct inode *blkdriver, FAR const void *data, + FAR void **handle); +int nxffs_unbind(FAR void *handle, FAR struct inode **blkdriver); +int nxffs_statfs(FAR struct inode *mountpt, FAR struct statfs *buf); +int nxffs_stat(FAR struct inode *mountpt, FAR const char *relpath, + FAR struct stat *buf); +int nxffs_unlink(FAR struct inode *mountpt, FAR const char *relpath); #endif /* __FS_NXFFS_NXFFS_H */ diff --git a/nuttx/fs/nxffs/nxffs_initialize.c b/nuttx/fs/nxffs/nxffs_initialize.c index 0aa424869a..4e7428c738 100644 --- a/nuttx/fs/nxffs/nxffs_initialize.c +++ b/nuttx/fs/nxffs/nxffs_initialize.c @@ -1,7 +1,7 @@ /**************************************************************************** * fs/nxffs/nxffs_initialize.c * - * Copyright (C) 2011 Gregory Nutt. All rights reserved. + * Copyright (C) 2011, 2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * References: Linux/Documentation/filesystems/romfs.txt @@ -84,7 +84,7 @@ const struct mountpt_operations nxffs_operations = nxffs_ioctl, /* ioctl */ NULL, /* sync -- No buffered data */ - NULL, /* dup -- not implemented */ + nxffs_dup, /* dup */ nxffs_opendir, /* opendir */ NULL, /* closedir */ diff --git a/nuttx/fs/nxffs/nxffs_open.c b/nuttx/fs/nxffs/nxffs_open.c index eb7817c57e..b1e99267ff 100644 --- a/nuttx/fs/nxffs/nxffs_open.c +++ b/nuttx/fs/nxffs/nxffs_open.c @@ -1,7 +1,7 @@ /**************************************************************************** * fs/nxffs/nxffs_open.c * - * Copyright (C) 2011 Gregory Nutt. All rights reserved. + * Copyright (C) 2011, 2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * References: Linux/Documentation/filesystems/romfs.txt @@ -1023,7 +1023,7 @@ int nxffs_open(FAR struct file *filep, FAR const char *relpath, #endif /* Limitation: A file must be opened for reading or writing, but not both. - * There is no general for extending the size of of a file. Extending the + * There is no general way of extending the size of a file. Extending the * file size of possible if the file to be extended is the last in the * sequence on FLASH, but since that case is not the general case, no file * extension is supported. @@ -1058,6 +1058,64 @@ int nxffs_open(FAR struct file *filep, FAR const char *relpath, return ret; } +/**************************************************************************** + * Name: binfs_dup + * + * Description: + * Duplicate open file data in the new file structure. + * + ****************************************************************************/ + +int nxffs_dup(FAR const struct file *oldp, FAR struct file *newp) +{ +#ifdef CONFIG_DEBUG + FAR struct nxffs_volume_s *volume; +#endif + FAR struct nxffs_ofile_s *ofile; + + fvdbg("Dup %p->%p\n", oldp, newp); + + /* Sanity checks */ + +#ifdef CONFIG_DEBUG + DEBUGASSERT(oldp->f_priv == NULL && oldp->f_inode != NULL); + + /* Get the mountpoint private data from the NuttX inode reference in the + * file structure + */ + + volume = (FAR struct nxffs_volume_s*)oldp->f_inode->i_private; + DEBUGASSERT(volume != NULL); +#endif + + /* Recover the open file state from the struct file instance */ + + ofile = (FAR struct nxffs_ofile_s *)oldp->f_priv; + + /* I do not think we need exclusive access to the volume to do this. + * The volume exclsem protects the open file list and, hence, would + * assure that the ofile is stable. However, it is assumed that the + * caller holds a value file descriptor associated with this ofile, + * so it should be stable throughout the life of this function. + */ + + /* Limitations: I do not think we have to be concerned about the + * usual NXFFS file limitations here: dup'ing cannot resulting + * in mixed reading and writing to the same file, or multiple + * writer to different file. + * + * I notice that nxffs_wropen will prohibit multiple opens for + * writing. But I do not thing that dup'ing a file already opened + * for writing suffers from any of these issues. + */ + + /* Just increment the reference count on the ofile */ + + ofile->crefs++; + newp->f_priv = (FAR void *)ofile; + return OK; +} + /**************************************************************************** * Name: nxffs_close * diff --git a/nuttx/fs/romfs/fs_romfs.c b/nuttx/fs/romfs/fs_romfs.c index de87c7fec8..2814aa49d0 100644 --- a/nuttx/fs/romfs/fs_romfs.c +++ b/nuttx/fs/romfs/fs_romfs.c @@ -636,7 +636,7 @@ static int romfs_dup(FAR const struct file *oldp, FAR struct file *newp) * dup'ed file. */ - newrf = (FAR struct romfs_file_s *)malloc(sizeof(struct romfs_file_s)); + newrf = (FAR struct romfs_file_s *)kmalloc(sizeof(struct romfs_file_s)); if (!newrf) { fdbg("Failed to allocate private data\n", ret); diff --git a/nuttx/include/nuttx/fs/fs.h b/nuttx/include/nuttx/fs/fs.h index 3138a8412c..327bf37ca5 100644 --- a/nuttx/include/nuttx/fs/fs.h +++ b/nuttx/include/nuttx/fs/fs.h @@ -1,7 +1,7 @@ /**************************************************************************** * include/nuttx/fs/fs.h * - * Copyright (C) 2007-2009, 2011-2012 Gregory Nutt. All rights reserved. + * Copyright (C) 2007-2009, 2011-2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without diff --git a/nuttx/sched/mq_initialize.c b/nuttx/sched/mq_initialize.c index 5b03a11201..dd7c7ed0f5 100644 --- a/nuttx/sched/mq_initialize.c +++ b/nuttx/sched/mq_initialize.c @@ -217,11 +217,11 @@ void mq_initialize(void) void mq_desblockalloc(void) { - struct mq_des_block_s *mqdesblock; + FAR struct mq_des_block_s *mqdesblock; /* Allocate a block of message descriptors */ - mqdesblock = (struct mq_des_block_s *)kmalloc(sizeof(struct mq_des_block_s)); + mqdesblock = (FAR struct mq_des_block_s *)kmalloc(sizeof(struct mq_des_block_s)); if (mqdesblock) { int i; diff --git a/nuttx/sched/sig_timedwait.c b/nuttx/sched/sig_timedwait.c index b07b8f2a1f..f8c619b218 100644 --- a/nuttx/sched/sig_timedwait.c +++ b/nuttx/sched/sig_timedwait.c @@ -228,7 +228,7 @@ int sigtimedwait(FAR const sigset_t *set, FAR struct siginfo *info, /* The return value is the number of the signal that awakened us */ - ret = info->si_signo; + ret = sigpend->info.si_signo; } /* We will have to wait for a signal to be posted to this task. */ diff --git a/nuttx/sched/task_vfork.c b/nuttx/sched/task_vfork.c index 0ea09b0487..4b42c7b363 100644 --- a/nuttx/sched/task_vfork.c +++ b/nuttx/sched/task_vfork.c @@ -291,7 +291,7 @@ pid_t task_vforkstart(FAR _TCB *child) * still running. */ - while ((ret = kill(pid, 0)) == OK) + while (kill(pid, 0) == OK) { /* Yes.. then we can yield to it -- assuming that it has not lowered * its priority. sleep(0) might be a safer thing to do since it does From 87b33d354695294b519f7f6f1275592faf4fee46 Mon Sep 17 00:00:00 2001 From: patacongo Date: Mon, 14 Jan 2013 22:06:19 +0000 Subject: [PATCH 071/118] Configre configs/ubw32/ostest to use kconfig-frontends git-svn-id: http://svn.code.sf.net/p/nuttx/code/trunk@5518 42af7a65-404d-4744-a932-0658087f49c3 --- nuttx/ChangeLog | 6 +- nuttx/arch/Kconfig | 18 + nuttx/arch/arm/Kconfig | 2 + nuttx/arch/arm/src/common/up_internal.h | 4 +- .../arm/src/kinetis/kinetis_clockconfig.c | 4 +- nuttx/arch/arm/src/kinetis/kinetis_start.c | 2 +- nuttx/arch/mips/Kconfig | 2 + nuttx/arch/mips/src/common/up_internal.h | 4 +- nuttx/arch/mips/src/pic32mx/Kconfig | 6 +- nuttx/arch/mips/src/pic32mx/pic32mx-head.S | 21 +- nuttx/configs/README.txt | 2 +- nuttx/configs/kwikstik-k40/ostest/defconfig | 2 +- nuttx/configs/mirtoo/nsh/defconfig | 6 +- nuttx/configs/mirtoo/nxffs/defconfig | 6 +- nuttx/configs/mirtoo/ostest/defconfig | 6 +- nuttx/configs/pcblogic-pic32mx/nsh/defconfig | 10 +- .../configs/pcblogic-pic32mx/ostest/defconfig | 10 +- nuttx/configs/pic32-starterkit/nsh/defconfig | 10 +- nuttx/configs/pic32-starterkit/nsh2/defconfig | 10 +- .../configs/pic32-starterkit/ostest/defconfig | 10 +- nuttx/configs/pic32mx7mmb/nsh/defconfig | 10 +- nuttx/configs/pic32mx7mmb/ostest/defconfig | 10 +- nuttx/configs/sure-pic32mx/nsh/defconfig | 10 +- nuttx/configs/sure-pic32mx/ostest/defconfig | 10 +- nuttx/configs/sure-pic32mx/usbnsh/defconfig | 10 +- nuttx/configs/twr-k60n512/nsh/defconfig | 2 +- nuttx/configs/twr-k60n512/ostest/defconfig | 2 +- nuttx/configs/ubw32/README.txt | 27 +- nuttx/configs/ubw32/nsh/Make.defs | 4 +- nuttx/configs/ubw32/nsh/defconfig | 10 +- nuttx/configs/ubw32/ostest/Make.defs | 4 +- nuttx/configs/ubw32/ostest/appconfig | 39 - nuttx/configs/ubw32/ostest/defconfig | 1015 ++++++++++------- nuttx/configs/ubw32/ostest/ld.script | 317 ----- .../configs/ubw32/{nsh => scripts}/ld.script | 4 +- 35 files changed, 674 insertions(+), 941 deletions(-) delete mode 100644 nuttx/configs/ubw32/ostest/appconfig delete mode 100644 nuttx/configs/ubw32/ostest/ld.script rename nuttx/configs/ubw32/{nsh => scripts}/ld.script (98%) diff --git a/nuttx/ChangeLog b/nuttx/ChangeLog index 4ba0fe985f..41ac95db00 100644 --- a/nuttx/ChangeLog +++ b/nuttx/ChangeLog @@ -3948,4 +3948,8 @@ * sched/sig_timedwait.c: sigtimedwait() would return a bad signal number if the signal was already pending when the function was called. - called. + * configs/ubw32/scripts: All common linker scripts moved to this + scripts sub-directory + * configs/ubw32/ostest: Configuration configured to use the + kconfig-frontends tools. + diff --git a/nuttx/arch/Kconfig b/nuttx/arch/Kconfig index 7d34b56f4d..d43137adb9 100644 --- a/nuttx/arch/Kconfig +++ b/nuttx/arch/Kconfig @@ -109,6 +109,10 @@ config ARCH_NOINTC bool default n +config ARCH_VECNOTIRQ + bool + default n + config ARCH_DMA bool default n @@ -141,6 +145,20 @@ config ENDIAN_BIG ---help--- Select if architecture operates using big-endian byte ordering. +config ARCH_HAVE_RAMFUNCS + bool + default n + +config ARCH_RAMFUNCS + bool "Copy functions to RAM on startup" + default n + depends on ARCH_HAVE_RAMFUNCS + ---help--- + Copy some functions to RAM at boot time. This is done in some + architectures to improve performance. In other cases, it is done + so that FLASH can be reconfigured while the MCU executes out of + SRAM. + comment "Board Settings" config BOARD_LOOPSPERMSEC diff --git a/nuttx/arch/arm/Kconfig b/nuttx/arch/arm/Kconfig index bc7634695e..36343e3199 100644 --- a/nuttx/arch/arm/Kconfig +++ b/nuttx/arch/arm/Kconfig @@ -47,6 +47,8 @@ config ARCH_CHIP_KINETIS select ARCH_CORTEXM4 select ARCH_HAVE_MPU select ARCH_IRQPRIO + select ARCH_HAVE_RAMFUNCS + select ARCH_RAMFUNCS ---help--- Freescale Kinetis Architectures (ARM Cortex-M4) diff --git a/nuttx/arch/arm/src/common/up_internal.h b/nuttx/arch/arm/src/common/up_internal.h index 0d3c5b1f2f..55071345f9 100644 --- a/nuttx/arch/arm/src/common/up_internal.h +++ b/nuttx/arch/arm/src/common/up_internal.h @@ -188,7 +188,7 @@ extern uint32_t _ebss; /* End+1 of .bss */ * will create a function named foo that will execute from RAM. */ -#ifdef CONFIG_BOOT_RAMFUNCS +#ifdef CONFIG_ARCH_RAMFUNCS # define __ramfunc__ __attribute__ ((section(".ramfunc"))) @@ -204,7 +204,7 @@ extern const uint32_t _framfuncs; /* Copy source address in FLASH */ extern uint32_t _sramfuncs; /* Copy destination start address in RAM */ extern uint32_t _eramfuncs; /* Copy destination start address in RAM */ -#endif /* CONFIG_BOOT_RAMFUNCS */ +#endif /* CONFIG_ARCH_RAMFUNCS */ #endif /* __ASSEMBLY__ */ /**************************************************************************** diff --git a/nuttx/arch/arm/src/kinetis/kinetis_clockconfig.c b/nuttx/arch/arm/src/kinetis/kinetis_clockconfig.c index 31ea235d2c..ad6e428849 100644 --- a/nuttx/arch/arm/src/kinetis/kinetis_clockconfig.c +++ b/nuttx/arch/arm/src/kinetis/kinetis_clockconfig.c @@ -55,8 +55,8 @@ * Private Definitions ****************************************************************************/ -#ifndef CONFIG_BOOT_RAMFUNCS -# error "CONFIG_BOOT_RAMFUNCS must be defined for this logic" +#ifndef CONFIG_ARCH_RAMFUNCS +# error "CONFIG_ARCH_RAMFUNCS must be defined for this logic" #endif /**************************************************************************** diff --git a/nuttx/arch/arm/src/kinetis/kinetis_start.c b/nuttx/arch/arm/src/kinetis/kinetis_start.c index c8f20fbddf..2f73cb2e6c 100644 --- a/nuttx/arch/arm/src/kinetis/kinetis_start.c +++ b/nuttx/arch/arm/src/kinetis/kinetis_start.c @@ -116,7 +116,7 @@ void __start(void) * at _framfuncs */ -#ifdef CONFIG_BOOT_RAMFUNCS +#ifdef CONFIG_ARCH_RAMFUNCS for (src = &_framfuncs, dest = &_sramfuncs; dest < &_eramfuncs; ) { *dest++ = *src++; diff --git a/nuttx/arch/mips/Kconfig b/nuttx/arch/mips/Kconfig index 772b6f6632..1b10e26aee 100644 --- a/nuttx/arch/mips/Kconfig +++ b/nuttx/arch/mips/Kconfig @@ -12,6 +12,8 @@ config ARCH_CHIP_PIC32MX bool "PIC32MX" select ARCH_MIPS32 select ARCH_IRQPRIO + select ARCH_VECNOTIRQ + select ARCH_HAVE_RAMFUNCS ---help--- Microchip PIC32MX320F032H (MIPS32) diff --git a/nuttx/arch/mips/src/common/up_internal.h b/nuttx/arch/mips/src/common/up_internal.h index 0eb1ed6a0b..b284961b0a 100644 --- a/nuttx/arch/mips/src/common/up_internal.h +++ b/nuttx/arch/mips/src/common/up_internal.h @@ -152,7 +152,7 @@ extern uint32_t _sdata; /* Start of .data */ extern uint32_t _edata; /* End+1 of .data */ extern uint32_t _sbss; /* Start of .bss */ extern uint32_t _ebss; /* End+1 of .bss */ -#ifdef CONFIG_PIC32MX_RAMFUNCS +#ifdef CONFIG_ARCH_RAMFUNCS extern uint32_t _sramfunc; /* Start of ramfuncs */ extern uint32_t _eramfunc; /* End+1 of ramfuncs */ extern uint32_t _ramfunc_loadaddr; /* Start of ramfuncs in FLASH */ @@ -160,7 +160,7 @@ extern uint32_t _ramfunc_sizeof; /* Size of ramfuncs */ extern uint32_t _bmxdkpba_address; /* BMX register setting */ extern uint32_t _bmxdudba_address; /* BMX register setting */ extern uint32_t _bmxdupba_address; /* BMX register setting */ -#endif /* CONFIG_PIC32MX_RAMFUNCS */ +#endif /* CONFIG_ARCH_RAMFUNCS */ #endif /* __ASSEMBLY__ */ /**************************************************************************** diff --git a/nuttx/arch/mips/src/pic32mx/Kconfig b/nuttx/arch/mips/src/pic32mx/Kconfig index bcb99cf6d7..6ac10608b2 100644 --- a/nuttx/arch/mips/src/pic32mx/Kconfig +++ b/nuttx/arch/mips/src/pic32mx/Kconfig @@ -533,10 +533,14 @@ config PIC32MX_CM1 bool "Comparator 1 (CM1)" default n -config PIC32MX_CM2 +config PIC32MX_CM2 bool "Comparator 2 (CM2)" default n +config PIC32MX_CM3 + bool "Comparator 3 (CM3)" + default n + config PIC32MX_RTCC bool "Real-Time Clock and Calendar (RTCC)" default n diff --git a/nuttx/arch/mips/src/pic32mx/pic32mx-head.S b/nuttx/arch/mips/src/pic32mx/pic32mx-head.S index 7224ee122f..2e1a340805 100644 --- a/nuttx/arch/mips/src/pic32mx/pic32mx-head.S +++ b/nuttx/arch/mips/src/pic32mx/pic32mx-head.S @@ -367,7 +367,7 @@ __start: * initializing bus matrix registers. */ -#ifdef CONFIG_PIC32MX_RAMFUNCS +#ifdef CONFIG_ARCH_RAMFUNCS la t1, _ramfunc_sizeof beqz t1, .Lnoramfuncs nop @@ -598,17 +598,26 @@ halt: devconfig: devconfig3: #if defined(CHIP_PIC32MX1) || defined(CHIP_PIC32MX2) + .long CONFIG_PIC32MX_USERID << DEVCFG3_USERID_SHIFT | \ CONFIG_PIC32MX_PMDL1WAY << 28 | CONFIG_PIC32MX_IOL1WAY << 29 | \ CONFIG_PIC32MX_USBIDO << 30 | CONFIG_PIC32MX_VBUSIO << 31 | \ DEVCFG3_UNUSED -#else + +#elif defined(CHIP_PIC32MX3) || defined(CHIP_PIC32MX4) + + .long CONFIG_PIC32MX_USERID << DEVCFG3_USERID_SHIFT | \ + DEVCFG3_UNUSED + +#elif defined(CHIP_PIC32MX5) || defined(CHIP_PIC32MX6) || defined(CHIP_PIC32MX7) + .long CONFIG_PIC32MX_USERID << DEVCFG3_USERID_SHIFT | \ CONFIG_PIC32MX_SRSSEL << DEVCFG3_FSRSSEL_SHIFT | \ CONFIG_PIC32MX_FMIIEN << 24 | CONFIG_PIC32MX_FETHIO << 25 | \ CONFIG_PIC32MX_FCANIO << 26 | CONFIG_PIC32MX_FSCM1IO << 29 | \ CONFIG_PIC32MX_USBIDO << 30 | CONFIG_PIC32MX_VBUSIO << 31 | \ DEVCFG3_UNUSED + #endif devconfig2: @@ -618,22 +627,27 @@ devconfig2: devconfig1: #if defined(CHIP_PIC32MX1) || defined(CHIP_PIC32MX2) + .long CONFIG_PIC32MX_FNOSC | CONFIG_PIC32MX_FSOSCEN | \ CONFIG_PIC32MX_IESO | CONFIG_PIC32MX_POSCMOD | \ CONFIG_PIC32MX_OSCOUT << 10 | \ CONFIG_PIC32MX_PBDIV | CONFIG_PIC32MX_FCKSM | \ DEVCFG1_WINDIS | CONFIG_PIC32MX_WDENABLE | \ DEVCFG1_FWDTWINSZ_75 | DEVCFG1_UNUSED + #else + .long CONFIG_PIC32MX_FNOSC | CONFIG_PIC32MX_FSOSCEN | \ CONFIG_PIC32MX_IESO | CONFIG_PIC32MX_POSCMOD | \ CONFIG_PIC32MX_OSCOUT << 10 | \ CONFIG_PIC32MX_PBDIV | CONFIG_PIC32MX_FCKSM | \ CONFIG_PIC32MX_WDENABLE | DEVCFG1_UNUSED + #endif devconfig0: #if defined(CHIP_PIC32MX1) || defined(CHIP_PIC32MX2) + .long CONFIG_PIC32MX_DEBUGGER << DEVCFG0_DEBUG_SHIFT | \ DEVCFG0_JTAGEN | \ CONFIG_PIC32MX_ICESEL << DEVCFG0_ICESEL_SHIFT | \ @@ -641,13 +655,16 @@ devconfig0: CONFIG_PIC32MX_BOOTFLASHWP << 24 | \ CONFIG_PIC32MX_CODEWP << 28 | \ DEVCFG0_UNUSED + #else + .long CONFIG_PIC32MX_DEBUGGER << DEVCFG0_DEBUG_SHIFT | \ CONFIG_PIC32MX_ICESEL << 3 | \ CONFIG_PIC32MX_PROGFLASHWP << DEVCFG0_PWP_SHIFT | \ CONFIG_PIC32MX_BOOTFLASHWP << 24 | \ CONFIG_PIC32MX_CODEWP << 28 | \ DEVCFG0_UNUSED + #endif .size devconfig, .-devconfig diff --git a/nuttx/configs/README.txt b/nuttx/configs/README.txt index 4800f02eeb..babdf7330e 100644 --- a/nuttx/configs/README.txt +++ b/nuttx/configs/README.txt @@ -1590,7 +1590,7 @@ defconfig -- This is a configuration file similar to the Linux operation from FLASH but must copy initialized .data sections to RAM. CONFIG_BOOT_COPYTORAM - Some configurations boot in FLASH but copy themselves entirely into RAM for better performance. - CONFIG_BOOT_RAMFUNCS - Other configurations may copy just some functions + CONFIG_ARCH_RAMFUNCS - Other configurations may copy just some functions into RAM, either for better performance or for errata workarounds. CONFIG_STACK_ALIGNMENT - Set if the your application has specific stack alignment requirements (may not be supported diff --git a/nuttx/configs/kwikstik-k40/ostest/defconfig b/nuttx/configs/kwikstik-k40/ostest/defconfig index 5f0291cedc..ff8c39c1fb 100755 --- a/nuttx/configs/kwikstik-k40/ostest/defconfig +++ b/nuttx/configs/kwikstik-k40/ostest/defconfig @@ -460,7 +460,7 @@ CONFIG_EXAMPLES_USBSERIAL_TRACEINTERRUPTS=n # CONFIG_BOOT_RUNFROMFLASH=n CONFIG_BOOT_COPYTORAM=n -CONFIG_BOOT_RAMFUNCS=y +CONFIG_ARCH_RAMFUNCS=y CONFIG_CUSTOM_STACK=n CONFIG_IDLETHREAD_STACKSIZE=1024 CONFIG_USERMAIN_STACKSIZE=2048 diff --git a/nuttx/configs/mirtoo/nsh/defconfig b/nuttx/configs/mirtoo/nsh/defconfig index 94a6b8b173..6e0d3bf70a 100644 --- a/nuttx/configs/mirtoo/nsh/defconfig +++ b/nuttx/configs/mirtoo/nsh/defconfig @@ -60,7 +60,7 @@ CONFIG_ARCH_DMA=n # Enable support for RAM-based functions # (If selected, then modifications are needed in linker scripts as well) # -CONFIG_PIC32MX_RAMFUNCS=n +CONFIG_ARCH_RAMFUNCS=n # # Identify toolchain and linker options @@ -105,7 +105,6 @@ CONFIG_PIC32MX_CM1=n CONFIG_PIC32MX_CM2=n CONFIG_PIC32MX_CM3=n CONFIG_PIC32MX_RTCC=n -CONFIG_PIC32MX_OSC=y CONFIG_PIC32MX_DDP=n CONFIG_PIC32MX_FLASH=n CONFIG_PIC32MX_BMX=n @@ -113,9 +112,6 @@ CONFIG_PIC32MX_DMA=n CONFIG_PIC32MX_CHE=n CONFIG_PIC32MX_USBDEV=n CONFIG_PIC32MX_USBHOST=n -CONFIG_PIC32MX_IOPORTA=y -CONFIG_PIC32MX_IOPORTB=y -CONFIG_PIC32MX_IOPORTC=y # # Mirtoo Board Settings diff --git a/nuttx/configs/mirtoo/nxffs/defconfig b/nuttx/configs/mirtoo/nxffs/defconfig index d633e56d9b..ed50e0325c 100644 --- a/nuttx/configs/mirtoo/nxffs/defconfig +++ b/nuttx/configs/mirtoo/nxffs/defconfig @@ -60,7 +60,7 @@ CONFIG_ARCH_DMA=n # Enable support for RAM-based functions # (If selected, then modifications are needed in linker scripts as well) # -CONFIG_PIC32MX_RAMFUNCS=n +CONFIG_ARCH_RAMFUNCS=n # # Identify toolchain and linker options @@ -105,7 +105,6 @@ CONFIG_PIC32MX_CM1=n CONFIG_PIC32MX_CM2=n CONFIG_PIC32MX_CM3=n CONFIG_PIC32MX_RTCC=n -CONFIG_PIC32MX_OSC=y CONFIG_PIC32MX_DDP=n CONFIG_PIC32MX_FLASH=n CONFIG_PIC32MX_BMX=n @@ -113,9 +112,6 @@ CONFIG_PIC32MX_DMA=n CONFIG_PIC32MX_CHE=n CONFIG_PIC32MX_USBDEV=n CONFIG_PIC32MX_USBHOST=n -CONFIG_PIC32MX_IOPORTA=y -CONFIG_PIC32MX_IOPORTB=y -CONFIG_PIC32MX_IOPORTC=y # # Mirtoo Board Settings diff --git a/nuttx/configs/mirtoo/ostest/defconfig b/nuttx/configs/mirtoo/ostest/defconfig index 471dab4448..5c8b697854 100644 --- a/nuttx/configs/mirtoo/ostest/defconfig +++ b/nuttx/configs/mirtoo/ostest/defconfig @@ -60,7 +60,7 @@ CONFIG_ARCH_DMA=n # Enable support for RAM-based functions # (If selected, then modifications are needed in linker scripts as well) # -CONFIG_PIC32MX_RAMFUNCS=n +CONFIG_ARCH_RAMFUNCS=n # # Identify toolchain and linker options @@ -105,7 +105,6 @@ CONFIG_PIC32MX_CM1=n CONFIG_PIC32MX_CM2=n CONFIG_PIC32MX_CM3=n CONFIG_PIC32MX_RTCC=n -CONFIG_PIC32MX_OSC=y CONFIG_PIC32MX_DDP=n CONFIG_PIC32MX_FLASH=n CONFIG_PIC32MX_BMX=n @@ -113,9 +112,6 @@ CONFIG_PIC32MX_DMA=n CONFIG_PIC32MX_CHE=n CONFIG_PIC32MX_USBDEV=n CONFIG_PIC32MX_USBHOST=n -CONFIG_PIC32MX_IOPORTA=y -CONFIG_PIC32MX_IOPORTB=y -CONFIG_PIC32MX_IOPORTC=y # # PIC32MX Configuration Settings diff --git a/nuttx/configs/pcblogic-pic32mx/nsh/defconfig b/nuttx/configs/pcblogic-pic32mx/nsh/defconfig index 7bce554ac7..6f1ef7dc90 100644 --- a/nuttx/configs/pcblogic-pic32mx/nsh/defconfig +++ b/nuttx/configs/pcblogic-pic32mx/nsh/defconfig @@ -60,7 +60,7 @@ CONFIG_ARCH_DMA=n # Enable support for RAM-based functions # (If selected, then modifications are needed in ld.script as well) # -CONFIG_PIC32MX_RAMFUNCS=n +CONFIG_ARCH_RAMFUNCS=n # # Identify toolchain and linker options @@ -102,7 +102,6 @@ CONFIG_PIC32MX_ADC=n CONFIG_PIC32MX_CVR=n CONFIG_PIC32MX_CM1=n CONFIG_PIC32MX_CM2=n -CONFIG_PIC32MX_OSC=y CONFIG_PIC32MX_DDP=n CONFIG_PIC32MX_FLASH=n CONFIG_PIC32MX_BMX=n @@ -110,13 +109,6 @@ CONFIG_PIC32MX_DMA=n CONFIG_PIC32MX_CHE=n CONFIG_PIC32MX_USBDEV=n CONFIG_PIC32MX_USBHOST=n -CONFIG_PIC32MX_IOPORTA=y -CONFIG_PIC32MX_IOPORTB=y -CONFIG_PIC32MX_IOPORTC=y -CONFIG_PIC32MX_IOPORTD=y -CONFIG_PIC32MX_IOPORTE=y -CONFIG_PIC32MX_IOPORTF=y -CONFIG_PIC32MX_IOPORTG=y # # PIC32MX Configuration Settings diff --git a/nuttx/configs/pcblogic-pic32mx/ostest/defconfig b/nuttx/configs/pcblogic-pic32mx/ostest/defconfig index 730b8134a9..1df428f8ae 100644 --- a/nuttx/configs/pcblogic-pic32mx/ostest/defconfig +++ b/nuttx/configs/pcblogic-pic32mx/ostest/defconfig @@ -60,7 +60,7 @@ CONFIG_ARCH_DMA=n # Enable support for RAM-based functions # (If selected, then modifications are needed in ld.script as well) # -CONFIG_PIC32MX_RAMFUNCS=n +CONFIG_ARCH_RAMFUNCS=n # # Identify toolchain and linker options @@ -102,7 +102,6 @@ CONFIG_PIC32MX_ADC=n CONFIG_PIC32MX_CVR=n CONFIG_PIC32MX_CM1=n CONFIG_PIC32MX_CM2=n -CONFIG_PIC32MX_OSC=y CONFIG_PIC32MX_DDP=n CONFIG_PIC32MX_FLASH=n CONFIG_PIC32MX_BMX=n @@ -110,13 +109,6 @@ CONFIG_PIC32MX_DMA=n CONFIG_PIC32MX_CHE=n CONFIG_PIC32MX_USBDEV=n CONFIG_PIC32MX_USBHOST=n -CONFIG_PIC32MX_IOPORTA=y -CONFIG_PIC32MX_IOPORTB=y -CONFIG_PIC32MX_IOPORTC=y -CONFIG_PIC32MX_IOPORTD=y -CONFIG_PIC32MX_IOPORTE=y -CONFIG_PIC32MX_IOPORTF=y -CONFIG_PIC32MX_IOPORTG=y # # PIC32MX Configuration Settings diff --git a/nuttx/configs/pic32-starterkit/nsh/defconfig b/nuttx/configs/pic32-starterkit/nsh/defconfig index 32220d89ba..f1c543e5f0 100644 --- a/nuttx/configs/pic32-starterkit/nsh/defconfig +++ b/nuttx/configs/pic32-starterkit/nsh/defconfig @@ -60,7 +60,7 @@ CONFIG_ARCH_DMA=n # Enable support for RAM-based functions # (If selected, then modifications are needed in ld.script as well) # -CONFIG_PIC32MX_RAMFUNCS=n +CONFIG_ARCH_RAMFUNCS=n # # Identify toolchain and linker options @@ -108,7 +108,6 @@ CONFIG_PIC32MX_ADC=n CONFIG_PIC32MX_CVR=n CONFIG_PIC32MX_CM1=n CONFIG_PIC32MX_CM2=n -CONFIG_PIC32MX_OSC=y CONFIG_PIC32MX_DDP=n CONFIG_PIC32MX_FLASH=n CONFIG_PIC32MX_BMX=n @@ -119,13 +118,6 @@ CONFIG_PIC32MX_USBHOST=n CONFIG_PIC32MX_CAN1=n CONFIG_PIC32MX_CAN2=n CONFIG_PIC32MX_ETHERNET=n -CONFIG_PIC32MX_IOPORTA=y -CONFIG_PIC32MX_IOPORTB=y -CONFIG_PIC32MX_IOPORTC=y -CONFIG_PIC32MX_IOPORTD=y -CONFIG_PIC32MX_IOPORTE=y -CONFIG_PIC32MX_IOPORTF=y -CONFIG_PIC32MX_IOPORTG=y # # PIC32MX Configuration Settings diff --git a/nuttx/configs/pic32-starterkit/nsh2/defconfig b/nuttx/configs/pic32-starterkit/nsh2/defconfig index a7a1ff18a8..f681b7689e 100644 --- a/nuttx/configs/pic32-starterkit/nsh2/defconfig +++ b/nuttx/configs/pic32-starterkit/nsh2/defconfig @@ -60,7 +60,7 @@ CONFIG_ARCH_DMA=n # Enable support for RAM-based functions # (If selected, then modifications are needed in ld.script as well) # -CONFIG_PIC32MX_RAMFUNCS=n +CONFIG_ARCH_RAMFUNCS=n # # Identify toolchain and linker options @@ -108,7 +108,6 @@ CONFIG_PIC32MX_ADC=n CONFIG_PIC32MX_CVR=n CONFIG_PIC32MX_CM1=n CONFIG_PIC32MX_CM2=n -CONFIG_PIC32MX_OSC=y CONFIG_PIC32MX_DDP=n CONFIG_PIC32MX_FLASH=n CONFIG_PIC32MX_BMX=n @@ -119,13 +118,6 @@ CONFIG_PIC32MX_USBHOST=n CONFIG_PIC32MX_CAN1=n CONFIG_PIC32MX_CAN2=n CONFIG_PIC32MX_ETHERNET=y -CONFIG_PIC32MX_IOPORTA=y -CONFIG_PIC32MX_IOPORTB=y -CONFIG_PIC32MX_IOPORTC=y -CONFIG_PIC32MX_IOPORTD=y -CONFIG_PIC32MX_IOPORTE=y -CONFIG_PIC32MX_IOPORTF=y -CONFIG_PIC32MX_IOPORTG=y # # PIC32MX Configuration Settings diff --git a/nuttx/configs/pic32-starterkit/ostest/defconfig b/nuttx/configs/pic32-starterkit/ostest/defconfig index 3a55de491e..6a077f2097 100644 --- a/nuttx/configs/pic32-starterkit/ostest/defconfig +++ b/nuttx/configs/pic32-starterkit/ostest/defconfig @@ -60,7 +60,7 @@ CONFIG_ARCH_DMA=n # Enable support for RAM-based functions # (If selected, then modifications are needed in ld.script as well) # -CONFIG_PIC32MX_RAMFUNCS=n +CONFIG_ARCH_RAMFUNCS=n # # Identify toolchain and linker options @@ -108,7 +108,6 @@ CONFIG_PIC32MX_ADC=n CONFIG_PIC32MX_CVR=n CONFIG_PIC32MX_CM1=n CONFIG_PIC32MX_CM2=n -CONFIG_PIC32MX_OSC=y CONFIG_PIC32MX_DDP=n CONFIG_PIC32MX_FLASH=n CONFIG_PIC32MX_BMX=n @@ -119,13 +118,6 @@ CONFIG_PIC32MX_USBHOST=n CONFIG_PIC32MX_CAN1=n CONFIG_PIC32MX_CAN2=n CONFIG_PIC32MX_ETHERNET=n -CONFIG_PIC32MX_IOPORTA=y -CONFIG_PIC32MX_IOPORTB=y -CONFIG_PIC32MX_IOPORTC=y -CONFIG_PIC32MX_IOPORTD=y -CONFIG_PIC32MX_IOPORTE=y -CONFIG_PIC32MX_IOPORTF=y -CONFIG_PIC32MX_IOPORTG=y # # PIC32MX Configuration Settings diff --git a/nuttx/configs/pic32mx7mmb/nsh/defconfig b/nuttx/configs/pic32mx7mmb/nsh/defconfig index d39f8bc405..66cd240e22 100644 --- a/nuttx/configs/pic32mx7mmb/nsh/defconfig +++ b/nuttx/configs/pic32mx7mmb/nsh/defconfig @@ -60,7 +60,7 @@ CONFIG_ARCH_DMA=n # Enable support for RAM-based functions # (If selected, then modifications are needed in ld.script as well) # -CONFIG_PIC32MX_RAMFUNCS=n +CONFIG_ARCH_RAMFUNCS=n # # Identify toolchain and linker options @@ -108,7 +108,6 @@ CONFIG_PIC32MX_ADC=n CONFIG_PIC32MX_CVR=n CONFIG_PIC32MX_CM1=n CONFIG_PIC32MX_CM2=n -CONFIG_PIC32MX_OSC=y CONFIG_PIC32MX_DDP=n CONFIG_PIC32MX_FLASH=n CONFIG_PIC32MX_BMX=n @@ -119,13 +118,6 @@ CONFIG_PIC32MX_USBHOST=n CONFIG_PIC32MX_CAN1=n CONFIG_PIC32MX_CAN2=n CONFIG_PIC32MX_ETHERNET=y -CONFIG_PIC32MX_IOPORTA=y -CONFIG_PIC32MX_IOPORTB=y -CONFIG_PIC32MX_IOPORTC=y -CONFIG_PIC32MX_IOPORTD=y -CONFIG_PIC32MX_IOPORTE=y -CONFIG_PIC32MX_IOPORTF=y -CONFIG_PIC32MX_IOPORTG=y # # PIC32MX Configuration Settings diff --git a/nuttx/configs/pic32mx7mmb/ostest/defconfig b/nuttx/configs/pic32mx7mmb/ostest/defconfig index b3cecf98d4..7cb71995eb 100644 --- a/nuttx/configs/pic32mx7mmb/ostest/defconfig +++ b/nuttx/configs/pic32mx7mmb/ostest/defconfig @@ -60,7 +60,7 @@ CONFIG_ARCH_DMA=n # Enable support for RAM-based functions # (If selected, then modifications are needed in ld.script as well) # -CONFIG_PIC32MX_RAMFUNCS=n +CONFIG_ARCH_RAMFUNCS=n # # Identify toolchain and linker options @@ -108,7 +108,6 @@ CONFIG_PIC32MX_ADC=n CONFIG_PIC32MX_CVR=n CONFIG_PIC32MX_CM1=n CONFIG_PIC32MX_CM2=n -CONFIG_PIC32MX_OSC=y CONFIG_PIC32MX_DDP=n CONFIG_PIC32MX_FLASH=n CONFIG_PIC32MX_BMX=n @@ -119,13 +118,6 @@ CONFIG_PIC32MX_USBHOST=n CONFIG_PIC32MX_CAN1=n CONFIG_PIC32MX_CAN2=n CONFIG_PIC32MX_ETHERNET=n -CONFIG_PIC32MX_IOPORTA=y -CONFIG_PIC32MX_IOPORTB=y -CONFIG_PIC32MX_IOPORTC=y -CONFIG_PIC32MX_IOPORTD=y -CONFIG_PIC32MX_IOPORTE=y -CONFIG_PIC32MX_IOPORTF=y -CONFIG_PIC32MX_IOPORTG=y # # PIC32MX Configuration Settings diff --git a/nuttx/configs/sure-pic32mx/nsh/defconfig b/nuttx/configs/sure-pic32mx/nsh/defconfig index 60c4dc53d6..07b31a1aea 100644 --- a/nuttx/configs/sure-pic32mx/nsh/defconfig +++ b/nuttx/configs/sure-pic32mx/nsh/defconfig @@ -62,7 +62,7 @@ CONFIG_ARCH_DMA=n # Enable support for RAM-based functions # (If selected, then modifications are needed in ld.script as well) # -CONFIG_PIC32MX_RAMFUNCS=n +CONFIG_ARCH_RAMFUNCS=n # # Identify toolchain and linker options @@ -103,7 +103,6 @@ CONFIG_PIC32MX_ADC=n CONFIG_PIC32MX_CVR=n CONFIG_PIC32MX_CM1=n CONFIG_PIC32MX_CM2=n -CONFIG_PIC32MX_OSC=y CONFIG_PIC32MX_DDP=n CONFIG_PIC32MX_FLASH=n CONFIG_PIC32MX_BMX=n @@ -111,13 +110,6 @@ CONFIG_PIC32MX_DMA=n CONFIG_PIC32MX_CHE=n CONFIG_PIC32MX_USBDEV=n CONFIG_PIC32MX_USBHOST=n -CONFIG_PIC32MX_IOPORTA=y -CONFIG_PIC32MX_IOPORTB=y -CONFIG_PIC32MX_IOPORTC=y -CONFIG_PIC32MX_IOPORTD=y -CONFIG_PIC32MX_IOPORTE=y -CONFIG_PIC32MX_IOPORTF=y -CONFIG_PIC32MX_IOPORTG=y # # PIC32MX Configuration Settings diff --git a/nuttx/configs/sure-pic32mx/ostest/defconfig b/nuttx/configs/sure-pic32mx/ostest/defconfig index 1bca11c479..86bb3b3073 100644 --- a/nuttx/configs/sure-pic32mx/ostest/defconfig +++ b/nuttx/configs/sure-pic32mx/ostest/defconfig @@ -62,7 +62,7 @@ CONFIG_ARCH_DMA=n # Enable support for RAM-based functions # (If selected, then modifications are needed in ld.script as well) # -CONFIG_PIC32MX_RAMFUNCS=n +CONFIG_ARCH_RAMFUNCS=n # # Identify toolchain and linker options @@ -103,7 +103,6 @@ CONFIG_PIC32MX_ADC=n CONFIG_PIC32MX_CVR=n CONFIG_PIC32MX_CM1=n CONFIG_PIC32MX_CM2=n -CONFIG_PIC32MX_OSC=y CONFIG_PIC32MX_DDP=n CONFIG_PIC32MX_FLASH=n CONFIG_PIC32MX_BMX=n @@ -111,13 +110,6 @@ CONFIG_PIC32MX_DMA=n CONFIG_PIC32MX_CHE=n CONFIG_PIC32MX_USBDEV=n CONFIG_PIC32MX_USBHOST=n -CONFIG_PIC32MX_IOPORTA=y -CONFIG_PIC32MX_IOPORTB=y -CONFIG_PIC32MX_IOPORTC=y -CONFIG_PIC32MX_IOPORTD=y -CONFIG_PIC32MX_IOPORTE=y -CONFIG_PIC32MX_IOPORTF=y -CONFIG_PIC32MX_IOPORTG=y # # PIC32MX Configuration Settings diff --git a/nuttx/configs/sure-pic32mx/usbnsh/defconfig b/nuttx/configs/sure-pic32mx/usbnsh/defconfig index 978e165413..9f6046f216 100644 --- a/nuttx/configs/sure-pic32mx/usbnsh/defconfig +++ b/nuttx/configs/sure-pic32mx/usbnsh/defconfig @@ -62,7 +62,7 @@ CONFIG_ARCH_DMA=n # Enable support for RAM-based functions # (If selected, then modifications are needed in ld.script as well) # -CONFIG_PIC32MX_RAMFUNCS=n +CONFIG_ARCH_RAMFUNCS=n # # Identify toolchain and linker options @@ -103,7 +103,6 @@ CONFIG_PIC32MX_ADC=n CONFIG_PIC32MX_CVR=n CONFIG_PIC32MX_CM1=n CONFIG_PIC32MX_CM2=n -CONFIG_PIC32MX_OSC=y CONFIG_PIC32MX_DDP=n CONFIG_PIC32MX_FLASH=n CONFIG_PIC32MX_BMX=n @@ -111,13 +110,6 @@ CONFIG_PIC32MX_DMA=n CONFIG_PIC32MX_CHE=n CONFIG_PIC32MX_USBDEV=y CONFIG_PIC32MX_USBHOST=n -CONFIG_PIC32MX_IOPORTA=y -CONFIG_PIC32MX_IOPORTB=y -CONFIG_PIC32MX_IOPORTC=y -CONFIG_PIC32MX_IOPORTD=y -CONFIG_PIC32MX_IOPORTE=y -CONFIG_PIC32MX_IOPORTF=y -CONFIG_PIC32MX_IOPORTG=y # # PIC32MX Configuration Settings diff --git a/nuttx/configs/twr-k60n512/nsh/defconfig b/nuttx/configs/twr-k60n512/nsh/defconfig index 7a4bb3b3a7..3f272b55a2 100644 --- a/nuttx/configs/twr-k60n512/nsh/defconfig +++ b/nuttx/configs/twr-k60n512/nsh/defconfig @@ -462,7 +462,7 @@ CONFIG_EXAMPLES_USBSERIAL_TRACEINTERRUPTS=n # CONFIG_BOOT_RUNFROMFLASH=n CONFIG_BOOT_COPYTORAM=n -CONFIG_BOOT_RAMFUNCS=y +CONFIG_ARCH_RAMFUNCS=y CONFIG_CUSTOM_STACK=n CONFIG_IDLETHREAD_STACKSIZE=1024 CONFIG_USERMAIN_STACKSIZE=2048 diff --git a/nuttx/configs/twr-k60n512/ostest/defconfig b/nuttx/configs/twr-k60n512/ostest/defconfig index 355e5773b4..fd27ffc2bc 100644 --- a/nuttx/configs/twr-k60n512/ostest/defconfig +++ b/nuttx/configs/twr-k60n512/ostest/defconfig @@ -459,7 +459,7 @@ CONFIG_EXAMPLES_USBSERIAL_TRACEINTERRUPTS=n # CONFIG_BOOT_RUNFROMFLASH=n CONFIG_BOOT_COPYTORAM=n -CONFIG_BOOT_RAMFUNCS=y +CONFIG_ARCH_RAMFUNCS=y CONFIG_CUSTOM_STACK=n CONFIG_IDLETHREAD_STACKSIZE=1024 CONFIG_USERMAIN_STACKSIZE=2048 diff --git a/nuttx/configs/ubw32/README.txt b/nuttx/configs/ubw32/README.txt index 801be39a9a..63cb1bb54b 100644 --- a/nuttx/configs/ubw32/README.txt +++ b/nuttx/configs/ubw32/README.txt @@ -586,15 +586,26 @@ Where is one of the following: This configuration directory, performs a simple OS test using apps/examples/ostest. - Serial Output. - -------------- - The OS test produces all of its test output on the serial console. - This configuration has UART1 enabled as a serial console. + NOTES: + ------ + 1. This configuration uses the mconf-based configuration tool. To + change this configuration using that tool, you should: - TX -- J4 pin 31: U1TX/RF8 - RX -- J4 pin 30: U1RX/RF2 - GND -- J4 pin 40: GND - Vcc -- J4 pin 39: 5V + a. Build and install the kconfig-mconf tool. See nuttx/README.txt + and misc/tools/ + + b. Execute 'make menuconfig' in nuttx/ in order to start the + reconfiguration process. + + 2. Serial Output. + + The OS test produces all of its test output on the serial console. + This configuration has UART1 enabled as a serial console. + + TX -- J4 pin 31: U1TX/RF8 + RX -- J4 pin 30: U1RX/RF2 + GND -- J4 pin 40: GND + Vcc -- J4 pin 39: 5V nsh: ==== diff --git a/nuttx/configs/ubw32/nsh/Make.defs b/nuttx/configs/ubw32/nsh/Make.defs index ae0e44ae44..f393bbfdf1 100644 --- a/nuttx/configs/ubw32/nsh/Make.defs +++ b/nuttx/configs/ubw32/nsh/Make.defs @@ -44,13 +44,13 @@ ifeq ($(WINTOOL),y) MKDEP = $(TOPDIR)/tools/mknulldeps.sh ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}" - ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/nsh/ld.script}" + ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/scripts/ld.script}" else # Linux/Cygwin-native toolchain MKDEP = $(TOPDIR)/tools/mkdeps.sh ARCHINCLUDES = -I. -isystem $(TOPDIR)/include ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx - ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/nsh/ld.script + ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/scripts/ld.script endif CC = $(CROSSDEV)gcc diff --git a/nuttx/configs/ubw32/nsh/defconfig b/nuttx/configs/ubw32/nsh/defconfig index ad18c12b6a..89afd59129 100644 --- a/nuttx/configs/ubw32/nsh/defconfig +++ b/nuttx/configs/ubw32/nsh/defconfig @@ -60,7 +60,7 @@ CONFIG_ARCH_DMA=n # Enable support for RAM-based functions # (If selected, then modifications are needed in ld.script as well) # -CONFIG_PIC32MX_RAMFUNCS=n +CONFIG_ARCH_RAMFUNCS=n # # Identify toolchain and linker options @@ -102,7 +102,6 @@ CONFIG_PIC32MX_ADC=n CONFIG_PIC32MX_CVR=n CONFIG_PIC32MX_CM1=n CONFIG_PIC32MX_CM2=n -CONFIG_PIC32MX_OSC=y CONFIG_PIC32MX_DDP=n CONFIG_PIC32MX_FLASH=n CONFIG_PIC32MX_BMX=n @@ -110,13 +109,6 @@ CONFIG_PIC32MX_DMA=n CONFIG_PIC32MX_CHE=n CONFIG_PIC32MX_USBDEV=n CONFIG_PIC32MX_USBHOST=n -CONFIG_PIC32MX_IOPORTA=y -CONFIG_PIC32MX_IOPORTB=y -CONFIG_PIC32MX_IOPORTC=y -CONFIG_PIC32MX_IOPORTD=y -CONFIG_PIC32MX_IOPORTE=y -CONFIG_PIC32MX_IOPORTF=y -CONFIG_PIC32MX_IOPORTG=y # # PIC32MX Configuration Settings diff --git a/nuttx/configs/ubw32/ostest/Make.defs b/nuttx/configs/ubw32/ostest/Make.defs index 54276acf73..b465899137 100644 --- a/nuttx/configs/ubw32/ostest/Make.defs +++ b/nuttx/configs/ubw32/ostest/Make.defs @@ -44,13 +44,13 @@ ifeq ($(WINTOOL),y) MKDEP = $(TOPDIR)/tools/mknulldeps.sh ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}" - ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/ostest/ld.script}" + ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/scripts/ld.script}" else # Linux/Cygwin-native toolchain MKDEP = $(TOPDIR)/tools/mkdeps.sh ARCHINCLUDES = -I. -isystem $(TOPDIR)/include ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx - ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/ostest/ld.script + ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/scripts/ld.script endif CC = $(CROSSDEV)gcc diff --git a/nuttx/configs/ubw32/ostest/appconfig b/nuttx/configs/ubw32/ostest/appconfig deleted file mode 100644 index 6278529fac..0000000000 --- a/nuttx/configs/ubw32/ostest/appconfig +++ /dev/null @@ -1,39 +0,0 @@ -############################################################################ -# configs/ubw32/ostest/appconfig -# -# Copyright (C) 2012 Gregory Nutt. All rights reserved. -# Author: Gregory Nutt -# -# 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. -# -############################################################################ - -# Path to example in apps/examples containing the user_start entry point - -CONFIGURED_APPS += examples/ostest - diff --git a/nuttx/configs/ubw32/ostest/defconfig b/nuttx/configs/ubw32/ostest/defconfig index 60322d4f6a..3a387ab997 100644 --- a/nuttx/configs/ubw32/ostest/defconfig +++ b/nuttx/configs/ubw32/ostest/defconfig @@ -1,249 +1,334 @@ -############################################################################ -# configs/ubw32/ostest/defconfig # -# Copyright (C) 2012 Gregory Nutt. All rights reserved. -# Author: Gregory Nutt +# Automatically generated file; DO NOT EDIT. +# Nuttx/ Configuration # -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: +CONFIG_NUTTX_NEWCONFIG=y + # -# 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. +# Build Setup # -# 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. +# CONFIG_EXPERIMENTAL is not set +# CONFIG_HOST_LINUX is not set +# CONFIG_HOST_OSX is not set +CONFIG_HOST_WINDOWS=y +# CONFIG_HOST_OTHER is not set +# CONFIG_WINDOWS_NATIVE is not set +CONFIG_WINDOWS_CYGWIN=y +# CONFIG_WINDOWS_MSYS is not set +# CONFIG_WINDOWS_OTHER is not set + # -############################################################################ +# Build Configuration # -# Architecture Selection +# CONFIG_APPS_DIR="../apps" +# CONFIG_BUILD_2PASS is not set + # -CONFIG_ARCH="mips" +# Binary Output Formats +# +# CONFIG_RRLOAD_BINARY is not set +CONFIG_INTELHEX_BINARY=y +# CONFIG_MOTOROLA_SREC is not set +# CONFIG_RAW_BINARY is not set + +# +# Customize Header Files +# +# CONFIG_ARCH_STDBOOL_H is not set +# CONFIG_ARCH_MATH_H is not set +# CONFIG_ARCH_FLOAT_H is not set +# CONFIG_ARCH_STDARG_H is not set + +# +# Debug Options +# +# CONFIG_DEBUG is not set +# CONFIG_DEBUG_SYMBOLS is not set + +# +# System Type +# +# CONFIG_ARCH_8051 is not set +# CONFIG_ARCH_ARM is not set +# CONFIG_ARCH_AVR is not set +# CONFIG_ARCH_HC is not set CONFIG_ARCH_MIPS=y -CONFIG_ARCH_MIPS32=y +# CONFIG_ARCH_RGMP is not set +# CONFIG_ARCH_SH is not set +# CONFIG_ARCH_SIM is not set +# CONFIG_ARCH_X86 is not set +# CONFIG_ARCH_Z16 is not set +# CONFIG_ARCH_Z80 is not set +CONFIG_ARCH="mips" +CONFIG_ARCH_FAMILY="mips32" CONFIG_ARCH_CHIP="pic32mx" -CONFIG_ARCH_CHIP_PIC32MX460F512L=y -CONFIG_ARCH_BOARD="ubw32" -CONFIG_ARCH_BOARD_UBW32=y CONFIG_BOARD_LOOPSPERMSEC=8079 -CONFIG_DRAM_SIZE=32768 -CONFIG_DRAM_START=0xa0000000 -CONFIG_ARCH_NOINTC=n -CONFIG_ARCH_VECNOTIRQ=y -CONFIG_ARCH_IRQPRIO=y -CONFIG_ARCH_INTERRUPTSTACK=0 -CONFIG_ARCH_STACKDUMP=y -CONFIG_ARCH_BOOTLOADER=n -CONFIG_ARCH_LEDS=y -CONFIG_ARCH_BUTTONS=n -CONFIG_ARCH_CALIBRATION=n -CONFIG_ARCH_DMA=n +# CONFIG_ARCH_CALIBRATION is not set +# CONFIG_SERIAL_TERMIOS is not set +CONFIG_ARCH_CHIP_PIC32MX=y +CONFIG_ARCH_MIPS32=y # -# Enable support for RAM-based functions -# (If selected, then modifications are needed in ld.script as well) +# MIPS32 Configuration Options # -CONFIG_PIC32MX_RAMFUNCS=n +# CONFIG_MIPS32_TOOLCHAIN_GNU_ELF is not set +# CONFIG_MIPS32_TOOLCHAIN_MICROCHIPL is not set +# CONFIG_MIPS32_TOOLCHAIN_MICROCHIPL_LITE is not set +# CONFIG_MIPS32_TOOLCHAIN_MICROCHIPW is not set +CONFIG_MIPS32_TOOLCHAIN_MICROCHIPW_LITE=y +# CONFIG_MIPS32_TOOLCHAIN_MICROCHIPOPENL is not set +# CONFIG_MIPS32_TOOLCHAIN_PINGUINOW is not set +# CONFIG_MIPS32_TOOLCHAIN_PINGUINOL is not set # -# Identify toolchain and linker options +# PIC32MX Configuration Options # -CONFIG_PIC32MX_MICROCHIPW=n -CONFIG_PIC32MX_MICROCHIPL=n -CONFIG_PIC32MX_MICROCHIPW_LITE=y -CONFIG_PIC32MX_MICROCHIPL_LITE=n +# CONFIG_ARCH_CHIP_PIC32MX110F016B is not set +# CONFIG_ARCH_CHIP_PIC32MX110F016C is not set +# CONFIG_ARCH_CHIP_PIC32MX110F016D is not set +# CONFIG_ARCH_CHIP_PIC32MX120F032B is not set +# CONFIG_ARCH_CHIP_PIC32MX120F032C is not set +# CONFIG_ARCH_CHIP_PIC32MX120F032D is not set +# CONFIG_ARCH_CHIP_PIC32MX130F064B is not set +# CONFIG_ARCH_CHIP_PIC32MX130F064C is not set +# CONFIG_ARCH_CHIP_PIC32MX130F064D is not set +# CONFIG_ARCH_CHIP_PIC32MX150F128B is not set +# CONFIG_ARCH_CHIP_PIC32MX150F128C is not set +# CONFIG_ARCH_CHIP_PIC32MX150F128D is not set +# CONFIG_ARCH_CHIP_PIC32MX210F016B is not set +# CONFIG_ARCH_CHIP_PIC32MX210F016C is not set +# CONFIG_ARCH_CHIP_PIC32MX210F016D is not set +# CONFIG_ARCH_CHIP_PIC32MX220F032B is not set +# CONFIG_ARCH_CHIP_PIC32MX220F032C is not set +# CONFIG_ARCH_CHIP_PIC32MX220F032D is not set +# CONFIG_ARCH_CHIP_PIC32MX230F064B is not set +# CONFIG_ARCH_CHIP_PIC32MX230F064C is not set +# CONFIG_ARCH_CHIP_PIC32MX230F064D is not set +# CONFIG_ARCH_CHIP_PIC32MX250F128B is not set +# CONFIG_ARCH_CHIP_PIC32MX250F128C is not set +# CONFIG_ARCH_CHIP_PIC32MX250F128D is not set +# CONFIG_ARCH_CHIP_PIC32MX320F032H is not set +# CONFIG_ARCH_CHIP_PIC32MX320F064H is not set +# CONFIG_ARCH_CHIP_PIC32MX320F128H is not set +# CONFIG_ARCH_CHIP_PIC32MX320F128L is not set +# CONFIG_ARCH_CHIP_PIC32MX340F128H is not set +# CONFIG_ARCH_CHIP_PIC32MX340F256H is not set +# CONFIG_ARCH_CHIP_PIC32MX340F512H is not set +# CONFIG_ARCH_CHIP_PIC32MX340F128L is not set +# CONFIG_ARCH_CHIP_PIC32MX360F256L is not set +# CONFIG_ARCH_CHIP_PIC32MX360F512L is not set +# CONFIG_ARCH_CHIP_PIC32MX420F032H is not set +# CONFIG_ARCH_CHIP_PIC32MX440F128H is not set +# CONFIG_ARCH_CHIP_PIC32MX440F128L is not set +# CONFIG_ARCH_CHIP_PIC32MX440F256H is not set +# CONFIG_ARCH_CHIP_PIC32MX440F512H is not set +# CONFIG_ARCH_CHIP_PIC32MX460F256L is not set +CONFIG_ARCH_CHIP_PIC32MX460F512L=y +# CONFIG_ARCH_CHIP_PIC32MX534F064H is not set +# CONFIG_ARCH_CHIP_PIC32MX534F064L is not set +# CONFIG_ARCH_CHIP_PIC32MX564F064H is not set +# CONFIG_ARCH_CHIP_PIC32MX564F064L is not set +# CONFIG_ARCH_CHIP_PIC32MX564F128H is not set +# CONFIG_ARCH_CHIP_PIC32MX564F128L is not set +# CONFIG_ARCH_CHIP_PIC32MX575F256H is not set +# CONFIG_ARCH_CHIP_PIC32MX575F256L is not set +# CONFIG_ARCH_CHIP_PIC32MX575F512H is not set +# CONFIG_ARCH_CHIP_PIC32MX575F512L is not set +# CONFIG_ARCH_CHIP_PIC32MX664F064H is not set +# CONFIG_ARCH_CHIP_PIC32MX664F064L is not set +# CONFIG_ARCH_CHIP_PIC32MX664F128H is not set +# CONFIG_ARCH_CHIP_PIC32MX664F128L is not set +# CONFIG_ARCH_CHIP_PIC32MX675F256H is not set +# CONFIG_ARCH_CHIP_PIC32MX675F256L is not set +# CONFIG_ARCH_CHIP_PIC32MX675F512H is not set +# CONFIG_ARCH_CHIP_PIC32MX675F512L is not set +# CONFIG_ARCH_CHIP_PIC32MX695F512H is not set +# CONFIG_ARCH_CHIP_PIC32MX695F512L is not set +# CONFIG_ARCH_CHIP_PIC32MX764F128H is not set +# CONFIG_ARCH_CHIP_PIC32MX764F128L is not set +# CONFIG_ARCH_CHIP_PIC32MX775F256H is not set +# CONFIG_ARCH_CHIP_PIC32MX775F256L is not set +# CONFIG_ARCH_CHIP_PIC32MX775F512H is not set +# CONFIG_ARCH_CHIP_PIC32MX775F512L is not set +# CONFIG_ARCH_CHIP_PIC32MX795F512H is not set +# CONFIG_ARCH_CHIP_PIC32MX795F512L is not set +CONFIG_ARCH_CHIP_PIC32MX4=y +# CONFIG_PIC32MX_MVEC is not set +CONFIG_PIC32MX_T1=y # -# Individual subsystems can be enabled: +# PIC32MX Peripheral Support # - -CONFIG_PIC32MX_WDT=n -CONFIG_PIC32MX_RTCC=n -CONFIG_PIC32MX_TIMER1=n -CONFIG_PIC32MX_TIMER2=n -CONFIG_PIC32MX_TIMER3=n -CONFIG_PIC32MX_TIMER4=n -CONFIG_PIC32MX_TIMER5=n -CONFIG_PIC32MX_IC1=n -CONFIG_PIC32MX_IC2=n -CONFIG_PIC32MX_IC3=n -CONFIG_PIC32MX_IC4=n -CONFIG_PIC32MX_IC5=n -CONFIG_PIC32MX_OC1=n -CONFIG_PIC32MX_OC2=n -CONFIG_PIC32MX_OC3=n -CONFIG_PIC32MX_OC4=n -CONFIG_PIC32MX_OC5=n -CONFIG_PIC32MX_I2C1=n -CONFIG_PIC32MX_I2C2=n -CONFIG_PIC32MX_SPI1=n -CONFIG_PIC32MX_SPI2=n +# CONFIG_PIC32MX_WDT is not set +# CONFIG_PIC32MX_T2 is not set +# CONFIG_PIC32MX_T3 is not set +# CONFIG_PIC32MX_T4 is not set +# CONFIG_PIC32MX_T5 is not set +# CONFIG_PIC32MX_IC1 is not set +# CONFIG_PIC32MX_IC2 is not set +# CONFIG_PIC32MX_IC3 is not set +# CONFIG_PIC32MX_IC4 is not set +# CONFIG_PIC32MX_IC5 is not set +# CONFIG_PIC32MX_OC1 is not set +# CONFIG_PIC32MX_OC2 is not set +# CONFIG_PIC32MX_OC3 is not set +# CONFIG_PIC32MX_OC4 is not set +# CONFIG_PIC32MX_OC5 is not set +# CONFIG_PIC32MX_I2C1 is not set +# CONFIG_PIC32MX_I2C2 is not set +# CONFIG_PIC32MX_I2C3 is not set +# CONFIG_PIC32MX_I2C4 is not set +# CONFIG_PIC32MX_I2C5 is not set +# CONFIG_PIC32MX_SPI1 is not set +# CONFIG_PIC32MX_SPI2 is not set +# CONFIG_PIC32MX_SPI3 is not set +# CONFIG_PIC32MX_SPI4 is not set CONFIG_PIC32MX_UART1=y -CONFIG_PIC32MX_UART2=n -CONFIG_PIC32MX_PMP=n -CONFIG_PIC32MX_ADC=n -CONFIG_PIC32MX_CVR=n -CONFIG_PIC32MX_CM1=n -CONFIG_PIC32MX_CM2=n -CONFIG_PIC32MX_OSC=y -CONFIG_PIC32MX_DDP=n -CONFIG_PIC32MX_FLASH=n -CONFIG_PIC32MX_BMX=n -CONFIG_PIC32MX_DMA=n -CONFIG_PIC32MX_CHE=n -CONFIG_PIC32MX_USBDEV=n -CONFIG_PIC32MX_USBHOST=n -CONFIG_PIC32MX_IOPORTA=y -CONFIG_PIC32MX_IOPORTB=y -CONFIG_PIC32MX_IOPORTC=y -CONFIG_PIC32MX_IOPORTD=y -CONFIG_PIC32MX_IOPORTE=y -CONFIG_PIC32MX_IOPORTF=y -CONFIG_PIC32MX_IOPORTG=y +# CONFIG_PIC32MX_UART2 is not set +# CONFIG_PIC32MX_UART3 is not set +# CONFIG_PIC32MX_UART4 is not set +# CONFIG_PIC32MX_UART5 is not set +# CONFIG_PIC32MX_UART6 is not set +# CONFIG_PIC32MX_ADC is not set +# CONFIG_PIC32MX_PMP is not set +# CONFIG_PIC32MX_CM1 is not set +# CONFIG_PIC32MX_CM2 is not set +# CONFIG_PIC32MX_CM3 is not set +# CONFIG_PIC32MX_RTCC is not set +# CONFIG_PIC32MX_DMA is not set +# CONFIG_PIC32MX_FLASH is not set +# CONFIG_PIC32MX_USBDEV is not set +# CONFIG_PIC32MX_USBHOST is not set +# CONFIG_PIC32MX_CAN1 is not set +# CONFIG_PIC32MX_CAN2 is not set +# CONFIG_PIC32MX_ETHERNET is not set +# CONFIG_PIC32MX_CTMU is not set # -# PIC32MX Configuration Settings +# PIC32MX Peripheral Interrupt Priorities +# +CONFIG_PIC32MX_CTPRIO=16 +CONFIG_PIC32MX_CS0PRIO=16 +CONFIG_PIC32MX_CS1PRIO=16 +CONFIG_PIC32MX_INT0PRIO=16 +CONFIG_PIC32MX_INT1PRIO=16 +CONFIG_PIC32MX_INT2PRIO=16 +CONFIG_PIC32MX_INT3PRIO=16 +CONFIG_PIC32MX_INT4PRIO=16 +CONFIG_PIC32MX_T1PRIO=16 +CONFIG_PIC32MX_UART1PRIO=16 + +# +# Device Configuration 0 (DEVCFG0) # CONFIG_PIC32MX_DEBUGGER=2 CONFIG_PIC32MX_ICESEL=1 +CONFIG_PIC32MX_PROGFLASHWP=0xff +CONFIG_PIC32MX_BOOTFLASHWP=1 +CONFIG_PIC32MX_CODEWP=1 # -# PIC32MX specific serial device driver settings +# Device Configuration 3 (DEVCFG3) # -CONFIG_UART1_SERIAL_CONSOLE=y -CONFIG_UART2_SERIAL_CONSOLE=n - -CONFIG_UART1_TXBUFSIZE=256 -CONFIG_UART2_TXBUFSIZE=256 - -CONFIG_UART1_RXBUFSIZE=256 -CONFIG_UART2_RXBUFSIZE=256 - -CONFIG_UART1_BAUD=115200 -CONFIG_UART2_BAUD=115200 - -CONFIG_UART1_BITS=8 -CONFIG_UART2_BITS=8 - -CONFIG_UART1_PARITY=0 -CONFIG_UART2_PARITY=0 - -CONFIG_UART1_2STOP=0 -CONFIG_UART2_2STOP=0 +CONFIG_PIC32MX_USBIDO=0 +CONFIG_PIC32MX_VBUSIO=0 +# CONFIG_PIC32MX_WDENABLE is not set +CONFIG_PIC32MX_FETHIO=1 +CONFIG_PIC32MX_FMIIEN=1 # -# General build options +# Architecture Options # -CONFIG_RRLOAD_BINARY=n -CONFIG_INTELHEX_BINARY=y -CONFIG_MOTOROLA_SREC=n -CONFIG_RAW_BINARY=n +# CONFIG_ARCH_NOINTC is not set +CONFIG_ARCH_VECNOTIRQ=y +# CONFIG_ARCH_DMA is not set +CONFIG_ARCH_IRQPRIO=y +# CONFIG_CUSTOM_STACK is not set +# CONFIG_ADDRENV is not set +# CONFIG_ARCH_HAVE_VFORK is not set +CONFIG_ARCH_STACKDUMP=y +# CONFIG_ENDIAN_BIG is not set +CONFIG_ARCH_HAVE_RAMFUNCS=y +# CONFIG_ARCH_RAMFUNCS is not set # -# General OS setup +# Board Settings # -CONFIG_USER_ENTRYPOINT="ostest_main" -CONFIG_DEBUG=n -CONFIG_DEBUG_VERBOSE=n -CONFIG_DEBUG_SYMBOLS=n -CONFIG_DEBUG_SCHED=n +CONFIG_DRAM_START=0xa0000000 +CONFIG_DRAM_SIZE=32768 +CONFIG_ARCH_HAVE_INTERRUPTSTACK=y +CONFIG_ARCH_INTERRUPTSTACK=0 -CONFIG_MM_REGIONS=1 -CONFIG_ARCH_LOWPUTC=y +# +# Boot options +# +# CONFIG_BOOT_RUNFROMEXTSRAM is not set +CONFIG_BOOT_RUNFROMFLASH=y +# CONFIG_BOOT_RUNFROMISRAM is not set +# CONFIG_BOOT_RUNFROMSDRAM is not set +# CONFIG_BOOT_COPYTORAM is not set + +# +# Board Selection +# +# CONFIG_ARCH_BOARD_PCBLOGICPIC32MX is not set +CONFIG_ARCH_BOARD_UBW32=y +# CONFIG_ARCH_BOARD_CUSTOM is not set +CONFIG_ARCH_BOARD="ubw32" + +# +# Common Board Options +# +CONFIG_ARCH_HAVE_LEDS=y +CONFIG_ARCH_LEDS=y +CONFIG_ARCH_HAVE_BUTTONS=y +# CONFIG_ARCH_BUTTONS is not set +CONFIG_ARCH_HAVE_IRQBUTTONS=y + +# +# Board-Specific Options +# + +# +# RTOS Features +# +CONFIG_MSEC_PER_TICK=10 CONFIG_RR_INTERVAL=0 -CONFIG_SCHED_INSTRUMENTATION=n +# CONFIG_SCHED_INSTRUMENTATION is not set CONFIG_TASK_NAME_SIZE=0 +# CONFIG_SCHED_HAVE_PARENT is not set +# CONFIG_JULIAN_TIME is not set CONFIG_START_YEAR=2012 CONFIG_START_MONTH=4 CONFIG_START_DAY=26 -CONFIG_GREGORIAN_TIME=n -CONFIG_JULIAN_TIME=n CONFIG_DEV_CONSOLE=y -CONFIG_DEV_LOWCONSOLE=y -CONFIG_MUTEX_TYPES=n -CONFIG_PRIORITY_INHERITANCE=n -CONFIG_SEM_PREALLOCHOLDERS=0 -CONFIG_SEM_NNESTPRIO=0 -CONFIG_FDCLONE_DISABLE=n -CONFIG_FDCLONE_STDIO=n +# CONFIG_MUTEX_TYPES is not set +# CONFIG_PRIORITY_INHERITANCE is not set +# CONFIG_FDCLONE_DISABLE is not set +# CONFIG_FDCLONE_STDIO is not set CONFIG_SDCLONE_DISABLE=y -CONFIG_SCHED_WORKQUEUE=n -CONFIG_SCHED_WORKPRIORITY=192 -CONFIG_SCHED_WORKPERIOD=50000 -CONFIG_SCHED_WORKSTACKSIZE=1024 -CONFIG_SIG_SIGWORK=17 -CONFIG_SCHED_WAITPID=n -CONFIG_SCHED_ATEXIT=n - -# -# Settings for nxflat -# -CONFIG_NXFLAT=n -CONFIG_NXFLAT_DUMPBUFFER=n -CONFIG_SYMTAB_ORDEREDBYNAME=y - -# -# The following can be used to disable categories of -# APIs supported by the OS. If the compiler supports -# weak functions, then it should not be necessary to -# disable functions unless you want to restrict usage -# of those APIs. -# -# There are certain dependency relationships in these -# features. -# -# o mq_notify logic depends on signals to awaken tasks -# waiting for queues to become full or empty. -# o pthread_condtimedwait() depends on signals to wake -# up waiting tasks. -# -CONFIG_DISABLE_CLOCK=n -CONFIG_DISABLE_POSIX_TIMERS=n -CONFIG_DISABLE_PTHREAD=n -CONFIG_DISABLE_SIGNALS=n -CONFIG_DISABLE_MQUEUE=n +# CONFIG_SCHED_WORKQUEUE is not set +# CONFIG_SCHED_WAITPID is not set +# CONFIG_SCHED_ATEXIT is not set +# CONFIG_SCHED_ONEXIT is not set +CONFIG_USER_ENTRYPOINT="ostest_main" +CONFIG_DISABLE_OS_API=y +# CONFIG_DISABLE_CLOCK is not set +# CONFIG_DISABLE_POSIX_TIMERS is not set +# CONFIG_DISABLE_PTHREAD is not set +# CONFIG_DISABLE_SIGNALS is not set +# CONFIG_DISABLE_MQUEUE is not set CONFIG_DISABLE_MOUNTPOINT=y CONFIG_DISABLE_ENVIRON=y CONFIG_DISABLE_POLL=y # -# Misc libc settings +# Signal Numbers # -CONFIG_NOPRINTF_FIELDWIDTH=n - -# -# Allow for architecture optimized implementations -# -# The architecture can provide optimized versions of the -# following to improve system performance -# -CONFIG_ARCH_MEMCPY=n -CONFIG_ARCH_MEMCMP=n -CONFIG_ARCH_MEMMOVE=n -CONFIG_ARCH_MEMSET=n -CONFIG_ARCH_STRCMP=n -CONFIG_ARCH_STRCPY=n -CONFIG_ARCH_STRNCPY=n -CONFIG_ARCH_STRLEN=n -CONFIG_ARCH_STRNLEN=n -CONFIG_ARCH_BZERO=n +CONFIG_SIG_SIGUSR1=1 +CONFIG_SIG_SIGUSR2=2 +CONFIG_SIG_SIGALARM=3 +CONFIG_SIG_SIGCONDTIMEDOUT=16 # # Sizes of configurable things (0 disables) @@ -254,260 +339,306 @@ CONFIG_NPTHREAD_KEYS=4 CONFIG_NFILE_DESCRIPTORS=8 CONFIG_NFILE_STREAMS=8 CONFIG_NAME_MAX=32 -CONFIG_STDIO_BUFFER_SIZE=256 -CONFIG_STDIO_LINEBUFFER=y -CONFIG_NUNGET_CHARS=2 CONFIG_PREALLOC_MQ_MSGS=4 CONFIG_MQ_MAXMSGSIZE=32 CONFIG_MAX_WDOGPARMS=2 CONFIG_PREALLOC_WDOGS=4 CONFIG_PREALLOC_TIMERS=4 -# -# Filesystem configuration -# -CONFIG_FS_FAT=n -CONFIG_FAT_LCNAMES=y -CONFIG_FAT_LFN=y -CONFIG_FAT_MAXFNAME=32 -CONFIG_FS_NXFFS=n -CONFIG_FS_ROMFS=n - -# -# Maintain legacy build behavior (revisit) -# - -CONFIG_MMCSD=y -CONFIG_MMCSD_SPI=y -CONFIG_MMCSD_SDIO=y - -# -# SPI-based MMC/SD driver -# -CONFIG_MMCSD_NSLOTS=1 -CONFIG_MMCSD_READONLY=n -CONFIG_MMCSD_SPICLOCK=12500000 - -# -# Block driver buffering -# -CONFIG_FS_READAHEAD=n -CONFIG_FS_WRITEBUFFER=n - -# -# SDIO-based MMC/SD driver -# -CONFIG_SDIO_DMA=n -CONFIG_MMCSD_MMCSUPPORT=n -CONFIG_MMCSD_HAVECARDDETECT=n - -# -# TCP/IP and UDP support via uIP -# -CONFIG_NET=n -CONFIG_NET_IPv6=n -CONFIG_NSOCKET_DESCRIPTORS=0 -CONFIG_NET_SOCKOPTS=y -CONFIG_NET_BUFSIZE=420 -CONFIG_NET_TCP=n -CONFIG_NET_TCP_CONNS=40 -CONFIG_NET_MAX_LISTENPORTS=40 -CONFIG_NET_UDP=n -CONFIG_NET_UDP_CHECKSUMS=y -#CONFIG_NET_UDP_CONNS=10 -CONFIG_NET_ICMP=n -CONFIG_NET_ICMP_PING=n -#CONFIG_NET_PINGADDRCONF=0 -CONFIG_NET_STATISTICS=y -#CONFIG_NET_RECEIVE_WINDOW= -#CONFIG_NET_ARPTAB_SIZE=8 -CONFIG_NET_BROADCAST=n - -# -# UIP Network Utilities -# -CONFIG_NET_DHCP_LIGHT=n -CONFIG_NET_RESOLV_ENTRIES=4 - -# -# USB Device Configuration -# -CONFIG_USBDEV=n -CONFIG_USBDEV_ISOCHRONOUS=n -CONFIG_USBDEV_DUALSPEED=n -CONFIG_USBDEV_SELFPOWERED=y -CONFIG_USBDEV_REMOTEWAKEUP=n -CONFIG_USBDEV_MAXPOWER=100 -CONFIG_USBDEV_TRACE=n -CONFIG_USBDEV_TRACE_NRECORDS=128 - -# -# USB Serial Device Configuration -# -CONFIG_PL2303=n -CONFIG_PL2303_EPINTIN=1 -CONFIG_PL2303_EPBULKOUT=2 -CONFIG_PL2303_EPBULKIN=5 -CONFIG_PL2303_NWRREQS=4 -CONFIG_PL2303_NRDREQS=4 -CONFIG_PL2303_VENDORID=0x067b -CONFIG_PL2303_PRODUCTID=0x2303 -CONFIG_PL2303_VENDORSTR="Nuttx" -CONFIG_PL2303_PRODUCTSTR="USBdev Serial" -CONFIG_PL2303_RXBUFSIZE=512 -CONFIG_PL2303_TXBUFSIZE=512 - -# -# USB serial device class driver (Standard CDC ACM class) -# -CONFIG_CDCACM=n -CONFIG_CDCACM_CONSOLE=n -#CONFIG_CDCACM_EP0MAXPACKET -CONFIG_CDCACM_EPINTIN=1 -#CONFIG_CDCACM_EPINTIN_FSSIZE -#CONFIG_CDCACM_EPINTIN_HSSIZE -CONFIG_CDCACM_EPBULKOUT=3 -#CONFIG_CDCACM_EPBULKOUT_FSSIZE -#CONFIG_CDCACM_EPBULKOUT_HSSIZE -CONFIG_CDCACM_EPBULKIN=2 -#CONFIG_CDCACM_EPBULKIN_FSSIZE -#CONFIG_CDCACM_EPBULKIN_HSSIZE -#CONFIG_CDCACM_NWRREQS -#CONFIG_CDCACM_NRDREQS -#CONFIG_CDCACM_VENDORID -#CONFIG_CDCACM_VENDORSTR -#CONFIG_CDCACM_PRODUCTID -#CONFIG_CDCACM_PRODUCTSTR -#CONFIG_CDCACM_RXBUFSIZE -#CONFIG_CDCACM_TXBUFSIZE - -# -# USB Storage Device Configuration -# -CONFIG_USBMSC=n -CONFIG_USBMSC_EP0MAXPACKET=64 -CONFIG_USBMSC_EPBULKOUT=1 -CONFIG_USBMSC_EPBULKIN=2 -CONFIG_USBMSC_NRDREQS=8 -CONFIG_USBMSC_NWRREQS=2 -CONFIG_USBMSC_BULKINREQLEN=256 -CONFIG_USBMSC_BULKOUTREQLEN=64 -CONFIG_USBMSC_VENDORID=0x584e -CONFIG_USBMSC_VENDORSTR="NuttX" -CONFIG_USBMSC_PRODUCTID=0x5342 -CONFIG_USBMSC_PRODUCTSTR="USBdev Storage" -CONFIG_USBMSC_VERSIONNO=0x0399 -CONFIG_USBMSC_REMOVABLE=y - -# -# Settings for examples/uip -# -CONFIG_EXAMPLES_UIP_IPADDR=0x0a000002 -CONFIG_EXAMPLES_UIP_DRIPADDR=0x0a000001 -CONFIG_EXAMPLES_UIP_NETMASK=0xffffff00 -CONFIG_EXAMPLES_UIP_DHCPC=n - -# -# Settings for examples/nettest -# -CONFIG_EXAMPLES_NETTEST_SERVER=n -CONFIG_EXAMPLES_NETTEST_PERFORMANCE=n -CONFIG_EXAMPLES_NETTEST_NOMAC=y -CONFIG_EXAMPLES_NETTEST_IPADDR=0x0a000002 -CONFIG_EXAMPLES_NETTEST_DRIPADDR=0x0a000001 -CONFIG_EXAMPLES_NETTEST_NETMASK=0xffffff00 -CONFIG_EXAMPLES_NETTEST_CLIENTIP=0x0a000001 - -# -# Settings for examples/ostest -# -CONFIG_EXAMPLES_OSTEST_LOOPS=1 -CONFIG_EXAMPLES_OSTEST_STACKSIZE=2048 -CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3 - -# -# Settings for apps/nshlib -# -CONFIG_NSH_BUILTIN_APPS=n -CONFIG_NSH_FILEIOSIZE=512 -CONFIG_NSH_STRERROR=n -CONFIG_NSH_LINELEN=64 -CONFIG_NSH_NESTDEPTH=3 -CONFIG_NSH_DISABLESCRIPT=n -CONFIG_NSH_DISABLEBG=n -CONFIG_NSH_ROMFSETC=n -CONFIG_NSH_CONSOLE=y -CONFIG_NSH_TELNET=n -CONFIG_NSH_ARCHINIT=n -CONFIG_NSH_IOBUFFER_SIZE=512 -CONFIG_NSH_DHCPC=n -CONFIG_NSH_NOMAC=n -CONFIG_NSH_IPADDR=0x0a000002 -CONFIG_NSH_DRIPADDR=0x0a000001 -CONFIG_NSH_NETMASK=0xffffff00 -CONFIG_NSH_ROMFSMOUNTPT="/etc" -CONFIG_NSH_INITSCRIPT="init.d/rcS" -CONFIG_NSH_ROMFSDEVNO=0 -CONFIG_NSH_ROMFSSECTSIZE=64 -CONFIG_NSH_FATDEVNO=1 -CONFIG_NSH_FATSECTSIZE=512 -CONFIG_NSH_FATNSECTORS=1024 -CONFIG_NSH_FATMOUNTPT="/tmp" - -# -# Architecture-specific NSH options -# -CONFIG_NSH_MMCSDSPIPORTNO=1 -CONFIG_NSH_MMCSDSLOTNO=0 -CONFIG_NSH_MMCSDMINOR=0 - -# -# Settings for examples/usbserial -# -CONFIG_EXAMPLES_USBSERIAL_INONLY=n -CONFIG_EXAMPLES_USBSERIAL_OUTONLY=n -CONFIG_EXAMPLES_USBSERIAL_ONLYSMALL=n -CONFIG_EXAMPLES_USBSERIAL_ONLYBIG=n - -CONFIG_EXAMPLES_USBSERIAL_TRACEINIT=n -CONFIG_EXAMPLES_USBSERIAL_TRACECLASS=n -CONFIG_EXAMPLES_USBSERIAL_TRACETRANSFERS=n -CONFIG_EXAMPLES_USBSERIAL_TRACECONTROLLER=n -CONFIG_EXAMPLES_USBSERIAL_TRACEINTERRUPTS=n - -# -# Settings for examples/usbstorage -# -CONFIG_EXAMPLES_USBMSC_NLUNS=1 -CONFIG_EXAMPLES_USBMSC_DEVMINOR1=0 -CONFIG_EXAMPLES_USBMSC_DEVPATH1="/dev/mmcsd0" -CONFIG_EXAMPLES_USBMSC_TRACEINIT=n -CONFIG_EXAMPLES_USBMSC_TRACECLASS=n -CONFIG_EXAMPLES_USBMSC_TRACETRANSFERS=n -CONFIG_EXAMPLES_USBMSC_TRACECONTROLLER=n -CONFIG_EXAMPLES_USBMSC_TRACEINTERRUPTS=n - -# -# Settings for examples/cdcacm -# -# Configuration prequisites: -# -CONFIG_EXAMPLES_CDCACM_DEVMINOR=0 -CONFIG_EXAMPLES_CDCACM_TRACEINIT=n -CONFIG_EXAMPLES_CDCACM_TRACECLASS=n -CONFIG_EXAMPLES_CDCACM_TRACETRANSFERS=n -CONFIG_EXAMPLES_CDCACM_TRACECONTROLLER=n -CONFIG_EXAMPLES_CDCACM_TRACEINTERRUPTS=n - # # Stack and heap information # -CONFIG_BOOT_RUNFROMFLASH=n -CONFIG_BOOT_COPYTORAM=n -CONFIG_CUSTOM_STACK=n CONFIG_IDLETHREAD_STACKSIZE=2048 CONFIG_USERMAIN_STACKSIZE=2048 CONFIG_PTHREAD_STACK_MIN=256 CONFIG_PTHREAD_STACK_DEFAULT=2048 -CONFIG_HEAP_BASE= -CONFIG_HEAP_SIZE= + +# +# Device Drivers +# +CONFIG_DEV_NULL=y +# CONFIG_DEV_ZERO is not set +# CONFIG_LOOP is not set +# CONFIG_RAMDISK is not set +# CONFIG_CAN is not set +# CONFIG_PWM is not set +# CONFIG_I2C is not set +# CONFIG_SPI is not set +# CONFIG_RTC is not set +# CONFIG_WATCHDOG is not set +# CONFIG_ANALOG is not set +# CONFIG_BCH is not set +# CONFIG_INPUT is not set +# CONFIG_LCD is not set +# CONFIG_MMCSD is not set +# CONFIG_MTD is not set +# CONFIG_PIPES is not set +# CONFIG_PM is not set +# CONFIG_POWER is not set +# CONFIG_SENSORS is not set +# CONFIG_SERCOMM_CONSOLE is not set +CONFIG_SERIAL=y +CONFIG_DEV_LOWCONSOLE=y +# CONFIG_16550_UART is not set +CONFIG_ARCH_HAVE_UART1=y +CONFIG_MCU_SERIAL=y +CONFIG_UART1_SERIAL_CONSOLE=y +# CONFIG_NO_SERIAL_CONSOLE is not set + +# +# UART1 Configuration +# +CONFIG_UART1_RXBUFSIZE=256 +CONFIG_UART1_TXBUFSIZE=256 +CONFIG_UART1_BAUD=115200 +CONFIG_UART1_BITS=8 +CONFIG_UART1_PARITY=0 +CONFIG_UART1_2STOP=0 +# CONFIG_USBDEV is not set +# CONFIG_USBHOST is not set +# CONFIG_WIRELESS is not set + +# +# System Logging Device Options +# + +# +# System Logging +# +# CONFIG_RAMLOG is not set + +# +# Networking Support +# +# CONFIG_NET is not set + +# +# File Systems +# + +# +# File system configuration +# +# CONFIG_FS_RAMMAP is not set + +# +# System Logging +# +# CONFIG_SYSLOG is not set + +# +# Graphics Support +# +# CONFIG_NX is not set + +# +# Memory Management +# +# CONFIG_MM_SMALL is not set +CONFIG_MM_REGIONS=1 +# CONFIG_GRAN is not set + +# +# Binary Formats +# +# CONFIG_BINFMT_DISABLE is not set +# CONFIG_NXFLAT is not set +# CONFIG_ELF is not set +# CONFIG_PIC is not set +CONFIG_SYMTAB_ORDEREDBYNAME=y + +# +# Library Routines +# + +# +# Standard C Library Options +# +CONFIG_STDIO_BUFFER_SIZE=256 +CONFIG_STDIO_LINEBUFFER=y +CONFIG_NUNGET_CHARS=2 +# CONFIG_LIBM is not set +# CONFIG_NOPRINTF_FIELDWIDTH is not set +# CONFIG_LIBC_FLOATINGPOINT is not set +# CONFIG_EOL_IS_CR is not set +# CONFIG_EOL_IS_LF is not set +# CONFIG_EOL_IS_BOTH_CRLF is not set +CONFIG_EOL_IS_EITHER_CRLF=y +# CONFIG_LIBC_EXECFUNCS is not set +# CONFIG_LIBC_STRERROR is not set +# CONFIG_LIBC_PERROR_STDOUT is not set +CONFIG_ARCH_LOWPUTC=y +CONFIG_LIB_SENDFILE_BUFSIZE=512 +# CONFIG_ARCH_ROMGETC is not set +# CONFIG_ARCH_OPTIMIZED_FUNCTIONS is not set + +# +# Non-standard Helper Functions +# +# CONFIG_LIB_KBDCODEC is not set + +# +# Basic CXX Support +# +# CONFIG_C99_BOOL8 is not set +# CONFIG_HAVE_CXX is not set + +# +# Application Configuration +# + +# +# Built-In Applications +# +# CONFIG_BUILTIN is not set + +# +# Examples +# +# CONFIG_EXAMPLES_BUTTONS is not set +# CONFIG_EXAMPLES_CAN is not set +# CONFIG_EXAMPLES_CDCACM is not set +# CONFIG_EXAMPLES_COMPOSITE is not set +# CONFIG_EXAMPLES_DHCPD is not set +# CONFIG_EXAMPLES_ELF is not set +# CONFIG_EXAMPLES_FTPC is not set +# CONFIG_EXAMPLES_FTPD is not set +# CONFIG_EXAMPLES_HELLO is not set +# CONFIG_EXAMPLES_HELLOXX is not set +# CONFIG_EXAMPLES_JSON is not set +# CONFIG_EXAMPLES_HIDKBD is not set +# CONFIG_EXAMPLES_KEYPADTEST is not set +# CONFIG_EXAMPLES_IGMP is not set +# CONFIG_EXAMPLES_LCDRW is not set +# CONFIG_EXAMPLES_MM is not set +# CONFIG_EXAMPLES_MOUNT is not set +# CONFIG_EXAMPLES_MODBUS is not set +# CONFIG_EXAMPLES_NETTEST is not set +# CONFIG_EXAMPLES_NSH is not set +# CONFIG_EXAMPLES_NULL is not set +# CONFIG_EXAMPLES_NX is not set +# CONFIG_EXAMPLES_NXCONSOLE is not set +# CONFIG_EXAMPLES_NXFFS is not set +# CONFIG_EXAMPLES_NXFLAT is not set +# CONFIG_EXAMPLES_NXHELLO is not set +# CONFIG_EXAMPLES_NXIMAGE is not set +# CONFIG_EXAMPLES_NXLINES is not set +# CONFIG_EXAMPLES_NXTEXT is not set +CONFIG_EXAMPLES_OSTEST=y +# CONFIG_EXAMPLES_OSTEST_BUILTIN is not set +CONFIG_EXAMPLES_OSTEST_LOOPS=1 +CONFIG_EXAMPLES_OSTEST_STACKSIZE=2048 +CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3 +CONFIG_EXAMPLES_OSTEST_RR_RANGE=10000 +CONFIG_EXAMPLES_OSTEST_RR_RUNS=10 +# CONFIG_EXAMPLES_PASHELLO is not set +# CONFIG_EXAMPLES_PIPE is not set +# CONFIG_EXAMPLES_POLL is not set +# CONFIG_EXAMPLES_POSIXSPAWN is not set +# CONFIG_EXAMPLES_QENCODER is not set +# CONFIG_EXAMPLES_RGMP is not set +# CONFIG_EXAMPLES_ROMFS is not set +# CONFIG_EXAMPLES_SENDMAIL is not set +# CONFIG_EXAMPLES_SERLOOP is not set +# CONFIG_EXAMPLES_TELNETD is not set +# CONFIG_EXAMPLES_THTTPD is not set +# CONFIG_EXAMPLES_TIFF is not set +# CONFIG_EXAMPLES_TOUCHSCREEN is not set +# CONFIG_EXAMPLES_UDP is not set +# CONFIG_EXAMPLES_UIP is not set +# CONFIG_EXAMPLES_USBSERIAL is not set +# CONFIG_EXAMPLES_USBMSC is not set +# CONFIG_EXAMPLES_USBTERM is not set +# CONFIG_EXAMPLES_WATCHDOG is not set + +# +# Interpreters +# + +# +# Interpreters +# +# CONFIG_INTERPRETERS_FICL is not set +# CONFIG_INTERPRETERS_PCODE is not set + +# +# Network Utilities +# + +# +# Networking Utilities +# +# CONFIG_NETUTILS_CODECS is not set +# CONFIG_NETUTILS_DHCPC is not set +# CONFIG_NETUTILS_DHCPD is not set +# CONFIG_NETUTILS_FTPC is not set +# CONFIG_NETUTILS_FTPD is not set +# CONFIG_NETUTILS_JSON is not set +# CONFIG_NETUTILS_RESOLV is not set +# CONFIG_NETUTILS_SMTP is not set +# CONFIG_NETUTILS_TELNETD is not set +# CONFIG_NETUTILS_TFTPC is not set +# CONFIG_NETUTILS_THTTPD is not set +# CONFIG_NETUTILS_UIPLIB is not set +# CONFIG_NETUTILS_WEBCLIENT is not set + +# +# ModBus +# + +# +# FreeModbus +# +# CONFIG_MODBUS is not set + +# +# NSH Library +# +# CONFIG_NSH_LIBRARY is not set + +# +# NxWidgets/NxWM +# + +# +# System NSH Add-Ons +# + +# +# Custom Free Memory Command +# +# CONFIG_SYSTEM_FREE is not set + +# +# I2C tool +# + +# +# FLASH Program Installation +# +# CONFIG_SYSTEM_INSTALL is not set + +# +# readline() +# +# CONFIG_SYSTEM_READLINE is not set + +# +# Power Off +# +# CONFIG_SYSTEM_POWEROFF is not set + +# +# RAMTRON +# +# CONFIG_SYSTEM_RAMTRON is not set + +# +# SD Card +# +# CONFIG_SYSTEM_SDCARD is not set + +# +# Sysinfo +# +# CONFIG_SYSTEM_SYSINFO is not set diff --git a/nuttx/configs/ubw32/ostest/ld.script b/nuttx/configs/ubw32/ostest/ld.script deleted file mode 100644 index 3a64fff23a..0000000000 --- a/nuttx/configs/ubw32/ostest/ld.script +++ /dev/null @@ -1,317 +0,0 @@ -/**************************************************************************** - * configs/ubw32/ostest/ld.script - * - * Copyright (C) 2012 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt - * - * 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. - * - ****************************************************************************/ -/* Memory Regions ***********************************************************/ - -MEMORY -{ - /* The PIC32MX460F512L has 512Kb of program FLASH at physical address - * 0x1d000000 but is always accessed at KSEG0 address 0x9d00:0000 - */ - - kseg0_progmem (rx) : ORIGIN = 0x9d000000, LENGTH = 512K - - /* The PIC32MX460F512L has 12Kb of boot FLASH at physical address - * 0x1fc00000. The initial reset vector is in KSEG1, but all other - * accesses are in KSEG0. - * - * REGION PHYSICAL KSEG SIZE - * DESCRIPTION START ADDR (BYTES) - * ------------- ---------- ------ ---------------------- - * Exceptions:* - * Reset 0x1fc00000 KSEG1 512 512 - * TLB Refill 0x1fc00200 KSEG1 256 768 - * Cache Error 0x1fc00300 KSEG1 128 896 - * Others 0x1fc00380 KSEG1 128 1024 (1Kb) - * Interrupt 0x1fc00400 KSEG1 128 1152 - * JTAG 0x1fc00480 KSEG1 16 1168 - * Exceptions 0x1fc00490 KSEG0 8192-1168 8192 (4Kb) - * Debug code 0x1fc02000 KSEG1 4096-16 12272 - * DEVCFG3-0 0x1fc02ff0 KSEG1 16 12288 (12Kb) - * - * Exceptions assume: - * - * STATUS: BEV=0/1 and EXL=0 - * CAUSE: IV=1 - * JTAG: ProbEn=0 - * And multi-vector support disabled - */ - - kseg1_reset (rx) : ORIGIN = 0xbfc00000, LENGTH = 384 - kseg1_genexcpt (rx) : ORIGIN = 0xbfc00180, LENGTH = 128 - kseg1_ebexcpt (rx) : ORIGIN = 0xbfc00200, LENGTH = 128 - kseg1_bevexcpt (rx) : ORIGIN = 0xbfc00380, LENGTH = 128 - kseg1_intexcpt (rx) : ORIGIN = 0xbfc00400, LENGTH = 128 - kseg1_dbgexcpt (rx) : ORIGIN = 0xbfc00480, LENGTH = 16 - kseg0_bootmem (rx) : ORIGIN = 0x9fc00490, LENGTH = 8192-1168 - kseg1_dbgcode (rx) : ORIGIN = 0xbfc02000, LENGTH = 4096-16 - kseg1_devcfg (r) : ORIGIN = 0xbfc02ff0, LENGTH = 16 - - /* The PIC32MX460F512L has 32Kb of data memory at physical address - * 0x00000000. Since the PIC32MX has no data cache, this memory is - * always accessed through KSEG1. - * - * When used with MPLAB, we need to set aside 512 bytes of memory - * for use by MPLAB. - */ - - kseg1_datamem (w!x) : ORIGIN = 0xa0000200, LENGTH = 32K - 512 -} - -OUTPUT_FORMAT("elf32-tradlittlemips") -OUTPUT_ARCH(pic32mx) -ENTRY(__start) - -SECTIONS -{ - /* Boot FLASH sections */ - - .reset : - { - KEEP (*(.reset)) - } > kseg1_reset - - /* Exception handlers. The following is assumed: - * - * STATUS: BEV=1 and EXL=0 - * CAUSE: IV=1 - * JTAG: ProbEn=0 - * And multi-vector support disabled - * - * In that configuration, the vector locations become: - * - * Reset, Soft Reset bfc0:0000 - * TLB Refill bfc0:0200 - * Cache Error bfc0:0300 - * All others bfc0:0380 - * Interrupt bfc0:0400 - * EJTAG Debug bfc0:0480 - */ - - /* KSEG1 exception handler "trampolines" */ - - .gen_excpt : - { - KEEP (*(.gen_excpt)) - } > kseg1_genexcpt - - .ebase_excpt : - { - KEEP (*(.ebase_excpt)) - } > kseg1_ebexcpt - - .bev_excpt : - { - KEEP (*(.bev_excpt)) - } > kseg1_bevexcpt - - .int_excpt : - { - KEEP (*(.int_excpt)) - } > kseg1_intexcpt - - .dbg_excpt = ORIGIN(kseg1_dbgexcpt); - - .start : - { - /* KSEG0 Reset startup logic */ - - *(.start) - - /* KSEG0 exception handlers */ - - *(.nmi_handler) - *(.bev_handler) - *(.int_handler) - } > kseg0_bootmem - - .dbg_code = ORIGIN(kseg1_dbgcode); - - .devcfg : - { - KEEP (*(.devcfg)) - } > kseg1_devcfg - - /* Program FLASH sections */ - - .text : - { - _stext = ABSOLUTE(.); - *(.text .text.*) - *(.stub) - KEEP (*(.text.*personality*)) - *(.gnu.linkonce.t.*) - *(.gnu.warning) - *(.mips16.fn.*) - *(.mips16.call.*) - - /* Read-only data is included in the text section */ - - *(.rodata .rodata.*) - *(.rodata1) - *(.gnu.linkonce.r.*) - - /* Small initialized constant global and static data */ - - *(.sdata2 .sdata2.*) - *(.gnu.linkonce.s2.*) - - /* Uninitialized constant global and static data */ - - *(.sbss2 .sbss2.*) - *(.gnu.linkonce.sb2.*) - _etext = ABSOLUTE(.); - } > kseg0_progmem - - /* Initialization data begins here in progmem */ - - _data_loaddr = LOADADDR(.data); - - .eh_frame_hdr : { *(.eh_frame_hdr) } - .eh_frame : ONLY_IF_RO { KEEP (*(.eh_frame)) } - - /* RAM functions are positioned at the beginning of RAM so that - * they can be guaranteed to satisfy the 2Kb alignment requirement. - */ - -/* This causes failures if there are no RAM functions - .ramfunc ALIGN(2K) : - { - _sramfunc = ABSOLUTE(.); - *(.ramfunc .ramfunc.*) - _eramfunc = ABSOLUTE(.); - } > kseg1_datamem AT > kseg0_progmem - - _ramfunc_loadaddr = LOADADDR(.ramfunc); - _ramfunc_sizeof = SIZEOF(.ramfunc); - _bmxdkpba_address = _sramfunc - ORIGIN(kseg1_datamem) ; - _bmxdudba_address = LENGTH(kseg1_datamem) ; - _bmxdupba_address = LENGTH(kseg1_datamem) ; -*/ - - .data : - { - _sdata = ABSOLUTE(.); - *(.data .data.*) - *(.gnu.linkonce.d.*) - KEEP (*(.gnu.linkonce.d.*personality*)) - *(.data1) - } > kseg1_datamem AT > kseg0_progmem - - .eh_frame : ONLY_IF_RW { KEEP (*(.eh_frame)) } - _gp = ALIGN(16) + 0x7FF0 ; - - .got : - { - *(.got.plt) *(.got) - } > kseg1_datamem AT > kseg0_progmem - - .sdata : - { - *(.sdata .sdata.* .gnu.linkonce.s.*) - } > kseg1_datamem AT > kseg0_progmem - - .lit8 : - { - *(.lit8) - } > kseg1_datamem AT > kseg0_progmem - - .lit4 : - { - *(.lit4) - _edata = ABSOLUTE(.); - } >kseg1_datamem AT>kseg0_progmem - - .sbss : - { - _sbss = ABSOLUTE(.); - *(.dynsbss) - *(.sbss .sbss.* .gnu.linkonce.sb.*) - *(.scommon) - } >kseg1_datamem - - .bss : - { - *(.dynbss) - *(.bss .bss.*) - *(.gnu.linkonce.b.*) - *(COMMON) - _ebss = ABSOLUTE(.); - } > kseg1_datamem - - /* Stabs debugging sections */ - - .stab 0 : { *(.stab) } - .stabstr 0 : { *(.stabstr) } - .stab.excl 0 : { *(.stab.excl) } - .stab.exclstr 0 : { *(.stab.exclstr) } - .stab.index 0 : { *(.stab.index) } - .stab.indexstr 0 : { *(.stab.indexstr) } - .comment 0 : { *(.comment) } - - /* DWARF debug sections */ - /* DWARF 1 */ - - .debug 0 : { *(.debug) } - .line 0 : { *(.line) } - - /* GNU DWARF 1 extensions */ - - .debug_srcinfo 0 : { *(.debug_srcinfo) } - .debug_sfnames 0 : { *(.debug_sfnames) } - - /* DWARF 1.1 and DWARF 2 */ - - .debug_aranges 0 : { *(.debug_aranges) } - .debug_pubnames 0 : { *(.debug_pubnames) } - - /* DWARF 2 */ - - .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) } - .debug_abbrev 0 : { *(.debug_abbrev) } - .debug_line 0 : { *(.debug_line) } - .debug_frame 0 : { *(.debug_frame) } - .debug_str 0 : { *(.debug_str) } - .debug_loc 0 : { *(.debug_loc) } - .debug_macinfo 0 : { *(.debug_macinfo) } - - /* SGI/MIPS DWARF 2 extensions */ - - .debug_weaknames 0 : { *(.debug_weaknames) } - .debug_funcnames 0 : { *(.debug_funcnames) } - .debug_typenames 0 : { *(.debug_typenames) } - .debug_varnames 0 : { *(.debug_varnames) } - - /DISCARD/ : { *(.note.GNU-stack) } -} diff --git a/nuttx/configs/ubw32/nsh/ld.script b/nuttx/configs/ubw32/scripts/ld.script similarity index 98% rename from nuttx/configs/ubw32/nsh/ld.script rename to nuttx/configs/ubw32/scripts/ld.script index 43e64a51be..c25820b115 100644 --- a/nuttx/configs/ubw32/nsh/ld.script +++ b/nuttx/configs/ubw32/scripts/ld.script @@ -1,7 +1,7 @@ /**************************************************************************** - * configs/ubw32/nsh/ld.script + * configs/ubw32/scripts/ld.script * - * Copyright (C) 2012 Gregory Nutt. All rights reserved. + * Copyright (C) 2012-2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without From f55cabeb593496691293a330daa7c6a3d99eae2e Mon Sep 17 00:00:00 2001 From: patacongo Date: Tue, 15 Jan 2013 00:03:58 +0000 Subject: [PATCH 072/118] Don't build drivers/mtd unless CONFIG_MTD is defined (Denis Carikli) git-svn-id: http://svn.code.sf.net/p/nuttx/code/trunk@5519 42af7a65-404d-4744-a932-0658087f49c3 --- nuttx/configs/amber/hello/defconfig | 2 +- nuttx/configs/avr32dev1/nsh/defconfig | 2 +- nuttx/configs/avr32dev1/ostest/defconfig | 2 +- nuttx/configs/c5471evm/httpd/defconfig | 2 +- nuttx/configs/c5471evm/nettest/defconfig | 2 +- nuttx/configs/c5471evm/nsh/defconfig | 2 +- nuttx/configs/c5471evm/ostest/defconfig | 2 +- nuttx/configs/compal_e88/nsh_highram/defconfig | 2 +- nuttx/configs/compal_e99/nsh_compalram/defconfig | 2 +- nuttx/configs/compal_e99/nsh_highram/defconfig | 2 +- nuttx/configs/demo9s12ne64/ostest/defconfig | 2 +- nuttx/configs/ea3131/nsh/defconfig | 1 + nuttx/configs/ea3131/ostest/defconfig | 1 + nuttx/configs/ea3131/pgnsh/defconfig | 1 + nuttx/configs/ea3131/usbserial/defconfig | 1 + nuttx/configs/ea3131/usbstorage/defconfig | 1 + nuttx/configs/ea3152/ostest/defconfig | 1 + nuttx/configs/eagle100/httpd/defconfig | 2 +- nuttx/configs/eagle100/nettest/defconfig | 2 +- nuttx/configs/eagle100/nsh/defconfig | 2 +- nuttx/configs/eagle100/nxflat/defconfig | 2 +- nuttx/configs/eagle100/ostest/defconfig | 2 +- nuttx/configs/eagle100/thttpd/defconfig | 2 +- nuttx/configs/ekk-lm3s9b96/nsh/defconfig | 2 +- nuttx/configs/ekk-lm3s9b96/ostest/defconfig | 2 +- nuttx/configs/ez80f910200kitg/ostest/defconfig | 2 +- nuttx/configs/ez80f910200zco/dhcpd/defconfig | 2 +- nuttx/configs/ez80f910200zco/httpd/defconfig | 2 +- nuttx/configs/ez80f910200zco/nettest/defconfig | 2 +- nuttx/configs/ez80f910200zco/nsh/defconfig | 2 +- nuttx/configs/ez80f910200zco/ostest/defconfig | 2 +- nuttx/configs/ez80f910200zco/poll/defconfig | 2 +- nuttx/configs/hymini-stm32v/buttons/defconfig | 1 + nuttx/configs/hymini-stm32v/nsh/defconfig | 1 + nuttx/configs/hymini-stm32v/nsh2/defconfig | 1 + nuttx/configs/hymini-stm32v/nx/defconfig | 1 + nuttx/configs/hymini-stm32v/nxlines/defconfig | 1 + nuttx/configs/hymini-stm32v/usbserial/defconfig | 1 + nuttx/configs/hymini-stm32v/usbstorage/defconfig | 1 + nuttx/configs/kwikstik-k40/ostest/defconfig | 1 + nuttx/configs/lincoln60/nsh/defconfig | 2 +- nuttx/configs/lincoln60/ostest/defconfig | 2 +- nuttx/configs/lm3s6432-s2e/nsh/defconfig | 2 +- nuttx/configs/lm3s6432-s2e/ostest/defconfig | 2 +- nuttx/configs/lm3s6965-ek/nsh/defconfig | 2 +- nuttx/configs/lm3s6965-ek/ostest/defconfig | 2 +- nuttx/configs/lm3s8962-ek/nsh/defconfig | 2 +- nuttx/configs/lm3s8962-ek/nx/defconfig | 2 +- nuttx/configs/lm3s8962-ek/ostest/defconfig | 2 +- nuttx/configs/lpc4330-xplorer/nsh/defconfig | 1 + nuttx/configs/lpc4330-xplorer/ostest/defconfig | 1 + nuttx/configs/lpcxpresso-lpc1768/dhcpd/defconfig | 2 +- nuttx/configs/lpcxpresso-lpc1768/nsh/defconfig | 2 +- nuttx/configs/lpcxpresso-lpc1768/nx/defconfig | 2 +- nuttx/configs/lpcxpresso-lpc1768/ostest/defconfig | 2 +- nuttx/configs/lpcxpresso-lpc1768/thttpd/defconfig | 2 +- nuttx/configs/lpcxpresso-lpc1768/usbstorage/defconfig | 2 +- nuttx/configs/m68332evb/defconfig | 2 +- nuttx/configs/mbed/hidkbd/defconfig | 2 +- nuttx/configs/mbed/nsh/defconfig | 2 +- nuttx/configs/mcu123-lpc214x/composite/defconfig | 2 +- nuttx/configs/mcu123-lpc214x/ostest/defconfig | 2 +- nuttx/configs/mcu123-lpc214x/usbserial/defconfig | 2 +- nuttx/configs/mcu123-lpc214x/usbstorage/defconfig | 2 +- nuttx/configs/micropendous3/hello/defconfig | 2 +- nuttx/configs/mirtoo/nsh/defconfig | 2 +- nuttx/configs/mirtoo/nxffs/defconfig | 2 +- nuttx/configs/mirtoo/ostest/defconfig | 2 +- nuttx/configs/mx1ads/ostest/defconfig | 2 +- nuttx/configs/ne64badge/ostest/defconfig | 2 +- nuttx/configs/ntosd-dm320/nettest/defconfig | 2 +- nuttx/configs/ntosd-dm320/nsh/defconfig | 2 +- nuttx/configs/ntosd-dm320/ostest/defconfig | 2 +- nuttx/configs/ntosd-dm320/poll/defconfig | 2 +- nuttx/configs/ntosd-dm320/thttpd/defconfig | 2 +- nuttx/configs/ntosd-dm320/udp/defconfig | 2 +- nuttx/configs/ntosd-dm320/uip/defconfig | 2 +- nuttx/configs/nucleus2g/nsh/defconfig | 2 +- nuttx/configs/nucleus2g/ostest/defconfig | 2 +- nuttx/configs/nucleus2g/usbserial/defconfig | 2 +- nuttx/configs/nucleus2g/usbstorage/defconfig | 2 +- nuttx/configs/olimex-lpc1766stk/ftpc/defconfig | 2 +- nuttx/configs/olimex-lpc1766stk/hidkbd/defconfig | 2 +- nuttx/configs/olimex-lpc1766stk/nettest/defconfig | 2 +- nuttx/configs/olimex-lpc1766stk/nsh/defconfig | 2 +- nuttx/configs/olimex-lpc1766stk/nx/defconfig | 2 +- nuttx/configs/olimex-lpc1766stk/ostest/defconfig | 2 +- nuttx/configs/olimex-lpc1766stk/slip-httpd/defconfig | 2 +- nuttx/configs/olimex-lpc1766stk/thttpd/defconfig | 2 +- nuttx/configs/olimex-lpc1766stk/usbserial/defconfig | 2 +- nuttx/configs/olimex-lpc1766stk/usbstorage/defconfig | 2 +- nuttx/configs/olimex-lpc2378/nsh/defconfig | 2 +- nuttx/configs/olimex-lpc2378/ostest/defconfig | 2 +- nuttx/configs/olimex-stm32-p107/nsh/defconfig | 1 + nuttx/configs/olimex-stm32-p107/ostest/defconfig | 1 + nuttx/configs/olimex-strp711/nettest/defconfig | 2 +- nuttx/configs/olimex-strp711/nsh/defconfig | 2 +- nuttx/configs/olimex-strp711/ostest/defconfig | 2 +- nuttx/configs/pcblogic-pic32mx/nsh/defconfig | 2 +- nuttx/configs/pcblogic-pic32mx/ostest/defconfig | 2 +- nuttx/configs/pic32-starterkit/nsh/defconfig | 2 +- nuttx/configs/pic32-starterkit/nsh2/defconfig | 2 +- nuttx/configs/pic32-starterkit/ostest/defconfig | 2 +- nuttx/configs/pic32mx7mmb/nsh/defconfig | 2 +- nuttx/configs/pic32mx7mmb/ostest/defconfig | 2 +- nuttx/configs/pjrc-8051/defconfig | 2 +- nuttx/configs/qemu-i486/nsh/defconfig | 2 +- nuttx/configs/qemu-i486/ostest/defconfig | 2 +- nuttx/configs/rgmp/arm/default/defconfig | 2 +- nuttx/configs/rgmp/arm/nsh/defconfig | 2 +- nuttx/configs/rgmp/x86/cxxtest/defconfig | 2 +- nuttx/configs/rgmp/x86/default/defconfig | 2 +- nuttx/configs/rgmp/x86/helloxx/defconfig | 2 +- nuttx/configs/rgmp/x86/nsh/defconfig | 2 +- nuttx/configs/sam3u-ek/knsh/defconfig | 1 + nuttx/configs/sam3u-ek/nsh/defconfig | 1 + nuttx/configs/sam3u-ek/nx/defconfig | 1 + nuttx/configs/sam3u-ek/ostest/defconfig | 1 + nuttx/configs/sam3u-ek/touchscreen/defconfig | 1 + nuttx/configs/sim/mount/defconfig | 8 -------- nuttx/configs/sim/nettest/defconfig | 8 -------- nuttx/configs/sim/nsh/defconfig | 8 -------- nuttx/configs/sim/nsh2/defconfig | 8 -------- nuttx/configs/sim/nx/defconfig | 8 -------- nuttx/configs/sim/nxffs/defconfig | 8 -------- nuttx/configs/sim/pashello/defconfig | 8 -------- nuttx/configs/sim/touchscreen/defconfig | 8 -------- nuttx/configs/skp16c26/ostest/defconfig | 3 ++- nuttx/configs/stm3210e-eval/RIDE/defconfig | 1 + nuttx/configs/stm3210e-eval/buttons/defconfig | 1 + nuttx/configs/stm3210e-eval/composite/defconfig | 1 + nuttx/configs/stm3210e-eval/nsh/defconfig | 1 + nuttx/configs/stm3210e-eval/nsh2/defconfig | 1 + nuttx/configs/stm3210e-eval/nx/defconfig | 1 + nuttx/configs/stm3210e-eval/nxconsole/defconfig | 1 + nuttx/configs/stm3210e-eval/nxlines/defconfig | 1 + nuttx/configs/stm3210e-eval/nxtext/defconfig | 1 + nuttx/configs/stm3210e-eval/ostest/defconfig | 1 + nuttx/configs/stm3210e-eval/pm/defconfig | 1 + nuttx/configs/stm3210e-eval/usbserial/defconfig | 1 + nuttx/configs/stm3210e-eval/usbstorage/defconfig | 1 + nuttx/configs/stm3220g-eval/dhcpd/defconfig | 1 + nuttx/configs/stm3220g-eval/nettest/defconfig | 1 + nuttx/configs/stm3220g-eval/nsh/defconfig | 1 + nuttx/configs/stm3220g-eval/nsh2/defconfig | 1 + nuttx/configs/stm3220g-eval/ostest/defconfig | 1 + nuttx/configs/stm3220g-eval/telnetd/defconfig | 1 + nuttx/configs/stm3240g-eval/dhcpd/defconfig | 1 + nuttx/configs/stm3240g-eval/nettest/defconfig | 1 + nuttx/configs/stm3240g-eval/nsh/defconfig | 1 + nuttx/configs/stm3240g-eval/nsh2/defconfig | 1 + nuttx/configs/stm3240g-eval/nxconsole/defconfig | 1 + nuttx/configs/stm3240g-eval/nxwm/defconfig | 1 + nuttx/configs/stm3240g-eval/ostest/defconfig | 1 + nuttx/configs/stm3240g-eval/telnetd/defconfig | 1 + nuttx/configs/stm3240g-eval/webserver/defconfig | 1 + nuttx/configs/stm32f4discovery/nsh/defconfig | 8 -------- nuttx/configs/stm32f4discovery/pm/defconfig | 8 -------- nuttx/configs/sure-pic32mx/nsh/defconfig | 2 +- nuttx/configs/sure-pic32mx/ostest/defconfig | 2 +- nuttx/configs/sure-pic32mx/usbnsh/defconfig | 2 +- nuttx/configs/teensy/hello/defconfig | 2 +- nuttx/configs/teensy/nsh/defconfig | 2 +- nuttx/configs/teensy/usbstorage/defconfig | 2 +- nuttx/configs/twr-k60n512/nsh/defconfig | 1 + nuttx/configs/twr-k60n512/ostest/defconfig | 1 + nuttx/configs/ubw32/nsh/defconfig | 2 +- nuttx/configs/us7032evb1/nsh/defconfig | 2 +- nuttx/configs/us7032evb1/ostest/defconfig | 2 +- nuttx/configs/vsn/nsh/defconfig | 1 + nuttx/drivers/mtd/Make.defs | 3 +++ 171 files changed, 164 insertions(+), 186 deletions(-) diff --git a/nuttx/configs/amber/hello/defconfig b/nuttx/configs/amber/hello/defconfig index 7e3d4ad70c..8bdb55db48 100644 --- a/nuttx/configs/amber/hello/defconfig +++ b/nuttx/configs/amber/hello/defconfig @@ -226,7 +226,7 @@ CONFIG_FS_ROMFS=n CONFIG_MMCSD=y CONFIG_MMCSD_SPI=y -CONFIG_MMCSD_SDIO=y +CONFIG_MTD=y # # SPI-based MMC/SD driver diff --git a/nuttx/configs/avr32dev1/nsh/defconfig b/nuttx/configs/avr32dev1/nsh/defconfig index acca1fbac3..bd2f3703f4 100755 --- a/nuttx/configs/avr32dev1/nsh/defconfig +++ b/nuttx/configs/avr32dev1/nsh/defconfig @@ -245,7 +245,7 @@ CONFIG_FS_ROMFS=n CONFIG_MMCSD=y CONFIG_MMCSD_SPI=y -CONFIG_MMCSD_SDIO=y +CONFIG_MTD=y # # SPI-based MMC/SD driver diff --git a/nuttx/configs/avr32dev1/ostest/defconfig b/nuttx/configs/avr32dev1/ostest/defconfig index 084c662332..72d0c3ae35 100755 --- a/nuttx/configs/avr32dev1/ostest/defconfig +++ b/nuttx/configs/avr32dev1/ostest/defconfig @@ -245,7 +245,7 @@ CONFIG_FS_ROMFS=n CONFIG_MMCSD=y CONFIG_MMCSD_SPI=y -CONFIG_MMCSD_SDIO=y +CONFIG_MTD=y # # SPI-based MMC/SD driver diff --git a/nuttx/configs/c5471evm/httpd/defconfig b/nuttx/configs/c5471evm/httpd/defconfig index 8f4bd6927c..3280b7c16a 100644 --- a/nuttx/configs/c5471evm/httpd/defconfig +++ b/nuttx/configs/c5471evm/httpd/defconfig @@ -265,4 +265,4 @@ CONFIG_HEAP_SIZE= CONFIG_MMCSD=y CONFIG_MMCSD_SPI=y -CONFIG_MMCSD_SDIO=y +CONFIG_MTD=y diff --git a/nuttx/configs/c5471evm/nettest/defconfig b/nuttx/configs/c5471evm/nettest/defconfig index 71065fc662..131e73f52c 100644 --- a/nuttx/configs/c5471evm/nettest/defconfig +++ b/nuttx/configs/c5471evm/nettest/defconfig @@ -265,4 +265,4 @@ CONFIG_HEAP_SIZE= CONFIG_MMCSD=y CONFIG_MMCSD_SPI=y -CONFIG_MMCSD_SDIO=y +CONFIG_MTD=y diff --git a/nuttx/configs/c5471evm/nsh/defconfig b/nuttx/configs/c5471evm/nsh/defconfig index 3750f9e5da..49fc8f9d06 100644 --- a/nuttx/configs/c5471evm/nsh/defconfig +++ b/nuttx/configs/c5471evm/nsh/defconfig @@ -265,4 +265,4 @@ CONFIG_HEAP_SIZE= CONFIG_MMCSD=y CONFIG_MMCSD_SPI=y -CONFIG_MMCSD_SDIO=y +CONFIG_MTD=y diff --git a/nuttx/configs/c5471evm/ostest/defconfig b/nuttx/configs/c5471evm/ostest/defconfig index f4d7b8c365..13013a2bd4 100644 --- a/nuttx/configs/c5471evm/ostest/defconfig +++ b/nuttx/configs/c5471evm/ostest/defconfig @@ -265,4 +265,4 @@ CONFIG_HEAP_SIZE= CONFIG_MMCSD=y CONFIG_MMCSD_SPI=y -CONFIG_MMCSD_SDIO=y +CONFIG_MTD=y diff --git a/nuttx/configs/compal_e88/nsh_highram/defconfig b/nuttx/configs/compal_e88/nsh_highram/defconfig index d67674f4e1..a6868e8698 100644 --- a/nuttx/configs/compal_e88/nsh_highram/defconfig +++ b/nuttx/configs/compal_e88/nsh_highram/defconfig @@ -284,4 +284,4 @@ CONFIG_HEAP_SIZE= CONFIG_MMCSD=y CONFIG_MMCSD_SPI=y -CONFIG_MMCSD_SDIO=y +CONFIG_MTD=y diff --git a/nuttx/configs/compal_e99/nsh_compalram/defconfig b/nuttx/configs/compal_e99/nsh_compalram/defconfig index e8c53947b8..058dc2aa29 100644 --- a/nuttx/configs/compal_e99/nsh_compalram/defconfig +++ b/nuttx/configs/compal_e99/nsh_compalram/defconfig @@ -286,4 +286,4 @@ CONFIG_HEAP_SIZE= CONFIG_MMCSD=y CONFIG_MMCSD_SPI=y -CONFIG_MMCSD_SDIO=y +CONFIG_MTD=y diff --git a/nuttx/configs/compal_e99/nsh_highram/defconfig b/nuttx/configs/compal_e99/nsh_highram/defconfig index 1d405874eb..ee1405ca5e 100644 --- a/nuttx/configs/compal_e99/nsh_highram/defconfig +++ b/nuttx/configs/compal_e99/nsh_highram/defconfig @@ -330,4 +330,4 @@ CONFIG_HEAP_SIZE= CONFIG_MMCSD=y CONFIG_MMCSD_SPI=y -CONFIG_MMCSD_SDIO=y +CONFIG_MTD=y diff --git a/nuttx/configs/demo9s12ne64/ostest/defconfig b/nuttx/configs/demo9s12ne64/ostest/defconfig index 79224989f2..3222b63eea 100755 --- a/nuttx/configs/demo9s12ne64/ostest/defconfig +++ b/nuttx/configs/demo9s12ne64/ostest/defconfig @@ -219,7 +219,7 @@ CONFIG_FS_ROMFS=n CONFIG_MMCSD=y CONFIG_MMCSD_SPI=y -CONFIG_MMCSD_SDIO=y +CONFIG_MTD=y # # SPI-based MMC/SD driver diff --git a/nuttx/configs/ea3131/nsh/defconfig b/nuttx/configs/ea3131/nsh/defconfig index 8c7b351af4..43510fa595 100644 --- a/nuttx/configs/ea3131/nsh/defconfig +++ b/nuttx/configs/ea3131/nsh/defconfig @@ -225,6 +225,7 @@ CONFIG_FS_WRITEBUFFER=n CONFIG_MMCSD=y CONFIG_MMCSD_SPI=y CONFIG_MMCSD_SDIO=y +CONFIG_MTD=y # # SDIO-based MMC/SD driver diff --git a/nuttx/configs/ea3131/ostest/defconfig b/nuttx/configs/ea3131/ostest/defconfig index 19838ceab4..6da813d9ec 100644 --- a/nuttx/configs/ea3131/ostest/defconfig +++ b/nuttx/configs/ea3131/ostest/defconfig @@ -225,6 +225,7 @@ CONFIG_FS_WRITEBUFFER=n CONFIG_MMCSD=y CONFIG_MMCSD_SPI=y CONFIG_MMCSD_SDIO=y +CONFIG_MTD=y # # SDIO-based MMC/SD driver diff --git a/nuttx/configs/ea3131/pgnsh/defconfig b/nuttx/configs/ea3131/pgnsh/defconfig index 1cc2bec7e2..2a9eeff939 100644 --- a/nuttx/configs/ea3131/pgnsh/defconfig +++ b/nuttx/configs/ea3131/pgnsh/defconfig @@ -268,6 +268,7 @@ CONFIG_FS_WRITEBUFFER=n CONFIG_MMCSD=y CONFIG_MMCSD_SPI=y CONFIG_MMCSD_SDIO=y +CONFIG_MTD=y # # SDIO-based MMC/SD driver diff --git a/nuttx/configs/ea3131/usbserial/defconfig b/nuttx/configs/ea3131/usbserial/defconfig index a82f69877a..40c0897f73 100644 --- a/nuttx/configs/ea3131/usbserial/defconfig +++ b/nuttx/configs/ea3131/usbserial/defconfig @@ -228,6 +228,7 @@ CONFIG_FS_WRITEBUFFER=n CONFIG_MMCSD=y CONFIG_MMCSD_SPI=y CONFIG_MMCSD_SDIO=y +CONFIG_MTD=y # # SDIO-based MMC/SD driver diff --git a/nuttx/configs/ea3131/usbstorage/defconfig b/nuttx/configs/ea3131/usbstorage/defconfig index a957fb3ab8..0659383a61 100644 --- a/nuttx/configs/ea3131/usbstorage/defconfig +++ b/nuttx/configs/ea3131/usbstorage/defconfig @@ -229,6 +229,7 @@ CONFIG_FS_WRITEBUFFER=n CONFIG_MMCSD=y CONFIG_MMCSD_SPI=y CONFIG_MMCSD_SDIO=y +CONFIG_MTD=y # # SDIO-based MMC/SD driver diff --git a/nuttx/configs/ea3152/ostest/defconfig b/nuttx/configs/ea3152/ostest/defconfig index 6d0bb63f05..d4d978649b 100644 --- a/nuttx/configs/ea3152/ostest/defconfig +++ b/nuttx/configs/ea3152/ostest/defconfig @@ -226,6 +226,7 @@ CONFIG_FS_WRITEBUFFER=n CONFIG_MMCSD=y CONFIG_MMCSD_SPI=y CONFIG_MMCSD_SDIO=y +CONFIG_MTD=y # # SDIO-based MMC/SD driver diff --git a/nuttx/configs/eagle100/httpd/defconfig b/nuttx/configs/eagle100/httpd/defconfig index bd0ac7664d..bb66364458 100644 --- a/nuttx/configs/eagle100/httpd/defconfig +++ b/nuttx/configs/eagle100/httpd/defconfig @@ -221,7 +221,7 @@ CONFIG_FS_ROMFS=n CONFIG_MMCSD=y CONFIG_MMCSD_SPI=y -CONFIG_MMCSD_SDIO=y +CONFIG_MTD=y # # SPI-based MMC/SD driver diff --git a/nuttx/configs/eagle100/nettest/defconfig b/nuttx/configs/eagle100/nettest/defconfig index 9b1f616c6e..8f969ee795 100644 --- a/nuttx/configs/eagle100/nettest/defconfig +++ b/nuttx/configs/eagle100/nettest/defconfig @@ -221,7 +221,7 @@ CONFIG_FS_ROMFS=n CONFIG_MMCSD=y CONFIG_MMCSD_SPI=y -CONFIG_MMCSD_SDIO=y +CONFIG_MTD=y # # SPI-based MMC/SD driver diff --git a/nuttx/configs/eagle100/nsh/defconfig b/nuttx/configs/eagle100/nsh/defconfig index 079bbc60e3..ed1c7b074b 100644 --- a/nuttx/configs/eagle100/nsh/defconfig +++ b/nuttx/configs/eagle100/nsh/defconfig @@ -223,7 +223,7 @@ CONFIG_FS_ROMFS=n CONFIG_MMCSD=y CONFIG_MMCSD_SPI=y -CONFIG_MMCSD_SDIO=y +CONFIG_MTD=y # # SPI-based MMC/SD driver diff --git a/nuttx/configs/eagle100/nxflat/defconfig b/nuttx/configs/eagle100/nxflat/defconfig index 110f906cbe..590a30516c 100644 --- a/nuttx/configs/eagle100/nxflat/defconfig +++ b/nuttx/configs/eagle100/nxflat/defconfig @@ -227,7 +227,7 @@ CONFIG_FS_ROMFS=y CONFIG_MMCSD=y CONFIG_MMCSD_SPI=y -CONFIG_MMCSD_SDIO=y +CONFIG_MTD=y # # SPI-based MMC/SD driver diff --git a/nuttx/configs/eagle100/ostest/defconfig b/nuttx/configs/eagle100/ostest/defconfig index 6d3b4ddad0..229aec59cc 100644 --- a/nuttx/configs/eagle100/ostest/defconfig +++ b/nuttx/configs/eagle100/ostest/defconfig @@ -221,7 +221,7 @@ CONFIG_FS_ROMFS=n CONFIG_MMCSD=y CONFIG_MMCSD_SPI=y -CONFIG_MMCSD_SDIO=y +CONFIG_MTD=y # # SPI-based MMC/SD driver diff --git a/nuttx/configs/eagle100/thttpd/defconfig b/nuttx/configs/eagle100/thttpd/defconfig index 2aca2582ec..7e1282368f 100644 --- a/nuttx/configs/eagle100/thttpd/defconfig +++ b/nuttx/configs/eagle100/thttpd/defconfig @@ -228,7 +228,7 @@ CONFIG_FS_ROMFS=y CONFIG_MMCSD=y CONFIG_MMCSD_SPI=y -CONFIG_MMCSD_SDIO=y +CONFIG_MTD=y # # SPI-based MMC/SD driver diff --git a/nuttx/configs/ekk-lm3s9b96/nsh/defconfig b/nuttx/configs/ekk-lm3s9b96/nsh/defconfig index adb9bb5fae..0bf59edf4e 100644 --- a/nuttx/configs/ekk-lm3s9b96/nsh/defconfig +++ b/nuttx/configs/ekk-lm3s9b96/nsh/defconfig @@ -240,7 +240,7 @@ CONFIG_NFS=y CONFIG_MMCSD=y CONFIG_MMCSD_SPI=y -CONFIG_MMCSD_SDIO=y +CONFIG_MTD=y # # SPI-based MMC/SD driver diff --git a/nuttx/configs/ekk-lm3s9b96/ostest/defconfig b/nuttx/configs/ekk-lm3s9b96/ostest/defconfig index 8215020366..3ac3c066a1 100644 --- a/nuttx/configs/ekk-lm3s9b96/ostest/defconfig +++ b/nuttx/configs/ekk-lm3s9b96/ostest/defconfig @@ -239,7 +239,7 @@ CONFIG_NFS=n CONFIG_MMCSD=y CONFIG_MMCSD_SPI=y -CONFIG_MMCSD_SDIO=y +CONFIG_MTD=y # # SPI-based MMC/SD driver diff --git a/nuttx/configs/ez80f910200kitg/ostest/defconfig b/nuttx/configs/ez80f910200kitg/ostest/defconfig index 80c9e682ea..d861778282 100644 --- a/nuttx/configs/ez80f910200kitg/ostest/defconfig +++ b/nuttx/configs/ez80f910200kitg/ostest/defconfig @@ -222,7 +222,7 @@ CONFIG_MMCSD_MMCSUPPORT=y CONFIG_MMCSD_HAVECARDDETECT=y CONFIG_MMCSD_SPI=y CONFIG_MMCSD_SPICLOCK=20000000 -CONFIG_MMCSD_SDIO=y +# CONFIG_MMCSD_SDIO is not set # CONFIG_SDIO_MUXBUS is not set # CONFIG_MTD is not set # CONFIG_PIPES is not set diff --git a/nuttx/configs/ez80f910200zco/dhcpd/defconfig b/nuttx/configs/ez80f910200zco/dhcpd/defconfig index 95baadc13b..043526165c 100644 --- a/nuttx/configs/ez80f910200zco/dhcpd/defconfig +++ b/nuttx/configs/ez80f910200zco/dhcpd/defconfig @@ -209,7 +209,7 @@ CONFIG_FS_ROMFS=n CONFIG_MMCSD=y CONFIG_MMCSD_SPI=y -CONFIG_MMCSD_SDIO=y +CONFIG_MTD=y # # SPI-based MMC/SD driver diff --git a/nuttx/configs/ez80f910200zco/httpd/defconfig b/nuttx/configs/ez80f910200zco/httpd/defconfig index 6a910ee0bb..329b970535 100644 --- a/nuttx/configs/ez80f910200zco/httpd/defconfig +++ b/nuttx/configs/ez80f910200zco/httpd/defconfig @@ -209,7 +209,7 @@ CONFIG_FS_ROMFS=n CONFIG_MMCSD=y CONFIG_MMCSD_SPI=y -CONFIG_MMCSD_SDIO=y +CONFIG_MTD=y # # SPI-based MMC/SD driver diff --git a/nuttx/configs/ez80f910200zco/nettest/defconfig b/nuttx/configs/ez80f910200zco/nettest/defconfig index 22cf35a0c4..94eedae20f 100644 --- a/nuttx/configs/ez80f910200zco/nettest/defconfig +++ b/nuttx/configs/ez80f910200zco/nettest/defconfig @@ -209,7 +209,7 @@ CONFIG_FS_ROMFS=n CONFIG_MMCSD=y CONFIG_MMCSD_SPI=y -CONFIG_MMCSD_SDIO=y +CONFIG_MTD=y # # SPI-based MMC/SD driver diff --git a/nuttx/configs/ez80f910200zco/nsh/defconfig b/nuttx/configs/ez80f910200zco/nsh/defconfig index 8ad3930fff..7b8f12a410 100644 --- a/nuttx/configs/ez80f910200zco/nsh/defconfig +++ b/nuttx/configs/ez80f910200zco/nsh/defconfig @@ -209,7 +209,7 @@ CONFIG_FS_ROMFS=y CONFIG_MMCSD=y CONFIG_MMCSD_SPI=y -CONFIG_MMCSD_SDIO=y +CONFIG_MTD=y # # SPI-based MMC/SD driver diff --git a/nuttx/configs/ez80f910200zco/ostest/defconfig b/nuttx/configs/ez80f910200zco/ostest/defconfig index 88c1b72791..e414cfcc14 100644 --- a/nuttx/configs/ez80f910200zco/ostest/defconfig +++ b/nuttx/configs/ez80f910200zco/ostest/defconfig @@ -225,7 +225,7 @@ CONFIG_MMCSD_MMCSUPPORT=y CONFIG_MMCSD_HAVECARDDETECT=y CONFIG_MMCSD_SPI=y CONFIG_MMCSD_SPICLOCK=20000000 -CONFIG_MMCSD_SDIO=y +# CONFIG_MMCSD_SDIO is not set # CONFIG_SDIO_MUXBUS is not set # CONFIG_MTD is not set # CONFIG_PIPES is not set diff --git a/nuttx/configs/ez80f910200zco/poll/defconfig b/nuttx/configs/ez80f910200zco/poll/defconfig index 82cea4fcf2..23c9fe747d 100644 --- a/nuttx/configs/ez80f910200zco/poll/defconfig +++ b/nuttx/configs/ez80f910200zco/poll/defconfig @@ -209,7 +209,7 @@ CONFIG_FS_ROMFS=n CONFIG_MMCSD=y CONFIG_MMCSD_SPI=y -CONFIG_MMCSD_SDIO=y +CONFIG_MTD=y # # SPI-based MMC/SD driver diff --git a/nuttx/configs/hymini-stm32v/buttons/defconfig b/nuttx/configs/hymini-stm32v/buttons/defconfig index e90ded32ad..fc258df0c4 100644 --- a/nuttx/configs/hymini-stm32v/buttons/defconfig +++ b/nuttx/configs/hymini-stm32v/buttons/defconfig @@ -277,6 +277,7 @@ CONFIG_FS_ROMFS=n CONFIG_MMCSD=y CONFIG_MMCSD_SPI=y CONFIG_MMCSD_SDIO=y +CONFIG_MTD=y # # SPI-based MMC/SD driver diff --git a/nuttx/configs/hymini-stm32v/nsh/defconfig b/nuttx/configs/hymini-stm32v/nsh/defconfig index eeb3b09ffd..5736aadc85 100755 --- a/nuttx/configs/hymini-stm32v/nsh/defconfig +++ b/nuttx/configs/hymini-stm32v/nsh/defconfig @@ -274,6 +274,7 @@ CONFIG_FS_ROMFS=n CONFIG_MMCSD=y CONFIG_MMCSD_SPI=y CONFIG_MMCSD_SDIO=y +CONFIG_MTD=y # # SPI-based MMC/SD driver diff --git a/nuttx/configs/hymini-stm32v/nsh2/defconfig b/nuttx/configs/hymini-stm32v/nsh2/defconfig index ecf4c3a3d8..7183a8632c 100644 --- a/nuttx/configs/hymini-stm32v/nsh2/defconfig +++ b/nuttx/configs/hymini-stm32v/nsh2/defconfig @@ -308,6 +308,7 @@ CONFIG_FS_WRITEBUFFER=n CONFIG_MMCSD=y CONFIG_MMCSD_SPI=y CONFIG_MMCSD_SDIO=y +CONFIG_MTD=y # # STM32 SDIO-based MMC/SD driver diff --git a/nuttx/configs/hymini-stm32v/nx/defconfig b/nuttx/configs/hymini-stm32v/nx/defconfig index c6e0491420..4e522cfd82 100644 --- a/nuttx/configs/hymini-stm32v/nx/defconfig +++ b/nuttx/configs/hymini-stm32v/nx/defconfig @@ -291,6 +291,7 @@ CONFIG_FS_ROMFS=n CONFIG_MMCSD=y CONFIG_MMCSD_SPI=y CONFIG_MMCSD_SDIO=y +CONFIG_MTD=y # # SPI-based MMC/SD driver diff --git a/nuttx/configs/hymini-stm32v/nxlines/defconfig b/nuttx/configs/hymini-stm32v/nxlines/defconfig index fb968c483a..7d1e8b9753 100644 --- a/nuttx/configs/hymini-stm32v/nxlines/defconfig +++ b/nuttx/configs/hymini-stm32v/nxlines/defconfig @@ -295,6 +295,7 @@ CONFIG_FS_ROMFS=n CONFIG_MMCSD=y CONFIG_MMCSD_SPI=y CONFIG_MMCSD_SDIO=y +CONFIG_MTD=y # # SPI-based MMC/SD driver diff --git a/nuttx/configs/hymini-stm32v/usbserial/defconfig b/nuttx/configs/hymini-stm32v/usbserial/defconfig index 0c7317a007..b53a79dd89 100755 --- a/nuttx/configs/hymini-stm32v/usbserial/defconfig +++ b/nuttx/configs/hymini-stm32v/usbserial/defconfig @@ -277,6 +277,7 @@ CONFIG_FS_ROMFS=n CONFIG_MMCSD=y CONFIG_MMCSD_SPI=y CONFIG_MMCSD_SDIO=y +CONFIG_MTD=y # # SPI-based MMC/SD driver diff --git a/nuttx/configs/hymini-stm32v/usbstorage/defconfig b/nuttx/configs/hymini-stm32v/usbstorage/defconfig index 16f43a1ce8..d89a33a03e 100755 --- a/nuttx/configs/hymini-stm32v/usbstorage/defconfig +++ b/nuttx/configs/hymini-stm32v/usbstorage/defconfig @@ -284,6 +284,7 @@ CONFIG_FS_ROMFS=n CONFIG_MMCSD=y CONFIG_MMCSD_SPI=y CONFIG_MMCSD_SDIO=y +CONFIG_MTD=y # # SPI-based MMC/SD driver diff --git a/nuttx/configs/kwikstik-k40/ostest/defconfig b/nuttx/configs/kwikstik-k40/ostest/defconfig index ff8c39c1fb..826af71b83 100755 --- a/nuttx/configs/kwikstik-k40/ostest/defconfig +++ b/nuttx/configs/kwikstik-k40/ostest/defconfig @@ -286,6 +286,7 @@ CONFIG_FS_ROMFS=n CONFIG_MMCSD=y CONFIG_MMCSD_SPI=y CONFIG_MMCSD_SDIO=y +CONFIG_MTD=y # # SPI-based MMC/SD driver diff --git a/nuttx/configs/lincoln60/nsh/defconfig b/nuttx/configs/lincoln60/nsh/defconfig index 908b01e3a5..abdea0c862 100644 --- a/nuttx/configs/lincoln60/nsh/defconfig +++ b/nuttx/configs/lincoln60/nsh/defconfig @@ -258,7 +258,7 @@ CONFIG_FS_ROMFS=n CONFIG_MMCSD=y CONFIG_MMCSD_SPI=y -CONFIG_MMCSD_SDIO=y +CONFIG_MTD=y # # SPI-based MMC/SD driver diff --git a/nuttx/configs/lincoln60/ostest/defconfig b/nuttx/configs/lincoln60/ostest/defconfig index ea42f57638..8ab244f0db 100644 --- a/nuttx/configs/lincoln60/ostest/defconfig +++ b/nuttx/configs/lincoln60/ostest/defconfig @@ -268,7 +268,7 @@ CONFIG_FS_ROMFS=n CONFIG_MMCSD=y CONFIG_MMCSD_SPI=y -CONFIG_MMCSD_SDIO=y +CONFIG_MTD=y # # SPI-based MMC/SD driver diff --git a/nuttx/configs/lm3s6432-s2e/nsh/defconfig b/nuttx/configs/lm3s6432-s2e/nsh/defconfig index a09bc6717d..cb3bbdeb4d 100644 --- a/nuttx/configs/lm3s6432-s2e/nsh/defconfig +++ b/nuttx/configs/lm3s6432-s2e/nsh/defconfig @@ -238,7 +238,7 @@ CONFIG_FS_ROMFS=n CONFIG_MMCSD=y CONFIG_MMCSD_SPI=y -CONFIG_MMCSD_SDIO=y +CONFIG_MTD=y # # SPI-based MMC/SD driver diff --git a/nuttx/configs/lm3s6432-s2e/ostest/defconfig b/nuttx/configs/lm3s6432-s2e/ostest/defconfig index 9387fd0868..a3ec724222 100644 --- a/nuttx/configs/lm3s6432-s2e/ostest/defconfig +++ b/nuttx/configs/lm3s6432-s2e/ostest/defconfig @@ -237,7 +237,7 @@ CONFIG_FS_ROMFS=n CONFIG_MMCSD=y CONFIG_MMCSD_SPI=y -CONFIG_MMCSD_SDIO=y +CONFIG_MTD=y # # SPI-based MMC/SD driver diff --git a/nuttx/configs/lm3s6965-ek/nsh/defconfig b/nuttx/configs/lm3s6965-ek/nsh/defconfig index 5c288f95dd..ccda5d9e85 100755 --- a/nuttx/configs/lm3s6965-ek/nsh/defconfig +++ b/nuttx/configs/lm3s6965-ek/nsh/defconfig @@ -280,7 +280,7 @@ CONFIG_MMCSD_MMCSUPPORT=y CONFIG_MMCSD_HAVECARDDETECT=y CONFIG_MMCSD_SPI=y CONFIG_MMCSD_SPICLOCK=12500000 -CONFIG_MMCSD_SDIO=y +# CONFIG_MMCSD_SDIO is not set # CONFIG_SDIO_MUXBUS is not set # CONFIG_MTD is not set # CONFIG_NETDEVICES is not set diff --git a/nuttx/configs/lm3s6965-ek/ostest/defconfig b/nuttx/configs/lm3s6965-ek/ostest/defconfig index 67633c9166..7a1b0eb0aa 100755 --- a/nuttx/configs/lm3s6965-ek/ostest/defconfig +++ b/nuttx/configs/lm3s6965-ek/ostest/defconfig @@ -259,7 +259,7 @@ CONFIG_MMCSD_MMCSUPPORT=y CONFIG_MMCSD_HAVECARDDETECT=y CONFIG_MMCSD_SPI=y CONFIG_MMCSD_SPICLOCK=12500000 -CONFIG_MMCSD_SDIO=y +# CONFIG_MMCSD_SDIO is not set # CONFIG_SDIO_MUXBUS is not set # CONFIG_MTD is not set # CONFIG_PIPES is not set diff --git a/nuttx/configs/lm3s8962-ek/nsh/defconfig b/nuttx/configs/lm3s8962-ek/nsh/defconfig index 4a35f8d4a9..f49b977aa2 100755 --- a/nuttx/configs/lm3s8962-ek/nsh/defconfig +++ b/nuttx/configs/lm3s8962-ek/nsh/defconfig @@ -238,7 +238,7 @@ CONFIG_FS_ROMFS=n CONFIG_MMCSD=y CONFIG_MMCSD_SPI=y -CONFIG_MMCSD_SDIO=y +CONFIG_MTD=y # # SPI-based MMC/SD driver diff --git a/nuttx/configs/lm3s8962-ek/nx/defconfig b/nuttx/configs/lm3s8962-ek/nx/defconfig index 3ca6ade216..b92bd8e95d 100755 --- a/nuttx/configs/lm3s8962-ek/nx/defconfig +++ b/nuttx/configs/lm3s8962-ek/nx/defconfig @@ -252,7 +252,7 @@ CONFIG_FS_ROMFS=n CONFIG_MMCSD=y CONFIG_MMCSD_SPI=y -CONFIG_MMCSD_SDIO=y +CONFIG_MTD=y # # SPI-based MMC/SD driver diff --git a/nuttx/configs/lm3s8962-ek/ostest/defconfig b/nuttx/configs/lm3s8962-ek/ostest/defconfig index 169ac9c8f5..cdf0477bcf 100755 --- a/nuttx/configs/lm3s8962-ek/ostest/defconfig +++ b/nuttx/configs/lm3s8962-ek/ostest/defconfig @@ -237,7 +237,7 @@ CONFIG_FS_ROMFS=n CONFIG_MMCSD=y CONFIG_MMCSD_SPI=y -CONFIG_MMCSD_SDIO=y +CONFIG_MTD=y # # SPI-based MMC/SD driver diff --git a/nuttx/configs/lpc4330-xplorer/nsh/defconfig b/nuttx/configs/lpc4330-xplorer/nsh/defconfig index 78b9e3f715..99c9200782 100644 --- a/nuttx/configs/lpc4330-xplorer/nsh/defconfig +++ b/nuttx/configs/lpc4330-xplorer/nsh/defconfig @@ -330,6 +330,7 @@ CONFIG_FS_ROMFS=n CONFIG_MMCSD=y CONFIG_MMCSD_SPI=y CONFIG_MMCSD_SDIO=y +CONFIG_MTD=y # # SPI-based MMC/SD driver diff --git a/nuttx/configs/lpc4330-xplorer/ostest/defconfig b/nuttx/configs/lpc4330-xplorer/ostest/defconfig index 342fe04a08..fc853de176 100644 --- a/nuttx/configs/lpc4330-xplorer/ostest/defconfig +++ b/nuttx/configs/lpc4330-xplorer/ostest/defconfig @@ -327,6 +327,7 @@ CONFIG_FS_ROMFS=n CONFIG_MMCSD=y CONFIG_MMCSD_SPI=y CONFIG_MMCSD_SDIO=y +CONFIG_MTD=y # # SPI-based MMC/SD driver diff --git a/nuttx/configs/lpcxpresso-lpc1768/dhcpd/defconfig b/nuttx/configs/lpcxpresso-lpc1768/dhcpd/defconfig index 2e0d2eea66..824fcfb2c3 100755 --- a/nuttx/configs/lpcxpresso-lpc1768/dhcpd/defconfig +++ b/nuttx/configs/lpcxpresso-lpc1768/dhcpd/defconfig @@ -270,7 +270,7 @@ CONFIG_FS_ROMFS=n CONFIG_MMCSD=y CONFIG_MMCSD_SPI=y -CONFIG_MMCSD_SDIO=y +CONFIG_MTD=y # # SPI-based MMC/SD driver diff --git a/nuttx/configs/lpcxpresso-lpc1768/nsh/defconfig b/nuttx/configs/lpcxpresso-lpc1768/nsh/defconfig index 23f375a47a..c11cf623f1 100755 --- a/nuttx/configs/lpcxpresso-lpc1768/nsh/defconfig +++ b/nuttx/configs/lpcxpresso-lpc1768/nsh/defconfig @@ -266,7 +266,7 @@ CONFIG_FS_ROMFS=n CONFIG_MMCSD=y CONFIG_MMCSD_SPI=y -CONFIG_MMCSD_SDIO=y +CONFIG_MTD=y # # SPI-based MMC/SD driver diff --git a/nuttx/configs/lpcxpresso-lpc1768/nx/defconfig b/nuttx/configs/lpcxpresso-lpc1768/nx/defconfig index 3f8474103a..d4b3b89538 100755 --- a/nuttx/configs/lpcxpresso-lpc1768/nx/defconfig +++ b/nuttx/configs/lpcxpresso-lpc1768/nx/defconfig @@ -283,7 +283,7 @@ CONFIG_FS_ROMFS=n CONFIG_MMCSD=y CONFIG_MMCSD_SPI=y -CONFIG_MMCSD_SDIO=y +CONFIG_MTD=y # # SPI-based MMC/SD driver diff --git a/nuttx/configs/lpcxpresso-lpc1768/ostest/defconfig b/nuttx/configs/lpcxpresso-lpc1768/ostest/defconfig index 10b63eb2d1..831b717b9a 100755 --- a/nuttx/configs/lpcxpresso-lpc1768/ostest/defconfig +++ b/nuttx/configs/lpcxpresso-lpc1768/ostest/defconfig @@ -268,7 +268,7 @@ CONFIG_FS_ROMFS=n CONFIG_MMCSD=y CONFIG_MMCSD_SPI=y -CONFIG_MMCSD_SDIO=y +CONFIG_MTD=y # # SPI-based MMC/SD driver diff --git a/nuttx/configs/lpcxpresso-lpc1768/thttpd/defconfig b/nuttx/configs/lpcxpresso-lpc1768/thttpd/defconfig index b6ea25948f..299750371d 100755 --- a/nuttx/configs/lpcxpresso-lpc1768/thttpd/defconfig +++ b/nuttx/configs/lpcxpresso-lpc1768/thttpd/defconfig @@ -270,7 +270,7 @@ CONFIG_FS_ROMFS=y CONFIG_MMCSD=y CONFIG_MMCSD_SPI=y -CONFIG_MMCSD_SDIO=y +CONFIG_MTD=y # # SPI-based MMC/SD driver diff --git a/nuttx/configs/lpcxpresso-lpc1768/usbstorage/defconfig b/nuttx/configs/lpcxpresso-lpc1768/usbstorage/defconfig index 9e4bcb15d6..fd055ee02c 100755 --- a/nuttx/configs/lpcxpresso-lpc1768/usbstorage/defconfig +++ b/nuttx/configs/lpcxpresso-lpc1768/usbstorage/defconfig @@ -264,7 +264,7 @@ CONFIG_FS_ROMFS=n CONFIG_MMCSD=y CONFIG_MMCSD_SPI=y -CONFIG_MMCSD_SDIO=y +CONFIG_MTD=y # # SPI-based MMC/SD driver diff --git a/nuttx/configs/m68332evb/defconfig b/nuttx/configs/m68332evb/defconfig index 4c40201847..7e49073a9d 100644 --- a/nuttx/configs/m68332evb/defconfig +++ b/nuttx/configs/m68332evb/defconfig @@ -216,4 +216,4 @@ CONFIG_HEAP_SIZE= CONFIG_MMCSD=y CONFIG_MMCSD_SPI=y -CONFIG_MMCSD_SDIO=y +CONFIG_MTD=y diff --git a/nuttx/configs/mbed/hidkbd/defconfig b/nuttx/configs/mbed/hidkbd/defconfig index b4bf00872d..94b007355b 100644 --- a/nuttx/configs/mbed/hidkbd/defconfig +++ b/nuttx/configs/mbed/hidkbd/defconfig @@ -263,7 +263,7 @@ CONFIG_FS_ROMFS=n CONFIG_MMCSD=y CONFIG_MMCSD_SPI=y -CONFIG_MMCSD_SDIO=y +CONFIG_MTD=y # # SPI-based MMC/SD driver diff --git a/nuttx/configs/mbed/nsh/defconfig b/nuttx/configs/mbed/nsh/defconfig index 2156af80ef..40a230b524 100755 --- a/nuttx/configs/mbed/nsh/defconfig +++ b/nuttx/configs/mbed/nsh/defconfig @@ -258,7 +258,7 @@ CONFIG_FS_ROMFS=n CONFIG_MMCSD=y CONFIG_MMCSD_SPI=y -CONFIG_MMCSD_SDIO=y +CONFIG_MTD=y # # SPI-based MMC/SD driver diff --git a/nuttx/configs/mcu123-lpc214x/composite/defconfig b/nuttx/configs/mcu123-lpc214x/composite/defconfig index 04fbe2b9e7..682facbabd 100644 --- a/nuttx/configs/mcu123-lpc214x/composite/defconfig +++ b/nuttx/configs/mcu123-lpc214x/composite/defconfig @@ -199,7 +199,7 @@ CONFIG_FS_ROMFS=n CONFIG_MMCSD=y CONFIG_MMCSD_SPI=y -CONFIG_MMCSD_SDIO=y +CONFIG_MTD=y # # SPI-based MMC/SD driver diff --git a/nuttx/configs/mcu123-lpc214x/ostest/defconfig b/nuttx/configs/mcu123-lpc214x/ostest/defconfig index 9d59439be5..7d0c501578 100644 --- a/nuttx/configs/mcu123-lpc214x/ostest/defconfig +++ b/nuttx/configs/mcu123-lpc214x/ostest/defconfig @@ -197,7 +197,7 @@ CONFIG_FS_ROMFS=n CONFIG_MMCSD=y CONFIG_MMCSD_SPI=y -CONFIG_MMCSD_SDIO=y +CONFIG_MTD=y # # SPI-based MMC/SD driver diff --git a/nuttx/configs/mcu123-lpc214x/usbserial/defconfig b/nuttx/configs/mcu123-lpc214x/usbserial/defconfig index 3097f7d783..c9f528c376 100644 --- a/nuttx/configs/mcu123-lpc214x/usbserial/defconfig +++ b/nuttx/configs/mcu123-lpc214x/usbserial/defconfig @@ -197,7 +197,7 @@ CONFIG_FS_ROMFS=n CONFIG_MMCSD=y CONFIG_MMCSD_SPI=y -CONFIG_MMCSD_SDIO=y +CONFIG_MTD=y # # SPI-based MMC/SD driver diff --git a/nuttx/configs/mcu123-lpc214x/usbstorage/defconfig b/nuttx/configs/mcu123-lpc214x/usbstorage/defconfig index 7b22bf6b0e..4273315c69 100644 --- a/nuttx/configs/mcu123-lpc214x/usbstorage/defconfig +++ b/nuttx/configs/mcu123-lpc214x/usbstorage/defconfig @@ -199,7 +199,7 @@ CONFIG_FS_ROMFS=n CONFIG_MMCSD=y CONFIG_MMCSD_SPI=y -CONFIG_MMCSD_SDIO=y +CONFIG_MTD=y # # SPI-based MMC/SD driver diff --git a/nuttx/configs/micropendous3/hello/defconfig b/nuttx/configs/micropendous3/hello/defconfig index ebc755abcc..2708c5d52e 100644 --- a/nuttx/configs/micropendous3/hello/defconfig +++ b/nuttx/configs/micropendous3/hello/defconfig @@ -221,7 +221,7 @@ CONFIG_FS_ROMFS=n CONFIG_MMCSD=y CONFIG_MMCSD_SPI=y -CONFIG_MMCSD_SDIO=y +CONFIG_MTD=y # # SPI-based MMC/SD driver diff --git a/nuttx/configs/mirtoo/nsh/defconfig b/nuttx/configs/mirtoo/nsh/defconfig index 6e0d3bf70a..9beaf67280 100644 --- a/nuttx/configs/mirtoo/nsh/defconfig +++ b/nuttx/configs/mirtoo/nsh/defconfig @@ -285,7 +285,7 @@ CONFIG_FS_ROMFS=n CONFIG_MMCSD=y CONFIG_MMCSD_SPI=y -CONFIG_MMCSD_SDIO=y +CONFIG_MTD=y # # SPI-based MMC/SD driver diff --git a/nuttx/configs/mirtoo/nxffs/defconfig b/nuttx/configs/mirtoo/nxffs/defconfig index ed50e0325c..50929eb0e4 100644 --- a/nuttx/configs/mirtoo/nxffs/defconfig +++ b/nuttx/configs/mirtoo/nxffs/defconfig @@ -285,7 +285,7 @@ CONFIG_FS_ROMFS=n CONFIG_MMCSD=y CONFIG_MMCSD_SPI=y -CONFIG_MMCSD_SDIO=y +CONFIG_MTD=y # # SPI-based MMC/SD driver diff --git a/nuttx/configs/mirtoo/ostest/defconfig b/nuttx/configs/mirtoo/ostest/defconfig index 5c8b697854..7c8596dbf4 100644 --- a/nuttx/configs/mirtoo/ostest/defconfig +++ b/nuttx/configs/mirtoo/ostest/defconfig @@ -276,7 +276,7 @@ CONFIG_FS_ROMFS=n CONFIG_MMCSD=y CONFIG_MMCSD_SPI=y -CONFIG_MMCSD_SDIO=y +CONFIG_MTD=y # # SPI-based MMC/SD driver diff --git a/nuttx/configs/mx1ads/ostest/defconfig b/nuttx/configs/mx1ads/ostest/defconfig index 54dbf6cce4..d432b84691 100644 --- a/nuttx/configs/mx1ads/ostest/defconfig +++ b/nuttx/configs/mx1ads/ostest/defconfig @@ -328,4 +328,4 @@ CONFIG_HEAP_SIZE= CONFIG_MMCSD=y CONFIG_MMCSD_SPI=y -CONFIG_MMCSD_SDIO=y +CONFIG_MTD=y diff --git a/nuttx/configs/ne64badge/ostest/defconfig b/nuttx/configs/ne64badge/ostest/defconfig index e6e0df700e..a730c93ebf 100755 --- a/nuttx/configs/ne64badge/ostest/defconfig +++ b/nuttx/configs/ne64badge/ostest/defconfig @@ -225,7 +225,7 @@ CONFIG_FS_ROMFS=n CONFIG_MMCSD=y CONFIG_MMCSD_SPI=y -CONFIG_MMCSD_SDIO=y +CONFIG_MTD=y # # SPI-based MMC/SD driver diff --git a/nuttx/configs/ntosd-dm320/nettest/defconfig b/nuttx/configs/ntosd-dm320/nettest/defconfig index dd2aff53c3..ee70127e3c 100644 --- a/nuttx/configs/ntosd-dm320/nettest/defconfig +++ b/nuttx/configs/ntosd-dm320/nettest/defconfig @@ -324,4 +324,4 @@ CONFIG_HEAP_SIZE= CONFIG_MMCSD=y CONFIG_MMCSD_SPI=y -CONFIG_MMCSD_SDIO=y +CONFIG_MTD=y diff --git a/nuttx/configs/ntosd-dm320/nsh/defconfig b/nuttx/configs/ntosd-dm320/nsh/defconfig index 98de53fe03..83f0dde793 100644 --- a/nuttx/configs/ntosd-dm320/nsh/defconfig +++ b/nuttx/configs/ntosd-dm320/nsh/defconfig @@ -355,4 +355,4 @@ CONFIG_HEAP_SIZE= CONFIG_MMCSD=y CONFIG_MMCSD_SPI=y -CONFIG_MMCSD_SDIO=y +CONFIG_MTD=y diff --git a/nuttx/configs/ntosd-dm320/ostest/defconfig b/nuttx/configs/ntosd-dm320/ostest/defconfig index 5d606453b1..94a946db37 100644 --- a/nuttx/configs/ntosd-dm320/ostest/defconfig +++ b/nuttx/configs/ntosd-dm320/ostest/defconfig @@ -320,4 +320,4 @@ CONFIG_HEAP_SIZE= CONFIG_MMCSD=y CONFIG_MMCSD_SPI=y -CONFIG_MMCSD_SDIO=y +CONFIG_MTD=y diff --git a/nuttx/configs/ntosd-dm320/poll/defconfig b/nuttx/configs/ntosd-dm320/poll/defconfig index e43eccce56..d808688837 100644 --- a/nuttx/configs/ntosd-dm320/poll/defconfig +++ b/nuttx/configs/ntosd-dm320/poll/defconfig @@ -331,4 +331,4 @@ CONFIG_HEAP_SIZE= CONFIG_MMCSD=y CONFIG_MMCSD_SPI=y -CONFIG_MMCSD_SDIO=y +CONFIG_MTD=y diff --git a/nuttx/configs/ntosd-dm320/thttpd/defconfig b/nuttx/configs/ntosd-dm320/thttpd/defconfig index fbb6d644f9..632e9a16e6 100644 --- a/nuttx/configs/ntosd-dm320/thttpd/defconfig +++ b/nuttx/configs/ntosd-dm320/thttpd/defconfig @@ -399,4 +399,4 @@ CONFIG_HEAP_SIZE= CONFIG_MMCSD=y CONFIG_MMCSD_SPI=y -CONFIG_MMCSD_SDIO=y +CONFIG_MTD=y diff --git a/nuttx/configs/ntosd-dm320/udp/defconfig b/nuttx/configs/ntosd-dm320/udp/defconfig index 5859279d0b..3d79e75acb 100644 --- a/nuttx/configs/ntosd-dm320/udp/defconfig +++ b/nuttx/configs/ntosd-dm320/udp/defconfig @@ -332,4 +332,4 @@ CONFIG_HEAP_SIZE= CONFIG_MMCSD=y CONFIG_MMCSD_SPI=y -CONFIG_MMCSD_SDIO=y +CONFIG_MTD=y diff --git a/nuttx/configs/ntosd-dm320/uip/defconfig b/nuttx/configs/ntosd-dm320/uip/defconfig index 69387e7f6d..6e08a37024 100644 --- a/nuttx/configs/ntosd-dm320/uip/defconfig +++ b/nuttx/configs/ntosd-dm320/uip/defconfig @@ -332,4 +332,4 @@ CONFIG_HEAP_SIZE= CONFIG_MMCSD=y CONFIG_MMCSD_SPI=y -CONFIG_MMCSD_SDIO=y +CONFIG_MTD=y diff --git a/nuttx/configs/nucleus2g/nsh/defconfig b/nuttx/configs/nucleus2g/nsh/defconfig index 2c440bc7f2..8f3e509715 100755 --- a/nuttx/configs/nucleus2g/nsh/defconfig +++ b/nuttx/configs/nucleus2g/nsh/defconfig @@ -259,7 +259,7 @@ CONFIG_FS_ROMFS=n CONFIG_MMCSD=y CONFIG_MMCSD_SPI=y -CONFIG_MMCSD_SDIO=y +CONFIG_MTD=y # # SPI-based MMC/SD driver diff --git a/nuttx/configs/nucleus2g/ostest/defconfig b/nuttx/configs/nucleus2g/ostest/defconfig index c32b1e715f..8f6cc8ac1d 100755 --- a/nuttx/configs/nucleus2g/ostest/defconfig +++ b/nuttx/configs/nucleus2g/ostest/defconfig @@ -258,7 +258,7 @@ CONFIG_FS_ROMFS=n CONFIG_MMCSD=y CONFIG_MMCSD_SPI=y -CONFIG_MMCSD_SDIO=y +CONFIG_MTD=y # # SPI-based MMC/SD driver diff --git a/nuttx/configs/nucleus2g/usbserial/defconfig b/nuttx/configs/nucleus2g/usbserial/defconfig index abe9ac0203..edd2160b40 100755 --- a/nuttx/configs/nucleus2g/usbserial/defconfig +++ b/nuttx/configs/nucleus2g/usbserial/defconfig @@ -259,7 +259,7 @@ CONFIG_FS_ROMFS=n CONFIG_MMCSD=y CONFIG_MMCSD_SPI=y -CONFIG_MMCSD_SDIO=y +CONFIG_MTD=y # # SPI-based MMC/SD driver diff --git a/nuttx/configs/nucleus2g/usbstorage/defconfig b/nuttx/configs/nucleus2g/usbstorage/defconfig index adab8f4f0e..8ea4614bea 100755 --- a/nuttx/configs/nucleus2g/usbstorage/defconfig +++ b/nuttx/configs/nucleus2g/usbstorage/defconfig @@ -260,7 +260,7 @@ CONFIG_FS_ROMFS=n CONFIG_MMCSD=y CONFIG_MMCSD_SPI=y -CONFIG_MMCSD_SDIO=y +CONFIG_MTD=y # # SPI-based MMC/SD driver diff --git a/nuttx/configs/olimex-lpc1766stk/ftpc/defconfig b/nuttx/configs/olimex-lpc1766stk/ftpc/defconfig index 8ff0d95aaf..15b26899b0 100755 --- a/nuttx/configs/olimex-lpc1766stk/ftpc/defconfig +++ b/nuttx/configs/olimex-lpc1766stk/ftpc/defconfig @@ -281,7 +281,7 @@ CONFIG_FS_ROMFS=n CONFIG_MMCSD=y CONFIG_MMCSD_SPI=y -CONFIG_MMCSD_SDIO=y +CONFIG_MTD=y # # SPI-based MMC/SD driver diff --git a/nuttx/configs/olimex-lpc1766stk/hidkbd/defconfig b/nuttx/configs/olimex-lpc1766stk/hidkbd/defconfig index 6346011879..fce1ed26f0 100755 --- a/nuttx/configs/olimex-lpc1766stk/hidkbd/defconfig +++ b/nuttx/configs/olimex-lpc1766stk/hidkbd/defconfig @@ -329,7 +329,7 @@ CONFIG_MMCSD_NSLOTS=1 # CONFIG_MMCSD_HAVECARDDETECT is not set CONFIG_MMCSD_SPI=y CONFIG_MMCSD_SPICLOCK=12500000 -CONFIG_MMCSD_SDIO=y +# CONFIG_MMCSD_SDIO=y is not set # CONFIG_SDIO_MUXBUS is not set # CONFIG_MTD is not set # CONFIG_PIPES is not set diff --git a/nuttx/configs/olimex-lpc1766stk/nettest/defconfig b/nuttx/configs/olimex-lpc1766stk/nettest/defconfig index 4ab823b8c7..5b6b3d676b 100755 --- a/nuttx/configs/olimex-lpc1766stk/nettest/defconfig +++ b/nuttx/configs/olimex-lpc1766stk/nettest/defconfig @@ -273,7 +273,7 @@ CONFIG_FS_ROMFS=n CONFIG_MMCSD=y CONFIG_MMCSD_SPI=y -CONFIG_MMCSD_SDIO=y +CONFIG_MTD=y # # SPI-based MMC/SD driver diff --git a/nuttx/configs/olimex-lpc1766stk/nsh/defconfig b/nuttx/configs/olimex-lpc1766stk/nsh/defconfig index 096f08a8a8..8ed82a3edd 100755 --- a/nuttx/configs/olimex-lpc1766stk/nsh/defconfig +++ b/nuttx/configs/olimex-lpc1766stk/nsh/defconfig @@ -285,7 +285,7 @@ CONFIG_FS_ROMFS=n CONFIG_MMCSD=y CONFIG_MMCSD_SPI=y -CONFIG_MMCSD_SDIO=y +CONFIG_MTD=y # # SPI-based MMC/SD driver diff --git a/nuttx/configs/olimex-lpc1766stk/nx/defconfig b/nuttx/configs/olimex-lpc1766stk/nx/defconfig index 28ad229d6b..f27acf40e6 100755 --- a/nuttx/configs/olimex-lpc1766stk/nx/defconfig +++ b/nuttx/configs/olimex-lpc1766stk/nx/defconfig @@ -286,7 +286,7 @@ CONFIG_FS_ROMFS=n CONFIG_MMCSD=y CONFIG_MMCSD_SPI=y -CONFIG_MMCSD_SDIO=y +CONFIG_MTD=y # # SPI-based MMC/SD driver diff --git a/nuttx/configs/olimex-lpc1766stk/ostest/defconfig b/nuttx/configs/olimex-lpc1766stk/ostest/defconfig index 02732e74a5..f341a49c42 100755 --- a/nuttx/configs/olimex-lpc1766stk/ostest/defconfig +++ b/nuttx/configs/olimex-lpc1766stk/ostest/defconfig @@ -268,7 +268,7 @@ CONFIG_FS_ROMFS=n CONFIG_MMCSD=y CONFIG_MMCSD_SPI=y -CONFIG_MMCSD_SDIO=y +CONFIG_MTD=y # # SPI-based MMC/SD driver diff --git a/nuttx/configs/olimex-lpc1766stk/slip-httpd/defconfig b/nuttx/configs/olimex-lpc1766stk/slip-httpd/defconfig index 9becdee046..259457cf6c 100755 --- a/nuttx/configs/olimex-lpc1766stk/slip-httpd/defconfig +++ b/nuttx/configs/olimex-lpc1766stk/slip-httpd/defconfig @@ -278,7 +278,7 @@ CONFIG_FS_ROMFS=y CONFIG_MMCSD=y CONFIG_MMCSD_SPI=y -CONFIG_MMCSD_SDIO=y +CONFIG_MTD=y # # SPI-based MMC/SD driver diff --git a/nuttx/configs/olimex-lpc1766stk/thttpd/defconfig b/nuttx/configs/olimex-lpc1766stk/thttpd/defconfig index fe42a861f9..f684dcde30 100755 --- a/nuttx/configs/olimex-lpc1766stk/thttpd/defconfig +++ b/nuttx/configs/olimex-lpc1766stk/thttpd/defconfig @@ -276,7 +276,7 @@ CONFIG_FS_ROMFS=y CONFIG_MMCSD=y CONFIG_MMCSD_SPI=y -CONFIG_MMCSD_SDIO=y +CONFIG_MTD=y # # SPI-based MMC/SD driver diff --git a/nuttx/configs/olimex-lpc1766stk/usbserial/defconfig b/nuttx/configs/olimex-lpc1766stk/usbserial/defconfig index 995cbad598..122e61485c 100755 --- a/nuttx/configs/olimex-lpc1766stk/usbserial/defconfig +++ b/nuttx/configs/olimex-lpc1766stk/usbserial/defconfig @@ -269,7 +269,7 @@ CONFIG_FS_ROMFS=n CONFIG_MMCSD=y CONFIG_MMCSD_SPI=y -CONFIG_MMCSD_SDIO=y +CONFIG_MTD=y # # SPI-based MMC/SD driver diff --git a/nuttx/configs/olimex-lpc1766stk/usbstorage/defconfig b/nuttx/configs/olimex-lpc1766stk/usbstorage/defconfig index e11c2c404e..51743e0202 100755 --- a/nuttx/configs/olimex-lpc1766stk/usbstorage/defconfig +++ b/nuttx/configs/olimex-lpc1766stk/usbstorage/defconfig @@ -270,7 +270,7 @@ CONFIG_FS_ROMFS=n CONFIG_MMCSD=y CONFIG_MMCSD_SPI=y -CONFIG_MMCSD_SDIO=y +CONFIG_MTD=y # # SPI-based MMC/SD driver diff --git a/nuttx/configs/olimex-lpc2378/nsh/defconfig b/nuttx/configs/olimex-lpc2378/nsh/defconfig index fcddbaaca0..c6728adb74 100755 --- a/nuttx/configs/olimex-lpc2378/nsh/defconfig +++ b/nuttx/configs/olimex-lpc2378/nsh/defconfig @@ -214,7 +214,7 @@ CONFIG_FS_ROMFS=n CONFIG_MMCSD=y CONFIG_MMCSD_SPI=y -CONFIG_MMCSD_SDIO=y +CONFIG_MTD=y # # SPI-based MMC/SD driver diff --git a/nuttx/configs/olimex-lpc2378/ostest/defconfig b/nuttx/configs/olimex-lpc2378/ostest/defconfig index b7216c7c4a..01e1918fde 100755 --- a/nuttx/configs/olimex-lpc2378/ostest/defconfig +++ b/nuttx/configs/olimex-lpc2378/ostest/defconfig @@ -214,7 +214,7 @@ CONFIG_FS_ROMFS=n CONFIG_MMCSD=y CONFIG_MMCSD_SPI=y -CONFIG_MMCSD_SDIO=y +CONFIG_MTD=y # # SPI-based MMC/SD driver diff --git a/nuttx/configs/olimex-stm32-p107/nsh/defconfig b/nuttx/configs/olimex-stm32-p107/nsh/defconfig index 0a831ce9fc..09d447e145 100644 --- a/nuttx/configs/olimex-stm32-p107/nsh/defconfig +++ b/nuttx/configs/olimex-stm32-p107/nsh/defconfig @@ -316,6 +316,7 @@ CONFIG_FS_ROMFS=n CONFIG_MMCSD=y CONFIG_MMCSD_SPI=y CONFIG_MMCSD_SDIO=y +CONFIG_MTD=y # # SPI-based MMC/SD driver diff --git a/nuttx/configs/olimex-stm32-p107/ostest/defconfig b/nuttx/configs/olimex-stm32-p107/ostest/defconfig index 272832381e..6bc065784c 100644 --- a/nuttx/configs/olimex-stm32-p107/ostest/defconfig +++ b/nuttx/configs/olimex-stm32-p107/ostest/defconfig @@ -324,6 +324,7 @@ CONFIG_FS_ROMFS=n CONFIG_MMCSD=y CONFIG_MMCSD_SPI=y CONFIG_MMCSD_SDIO=y +CONFIG_MTD=y # # SPI-based MMC/SD driver diff --git a/nuttx/configs/olimex-strp711/nettest/defconfig b/nuttx/configs/olimex-strp711/nettest/defconfig index a8767c7be1..bc95f0c02d 100755 --- a/nuttx/configs/olimex-strp711/nettest/defconfig +++ b/nuttx/configs/olimex-strp711/nettest/defconfig @@ -248,7 +248,7 @@ CONFIG_ENC28J60_HALFDUPPLEX=n CONFIG_MMCSD=y CONFIG_MMCSD_SPI=y -CONFIG_MMCSD_SDIO=y +CONFIG_MTD=y # # SPI-based MMC/SD driver diff --git a/nuttx/configs/olimex-strp711/nsh/defconfig b/nuttx/configs/olimex-strp711/nsh/defconfig index b621945ed6..886498eae6 100644 --- a/nuttx/configs/olimex-strp711/nsh/defconfig +++ b/nuttx/configs/olimex-strp711/nsh/defconfig @@ -231,7 +231,7 @@ CONFIG_FS_ROMFS=n CONFIG_MMCSD=y CONFIG_MMCSD_SPI=y -CONFIG_MMCSD_SDIO=y +CONFIG_MTD=y # # SPI-based MMC/SD driver diff --git a/nuttx/configs/olimex-strp711/ostest/defconfig b/nuttx/configs/olimex-strp711/ostest/defconfig index 02804cd67e..b5621315a6 100644 --- a/nuttx/configs/olimex-strp711/ostest/defconfig +++ b/nuttx/configs/olimex-strp711/ostest/defconfig @@ -231,7 +231,7 @@ CONFIG_FS_ROMFS=n CONFIG_MMCSD=y CONFIG_MMCSD_SPI=y -CONFIG_MMCSD_SDIO=y +CONFIG_MTD=y # # SPI-based MMC/SD driver diff --git a/nuttx/configs/pcblogic-pic32mx/nsh/defconfig b/nuttx/configs/pcblogic-pic32mx/nsh/defconfig index 6f1ef7dc90..fe24cb886f 100644 --- a/nuttx/configs/pcblogic-pic32mx/nsh/defconfig +++ b/nuttx/configs/pcblogic-pic32mx/nsh/defconfig @@ -273,7 +273,7 @@ CONFIG_FS_ROMFS=n CONFIG_MMCSD=y CONFIG_MMCSD_SPI=y -CONFIG_MMCSD_SDIO=y +CONFIG_MTD=y # # SPI-based MMC/SD driver diff --git a/nuttx/configs/pcblogic-pic32mx/ostest/defconfig b/nuttx/configs/pcblogic-pic32mx/ostest/defconfig index 1df428f8ae..19196eae94 100644 --- a/nuttx/configs/pcblogic-pic32mx/ostest/defconfig +++ b/nuttx/configs/pcblogic-pic32mx/ostest/defconfig @@ -263,7 +263,7 @@ CONFIG_FS_ROMFS=n CONFIG_MMCSD=y CONFIG_MMCSD_SPI=y -CONFIG_MMCSD_SDIO=y +CONFIG_MTD=y # # SPI-based MMC/SD driver diff --git a/nuttx/configs/pic32-starterkit/nsh/defconfig b/nuttx/configs/pic32-starterkit/nsh/defconfig index f1c543e5f0..8bf0432e28 100644 --- a/nuttx/configs/pic32-starterkit/nsh/defconfig +++ b/nuttx/configs/pic32-starterkit/nsh/defconfig @@ -356,7 +356,7 @@ CONFIG_FS_ROMFS=n CONFIG_MMCSD=y CONFIG_MMCSD_SPI=y -CONFIG_MMCSD_SDIO=y +CONFIG_MTD=y # # SPI-based MMC/SD driver diff --git a/nuttx/configs/pic32-starterkit/nsh2/defconfig b/nuttx/configs/pic32-starterkit/nsh2/defconfig index f681b7689e..fb54a2949f 100644 --- a/nuttx/configs/pic32-starterkit/nsh2/defconfig +++ b/nuttx/configs/pic32-starterkit/nsh2/defconfig @@ -355,7 +355,7 @@ CONFIG_FS_ROMFS=n CONFIG_MMCSD=y CONFIG_MMCSD_SPI=y -CONFIG_MMCSD_SDIO=y +CONFIG_MTD=y # # SPI-based MMC/SD driver diff --git a/nuttx/configs/pic32-starterkit/ostest/defconfig b/nuttx/configs/pic32-starterkit/ostest/defconfig index 6a077f2097..39f7d04af6 100644 --- a/nuttx/configs/pic32-starterkit/ostest/defconfig +++ b/nuttx/configs/pic32-starterkit/ostest/defconfig @@ -353,7 +353,7 @@ CONFIG_FS_ROMFS=n CONFIG_MMCSD=y CONFIG_MMCSD_SPI=y -CONFIG_MMCSD_SDIO=y +CONFIG_MTD=y # # SPI-based MMC/SD driver diff --git a/nuttx/configs/pic32mx7mmb/nsh/defconfig b/nuttx/configs/pic32mx7mmb/nsh/defconfig index 66cd240e22..62f524ee2a 100644 --- a/nuttx/configs/pic32mx7mmb/nsh/defconfig +++ b/nuttx/configs/pic32mx7mmb/nsh/defconfig @@ -371,7 +371,7 @@ CONFIG_FS_ROMFS=n CONFIG_MMCSD=y CONFIG_MMCSD_SPI=y -CONFIG_MMCSD_SDIO=y +CONFIG_MTD=y # # SPI-based MMC/SD driver diff --git a/nuttx/configs/pic32mx7mmb/ostest/defconfig b/nuttx/configs/pic32mx7mmb/ostest/defconfig index 7cb71995eb..4595913cdd 100644 --- a/nuttx/configs/pic32mx7mmb/ostest/defconfig +++ b/nuttx/configs/pic32mx7mmb/ostest/defconfig @@ -353,7 +353,7 @@ CONFIG_FS_ROMFS=n CONFIG_MMCSD=y CONFIG_MMCSD_SPI=y -CONFIG_MMCSD_SDIO=y +CONFIG_MTD=y # # SPI-based MMC/SD driver diff --git a/nuttx/configs/pjrc-8051/defconfig b/nuttx/configs/pjrc-8051/defconfig index b41d74e315..43c2347a9f 100644 --- a/nuttx/configs/pjrc-8051/defconfig +++ b/nuttx/configs/pjrc-8051/defconfig @@ -215,4 +215,4 @@ CONFIG_HEAP_SIZE= CONFIG_MMCSD=y CONFIG_MMCSD_SPI=y -CONFIG_MMCSD_SDIO=y +CONFIG_MTD=y diff --git a/nuttx/configs/qemu-i486/nsh/defconfig b/nuttx/configs/qemu-i486/nsh/defconfig index 792157fe0e..09e252e0b9 100644 --- a/nuttx/configs/qemu-i486/nsh/defconfig +++ b/nuttx/configs/qemu-i486/nsh/defconfig @@ -316,4 +316,4 @@ CONFIG_HEAP_SIZE= CONFIG_MMCSD=y CONFIG_MMCSD_SPI=y -CONFIG_MMCSD_SDIO=y +CONFIG_MTD=y diff --git a/nuttx/configs/qemu-i486/ostest/defconfig b/nuttx/configs/qemu-i486/ostest/defconfig index b0036289a8..aeae97df1d 100644 --- a/nuttx/configs/qemu-i486/ostest/defconfig +++ b/nuttx/configs/qemu-i486/ostest/defconfig @@ -232,4 +232,4 @@ CONFIG_HEAP_SIZE= CONFIG_MMCSD=y CONFIG_MMCSD_SPI=y -CONFIG_MMCSD_SDIO=y +CONFIG_MTD=y diff --git a/nuttx/configs/rgmp/arm/default/defconfig b/nuttx/configs/rgmp/arm/default/defconfig index 0c40e8bd21..88843e365d 100644 --- a/nuttx/configs/rgmp/arm/default/defconfig +++ b/nuttx/configs/rgmp/arm/default/defconfig @@ -226,7 +226,7 @@ CONFIG_HEAP_SIZE= CONFIG_MMCSD=y CONFIG_MMCSD_SPI=y -CONFIG_MMCSD_SDIO=y +CONFIG_MTD=y ########################################## # RGMP specific configuration diff --git a/nuttx/configs/rgmp/arm/nsh/defconfig b/nuttx/configs/rgmp/arm/nsh/defconfig index 0ae14b1418..47c685aae4 100644 --- a/nuttx/configs/rgmp/arm/nsh/defconfig +++ b/nuttx/configs/rgmp/arm/nsh/defconfig @@ -227,7 +227,7 @@ CONFIG_HEAP_SIZE= CONFIG_MMCSD=y CONFIG_MMCSD_SPI=y -CONFIG_MMCSD_SDIO=y +CONFIG_MTD=y ########################################## # RGMP specific configuration diff --git a/nuttx/configs/rgmp/x86/cxxtest/defconfig b/nuttx/configs/rgmp/x86/cxxtest/defconfig index 1d2996557f..b1634e1e50 100644 --- a/nuttx/configs/rgmp/x86/cxxtest/defconfig +++ b/nuttx/configs/rgmp/x86/cxxtest/defconfig @@ -332,7 +332,7 @@ CONFIG_NET_RESOLV_ENTRIES=4 CONFIG_MMCSD=y CONFIG_MMCSD_SPI=y -CONFIG_MMCSD_SDIO=y +CONFIG_MTD=y # # Settings for examples/uip diff --git a/nuttx/configs/rgmp/x86/default/defconfig b/nuttx/configs/rgmp/x86/default/defconfig index 070ffcb30b..383e0ff5fd 100644 --- a/nuttx/configs/rgmp/x86/default/defconfig +++ b/nuttx/configs/rgmp/x86/default/defconfig @@ -187,7 +187,7 @@ CONFIG_NET_RESOLV_ENTRIES=4 CONFIG_MMCSD=y CONFIG_MMCSD_SPI=y -CONFIG_MMCSD_SDIO=y +CONFIG_MTD=y # # Settings for examples/uip diff --git a/nuttx/configs/rgmp/x86/helloxx/defconfig b/nuttx/configs/rgmp/x86/helloxx/defconfig index c8400560a9..1591952242 100644 --- a/nuttx/configs/rgmp/x86/helloxx/defconfig +++ b/nuttx/configs/rgmp/x86/helloxx/defconfig @@ -394,7 +394,7 @@ CONFIG_USER_ENTRYPOINT="helloxx_main" CONFIG_MMCSD=y CONFIG_MMCSD_SPI=y -CONFIG_MMCSD_SDIO=y +CONFIG_MTD=y # # uClibc++ Standard C++ Library diff --git a/nuttx/configs/rgmp/x86/nsh/defconfig b/nuttx/configs/rgmp/x86/nsh/defconfig index 891d58ba8f..6f10b234a2 100644 --- a/nuttx/configs/rgmp/x86/nsh/defconfig +++ b/nuttx/configs/rgmp/x86/nsh/defconfig @@ -236,7 +236,7 @@ CONFIG_HEAP_SIZE= CONFIG_MMCSD=y CONFIG_MMCSD_SPI=y -CONFIG_MMCSD_SDIO=y +CONFIG_MTD=y ########################################## # RGMP specific configuration diff --git a/nuttx/configs/sam3u-ek/knsh/defconfig b/nuttx/configs/sam3u-ek/knsh/defconfig index 30f60f0e32..709c3e7850 100755 --- a/nuttx/configs/sam3u-ek/knsh/defconfig +++ b/nuttx/configs/sam3u-ek/knsh/defconfig @@ -274,6 +274,7 @@ CONFIG_FS_ROMFS=n CONFIG_MMCSD=y CONFIG_MMCSD_SPI=y CONFIG_MMCSD_SDIO=y +CONFIG_MTD=y # # SPI-based MMC/SD driver diff --git a/nuttx/configs/sam3u-ek/nsh/defconfig b/nuttx/configs/sam3u-ek/nsh/defconfig index 9715984649..38520a9aae 100755 --- a/nuttx/configs/sam3u-ek/nsh/defconfig +++ b/nuttx/configs/sam3u-ek/nsh/defconfig @@ -249,6 +249,7 @@ CONFIG_FS_ROMFS=n CONFIG_MMCSD=y CONFIG_MMCSD_SPI=y CONFIG_MMCSD_SDIO=y +CONFIG_MTD=y # # SPI-based MMC/SD driver diff --git a/nuttx/configs/sam3u-ek/nx/defconfig b/nuttx/configs/sam3u-ek/nx/defconfig index dd55d9c932..a21a6570de 100755 --- a/nuttx/configs/sam3u-ek/nx/defconfig +++ b/nuttx/configs/sam3u-ek/nx/defconfig @@ -258,6 +258,7 @@ CONFIG_FS_ROMFS=n CONFIG_MMCSD=y CONFIG_MMCSD_SPI=y CONFIG_MMCSD_SDIO=y +CONFIG_MTD=y # # SPI-based MMC/SD driver diff --git a/nuttx/configs/sam3u-ek/ostest/defconfig b/nuttx/configs/sam3u-ek/ostest/defconfig index bf15cb1a59..5125f5ba91 100755 --- a/nuttx/configs/sam3u-ek/ostest/defconfig +++ b/nuttx/configs/sam3u-ek/ostest/defconfig @@ -250,6 +250,7 @@ CONFIG_FS_ROMFS=n CONFIG_MMCSD=y CONFIG_MMCSD_SPI=y CONFIG_MMCSD_SDIO=y +CONFIG_MTD=y # # SPI-based MMC/SD driver diff --git a/nuttx/configs/sam3u-ek/touchscreen/defconfig b/nuttx/configs/sam3u-ek/touchscreen/defconfig index 414eadb6eb..278c55478d 100755 --- a/nuttx/configs/sam3u-ek/touchscreen/defconfig +++ b/nuttx/configs/sam3u-ek/touchscreen/defconfig @@ -283,6 +283,7 @@ CONFIG_FS_ROMFS=n CONFIG_MMCSD=y CONFIG_MMCSD_SPI=y CONFIG_MMCSD_SDIO=y +CONFIG_MTD=y # # SPI-based MMC/SD driver diff --git a/nuttx/configs/sim/mount/defconfig b/nuttx/configs/sim/mount/defconfig index d5e108782c..7caa878525 100644 --- a/nuttx/configs/sim/mount/defconfig +++ b/nuttx/configs/sim/mount/defconfig @@ -223,11 +223,3 @@ CONFIG_PTHREAD_STACK_MIN=256 CONFIG_PTHREAD_STACK_DEFAULT=8192 CONFIG_HEAP_BASE= CONFIG_HEAP_SIZE= - -# -# Maintain legacy build behavior (revisit) -# - -CONFIG_MMCSD=y -CONFIG_MMCSD_SPI=y -CONFIG_MMCSD_SDIO=y diff --git a/nuttx/configs/sim/nettest/defconfig b/nuttx/configs/sim/nettest/defconfig index 1df980ea83..c216e2edc8 100644 --- a/nuttx/configs/sim/nettest/defconfig +++ b/nuttx/configs/sim/nettest/defconfig @@ -222,11 +222,3 @@ CONFIG_PTHREAD_STACK_MIN=256 CONFIG_PTHREAD_STACK_DEFAULT=8192 CONFIG_HEAP_BASE= CONFIG_HEAP_SIZE= - -# -# Maintain legacy build behavior (revisit) -# - -CONFIG_MMCSD=y -CONFIG_MMCSD_SPI=y -CONFIG_MMCSD_SDIO=y diff --git a/nuttx/configs/sim/nsh/defconfig b/nuttx/configs/sim/nsh/defconfig index 2d627a66de..794b3107df 100644 --- a/nuttx/configs/sim/nsh/defconfig +++ b/nuttx/configs/sim/nsh/defconfig @@ -267,11 +267,3 @@ CONFIG_PTHREAD_STACK_MIN=256 CONFIG_PTHREAD_STACK_DEFAULT=8192 CONFIG_HEAP_BASE= CONFIG_HEAP_SIZE= - -# -# Maintain legacy build behavior (revisit) -# - -CONFIG_MMCSD=y -CONFIG_MMCSD_SPI=y -CONFIG_MMCSD_SDIO=y diff --git a/nuttx/configs/sim/nsh2/defconfig b/nuttx/configs/sim/nsh2/defconfig index c9e5b343f0..b7e31b9e32 100644 --- a/nuttx/configs/sim/nsh2/defconfig +++ b/nuttx/configs/sim/nsh2/defconfig @@ -369,11 +369,3 @@ CONFIG_PTHREAD_STACK_MIN=256 CONFIG_PTHREAD_STACK_DEFAULT=8192 CONFIG_HEAP_BASE= CONFIG_HEAP_SIZE= - -# -# Maintain legacy build behavior (revisit) -# - -CONFIG_MMCSD=y -CONFIG_MMCSD_SPI=y -CONFIG_MMCSD_SDIO=y diff --git a/nuttx/configs/sim/nx/defconfig b/nuttx/configs/sim/nx/defconfig index 714d5dbb6a..0fddca0966 100644 --- a/nuttx/configs/sim/nx/defconfig +++ b/nuttx/configs/sim/nx/defconfig @@ -323,11 +323,3 @@ CONFIG_PTHREAD_STACK_MIN=256 CONFIG_PTHREAD_STACK_DEFAULT=8192 CONFIG_HEAP_BASE= CONFIG_HEAP_SIZE= - -# -# Maintain legacy build behavior (revisit) -# - -CONFIG_MMCSD=y -CONFIG_MMCSD_SPI=y -CONFIG_MMCSD_SDIO=y diff --git a/nuttx/configs/sim/nxffs/defconfig b/nuttx/configs/sim/nxffs/defconfig index c8aadee257..79f5b0f93a 100644 --- a/nuttx/configs/sim/nxffs/defconfig +++ b/nuttx/configs/sim/nxffs/defconfig @@ -232,11 +232,3 @@ CONFIG_PTHREAD_STACK_MIN=256 CONFIG_PTHREAD_STACK_DEFAULT=8192 CONFIG_HEAP_BASE= CONFIG_HEAP_SIZE= - -# -# Maintain legacy build behavior (revisit) -# - -CONFIG_MMCSD=y -CONFIG_MMCSD_SPI=y -CONFIG_MMCSD_SDIO=y diff --git a/nuttx/configs/sim/pashello/defconfig b/nuttx/configs/sim/pashello/defconfig index fedf401d85..b40ec626ec 100644 --- a/nuttx/configs/sim/pashello/defconfig +++ b/nuttx/configs/sim/pashello/defconfig @@ -211,11 +211,3 @@ CONFIG_PTHREAD_STACK_MIN=256 CONFIG_PTHREAD_STACK_DEFAULT=8192 CONFIG_HEAP_BASE= CONFIG_HEAP_SIZE= - -# -# Maintain legacy build behavior (revisit) -# - -CONFIG_MMCSD=y -CONFIG_MMCSD_SPI=y -CONFIG_MMCSD_SDIO=y diff --git a/nuttx/configs/sim/touchscreen/defconfig b/nuttx/configs/sim/touchscreen/defconfig index df2a0553c8..6a2e3e304d 100644 --- a/nuttx/configs/sim/touchscreen/defconfig +++ b/nuttx/configs/sim/touchscreen/defconfig @@ -318,11 +318,3 @@ CONFIG_PTHREAD_STACK_MIN=256 CONFIG_PTHREAD_STACK_DEFAULT=8192 CONFIG_HEAP_BASE= CONFIG_HEAP_SIZE= - -# -# Maintain legacy build behavior (revisit) -# - -CONFIG_MMCSD=y -CONFIG_MMCSD_SPI=y -CONFIG_MMCSD_SDIO=y diff --git a/nuttx/configs/skp16c26/ostest/defconfig b/nuttx/configs/skp16c26/ostest/defconfig index cf93d5b10a..40ff5b3a14 100644 --- a/nuttx/configs/skp16c26/ostest/defconfig +++ b/nuttx/configs/skp16c26/ostest/defconfig @@ -324,4 +324,5 @@ CONFIG_HEAP_SIZE= CONFIG_MMCSD=y CONFIG_MMCSD_SPI=y -CONFIG_MMCSD_SDIO=y +CONFIG_MTD=y + diff --git a/nuttx/configs/stm3210e-eval/RIDE/defconfig b/nuttx/configs/stm3210e-eval/RIDE/defconfig index 6d84e7c362..662537a9d7 100755 --- a/nuttx/configs/stm3210e-eval/RIDE/defconfig +++ b/nuttx/configs/stm3210e-eval/RIDE/defconfig @@ -282,6 +282,7 @@ CONFIG_FS_ROMFS=n CONFIG_MMCSD=y CONFIG_MMCSD_SPI=y CONFIG_MMCSD_SDIO=y +CONFIG_MTD=y # # SPI-based MMC/SD driver diff --git a/nuttx/configs/stm3210e-eval/buttons/defconfig b/nuttx/configs/stm3210e-eval/buttons/defconfig index 37e19171fe..3c8fca2227 100644 --- a/nuttx/configs/stm3210e-eval/buttons/defconfig +++ b/nuttx/configs/stm3210e-eval/buttons/defconfig @@ -293,6 +293,7 @@ CONFIG_FS_ROMFS=n CONFIG_MMCSD=y CONFIG_MMCSD_SPI=y CONFIG_MMCSD_SDIO=y +CONFIG_MTD=y # # SPI-based MMC/SD driver diff --git a/nuttx/configs/stm3210e-eval/composite/defconfig b/nuttx/configs/stm3210e-eval/composite/defconfig index 7fee337943..b5c39f9288 100755 --- a/nuttx/configs/stm3210e-eval/composite/defconfig +++ b/nuttx/configs/stm3210e-eval/composite/defconfig @@ -299,6 +299,7 @@ CONFIG_FS_ROMFS=n CONFIG_MMCSD=y CONFIG_MMCSD_SPI=y CONFIG_MMCSD_SDIO=y +CONFIG_MTD=y # # SPI-based MMC/SD driver diff --git a/nuttx/configs/stm3210e-eval/nsh/defconfig b/nuttx/configs/stm3210e-eval/nsh/defconfig index b5e52e4944..12ebc34c22 100755 --- a/nuttx/configs/stm3210e-eval/nsh/defconfig +++ b/nuttx/configs/stm3210e-eval/nsh/defconfig @@ -290,6 +290,7 @@ CONFIG_FS_ROMFS=n CONFIG_MMCSD=y CONFIG_MMCSD_SPI=y CONFIG_MMCSD_SDIO=y +CONFIG_MTD=y # # SPI-based MMC/SD driver diff --git a/nuttx/configs/stm3210e-eval/nsh2/defconfig b/nuttx/configs/stm3210e-eval/nsh2/defconfig index 30a0bb3276..063307143b 100644 --- a/nuttx/configs/stm3210e-eval/nsh2/defconfig +++ b/nuttx/configs/stm3210e-eval/nsh2/defconfig @@ -355,6 +355,7 @@ CONFIG_FS_ROMFS=n CONFIG_MMCSD=y CONFIG_MMCSD_SPI=y CONFIG_MMCSD_SDIO=y +CONFIG_MTD=y # # SPI-based MMC/SD driver diff --git a/nuttx/configs/stm3210e-eval/nx/defconfig b/nuttx/configs/stm3210e-eval/nx/defconfig index 0ad42dfbe5..bff0316177 100644 --- a/nuttx/configs/stm3210e-eval/nx/defconfig +++ b/nuttx/configs/stm3210e-eval/nx/defconfig @@ -307,6 +307,7 @@ CONFIG_FS_ROMFS=n CONFIG_MMCSD=y CONFIG_MMCSD_SPI=y CONFIG_MMCSD_SDIO=y +CONFIG_MTD=y # # SPI-based MMC/SD driver diff --git a/nuttx/configs/stm3210e-eval/nxconsole/defconfig b/nuttx/configs/stm3210e-eval/nxconsole/defconfig index 7dd5878bf4..94dbf500f2 100644 --- a/nuttx/configs/stm3210e-eval/nxconsole/defconfig +++ b/nuttx/configs/stm3210e-eval/nxconsole/defconfig @@ -308,6 +308,7 @@ CONFIG_FS_ROMFS=n CONFIG_MMCSD=y CONFIG_MMCSD_SPI=y CONFIG_MMCSD_SDIO=y +CONFIG_MTD=y # # SPI-based MMC/SD driver diff --git a/nuttx/configs/stm3210e-eval/nxlines/defconfig b/nuttx/configs/stm3210e-eval/nxlines/defconfig index 068a17acb4..760b3a6e1e 100644 --- a/nuttx/configs/stm3210e-eval/nxlines/defconfig +++ b/nuttx/configs/stm3210e-eval/nxlines/defconfig @@ -307,6 +307,7 @@ CONFIG_FS_ROMFS=n CONFIG_MMCSD=y CONFIG_MMCSD_SPI=y CONFIG_MMCSD_SDIO=y +CONFIG_MTD=y # # SPI-based MMC/SD driver diff --git a/nuttx/configs/stm3210e-eval/nxtext/defconfig b/nuttx/configs/stm3210e-eval/nxtext/defconfig index b6f88a3cac..d8b1fbe1ef 100644 --- a/nuttx/configs/stm3210e-eval/nxtext/defconfig +++ b/nuttx/configs/stm3210e-eval/nxtext/defconfig @@ -307,6 +307,7 @@ CONFIG_FS_ROMFS=n CONFIG_MMCSD=y CONFIG_MMCSD_SPI=y CONFIG_MMCSD_SDIO=y +CONFIG_MTD=y # # SPI-based MMC/SD driver diff --git a/nuttx/configs/stm3210e-eval/ostest/defconfig b/nuttx/configs/stm3210e-eval/ostest/defconfig index 0553b1a984..eb14399ea0 100755 --- a/nuttx/configs/stm3210e-eval/ostest/defconfig +++ b/nuttx/configs/stm3210e-eval/ostest/defconfig @@ -302,6 +302,7 @@ CONFIG_FS_ROMFS=n CONFIG_MMCSD=y CONFIG_MMCSD_SPI=y CONFIG_MMCSD_SDIO=y +CONFIG_MTD=y # # SPI-based MMC/SD driver diff --git a/nuttx/configs/stm3210e-eval/pm/defconfig b/nuttx/configs/stm3210e-eval/pm/defconfig index 61bd995c8b..c113ddf60b 100644 --- a/nuttx/configs/stm3210e-eval/pm/defconfig +++ b/nuttx/configs/stm3210e-eval/pm/defconfig @@ -386,6 +386,7 @@ CONFIG_FS_ROMFS=n CONFIG_MMCSD=y CONFIG_MMCSD_SPI=y CONFIG_MMCSD_SDIO=y +CONFIG_MTD=y # # SPI-based MMC/SD driver diff --git a/nuttx/configs/stm3210e-eval/usbserial/defconfig b/nuttx/configs/stm3210e-eval/usbserial/defconfig index 94059c07c3..c1f935e965 100755 --- a/nuttx/configs/stm3210e-eval/usbserial/defconfig +++ b/nuttx/configs/stm3210e-eval/usbserial/defconfig @@ -292,6 +292,7 @@ CONFIG_FS_ROMFS=n CONFIG_MMCSD=y CONFIG_MMCSD_SPI=y CONFIG_MMCSD_SDIO=y +CONFIG_MTD=y # # SPI-based MMC/SD driver diff --git a/nuttx/configs/stm3210e-eval/usbstorage/defconfig b/nuttx/configs/stm3210e-eval/usbstorage/defconfig index 5c1ed5fb29..3e71193532 100755 --- a/nuttx/configs/stm3210e-eval/usbstorage/defconfig +++ b/nuttx/configs/stm3210e-eval/usbstorage/defconfig @@ -299,6 +299,7 @@ CONFIG_FS_ROMFS=n CONFIG_MMCSD=y CONFIG_MMCSD_SPI=y CONFIG_MMCSD_SDIO=y +CONFIG_MTD=y # # SPI-based MMC/SD driver diff --git a/nuttx/configs/stm3220g-eval/dhcpd/defconfig b/nuttx/configs/stm3220g-eval/dhcpd/defconfig index 29baf9af06..627136ebba 100644 --- a/nuttx/configs/stm3220g-eval/dhcpd/defconfig +++ b/nuttx/configs/stm3220g-eval/dhcpd/defconfig @@ -363,6 +363,7 @@ CONFIG_FS_ROMFS=n CONFIG_MMCSD=y CONFIG_MMCSD_SPI=y CONFIG_MMCSD_SDIO=y +CONFIG_MTD=y # # SPI-based MMC/SD driver diff --git a/nuttx/configs/stm3220g-eval/nettest/defconfig b/nuttx/configs/stm3220g-eval/nettest/defconfig index 08e04ad0ed..39c1bb8edf 100644 --- a/nuttx/configs/stm3220g-eval/nettest/defconfig +++ b/nuttx/configs/stm3220g-eval/nettest/defconfig @@ -363,6 +363,7 @@ CONFIG_FS_ROMFS=n CONFIG_MMCSD=y CONFIG_MMCSD_SPI=y CONFIG_MMCSD_SDIO=y +CONFIG_MTD=y # # SPI-based MMC/SD driver diff --git a/nuttx/configs/stm3220g-eval/nsh/defconfig b/nuttx/configs/stm3220g-eval/nsh/defconfig index bd9d028605..8486c4fd6f 100644 --- a/nuttx/configs/stm3220g-eval/nsh/defconfig +++ b/nuttx/configs/stm3220g-eval/nsh/defconfig @@ -409,6 +409,7 @@ CONFIG_FS_ROMFS=n CONFIG_MMCSD=y CONFIG_MMCSD_SPI=y CONFIG_MMCSD_SDIO=y +CONFIG_MTD=y # # SPI-based MMC/SD driver diff --git a/nuttx/configs/stm3220g-eval/nsh2/defconfig b/nuttx/configs/stm3220g-eval/nsh2/defconfig index b5fe843bca..bc641b8be6 100644 --- a/nuttx/configs/stm3220g-eval/nsh2/defconfig +++ b/nuttx/configs/stm3220g-eval/nsh2/defconfig @@ -408,6 +408,7 @@ CONFIG_FS_ROMFS=n CONFIG_MMCSD=y CONFIG_MMCSD_SPI=y CONFIG_MMCSD_SDIO=y +CONFIG_MTD=y # # SPI-based MMC/SD driver diff --git a/nuttx/configs/stm3220g-eval/ostest/defconfig b/nuttx/configs/stm3220g-eval/ostest/defconfig index f63f96c9af..3ec4175161 100644 --- a/nuttx/configs/stm3220g-eval/ostest/defconfig +++ b/nuttx/configs/stm3220g-eval/ostest/defconfig @@ -353,6 +353,7 @@ CONFIG_FS_ROMFS=n CONFIG_MMCSD=y CONFIG_MMCSD_SPI=y CONFIG_MMCSD_SDIO=y +CONFIG_MTD=y # # SPI-based MMC/SD driver diff --git a/nuttx/configs/stm3220g-eval/telnetd/defconfig b/nuttx/configs/stm3220g-eval/telnetd/defconfig index f529198f17..b89e7d4f77 100644 --- a/nuttx/configs/stm3220g-eval/telnetd/defconfig +++ b/nuttx/configs/stm3220g-eval/telnetd/defconfig @@ -363,6 +363,7 @@ CONFIG_FS_ROMFS=n CONFIG_MMCSD=y CONFIG_MMCSD_SPI=y CONFIG_MMCSD_SDIO=y +CONFIG_MTD=y # # SPI-based MMC/SD driver diff --git a/nuttx/configs/stm3240g-eval/dhcpd/defconfig b/nuttx/configs/stm3240g-eval/dhcpd/defconfig index 5199cf85c3..91682111bf 100644 --- a/nuttx/configs/stm3240g-eval/dhcpd/defconfig +++ b/nuttx/configs/stm3240g-eval/dhcpd/defconfig @@ -369,6 +369,7 @@ CONFIG_FS_ROMFS=n CONFIG_MMCSD=y CONFIG_MMCSD_SPI=y CONFIG_MMCSD_SDIO=y +CONFIG_MTD=y # # SPI-based MMC/SD driver diff --git a/nuttx/configs/stm3240g-eval/nettest/defconfig b/nuttx/configs/stm3240g-eval/nettest/defconfig index c5e0da795a..257a4d2520 100644 --- a/nuttx/configs/stm3240g-eval/nettest/defconfig +++ b/nuttx/configs/stm3240g-eval/nettest/defconfig @@ -369,6 +369,7 @@ CONFIG_FS_ROMFS=n CONFIG_MMCSD=y CONFIG_MMCSD_SPI=y CONFIG_MMCSD_SDIO=y +CONFIG_MTD=y # # SPI-based MMC/SD driver diff --git a/nuttx/configs/stm3240g-eval/nsh/defconfig b/nuttx/configs/stm3240g-eval/nsh/defconfig index 6c19ed531d..82caf16226 100644 --- a/nuttx/configs/stm3240g-eval/nsh/defconfig +++ b/nuttx/configs/stm3240g-eval/nsh/defconfig @@ -414,6 +414,7 @@ CONFIG_FS_ROMFS=n CONFIG_MMCSD=y CONFIG_MMCSD_SPI=y CONFIG_MMCSD_SDIO=y +CONFIG_MTD=y # # SPI-based MMC/SD driver diff --git a/nuttx/configs/stm3240g-eval/nsh2/defconfig b/nuttx/configs/stm3240g-eval/nsh2/defconfig index 08690ade3f..9e7d57adee 100644 --- a/nuttx/configs/stm3240g-eval/nsh2/defconfig +++ b/nuttx/configs/stm3240g-eval/nsh2/defconfig @@ -414,6 +414,7 @@ CONFIG_FS_ROMFS=n CONFIG_MMCSD=y CONFIG_MMCSD_SPI=y CONFIG_MMCSD_SDIO=y +CONFIG_MTD=y # # SPI-based MMC/SD driver diff --git a/nuttx/configs/stm3240g-eval/nxconsole/defconfig b/nuttx/configs/stm3240g-eval/nxconsole/defconfig index 202fa4378c..92c3ceb75e 100644 --- a/nuttx/configs/stm3240g-eval/nxconsole/defconfig +++ b/nuttx/configs/stm3240g-eval/nxconsole/defconfig @@ -413,6 +413,7 @@ CONFIG_FS_ROMFS=n CONFIG_MMCSD=y CONFIG_MMCSD_SPI=y CONFIG_MMCSD_SDIO=y +CONFIG_MTD=y # # SPI-based MMC/SD driver diff --git a/nuttx/configs/stm3240g-eval/nxwm/defconfig b/nuttx/configs/stm3240g-eval/nxwm/defconfig index a220af2d1c..34eaa9ec6d 100644 --- a/nuttx/configs/stm3240g-eval/nxwm/defconfig +++ b/nuttx/configs/stm3240g-eval/nxwm/defconfig @@ -415,6 +415,7 @@ CONFIG_FS_ROMFS=n CONFIG_MMCSD=y CONFIG_MMCSD_SPI=y CONFIG_MMCSD_SDIO=y +CONFIG_MTD=y # # SPI-based MMC/SD driver diff --git a/nuttx/configs/stm3240g-eval/ostest/defconfig b/nuttx/configs/stm3240g-eval/ostest/defconfig index fcc54aa4bd..f9e690a103 100644 --- a/nuttx/configs/stm3240g-eval/ostest/defconfig +++ b/nuttx/configs/stm3240g-eval/ostest/defconfig @@ -358,6 +358,7 @@ CONFIG_FS_ROMFS=n CONFIG_MMCSD=y CONFIG_MMCSD_SPI=y CONFIG_MMCSD_SDIO=y +CONFIG_MTD=y # # SPI-based MMC/SD driver diff --git a/nuttx/configs/stm3240g-eval/telnetd/defconfig b/nuttx/configs/stm3240g-eval/telnetd/defconfig index 5aef41c27b..ec04476b77 100644 --- a/nuttx/configs/stm3240g-eval/telnetd/defconfig +++ b/nuttx/configs/stm3240g-eval/telnetd/defconfig @@ -369,6 +369,7 @@ CONFIG_FS_ROMFS=n CONFIG_MMCSD=y CONFIG_MMCSD_SPI=y CONFIG_MMCSD_SDIO=y +CONFIG_MTD=y # # SPI-based MMC/SD driver diff --git a/nuttx/configs/stm3240g-eval/webserver/defconfig b/nuttx/configs/stm3240g-eval/webserver/defconfig index 6d09968e9f..792eafa0a1 100644 --- a/nuttx/configs/stm3240g-eval/webserver/defconfig +++ b/nuttx/configs/stm3240g-eval/webserver/defconfig @@ -414,6 +414,7 @@ CONFIG_FS_ROMFS=n CONFIG_MMCSD=y CONFIG_MMCSD_SPI=y CONFIG_MMCSD_SDIO=y +CONFIG_MTD=y # # SPI-based MMC/SD driver diff --git a/nuttx/configs/stm32f4discovery/nsh/defconfig b/nuttx/configs/stm32f4discovery/nsh/defconfig index 98034e22eb..d9917b3a85 100644 --- a/nuttx/configs/stm32f4discovery/nsh/defconfig +++ b/nuttx/configs/stm32f4discovery/nsh/defconfig @@ -376,14 +376,6 @@ CONFIG_FAT_MAXFNAME=32 CONFIG_FS_NXFFS=n CONFIG_FS_ROMFS=n -# -# Maintain legacy build behavior (revisit) -# - -CONFIG_MMCSD=y -CONFIG_MMCSD_SPI=y -CONFIG_MMCSD_SDIO=y - # # SPI-based MMC/SD driver # diff --git a/nuttx/configs/stm32f4discovery/pm/defconfig b/nuttx/configs/stm32f4discovery/pm/defconfig index 3e24168cde..1636f6ecb0 100644 --- a/nuttx/configs/stm32f4discovery/pm/defconfig +++ b/nuttx/configs/stm32f4discovery/pm/defconfig @@ -395,14 +395,6 @@ CONFIG_FAT_MAXFNAME=32 CONFIG_FS_NXFFS=n CONFIG_FS_ROMFS=n -# -# Maintain legacy build behavior (revisit) -# - -CONFIG_MMCSD=y -CONFIG_MMCSD_SPI=y -CONFIG_MMCSD_SDIO=y - # # SPI-based MMC/SD driver # diff --git a/nuttx/configs/sure-pic32mx/nsh/defconfig b/nuttx/configs/sure-pic32mx/nsh/defconfig index 07b31a1aea..d15bac1f45 100644 --- a/nuttx/configs/sure-pic32mx/nsh/defconfig +++ b/nuttx/configs/sure-pic32mx/nsh/defconfig @@ -285,7 +285,7 @@ CONFIG_FS_ROMFS=n CONFIG_MMCSD=y CONFIG_MMCSD_SPI=y -CONFIG_MMCSD_SDIO=y +CONFIG_MTD=y # # SPI-based MMC/SD driver diff --git a/nuttx/configs/sure-pic32mx/ostest/defconfig b/nuttx/configs/sure-pic32mx/ostest/defconfig index 86bb3b3073..a04f2171aa 100644 --- a/nuttx/configs/sure-pic32mx/ostest/defconfig +++ b/nuttx/configs/sure-pic32mx/ostest/defconfig @@ -264,7 +264,7 @@ CONFIG_FS_ROMFS=n CONFIG_MMCSD=y CONFIG_MMCSD_SPI=y -CONFIG_MMCSD_SDIO=y +CONFIG_MTD=y # # SPI-based MMC/SD driver diff --git a/nuttx/configs/sure-pic32mx/usbnsh/defconfig b/nuttx/configs/sure-pic32mx/usbnsh/defconfig index 9f6046f216..3ebfde8343 100644 --- a/nuttx/configs/sure-pic32mx/usbnsh/defconfig +++ b/nuttx/configs/sure-pic32mx/usbnsh/defconfig @@ -282,7 +282,7 @@ CONFIG_FS_ROMFS=n CONFIG_MMCSD=y CONFIG_MMCSD_SPI=y -CONFIG_MMCSD_SDIO=y +CONFIG_MTD=y # # SPI-based MMC/SD driver diff --git a/nuttx/configs/teensy/hello/defconfig b/nuttx/configs/teensy/hello/defconfig index 8fafe1a104..cc2b6c9c1a 100644 --- a/nuttx/configs/teensy/hello/defconfig +++ b/nuttx/configs/teensy/hello/defconfig @@ -221,7 +221,7 @@ CONFIG_FS_ROMFS=n CONFIG_MMCSD=y CONFIG_MMCSD_SPI=y -CONFIG_MMCSD_SDIO=y +CONFIG_MTD=y # # SPI-based MMC/SD driver diff --git a/nuttx/configs/teensy/nsh/defconfig b/nuttx/configs/teensy/nsh/defconfig index faeb0b1030..0cc8777315 100755 --- a/nuttx/configs/teensy/nsh/defconfig +++ b/nuttx/configs/teensy/nsh/defconfig @@ -221,7 +221,7 @@ CONFIG_FS_ROMFS=n CONFIG_MMCSD=y CONFIG_MMCSD_SPI=y -CONFIG_MMCSD_SDIO=y +CONFIG_MTD=y # # SPI-based MMC/SD driver diff --git a/nuttx/configs/teensy/usbstorage/defconfig b/nuttx/configs/teensy/usbstorage/defconfig index 1f01868976..590a6f8bbe 100755 --- a/nuttx/configs/teensy/usbstorage/defconfig +++ b/nuttx/configs/teensy/usbstorage/defconfig @@ -222,7 +222,7 @@ CONFIG_FS_ROMFS=n CONFIG_MMCSD=y CONFIG_MMCSD_SPI=y -CONFIG_MMCSD_SDIO=y +CONFIG_MTD=y # # SPI-based MMC/SD driver diff --git a/nuttx/configs/twr-k60n512/nsh/defconfig b/nuttx/configs/twr-k60n512/nsh/defconfig index 3f272b55a2..959379bea2 100644 --- a/nuttx/configs/twr-k60n512/nsh/defconfig +++ b/nuttx/configs/twr-k60n512/nsh/defconfig @@ -286,6 +286,7 @@ CONFIG_FS_ROMFS=n CONFIG_MMCSD=y CONFIG_MMCSD_SPI=y CONFIG_MMCSD_SDIO=y +CONFIG_MTD=y # # SPI-based MMC/SD driver diff --git a/nuttx/configs/twr-k60n512/ostest/defconfig b/nuttx/configs/twr-k60n512/ostest/defconfig index fd27ffc2bc..14d3435da5 100644 --- a/nuttx/configs/twr-k60n512/ostest/defconfig +++ b/nuttx/configs/twr-k60n512/ostest/defconfig @@ -285,6 +285,7 @@ CONFIG_FS_ROMFS=n CONFIG_MMCSD=y CONFIG_MMCSD_SPI=y CONFIG_MMCSD_SDIO=y +CONFIG_MTD=y # # SPI-based MMC/SD driver diff --git a/nuttx/configs/ubw32/nsh/defconfig b/nuttx/configs/ubw32/nsh/defconfig index 89afd59129..8769fa677c 100644 --- a/nuttx/configs/ubw32/nsh/defconfig +++ b/nuttx/configs/ubw32/nsh/defconfig @@ -272,7 +272,7 @@ CONFIG_FS_ROMFS=n CONFIG_MMCSD=y CONFIG_MMCSD_SPI=y -CONFIG_MMCSD_SDIO=y +CONFIG_MTD=y # # SPI-based MMC/SD driver diff --git a/nuttx/configs/us7032evb1/nsh/defconfig b/nuttx/configs/us7032evb1/nsh/defconfig index 2405dc2d3b..5bf0bd71d6 100644 --- a/nuttx/configs/us7032evb1/nsh/defconfig +++ b/nuttx/configs/us7032evb1/nsh/defconfig @@ -197,7 +197,7 @@ CONFIG_FS_ROMFS=n CONFIG_MMCSD=y CONFIG_MMCSD_SPI=y -CONFIG_MMCSD_SDIO=y +CONFIG_MTD=y # # SPI-based MMC/SD driver diff --git a/nuttx/configs/us7032evb1/ostest/defconfig b/nuttx/configs/us7032evb1/ostest/defconfig index e910f112f2..5b40baf88c 100644 --- a/nuttx/configs/us7032evb1/ostest/defconfig +++ b/nuttx/configs/us7032evb1/ostest/defconfig @@ -197,7 +197,7 @@ CONFIG_FS_ROMFS=n CONFIG_MMCSD=y CONFIG_MMCSD_SPI=y -CONFIG_MMCSD_SDIO=y +CONFIG_MTD=y # # SPI-based MMC/SD driver diff --git a/nuttx/configs/vsn/nsh/defconfig b/nuttx/configs/vsn/nsh/defconfig index 2b7d8a20cd..5952f47240 100755 --- a/nuttx/configs/vsn/nsh/defconfig +++ b/nuttx/configs/vsn/nsh/defconfig @@ -333,6 +333,7 @@ CONFIG_I2C_SLAVE=n CONFIG_MMCSD=y CONFIG_MMCSD_SPI=y CONFIG_MMCSD_SDIO=y +CONFIG_MTD=y # # SPI-based MMC/SD driver diff --git a/nuttx/drivers/mtd/Make.defs b/nuttx/drivers/mtd/Make.defs index 7db7592d4e..3102f1447d 100644 --- a/nuttx/drivers/mtd/Make.defs +++ b/nuttx/drivers/mtd/Make.defs @@ -37,6 +37,8 @@ # Include MTD drivers +ifeq ($(CONFIG_MTD),y) + CSRCS += at45db.c flash_eraseall.c ftl.c m25px.c rammtd.c ramtron.c ifeq ($(CONFIG_MTD_AT24XX),y) @@ -60,3 +62,4 @@ endif DEPPATH += --dep-path mtd VPATH += :mtd +endif From 90a72e97d3f18a5e230578c63113da119622a73a Mon Sep 17 00:00:00 2001 From: patacongo Date: Tue, 15 Jan 2013 15:40:18 +0000 Subject: [PATCH 073/118] Implement vfork() for the MIPS32 architecture git-svn-id: http://svn.code.sf.net/p/nuttx/code/trunk@5520 42af7a65-404d-4744-a932-0658087f49c3 --- nuttx/ChangeLog | 3 + nuttx/Documentation/NuttX.html | 4 +- nuttx/TODO | 21 ++- nuttx/arch/arm/src/arm/vfork.S | 3 + nuttx/arch/arm/src/armv7-m/vfork.S | 3 + nuttx/arch/arm/src/common/up_vfork.c | 2 +- nuttx/arch/arm/src/common/up_vfork.h | 8 +- nuttx/arch/mips/Kconfig | 1 + nuttx/arch/mips/src/mips32/Kconfig | 8 + nuttx/arch/mips/src/mips32/up_vfork.c | 254 ++++++++++++++++++++++++++ nuttx/arch/mips/src/mips32/up_vfork.h | 132 +++++++++++++ nuttx/arch/mips/src/mips32/vfork.S | 154 ++++++++++++++++ nuttx/arch/mips/src/pic32mx/Make.defs | 4 +- nuttx/configs/ubw32/ostest/defconfig | 9 +- nuttx/sched/task_vfork.c | 8 +- 15 files changed, 599 insertions(+), 15 deletions(-) create mode 100644 nuttx/arch/mips/src/mips32/up_vfork.c create mode 100644 nuttx/arch/mips/src/mips32/up_vfork.h create mode 100644 nuttx/arch/mips/src/mips32/vfork.S diff --git a/nuttx/ChangeLog b/nuttx/ChangeLog index 41ac95db00..2d2cd82591 100644 --- a/nuttx/ChangeLog +++ b/nuttx/ChangeLog @@ -3952,4 +3952,7 @@ scripts sub-directory * configs/ubw32/ostest: Configuration configured to use the kconfig-frontends tools. + * arch/mips/src/mips32/up_vfork.c, up_vfork.h, and vfork.S: + Implement vfork() for MIPS32 (no floating point support) + * configs/ubw32/ostest: Enable the vfork() test. diff --git a/nuttx/Documentation/NuttX.html b/nuttx/Documentation/NuttX.html index 22651de79e..c5f1ebc9c2 100644 --- a/nuttx/Documentation/NuttX.html +++ b/nuttx/Documentation/NuttX.html @@ -381,7 +381,7 @@

          -

        • Well documented in the NuttX User Guide.
        • +
        • Well documented in the NuttX User Guide.
        • @@ -3833,7 +3833,7 @@ pascal-3.0 2011-05-15 Gregory Nutt <gnutt@nuttx.org> - User Guide + User Guide diff --git a/nuttx/TODO b/nuttx/TODO index 0d02e10e6c..58ca4cc8e4 100644 --- a/nuttx/TODO +++ b/nuttx/TODO @@ -6,7 +6,7 @@ standards, things that could be improved, and ideas for enhancements. nuttx/ - (10) Task/Scheduler (sched/) + (11) Task/Scheduler (sched/) (1) Memory Managment (mm/) (3) Signals (sched/, arch/) (2) pthreads (sched/) @@ -195,6 +195,25 @@ o Task/Scheduler (sched/) Status: Open Priority: Low + Title: IMPROVED TASK CONTROL BLOCK STRUCTURE + All task resources that are shared amongst threads have + their own "break-away", reference-counted structure. The + Task Control Block (TCB) of each thread holds a reference + to each breakaway structure (see include/nuttx/sched.h). + It would be more efficent to have one reference counted + structure that holds all of the shared resources. + + These are the current shared structures: + - Environment varaibles (struct environ_s) + - PIC data space and address environments (struct dspace_s) + - File descriptors (struct filelist) + - FILE streams (struct streamlist) + - Sockets (struct socketlist) + Status: Open + Priority: Low. This is an enhancement. It would slight reduce + memory usage but would also increase coupling. These + resources are nicely modular now. + o Memory Managment (mm/) ^^^^^^^^^^^^^^^^^^^^^^ diff --git a/nuttx/arch/arm/src/arm/vfork.S b/nuttx/arch/arm/src/arm/vfork.S index 226d9f7de4..7c3c8b7274 100644 --- a/nuttx/arch/arm/src/arm/vfork.S +++ b/nuttx/arch/arm/src/arm/vfork.S @@ -105,6 +105,7 @@ vfork: mov r0, sp /* Save the value of the stack on entry */ sub sp, sp, #VFORK_SIZEOF /* Allocate the structure on the stack */ + /* CPU registers */ /* Save the volatile registers */ str r4, [sp, #VFORK_R4_OFFSET] @@ -121,6 +122,8 @@ vfork: str r0, [sp, #VFORK_SP_OFFSET] str lr, [sp, #VFORK_LR_OFFSET] + /* Floating point registers (not yet) */ + /* Then, call up_vfork(), passing it a pointer to the stack structure */ mov r0, sp diff --git a/nuttx/arch/arm/src/armv7-m/vfork.S b/nuttx/arch/arm/src/armv7-m/vfork.S index 386fca33c4..f36ff23aa7 100644 --- a/nuttx/arch/arm/src/armv7-m/vfork.S +++ b/nuttx/arch/arm/src/armv7-m/vfork.S @@ -108,6 +108,7 @@ vfork: mov r0, sp /* Save the value of the stack on entry */ sub sp, sp, #VFORK_SIZEOF /* Allocate the structure on the stack */ + /* CPU registers */ /* Save the volatile registers */ str r4, [sp, #VFORK_R4_OFFSET] @@ -124,6 +125,8 @@ vfork: str r0, [sp, #VFORK_SP_OFFSET] str lr, [sp, #VFORK_LR_OFFSET] + /* Floating point registers (not yet) */ + /* Then, call up_vfork(), passing it a pointer to the stack structure */ mov r0, sp diff --git a/nuttx/arch/arm/src/common/up_vfork.c b/nuttx/arch/arm/src/common/up_vfork.c index 5349378bc4..3b653e3170 100644 --- a/nuttx/arch/arm/src/common/up_vfork.c +++ b/nuttx/arch/arm/src/common/up_vfork.c @@ -208,7 +208,7 @@ pid_t up_vfork(const struct vfork_s *context) svdbg("New stack base:%08x SP:%08x FP:%08x\n", child->adj_stack_ptr, newsp, newfp); - /* Update the stack pointer, frame pointer, and voltile registers. When + /* Update the stack pointer, frame pointer, and volatile registers. When * the child TCB was initialized, all of the values were set to zero. * up_initial_state() altered a few values, but the return value in R0 * should be cleared to zero, providing the indication to the newly started diff --git a/nuttx/arch/arm/src/common/up_vfork.h b/nuttx/arch/arm/src/common/up_vfork.h index a4505474a3..97edf9aaa5 100644 --- a/nuttx/arch/arm/src/common/up_vfork.h +++ b/nuttx/arch/arm/src/common/up_vfork.h @@ -1,5 +1,5 @@ /**************************************************************************** - * arch/arm/src/common/arm-vfork.h + * arch/arm/src/common/up_vfork.h * * Copyright (C) 2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -53,6 +53,7 @@ #define VFORK_R8_OFFSET (4*4) /* Volatile register r8 */ #define VFORK_R9_OFFSET (5*4) /* Volatile register r9 */ #define VFORK_R10_OFFSET (6*4) /* Volatile register r10 */ + #define VFORK_FP_OFFSET (7*4) /* Frame pointer */ #define VFORK_SP_OFFSET (8*4) /* Stack pointer*/ #define VFORK_LR_OFFSET (9*4) /* Return address*/ @@ -66,6 +67,8 @@ #ifndef __ASSEMBLY__ struct vfork_s { + /* CPU registers */ + uint32_t r4; /* Volatile register r4 */ uint32_t r5; /* Volatile register r5 */ uint32_t r6; /* Volatile register r6 */ @@ -73,9 +76,12 @@ struct vfork_s uint32_t r8; /* Volatile register r8 */ uint32_t r9; /* Volatile register r9 */ uint32_t r10; /* Volatile register r10 */ + uint32_t fp; /* Frame pointer */ uint32_t sp; /* Stack pointer*/ uint32_t lr; /* Return address*/ + + /* Floating point registers (not yet) */ }; #endif diff --git a/nuttx/arch/mips/Kconfig b/nuttx/arch/mips/Kconfig index 1b10e26aee..86482ef7ae 100644 --- a/nuttx/arch/mips/Kconfig +++ b/nuttx/arch/mips/Kconfig @@ -22,6 +22,7 @@ endchoice config ARCH_MIPS32 bool default n + select ARCH_HAVE_VFORK config ARCH_FAMILY string diff --git a/nuttx/arch/mips/src/mips32/Kconfig b/nuttx/arch/mips/src/mips32/Kconfig index b8b5d9b926..c7a4499c22 100644 --- a/nuttx/arch/mips/src/mips32/Kconfig +++ b/nuttx/arch/mips/src/mips32/Kconfig @@ -47,4 +47,12 @@ config MIPS32_TOOLCHAIN_PINGUINOL endchoice +config MIPS32_FRAMEPOINTER + bool "ABI Uses Frame Pointer" + default n + depends on ARCH_HAVE_VFORK + ---help--- + Register r30 may be a frame pointer in some ABIs. Or may just be + saved register s8. It makes a difference for vfork handling. + endif diff --git a/nuttx/arch/mips/src/mips32/up_vfork.c b/nuttx/arch/mips/src/mips32/up_vfork.c new file mode 100644 index 0000000000..6b7e27f318 --- /dev/null +++ b/nuttx/arch/mips/src/mips32/up_vfork.c @@ -0,0 +1,254 @@ +/**************************************************************************** + * arch/mips/src/mips32/up_vfork.c + * + * Copyright (C) 2013 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * 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. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include +#include +#include +#include +#include + +#include +#include +#include + +#include "up_vfork.h" +#include "os_internal.h" + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +#ifndef CONFIG_STACK_ALIGNMENT +# define CONFIG_STACK_ALIGNMENT 4 +#endif + +/**************************************************************************** + * Private Functions + ****************************************************************************/ + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: up_vfork + * + * Description: + * The vfork() function has the same effect as fork(), except that the + * behavior is undefined if the process created by vfork() either modifies + * any data other than a variable of type pid_t used to store the return + * value from vfork(), or returns from the function in which vfork() was + * called, or calls any other function before successfully calling _exit() + * or one of the exec family of functions. + * + * The overall sequence is: + * + * 1) User code calls vfork(). vfork() collects context information and + * transfers control up up_vfork(). + * 2) up_vfork()and calls task_vforksetup(). + * 3) task_vforksetup() allocates and configures the child task's TCB. This + * consists of: + * - Allocation of the child task's TCB. + * - Initialization of file descriptors and streams + * - Configuration of environment variables + * - Setup the intput parameters for the task. + * - Initialization of the TCB (including call to up_initial_state() + * 4) up_vfork() provides any additional operating context. up_vfork must: + * - Allocate and initialize the stack + * - Initialize special values in any CPU registers that were not + * already configured by up_initial_state() + * 5) up_vfork() then calls task_vforkstart() + * 6) task_vforkstart() then executes the child thread. + * + * task_vforkabort() may be called if an error occurs between steps 3 and 6. + * + * Input Paremeters: + * context - Caller context information saved by vfork() + * + * Return: + * Upon successful completion, vfork() returns 0 to the child process and + * returns the process ID of the child process to the parent process. + * Otherwise, -1 is returned to the parent, no child process is created, + * and errno is set to indicate the error. + * + ****************************************************************************/ + +pid_t up_vfork(const struct vfork_s *context) +{ + _TCB *parent = (FAR _TCB *)g_readytorun.head; + _TCB *child; + size_t stacksize; + uint32_t newsp; +#if CONFIG_MIPS32_FRAMEPOINTER + uint32_t newfp; +#endif + uint32_t stackutil; + int ret; + + svdbg("s0:%08x s1:%08x s2:%08x s3:%08x s4:%08x\n", + context->s0, context->s1, context->s2, context->s3, context->s4); +#if CONFIG_MIPS32_FRAMEPOINTER + svdbg("s5:%08x s6:%08x s7:%08x\n", + context->s5, context->s6, context->s7); +#ifdef MIPS32_SAVE_GP + svdbg("fp:%08x sp:%08x ra:%08x gp:%08x\n", + context->fp, context->sp, context->ra, context->gp); +#else + svdbg("fp:%08x sp:%08x ra:%08x\n", + context->fp context->sp, context->ra); +#endif +#else + svdbg("s5:%08x s6:%08x s7:%08x s8:%08x\n", + context->s5, context->s6, context->s7, context->s8); +#ifdef MIPS32_SAVE_GP + svdbg("sp:%08x ra:%08x gp:%08x\n", + context->sp, context->ra, context->gp); +#else + svdbg("sp:%08x ra:%08x\n", + context->sp, context->ra); +#endif +#endif + + /* Allocate and initialize a TCB for the child task. */ + + child = task_vforksetup((start_t)context->ra); + if (!child) + { + sdbg("task_vforksetup failed\n"); + return (pid_t)ERROR; + } + + svdbg("Parent=%p Child=%p\n", parent, child); + + /* Get the size of the parent task's stack. Due to alignment operations, + * the adjusted stack size may be smaller than the stack size originally + * requrested. + */ + + stacksize = parent->adj_stack_size + CONFIG_STACK_ALIGNMENT - 1; + + /* Allocate the stack for the TCB */ + + ret = up_create_stack(child, stacksize); + if (ret != OK) + { + sdbg("up_create_stack failed: %d\n", ret); + task_vforkabort(child, -ret); + return (pid_t)ERROR; + } + + /* How much of the parent's stack was utilized? The MIPS uses + * a push-down stack so that the current stack pointer should + * be lower than the initial, adjusted stack pointer. The + * stack usage should be the difference between those two. + */ + + DEBUGASSERT((uint32_t)parent->adj_stack_ptr > context->sp); + stackutil = (uint32_t)parent->adj_stack_ptr - context->sp; + + svdbg("stacksize:%d stackutil:%d\n", stacksize, stackutil); + + /* Make some feeble effort to perserve the stack contents. This is + * feeble because the stack surely contains invalid pointers and other + * content that will not work in the child context. However, if the + * user follows all of the caveats of vfor() usage, even this feeble + * effort is overkill. + */ + + newsp = (uint32_t)child->adj_stack_ptr - stackutil; + memcpy((void *)newsp, (const void *)context->sp, stackutil); + + /* Was there a frame pointer in place before? */ + +#if CONFIG_MIPS32_FRAMEPOINTER + if (context->fp <= (uint32_t)parent->adj_stack_ptr && + context->fp >= (uint32_t)parent->adj_stack_ptr - stacksize) + { + uint32_t frameutil = (uint32_t)parent->adj_stack_ptr - context->fp; + newfp = (uint32_t)child->adj_stack_ptr - frameutil; + } + else + { + newfp = context->fp; + } + + svdbg("Old stack base:%08x SP:%08x FP:%08x\n", + parent->adj_stack_ptr, context->sp, context->fp); + svdbg("New stack base:%08x SP:%08x FP:%08x\n", + child->adj_stack_ptr, newsp, newfp); +#else + svdbg("Old stack base:%08x SP:%08x\n", + parent->adj_stack_ptr, context->sp); + svdbg("New stack base:%08x SP:%08x\n", + child->adj_stack_ptr, newsp); +#endif + + /* Update the stack pointer, frame pointer, global pointer and saved + * registers. When the child TCB was initialized, all of the values + * were set to zero. up_initial_state() altered a few values, but the + * return value in v0 should be cleared to zero, providing the + * indication to the newly started child thread. + */ + + child->xcp.regs[REG_S0] = context->s0; /* Saved register s0 */ + child->xcp.regs[REG_S1] = context->s1; /* Saved register s1 */ + child->xcp.regs[REG_S2] = context->s2; /* Saved register s2 */ + child->xcp.regs[REG_S3] = context->s3; /* Volatile register s3 */ + child->xcp.regs[REG_S4] = context->s4; /* Volatile register s4 */ + child->xcp.regs[REG_S5] = context->s5; /* Volatile register s5 */ + child->xcp.regs[REG_S6] = context->s6; /* Volatile register s6 */ + child->xcp.regs[REG_S7] = context->s7; /* Volatile register s7 */ +#if CONFIG_MIPS32_FRAMEPOINTER + child->xcp.regs[REG_FP] = newfp; /* Frame pointer */ +#else + child->xcp.regs[REG_S8] = context->s8; /* Volatile register s8 */ +#endif + child->xcp.regs[REG_SP] = newsp; /* Stack pointer */ +#if MIPS32_SAVE_GP + child->xcp.regs[REG_GP] = newsp; /* Global pointer */ +#endif + + /* And, finally, start the child task. On a failure, task_vforkstart() + * will discard the TCB by calling task_vforkabort(). + */ + + return task_vforkstart(child); +} diff --git a/nuttx/arch/mips/src/mips32/up_vfork.h b/nuttx/arch/mips/src/mips32/up_vfork.h new file mode 100644 index 0000000000..5566330727 --- /dev/null +++ b/nuttx/arch/mips/src/mips32/up_vfork.h @@ -0,0 +1,132 @@ +/**************************************************************************** + * arch/mips/src/mips/up_vfork.h + * + * Copyright (C) 2013 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * 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. + * + ****************************************************************************/ + +#ifndef __ARCH_MIPS_SRC_MIPS32_VFORK_H +#define __ARCH_MIPS_SRC_MIPS32_VFORK_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include +#include + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ +/* Register r30 may be a frame pointer in some ABIs. Or may just be saved + * register s8. It makes a difference for vfork handling. + */ + +#undef VFORK_HAVE_FP + +/* r0 zero Always has the value 0. + * r1 at Temporary generally used by assembler. + * r2-r3 v0-v1 Used for expression evaluations and to hold the integer and + * pointer type function return values. + * r4-r7 a0-a3 Used for passing arguments to functions; values are not + * preserved across function calls. + * r8-r15 t0-t7 Temporary registers used for expression evaluation; values + * are not preserved across function calls. + * r16-r23 s0-s7 Saved registers; values are preserved across function calls. + * r24-r25 t8-t9 Temporary registers used for expression evaluations; values + * are not preserved across function calls. When calling + * position independent functions r25 must contain the address + * of the called function. + * r26-r27 k0-k1 Used only by the operating system. + * r28 gp Global pointer and context pointer. + * r29 sp Stack pointer. + * r30 s8 Saved register (like s0-s7). If a frame pointer is used, + * then this is the frame pointer. + * r31 ra Return address. + */ + +#define VFORK_S0_OFFSET (0*4) /* Saved register s0 */ +#define VFORK_S1_OFFSET (1*4) /* Saved register s1 */ +#define VFORK_S2_OFFSET (2*4) /* Saved register s2 */ +#define VFORK_S3_OFFSET (3*4) /* Saved register s3 */ +#define VFORK_S4_OFFSET (4*4) /* Saved register s4 */ +#define VFORK_S5_OFFSET (5*4) /* Saved register s5 */ +#define VFORK_S6_OFFSET (6*4) /* Saved register s6 */ +#define VFORK_S7_OFFSET (7*4) /* Saved register s7 */ + +#ifdef CONFIG_MIPS32_FRAMEPOINTER +# define VFORK_FP_OFFSET (8*4) /* Frame pointer */ +#else +# define VFORK_S8_OFFSET (8*4) /* Saved register s8 */ +#endif + +#define VFORK_SP_OFFSET (9*4) /* Stack pointer*/ +#define VFORK_RA_OFFSET (10*4) /* Return address*/ +#ifdef MIPS32_SAVE_GP +# define VFORK_GP_OFFSET (11*4) /* Global pointer */ +# define VFORK_SIZEOF (12*4) +#else +# define VFORK_SIZEOF (11*4) +#endif + +/**************************************************************************** + * Public Types + ****************************************************************************/ + +#ifndef __ASSEMBLY__ +struct vfork_s +{ + /* CPU registers */ + + uint32_t s0; /* Saved register s0 */ + uint32_t s1; /* Saved register s1 */ + uint32_t s2; /* Saved register s2 */ + uint32_t s3; /* Saved register s3 */ + uint32_t s4; /* Saved register s4 */ + uint32_t s5; /* Saved register s5 */ + uint32_t s6; /* Saved register s6 */ + uint32_t s7; /* Saved register s7 */ +#ifdef CONFIG_MIPS32_FRAMEPOINTER + uint32_t fp; /* Frame pointer */ +#else + uint32_t s8; /* Saved register s8 */ +#endif + uint32_t sp; /* Stack pointer*/ + uint32_t ra; /* Return address*/ +#ifdef MIPS32_SAVE_GP + uint32_t gp; /* Global pointer */ +#endif + + /* Floating point registers (not yet) */ +}; +#endif + +#endif /* __ARCH_MIPS_SRC_MIPS32_VFORK_H */ diff --git a/nuttx/arch/mips/src/mips32/vfork.S b/nuttx/arch/mips/src/mips32/vfork.S new file mode 100644 index 0000000000..2b7d180d35 --- /dev/null +++ b/nuttx/arch/mips/src/mips32/vfork.S @@ -0,0 +1,154 @@ +/************************************************************************************ + * arch/mips/src/mips32/vfork.S + * + * Copyright (C) 2013 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * 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. + * + ************************************************************************************/ + +/************************************************************************************ + * Included Files + ************************************************************************************/ + +#include + +#include "up_vfork.h" + +/************************************************************************************ + * Pre-processor Definitions + ************************************************************************************/ + +/************************************************************************************ + * Global Symbols + ************************************************************************************/ + + .file "vfork.S" + .globl up_vfork + +/************************************************************************************ + * Public Functions + ************************************************************************************/ + +/************************************************************************************ + * Name: vfork + * + * Description: + * The vfork() function has the same effect as fork(), except that the behavior is + * undefined if the process created by vfork() either modifies any data other than + * a variable of type pid_t used to store the return value from vfork(), or returns + * from the function in which vfork() was called, or calls any other function before + * successfully calling _exit() or one of the exec family of functions. + * + * This thin layer implements vfork by simply calling up_vfork() with the vfork() + * context as an argument. The overall sequence is: + * + * 1) User code calls vfork(). vfork() collects context information and + * transfers control up up_vfork(). + * 2) up_vfork()and calls task_vforksetup(). + * 3) task_vforksetup() allocates and configures the child task's TCB. This + * consists of: + * - Allocation of the child task's TCB. + * - Initialization of file descriptors and streams + * - Configuration of environment variables + * - Setup the intput parameters for the task. + * - Initialization of the TCB (including call to up_initial_state() + * 4) up_vfork() provides any additional operating context. up_vfork must: + * - Allocate and initialize the stack + * - Initialize special values in any CPU registers that were not + * already configured by up_initial_state() + * 5) up_vfork() then calls task_vforkstart() + * 6) task_vforkstart() then executes the child thread. + * + * Input Paremeters: + * None + * + * Return: + * Upon successful completion, vfork() returns 0 to the child process and returns + * the process ID of the child process to the parent process. Otherwise, -1 is + * returned to the parent, no child process is created, and errno is set to + * indicate the error. + * + ************************************************************************************/ + + .text + .align 2 + .globl vfork + .type vfork, function + .set nomips16 + .ent vfork + +vfork: + /* Create a stack frame */ + + move $t0, $sp /* Save the value of the stack on entry */ + addiu $sp, $sp, -VFORK_SIZEOF /* Allocate the structure on the stack */ + + /* CPU registers */ + /* Save the saved registers */ + + sw $s0, VFORK_S0_OFFSET($sp) + sw $s1, VFORK_S1_OFFSET($sp) + sw $s2, VFORK_S2_OFFSET($sp) + sw $s3, VFORK_S3_OFFSET($sp) + sw $s4, VFORK_S4_OFFSET($sp) + sw $s5, VFORK_S5_OFFSET($sp) + sw $s6, VFORK_S6_OFFSET($sp) + sw $s7, VFORK_S7_OFFSET($sp) + +#ifdef CONFIG_MIPS32_FRAMEPOINTER + sw $fp, VFORK_FP_OFFSET($sp) +#else + sw $s8, VFORK_S8_OFFSET($sp) +#endif + + /* Save the global pointer, stack pointer, and return address */ + + sw $t0, VFORK_SP_OFFSET($sp) + sw $ra, VFORK_RA_OFFSET($sp) +#ifdef MIPS32_SAVE_GP + sw $gp, VFORK_GP_OFFSET($sp) +#endif + + /* Floating point registers (not yet) */ + + /* Then, call up_vfork(), passing it a pointer to the stack structure */ + + move $a0, $sp + jal up_vfork + nop + + /* Release the stack data and return the value returned by up_vfork */ + + lw $ra, VFORK_RA_OFFSET($sp) + addiu $sp, $sp, VFORK_SIZEOF + j $ra + + .end vfork + .size vfork, .-vfork diff --git a/nuttx/arch/mips/src/pic32mx/Make.defs b/nuttx/arch/mips/src/pic32mx/Make.defs index 46fef84dce..861e1c3014 100644 --- a/nuttx/arch/mips/src/pic32mx/Make.defs +++ b/nuttx/arch/mips/src/pic32mx/Make.defs @@ -39,14 +39,14 @@ HEAD_ASRC = pic32mx-head.S # Common MIPS files -CMN_ASRCS = up_syscall0.S +CMN_ASRCS = up_syscall0.S vfork.S CMN_CSRCS = up_allocateheap.c up_assert.c up_blocktask.c up_copystate.c \ up_createstack.c up_doirq.c up_exit.c up_idle.c up_initialize.c \ up_initialstate.c up_interruptcontext.c up_irq.c up_lowputs.c \ up_mdelay.c up_modifyreg8.c up_modifyreg16.c up_modifyreg32.c \ up_puts.c up_releasepending.c up_releasestack.c up_reprioritizertr.c \ up_schedulesigaction.c up_sigdeliver.c up_swint0.c up_udelay.c \ - up_unblocktask.c up_usestack.c + up_unblocktask.c up_usestack.c up_vfork.c # Configuration dependent common files diff --git a/nuttx/configs/ubw32/ostest/defconfig b/nuttx/configs/ubw32/ostest/defconfig index 3a387ab997..a722e25e71 100644 --- a/nuttx/configs/ubw32/ostest/defconfig +++ b/nuttx/configs/ubw32/ostest/defconfig @@ -72,13 +72,10 @@ CONFIG_ARCH_MIPS32=y # MIPS32 Configuration Options # # CONFIG_MIPS32_TOOLCHAIN_GNU_ELF is not set -# CONFIG_MIPS32_TOOLCHAIN_MICROCHIPL is not set -# CONFIG_MIPS32_TOOLCHAIN_MICROCHIPL_LITE is not set # CONFIG_MIPS32_TOOLCHAIN_MICROCHIPW is not set CONFIG_MIPS32_TOOLCHAIN_MICROCHIPW_LITE=y -# CONFIG_MIPS32_TOOLCHAIN_MICROCHIPOPENL is not set # CONFIG_MIPS32_TOOLCHAIN_PINGUINOW is not set -# CONFIG_MIPS32_TOOLCHAIN_PINGUINOL is not set +# CONFIG_MIPS32_FRAMEPOINTER is not set # # PIC32MX Configuration Options @@ -245,7 +242,7 @@ CONFIG_ARCH_VECNOTIRQ=y CONFIG_ARCH_IRQPRIO=y # CONFIG_CUSTOM_STACK is not set # CONFIG_ADDRENV is not set -# CONFIG_ARCH_HAVE_VFORK is not set +CONFIG_ARCH_HAVE_VFORK=y CONFIG_ARCH_STACKDUMP=y # CONFIG_ENDIAN_BIG is not set CONFIG_ARCH_HAVE_RAMFUNCS=y @@ -308,7 +305,7 @@ CONFIG_DEV_CONSOLE=y # CONFIG_FDCLONE_STDIO is not set CONFIG_SDCLONE_DISABLE=y # CONFIG_SCHED_WORKQUEUE is not set -# CONFIG_SCHED_WAITPID is not set +CONFIG_SCHED_WAITPID=y # CONFIG_SCHED_ATEXIT is not set # CONFIG_SCHED_ONEXIT is not set CONFIG_USER_ENTRYPOINT="ostest_main" diff --git a/nuttx/sched/task_vfork.c b/nuttx/sched/task_vfork.c index 4b42c7b363..46b2d8e9f4 100644 --- a/nuttx/sched/task_vfork.c +++ b/nuttx/sched/task_vfork.c @@ -287,7 +287,11 @@ pid_t task_vforkstart(FAR _TCB *child) #endif #else - /* Again exploiting that execv() bug: Check if the child thread is + /* The following logic does not appear to work... It gets stuff in an + * infinite kill() loop and hogs the processor. Therefore, it looks + * as though CONFIG_SCHED_WAITPID may be a requirement to used vfork(). + * + * Again exploiting that execv() bug: Check if the child thread is * still running. */ @@ -331,4 +335,4 @@ void task_vforkabort(FAR _TCB *child, int errcode) sched_releasetcb(child); set_errno(errcode); -} \ No newline at end of file +} From fcb316906d1741c28292e94eb7f09bd4d71ccb48 Mon Sep 17 00:00:00 2001 From: patacongo Date: Tue, 15 Jan 2013 21:01:37 +0000 Subject: [PATCH 074/118] Implement redirection of output from NSH builtin commands to a file in a mounted volume git-svn-id: http://svn.code.sf.net/p/nuttx/code/trunk@5521 42af7a65-404d-4744-a932-0658087f49c3 --- apps/ChangeLog.txt | 2 + apps/builtin/Kconfig | 9 + apps/builtin/binfs.c | 6 +- apps/builtin/builtin.c | 4 +- apps/builtin/builtin.h | 2 +- apps/builtin/exec_builtin.c | 397 ++++++-- apps/include/apps.h | 47 +- apps/nshlib/Makefile | 2 +- apps/nshlib/nsh.h | 3 +- apps/nshlib/{nsh_apps.c => nsh_builtin.c} | 26 +- apps/nshlib/nsh_codeccmd.c | 1076 ++++++++++----------- apps/nshlib/nsh_parse.c | 95 +- nuttx/configs/sim/nsh/defconfig | 3 +- nuttx/configs/vsn/src/README.txt | 3 +- nuttx/fs/fat/fs_fat32.c | 19 +- nuttx/fs/romfs/fs_romfs.c | 17 +- 16 files changed, 1018 insertions(+), 693 deletions(-) rename apps/nshlib/{nsh_apps.c => nsh_builtin.c} (92%) diff --git a/apps/ChangeLog.txt b/apps/ChangeLog.txt index bf329a40db..ea4fcd07b9 100644 --- a/apps/ChangeLog.txt +++ b/apps/ChangeLog.txt @@ -467,3 +467,5 @@ * apps/examples/ostest/waitpid.c: Add a test for waitpid(), waitid(), and wait(). * builtin/binfs.c: Add hooks for dup() method (not implemented). + * builtin/exec_builtin.c, nshlib/nsh_parse.c, and nshlib/nsh_builtin.c: + NSH now supports re-direction of I/O to files (but still not from). diff --git a/apps/builtin/Kconfig b/apps/builtin/Kconfig index 5b262734d5..1049712aaf 100644 --- a/apps/builtin/Kconfig +++ b/apps/builtin/Kconfig @@ -27,4 +27,13 @@ if BUILTIN however, to support execution of the builtin applications from BINFS as well (via a binfmt/ loader). However, that is down the road. +config BUILTIN_PROXY_STACKSIZE + int "Builtin Proxy Stack Size" + default 1024 + ---help--- + If exec_builting uses I/O redirection options, then it will require + an intermediary/proxy task to muck with the file descriptors. This + configuration item specifies the stack size used for the proxy. Default: + 1024 bytes. + endif diff --git a/apps/builtin/binfs.c b/apps/builtin/binfs.c index 365021c7f8..1fc2e7940f 100644 --- a/apps/builtin/binfs.c +++ b/apps/builtin/binfs.c @@ -399,7 +399,7 @@ static int binfs_readdir(struct inode *mountpt, struct fs_dirent_s *dir) /* Have we reached the end of the directory */ index = dir->u.binfs.fb_index; - if (builtins[index].name == NULL) + if (g_builtins[index].name == NULL) { /* We signal the end of the directory by returning the * special error -ENOENT @@ -412,9 +412,9 @@ static int binfs_readdir(struct inode *mountpt, struct fs_dirent_s *dir) { /* Save the filename and file type */ - fvdbg("Entry %d: \"%s\"\n", index, builtins[index].name); + fvdbg("Entry %d: \"%s\"\n", index, g_builtins[index].name); dir->fd_dir.d_type = DTYPE_FILE; - strncpy(dir->fd_dir.d_name, builtins[index].name, NAME_MAX+1); + strncpy(dir->fd_dir.d_name, g_builtins[index].name, NAME_MAX+1); /* The application list is terminated by an entry with a NULL name. * Therefore, there is at least one more entry in the list. diff --git a/apps/builtin/builtin.c b/apps/builtin/builtin.c index a6ed7dd3fb..e0ae9888ab 100644 --- a/apps/builtin/builtin.c +++ b/apps/builtin/builtin.c @@ -64,7 +64,7 @@ extern "C" { #include "builtin_proto.h" -const struct builtin_s builtins[] = +const struct builtin_s g_builtins[] = { # include "builtin_list.h" { NULL, 0, 0, 0 } @@ -90,7 +90,7 @@ const struct builtin_s builtins[] = int number_builtins(void) { - return sizeof(builtins)/sizeof(struct builtin_s) - 1; + return sizeof(g_builtins)/sizeof(struct builtin_s) - 1; } diff --git a/apps/builtin/builtin.h b/apps/builtin/builtin.h index 3f7ddd7ce3..4593809eed 100644 --- a/apps/builtin/builtin.h +++ b/apps/builtin/builtin.h @@ -60,7 +60,7 @@ extern "C" { #define EXTERN extern #endif -EXTERN const struct builtin_s builtins[]; +EXTERN const struct builtin_s g_builtins[]; /**************************************************************************** * Public Functions diff --git a/apps/builtin/exec_builtin.c b/apps/builtin/exec_builtin.c index dc36302300..a3e79a9453 100644 --- a/apps/builtin/exec_builtin.c +++ b/apps/builtin/exec_builtin.c @@ -1,13 +1,15 @@ /**************************************************************************** * apps/builtin/exec_builtin.c * + * Originally by: + * * Copyright (C) 2011 Uros Platise. All rights reserved. * Author: Uros Platise * - * With updates, modifications, and general maintenance by: + * With subsequent updates, modifications, and general maintenance by: * - * Copyright (C) 2012 Gregory Nutt. All rights reserved. - * Auther: Gregory Nutt + * Copyright (C) 2012-2013 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -43,18 +45,45 @@ ****************************************************************************/ #include -#include -#include +#include #include +#include +#include #include +#include + +#include #include "builtin.h" +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +#ifndef CONFIG_BUILTIN_PROXY_STACKSIZE +# define CONFIG_BUILTIN_PROXY_STACKSIZE 1024 +#endif + /**************************************************************************** * Private Types ****************************************************************************/ +struct builtin_parms_s +{ + /* Input values */ + + FAR const char *redirfile; + FAR const char **argv; + int oflags; + int index; + + /* Returned values */ + + pid_t result; + int errcode; +}; + /**************************************************************************** * Private Function Prototypes ****************************************************************************/ @@ -63,10 +92,276 @@ * Private Data ****************************************************************************/ +static sem_t g_builtin_parmsem = SEM_INITIALIZER(1); +static sem_t g_builtin_execsem = SEM_INITIALIZER(0); +static struct builtin_parms_s g_builtin_parms; + /**************************************************************************** * Private Functions ****************************************************************************/ +/**************************************************************************** + * Name: bultin_semtake and builtin_semgive + * + * Description: + * Give and take semaphores + * + * Input Parameters: + * + * sem - The semaphore to act on. + * + * Returned Value: + * None + * + ****************************************************************************/ + +static void bultin_semtake(FAR sem_t *sem) +{ + int ret; + + do + { + ret = sem_wait(sem); + ASSERT(ret == 0 || errno == EINTR); + } + while (ret != 0); +} + +#define builtin_semgive(sem) sem_post(sem) + +/**************************************************************************** + * Name: builtin_taskcreate + * + * Description: + * Execute the builtin task + * + * Returned Value: + * On success, the task ID of the builtin task is returned; On failure, -1 + * (ERROR) is returned and the errno is set appropriately. + * + ****************************************************************************/ + +static int builtin_taskcreate(int index, FAR const char **argv) +{ + int ret; + + /* Disable pre-emption. This means that although we start the builtin + * application here, it will not actually run until pre-emption is + * re-enabled below. + */ + + sched_lock(); + + /* Start the builtin application task */ + + ret = TASK_CREATE(g_builtins[index].name, g_builtins[index].priority, + g_builtins[index].stacksize, g_builtins[index].main, + (argv) ? &argv[1] : (FAR const char **)NULL); + + /* If robin robin scheduling is enabled, then set the scheduling policy + * of the new task to SCHED_RR before it has a chance to run. + */ + +#if CONFIG_RR_INTERVAL > 0 + if (ret > 0) + { + struct sched_param param; + + /* Pre-emption is disabled so the task creation and the + * following operation will be atomic. The priority of the + * new task cannot yet have changed from its initial value. + */ + + param.sched_priority = g_builtins[index].priority; + (void)sched_setscheduler(ret, SCHED_RR, ¶m); + } +#endif + + /* Now let the builtin application run */ + + sched_unlock(); + + /* Return the task ID of the new task if the task was sucessfully + * started. Otherwise, ret will be ERROR (and the errno value will + * be set appropriately). + */ + + return ret; +} + +/**************************************************************************** + * Name: builtin_proxy + * + * Description: + * Perform output redirection, then execute the builtin task. + * + * Input Parameters: + * Standard task start-up parameters + * + * Returned Value: + * Standard task return value. + * + ****************************************************************************/ + +static int builtin_proxy(int argc, char *argv[]) +{ + int fd; + int ret = ERROR; + + /* Open the output file for redirection */ + + svdbg("Open'ing redirfile=%s oflags=%04x mode=0644\n", + g_builtin_parms.redirfile, g_builtin_parms.oflags); + + fd = open(g_builtin_parms.redirfile, g_builtin_parms.oflags, 0644); + if (fd < 0) + { + /* Remember the errno value. ret is already set to ERROR */ + + g_builtin_parms.errcode = errno; + sdbg("ERROR: open of %s failed: %d\n", + g_builtin_parms.redirfile, g_builtin_parms.errcode); + } + + /* Does the return file descriptor happen to match the required file + * desciptor number? + */ + + else if (fd != 1) + { + /* No.. dup2 to get the correct file number */ + + svdbg("Dup'ing %d->1\n", fd); + + ret = dup2(fd, 1); + if (ret < 0) + { + g_builtin_parms.errcode = errno; + sdbg("ERROR: dup2 failed: %d\n", g_builtin_parms.errcode); + } + + svdbg("Closing fd=%d\n", fd); + close(fd); + } + + /* Was the setup successful? */ + + if (ret == OK) + { + /* Yes.. Start the task. On success, the task ID of the builtin task + * is returned; On failure, -1 (ERROR) is returned and the errno + * is set appropriately. + */ + + ret = builtin_taskcreate(g_builtin_parms.index, g_builtin_parms.argv); + if (ret < 0) + { + g_builtin_parms.errcode = errno; + sdbg("ERROR: builtin_taskcreate failed: %d\n", + g_builtin_parms.errcode); + } + } + + /* Post the semaphore to inform the parent task that we have completed + * what we need to do. + */ + + g_builtin_parms.result = ret; + builtin_semgive(&g_builtin_execsem); + return 0; +} + +/**************************************************************************** + * Name: builtin_startproxy + * + * Description: + * Perform output redirection, then execute the builtin task. + * + * Input Parameters: + * Standard task start-up parameters + * + * Returned Value: + * On success, the task ID of the builtin task is returned; On failure, -1 + * (ERROR) is returned and the errno is set appropriately. + * + ****************************************************************************/ + +static inline int builtin_startproxy(int index, FAR const char **argv, + FAR const char *redirfile, int oflags) +{ + struct sched_param param; + pid_t proxy; + int errcode; + int ret; + + DEBUGASSERT(path); + + svdbg("index=%d argv=%p redirfile=%s oflags=%04x\n", + index, argv, redirfile, oflags); + + /* We will have to go through an intermediary/proxy task in order to + * perform the I/O redirection. This would be a natural place to fork(). + * However, true fork() behavior requires an MMU and most implementations + * of vfork() are not capable of these operations. + * + * Even without fork(), we can still do the job, but parameter passing is + * messier. Unfortunately, there is no (clean) way to pass binary values + * as a task parameter, so we will use a semaphore-protected global + * structure. + */ + + /* Get exclusive access to the global parameter structure */ + + bultin_semtake(&g_builtin_parmsem); + + /* Populate the parameter structure */ + + g_builtin_parms.redirfile = redirfile; + g_builtin_parms.argv = argv; + g_builtin_parms.result = ERROR; + g_builtin_parms.oflags = oflags; + g_builtin_parms.index = index; + + /* Get the priority of this (parent) task */ + + ret = sched_getparam(0, ¶m); + if (ret < 0) + { + errcode = errno; + sdbg("ERROR: sched_getparam failed: %d\n", errcode); + goto errout; + } + + /* Start the intermediary/proxy task at the same priority as the parent task. */ + + proxy = TASK_CREATE("builtin_proxy", param.sched_priority, + CONFIG_BUILTIN_PROXY_STACKSIZE, (main_t)builtin_proxy, + (FAR const char **)NULL); + if (proxy < 0) + { + errcode = errno; + sdbg("ERROR: Failed to start builtin_proxy: %d\n", errcode); + goto errout; + } + + /* Wait for the proxy to complete its job. We could use waitpid() + * for this. + */ + + bultin_semtake(&g_builtin_execsem); + + /* Get the result and relinquish our access to the parameter structure */ + + set_errno(g_builtin_parms.errcode); + builtin_semgive(&g_builtin_parmsem); + return g_builtin_parms.result; + +errout: + set_errno(errcode); + builtin_semgive(&g_builtin_parmsem); + return ERROR; +} + /**************************************************************************** * Public Functions ****************************************************************************/ @@ -86,10 +381,10 @@ const char *builtin_getname(int index) { return NULL; } - - return builtins[index].name; + + return g_builtins[index].name; } - + /**************************************************************************** * Name: builtin_isavail * @@ -102,10 +397,10 @@ const char *builtin_getname(int index) int builtin_isavail(FAR const char *appname) { int i; - - for (i = 0; builtins[i].name; i++) + + for (i = 0; g_builtins[i].name; i++) { - if (!strcmp(builtins[i].name, appname)) + if (!strcmp(g_builtins[i].name, appname)) { return i; } @@ -114,74 +409,60 @@ int builtin_isavail(FAR const char *appname) set_errno(ENOENT); return ERROR; } - + /**************************************************************************** - * Name: builtin_isavail + * Name: exec_builtin * * Description: - * Execute the application with name 'appname', providing the arguments - * in the argv[] array. + * Executes builtin applications registered during 'make context' time. + * New application is run in a separate task context (and thread). + * + * Input Parameter: + * filename - Name of the linked-in binary to be started. + * argv - Argument list + * redirfile - If output if redirected, this parameter will be non-NULL + * and will provide the full path to the file. + * oflags - If output is redirected, this parameter will provide the + * open flags to use. This will support file replacement + * of appending to an existing file. * * Returned Value: - * On success, the task ID of the builtin application is returned. On - * failure, -1 (ERROR) is returned an the errno value is set appropriately. + * This is an end-user function, so it follows the normal convention: + * Returns the PID of the exec'ed module. On failure, it.returns + * -1 (ERROR) and sets errno appropriately. * ****************************************************************************/ -int exec_builtin(FAR const char *appname, FAR const char **argv) +int exec_builtin(FAR const char *appname, FAR const char **argv, + FAR const char *redirfile, int oflags) { - pid_t pid; int index; + int ret = ERROR; /* Verify that an application with this name exists */ index = builtin_isavail(appname); if (index >= 0) { - /* Disable pre-emption. This means that although we start the builtin - * application here, it will not actually run until pre-emption is - * re-enabled below. - */ + /* Is output being redirected? */ - sched_lock(); - - /* Start the builtin application task */ - - pid = TASK_CREATE(builtins[index].name, builtins[index].priority, - builtins[index].stacksize, builtins[index].main, - (argv) ? &argv[1] : (const char **)NULL); - - /* If robin robin scheduling is enabled, then set the scheduling policy - * of the new task to SCHED_RR before it has a chance to run. - */ - -#if CONFIG_RR_INTERVAL > 0 - if (pid > 0) + if (redirfile) { - struct sched_param param; - - /* Pre-emption is disabled so the task creation and the - * following operation will be atomic. The priority of the - * new task cannot yet have changed from its initial value. - */ - - param.sched_priority = builtins[index].priority; - sched_setscheduler(pid, SCHED_RR, ¶m); + ret = builtin_startproxy(index, argv, redirfile, oflags); } -#endif - /* Now let the builtin application run */ + else + { + /* Start the builtin application task */ - sched_unlock(); - - /* Return the task ID of the new task if the task was sucessfully - * started. Otherwise, pid will be ERROR (and the errno value will - * be set appropriately). - */ - - return pid; + ret = builtin_taskcreate(index, argv); + } } - /* Return ERROR with errno set appropriately */ - return ERROR; + /* Return the task ID of the new task if the task was sucessfully + * started. Otherwise, ret will be ERROR (and the errno value will + * be set appropriately). + */ + + return ret; } diff --git a/apps/include/apps.h b/apps/include/apps.h index 37599ac5c5..f806d8aed2 100644 --- a/apps/include/apps.h +++ b/apps/include/apps.h @@ -1,9 +1,16 @@ /**************************************************************************** * apps/include/apps.h * - * Copyright(C) 2011 Uros Platise. All rights reserved. + * Originally by: + * + * Copyright (C) 2011 Uros Platise. All rights reserved. * Author: Uros Platise * + * With subsequent updates, modifications, and general maintenance by: + * + * Copyright (C) 2012-2013 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -64,19 +71,6 @@ struct builtin_s * Public Data ****************************************************************************/ -/* The "bindir" is file system that supports access to the builtin applications. - * It is typically mounted under /bin. - */ - -#ifdef CONFIG_APPS_BINDIR -struct mountpt_operations; -extern const struct mountpt_operations binfs_operations; -#endif - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - #undef EXTERN #if defined(__cplusplus) #define EXTERN extern "C" @@ -85,6 +79,19 @@ extern "C" { #define EXTERN extern #endif +/* The "bindir" is file system that supports access to the builtin applications. + * It is typically mounted under /bin. + */ + +#ifdef CONFIG_APPS_BINDIR +EXTERN mountpt_operations; +EXTERN const struct mountpt_operations binfs_operations; +#endif + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + /**************************************************************************** * Name: builtin_isavail * @@ -129,8 +136,13 @@ EXTERN const char *builtin_getname(int index); * New application is run in a separate task context (and thread). * * Input Parameter: - * filename - Name of the linked-in binary to be started. - * argv - Argument list + * filename - Name of the linked-in binary to be started. + * argv - Argument list + * redirfile - If output if redirected, this parameter will be non-NULL + * and will provide the full path to the file. + * oflags - If output is redirected, this parameter will provide the + * open flags to use. This will support file replacement + * of appending to an existing file. * * Returned Value: * This is an end-user function, so it follows the normal convention: @@ -139,7 +151,8 @@ EXTERN const char *builtin_getname(int index); * ****************************************************************************/ -EXTERN int exec_builtin(FAR const char *appname, FAR const char **argv); +EXTERN int exec_builtin(FAR const char *appname, FAR const char **argv, + FAR const char *redirfile, int oflags); #undef EXTERN #if defined(__cplusplus) diff --git a/apps/nshlib/Makefile b/apps/nshlib/Makefile index 7ddbb67bf3..5c52696853 100644 --- a/apps/nshlib/Makefile +++ b/apps/nshlib/Makefile @@ -44,7 +44,7 @@ CSRCS = nsh_init.c nsh_parse.c nsh_console.c nsh_fscmds.c nsh_ddcmd.c \ nsh_proccmds.c nsh_mmcmds.c nsh_envcmds.c nsh_dbgcmds.c ifeq ($(CONFIG_NSH_BUILTIN_APPS),y) -CSRCS += nsh_apps.c +CSRCS += nsh_builtin.c endif ifeq ($(CONFIG_NSH_ROMFSETC),y) diff --git a/apps/nshlib/nsh.h b/apps/nshlib/nsh.h index a046a384fc..253a803f88 100644 --- a/apps/nshlib/nsh.h +++ b/apps/nshlib/nsh.h @@ -491,7 +491,8 @@ int nsh_parse(FAR struct nsh_vtbl_s *vtbl, char *cmdline); /* Application interface */ #ifdef CONFIG_NSH_BUILTIN_APPS -int nsh_execapp(FAR struct nsh_vtbl_s *vtbl, FAR const char *cmd, FAR char **argv); +int nsh_builtin(FAR struct nsh_vtbl_s *vtbl, FAR const char *cmd, + FAR char **argv, FAR const char *redirfile, int oflags); #endif /* Working directory support */ diff --git a/apps/nshlib/nsh_apps.c b/apps/nshlib/nsh_builtin.c similarity index 92% rename from apps/nshlib/nsh_apps.c rename to apps/nshlib/nsh_builtin.c index ea8791eef2..16e3e94279 100644 --- a/apps/nshlib/nsh_apps.c +++ b/apps/nshlib/nsh_builtin.c @@ -1,10 +1,16 @@ /**************************************************************************** - * apps/nshlib/nsh_apps.c + * apps/nshlib/nsh_builtin.c + * + * Originally by: * - * Copyright (C) 2011-2012 Gregory Nutt. All rights reserved. * Copyright (C) 2011 Uros Platise. All rights reserved. * Author: Uros Platise * + * With subsequent updates, modifications, and general maintenance by: + * + * Copyright (C) 2011-2013 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -84,7 +90,7 @@ ****************************************************************************/ /**************************************************************************** - * Name: nsh_execapp + * Name: nsh_builtin * * Description: * Attempt to execute the application task whose name is 'cmd' @@ -104,8 +110,8 @@ * ****************************************************************************/ -int nsh_execapp(FAR struct nsh_vtbl_s *vtbl, FAR const char *cmd, - FAR char **argv) +int nsh_builtin(FAR struct nsh_vtbl_s *vtbl, FAR const char *cmd, + FAR char **argv, FAR const char *redirfile, int oflags) { int ret = OK; @@ -119,7 +125,7 @@ int nsh_execapp(FAR struct nsh_vtbl_s *vtbl, FAR const char *cmd, * applications. */ - ret = exec_builtin(cmd, (FAR const char **)argv); + ret = exec_builtin(cmd, (FAR const char **)argv, redirfile, oflags); if (ret >= 0) { /* The application was successfully started (but still blocked because @@ -191,7 +197,7 @@ int nsh_execapp(FAR struct nsh_vtbl_s *vtbl, FAR const char *cmd, #if !defined(CONFIG_SCHED_WAITPID) || !defined(CONFIG_NSH_DISABLEBG) { struct sched_param param; - sched_getparam(0, ¶m); + sched_getparam(ret, ¶m); nsh_output(vtbl, "%s [%d:%d]\n", cmd, ret, param.sched_priority); /* Backgrounded commands always 'succeed' as long as we can start @@ -205,13 +211,13 @@ int nsh_execapp(FAR struct nsh_vtbl_s *vtbl, FAR const char *cmd, sched_unlock(); - /* If exec_builtin() or waitpid() failed, then return the negated errno - * value. + /* If exec_builtin() or waitpid() failed, then return -1 (ERROR) with the + * errno value set appropriately. */ if (ret < 0) { - return -errno; + return ERROR; } return ret; diff --git a/apps/nshlib/nsh_codeccmd.c b/apps/nshlib/nsh_codeccmd.c index 8c1f5adbdf..779fc5ecda 100644 --- a/apps/nshlib/nsh_codeccmd.c +++ b/apps/nshlib/nsh_codeccmd.c @@ -1,538 +1,538 @@ -/**************************************************************************** - * apps/nshlib/nsh_apps.c - * - * This file is part of NuttX, contributed by Darcy Gong - * - * Copyright (C) 2012 Gregory Nutt. All rights reserved. - * Author: Darcy Gong 2012-10-30 - * - * 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. - * - ****************************************************************************/ - -/**************************************************************************** - * Included Files - ****************************************************************************/ - -#include -#ifdef CONFIG_NETUTILS_CODECS - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#if defined(CONFIG_NSH_DISABLE_URLENCODE) && defined(CONFIG_NSH_DISABLE_URLDECODE) -# undef CONFIG_CODECS_URLCODE -#endif - -#ifdef CONFIG_CODECS_URLCODE -#include -#endif - -#if defined(CONFIG_NSH_DISABLE_BASE64ENC) && defined(CONFIG_NSH_DISABLE_BASE64ENC) -# undef CONFIG_CODECS_BASE64 -#endif - -#ifdef CONFIG_CODECS_BASE64 -#include -#endif - -#if defined(CONFIG_CODECS_HASH_MD5) && !defined(CONFIG_NSH_DISABLE_MD5) -#include -#endif - -#include "nsh.h" -#include "nsh_console.h" - -/**************************************************************************** - * Pre-processor Definitions - ****************************************************************************/ - -#ifndef CONFIG_NSH_CODECS_BUFSIZE -# define CONFIG_NSH_CODECS_BUFSIZE 128 -#endif - -#define CODEC_MODE_URLENCODE 1 -#define CODEC_MODE_URLDECODE 2 -#define CODEC_MODE_BASE64ENC 3 -#define CODEC_MODE_BASE64DEC 4 -#define CODEC_MODE_HASH_MD5 5 - -/**************************************************************************** - * Private Types - ****************************************************************************/ - -typedef void (*codec_callback_t)(FAR char *src_buff, int src_buff_len, - FAR char *dst_buff, FAR int *dst_buff_len, - int mode); - -/**************************************************************************** - * Private Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: urlencode_cb - ****************************************************************************/ - -#if defined(CONFIG_CODECS_URLCODE) && !defined(CONFIG_NSH_DISABLE_URLENCODE) -static void urlencode_cb(FAR char *src_buff, int src_buff_len, - FAR char *dst_buff, FAR int *dst_buff_len, int mode) -{ - urlencode(src_buff,src_buff_len,dst_buff,dst_buff_len); -} -#endif - -/**************************************************************************** - * Name: urldecode_cb - ****************************************************************************/ - -#if defined(CONFIG_CODECS_URLCODE) && !defined(CONFIG_NSH_DISABLE_URLDECODE) -static void urldecode_cb(FAR char *src_buff, int src_buff_len, FAR char *dst_buff, - FAR int *dst_buff_len, int mode) -{ - urldecode(src_buff,src_buff_len,dst_buff,dst_buff_len); -} -#endif - -/**************************************************************************** - * Name: b64enc_cb - ****************************************************************************/ - -#if defined(CONFIG_CODECS_BASE64) && !defined(CONFIG_NSH_DISABLE_BASE64ENC) -static void b64enc_cb(FAR char *src_buff, int src_buff_len, FAR char *dst_buff, - FAR int *dst_buff_len, int mode) -{ - if (mode == 0) - { - //dst_buff = - base64_encode((unsigned char *)src_buff, src_buff_len, - (unsigned char *)dst_buff, (size_t *)dst_buff_len); - } - else - { - //dst_buff = - base64w_encode((unsigned char *)src_buff, src_buff_len, - (unsigned char *)dst_buff, (size_t *)dst_buff_len); - } -} -#endif - -/**************************************************************************** - * Name: b64dec_cb - ****************************************************************************/ - -#if defined(CONFIG_CODECS_BASE64) && !defined(CONFIG_NSH_DISABLE_BASE64DEC) -static void b64dec_cb(FAR char *src_buff, int src_buff_len, FAR char *dst_buff, - FAR int *dst_buff_len, int mode) -{ - if (mode == 0) - { - //dst_buff = - base64_decode((unsigned char *)src_buff, src_buff_len, - (unsigned char *)dst_buff, (size_t *)dst_buff_len); - } - else - { - //dst_buff = - base64w_decode((unsigned char *)src_buff, src_buff_len, - (unsigned char *)dst_buff,(size_t *)dst_buff_len); - } -} -#endif - -/**************************************************************************** - * Name: md5_cb - ****************************************************************************/ - -#if defined(CONFIG_CODECS_HASH_MD5) && !defined(CONFIG_NSH_DISABLE_MD5) -static void md5_cb(FAR char *src_buff, int src_buff_len, FAR char *dst_buff, - FAR int *dst_buff_len, int mode) -{ - MD5Update((MD5_CTX *)dst_buff, (unsigned char *)src_buff, src_buff_len); -} -#endif - -/**************************************************************************** - * Name: calc_codec_buffsize - ****************************************************************************/ - -static int calc_codec_buffsize(int src_buffsize, uint8_t mode) -{ - switch (mode) - { - case CODEC_MODE_URLENCODE: - return src_buffsize*3+1; - case CODEC_MODE_URLDECODE: - return src_buffsize+1; - case CODEC_MODE_BASE64ENC: - return ((src_buffsize + 2)/ 3 * 4)+1; - case CODEC_MODE_BASE64DEC: - return (src_buffsize / 4 * 3 + 2)+1; - case CODEC_MODE_HASH_MD5: - return 32+1; - default: - return src_buffsize+1; - } -} - -/**************************************************************************** - * Name: cmd_codecs_proc - ****************************************************************************/ - -static int cmd_codecs_proc(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv, - uint8_t mode, codec_callback_t func) -{ -#if defined(CONFIG_CODECS_HASH_MD5) && !defined(CONFIG_NSH_DISABLE_MD5) - static const unsigned char hex_chars[] = "0123456789abcdef"; - MD5_CTX ctx; - unsigned char mac[16]; - char *pSrc; - char *pDest; -#endif - - char *localfile = NULL; - char *src_buffer = NULL; - char *buffer = NULL; - char *fullpath = NULL; - const char *fmt; - char *s_data; - bool badarg = false; - bool is_file = false; - bool is_websafe=false; - int option; - int fd = -1; - int buff_len = 0; - int src_buff_len = 0; - int i = 0; - int ret = OK; - - /* Get the command options */ - - while ((option = getopt(argc, argv, ":fw")) != ERROR) - { - switch (option) - { - case 'f': - is_file = true; - break; - -#ifdef CONFIG_CODECS_BASE64 - case 'w': - is_websafe = true; - - if (!(mode == CODEC_MODE_BASE64ENC || mode == CODEC_MODE_BASE64DEC)) - { - badarg = true; - } - break; -#endif - case ':': - nsh_output(vtbl, g_fmtargrequired, argv[0]); - badarg = true; - break; - - case '?': - default: - nsh_output(vtbl, g_fmtarginvalid, argv[0]); - badarg = true; - break; - } - } - - /* If a bad argument was encountered, then return without processing the command */ - - if (badarg) - { - return ERROR; - } - - /* There should be exactly on parameter left on the command-line */ - - if (optind == argc-1) - { - s_data = argv[optind]; - } - else if (optind >= argc) - { - fmt = g_fmttoomanyargs; - goto errout; - } - else - { - fmt = g_fmtargrequired; - goto errout; - } - -#if defined(CONFIG_CODECS_HASH_MD5) && !defined(CONFIG_NSH_DISABLE_MD5) - if (mode == CODEC_MODE_HASH_MD5) - { - MD5Init(&ctx); - } -#endif - - if (is_file) - { - /* Get the local file name */ - - localfile = s_data; - - /* Get the full path to the local file */ - - fullpath = nsh_getfullpath(vtbl, localfile); - - /* Open the local file for writing */ - - fd = open(fullpath, O_RDONLY|O_TRUNC, 0644); - if (fd < 0) - { - nsh_output(vtbl, g_fmtcmdfailed, argv[0], "open", NSH_ERRNO); - ret = ERROR; - goto exit; - } - - src_buffer = malloc(CONFIG_NSH_CODECS_BUFSIZE+2); -#if defined(CONFIG_CODECS_BASE64) && !defined(CONFIG_NSH_DISABLE_BASE64ENC) - if (mode == CODEC_MODE_BASE64ENC) - { - src_buff_len = CONFIG_NSH_CODECS_BUFSIZE / 3 * 3; - } - else -#endif - { - src_buff_len = CONFIG_NSH_CODECS_BUFSIZE; - } - - buff_len = calc_codec_buffsize(src_buff_len+2, mode); - buffer = malloc(buff_len); - while(true) - { - memset(src_buffer, 0, src_buff_len+2); - ret=read(fd, src_buffer, src_buff_len); - if (ret < 0) - { - nsh_output(vtbl, g_fmtcmdfailed, argv[0], "read", NSH_ERRNO); - ret = ERROR; - goto exit; - } - else if(ret==0) - { - break; - } - -#if defined(CONFIG_CODECS_URLCODE) && !defined(CONFIG_NSH_DISABLE_URLDECODE) - if (mode == CODEC_MODE_URLDECODE) - { - if (src_buffer[src_buff_len-1]=='%') - { - ret += read(fd,&src_buffer[src_buff_len],2); - } - else if (src_buffer[src_buff_len-2]=='%') - { - ret += read(fd,&src_buffer[src_buff_len],1); - } - } -#endif - memset(buffer, 0, buff_len); - if (func) - { -#if defined(CONFIG_CODECS_HASH_MD5) && !defined(CONFIG_NSH_DISABLE_MD5) - if (mode == CODEC_MODE_HASH_MD5) - { - func(src_buffer, ret, (char *)&ctx, &buff_len,0); - } - else -#endif - { - func(src_buffer, ret, buffer, &buff_len,(is_websafe)?1:0); - nsh_output(vtbl, "%s", buffer); - } - } - - buff_len = calc_codec_buffsize(src_buff_len+2, mode); - } - -#if defined(CONFIG_CODECS_HASH_MD5) && !defined(CONFIG_NSH_DISABLE_MD5) - if (mode == CODEC_MODE_HASH_MD5) - { - MD5Final(mac, &ctx); - pSrc = (char *)&mac; - pDest = buffer; - for(i=0;i<16;i++,pSrc++) - { - *pDest++ = hex_chars[(*pSrc) >> 4]; - *pDest++ = hex_chars[(*pSrc) & 0x0f]; - } - - *pDest='\0'; - nsh_output(vtbl, "%s\n", buffer); - } -#endif - ret = OK; - goto exit; - } - else - { - src_buffer = s_data; - src_buff_len = strlen(s_data); - buff_len = calc_codec_buffsize(src_buff_len, mode); - buffer = malloc(buff_len); - buffer[0]=0; - if (!buffer) - { - fmt = g_fmtcmdoutofmemory; - goto errout; - } - - memset(buffer, 0, buff_len); - if (func) - { -#if defined(CONFIG_CODECS_HASH_MD5) && !defined(CONFIG_NSH_DISABLE_MD5) - if (mode == CODEC_MODE_HASH_MD5) - { - func(src_buffer, src_buff_len, (char *)&ctx, &buff_len, 0); - MD5Final(mac, &ctx); - pSrc = (char *)&mac; - pDest = buffer; - for(i=0;i<16;i++,pSrc++) - { - *pDest++ = hex_chars[(*pSrc) >> 4]; - *pDest++ = hex_chars[(*pSrc) & 0x0f]; - } - - *pDest='\0'; - } - else -#endif - { - func(src_buffer, src_buff_len, buffer, &buff_len,(is_websafe)?1:0); - } - } - - nsh_output(vtbl, "%s\n",buffer); - src_buffer = NULL; - goto exit; - } - -exit: - if (fd >= 0) - { - close(fd); - } - - if (fullpath) - { - free(fullpath); - } - - if (src_buffer) - { - free(src_buffer); - } - - if (buffer) - { - free(buffer); - } - - return ret; - -errout: - nsh_output(vtbl, fmt, argv[0]); - ret = ERROR; - goto exit; -} - -/**************************************************************************** - * Public Functions - ****************************************************************************/ - -/**************************************************************************** - * Name: cmd_urlencode - ****************************************************************************/ - -#if defined(CONFIG_CODECS_URLCODE) && !defined(CONFIG_NSH_DISABLE_URLENCODE) -int cmd_urlencode(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv) -{ - return cmd_codecs_proc(vtbl, argc, argv, CODEC_MODE_URLENCODE, urlencode_cb); -} -#endif - -/**************************************************************************** - * Name: cmd_urldecode - ****************************************************************************/ - -#if defined(CONFIG_CODECS_URLCODE) && !defined(CONFIG_NSH_DISABLE_URLDECODE) -int cmd_urldecode(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv) -{ - return cmd_codecs_proc(vtbl, argc, argv, CODEC_MODE_URLDECODE, urldecode_cb); -} -#endif - -/**************************************************************************** - * Name: cmd_base64encode - ****************************************************************************/ - -#if defined(CONFIG_CODECS_BASE64) && !defined(CONFIG_NSH_DISABLE_BASE64ENC) -int cmd_base64encode(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv) -{ - return cmd_codecs_proc(vtbl, argc, argv, CODEC_MODE_BASE64ENC, b64enc_cb); -} -#endif - -/**************************************************************************** - * Name: cmd_base64decode - ****************************************************************************/ - -#if defined(CONFIG_CODECS_BASE64) && !defined(CONFIG_NSH_DISABLE_BASE64DEC) -int cmd_base64decode(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv) -{ - return cmd_codecs_proc(vtbl, argc, argv, CODEC_MODE_BASE64DEC, b64dec_cb); -} -#endif - -/**************************************************************************** - * Name: cmd_md5 - ****************************************************************************/ - -#if defined(CONFIG_CODECS_HASH_MD5) && !defined(CONFIG_NSH_DISABLE_MD5) -int cmd_md5(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv) -{ - return cmd_codecs_proc(vtbl,argc,argv,CODEC_MODE_HASH_MD5,md5_cb); -} -#endif - -#endif /* CONFIG_NETUTILS_CODECS */ +/**************************************************************************** + * apps/nshlib/nsh_codeccmd.c + * + * This file is part of NuttX, contributed by Darcy Gong + * + * Copyright (C) 2012 Gregory Nutt. All rights reserved. + * Author: Darcy Gong 2012-10-30 + * + * 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. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include +#ifdef CONFIG_NETUTILS_CODECS + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#if defined(CONFIG_NSH_DISABLE_URLENCODE) && defined(CONFIG_NSH_DISABLE_URLDECODE) +# undef CONFIG_CODECS_URLCODE +#endif + +#ifdef CONFIG_CODECS_URLCODE +#include +#endif + +#if defined(CONFIG_NSH_DISABLE_BASE64ENC) && defined(CONFIG_NSH_DISABLE_BASE64ENC) +# undef CONFIG_CODECS_BASE64 +#endif + +#ifdef CONFIG_CODECS_BASE64 +#include +#endif + +#if defined(CONFIG_CODECS_HASH_MD5) && !defined(CONFIG_NSH_DISABLE_MD5) +#include +#endif + +#include "nsh.h" +#include "nsh_console.h" + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +#ifndef CONFIG_NSH_CODECS_BUFSIZE +# define CONFIG_NSH_CODECS_BUFSIZE 128 +#endif + +#define CODEC_MODE_URLENCODE 1 +#define CODEC_MODE_URLDECODE 2 +#define CODEC_MODE_BASE64ENC 3 +#define CODEC_MODE_BASE64DEC 4 +#define CODEC_MODE_HASH_MD5 5 + +/**************************************************************************** + * Private Types + ****************************************************************************/ + +typedef void (*codec_callback_t)(FAR char *src_buff, int src_buff_len, + FAR char *dst_buff, FAR int *dst_buff_len, + int mode); + +/**************************************************************************** + * Private Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: urlencode_cb + ****************************************************************************/ + +#if defined(CONFIG_CODECS_URLCODE) && !defined(CONFIG_NSH_DISABLE_URLENCODE) +static void urlencode_cb(FAR char *src_buff, int src_buff_len, + FAR char *dst_buff, FAR int *dst_buff_len, int mode) +{ + urlencode(src_buff,src_buff_len,dst_buff,dst_buff_len); +} +#endif + +/**************************************************************************** + * Name: urldecode_cb + ****************************************************************************/ + +#if defined(CONFIG_CODECS_URLCODE) && !defined(CONFIG_NSH_DISABLE_URLDECODE) +static void urldecode_cb(FAR char *src_buff, int src_buff_len, FAR char *dst_buff, + FAR int *dst_buff_len, int mode) +{ + urldecode(src_buff,src_buff_len,dst_buff,dst_buff_len); +} +#endif + +/**************************************************************************** + * Name: b64enc_cb + ****************************************************************************/ + +#if defined(CONFIG_CODECS_BASE64) && !defined(CONFIG_NSH_DISABLE_BASE64ENC) +static void b64enc_cb(FAR char *src_buff, int src_buff_len, FAR char *dst_buff, + FAR int *dst_buff_len, int mode) +{ + if (mode == 0) + { + //dst_buff = + base64_encode((unsigned char *)src_buff, src_buff_len, + (unsigned char *)dst_buff, (size_t *)dst_buff_len); + } + else + { + //dst_buff = + base64w_encode((unsigned char *)src_buff, src_buff_len, + (unsigned char *)dst_buff, (size_t *)dst_buff_len); + } +} +#endif + +/**************************************************************************** + * Name: b64dec_cb + ****************************************************************************/ + +#if defined(CONFIG_CODECS_BASE64) && !defined(CONFIG_NSH_DISABLE_BASE64DEC) +static void b64dec_cb(FAR char *src_buff, int src_buff_len, FAR char *dst_buff, + FAR int *dst_buff_len, int mode) +{ + if (mode == 0) + { + //dst_buff = + base64_decode((unsigned char *)src_buff, src_buff_len, + (unsigned char *)dst_buff, (size_t *)dst_buff_len); + } + else + { + //dst_buff = + base64w_decode((unsigned char *)src_buff, src_buff_len, + (unsigned char *)dst_buff,(size_t *)dst_buff_len); + } +} +#endif + +/**************************************************************************** + * Name: md5_cb + ****************************************************************************/ + +#if defined(CONFIG_CODECS_HASH_MD5) && !defined(CONFIG_NSH_DISABLE_MD5) +static void md5_cb(FAR char *src_buff, int src_buff_len, FAR char *dst_buff, + FAR int *dst_buff_len, int mode) +{ + MD5Update((MD5_CTX *)dst_buff, (unsigned char *)src_buff, src_buff_len); +} +#endif + +/**************************************************************************** + * Name: calc_codec_buffsize + ****************************************************************************/ + +static int calc_codec_buffsize(int src_buffsize, uint8_t mode) +{ + switch (mode) + { + case CODEC_MODE_URLENCODE: + return src_buffsize*3+1; + case CODEC_MODE_URLDECODE: + return src_buffsize+1; + case CODEC_MODE_BASE64ENC: + return ((src_buffsize + 2)/ 3 * 4)+1; + case CODEC_MODE_BASE64DEC: + return (src_buffsize / 4 * 3 + 2)+1; + case CODEC_MODE_HASH_MD5: + return 32+1; + default: + return src_buffsize+1; + } +} + +/**************************************************************************** + * Name: cmd_codecs_proc + ****************************************************************************/ + +static int cmd_codecs_proc(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv, + uint8_t mode, codec_callback_t func) +{ +#if defined(CONFIG_CODECS_HASH_MD5) && !defined(CONFIG_NSH_DISABLE_MD5) + static const unsigned char hex_chars[] = "0123456789abcdef"; + MD5_CTX ctx; + unsigned char mac[16]; + char *pSrc; + char *pDest; +#endif + + char *localfile = NULL; + char *src_buffer = NULL; + char *buffer = NULL; + char *fullpath = NULL; + const char *fmt; + char *s_data; + bool badarg = false; + bool is_file = false; + bool is_websafe=false; + int option; + int fd = -1; + int buff_len = 0; + int src_buff_len = 0; + int i = 0; + int ret = OK; + + /* Get the command options */ + + while ((option = getopt(argc, argv, ":fw")) != ERROR) + { + switch (option) + { + case 'f': + is_file = true; + break; + +#ifdef CONFIG_CODECS_BASE64 + case 'w': + is_websafe = true; + + if (!(mode == CODEC_MODE_BASE64ENC || mode == CODEC_MODE_BASE64DEC)) + { + badarg = true; + } + break; +#endif + case ':': + nsh_output(vtbl, g_fmtargrequired, argv[0]); + badarg = true; + break; + + case '?': + default: + nsh_output(vtbl, g_fmtarginvalid, argv[0]); + badarg = true; + break; + } + } + + /* If a bad argument was encountered, then return without processing the command */ + + if (badarg) + { + return ERROR; + } + + /* There should be exactly on parameter left on the command-line */ + + if (optind == argc-1) + { + s_data = argv[optind]; + } + else if (optind >= argc) + { + fmt = g_fmttoomanyargs; + goto errout; + } + else + { + fmt = g_fmtargrequired; + goto errout; + } + +#if defined(CONFIG_CODECS_HASH_MD5) && !defined(CONFIG_NSH_DISABLE_MD5) + if (mode == CODEC_MODE_HASH_MD5) + { + MD5Init(&ctx); + } +#endif + + if (is_file) + { + /* Get the local file name */ + + localfile = s_data; + + /* Get the full path to the local file */ + + fullpath = nsh_getfullpath(vtbl, localfile); + + /* Open the local file for writing */ + + fd = open(fullpath, O_RDONLY|O_TRUNC, 0644); + if (fd < 0) + { + nsh_output(vtbl, g_fmtcmdfailed, argv[0], "open", NSH_ERRNO); + ret = ERROR; + goto exit; + } + + src_buffer = malloc(CONFIG_NSH_CODECS_BUFSIZE+2); +#if defined(CONFIG_CODECS_BASE64) && !defined(CONFIG_NSH_DISABLE_BASE64ENC) + if (mode == CODEC_MODE_BASE64ENC) + { + src_buff_len = CONFIG_NSH_CODECS_BUFSIZE / 3 * 3; + } + else +#endif + { + src_buff_len = CONFIG_NSH_CODECS_BUFSIZE; + } + + buff_len = calc_codec_buffsize(src_buff_len+2, mode); + buffer = malloc(buff_len); + while(true) + { + memset(src_buffer, 0, src_buff_len+2); + ret=read(fd, src_buffer, src_buff_len); + if (ret < 0) + { + nsh_output(vtbl, g_fmtcmdfailed, argv[0], "read", NSH_ERRNO); + ret = ERROR; + goto exit; + } + else if(ret==0) + { + break; + } + +#if defined(CONFIG_CODECS_URLCODE) && !defined(CONFIG_NSH_DISABLE_URLDECODE) + if (mode == CODEC_MODE_URLDECODE) + { + if (src_buffer[src_buff_len-1]=='%') + { + ret += read(fd,&src_buffer[src_buff_len],2); + } + else if (src_buffer[src_buff_len-2]=='%') + { + ret += read(fd,&src_buffer[src_buff_len],1); + } + } +#endif + memset(buffer, 0, buff_len); + if (func) + { +#if defined(CONFIG_CODECS_HASH_MD5) && !defined(CONFIG_NSH_DISABLE_MD5) + if (mode == CODEC_MODE_HASH_MD5) + { + func(src_buffer, ret, (char *)&ctx, &buff_len,0); + } + else +#endif + { + func(src_buffer, ret, buffer, &buff_len,(is_websafe)?1:0); + nsh_output(vtbl, "%s", buffer); + } + } + + buff_len = calc_codec_buffsize(src_buff_len+2, mode); + } + +#if defined(CONFIG_CODECS_HASH_MD5) && !defined(CONFIG_NSH_DISABLE_MD5) + if (mode == CODEC_MODE_HASH_MD5) + { + MD5Final(mac, &ctx); + pSrc = (char *)&mac; + pDest = buffer; + for(i=0;i<16;i++,pSrc++) + { + *pDest++ = hex_chars[(*pSrc) >> 4]; + *pDest++ = hex_chars[(*pSrc) & 0x0f]; + } + + *pDest='\0'; + nsh_output(vtbl, "%s\n", buffer); + } +#endif + ret = OK; + goto exit; + } + else + { + src_buffer = s_data; + src_buff_len = strlen(s_data); + buff_len = calc_codec_buffsize(src_buff_len, mode); + buffer = malloc(buff_len); + buffer[0]=0; + if (!buffer) + { + fmt = g_fmtcmdoutofmemory; + goto errout; + } + + memset(buffer, 0, buff_len); + if (func) + { +#if defined(CONFIG_CODECS_HASH_MD5) && !defined(CONFIG_NSH_DISABLE_MD5) + if (mode == CODEC_MODE_HASH_MD5) + { + func(src_buffer, src_buff_len, (char *)&ctx, &buff_len, 0); + MD5Final(mac, &ctx); + pSrc = (char *)&mac; + pDest = buffer; + for(i=0;i<16;i++,pSrc++) + { + *pDest++ = hex_chars[(*pSrc) >> 4]; + *pDest++ = hex_chars[(*pSrc) & 0x0f]; + } + + *pDest='\0'; + } + else +#endif + { + func(src_buffer, src_buff_len, buffer, &buff_len,(is_websafe)?1:0); + } + } + + nsh_output(vtbl, "%s\n",buffer); + src_buffer = NULL; + goto exit; + } + +exit: + if (fd >= 0) + { + close(fd); + } + + if (fullpath) + { + free(fullpath); + } + + if (src_buffer) + { + free(src_buffer); + } + + if (buffer) + { + free(buffer); + } + + return ret; + +errout: + nsh_output(vtbl, fmt, argv[0]); + ret = ERROR; + goto exit; +} + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: cmd_urlencode + ****************************************************************************/ + +#if defined(CONFIG_CODECS_URLCODE) && !defined(CONFIG_NSH_DISABLE_URLENCODE) +int cmd_urlencode(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv) +{ + return cmd_codecs_proc(vtbl, argc, argv, CODEC_MODE_URLENCODE, urlencode_cb); +} +#endif + +/**************************************************************************** + * Name: cmd_urldecode + ****************************************************************************/ + +#if defined(CONFIG_CODECS_URLCODE) && !defined(CONFIG_NSH_DISABLE_URLDECODE) +int cmd_urldecode(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv) +{ + return cmd_codecs_proc(vtbl, argc, argv, CODEC_MODE_URLDECODE, urldecode_cb); +} +#endif + +/**************************************************************************** + * Name: cmd_base64encode + ****************************************************************************/ + +#if defined(CONFIG_CODECS_BASE64) && !defined(CONFIG_NSH_DISABLE_BASE64ENC) +int cmd_base64encode(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv) +{ + return cmd_codecs_proc(vtbl, argc, argv, CODEC_MODE_BASE64ENC, b64enc_cb); +} +#endif + +/**************************************************************************** + * Name: cmd_base64decode + ****************************************************************************/ + +#if defined(CONFIG_CODECS_BASE64) && !defined(CONFIG_NSH_DISABLE_BASE64DEC) +int cmd_base64decode(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv) +{ + return cmd_codecs_proc(vtbl, argc, argv, CODEC_MODE_BASE64DEC, b64dec_cb); +} +#endif + +/**************************************************************************** + * Name: cmd_md5 + ****************************************************************************/ + +#if defined(CONFIG_CODECS_HASH_MD5) && !defined(CONFIG_NSH_DISABLE_MD5) +int cmd_md5(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv) +{ + return cmd_codecs_proc(vtbl,argc,argv,CODEC_MODE_HASH_MD5,md5_cb); +} +#endif + +#endif /* CONFIG_NETUTILS_CODECS */ diff --git a/apps/nshlib/nsh_parse.c b/apps/nshlib/nsh_parse.c index 70fa39f62a..15723b497c 100644 --- a/apps/nshlib/nsh_parse.c +++ b/apps/nshlib/nsh_parse.c @@ -1,7 +1,7 @@ /**************************************************************************** * apps/nshlib/nsh_parse.c * - * Copyright (C) 2007-2012 Gregory Nutt. All rights reserved. + * Copyright (C) 2007-2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -72,7 +72,7 @@ /* Argument list size * - * argv[0]: The command name. + * argv[0]: The command name. * argv[1]: The beginning of argument (up to CONFIG_NSH_MAXARGUMENTS) * argv[argc-3]: Possibly '>' or '>>' * argv[argc-2]: Possibly @@ -226,7 +226,7 @@ static const struct cmdmap_s g_cmdmap[] = { "help", cmd_help, 1, 3, "[-v] []" }, # endif #endif - + #if CONFIG_NFILE_DESCRIPTORS > 0 #ifndef CONFIG_NSH_DISABLE_HEXDUMP { "hexdump", cmd_hexdump, 2, 2, "" }, @@ -723,15 +723,11 @@ static int cmd_exit(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv) * Name: nsh_execute * * Description: - * Exectue the command in argv[0] + * Execute the command in argv[0] * * Returned Value: - * <0 If exec_builtin() fails, then the negated errno value - * is returned. * -1 (ERRROR) if the command was unsuccessful * 0 (OK) if the command was successful - * 1 if an application task was spawned successfully, but - * returned failure exit status. * ****************************************************************************/ @@ -751,21 +747,6 @@ static int nsh_execute(FAR struct nsh_vtbl_s *vtbl, int argc, char *argv[]) */ cmd = argv[0]; - - /* Try to find a command in the application library. */ - -#ifdef CONFIG_NSH_BUILTIN_APPS - ret = nsh_execapp(vtbl, cmd, argv); - - /* If the built-in application was successfully started, return OK - * or 1 (if the application returned a non-zero exit status). - */ - - if (ret >= 0) - { - return ret; - } -#endif /* See if the command is one that we understand */ @@ -1352,7 +1333,7 @@ int nsh_parse(FAR struct nsh_vtbl_s *vtbl, char *cmdline) /* Parse all of the arguments following the command name. The form * of argv is: * - * argv[0]: The command name. + * argv[0]: The command name. * argv[1]: The beginning of argument (up to CONFIG_NSH_MAXARGUMENTS) * argv[argc-3]: Possibly '>' or '>>' * argv[argc-2]: Possibly @@ -1410,6 +1391,47 @@ int nsh_parse(FAR struct nsh_vtbl_s *vtbl, char *cmdline) } } + /* Check if the maximum number of arguments was exceeded */ + + if (argc > CONFIG_NSH_MAXARGUMENTS) + { + nsh_output(vtbl, g_fmttoomanyargs, cmd); + } + + /* Does this command correspond to a builtin command? + * nsh_builtin() returns: + * + * -1 (ERROR) if the application task corresponding to 'argv[0]' could not + * be started (possibly because it doesn not exist). + * 0 (OK) if the application task corresponding to 'argv[0]' was + * and successfully started. If CONFIG_SCHED_WAITPID is + * defined, this return value also indicates that the + * application returned successful status (EXIT_SUCCESS) + * 1 If CONFIG_SCHED_WAITPID is defined, then this return value + * indicates that the application task was spawned successfully + * but returned failure exit status. + * + * Note the priority if not effected by nice-ness. + */ + +#ifdef CONFIG_NSH_BUILTIN_APPS + ret = nsh_builtin(vtbl, argv[0], argv, redirfile, oflags); + if (ret >= 0) + { + /* nsh_builtin() returned 0 or 1. This means that the builtin + * command was successfully started (although it may not have ran + * successfully). So certainly it is not an NSH command. + */ + + return nsh_saveresult(vtbl, ret != OK); + } + + /* No, not a built in command (or, at least, we were unable to start a + * builtin command of that name). Treat it like an NSH command. + */ + +#endif + /* Redirected output? */ if (vtbl->np.np_redirect) @@ -1431,23 +1453,13 @@ int nsh_parse(FAR struct nsh_vtbl_s *vtbl, char *cmdline) } } - /* Check if the maximum number of arguments was exceeded */ - - if (argc > CONFIG_NSH_MAXARGUMENTS) - { - nsh_output(vtbl, g_fmttoomanyargs, cmd); - } - /* Handle the case where the command is executed in background. * However is app is to be started as builtin new process will - * be created anyway, so skip this step. */ + * be created anyway, so skip this step. + */ #ifndef CONFIG_NSH_DISABLEBG - if (vtbl->np.np_bg -#ifdef CONFIG_NSH_BUILTIN_APPS - && builtin_isavail(argv[0]) < 0 -#endif - ) + if (vtbl->np.np_bg) { struct sched_param param; struct nsh_vtbl_s *bkgvtbl; @@ -1514,6 +1526,7 @@ int nsh_parse(FAR struct nsh_vtbl_s *vtbl, char *cmdline) priority = min_priority; } } + param.sched_priority = priority; } @@ -1553,8 +1566,6 @@ int nsh_parse(FAR struct nsh_vtbl_s *vtbl, char *cmdline) * * -1 (ERRROR) if the command was unsuccessful * 0 (OK) if the command was successful - * 1 if an application task was spawned successfully, but - * returned failure exit status. */ ret = nsh_execute(vtbl, argc, argv); @@ -1568,11 +1579,11 @@ int nsh_parse(FAR struct nsh_vtbl_s *vtbl, char *cmdline) nsh_undirect(vtbl, save); } - /* Treat both errors and non-zero return codes as "errors" so that - * it is possible to test for non-zero returns in nsh scripts. + /* Mark errors so that it is possible to test for non-zero return values + * in nsh scripts. */ - if (ret != OK) + if (ret < 0) { goto errout; } diff --git a/nuttx/configs/sim/nsh/defconfig b/nuttx/configs/sim/nsh/defconfig index 794b3107df..cec10459ad 100644 --- a/nuttx/configs/sim/nsh/defconfig +++ b/nuttx/configs/sim/nsh/defconfig @@ -73,7 +73,7 @@ CONFIG_SCHED_WORKPRIORITY=192 CONFIG_SCHED_WORKPERIOD=50000 CONFIG_SCHED_WORKSTACKSIZE=1024 CONFIG_SIG_SIGWORK=17 -CONFIG_SCHED_WAITPID=n +CONFIG_SCHED_WAITPID=y CONFIG_SCHED_ATEXIT=n CONFIG_SCHED_ONEXIT=n @@ -224,6 +224,7 @@ CONFIG_EXAMPLES_OSTEST_STACKSIZE=8192 # # Settings for apps/nshlib # +CONFIG_NSH_BUILTIN_APPS=n CONFIG_NSH_FILEIOSIZE=1024 CONFIG_NSH_STRERROR=n CONFIG_NSH_LINELEN=80 diff --git a/nuttx/configs/vsn/src/README.txt b/nuttx/configs/vsn/src/README.txt index 87a538a109..732ede5e62 100644 --- a/nuttx/configs/vsn/src/README.txt +++ b/nuttx/configs/vsn/src/README.txt @@ -12,8 +12,7 @@ Execution starts in the following order: is set. It must be set for the VSN board. - boot, performs initial chip and board initialization - - sched/os_bringup.c then calls either user_start or exec_builtin() - with application as set in the .config + - sched/os_bringup.c then calls user entry defined in the .config file. Naming throughout the code diff --git a/nuttx/fs/fat/fs_fat32.c b/nuttx/fs/fat/fs_fat32.c index 7164a9f8fb..c10c28a5c5 100644 --- a/nuttx/fs/fat/fs_fat32.c +++ b/nuttx/fs/fat/fs_fat32.c @@ -1314,15 +1314,16 @@ static int fat_dup(FAR const struct file *oldp, FAR struct file *newp) * file is re-opened. */ - newff->ff_bflags = 0; - newff->ff_oflags = oldff->ff_oflags; - newff->ff_sectorsincluster = oldff->ff_sectorsincluster; - newff->ff_dirindex = oldff->ff_dirindex; - newff->ff_currentcluster = oldff->ff_currentcluster; - newff->ff_dirsector = oldff->ff_dirsector; - newff->ff_size = oldff->ff_size; - newff->ff_currentsector = 0; - newff->ff_cachesector = 0; + newff->ff_bflags = 0; /* File buffer flags */ + newff->ff_oflags = oldff->ff_oflags; /* File open flags */ + newff->ff_sectorsincluster = oldff->ff_sectorsincluster; /* Sectors remaining in cluster */ + newff->ff_dirindex = oldff->ff_dirindex; /* Index to directory entry */ + newff->ff_currentcluster = oldff->ff_currentcluster; /* Current cluster */ + newff->ff_dirsector = oldff->ff_dirsector; /* Sector containing directory entry */ + newff->ff_size = oldff->ff_size; /* Size of the file */ + newff->ff_startcluster = oldff->ff_startcluster; /* Start cluster of file on media */ + newff->ff_currentsector = oldff->ff_currentsector; /* Current sector */ + newff->ff_cachesector = 0; /* Sector in file buffer */ /* Attach the private date to the struct file instance */ diff --git a/nuttx/fs/romfs/fs_romfs.c b/nuttx/fs/romfs/fs_romfs.c index 2814aa49d0..6a6fca3551 100644 --- a/nuttx/fs/romfs/fs_romfs.c +++ b/nuttx/fs/romfs/fs_romfs.c @@ -56,6 +56,7 @@ #include #include +#include #include #include #include @@ -225,7 +226,7 @@ static int romfs_open(FAR struct file *filep, FAR const char *relpath, * file. */ - rf = (FAR struct romfs_file_s *)zalloc(sizeof(struct romfs_file_s)); + rf = (FAR struct romfs_file_s *)kzalloc(sizeof(struct romfs_file_s)); if (!rf) { fdbg("Failed to allocate private data\n", ret); @@ -317,12 +318,12 @@ static int romfs_close(FAR struct file *filep) if (!rm->rm_xipbase && rf->rf_buffer) { - free(rf->rf_buffer); + kfree(rf->rf_buffer); } /* Then free the file structure itself. */ - free(rf); + kfree(rf); filep->f_priv = NULL; return ret; } @@ -915,7 +916,7 @@ static int romfs_bind(FAR struct inode *blkdriver, FAR const void *data, /* Create an instance of the mountpt state structure */ - rm = (FAR struct romfs_mountpt_s *)zalloc(sizeof(struct romfs_mountpt_s)); + rm = (FAR struct romfs_mountpt_s *)kzalloc(sizeof(struct romfs_mountpt_s)); if (!rm) { fdbg("Failed to allocate mountpoint structure\n"); @@ -959,12 +960,12 @@ static int romfs_bind(FAR struct inode *blkdriver, FAR const void *data, errout_with_buffer: if (!rm->rm_xipbase) { - free(rm->rm_buffer); + kfree(rm->rm_buffer); } errout_with_sem: sem_destroy(&rm->rm_sem); - free(rm); + kfree(rm); return ret; } @@ -1031,11 +1032,11 @@ static int romfs_unbind(FAR void *handle, FAR struct inode **blkdriver) if (!rm->rm_xipbase && rm->rm_buffer) { - free(rm->rm_buffer); + kfree(rm->rm_buffer); } sem_destroy(&rm->rm_sem); - free(rm); + kfree(rm); return OK; } From 77efc9f9cdd5828ab724b3355f0f0737bb15b579 Mon Sep 17 00:00:00 2001 From: patacongo Date: Wed, 16 Jan 2013 14:14:14 +0000 Subject: [PATCH 075/118] BINFS now supports open, close, and FIOC_FILENAME ioctl git-svn-id: http://svn.code.sf.net/p/nuttx/code/trunk@5522 42af7a65-404d-4744-a932-0658087f49c3 --- apps/ChangeLog.txt | 4 + apps/builtin/binfs.c | 331 +++++++------------------------ apps/include/apps.h | 3 + nuttx/TODO | 21 +- nuttx/binfmt/binfmt_execmodule.c | 14 +- nuttx/fs/nfs/nfs_vfsops.c | 61 +++--- nuttx/fs/nxffs/nxffs_open.c | 3 +- nuttx/include/nuttx/fs/binfs.h | 80 ++++++++ nuttx/include/nuttx/fs/ioctl.h | 1 + 9 files changed, 216 insertions(+), 302 deletions(-) create mode 100644 nuttx/include/nuttx/fs/binfs.h diff --git a/apps/ChangeLog.txt b/apps/ChangeLog.txt index ea4fcd07b9..f91dc318b7 100644 --- a/apps/ChangeLog.txt +++ b/apps/ChangeLog.txt @@ -469,3 +469,7 @@ * builtin/binfs.c: Add hooks for dup() method (not implemented). * builtin/exec_builtin.c, nshlib/nsh_parse.c, and nshlib/nsh_builtin.c: NSH now supports re-direction of I/O to files (but still not from). + * builtin/binfs.c: Greatly simplified (it is going to need to be + very lightweight). Now supports open, close, and a new ioctl to recover + the builtin filename. The latter will be needed to support a binfs + binfmt. diff --git a/apps/builtin/binfs.c b/apps/builtin/binfs.c index 1fc2e7940f..611e2b3bb0 100644 --- a/apps/builtin/binfs.c +++ b/apps/builtin/binfs.c @@ -45,7 +45,6 @@ #include #include -#include #include #include #include @@ -53,8 +52,11 @@ #include #include +#include #include +#include + #include "builtin.h" #if !defined(CONFIG_DISABLE_MOUNTPOINT) && defined(CONFIG_APPS_BINDIR) @@ -63,24 +65,12 @@ * Private Types ****************************************************************************/ -/* This structure represents the overall mountpoint state. An instance of this - * structure is retained as inode private data on each mountpoint that is - * mounted with a fat32 filesystem. - */ - -struct binfs_state_s -{ - sem_t bm_sem; /* Used to assume thread-safe access */ -}; - /**************************************************************************** * Private Function Prototypes ****************************************************************************/ -static void binfs_semtake(struct binfs_state_s *bm); -static inline void binfs_semgive(struct binfs_state_s *bm); static int binfs_open(FAR struct file *filep, const char *relpath, - int oflags, mode_t mode); + int oflags, mode_t mode); static int binfs_close(FAR struct file *filep); static ssize_t binfs_read(FAR struct file *filep, char *buffer, size_t buflen); static int binfs_ioctl(FAR struct file *filep, int cmd, unsigned long arg); @@ -89,15 +79,19 @@ static int binfs_dup(FAR const struct file *oldp, FAR struct file *newp); static int binfs_opendir(struct inode *mountpt, const char *relpath, struct fs_dirent_s *dir); -static int binfs_readdir(struct inode *mountpt, struct fs_dirent_s *dir); -static int binfs_rewinddir(struct inode *mountpt, struct fs_dirent_s *dir); +static int binfs_readdir(FAR struct inode *mountpt, + FAR struct fs_dirent_s *dir); +static int binfs_rewinddir(FAR struct inode *mountpt, + FAR struct fs_dirent_s *dir); -static int binfs_bind(FAR struct inode *blkdriver, const void *data, - void **handle); -static int binfs_unbind(void *handle, FAR struct inode **blkdriver); -static int binfs_statfs(struct inode *mountpt, struct statfs *buf); +static int binfs_bind(FAR struct inode *blkdriver, FAR const void *data, + FAR void **handle); +static int binfs_unbind(FAR void *handle, FAR struct inode **blkdriver); +static int binfs_statfs(FAR struct inode *mountpt, + FAR struct statfs *buf); -static int binfs_stat(struct inode *mountpt, const char *relpath, struct stat *buf); +static int binfs_stat(FAR struct inode *mountpt, FAR const char *relpath, + FAR struct stat *buf); /**************************************************************************** * Private Variables @@ -144,71 +138,42 @@ const struct mountpt_operations binfs_operations = * Private Functions ****************************************************************************/ -/**************************************************************************** - * Name: binfs_semtake - ****************************************************************************/ - -static void binfs_semtake(struct binfs_state_s *bm) -{ - /* Take the semaphore (perhaps waiting) */ - - while (sem_wait(&bm->bm_sem) != 0) - { - /* The only case that an error should occur here is if - * the wait was awakened by a signal. - */ - - ASSERT(errno == EINTR); - } -} - -/**************************************************************************** - * Name: binfs_semgive - ****************************************************************************/ - -static inline void binfs_semgive(struct binfs_state_s *bm) -{ - sem_post(&bm->bm_sem); -} - /**************************************************************************** * Name: binfs_open ****************************************************************************/ -static int binfs_open(FAR struct file *filep, const char *relpath, - int oflags, mode_t mode) +static int binfs_open(FAR struct file *filep, FAR const char *relpath, + int oflags, mode_t mode) { - struct binfs_state_s *bm; - int ret = -ENOSYS; + int index; fvdbg("Open '%s'\n", relpath); - /* Sanity checks */ - - DEBUGASSERT(filep->f_priv == NULL && filep->f_inode != NULL); - - /* mountpoint private data from the inode reference from the file - * structure - */ - - bm = (struct binfs_state_s*)filep->f_inode->i_private; - DEBUGASSERT(bm != NULL); - /* BINFS is read-only. Any attempt to open with any kind of write * access is not permitted. */ if ((oflags & O_WRONLY) != 0 || (oflags & O_RDONLY) == 0) { - fdbg("Only O_RDONLY supported\n"); - ret = -EACCES; + fdbg("ERROR: Only O_RDONLY supported\n"); + return -EACCES; } - /* Save open-specific state in filep->f_priv */ + /* Check if the an entry exists with this name in the root directory. + * so the 'relpath' must be the name of the builtin function. + */ - /* Opening of elements within the pseudo-file system is not yet supported */ + index = builtin_isavail(relpath); + if (index < 0) + { + fdbg("ERROR: Builting %s does not exist\n", relpath); + return -ENOENT; + } - return ret; + /* Save the index as the open-specific state in filep->f_priv */ + + filep->f_priv = (FAR void *)index; + return OK; } /**************************************************************************** @@ -217,31 +182,8 @@ static int binfs_open(FAR struct file *filep, const char *relpath, static int binfs_close(FAR struct file *filep) { - struct binfs_state_s *bm; - int ret = -ENOSYS; - fvdbg("Closing\n"); - - /* Sanity checks */ - - DEBUGASSERT(filep->f_priv != NULL && filep->f_inode != NULL); - - /* Recover the open file state from the struct file instance */ - /* bf = filep->f_priv; */ - - /* Recover the file system state from the inode */ - - bm = filep->f_inode->i_private; - DEBUGASSERT(bm != NULL); - - /* Free the open file state */ - /* free(bf); */ - - filep->f_priv = NULL; - - /* Since open() is not yet supported, neither is close(). */ - - return ret; + return OK; } /**************************************************************************** @@ -250,25 +192,10 @@ static int binfs_close(FAR struct file *filep) static ssize_t binfs_read(FAR struct file *filep, char *buffer, size_t buflen) { - struct binfs_state_s *bm; + /* Reading is not supported. Just return end-of-file */ fvdbg("Read %d bytes from offset %d\n", buflen, filep->f_pos); - - /* Sanity checks */ - - DEBUGASSERT(filep->f_priv != NULL && filep->f_inode != NULL); - - /* Recover the open file state data from the struct file instance */ - /* bf = filep->f_priv; */ - - /* Recover the file system state from the inode */ - - bm = filep->f_inode->i_private; - DEBUGASSERT(bm != NULL); - - /* Since open is not yet supported, neither is reading */ - - return -ENOSYS; + return 0; } /**************************************************************************** @@ -277,25 +204,36 @@ static ssize_t binfs_read(FAR struct file *filep, char *buffer, size_t buflen) static int binfs_ioctl(FAR struct file *filep, int cmd, unsigned long arg) { - struct binfs_state_s *bm; + int ret; fvdbg("cmd: %d arg: %08lx\n", cmd, arg); - /* Sanity checks */ + /* Only one IOCTL command is supported */ - DEBUGASSERT(filep->f_priv != NULL && filep->f_inode != NULL); + if (cmd == FIOC_FILENAME) + { + /* IN: FAR char const ** pointer + * OUT: Pointer to a persistent file name (Guaranteed to persist while + * the file is open). + */ - /* Recover the open file state from the struct file instance */ - /* bf = filep->f_priv; */ + FAR const char **ptr = (FAR const char **)((uintptr_t)arg); + if (ptr == NULL) + { + ret = -EINVAL; + } + else + { + *ptr = g_builtins[(int)filep->f_priv].name; + ret = OK; + } + } + else + { + ret = -ENOTTY; + } - /* Recover the file system state from the inode */ - - bm = filep->f_inode->i_private; - DEBUGASSERT(bm != NULL); - - /* No ioctl commands yet supported */ - - return -ENOTTY; + return ret; } /**************************************************************************** @@ -308,27 +246,12 @@ static int binfs_ioctl(FAR struct file *filep, int cmd, unsigned long arg) static int binfs_dup(FAR const struct file *oldp, FAR struct file *newp) { - struct binfs_state_s *bm; - int ret = -ENOSYS; - fvdbg("Dup %p->%p\n", oldp, newp); - /* Sanity checks */ + /* Copy the index from the old to the new file structure */ - DEBUGASSERT(oldp->f_priv == NULL && oldp->f_inode != NULL); - - /* mountpoint private data from the inode reference from the file - * structure - */ - - bm = (struct binfs_state_s*)oldp->f_inode->i_private; - DEBUGASSERT(bm != NULL); - - /* Opening of elements within the pseudo-file system is not yet supported - * and, hence, neither is dup'ing the opened file. - */ - - return ret; + newp->f_priv = oldp->f_priv; + return OK; } /**************************************************************************** @@ -342,36 +265,19 @@ static int binfs_dup(FAR const struct file *oldp, FAR struct file *newp) static int binfs_opendir(struct inode *mountpt, const char *relpath, struct fs_dirent_s *dir) { - struct binfs_state_s *bm; - int ret; - fvdbg("relpath: \"%s\"\n", relpath ? relpath : "NULL"); - /* Sanity checks */ - - DEBUGASSERT(mountpt != NULL && mountpt->i_private != NULL); - - /* Recover the file system state from the inode instance */ - - bm = mountpt->i_private; - binfs_semtake(bm); - /* The requested directory must be the volume-relative "root" directory */ if (relpath && relpath[0] != '\0') { - ret = -ENOENT; - goto errout_with_semaphore; + return -ENOENT; } /* Set the index to the first entry */ dir->u.binfs.fb_index = 0; - ret = OK; - -errout_with_semaphore: - binfs_semgive(bm); - return ret; + return OK; } /**************************************************************************** @@ -383,19 +289,9 @@ errout_with_semaphore: static int binfs_readdir(struct inode *mountpt, struct fs_dirent_s *dir) { - struct binfs_state_s *bm; unsigned int index; int ret; - /* Sanity checks */ - - DEBUGASSERT(mountpt != NULL && mountpt->i_private != NULL); - - /* Recover the file system state from the inode instance */ - - bm = mountpt->i_private; - binfs_semtake(bm); - /* Have we reached the end of the directory */ index = dir->u.binfs.fb_index; @@ -426,11 +322,10 @@ static int binfs_readdir(struct inode *mountpt, struct fs_dirent_s *dir) * standard f_pos instead of our own private fb_index. */ - dir->u.binfs.fb_index = index; - ret = OK; + dir->u.binfs.fb_index = index; + ret = OK; } - binfs_semgive(bm); return ret; } @@ -443,22 +338,9 @@ static int binfs_readdir(struct inode *mountpt, struct fs_dirent_s *dir) static int binfs_rewinddir(struct inode *mountpt, struct fs_dirent_s *dir) { - struct binfs_state_s *bm; - fvdbg("Entry\n"); - /* Sanity checks */ - - DEBUGASSERT(mountpt != NULL && mountpt->i_private != NULL); - - /* Recover the file system state from the inode instance */ - - bm = mountpt->i_private; - binfs_semtake(bm); - - dir->u.binfs.fb_index = 0; - - binfs_semgive(bm); + dir->u.binfs.fb_index = 0; return OK; } @@ -476,29 +358,7 @@ static int binfs_rewinddir(struct inode *mountpt, struct fs_dirent_s *dir) static int binfs_bind(FAR struct inode *blkdriver, const void *data, void **handle) { - struct binfs_state_s *bm; - fvdbg("Entry\n"); - - /* Create an instance of the mountpt state structure */ - - bm = (struct binfs_state_s *)zalloc(sizeof(struct binfs_state_s)); - if (!bm) - { - fdbg("Failed to allocate mountpoint structure\n"); - return -ENOMEM; - } - - /* Initialize the allocated mountpt state structure. The filesystem is - * responsible for one reference ont the blkdriver inode and does not - * have to addref() here (but does have to release in ubind(). - */ - - sem_init(&bm->bm_sem, 0, 1); /* Initialize the semaphore that controls access */ - - /* Mounted! */ - - *handle = (void*)bm; return OK; } @@ -512,22 +372,7 @@ static int binfs_bind(FAR struct inode *blkdriver, const void *data, static int binfs_unbind(void *handle, FAR struct inode **blkdriver) { - struct binfs_state_s *bm = (struct binfs_state_s*)handle; - fvdbg("Entry\n"); - -#ifdef CONFIG_DEBUG - if (!bm) - { - return -EINVAL; - } -#endif - - /* Check if there are sill any files opened on the filesystem. */ - - /* Release the mountpoint private data */ - - sem_destroy(&bm->bm_sem); return OK; } @@ -540,19 +385,8 @@ static int binfs_unbind(void *handle, FAR struct inode **blkdriver) static int binfs_statfs(struct inode *mountpt, struct statfs *buf) { - struct binfs_state_s *bm; - fvdbg("Entry\n"); - /* Sanity checks */ - - DEBUGASSERT(mountpt && mountpt->i_private); - - /* Get the mountpoint private data from the inode structure */ - - bm = mountpt->i_private; - binfs_semtake(bm); - /* Fill in the statfs info */ memset(buf, 0, sizeof(struct statfs)); @@ -562,8 +396,6 @@ static int binfs_statfs(struct inode *mountpt, struct statfs *buf) buf->f_bfree = 0; buf->f_bavail = 0; buf->f_namelen = NAME_MAX; - - binfs_semgive(bm); return OK; } @@ -576,20 +408,8 @@ static int binfs_statfs(struct inode *mountpt, struct statfs *buf) static int binfs_stat(struct inode *mountpt, const char *relpath, struct stat *buf) { - struct binfs_state_s *bm; - int ret; - fvdbg("Entry\n"); - /* Sanity checks */ - - DEBUGASSERT(mountpt && mountpt->i_private); - - /* Get the mountpoint private data from the inode structure */ - - bm = mountpt->i_private; - binfs_semtake(bm); - /* The requested directory must be the volume-relative "root" directory */ if (relpath && relpath[0] != '\0') @@ -598,8 +418,7 @@ static int binfs_stat(struct inode *mountpt, const char *relpath, struct stat *b if (builtin_isavail(relpath) < 0) { - ret = -ENOENT; - goto errout_with_semaphore; + return -ENOENT; } /* It's a execute-only file name */ @@ -615,14 +434,10 @@ static int binfs_stat(struct inode *mountpt, const char *relpath, struct stat *b /* File/directory size, access block size */ - buf->st_size = 0; - buf->st_blksize = 0; - buf->st_blocks = 0; - ret = OK; - -errout_with_semaphore: - binfs_semgive(bm); - return ret; + buf->st_size = 0; + buf->st_blksize = 0; + buf->st_blocks = 0; + return OK; } /**************************************************************************** diff --git a/apps/include/apps.h b/apps/include/apps.h index f806d8aed2..9f1918e574 100644 --- a/apps/include/apps.h +++ b/apps/include/apps.h @@ -48,9 +48,12 @@ ****************************************************************************/ #include + #include #include +#include + /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ diff --git a/nuttx/TODO b/nuttx/TODO index 58ca4cc8e4..248d2dafa7 100644 --- a/nuttx/TODO +++ b/nuttx/TODO @@ -6,7 +6,7 @@ standards, things that could be improved, and ideas for enhancements. nuttx/ - (11) Task/Scheduler (sched/) + (10) Task/Scheduler (sched/) (1) Memory Managment (mm/) (3) Signals (sched/, arch/) (2) pthreads (sched/) @@ -58,16 +58,6 @@ o Task/Scheduler (sched/) Status: Closed. No, this behavior will not be implemented. Priority: Medium, required for good emulation of process/pthread model. - Title: MISSING ERRNO SETTINGS - Description: Several APIs do not set errno. Need to review all APIs. - Update: These are being fixed as they are encountered. There is - no accounting of how many interfaces have this problem. - Status: Open? There has been an effort over the past few years to assure - that all errno settings are in place. What is the current state? - Unknown. - Priority: Medium, required for standard compliance (but makes the - code bigger) - Title: TICKLESS OS Description: On a side note, I have thought about a tick-less timer for the OS for a long time. Basically we could replace the periodic system @@ -178,7 +168,14 @@ o Task/Scheduler (sched/) You would think that this should be a clone of the existing pthread join logic. Howver there is no need for zombies - in NuttX so, the status if the parent has already exit'ed. + in NuttX so no need to keep the status if the parent has + already exit'ed. Other simplifications: + + 1. Keep the array/list of return status in the parent + tasks TCB. + 2. Use a fixed size array of return status (perhaps the + the enire array is allocated so that that is con + penalty for tasks that have no childre. At present, exit status is not retained. If waitpid() is called after the child task has exit'ed it simpley diff --git a/nuttx/binfmt/binfmt_execmodule.c b/nuttx/binfmt/binfmt_execmodule.c index 400451c408..df8da53435 100644 --- a/nuttx/binfmt/binfmt_execmodule.c +++ b/nuttx/binfmt/binfmt_execmodule.c @@ -1,7 +1,7 @@ /**************************************************************************** * binfmt/binfmt_execmodule.c * - * Copyright (C) 2009 Gregory Nutt. All rights reserved. + * Copyright (C) 2009, 2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -47,6 +47,7 @@ #include #include +#include #include #include "os_internal.h" @@ -167,7 +168,7 @@ int exec_module(FAR const struct binary_s *binp, int priority) /* Allocate a TCB for the new task. */ - tcb = (FAR _TCB*)zalloc(sizeof(_TCB)); + tcb = (FAR _TCB*)kzalloc(sizeof(_TCB)); if (!tcb) { err = ENOMEM; @@ -177,7 +178,7 @@ int exec_module(FAR const struct binary_s *binp, int priority) /* Allocate the stack for the new task */ #ifndef CONFIG_CUSTOM_STACK - stack = (FAR uint32_t*)malloc(binp->stacksize); + stack = (FAR uint32_t*)kmalloc(binp->stacksize); if (!tcb) { err = ENOMEM; @@ -201,6 +202,9 @@ int exec_module(FAR const struct binary_s *binp, int priority) goto errout_with_stack; } + /* Note that tcb->flags are not modified. 0=normal task */ + /* tcb->flags |= TCB_FLAG_TTYPE_TASK; */ + /* Add the D-Space address as the PIC base address. By convention, this * must be the first allocated address space. */ @@ -257,14 +261,14 @@ errout_with_stack: #ifndef CONFIG_CUSTOM_STACK tcb->stack_alloc_ptr = NULL; sched_releasetcb(tcb); - free(stack); + kfree(stack); #else sched_releasetcb(tcb); #endif goto errout; errout_with_tcb: - free(tcb); + kfree(tcb); errout: errno = err; bdbg("returning errno: %d\n", err); diff --git a/nuttx/fs/nfs/nfs_vfsops.c b/nuttx/fs/nfs/nfs_vfsops.c index 01e999ac84..2ff4ff9d3f 100644 --- a/nuttx/fs/nfs/nfs_vfsops.c +++ b/nuttx/fs/nfs/nfs_vfsops.c @@ -680,6 +680,7 @@ static int nfs_close(FAR struct file *filep) FAR struct nfsnode *np; FAR struct nfsnode *prev; FAR struct nfsnode *curr; + int ret; /* Sanity checks */ @@ -703,8 +704,7 @@ static int nfs_close(FAR struct file *filep) if (np->n_crefs > 1) { np->n_crefs--; - nfs_semgive(nmp); - return OK; + ret = OK; } /* There are no more references to the file structure. Now we need to @@ -714,38 +714,47 @@ static int nfs_close(FAR struct file *filep) * containted in the mount structure. */ - for (prev = NULL, curr = nmp->nm_head; curr; prev = curr, curr = curr->n_next) - { - /* Check if this node is ours */ + else + { + /* Assume file structure will not be found. This should never happen. */ - if (np == curr) - { - /* Yes.. remove it from the list of file structures */ + ret = -EINVAL; - if (prev) - { - /* Remove from mid-list */ + for (prev = NULL, curr = nmp->nm_head; + curr; + prev = curr, curr = curr->n_next) + { + /* Check if this node is ours */ - prev->n_next = np->n_next; - } - else - { - /* Remove from the head of the list */ + if (np == curr) + { + /* Yes.. remove it from the list of file structures */ - nmp->nm_head = np->n_next; - } + if (prev) + { + /* Remove from mid-list */ - /* Then deallocate the file structure and return success */ + prev->n_next = np->n_next; + } + else + { + /* Remove from the head of the list */ - kfree(np); - nfs_semgive(nmp); - return OK; - } - } + nmp->nm_head = np->n_next; + } - fdbg("ERROR: file structure not found in list: %p\n", np); + /* Then deallocate the file structure and return success */ + + kfree(np); + ret = OK; + break; + } + } + } + + filep->f_priv = NULL; nfs_semgive(nmp); - return EINVAL; + return ret; } /**************************************************************************** diff --git a/nuttx/fs/nxffs/nxffs_open.c b/nuttx/fs/nxffs/nxffs_open.c index b1e99267ff..9fa4ef2e0e 100644 --- a/nuttx/fs/nxffs/nxffs_open.c +++ b/nuttx/fs/nxffs/nxffs_open.c @@ -1188,9 +1188,10 @@ int nxffs_close(FAR struct file *filep) ofile->crefs--; } - filep->f_priv = NULL; + filep->f_priv = NULL; sem_post(&volume->exclsem); + errout: return ret; } diff --git a/nuttx/include/nuttx/fs/binfs.h b/nuttx/include/nuttx/fs/binfs.h new file mode 100644 index 0000000000..6125384a9f --- /dev/null +++ b/nuttx/include/nuttx/fs/binfs.h @@ -0,0 +1,80 @@ +/**************************************************************************** + * include/nuttx/fs/binfs.h + * + * Copyright (C) 2013 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * 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. + * + ****************************************************************************/ + +#ifndef __INCLUDE_NUTTX_FS_BINFS_H +#define __INCLUDE_NUTTX_FS_BINFS_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ +/* This is the BINFS ioctl that can be used to recover the filename + * associated with the builtin task. + */ + +#define FIOC_FILENAME FIOC_USER /* IN: FAR const char ** pointer + * OUT: Pointer to a persistent file name + * (Guaranteed to persist while the file + * is open). + */ + +/**************************************************************************** + * Type Definitions + ****************************************************************************/ + +/**************************************************************************** + * Public Function Prototypes + ****************************************************************************/ + +#ifdef __cplusplus +#define EXTERN extern "C" +extern "C" { +#else +#define EXTERN extern +#endif + +#undef EXTERN +#ifdef __cplusplus +} +#endif + +#endif /* __INCLUDE_NUTTX_FS_BINFS_H */ diff --git a/nuttx/include/nuttx/fs/ioctl.h b/nuttx/include/nuttx/fs/ioctl.h index 19f29b1fb6..8f2fdd7d93 100644 --- a/nuttx/include/nuttx/fs/ioctl.h +++ b/nuttx/include/nuttx/fs/ioctl.h @@ -105,6 +105,7 @@ #define FIOC_OPTIMIZE _FIOC(0x0003) /* IN: None * OUT: None */ +#define FIOC_USER _FIOC(0x0004) /* File system-specific */ /* NuttX file system ioctl definitions **************************************/ From 4f7967b4c678bef1a42eda3acf739c8bbefd9a07 Mon Sep 17 00:00:00 2001 From: patacongo Date: Wed, 16 Jan 2013 15:41:27 +0000 Subject: [PATCH 076/118] apps/builtin/binfs.c moved to nuttx/fs/binfs/fs_binfs.c git-svn-id: http://svn.code.sf.net/p/nuttx/code/trunk@5523 42af7a65-404d-4744-a932-0658087f49c3 --- apps/ChangeLog.txt | 2 + apps/builtin/Kconfig | 14 ------ apps/builtin/Makefile | 4 -- apps/builtin/builtin.c | 2 + apps/builtin/exec_builtin.c | 3 +- apps/include/apps.h | 17 ------- apps/nshlib/nsh_mntcmds.c | 2 +- nuttx/ChangeLog | 3 +- nuttx/configs/sim/README.txt | 7 +-- nuttx/configs/sim/nsh/appconfig | 3 ++ nuttx/configs/sim/nsh/defconfig | 12 +++-- nuttx/configs/vsn/nsh/defconfig | 2 +- nuttx/fs/Kconfig | 3 +- nuttx/fs/Makefile | 15 ++++-- nuttx/fs/binfs/Kconfig | 19 ++++++++ nuttx/fs/binfs/Make.defs | 48 +++++++++++++++++++ .../binfs.c => nuttx/fs/binfs/fs_binfs.c | 9 ++-- nuttx/fs/fat/Make.defs | 9 ++-- nuttx/fs/fs_mount.c | 13 +++-- nuttx/fs/mmap/Make.defs | 9 +++- nuttx/fs/nfs/Make.defs | 9 ++-- nuttx/fs/nxffs/Make.defs | 9 ++-- nuttx/fs/romfs/Make.defs | 9 ++-- .../include/nuttx/binfmt}/builtin.h | 16 +++++-- nuttx/include/nuttx/fs/binfs.h | 16 ++++++- nuttx/include/nuttx/fs/dirent.h | 6 +-- nuttx/tools/mkconfig.c | 6 +-- 27 files changed, 178 insertions(+), 89 deletions(-) create mode 100644 nuttx/fs/binfs/Kconfig create mode 100644 nuttx/fs/binfs/Make.defs rename apps/builtin/binfs.c => nuttx/fs/binfs/fs_binfs.c (98%) rename {apps/builtin => nuttx/include/nuttx/binfmt}/builtin.h (86%) diff --git a/apps/ChangeLog.txt b/apps/ChangeLog.txt index f91dc318b7..5bc3b21490 100644 --- a/apps/ChangeLog.txt +++ b/apps/ChangeLog.txt @@ -473,3 +473,5 @@ very lightweight). Now supports open, close, and a new ioctl to recover the builtin filename. The latter will be needed to support a binfs binfmt. + * builtin/binfs.c: Move apps/builtin/binfs.c to fs/binfs/fs_binfs.c + CONFIG_APPS_BINDIR rename CONFIG_FS_BINFS diff --git a/apps/builtin/Kconfig b/apps/builtin/Kconfig index 1049712aaf..37150e8a95 100644 --- a/apps/builtin/Kconfig +++ b/apps/builtin/Kconfig @@ -13,20 +13,6 @@ config BUILTIN if BUILTIN - config APPS_BINDIR - bool "BINFS File System" - default n - ---help--- - The BINFS file system is current just a toy. The BINFS may, for example, - be mount at /bin. Then all of the built-in applications will appear as - executable file in /bin if you list them from NSH like: - - nsh> ls -l /bin - - At present, the BINFS supports nothing more than that. It is planned, - however, to support execution of the builtin applications from BINFS as - well (via a binfmt/ loader). However, that is down the road. - config BUILTIN_PROXY_STACKSIZE int "Builtin Proxy Stack Size" default 1024 diff --git a/apps/builtin/Makefile b/apps/builtin/Makefile index 8c89288864..d77054f41f 100644 --- a/apps/builtin/Makefile +++ b/apps/builtin/Makefile @@ -41,10 +41,6 @@ include $(APPDIR)/Make.defs ASRCS = CSRCS = builtin.c exec_builtin.c -ifeq ($(CONFIG_APPS_BINDIR),y) -CSRCS += binfs.c -endif - AOBJS = $(ASRCS:.S=$(OBJEXT)) COBJS = $(CSRCS:.c=$(OBJEXT)) diff --git a/apps/builtin/builtin.c b/apps/builtin/builtin.c index e0ae9888ab..90c0b1353c 100644 --- a/apps/builtin/builtin.c +++ b/apps/builtin/builtin.c @@ -40,6 +40,8 @@ ****************************************************************************/ #include + +#include #include /**************************************************************************** diff --git a/apps/builtin/exec_builtin.c b/apps/builtin/exec_builtin.c index a3e79a9453..6868d7ee7c 100644 --- a/apps/builtin/exec_builtin.c +++ b/apps/builtin/exec_builtin.c @@ -53,10 +53,9 @@ #include #include +#include #include -#include "builtin.h" - /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ diff --git a/apps/include/apps.h b/apps/include/apps.h index 9f1918e574..0fb807c141 100644 --- a/apps/include/apps.h +++ b/apps/include/apps.h @@ -62,14 +62,6 @@ * Public Types ****************************************************************************/ -struct builtin_s -{ - const char *name; /* Invocation name and as seen under /sbin/ */ - int priority; /* Use: SCHED_PRIORITY_DEFAULT */ - int stacksize; /* Desired stack size */ - main_t main; /* Entry point: main(int argc, char *argv[]) */ -}; - /**************************************************************************** * Public Data ****************************************************************************/ @@ -82,15 +74,6 @@ extern "C" { #define EXTERN extern #endif -/* The "bindir" is file system that supports access to the builtin applications. - * It is typically mounted under /bin. - */ - -#ifdef CONFIG_APPS_BINDIR -EXTERN mountpt_operations; -EXTERN const struct mountpt_operations binfs_operations; -#endif - /**************************************************************************** * Public Functions ****************************************************************************/ diff --git a/apps/nshlib/nsh_mntcmds.c b/apps/nshlib/nsh_mntcmds.c index f6eb26c31a..b16ba8465c 100644 --- a/apps/nshlib/nsh_mntcmds.c +++ b/apps/nshlib/nsh_mntcmds.c @@ -131,7 +131,7 @@ static int mount_handler(FAR const char *mountpoint, break; #endif -#ifdef CONFIG_APPS_BINDIR +#ifdef CONFIG_FS_BINFS case BINFS_MAGIC: fstype = "bindir"; break; diff --git a/nuttx/ChangeLog b/nuttx/ChangeLog index 2d2cd82591..ed85f06e1d 100644 --- a/nuttx/ChangeLog +++ b/nuttx/ChangeLog @@ -3955,4 +3955,5 @@ * arch/mips/src/mips32/up_vfork.c, up_vfork.h, and vfork.S: Implement vfork() for MIPS32 (no floating point support) * configs/ubw32/ostest: Enable the vfork() test. - + * fs/binfs: Move apps/builtin/binfs.c to fs/binfs/fs_binfs.c + CONFIG_APPS_BINDIR rename CONFIG_FS_BINFS diff --git a/nuttx/configs/sim/README.txt b/nuttx/configs/sim/README.txt index 8abfd9c231..165e92b962 100644 --- a/nuttx/configs/sim/README.txt +++ b/nuttx/configs/sim/README.txt @@ -270,8 +270,9 @@ nsh Description ----------- - Configures to use the NuttShell at apps/examples/nsh. This configuration - may be selected as follows: + Configures to use the NuttShell at apps/examples/nsh. This version has + one builtin function: This configuration: apps/examples/hello. This + configuration may be selected as follows: cd /tools ./configure.sh sim/nsh @@ -281,7 +282,7 @@ nsh2 Description ----------- This is another example that configures to use the NuttShell at apps/examples/nsh. - Unlike nsh, this version uses NSH built-in functions. The nx, nxhello, and + Like nsh, this version uses NSH built-in functions: The nx, nxhello, and nxlines examples are included as built-in functions. X11 Configuration diff --git a/nuttx/configs/sim/nsh/appconfig b/nuttx/configs/sim/nsh/appconfig index 264588e511..3f50f68187 100644 --- a/nuttx/configs/sim/nsh/appconfig +++ b/nuttx/configs/sim/nsh/appconfig @@ -42,3 +42,6 @@ CONFIGURED_APPS += examples/nsh CONFIGURED_APPS += system/readline CONFIGURED_APPS += nshlib +# Example built-in application + +CONFIGURED_APPS += examples/hello diff --git a/nuttx/configs/sim/nsh/defconfig b/nuttx/configs/sim/nsh/defconfig index cec10459ad..146519aa67 100644 --- a/nuttx/configs/sim/nsh/defconfig +++ b/nuttx/configs/sim/nsh/defconfig @@ -1,7 +1,7 @@ ############################################################################ # sim/nsh/defconfig # -# Copyright (C) 2008-2012 Gregory Nutt. All rights reserved. +# Copyright (C) 2008-2013 Gregory Nutt. All rights reserved. # Author: Gregory Nutt # # Redistribution and use in source and binary forms, with or without @@ -46,7 +46,7 @@ CONFIG_ARCH_BOARD_SIM=y CONFIG_USER_ENTRYPOINT="nsh_main" CONFIG_DEBUG=n CONFIG_DEBUG_VERBOSE=n -CONFIG_DEBUG_SYMBOLS=n +CONFIG_DEBUG_SYMBOLS=y CONFIG_HAVE_CXX=n CONFIG_HAVE_CXXINITIALIZE=n @@ -170,6 +170,7 @@ CONFIG_FAT_LFN=n CONFIG_FAT_MAXFNAME=32 CONFIG_FS_NXFFS=n CONFIG_FS_ROMFS=y +CONFIG_FS_BINFS=y # # TCP/IP and UDP support via uIP @@ -193,6 +194,11 @@ CONFIG_NET_STATISTICS=y #CONFIG_NET_ARPTAB_SIZE=8 CONFIG_NET_BROADCAST=n +# +# Settings for examples/hello +# +CONFIG_EXAMPLES_HELLO_BUILTIN=y + # # UIP Network Utilities # @@ -224,7 +230,7 @@ CONFIG_EXAMPLES_OSTEST_STACKSIZE=8192 # # Settings for apps/nshlib # -CONFIG_NSH_BUILTIN_APPS=n +CONFIG_NSH_BUILTIN_APPS=y CONFIG_NSH_FILEIOSIZE=1024 CONFIG_NSH_STRERROR=n CONFIG_NSH_LINELEN=80 diff --git a/nuttx/configs/vsn/nsh/defconfig b/nuttx/configs/vsn/nsh/defconfig index 5952f47240..5ec7e06ebb 100755 --- a/nuttx/configs/vsn/nsh/defconfig +++ b/nuttx/configs/vsn/nsh/defconfig @@ -526,4 +526,4 @@ CONFIG_HEAP_SIZE= CONFIG_APPS_DIR="../apps" # Provide /dev/ramX and then: mount -t binfs /dev/ram0 /bin -CONFIG_APPS_BINDIR=y +CONFIG_FS_BINFS=y diff --git a/nuttx/fs/Kconfig b/nuttx/fs/Kconfig index 1d10467351..dfbfda3fa2 100644 --- a/nuttx/fs/Kconfig +++ b/nuttx/fs/Kconfig @@ -5,11 +5,12 @@ comment "File system configuration" -source fs/fat/Kconfig source fs/mmap/Kconfig +source fs/fat/Kconfig source fs/nfs/Kconfig source fs/nxffs/Kconfig source fs/romfs/Kconfig +source fs/binfs/Kconfig comment "System Logging" diff --git a/nuttx/fs/Makefile b/nuttx/fs/Makefile index 6955c164b5..2a1fd75a87 100644 --- a/nuttx/fs/Makefile +++ b/nuttx/fs/Makefile @@ -1,7 +1,7 @@ ############################################################################ # fs/Makefile # -# Copyright (C) 2007, 2008, 2011-2012 Gregory Nutt. All rights reserved. +# Copyright (C) 2007, 2008, 2011-2013 Gregory Nutt. All rights reserved. # Author: Gregory Nutt # # Redistribution and use in source and binary forms, with or without @@ -72,6 +72,9 @@ CSRCS += fs_registerdriver.c fs_unregisterdriver.c CSRCS += fs_registerblockdriver.c fs_unregisterblockdriver.c \ fs_findblockdriver.c fs_openblockdriver.c fs_closeblockdriver.c +DEPPATH = +VPATH = . + include mmap/Make.defs # Stream support @@ -91,13 +94,17 @@ endif # Additional files required is mount-able file systems are supported ifneq ($(CONFIG_DISABLE_MOUNTPOINT),y) + CSRCS += fs_fsync.c fs_mkdir.c fs_mount.c fs_rename.c fs_rmdir.c \ fs_umount.c fs_unlink.c CSRCS += fs_foreachmountpoint.c + include fat/Make.defs include romfs/Make.defs include nxffs/Make.defs include nfs/Make.defs +include binfs/Make.defs + endif endif @@ -108,8 +115,7 @@ OBJS = $(AOBJS) $(COBJS) BIN = libfs$(LIBEXT) -SUBDIRS = mmap fat romfs nxffs:nfs -VPATH = mmap:fat:romfs:nxffs:nfs +SUBDIRS = mmap fat romfs nxffs nfs binfs all: $(BIN) @@ -123,8 +129,7 @@ $(BIN): $(OBJS) $(call ARCHIVE, $@, $(OBJS)) .depend: Makefile $(SRCS) - $(Q) $(MKDEP) --dep-path . $(MMAPDEPPATH) $(FATDEPPATH) $(ROMFSDEPPATH) $(NXFFSDEPPATH) $(NFSDEPPATH) \ - "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep + $(Q) $(MKDEP) --dep-path . $(DEPPATH) "$(CC)" -- $(CFLAGS) -- $(SRCS) >Make.dep $(Q) touch $@ depend: .depend diff --git a/nuttx/fs/binfs/Kconfig b/nuttx/fs/binfs/Kconfig new file mode 100644 index 0000000000..eedbe497dc --- /dev/null +++ b/nuttx/fs/binfs/Kconfig @@ -0,0 +1,19 @@ +# +# For a description of the syntax of this configuration file, +# see misc/tools/kconfig-language.txt. +# + +config FS_BINFS + bool "BINFS File System" + default n + depends on BUILTIN + ---help--- + The BINFS file system is provides access to builtin applications through + the NuttX file system. The BINFS may, for example, be mount at /bin. + Then all of the built-in applications will appear as executable files in + /bin. Then, for example, you list them from NSH like: + + nsh> ls -l /bin + + If the BINFS BINFMT loader is also enabled, then the builtin applications + can be executed through the normal mechanisms (posix_spawn(), exev(), etc.) diff --git a/nuttx/fs/binfs/Make.defs b/nuttx/fs/binfs/Make.defs new file mode 100644 index 0000000000..a65b7367fc --- /dev/null +++ b/nuttx/fs/binfs/Make.defs @@ -0,0 +1,48 @@ +############################################################################ +# fs/binfs/Make.defs +# +# Copyright (C) 2013 Gregory Nutt. All rights reserved. +# Author: Gregory Nutt +# +# 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_FS_BINFS),y) +# Files required for BINFS file system support + +ASRCS += +CSRCS += fs_binfs.c + +# Include BINFS build support + +DEPPATH += --dep-path binfs +VPATH += :binfs +CFLAGS += ${shell $(INCDIR) $(INCDIROPT) "$(CC)" $(TOPDIR)$(DELIM)fs$(DELIM)binfs} + +endif diff --git a/apps/builtin/binfs.c b/nuttx/fs/binfs/fs_binfs.c similarity index 98% rename from apps/builtin/binfs.c rename to nuttx/fs/binfs/fs_binfs.c index 611e2b3bb0..2508719e7f 100644 --- a/apps/builtin/binfs.c +++ b/nuttx/fs/binfs/fs_binfs.c @@ -1,5 +1,5 @@ /**************************************************************************** - * apps/builtin/binfs.c + * fs/binfs/fs_binfs.c * * Copyright (C) 2011-2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -54,12 +54,11 @@ #include #include #include +#include #include -#include "builtin.h" - -#if !defined(CONFIG_DISABLE_MOUNTPOINT) && defined(CONFIG_APPS_BINDIR) +#if !defined(CONFIG_DISABLE_MOUNTPOINT) && defined(CONFIG_FS_BINFS) /**************************************************************************** * Private Types @@ -444,5 +443,5 @@ static int binfs_stat(struct inode *mountpt, const char *relpath, struct stat *b * Public Functions ****************************************************************************/ -#endif /* !CONFIG_DISABLE_MOUNTPOINT && CONFIG_APPS_BINDIR */ +#endif /* !CONFIG_DISABLE_MOUNTPOINT && CONFIG_FS_BINFS */ diff --git a/nuttx/fs/fat/Make.defs b/nuttx/fs/fat/Make.defs index 136302b86f..2769ab6023 100644 --- a/nuttx/fs/fat/Make.defs +++ b/nuttx/fs/fat/Make.defs @@ -1,7 +1,7 @@ ############################################################################ # Make.defs # -# Copyright (C) 2008, 2011 Gregory Nutt. All rights reserved. +# Copyright (C) 2008, 2011, 2013 Gregory Nutt. All rights reserved. # Author: Gregory Nutt # # Redistribution and use in source and binary forms, with or without @@ -44,7 +44,10 @@ CSRCS += fs_fat32.c fs_fat32dirent.c fs_fat32attrib.c fs_fat32util.c ASRCS += CSRCS += fs_mkfatfs.c fs_configfat.c fs_writefat.c -# Argument for dependency checking +# Include FAT build support + +DEPPATH += --dep-path fat +VPATH += :fat +CFLAGS += ${shell $(INCDIR) $(INCDIROPT) "$(CC)" $(TOPDIR)$(DELIM)fs$(DELIM)fat} -FATDEPPATH = --dep-path fat endif diff --git a/nuttx/fs/fs_mount.c b/nuttx/fs/fs_mount.c index 228c1fc6ec..1b3da8dc3c 100644 --- a/nuttx/fs/fs_mount.c +++ b/nuttx/fs/fs_mount.c @@ -1,7 +1,7 @@ /**************************************************************************** * fs/fs_mount.c * - * Copyright (C) 2007-2009, 2011-2012 Gregory Nutt. All rights reserved. + * Copyright (C) 2007-2009, 2011-2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -47,10 +47,6 @@ #include -#ifdef CONFIG_APPS_BINDIR -# include -#endif - #include "fs_internal.h" /* At least one filesystem must be defined, or this file will not compile. @@ -78,7 +74,7 @@ /* These file systems do not require block drivers */ -#if defined(CONFIG_FS_NXFFS) || defined(CONFIG_APPS_BINDIR) || defined(CONFIG_NFS) +#if defined(CONFIG_FS_NXFFS) || defined(CONFIG_FS_BINFS) || defined(CONFIG_NFS) # define NONBDFS_SUPPORT #endif @@ -123,6 +119,9 @@ extern const struct mountpt_operations nxffs_operations; #ifdef CONFIG_NFS extern const struct mountpt_operations nfs_operations; #endif +#ifdef CONFIG_FS_BINFS +extern const struct mountpt_operations binfs_operations; +#endif static const struct fsmap_t g_nonbdfsmap[] = { @@ -132,7 +131,7 @@ static const struct fsmap_t g_nonbdfsmap[] = #ifdef CONFIG_NFS { "nfs", &nfs_operations }, #endif -#ifdef CONFIG_APPS_BINDIR +#ifdef CONFIG_FS_BINFS { "binfs", &binfs_operations }, #endif { NULL, NULL }, diff --git a/nuttx/fs/mmap/Make.defs b/nuttx/fs/mmap/Make.defs index 59857fe9c4..b85d9f60fc 100644 --- a/nuttx/fs/mmap/Make.defs +++ b/nuttx/fs/mmap/Make.defs @@ -1,7 +1,7 @@ ############################################################################ # fs/mmap/Make.defs # -# Copyright (C) 2011 Gregory Nutt. All rights reserved. +# Copyright (C) 2011, 2013 Gregory Nutt. All rights reserved. # Author: Gregory Nutt # # Redistribution and use in source and binary forms, with or without @@ -40,4 +40,9 @@ ifeq ($(CONFIG_FS_RAMMAP),y) CSRCS += fs_munmap.c fs_rammap.c endif -MMAPDEPPATH = --dep-path mmap +# Include MMAP build support + +DEPPATH += --dep-path mmap +VPATH += :mmap +CFLAGS += ${shell $(INCDIR) $(INCDIROPT) "$(CC)" $(TOPDIR)$(DELIM)fs$(DELIM)mmap} + diff --git a/nuttx/fs/nfs/Make.defs b/nuttx/fs/nfs/Make.defs index fc4682f855..ec2177fcfd 100644 --- a/nuttx/fs/nfs/Make.defs +++ b/nuttx/fs/nfs/Make.defs @@ -1,7 +1,7 @@ ############################################################################ # Make.defs # -# Copyright (C) 2012 Gregory Nutt. All rights reserved. +# Copyright (C) 2012-2013 Gregory Nutt. All rights reserved. # Author: Gregory Nutt # # Redistribution and use in source and binary forms, with or without @@ -44,7 +44,10 @@ CSRCS += ASRCS += CSRCS += rpc_clnt.c nfs_util.c nfs_vfsops.c -# Argument for dependency checking +# Include NFS build support + +DEPPATH += --dep-path nfs +VPATH += :nfs +CFLAGS += ${shell $(INCDIR) $(INCDIROPT) "$(CC)" $(TOPDIR)$(DELIM)fs$(DELIM)nfs} -NFSDEPPATH = --dep-path nfs endif diff --git a/nuttx/fs/nxffs/Make.defs b/nuttx/fs/nxffs/Make.defs index b67ae4472d..ccf1ba6612 100644 --- a/nuttx/fs/nxffs/Make.defs +++ b/nuttx/fs/nxffs/Make.defs @@ -1,7 +1,7 @@ ############################################################################ # fs/nxffs/Make.defs # -# Copyright (C) 2011 Gregory Nutt. All rights reserved. +# Copyright (C) 2011, 2013 Gregory Nutt. All rights reserved. # Author: Gregory Nutt # # Redistribution and use in source and binary forms, with or without @@ -40,7 +40,10 @@ CSRCS += nxffs_block.c nxffs_blockstats.c nxffs_cache.c nxffs_dirent.c \ nxffs_open.c nxffs_pack.c nxffs_read.c nxffs_reformat.c \ nxffs_stat.c nxffs_unlink.c nxffs_util.c nxffs_write.c -# Argument for dependency checking +# Include NXFFS build support + +DEPPATH += --dep-path nxffs +VPATH += :nxffs +CFLAGS += ${shell $(INCDIR) $(INCDIROPT) "$(CC)" $(TOPDIR)$(DELIM)fs$(DELIM)nxffs} -NXFFSDEPPATH = --dep-path nxffs endif diff --git a/nuttx/fs/romfs/Make.defs b/nuttx/fs/romfs/Make.defs index 77de93c054..e87cbdf9e5 100644 --- a/nuttx/fs/romfs/Make.defs +++ b/nuttx/fs/romfs/Make.defs @@ -1,7 +1,7 @@ ############################################################################ # fs/romfs/Make.defs # -# Copyright (C) 2008, 2011 Gregory Nutt. All rights reserved. +# Copyright (C) 2008, 2011, 2013 Gregory Nutt. All rights reserved. # Author: Gregory Nutt # # Redistribution and use in source and binary forms, with or without @@ -39,7 +39,10 @@ ifeq ($(CONFIG_FS_ROMFS),y) ASRCS += CSRCS += fs_romfs.c fs_romfsutil.c -# Argument for dependency checking +# Include ROMFS build support + +DEPPATH += --dep-path romfs +VPATH += :romfs +CFLAGS += ${shell $(INCDIR) $(INCDIROPT) "$(CC)" $(TOPDIR)$(DELIM)fs$(DELIM)romfs} -ROMFSDEPPATH = --dep-path romfs endif diff --git a/apps/builtin/builtin.h b/nuttx/include/nuttx/binfmt/builtin.h similarity index 86% rename from apps/builtin/builtin.h rename to nuttx/include/nuttx/binfmt/builtin.h index 4593809eed..c27605cac4 100644 --- a/apps/builtin/builtin.h +++ b/nuttx/include/nuttx/binfmt/builtin.h @@ -1,5 +1,5 @@ /**************************************************************************** - * apps/builtin/builtin.h + * include/nuttx/binfmt/builtin.h * * Copyright (C) 2011 Uros Platise. All rights reserved. * Copyright (C) 2011-2012 Gregory Nutt. All rights reserved. @@ -35,8 +35,8 @@ * ****************************************************************************/ -#ifndef __APPS_BUILTIN_BUILTIN_H -#define __APPS_BUILTIN_BUILTIN_H +#ifndef __INCLUDE_NUTTX_BINFMT_BUILTIN_H +#define __INCLUDE_NUTTX_BINFMT_BUILTIN_H /**************************************************************************** * Included Files @@ -49,6 +49,14 @@ * Public Types ****************************************************************************/ +struct builtin_s +{ + const char *name; /* Invocation name and as seen under /sbin/ */ + int priority; /* Use: SCHED_PRIORITY_DEFAULT */ + int stacksize; /* Desired stack size */ + main_t main; /* Entry point: main(int argc, char *argv[]) */ +}; + /**************************************************************************** * Public Data ****************************************************************************/ @@ -73,5 +81,5 @@ EXTERN int number_builtins(void); } #endif -#endif /* __APPS_BUILTIN_BUILTIN_H */ +#endif /* __INCLUDE_NUTTX_BINFMT_BUILTIN_H */ diff --git a/nuttx/include/nuttx/fs/binfs.h b/nuttx/include/nuttx/fs/binfs.h index 6125384a9f..df92375e3a 100644 --- a/nuttx/include/nuttx/fs/binfs.h +++ b/nuttx/include/nuttx/fs/binfs.h @@ -44,6 +44,8 @@ #include +#ifdef CONFIG_FS_BINFS + /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ @@ -62,7 +64,7 @@ ****************************************************************************/ /**************************************************************************** - * Public Function Prototypes + * Public Data ****************************************************************************/ #ifdef __cplusplus @@ -72,9 +74,21 @@ extern "C" { #define EXTERN extern #endif +/* The "bindir" is file system that supports access to the builtin applications. + * It is typically mounted under /bin. + */ + +EXTERN mountpt_operations; +EXTERN const struct mountpt_operations binfs_operations; + +/**************************************************************************** + * Public Function Prototypes + ****************************************************************************/ + #undef EXTERN #ifdef __cplusplus } #endif +#endif /* CONFIG_FS_BINFS */ #endif /* __INCLUDE_NUTTX_FS_BINFS_H */ diff --git a/nuttx/include/nuttx/fs/dirent.h b/nuttx/include/nuttx/fs/dirent.h index 75867c87ae..f8d3568505 100644 --- a/nuttx/include/nuttx/fs/dirent.h +++ b/nuttx/include/nuttx/fs/dirent.h @@ -1,7 +1,7 @@ /**************************************************************************** * include/nuttx/fs/dirent.h * - * Copyright (C) 2007, 2009, 2011-2012 Gregory Nutt. All rights reserved. + * Copyright (C) 2007, 2009, 2011-2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -102,7 +102,7 @@ struct fs_romfsdir_s }; #endif /* CONFIG_FS_ROMFS */ -#ifdef CONFIG_APPS_BINDIR +#ifdef CONFIG_FS_BINFS /* The apps/ pseudo bin/ directory. The state value is simply an index */ struct fs_binfsdir_s @@ -179,7 +179,7 @@ struct fs_dirent_s #ifdef CONFIG_FS_ROMFS struct fs_romfsdir_s romfs; #endif -#ifdef CONFIG_APPS_BINDIR +#ifdef CONFIG_FS_BINFS struct fs_binfsdir_s binfs; #endif #ifdef CONFIG_FS_NXFFS diff --git a/nuttx/tools/mkconfig.c b/nuttx/tools/mkconfig.c index f4a1168c57..fe3e004916 100644 --- a/nuttx/tools/mkconfig.c +++ b/nuttx/tools/mkconfig.c @@ -1,7 +1,7 @@ /**************************************************************************** * tools/mkconfig.c * - * Copyright (C) 2007-2012 Gregory Nutt. All rights reserved. + * Copyright (C) 2007-2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -213,14 +213,14 @@ int main(int argc, char **argv, char **envp) printf("# undef CONFIG_FS_FAT\n"); printf("# undef CONFIG_FS_ROMFS\n"); printf("# undef CONFIG_FS_NXFFS\n"); - printf("# undef CONFIG_APPS_BINDIR\n"); + printf("# undef CONFIG_FS_BINFS\n"); printf("# undef CONFIG_NFS\n"); printf("#endif\n\n"); printf("/* Check if any readable and writable filesystem (OR USB storage) is supported */\n\n"); printf("#undef CONFIG_FS_READABLE\n"); printf("#undef CONFIG_FS_WRITABLE\n"); printf("#if defined(CONFIG_FS_FAT) || defined(CONFIG_FS_ROMFS) || defined(CONFIG_USBMSC) || \\\n"); - printf(" defined(CONFIG_FS_NXFFS) || defined(CONFIG_APPS_BINDIR) || defined(CONFIG_NFS)\n"); + printf(" defined(CONFIG_FS_NXFFS) || defined(CONFIG_FS_BINFS) || defined(CONFIG_NFS)\n"); printf("# define CONFIG_FS_READABLE 1\n"); printf("#endif\n\n"); printf("#if defined(CONFIG_FS_FAT) || defined(CONFIG_USBMSC) || defined(CONFIG_FS_NXFFS) || \\\n"); From 38efdf0ce37cc3413acee30d966f242aa8a77acd Mon Sep 17 00:00:00 2001 From: patacongo Date: Wed, 16 Jan 2013 17:05:00 +0000 Subject: [PATCH 077/118] Rename apps/include/apps.h to builtin.h. Move parts of apps/builtins/exec_builtin.c to binfmt/libbuiltin/libbuiltin_utils.c git-svn-id: http://svn.code.sf.net/p/nuttx/code/trunk@5524 42af7a65-404d-4744-a932-0658087f49c3 --- apps/ChangeLog.txt | 6 + apps/README.txt | 3 +- apps/builtin/Kconfig | 10 +- apps/builtin/builtin.c | 1 - apps/builtin/exec_builtin.c | 46 +------- apps/include/{apps.h => builtin.h} | 47 +------- apps/nshlib/Kconfig | 2 +- apps/nshlib/nsh_builtin.c | 3 +- apps/nshlib/nsh_parse.c | 2 +- nuttx/ChangeLog | 5 + nuttx/Documentation/NuttShell.html | 2 +- nuttx/binfmt/Kconfig | 14 +++ nuttx/binfmt/Makefile | 3 +- nuttx/binfmt/libbuiltin/Kconfig | 4 + nuttx/binfmt/libbuiltin/Make.defs | 49 +++++++++ nuttx/binfmt/libbuiltin/libbuiltin_utils.c | 121 +++++++++++++++++++++ nuttx/fs/binfs/fs_binfs.c | 3 +- nuttx/include/nuttx/binfmt/builtin.h | 81 +++++++++++++- nuttx/include/nuttx/fs/binfs.h | 11 -- nuttx/include/nuttx/fs/ioctl.h | 6 +- 20 files changed, 296 insertions(+), 123 deletions(-) rename apps/include/{apps.h => builtin.h} (76%) create mode 100644 nuttx/binfmt/libbuiltin/Kconfig create mode 100644 nuttx/binfmt/libbuiltin/Make.defs create mode 100644 nuttx/binfmt/libbuiltin/libbuiltin_utils.c diff --git a/apps/ChangeLog.txt b/apps/ChangeLog.txt index 5bc3b21490..6faac9e4ba 100644 --- a/apps/ChangeLog.txt +++ b/apps/ChangeLog.txt @@ -475,3 +475,9 @@ binfmt. * builtin/binfs.c: Move apps/builtin/binfs.c to fs/binfs/fs_binfs.c CONFIG_APPS_BINDIR rename CONFIG_FS_BINFS + * apps/include/builtin.h: Some of the content of + apps/include/apps.h moved to include/nuttx/binfmt/builtin.h. + apps/include/apps.h renamed builtin.h + * pps/builtin/exec_builtins.c: Move utility builtin + utility functions from apps/builtin/exec_builtins.c to + binfmt/libbuiltin/libbuiltin_utils.c \ No newline at end of file diff --git a/apps/README.txt b/apps/README.txt index 4a336abdb2..55accfcf60 100644 --- a/apps/README.txt +++ b/apps/README.txt @@ -7,7 +7,6 @@ Contents General Directory Location Built-In Applications - Built-In Startup main() function NuttShell (NSH) Built-In Commands Synchronous Built-In Commands Application Configuration File @@ -62,7 +61,7 @@ collected during the make context build phase. To execute an application function: - exec_builtin() is defined in the nuttx/include/apps/apps.h + exec_builtin() is defined in the nuttx/include/apps/builtin.h NuttShell (NSH) Built-In Commands --------------------------------- diff --git a/apps/builtin/Kconfig b/apps/builtin/Kconfig index 37150e8a95..c3371d708f 100644 --- a/apps/builtin/Kconfig +++ b/apps/builtin/Kconfig @@ -3,21 +3,13 @@ # see misc/tools/kconfig-language.txt. # -config BUILTIN - bool "Support Builtin Applications" - default n - ---help--- - Enable support for builtin applications. This features assigns a string - name to an application. This feature is also the underlying requirement - to support built-in applications in the NuttShell (NSH). - if BUILTIN config BUILTIN_PROXY_STACKSIZE int "Builtin Proxy Stack Size" default 1024 ---help--- - If exec_builting uses I/O redirection options, then it will require + If exec_builtin uses I/O redirection options, then it will require an intermediary/proxy task to muck with the file descriptors. This configuration item specifies the stack size used for the proxy. Default: 1024 bytes. diff --git a/apps/builtin/builtin.c b/apps/builtin/builtin.c index 90c0b1353c..7655a531da 100644 --- a/apps/builtin/builtin.c +++ b/apps/builtin/builtin.c @@ -42,7 +42,6 @@ #include #include -#include /**************************************************************************** * Private Types diff --git a/apps/builtin/exec_builtin.c b/apps/builtin/exec_builtin.c index 6868d7ee7c..05648590db 100644 --- a/apps/builtin/exec_builtin.c +++ b/apps/builtin/exec_builtin.c @@ -54,7 +54,7 @@ #include #include -#include +#include /**************************************************************************** * Pre-processor Definitions @@ -365,50 +365,6 @@ errout: * Public Functions ****************************************************************************/ -/**************************************************************************** - * Name: builtin_getname - * - * Description: - * Return the name of the application at index in the table of builtin - * applications. - * - ****************************************************************************/ - -const char *builtin_getname(int index) -{ - if (index < 0 || index >= number_builtins()) - { - return NULL; - } - - return g_builtins[index].name; -} - -/**************************************************************************** - * Name: builtin_isavail - * - * Description: - * Return the index into the table of applications for the applicaiton with - * the name 'appname'. - * - ****************************************************************************/ - -int builtin_isavail(FAR const char *appname) -{ - int i; - - for (i = 0; g_builtins[i].name; i++) - { - if (!strcmp(g_builtins[i].name, appname)) - { - return i; - } - } - - set_errno(ENOENT); - return ERROR; -} - /**************************************************************************** * Name: exec_builtin * diff --git a/apps/include/apps.h b/apps/include/builtin.h similarity index 76% rename from apps/include/apps.h rename to apps/include/builtin.h index 0fb807c141..24cf204fa6 100644 --- a/apps/include/apps.h +++ b/apps/include/builtin.h @@ -1,5 +1,5 @@ /**************************************************************************** - * apps/include/apps.h + * apps/include/builtin.h * * Originally by: * @@ -40,8 +40,8 @@ * ****************************************************************************/ -#ifndef __APPS_INCLUDE_APPS_H -#define __APPS_INCLUDE_APPS_H +#ifndef __APPS_INCLUDE_BUILTIN_H +#define __APPS_INCLUDE_BUILTIN_H /**************************************************************************** * Included Files @@ -50,9 +50,8 @@ #include #include -#include -#include +#include /**************************************************************************** * Pre-processor Definitions @@ -78,42 +77,6 @@ extern "C" { * Public Functions ****************************************************************************/ -/**************************************************************************** - * Name: builtin_isavail - * - * Description: - * Checks for availabiliy of application registerred during compile time. - * - * Input Parameter: - * filename - Name of the linked-in binary to be started. - * - * Returned Value: - * This is an end-user function, so it follows the normal convention: - * Returns index of builtin application. If it is not found then it - * returns -1 (ERROR) and sets errno appropriately. - * - ****************************************************************************/ - -EXTERN int builtin_isavail(FAR const char *appname); - -/**************************************************************************** - * Name: builtin_getname - * - * Description: - * Returns pointer to a name of built-in application pointed by the - * index. - * - * Input Parameter: - * index, from 0 and on ... - * - * Returned Value: - * Returns valid pointer pointing to the app name if index is valid. - * Otherwise NULL is returned. - * - ****************************************************************************/ - -EXTERN const char *builtin_getname(int index); - /**************************************************************************** * Name: exec_builtin * @@ -145,4 +108,4 @@ EXTERN int exec_builtin(FAR const char *appname, FAR const char **argv, } #endif -#endif /* __APPS_INCLUDE_APPS_H */ +#endif /* __APPS_INCLUDE_BUILTIN_H */ diff --git a/apps/nshlib/Kconfig b/apps/nshlib/Kconfig index e60e9c4806..9cfc020a59 100644 --- a/apps/nshlib/Kconfig +++ b/apps/nshlib/Kconfig @@ -15,7 +15,7 @@ if NSH_LIBRARY config NSH_BUILTIN_APPS bool "Enable built-in applications" default y - depends on BUILTIN + select BUILTIN ---help--- Support external registered, "built-in" applications that can be executed from the NSH command line (see apps/README.txt for diff --git a/apps/nshlib/nsh_builtin.c b/apps/nshlib/nsh_builtin.c index 16e3e94279..ba39e8dfe8 100644 --- a/apps/nshlib/nsh_builtin.c +++ b/apps/nshlib/nsh_builtin.c @@ -54,7 +54,8 @@ #include #include -#include +#include +#include #include "nsh.h" #include "nsh_console.h" diff --git a/apps/nshlib/nsh_parse.c b/apps/nshlib/nsh_parse.c index 15723b497c..c367243722 100644 --- a/apps/nshlib/nsh_parse.c +++ b/apps/nshlib/nsh_parse.c @@ -59,7 +59,7 @@ #endif #ifdef CONFIG_NSH_BUILTIN_APPS -# include +# include #endif #include diff --git a/nuttx/ChangeLog b/nuttx/ChangeLog index ed85f06e1d..57925a8b3b 100644 --- a/nuttx/ChangeLog +++ b/nuttx/ChangeLog @@ -3957,3 +3957,8 @@ * configs/ubw32/ostest: Enable the vfork() test. * fs/binfs: Move apps/builtin/binfs.c to fs/binfs/fs_binfs.c CONFIG_APPS_BINDIR rename CONFIG_FS_BINFS + * include/nuttx/binfmt/builtin.h: Some of the content of + apps/include/apps.h moved to include/nuttx/binfmt/builtin.h + * binfmt/libbuiltin/libbuiltin_utils.c: Move utility builtin + utility functions from apps/builtin/exec_builtins.c to + binfmt/libbuiltin/libbuiltin_utils.c \ No newline at end of file diff --git a/nuttx/Documentation/NuttShell.html b/nuttx/Documentation/NuttShell.html index 95a75b22c5..273898476d 100644 --- a/nuttx/Documentation/NuttShell.html +++ b/nuttx/Documentation/NuttShell.html @@ -3261,7 +3261,7 @@ Builtin Apps:

          Built-In Application Utility Functions. - The utility functions exported by the builtin application logic are prototyped in apps/include/apps.h. + The utility functions exported by the builtin application logic are prototyped in nuttx/include/nuttx/binfmt/builtin.h and apps/include/builtin.h. These utility functions include:

          diff --git a/nuttx/binfmt/Kconfig b/nuttx/binfmt/Kconfig index 495bd050f9..8d6c0bb18f 100644 --- a/nuttx/binfmt/Kconfig +++ b/nuttx/binfmt/Kconfig @@ -49,6 +49,20 @@ if ELF source binfmt/libelf/Kconfig endif +config BUILTIN + bool "Support Builtin Applications" + default n + ---help--- + Enable support for builtin applications. This features assigns a string + name to an application and in addition if FS_BINFS is defined, retaining + those names in a file system from which they can be executed. This feature + is also the underlying requirement to support built-in applications in the + NuttShell (NSH). + +if BUILTIN +source binfmt/libbuiltin/Kconfig +endif + endif config PIC diff --git a/nuttx/binfmt/Makefile b/nuttx/binfmt/Makefile index 8ec0d877c1..49dcd3d321 100644 --- a/nuttx/binfmt/Makefile +++ b/nuttx/binfmt/Makefile @@ -1,7 +1,7 @@ ############################################################################ # nxflat/Makefile # -# Copyright (C) 2007-2009, 2012 Gregory Nutt. All rights reserved. +# Copyright (C) 2007-2009, 2012-2013 Gregory Nutt. All rights reserved. # Author: Gregory Nutt # # Redistribution and use in source and binary forms, with or without @@ -65,6 +65,7 @@ DEPPATH = --dep-path . include libnxflat$(DELIM)Make.defs include libelf$(DELIM)Make.defs +include libbuiltin$(DELIM)Make.defs BINFMT_AOBJS = $(BINFMT_ASRCS:.S=$(OBJEXT)) BINFMT_COBJS = $(BINFMT_CSRCS:.c=$(OBJEXT)) diff --git a/nuttx/binfmt/libbuiltin/Kconfig b/nuttx/binfmt/libbuiltin/Kconfig new file mode 100644 index 0000000000..ae2bf31307 --- /dev/null +++ b/nuttx/binfmt/libbuiltin/Kconfig @@ -0,0 +1,4 @@ +# +# For a description of the syntax of this configuration file, +# see misc/tools/kconfig-language.txt. +# diff --git a/nuttx/binfmt/libbuiltin/Make.defs b/nuttx/binfmt/libbuiltin/Make.defs new file mode 100644 index 0000000000..1d129294c2 --- /dev/null +++ b/nuttx/binfmt/libbuiltin/Make.defs @@ -0,0 +1,49 @@ +############################################################################ +# binfmt/libbuiltin/Make.defs +# +# Copyright (C) 2013 Gregory Nutt. All rights reserved. +# Author: Gregory Nutt +# +# 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. +# +############################################################################ + +# Legacy configurations don't set CONFIG_BUILTIN +# ifeq ($(CONFIG_BUILTIN),y) + +# Builtin application interfaces + +BINFMT_CSRCS += libbuiltin_utils.c + +# Hook the libelf subdirectory into the build + +VPATH += libbuiltin +SUBDIRS += libbuiltin +DEPPATH += --dep-path libbuiltin + +# endif diff --git a/nuttx/binfmt/libbuiltin/libbuiltin_utils.c b/nuttx/binfmt/libbuiltin/libbuiltin_utils.c new file mode 100644 index 0000000000..b53becff93 --- /dev/null +++ b/nuttx/binfmt/libbuiltin/libbuiltin_utils.c @@ -0,0 +1,121 @@ +/**************************************************************************** + * binfmt/libbuiltin/libbuiltin_utils.c + * + * Originally by: + * + * Copyright (C) 2011 Uros Platise. All rights reserved. + * Author: Uros Platise + * + * With subsequent updates, modifications, and general maintenance by: + * + * Copyright (C) 2012-2013 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * 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. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include +#include +#include + +#include + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +/**************************************************************************** + * Private Types + ****************************************************************************/ + +/**************************************************************************** + * Private Function Prototypes + ****************************************************************************/ + +/**************************************************************************** + * Private Data + ****************************************************************************/ + +/**************************************************************************** + * Private Functions + ****************************************************************************/ + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: builtin_getname + * + * Description: + * Return the name of the application at index in the table of builtin + * applications. + * + ****************************************************************************/ + +FAR const char *builtin_getname(int index) +{ + if (index < 0 || index >= number_builtins()) + { + return NULL; + } + + return g_builtins[index].name; +} + +/**************************************************************************** + * Name: builtin_isavail + * + * Description: + * Return the index into the table of applications for the applicaiton with + * the name 'appname'. + * + ****************************************************************************/ + +int builtin_isavail(FAR const char *appname) +{ + int i; + + for (i = 0; g_builtins[i].name; i++) + { + if (!strncmp(g_builtins[i].name, appname, NAME_MAX)) + { + return i; + } + } + + set_errno(ENOENT); + return ERROR; +} diff --git a/nuttx/fs/binfs/fs_binfs.c b/nuttx/fs/binfs/fs_binfs.c index 2508719e7f..ed6326eba6 100644 --- a/nuttx/fs/binfs/fs_binfs.c +++ b/nuttx/fs/binfs/fs_binfs.c @@ -54,10 +54,9 @@ #include #include #include +#include #include -#include - #if !defined(CONFIG_DISABLE_MOUNTPOINT) && defined(CONFIG_FS_BINFS) /**************************************************************************** diff --git a/nuttx/include/nuttx/binfmt/builtin.h b/nuttx/include/nuttx/binfmt/builtin.h index c27605cac4..632f8944d2 100644 --- a/nuttx/include/nuttx/binfmt/builtin.h +++ b/nuttx/include/nuttx/binfmt/builtin.h @@ -1,10 +1,15 @@ /**************************************************************************** * include/nuttx/binfmt/builtin.h * + * Originally by: + * * Copyright (C) 2011 Uros Platise. All rights reserved. - * Copyright (C) 2011-2012 Gregory Nutt. All rights reserved. - * Authors: Uros Platise - * Gregory Nutt + * Author: Uros Platise + * + * With subsequent updates, modifications, and general maintenance by: + * + * Copyright (C) 2012-2013 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -43,7 +48,7 @@ ****************************************************************************/ #include -#include +#include /**************************************************************************** * Public Types @@ -68,13 +73,79 @@ extern "C" { #define EXTERN extern #endif +/* The g_builtins[] array holds information about each builtin function. If + * support for builtin functions is enabled in the NuttX configuration, then + * this arrary (along with the number_builtins() function) must be provided + * by the application code. + */ + EXTERN const struct builtin_s g_builtins[]; /**************************************************************************** * Public Functions ****************************************************************************/ -EXTERN int number_builtins(void); +/**************************************************************************** + * Utility Functions Provided to Applications by binfmt/libbuiltin + ****************************************************************************/ +/**************************************************************************** + * Name: builtin_isavail + * + * Description: + * Checks for availabiliy of application registerred during compile time. + * + * Input Parameter: + * filename - Name of the linked-in binary to be started. + * + * Returned Value: + * This is an end-user function, so it follows the normal convention: + * Returns index of builtin application. If it is not found then it + * returns -1 (ERROR) and sets errno appropriately. + * + ****************************************************************************/ + +int builtin_isavail(FAR const char *appname); + +/**************************************************************************** + * Name: builtin_getname + * + * Description: + * Returns pointer to a name of built-in application pointed by the + * index. + * + * Input Parameter: + * index, from 0 and on ... + * + * Returned Value: + * Returns valid pointer pointing to the app name if index is valid. + * Otherwise NULL is returned. + * + ****************************************************************************/ + +FAR const char *builtin_getname(int index); + +/**************************************************************************** + * Data Set Access Functions Provided to Applications by binfmt/libbuiltin + ****************************************************************************/ +/**************************************************************************** + * Name: number_builtins + * + * Description: + * Returns the number of builtin functions in the g_builtins[] array. If + * support for builtin functions is enabled in the NuttX configuration, + * then this function (along with g_builtins[]) must be provided by the + * application code. + * + * Input Parameter: + * None + * + * Returned Value: + * The number of entries in the g_builtins[] array. This function does + * not return failures. + * + ****************************************************************************/ + +int number_builtins(void); #undef EXTERN #if defined(__cplusplus) diff --git a/nuttx/include/nuttx/fs/binfs.h b/nuttx/include/nuttx/fs/binfs.h index df92375e3a..d967506d81 100644 --- a/nuttx/include/nuttx/fs/binfs.h +++ b/nuttx/include/nuttx/fs/binfs.h @@ -42,22 +42,11 @@ #include -#include - #ifdef CONFIG_FS_BINFS /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ -/* This is the BINFS ioctl that can be used to recover the filename - * associated with the builtin task. - */ - -#define FIOC_FILENAME FIOC_USER /* IN: FAR const char ** pointer - * OUT: Pointer to a persistent file name - * (Guaranteed to persist while the file - * is open). - */ /**************************************************************************** * Type Definitions diff --git a/nuttx/include/nuttx/fs/ioctl.h b/nuttx/include/nuttx/fs/ioctl.h index 8f2fdd7d93..9cde497a82 100644 --- a/nuttx/include/nuttx/fs/ioctl.h +++ b/nuttx/include/nuttx/fs/ioctl.h @@ -105,7 +105,11 @@ #define FIOC_OPTIMIZE _FIOC(0x0003) /* IN: None * OUT: None */ -#define FIOC_USER _FIOC(0x0004) /* File system-specific */ +#define FIOC_FILENAME _FIOC(0x0004) /* IN: FAR const char ** pointer + * OUT: Pointer to a persistent file name + * (Guaranteed to persist while the file + * is open). + */ /* NuttX file system ioctl definitions **************************************/ From a568e1e63afed4a9a1fb075568eec16ab76c158d Mon Sep 17 00:00:00 2001 From: patacongo Date: Wed, 16 Jan 2013 19:08:23 +0000 Subject: [PATCH 078/118] Add a binary 'loader' so that builtin applications can be executed from the BINFS file system git-svn-id: http://svn.code.sf.net/p/nuttx/code/trunk@5525 42af7a65-404d-4744-a932-0658087f49c3 --- apps/ChangeLog.txt | 8 +- apps/nshlib/Kconfig | 2 +- apps/nshlib/nsh_mntcmds.c | 74 +++++-- apps/nshlib/nsh_parse.c | 2 +- nuttx/ChangeLog | 5 +- nuttx/binfmt/builtin.c | 195 ++++++++++++++++++ nuttx/binfmt/elf.c | 2 +- nuttx/binfmt/libbuiltin/Make.defs | 9 +- nuttx/configs/cloudctrl/nsh/defconfig | 2 +- .../configs/compal_e88/nsh_highram/defconfig | 2 + .../compal_e99/nsh_compalram/defconfig | 2 + .../configs/compal_e99/nsh_highram/defconfig | 2 + nuttx/configs/fire-stm32v2/nsh/defconfig | 10 +- nuttx/configs/hymini-stm32v/nsh2/defconfig | 1 + nuttx/configs/mirtoo/ostest/defconfig | 2 +- .../configs/olimex-lpc1766stk/ftpc/defconfig | 3 +- nuttx/configs/olimex-lpc1766stk/nsh/defconfig | 1 + nuttx/configs/olimex-stm32-p107/nsh/defconfig | 1 + nuttx/configs/pcblogic-pic32mx/nsh/defconfig | 1 + nuttx/configs/pic32-starterkit/nsh/defconfig | 1 + nuttx/configs/pic32-starterkit/nsh2/defconfig | 1 + nuttx/configs/pic32mx7mmb/nsh/defconfig | 1 + nuttx/configs/sam3u-ek/touchscreen/defconfig | 1 + nuttx/configs/shenzhou/nsh/defconfig | 2 +- nuttx/configs/shenzhou/nxwm/defconfig | 2 +- nuttx/configs/shenzhou/thttpd/defconfig | 2 +- nuttx/configs/sim/nsh/defconfig | 1 + nuttx/configs/sim/nsh2/defconfig | 1 + nuttx/configs/stm3210e-eval/nsh2/defconfig | 1 + .../configs/stm3210e-eval/nxconsole/defconfig | 1 + nuttx/configs/stm3210e-eval/pm/defconfig | 1 + nuttx/configs/stm3220g-eval/nsh/defconfig | 1 + nuttx/configs/stm3220g-eval/nsh2/defconfig | 1 + nuttx/configs/stm3220g-eval/ostest/defconfig | 2 +- nuttx/configs/stm3240g-eval/nsh/defconfig | 1 + nuttx/configs/stm3240g-eval/nsh2/defconfig | 1 + .../configs/stm3240g-eval/nxconsole/defconfig | 1 + nuttx/configs/stm3240g-eval/ostest/defconfig | 2 +- .../configs/stm3240g-eval/webserver/defconfig | 2 +- .../configs/stm32f100rc_generic/nsh/defconfig | 2 +- nuttx/configs/stm32f4discovery/nsh/defconfig | 1 + nuttx/configs/stm32f4discovery/pm/defconfig | 1 + nuttx/configs/sure-pic32mx/nsh/defconfig | 1 + nuttx/configs/sure-pic32mx/usbnsh/defconfig | 1 + nuttx/configs/ubw32/nsh/defconfig | 1 + nuttx/configs/vsn/nsh/defconfig | 1 + nuttx/fs/fs_mount.c | 2 +- 47 files changed, 317 insertions(+), 43 deletions(-) create mode 100644 nuttx/binfmt/builtin.c diff --git a/apps/ChangeLog.txt b/apps/ChangeLog.txt index 6faac9e4ba..14eb78950d 100644 --- a/apps/ChangeLog.txt +++ b/apps/ChangeLog.txt @@ -478,6 +478,10 @@ * apps/include/builtin.h: Some of the content of apps/include/apps.h moved to include/nuttx/binfmt/builtin.h. apps/include/apps.h renamed builtin.h - * pps/builtin/exec_builtins.c: Move utility builtin + * apps/builtin/exec_builtins.c: Move utility builtin utility functions from apps/builtin/exec_builtins.c to - binfmt/libbuiltin/libbuiltin_utils.c \ No newline at end of file + binfmt/libbuiltin/libbuiltin_utils.c + * apps/nshlib/nsh_mountcmds.c: The block driver/source + argument is now optional. Many files systems do not need + a source and it is really stupid to have to enter a bogus + source parameter. diff --git a/apps/nshlib/Kconfig b/apps/nshlib/Kconfig index 9cfc020a59..e60e9c4806 100644 --- a/apps/nshlib/Kconfig +++ b/apps/nshlib/Kconfig @@ -15,7 +15,7 @@ if NSH_LIBRARY config NSH_BUILTIN_APPS bool "Enable built-in applications" default y - select BUILTIN + depends on BUILTIN ---help--- Support external registered, "built-in" applications that can be executed from the NSH command line (see apps/README.txt for diff --git a/apps/nshlib/nsh_mntcmds.c b/apps/nshlib/nsh_mntcmds.c index b16ba8465c..f8e3a142a0 100644 --- a/apps/nshlib/nsh_mntcmds.c +++ b/apps/nshlib/nsh_mntcmds.c @@ -133,7 +133,7 @@ static int mount_handler(FAR const char *mountpoint, #ifdef CONFIG_FS_BINFS case BINFS_MAGIC: - fstype = "bindir"; + fstype = "binfs"; break; #endif @@ -198,9 +198,11 @@ int cmd_df(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv) defined(CONFIG_FS_READABLE) && !defined(CONFIG_NSH_DISABLE_MOUNT) int cmd_mount(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv) { - FAR char *source; - FAR char *target; - FAR char *filesystem = NULL; + FAR const char *source; + FAR char *fullsource; + FAR const char *target; + FAR char *fulltarget; + FAR const char *filesystem = NULL; bool badarg = false; int option; int ret; @@ -248,21 +250,34 @@ int cmd_mount(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv) return ERROR; } - /* There are two required arguments after the options: the source and target - * paths. + /* There may be one or two required arguments after the options: the source + * and target paths. Some file systems do not require the source parameter + * so if there is only one parameter left, it must be the target. */ - if (optind + 2 < argc) - { - nsh_output(vtbl, g_fmttoomanyargs, argv[0]); - return ERROR; - } - else if (optind + 2 > argc) + if (optind >= argc) { nsh_output(vtbl, g_fmtargrequired, argv[0]); return ERROR; } + source = NULL; + target = argv[optind]; + optind++; + + if (optind < argc) + { + source = target; + target = argv[optind]; + optind++; + + if (optind < argc) + { + nsh_output(vtbl, g_fmttoomanyargs, argv[0]); + return ERROR; + } + } + /* While the above parsing for the -t argument looks nice, the -t argument * not really optional. */ @@ -277,29 +292,44 @@ int cmd_mount(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv) * working directory. */ - source = nsh_getfullpath(vtbl, argv[optind]); - if (!source) + fullsource = NULL; + fulltarget = NULL; + + if (source) { - return ERROR; + fullsource = nsh_getfullpath(vtbl, source); + if (!fullsource) + { + return ERROR; + } } - target = nsh_getfullpath(vtbl, argv[optind+1]); - if (!target) + fulltarget = nsh_getfullpath(vtbl, target); + if (!fulltarget) { - nsh_freefullpath(source); - return ERROR; + ret = ERROR; + goto errout; } /* Perform the mount */ - ret = mount(source, target, filesystem, 0, NULL); + ret = mount(fullsource, fulltarget, filesystem, 0, NULL); if (ret < 0) { nsh_output(vtbl, g_fmtcmdfailed, argv[0], "mount", NSH_ERRNO); } - nsh_freefullpath(source); - nsh_freefullpath(target); +errout: + if (fullsource) + { + nsh_freefullpath(fullsource); + } + + if (fulltarget) + { + nsh_freefullpath(fulltarget); + } + return ret; } #endif diff --git a/apps/nshlib/nsh_parse.c b/apps/nshlib/nsh_parse.c index c367243722..ef4125a63f 100644 --- a/apps/nshlib/nsh_parse.c +++ b/apps/nshlib/nsh_parse.c @@ -301,7 +301,7 @@ static const struct cmdmap_s g_cmdmap[] = #if !defined(CONFIG_DISABLE_MOUNTPOINT) && CONFIG_NFILE_DESCRIPTORS > 0 && defined(CONFIG_FS_READABLE) # ifndef CONFIG_NSH_DISABLE_MOUNT - { "mount", cmd_mount, 1, 5, "[-t ]" }, + { "mount", cmd_mount, 1, 5, "[-t [] ]" }, # endif #endif diff --git a/nuttx/ChangeLog b/nuttx/ChangeLog index 57925a8b3b..8d6d813639 100644 --- a/nuttx/ChangeLog +++ b/nuttx/ChangeLog @@ -3961,4 +3961,7 @@ apps/include/apps.h moved to include/nuttx/binfmt/builtin.h * binfmt/libbuiltin/libbuiltin_utils.c: Move utility builtin utility functions from apps/builtin/exec_builtins.c to - binfmt/libbuiltin/libbuiltin_utils.c \ No newline at end of file + binfmt/libbuiltin/libbuiltin_utils.c + * binfmt/builtin.c and binfmt/libbuiltin: Add a binary "loader" + that can be used to execute builtin programs from the BINFS + file system. diff --git a/nuttx/binfmt/builtin.c b/nuttx/binfmt/builtin.c new file mode 100644 index 0000000000..e591ebea82 --- /dev/null +++ b/nuttx/binfmt/builtin.c @@ -0,0 +1,195 @@ +/**************************************************************************** + * binfmt/builtin.c + * + * Copyright (C) 2012 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * 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. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include +#include + +#include +#include +#include +#include +#include + +#include +#include +#include + +#ifdef CONFIG_BUILTIN + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +/**************************************************************************** + * Private Function Prototypes + ****************************************************************************/ + +static int builtin_loadbinary(FAR struct binary_s *binp); + +/**************************************************************************** + * Private Data + ****************************************************************************/ + +static struct binfmt_s g_builtin_binfmt = +{ + NULL, /* next */ + builtin_loadbinary, /* load */ +}; + +/**************************************************************************** + * Private Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: builtin_loadbinary + * + * Description: + * Verify that the file is an builtin binary. + * + ****************************************************************************/ + +static int builtin_loadbinary(struct binary_s *binp) +{ + FAR const char *filename; + int fd; + int index; + int ret; + + bvdbg("Loading file: %s\n", binp->filename); + + /* Open the binary file for reading (only) */ + + fd = open(filename, O_RDONLY); + if (fd < 0) + { + int errval = errno; + bdbg("ERROR: Failed to open binary %s: %d\n", filename, errval); + return -errval; + } + + /* If this file is a BINFS file system, then we can recover the name of + * the file using the FIOC_FILENAME ioctl() call. + */ + + ret = ioctl(fd, FIOC_FILENAME, (unsigned long)((uintptr_t)&filename)); + if (ret < 0) + { + int errval = errno; + bdbg("ERROR: FIOC_FILENAME ioctl failed: %d\n", errval); + return -errval; + } + + /* Other file systems may also support FIOC_FILENAME, so the real proof + * is that we can look up the index to this name in g_builtins[]. + */ + + index = builtin_isavail(filename); + if (index < 0) + { + int errval = errno; + bdbg("ERROR: %s is not a builtin application\n", filename); + return -errval; + + } + + /* Return the load information. NOTE: that there is no way to configure + * the priority. That is a bug and needs to be fixed. + */ + + binp->entrypt = g_builtins[index].main; + binp->stacksize = g_builtins[index].stacksize; + return OK; +} + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: builtin_initialize + * + * Description: + * Builtin support is built unconditionally. However, it order to + * use this binary format, this function must be called during system + * format in order to register the builtin binary format. + * + * Returned Value: + * This is a NuttX internal function so it follows the convention that + * 0 (OK) is returned on success and a negated errno is returned on + * failure. + * + ****************************************************************************/ + +int builtin_initialize(void) +{ + int ret; + + /* Register ourselves as a binfmt loader */ + + bvdbg("Registering Builtin Loader\n"); + + ret = register_binfmt(&g_builtin_binfmt); + if (ret != 0) + { + bdbg("Failed to register binfmt: %d\n", ret); + } + + return ret; +} + +/**************************************************************************** + * Name: builtin_uninitialize + * + * Description: + * Unregister the builtin binary loader + * + * Returned Value: + * None + * + ****************************************************************************/ + +void builtin_uninitialize(void) +{ + unregister_binfmt(&g_builtin_binfmt); +} + +#endif /* CONFIG_BUILTIN */ + diff --git a/nuttx/binfmt/elf.c b/nuttx/binfmt/elf.c index bcebf13ca5..9dc59fbdd5 100644 --- a/nuttx/binfmt/elf.c +++ b/nuttx/binfmt/elf.c @@ -183,7 +183,7 @@ static int elf_loadbinary(struct binary_s *binp) bvdbg("Loading file: %s\n", binp->filename); - /* Initialize the xflat library to load the program binary. */ + /* Initialize the ELF library to load the program binary. */ ret = elf_init(binp->filename, &loadinfo); elf_dumploadinfo(&loadinfo); diff --git a/nuttx/binfmt/libbuiltin/Make.defs b/nuttx/binfmt/libbuiltin/Make.defs index 1d129294c2..96e8b6c37b 100644 --- a/nuttx/binfmt/libbuiltin/Make.defs +++ b/nuttx/binfmt/libbuiltin/Make.defs @@ -33,11 +33,14 @@ # ############################################################################ -# Legacy configurations don't set CONFIG_BUILTIN -# ifeq ($(CONFIG_BUILTIN),y) +ifeq ($(CONFIG_BUILTIN),y) # Builtin application interfaces +BINFMT_CSRCS += builtin.c + +# Builtin library interfaces + BINFMT_CSRCS += libbuiltin_utils.c # Hook the libelf subdirectory into the build @@ -46,4 +49,4 @@ VPATH += libbuiltin SUBDIRS += libbuiltin DEPPATH += --dep-path libbuiltin -# endif +endif diff --git a/nuttx/configs/cloudctrl/nsh/defconfig b/nuttx/configs/cloudctrl/nsh/defconfig index 8f145d3ab9..009d9bdfa2 100644 --- a/nuttx/configs/cloudctrl/nsh/defconfig +++ b/nuttx/configs/cloudctrl/nsh/defconfig @@ -463,6 +463,7 @@ CONFIG_MM_REGIONS=1 # CONFIG_BINFMT_DISABLE is not set # CONFIG_NXFLAT is not set # CONFIG_ELF is not set +CONFIG_BUILTIN=y # CONFIG_SYMTAB_ORDEREDBYNAME is not set # @@ -505,7 +506,6 @@ CONFIG_HAVE_CXX=y # # Named Applications # -CONFIG_BUILTIN=y # # Examples diff --git a/nuttx/configs/compal_e88/nsh_highram/defconfig b/nuttx/configs/compal_e88/nsh_highram/defconfig index a6868e8698..7715317b73 100644 --- a/nuttx/configs/compal_e88/nsh_highram/defconfig +++ b/nuttx/configs/compal_e88/nsh_highram/defconfig @@ -250,6 +250,8 @@ CONFIG_NSH_NOMAC=y CONFIG_NSH_IPADDR=0x0a000002 CONFIG_NSH_DRIPADDR=0x0a000001 CONFIG_NSH_NETMASK=0xffffff00 + +CONFIG_BUILTIN=y CONFIG_NSH_BUILTIN_APPS=y # diff --git a/nuttx/configs/compal_e99/nsh_compalram/defconfig b/nuttx/configs/compal_e99/nsh_compalram/defconfig index 058dc2aa29..8739c6b91e 100644 --- a/nuttx/configs/compal_e99/nsh_compalram/defconfig +++ b/nuttx/configs/compal_e99/nsh_compalram/defconfig @@ -256,6 +256,8 @@ CONFIG_NSH_NOMAC=y CONFIG_NSH_IPADDR=0x0a000002 CONFIG_NSH_DRIPADDR=0x0a000001 CONFIG_NSH_NETMASK=0xffffff00 + +CONFIG_BUILTIN=y CONFIG_NSH_BUILTIN_APPS=y # diff --git a/nuttx/configs/compal_e99/nsh_highram/defconfig b/nuttx/configs/compal_e99/nsh_highram/defconfig index ee1405ca5e..9efcd9a810 100644 --- a/nuttx/configs/compal_e99/nsh_highram/defconfig +++ b/nuttx/configs/compal_e99/nsh_highram/defconfig @@ -254,6 +254,8 @@ CONFIG_NSH_NOMAC=y CONFIG_NSH_IPADDR=0x0a000002 CONFIG_NSH_DRIPADDR=0x0a000001 CONFIG_NSH_NETMASK=0xffffff00 + +CONFIG_BUILTIN=y CONFIG_NSH_BUILTIN_APPS=y # diff --git a/nuttx/configs/fire-stm32v2/nsh/defconfig b/nuttx/configs/fire-stm32v2/nsh/defconfig index 2660984968..7a4bc1beda 100644 --- a/nuttx/configs/fire-stm32v2/nsh/defconfig +++ b/nuttx/configs/fire-stm32v2/nsh/defconfig @@ -501,6 +501,15 @@ CONFIG_FAT_MAXFNAME=32 CONFIG_MM_REGIONS=1 # CONFIG_GRAN is not set +# +# Binary Formats +# +# CONFIG_BINFMT_DISABLE is not set +# CONFIG_NXFLAT is not set +# CONFIG_ELF is not set +CONFIG_BUILTIN=y +# CONFIG_SYMTAB_ORDEREDBYNAME is not set + # # Library Routines # @@ -531,7 +540,6 @@ CONFIG_LIB_SENDFILE_BUFSIZE=512 # # Named Applications # -CONFIG_BUILTIN=y # # Examples diff --git a/nuttx/configs/hymini-stm32v/nsh2/defconfig b/nuttx/configs/hymini-stm32v/nsh2/defconfig index 7183a8632c..61c7fcd690 100644 --- a/nuttx/configs/hymini-stm32v/nsh2/defconfig +++ b/nuttx/configs/hymini-stm32v/nsh2/defconfig @@ -447,6 +447,7 @@ CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3 # # Settings for apps/nshlib # +CONFIG_BUILTIN=y CONFIG_NSH_BUILTIN_APPS=y CONFIG_NSH_FILEIOSIZE=512 CONFIG_NSH_STRERROR=n diff --git a/nuttx/configs/mirtoo/ostest/defconfig b/nuttx/configs/mirtoo/ostest/defconfig index 7c8596dbf4..46612d9936 100644 --- a/nuttx/configs/mirtoo/ostest/defconfig +++ b/nuttx/configs/mirtoo/ostest/defconfig @@ -401,7 +401,7 @@ CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3 # # Settings for apps/nshlib # -CONFIG_NSH_BUILTIN_APPS=y +CONFIG_NSH_BUILTIN_APPS=n CONFIG_NSH_FILEIOSIZE=512 CONFIG_NSH_STRERROR=n CONFIG_NSH_LINELEN=64 diff --git a/nuttx/configs/olimex-lpc1766stk/ftpc/defconfig b/nuttx/configs/olimex-lpc1766stk/ftpc/defconfig index 15b26899b0..a25be53de4 100755 --- a/nuttx/configs/olimex-lpc1766stk/ftpc/defconfig +++ b/nuttx/configs/olimex-lpc1766stk/ftpc/defconfig @@ -163,7 +163,7 @@ CONFIG_RAW_BINARY=n # # General OS setup # -CONFIG_USER_ENTRYPOINT="ftpc_main" +CONFIG_USER_ENTRYPOINT="nsh_main" CONFIG_DEBUG=n CONFIG_DEBUG_VERBOSE=n CONFIG_DEBUG_SYMBOLS=n @@ -489,6 +489,7 @@ CONFIG_EXAMPLES_BUTTONS_NAME7="RIGHT" # # Settings for apps/nshlib # +CONFIG_BUILTIN=y CONFIG_NSH_BUILTIN_APPS=y CONFIG_NSH_FILEIOSIZE=512 CONFIG_NSH_STRERROR=n diff --git a/nuttx/configs/olimex-lpc1766stk/nsh/defconfig b/nuttx/configs/olimex-lpc1766stk/nsh/defconfig index 8ed82a3edd..c096cdb0e4 100755 --- a/nuttx/configs/olimex-lpc1766stk/nsh/defconfig +++ b/nuttx/configs/olimex-lpc1766stk/nsh/defconfig @@ -470,6 +470,7 @@ CONFIG_EXAMPLES_BUTTONS_NAME7="RIGHT" # # Settings for apps/nshlib # +CONFIG_BUILTIN=y CONFIG_NSH_BUILTIN_APPS=y CONFIG_NSH_FILEIOSIZE=512 CONFIG_NSH_STRERROR=n diff --git a/nuttx/configs/olimex-stm32-p107/nsh/defconfig b/nuttx/configs/olimex-stm32-p107/nsh/defconfig index 09d447e145..1dcb5123a4 100644 --- a/nuttx/configs/olimex-stm32-p107/nsh/defconfig +++ b/nuttx/configs/olimex-stm32-p107/nsh/defconfig @@ -476,6 +476,7 @@ CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3 # # Settings for apps/nshlib # +CONFIG_BUILTIN=y CONFIG_NSH_BUILTIN_APPS=y CONFIG_NSH_FILEIOSIZE=512 CONFIG_NSH_STRERROR=n diff --git a/nuttx/configs/pcblogic-pic32mx/nsh/defconfig b/nuttx/configs/pcblogic-pic32mx/nsh/defconfig index fe24cb886f..d59e2b7d20 100644 --- a/nuttx/configs/pcblogic-pic32mx/nsh/defconfig +++ b/nuttx/configs/pcblogic-pic32mx/nsh/defconfig @@ -398,6 +398,7 @@ CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3 # # Settings for apps/nshlib # +CONFIG_BUILTIN=y CONFIG_NSH_BUILTIN_APPS=y CONFIG_NSH_FILEIOSIZE=512 CONFIG_NSH_STRERROR=n diff --git a/nuttx/configs/pic32-starterkit/nsh/defconfig b/nuttx/configs/pic32-starterkit/nsh/defconfig index 8bf0432e28..b50dd77fb6 100644 --- a/nuttx/configs/pic32-starterkit/nsh/defconfig +++ b/nuttx/configs/pic32-starterkit/nsh/defconfig @@ -562,6 +562,7 @@ CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3 # # Settings for apps/nshlib # +CONFIG_BUILTIN=y CONFIG_NSH_BUILTIN_APPS=y CONFIG_NSH_FILEIOSIZE=512 CONFIG_NSH_STRERROR=n diff --git a/nuttx/configs/pic32-starterkit/nsh2/defconfig b/nuttx/configs/pic32-starterkit/nsh2/defconfig index fb54a2949f..2a1be755d2 100644 --- a/nuttx/configs/pic32-starterkit/nsh2/defconfig +++ b/nuttx/configs/pic32-starterkit/nsh2/defconfig @@ -561,6 +561,7 @@ CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3 # # Settings for apps/nshlib # +CONFIG_BUILTIN=y CONFIG_NSH_BUILTIN_APPS=y CONFIG_NSH_FILEIOSIZE=512 CONFIG_NSH_STRERROR=n diff --git a/nuttx/configs/pic32mx7mmb/nsh/defconfig b/nuttx/configs/pic32mx7mmb/nsh/defconfig index 62f524ee2a..eb4b64e72d 100644 --- a/nuttx/configs/pic32mx7mmb/nsh/defconfig +++ b/nuttx/configs/pic32mx7mmb/nsh/defconfig @@ -608,6 +608,7 @@ CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3 # # Settings for apps/nshlib # +CONFIG_BUILTIN=y CONFIG_NSH_BUILTIN_APPS=y CONFIG_NSH_FILEIOSIZE=512 CONFIG_NSH_STRERROR=n diff --git a/nuttx/configs/sam3u-ek/touchscreen/defconfig b/nuttx/configs/sam3u-ek/touchscreen/defconfig index 278c55478d..25f8086359 100755 --- a/nuttx/configs/sam3u-ek/touchscreen/defconfig +++ b/nuttx/configs/sam3u-ek/touchscreen/defconfig @@ -443,6 +443,7 @@ CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3 # # Settings for apps/nshlib # +CONFIG_BUILTIN=y CONFIG_NSH_BUILTIN_APPS=y CONFIG_NSH_FILEIOSIZE=512 CONFIG_NSH_STRERROR=n diff --git a/nuttx/configs/shenzhou/nsh/defconfig b/nuttx/configs/shenzhou/nsh/defconfig index 383522b6f1..d23290e86b 100644 --- a/nuttx/configs/shenzhou/nsh/defconfig +++ b/nuttx/configs/shenzhou/nsh/defconfig @@ -463,6 +463,7 @@ CONFIG_MM_REGIONS=1 # CONFIG_BINFMT_DISABLE is not set # CONFIG_NXFLAT is not set # CONFIG_ELF is not set +CONFIG_BUILTIN=y # CONFIG_SYMTAB_ORDEREDBYNAME is not set # @@ -505,7 +506,6 @@ CONFIG_HAVE_CXX=y # # Named Applications # -CONFIG_BUILTIN=y # # Examples diff --git a/nuttx/configs/shenzhou/nxwm/defconfig b/nuttx/configs/shenzhou/nxwm/defconfig index b9bf72aebb..e13fb72dc9 100644 --- a/nuttx/configs/shenzhou/nxwm/defconfig +++ b/nuttx/configs/shenzhou/nxwm/defconfig @@ -586,6 +586,7 @@ CONFIG_MM_REGIONS=1 # CONFIG_BINFMT_EXEPATH is not set # CONFIG_NXFLAT is not set # CONFIG_ELF is not set +# CONFIG_BUILTIN is not set # CONFIG_PIC is not set # CONFIG_SYMTAB_ORDEREDBYNAME is not set @@ -630,7 +631,6 @@ CONFIG_HAVE_CXXINITIALIZE=y # # Named Applications # -CONFIG_BUILTIN=y # # Examples diff --git a/nuttx/configs/shenzhou/thttpd/defconfig b/nuttx/configs/shenzhou/thttpd/defconfig index d7af34821e..05d5fa3372 100644 --- a/nuttx/configs/shenzhou/thttpd/defconfig +++ b/nuttx/configs/shenzhou/thttpd/defconfig @@ -474,7 +474,6 @@ CONFIG_HAVE_CXX=y # # Named Applications # -CONFIG_BUILTIN=y # # Examples @@ -835,6 +834,7 @@ CONFIG_NETUTILS_WEBCLIENT=y # NSH Library # CONFIG_NSH_LIBRARY=y +CONFIG_BUILTIN=y CONFIG_NSH_BUILTIN_APPS=y # diff --git a/nuttx/configs/sim/nsh/defconfig b/nuttx/configs/sim/nsh/defconfig index 146519aa67..3f52dfe694 100644 --- a/nuttx/configs/sim/nsh/defconfig +++ b/nuttx/configs/sim/nsh/defconfig @@ -230,6 +230,7 @@ CONFIG_EXAMPLES_OSTEST_STACKSIZE=8192 # # Settings for apps/nshlib # +CONFIG_BUILTIN=y CONFIG_NSH_BUILTIN_APPS=y CONFIG_NSH_FILEIOSIZE=1024 CONFIG_NSH_STRERROR=n diff --git a/nuttx/configs/sim/nsh2/defconfig b/nuttx/configs/sim/nsh2/defconfig index b7e31b9e32..bcbe806ccb 100644 --- a/nuttx/configs/sim/nsh2/defconfig +++ b/nuttx/configs/sim/nsh2/defconfig @@ -274,6 +274,7 @@ CONFIG_EXAMPLES_OSTEST_STACKSIZE=8192 # # Settings for apps/nshlib # +CONFIG_BUILTIN=y CONFIG_NSH_BUILTIN_APPS=y CONFIG_NSH_FILEIOSIZE=1024 CONFIG_NSH_STRERROR=n diff --git a/nuttx/configs/stm3210e-eval/nsh2/defconfig b/nuttx/configs/stm3210e-eval/nsh2/defconfig index 063307143b..2be2dcefd3 100644 --- a/nuttx/configs/stm3210e-eval/nsh2/defconfig +++ b/nuttx/configs/stm3210e-eval/nsh2/defconfig @@ -571,6 +571,7 @@ CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3 # # Settings for apps/nshlib # +CONFIG_BUILTIN=y CONFIG_NSH_BUILTIN_APPS=y CONFIG_NSH_FILEIOSIZE=512 CONFIG_NSH_STRERROR=n diff --git a/nuttx/configs/stm3210e-eval/nxconsole/defconfig b/nuttx/configs/stm3210e-eval/nxconsole/defconfig index 94dbf500f2..9e7ed363fd 100644 --- a/nuttx/configs/stm3210e-eval/nxconsole/defconfig +++ b/nuttx/configs/stm3210e-eval/nxconsole/defconfig @@ -496,6 +496,7 @@ CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3 # # Settings for apps/nshlib # +CONFIG_BUILTIN=y CONFIG_NSH_BUILTIN_APPS=y CONFIG_NSH_FILEIOSIZE=512 CONFIG_NSH_STRERROR=n diff --git a/nuttx/configs/stm3210e-eval/pm/defconfig b/nuttx/configs/stm3210e-eval/pm/defconfig index c113ddf60b..e4a976727f 100644 --- a/nuttx/configs/stm3210e-eval/pm/defconfig +++ b/nuttx/configs/stm3210e-eval/pm/defconfig @@ -616,6 +616,7 @@ CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3 # # Settings for apps/nshlib # +CONFIG_BUILTIN=y CONFIG_NSH_BUILTIN_APPS=y CONFIG_NSH_FILEIOSIZE=512 CONFIG_NSH_STRERROR=n diff --git a/nuttx/configs/stm3220g-eval/nsh/defconfig b/nuttx/configs/stm3220g-eval/nsh/defconfig index 8486c4fd6f..71a03d2122 100644 --- a/nuttx/configs/stm3220g-eval/nsh/defconfig +++ b/nuttx/configs/stm3220g-eval/nsh/defconfig @@ -672,6 +672,7 @@ CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3 # # Settings for apps/nshlib # +CONFIG_BUILTIN=y CONFIG_NSH_BUILTIN_APPS=y CONFIG_NSH_FILEIOSIZE=512 CONFIG_NSH_STRERROR=n diff --git a/nuttx/configs/stm3220g-eval/nsh2/defconfig b/nuttx/configs/stm3220g-eval/nsh2/defconfig index bc641b8be6..84950645bd 100644 --- a/nuttx/configs/stm3220g-eval/nsh2/defconfig +++ b/nuttx/configs/stm3220g-eval/nsh2/defconfig @@ -659,6 +659,7 @@ CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3 # # Settings for apps/nshlib # +CONFIG_BUILTIN=y CONFIG_NSH_BUILTIN_APPS=y CONFIG_NSH_FILEIOSIZE=512 CONFIG_NSH_STRERROR=n diff --git a/nuttx/configs/stm3220g-eval/ostest/defconfig b/nuttx/configs/stm3220g-eval/ostest/defconfig index 3ec4175161..f03f67cbda 100644 --- a/nuttx/configs/stm3220g-eval/ostest/defconfig +++ b/nuttx/configs/stm3220g-eval/ostest/defconfig @@ -562,7 +562,7 @@ CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3 # # Settings for apps/nshlib # -CONFIG_NSH_BUILTIN_APPS=y +CONFIG_NSH_BUILTIN_APPS=n CONFIG_NSH_FILEIOSIZE=512 CONFIG_NSH_STRERROR=n CONFIG_NSH_LINELEN=64 diff --git a/nuttx/configs/stm3240g-eval/nsh/defconfig b/nuttx/configs/stm3240g-eval/nsh/defconfig index 82caf16226..efc60cd2f7 100644 --- a/nuttx/configs/stm3240g-eval/nsh/defconfig +++ b/nuttx/configs/stm3240g-eval/nsh/defconfig @@ -672,6 +672,7 @@ CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3 # # Settings for apps/nshlib # +CONFIG_BUILTIN=y CONFIG_NSH_BUILTIN_APPS=y CONFIG_NSH_FILEIOSIZE=512 CONFIG_NSH_STRERROR=n diff --git a/nuttx/configs/stm3240g-eval/nsh2/defconfig b/nuttx/configs/stm3240g-eval/nsh2/defconfig index 9e7d57adee..122910e4ea 100644 --- a/nuttx/configs/stm3240g-eval/nsh2/defconfig +++ b/nuttx/configs/stm3240g-eval/nsh2/defconfig @@ -619,6 +619,7 @@ CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3 # # Settings for apps/nshlib # +CONFIG_BUILTIN=y CONFIG_NSH_BUILTIN_APPS=y CONFIG_NSH_FILEIOSIZE=512 CONFIG_NSH_STRERROR=n diff --git a/nuttx/configs/stm3240g-eval/nxconsole/defconfig b/nuttx/configs/stm3240g-eval/nxconsole/defconfig index 92c3ceb75e..bd8be9f5d3 100644 --- a/nuttx/configs/stm3240g-eval/nxconsole/defconfig +++ b/nuttx/configs/stm3240g-eval/nxconsole/defconfig @@ -642,6 +642,7 @@ CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3 # # Settings for apps/nshlib # +CONFIG_BUILTIN=y CONFIG_NSH_BUILTIN_APPS=y CONFIG_NSH_FILEIOSIZE=512 CONFIG_NSH_STRERROR=n diff --git a/nuttx/configs/stm3240g-eval/ostest/defconfig b/nuttx/configs/stm3240g-eval/ostest/defconfig index f9e690a103..f7eb4ef958 100644 --- a/nuttx/configs/stm3240g-eval/ostest/defconfig +++ b/nuttx/configs/stm3240g-eval/ostest/defconfig @@ -574,7 +574,7 @@ CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3 # # Settings for apps/nshlib # -CONFIG_NSH_BUILTIN_APPS=y +CONFIG_NSH_BUILTIN_APPS=n CONFIG_NSH_FILEIOSIZE=512 CONFIG_NSH_STRERROR=n CONFIG_NSH_LINELEN=64 diff --git a/nuttx/configs/stm3240g-eval/webserver/defconfig b/nuttx/configs/stm3240g-eval/webserver/defconfig index 792eafa0a1..6b4d47e53b 100644 --- a/nuttx/configs/stm3240g-eval/webserver/defconfig +++ b/nuttx/configs/stm3240g-eval/webserver/defconfig @@ -673,7 +673,7 @@ CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3 # # Settings for apps/nshlib # -CONFIG_NSH_BUILTIN_APPS=y +CONFIG_NSH_BUILTIN_APPS=n CONFIG_NSH_FILEIOSIZE=512 CONFIG_NSH_STRERROR=n CONFIG_NSH_LINELEN=64 diff --git a/nuttx/configs/stm32f100rc_generic/nsh/defconfig b/nuttx/configs/stm32f100rc_generic/nsh/defconfig index 12193e7ed8..aea79ff3f8 100644 --- a/nuttx/configs/stm32f100rc_generic/nsh/defconfig +++ b/nuttx/configs/stm32f100rc_generic/nsh/defconfig @@ -393,6 +393,7 @@ CONFIG_MM_REGIONS=1 # CONFIG_BINFMT_DISABLE is not set # CONFIG_NXFLAT is not set # CONFIG_ELF is not set +CONFIG_BUILTIN=y CONFIG_SYMTAB_ORDEREDBYNAME=y # @@ -428,7 +429,6 @@ CONFIG_LIB_SENDFILE_BUFSIZE=512 # # Named Applications # -CONFIG_BUILTIN=y # # Examples diff --git a/nuttx/configs/stm32f4discovery/nsh/defconfig b/nuttx/configs/stm32f4discovery/nsh/defconfig index d9917b3a85..3ec1170556 100644 --- a/nuttx/configs/stm32f4discovery/nsh/defconfig +++ b/nuttx/configs/stm32f4discovery/nsh/defconfig @@ -603,6 +603,7 @@ CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3 # # Settings for apps/nshlib # +CONFIG_BUILTIN=y CONFIG_NSH_BUILTIN_APPS=y CONFIG_NSH_FILEIOSIZE=512 CONFIG_NSH_STRERROR=n diff --git a/nuttx/configs/stm32f4discovery/pm/defconfig b/nuttx/configs/stm32f4discovery/pm/defconfig index 1636f6ecb0..3322350505 100644 --- a/nuttx/configs/stm32f4discovery/pm/defconfig +++ b/nuttx/configs/stm32f4discovery/pm/defconfig @@ -622,6 +622,7 @@ CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3 # # Settings for apps/nshlib # +CONFIG_BUILTIN=y CONFIG_NSH_BUILTIN_APPS=y CONFIG_NSH_FILEIOSIZE=512 CONFIG_NSH_STRERROR=n diff --git a/nuttx/configs/sure-pic32mx/nsh/defconfig b/nuttx/configs/sure-pic32mx/nsh/defconfig index d15bac1f45..a5977733c9 100644 --- a/nuttx/configs/sure-pic32mx/nsh/defconfig +++ b/nuttx/configs/sure-pic32mx/nsh/defconfig @@ -434,6 +434,7 @@ CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3 # # Settings for apps/nshlib # +CONFIG_BUILTIN=y CONFIG_NSH_BUILTIN_APPS=y CONFIG_NSH_FILEIOSIZE=512 CONFIG_NSH_STRERROR=n diff --git a/nuttx/configs/sure-pic32mx/usbnsh/defconfig b/nuttx/configs/sure-pic32mx/usbnsh/defconfig index 3ebfde8343..3ab4563e99 100644 --- a/nuttx/configs/sure-pic32mx/usbnsh/defconfig +++ b/nuttx/configs/sure-pic32mx/usbnsh/defconfig @@ -431,6 +431,7 @@ CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3 # # Settings for apps/nshlib # +CONFIG_BUILTIN=y CONFIG_NSH_BUILTIN_APPS=y CONFIG_NSH_FILEIOSIZE=512 CONFIG_NSH_STRERROR=n diff --git a/nuttx/configs/ubw32/nsh/defconfig b/nuttx/configs/ubw32/nsh/defconfig index 8769fa677c..c9718ca8d0 100644 --- a/nuttx/configs/ubw32/nsh/defconfig +++ b/nuttx/configs/ubw32/nsh/defconfig @@ -421,6 +421,7 @@ CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3 # # Settings for apps/nshlib # +CONFIG_BUILTIN=y CONFIG_NSH_BUILTIN_APPS=y CONFIG_NSH_FILEIOSIZE=512 CONFIG_NSH_STRERROR=n diff --git a/nuttx/configs/vsn/nsh/defconfig b/nuttx/configs/vsn/nsh/defconfig index 5ec7e06ebb..88d14aba61 100755 --- a/nuttx/configs/vsn/nsh/defconfig +++ b/nuttx/configs/vsn/nsh/defconfig @@ -459,6 +459,7 @@ CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3 # # Settings for apps/nshlib # +CONFIG_BUILTIN=y CONFIG_NSH_BUILTIN_APPS=y CONFIG_NSH_FILEIOSIZE=512 CONFIG_NSH_STRERROR=n diff --git a/nuttx/fs/fs_mount.c b/nuttx/fs/fs_mount.c index 1b3da8dc3c..a91e7d3669 100644 --- a/nuttx/fs/fs_mount.c +++ b/nuttx/fs/fs_mount.c @@ -221,7 +221,7 @@ int mount(FAR const char *source, FAR const char *target, /* Find the specified filesystem. Try the block driver file systems first */ #ifdef BDFS_SUPPORT - if ((mops = mount_findfs(g_bdfsmap, filesystemtype)) != NULL) + if (source && (mops = mount_findfs(g_bdfsmap, filesystemtype)) != NULL) { /* Make sure that a block driver argument was provided */ From e7e1c6aee0e0d84f290995a092c1722878a54044 Mon Sep 17 00:00:00 2001 From: patacongo Date: Wed, 16 Jan 2013 21:38:00 +0000 Subject: [PATCH 079/118] convert configs/sim/nsh to use kconfig-frontends git-svn-id: http://svn.code.sf.net/p/nuttx/code/trunk@5526 42af7a65-404d-4744-a932-0658087f49c3 --- apps/examples/Makefile | 8 +- apps/examples/README.txt | 2 +- apps/examples/hello/Makefile | 2 +- nuttx/ChangeLog | 3 + nuttx/Documentation/NuttShell.html | 18 +- .../configs/compal_e88/nsh_highram/defconfig | 2 +- .../compal_e99/nsh_compalram/defconfig | 2 +- .../configs/compal_e99/nsh_highram/defconfig | 3 +- nuttx/configs/sim/README.txt | 19 +- nuttx/configs/sim/nsh/appconfig | 47 -- nuttx/configs/sim/nsh/defconfig | 651 ++++++++++++------ 11 files changed, 491 insertions(+), 266 deletions(-) delete mode 100644 nuttx/configs/sim/nsh/appconfig diff --git a/apps/examples/Makefile b/apps/examples/Makefile index a11dbf2405..9397480750 100644 --- a/apps/examples/Makefile +++ b/apps/examples/Makefile @@ -57,13 +57,11 @@ SUBDIRS += usbserial sendmail usbstorage usbterm watchdog wget wgetjson CNTXTDIRS = pwm ifeq ($(CONFIG_NSH_BUILTIN_APPS),y) -CNTXTDIRS += adc can cdcacm composite cxxtest dhcpd discover ftpd json keypadtest -CNTXTDIRS += modbus nettest nxlines relays qencoder telnetd watchdog wgetjson +CNTXTDIRS += adc can cdcacm composite cxxtest dhcpd discover ftpd hello json +CNTXTDIRS += keypadtestmodbus nettest nxlines relays qencoder telnetd watchdog +CNTXTDIRS += wgetjson endif -ifeq ($(CONFIG_EXAMPLES_HELLO_BUILTIN),y) -CNTXTDIRS += hello -endif ifeq ($(CONFIG_EXAMPLES_HELLOXX_BUILTIN),y) CNTXTDIRS += helloxx endif diff --git a/apps/examples/README.txt b/apps/examples/README.txt index 5c6332ee33..5996cbb708 100644 --- a/apps/examples/README.txt +++ b/apps/examples/README.txt @@ -491,7 +491,7 @@ examples/hello than examples/null with a single printf statement. Really useful only for bringing up new NuttX architectures. - * CONFIG_EXAMPLES_HELLO_BUILTIN + * CONFIG_NSH_BUILTIN_APPS Build the "Hello, World" example as an NSH built-in application. examples/helloxx diff --git a/apps/examples/hello/Makefile b/apps/examples/hello/Makefile index fc98fa7f45..c3b9744d7f 100644 --- a/apps/examples/hello/Makefile +++ b/apps/examples/hello/Makefile @@ -83,7 +83,7 @@ $(COBJS): %$(OBJEXT): %.c $(call ARCHIVE, $(BIN), $(OBJS)) @touch .built -ifeq ($(CONFIG_EXAMPLES_HELLO_BUILTIN),y) +ifeq ($(CONFIG_NSH_BUILTIN_APPS),y) $(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat: $(DEPCONFIG) Makefile $(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main) diff --git a/nuttx/ChangeLog b/nuttx/ChangeLog index 8d6d813639..6bc66ec9df 100644 --- a/nuttx/ChangeLog +++ b/nuttx/ChangeLog @@ -3965,3 +3965,6 @@ * binfmt/builtin.c and binfmt/libbuiltin: Add a binary "loader" that can be used to execute builtin programs from the BINFS file system. + * configs/sim/nsh: Convert to use kconfig-frontends configuration + tool. + diff --git a/nuttx/Documentation/NuttShell.html b/nuttx/Documentation/NuttShell.html index 273898476d..950428e8af 100644 --- a/nuttx/Documentation/NuttShell.html +++ b/nuttx/Documentation/NuttShell.html @@ -2518,6 +2518,8 @@ nsh> Support external registered, "builtin" applications that can be executed from the NSH command line (see apps/README.txt for more information). + This required CONFIG_BUILTIN to enable NuttX support for + "builtin" applications. @@ -3227,8 +3229,20 @@ struct cmdmap_s

          These applications are built-into NSH in the sense that they can be executed by simply typing the name of the application at the NSH prompt. - Built-in application support is enabled with the configuration option CONFIG_NSH_BUILTIN_APPS. - When this configuration option is set, you will also be able to see the built-in applications if you enter "nsh> help". + Built-in application support is enabled with these configuration option: +

          +
            +
          • + CONFIG_BUILTIN: + Enable NuttX support for builtin applications. +
          • +
          • + CONFIG_NSH_BUILTIN_APPS: + Enable NSH support for builtin applications. +
          • +
          +

          + When these configuration options are set, you will also be able to see the built-in applications if you enter "nsh> help". They will appear at the bottom of the list of NSH commands under:

          diff --git a/nuttx/configs/compal_e88/nsh_highram/defconfig b/nuttx/configs/compal_e88/nsh_highram/defconfig index 7715317b73..9d5c0e3c40 100644 --- a/nuttx/configs/compal_e88/nsh_highram/defconfig +++ b/nuttx/configs/compal_e88/nsh_highram/defconfig @@ -256,7 +256,7 @@ CONFIG_NSH_BUILTIN_APPS=y # # Settings for examples/hello -CONFIG_EXAMPLES_HELLO_BUILTIN=y +# # # Settings for examples/wget diff --git a/nuttx/configs/compal_e99/nsh_compalram/defconfig b/nuttx/configs/compal_e99/nsh_compalram/defconfig index 8739c6b91e..79fe93ab52 100644 --- a/nuttx/configs/compal_e99/nsh_compalram/defconfig +++ b/nuttx/configs/compal_e99/nsh_compalram/defconfig @@ -224,7 +224,7 @@ CONFIG_NET_RESOLV_ENTRIES=4 # # Settings for examples/hello -CONFIG_EXAMPLES_HELLO_BUILTIN=y +# # # Settings for examples/uip diff --git a/nuttx/configs/compal_e99/nsh_highram/defconfig b/nuttx/configs/compal_e99/nsh_highram/defconfig index 9efcd9a810..11ee153fa3 100644 --- a/nuttx/configs/compal_e99/nsh_highram/defconfig +++ b/nuttx/configs/compal_e99/nsh_highram/defconfig @@ -260,7 +260,8 @@ CONFIG_NSH_BUILTIN_APPS=y # # Settings for examples/hello -CONFIG_EXAMPLES_HELLO_BUILTIN=y +# + CONFIG_EXAMPLES_NXHELLO_BUILTIN=y CONFIG_EXAMPLES_NXTEXT_BUILTIN=y CONFIG_EXAMPLES_NXIMAGE_BUILTIN=y diff --git a/nuttx/configs/sim/README.txt b/nuttx/configs/sim/README.txt index 165e92b962..6e124a3a18 100644 --- a/nuttx/configs/sim/README.txt +++ b/nuttx/configs/sim/README.txt @@ -270,13 +270,26 @@ nsh Description ----------- - Configures to use the NuttShell at apps/examples/nsh. This version has - one builtin function: This configuration: apps/examples/hello. This - configuration may be selected as follows: + Configures to use the NuttShell at apps/examples/nsh. This configuration + may be selected as follows: cd /tools ./configure.sh sim/nsh + NOTES: + ------ + 1. This configuration uses the mconf-based configuration tool. To + change this configuration using that tool, you should: + + a. Build and install the kconfig-mconf tool. See nuttx/README.txt + and misc/tools/ + + b. Execute 'make menuconfig' in nuttx/ in order to start the + reconfiguration process. + + 2. This version has one builtin function: This configuration: + apps/examples/hello. + nsh2 Description diff --git a/nuttx/configs/sim/nsh/appconfig b/nuttx/configs/sim/nsh/appconfig deleted file mode 100644 index 3f50f68187..0000000000 --- a/nuttx/configs/sim/nsh/appconfig +++ /dev/null @@ -1,47 +0,0 @@ -############################################################################ -# configs/sim/nsh/appconfig -# -# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved. -# Author: Gregory Nutt -# -# 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. -# -############################################################################ - -# Path to example in apps/examples containing the user_start entry point - -CONFIGURED_APPS += examples/nsh - -# The NSH Library - -CONFIGURED_APPS += system/readline -CONFIGURED_APPS += nshlib - -# Example built-in application - -CONFIGURED_APPS += examples/hello diff --git a/nuttx/configs/sim/nsh/defconfig b/nuttx/configs/sim/nsh/defconfig index 3f52dfe694..8dc5ddccea 100644 --- a/nuttx/configs/sim/nsh/defconfig +++ b/nuttx/configs/sim/nsh/defconfig @@ -1,148 +1,154 @@ -############################################################################ -# sim/nsh/defconfig # -# Copyright (C) 2008-2013 Gregory Nutt. All rights reserved. -# Author: Gregory Nutt +# Automatically generated file; DO NOT EDIT. +# Nuttx/ Configuration # -# 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. -# -############################################################################ -# -# Architecture selection -# -CONFIG_ARCH="sim" -CONFIG_ARCH_SIM=y -CONFIG_ARCH_BOARD="sim" -CONFIG_ARCH_BOARD_SIM=y +CONFIG_NUTTX_NEWCONFIG=y # -# General OS setup +# Build Setup # -CONFIG_USER_ENTRYPOINT="nsh_main" -CONFIG_DEBUG=n -CONFIG_DEBUG_VERBOSE=n +# CONFIG_EXPERIMENTAL is not set +CONFIG_HOST_LINUX=y +# CONFIG_HOST_OSX is not set +# CONFIG_HOST_WINDOWS is not set +# CONFIG_HOST_OTHER is not set + +# +# Build Configuration +# +# CONFIG_APPS_DIR="../apps" +# CONFIG_BUILD_2PASS is not set + +# +# Binary Output Formats +# +# CONFIG_RRLOAD_BINARY is not set +# CONFIG_INTELHEX_BINARY is not set +# CONFIG_MOTOROLA_SREC is not set +# CONFIG_RAW_BINARY is not set + +# +# Customize Header Files +# +# CONFIG_ARCH_STDBOOL_H is not set +# CONFIG_ARCH_MATH_H is not set +# CONFIG_ARCH_FLOAT_H is not set +# CONFIG_ARCH_STDARG_H is not set + +# +# Debug Options +# +# CONFIG_DEBUG is not set CONFIG_DEBUG_SYMBOLS=y -CONFIG_HAVE_CXX=n -CONFIG_HAVE_CXXINITIALIZE=n -CONFIG_MM_REGIONS=1 -CONFIG_ARCH_LOWPUTC=y +# +# System Type +# +# CONFIG_ARCH_8051 is not set +# CONFIG_ARCH_ARM is not set +# CONFIG_ARCH_AVR is not set +# CONFIG_ARCH_HC is not set +# CONFIG_ARCH_MIPS is not set +# CONFIG_ARCH_RGMP is not set +# CONFIG_ARCH_SH is not set +CONFIG_ARCH_SIM=y +# CONFIG_ARCH_X86 is not set +# CONFIG_ARCH_Z16 is not set +# CONFIG_ARCH_Z80 is not set +CONFIG_ARCH="sim" +CONFIG_BOARD_LOOPSPERMSEC= + +# +# Simulation Configuration Options +# +# CONFIG_SIM_M32 is not set +# CONFIG_SIM_WALLTIME is not set + +# +# Architecture Options +# +# CONFIG_ARCH_NOINTC is not set +# CONFIG_ARCH_VECNOTIRQ is not set +# CONFIG_ARCH_DMA is not set +# CONFIG_ARCH_IRQPRIO is not set +# CONFIG_CUSTOM_STACK is not set +# CONFIG_ADDRENV is not set +# CONFIG_ARCH_HAVE_VFORK is not set +# CONFIG_ARCH_STACKDUMP is not set +# CONFIG_ENDIAN_BIG is not set +# CONFIG_ARCH_HAVE_RAMFUNCS is not set + +# +# Board Settings +# +CONFIG_DRAM_START= +CONFIG_DRAM_SIZE= + +# +# Boot options +# +CONFIG_BOOT_RUNFROMEXTSRAM=y +# CONFIG_BOOT_RUNFROMFLASH is not set +# CONFIG_BOOT_RUNFROMISRAM is not set +# CONFIG_BOOT_RUNFROMSDRAM is not set +# CONFIG_BOOT_COPYTORAM is not set + +# +# Board Selection +# +CONFIG_ARCH_BOARD_SIM=y +# CONFIG_ARCH_BOARD_CUSTOM is not set +CONFIG_ARCH_BOARD="sim" + +# +# Common Board Options +# +CONFIG_NSH_MMCSDMINOR=0 + +# +# Board-Specific Options +# + +# +# RTOS Features +# +CONFIG_MSEC_PER_TICK=10 CONFIG_RR_INTERVAL=0 -CONFIG_SCHED_INSTRUMENTATION=n +# CONFIG_SCHED_INSTRUMENTATION is not set CONFIG_TASK_NAME_SIZE=32 +# CONFIG_SCHED_HAVE_PARENT is not set +# CONFIG_JULIAN_TIME is not set CONFIG_START_YEAR=2008 CONFIG_START_MONTH=6 CONFIG_START_DAY=1 -CONFIG_JULIAN_TIME=n CONFIG_DEV_CONSOLE=y -CONFIG_DEV_LOWCONSOLE=n -CONFIG_MUTEX_TYPES=n -CONFIG_PRIORITY_INHERITANCE=n -CONFIG_SEM_PREALLOCHOLDERS=0 -CONFIG_SEM_NNESTPRIO=0 -CONFIG_FDCLONE_DISABLE=n -CONFIG_FDCLONE_STDIO=n +# CONFIG_MUTEX_TYPES is not set +# CONFIG_PRIORITY_INHERITANCE is not set +# CONFIG_FDCLONE_DISABLE is not set +# CONFIG_FDCLONE_STDIO is not set CONFIG_SDCLONE_DISABLE=y -CONFIG_SCHED_WORKQUEUE=n -CONFIG_SCHED_WORKPRIORITY=192 -CONFIG_SCHED_WORKPERIOD=50000 -CONFIG_SCHED_WORKSTACKSIZE=1024 -CONFIG_SIG_SIGWORK=17 +# CONFIG_SCHED_WORKQUEUE is not set CONFIG_SCHED_WAITPID=y -CONFIG_SCHED_ATEXIT=n -CONFIG_SCHED_ONEXIT=n - -# -# System Logging -# - -CONFIG_SYSLOG=n -CONFIG_SYSLOG_DEVPATH="/dev/syslog" -CONFIG_SYSLOG_CHAR=n - -CONFIG_RAMLOG=n -CONFIG_RAMLOG_CONSOLE=n -CONFIG_RAMLOG_SYSLOG=y -#CONFIG_RAMLOG_NPOLLWAITERS -#CONFIG_RAMLOG_CONSOLE_BUFSIZE - -# -# The following can be used to disable categories of -# APIs supported by the OS. If the compiler supports -# weak functions, then it should not be necessary to -# disable functions unless you want to restrict usage -# of those APIs. -# -# There are certain dependency relationships in these -# features. -# -# o mq_notify logic depends on signals to awaken tasks -# waiting for queues to become full or empty. -# o pthread_condtimedwait() depends on signals to wake -# up waiting tasks. -# -CONFIG_DISABLE_CLOCK=n -CONFIG_DISABLE_POSIX_TIMERS=n -CONFIG_DISABLE_PTHREAD=n -CONFIG_DISABLE_SIGNALS=n -CONFIG_DISABLE_MQUEUE=n -CONFIG_DISABLE_MOUNTPOINT=n -CONFIG_DISABLE_ENVIRON=n +# CONFIG_SCHED_ATEXIT is not set +# CONFIG_SCHED_ONEXIT is not set +CONFIG_USER_ENTRYPOINT="nsh_main" +CONFIG_DISABLE_OS_API=y +# CONFIG_DISABLE_CLOCK is not set +# CONFIG_DISABLE_POSIX_TIMERS is not set +# CONFIG_DISABLE_PTHREAD is not set +# CONFIG_DISABLE_SIGNALS is not set +# CONFIG_DISABLE_MQUEUE is not set +# CONFIG_DISABLE_MOUNTPOINT is not set +# CONFIG_DISABLE_ENVIRON is not set CONFIG_DISABLE_POLL=y # -# Misc libc settings +# Signal Numbers # -CONFIG_NOPRINTF_FIELDWIDTH=n - -# -# Allow for architecture optimized implementations -# -# The architecture can provide optimized versions of the -# following to improve sysem performance -# -CONFIG_ARCH_MEMCPY=n -CONFIG_ARCH_MEMCMP=n -CONFIG_ARCH_MEMMOVE=n -CONFIG_ARCH_MEMSET=n -CONFIG_ARCH_STRCMP=n -CONFIG_ARCH_STRCPY=n -CONFIG_ARCH_STRNCPY=n -CONFIG_ARCH_STRLEN=n -CONFIG_ARCH_STRNLEN=n -CONFIG_ARCH_BZERO=n - -# -# General build options -# -CONFIG_RRLOAD_BINARY=n -CONFIG_INTELHEX_BINARY=n -CONFIG_RAW_BINARY=n +CONFIG_SIG_SIGUSR1=1 +CONFIG_SIG_SIGUSR2=2 +CONFIG_SIG_SIGALARM=3 +CONFIG_SIG_SIGCONDTIMEDOUT=16 # # Sizes of configurable things (0 disables) @@ -153,8 +159,6 @@ CONFIG_NPTHREAD_KEYS=4 CONFIG_NFILE_DESCRIPTORS=32 CONFIG_NFILE_STREAMS=16 CONFIG_NAME_MAX=32 -CONFIG_STDIO_BUFFER_SIZE=1024 -CONFIG_NUNGET_CHARS=2 CONFIG_PREALLOC_MQ_MSGS=32 CONFIG_MQ_MAXMSGSIZE=32 CONFIG_MAX_WDOGPARMS=4 @@ -162,91 +166,299 @@ CONFIG_PREALLOC_WDOGS=32 CONFIG_PREALLOC_TIMERS=8 # -# Filesystem configuration +# Stack and heap information # +CONFIG_IDLETHREAD_STACKSIZE=4096 +CONFIG_USERMAIN_STACKSIZE=4096 +CONFIG_PTHREAD_STACK_MIN=256 +CONFIG_PTHREAD_STACK_DEFAULT=8192 + +# +# Device Drivers +# +CONFIG_DEV_NULL=y +# CONFIG_DEV_ZERO is not set +# CONFIG_LOOP is not set +# CONFIG_RAMDISK is not set +# CONFIG_CAN is not set +# CONFIG_PWM is not set +# CONFIG_I2C is not set +# CONFIG_SPI is not set +# CONFIG_RTC is not set +# CONFIG_WATCHDOG is not set +# CONFIG_ANALOG is not set +# CONFIG_BCH is not set +# CONFIG_INPUT is not set +# CONFIG_LCD is not set +# CONFIG_MMCSD is not set +# CONFIG_MTD is not set +# CONFIG_PIPES is not set +# CONFIG_PM is not set +# CONFIG_POWER is not set +# CONFIG_SENSORS is not set +# CONFIG_SERCOMM_CONSOLE is not set +CONFIG_SERIAL=y +# CONFIG_DEV_LOWCONSOLE is not set +# CONFIG_16550_UART is not set +# CONFIG_STANDARD_SERIAL is not set +# CONFIG_USBDEV is not set +# CONFIG_USBHOST is not set +# CONFIG_WIRELESS is not set + +# +# System Logging Device Options +# + +# +# System Logging +# +# CONFIG_RAMLOG is not set + +# +# Networking Support +# +# CONFIG_NET is not set + +# +# File Systems +# + +# +# File system configuration +# +# CONFIG_FS_RAMMAP is not set CONFIG_FS_FAT=y CONFIG_FAT_LCNAMES=y -CONFIG_FAT_LFN=n +CONFIG_FAT_LFN=y CONFIG_FAT_MAXFNAME=32 -CONFIG_FS_NXFFS=n +# CONFIG_FS_FATTIME is not set +# CONFIG_FAT_DMAMEMORY is not set +# CONFIG_FS_NXFFS is not set CONFIG_FS_ROMFS=y CONFIG_FS_BINFS=y # -# TCP/IP and UDP support via uIP +# System Logging # -CONFIG_NET=n -CONFIG_NET_IPv6=n -CONFIG_NSOCKET_DESCRIPTORS=0 -CONFIG_NET_SOCKOPTS=y -CONFIG_NET_BUFSIZE=420 -CONFIG_NET_TCP=n -CONFIG_NET_TCP_CONNS=40 -CONFIG_NET_MAX_LISTENPORTS=40 -CONFIG_NET_UDP=n -CONFIG_NET_UDP_CHECKSUMS=y -#CONFIG_NET_UDP_CONNS=10 -CONFIG_NET_ICMP=n -CONFIG_NET_ICMP_PING=n -#CONFIG_NET_PINGADDRCONF=0 -CONFIG_NET_STATISTICS=y -#CONFIG_NET_RECEIVE_WINDOW= -#CONFIG_NET_ARPTAB_SIZE=8 -CONFIG_NET_BROADCAST=n +# CONFIG_SYSLOG is not set # -# Settings for examples/hello +# Graphics Support # -CONFIG_EXAMPLES_HELLO_BUILTIN=y +# CONFIG_NX is not set # -# UIP Network Utilities +# Memory Management # -CONFIG_NET_DHCP_LIGHT=n -CONFIG_NET_RESOLV_ENTRIES=4 +# CONFIG_MM_SMALL is not set +CONFIG_MM_REGIONS=1 +# CONFIG_GRAN is not set # -# Settings for examples/uip -CONFIG_EXAMPLES_UIP_IPADDR=0xc0a80080 -CONFIG_EXAMPLES_UIP_DRIPADDR=0xc0a80001 -CONFIG_EXAMPLES_UIP_NETMASK=0xffffff00 -CONFIG_EXAMPLES_UIP_DHCPC=n - -# -# Settings for examples/nettest -CONFIG_EXAMPLES_NETTEST_SERVER=n -CONFIG_EXAMPLES_NETTEST_PERFORMANCE=n -CONFIG_EXAMPLES_NETTEST_NOMAC=n -CONFIG_EXAMPLES_NETTEST_IPADDR=0xc0a80080 -CONFIG_EXAMPLES_NETTEST_DRIPADDR=0xc0a80001 -CONFIG_EXAMPLES_NETTEST_NETMASK=0xffffff00 -CONFIG_EXAMPLES_NETTEST_CLIENTIP=0xc0a8006a - -# -# Settings for examples/ostest -CONFIG_EXAMPLES_OSTEST_LOOPS=100 -CONFIG_EXAMPLES_OSTEST_STACKSIZE=8192 - -# -# Settings for apps/nshlib +# Binary Formats # +# CONFIG_BINFMT_DISABLE is not set +# CONFIG_BINFMT_EXEPATH is not set +# CONFIG_NXFLAT is not set +# CONFIG_ELF is not set CONFIG_BUILTIN=y +# CONFIG_PIC is not set +# CONFIG_SYMTAB_ORDEREDBYNAME is not set + +# +# Library Routines +# + +# +# Standard C Library Options +# +CONFIG_STDIO_BUFFER_SIZE=1024 +CONFIG_STDIO_LINEBUFFER=y +CONFIG_NUNGET_CHARS=2 +CONFIG_LIB_HOMEDIR="/" +# CONFIG_LIBM is not set +# CONFIG_NOPRINTF_FIELDWIDTH is not set +# CONFIG_LIBC_FLOATINGPOINT is not set +# CONFIG_EOL_IS_CR is not set +# CONFIG_EOL_IS_LF is not set +# CONFIG_EOL_IS_BOTH_CRLF is not set +CONFIG_EOL_IS_EITHER_CRLF=y +# CONFIG_LIBC_EXECFUNCS is not set +# CONFIG_LIBC_STRERROR is not set +# CONFIG_LIBC_PERROR_STDOUT is not set +CONFIG_ARCH_LOWPUTC=y +CONFIG_LIB_SENDFILE_BUFSIZE=512 +# CONFIG_ARCH_ROMGETC is not set +# CONFIG_ARCH_OPTIMIZED_FUNCTIONS is not set + +# +# Non-standard Helper Functions +# +# CONFIG_LIB_KBDCODEC is not set + +# +# Basic CXX Support +# +# CONFIG_C99_BOOL8 is not set +# CONFIG_HAVE_CXX is not set + +# +# Application Configuration +# + +# +# Built-In Applications +# +CONFIG_BUILTIN_PROXY_STACKSIZE=1024 + +# +# Examples +# +# CONFIG_EXAMPLES_BUTTONS is not set +# CONFIG_EXAMPLES_CAN is not set +# CONFIG_EXAMPLES_CDCACM is not set +# CONFIG_EXAMPLES_COMPOSITE is not set +# CONFIG_EXAMPLES_DHCPD is not set +# CONFIG_EXAMPLES_ELF is not set +# CONFIG_EXAMPLES_FTPC is not set +# CONFIG_EXAMPLES_FTPD is not set +CONFIG_EXAMPLES_HELLO=y +# CONFIG_EXAMPLES_HELLOXX is not set +# CONFIG_EXAMPLES_JSON is not set +# CONFIG_EXAMPLES_HIDKBD is not set +# CONFIG_EXAMPLES_KEYPADTEST is not set +# CONFIG_EXAMPLES_IGMP is not set +# CONFIG_EXAMPLES_LCDRW is not set +# CONFIG_EXAMPLES_MM is not set +# CONFIG_EXAMPLES_MOUNT is not set +# CONFIG_EXAMPLES_MODBUS is not set +# CONFIG_EXAMPLES_NETTEST is not set +CONFIG_EXAMPLES_NSH=y +# CONFIG_EXAMPLES_NULL is not set +# CONFIG_EXAMPLES_NX is not set +# CONFIG_EXAMPLES_NXCONSOLE is not set +# CONFIG_EXAMPLES_NXFFS is not set +# CONFIG_EXAMPLES_NXFLAT is not set +# CONFIG_EXAMPLES_NXHELLO is not set +# CONFIG_EXAMPLES_NXIMAGE is not set +# CONFIG_EXAMPLES_NXLINES is not set +# CONFIG_EXAMPLES_NXTEXT is not set +# CONFIG_EXAMPLES_OSTEST is not set +# CONFIG_EXAMPLES_PASHELLO is not set +# CONFIG_EXAMPLES_PIPE is not set +# CONFIG_EXAMPLES_POLL is not set +# CONFIG_EXAMPLES_POSIXSPAWN is not set +# CONFIG_EXAMPLES_QENCODER is not set +# CONFIG_EXAMPLES_RGMP is not set +# CONFIG_EXAMPLES_ROMFS is not set +# CONFIG_EXAMPLES_SENDMAIL is not set +# CONFIG_EXAMPLES_SERLOOP is not set +# CONFIG_EXAMPLES_TELNETD is not set +# CONFIG_EXAMPLES_THTTPD is not set +# CONFIG_EXAMPLES_TIFF is not set +# CONFIG_EXAMPLES_TOUCHSCREEN is not set +# CONFIG_EXAMPLES_UDP is not set +# CONFIG_EXAMPLES_UIP is not set +# CONFIG_EXAMPLES_USBSERIAL is not set +# CONFIG_EXAMPLES_USBMSC is not set +# CONFIG_EXAMPLES_USBTERM is not set +# CONFIG_EXAMPLES_WATCHDOG is not set + +# +# Interpreters +# + +# +# Interpreters +# +# CONFIG_INTERPRETERS_FICL is not set +# CONFIG_INTERPRETERS_PCODE is not set + +# +# Network Utilities +# + +# +# Networking Utilities +# +# CONFIG_NETUTILS_CODECS is not set +# CONFIG_NETUTILS_DHCPC is not set +# CONFIG_NETUTILS_DHCPD is not set +# CONFIG_NETUTILS_FTPC is not set +# CONFIG_NETUTILS_FTPD is not set +# CONFIG_NETUTILS_JSON is not set +# CONFIG_NETUTILS_RESOLV is not set +# CONFIG_NETUTILS_SMTP is not set +# CONFIG_NETUTILS_TELNETD is not set +# CONFIG_NETUTILS_TFTPC is not set +# CONFIG_NETUTILS_THTTPD is not set +# CONFIG_NETUTILS_UIPLIB is not set +# CONFIG_NETUTILS_WEBCLIENT is not set + +# +# ModBus +# + +# +# FreeModbus +# +# CONFIG_MODBUS is not set + +# +# NSH Library +# +CONFIG_NSH_LIBRARY=y CONFIG_NSH_BUILTIN_APPS=y + +# +# Disable Individual commands +# +# CONFIG_NSH_DISABLE_CAT is not set +# CONFIG_NSH_DISABLE_CD is not set +# CONFIG_NSH_DISABLE_CP is not set +# CONFIG_NSH_DISABLE_DD is not set +# CONFIG_NSH_DISABLE_ECHO is not set +# CONFIG_NSH_DISABLE_EXEC is not set +# CONFIG_NSH_DISABLE_EXIT is not set +# CONFIG_NSH_DISABLE_FREE is not set +# CONFIG_NSH_DISABLE_GET is not set +# CONFIG_NSH_DISABLE_HELP is not set +# CONFIG_NSH_DISABLE_HEXDUMP is not set +# CONFIG_NSH_DISABLE_IFCONFIG is not set +# CONFIG_NSH_DISABLE_KILL is not set +# CONFIG_NSH_DISABLE_LOSETUP is not set +# CONFIG_NSH_DISABLE_LS is not set +# CONFIG_NSH_DISABLE_MB is not set +# CONFIG_NSH_DISABLE_MKDIR is not set +# CONFIG_NSH_DISABLE_MKFATFS is not set +# CONFIG_NSH_DISABLE_MKFIFO is not set +# CONFIG_NSH_DISABLE_MKRD is not set +# CONFIG_NSH_DISABLE_MH is not set +# CONFIG_NSH_DISABLE_MOUNT is not set +# CONFIG_NSH_DISABLE_MW is not set +# CONFIG_NSH_DISABLE_NSFMOUNT is not set +# CONFIG_NSH_DISABLE_PS is not set +# CONFIG_NSH_DISABLE_PING is not set +# CONFIG_NSH_DISABLE_PUT is not set +# CONFIG_NSH_DISABLE_PWD is not set +# CONFIG_NSH_DISABLE_RM is not set +# CONFIG_NSH_DISABLE_RMDIR is not set +# CONFIG_NSH_DISABLE_SET is not set +# CONFIG_NSH_DISABLE_SH is not set +# CONFIG_NSH_DISABLE_SLEEP is not set +# CONFIG_NSH_DISABLE_TEST is not set +# CONFIG_NSH_DISABLE_UMOUNT is not set +# CONFIG_NSH_DISABLE_UNSET is not set +# CONFIG_NSH_DISABLE_USLEEP is not set +# CONFIG_NSH_DISABLE_WGET is not set +# CONFIG_NSH_DISABLE_XD is not set +CONFIG_NSH_CODECS_BUFSIZE=128 CONFIG_NSH_FILEIOSIZE=1024 -CONFIG_NSH_STRERROR=n CONFIG_NSH_LINELEN=80 CONFIG_NSH_NESTDEPTH=3 -CONFIG_NSH_DISABLESCRIPT=n -CONFIG_NSH_DISABLEBG=n +# CONFIG_NSH_DISABLESCRIPT is not set +# CONFIG_NSH_DISABLEBG is not set CONFIG_NSH_ROMFSETC=y -CONFIG_NSH_CONSOLE=y -CONFIG_NSH_TELNET=n -CONFIG_NSH_IOBUFFER_SIZE=512 -CONFIG_NSH_DHCPC=n -CONFIG_NSH_NOMAC=n -CONFIG_NSH_IPADDR=0x0a000002 -CONFIG_NSH_DRIPADDR=0x0a000001 -CONFIG_NSH_NETMASK=0xffffff00 CONFIG_NSH_ROMFSMOUNTPT="/etc" CONFIG_NSH_INITSCRIPT="init.d/rcS" CONFIG_NSH_ROMFSDEVNO=1 @@ -255,23 +467,54 @@ CONFIG_NSH_FATDEVNO=2 CONFIG_NSH_FATSECTSIZE=512 CONFIG_NSH_FATNSECTORS=1024 CONFIG_NSH_FATMOUNTPT="/tmp" +CONFIG_NSH_CONSOLE=y +# CONFIG_NSH_CONDEV is not set +# CONFIG_NSH_ARCHINIT is not set # -# Settings for examples/mount -CONFIG_EXAMPLES_MOUNT_DEVNAME="/dev/ram0" -#CONFIG_EXAMPLES_MOUNT_NSECTORS=2048 -#CONFIG_EXAMPLES_MOUNT_SECTORSIZE=512 -#CONFIG_EXAMPLES_MOUNT_RAMDEVNO=1 +# NxWidgets/NxWM +# # -# Stack and heap information +# System NSH Add-Ons # -CONFIG_BOOT_RUNFROMFLASH=n -CONFIG_BOOT_COPYTORAM=n -CONFIG_CUSTOM_STACK=n -CONFIG_IDLETHREAD_STACKSIZE=4096 -CONFIG_USERMAIN_STACKSIZE=4096 -CONFIG_PTHREAD_STACK_MIN=256 -CONFIG_PTHREAD_STACK_DEFAULT=8192 -CONFIG_HEAP_BASE= -CONFIG_HEAP_SIZE= + +# +# Custom Free Memory Command +# +# CONFIG_SYSTEM_FREE is not set + +# +# I2C tool +# + +# +# FLASH Program Installation +# +# CONFIG_SYSTEM_INSTALL is not set + +# +# readline() +# +CONFIG_SYSTEM_READLINE=y +CONFIG_READLINE_ECHO=y + +# +# Power Off +# +# CONFIG_SYSTEM_POWEROFF is not set + +# +# RAMTRON +# +# CONFIG_SYSTEM_RAMTRON is not set + +# +# SD Card +# +# CONFIG_SYSTEM_SDCARD is not set + +# +# Sysinfo +# +# CONFIG_SYSTEM_SYSINFO is not set From caeef71797019505fd450b1a0ae573ac5e490c6e Mon Sep 17 00:00:00 2001 From: patacongo Date: Thu, 17 Jan 2013 00:30:12 +0000 Subject: [PATCH 080/118] Change the way thread priority is handled in binfmt/ to better match the way that priority is set up for the builtin tasks git-svn-id: http://svn.code.sf.net/p/nuttx/code/trunk@5527 42af7a65-404d-4744-a932-0658087f49c3 --- apps/examples/elf/elf_main.c | 2 +- apps/examples/nxflat/nxflat_main.c | 2 +- nuttx/Documentation/NuttXBinfmt.html | 26 +++++- nuttx/Documentation/NuttXNxFlat.html | 2 +- nuttx/binfmt/binfmt_exec.c | 18 +--- nuttx/binfmt/binfmt_execmodule.c | 6 +- nuttx/binfmt/binfmt_loadmodule.c | 43 +++++++++ nuttx/binfmt/builtin.c | 1 + nuttx/binfmt/libbuiltin/Make.defs | 4 +- nuttx/binfmt/libbuiltin/libbuiltin_getname.c | 92 +++++++++++++++++++ ...ibbuiltin_utils.c => libbuiltin_isavail.c} | 21 +---- nuttx/configs/sim/README.txt | 10 ++ nuttx/include/nuttx/binfmt/binfmt.h | 11 ++- 13 files changed, 189 insertions(+), 49 deletions(-) create mode 100644 nuttx/binfmt/libbuiltin/libbuiltin_getname.c rename nuttx/binfmt/libbuiltin/{libbuiltin_utils.c => libbuiltin_isavail.c} (88%) diff --git a/apps/examples/elf/elf_main.c b/apps/examples/elf/elf_main.c index 66a47592c8..2b5c0eb5eb 100644 --- a/apps/examples/elf/elf_main.c +++ b/apps/examples/elf/elf_main.c @@ -321,7 +321,7 @@ int elf_main(int argc, char *argv[]) /* Execute the ELF module */ - ret = exec_module(&bin, 50); + ret = exec_module(&bin); mm_update(&g_mmstep, "after exec_module"); diff --git a/apps/examples/nxflat/nxflat_main.c b/apps/examples/nxflat/nxflat_main.c index 536bc1dd82..0c4846a5cc 100644 --- a/apps/examples/nxflat/nxflat_main.c +++ b/apps/examples/nxflat/nxflat_main.c @@ -243,7 +243,7 @@ int nxflat_main(int argc, char *argv[]) /* Execute the ELF module */ - ret = exec_module(&bin, 50); + ret = exec_module(&bin); if (ret < 0) { err("ERROR: Failed to execute program '%s'\n", dirlist[i]); diff --git a/nuttx/Documentation/NuttXBinfmt.html b/nuttx/Documentation/NuttXBinfmt.html index 9c9fd3a510..7528b188bc 100644 --- a/nuttx/Documentation/NuttXBinfmt.html +++ b/nuttx/Documentation/NuttXBinfmt.html @@ -8,7 +8,7 @@

          NuttX Binary Loader

          -

          Last Updated: December 17, 2012

          +

          Last Updated: January 16, 2013

          @@ -141,7 +141,7 @@ struct binary_s { /* Information provided to the loader to load and bind a module */ - FAR const char *filename; /* Full path to the binary to be loaded1 */ + FAR const char *filename; /* Full path to the binary to be loaded */ FAR const char **argv; /* Argument list */ FAR const struct symtab_s *exports; /* Table of exported symbols */ int nexports; /* The number of symbols in exports[] */ @@ -153,13 +153,33 @@ struct binary_s main_t entrypt; /* Entry point into a program module */ FAR void *mapped; /* Memory-mapped, address space */ FAR void *alloc[BINFMT_NALLOC]; /* Allocated address spaces */ + + /* Constructors/destructors */ + #ifdef CONFIG_BINFMT_CONSTRUCTORS FAR binfmt_ctor_t *ctors; /* Pointer to a list of constructors */ FAR binfmt_dtor_t *dtors; /* Pointer to a list of destructors */ uint16_t nctors; /* Number of constructors in the list */ uint16_t ndtors; /* Number of destructors in the list */ #endif + + /* Address environment. + * + * addrenv - This is the handle created by up_addrenv_create() that can be + * used to manage the tasks address space. + */ + +#ifdef CONFIG_ADDRENV + task_addrenv_t addrenv; /* Task address environment */ +#endif + size_t mapsize; /* Size of the mapped address region (needed for munmap) */ + + /* Start-up information that is provided by the loader, but may be modified + * by the caller between load_module() and exec_module() calls. + */ + + uint8_t priority; /* Task execution priority */ size_t stacksize; /* Size of the stack in bytes (unallocated) */ };
        @@ -291,7 +311,7 @@ This is a NuttX internal function so it follows the convention that 0 (OK<

        Function Prototype:

           #include <:nuttx/binfmt/binfmt.h>
          -int exec_module(FAR const struct binary_s *bin, int priority);
          +int exec_module(FAR const struct binary_s *bin);
           

        Description:

          diff --git a/nuttx/Documentation/NuttXNxFlat.html b/nuttx/Documentation/NuttXNxFlat.html index 3a2ed80460..ed04f7f773 100644 --- a/nuttx/Documentation/NuttXNxFlat.html +++ b/nuttx/Documentation/NuttXNxFlat.html @@ -668,7 +668,7 @@ cat ../syscall/syscall.csv ../libc/lib.csv | sort >tmp.csv

        -

        int exec_module(FAR const struct binary_s *bin, int priority) +

        int exec_module(FAR const struct binary_s *bin)

          Description: Execute a module that has been loaded into memory by load_module(). diff --git a/nuttx/binfmt/binfmt_exec.c b/nuttx/binfmt/binfmt_exec.c index d5e2747103..d878c8cc50 100644 --- a/nuttx/binfmt/binfmt_exec.c +++ b/nuttx/binfmt/binfmt_exec.c @@ -40,7 +40,6 @@ #include #include -#include #include #include @@ -75,8 +74,7 @@ * * Description: * This is a convenience function that wraps load_ and exec_module into - * one call. The priority of the executed program is set to be the - * same as the priority of the calling thread. + * one call. * * Input Parameter: * filename - Fulll path to the binary to be loaded @@ -95,18 +93,8 @@ int exec(FAR const char *filename, FAR const char **argv, FAR const struct symtab_s *exports, int nexports) { struct binary_s bin; - struct sched_param param; int ret; - /* Get the priority of this thread */ - - ret = sched_getparam(0, ¶m); - if (ret < 0) - { - bdbg("ERROR: sched_getparam failed: %d\n", errno); - return ERROR; - } - /* Load the module into memory */ memset(&bin, 0, sizeof(struct binary_s)); @@ -121,9 +109,9 @@ int exec(FAR const char *filename, FAR const char **argv, return ERROR; } - /* Then start the module at the priority of this thread */ + /* Then start the module */ - ret = exec_module(&bin, param.sched_priority); + ret = exec_module(&bin); if (ret < 0) { bdbg("ERROR: Failed to execute program '%s'\n", filename); diff --git a/nuttx/binfmt/binfmt_execmodule.c b/nuttx/binfmt/binfmt_execmodule.c index df8da53435..afa445abb9 100644 --- a/nuttx/binfmt/binfmt_execmodule.c +++ b/nuttx/binfmt/binfmt_execmodule.c @@ -144,7 +144,7 @@ static inline int exec_ctors(FAR const struct binary_s *binp) * ****************************************************************************/ -int exec_module(FAR const struct binary_s *binp, int priority) +int exec_module(FAR const struct binary_s *binp) { FAR _TCB *tcb; #ifndef CONFIG_CUSTOM_STACK @@ -187,12 +187,12 @@ int exec_module(FAR const struct binary_s *binp, int priority) /* Initialize the task */ - ret = task_init(tcb, binp->filename, priority, stack, + ret = task_init(tcb, binp->filename, binp->priority, stack, binp->stacksize, binp->entrypt, binp->argv); #else /* Initialize the task */ - ret = task_init(tcb, binp->filename, priority, stack, + ret = task_init(tcb, binp->filename, binp->priority, stack, binp->entrypt, binp->argv); #endif if (ret < 0) diff --git a/nuttx/binfmt/binfmt_loadmodule.c b/nuttx/binfmt/binfmt_loadmodule.c index 112a6b35b1..4f3dc69524 100644 --- a/nuttx/binfmt/binfmt_loadmodule.c +++ b/nuttx/binfmt/binfmt_loadmodule.c @@ -66,6 +66,39 @@ * Private Functions ****************************************************************************/ +/**************************************************************************** + * Name: load_default_priority + * + * Description: + * Set the default priority of the module to be loaded. This may be + * changed (1) by the actions of the binary format's load() method if + * the binary format contains priority informaition, or (2) by the user + * between calls to load_module() and exec_module(). + * + * Returned Value: + * Zero (OK) is returned on success; Otherwise, -1 (ERROR) is returned and + * the errno variable is set appropriately. + * + ****************************************************************************/ + +static int load_default_priority(FAR struct binary_s *bin) +{ + struct sched_param param; + + /* Get the priority of this thread */ + + ret = sched_getparam(0, ¶m); + if (ret < 0) + { + bdbg("ERROR: sched_getparam failed: %d\n", errno); + return ERROR; + } + + /* Save that as the priority of child thread */ + + bin->priority = param.sched_priority; +} + /**************************************************************************** * Name: load_absmodule * @@ -145,6 +178,16 @@ int load_module(FAR struct binary_s *bin) if (bin && bin->filename) #endif { + /* Set the default priority of the new program. */ + + ret = load_default_priority(bin) + if (ret < 0) + { + /* The errno is already set in this case */ + + return ERROR; + } + /* Were we given a relative path? Or an absolute path to the file to * be loaded? Absolute paths start with '/'. */ diff --git a/nuttx/binfmt/builtin.c b/nuttx/binfmt/builtin.c index e591ebea82..d36cb63265 100644 --- a/nuttx/binfmt/builtin.c +++ b/nuttx/binfmt/builtin.c @@ -136,6 +136,7 @@ static int builtin_loadbinary(struct binary_s *binp) binp->entrypt = g_builtins[index].main; binp->stacksize = g_builtins[index].stacksize; + binp->priority = g_builtins[index].priority; return OK; } diff --git a/nuttx/binfmt/libbuiltin/Make.defs b/nuttx/binfmt/libbuiltin/Make.defs index 96e8b6c37b..5eec1acde4 100644 --- a/nuttx/binfmt/libbuiltin/Make.defs +++ b/nuttx/binfmt/libbuiltin/Make.defs @@ -41,9 +41,9 @@ BINFMT_CSRCS += builtin.c # Builtin library interfaces -BINFMT_CSRCS += libbuiltin_utils.c +BINFMT_CSRCS += libbuiltin_getname.c libbuiltin_isavail.c -# Hook the libelf subdirectory into the build +# Hook the libbuiltin subdirectory into the build VPATH += libbuiltin SUBDIRS += libbuiltin diff --git a/nuttx/binfmt/libbuiltin/libbuiltin_getname.c b/nuttx/binfmt/libbuiltin/libbuiltin_getname.c new file mode 100644 index 0000000000..01ac024f7a --- /dev/null +++ b/nuttx/binfmt/libbuiltin/libbuiltin_getname.c @@ -0,0 +1,92 @@ +/**************************************************************************** + * binfmt/libbuiltin/libbuiltin_getname.c + * + * Originally by: + * + * Copyright (C) 2011 Uros Platise. All rights reserved. + * Author: Uros Platise + * + * With subsequent updates, modifications, and general maintenance by: + * + * Copyright (C) 2012-2013 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * 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. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +/**************************************************************************** + * Private Types + ****************************************************************************/ + +/**************************************************************************** + * Private Function Prototypes + ****************************************************************************/ + +/**************************************************************************** + * Private Data + ****************************************************************************/ + +/**************************************************************************** + * Private Functions + ****************************************************************************/ + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: builtin_getname + * + * Description: + * Return the name of the application at index in the table of builtin + * applications. + * + ****************************************************************************/ + +FAR const char *builtin_getname(int index) +{ + if (index < 0 || index >= number_builtins()) + { + return NULL; + } + + return g_builtins[index].name; +} diff --git a/nuttx/binfmt/libbuiltin/libbuiltin_utils.c b/nuttx/binfmt/libbuiltin/libbuiltin_isavail.c similarity index 88% rename from nuttx/binfmt/libbuiltin/libbuiltin_utils.c rename to nuttx/binfmt/libbuiltin/libbuiltin_isavail.c index b53becff93..f99a4b81d5 100644 --- a/nuttx/binfmt/libbuiltin/libbuiltin_utils.c +++ b/nuttx/binfmt/libbuiltin/libbuiltin_isavail.c @@ -1,5 +1,5 @@ /**************************************************************************** - * binfmt/libbuiltin/libbuiltin_utils.c + * binfmt/libbuiltin/libbuiltin_isavail.c * * Originally by: * @@ -76,25 +76,6 @@ * Public Functions ****************************************************************************/ -/**************************************************************************** - * Name: builtin_getname - * - * Description: - * Return the name of the application at index in the table of builtin - * applications. - * - ****************************************************************************/ - -FAR const char *builtin_getname(int index) -{ - if (index < 0 || index >= number_builtins()) - { - return NULL; - } - - return g_builtins[index].name; -} - /**************************************************************************** * Name: builtin_isavail * diff --git a/nuttx/configs/sim/README.txt b/nuttx/configs/sim/README.txt index 6e124a3a18..67ff730197 100644 --- a/nuttx/configs/sim/README.txt +++ b/nuttx/configs/sim/README.txt @@ -290,6 +290,16 @@ nsh 2. This version has one builtin function: This configuration: apps/examples/hello. + 3. This configuration has BINFS enabled so that the builtin applications + can be made visible in the file system. For example: + + NuttShell (NSH) NuttX-6.24 + nsh> mount -t binfs /bin + nsh> ls /bin + /bin: + hello + nsh> + nsh2 Description diff --git a/nuttx/include/nuttx/binfmt/binfmt.h b/nuttx/include/nuttx/binfmt/binfmt.h index 480e82c09f..c6c7c874a7 100644 --- a/nuttx/include/nuttx/binfmt/binfmt.h +++ b/nuttx/include/nuttx/binfmt/binfmt.h @@ -117,6 +117,12 @@ struct binary_s #endif size_t mapsize; /* Size of the mapped address region (needed for munmap) */ + + /* Start-up information that is provided by the loader, but may be modified + * by the caller between load_module() and exec_module() calls. + */ + + uint8_t priority; /* Task execution priority */ size_t stacksize; /* Size of the stack in bytes (unallocated) */ }; @@ -221,15 +227,14 @@ int unload_module(FAR const struct binary_s *bin); * ****************************************************************************/ -int exec_module(FAR const struct binary_s *bin, int priority); +int exec_module(FAR const struct binary_s *bin); /**************************************************************************** * Name: exec * * Description: * This is a convenience function that wraps load_ and exec_module into - * one call. The priority of the executed program is set to be the - * same as the priority of the calling thread. + * one call. * * Input Parameter: * filename - Fulll path to the binary to be loaded From 8685f63c72259d18304fd9a04099e5cfa17829ba Mon Sep 17 00:00:00 2001 From: px4dev Date: Thu, 17 Jan 2013 01:18:18 -0800 Subject: [PATCH 081/118] Some gentle massaging to get things building again. --- .gitignore | 8 ++++-- apps/Makefile | 5 +++- apps/builtin/exec_builtin.c | 2 +- apps/examples/Makefile | 24 ++++++++++------- apps/namedapp/namedapp_list.h | 42 ++++++++++++++++++++++++++++++ apps/namedapp/namedapp_proto.h | 42 ++++++++++++++++++++++++++++++ nuttx/configs/px4fmu/nsh/defconfig | 1 + 7 files changed, 111 insertions(+), 13 deletions(-) create mode 100644 apps/namedapp/namedapp_list.h create mode 100644 apps/namedapp/namedapp_proto.h diff --git a/.gitignore b/.gitignore index ef0ed3c4c1..85d846b982 100644 --- a/.gitignore +++ b/.gitignore @@ -1,12 +1,16 @@ .built *.context +*.bdat +*.pdat .depend +.updated .config +.config-e .version .project .cproject -apps/namedapp/namedapp_list.h -apps/namedapp/namedapp_proto.h +apps/builtin/builtin_list.h +apps/builtin/builtin_proto.h Make.dep *.pyc *.o diff --git a/apps/Makefile b/apps/Makefile index d0cc23a5f5..d3078d0696 100644 --- a/apps/Makefile +++ b/apps/Makefile @@ -49,7 +49,10 @@ APPDIR = ${shell pwd} # list can be extended by the .config file as well. CONFIGURED_APPS = -SUBDIRS = examples graphics interpreters modbus builtin nshlib netutils system + +SUBDIRS = examples interpreters builtin nshlib system + +#SUBDIRS = examples graphics interpreters modbus builtin nshlib netutils system # There are two different mechanisms for obtaining the list of configured # directories: diff --git a/apps/builtin/exec_builtin.c b/apps/builtin/exec_builtin.c index 05648590db..9fde813d6d 100644 --- a/apps/builtin/exec_builtin.c +++ b/apps/builtin/exec_builtin.c @@ -293,7 +293,7 @@ static inline int builtin_startproxy(int index, FAR const char **argv, int errcode; int ret; - DEBUGASSERT(path); +// DEBUGASSERT(path); svdbg("index=%d argv=%p redirfile=%s oflags=%04x\n", index, argv, redirfile, oflags); diff --git a/apps/examples/Makefile b/apps/examples/Makefile index 9397480750..201be955b3 100644 --- a/apps/examples/Makefile +++ b/apps/examples/Makefile @@ -37,12 +37,15 @@ # Sub-directories -SUBDIRS = adc buttons can cdcacm composite cxxtest dhcpd discover elf ftpc -SUBDIRS += ftpd hello helloxx hidkbd igmp json keypadtest lcdrw mm modbus mount -SUBDIRS += nettest nsh null nx nxconsole nxffs nxflat nxhello nximage -SUBDIRS += nxlines nxtext ostest pashello pipe poll pwm posix_spawn qencoder -SUBDIRS += relays rgmp romfs serloop telnetd thttpd tiff touchscreen udp uip -SUBDIRS += usbserial sendmail usbstorage usbterm watchdog wget wgetjson +SUBDIRS = adc can cdcacm nsh +SUBDIRS += math_demo control_demo kalman_demo px4_deamon_app + +#SUBDIRS = adc buttons can cdcacm composite cxxtest dhcpd discover elf ftpc +#SUBDIRS += ftpd hello helloxx hidkbd igmp json keypadtest lcdrw mm modbus mount +#SUBDIRS += nettest nsh null nx nxconsole nxffs nxflat nxhello nximage +#SUBDIRS += nxlines nxtext ostest pashello pipe poll pwm posix_spawn qencoder +#SUBDIRS += relays rgmp romfs serloop telnetd thttpd tiff touchscreen udp uip +#SUBDIRS += usbserial sendmail usbstorage usbterm watchdog wget wgetjson # Sub-directories that might need context setup. Directories may need # context setup for a variety of reasons, but the most common is because @@ -57,9 +60,12 @@ SUBDIRS += usbserial sendmail usbstorage usbterm watchdog wget wgetjson CNTXTDIRS = pwm ifeq ($(CONFIG_NSH_BUILTIN_APPS),y) -CNTXTDIRS += adc can cdcacm composite cxxtest dhcpd discover ftpd hello json -CNTXTDIRS += keypadtestmodbus nettest nxlines relays qencoder telnetd watchdog -CNTXTDIRS += wgetjson + +CNTXTDIRS += adc can cdcacm + +#CNTXTDIRS += adc can cdcacm composite cxxtest dhcpd discover ftpd hello json +#CNTXTDIRS += keypadtestmodbus nettest nxlines relays qencoder telnetd watchdog +#CNTXTDIRS += wgetjson endif ifeq ($(CONFIG_EXAMPLES_HELLOXX_BUILTIN),y) diff --git a/apps/namedapp/namedapp_list.h b/apps/namedapp/namedapp_list.h new file mode 100644 index 0000000000..72d1fa52d2 --- /dev/null +++ b/apps/namedapp/namedapp_list.h @@ -0,0 +1,42 @@ +/* List of application requirements, generated during make context. */ +{ "math_demo", SCHED_PRIORITY_DEFAULT, 8192, math_demo_main }, +{ "control_demo", SCHED_PRIORITY_DEFAULT, 2048, control_demo_main }, +{ "kalman_demo", SCHED_PRIORITY_MAX - 30, 2048, kalman_demo_main }, +{ "reboot", SCHED_PRIORITY_DEFAULT, 2048, reboot_main }, +{ "perf", SCHED_PRIORITY_DEFAULT, 2048, perf_main }, +{ "top", SCHED_PRIORITY_DEFAULT - 10, 3000, top_main }, +{ "boardinfo", SCHED_PRIORITY_DEFAULT, 2048, boardinfo_main }, +{ "mixer", SCHED_PRIORITY_DEFAULT, 4096, mixer_main }, +{ "eeprom", SCHED_PRIORITY_DEFAULT, 4096, eeprom_main }, +{ "param", SCHED_PRIORITY_DEFAULT, 4096, param_main }, +{ "bl_update", SCHED_PRIORITY_DEFAULT, 4096, bl_update_main }, +{ "preflight_check", SCHED_PRIORITY_DEFAULT, 2048, preflight_check_main }, +{ "delay_test", SCHED_PRIORITY_DEFAULT, 2048, delay_test_main }, +{ "uorb", SCHED_PRIORITY_DEFAULT, 4096, uorb_main }, +{ "mavlink", SCHED_PRIORITY_DEFAULT, 2048, mavlink_main }, +{ "mavlink_onboard", SCHED_PRIORITY_DEFAULT, 2048, mavlink_onboard_main }, +{ "gps", SCHED_PRIORITY_DEFAULT, 2048, gps_main }, +{ "commander", SCHED_PRIORITY_MAX - 30, 2048, commander_main }, +{ "sdlog", SCHED_PRIORITY_MAX - 30, 2048, sdlog_main }, +{ "sensors", SCHED_PRIORITY_MAX-5, 4096, sensors_main }, +{ "ardrone_interface", SCHED_PRIORITY_MAX - 15, 2048, ardrone_interface_main }, +{ "multirotor_att_control", SCHED_PRIORITY_MAX - 15, 2048, multirotor_att_control_main }, +{ "multirotor_pos_control", SCHED_PRIORITY_MAX - 25, 2048, multirotor_pos_control_main }, +{ "fixedwing_att_control", SCHED_PRIORITY_MAX - 30, 2048, fixedwing_att_control_main }, +{ "fixedwing_pos_control", SCHED_PRIORITY_MAX - 30, 2048, fixedwing_pos_control_main }, +{ "position_estimator", SCHED_PRIORITY_DEFAULT, 4096, position_estimator_main }, +{ "attitude_estimator_ekf", SCHED_PRIORITY_DEFAULT, 2048, attitude_estimator_ekf_main }, +{ "ms5611", SCHED_PRIORITY_DEFAULT, 2048, ms5611_main }, +{ "hmc5883", SCHED_PRIORITY_DEFAULT, 4096, hmc5883_main }, +{ "mpu6000", SCHED_PRIORITY_DEFAULT, 4096, mpu6000_main }, +{ "bma180", SCHED_PRIORITY_DEFAULT, 2048, bma180_main }, +{ "l3gd20", SCHED_PRIORITY_DEFAULT, 2048, l3gd20_main }, +{ "px4io", SCHED_PRIORITY_DEFAULT, 2048, px4io_main }, +{ "blinkm", SCHED_PRIORITY_DEFAULT, 2048, blinkm_main }, +{ "tone_alarm", SCHED_PRIORITY_DEFAULT, 2048, tone_alarm_main }, +{ "adc", SCHED_PRIORITY_DEFAULT, 2048, adc_main }, +{ "fmu", SCHED_PRIORITY_DEFAULT, 2048, fmu_main }, +{ "hil", SCHED_PRIORITY_DEFAULT, 2048, hil_main }, +{ "tests", SCHED_PRIORITY_DEFAULT, 12000, tests_main }, +{ "sercon", SCHED_PRIORITY_DEFAULT, 2048, sercon_main }, +{ "serdis", SCHED_PRIORITY_DEFAULT, 2048, serdis_main }, diff --git a/apps/namedapp/namedapp_proto.h b/apps/namedapp/namedapp_proto.h new file mode 100644 index 0000000000..09f5b4156a --- /dev/null +++ b/apps/namedapp/namedapp_proto.h @@ -0,0 +1,42 @@ +/* List of application entry points, generated during make context. */ +EXTERN int math_demo_main(int argc, char *argv[]); +EXTERN int control_demo_main(int argc, char *argv[]); +EXTERN int kalman_demo_main(int argc, char *argv[]); +EXTERN int reboot_main(int argc, char *argv[]); +EXTERN int perf_main(int argc, char *argv[]); +EXTERN int top_main(int argc, char *argv[]); +EXTERN int boardinfo_main(int argc, char *argv[]); +EXTERN int mixer_main(int argc, char *argv[]); +EXTERN int eeprom_main(int argc, char *argv[]); +EXTERN int param_main(int argc, char *argv[]); +EXTERN int bl_update_main(int argc, char *argv[]); +EXTERN int preflight_check_main(int argc, char *argv[]); +EXTERN int delay_test_main(int argc, char *argv[]); +EXTERN int uorb_main(int argc, char *argv[]); +EXTERN int mavlink_main(int argc, char *argv[]); +EXTERN int mavlink_onboard_main(int argc, char *argv[]); +EXTERN int gps_main(int argc, char *argv[]); +EXTERN int commander_main(int argc, char *argv[]); +EXTERN int sdlog_main(int argc, char *argv[]); +EXTERN int sensors_main(int argc, char *argv[]); +EXTERN int ardrone_interface_main(int argc, char *argv[]); +EXTERN int multirotor_att_control_main(int argc, char *argv[]); +EXTERN int multirotor_pos_control_main(int argc, char *argv[]); +EXTERN int fixedwing_att_control_main(int argc, char *argv[]); +EXTERN int fixedwing_pos_control_main(int argc, char *argv[]); +EXTERN int position_estimator_main(int argc, char *argv[]); +EXTERN int attitude_estimator_ekf_main(int argc, char *argv[]); +EXTERN int ms5611_main(int argc, char *argv[]); +EXTERN int hmc5883_main(int argc, char *argv[]); +EXTERN int mpu6000_main(int argc, char *argv[]); +EXTERN int bma180_main(int argc, char *argv[]); +EXTERN int l3gd20_main(int argc, char *argv[]); +EXTERN int px4io_main(int argc, char *argv[]); +EXTERN int blinkm_main(int argc, char *argv[]); +EXTERN int tone_alarm_main(int argc, char *argv[]); +EXTERN int adc_main(int argc, char *argv[]); +EXTERN int fmu_main(int argc, char *argv[]); +EXTERN int hil_main(int argc, char *argv[]); +EXTERN int tests_main(int argc, char *argv[]); +EXTERN int sercon_main(int argc, char *argv[]); +EXTERN int serdis_main(int argc, char *argv[]); diff --git a/nuttx/configs/px4fmu/nsh/defconfig b/nuttx/configs/px4fmu/nsh/defconfig index 8a76f0e052..c70866d066 100755 --- a/nuttx/configs/px4fmu/nsh/defconfig +++ b/nuttx/configs/px4fmu/nsh/defconfig @@ -940,6 +940,7 @@ CONFIG_CDCACM_PRODUCTSTR="PX4 FMU v1.6" # CONFIG_NSH_FATNSECTORS - FAT FS number of sectors # CONFIG_NSH_FATMOUNTPT - FAT FS mountpoint # +CONFIG_BUILTIN=y CONFIG_NSH_BUILTIN_APPS=y CONFIG_NSH_FILEIOSIZE=512 CONFIG_NSH_STRERROR=y From e9d0885500d437cc6c89370d8131913bd1e7310b Mon Sep 17 00:00:00 2001 From: patacongo Date: Thu, 17 Jan 2013 14:43:55 +0000 Subject: [PATCH 082/118] Add logic to automatically unload module on exit; Several patches from Mike Smith git-svn-id: http://svn.code.sf.net/p/nuttx/code/trunk@5528 42af7a65-404d-4744-a932-0658087f49c3 --- apps/builtin/Makefile | 2 +- apps/builtin/builtin.c | 33 +++------- apps/builtin/exec_builtin.c | 16 +++-- nuttx/TODO | 23 +++++-- nuttx/binfmt/Makefile | 4 ++ nuttx/binfmt/binfmt_exec.c | 69 +++++++++++++++++++- nuttx/binfmt/builtin.c | 8 ++- nuttx/binfmt/libbuiltin/libbuiltin_getname.c | 14 ++-- nuttx/binfmt/libbuiltin/libbuiltin_isavail.c | 7 +- nuttx/configs/sim/nsh/defconfig | 3 +- nuttx/fs/binfs/fs_binfs.c | 10 +-- nuttx/include/nuttx/binfmt/binfmt.h | 47 ++++++++++++- nuttx/include/nuttx/binfmt/builtin.h | 26 +++----- nuttx/sched/Kconfig | 36 +++++----- nuttx/tools/Makefile.export | 12 ++-- 15 files changed, 214 insertions(+), 96 deletions(-) diff --git a/apps/builtin/Makefile b/apps/builtin/Makefile index d77054f41f..f89532871c 100644 --- a/apps/builtin/Makefile +++ b/apps/builtin/Makefile @@ -39,7 +39,7 @@ include $(APPDIR)/Make.defs # Source and object files ASRCS = -CSRCS = builtin.c exec_builtin.c +CSRCS = builtin.c builtin_list.c exec_builtin.c AOBJS = $(ASRCS:.S=$(OBJEXT)) COBJS = $(CSRCS:.c=$(OBJEXT)) diff --git a/apps/builtin/builtin.c b/apps/builtin/builtin.c index 7655a531da..d26f0a044d 100644 --- a/apps/builtin/builtin.c +++ b/apps/builtin/builtin.c @@ -55,27 +55,8 @@ * Public Data ****************************************************************************/ -#undef EXTERN -#if defined(__cplusplus) -#define EXTERN extern "C" -extern "C" { -#else -#define EXTERN extern -#endif - -#include "builtin_proto.h" - -const struct builtin_s g_builtins[] = -{ -# include "builtin_list.h" - { NULL, 0, 0, 0 } -}; - -#undef EXTERN -#if defined(__cplusplus) -} -#endif - +extern const struct builtin_s g_builtins[]; +extern const int g_builtin_count; /**************************************************************************** * Private Data @@ -89,9 +70,11 @@ const struct builtin_s g_builtins[] = * Public Functions ****************************************************************************/ -int number_builtins(void) +FAR const struct builtin_s *builtin_for_index(int index) { - return sizeof(g_builtins)/sizeof(struct builtin_s) - 1; + if (index < g_builtin_count) + { + return &g_builtins[index]; + } + return NULL; } - - diff --git a/apps/builtin/exec_builtin.c b/apps/builtin/exec_builtin.c index 05648590db..d4431164cc 100644 --- a/apps/builtin/exec_builtin.c +++ b/apps/builtin/exec_builtin.c @@ -142,8 +142,17 @@ static void bultin_semtake(FAR sem_t *sem) static int builtin_taskcreate(int index, FAR const char **argv) { + FAR const struct builtin_s *b; int ret; + b = builtin_for_index(index); + + if (b == NULL) + { + errno = ENOENT; + return ERROR; + } + /* Disable pre-emption. This means that although we start the builtin * application here, it will not actually run until pre-emption is * re-enabled below. @@ -153,8 +162,7 @@ static int builtin_taskcreate(int index, FAR const char **argv) /* Start the builtin application task */ - ret = TASK_CREATE(g_builtins[index].name, g_builtins[index].priority, - g_builtins[index].stacksize, g_builtins[index].main, + ret = TASK_CREATE(b->name, b->priority, b->stacksize, b->main, (argv) ? &argv[1] : (FAR const char **)NULL); /* If robin robin scheduling is enabled, then set the scheduling policy @@ -171,7 +179,7 @@ static int builtin_taskcreate(int index, FAR const char **argv) * new task cannot yet have changed from its initial value. */ - param.sched_priority = g_builtins[index].priority; + param.sched_priority = b->priority; (void)sched_setscheduler(ret, SCHED_RR, ¶m); } #endif @@ -293,8 +301,6 @@ static inline int builtin_startproxy(int index, FAR const char **argv, int errcode; int ret; - DEBUGASSERT(path); - svdbg("index=%d argv=%p redirfile=%s oflags=%04x\n", index, argv, redirfile, oflags); diff --git a/nuttx/TODO b/nuttx/TODO index 248d2dafa7..91b4aebaae 100644 --- a/nuttx/TODO +++ b/nuttx/TODO @@ -6,7 +6,7 @@ standards, things that could be improved, and ideas for enhancements. nuttx/ - (10) Task/Scheduler (sched/) + (11) Task/Scheduler (sched/) (1) Memory Managment (mm/) (3) Signals (sched/, arch/) (2) pthreads (sched/) @@ -193,7 +193,7 @@ o Task/Scheduler (sched/) Priority: Low Title: IMPROVED TASK CONTROL BLOCK STRUCTURE - All task resources that are shared amongst threads have + Description: All task resources that are shared amongst threads have their own "break-away", reference-counted structure. The Task Control Block (TCB) of each thread holds a reference to each breakaway structure (see include/nuttx/sched.h). @@ -206,11 +206,26 @@ o Task/Scheduler (sched/) - File descriptors (struct filelist) - FILE streams (struct streamlist) - Sockets (struct socketlist) - Status: Open - Priority: Low. This is an enhancement. It would slight reduce + Status: Open + Priority: Low. This is an enhancement. It would slight reduce memory usage but would also increase coupling. These resources are nicely modular now. + Title: ISSUES WITH atexit() AND on_exit() + Description: These functions execute with the following bad properties: + + 1. They run with interrupts disabled, + 2. They run in supervisor mode (if applicable), and + 3. They do not obey any setup of PIC or address + environments. Do they need to? + + The fix for all of these issues it to have the callbacks + run on the caller's thread (as with signal handlers). + Status: Open + Priority: Medium Low. This is an important change to some less + important interfaces. For the average user, these + functions are just fine the way they are. + o Memory Managment (mm/) ^^^^^^^^^^^^^^^^^^^^^^ diff --git a/nuttx/binfmt/Makefile b/nuttx/binfmt/Makefile index 49dcd3d321..2f692beb1d 100644 --- a/nuttx/binfmt/Makefile +++ b/nuttx/binfmt/Makefile @@ -52,6 +52,10 @@ ifeq ($(CONFIG_BINFMT_EXEPATH),y) BINFMT_CSRCS += binfmt_exepath.c endif +ifeq ($(CONFIG_SCHED_HAVE_PARENT),y) +BINFMT_CSRCS += binfmt_schedunload.c +endif + # Symbol table source files BINFMT_CSRCS += symtab_findbyname.c symtab_findbyvalue.c diff --git a/nuttx/binfmt/binfmt_exec.c b/nuttx/binfmt/binfmt_exec.c index d878c8cc50..1cead43842 100644 --- a/nuttx/binfmt/binfmt_exec.c +++ b/nuttx/binfmt/binfmt_exec.c @@ -74,7 +74,9 @@ * * Description: * This is a convenience function that wraps load_ and exec_module into - * one call. + * one call. If CONFIG_SCHED_ONEXIT is also defined, this function will + * automatically call schedule_unload() to unload the module when task + * exits. * * Input Parameter: * filename - Fulll path to the binary to be loaded @@ -84,7 +86,7 @@ * * Returned Value: * This is an end-user function, so it follows the normal convention: - * Returns the PID of the exec'ed module. On failure, it.returns + * It returns the PID of the exec'ed module. On failure, it returns * -1 (ERROR) and sets errno appropriately. * ****************************************************************************/ @@ -92,6 +94,66 @@ int exec(FAR const char *filename, FAR const char **argv, FAR const struct symtab_s *exports, int nexports) { +#ifdef CONFIG_SCHED_ONEXIT + FAR struct binary_s *bin; + int errorcode; + int ret; + + /* Allocate the load information */ + + bin = (FAR struct binary_s *)kzalloc(sizeof(struct binary_s)); + if (!bin) + { + set_errno(ENOMEM); + return ERROR; + } + + /* Load the module into memory */ + + bin->filename = filename; + bin->exports = exports; + bin->nexports = nexports; + + ret = load_module(bin); + if (ret < 0) + { + bdbg("ERROR: Failed to load program '%s'\n", filename); + kfree(bin); + return ERROR; + } + + /* Disable pre-emption so that the executed module does + * not return until we get a chance to connect the on_exit + * handler. + */ + + sched_lock(); + + /* Then start the module */ + + ret = exec_module(bin); + if (ret < 0) + { + bdbg("ERROR: Failed to execute program '%s'\n", filename); + sched_unlock(); + unload_module(bin); + kfree(bin); + return ERROR; + } + + /* Set up to unload the module (and free the binary_s structure) + * when the task exists. + */ + + ret = schedul_unload(ret, bin); + if (ret < 0) + { + bdbg("ERROR: Failed to schedul unload '%s'\n", filename); + } + + sched_unlock(); + return ret; +#else struct binary_s bin; int ret; @@ -119,7 +181,10 @@ int exec(FAR const char *filename, FAR const char **argv, return ERROR; } + /* TODO: How does the module get unloaded in this case? */ + return ret; +#endif } #endif /* CONFIG_BINFMT_DISABLE */ diff --git a/nuttx/binfmt/builtin.c b/nuttx/binfmt/builtin.c index d36cb63265..d80d9f5d84 100644 --- a/nuttx/binfmt/builtin.c +++ b/nuttx/binfmt/builtin.c @@ -89,6 +89,7 @@ static struct binfmt_s g_builtin_binfmt = static int builtin_loadbinary(struct binary_s *binp) { FAR const char *filename; + FAR const struct builtin_s *b; int fd; int index; int ret; @@ -134,9 +135,10 @@ static int builtin_loadbinary(struct binary_s *binp) * the priority. That is a bug and needs to be fixed. */ - binp->entrypt = g_builtins[index].main; - binp->stacksize = g_builtins[index].stacksize; - binp->priority = g_builtins[index].priority; + b = builtin_for_index(index); + binp->entrypt = b->main; + binp->stacksize = b->stacksize; + binp->priority = b->priority; return OK; } diff --git a/nuttx/binfmt/libbuiltin/libbuiltin_getname.c b/nuttx/binfmt/libbuiltin/libbuiltin_getname.c index 01ac024f7a..9da2bac294 100644 --- a/nuttx/binfmt/libbuiltin/libbuiltin_getname.c +++ b/nuttx/binfmt/libbuiltin/libbuiltin_getname.c @@ -83,10 +83,14 @@ FAR const char *builtin_getname(int index) { - if (index < 0 || index >= number_builtins()) - { - return NULL; - } + struct builtin_s *b; - return g_builtins[index].name; + b = builtin_for_index(index); + + if (b != NULL) + { + return b->name; + } + + return NULL; } diff --git a/nuttx/binfmt/libbuiltin/libbuiltin_isavail.c b/nuttx/binfmt/libbuiltin/libbuiltin_isavail.c index f99a4b81d5..b1d55ff21a 100644 --- a/nuttx/binfmt/libbuiltin/libbuiltin_isavail.c +++ b/nuttx/binfmt/libbuiltin/libbuiltin_isavail.c @@ -80,18 +80,19 @@ * Name: builtin_isavail * * Description: - * Return the index into the table of applications for the applicaiton with + * Return the index into the table of applications for the application with * the name 'appname'. * ****************************************************************************/ int builtin_isavail(FAR const char *appname) { + FAR const char *n; int i; - for (i = 0; g_builtins[i].name; i++) + for (i = 0; n = builtin_getname(i); i++) { - if (!strncmp(g_builtins[i].name, appname, NAME_MAX)) + if (!strncmp(n, appname, NAME_MAX)) { return i; } diff --git a/nuttx/configs/sim/nsh/defconfig b/nuttx/configs/sim/nsh/defconfig index 8dc5ddccea..c5eadb1226 100644 --- a/nuttx/configs/sim/nsh/defconfig +++ b/nuttx/configs/sim/nsh/defconfig @@ -116,7 +116,7 @@ CONFIG_MSEC_PER_TICK=10 CONFIG_RR_INTERVAL=0 # CONFIG_SCHED_INSTRUMENTATION is not set CONFIG_TASK_NAME_SIZE=32 -# CONFIG_SCHED_HAVE_PARENT is not set +CONFIG_SCHED_HAVE_PARENT=y # CONFIG_JULIAN_TIME is not set CONFIG_START_YEAR=2008 CONFIG_START_MONTH=6 @@ -148,6 +148,7 @@ CONFIG_DISABLE_POLL=y CONFIG_SIG_SIGUSR1=1 CONFIG_SIG_SIGUSR2=2 CONFIG_SIG_SIGALARM=3 +CONFIG_SIG_SIGCHLD=4 CONFIG_SIG_SIGCONDTIMEDOUT=16 # diff --git a/nuttx/fs/binfs/fs_binfs.c b/nuttx/fs/binfs/fs_binfs.c index ed6326eba6..56ea472afd 100644 --- a/nuttx/fs/binfs/fs_binfs.c +++ b/nuttx/fs/binfs/fs_binfs.c @@ -222,7 +222,7 @@ static int binfs_ioctl(FAR struct file *filep, int cmd, unsigned long arg) } else { - *ptr = g_builtins[(int)filep->f_priv].name; + *ptr = builtin_getname((int)filep->f_priv); ret = OK; } } @@ -287,13 +287,15 @@ static int binfs_opendir(struct inode *mountpt, const char *relpath, static int binfs_readdir(struct inode *mountpt, struct fs_dirent_s *dir) { + FAR const char *name; unsigned int index; int ret; /* Have we reached the end of the directory */ index = dir->u.binfs.fb_index; - if (g_builtins[index].name == NULL) + name = builtin_getname(index); + if (name == NULL) { /* We signal the end of the directory by returning the * special error -ENOENT @@ -306,9 +308,9 @@ static int binfs_readdir(struct inode *mountpt, struct fs_dirent_s *dir) { /* Save the filename and file type */ - fvdbg("Entry %d: \"%s\"\n", index, g_builtins[index].name); + fvdbg("Entry %d: \"%s\"\n", index, name); dir->fd_dir.d_type = DTYPE_FILE; - strncpy(dir->fd_dir.d_name, g_builtins[index].name, NAME_MAX+1); + strncpy(dir->fd_dir.d_name, name, NAME_MAX+1); /* The application list is terminated by an entry with a NULL name. * Therefore, there is at least one more entry in the list. diff --git a/nuttx/include/nuttx/binfmt/binfmt.h b/nuttx/include/nuttx/binfmt/binfmt.h index c6c7c874a7..472ba0fc4b 100644 --- a/nuttx/include/nuttx/binfmt/binfmt.h +++ b/nuttx/include/nuttx/binfmt/binfmt.h @@ -82,6 +82,18 @@ typedef FAR void (*binfmt_dtor_t)(void); struct symtab_s; struct binary_s { + /* If CONFIG_SCHED_HAVE_PARENT is defined then schedul_unload() will + * manage instances of struct binary_s allocated with kmalloc. It + * will keep the binary data in a link list and when SIGCHLD is received + * (meaning that the task has exit'ed, schedul_unload() will find the + * data, unload the module, and free the structure. + */ + +#ifdef CONFIG_SCHED_HAVE_PARENT + FAR struct binary_s *flink; /* Supports a singly linked list */ + pid_t pid; /* Task ID of the child task */ +#endif + /* Information provided to the loader to load and bind a module */ FAR const char *filename; /* Full path to the binary to be loaded (See NOTE 1 above) */ @@ -222,19 +234,48 @@ int unload_module(FAR const struct binary_s *bin); * * Returned Value: * This is an end-user function, so it follows the normal convention: - * Returns the PID of the exec'ed module. On failure, it.returns + * Returns the PID of the exec'ed module. On failure, it returns * -1 (ERROR) and sets errno appropriately. * ****************************************************************************/ int exec_module(FAR const struct binary_s *bin); +/**************************************************************************** + * Name: schedule_unload + * + * Description: + * If CONFIG_SCHED_HAVE_PARENT is defined, this function may be called by + * the parent of the the newly created task to automatically unload the + * module when the task exits. This assumes that (1) the caller is the + * parent of the created task, (2) that bin was allocated with kmalloc() + * or friends. It will also automatically free the structure with kfree() + * after unloading the module. + * + * Input Parameter: + * pid - The task ID of the child task + * bin - This structure must have been allocated with kmalloc() and must + * persist until the task unloads + * + * Returned Value: + * This is an end-user function, so it follows the normal convention: + * It returns 0 (OK) if the callback was successfully scheduled. On + * failure, it returns -1 (ERROR) and sets errno appropriately. + * + ****************************************************************************/ + +#ifdef CONFIG_SCHED_HAVE_PARENT +int schedule_unload(pid_t pid, FAR const struct binary_s *bin); +#endif + /**************************************************************************** * Name: exec * * Description: * This is a convenience function that wraps load_ and exec_module into - * one call. + * one call. If CONFIG_SCHED_ONEXIT is also defined, this function will + * automatically call schedule_unload() to unload the module when task + * exits. * * Input Parameter: * filename - Fulll path to the binary to be loaded @@ -244,7 +285,7 @@ int exec_module(FAR const struct binary_s *bin); * * Returned Value: * This is an end-user function, so it follows the normal convention: - * Returns the PID of the exec'ed module. On failure, it.returns + * It returns the PID of the exec'ed module. On failure, it returns * -1 (ERROR) and sets errno appropriately. * ****************************************************************************/ diff --git a/nuttx/include/nuttx/binfmt/builtin.h b/nuttx/include/nuttx/binfmt/builtin.h index 632f8944d2..5921cc5189 100644 --- a/nuttx/include/nuttx/binfmt/builtin.h +++ b/nuttx/include/nuttx/binfmt/builtin.h @@ -73,14 +73,6 @@ extern "C" { #define EXTERN extern #endif -/* The g_builtins[] array holds information about each builtin function. If - * support for builtin functions is enabled in the NuttX configuration, then - * this arrary (along with the number_builtins() function) must be provided - * by the application code. - */ - -EXTERN const struct builtin_s g_builtins[]; - /**************************************************************************** * Public Functions ****************************************************************************/ @@ -128,24 +120,24 @@ FAR const char *builtin_getname(int index); * Data Set Access Functions Provided to Applications by binfmt/libbuiltin ****************************************************************************/ /**************************************************************************** - * Name: number_builtins + * Name: builtin_for_index * * Description: - * Returns the number of builtin functions in the g_builtins[] array. If - * support for builtin functions is enabled in the NuttX configuration, - * then this function (along with g_builtins[]) must be provided by the - * application code. + * Returns the builtin_s structure for the selected builtin. + * If support for builtin functions is enabled in the NuttX configuration, + * then this function must be provided by the application code. * * Input Parameter: - * None + * index, from 0 and on... * * Returned Value: - * The number of entries in the g_builtins[] array. This function does - * not return failures. + * Returns valid pointer pointing to the builtin_s structure if index is + * valid. + * Otherwise, NULL is returned. * ****************************************************************************/ -int number_builtins(void); +EXTERN FAR const struct builtin_s *builtin_for_index(int index); #undef EXTERN #if defined(__cplusplus) diff --git a/nuttx/sched/Kconfig b/nuttx/sched/Kconfig index 6d53a03aa7..11d74b5831 100644 --- a/nuttx/sched/Kconfig +++ b/nuttx/sched/Kconfig @@ -4,7 +4,7 @@ # config MSEC_PER_TICK - int "tick timer" + int "Milliseconds per system timer tick" default 10 ---help--- The default system timer is 100Hz or MSEC_PER_TICK=10. This setting @@ -12,7 +12,7 @@ config MSEC_PER_TICK system timer interrupts at some interrupt interval other than 10 msec. config RR_INTERVAL - int "round robin timeslice" + int "Round robin timeslice (MSEC)" default 0 ---help--- The round robin timeslice will be set this number of milliseconds; @@ -39,7 +39,7 @@ config TASK_NAME_SIZE disable. config SCHED_HAVE_PARENT - bool "Remember Parent" + bool "Support parent/child task relationships" default n ---help--- Remember the ID of the parent thread when a new child thread is @@ -56,15 +56,15 @@ config JULIAN_TIME Enables Julian time conversions config START_YEAR - int "start year" + int "Start year" default 2013 config START_MONTH - int "start month" + int "Start month" default 1 config START_DAY - int "start day" + int "Start day" default 1 config DEV_CONSOLE @@ -372,7 +372,7 @@ endif comment "Sizes of configurable things (0 disables)" config MAX_TASKS - int "Max tasks" + int "Max number of tasks" default 32 ---help--- The maximum number of simultaneously active tasks. This value must be @@ -386,33 +386,32 @@ config MAX_TASK_ARGS receive (i.e., maxmum value of 'argc') config NPTHREAD_KEYS - int "Number of pthread keys" + int "Maximum number of pthread keys" default 4 ---help--- The number of items of thread- specific data that can be retained config NFILE_DESCRIPTORS - int "Max file descriptors" + int "Maximum number of file descriptors per task" default 16 ---help--- - The maximum number of file - descriptors (one for each open) + The maximum number of file descriptors per task (one for each open) config NFILE_STREAMS - int "Max file streams" + int "Maximum number of FILE streams" default 16 ---help--- The maximum number of streams that can be fopen'ed config NAME_MAX - int "name max" + int "Maximum size of a file name" default 32 ---help--- The maximum size of a file name. config PREALLOC_MQ_MSGS - int "Pre-allocated messages" + int "Number of pre-allocated messages" default 32 ---help--- The number of pre-allocated message structures. The system manages @@ -426,21 +425,20 @@ config MQ_MAXMSGSIZE setting (does not include other message structure overhead. config MAX_WDOGPARMS - int "max watchdog parms" + int "Maximum number of watchdog parameters" default 4 ---help--- - Maximum number of parameters that - can be passed to a watchdog handler + Maximum number of parameters that can be passed to a watchdog handler config PREALLOC_WDOGS - int "Pre-allocated watchdogs" + int "Number of pre-allocated watchdog timers" default 32 ---help--- The number of pre-allocated watchdog structures. The system manages a pool of preallocated watchdog structures to minimize dynamic allocations config PREALLOC_TIMERS - int "Pre-allocated timers" + int "Number of pre-allocated POSIX timers" default 8 ---help--- The number of pre-allocated POSIX timer structures. The system manages a diff --git a/nuttx/tools/Makefile.export b/nuttx/tools/Makefile.export index 002cb526b4..6dfe72bf99 100644 --- a/nuttx/tools/Makefile.export +++ b/nuttx/tools/Makefile.export @@ -37,14 +37,18 @@ include $(TOPDIR)/.config include $(EXPORTDIR)/Make.defs ifdef ARCHSCRIPT +# +# ARCHSCRIPT may contain a leading -T; it must not be followed by a space +# for this to work. +# ifeq ($(WINTOOL),y) -LDPATH = ${shell cygpath -u $(patsubst -T,,$(ARCHSCRIPT))} +LDPATH = $(shell cygpath -u $(patsubst -T%,%,$(ARCHSCRIPT))) else -LDPATH = $(patsubst -T,,$(ARCHSCRIPT)) +LDPATH = $(patsubst -T%,%,$(ARCHSCRIPT)) endif -LDNAME = ${shell basename ${LDPATH}} -LDDIR = ${shell dirname ${LDPATH}} +LDNAME = ${notdir ${LDPATH}} +LDDIR = ${dir ${LDPATH}} endif ARCHSUBDIR = "arch/$(CONFIG_ARCH)/src" From 19e43efe230a2b8720d98cba5a6ad156942e291f Mon Sep 17 00:00:00 2001 From: patacongo Date: Thu, 17 Jan 2013 18:32:13 +0000 Subject: [PATCH 083/118] NSH will now run files from the file system; Add logic to unload and clean-up after running a task from a file system; Extensions to builtin apps from Mike Smith git-svn-id: http://svn.code.sf.net/p/nuttx/code/trunk@5529 42af7a65-404d-4744-a932-0658087f49c3 --- apps/ChangeLog.txt | 3 + apps/builtin/builtin_list.c | 79 +++++ apps/examples/nsh/nsh_main.c | 38 +++ apps/nshlib/Kconfig | 11 +- apps/nshlib/Makefile | 4 + apps/nshlib/nsh.h | 5 + apps/nshlib/nsh_builtin.c | 27 +- apps/nshlib/nsh_fileapps.c | 298 +++++++++++++++++ apps/nshlib/nsh_parse.c | 37 ++- nuttx/ChangeLog | 4 + nuttx/arch/arm/include/stm32/chip.h | 38 ++- nuttx/binfmt/binfmt_exec.c | 10 +- nuttx/binfmt/binfmt_loadmodule.c | 4 +- nuttx/binfmt/binfmt_schedunload.c | 333 +++++++++++++++++++ nuttx/binfmt/builtin.c | 4 +- nuttx/binfmt/libbuiltin/libbuiltin_getname.c | 8 +- nuttx/binfmt/libbuiltin/libbuiltin_isavail.c | 6 +- nuttx/configs/sim/nsh/defconfig | 12 +- nuttx/include/nuttx/binfmt/binfmt.h | 2 +- nuttx/include/nuttx/binfmt/builtin.h | 30 ++ nuttx/libc/spawn/lib_ps.c | 2 +- nuttx/tools/mkconfig.c | 2 +- 22 files changed, 927 insertions(+), 30 deletions(-) create mode 100644 apps/builtin/builtin_list.c create mode 100644 apps/nshlib/nsh_fileapps.c create mode 100644 nuttx/binfmt/binfmt_schedunload.c diff --git a/apps/ChangeLog.txt b/apps/ChangeLog.txt index 14eb78950d..ba8dec613a 100644 --- a/apps/ChangeLog.txt +++ b/apps/ChangeLog.txt @@ -485,3 +485,6 @@ argument is now optional. Many files systems do not need a source and it is really stupid to have to enter a bogus source parameter. + * apps/nshlib/nsh_fileapp.c: Add the ability to execute a file + from a file system using posix_spawn(). + * apps/builtin/: Extensions from Mike Smith. diff --git a/apps/builtin/builtin_list.c b/apps/builtin/builtin_list.c new file mode 100644 index 0000000000..a5556bf54f --- /dev/null +++ b/apps/builtin/builtin_list.c @@ -0,0 +1,79 @@ +/**************************************************************************** + * apps/builtin/builtin_list.c + * + * Copyright (C) 2011 Uros Platise. All rights reserved. + * Copyright (C) 2011 Gregory Nutt. All rights reserved. + * Authors: Uros Platise + * Gregory Nutt + * + * 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. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include + +/**************************************************************************** + * Private Types + ****************************************************************************/ + +/**************************************************************************** + * Private Function Prototypes + ****************************************************************************/ + +/**************************************************************************** + * Public Data + ****************************************************************************/ + +#include "builtin_proto.h" + +const struct builtin_s g_builtins[] = +{ +# include "builtin_list.h" + { NULL, 0, 0, 0 } +}; + +const int g_builtin_count = sizeof(g_builtins) / sizeof(g_builtins[0]); + +/**************************************************************************** + * Private Data + ****************************************************************************/ + +/**************************************************************************** + * Private Functions + ****************************************************************************/ + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + diff --git a/apps/examples/nsh/nsh_main.c b/apps/examples/nsh/nsh_main.c index 97792cb2a3..d9bfc20181 100644 --- a/apps/examples/nsh/nsh_main.c +++ b/apps/examples/nsh/nsh_main.c @@ -46,6 +46,12 @@ #include #include +#if defined(CONFIG_FS_BINFS) && (CONFIG_BUILTIN) +#include +#endif +#if defined(CONFIG_LIBC_EXECFUNCS) && defined(CONFIG_EXECFUNCS_SYMTAB) +#include +#endif #include @@ -75,6 +81,21 @@ * Public Data ****************************************************************************/ +/* If posix_spawn() is enabled as required for CONFIG_NSH_FILE_APPS, then + * a symbol table is needed by the internals of posix_spawn(). The symbol + * table is needed to support ELF and NXFLAT binaries to dynamically link to + * the base code. However, if only the BINFS file system is supported, then + * no Makefile is needed. + * + * This is a kludge to plug the missing file system in the case where BINFS + * is used. REVISIT: This will, of course, be in the way if you want to + * support ELF or NXFLAT binaries! + */ + +#if defined(CONFIG_LIBC_EXECFUNCS) && defined(CONFIG_EXECFUNCS_SYMTAB) +const struct symtab_s CONFIG_EXECFUNCS_SYMTAB[1]; +#endif + /**************************************************************************** * Private Functions ****************************************************************************/ @@ -98,6 +119,23 @@ int nsh_main(int argc, char *argv[]) up_cxxinitialize(); #endif + /* Make sure that we are using our symbol take */ + +#if defined(CONFIG_LIBC_EXECFUNCS) && defined(CONFIG_EXECFUNCS_SYMTAB) + exec_setsymtab(CONFIG_EXECFUNCS_SYMTAB, 0); +#endif + + /* Register the BINFS file system */ + +#if defined(CONFIG_FS_BINFS) && (CONFIG_BUILTIN) + ret = builtin_initialize(); + if (ret < 0) + { + fprintf(stderr, "ERROR: builtin_initialize failed: %d\n", ret); + exitval = 1; + } +#endif + /* Initialize the NSH library */ nsh_initialize(); diff --git a/apps/nshlib/Kconfig b/apps/nshlib/Kconfig index e60e9c4806..f6a5aa0454 100644 --- a/apps/nshlib/Kconfig +++ b/apps/nshlib/Kconfig @@ -14,7 +14,7 @@ config NSH_LIBRARY if NSH_LIBRARY config NSH_BUILTIN_APPS bool "Enable built-in applications" - default y + default n depends on BUILTIN ---help--- Support external registered, "built-in" applications that can be @@ -22,6 +22,15 @@ config NSH_BUILTIN_APPS more information). This options requires support for builtin applications (BUILTIN). +config NSH_FILE_APPS + bool "Enable execution of program files" + default n + depends on LIBC_EXECFUNCS + ---help--- + Support execution of program files residing within a file + system. This options requires support for the posix_spawn() + interface (LIBC_EXECFUNCS). + menu "Disable Individual commands" config NSH_DISABLE_BASE64DEC diff --git a/apps/nshlib/Makefile b/apps/nshlib/Makefile index 5c52696853..948f43d52f 100644 --- a/apps/nshlib/Makefile +++ b/apps/nshlib/Makefile @@ -47,6 +47,10 @@ ifeq ($(CONFIG_NSH_BUILTIN_APPS),y) CSRCS += nsh_builtin.c endif +ifeq ($(CONFIG_NSH_FILE_APPS),y) +CSRCS += nsh_fileapps.c +endif + ifeq ($(CONFIG_NSH_ROMFSETC),y) CSRCS += nsh_romfsetc.c endif diff --git a/apps/nshlib/nsh.h b/apps/nshlib/nsh.h index 253a803f88..64099a8df0 100644 --- a/apps/nshlib/nsh.h +++ b/apps/nshlib/nsh.h @@ -495,6 +495,11 @@ int nsh_builtin(FAR struct nsh_vtbl_s *vtbl, FAR const char *cmd, FAR char **argv, FAR const char *redirfile, int oflags); #endif +#ifdef CONFIG_NSH_FILE_APPS +int nsh_fileapp(FAR struct nsh_vtbl_s *vtbl, FAR const char *cmd, + FAR char **argv, FAR const char *redirfile, int oflags); +#endif + /* Working directory support */ #if CONFIG_NFILE_DESCRIPTORS > 0 && !defined(CONFIG_DISABLE_ENVIRON) diff --git a/apps/nshlib/nsh_builtin.c b/apps/nshlib/nsh_builtin.c index ba39e8dfe8..2d23ca8d8b 100644 --- a/apps/nshlib/nsh_builtin.c +++ b/apps/nshlib/nsh_builtin.c @@ -51,6 +51,7 @@ #endif #include +#include #include #include @@ -129,20 +130,34 @@ int nsh_builtin(FAR struct nsh_vtbl_s *vtbl, FAR const char *cmd, ret = exec_builtin(cmd, (FAR const char **)argv, redirfile, oflags); if (ret >= 0) { - /* The application was successfully started (but still blocked because - * the scheduler is locked). If the application was not backgrounded, - * then we need to wait here for the application to exit. These really - * only works works with the following options: + /* The application was successfully started with pre-emption disabled. + * In the simplest cases, the application will not have run because the + * the scheduler is locked. but in the case were I/O redirected, a + * proxy task ran and, as result, so may have the application. + * + * If the application did not run and if the application was not + * backgrounded, then we need to wait here for the application to + * exit. This only works works with the following options: * * - CONFIG_NSH_DISABLEBG - Do not run commands in background * - CONFIG_SCHED_WAITPID - Required to run external commands in * foreground - * - * These concepts do not apply cleanly to the external applications. */ #ifdef CONFIG_SCHED_WAITPID + /* Check if the application is still running */ + + if (kill(ret, 0) < 0) + { + /* It is not running. In this case, we have no idea if the + * application ran successfully or not. Let's assume that is + * did. + */ + + return 0; + } + /* CONFIG_SCHED_WAITPID is selected, so we may run the command in * foreground unless we were specifically requested to run the command * in background (and running commands in background is enabled). diff --git a/apps/nshlib/nsh_fileapps.c b/apps/nshlib/nsh_fileapps.c new file mode 100644 index 0000000000..7f9f58e534 --- /dev/null +++ b/apps/nshlib/nsh_fileapps.c @@ -0,0 +1,298 @@ +/**************************************************************************** + * apps/nshlib/nsh_fileapps.c + * + * Copyright (C) 2013 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * 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. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#ifdef CONFIG_SCHED_WAITPID +# include +#endif + +#include +#include +#include +#include +#include + +#include "nsh.h" +#include "nsh_console.h" + +#ifdef CONFIG_NSH_FILE_APPS + +/**************************************************************************** + * Definitions + ****************************************************************************/ + +/**************************************************************************** + * Private Types + ****************************************************************************/ + +/**************************************************************************** + * Private Function Prototypes + ****************************************************************************/ + +/**************************************************************************** + * Private Data + ****************************************************************************/ + +/**************************************************************************** + * Public Data + ****************************************************************************/ + +/**************************************************************************** + * Private Functions + ****************************************************************************/ + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: nsh_fileapp + * + * Description: + * Attempt to execute the application task whose name is 'cmd' + * + * Returned Value: + * <0 If exec_builtin() fails, then the negated errno value + * is returned. + * -1 (ERROR) if the application task corresponding to 'cmd' could not + * be started (possibly because it doesn not exist). + * 0 (OK) if the application task corresponding to 'cmd' was + * and successfully started. If CONFIG_SCHED_WAITPID is + * defined, this return value also indicates that the + * application returned successful status (EXIT_SUCCESS) + * 1 If CONFIG_SCHED_WAITPID is defined, then this return value + * indicates that the application task was spawned successfully + * but returned failure exit status. + * + ****************************************************************************/ + +int nsh_fileapp(FAR struct nsh_vtbl_s *vtbl, FAR const char *cmd, + FAR char **argv, FAR const char *redirfile, int oflags) +{ + posix_spawn_file_actions_t file_actions; + posix_spawnattr_t attr; + pid_t pid; + int ret; + + /* Initialize the attributes file actions structure */ + + ret = posix_spawn_file_actions_init(&file_actions); + if (ret != 0) + { + /* posix_spawn_file_actions_init returns a positive errno value on + * failure. + */ + + nsh_output(vtbl, g_fmtcmdfailed, cmd, "posix_spawn_file_actions_init", + NSH_ERRNO_OF(ret)); + goto errout; + } + + ret = posix_spawnattr_init(&attr); + if (ret != 0) + { + /* posix_spawnattr_init returns a positive errno value on failure. */ + + nsh_output(vtbl, g_fmtcmdfailed, cmd, "posix_spawnattr_init", + NSH_ERRNO); + goto errout_with_actions; + } + + /* Handle re-direction of output */ + + if (redirfile) + { + ret = posix_spawn_file_actions_addopen(&file_actions, 1, redirfile, + oflags, 0644); + if (ret != 0) + { + /* posix_spawn_file_actions_addopen returns a positive errno + * value on failure. + */ + + nsh_output(vtbl, g_fmtcmdfailed, cmd, + "posix_spawn_file_actions_addopen", + NSH_ERRNO); + goto errout_with_attrs; + } + } + + /* Lock the scheduler to prevent the application from running until the + * waitpid() has been called. + */ + + sched_lock(); + + /* Execute the program. posix_spawnp returns a positive errno value on + * failure. + */ + + ret = posix_spawnp(&pid, cmd, &file_actions, &attr, &argv[1], NULL); + if (ret == OK) + { + /* The application was successfully started with pre-emption disabled. + * In the simplest cases, the application will not have run because the + * the scheduler is locked. but in the case were I/O redirected, a + * proxy task ran and, as result, so may have the application. + * + * If the application did not run and if the application was not + * backgrounded, then we need to wait here for the application to + * exit. This only works works with the following options: + * + * - CONFIG_NSH_DISABLEBG - Do not run commands in background + * - CONFIG_SCHED_WAITPID - Required to run external commands in + * foreground + */ + +#ifdef CONFIG_SCHED_WAITPID + /* Check if the application is still running */ + + if (kill(ret, 0) < 0) + { + /* It is not running. In this case, we have no idea if the + * application ran successfully or not. Let's assume that is + * did. + */ + + return 0; + } + + /* CONFIG_SCHED_WAITPID is selected, so we may run the command in + * foreground unless we were specifically requested to run the command + * in background (and running commands in background is enabled). + */ + +# ifndef CONFIG_NSH_DISABLEBG + if (vtbl->np.np_bg == false) +# endif /* CONFIG_NSH_DISABLEBG */ + { + int rc = 0; + + /* Wait for the application to exit. Since we have locked the + * scheduler above, we know that the application has not yet + * started and there is no possibility that it has already exited. + * The scheduler will be unlocked while waitpid is waiting and the + * application will be able to run. + */ + + ret = waitpid(pid, &rc, 0); + if (ret >= 0) + { + /* We can't return the exact status (nsh has nowhere to put it) + * so just pass back zero/nonzero in a fashion that doesn't look + * like an error. + */ + + ret = (rc == 0) ? OK : 1; + + /* TODO: Set the environment variable '?' to a string corresponding + * to WEXITSTATUS(rc) so that $? will expand to the exit status of + * the most recently executed task. + */ + } + } +# ifndef CONFIG_NSH_DISABLEBG + else +# endif /* CONFIG_NSH_DISABLEBG */ +#endif /* CONFIG_SCHED_WAITPID */ + + /* We get here if either: + * + * - CONFIG_SCHED_WAITPID is not selected meaning that all commands + * have to be run in background, or + * - CONFIG_SCHED_WAITPID and CONFIG_NSH_DISABLEBG are both selected, but the + * user requested to run the command in background. + * + * NOTE that the case of a) CONFIG_SCHED_WAITPID is not selected and + * b) CONFIG_NSH_DISABLEBG selected cannot be supported. In that event, all + * commands will have to run in background. The waitpid() API must be + * available to support running the command in foreground. + */ + +#if !defined(CONFIG_SCHED_WAITPID) || !defined(CONFIG_NSH_DISABLEBG) + { + struct sched_param param; + sched_getparam(ret, ¶m); + nsh_output(vtbl, "%s [%d:%d]\n", cmd, ret, param.sched_priority); + + /* Backgrounded commands always 'succeed' as long as we can start + * them. + */ + + ret = OK; + } +#endif /* !CONFIG_SCHED_WAITPID || !CONFIG_NSH_DISABLEBG */ + } + + sched_unlock(); + + /* Free attibutes and file actions. Ignoring return values in the case + * of an error. + */ + +errout_with_actions: + (void)posix_spawn_file_actions_destroy(&file_actions); + +errout_with_attrs: + (void)posix_spawnattr_destroy(&attr); + +errout: + /* Most posix_spawn interfaces return a positive errno value on failure + * and do not set the errno variable. + */ + + if (ret > 0) + { + /* Set the errno value and return -1 */ + + set_errno(ret); + ret = ERROR; + } + else if (ret < 0) + { + /* Return -1 on failure. errno should have been set. */ + + ret = ERROR; + } + + return ret; +} + +#endif /* CONFIG_NSH_FILE_APPS */ diff --git a/apps/nshlib/nsh_parse.c b/apps/nshlib/nsh_parse.c index ef4125a63f..f679d9b320 100644 --- a/apps/nshlib/nsh_parse.c +++ b/apps/nshlib/nsh_parse.c @@ -61,6 +61,7 @@ #ifdef CONFIG_NSH_BUILTIN_APPS # include #endif + #include #include "nsh.h" @@ -1398,6 +1399,40 @@ int nsh_parse(FAR struct nsh_vtbl_s *vtbl, char *cmdline) nsh_output(vtbl, g_fmttoomanyargs, cmd); } + /* Does this command correspond to an application filename? + * nsh_fileapp() returns: + * + * -1 (ERROR) if the application task corresponding to 'argv[0]' could not + * be started (possibly because it doesn not exist). + * 0 (OK) if the application task corresponding to 'argv[0]' was + * and successfully started. If CONFIG_SCHED_WAITPID is + * defined, this return value also indicates that the + * application returned successful status (EXIT_SUCCESS) + * 1 If CONFIG_SCHED_WAITPID is defined, then this return value + * indicates that the application task was spawned successfully + * but returned failure exit status. + * + * Note the priority if not effected by nice-ness. + */ + +#ifdef CONFIG_NSH_FILE_APPS + ret = nsh_fileapp(vtbl, argv[0], argv, redirfile, oflags); + if (ret >= 0) + { + /* nsh_fileapp() returned 0 or 1. This means that the builtin + * command was successfully started (although it may not have ran + * successfully). So certainly it is not an NSH command. + */ + + return nsh_saveresult(vtbl, ret != OK); + } + + /* No, not a built in command (or, at least, we were unable to start a + * builtin command of that name). Treat it like an NSH command. + */ + +#endif + /* Does this command correspond to a builtin command? * nsh_builtin() returns: * @@ -1414,7 +1449,7 @@ int nsh_parse(FAR struct nsh_vtbl_s *vtbl, char *cmdline) * Note the priority if not effected by nice-ness. */ -#ifdef CONFIG_NSH_BUILTIN_APPS +#if defined(CONFIG_NSH_BUILTIN_APPS) && (!defined(CONFIG_NSH_FILE_APPS) || !defined(CONFIG_FS_BINFS)) ret = nsh_builtin(vtbl, argv[0], argv, redirfile, oflags); if (ret >= 0) { diff --git a/nuttx/ChangeLog b/nuttx/ChangeLog index 6bc66ec9df..1b0c5338b9 100644 --- a/nuttx/ChangeLog +++ b/nuttx/ChangeLog @@ -3967,4 +3967,8 @@ file system. * configs/sim/nsh: Convert to use kconfig-frontends configuration tool. + * binfmt/binfmt_schedunload.c: Add logic based on SIGCHLD to + automatically unload and clean-up after running a task that + was loaded into memory. + * binfmt/libbuiltin: Extensions from Mike Smith diff --git a/nuttx/arch/arm/include/stm32/chip.h b/nuttx/arch/arm/include/stm32/chip.h index d34c2eb4f0..b7ec7dbba7 100644 --- a/nuttx/arch/arm/include/stm32/chip.h +++ b/nuttx/arch/arm/include/stm32/chip.h @@ -183,9 +183,43 @@ # define STM32_NRNG 0 /* No random number generator (RNG) */ # define STM32_NDCMI 0 /* No digital camera interface (DCMI) */ +/* STM32 F103 Medium Density Family *************************************************/ +/* STM32F103RB is in the Medium-density performance line and is provided in 64 pin + * packages with 128K Flash, USB, CAN, 7 timers, 2 ADCs, 9 com. interfaces + */ + +#elif defined(CONFIG_ARCH_CHIP_STM32F103RBT6) +# define CONFIG_STM32_STM32F10XX 1 /* STM32F10xxx family */ +# undef CONFIG_STM32_LOWDENSITY /* STM32F100x, STM32F101x, STM32F102x and STM32F103x w/ 16/32 Kbytes */ +# define CONFIG_STM32_MEDIUMDENSITY 1 /* STM32F100x, STM32F101x, STM32F102x and STM32F103x w/ 64/128 Kbytes */ +# undef CONFIG_STM32_HIGHDENSITY /* STM32F100x, STM32F101x, and STM32F103x w/ 256/512 Kbytes */ +# undef CONFIG_STM32_VALUELINE /* STM32F100x */ +# undef CONFIG_STM32_CONNECTIVITYLINE /* STM32F105x and STM32F107x */ +# undef CONFIG_STM32_STM32F20XX /* STM32F205x and STM32F207x */ +# undef CONFIG_STM32_STM32F40XX /* STM32F405xx and STM32407xx families */ +# define STM32_NFSMC 0 /* FSMC */ +# define STM32_NATIM 1 /* One advanced timer TIM1 */ +# define STM32_NGTIM 3 /* General timers TIM2,3,4 */ +# define STM32_NBTIM 0 /* Two basic timers TIM6 and TIM7 */ +# define STM32_NDMA 1 /* DMA1 */ +# define STM32_NSPI 2 /* SPI1-2 */ +# define STM32_NI2S 0 /* No I2S (?) */ +# define STM32_NUSART 3 /* USART1-3 */ +# define STM32_NI2C 2 /* I2C1-2 */ +# define STM32_NCAN 1 /* bxCAN1 */ +# define STM32_NSDIO 0 /* No SDIO */ +# define STM32_NUSBOTG 0 /* No USB OTG FS/HS */ +# define STM32_NGPIO 51 /* GPIOA-E */ +# define STM32_NADC 2 /* ADC1-2 */ +# define STM32_NDAC 0 /* No DAC */ +# define STM32_NCRC 1 /* CRC */ +# define STM32_NTHERNET 0 /* No ethernet */ +# define STM32_NRNG 0 /* No random number generator (RNG) */ +# define STM32_NDCMI 0 /* No digital camera interface (DCMI) */ + /* STM32 F103 High Density Family ***************************************************/ -/* STM32F103RC, STM32F103RD, and STM32F103RE are all provided in 64 pin packages and differ - * only in the available FLASH and SRAM. +/* STM32F103RC, STM32F103RD, and STM32F103RE are all provided in 64 pin packages and + * differ only in the available FLASH and SRAM. */ #elif defined(CONFIG_ARCH_CHIP_STM32F103RET6) diff --git a/nuttx/binfmt/binfmt_exec.c b/nuttx/binfmt/binfmt_exec.c index 1cead43842..7f45fb841b 100644 --- a/nuttx/binfmt/binfmt_exec.c +++ b/nuttx/binfmt/binfmt_exec.c @@ -43,6 +43,7 @@ #include #include +#include #include #include "binfmt_internal.h" @@ -97,6 +98,7 @@ int exec(FAR const char *filename, FAR const char **argv, #ifdef CONFIG_SCHED_ONEXIT FAR struct binary_s *bin; int errorcode; + int pid; int ret; /* Allocate the load information */ @@ -131,8 +133,8 @@ int exec(FAR const char *filename, FAR const char **argv, /* Then start the module */ - ret = exec_module(bin); - if (ret < 0) + pid = exec_module(bin); + if (pid < 0) { bdbg("ERROR: Failed to execute program '%s'\n", filename); sched_unlock(); @@ -145,14 +147,14 @@ int exec(FAR const char *filename, FAR const char **argv, * when the task exists. */ - ret = schedul_unload(ret, bin); + ret = schedule_unload(pid, bin); if (ret < 0) { bdbg("ERROR: Failed to schedul unload '%s'\n", filename); } sched_unlock(); - return ret; + return pid; #else struct binary_s bin; int ret; diff --git a/nuttx/binfmt/binfmt_loadmodule.c b/nuttx/binfmt/binfmt_loadmodule.c index 4f3dc69524..322ed2c487 100644 --- a/nuttx/binfmt/binfmt_loadmodule.c +++ b/nuttx/binfmt/binfmt_loadmodule.c @@ -84,6 +84,7 @@ static int load_default_priority(FAR struct binary_s *bin) { struct sched_param param; + int ret; /* Get the priority of this thread */ @@ -97,6 +98,7 @@ static int load_default_priority(FAR struct binary_s *bin) /* Save that as the priority of child thread */ bin->priority = param.sched_priority; + return ret; } /**************************************************************************** @@ -180,7 +182,7 @@ int load_module(FAR struct binary_s *bin) { /* Set the default priority of the new program. */ - ret = load_default_priority(bin) + ret = load_default_priority(bin); if (ret < 0) { /* The errno is already set in this case */ diff --git a/nuttx/binfmt/binfmt_schedunload.c b/nuttx/binfmt/binfmt_schedunload.c new file mode 100644 index 0000000000..972d17963e --- /dev/null +++ b/nuttx/binfmt/binfmt_schedunload.c @@ -0,0 +1,333 @@ +/**************************************************************************** + * binfmt/binfmt_schedunload.c + * + * Copyright (C) 2013 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * 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. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include +#include +#include + +#include +#include + +#include "binfmt_internal.h" + +#if !defined(CONFIG_BINFMT_DISABLE) && defined(CONFIG_SCHED_HAVE_PARENT) + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +/**************************************************************************** + * Private Function Prototypes + ****************************************************************************/ + +/**************************************************************************** + * Private Data + ****************************************************************************/ + +FAR struct binary_s *g_unloadhead; + +/**************************************************************************** + * Private Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: unload_list_add + * + * Description: + * If CONFIG_SCHED_HAVE_PARENT is defined then schedul_unload() will + * manage instances of struct binary_s allocated with kmalloc. It + * will keep the binary data in a link list and when SIGCHLD is received + * (meaning that the task has exit'ed, schedul_unload() will find the + * data, unload the module, and free the structure. + * + * This function will add one structure to the linked list + * + * Input Parameter: + * pid - The task ID of the child task + * bin - This structure must have been allocated with kmalloc() and must + * persist until the task unloads + + * + * Returned Value: + * None + * + ****************************************************************************/ + +static void unload_list_add(pid_t pid, FAR struct binary_s *bin) +{ + irqstate_t flags; + + /* Save the PID in the structure so that we recover it later */ + + bin->pid = pid; + + /* Disable deliver of any signals while we muck with the list. The graceful + * way to do this would be block delivery of SIGCHLD would be with + * sigprocmask. Here we do it the quick'n'dirty way by just disabling + * interrupts. + */ + + flags = irqsave(); + bin->flink = g_unloadhead; + g_unloadhead = bin; + irqrestore(flags); +} + +/**************************************************************************** + * Name: unload_list_remove + * + * Description: + * If CONFIG_SCHED_HAVE_PARENT is defined then schedul_unload() will + * manage instances of struct binary_s allocated with kmalloc. It + * will keep the binary data in a link list and when SIGCHLD is received + * (meaning that the task has exit'ed, schedul_unload() will find the + * data, unload the module, and free the structure. + * + * This function will remove one structure to the linked list + * + * Input Parameter: + * pid - The task ID of the child task + * + * Returned Value: + * On success, the load structure is returned. NULL is returned on + * failure. + * + ****************************************************************************/ + +static FAR struct binary_s *unload_list_remove(pid_t pid) +{ + FAR struct binary_s *curr; + FAR struct binary_s *prev; + + /* Note the asymmetry. We do not have to disable interrupts here because + * the main thread cannot run while we are in the interrupt handler. Here, + * it should be sufficient to disable pre-emption so that no other thread + * can run. + */ + + sched_lock(); + + /* Find the structure in the unload list with the matching PID */ + + for (prev = NULL, curr = g_unloadhead; + curr && (curr->pid != pid); + prev = curr, curr = curr->flink); + + /* Did we find it? It must be there. Hmmm.. we should probably ASSERT if + * we do not! + */ + + if (curr) + { + /* Was there another entry before this one? */ + + if (prev) + { + /* Yes.. remove the current entry from after the previous entry */ + + prev->flink = curr->flink; + } + else + { + /* No.. remove the current entry from the head of the list */ + + g_unloadhead = curr->flink; + } + + /* Nullify the forward link ... superstitious */ + + curr->flink = NULL; + } + + sched_unlock(); + return curr; +} + +/**************************************************************************** + * Name: unload_callback + * + * Description: + * If CONFIG_SCHED_HAVE_PARENT is defined, this function may be called to + * automatically unload the module when task exits. It assumes that + * bin was allocated with kmalloc() or friends and will also automatically + * free the structure with kfree() when the task exists. + * + * Input Parameter: + * pid - The ID of the task that just exited + * arg - A reference to the load structure cast to FAR void * + * + * Returned Value: + * None + * + ****************************************************************************/ + +static void unload_callback(int signo, siginfo_t *info, void *ucontext) +{ + FAR struct binary_s *bin; + int ret; + + /* Sanity checking */ + + if (!info || signo != SIGCHLD) + { + blldbg("ERROR:Bad signal callback: signo=%d info=%p\n", signo, callback); + return; + } + + /* Get the load information for this pid */ + + bin = unload_list_remove(info->si_pid); + if (!bin) + { + blldbg("ERROR: Could not find load info for PID=%d\n", info->si_pid); + return; + } + + /* Unload the module */ + + ret = unload_module(bin); + if (ret < 0) + { + blldbg("ERROR: unload_module failed: %d\n", get_errno()); + } + + /* Free the load structure */ + + kfree(bin); +} + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: schedule_unload + * + * Description: + * If CONFIG_SCHED_HAVE_PARENT is defined, this function may be called by + * the parent of the the newly created task to automatically unload the + * module when the task exits. This assumes that (1) the caller is the + * parent of the created task, (2) that bin was allocated with kmalloc() + * or friends. It will also automatically free the structure with kfree() + * after unloading the module. + * + * Input Parameter: + * pid - The task ID of the child task + * bin - This structure must have been allocated with kmalloc() and must + * persist until the task unloads + * + * Returned Value: + * This is an end-user function, so it follows the normal convention: + * It returns 0 (OK) if the callback was successfully scheduled. On + * failure, it returns -1 (ERROR) and sets errno appropriately. + * + * On failures, the 'bin' structure will not be deallocated and the + * module not not be unloaded. + * + ****************************************************************************/ + +int schedule_unload(pid_t pid, FAR struct binary_s *bin) +{ + struct sigaction act; + struct sigaction oact; + sigset_t sigset; + irqstate_t flags; + int errorcode; + int ret; + + /* Make sure that SIGCHLD is unmasked */ + + (void)sigemptyset(&sigset); + (void)sigaddset(&sigset, SIGCHLD); + ret = sigprocmask(SIG_UNBLOCK, &sigset, NULL); + if (ret != OK) + { + /* The errno value will get trashed by the following debug output */ + + errorcode = get_errno(); + bvdbg("ERROR: sigprocmask failed: %d\n", ret); + goto errout; + } + + /* Add the structure to the list. We want to do this *before* connecting + * the signal handler. This does, however, make error recovery more + * complex if sigaction() fails below because then we have to remove the + * unload structure for the list in an unexpected context. + */ + + unload_list_add(pid, bin); + + /* Register the SIGCHLD handler */ + + act.sa_sigaction = unload_callback; + act.sa_flags = SA_SIGINFO; + + (void)sigfillset(&act.sa_mask); + (void)sigdelset(&act.sa_mask, SIGCHLD); + + ret = sigaction(SIGCHLD, &act, &oact); + if (ret != OK) + { + /* The errno value will get trashed by the following debug output */ + + errorcode = get_errno(); + bvdbg("ERROR: sigaction failed: %d\n" , ret); + + /* Emergency removal from the list */ + + flags = irqsave(); + if (unload_list_remove(pid) != bin) + { + blldbg("ERROR: Failed to remove structure\n"); + } + + goto errout; + } + + return OK; + +errout: + set_errno(errorcode); + return ERROR; +} + +#endif /* !CONFIG_BINFMT_DISABLE && CONFIG_SCHED_HAVE_PARENT */ + diff --git a/nuttx/binfmt/builtin.c b/nuttx/binfmt/builtin.c index d80d9f5d84..e492f72e58 100644 --- a/nuttx/binfmt/builtin.c +++ b/nuttx/binfmt/builtin.c @@ -98,11 +98,11 @@ static int builtin_loadbinary(struct binary_s *binp) /* Open the binary file for reading (only) */ - fd = open(filename, O_RDONLY); + fd = open(binp->filename, O_RDONLY); if (fd < 0) { int errval = errno; - bdbg("ERROR: Failed to open binary %s: %d\n", filename, errval); + bdbg("ERROR: Failed to open binary %s: %d\n", binp->filename, errval); return -errval; } diff --git a/nuttx/binfmt/libbuiltin/libbuiltin_getname.c b/nuttx/binfmt/libbuiltin/libbuiltin_getname.c index 9da2bac294..d1e3958b32 100644 --- a/nuttx/binfmt/libbuiltin/libbuiltin_getname.c +++ b/nuttx/binfmt/libbuiltin/libbuiltin_getname.c @@ -83,13 +83,13 @@ FAR const char *builtin_getname(int index) { - struct builtin_s *b; + FAR const struct builtin_s *builtin; - b = builtin_for_index(index); + builtin = builtin_for_index(index); - if (b != NULL) + if (builtin != NULL) { - return b->name; + return builtin->name; } return NULL; diff --git a/nuttx/binfmt/libbuiltin/libbuiltin_isavail.c b/nuttx/binfmt/libbuiltin/libbuiltin_isavail.c index b1d55ff21a..7a480c0f3b 100644 --- a/nuttx/binfmt/libbuiltin/libbuiltin_isavail.c +++ b/nuttx/binfmt/libbuiltin/libbuiltin_isavail.c @@ -87,12 +87,12 @@ int builtin_isavail(FAR const char *appname) { - FAR const char *n; + FAR const char *name; int i; - for (i = 0; n = builtin_getname(i); i++) + for (i = 0; (name = builtin_getname(i)); i++) { - if (!strncmp(n, appname, NAME_MAX)) + if (!strncmp(name, appname, NAME_MAX)) { return i; } diff --git a/nuttx/configs/sim/nsh/defconfig b/nuttx/configs/sim/nsh/defconfig index c5eadb1226..7b72ac3031 100644 --- a/nuttx/configs/sim/nsh/defconfig +++ b/nuttx/configs/sim/nsh/defconfig @@ -130,7 +130,8 @@ CONFIG_SDCLONE_DISABLE=y # CONFIG_SCHED_WORKQUEUE is not set CONFIG_SCHED_WAITPID=y # CONFIG_SCHED_ATEXIT is not set -# CONFIG_SCHED_ONEXIT is not set +CONFIG_SCHED_ONEXIT=y +CONFIG_SCHED_ONEXIT_MAX=1 CONFIG_USER_ENTRYPOINT="nsh_main" CONFIG_DISABLE_OS_API=y # CONFIG_DISABLE_CLOCK is not set @@ -259,7 +260,8 @@ CONFIG_MM_REGIONS=1 # Binary Formats # # CONFIG_BINFMT_DISABLE is not set -# CONFIG_BINFMT_EXEPATH is not set +CONFIG_BINFMT_EXEPATH=y +CONFIG_PATH_INITIAL="/bin" # CONFIG_NXFLAT is not set # CONFIG_ELF is not set CONFIG_BUILTIN=y @@ -284,7 +286,10 @@ CONFIG_LIB_HOMEDIR="/" # CONFIG_EOL_IS_LF is not set # CONFIG_EOL_IS_BOTH_CRLF is not set CONFIG_EOL_IS_EITHER_CRLF=y -# CONFIG_LIBC_EXECFUNCS is not set +CONFIG_LIBC_EXECFUNCS=y +CONFIG_EXECFUNCS_SYMTAB="g_symtab" +CONFIG_EXECFUNCS_NSYMBOLS=0 +CONFIG_POSIX_SPAWN_STACKSIZE=1024 # CONFIG_LIBC_STRERROR is not set # CONFIG_LIBC_PERROR_STDOUT is not set CONFIG_ARCH_LOWPUTC=y @@ -410,6 +415,7 @@ CONFIG_EXAMPLES_NSH=y # CONFIG_NSH_LIBRARY=y CONFIG_NSH_BUILTIN_APPS=y +CONFIG_NSH_FILE_APPS=y # # Disable Individual commands diff --git a/nuttx/include/nuttx/binfmt/binfmt.h b/nuttx/include/nuttx/binfmt/binfmt.h index 472ba0fc4b..590d88402d 100644 --- a/nuttx/include/nuttx/binfmt/binfmt.h +++ b/nuttx/include/nuttx/binfmt/binfmt.h @@ -265,7 +265,7 @@ int exec_module(FAR const struct binary_s *bin); ****************************************************************************/ #ifdef CONFIG_SCHED_HAVE_PARENT -int schedule_unload(pid_t pid, FAR const struct binary_s *bin); +int schedule_unload(pid_t pid, FAR struct binary_s *bin); #endif /**************************************************************************** diff --git a/nuttx/include/nuttx/binfmt/builtin.h b/nuttx/include/nuttx/binfmt/builtin.h index 5921cc5189..6ff565395c 100644 --- a/nuttx/include/nuttx/binfmt/builtin.h +++ b/nuttx/include/nuttx/binfmt/builtin.h @@ -77,6 +77,36 @@ extern "C" { * Public Functions ****************************************************************************/ +/**************************************************************************** + * Name: builtin_initialize + * + * Description: + * Builtin support is built unconditionally. However, it order to + * use this binary format, this function must be called during system + * format in order to register the builtin binary format. + * + * Returned Value: + * This is a NuttX internal function so it follows the convention that + * 0 (OK) is returned on success and a negated errno is returned on + * failure. + * + ****************************************************************************/ + +int builtin_initialize(void); + +/**************************************************************************** + * Name: builtin_uninitialize + * + * Description: + * Unregister the builtin binary loader + * + * Returned Value: + * None + * + ****************************************************************************/ + +void builtin_uninitialize(void); + /**************************************************************************** * Utility Functions Provided to Applications by binfmt/libbuiltin ****************************************************************************/ diff --git a/nuttx/libc/spawn/lib_ps.c b/nuttx/libc/spawn/lib_ps.c index 638b27f871..000f711a3f 100644 --- a/nuttx/libc/spawn/lib_ps.c +++ b/nuttx/libc/spawn/lib_ps.c @@ -247,7 +247,7 @@ static int ps_exec(FAR pid_t *pidp, FAR const char *path, errout: sched_unlock(); - return OK; + return ret; } /**************************************************************************** diff --git a/nuttx/tools/mkconfig.c b/nuttx/tools/mkconfig.c index fe3e004916..d8d09df348 100644 --- a/nuttx/tools/mkconfig.c +++ b/nuttx/tools/mkconfig.c @@ -116,7 +116,7 @@ int main(int argc, char **argv, char **envp) printf(" * configured (at present, NXFLAT is the only supported binary.\n"); printf(" * format).\n"); printf(" */\n\n"); - printf("#if !defined(CONFIG_NXFLAT) && !defined(CONFIG_ELF)\n"); + printf("#if !defined(CONFIG_NXFLAT) && !defined(CONFIG_ELF) && !defined(CONFIG_BUILTIN)\n"); printf("# undef CONFIG_BINFMT_DISABLE\n"); printf("# define CONFIG_BINFMT_DISABLE 1\n"); printf("#endif\n\n"); From 2f653578c632ec95e94f67306af24c7d82700d28 Mon Sep 17 00:00:00 2001 From: patacongo Date: Thu, 17 Jan 2013 20:25:32 +0000 Subject: [PATCH 084/118] Misc bug fixes related to NSH file execution git-svn-id: http://svn.code.sf.net/p/nuttx/code/trunk@5530 42af7a65-404d-4744-a932-0658087f49c3 --- apps/builtin/exec_builtin.c | 16 +++++++++++ apps/nshlib/nsh_builtin.c | 54 ++++++++++++++++++++++-------------- apps/nshlib/nsh_fileapps.c | 53 ++++++++++++++++++++++------------- nuttx/configs/sim/README.txt | 31 ++++++++++++++++----- nuttx/libc/spawn/lib_ps.c | 16 +++++++++++ 5 files changed, 122 insertions(+), 48 deletions(-) diff --git a/apps/builtin/exec_builtin.c b/apps/builtin/exec_builtin.c index d4431164cc..803d1ef34c 100644 --- a/apps/builtin/exec_builtin.c +++ b/apps/builtin/exec_builtin.c @@ -46,6 +46,7 @@ #include +#include #include #include #include @@ -92,7 +93,9 @@ struct builtin_parms_s ****************************************************************************/ static sem_t g_builtin_parmsem = SEM_INITIALIZER(1); +#ifndef CONFIG_SCHED_WAITPID static sem_t g_builtin_execsem = SEM_INITIALIZER(0); +#endif static struct builtin_parms_s g_builtin_parms; /**************************************************************************** @@ -274,7 +277,9 @@ static int builtin_proxy(int argc, char *argv[]) */ g_builtin_parms.result = ret; +#ifndef CONFIG_SCHED_WAITPID builtin_semgive(&g_builtin_execsem); +#endif return 0; } @@ -299,6 +304,9 @@ static inline int builtin_startproxy(int index, FAR const char **argv, struct sched_param param; pid_t proxy; int errcode; +#ifdef CONFIG_SCHED_WAITPID + int status; +#endif int ret; svdbg("index=%d argv=%p redirfile=%s oflags=%04x\n", @@ -353,7 +361,15 @@ static inline int builtin_startproxy(int index, FAR const char **argv, * for this. */ +#ifdef CONFIG_SCHED_WAITPID + ret = waitpid(proxy, &status, 0); + if (ret < 0) + { + sdbg("ERROR: waitpid() failed: %d\n", errno); + } +#else bultin_semtake(&g_builtin_execsem); +#endif /* Get the result and relinquish our access to the parameter structure */ diff --git a/apps/nshlib/nsh_builtin.c b/apps/nshlib/nsh_builtin.c index 2d23ca8d8b..343a0824b3 100644 --- a/apps/nshlib/nsh_builtin.c +++ b/apps/nshlib/nsh_builtin.c @@ -51,7 +51,6 @@ #endif #include -#include #include #include @@ -117,8 +116,8 @@ int nsh_builtin(FAR struct nsh_vtbl_s *vtbl, FAR const char *cmd, { int ret = OK; - /* Lock the scheduler to prevent the application from running until the - * waitpid() has been called. + /* Lock the scheduler in an attempt to prevent the application from + * running until waitpid() has been called. */ sched_lock(); @@ -146,18 +145,6 @@ int nsh_builtin(FAR struct nsh_vtbl_s *vtbl, FAR const char *cmd, #ifdef CONFIG_SCHED_WAITPID - /* Check if the application is still running */ - - if (kill(ret, 0) < 0) - { - /* It is not running. In this case, we have no idea if the - * application ran successfully or not. Let's assume that is - * did. - */ - - return 0; - } - /* CONFIG_SCHED_WAITPID is selected, so we may run the command in * foreground unless we were specifically requested to run the command * in background (and running commands in background is enabled). @@ -169,15 +156,40 @@ int nsh_builtin(FAR struct nsh_vtbl_s *vtbl, FAR const char *cmd, { int rc = 0; - /* Wait for the application to exit. Since we have locked the - * scheduler above, we know that the application has not yet - * started and there is no possibility that it has already exited. - * The scheduler will be unlocked while waitpid is waiting and the - * application will be able to run. + /* Wait for the application to exit. We did locked the scheduler + * above, but that does not guarantee that the application did not + * run in the case where I/O was redirected. The scheduler will + * be unlocked while waitpid is waiting and if the application has + * not yet run, it will be able to to do so. */ ret = waitpid(ret, &rc, 0); - if (ret >= 0) + if (ret < 0) + { + /* If the child thread does not exist, waitpid() will return + * the error ECHLD. Since we know that the task was successfully + * started, this must be one of the cases described above; we + * have to assume that the task already exit'ed. In this case, + * we have no idea if the application ran successfully or not + * (because NuttX does not retain exit status of child tasks). + * Let's assume that is did run successfully. + */ + + int errcode = errno; + if (errcode == ECHILD) + { + ret = OK; + } + else + { + nsh_output(vtbl, g_fmtcmdfailed, cmd, "waitpid", + NSH_ERRNO_OF(errcode)); + } + } + + /* Waitpid completed the wait successfully */ + + else { /* We can't return the exact status (nsh has nowhere to put it) * so just pass back zero/nonzero in a fashion that doesn't look diff --git a/apps/nshlib/nsh_fileapps.c b/apps/nshlib/nsh_fileapps.c index 7f9f58e534..92146a68db 100644 --- a/apps/nshlib/nsh_fileapps.c +++ b/apps/nshlib/nsh_fileapps.c @@ -44,7 +44,6 @@ #endif #include -#include #include #include #include @@ -154,8 +153,8 @@ int nsh_fileapp(FAR struct nsh_vtbl_s *vtbl, FAR const char *cmd, } } - /* Lock the scheduler to prevent the application from running until the - * waitpid() has been called. + /* Lock the scheduler in an attempt to prevent the application from + * running until waitpid() has been called. */ sched_lock(); @@ -182,17 +181,6 @@ int nsh_fileapp(FAR struct nsh_vtbl_s *vtbl, FAR const char *cmd, */ #ifdef CONFIG_SCHED_WAITPID - /* Check if the application is still running */ - - if (kill(ret, 0) < 0) - { - /* It is not running. In this case, we have no idea if the - * application ran successfully or not. Let's assume that is - * did. - */ - - return 0; - } /* CONFIG_SCHED_WAITPID is selected, so we may run the command in * foreground unless we were specifically requested to run the command @@ -205,15 +193,40 @@ int nsh_fileapp(FAR struct nsh_vtbl_s *vtbl, FAR const char *cmd, { int rc = 0; - /* Wait for the application to exit. Since we have locked the - * scheduler above, we know that the application has not yet - * started and there is no possibility that it has already exited. - * The scheduler will be unlocked while waitpid is waiting and the - * application will be able to run. + /* Wait for the application to exit. We did locked the scheduler + * above, but that does not guarantee that the application did not + * run in the case where I/O was redirected. The scheduler will + * be unlocked while waitpid is waiting and if the application has + * not yet run, it will be able to to do so. */ ret = waitpid(pid, &rc, 0); - if (ret >= 0) + if (ret < 0) + { + /* If the child thread does not exist, waitpid() will return + * the error ECHLD. Since we know that the task was successfully + * started, this must be one of the cases described above; we + * have to assume that the task already exit'ed. In this case, + * we have no idea if the application ran successfully or not + * (because NuttX does not retain exit status of child tasks). + * Let's assume that is did run successfully. + */ + + int errcode = errno; + if (errcode == ECHILD) + { + ret = OK; + } + else + { + nsh_output(vtbl, g_fmtcmdfailed, cmd, "waitpid", + NSH_ERRNO_OF(errcode)); + } + } + + /* Waitpid completed the wait successfully */ + + else { /* We can't return the exact status (nsh has nowhere to put it) * so just pass back zero/nonzero in a fashion that doesn't look diff --git a/nuttx/configs/sim/README.txt b/nuttx/configs/sim/README.txt index 67ff730197..963a46e083 100644 --- a/nuttx/configs/sim/README.txt +++ b/nuttx/configs/sim/README.txt @@ -291,14 +291,31 @@ nsh apps/examples/hello. 3. This configuration has BINFS enabled so that the builtin applications - can be made visible in the file system. For example: + can be made visible in the file system. Because of that, the + build in applications do not work as other examples. - NuttShell (NSH) NuttX-6.24 - nsh> mount -t binfs /bin - nsh> ls /bin - /bin: - hello - nsh> + For example trying to execute the hello builtin application will + fail: + + nsh> hello + nsh: hello: command not found + nsh> + + Unless you first mount the BINFS file system: + + nsh> mount -t binfs /bin + nsh> ls /bin + /bin: + hello + nsh> echo $PATH + /bin + nsh> hello + Hello, World!! + nsh> + + Notice that the executable 'hello' is found using the value in the PATH + variable (which was preset to "/bin"). If the PATH variable were not set + then you would have to use /bin/hello on the command line. nsh2 diff --git a/nuttx/libc/spawn/lib_ps.c b/nuttx/libc/spawn/lib_ps.c index 000f711a3f..1bf7c21133 100644 --- a/nuttx/libc/spawn/lib_ps.c +++ b/nuttx/libc/spawn/lib_ps.c @@ -39,6 +39,7 @@ #include +#include #include #include #include @@ -75,7 +76,9 @@ struct spawn_parms_s ****************************************************************************/ static sem_t g_ps_parmsem = SEM_INITIALIZER(1); +#ifndef CONFIG_SCHED_WAITPID static sem_t g_ps_execsem = SEM_INITIALIZER(0); +#endif static struct spawn_parms_s g_ps_parms; /**************************************************************************** @@ -425,7 +428,9 @@ static int spawn_proxy(int argc, char *argv[]) */ g_ps_parms.result = ret; +#ifndef CONFIG_SCHED_WAITPID ps_semgive(&g_ps_execsem); +#endif return 0; } @@ -540,6 +545,9 @@ int posix_spawn(FAR pid_t *pid, FAR const char *path, { struct sched_param param; pid_t proxy; +#ifdef CONFIG_SCHED_WAITPID + int status; +#endif int ret; DEBUGASSERT(path); @@ -613,7 +621,15 @@ int posix_spawn(FAR pid_t *pid, FAR const char *path, /* Wait for the proxy to complete its job */ +#ifdef CONFIG_SCHED_WAITPID + ret = waitpid(proxy, &status, 0); + if (ret < 0) + { + sdbg("ERROR: waitpid() failed: %d\n", errno); + } +#else ps_semtake(&g_ps_execsem); +#endif /* Get the result and relinquish our access to the parameter structure */ From 76753ad9cb67133892000f19de10f93de78bb525 Mon Sep 17 00:00:00 2001 From: patacongo Date: Fri, 18 Jan 2013 01:52:42 +0000 Subject: [PATCH 085/118] Add internal API task_reparent(), used in posix_spawn(). Move libc/spawn/lib_ps.c to sched/task_posixspawn.c; Move libc/spawn/spawn.h to include/nuttx/spawn.h git-svn-id: http://svn.code.sf.net/p/nuttx/code/trunk@5531 42af7a65-404d-4744-a932-0658087f49c3 --- apps/builtin/exec_builtin.c | 44 ++++-- apps/nshlib/nsh_builtin.c | 26 ++-- apps/nshlib/nsh_fileapps.c | 21 +-- nuttx/ChangeLog | 7 +- nuttx/binfmt/binfmt_exec.c | 1 - nuttx/{libc/spawn => include/nuttx}/spawn.h | 8 +- nuttx/include/signal.h | 9 +- nuttx/libc/spawn/Make.defs | 2 - nuttx/libc/spawn/lib_psfa_addaction.c | 2 +- nuttx/libc/spawn/lib_psfa_addclose.c | 2 +- nuttx/libc/spawn/lib_psfa_adddup2.c | 2 +- nuttx/libc/spawn/lib_psfa_addopen.c | 2 +- nuttx/libc/spawn/lib_psfa_destroy.c | 2 +- nuttx/libc/spawn/lib_psfa_dump.c | 2 +- nuttx/sched/Makefile | 6 +- nuttx/sched/os_internal.h | 3 + .../lib_ps.c => sched/task_posixspawn.c} | 82 +++++++--- nuttx/sched/task_reparent.c | 145 ++++++++++++++++++ nuttx/syscall/syscall.csv | 2 + 19 files changed, 297 insertions(+), 71 deletions(-) rename nuttx/{libc/spawn => include/nuttx}/spawn.h (97%) rename nuttx/{libc/spawn/lib_ps.c => sched/task_posixspawn.c} (91%) create mode 100644 nuttx/sched/task_reparent.c diff --git a/apps/builtin/exec_builtin.c b/apps/builtin/exec_builtin.c index 803d1ef34c..60e8b742d9 100644 --- a/apps/builtin/exec_builtin.c +++ b/apps/builtin/exec_builtin.c @@ -124,7 +124,7 @@ static void bultin_semtake(FAR sem_t *sem) do { ret = sem_wait(sem); - ASSERT(ret == 0 || errno == EINTR); + ASSERT(ret == 0 || get_errno() == EINTR); } while (ret != 0); } @@ -152,7 +152,7 @@ static int builtin_taskcreate(int index, FAR const char **argv) if (b == NULL) { - errno = ENOENT; + set_errno(ENOENT); return ERROR; } @@ -228,7 +228,7 @@ static int builtin_proxy(int argc, char *argv[]) { /* Remember the errno value. ret is already set to ERROR */ - g_builtin_parms.errcode = errno; + g_builtin_parms.errcode = get_errno(); sdbg("ERROR: open of %s failed: %d\n", g_builtin_parms.redirfile, g_builtin_parms.errcode); } @@ -246,7 +246,7 @@ static int builtin_proxy(int argc, char *argv[]) ret = dup2(fd, 1); if (ret < 0) { - g_builtin_parms.errcode = errno; + g_builtin_parms.errcode = get_errno(); sdbg("ERROR: dup2 failed: %d\n", g_builtin_parms.errcode); } @@ -266,12 +266,18 @@ static int builtin_proxy(int argc, char *argv[]) ret = builtin_taskcreate(g_builtin_parms.index, g_builtin_parms.argv); if (ret < 0) { - g_builtin_parms.errcode = errno; + g_builtin_parms.errcode = get_errno(); sdbg("ERROR: builtin_taskcreate failed: %d\n", g_builtin_parms.errcode); } } + /* NOTE: There is a logical error here if CONFIG_SCHED_HAVE_PARENT is + * defined: The new task is the child of this proxy task, not the + * original caller. As a consequence, operations like waitpid() will + * fail on the caller's thread. + */ + /* Post the semaphore to inform the parent task that we have completed * what we need to do. */ @@ -340,11 +346,21 @@ static inline int builtin_startproxy(int index, FAR const char **argv, ret = sched_getparam(0, ¶m); if (ret < 0) { - errcode = errno; + errcode = get_errno(); sdbg("ERROR: sched_getparam failed: %d\n", errcode); - goto errout; + goto errout_with_sem; } + /* Disable pre-emption so that the proxy does not run until we waitpid + * is called. This is probably unnecessary since the builtin_proxy has + * the same priority as this thread; it should be schedule behind this + * task in the ready-to-run list. + */ + +#ifdef CONFIG_SCHED_WAITPID + sched_lock(); +#endif + /* Start the intermediary/proxy task at the same priority as the parent task. */ proxy = TASK_CREATE("builtin_proxy", param.sched_priority, @@ -352,9 +368,9 @@ static inline int builtin_startproxy(int index, FAR const char **argv, (FAR const char **)NULL); if (proxy < 0) { - errcode = errno; + errcode = get_errno(); sdbg("ERROR: Failed to start builtin_proxy: %d\n", errcode); - goto errout; + goto errout_with_lock; } /* Wait for the proxy to complete its job. We could use waitpid() @@ -365,7 +381,8 @@ static inline int builtin_startproxy(int index, FAR const char **argv, ret = waitpid(proxy, &status, 0); if (ret < 0) { - sdbg("ERROR: waitpid() failed: %d\n", errno); + sdbg("ERROR: waitpid() failed: %d\n", get_errno()); + goto errout_with_lock; } #else bultin_semtake(&g_builtin_execsem); @@ -377,7 +394,12 @@ static inline int builtin_startproxy(int index, FAR const char **argv, builtin_semgive(&g_builtin_parmsem); return g_builtin_parms.result; -errout: +errout_with_lock: +#ifdef CONFIG_SCHED_WAITPID + sched_unlock(); +#endif + +errout_with_sem: set_errno(errcode); builtin_semgive(&g_builtin_parmsem); return ERROR; diff --git a/apps/nshlib/nsh_builtin.c b/apps/nshlib/nsh_builtin.c index 343a0824b3..0d5a0231c8 100644 --- a/apps/nshlib/nsh_builtin.c +++ b/apps/nshlib/nsh_builtin.c @@ -131,12 +131,14 @@ int nsh_builtin(FAR struct nsh_vtbl_s *vtbl, FAR const char *cmd, { /* The application was successfully started with pre-emption disabled. * In the simplest cases, the application will not have run because the - * the scheduler is locked. but in the case were I/O redirected, a - * proxy task ran and, as result, so may have the application. + * the scheduler is locked. But in the case where I/O was redirected, a + * proxy task ran and broke our lock. As result, the application may + * have aso ran if its priority was higher than than the priority of + * this thread. * - * If the application did not run and if the application was not - * backgrounded, then we need to wait here for the application to - * exit. This only works works with the following options: + * If the application did not run to completion and if the application + * was not backgrounded, then we need to wait here for the application + * to exit. This only works works with the following options: * * - CONFIG_NSH_DISABLEBG - Do not run commands in background * - CONFIG_SCHED_WAITPID - Required to run external commands in @@ -156,11 +158,17 @@ int nsh_builtin(FAR struct nsh_vtbl_s *vtbl, FAR const char *cmd, { int rc = 0; - /* Wait for the application to exit. We did locked the scheduler + /* Wait for the application to exit. We did lock the scheduler * above, but that does not guarantee that the application did not - * run in the case where I/O was redirected. The scheduler will - * be unlocked while waitpid is waiting and if the application has - * not yet run, it will be able to to do so. + * already run to completion in the case where I/O was redirected. + * Here the scheduler will be unlocked while waitpid is waiting + * and if the application has not yet run, it will now be able to + * do so. + * + * Also, if CONFIG_SCHED_HAVE_PARENT is defined waitpid() might fail + * even if task is still active: If the I/O was re-directed by a + * proxy task, then the ask is a child of the proxy, and not this + * task. waitpid() fails with ECHILD in either case. */ ret = waitpid(ret, &rc, 0); diff --git a/apps/nshlib/nsh_fileapps.c b/apps/nshlib/nsh_fileapps.c index 92146a68db..9ff230f1a8 100644 --- a/apps/nshlib/nsh_fileapps.c +++ b/apps/nshlib/nsh_fileapps.c @@ -168,12 +168,14 @@ int nsh_fileapp(FAR struct nsh_vtbl_s *vtbl, FAR const char *cmd, { /* The application was successfully started with pre-emption disabled. * In the simplest cases, the application will not have run because the - * the scheduler is locked. but in the case were I/O redirected, a - * proxy task ran and, as result, so may have the application. + * the scheduler is locked. But in the case where I/O was redirected, a + * proxy task ran and broke our lock. As result, the application may + * have aso ran if its priority was higher than than the priority of + * this thread. * - * If the application did not run and if the application was not - * backgrounded, then we need to wait here for the application to - * exit. This only works works with the following options: + * If the application did not run to completion and if the application + * was not backgrounded, then we need to wait here for the application + * to exit. This only works works with the following options: * * - CONFIG_NSH_DISABLEBG - Do not run commands in background * - CONFIG_SCHED_WAITPID - Required to run external commands in @@ -193,11 +195,12 @@ int nsh_fileapp(FAR struct nsh_vtbl_s *vtbl, FAR const char *cmd, { int rc = 0; - /* Wait for the application to exit. We did locked the scheduler + /* Wait for the application to exit. We did lock the scheduler * above, but that does not guarantee that the application did not - * run in the case where I/O was redirected. The scheduler will - * be unlocked while waitpid is waiting and if the application has - * not yet run, it will be able to to do so. + * already run to completion in the case where I/O was redirected. + * Here the scheduler will be unlocked while waitpid is waiting + * and if the application has not yet run, it will now be able to + * do so. */ ret = waitpid(pid, &rc, 0); diff --git a/nuttx/ChangeLog b/nuttx/ChangeLog index 1b0c5338b9..2a1561abe4 100644 --- a/nuttx/ChangeLog +++ b/nuttx/ChangeLog @@ -3971,4 +3971,9 @@ automatically unload and clean-up after running a task that was loaded into memory. * binfmt/libbuiltin: Extensions from Mike Smith - + * sched/task_reparent.c: Add internal interface to change the + parent task. + * sched/task_posixspawn(): Move libc/spawn/lib_ps.c to + sched/task_posixspawn() now it requires internal, reparenting + interfaces + * include/nuttx/spawn(): Move libc/spawn.h to include/nuttx/spawn.h diff --git a/nuttx/binfmt/binfmt_exec.c b/nuttx/binfmt/binfmt_exec.c index 7f45fb841b..4226b6cfc9 100644 --- a/nuttx/binfmt/binfmt_exec.c +++ b/nuttx/binfmt/binfmt_exec.c @@ -97,7 +97,6 @@ int exec(FAR const char *filename, FAR const char **argv, { #ifdef CONFIG_SCHED_ONEXIT FAR struct binary_s *bin; - int errorcode; int pid; int ret; diff --git a/nuttx/libc/spawn/spawn.h b/nuttx/include/nuttx/spawn.h similarity index 97% rename from nuttx/libc/spawn/spawn.h rename to nuttx/include/nuttx/spawn.h index 3f4e195cc7..f84ae83556 100644 --- a/nuttx/libc/spawn/spawn.h +++ b/nuttx/include/nuttx/spawn.h @@ -1,5 +1,5 @@ /**************************************************************************** - * libc/spawn/spawn.h + * include/nuttx/spawn.h * * Copyright (C) 2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -33,8 +33,8 @@ * ****************************************************************************/ -#ifndef __LIBC_SPAWN_SPAWN_H -#define __LIBC_SPAWN_SPAWN_H +#ifndef __INCLUDE_NUTTX_SPAWN_H +#define __INCLUDE_NUTTX_SPAWN_H /**************************************************************************** * Included Files @@ -118,4 +118,4 @@ void add_file_action(FAR posix_spawn_file_actions_t *file_action, } #endif -#endif /* __LIBC_SPAWN_SPAWN_H */ +#endif /* __INCLUDE_NUTTX_SPAWN_H */ diff --git a/nuttx/include/signal.h b/nuttx/include/signal.h index 30726105bb..7c6b4cd553 100644 --- a/nuttx/include/signal.h +++ b/nuttx/include/signal.h @@ -61,14 +61,17 @@ /* All signals are "real time" signals */ -#define SIGRTMIN 0 /* First real time signal */ -#define SIGRTMAX 31 /* Last real time signal */ +#define SIGRTMIN MIN_SIGNO /* First real time signal */ +#define SIGRTMAX MAX_SIGNO /* Last real time signal */ /* A few of the real time signals are used within the OS. They have * default values that can be overridden from the configuration file. The * rest are all user signals. * - * These are semi-standard signal definitions: + * The signal number zero is wasted for the most part. It is a valid + * signal number, but has special meaning at many interfaces (e.g., Kill()). + * + * These are the semi-standard signal definitions: */ #ifndef CONFIG_SIG_SIGUSR1 diff --git a/nuttx/libc/spawn/Make.defs b/nuttx/libc/spawn/Make.defs index 99ee781ce2..8cb086feee 100644 --- a/nuttx/libc/spawn/Make.defs +++ b/nuttx/libc/spawn/Make.defs @@ -37,8 +37,6 @@ ifeq ($(CONFIG_LIBC_EXECFUNCS),y) -CSRCS += lib_ps.c - CSRCS += lib_psfa_addaction.c lib_psfa_addclose.c lib_psfa_adddup2.c CSRCS += lib_psfa_addopen.c lib_psfa_destroy.c lib_psfa_init.c diff --git a/nuttx/libc/spawn/lib_psfa_addaction.c b/nuttx/libc/spawn/lib_psfa_addaction.c index 3f297d7cf8..8700efc2a5 100644 --- a/nuttx/libc/spawn/lib_psfa_addaction.c +++ b/nuttx/libc/spawn/lib_psfa_addaction.c @@ -41,7 +41,7 @@ #include -#include "spawn/spawn.h" +#include /**************************************************************************** * Global Functions diff --git a/nuttx/libc/spawn/lib_psfa_addclose.c b/nuttx/libc/spawn/lib_psfa_addclose.c index bf22a153a8..1c72f0f828 100644 --- a/nuttx/libc/spawn/lib_psfa_addclose.c +++ b/nuttx/libc/spawn/lib_psfa_addclose.c @@ -44,7 +44,7 @@ #include #include -#include "spawn/spawn.h" +#include /**************************************************************************** * Global Functions diff --git a/nuttx/libc/spawn/lib_psfa_adddup2.c b/nuttx/libc/spawn/lib_psfa_adddup2.c index fc788a4e9d..deb3cbdb33 100644 --- a/nuttx/libc/spawn/lib_psfa_adddup2.c +++ b/nuttx/libc/spawn/lib_psfa_adddup2.c @@ -44,7 +44,7 @@ #include #include -#include "spawn/spawn.h" +#include /**************************************************************************** * Global Functions diff --git a/nuttx/libc/spawn/lib_psfa_addopen.c b/nuttx/libc/spawn/lib_psfa_addopen.c index 385e1cfc33..66bbd813a6 100644 --- a/nuttx/libc/spawn/lib_psfa_addopen.c +++ b/nuttx/libc/spawn/lib_psfa_addopen.c @@ -45,7 +45,7 @@ #include #include -#include "spawn/spawn.h" +#include /**************************************************************************** * Global Functions diff --git a/nuttx/libc/spawn/lib_psfa_destroy.c b/nuttx/libc/spawn/lib_psfa_destroy.c index 5d0a644d8b..a21886645c 100644 --- a/nuttx/libc/spawn/lib_psfa_destroy.c +++ b/nuttx/libc/spawn/lib_psfa_destroy.c @@ -43,7 +43,7 @@ #include #include -#include "spawn/spawn.h" +#include /**************************************************************************** * Global Functions diff --git a/nuttx/libc/spawn/lib_psfa_dump.c b/nuttx/libc/spawn/lib_psfa_dump.c index d7bf1576de..0dbaeb0234 100644 --- a/nuttx/libc/spawn/lib_psfa_dump.c +++ b/nuttx/libc/spawn/lib_psfa_dump.c @@ -43,7 +43,7 @@ #include #include -#include "spawn/spawn.h" +#include #ifdef CONFIG_DEBUG diff --git a/nuttx/sched/Makefile b/nuttx/sched/Makefile index 3d6b58bacf..73c67239e5 100644 --- a/nuttx/sched/Makefile +++ b/nuttx/sched/Makefile @@ -48,7 +48,7 @@ TSK_SRCS = prctl.c task_create.c task_init.c task_setup.c task_activate.c \ task_restart.c task_vfork.c exit.c getpid.c sched_addreadytorun.c \ sched_removereadytorun.c sched_addprioritized.c sched_mergepending.c \ sched_addblocked.c sched_removeblocked.c sched_free.c sched_gettcb.c \ - sched_verifytcb.c sched_releasetcb.c + sched_verifytcb.c sched_releasetcb.c task_posixspawn.c SCHED_SRCS = sched_setparam.c sched_setpriority.c sched_getparam.c \ sched_setscheduler.c sched_getscheduler.c \ @@ -67,6 +67,10 @@ ifeq ($(CONFIG_PRIORITY_INHERITANCE),y) SCHED_SRCS += sched_reprioritize.c endif +ifeq ($(CONFIG_SCHED_HAVE_PARENT),y) +SCHED_SRCS += task_reparent.c +endif + ifeq ($(CONFIG_SCHED_WAITPID),y) SCHED_SRCS += sched_waitpid.c ifeq ($(CONFIG_SCHED_HAVE_PARENT),y) diff --git a/nuttx/sched/os_internal.h b/nuttx/sched/os_internal.h index 32d9fb4ac3..f21d9654f6 100644 --- a/nuttx/sched/os_internal.h +++ b/nuttx/sched/os_internal.h @@ -268,6 +268,9 @@ int task_schedsetup(FAR _TCB *tcb, int priority, start_t start, int task_argsetup(FAR _TCB *tcb, FAR const char *name, FAR const char *argv[]); void task_exithook(FAR _TCB *tcb, int status); int task_deletecurrent(void); +#ifdef CONFIG_SCHED_HAVE_PARENT +int task_reparent(pid_t oldpid, pid_t newpid, pid_t chpid); +#endif #ifndef CONFIG_CUSTOM_STACK int kernel_thread(FAR const char *name, int priority, int stack_size, main_t entry, FAR const char *argv[]); diff --git a/nuttx/libc/spawn/lib_ps.c b/nuttx/sched/task_posixspawn.c similarity index 91% rename from nuttx/libc/spawn/lib_ps.c rename to nuttx/sched/task_posixspawn.c index 1bf7c21133..4201e759ba 100644 --- a/nuttx/libc/spawn/lib_ps.c +++ b/nuttx/sched/task_posixspawn.c @@ -1,5 +1,5 @@ /**************************************************************************** - * libc/string/lib_ps.c + * sched/task_posixspawn.c * * Copyright (C) 2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt @@ -50,8 +50,9 @@ #include #include +#include -#include "spawn/spawn.h" +#include "os_internal.h" /**************************************************************************** * Private Types @@ -86,7 +87,7 @@ static struct spawn_parms_s g_ps_parms; ****************************************************************************/ /**************************************************************************** - * Name: ps_semtake and ps_semgive + * Name: spawn_semtake and spawn_semgive * * Description: * Give and take semaphores @@ -100,7 +101,7 @@ static struct spawn_parms_s g_ps_parms; * ****************************************************************************/ -static void ps_semtake(FAR sem_t *sem) +static void spawn_semtake(FAR sem_t *sem) { int ret; @@ -112,10 +113,10 @@ static void ps_semtake(FAR sem_t *sem) while (ret != 0); } -#define ps_semgive(sem) sem_post(sem) +#define spawn_semgive(sem) sem_post(sem) /**************************************************************************** - * Name: ps_exec + * Name: spawn_exec * * Description: * Execute the task from the file system. @@ -153,9 +154,9 @@ static void ps_semtake(FAR sem_t *sem) * ****************************************************************************/ -static int ps_exec(FAR pid_t *pidp, FAR const char *path, - FAR const posix_spawnattr_t *attr, - FAR char *const argv[]) +static int spawn_exec(FAR pid_t *pidp, FAR const char *path, + FAR const posix_spawnattr_t *attr, + FAR char *const argv[]) { struct sched_param param; FAR const struct symtab_s *symtab; @@ -420,7 +421,23 @@ static int spawn_proxy(int argc, char *argv[]) { /* Start the task */ - ret = ps_exec(g_ps_parms.pid, g_ps_parms.path, attr, g_ps_parms.argv); + ret = spawn_exec(g_ps_parms.pid, g_ps_parms.path, attr, + g_ps_parms.argv); + +#ifdef CONFIG_SCHED_HAVE_PARENT + if (ret == OK) + { + /* Change of the parent of the task we just spawned to our parent. + * What should we do in the event of a failure? + */ + + int tmp = task_reparent(0, 0, *g_ps_parms.pid); + if (tmp < 0) + { + sdbg("ERROR: task_reparent() failed: %d\n", tmp); + } + } +#endif } /* Post the semaphore to inform the parent task that we have completed @@ -429,9 +446,9 @@ static int spawn_proxy(int argc, char *argv[]) g_ps_parms.result = ret; #ifndef CONFIG_SCHED_WAITPID - ps_semgive(&g_ps_execsem); + spawn_semgive(&g_ps_execsem); #endif - return 0; + return OK; } /**************************************************************************** @@ -566,7 +583,7 @@ int posix_spawn(FAR pid_t *pid, FAR const char *path, if (file_actions == NULL || *file_actions == NULL) #endif { - return ps_exec(pid, path, attr, argv); + return spawn_exec(pid, path, attr, argv); } /* Otherwise, we will have to go through an intermediary/proxy task in order @@ -582,7 +599,7 @@ int posix_spawn(FAR pid_t *pid, FAR const char *path, /* Get exclusive access to the global parameter structure */ - ps_semtake(&g_ps_parmsem); + spawn_semtake(&g_ps_parmsem); /* Populate the parameter structure */ @@ -601,22 +618,33 @@ int posix_spawn(FAR pid_t *pid, FAR const char *path, int errcode = errno; sdbg("ERROR: sched_getparam failed: %d\n", errcode); - ps_semgive(&g_ps_parmsem); + spawn_semgive(&g_ps_parmsem); return errcode; } - /* Start the intermediary/proxy task at the same priority as the parent task. */ + /* Disable pre-emption so that the proxy does not run until we waitpid + * is called. This is probably unnecessary since the spawn_proxy has + * the same priority as this thread; it should be schedule behind this + * task in the ready-to-run list. + */ + +#ifdef CONFIG_SCHED_WAITPID + sched_lock(); +#endif + + /* Start the intermediary/proxy task at the same priority as the parent + * task. + */ proxy = TASK_CREATE("spawn_proxy", param.sched_priority, CONFIG_POSIX_SPAWN_STACKSIZE, (main_t)spawn_proxy, (FAR const char **)NULL); if (proxy < 0) { - int errcode = errno; + ret = get_errno(); + sdbg("ERROR: Failed to start spawn_proxy: %d\n", ret); - sdbg("ERROR: Failed to start spawn_proxy: %d\n", errcode); - ps_semgive(&g_ps_parmsem); - return errcode; + goto errout_with_lock; } /* Wait for the proxy to complete its job */ @@ -625,15 +653,21 @@ int posix_spawn(FAR pid_t *pid, FAR const char *path, ret = waitpid(proxy, &status, 0); if (ret < 0) { - sdbg("ERROR: waitpid() failed: %d\n", errno); + sdbg("ERROR: waitpid() failed: %d\n", errno); + goto errout_with_lock; } #else - ps_semtake(&g_ps_execsem); + spawn_semtake(&g_ps_execsem); #endif /* Get the result and relinquish our access to the parameter structure */ ret = g_ps_parms.result; - ps_semgive(&g_ps_parmsem); - return ret; + +errout_with_lock: +#ifdef CONFIG_SCHED_WAITPID + sched_unlock(); +#endif + spawn_semgive(&g_ps_parmsem); + return ret; } diff --git a/nuttx/sched/task_reparent.c b/nuttx/sched/task_reparent.c new file mode 100644 index 0000000000..9daa0743b0 --- /dev/null +++ b/nuttx/sched/task_reparent.c @@ -0,0 +1,145 @@ +/***************************************************************************** + * sched/task_reparent.c + * + * Copyright (C) 2013 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * 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. + * + *****************************************************************************/ + +/***************************************************************************** + * Included Files + *****************************************************************************/ + +#include + +#include + +#include "os_internal.h" + +#ifdef CONFIG_SCHED_HAVE_PARENT + +/***************************************************************************** + * Private Functions + *****************************************************************************/ + +/***************************************************************************** + * Public Functions + *****************************************************************************/ + +/***************************************************************************** + * Name: task_reparent + * + * Description: + * Change the parent of a task. + * + * Parameters: + * oldpid - PID of the old parent task (0 if this task) + * newpid - PID ot the new parent task (0 for the parent of this task) + * chpid - PID of the child to be reparented. + * + * Return Value: + * 0 (OK) on success; A negated errno value on failure. + * + *****************************************************************************/ + +int task_reparent(pid_t oldpid, pid_t newpid, pid_t chpid) +{ + _TCB *oldtcb; + _TCB *newtcb; + _TCB *chtcb; + irqstate_t flags; + int ret; + + /* If oldpid is zero, then we are parent task. */ + + if (oldpid == 0) + { + oldpid = getpid(); + } + + /* Get the current parent task's TCB */ + + oldtcb = sched_gettcb(oldpid); + if (!oldtcb) + { + return -ESRCH; + } + + /* Disable interrupts so that nothing can change from this point */ + + flags = irqsave(); + + /* If newpid is zero, then new is the parent of oldpid. */ + + if (newpid == 0) + { + newpid = oldtcb->parent; + } + + /* Get the new parent task's TCB */ + + newtcb = sched_gettcb(newpid); + if (!newtcb) + { + ret = -ESRCH; + goto errout_with_ints; + } + + /* Get the child tasks TCB */ + + chtcb = sched_gettcb(chpid); + if (!chtcb) + { + ret = -ECHILD; + goto errout_with_ints; + } + + /* Verify that oldpid is the parent of chpid */ + + if (chtcb->parent != oldpid) + { + ret = -ECHILD; + goto errout_with_ints; + } + + /* Okay, reparent the child */ + + DEBUGASSERT(oldtcb->nchildren > 0); + chtcb->parent = newpid; + oldtcb->nchildren--; + newtcb->nchildren++; + ret = OK; + +errout_with_ints: + irqrestore(flags); + return ret; +} + +#endif /* CONFIG_SCHED_HAVE_PARENT */ diff --git a/nuttx/syscall/syscall.csv b/nuttx/syscall/syscall.csv index 4ccd53f9d6..5bc52a71d7 100644 --- a/nuttx/syscall/syscall.csv +++ b/nuttx/syscall/syscall.csv @@ -43,6 +43,8 @@ "prctl","sys/prctl.h", "CONFIG_TASK_NAME_SIZE > 0","int","int","..." "clock_systimer","nuttx/clock.h","!defined(CONFIG_DISABLE_CLOCK)","uint32_t" "poll","poll.h","!defined(CONFIG_DISABLE_POLL) && (CONFIG_NSOCKET_DESCRIPTORS > 0 || CONFIG_NFILE_DESCRIPTORS > 0)","int","FAR struct pollfd*","nfds_t","int" +"posix_spawnp", defined(CONFIG_BINFMT_EXEPATH), "int","FAR pid_t *","FAR const char *","FAR const posix_spawn_file_actions_t *","FAR const posix_spawnattr_t *","FAR char *const []","FAR char *const []" +"posix_spawn", !defined(CONFIG_BINFMT_EXEPATH), "int","FAR pid_t *","FAR const char *","FAR const posix_spawn_file_actions_t *","FAR const posix_spawnattr_t *","FAR char *const []","FAR char *const []" "pthread_barrier_destroy","pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","int","FAR pthread_barrier_t*" "pthread_barrier_init","pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","int","FAR pthread_barrier_t*","FAR const pthread_barrierattr_t*","unsigned int" "pthread_barrier_wait","pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","int","FAR pthread_barrier_t*" From 55b9700d59bb38db9427258b5dd2e1020a6fef67 Mon Sep 17 00:00:00 2001 From: patacongo Date: Fri, 18 Jan 2013 13:34:09 +0000 Subject: [PATCH 086/118] STM32 I2C changes from Mike Smith git-svn-id: http://svn.code.sf.net/p/nuttx/code/trunk@5532 42af7a65-404d-4744-a932-0658087f49c3 --- nuttx/arch/arm/src/stm32/stm32_i2c.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/nuttx/arch/arm/src/stm32/stm32_i2c.c b/nuttx/arch/arm/src/stm32/stm32_i2c.c index c44a823dbb..18687c6f40 100644 --- a/nuttx/arch/arm/src/stm32/stm32_i2c.c +++ b/nuttx/arch/arm/src/stm32/stm32_i2c.c @@ -1245,11 +1245,11 @@ static int stm32_i2c_isr(struct stm32_i2c_priv_s *priv) /* Disable acknowledge when last byte is to be received */ + priv->dcnt--; if (priv->dcnt == 1) { stm32_i2c_modifyreg(priv, STM32_I2C_CR1_OFFSET, I2C_CR1_ACK, 0); } - priv->dcnt--; #ifdef CONFIG_I2C_POLLED irqrestore(state); @@ -1985,7 +1985,6 @@ int up_i2creset(FAR struct i2c_dev_s * dev) unit32_ scl_gpio; unit32_ sda_gpio; int ret = ERROR; - irqstate_t state; ASSERT(dev); @@ -2010,6 +2009,10 @@ int up_i2creset(FAR struct i2c_dev_s * dev) scl_gpio = MKI2C_OUTPUT(priv->config->scl_pin); sda_gpio = MKI2C_OUTPUT(priv->config->sda_pin); + /* Let SDA go high */ + + stm32_gpiowrite(sda_gpio, 1); + /* Clock the bus until any slaves currently driving it let it go. */ clock_count = 0; @@ -2017,7 +2020,7 @@ int up_i2creset(FAR struct i2c_dev_s * dev) { /* Give up if we have tried too hard */ - if (clock_count++ > 1000) + if (clock_count++ > 10) { goto out; } @@ -2032,7 +2035,7 @@ int up_i2creset(FAR struct i2c_dev_s * dev) { /* Give up if we have tried too hard */ - if (stretch_count++ > 1000) + if (stretch_count++ > 10) { goto out; } From 3ff155d04803d8b19f0f56602e95b4034bc33820 Mon Sep 17 00:00:00 2001 From: patacongo Date: Fri, 18 Jan 2013 16:37:37 +0000 Subject: [PATCH 087/118] Beginnings of definitions for the LPC1788; convert olimex-lpc1766stk to use kconfig-frontends git-svn-id: http://svn.code.sf.net/p/nuttx/code/trunk@5533 42af7a65-404d-4744-a932-0658087f49c3 --- apps/nshlib/nsh_netcmds.c | 5 +- nuttx/ChangeLog | 5 + nuttx/arch/arm/include/lpc17xx/chip.h | 377 ++++++ nuttx/arch/arm/include/lpc17xx/irq.h | 203 +-- nuttx/arch/arm/include/lpc17xx/lpc176x_irq.h | 245 ++++ nuttx/arch/arm/include/lpc17xx/lpc178x_irq.h | 294 +++++ nuttx/arch/arm/src/lpc17xx/Kconfig | 56 +- nuttx/arch/arm/src/lpc17xx/chip.h | 158 +-- nuttx/arch/arm/src/lpc17xx/lpc17_ssp.c | 3 +- nuttx/configs/olimex-lpc1766stk/README.txt | 65 +- nuttx/configs/olimex-lpc1766stk/nsh/appconfig | 66 - nuttx/configs/olimex-lpc1766stk/nsh/defconfig | 1115 ++++++++++------- nuttx/drivers/mmcsd/Kconfig | 2 +- nuttx/sched/Makefile | 166 +-- nuttx/sched/os_internal.h | 2 +- nuttx/sched/task_posixspawn.c | 3 +- nuttx/sched/task_reparent.c | 89 +- 17 files changed, 1821 insertions(+), 1033 deletions(-) create mode 100644 nuttx/arch/arm/include/lpc17xx/chip.h create mode 100644 nuttx/arch/arm/include/lpc17xx/lpc176x_irq.h create mode 100644 nuttx/arch/arm/include/lpc17xx/lpc178x_irq.h delete mode 100644 nuttx/configs/olimex-lpc1766stk/nsh/appconfig diff --git a/apps/nshlib/nsh_netcmds.c b/apps/nshlib/nsh_netcmds.c index 506950e14f..473045c408 100644 --- a/apps/nshlib/nsh_netcmds.c +++ b/apps/nshlib/nsh_netcmds.c @@ -53,12 +53,13 @@ #include #include +#include +#include + #include #include -#include #include #include -#include #ifdef CONFIG_NET_STATISTICS # include diff --git a/nuttx/ChangeLog b/nuttx/ChangeLog index 2a1561abe4..c61479cadb 100644 --- a/nuttx/ChangeLog +++ b/nuttx/ChangeLog @@ -3977,3 +3977,8 @@ sched/task_posixspawn() now it requires internal, reparenting interfaces * include/nuttx/spawn(): Move libc/spawn.h to include/nuttx/spawn.h + * arch/arm/include/lpc17xx/chip.h, irq178x.h: Integrate Marcelo + Rommel's LPC1788 definitions into the base LPC17xx. + * configs/olimex-lpc1766stk/nsh: Convert configuration to use + the kconfig-frontends tools. + * sched/task_reparent.c: Simplify reparenting interface. diff --git a/nuttx/arch/arm/include/lpc17xx/chip.h b/nuttx/arch/arm/include/lpc17xx/chip.h new file mode 100644 index 0000000000..d2c436d357 --- /dev/null +++ b/nuttx/arch/arm/include/lpc17xx/chip.h @@ -0,0 +1,377 @@ +/************************************************************************************ + * arch/arm/include/lpc17xx/chip.h + * + * Copyright (C) 2010-2011 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * with LPC178x support from Rommel Marcelo + * + * 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. + * + ************************************************************************************/ + +#ifndef __ARCH_ARM_INCLUDE_LPC17XX_CHIP_H +#define __ARCH_ARM_INCLUDE_LPC17XX_CHIP_H + +/************************************************************************************ + * Included Files + ************************************************************************************/ + +#include + +/************************************************************************************ + * Pre-processor Definitions + ************************************************************************************/ + +/* Get customizations for each supported chip */ + +#if defined(CONFIG_ARCH_CHIP_LPC1751) +# define LPC176x 1 /* LPC175/6 family */ +# undef LPC178x /* Not LPC177/8 family */ +# define LPC17_FLASH_SIZE (32*1024) /* 32Kb */ +# define LPC17_SRAM_SIZE (8*1024) /* 8Kb */ +# define LPC17_CPUSRAM_SIZE (8*1024) +# undef LPC17_HAVE_BANK0 /* No AHB SRAM bank 0 */ +# undef LPC17_HAVE_BANK1 /* No AHB SRAM bank 1 */ +# define LPC17_NETHCONTROLLERS 0 /* No Ethernet controller */ +# define LPC17_NUSBHOST 0 /* No USB host controller */ +# define LPC17_NUSBOTG 0 /* No USB OTG controller */ +# define LPC17_NUSBDEV 1 /* One USB device controller */ +# define LPC17_NCAN 1 /* One CAN controller */ +# define LPC17_NI2S 0 /* No I2S modules */ +# define LPC17_NDAC 0 /* No DAC module */ +#elif defined(CONFIG_ARCH_CHIP_LPC1752) +# define LPC176x 1 /* LPC175/6 family */ +# undef LPC178x /* Not LPC177/8 family */ +# define LPC17_FLASH_SIZE (64*1024) /* 65Kb */ +# define LPC17_SRAM_SIZE (16*1024) /* 16Kb */ +# define LPC17_CPUSRAM_SIZE (16*1024) +# undef LPC17_HAVE_BANK0 /* No AHB SRAM bank 0 */ +# undef LPC17_HAVE_BANK1 /* No AHB SRAM bank 1 */ +# define LPC17_NETHCONTROLLERS 0 /* No Ethernet controller */ +# define LPC17_NUSBHOST 0 /* No USB host controller */ +# define LPC17_NUSBOTG 0 /* No USB OTG controller */ +# define LPC17_NUSBDEV 1 /* One USB device controller */ +# define LPC17_NCAN 1 /* One CAN controller */ +# define LPC17_NI2S 0 /* No I2S modules */ +# define LPC17_NDAC 0 /* No DAC module */ +#elif defined(CONFIG_ARCH_CHIP_LPC1754) +# define LPC176x 1 /* LPC175/6 family */ +# undef LPC178x /* Not LPC177/8 family */ +# define LPC17_FLASH_SIZE (128*1024) /* 128Kb */ +# define LPC17_SRAM_SIZE (32*1024) /* 32Kb */ +# define LPC17_CPUSRAM_SIZE (16*1024) +# define LPC17_HAVE_BANK0 1 /* Have AHB SRAM bank 0 */ +# undef LPC17_HAVE_BANK1 /* No AHB SRAM bank 1 */ +# define LPC17_NETHCONTROLLERS 0 /* No Ethernet controller */ +# define LPC17_NUSBHOST 1 /* One USB host controller */ +# define LPC17_NUSBOTG 1 /* One USB OTG controller */ +# define LPC17_NUSBDEV 1 /* One USB device controller */ +# define LPC17_NCAN 1 /* One CAN controller */ +# define LPC17_NI2S 0 /* No I2S modules */ +# define LPC17_NDAC 1 /* One DAC module */ +#elif defined(CONFIG_ARCH_CHIP_LPC1756) +# define LPC176x 1 /* LPC175/6 family */ +# undef LPC178x /* Not LPC177/8 family */ +# define LPC17_FLASH_SIZE (256*1024) /* 256Kb */ +# define LPC17_SRAM_SIZE (32*1024) /* 32Kb */ +# define LPC17_CPUSRAM_SIZE (16*1024) +# define LPC17_HAVE_BANK0 1 /* No AHB SRAM bank 0 */ +# undef LPC17_HAVE_BANK1 /* No AHB SRAM bank 1 */ +# define LPC17_NETHCONTROLLERS 0 /* No Ethernet controller */ +# define LPC17_NUSBHOST 1 /* One USB host controller */ +# define LPC17_NUSBOTG 1 /* One USB OTG controller */ +# define LPC17_NUSBDEV 1 /* One USB device controller */ +# define LPC17_NCAN 2 /* Two CAN controllers */ +# define LPC17_NI2S 1 /* One I2S module */ +# define LPC17_NDAC 1 /* One DAC module */ +#elif defined(CONFIG_ARCH_CHIP_LPC1758) +# define LPC176x 1 /* LPC175/6 family */ +# undef LPC178x /* Not LPC177/8 family */ +# define LPC17_FLASH_SIZE (512*1024) /* 512Kb */ +# define LPC17_SRAM_SIZE (64*1024) /* 64Kb */ +# define LPC17_CPUSRAM_SIZE (32*1024) +# define LPC17_HAVE_BANK0 1 /* Have AHB SRAM bank 0 */ +# define LPC17_HAVE_BANK1 1 /* Have AHB SRAM bank 1 */ +# define LPC17_NETHCONTROLLERS 1 /* One Ethernet controller */ +# define LPC17_NUSBHOST 1 /* One USB host controller */ +# define LPC17_NUSBOTG 1 /* One USB OTG controller */ +# define LPC17_NUSBDEV 1 /* One USB device controller */ +# define LPC17_NCAN 2 /* Two CAN controllers */ +# define LPC17_NI2S 1 /* One I2S module */ +# define LPC17_NDAC 1 /* One DAC module */ +#elif defined(CONFIG_ARCH_CHIP_LPC1759) +# define LPC176x 1 /* LPC175/6 family */ +# undef LPC178x /* Not LPC177/8 family */ +# define LPC17_FLASH_SIZE (512*1024) /* 512Kb */ +# define LPC17_SRAM_SIZE (64*1024) /* 64Kb */ +# define LPC17_CPUSRAM_SIZE (32*1024) +# define LPC17_HAVE_BANK0 1 /* Have AHB SRAM bank 0 */ +# define LPC17_HAVE_BANK1 1 /* Have AHB SRAM bank 1 */ +# define LPC17_NETHCONTROLLERS 0 /* No Ethernet controller */ +# define LPC17_NUSBHOST 1 /* One USB host controller */ +# define LPC17_NUSBOTG 1 /* One USB OTG controller */ +# define LPC17_NUSBDEV 1 /* One USB device controller */ +# define LPC17_NCAN 2 /* Two CAN controllers */ +# define LPC17_NI2S 1 /* One I2S module */ +# define LPC17_NDAC 1 /* One DAC module */ +#elif defined(CONFIG_ARCH_CHIP_LPC1764) +# define LPC176x 1 /* LPC175/6 family */ +# undef LPC178x /* Not LPC177/8 family */ +# define LPC17_FLASH_SIZE (128*1024) /* 128Kb */ +# define LPC17_SRAM_SIZE (32*1024) /* 32Kb */ +# define LPC17_CPUSRAM_SIZE (16*1024) +# define LPC17_HAVE_BANK0 1 /* Have AHB SRAM bank 0 */ +# undef LPC17_HAVE_BANK1 /* No AHB SRAM bank 1 */ +# define LPC17_NETHCONTROLLERS 1 /* One Ethernet controller */ +# define LPC17_NUSBHOST 0 /* No USB host controller */ +# define LPC17_NUSBOTG 0 /* No USB OTG controller */ +# define LPC17_NUSBDEV 1 /* One USB device controller */ +# define LPC17_NCAN 2 /* Two CAN controllers */ +# define LPC17_NI2S 0 /* No I2S modules */ +# define LPC17_NDAC 0 /* No DAC module */ +#elif defined(CONFIG_ARCH_CHIP_LPC1765) +# define LPC176x 1 /* LPC175/6 family */ +# undef LPC178x /* Not LPC177/8 family */ +# define LPC17_FLASH_SIZE (256*1024) /* 256Kb */ +# define LPC17_SRAM_SIZE (64*1024) /* 64Kb */ +# define LPC17_CPUSRAM_SIZE (32*1024) +# define LPC17_HAVE_BANK0 1 /* Have AHB SRAM bank 0 */ +# define LPC17_HAVE_BANK1 1 /* Have AHB SRAM bank 1 */ +# define LPC17_NETHCONTROLLERS 0 /* No Ethernet controller */ +# define LPC17_NUSBHOST 1 /* One USB host controller */ +# define LPC17_NUSBOTG 1 /* One USB OTG controller */ +# define LPC17_NUSBDEV 1 /* One USB device controller */ +# define LPC17_NCAN 2 /* Two CAN controllers */ +# define LPC17_NI2S 1 /* One I2S module */ +# define LPC17_NDAC 1 /* One DAC module */ +#elif defined(CONFIG_ARCH_CHIP_LPC1766) +# define LPC176x 1 /* LPC175/6 family */ +# undef LPC178x /* Not LPC177/8 family */ +# define LPC17_FLASH_SIZE (256*1024) /* 256Kb */ +# define LPC17_SRAM_SIZE (64*1024) /* 64Kb */ +# define LPC17_CPUSRAM_SIZE (32*1024) +# define LPC17_HAVE_BANK0 1 /* Have AHB SRAM bank 0 */ +# define LPC17_HAVE_BANK1 1 /* Have AHB SRAM bank 1 */ +# define LPC17_NETHCONTROLLERS 1 /* One Ethernet controller */ +# define LPC17_NUSBHOST 1 /* One USB host controller */ +# define LPC17_NUSBOTG 1 /* One USB OTG controller */ +# define LPC17_NUSBDEV 1 /* One USB device controller */ +# define LPC17_NCAN 2 /* Two CAN controllers */ +# define LPC17_NI2S 1 /* One I2S module */ +# define LPC17_NDAC 1 /* One DAC module */ +#elif defined(CONFIG_ARCH_CHIP_LPC1767) +# define LPC176x 1 /* LPC175/6 family */ +# undef LPC178x /* Not LPC177/8 family */ +# define LPC17_FLASH_SIZE (512*1024) /* 512Kb */ +# define LPC17_SRAM_SIZE (64*1024) /* 64Kb */ +# define LPC17_CPUSRAM_SIZE (32*1024) +# define LPC17_HAVE_BANK0 1 /* Have AHB SRAM bank 0 */ +# define LPC17_HAVE_BANK1 1 /* Have AHB SRAM bank 1 */ +# define LPC17_NETHCONTROLLERS 1 /* One Ethernet controller */ +# define LPC17_NUSBHOST 0 /* No USB host controller */ +# define LPC17_NUSBOTG 0 /* No USB OTG controller */ +# define LPC17_NUSBDEV 0 /* No USB device controller */ +# define LPC17_NCAN 0 /* No CAN controllers */ +# define LPC17_NI2S 1 /* One I2S module */ +# define LPC17_NDAC 1 /* One DAC module */ +#elif defined(CONFIG_ARCH_CHIP_LPC1769) || defined(CONFIG_ARCH_CHIP_LPC1768) +# define LPC176x 1 /* LPC175/6 family */ +# undef LPC178x /* Not LPC177/8 family */ +# define LPC17_FLASH_SIZE (512*1024) /* 512Kb */ +# define LPC17_SRAM_SIZE (64*1024) /* 64Kb */ +# define LPC17_CPUSRAM_SIZE (32*1024) +# define LPC17_HAVE_BANK0 1 /* Have AHB SRAM bank 0 */ +# define LPC17_HAVE_BANK1 1 /* Have AHB SRAM bank 1 */ +# define LPC17_NETHCONTROLLERS 1 /* One Ethernet controller */ +# define LPC17_NUSBHOST 1 /* One USB host controller */ +# define LPC17_NUSBOTG 1 /* One USB OTG controller */ +# define LPC17_NUSBDEV 1 /* One USB device controller */ +# define LPC17_NCAN 2 /* Two CAN controllers */ +# define LPC17_NI2S 1 /* One I2S module */ +# define LPC17_NDAC 1 /* One DAC module */ +#elif defined(CONFIG_ARCH_CHIP_LPC1773) +# undef LPC176x /* Not LPC175/6 family */ +# define LPC178x 1 /* LPC177/8 family */ +# define LPC17_FLASH_SIZE (128*1024) /* 128Kb */ +# define LPC17_SRAM_SIZE (32*1024) /* 32Kb */ +# define LPC17_CPUSRAM_SIZE (8*1024) +# define LPC17_HAVE_BANK0 1 /* Have Peripheral SRAM bank 0 */ +# undef LPC17_HAVE_BANK1 /* No Peripheral SRAM bank 1 */ +# define LPC17_NETHCONTROLLERS 1 /* One Ethernet controller */ +# undef LPC17_NUSBHOST /* No USB host controller */ +# undef LPC17_NUSBOTG /* No USB OTG controller */ +# define LPC17_NUSBDEV 1 /* One USB device controller */ +# define LPC17_HAVE_SPIFI 1 /* Have SPIFI interface */ +# undef LPC17_HAVE_LCD /* No LCD controller */ +# undef LPC17_HAVE_QEI /* No QEI interface */ +# undef LPC17_HAVE_SD /* No SD controller */ +#elif defined(CONFIG_ARCH_CHIP_LPC1774) +# undef LPC176x /* Not LPC175/6 family */ +# define LPC178x 1 /* LPC177/8 family */ +# define LPC17_FLASH_SIZE (128*1024) /* 128Kb */ +# define LPC17_SRAM_SIZE (32*1024) /* 32Kb */ +# define LPC17_CPUSRAM_SIZE (8*1024) +# define LPC17_HAVE_BANK0 1 /* Have Peripheral SRAM bank 0*/ +# undef LPC17_HAVE_BANK1 /* Have Peripheral SRAM bank 1 */ +# define LPC17_NETHCONTROLLERS 1 /* One Ethernet controller */ +# undef LPC17_NUSBHOST /* One USB host controller */ +# undef LPC17_NUSBOTG /* One USB OTG controller */ +# define LPC17_NUSBDEV 1 /* One USB device controller */ +# undef LPC17_HAVE_SPIFI /* Have SPIFI interface */ +# undef LPC17_HAVE_LCD /* One LCD controller */ +# define LPC17_HAVE_QEI 1 /* One QEI interface */ +# define LPC17_HAVE_SD 1 /* One SD controller */ +#elif defined(CONFIG_ARCH_CHIP_LPC1776) +# undef LPC176x /* Not LPC175/6 family */ +# define LPC178x 1 /* LPC177/8 family */ +# define LPC17_FLASH_SIZE (256*1024) /* 256Kb */ +# define LPC17_SRAM_SIZE (64*1024) /* 64Kb */ +# define LPC17_CPUSRAM_SIZE (16*1024) +# define LPC17_HAVE_BANK0 1 /* Have Peripheral SRAM bank 0 */ +# undef LPC17_HAVE_BANK1 /* Have Peripheral SRAM bank 1 */ +# define LPC17_NETHCONTROLLERS 1 /* One Ethernet controller */ +# define LPC17_NUSBHOST 1 /* One USB host controller */ +# define LPC17_NUSBOTG 1 /* One USB OTG controller */ +# define LPC17_NUSBDEV 1 /* One USB device controller */ +# undef LPC17_HAVE_SPIFI /* Have SPIFI interface */ +# undef LPC17_HAVE_LCD /* One LCD controller */ +# define LPC17_HAVE_QEI 1 /* One QEI interface */ +# define LPC17_HAVE_SD 1 /* One SD controller */ +#elif defined(CONFIG_ARCH_CHIP_LPC1777) +# undef LPC176x /* Not LPC175/6 family */ +# define LPC178x 1 /* LPC177/8 family */ +# define LPC17_FLASH_SIZE (512*1024) /* 512Kb */ +# define LPC17_SRAM_SIZE (64*1024) /* 64Kb */ +# define LPC17_CPUSRAM_SIZE (32*1024) +# define LPC17_HAVE_BANK0 1 /* Have Peripheral SRAM bank 0 */ +# define LPC17_HAVE_BANK1 1 /* Have Peripheral SRAM bank 1 */ +# undef LPC17_NETHCONTROLLERS /* One Ethernet controller */ +# define LPC17_NUSBHOST 1 /* One USB host controller */ +# define LPC17_NUSBOTG 1 /* One USB OTG controller */ +# define LPC17_NUSBDEV 1 /* One USB device controller */ +# undef LPC17_HAVE_SPIFI /* Have SPIFI interface */ +# undef LPC17_HAVE_LCD /* One LCD controller */ +# define LPC17_HAVE_QEI 1 /* One QEI interface */ +# define LPC17_HAVE_SD 1 /* One SD controller */ +#elif defined(CONFIG_ARCH_CHIP_LPC1778) +# undef LPC176x /* Not LPC175/6 family */ +# define LPC178x 1 /* LPC177/8 family */ +# define LPC17_FLASH_SIZE (512*1024) /* 512Kb */ +# define LPC17_SRAM_SIZE (64*1024) /* 64Kb */ +# define LPC17_CPUSRAM_SIZE (32*1024) +# define LPC17_HAVE_BANK0 1 /* Have Peripheral SRAM bank 0 */ +# define LPC17_HAVE_BANK1 1 /* Have Peripheral SRAM bank 1 */ +# define LPC17_NETHCONTROLLERS 1 /* One Ethernet controller */ +# define LPC17_NUSBHOST 1 /* One USB host controller */ +# define LPC17_NUSBOTG 1 /* One USB OTG controller */ +# define LPC17_NUSBDEV 1 /* One USB device controller */ +# undef LPC17_HAVE_SPIFI /* Have SPIFI interface */ +# undef LPC17_HAVE_LCD /* One LCD controller */ +# define LPC17_HAVE_QEI 1 /* One QEI interface */ +# define LPC17_HAVE_SD 1 /* One SD controller */ +#elif defined(CONFIG_ARCH_CHIP_LPC1785) +# undef LPC176x /* Not LPC175/6 family */ +# define LPC178x 1 /* LPC177/8 family */ +# define LPC17_FLASH_SIZE (256*1024) /* 256Kb */ +# define LPC17_SRAM_SIZE (64*1024) /* 64Kb */ +# define LPC17_CPUSRAM_SIZE (16*1024) +# define LPC17_HAVE_BANK0 1 /* Have Peripheral SRAM bank 0 */ +# undef LPC17_HAVE_BANK1 /* Have Peripheral SRAM bank 1 */ +# undef LPC17_NETHCONTROLLERS /* One Ethernet controller */ +# define LPC17_NUSBHOST 1 /* One USB host controller */ +# define LPC17_NUSBOTG 1 /* One USB OTG controller */ +# define LPC17_NUSBDEV 1 /* One USB device controller */ +# undef LPC17_HAVE_SPIFI /* Have SPIFI interface */ +# define LPC17_HAVE_LCD 1 /* One LCD controller */ +# undef LPC17_HAVE_QEI /* One QEI interface */ +# define LPC17_HAVE_SD 1 /* One SD controller */ +#elif defined(CONFIG_ARCH_CHIP_LPC1786) +# undef LPC176x /* Not LPC175/6 family */ +# define LPC178x 1 /* LPC177/8 family */ +# define LPC17_FLASH_SIZE (256*1024) /* 256Kb */ +# define LPC17_SRAM_SIZE (64*1024) /* 64Kb */ +# define LPC17_CPUSRAM_SIZE (16*1024) +# define LPC17_HAVE_BANK0 1 /* Have Peripheral SRAM bank 0 */ +# undef LPC17_HAVE_BANK1 /* Have Peripheral SRAM bank 1 */ +# define LPC17_NETHCONTROLLERS 1 /* One Ethernet controller */ +# define LPC17_NUSBHOST 1 /* One USB host controller */ +# define LPC17_NUSBOTG 1 /* One USB OTG controller */ +# define LPC17_NUSBDEV 1 /* One USB device controller */ +# undef LPC17_HAVE_SPIFI /* Have SPIFI interface */ +# define LPC17_HAVE_LCD 1 /* One LCD controller */ +# define LPC17_HAVE_QEI 1 /* One QEI interface */ +# define LPC17_HAVE_SD 1 /* One SD controller */ +#elif defined(CONFIG_ARCH_CHIP_LPC1787) +# undef LPC176x /* Not LPC175/6 family */ +# define LPC178x 1 /* LPC177/8 family */ +# define LPC17_FLASH_SIZE (512*1024) /* 512Kb */ +# define LPC17_SRAM_SIZE (64*1024) /* 64Kb */ +# define LPC17_CPUSRAM_SIZE (32*1024) +# define LPC17_HAVE_BANK0 1 /* Have Peripheral SRAM bank 0 */ +# define LPC17_HAVE_BANK1 1 /* Have Peripheral SRAM bank 1 */ +# undef LPC17_NETHCONTROLLERS /* One Ethernet controller */ +# define LPC17_NUSBHOST 1 /* One USB host controller */ +# define LPC17_NUSBOTG 1 /* One USB OTG controller */ +# define LPC17_NUSBDEV 1 /* One USB device controller */ +# undef LPC17_HAVE_SPIFI /* Have SPIFI interface */ +# define LPC17_HAVE_LCD 1 /* One LCD controller */ +# define LPC17_HAVE_QEI 1 /* One QEI interface */ +# define LPC17_HAVE_SD 1 /* One SD controller */ +#elif defined(CONFIG_ARCH_CHIP_LPC1788) +# undef LPC176x /* Not LPC175/6 family */ +# define LPC178x 1 /* LPC177/8 family */ +# define LPC17_FLASH_SIZE (512*1024) /* 512Kb */ +# define LPC17_SRAM_SIZE (64*1024) /* 64Kb */ +# define LPC17_CPUSRAM_SIZE (32*1024) +# define LPC17_HAVE_BANK0 1 /* Have Peripheral SRAM bank 0 */ +# define LPC17_HAVE_BANK1 1 /* Have Peripheral SRAM bank 1 */ +# define LPC17_NETHCONTROLLERS 1 /* One Ethernet controller */ +# define LPC17_NUSBHOST 1 /* One USB host controller */ +# define LPC17_NUSBOTG 1 /* One USB OTG controller */ +# define LPC17_NUSBDEV 1 /* One USB device controller */ +# undef LPC17_HAVE_SPIFI /* Have SPIFI interface */ +# define LPC17_HAVE_LCD 1 /* One LCD controller */ +# define LPC17_HAVE_QEI 1 /* One QEI interface */ +# define LPC17_HAVE_SD 1 /* One SD controller */ +#else +# error "Unsupported LPC17xx chip" +#endif + +/************************************************************************************ + * Public Types + ************************************************************************************/ + +/************************************************************************************ + * Public Data + ************************************************************************************/ + +/************************************************************************************ + * Public Functions + ************************************************************************************/ + +#endif /* __ARCH_ARM_INCLUDE_LPC17XX_CHIP_H */ diff --git a/nuttx/arch/arm/include/lpc17xx/irq.h b/nuttx/arch/arm/include/lpc17xx/irq.h index a7eebb32c2..c058f63674 100644 --- a/nuttx/arch/arm/include/lpc17xx/irq.h +++ b/nuttx/arch/arm/include/lpc17xx/irq.h @@ -1,7 +1,7 @@ /**************************************************************************** - * arch/lpc17xxx/irq.h + * arch/arm/include/lpc17xxx/irq.h * - * Copyright (C) 2010-2011 Gregory Nutt. All rights reserved. + * Copyright (C) 2010-2011, 2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -33,12 +33,12 @@ * ****************************************************************************/ -/* This file should never be included directed but, rather, - * only indirectly through nuttx/irq.h +/* This file should never be included directed but, rather, only indirectly + * through nuttx/irq.h */ -#ifndef __ARCH_LPC17XX_IRQ_H -#define __ARCH_LPC17XX_IRQ_H +#ifndef __ARCH_ARM_INCLUDE_LPC17XX_IRQ_H +#define __ARCH_ARM_INCLUDE_LPC17XX_IRQ_H /**************************************************************************** * Included Files @@ -47,17 +47,17 @@ #ifndef __ASSEMBLY__ # include #endif +#include /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ - /* IRQ numbers. The IRQ number corresponds vector number and hence map * directly to bits in the NVIC. This does, however, waste several words of * memory in the IRQ to handle mapping tables. */ -/* Processor Exceptions (vectors 0-15) */ +/* Common Processor Exceptions (vectors 0-15) */ #define LPC17_IRQ_RESERVED (0) /* Reserved vector (only used with CONFIG_DEBUG) */ /* Vector 0: Reset stack pointer value */ @@ -75,185 +75,24 @@ /* External interrupts (vectors >= 16) */ -#define LPC17_IRQ_EXTINT (16) /* Vector number of the first external interrupt */ -#define LPC17_IRQ_WDT (LPC17_IRQ_EXTINT+0) /* WDT Watchdog Interrupt (WDINT) */ -#define LPC17_IRQ_TMR0 (LPC17_IRQ_EXTINT+1) /* Timer 0 Match 0 - 1 (MR0, MR1) - * Capture 0 - 1 (CR0, CR1) */ -#define LPC17_IRQ_TMR1 (LPC17_IRQ_EXTINT+2) /* Timer 1 Match 0 - 2 (MR0, MR1, MR2) - * Capture 0 - 1 (CR0, CR1) */ -#define LPC17_IRQ_TMR2 (LPC17_IRQ_EXTINT+3) /* Timer 2 Match 0-3 - * Capture 0-1 */ -#define LPC17_IRQ_TMR3 (LPC17_IRQ_EXTINT+4) /* Timer 3 Match 0-3 - * Capture 0-1 */ -#define LPC17_IRQ_UART0 (LPC17_IRQ_EXTINT+5) /* UART 0 Rx Line Status (RLS) - * Transmit Holding Register Empty (THRE) - * Rx Data Available (RDA) - * Character Time-out Indicator (CTI) - * End of Auto-Baud (ABEO) - * Auto-Baud Time-Out (ABTO) */ -#define LPC17_IRQ_UART1 (LPC17_IRQ_EXTINT+6) /* UART 1 Rx Line Status (RLS) - * Transmit Holding Register Empty (THRE) - * Rx Data Available (RDA) - * Character Time-out Indicator (CTI) - * Modem Control Change - * End of Auto-Baud (ABEO) - * Auto-Baud Time-Out (ABTO) */ -#define LPC17_IRQ_UART2 (LPC17_IRQ_EXTINT+7) /* UART 2 Rx Line Status (RLS) - * Transmit Holding Register Empty (THRE) - * Rx Data Available (RDA) - * Character Time-out Indicator (CTI) - * End of Auto-Baud (ABEO) - * Auto-Baud Time-Out (ABTO) */ -#define LPC17_IRQ_UART3 (LPC17_IRQ_EXTINT+8) /* UART 3 Rx Line Status (RLS) - * Transmit Holding Register Empty (THRE) - * Rx Data Available (RDA) - * Character Time-out Indicator (CTI) - * End of Auto-Baud (ABEO) - * Auto-Baud Time-Out (ABTO) */ -#define LPC17_IRQ_PWM1 (LPC17_IRQ_EXTINT+9) /* PWM1 Match 0 - 6 of PWM1 - * Capture 0-1 of PWM1 */ -#define LPC17_IRQ_I2C0 (LPC17_IRQ_EXTINT+10) /* I2C0 SI (state change) */ -#define LPC17_IRQ_I2C1 (LPC17_IRQ_EXTINT+11) /* I2C1 SI (state change) */ -#define LPC17_IRQ_I2C2 (LPC17_IRQ_EXTINT+12) /* I2C2 SI (state change) */ -#define LPC17_IRQ_SPIF (LPC17_IRQ_EXTINT+13) /* SPI SPI Interrupt Flag (SPIF) - * Mode Fault (MODF) */ -#define LPC17_IRQ_SSP0 (LPC17_IRQ_EXTINT+14) /* SSP0 Tx FIFO half empty of SSP0 - * Rx FIFO half full of SSP0 - * Rx Timeout of SSP0 - * Rx Overrun of SSP0 */ -#define LPC17_IRQ_SSP1 (LPC17_IRQ_EXTINT+15) /* SSP 1 Tx FIFO half empty - * Rx FIFO half full - * Rx Timeout - * Rx Overrun */ -#define LPC17_IRQ_PLL0 (LPC17_IRQ_EXTINT+16) /* PLL0 (Main PLL) PLL0 Lock (PLOCK0) */ -#define LPC17_IRQ_RTC (LPC17_IRQ_EXTINT+17) /* RTC Counter Increment (RTCCIF) - * Alarm (RTCALF) */ -#define LPC17_IRQ_EINT0 (LPC17_IRQ_EXTINT+18) /* External Interrupt 0 (EINT0) */ -#define LPC17_IRQ_EINT1 (LPC17_IRQ_EXTINT+19) /* External Interrupt 1 (EINT1) */ -#define LPC17_IRQ_EINT2 (LPC17_IRQ_EXTINT+20) /* External Interrupt 2 (EINT2) */ -#define LPC17_IRQ_EINT3 (LPC17_IRQ_EXTINT+21) /* External Interrupt 3 (EINT3) - * Note: EINT3 channel is shared with GPIO interrupts */ -#define LPC17_IRQ_ADC (LPC17_IRQ_EXTINT+22) /* ADC A/D Converter end of conversion */ -#define LPC17_IRQ_BOD (LPC17_IRQ_EXTINT+23) /* BOD Brown Out detect */ -#define LPC17_IRQ_USB (LPC17_IRQ_EXTINT+24) /* USB USB_INT_REQ_LP, USB_INT_REQ_HP, - * USB_INT_REQ_DMA */ -#define LPC17_IRQ_CAN (LPC17_IRQ_EXTINT+25) /* CAN CAN Common, CAN 0 Tx, CAN 0 Rx, - * CAN 1 Tx, CAN 1 Rx */ -#define LPC17_IRQ_GPDMA (LPC17_IRQ_EXTINT+26) /* GPDMA IntStatus of DMA channel 0, - * IntStatus of DMA channel 1 */ -#define LPC17_IRQ_I2S (LPC17_IRQ_EXTINT+27) /* I2S irq, dmareq1, dmareq2 */ -#define LPC17_IRQ_ETH (LPC17_IRQ_EXTINT+28) /* Ethernet WakeupInt, SoftInt, TxDoneInt, - * TxFinishedInt, TxErrorInt,* TxUnderrunInt, - * RxDoneInt, RxFinishedInt, RxErrorInt, - * RxOverrunInt */ -#define LPC17_IRQ_RITINT (LPC17_IRQ_EXTINT+29) /* Repetitive Interrupt Timer (RITINT) */ -#define LPC17_IRQ_MCPWM (LPC17_IRQ_EXTINT+30) /* Motor Control PWM IPER[2:0], IPW[2:0], - * ICAP[2:0], FES */ -#define LPC17_IRQ_QEI (LPC17_IRQ_EXTINT+31) /* Quadrature Encoder INX_Int, TIM_Int, VELC_Int, - * DIR_Int, ERR_Int, ENCLK_Int, POS0_Int, POS1_Int - * POS2_Int, REV_Int, POS0REV_Int, OS1REV_Int, - * POS2REV_Int */ -#define LPC17_IRQ_PLL1 (LPC17_IRQ_EXTINT+32) /* PLL1 (USB PLL) PLL1 Lock (PLOCK1) */ -#define LPC17_IRQ_USBACT (LPC17_IRQ_EXTINT+33) /* USB Activity Interrupt USB_NEED_CLK */ -#define LPC17_IRQ_CANACT (LPC17_IRQ_EXTINT+34) /* CAN Activity Interrupt CAN1WAKE, CAN2WAKE */ -#define LPC17_IRQ_NEXTINT (35) -#define LPC17_IRQ_NIRQS (LPC17_IRQ_EXTINT+LPC17_IRQ_NEXTINT) +#define LPC17_IRQ_EXTINT (16) /* Vector number of the first external interrupt */ -/* GPIO interrupts. The LPC17xx supports several interrupts on ports 0 and - * 2 (only). We go through some special efforts to keep the number of IRQs - * to a minimum in this sparse interrupt case. - * - * 28 interrupts on Port 0: p0.0 - p0.11, p0.15-p0.30 - * 14 interrupts on Port 2: p2.0 - p2.13 - * -- - * 42 - */ +/* Family Specfic Interrupts */ -#ifdef CONFIG_GPIO_IRQ -# define LPC17_VALID_GPIOINT0 (0x7fff8ffful) /* GPIO port 0 interrrupt set */ -# define LPC17_VALID_GPIOINT2 (0x00003ffful) /* GPIO port 2 interrupt set */ - - /* Set 1: 12 interrupts p0.0-p0.11 */ - -# define LPC17_VALID_GPIOINT0L (0x00000ffful) -# define LPC17_VALID_SHIFT0L (0) -# define LPC17_VALID_FIRST0L (LPC17_IRQ_EXTINT+LPC17_IRQ_NEXTINT) - -# define LPC17_IRQ_P0p0 (LPC17_VALID_FIRST0L+0) -# define LPC17_IRQ_P0p1 (LPC17_VALID_FIRST0L+1) -# define LPC17_IRQ_P0p2 (LPC17_VALID_FIRST0L+2) -# define LPC17_IRQ_P0p3 (LPC17_VALID_FIRST0L+3) -# define LPC17_IRQ_P0p4 (LPC17_VALID_FIRST0L+4) -# define LPC17_IRQ_P0p5 (LPC17_VALID_FIRST0L+5) -# define LPC17_IRQ_P0p6 (LPC17_VALID_FIRST0L+6) -# define LPC17_IRQ_P0p7 (LPC17_VALID_FIRST0L+7) -# define LPC17_IRQ_P0p8 (LPC17_VALID_FIRST0L+8) -# define LPC17_IRQ_P0p9 (LPC17_VALID_FIRST0L+9) -# define LPC17_IRQ_P0p10 (LPC17_VALID_FIRST0L+10) -# define LPC17_IRQ_P0p11 (LPC17_VALID_FIRST0L+11) -# define LPC17_VALID_NIRQS0L (12) - - /* Set 2: 16 interrupts p0.15-p0.30 */ - -# define LPC17_VALID_GPIOINT0H (0x7fff8000ull) -# define LPC17_VALID_SHIFT0H (15) -# define LPC17_VALID_FIRST0H (LPC17_VALID_FIRST0L+LPC17_VALID_NIRQS0L) - -# define LPC17_IRQ_P0p15 (LPC17_VALID_FIRST0H+0) -# define LPC17_IRQ_P0p16 (LPC17_VALID_FIRST0H+1) -# define LPC17_IRQ_P0p17 (LPC17_VALID_FIRST0H+2) -# define LPC17_IRQ_P0p18 (LPC17_VALID_FIRST0H+3) -# define LPC17_IRQ_P0p19 (LPC17_VALID_FIRST0H+4) -# define LPC17_IRQ_P0p20 (LPC17_VALID_FIRST0H+5) -# define LPC17_IRQ_P0p21 (LPC17_VALID_FIRST0H+6) -# define LPC17_IRQ_P0p22 (LPC17_VALID_FIRST0H+7) -# define LPC17_IRQ_P0p23 (LPC17_VALID_FIRST0H+8) -# define LPC17_IRQ_P0p24 (LPC17_VALID_FIRST0H+9) -# define LPC17_IRQ_P0p25 (LPC17_VALID_FIRST0H+10) -# define LPC17_IRQ_P0p26 (LPC17_VALID_FIRST0H+11) -# define LPC17_IRQ_P0p27 (LPC17_VALID_FIRST0H+12) -# define LPC17_IRQ_P0p28 (LPC17_VALID_FIRST0H+13) -# define LPC17_IRQ_P0p29 (LPC17_VALID_FIRST0H+14) -# define LPC17_IRQ_P0p30 (LPC17_VALID_FIRST0H+15) -# define LPC17_VALID_NIRQS0H (16) - - /* Set 3: 14 interrupts p2.0-p2.13 */ - -# define LPC17_VALID_GPIOINT2 (0x00003ffful) -# define LPC17_VALID_SHIFT2 (0) -# define LPC17_VALID_FIRST2 (LPC17_VALID_FIRST0H+LPC17_VALID_NIRQS0H) - -# define LPC17_IRQ_P2p0 (LPC17_VALID_FIRST2+0) -# define LPC17_IRQ_P2p1 (LPC17_VALID_FIRST2+1) -# define LPC17_IRQ_P2p2 (LPC17_VALID_FIRST2+2) -# define LPC17_IRQ_P2p3 (LPC17_VALID_FIRST2+3) -# define LPC17_IRQ_P2p4 (LPC17_VALID_FIRST2+4) -# define LPC17_IRQ_P2p5 (LPC17_VALID_FIRST2+5) -# define LPC17_IRQ_P2p6 (LPC17_VALID_FIRST2+6) -# define LPC17_IRQ_P2p7 (LPC17_VALID_FIRST2+7) -# define LPC17_IRQ_P2p8 (LPC17_VALID_FIRST2+8) -# define LPC17_IRQ_P2p9 (LPC17_VALID_FIRST2+9) -# define LPC17_IRQ_P2p10 (LPC17_VALID_FIRST2+10) -# define LPC17_IRQ_P2p11 (LPC17_VALID_FIRST2+11) -# define LPC17_IRQ_P2p12 (LPC17_VALID_FIRST2+12) -# define LPC17_IRQ_P2p13 (LPC17_VALID_FIRST2+13) -# define LPC17_VALID_NIRQS2 (14) -# define LPC17_NGPIOAIRQS (LPC17_VALID_NIRQS0L+LPC17_VALID_NIRQS0H+LPC17_VALID_NIRQS2) +#if defined(LPC176x) /* LPC175/6 family */ +# include +#elif defined(LPC178x) /* LPC177/8 family */ +# include #else -# define LPC17_NGPIOAIRQS (0) +# error "Unknown LPC17xx family" #endif -/* Total number of IRQ numbers */ - -#define NR_IRQS (LPC17_IRQ_EXTINT+LPC17_IRQ_NEXTINT+LPC17_NGPIOAIRQS) - /**************************************************************************** * Public Types ****************************************************************************/ #ifndef __ASSEMBLY__ typedef void (*vic_vector_t)(uint32_t *regs); -#endif /**************************************************************************** * Inline functions @@ -267,19 +106,15 @@ typedef void (*vic_vector_t)(uint32_t *regs); * Public Function Prototypes ****************************************************************************/ -#ifndef __ASSEMBLY__ #ifdef __cplusplus -#define EXTERN extern "C" -extern "C" { -#else -#define EXTERN extern +extern "C" +{ #endif -#undef EXTERN #ifdef __cplusplus } #endif -#endif +#endif __ASSEMBLY__ -#endif /* __ARCH_LPC17XX_IRQ_H */ +#endif /* __ARCH_ARM_INCLUDE_LPC17XX_IRQ_H */ diff --git a/nuttx/arch/arm/include/lpc17xx/lpc176x_irq.h b/nuttx/arch/arm/include/lpc17xx/lpc176x_irq.h new file mode 100644 index 0000000000..ac97195e69 --- /dev/null +++ b/nuttx/arch/arm/include/lpc17xx/lpc176x_irq.h @@ -0,0 +1,245 @@ +/**************************************************************************** + * arch/lpc17xx/lpc176x_irq.h + * + * Copyright (C) 2010-2011, 2013 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * 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. + * + ****************************************************************************/ + +/* This file should never be included directed but, rather, only indirectly + * through nuttx/irq.h + */ + +#ifndef __ARCH_ARM_INCLUDE_LPC17XX_LPC176X_IRQ_H +#define __ARCH_ARM_INCLUDE_LPC17XX_LPC176X_IRQ_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ +/* IRQ numbers. The IRQ number corresponds vector number and hence map + * directly to bits in the NVIC. This does, however, waste several words of + * memory in the IRQ to handle mapping tables. + */ + +/* External interrupts (vectors >= 16) */ + +#define LPC17_IRQ_WDT (LPC17_IRQ_EXTINT+0) /* WDT Watchdog Interrupt (WDINT) */ +#define LPC17_IRQ_TMR0 (LPC17_IRQ_EXTINT+1) /* Timer 0 Match 0 - 1 (MR0, MR1) + * Capture 0 - 1 (CR0, CR1) */ +#define LPC17_IRQ_TMR1 (LPC17_IRQ_EXTINT+2) /* Timer 1 Match 0 - 2 (MR0, MR1, MR2) + * Capture 0 - 1 (CR0, CR1) */ +#define LPC17_IRQ_TMR2 (LPC17_IRQ_EXTINT+3) /* Timer 2 Match 0-3 + * Capture 0-1 */ +#define LPC17_IRQ_TMR3 (LPC17_IRQ_EXTINT+4) /* Timer 3 Match 0-3 + * Capture 0-1 */ +#define LPC17_IRQ_UART0 (LPC17_IRQ_EXTINT+5) /* UART 0 Rx Line Status (RLS) + * Transmit Holding Register Empty (THRE) + * Rx Data Available (RDA) + * Character Time-out Indicator (CTI) + * End of Auto-Baud (ABEO) + * Auto-Baud Time-Out (ABTO) */ +#define LPC17_IRQ_UART1 (LPC17_IRQ_EXTINT+6) /* UART 1 Rx Line Status (RLS) + * Transmit Holding Register Empty (THRE) + * Rx Data Available (RDA) + * Character Time-out Indicator (CTI) + * Modem Control Change + * End of Auto-Baud (ABEO) + * Auto-Baud Time-Out (ABTO) */ +#define LPC17_IRQ_UART2 (LPC17_IRQ_EXTINT+7) /* UART 2 Rx Line Status (RLS) + * Transmit Holding Register Empty (THRE) + * Rx Data Available (RDA) + * Character Time-out Indicator (CTI) + * End of Auto-Baud (ABEO) + * Auto-Baud Time-Out (ABTO) */ +#define LPC17_IRQ_UART3 (LPC17_IRQ_EXTINT+8) /* UART 3 Rx Line Status (RLS) + * Transmit Holding Register Empty (THRE) + * Rx Data Available (RDA) + * Character Time-out Indicator (CTI) + * End of Auto-Baud (ABEO) + * Auto-Baud Time-Out (ABTO) */ +#define LPC17_IRQ_PWM1 (LPC17_IRQ_EXTINT+9) /* PWM1 Match 0 - 6 of PWM1 + * Capture 0-1 of PWM1 */ +#define LPC17_IRQ_I2C0 (LPC17_IRQ_EXTINT+10) /* I2C0 SI (state change) */ +#define LPC17_IRQ_I2C1 (LPC17_IRQ_EXTINT+11) /* I2C1 SI (state change) */ +#define LPC17_IRQ_I2C2 (LPC17_IRQ_EXTINT+12) /* I2C2 SI (state change) */ +#define LPC17_IRQ_SPIF (LPC17_IRQ_EXTINT+13) /* SPI SPI Interrupt Flag (SPIF) + * Mode Fault (MODF) */ +#define LPC17_IRQ_SSP0 (LPC17_IRQ_EXTINT+14) /* SSP0 Tx FIFO half empty of SSP0 + * Rx FIFO half full of SSP0 + * Rx Timeout of SSP0 + * Rx Overrun of SSP0 */ +#define LPC17_IRQ_SSP1 (LPC17_IRQ_EXTINT+15) /* SSP 1 Tx FIFO half empty + * Rx FIFO half full + * Rx Timeout + * Rx Overrun */ +#define LPC17_IRQ_PLL0 (LPC17_IRQ_EXTINT+16) /* PLL0 (Main PLL) PLL0 Lock (PLOCK0) */ +#define LPC17_IRQ_RTC (LPC17_IRQ_EXTINT+17) /* RTC Counter Increment (RTCCIF) + * Alarm (RTCALF) */ +#define LPC17_IRQ_EINT0 (LPC17_IRQ_EXTINT+18) /* External Interrupt 0 (EINT0) */ +#define LPC17_IRQ_EINT1 (LPC17_IRQ_EXTINT+19) /* External Interrupt 1 (EINT1) */ +#define LPC17_IRQ_EINT2 (LPC17_IRQ_EXTINT+20) /* External Interrupt 2 (EINT2) */ +#define LPC17_IRQ_EINT3 (LPC17_IRQ_EXTINT+21) /* External Interrupt 3 (EINT3) + * Note: EINT3 channel is shared with GPIO interrupts */ +#define LPC17_IRQ_ADC (LPC17_IRQ_EXTINT+22) /* ADC A/D Converter end of conversion */ +#define LPC17_IRQ_BOD (LPC17_IRQ_EXTINT+23) /* BOD Brown Out detect */ +#define LPC17_IRQ_USB (LPC17_IRQ_EXTINT+24) /* USB USB_INT_REQ_LP, USB_INT_REQ_HP, + * USB_INT_REQ_DMA */ +#define LPC17_IRQ_CAN (LPC17_IRQ_EXTINT+25) /* CAN CAN Common, CAN 0 Tx, CAN 0 Rx, + * CAN 1 Tx, CAN 1 Rx */ +#define LPC17_IRQ_GPDMA (LPC17_IRQ_EXTINT+26) /* GPDMA IntStatus of DMA channel 0, + * IntStatus of DMA channel 1 */ +#define LPC17_IRQ_I2S (LPC17_IRQ_EXTINT+27) /* I2S irq, dmareq1, dmareq2 */ +#define LPC17_IRQ_ETH (LPC17_IRQ_EXTINT+28) /* Ethernet WakeupInt, SoftInt, TxDoneInt, + * TxFinishedInt, TxErrorInt,* TxUnderrunInt, + * RxDoneInt, RxFinishedInt, RxErrorInt, + * RxOverrunInt */ +#define LPC17_IRQ_RITINT (LPC17_IRQ_EXTINT+29) /* Repetitive Interrupt Timer (RITINT) */ +#define LPC17_IRQ_MCPWM (LPC17_IRQ_EXTINT+30) /* Motor Control PWM IPER[2:0], IPW[2:0], + * ICAP[2:0], FES */ +#define LPC17_IRQ_QEI (LPC17_IRQ_EXTINT+31) /* Quadrature Encoder INX_Int, TIM_Int, VELC_Int, + * DIR_Int, ERR_Int, ENCLK_Int, POS0_Int, POS1_Int + * POS2_Int, REV_Int, POS0REV_Int, OS1REV_Int, + * POS2REV_Int */ +#define LPC17_IRQ_PLL1 (LPC17_IRQ_EXTINT+32) /* PLL1 (USB PLL) PLL1 Lock (PLOCK1) */ +#define LPC17_IRQ_USBACT (LPC17_IRQ_EXTINT+33) /* USB Activity Interrupt USB_NEED_CLK */ +#define LPC17_IRQ_CANACT (LPC17_IRQ_EXTINT+34) /* CAN Activity Interrupt CAN1WAKE, CAN2WAKE */ +#define LPC17_IRQ_NEXTINT (35) +#define LPC17_IRQ_NIRQS (LPC17_IRQ_EXTINT+LPC17_IRQ_NEXTINT) + +/* GPIO interrupts. The LPC17xx supports several interrupts on ports 0 and + * 2 (only). We go through some special efforts to keep the number of IRQs + * to a minimum in this sparse interrupt case. + * + * 28 interrupts on Port 0: p0.0 - p0.11, p0.15-p0.30 + * 14 interrupts on Port 2: p2.0 - p2.13 + * -- + * 42 + */ + +#ifdef CONFIG_GPIO_IRQ +# define LPC17_VALID_GPIOINT0 (0x7fff8ffful) /* GPIO port 0 interrrupt set */ +# define LPC17_VALID_GPIOINT2 (0x00003ffful) /* GPIO port 2 interrupt set */ + + /* Set 1: 12 interrupts p0.0-p0.11 */ + +# define LPC17_VALID_GPIOINT0L (0x00000ffful) +# define LPC17_VALID_SHIFT0L (0) +# define LPC17_VALID_FIRST0L (LPC17_IRQ_EXTINT+LPC17_IRQ_NEXTINT) + +# define LPC17_IRQ_P0p0 (LPC17_VALID_FIRST0L+0) +# define LPC17_IRQ_P0p1 (LPC17_VALID_FIRST0L+1) +# define LPC17_IRQ_P0p2 (LPC17_VALID_FIRST0L+2) +# define LPC17_IRQ_P0p3 (LPC17_VALID_FIRST0L+3) +# define LPC17_IRQ_P0p4 (LPC17_VALID_FIRST0L+4) +# define LPC17_IRQ_P0p5 (LPC17_VALID_FIRST0L+5) +# define LPC17_IRQ_P0p6 (LPC17_VALID_FIRST0L+6) +# define LPC17_IRQ_P0p7 (LPC17_VALID_FIRST0L+7) +# define LPC17_IRQ_P0p8 (LPC17_VALID_FIRST0L+8) +# define LPC17_IRQ_P0p9 (LPC17_VALID_FIRST0L+9) +# define LPC17_IRQ_P0p10 (LPC17_VALID_FIRST0L+10) +# define LPC17_IRQ_P0p11 (LPC17_VALID_FIRST0L+11) +# define LPC17_VALID_NIRQS0L (12) + + /* Set 2: 16 interrupts p0.15-p0.30 */ + +# define LPC17_VALID_GPIOINT0H (0x7fff8000ull) +# define LPC17_VALID_SHIFT0H (15) +# define LPC17_VALID_FIRST0H (LPC17_VALID_FIRST0L+LPC17_VALID_NIRQS0L) + +# define LPC17_IRQ_P0p15 (LPC17_VALID_FIRST0H+0) +# define LPC17_IRQ_P0p16 (LPC17_VALID_FIRST0H+1) +# define LPC17_IRQ_P0p17 (LPC17_VALID_FIRST0H+2) +# define LPC17_IRQ_P0p18 (LPC17_VALID_FIRST0H+3) +# define LPC17_IRQ_P0p19 (LPC17_VALID_FIRST0H+4) +# define LPC17_IRQ_P0p20 (LPC17_VALID_FIRST0H+5) +# define LPC17_IRQ_P0p21 (LPC17_VALID_FIRST0H+6) +# define LPC17_IRQ_P0p22 (LPC17_VALID_FIRST0H+7) +# define LPC17_IRQ_P0p23 (LPC17_VALID_FIRST0H+8) +# define LPC17_IRQ_P0p24 (LPC17_VALID_FIRST0H+9) +# define LPC17_IRQ_P0p25 (LPC17_VALID_FIRST0H+10) +# define LPC17_IRQ_P0p26 (LPC17_VALID_FIRST0H+11) +# define LPC17_IRQ_P0p27 (LPC17_VALID_FIRST0H+12) +# define LPC17_IRQ_P0p28 (LPC17_VALID_FIRST0H+13) +# define LPC17_IRQ_P0p29 (LPC17_VALID_FIRST0H+14) +# define LPC17_IRQ_P0p30 (LPC17_VALID_FIRST0H+15) +# define LPC17_VALID_NIRQS0H (16) + + /* Set 3: 14 interrupts p2.0-p2.13 */ + +# define LPC17_VALID_GPIOINT2 (0x00003ffful) +# define LPC17_VALID_SHIFT2 (0) +# define LPC17_VALID_FIRST2 (LPC17_VALID_FIRST0H+LPC17_VALID_NIRQS0H) + +# define LPC17_IRQ_P2p0 (LPC17_VALID_FIRST2+0) +# define LPC17_IRQ_P2p1 (LPC17_VALID_FIRST2+1) +# define LPC17_IRQ_P2p2 (LPC17_VALID_FIRST2+2) +# define LPC17_IRQ_P2p3 (LPC17_VALID_FIRST2+3) +# define LPC17_IRQ_P2p4 (LPC17_VALID_FIRST2+4) +# define LPC17_IRQ_P2p5 (LPC17_VALID_FIRST2+5) +# define LPC17_IRQ_P2p6 (LPC17_VALID_FIRST2+6) +# define LPC17_IRQ_P2p7 (LPC17_VALID_FIRST2+7) +# define LPC17_IRQ_P2p8 (LPC17_VALID_FIRST2+8) +# define LPC17_IRQ_P2p9 (LPC17_VALID_FIRST2+9) +# define LPC17_IRQ_P2p10 (LPC17_VALID_FIRST2+10) +# define LPC17_IRQ_P2p11 (LPC17_VALID_FIRST2+11) +# define LPC17_IRQ_P2p12 (LPC17_VALID_FIRST2+12) +# define LPC17_IRQ_P2p13 (LPC17_VALID_FIRST2+13) +# define LPC17_VALID_NIRQS2 (14) +# define LPC17_NGPIOAIRQS (LPC17_VALID_NIRQS0L+LPC17_VALID_NIRQS0H+LPC17_VALID_NIRQS2) +#else +# define LPC17_NGPIOAIRQS (0) +#endif + +/* Total number of IRQ numbers */ + +#define NR_IRQS (LPC17_IRQ_EXTINT+LPC17_IRQ_NEXTINT+LPC17_NGPIOAIRQS) + +/**************************************************************************** + * Public Types + ****************************************************************************/ + +/**************************************************************************** + * Inline functions + ****************************************************************************/ + +/**************************************************************************** + * Public Variables + ****************************************************************************/ + +/**************************************************************************** + * Public Function Prototypes + ****************************************************************************/ + +#endif /* __ARCH_ARM_INCLUDE_LPC17XX_LPC176X_IRQ_H */ + diff --git a/nuttx/arch/arm/include/lpc17xx/lpc178x_irq.h b/nuttx/arch/arm/include/lpc17xx/lpc178x_irq.h new file mode 100644 index 0000000000..9f7cbf9a77 --- /dev/null +++ b/nuttx/arch/arm/include/lpc17xx/lpc178x_irq.h @@ -0,0 +1,294 @@ +/**************************************************************************** + * arch/arm/include/lpc17xxx/lpc178x_irq.h + * + * Copyright (C) 2013 Gregory Nutt. All rights reserved. + * Authors: Rommel Marcelo + * Gregory Nutt + * + * 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. + * + ****************************************************************************/ + +/* This file should never be included directed but, rather, + * only indirectly through nuttx/irq.h + */ + +#ifndef __ARCH_ARM_INCLUDE_LPC17XX_LPC178X_IRQ_H +#define __ARCH_ARM_INCLUDE_LPC17XX_LPC178X_IRQ_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +/* IRQ numbers. The IRQ number corresponds vector number and hence map + * directly to bits in the NVIC. This does, however, waste several words of + * memory in the IRQ to handle mapping tables. + */ + +/* External interrupts (vectors >= 16) */ + +#define LPC17_IRQ_WDT (LPC17_IRQ_EXTINT+0) /* WDT Watchdog Interrupt (WDINT) */ +#define LPC17_IRQ_TMR0 (LPC17_IRQ_EXTINT+1) /* Timer 0 Match 0 - 1 (MR0, MR1) + * Capture 0 - 1 (CR0, CR1) */ +#define LPC17_IRQ_TMR1 (LPC17_IRQ_EXTINT+2) /* Timer 1 Match 0 - 2 (MR0, MR1, MR2) + * Capture 0 - 1 (CR0, CR1) */ +#define LPC17_IRQ_TMR2 (LPC17_IRQ_EXTINT+3) /* Timer 2 Match 0-3 + * Capture 0-1 */ +#define LPC17_IRQ_TMR3 (LPC17_IRQ_EXTINT+4) /* Timer 3 Match 0-3 + * Capture 0-1 */ +#define LPC17_IRQ_UART0 (LPC17_IRQ_EXTINT+5) /* UART 0 Rx Line Status (RLS) + * Transmit Holding Register Empty (THRE) + * Rx Data Available (RDA) + * Character Time-out Indicator (CTI) + * End of Auto-Baud (ABEO) + * Auto-Baud Time-Out (ABTO) */ +#define LPC17_IRQ_UART1 (LPC17_IRQ_EXTINT+6) /* UART 1 Rx Line Status (RLS) + * Transmit Holding Register Empty (THRE) + * Rx Data Available (RDA) + * Character Time-out Indicator (CTI) + * Modem Control Change + * End of Auto-Baud (ABEO) + * Auto-Baud Time-Out (ABTO) */ +#define LPC17_IRQ_UART2 (LPC17_IRQ_EXTINT+7) /* UART 2 Rx Line Status (RLS) + * Transmit Holding Register Empty (THRE) + * Rx Data Available (RDA) + * Character Time-out Indicator (CTI) + * End of Auto-Baud (ABEO) + * Auto-Baud Time-Out (ABTO) */ +#define LPC17_IRQ_UART3 (LPC17_IRQ_EXTINT+8) /* UART 3 Rx Line Status (RLS) + * Transmit Holding Register Empty (THRE) + * Rx Data Available (RDA) + * Character Time-out Indicator (CTI) + * End of Auto-Baud (ABEO) + * Auto-Baud Time-Out (ABTO) */ +#define LPC17_IRQ_PWM1 (LPC17_IRQ_EXTINT+9) /* PWM1 Match 0 - 6 of PWM1 + * Capture 0-1 of PWM1 */ +#define LPC17_IRQ_I2C0 (LPC17_IRQ_EXTINT+10) /* I2C0 SI (state change) */ +#define LPC17_IRQ_I2C1 (LPC17_IRQ_EXTINT+11) /* I2C1 SI (state change) */ +#define LPC17_IRQ_I2C2 (LPC17_IRQ_EXTINT+12) /* I2C2 SI (state change) */ +/* (LPC17_IRQ_EXTINT+13) Unused */ +#define LPC17_IRQ_SSP0 (LPC17_IRQ_EXTINT+14) /* SSP0 Tx FIFO half empty of SSP0 + * Rx FIFO half full of SSP0 + * Rx Timeout of SSP0 + * Rx Overrun of SSP0 */ +#define LPC17_IRQ_SSP1 (LPC17_IRQ_EXTINT+15) /* SSP 1 Tx FIFO half empty + * Rx FIFO half full + * Rx Timeout + * Rx Overrun */ +#define LPC17_IRQ_PLL0 (LPC17_IRQ_EXTINT+16) /* PLL0 (Main PLL) PLL0 Lock (PLOCK0) */ +#define LPC17_IRQ_RTC (LPC17_IRQ_EXTINT+17) /* RTC Counter Increment (RTCCIF) + * Alarm (RTCALF) */ +#define LPC17_IRQ_EINT0 (LPC17_IRQ_EXTINT+18) /* External Interrupt 0 (EINT0) */ +#define LPC17_IRQ_EINT1 (LPC17_IRQ_EXTINT+19) /* External Interrupt 1 (EINT1) */ +#define LPC17_IRQ_EINT2 (LPC17_IRQ_EXTINT+20) /* External Interrupt 2 (EINT2) */ +#define LPC17_IRQ_EINT3 (LPC17_IRQ_EXTINT+21) /* External Interrupt 3 (EINT3) + * Note: EINT3 channel is shared with GPIO interrupts */ +#define LPC17_IRQ_ADC (LPC17_IRQ_EXTINT+22) /* ADC A/D Converter end of conversion */ +#define LPC17_IRQ_BOD (LPC17_IRQ_EXTINT+23) /* BOD Brown Out detect */ +#define LPC17_IRQ_USB (LPC17_IRQ_EXTINT+24) /* USB USB_INT_REQ_LP, USB_INT_REQ_HP, + * USB_INT_REQ_DMA */ +#define LPC17_IRQ_CAN (LPC17_IRQ_EXTINT+25) /* CAN CAN Common, CAN 0 Tx, CAN 0 Rx, + * CAN 1 Tx, CAN 1 Rx */ +#define LPC17_IRQ_GPDMA (LPC17_IRQ_EXTINT+26) /* GPDMA IntStatus of DMA channel 0, + * IntStatus of DMA channel 1 */ +#define LPC17_IRQ_I2S (LPC17_IRQ_EXTINT+27) /* I2S irq, dmareq1, dmareq2 */ +#define LPC17_IRQ_ETH (LPC17_IRQ_EXTINT+28) /* Ethernet WakeupInt, SoftInt, TxDoneInt, + * TxFinishedInt, TxErrorInt,* TxUnderrunInt, + * RxDoneInt, RxFinishedInt, RxErrorInt, + * RxOverrunInt */ +#define LPC17_IRQ_MCI (LPC17_IRQ_EXTINT+29) /* MCI SD Card Interface */ +#define LPC17_IRQ_MCPWM (LPC17_IRQ_EXTINT+30) /* Motor Control PWM IPER[2:0], IPW[2:0], + * ICAP[2:0], FES */ +#define LPC17_IRQ_QEI (LPC17_IRQ_EXTINT+31) /* Quadrature Encoder INX_Int, TIM_Int, VELC_Int, + * DIR_Int, ERR_Int, ENCLK_Int, POS0_Int, POS1_Int + * POS2_Int, REV_Int, POS0REV_Int, OS1REV_Int, + * POS2REV_Int */ +#define LPC17_IRQ_PLL1 (LPC17_IRQ_EXTINT+32) /* PLL1 (USB PLL) PLL1 Lock (PLOCK1) */ +#define LPC17_IRQ_USBACT (LPC17_IRQ_EXTINT+33) /* USB Activity Interrupt USB_NEED_CLK */ +#define LPC17_IRQ_CANACT (LPC17_IRQ_EXTINT+34) /* CAN Activity Interrupt CAN1WAKE, CAN2WAKE */ +#define LPC17_IRQ_UART4 (LPC17_IRQ_EXTINT+35) /* UART 4 Rx Line Status (RLS) + * Transmit Holding Register Empty (THRE) + * Rx Data Available (RDA) + * Character Time-out Indicator (CTI) + * End of Auto-Baud (ABEO) + * Auto-Baud Time-Out (ABTO) */ +#define LPC17_IRQ_SSP2 (LPC17_IRQ_EXTINT+36) /* SSP2 Tx FIFO half empty of SSP2 + * Rx FIFO half full of SSP2 + * Rx Timeout of SSP2 + * Rx Overrun of SSP2 */ +#define LPC17_IRQ_LCD (LPC17_IRQ_EXTINT+37) /* LCD interrupt + * BER, VCompI, LNBUI, FUFI, CrsrI */ +#define LPC17_IRQ_GPIO (LPC17_IRQ_EXTINT+38) /* GPIO Interrupt + * P0xREI, P2xREI, P0xFEI, P2xFEI */ +#define LPC17_IRQ_PWM0 (LPC17_IRQ_EXTINT+39) /* PWM0 Match 0 - 6 of PWM0 + * Capture 0-1 of PWM0 */ +#define LPC17_IRQ_EEPROM (LPC17_IRQ_EXTINT+40) /* EEPROM Interrupt + * EE_PROG_DONE, EE_RW_DONE */ +#define LPC17_IRQ_NEXTINT (40) +#define LPC17_IRQ_NIRQS (LPC17_IRQ_EXTINT+LPC17_IRQ_NEXTINT) + +/* GPIO interrupts. The LPC177x_8x supports several interrupts on ports 0 and + * 2 (only). We go through some special efforts to keep the number of IRQs + * to a minimum in this sparse interrupt case. + * + * 31 interrupts on Port 0: p0.0 - p0.30 + * 31 interrupts on Port 2: p2.0 - p2.30 + * -- + * 42 + */ + +#ifdef CONFIG_GPIO_IRQ +//~ # define LPC17_VALID_GPIOINT0 (0x7fff8ffful) /* GPIO port 0 interrrupt set */ +//~ # define LPC17_VALID_GPIOINT2 (0x00003ffful) /* GPIO port 2 interrupt set */ + + /* Set 1: 16 interrupts p0.0-p0.15 */ + +//~ # define LPC17_VALID_GPIOINT0L (0x00000ffful) +# define LPC17_VALID_SHIFT0L (0) +# define LPC17_VALID_FIRST0L (LPC17_IRQ_EXTINT+LPC17_IRQ_NEXTINT) + +# define LPC17_IRQ_P0p0 (LPC17_VALID_FIRST0L+0) +# define LPC17_IRQ_P0p1 (LPC17_VALID_FIRST0L+1) +# define LPC17_IRQ_P0p2 (LPC17_VALID_FIRST0L+2) +# define LPC17_IRQ_P0p3 (LPC17_VALID_FIRST0L+3) +# define LPC17_IRQ_P0p4 (LPC17_VALID_FIRST0L+4) +# define LPC17_IRQ_P0p5 (LPC17_VALID_FIRST0L+5) +# define LPC17_IRQ_P0p6 (LPC17_VALID_FIRST0L+6) +# define LPC17_IRQ_P0p7 (LPC17_VALID_FIRST0L+7) +# define LPC17_IRQ_P0p8 (LPC17_VALID_FIRST0L+8) +# define LPC17_IRQ_P0p9 (LPC17_VALID_FIRST0L+9) +# define LPC17_IRQ_P0p10 (LPC17_VALID_FIRST0L+10) +# define LPC17_IRQ_P0p11 (LPC17_VALID_FIRST0L+11) +# define LPC17_IRQ_P0p12 (LPC17_VALID_FIRST0L+12) +# define LPC17_IRQ_P0p13 (LPC17_VALID_FIRST0L+13) +# define LPC17_IRQ_P0p14 (LPC17_VALID_FIRST0L+14) +# define LPC17_IRQ_P0p15 (LPC17_VALID_FIRST0L+15) +# define LPC17_VALID_NIRQS0L (16) + + /* Set 2: 16 interrupts p0.16-p0.31 */ + +//~ # define LPC17_VALID_GPIOINT0H (0x7fff8000ull) +# define LPC17_VALID_SHIFT0H (15) +# define LPC17_VALID_FIRST0H (LPC17_VALID_FIRST0L+LPC17_VALID_NIRQS0L) + +# define LPC17_IRQ_P0p16 (LPC17_VALID_FIRST0H+0) +# define LPC17_IRQ_P0p17 (LPC17_VALID_FIRST0H+1) +# define LPC17_IRQ_P0p18 (LPC17_VALID_FIRST0H+2) +# define LPC17_IRQ_P0p19 (LPC17_VALID_FIRST0H+3) +# define LPC17_IRQ_P0p20 (LPC17_VALID_FIRST0H+4) +# define LPC17_IRQ_P0p21 (LPC17_VALID_FIRST0H+5) +# define LPC17_IRQ_P0p22 (LPC17_VALID_FIRST0H+6) +# define LPC17_IRQ_P0p23 (LPC17_VALID_FIRST0H+7) +# define LPC17_IRQ_P0p24 (LPC17_VALID_FIRST0H+8) +# define LPC17_IRQ_P0p25 (LPC17_VALID_FIRST0H+9) +# define LPC17_IRQ_P0p26 (LPC17_VALID_FIRST0H+10) +# define LPC17_IRQ_P0p27 (LPC17_VALID_FIRST0H+11) +# define LPC17_IRQ_P0p28 (LPC17_VALID_FIRST0H+12) +# define LPC17_IRQ_P0p29 (LPC17_VALID_FIRST0H+13) +# define LPC17_IRQ_P0p30 (LPC17_VALID_FIRST0H+14) +# define LPC17_IRQ_P0p31 (LPC17_VALID_FIRST0H+15) +# define LPC17_VALID_NIRQS0H (16) + + /* Set 3: 16 interrupts p2.0-p2.15 */ + +//~ # define LPC17_VALID_GPIOINT2 (0x00003ffful) +# define LPC17_VALID_SHIFT2L (0) +# define LPC17_VALID_FIRST2L (LPC17_VALID_FIRST0H+LPC17_VALID_NIRQS0H) + +# define LPC17_IRQ_P2p0 (LPC17_VALID_FIRST2L+0) +# define LPC17_IRQ_P2p1 (LPC17_VALID_FIRST2L+1) +# define LPC17_IRQ_P2p2 (LPC17_VALID_FIRST2L+2) +# define LPC17_IRQ_P2p3 (LPC17_VALID_FIRST2L+3) +# define LPC17_IRQ_P2p4 (LPC17_VALID_FIRST2L+4) +# define LPC17_IRQ_P2p5 (LPC17_VALID_FIRST2L+5) +# define LPC17_IRQ_P2p6 (LPC17_VALID_FIRST2L+6) +# define LPC17_IRQ_P2p7 (LPC17_VALID_FIRST2L+7) +# define LPC17_IRQ_P2p8 (LPC17_VALID_FIRST2L+8) +# define LPC17_IRQ_P2p9 (LPC17_VALID_FIRST2L+9) +# define LPC17_IRQ_P2p10 (LPC17_VALID_FIRST2L+10) +# define LPC17_IRQ_P2p11 (LPC17_VALID_FIRST2L+11) +# define LPC17_IRQ_P2p12 (LPC17_VALID_FIRST2L+12) +# define LPC17_IRQ_P2p13 (LPC17_VALID_FIRST2L+13) +# define LPC17_IRQ_P2p14 (LPC17_VALID_FIRST2L+14) +# define LPC17_IRQ_P2p15 (LPC17_VALID_FIRST2L+15) +# define LPC17_VALID_NIRQS2L (16) + + /* Set 3: 16 interrupts p2.16 - p2.31 */ + +# define LPC17_VALID_SHIFT2H (15) +# define LPC17_VALID_FIRST2H (LPC17_VALID_FIRST2L+LPC17_VALID_NIRQS2L) + +# define LPC17_IRQ_P2p16 (LPC17_VALID_FIRST2H+0) +# define LPC17_IRQ_P2p17 (LPC17_VALID_FIRST2H+1) +# define LPC17_IRQ_P2p18 (LPC17_VALID_FIRST2H+2) +# define LPC17_IRQ_P2p19 (LPC17_VALID_FIRST2H+3) +# define LPC17_IRQ_P2p20 (LPC17_VALID_FIRST2H+4) +# define LPC17_IRQ_P2p21 (LPC17_VALID_FIRST2H+5) +# define LPC17_IRQ_P2p22 (LPC17_VALID_FIRST2H+6) +# define LPC17_IRQ_P2p23 (LPC17_VALID_FIRST2H+7) +# define LPC17_IRQ_P2p24 (LPC17_VALID_FIRST2H+8) +# define LPC17_IRQ_P2p25 (LPC17_VALID_FIRST2H+9) +# define LPC17_IRQ_P2p26 (LPC17_VALID_FIRST2H+10) +# define LPC17_IRQ_P2p27 (LPC17_VALID_FIRST2H+11) +# define LPC17_IRQ_P2p28 (LPC17_VALID_FIRST2H+12) +# define LPC17_IRQ_P2p29 (LPC17_VALID_FIRST2H+13) +# define LPC17_IRQ_P2p30 (LPC17_VALID_FIRST2H+14) +# define LPC17_IRQ_P2p31 (LPC17_VALID_FIRST2H+15) +# define LPC17_VALID_NIRQS2H (16) + +# define LPC17_NGPIOAIRQS (LPC17_VALID_NIRQS0L+LPC17_VALID_NIRQS0H+LPC17_VALID_NIRQS2L+LPC17_VALID_NIRQS2H) +#else +# define LPC17_NGPIOAIRQS (0) +#endif + +/* Total number of IRQ numbers */ + +#define NR_IRQS (LPC17_IRQ_EXTINT+LPC17_IRQ_NEXTINT+LPC17_NGPIOAIRQS) + +/**************************************************************************** + * Public Types + ****************************************************************************/ + +/**************************************************************************** + * Inline functions + ****************************************************************************/ + +/**************************************************************************** + * Public Variables + ****************************************************************************/ + +/**************************************************************************** + * Public Function Prototypes + ****************************************************************************/ + +#endif /* __ARCH_ARM_INCLUDE_LPC17XX_LPC178X_IRQ_H */ + diff --git a/nuttx/arch/arm/src/lpc17xx/Kconfig b/nuttx/arch/arm/src/lpc17xx/Kconfig index 8acd67595f..b7dd7ac34b 100644 --- a/nuttx/arch/arm/src/lpc17xx/Kconfig +++ b/nuttx/arch/arm/src/lpc17xx/Kconfig @@ -12,49 +12,101 @@ choice config ARCH_CHIP_LPC1751 bool "LPC1751" + select ARCH_FAMILY_LPC175X config ARCH_CHIP_LPC1752 bool "LPC1752" + select ARCH_FAMILY_LPC175X config ARCH_CHIP_LPC1754 bool "LPC1754" + select ARCH_FAMILY_LPC175X config ARCH_CHIP_LPC1756 bool "LPC1756" + select ARCH_FAMILY_LPC175X config ARCH_CHIP_LPC1758 bool "LPC1758" + select ARCH_FAMILY_LPC175X config ARCH_CHIP_LPC1759 bool "LPC1759" + select ARCH_FAMILY_LPC175X config ARCH_CHIP_LPC1764 bool "LPC1764" + select ARCH_FAMILY_LPC176X config ARCH_CHIP_LPC1765 bool "LPC1765" + select ARCH_FAMILY_LPC176X config ARCH_CHIP_LPC1766 bool "LPC1766" + select ARCH_FAMILY_LPC176X config ARCH_CHIP_LPC1767 bool "LPC1767" + select ARCH_FAMILY_LPC176X config ARCH_CHIP_LPC1768 bool "LPC1768" + select ARCH_FAMILY_LPC176X config ARCH_CHIP_LPC1769 bool "LPC1769" + select ARCH_FAMILY_LPC176X + +config ARCH_CHIP_LPC1773 + bool "LPC1773" + select ARCH_FAMILY_LPC177X + +config ARCH_CHIP_LPC1774 + bool "LPC1774" + select ARCH_FAMILY_LPC177X + +config ARCH_CHIP_LPC1776 + bool "LPC1776" + select ARCH_FAMILY_LPC177X + +config ARCH_CHIP_LPC1777 + bool "LPC1777" + select ARCH_FAMILY_LPC177X + +config ARCH_CHIP_LPC1778 + bool "LPC1778" + select ARCH_FAMILY_LPC177X + +config ARCH_CHIP_LPC1785 + bool "LPC1785" + select ARCH_FAMILY_LPC178X + +config ARCH_CHIP_LPC1786 + bool "LPC1786" + select ARCH_FAMILY_LPC178X + +config ARCH_CHIP_LPC1787 + bool "LPC1787" + select ARCH_FAMILY_LPC178X + +config ARCH_CHIP_LPC1788 + bool "LPC1788" + select ARCH_FAMILY_LPC178X endchoice config ARCH_FAMILY_LPC175X bool - default y if ARCH_CHIP_LPC1751 || ARCH_CHIP_LPC1752 || ARCH_CHIP_LPC1754 || ARCH_CHIP_LPC1756 || ARCH_CHIP_LPC1758 || ARCH_CHIP_LPC1759 config ARCH_FAMILY_LPC176X bool - default y if ARCH_CHIP_LPC1764 || ARCH_CHIP_LPC1765 || ARCH_CHIP_LPC1766 || ARCH_CHIP_LPC1767 || ARCH_CHIP_LPC1768 || ARCH_CHIP_LPC1769 + +config ARCH_FAMILY_LPC177X + bool + +config ARCH_FAMILY_LPC178X + bool menu "LPC17xx Peripheral Support" diff --git a/nuttx/arch/arm/src/lpc17xx/chip.h b/nuttx/arch/arm/src/lpc17xx/chip.h index 9824820175..60dda773d3 100644 --- a/nuttx/arch/arm/src/lpc17xx/chip.h +++ b/nuttx/arch/arm/src/lpc17xx/chip.h @@ -41,159 +41,7 @@ ************************************************************************************/ #include - -/************************************************************************************ - * Pre-processor Definitions - ************************************************************************************/ - -/* Get customizations for each supported chip */ - -#if defined(CONFIG_ARCH_CHIP_LPC1769) || defined(CONFIG_ARCH_CHIP_LPC1768) -# define LPC17_FLASH_SIZE (512*1024) /* 512Kb */ -# define LPC17_SRAM_SIZE (64*1024) /* 64Kb */ -# define LPC17_CPUSRAM_SIZE (32*1024) -# define LPC17_HAVE_BANK0 1 /* Have AHB SRAM bank 0 */ -# define LPC17_HAVE_BANK1 1 /* Have AHB SRAM bank 1 */ -# define LPC17_NETHCONTROLLERS 1 /* One Ethernet controller */ -# define LPC17_NUSBHOST 1 /* One USB host controller */ -# define LPC17_NUSBOTG 1 /* One USB OTG controller */ -# define LPC17_NUSBDEV 1 /* One USB device controller */ -# define LPC17_NCAN 2 /* Two CAN controllers */ -# define LPC17_NI2S 1 /* One I2S module */ -# define LPC17_NDAC 1 /* One DAC module */ -#elif defined(CONFIG_ARCH_CHIP_LPC1767) -# define LPC17_FLASH_SIZE (512*1024) /* 512Kb */ -# define LPC17_SRAM_SIZE (64*1024) /* 64Kb */ -# define LPC17_CPUSRAM_SIZE (32*1024) -# define LPC17_HAVE_BANK0 1 /* Have AHB SRAM bank 0 */ -# define LPC17_HAVE_BANK1 1 /* Have AHB SRAM bank 1 */ -# define LPC17_NETHCONTROLLERS 1 /* One Ethernet controller */ -# define LPC17_NUSBHOST 0 /* No USB host controller */ -# define LPC17_NUSBOTG 0 /* No USB OTG controller */ -# define LPC17_NUSBDEV 0 /* No USB device controller */ -# define LPC17_NCAN 0 /* No CAN controllers */ -# define LPC17_NI2S 1 /* One I2S module */ -# define LPC17_NDAC 1 /* One DAC module */ -#elif defined(CONFIG_ARCH_CHIP_LPC1766) -# define LPC17_FLASH_SIZE (256*1024) /* 256Kb */ -# define LPC17_SRAM_SIZE (64*1024) /* 64Kb */ -# define LPC17_CPUSRAM_SIZE (32*1024) -# define LPC17_HAVE_BANK0 1 /* Have AHB SRAM bank 0 */ -# define LPC17_HAVE_BANK1 1 /* Have AHB SRAM bank 1 */ -# define LPC17_NETHCONTROLLERS 1 /* One Ethernet controller */ -# define LPC17_NUSBHOST 1 /* One USB host controller */ -# define LPC17_NUSBOTG 1 /* One USB OTG controller */ -# define LPC17_NUSBDEV 1 /* One USB device controller */ -# define LPC17_NCAN 2 /* Two CAN controllers */ -# define LPC17_NI2S 1 /* One I2S module */ -# define LPC17_NDAC 1 /* One DAC module */ -#elif defined(CONFIG_ARCH_CHIP_LPC1765) -# define LPC17_FLASH_SIZE (256*1024) /* 256Kb */ -# define LPC17_SRAM_SIZE (64*1024) /* 64Kb */ -# define LPC17_CPUSRAM_SIZE (32*1024) -# define LPC17_HAVE_BANK0 1 /* Have AHB SRAM bank 0 */ -# define LPC17_HAVE_BANK1 1 /* Have AHB SRAM bank 1 */ -# define LPC17_NETHCONTROLLERS 0 /* No Ethernet controller */ -# define LPC17_NUSBHOST 1 /* One USB host controller */ -# define LPC17_NUSBOTG 1 /* One USB OTG controller */ -# define LPC17_NUSBDEV 1 /* One USB device controller */ -# define LPC17_NCAN 2 /* Two CAN controllers */ -# define LPC17_NI2S 1 /* One I2S module */ -# define LPC17_NDAC 1 /* One DAC module */ -#elif defined(CONFIG_ARCH_CHIP_LPC1764) -# define LPC17_FLASH_SIZE (128*1024) /* 128Kb */ -# define LPC17_SRAM_SIZE (32*1024) /* 32Kb */ -# define LPC17_CPUSRAM_SIZE (16*1024) -# define LPC17_HAVE_BANK0 1 /* Have AHB SRAM bank 0 */ -# undef LPC17_HAVE_BANK1 /* No AHB SRAM bank 1 */ -# define LPC17_NETHCONTROLLERS 1 /* One Ethernet controller */ -# define LPC17_NUSBHOST 0 /* No USB host controller */ -# define LPC17_NUSBOTG 0 /* No USB OTG controller */ -# define LPC17_NUSBDEV 1 /* One USB device controller */ -# define LPC17_NCAN 2 /* Two CAN controllers */ -# define LPC17_NI2S 0 /* No I2S modules */ -# define LPC17_NDAC 0 /* No DAC module */ -#elif defined(CONFIG_ARCH_CHIP_LPC1759) -# define LPC17_FLASH_SIZE (512*1024) /* 512Kb */ -# define LPC17_SRAM_SIZE (64*1024) /* 64Kb */ -# define LPC17_CPUSRAM_SIZE (32*1024) -# define LPC17_HAVE_BANK0 1 /* Have AHB SRAM bank 0 */ -# define LPC17_HAVE_BANK1 1 /* Have AHB SRAM bank 1 */ -# define LPC17_NETHCONTROLLERS 0 /* No Ethernet controller */ -# define LPC17_NUSBHOST 1 /* One USB host controller */ -# define LPC17_NUSBOTG 1 /* One USB OTG controller */ -# define LPC17_NUSBDEV 1 /* One USB device controller */ -# define LPC17_NCAN 2 /* Two CAN controllers */ -# define LPC17_NI2S 1 /* One I2S module */ -# define LPC17_NDAC 1 /* One DAC module */ -#elif defined(CONFIG_ARCH_CHIP_LPC1758) -# define LPC17_FLASH_SIZE (512*1024) /* 512Kb */ -# define LPC17_SRAM_SIZE (64*1024) /* 64Kb */ -# define LPC17_CPUSRAM_SIZE (32*1024) -# define LPC17_HAVE_BANK0 1 /* Have AHB SRAM bank 0 */ -# define LPC17_HAVE_BANK1 1 /* Have AHB SRAM bank 1 */ -# define LPC17_NETHCONTROLLERS 1 /* One Ethernet controller */ -# define LPC17_NUSBHOST 1 /* One USB host controller */ -# define LPC17_NUSBOTG 1 /* One USB OTG controller */ -# define LPC17_NUSBDEV 1 /* One USB device controller */ -# define LPC17_NCAN 2 /* Two CAN controllers */ -# define LPC17_NI2S 1 /* One I2S module */ -# define LPC17_NDAC 1 /* One DAC module */ -#elif defined(CONFIG_ARCH_CHIP_LPC1756) -# define LPC17_FLASH_SIZE (256*1024) /* 256Kb */ -# define LPC17_SRAM_SIZE (32*1024) /* 32Kb */ -# define LPC17_CPUSRAM_SIZE (16*1024) -# define LPC17_HAVE_BANK0 1 /* No AHB SRAM bank 0 */ -# undef LPC17_HAVE_BANK1 /* No AHB SRAM bank 1 */ -# define LPC17_NETHCONTROLLERS 0 /* No Ethernet controller */ -# define LPC17_NUSBHOST 1 /* One USB host controller */ -# define LPC17_NUSBOTG 1 /* One USB OTG controller */ -# define LPC17_NUSBDEV 1 /* One USB device controller */ -# define LPC17_NCAN 2 /* Two CAN controllers */ -# define LPC17_NI2S 1 /* One I2S module */ -# define LPC17_NDAC 1 /* One DAC module */ -#elif defined(CONFIG_ARCH_CHIP_LPC1754) -# define LPC17_FLASH_SIZE (128*1024) /* 128Kb */ -# define LPC17_SRAM_SIZE (32*1024) /* 32Kb */ -# define LPC17_CPUSRAM_SIZE (16*1024) -# define LPC17_HAVE_BANK0 1 /* Have AHB SRAM bank 0 */ -# undef LPC17_HAVE_BANK1 /* No AHB SRAM bank 1 */ -# define LPC17_NETHCONTROLLERS 0 /* No Ethernet controller */ -# define LPC17_NUSBHOST 1 /* One USB host controller */ -# define LPC17_NUSBOTG 1 /* One USB OTG controller */ -# define LPC17_NUSBDEV 1 /* One USB device controller */ -# define LPC17_NCAN 1 /* One CAN controller */ -# define LPC17_NI2S 0 /* No I2S modules */ -# define LPC17_NDAC 1 /* One DAC module */ -#elif defined(CONFIG_ARCH_CHIP_LPC1752) -# define LPC17_FLASH_SIZE (64*1024) /* 65Kb */ -# define LPC17_SRAM_SIZE (16*1024) /* 16Kb */ -# define LPC17_CPUSRAM_SIZE (16*1024) -# undef LPC17_HAVE_BANK0 /* No AHB SRAM bank 0 */ -# undef LPC17_HAVE_BANK1 /* No AHB SRAM bank 1 */ -# define LPC17_NETHCONTROLLERS 0 /* No Ethernet controller */ -# define LPC17_NUSBHOST 0 /* No USB host controller */ -# define LPC17_NUSBOTG 0 /* No USB OTG controller */ -# define LPC17_NUSBDEV 1 /* One USB device controller */ -# define LPC17_NCAN 1 /* One CAN controller */ -# define LPC17_NI2S 0 /* No I2S modules */ -# define LPC17_NDAC 0 /* No DAC module */ -#elif defined(CONFIG_ARCH_CHIP_LPC1751) -# define LPC17_FLASH_SIZE (32*1024) /* 32Kb */ -# define LPC17_SRAM_SIZE (8*1024) /* 8Kb */ -# define LPC17_CPUSRAM_SIZE (8*1024) -# undef LPC17_HAVE_BANK0 /* No AHB SRAM bank 0 */ -# undef LPC17_HAVE_BANK1 /* No AHB SRAM bank 1 */ -# define LPC17_NETHCONTROLLERS 0 /* No Ethernet controller */ -# define LPC17_NUSBHOST 0 /* No USB host controller */ -# define LPC17_NUSBOTG 0 /* No USB OTG controller */ -# define LPC17_NUSBDEV 1 /* One USB device controller */ -# define LPC17_NCAN 1 /* One CAN controller */ -# define LPC17_NI2S 0 /* No I2S modules */ -# define LPC17_NDAC 0 /* No DAC module */ -#else -# error "Unsupported LPC17xx chip" -#endif +#include /* Include only the memory map. Other chip hardware files should then include this * file for the proper setup @@ -201,6 +49,10 @@ #include "lpc17_memorymap.h" +/************************************************************************************ + * Pre-processor Definitions + ************************************************************************************/ + /* NVIC priority levels *************************************************************/ /* Each priority field holds a priority value, 0-31. The lower the value, the greater * the priority of the corresponding interrupt. The processor implements only diff --git a/nuttx/arch/arm/src/lpc17xx/lpc17_ssp.c b/nuttx/arch/arm/src/lpc17xx/lpc17_ssp.c index 76c446c7dc..db6fbe1f82 100644 --- a/nuttx/arch/arm/src/lpc17xx/lpc17_ssp.c +++ b/nuttx/arch/arm/src/lpc17xx/lpc17_ssp.c @@ -1,7 +1,7 @@ /**************************************************************************** * arch/arm/src/lpc17xx/lpc17_ssp.c * - * Copyright (C) 2010-2012 Gregory Nutt. All rights reserved. + * Copyright (C) 2010-2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -926,4 +926,3 @@ void ssp_flush(FAR struct spi_dev_s *dev) } #endif /* CONFIG_LPC17_SSP0/1 */ - diff --git a/nuttx/configs/olimex-lpc1766stk/README.txt b/nuttx/configs/olimex-lpc1766stk/README.txt index 13c63d18bd..990d1141a5 100644 --- a/nuttx/configs/olimex-lpc1766stk/README.txt +++ b/nuttx/configs/olimex-lpc1766stk/README.txt @@ -935,44 +935,37 @@ Where is one of the following: Configuration Notes: - 1. Uses the buildroot toolchaing (CONFIG_LPC17_BUILDROOT=y). But that is - easily reconfigured (see above) - 2. Support for FAT long file names is built-in but can easily be - removed if you are concerned about Microsoft patent issues (see the - section "FAT Long File Names" in the top-level COPYING file). - - CONFIG_FS_FAT=y - CONFIG_FAT_LCNAMES=y <-- Long file name support - CONFIG_FAT_LFN=y - CONFIG_FAT_MAXFNAME=32 - CONFIG_FS_NXFFS=n - CONFIG_FS_ROMFS=n - - 3. Includes logic to support a button test (apps/examples/buttons). To - enable the button test, make the following changes in the .config - after configuring: - - -CONFIG_ARCH_BUTTONS=n - +CONFIG_ARCH_BUTTONS=y - - -CONFIG_GPIO_IRQ=n - -CONFIG_ARCH_IRQBUTTONS=n - +CONFIG_GPIO_IRQ=y - +CONFIG_ARCH_IRQBUTTONS=y - - 4. This example supports the CAN loopback test (apps/examples/can) but this - must be manually enabled by selecting: - - CONFIG_CAN=y : Enable the generic CAN infrastructure - CONFIG_LPC17_CAN1=y : Enable CAN1 - CONFIG_CAN_LOOPBACK=y : Enable CAN loopback mode - - See also apps/examples/README.txt + NOTES: - Special CAN-only debug options: + 1. This configuration uses the mconf-based configuration tool. To + change this configuration using that tool, you should: - CONFIG_DEBUG_CAN - CONFIG_CAN_REGDEBUG + a. Build and install the kconfig-mconf tool. See nuttx/README.txt + and misc/tools/ + + b. Execute 'make menuconfig' in nuttx/ in order to start the + reconfiguration process. + + 2. Uses the older, OABI, buildroot toolchain. But that is easily + reconfigured: + + CONFIG_ARMV7M_TOOLCHAIN_BUILDROOT=y : Buildroot toolchain + CONFIG_ARMV7M_OABI_TOOLCHAIN=y : Older, OABI toolchain + + 3. This configuration supports a network. You may have to change + these settings for your network: + + CONFIG_NSH_IPADDR=0x0a000002 : IP address: 10.0.0.2 + CONFIG_NSH_DRIPADDR=0x0a000001 : Gateway: 10.0.0.1 + CONFIG_NSH_NETMASK=0xffffff00 : Netmask: 255.255.255.0 + + 4. This configuration supports the SPI-based MMC/SD card slot. + FAT file system support for FAT long file names is built-in but + can easily be removed if you are concerned about Microsoft patent + issues (see the section "FAT Long File Names" in the top-level + COPYING file). + + CONFIG_FAT_LFN=y : Enables long file name support nx: An example using the NuttX graphics system (NX). This example uses diff --git a/nuttx/configs/olimex-lpc1766stk/nsh/appconfig b/nuttx/configs/olimex-lpc1766stk/nsh/appconfig deleted file mode 100644 index b535ca8696..0000000000 --- a/nuttx/configs/olimex-lpc1766stk/nsh/appconfig +++ /dev/null @@ -1,66 +0,0 @@ -############################################################################ -# configs/olimex-lpc1766stk/nsh/appconfig -# -# Copyright (C) 2011-2012 Gregory Nutt. All rights reserved. -# Author: Gregory Nutt -# -# 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. -# -############################################################################ - -# Path to example in apps/examples containing the user_start entry point - -CONFIGURED_APPS += examples/nsh - -# NSH library - -CONFIGURED_APPS += system/readline -CONFIGURED_APPS += nshlib - -# Networking support - -ifeq ($(CONFIG_NET),y) -CONFIGURED_APPS += netutils/uiplib -CONFIGURED_APPS += netutils/dhcpc -CONFIGURED_APPS += netutils/resolv -CONFIGURED_APPS += netutils/tftpc -CONFIGURED_APPS += netutils/webclient -ifeq ($(CONFIG_NSH_TELNET),y) -CONFIGURED_APPS += netutils/telnetd -endif -endif - -ifeq ($(CONFIG_ARCH_BUTTONS),y) -CONFIGURED_APPS += examples/buttons -endif - -ifeq ($(CONFIG_CAN),y) -CONFIGURED_APPS += examples/can -endif - - diff --git a/nuttx/configs/olimex-lpc1766stk/nsh/defconfig b/nuttx/configs/olimex-lpc1766stk/nsh/defconfig index c096cdb0e4..0f16933b89 100755 --- a/nuttx/configs/olimex-lpc1766stk/nsh/defconfig +++ b/nuttx/configs/olimex-lpc1766stk/nsh/defconfig @@ -1,255 +1,292 @@ -############################################################################ -# configs/olimex-lpc1766stk/nsh/defconfig # -# Copyright (C) 2010-2012 Gregory Nutt. All rights reserved. -# Author: Gregory Nutt +# Automatically generated file; DO NOT EDIT. +# Nuttx/ Configuration # -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: +CONFIG_NUTTX_NEWCONFIG=y + # -# 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. +# Build Setup # -# 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. +# CONFIG_EXPERIMENTAL is not set +CONFIG_HOST_LINUX=y +# CONFIG_HOST_OSX is not set +# CONFIG_HOST_WINDOWS is not set +# CONFIG_HOST_OTHER is not set + # -############################################################################ +# Build Configuration # -# Architecture Selection +# CONFIG_APPS_DIR="../apps" +# CONFIG_BUILD_2PASS is not set + # -CONFIG_ARCH="arm" +# Binary Output Formats +# +# CONFIG_RRLOAD_BINARY is not set +CONFIG_INTELHEX_BINARY=y +# CONFIG_MOTOROLA_SREC is not set +# CONFIG_RAW_BINARY is not set + +# +# Customize Header Files +# +# CONFIG_ARCH_STDBOOL_H is not set +# CONFIG_ARCH_MATH_H is not set +# CONFIG_ARCH_FLOAT_H is not set +# CONFIG_ARCH_STDARG_H is not set + +# +# Debug Options +# +# CONFIG_DEBUG is not set +# CONFIG_DEBUG_SYMBOLS is not set + +# +# System Type +# +# CONFIG_ARCH_8051 is not set CONFIG_ARCH_ARM=y -CONFIG_ARCH_CORTEXM3=y -CONFIG_ARCH_CHIP="lpc17xx" +# CONFIG_ARCH_AVR is not set +# CONFIG_ARCH_HC is not set +# CONFIG_ARCH_MIPS is not set +# CONFIG_ARCH_RGMP is not set +# CONFIG_ARCH_SH is not set +# CONFIG_ARCH_SIM is not set +# CONFIG_ARCH_X86 is not set +# CONFIG_ARCH_Z16 is not set +# CONFIG_ARCH_Z80 is not set +CONFIG_ARCH="arm" + +# +# ARM Options +# +# CONFIG_ARCH_CHIP_C5471 is not set +# CONFIG_ARCH_CHIP_CALYPSO is not set +# CONFIG_ARCH_CHIP_DM320 is not set +# CONFIG_ARCH_CHIP_IMX is not set +# CONFIG_ARCH_CHIP_KINETIS is not set +# CONFIG_ARCH_CHIP_LM is not set CONFIG_ARCH_CHIP_LPC17XX=y -CONFIG_ARCH_CHIP_LPC1766=y -CONFIG_ARCH_BOARD="olimex-lpc1766stk" -CONFIG_ARCH_BOARD_LPC1766STK=y +# CONFIG_ARCH_CHIP_LPC214X is not set +# CONFIG_ARCH_CHIP_LPC2378 is not set +# CONFIG_ARCH_CHIP_LPC31XX is not set +# CONFIG_ARCH_CHIP_LPC43XX is not set +# CONFIG_ARCH_CHIP_SAM3U is not set +# CONFIG_ARCH_CHIP_STM32 is not set +# CONFIG_ARCH_CHIP_STR71X is not set +CONFIG_ARCH_CORTEXM3=y +CONFIG_ARCH_FAMILY="armv7-m" +CONFIG_ARCH_CHIP="lpc17xx" +CONFIG_ARCH_HAVE_MPU=y +# CONFIG_ARMV7M_MPU is not set CONFIG_BOARD_LOOPSPERMSEC=8111 -CONFIG_DRAM_SIZE=32768 -CONFIG_DRAM_START=0x10000000 -CONFIG_ARCH_IRQPRIO=y -CONFIG_ARCH_INTERRUPTSTACK=0 -CONFIG_ARCH_STACKDUMP=y -CONFIG_ARCH_BOOTLOADER=n -CONFIG_ARCH_LEDS=y -CONFIG_ARCH_BUTTONS=n -CONFIG_ARCH_CALIBRATION=n -CONFIG_ARCH_DMA=n +# CONFIG_ARCH_CALIBRATION is not set # -# Identify toolchain and linker options +# ARMV7M Configuration Options # -CONFIG_LPC17_CODESOURCERYW=n -CONFIG_LPC17_CODESOURCERYL=n -CONFIG_LPC17_DEVKITARM=n -CONFIG_LPC17_BUILDROOT=y +CONFIG_ARMV7M_TOOLCHAIN_BUILDROOT=y +# CONFIG_ARMV7M_TOOLCHAIN_CODEREDL is not set +# CONFIG_ARMV7M_TOOLCHAIN_CODESOURCERYL is not set +# CONFIG_ARMV7M_TOOLCHAIN_GNU_EABI is not set +CONFIG_ARMV7M_OABI_TOOLCHAIN=y # -# Individual subsystems can be enabled: +# LPC17xx Configuration Options # +# CONFIG_ARCH_CHIP_LPC1751 is not set +# CONFIG_ARCH_CHIP_LPC1752 is not set +# CONFIG_ARCH_CHIP_LPC1754 is not set +# CONFIG_ARCH_CHIP_LPC1756 is not set +# CONFIG_ARCH_CHIP_LPC1758 is not set +# CONFIG_ARCH_CHIP_LPC1759 is not set +# CONFIG_ARCH_CHIP_LPC1764 is not set +# CONFIG_ARCH_CHIP_LPC1765 is not set +CONFIG_ARCH_CHIP_LPC1766=y +# CONFIG_ARCH_CHIP_LPC1767 is not set +# CONFIG_ARCH_CHIP_LPC1768 is not set +# CONFIG_ARCH_CHIP_LPC1769 is not set +# CONFIG_ARCH_CHIP_LPC1773 is not set +# CONFIG_ARCH_CHIP_LPC1774 is not set +# CONFIG_ARCH_CHIP_LPC1776 is not set +# CONFIG_ARCH_CHIP_LPC1777 is not set +# CONFIG_ARCH_CHIP_LPC1778 is not set +# CONFIG_ARCH_CHIP_LPC1785 is not set +# CONFIG_ARCH_CHIP_LPC1786 is not set +# CONFIG_ARCH_CHIP_LPC1787 is not set +# CONFIG_ARCH_CHIP_LPC1788 is not set +CONFIG_ARCH_FAMILY_LPC176X=y + +# +# LPC17xx Peripheral Support +# +CONFIG_LPC17_MAINOSC=y +CONFIG_LPC17_PLL0=y +CONFIG_LPC17_PLL1=y CONFIG_LPC17_ETHERNET=y -CONFIG_LPC17_USBHOST=n -CONFIG_LPC17_USBOTG=n -CONFIG_LPC17_USBDEV=n +# CONFIG_LPC17_USBHOST is not set +# CONFIG_LPC17_USBDEV is not set CONFIG_LPC17_UART0=y -CONFIG_LPC17_UART1=n -CONFIG_LPC17_UART2=n -CONFIG_LPC17_UART3=n -CONFIG_LPC17_CAN1=n -CONFIG_LPC17_CAN2=n -CONFIG_LPC17_SPI=n -CONFIG_LPC17_SSP0=n +# CONFIG_LPC17_UART1 is not set +# CONFIG_LPC17_UART2 is not set +# CONFIG_LPC17_UART3 is not set +# CONFIG_LPC17_CAN1 is not set +# CONFIG_LPC17_CAN2 is not set +# CONFIG_LPC17_SPI is not set +# CONFIG_LPC17_SSP0 is not set CONFIG_LPC17_SSP1=y -CONFIG_LPC17_I2C0=n -CONFIG_LPC17_I2C1=n -CONFIG_LPC17_I2S=n -CONFIG_LPC17_TMR0=n -CONFIG_LPC17_TMR1=n -CONFIG_LPC17_TMR2=n -CONFIG_LPC17_TMR3=n -CONFIG_LPC17_RIT=n -CONFIG_LPC17_PWM=n -CONFIG_LPC17_MCPWM=n -CONFIG_LPC17_QEI=n -CONFIG_LPC17_RTC=n -CONFIG_LPC17_WDT=n -CONFIG_LPC17_ADC=n -CONFIG_LPC17_DAC=n -CONFIG_LPC17_GPDMA=n +# CONFIG_LPC17_I2C0 is not set +# CONFIG_LPC17_I2C1 is not set +# CONFIG_LPC17_I2C2 is not set +# CONFIG_LPC17_I2S is not set +# CONFIG_LPC17_TMR0 is not set +# CONFIG_LPC17_TMR1 is not set +# CONFIG_LPC17_TMR2 is not set +# CONFIG_LPC17_TMR3 is not set +# CONFIG_LPC17_RIT is not set +# CONFIG_LPC17_PWM is not set +# CONFIG_LPC17_MCPWM is not set +# CONFIG_LPC17_QEI is not set +# CONFIG_LPC17_RTC is not set +# CONFIG_LPC17_WDT is not set +# CONFIG_LPC17_ADC is not set +# CONFIG_LPC17_DAC is not set +# CONFIG_LPC17_GPDMA is not set +# CONFIG_LPC17_FLASH is not set # -# LPC17xx Button interrupt support +# Serial driver options # -CONFIG_GPIO_IRQ=n -CONFIG_ARCH_IRQBUTTONS=n +# CONFIG_SERIAL_TERMIOS is not set +# CONFIG_UART0_FLOWCONTROL is not set # -# LPC17xx specific serial device driver settings +# ADC driver options # -CONFIG_UART0_SERIAL_CONSOLE=y -CONFIG_UART1_SERIAL_CONSOLE=n -CONFIG_UART2_SERIAL_CONSOLE=n -CONFIG_UART3_SERIAL_CONSOLE=n - -CONFIG_UART0_TXBUFSIZE=256 -CONFIG_UART1_TXBUFSIZE=256 -CONFIG_UART2_TXBUFSIZE=256 -CONFIG_UART3_TXBUFSIZE=256 - -CONFIG_UART0_RXBUFSIZE=256 -CONFIG_UART1_RXBUFSIZE=256 -CONFIG_UART2_RXBUFSIZE=256 -CONFIG_UART3_RXBUFSIZE=256 - -CONFIG_UART0_BAUD=57600 -CONFIG_UART2_BAUD=57600 -CONFIG_UART3_BAUD=57600 -CONFIG_UART1_BAUD=57600 - -CONFIG_UART0_BITS=8 -CONFIG_UART1_BITS=8 -CONFIG_UART2_BITS=8 -CONFIG_UART3_BITS=8 - -CONFIG_UART0_PARITY=0 -CONFIG_UART1_PARITY=0 -CONFIG_UART2_PARITY=0 -CONFIG_UART3_PARITY=0 - -CONFIG_UART0_2STOP=0 -CONFIG_UART1_2STOP=0 -CONFIG_UART2_2STOP=0 -CONFIG_UART3_2STOP=0 # -# LPC17xx specific PHY/Ethernet device driver settings +# CAN driver options +# +# CONFIG_GPIO_IRQ is not set + +# +# I2C driver options +# + +# +# Ethernet driver options # -CONFIG_PHY_KS8721=y CONFIG_PHY_AUTONEG=y -CONFIG_PHY_SPEED100=n -CONFIG_PHY_FDUPLEX=y CONFIG_NET_EMACRAM_SIZE=8192 CONFIG_NET_NTXDESC=7 CONFIG_NET_NRXDESC=7 -CONFIG_NET_REGDEBUG=n +CONFIG_NET_PRIORITY=0 +# CONFIG_NET_WOL is not set +# CONFIG_NET_HASH is not set +# CONFIG_NET_MULTICAST is not set # -# General build options +# USB device driver options # -CONFIG_RRLOAD_BINARY=n -CONFIG_INTELHEX_BINARY=y -CONFIG_MOTOROLA_SREC=n -CONFIG_RAW_BINARY=n # -# General OS setup +# USB host driver options # -CONFIG_USER_ENTRYPOINT="nsh_main" -CONFIG_DEBUG=n -CONFIG_DEBUG_VERBOSE=n -CONFIG_DEBUG_SYMBOLS=n -CONFIG_DEBUG_NET=n -CONFIG_DEBUG_USB=n -CONFIG_DEBUG_GPIO=n -CONFIG_DEBUG_CAN=n -CONFIG_MM_REGIONS=2 -CONFIG_ARCH_LOWPUTC=y + +# +# Architecture Options +# +# CONFIG_ARCH_NOINTC is not set +# CONFIG_ARCH_VECNOTIRQ is not set +# CONFIG_ARCH_DMA is not set +CONFIG_ARCH_IRQPRIO=y +# CONFIG_CUSTOM_STACK is not set +# CONFIG_ADDRENV is not set +CONFIG_ARCH_HAVE_VFORK=y +CONFIG_ARCH_STACKDUMP=y +# CONFIG_ENDIAN_BIG is not set +# CONFIG_ARCH_HAVE_RAMFUNCS is not set + +# +# Board Settings +# +CONFIG_DRAM_START=0x10000000 +CONFIG_DRAM_SIZE=32768 +CONFIG_ARCH_HAVE_INTERRUPTSTACK=y +CONFIG_ARCH_INTERRUPTSTACK=0 + +# +# Boot options +# +# CONFIG_BOOT_RUNFROMEXTSRAM is not set +CONFIG_BOOT_RUNFROMFLASH=y +# CONFIG_BOOT_RUNFROMISRAM is not set +# CONFIG_BOOT_RUNFROMSDRAM is not set +# CONFIG_BOOT_COPYTORAM is not set + +# +# Board Selection +# +CONFIG_ARCH_BOARD_LPC1766STK=y +# CONFIG_ARCH_BOARD_CUSTOM is not set +CONFIG_ARCH_BOARD="olimex-lpc1766stk" + +# +# Common Board Options +# +CONFIG_ARCH_HAVE_LEDS=y +CONFIG_ARCH_LEDS=y +CONFIG_ARCH_HAVE_BUTTONS=y +# CONFIG_ARCH_BUTTONS is not set +CONFIG_ARCH_HAVE_IRQBUTTONS=y +CONFIG_NSH_MMCSDMINOR=0 +CONFIG_NSH_MMCSDSLOTNO=0 +CONFIG_NSH_MMCSDSPIPORTNO=1 + +# +# Board-Specific Options +# + +# +# RTOS Features +# +CONFIG_MSEC_PER_TICK=10 CONFIG_RR_INTERVAL=200 -CONFIG_SCHED_INSTRUMENTATION=n +# CONFIG_SCHED_INSTRUMENTATION is not set CONFIG_TASK_NAME_SIZE=0 +# CONFIG_SCHED_HAVE_PARENT is not set +# CONFIG_JULIAN_TIME is not set CONFIG_START_YEAR=2011 CONFIG_START_MONTH=12 CONFIG_START_DAY=30 -CONFIG_GREGORIAN_TIME=n -CONFIG_JULIAN_TIME=n CONFIG_DEV_CONSOLE=y -CONFIG_DEV_LOWCONSOLE=n -CONFIG_MUTEX_TYPES=n -CONFIG_PRIORITY_INHERITANCE=n -CONFIG_SEM_PREALLOCHOLDERS=0 -CONFIG_SEM_NNESTPRIO=0 -CONFIG_FDCLONE_DISABLE=n -CONFIG_FDCLONE_STDIO=n +# CONFIG_MUTEX_TYPES is not set +# CONFIG_PRIORITY_INHERITANCE is not set +# CONFIG_FDCLONE_DISABLE is not set +# CONFIG_FDCLONE_STDIO is not set CONFIG_SDCLONE_DISABLE=y -CONFIG_SCHED_WORKQUEUE=n -CONFIG_SCHED_WORKPRIORITY=192 -CONFIG_SCHED_WORKPERIOD=50000 -CONFIG_SCHED_WORKSTACKSIZE=1024 -CONFIG_SIG_SIGWORK=17 +# CONFIG_SCHED_WORKQUEUE is not set CONFIG_SCHED_WAITPID=y -CONFIG_SCHED_ATEXIT=n - -# -# Settings for NXFLAT -# -CONFIG_NXFLAT=y -CONFIG_NXFLAT_DUMPBUFFER=n -CONFIG_SYMTAB_ORDEREDBYNAME=y - -# -# The following can be used to disable categories of -# APIs supported by the OS. If the compiler supports -# weak functions, then it should not be necessary to -# disable functions unless you want to restrict usage -# of those APIs. -# -# There are certain dependency relationships in these -# features. -# -# o mq_notify logic depends on signals to awaken tasks -# waiting for queues to become full or empty. -# o pthread_condtimedwait() depends on signals to wake -# up waiting tasks. -# -CONFIG_DISABLE_CLOCK=n -CONFIG_DISABLE_POSIX_TIMERS=n -CONFIG_DISABLE_PTHREAD=n -CONFIG_DISABLE_SIGNALS=n -CONFIG_DISABLE_MQUEUE=n -CONFIG_DISABLE_MOUNTPOINT=n -CONFIG_DISABLE_ENVIRON=n +# CONFIG_SCHED_ATEXIT is not set +# CONFIG_SCHED_ONEXIT is not set +CONFIG_USER_ENTRYPOINT="nsh_main" +CONFIG_DISABLE_OS_API=y +# CONFIG_DISABLE_CLOCK is not set +# CONFIG_DISABLE_POSIX_TIMERS is not set +# CONFIG_DISABLE_PTHREAD is not set +# CONFIG_DISABLE_SIGNALS is not set +# CONFIG_DISABLE_MQUEUE is not set +# CONFIG_DISABLE_MOUNTPOINT is not set +# CONFIG_DISABLE_ENVIRON is not set CONFIG_DISABLE_POLL=y # -# Misc libc settings +# Signal Numbers # -CONFIG_NOPRINTF_FIELDWIDTH=n - -# -# Allow for architecture optimized implementations -# -# The architecture can provide optimized versions of the -# following to improve system performance -# -CONFIG_ARCH_MEMCPY=n -CONFIG_ARCH_MEMCMP=n -CONFIG_ARCH_MEMMOVE=n -CONFIG_ARCH_MEMSET=n -CONFIG_ARCH_STRCMP=n -CONFIG_ARCH_STRCPY=n -CONFIG_ARCH_STRNCPY=n -CONFIG_ARCH_STRLEN=n -CONFIG_ARCH_STRNLEN=n -CONFIG_ARCH_BZERO=n +CONFIG_SIG_SIGUSR1=1 +CONFIG_SIG_SIGUSR2=2 +CONFIG_SIG_SIGALARM=3 +CONFIG_SIG_SIGCONDTIMEDOUT=16 # # Sizes of configurable things (0 disables) @@ -260,273 +297,433 @@ CONFIG_NPTHREAD_KEYS=4 CONFIG_NFILE_DESCRIPTORS=8 CONFIG_NFILE_STREAMS=8 CONFIG_NAME_MAX=32 -CONFIG_STDIO_BUFFER_SIZE=256 -CONFIG_STDIO_LINEBUFFER=y -CONFIG_NUNGET_CHARS=2 CONFIG_PREALLOC_MQ_MSGS=4 CONFIG_MQ_MAXMSGSIZE=32 CONFIG_MAX_WDOGPARMS=2 CONFIG_PREALLOC_WDOGS=4 CONFIG_PREALLOC_TIMERS=4 -# -# Filesystem configuration -# -CONFIG_FS_FAT=y -CONFIG_FAT_LCNAMES=y -CONFIG_FAT_LFN=y -CONFIG_FAT_MAXFNAME=32 -CONFIG_FS_NXFFS=n -CONFIG_FS_ROMFS=n - -# -# Maintain legacy build behavior (revisit) -# - -CONFIG_MMCSD=y -CONFIG_MMCSD_SPI=y -CONFIG_MTD=y - -# -# SPI-based MMC/SD driver -# -CONFIG_MMCSD_NSLOTS=1 -CONFIG_MMCSD_READONLY=n -CONFIG_MMCSD_SPICLOCK=12500000 - -# -# Block driver buffering -# -CONFIG_FS_READAHEAD=n -CONFIG_FS_WRITEBUFFER=n - -# -# SDIO-based MMC/SD driver -# -CONFIG_SDIO_DMA=n -CONFIG_MMCSD_MMCSUPPORT=n -CONFIG_MMCSD_HAVECARDDETECT=n - -# -# TCP/IP and UDP support via uIP -# -CONFIG_NET=y -CONFIG_NET_IPv6=n -CONFIG_NSOCKET_DESCRIPTORS=8 -CONFIG_NET_SOCKOPTS=y -CONFIG_NET_BUFSIZE=562 -CONFIG_NET_TCP=y -CONFIG_NET_TCP_CONNS=8 -CONFIG_NET_NTCP_READAHEAD_BUFFERS=16 -CONFIG_NET_TCPBACKLOG=n -CONFIG_NET_MAX_LISTENPORTS=8 -CONFIG_NET_UDP=y -CONFIG_NET_UDP_CHECKSUMS=y -#CONFIG_NET_UDP_CONNS=8 -CONFIG_NET_ICMP=y -CONFIG_NET_ICMP_PING=y -#CONFIG_NET_PINGADDRCONF=0 -CONFIG_NET_STATISTICS=n -#CONFIG_NET_RECEIVE_WINDOW= -#CONFIG_NET_ARPTAB_SIZE=8 -CONFIG_NET_BROADCAST=n - -# -# UIP Network Utilities -# -CONFIG_NET_DHCP_LIGHT=n -CONFIG_NET_RESOLV_ENTRIES=4 - -# -# CAN device driver settings -# -CONFIG_CAN=n -CONFIG_CAN_EXTID=n -#CONFIG_CAN_FIFOSIZE -#CONFIG_CAN_NPENDINGRTR -CONFIG_CAN_LOOPBACK=n -CONFIG_CAN_REGDEBUG=n -CONFIG_CAN1_BAUD=700000 -CONFIG_CAN2_BAUD=700000 - -# -# USB Device Configuration -# -CONFIG_USBDEV=n -CONFIG_USBDEV_ISOCHRONOUS=n -CONFIG_USBDEV_DUALSPEED=n -CONFIG_USBDEV_SELFPOWERED=y -CONFIG_USBDEV_REMOTEWAKEUP=n -CONFIG_USBDEV_MAXPOWER=100 -CONFIG_USBDEV_TRACE=n -CONFIG_USBDEV_TRACE_NRECORDS=128 - -# -# USB Host Configuration -# -CONFIG_USBHOST=n -CONFIG_USBHOST_NPREALLOC=0 -CONFIG_USBHOST_BULK_DISABLE=n -CONFIG_USBHOST_INT_DISABLE=y -CONFIG_USBHOST_ISOC_DISABLE=y - -# -# LPC17xx USB Device Configuration -# -CONFIG_LPC17_USBDEV_FRAME_INTERRUPT=n -CONFIG_LPC17_USBDEV_EPFAST_INTERRUPT=n -CONFIG_LPC17_USBDEV_DMA=n -CONFIG_LPC17_USBDEV_NDMADESCRIPTORS=0 -CONFIG_LPC17_USBDEV_DMAINTMASK=0 - -# -# LPC17xx USB Host Configuration -# -# OHCI RAM layout: -# -CONFIG_USBHOST_OHCIRAM_SIZE=1536 -CONFIG_USBHOST_NEDS=2 -CONFIG_USBHOST_NTDS=3 -CONFIG_USBHOST_TDBUFFERS=3 -CONFIG_USBHOST_TDBUFSIZE=128 -CONFIG_USBHOST_IOBUFSIZE=512 - -# -# USB Serial Device Configuration -# -CONFIG_PL2303=n -CONFIG_PL2303_EPINTIN=1 -CONFIG_PL2303_EPBULKOUT=2 -CONFIG_PL2303_EPBULKIN=5 -CONFIG_PL2303_NWRREQS=4 -CONFIG_PL2303_NRDREQS=4 -CONFIG_PL2303_VENDORID=0x067b -CONFIG_PL2303_PRODUCTID=0x2303 -CONFIG_PL2303_VENDORSTR="Nuttx" -CONFIG_PL2303_PRODUCTSTR="USBdev Serial" -CONFIG_PL2303_RXBUFSIZE=512 -CONFIG_PL2303_TXBUFSIZE=512 - -# -# USB Storage Device Configuration -# -CONFIG_USBMSC=n -CONFIG_USBMSC_EP0MAXPACKET=64 -CONFIG_USBMSC_EPBULKOUT=2 -CONFIG_USBMSC_EPBULKIN=5 -CONFIG_USBMSC_NRDREQS=2 -CONFIG_USBMSC_NWRREQS=2 -CONFIG_USBMSC_BULKINREQLEN=256 -CONFIG_USBMSC_BULKOUTREQLEN=256 -CONFIG_USBMSC_VENDORID=0x584e -CONFIG_USBMSC_VENDORSTR="NuttX" -CONFIG_USBMSC_PRODUCTID=0x5342 -CONFIG_USBMSC_PRODUCTSTR="USBdev Storage" -CONFIG_USBMSC_VERSIONNO=0x0399 -CONFIG_USBMSC_REMOVABLE=y - -# -# Settings for examples/uip -# -CONFIG_EXAMPLES_UIP_IPADDR=0x0a000002 -CONFIG_EXAMPLES_UIP_DRIPADDR=0x0a000001 -CONFIG_EXAMPLES_UIP_NETMASK=0xffffff00 -CONFIG_EXAMPLES_UIP_DHCPC=n - -# -# Settings for examples/nettest -# -CONFIG_EXAMPLES_NETTEST_SERVER=n -CONFIG_EXAMPLES_NETTEST_PERFORMANCE=n -CONFIG_EXAMPLES_NETTEST_NOMAC=y -CONFIG_EXAMPLES_NETTEST_IPADDR=0x0a000002 -CONFIG_EXAMPLES_NETTEST_DRIPADDR=0x0a000001 -CONFIG_EXAMPLES_NETTEST_NETMASK=0xffffff00 -CONFIG_EXAMPLES_NETTEST_CLIENTIP=0x0a000001 - -# -# Settings for examples/ostest -# -CONFIG_EXAMPLES_OSTEST_LOOPS=1 -CONFIG_EXAMPLES_OSTEST_STACKSIZE=2048 -CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3 - -# -# Settings for examples/buttons -# -CONFIG_EXAMPLES_BUTTONS_MIN=0 -CONFIG_EXAMPLES_BUTTONS_MAX=7 -CONFIG_EXAMPLES_IRQBUTTONS_MIN=0 -CONFIG_EXAMPLES_IRQBUTTONS_MAX=7 -CONFIG_EXAMPLES_BUTTONS_NAME0="BUT1" -CONFIG_EXAMPLES_BUTTONS_NAME1="BUT2" -CONFIG_EXAMPLES_BUTTONS_NAME2="WAKE-UP" -CONFIG_EXAMPLES_BUTTONS_NAME3="CENTER" -CONFIG_EXAMPLES_BUTTONS_NAME4="UP" -CONFIG_EXAMPLES_BUTTONS_NAME5="DOWN" -CONFIG_EXAMPLES_BUTTONS_NAME6="LEFT" -CONFIG_EXAMPLES_BUTTONS_NAME7="RIGHT" - -# -# Settings for apps/nshlib -# -CONFIG_BUILTIN=y -CONFIG_NSH_BUILTIN_APPS=y -CONFIG_NSH_FILEIOSIZE=512 -CONFIG_NSH_STRERROR=n -CONFIG_NSH_LINELEN=64 -CONFIG_NSH_NESTDEPTH=3 -CONFIG_NSH_DISABLESCRIPT=n -CONFIG_NSH_DISABLEBG=n -CONFIG_NSH_ROMFSETC=n -CONFIG_NSH_CONSOLE=y -CONFIG_NSH_TELNET=y -CONFIG_NSH_ARCHINIT=y -CONFIG_NSH_IOBUFFER_SIZE=512 -CONFIG_NSH_DHCPC=n -CONFIG_NSH_NOMAC=y -CONFIG_NSH_IPADDR=0x0a000002 -CONFIG_NSH_DRIPADDR=0x0a000001 -CONFIG_NSH_NETMASK=0xffffff00 -CONFIG_NSH_ROMFSMOUNTPT="/etc" -CONFIG_NSH_INITSCRIPT="init.d/rcS" -CONFIG_NSH_ROMFSDEVNO=0 -CONFIG_NSH_ROMFSSECTSIZE=64 -CONFIG_NSH_FATDEVNO=1 -CONFIG_NSH_FATSECTSIZE=512 -CONFIG_NSH_FATNSECTORS=1024 -CONFIG_NSH_FATMOUNTPT="/tmp" - -# -# Architecture-specific NSH options -# -CONFIG_NSH_MMCSDSPIPORTNO=1 -CONFIG_NSH_MMCSDSLOTNO=0 -CONFIG_NSH_MMCSDMINOR=0 - -# -# Settings for examples/usbserial -# -CONFIG_EXAMPLES_USBSERIAL_INONLY=n -CONFIG_EXAMPLES_USBSERIAL_OUTONLY=n -CONFIG_EXAMPLES_USBSERIAL_ONLYSMALL=n -CONFIG_EXAMPLES_USBSERIAL_ONLYBIG=n - -CONFIG_EXAMPLES_USBSERIAL_TRACEINIT=n -CONFIG_EXAMPLES_USBSERIAL_TRACECLASS=n -CONFIG_EXAMPLES_USBSERIAL_TRACETRANSFERS=n -CONFIG_EXAMPLES_USBSERIAL_TRACECONTROLLER=n -CONFIG_EXAMPLES_USBSERIAL_TRACEINTERRUPTS=n - # # Stack and heap information # -CONFIG_BOOT_RUNFROMFLASH=n -CONFIG_BOOT_COPYTORAM=n -CONFIG_CUSTOM_STACK=n CONFIG_IDLETHREAD_STACKSIZE=1024 CONFIG_USERMAIN_STACKSIZE=2048 CONFIG_PTHREAD_STACK_MIN=256 CONFIG_PTHREAD_STACK_DEFAULT=2048 -CONFIG_HEAP_BASE= -CONFIG_HEAP_SIZE= + +# +# Device Drivers +# +CONFIG_DEV_NULL=y +# CONFIG_DEV_ZERO is not set +# CONFIG_LOOP is not set +# CONFIG_RAMDISK is not set +# CONFIG_CAN is not set +# CONFIG_PWM is not set +# CONFIG_I2C is not set +CONFIG_SPI=y +# CONFIG_SPI_OWNBUS is not set +# CONFIG_SPI_EXCHANGE is not set +# CONFIG_SPI_CMDDATA is not set +# CONFIG_RTC is not set +# CONFIG_WATCHDOG is not set +# CONFIG_ANALOG is not set +# CONFIG_BCH is not set +# CONFIG_INPUT is not set +# CONFIG_LCD is not set +CONFIG_MMCSD=y +CONFIG_MMCSD_NSLOTS=1 +# CONFIG_MMCSD_READONLY is not set +# CONFIG_MMCSD_MULTIBLOCK_DISABLE is not set +# CONFIG_MMCSD_MMCSUPPORT is not set +# CONFIG_MMCSD_HAVECARDDETECT is not set +CONFIG_MMCSD_SPI=y +CONFIG_MMCSD_SPICLOCK=12500000 +# CONFIG_MMCSD_SDIO is not set +# CONFIG_MTD is not set +# CONFIG_NETDEVICES is not set +# CONFIG_NET_SLIP is not set +# CONFIG_PIPES is not set +# CONFIG_PM is not set +# CONFIG_POWER is not set +# CONFIG_SENSORS is not set +# CONFIG_SERCOMM_CONSOLE is not set +CONFIG_SERIAL=y +# CONFIG_DEV_LOWCONSOLE is not set +# CONFIG_16550_UART is not set +CONFIG_ARCH_HAVE_UART0=y +CONFIG_MCU_SERIAL=y +CONFIG_STANDARD_SERIAL=y +CONFIG_UART0_SERIAL_CONSOLE=y +# CONFIG_NO_SERIAL_CONSOLE is not set + +# +# UART0 Configuration +# +CONFIG_UART0_RXBUFSIZE=256 +CONFIG_UART0_TXBUFSIZE=256 +CONFIG_UART0_BAUD=57600 +CONFIG_UART0_BITS=8 +CONFIG_UART0_PARITY=0 +CONFIG_UART0_2STOP=0 +# CONFIG_USBDEV is not set +# CONFIG_USBHOST is not set +# CONFIG_WIRELESS is not set + +# +# System Logging Device Options +# + +# +# System Logging +# +# CONFIG_RAMLOG is not set + +# +# Networking Support +# +CONFIG_NET=y +CONFIG_ARCH_HAVE_PHY=y +CONFIG_PHY_KS8721=y +# CONFIG_PHY_DP83848C is not set +# CONFIG_PHY_LAN8720 is not set +# CONFIG_PHY_DM9161 is not set +# CONFIG_NET_NOINTS is not set +# CONFIG_NET_MULTIBUFFER is not set +# CONFIG_NET_IPv6 is not set +CONFIG_NSOCKET_DESCRIPTORS=8 +CONFIG_NET_NACTIVESOCKETS=16 +CONFIG_NET_SOCKOPTS=y +CONFIG_NET_BUFSIZE=562 +# CONFIG_NET_TCPURGDATA is not set +CONFIG_NET_TCP=y +CONFIG_NET_TCP_CONNS=8 +CONFIG_NET_MAX_LISTENPORTS=8 +CONFIG_NET_TCP_READAHEAD_BUFSIZE=562 +CONFIG_NET_NTCP_READAHEAD_BUFFERS=16 +CONFIG_NET_TCP_RECVDELAY=0 +# CONFIG_NET_TCPBACKLOG is not set +CONFIG_NET_UDP=y +CONFIG_NET_UDP_CHECKSUMS=y +CONFIG_NET_UDP_CONNS=8 +# CONFIG_NET_BROADCAST is not set +CONFIG_NET_ICMP=y +CONFIG_NET_ICMP_PING=y +# CONFIG_NET_PINGADDRCONF is not set +# CONFIG_NET_IGMP is not set +# CONFIG_NET_STATISTICS is not set +CONFIG_NET_RECEIVE_WINDOW=562 +CONFIG_NET_ARPTAB_SIZE=16 +# CONFIG_NET_ARP_IPIN is not set + +# +# File Systems +# + +# +# File system configuration +# +# CONFIG_FS_RAMMAP is not set +CONFIG_FS_FAT=y +CONFIG_FAT_LCNAMES=y +CONFIG_FAT_LFN=y +CONFIG_FAT_MAXFNAME=32 +# CONFIG_FS_FATTIME is not set +# CONFIG_FAT_DMAMEMORY is not set +# CONFIG_NFS is not set +# CONFIG_FS_NXFFS is not set +# CONFIG_FS_ROMFS is not set +# CONFIG_FS_BINFS is not set + +# +# System Logging +# +# CONFIG_SYSLOG is not set + +# +# Graphics Support +# +# CONFIG_NX is not set + +# +# Memory Management +# +# CONFIG_MM_SMALL is not set +CONFIG_MM_REGIONS=2 +# CONFIG_GRAN is not set + +# +# Binary Formats +# +# CONFIG_BINFMT_DISABLE is not set +# CONFIG_BINFMT_EXEPATH is not set +CONFIG_NXFLAT=y +# CONFIG_ELF is not set +CONFIG_BUILTIN=y +CONFIG_PIC=y +CONFIG_SYMTAB_ORDEREDBYNAME=y + +# +# Library Routines +# + +# +# Standard C Library Options +# +CONFIG_STDIO_BUFFER_SIZE=256 +CONFIG_STDIO_LINEBUFFER=y +CONFIG_NUNGET_CHARS=2 +CONFIG_LIB_HOMEDIR="/" +# CONFIG_LIBM is not set +# CONFIG_NOPRINTF_FIELDWIDTH is not set +# CONFIG_LIBC_FLOATINGPOINT is not set +# CONFIG_EOL_IS_CR is not set +# CONFIG_EOL_IS_LF is not set +# CONFIG_EOL_IS_BOTH_CRLF is not set +CONFIG_EOL_IS_EITHER_CRLF=y +# CONFIG_LIBC_EXECFUNCS is not set +# CONFIG_LIBC_STRERROR is not set +# CONFIG_LIBC_PERROR_STDOUT is not set +CONFIG_ARCH_LOWPUTC=y +CONFIG_LIB_SENDFILE_BUFSIZE=512 +# CONFIG_ARCH_ROMGETC is not set +# CONFIG_ARCH_OPTIMIZED_FUNCTIONS is not set + +# +# Non-standard Helper Functions +# +# CONFIG_LIB_KBDCODEC is not set + +# +# Basic CXX Support +# +# CONFIG_C99_BOOL8 is not set +# CONFIG_HAVE_CXX is not set + +# +# Application Configuration +# + +# +# Built-In Applications +# +CONFIG_BUILTIN_PROXY_STACKSIZE=1024 + +# +# Examples +# +# CONFIG_EXAMPLES_BUTTONS is not set +# CONFIG_EXAMPLES_CAN is not set +# CONFIG_EXAMPLES_CDCACM is not set +# CONFIG_EXAMPLES_COMPOSITE is not set +# CONFIG_EXAMPLES_DHCPD is not set +# CONFIG_EXAMPLES_ELF is not set +# CONFIG_EXAMPLES_FTPC is not set +# CONFIG_EXAMPLES_FTPD is not set +# CONFIG_EXAMPLES_HELLO is not set +# CONFIG_EXAMPLES_HELLOXX is not set +# CONFIG_EXAMPLES_JSON is not set +# CONFIG_EXAMPLES_HIDKBD is not set +# CONFIG_EXAMPLES_KEYPADTEST is not set +# CONFIG_EXAMPLES_IGMP is not set +# CONFIG_EXAMPLES_LCDRW is not set +# CONFIG_EXAMPLES_MM is not set +# CONFIG_EXAMPLES_MOUNT is not set +# CONFIG_EXAMPLES_MODBUS is not set +# CONFIG_EXAMPLES_NETTEST is not set +CONFIG_EXAMPLES_NSH=y +# CONFIG_EXAMPLES_NULL is not set +# CONFIG_EXAMPLES_NX is not set +# CONFIG_EXAMPLES_NXCONSOLE is not set +# CONFIG_EXAMPLES_NXFFS is not set +# CONFIG_EXAMPLES_NXFLAT is not set +# CONFIG_EXAMPLES_NXHELLO is not set +# CONFIG_EXAMPLES_NXIMAGE is not set +# CONFIG_EXAMPLES_NXLINES is not set +# CONFIG_EXAMPLES_NXTEXT is not set +# CONFIG_EXAMPLES_OSTEST is not set +# CONFIG_EXAMPLES_PASHELLO is not set +# CONFIG_EXAMPLES_PIPE is not set +# CONFIG_EXAMPLES_POLL is not set +# CONFIG_EXAMPLES_POSIXSPAWN is not set +# CONFIG_EXAMPLES_QENCODER is not set +# CONFIG_EXAMPLES_RGMP is not set +# CONFIG_EXAMPLES_ROMFS is not set +# CONFIG_EXAMPLES_SENDMAIL is not set +# CONFIG_EXAMPLES_SERLOOP is not set +# CONFIG_EXAMPLES_TELNETD is not set +# CONFIG_EXAMPLES_THTTPD is not set +# CONFIG_EXAMPLES_TIFF is not set +# CONFIG_EXAMPLES_TOUCHSCREEN is not set +# CONFIG_EXAMPLES_UDP is not set +# CONFIG_EXAMPLES_DISCOVER is not set +# CONFIG_EXAMPLES_UIP is not set +# CONFIG_EXAMPLES_USBSERIAL is not set +# CONFIG_EXAMPLES_USBMSC is not set +# CONFIG_EXAMPLES_USBTERM is not set +# CONFIG_EXAMPLES_WATCHDOG is not set + +# +# Interpreters +# + +# +# Interpreters +# +# CONFIG_INTERPRETERS_FICL is not set +# CONFIG_INTERPRETERS_PCODE is not set + +# +# Network Utilities +# + +# +# Networking Utilities +# +# CONFIG_NETUTILS_CODECS is not set +CONFIG_NETUTILS_DHCPC=y +# CONFIG_NETUTILS_DHCPD is not set +# CONFIG_NETUTILS_FTPC is not set +# CONFIG_NETUTILS_FTPD is not set +# CONFIG_NETUTILS_JSON is not set +CONFIG_NETUTILS_RESOLV=y +CONFIG_NET_RESOLV_ENTRIES=8 +CONFIG_NET_RESOLV_MAXRESPONSE=96 +# CONFIG_NETUTILS_SMTP is not set +CONFIG_NETUTILS_TELNETD=y +CONFIG_NETUTILS_TFTPC=y +# CONFIG_NETUTILS_THTTPD is not set +CONFIG_NETUTILS_UIPLIB=y +CONFIG_NETUTILS_WEBCLIENT=y +CONFIG_NSH_WGET_USERAGENT="NuttX/6.xx.x (; http://www.nuttx.org/)" +# CONFIG_NETUTILS_WEBSERVER is not set +# CONFIG_NETUTILS_DISCOVER is not set +# CONFIG_NETUTILS_XMLRPC is not set + +# +# ModBus +# + +# +# FreeModbus +# +# CONFIG_MODBUS is not set + +# +# NSH Library +# +CONFIG_NSH_LIBRARY=y +CONFIG_NSH_BUILTIN_APPS=y + +# +# Disable Individual commands +# +# CONFIG_NSH_DISABLE_CAT is not set +# CONFIG_NSH_DISABLE_CD is not set +# CONFIG_NSH_DISABLE_CP is not set +# CONFIG_NSH_DISABLE_DD is not set +# CONFIG_NSH_DISABLE_ECHO is not set +# CONFIG_NSH_DISABLE_EXEC is not set +# CONFIG_NSH_DISABLE_EXIT is not set +# CONFIG_NSH_DISABLE_FREE is not set +# CONFIG_NSH_DISABLE_GET is not set +# CONFIG_NSH_DISABLE_HELP is not set +# CONFIG_NSH_DISABLE_HEXDUMP is not set +# CONFIG_NSH_DISABLE_IFCONFIG is not set +# CONFIG_NSH_DISABLE_KILL is not set +# CONFIG_NSH_DISABLE_LOSETUP is not set +# CONFIG_NSH_DISABLE_LS is not set +# CONFIG_NSH_DISABLE_MB is not set +# CONFIG_NSH_DISABLE_MKDIR is not set +# CONFIG_NSH_DISABLE_MKFATFS is not set +# CONFIG_NSH_DISABLE_MKFIFO is not set +# CONFIG_NSH_DISABLE_MKRD is not set +# CONFIG_NSH_DISABLE_MH is not set +# CONFIG_NSH_DISABLE_MOUNT is not set +# CONFIG_NSH_DISABLE_MW is not set +# CONFIG_NSH_DISABLE_NSFMOUNT is not set +# CONFIG_NSH_DISABLE_PS is not set +# CONFIG_NSH_DISABLE_PING is not set +# CONFIG_NSH_DISABLE_PUT is not set +# CONFIG_NSH_DISABLE_PWD is not set +# CONFIG_NSH_DISABLE_RM is not set +# CONFIG_NSH_DISABLE_RMDIR is not set +# CONFIG_NSH_DISABLE_SET is not set +# CONFIG_NSH_DISABLE_SH is not set +# CONFIG_NSH_DISABLE_SLEEP is not set +# CONFIG_NSH_DISABLE_TEST is not set +# CONFIG_NSH_DISABLE_UMOUNT is not set +# CONFIG_NSH_DISABLE_UNSET is not set +# CONFIG_NSH_DISABLE_USLEEP is not set +# CONFIG_NSH_DISABLE_WGET is not set +# CONFIG_NSH_DISABLE_XD is not set +CONFIG_NSH_CODECS_BUFSIZE=128 +CONFIG_NSH_FILEIOSIZE=512 +CONFIG_NSH_LINELEN=64 +CONFIG_NSH_NESTDEPTH=3 +# CONFIG_NSH_DISABLESCRIPT is not set +# CONFIG_NSH_DISABLEBG is not set +CONFIG_NSH_CONSOLE=y +# CONFIG_NSH_CONDEV is not set +CONFIG_NSH_ARCHINIT=y +CONFIG_NSH_TELNET=y +CONFIG_NSH_TELNETD_PORT=23 +CONFIG_NSH_TELNETD_DAEMONPRIO=100 +CONFIG_NSH_TELNETD_DAEMONSTACKSIZE=2048 +CONFIG_NSH_TELNETD_CLIENTPRIO=100 +CONFIG_NSH_TELNETD_CLIENTSTACKSIZE=2048 +CONFIG_NSH_IOBUFFER_SIZE=512 +# CONFIG_NSH_TELNET_LOGIN is not set +CONFIG_NSH_IPADDR=0x0a000002 +CONFIG_NSH_DRIPADDR=0x0a000001 +CONFIG_NSH_NETMASK=0xffffff00 +CONFIG_NSH_NOMAC=y +CONFIG_NSH_MAX_ROUNDTRIP=20 + +# +# NxWidgets/NxWM +# + +# +# System NSH Add-Ons +# + +# +# Custom Free Memory Command +# +# CONFIG_SYSTEM_FREE is not set + +# +# I2C tool +# + +# +# FLASH Program Installation +# +# CONFIG_SYSTEM_INSTALL is not set + +# +# readline() +# +CONFIG_SYSTEM_READLINE=y +CONFIG_READLINE_ECHO=y + +# +# Power Off +# +# CONFIG_SYSTEM_POWEROFF is not set + +# +# RAMTRON +# +# CONFIG_SYSTEM_RAMTRON is not set + +# +# SD Card +# +# CONFIG_SYSTEM_SDCARD is not set + +# +# Sysinfo +# +# CONFIG_SYSTEM_SYSINFO is not set diff --git a/nuttx/drivers/mmcsd/Kconfig b/nuttx/drivers/mmcsd/Kconfig index 5cdc23bcf8..2d9a04bbbc 100644 --- a/nuttx/drivers/mmcsd/Kconfig +++ b/nuttx/drivers/mmcsd/Kconfig @@ -53,7 +53,7 @@ config MMCSD_SPICLOCK config MMCSD_SDIO bool "MMC/SD sdio transfer support" - default y + default n if MMCSD_SDIO config SDIO_DMA diff --git a/nuttx/sched/Makefile b/nuttx/sched/Makefile index 73c67239e5..38d3e047fc 100644 --- a/nuttx/sched/Makefile +++ b/nuttx/sched/Makefile @@ -35,166 +35,172 @@ -include $(TOPDIR)/Make.defs -ASRCS = -AOBJS = $(ASRCS:.S=$(OBJEXT)) +ASRCS = +AOBJS = $(ASRCS:.S=$(OBJEXT)) -MISC_SRCS = os_start.c os_bringup.c errno_getptr.c errno_get.c errno_set.c \ - sched_garbage.c sched_setupstreams.c sched_getfiles.c sched_getsockets.c \ - sched_getstreams.c sched_setupidlefiles.c sched_setuptaskfiles.c \ - sched_setuppthreadfiles.c sched_releasefiles.c +MISC_SRCS = os_start.c os_bringup.c errno_getptr.c errno_get.c errno_set.c +MISC_SRCS += sched_garbage.c sched_setupstreams.c sched_getfiles.c sched_getsockets.c +MISC_SRCS += sched_getstreams.c sched_setupidlefiles.c sched_setuptaskfiles.c +MISC_SRCS += sched_setuppthreadfiles.c sched_releasefiles.c -TSK_SRCS = prctl.c task_create.c task_init.c task_setup.c task_activate.c \ - task_start.c task_delete.c task_deletecurrent.c task_exithook.c \ - task_restart.c task_vfork.c exit.c getpid.c sched_addreadytorun.c \ - sched_removereadytorun.c sched_addprioritized.c sched_mergepending.c \ - sched_addblocked.c sched_removeblocked.c sched_free.c sched_gettcb.c \ - sched_verifytcb.c sched_releasetcb.c task_posixspawn.c +TSK_SRCS = prctl.c task_create.c task_init.c task_setup.c task_activate.c +TSK_SRCS += task_start.c task_delete.c task_deletecurrent.c task_exithook.c +TSK_SRCS += task_restart.c task_vfork.c exit.c getpid.c sched_addreadytorun.c +TSK_SRCS += sched_removereadytorun.c sched_addprioritized.c sched_mergepending.c +TSK_SRCS += sched_addblocked.c sched_removeblocked.c sched_free.c sched_gettcb.c +TSK_SRCS += sched_verifytcb.c sched_releasetcb.c -SCHED_SRCS = sched_setparam.c sched_setpriority.c sched_getparam.c \ - sched_setscheduler.c sched_getscheduler.c \ - sched_yield.c sched_rrgetinterval.c sched_foreach.c \ - sched_lock.c sched_unlock.c sched_lockcount.c sched_self.c +ifneq ($(CONFIG_BINFMT_DISABLE),y) +ifeq ($(CONFIG_LIBC_EXECFUNCS),y) +TSK_SRCS += task_posixspawn.c +endif +endif + +SCHED_SRCS = sched_setparam.c sched_setpriority.c sched_getparam.c +SCHED_SRCS += sched_setscheduler.c sched_getscheduler.c +SCHED_SRCS += sched_yield.c sched_rrgetinterval.c sched_foreach.c +SCHED_SRCS += sched_lock.c sched_unlock.c sched_lockcount.c sched_self.c ifeq ($(CONFIG_SCHED_ATEXIT),y) -SCHED_SRCS += atexit.c +SCHED_SRCS += atexit.c endif ifeq ($(CONFIG_SCHED_ONEXIT),y) -SCHED_SRCS += on_exit.c +SCHED_SRCS += on_exit.c endif ifeq ($(CONFIG_PRIORITY_INHERITANCE),y) -SCHED_SRCS += sched_reprioritize.c +SCHED_SRCS += sched_reprioritize.c endif ifeq ($(CONFIG_SCHED_HAVE_PARENT),y) -SCHED_SRCS += task_reparent.c +SCHED_SRCS += task_reparent.c endif ifeq ($(CONFIG_SCHED_WAITPID),y) -SCHED_SRCS += sched_waitpid.c +SCHED_SRCS += sched_waitpid.c ifeq ($(CONFIG_SCHED_HAVE_PARENT),y) -SCHED_SRCS += sched_waitid.c sched_wait.c +SCHED_SRCS += sched_waitid.c sched_wait.c endif endif -ENV_SRCS = env_getenvironptr.c env_dup.c env_share.c env_release.c \ - env_findvar.c env_removevar.c \ - env_clearenv.c env_getenv.c env_putenv.c env_setenv.c env_unsetenv.c +ENV_SRCS = env_getenvironptr.c env_dup.c env_share.c env_release.c +ENV_SRCS += env_findvar.c env_removevar.c +ENV_SRCS += env_clearenv.c env_getenv.c env_putenv.c env_setenv.c env_unsetenv.c -WDOG_SRCS = wd_initialize.c wd_create.c wd_start.c wd_cancel.c wd_delete.c \ - wd_gettime.c +WDOG_SRCS = wd_initialize.c wd_create.c wd_start.c wd_cancel.c wd_delete.c +WDOG_SRCS += wd_gettime.c -TIME_SRCS = sched_processtimer.c +TIME_SRCS = sched_processtimer.c ifneq ($(CONFIG_DISABLE_SIGNALS),y) -TIME_SRCS += sleep.c usleep.c +TIME_SRCS += sleep.c usleep.c endif -CLOCK_SRCS = clock_initialize.c clock_settime.c clock_gettime.c clock_getres.c \ - clock_time2ticks.c clock_abstime2ticks.c clock_ticks2time.c \ - clock_gettimeofday.c clock_systimer.c +CLOCK_SRCS = clock_initialize.c clock_settime.c clock_gettime.c clock_getres.c +CLOCK_SRCS += clock_time2ticks.c clock_abstime2ticks.c clock_ticks2time.c +CLOCK_SRCS += clock_gettimeofday.c clock_systimer.c -SIGNAL_SRCS = sig_initialize.c \ - sig_action.c sig_procmask.c sig_pending.c sig_suspend.c \ - sig_kill.c sig_queue.c sig_waitinfo.c sig_timedwait.c \ - sig_findaction.c sig_allocatependingsigaction.c \ - sig_releasependingsigaction.c sig_unmaskpendingsignal.c \ - sig_removependingsignal.c sig_releasependingsignal.c sig_lowest.c \ - sig_mqnotempty.c sig_cleanup.c sig_received.c sig_deliver.c pause.c +SIGNAL_SRCS = sig_initialize.c +SIGNAL_SRCS += sig_action.c sig_procmask.c sig_pending.c sig_suspend.c +SIGNAL_SRCS += sig_kill.c sig_queue.c sig_waitinfo.c sig_timedwait.c +SIGNAL_SRCS += sig_findaction.c sig_allocatependingsigaction.c +SIGNAL_SRCS += sig_releasependingsigaction.c sig_unmaskpendingsignal.c +SIGNAL_SRCS += sig_removependingsignal.c sig_releasependingsignal.c sig_lowest.c +SIGNAL_SRCS += sig_mqnotempty.c sig_cleanup.c sig_received.c sig_deliver.c pause.c -MQUEUE_SRCS = mq_open.c mq_close.c mq_unlink.c mq_send.c mq_timedsend.c\ - mq_sndinternal.c mq_receive.c mq_timedreceive.c mq_rcvinternal.c \ - mq_initialize.c mq_descreate.c mq_findnamed.c mq_msgfree.c mq_msgqfree.c +MQUEUE_SRCS = mq_open.c mq_close.c mq_unlink.c mq_send.c mq_timedsend.c +MQUEUE_SRCS += mq_sndinternal.c mq_receive.c mq_timedreceive.c mq_rcvinternal.c +MQUEUE_SRCS += mq_initialize.c mq_descreate.c mq_findnamed.c mq_msgfree.c mq_msgqfree.c ifneq ($(CONFIG_DISABLE_SIGNALS),y) -MQUEUE_SRCS += mq_waitirq.c +MQUEUE_SRCS += mq_waitirq.c endif ifneq ($(CONFIG_DISABLE_SIGNALS),y) -MQUEUE_SRCS += mq_notify.c +MQUEUE_SRCS += mq_notify.c endif -PTHREAD_SRCS = pthread_create.c pthread_exit.c pthread_join.c pthread_detach.c \ - pthread_yield.c pthread_getschedparam.c pthread_setschedparam.c \ - pthread_mutexinit.c pthread_mutexdestroy.c \ - pthread_mutexlock.c pthread_mutextrylock.c pthread_mutexunlock.c \ - pthread_condinit.c pthread_conddestroy.c \ - pthread_condwait.c pthread_condsignal.c pthread_condbroadcast.c \ - pthread_barrierinit.c pthread_barrierdestroy.c pthread_barrierwait.c \ - pthread_cancel.c pthread_setcancelstate.c \ - pthread_keycreate.c pthread_setspecific.c pthread_getspecific.c pthread_keydelete.c \ - pthread_initialize.c pthread_completejoin.c pthread_findjoininfo.c \ - pthread_removejoininfo.c pthread_once.c pthread_setschedprio.c +PTHREAD_SRCS = pthread_create.c pthread_exit.c pthread_join.c pthread_detach.c +PTHREAD_SRCS += pthread_yield.c pthread_getschedparam.c pthread_setschedparam.c +PTHREAD_SRCS += pthread_mutexinit.c pthread_mutexdestroy.c +PTHREAD_SRCS += pthread_mutexlock.c pthread_mutextrylock.c pthread_mutexunlock.c +PTHREAD_SRCS += pthread_condinit.c pthread_conddestroy.c +PTHREAD_SRCS += pthread_condwait.c pthread_condsignal.c pthread_condbroadcast.c +PTHREAD_SRCS += pthread_barrierinit.c pthread_barrierdestroy.c pthread_barrierwait.c +PTHREAD_SRCS += pthread_cancel.c pthread_setcancelstate.c +PTHREAD_SRCS += pthread_keycreate.c pthread_setspecific.c pthread_getspecific.c pthread_keydelete.c +PTHREAD_SRCS += pthread_initialize.c pthread_completejoin.c pthread_findjoininfo.c +PTHREAD_SRCS += pthread_removejoininfo.c pthread_once.c pthread_setschedprio.c ifneq ($(CONFIG_DISABLE_SIGNALS),y) -PTHREAD_SRCS += pthread_condtimedwait.c pthread_kill.c pthread_sigmask.c +PTHREAD_SRCS += pthread_condtimedwait.c pthread_kill.c pthread_sigmask.c endif -SEM_SRCS = sem_initialize.c sem_destroy.c sem_open.c sem_close.c sem_unlink.c \ - sem_wait.c sem_trywait.c sem_timedwait.c sem_post.c sem_findnamed.c +SEM_SRCS = sem_initialize.c sem_destroy.c sem_open.c sem_close.c sem_unlink.c +SEM_SRCS += sem_wait.c sem_trywait.c sem_timedwait.c sem_post.c sem_findnamed.c ifneq ($(CONFIG_DISABLE_SIGNALS),y) -SEM_SRCS += sem_waitirq.c +SEM_SRCS += sem_waitirq.c endif ifeq ($(CONFIG_PRIORITY_INHERITANCE),y) -SEM_SRCS += sem_holder.c +SEM_SRCS += sem_holder.c endif ifneq ($(CONFIG_DISABLE_POSIX_TIMERS),y) -TIMER_SRCS = timer_initialize.c timer_create.c timer_delete.c timer_getoverrun.c \ - timer_gettime.c timer_settime.c timer_release.c +TIMER_SRCS += timer_initialize.c timer_create.c timer_delete.c timer_getoverrun.c +TIMER_SRCS += timer_gettime.c timer_settime.c timer_release.c endif ifeq ($(CONFIG_SCHED_WORKQUEUE),y) -WORK_SRCS = work_thread.c work_queue.c work_cancel.c work_signal.c +WORK_SRCS = work_thread.c work_queue.c work_cancel.c work_signal.c endif ifeq ($(CONFIG_PAGING),y) -PGFILL_SRCS = pg_miss.c pg_worker.c +PGFILL_SRCS = pg_miss.c pg_worker.c endif -IRQ_SRCS = irq_initialize.c irq_attach.c irq_dispatch.c irq_unexpectedisr.c +IRQ_SRCS = irq_initialize.c irq_attach.c irq_dispatch.c irq_unexpectedisr.c -KMM_SRCS = kmm_initialize.c kmm_addregion.c kmm_semaphore.c \ - kmm_kmalloc.c kmm_kzalloc.c kmm_krealloc.c kmm_kfree.c +KMM_SRCS = kmm_initialize.c kmm_addregion.c kmm_semaphore.c +KMM_SRCS = kmm_kmalloc.c kmm_kzalloc.c kmm_krealloc.c kmm_kfree.c -CSRCS = $(MISC_SRCS) $(TSK_SRCS) $(SCHED_SRCS) $(WDOG_SRCS) $(TIME_SRCS) \ - $(SEM_SRCS) $(TIMER_SRCS) $(WORK_SRCS) $(PGFILL_SRCS) $(IRQ_SRCS) +CSRCS = $(MISC_SRCS) $(TSK_SRCS) $(SCHED_SRCS) $(WDOG_SRCS) $(TIME_SRCS) \ + $(SEM_SRCS) $(TIMER_SRCS) $(WORK_SRCS) $(PGFILL_SRCS) $(IRQ_SRCS) ifneq ($(CONFIG_DISABLE_CLOCK),y) -CSRCS += $(CLOCK_SRCS) +CSRCS += $(CLOCK_SRCS) endif ifneq ($(CONFIG_DISABLE_PTHREAD),y) -CSRCS += $(PTHREAD_SRCS) +CSRCS += $(PTHREAD_SRCS) endif ifneq ($(CONFIG_DISABLE_SIGNALS),y) -CSRCS += $(SIGNAL_SRCS) +CSRCS += $(SIGNAL_SRCS) endif ifneq ($(CONFIG_DISABLE_MQUEUE),y) -CSRCS += $(MQUEUE_SRCS) +CSRCS += $(MQUEUE_SRCS) endif ifneq ($(CONFIG_DISABLE_ENVIRON),y) -CSRCS += $(ENV_SRCS) +CSRCS += $(ENV_SRCS) endif ifeq ($(CONFIG_NUTTX_KERNEL),y) -CSRCS += $(KMM_SRCS) +CSRCS += $(KMM_SRCS) endif -COBJS = $(CSRCS:.c=$(OBJEXT)) +COBJS = $(CSRCS:.c=$(OBJEXT)) -SRCS = $(ASRCS) $(CSRCS) -OBJS = $(AOBJS) $(COBJS) +SRCS = $(ASRCS) $(CSRCS) +OBJS = $(AOBJS) $(COBJS) -BIN = libsched$(LIBEXT) +BIN = libsched$(LIBEXT) -all: $(BIN) +all: $(BIN) .PHONY: context depend clean distclean $(AOBJS): %$(OBJEXT): %.S diff --git a/nuttx/sched/os_internal.h b/nuttx/sched/os_internal.h index f21d9654f6..95b42c7ae3 100644 --- a/nuttx/sched/os_internal.h +++ b/nuttx/sched/os_internal.h @@ -269,7 +269,7 @@ int task_argsetup(FAR _TCB *tcb, FAR const char *name, FAR const char *argv[]); void task_exithook(FAR _TCB *tcb, int status); int task_deletecurrent(void); #ifdef CONFIG_SCHED_HAVE_PARENT -int task_reparent(pid_t oldpid, pid_t newpid, pid_t chpid); +int task_reparent(pid_t ppid, pid_t chpid); #endif #ifndef CONFIG_CUSTOM_STACK int kernel_thread(FAR const char *name, int priority, int stack_size, diff --git a/nuttx/sched/task_posixspawn.c b/nuttx/sched/task_posixspawn.c index 4201e759ba..7bb9c9a4d8 100644 --- a/nuttx/sched/task_posixspawn.c +++ b/nuttx/sched/task_posixspawn.c @@ -40,6 +40,7 @@ #include #include +#include #include #include #include @@ -431,7 +432,7 @@ static int spawn_proxy(int argc, char *argv[]) * What should we do in the event of a failure? */ - int tmp = task_reparent(0, 0, *g_ps_parms.pid); + int tmp = task_reparent(0, *g_ps_parms.pid); if (tmp < 0) { sdbg("ERROR: task_reparent() failed: %d\n", tmp); diff --git a/nuttx/sched/task_reparent.c b/nuttx/sched/task_reparent.c index 9daa0743b0..244825f804 100644 --- a/nuttx/sched/task_reparent.c +++ b/nuttx/sched/task_reparent.c @@ -60,8 +60,8 @@ * Change the parent of a task. * * Parameters: - * oldpid - PID of the old parent task (0 if this task) - * newpid - PID ot the new parent task (0 for the parent of this task) + * ppid - PID of the new parent task (0 for grandparent, i.e. the parent + * of the current parent task) * chpid - PID of the child to be reparented. * * Return Value: @@ -69,50 +69,22 @@ * *****************************************************************************/ -int task_reparent(pid_t oldpid, pid_t newpid, pid_t chpid) +int task_reparent(pid_t ppid, pid_t chpid) { - _TCB *oldtcb; - _TCB *newtcb; + _TCB *ptcb; _TCB *chtcb; + _TCB *otcb; + pid_t opid; irqstate_t flags; int ret; - /* If oldpid is zero, then we are parent task. */ - - if (oldpid == 0) - { - oldpid = getpid(); - } - - /* Get the current parent task's TCB */ - - oldtcb = sched_gettcb(oldpid); - if (!oldtcb) - { - return -ESRCH; - } - - /* Disable interrupts so that nothing can change from this point */ + /* Disable interrupts so that nothing can change in the relatinoship of + * the three task: Child, current parent, and new parent. + */ flags = irqsave(); - /* If newpid is zero, then new is the parent of oldpid. */ - - if (newpid == 0) - { - newpid = oldtcb->parent; - } - - /* Get the new parent task's TCB */ - - newtcb = sched_gettcb(newpid); - if (!newtcb) - { - ret = -ESRCH; - goto errout_with_ints; - } - - /* Get the child tasks TCB */ + /* Get the child tasks TCB (chtcb) */ chtcb = sched_gettcb(chpid); if (!chtcb) @@ -121,20 +93,45 @@ int task_reparent(pid_t oldpid, pid_t newpid, pid_t chpid) goto errout_with_ints; } - /* Verify that oldpid is the parent of chpid */ + /* Get the PID of the child task's parent (opid) */ - if (chtcb->parent != oldpid) + opid = chtcb->parent; + + /* Get the TCB of the child task's parent (otcb) */ + + otcb = sched_gettcb(opid); + if (!otcb) { - ret = -ECHILD; + ret = -ESRCH; goto errout_with_ints; } - /* Okay, reparent the child */ + /* If new parent task's PID (ppid) is zero, then new parent is the + * grandparent will be the new parent, i.e., the parent of the current + * parent task. + */ - DEBUGASSERT(oldtcb->nchildren > 0); - chtcb->parent = newpid; - oldtcb->nchildren--; - newtcb->nchildren++; + if (ppid == 0) + { + ppid = otcb->parent; + } + + /* Get the new parent task's TCB (ptcb) */ + + ptcb = sched_gettcb(ppid); + if (!ptcb) + { + ret = -ESRCH; + goto errout_with_ints; + } + + /* Then reparent the child */ + + DEBUGASSERT(otcb->nchildren > 0); + + chtcb->parent = ppid; /* The task specified by ppid is the new parent */ + otcb->nchildren--; /* The orignal parent now has one few children */ + ptcb->nchildren++; /* The new parent has one additional child */ ret = OK; errout_with_ints: From 40041c8792340b6148338cb3e3a28266fdff7373 Mon Sep 17 00:00:00 2001 From: patacongo Date: Fri, 18 Jan 2013 19:16:44 +0000 Subject: [PATCH 088/118] Refactor all lpc17xx header files (more like STM32 header file structure now) git-svn-id: http://svn.code.sf.net/p/nuttx/code/trunk@5534 42af7a65-404d-4744-a932-0658087f49c3 --- nuttx/arch/arm/include/lpc17xx/irq.h | 2 +- nuttx/arch/arm/src/lpc17xx/chip.h | 4 +- .../lpc176x_memorymap.h} | 10 +- .../arm/src/lpc17xx/chip/lpc176x_pinconfig.h | 234 +++++ .../arm/src/lpc17xx/chip/lpc178x_memorymap.h | 64 ++ .../arm/src/lpc17xx/chip/lpc178x_pinconfig.h | 72 ++ nuttx/arch/arm/src/lpc17xx/chip/lpc17_adc.h | 180 ++++ nuttx/arch/arm/src/lpc17xx/chip/lpc17_can.h | 510 +++++++++++ nuttx/arch/arm/src/lpc17xx/chip/lpc17_dac.h | 97 ++ .../arm/src/lpc17xx/chip/lpc17_ethernet.h | 597 ++++++++++++ nuttx/arch/arm/src/lpc17xx/chip/lpc17_gpdma.h | 417 +++++++++ nuttx/arch/arm/src/lpc17xx/chip/lpc17_gpio.h | 293 ++++++ nuttx/arch/arm/src/lpc17xx/chip/lpc17_i2c.h | 208 +++++ nuttx/arch/arm/src/lpc17xx/chip/lpc17_i2s.h | 62 ++ .../arm/src/lpc17xx/{ => chip}/lpc17_mcpwm.h | 12 +- .../arm/src/lpc17xx/chip/lpc17_memorymap.h | 71 ++ .../arm/src/lpc17xx/chip/lpc17_pinconfig.h | 71 ++ .../src/lpc17xx/{ => chip}/lpc17_pinconn.h | 12 +- nuttx/arch/arm/src/lpc17xx/chip/lpc17_pwm.h | 63 ++ nuttx/arch/arm/src/lpc17xx/chip/lpc17_qei.h | 190 ++++ nuttx/arch/arm/src/lpc17xx/chip/lpc17_rit.h | 92 ++ nuttx/arch/arm/src/lpc17xx/chip/lpc17_rtc.h | 270 ++++++ nuttx/arch/arm/src/lpc17xx/chip/lpc17_spi.h | 141 +++ nuttx/arch/arm/src/lpc17xx/chip/lpc17_ssp.h | 174 ++++ .../arm/src/lpc17xx/{ => chip}/lpc17_syscon.h | 12 +- nuttx/arch/arm/src/lpc17xx/chip/lpc17_timer.h | 250 +++++ .../arm/src/lpc17xx/{ => chip}/lpc17_uart.h | 678 +++++++------- .../arm/src/lpc17xx/{ => chip}/lpc17_usb.h | 12 +- nuttx/arch/arm/src/lpc17xx/chip/lpc17_wdt.h | 108 +++ nuttx/arch/arm/src/lpc17xx/lpc17_adc.c | 5 +- nuttx/arch/arm/src/lpc17xx/lpc17_adc.h | 268 ++---- .../arch/arm/src/lpc17xx/lpc17_allocateheap.c | 2 +- nuttx/arch/arm/src/lpc17xx/lpc17_can.c | 5 +- nuttx/arch/arm/src/lpc17xx/lpc17_can.h | 506 +---------- .../arch/arm/src/lpc17xx/lpc17_clockconfig.c | 4 +- .../arch/arm/src/lpc17xx/lpc17_clockconfig.h | 84 ++ nuttx/arch/arm/src/lpc17xx/lpc17_clrpend.c | 2 +- nuttx/arch/arm/src/lpc17xx/lpc17_clrpend.h | 84 ++ nuttx/arch/arm/src/lpc17xx/lpc17_dac.c | 5 +- nuttx/arch/arm/src/lpc17xx/lpc17_dac.h | 65 +- nuttx/arch/arm/src/lpc17xx/lpc17_emacram.h | 2 +- nuttx/arch/arm/src/lpc17xx/lpc17_ethernet.c | 7 +- nuttx/arch/arm/src/lpc17xx/lpc17_ethernet.h | 550 +---------- nuttx/arch/arm/src/lpc17xx/lpc17_gpdma.c | 4 +- nuttx/arch/arm/src/lpc17xx/lpc17_gpdma.h | 527 ++++------- nuttx/arch/arm/src/lpc17xx/lpc17_gpio.c | 11 +- nuttx/arch/arm/src/lpc17xx/lpc17_gpio.h | 284 +++--- nuttx/arch/arm/src/lpc17xx/lpc17_gpiodbg.c | 2 +- nuttx/arch/arm/src/lpc17xx/lpc17_gpioint.c | 3 +- nuttx/arch/arm/src/lpc17xx/lpc17_i2c.c | 9 +- nuttx/arch/arm/src/lpc17xx/lpc17_i2c.h | 150 +-- nuttx/arch/arm/src/lpc17xx/lpc17_i2s.h | 380 ++++---- nuttx/arch/arm/src/lpc17xx/lpc17_internal.h | 854 ------------------ nuttx/arch/arm/src/lpc17xx/lpc17_irq.c | 4 +- nuttx/arch/arm/src/lpc17xx/lpc17_lowputc.c | 8 +- nuttx/arch/arm/src/lpc17xx/lpc17_lowputc.h | 84 ++ nuttx/arch/arm/src/lpc17xx/lpc17_ohciram.h | 2 +- nuttx/arch/arm/src/lpc17xx/lpc17_pwm.h | 2 +- nuttx/arch/arm/src/lpc17xx/lpc17_qei.h | 132 +-- nuttx/arch/arm/src/lpc17xx/lpc17_rit.h | 34 +- nuttx/arch/arm/src/lpc17xx/lpc17_rtc.h | 332 ++----- nuttx/arch/arm/src/lpc17xx/lpc17_serial.c | 6 +- nuttx/arch/arm/src/lpc17xx/lpc17_serial.h | 6 +- nuttx/arch/arm/src/lpc17xx/lpc17_spi.c | 5 +- nuttx/arch/arm/src/lpc17xx/lpc17_spi.h | 173 ++-- nuttx/arch/arm/src/lpc17xx/lpc17_ssp.c | 5 +- nuttx/arch/arm/src/lpc17xx/lpc17_ssp.h | 347 ++++--- nuttx/arch/arm/src/lpc17xx/lpc17_start.c | 3 +- nuttx/arch/arm/src/lpc17xx/lpc17_timer.h | 312 ++----- nuttx/arch/arm/src/lpc17xx/lpc17_timerisr.c | 2 +- nuttx/arch/arm/src/lpc17xx/lpc17_usbdev.c | 9 +- nuttx/arch/arm/src/lpc17xx/lpc17_usbhost.c | 8 +- nuttx/arch/arm/src/lpc17xx/lpc17_wdt.h | 50 +- nuttx/configs/lincoln60/src/up_boot.c | 1 - nuttx/configs/lincoln60/src/up_buttons.c | 4 +- nuttx/configs/lincoln60/src/up_leds.c | 4 +- .../src/lpcxpresso_internal.h | 4 +- .../configs/lpcxpresso-lpc1768/src/up_boot.c | 2 +- .../configs/lpcxpresso-lpc1768/src/up_leds.c | 4 +- .../configs/lpcxpresso-lpc1768/src/up_oled.c | 5 +- nuttx/configs/lpcxpresso-lpc1768/src/up_ssp.c | 13 +- nuttx/configs/mbed/src/up_boot.c | 2 +- nuttx/configs/mbed/src/up_leds.c | 4 +- nuttx/configs/nucleus2g/src/up_boot.c | 2 +- nuttx/configs/nucleus2g/src/up_leds.c | 4 +- nuttx/configs/nucleus2g/src/up_outputs.c | 4 +- nuttx/configs/nucleus2g/src/up_ssp.c | 9 +- nuttx/configs/olimex-lpc1766stk/src/up_boot.c | 2 +- .../olimex-lpc1766stk/src/up_buttons.c | 2 +- nuttx/configs/olimex-lpc1766stk/src/up_can.c | 1 - nuttx/configs/olimex-lpc1766stk/src/up_lcd.c | 2 +- nuttx/configs/olimex-lpc1766stk/src/up_leds.c | 2 +- nuttx/configs/olimex-lpc1766stk/src/up_nsh.c | 4 +- nuttx/configs/olimex-lpc1766stk/src/up_ssp.c | 3 +- .../configs/olimex-lpc1766stk/src/up_usbmsc.c | 2 +- 95 files changed, 5973 insertions(+), 4350 deletions(-) rename nuttx/arch/arm/src/lpc17xx/{lpc17_memorymap.h => chip/lpc176x_memorymap.h} (96%) create mode 100644 nuttx/arch/arm/src/lpc17xx/chip/lpc176x_pinconfig.h create mode 100644 nuttx/arch/arm/src/lpc17xx/chip/lpc178x_memorymap.h create mode 100644 nuttx/arch/arm/src/lpc17xx/chip/lpc178x_pinconfig.h create mode 100644 nuttx/arch/arm/src/lpc17xx/chip/lpc17_adc.h create mode 100644 nuttx/arch/arm/src/lpc17xx/chip/lpc17_can.h create mode 100644 nuttx/arch/arm/src/lpc17xx/chip/lpc17_dac.h create mode 100644 nuttx/arch/arm/src/lpc17xx/chip/lpc17_ethernet.h create mode 100644 nuttx/arch/arm/src/lpc17xx/chip/lpc17_gpdma.h create mode 100644 nuttx/arch/arm/src/lpc17xx/chip/lpc17_gpio.h create mode 100644 nuttx/arch/arm/src/lpc17xx/chip/lpc17_i2c.h create mode 100644 nuttx/arch/arm/src/lpc17xx/chip/lpc17_i2s.h rename nuttx/arch/arm/src/lpc17xx/{ => chip}/lpc17_mcpwm.h (98%) create mode 100644 nuttx/arch/arm/src/lpc17xx/chip/lpc17_memorymap.h create mode 100644 nuttx/arch/arm/src/lpc17xx/chip/lpc17_pinconfig.h rename nuttx/arch/arm/src/lpc17xx/{ => chip}/lpc17_pinconn.h (99%) create mode 100644 nuttx/arch/arm/src/lpc17xx/chip/lpc17_pwm.h create mode 100644 nuttx/arch/arm/src/lpc17xx/chip/lpc17_qei.h create mode 100644 nuttx/arch/arm/src/lpc17xx/chip/lpc17_rit.h create mode 100644 nuttx/arch/arm/src/lpc17xx/chip/lpc17_rtc.h create mode 100644 nuttx/arch/arm/src/lpc17xx/chip/lpc17_spi.h create mode 100644 nuttx/arch/arm/src/lpc17xx/chip/lpc17_ssp.h rename nuttx/arch/arm/src/lpc17xx/{ => chip}/lpc17_syscon.h (99%) create mode 100644 nuttx/arch/arm/src/lpc17xx/chip/lpc17_timer.h rename nuttx/arch/arm/src/lpc17xx/{ => chip}/lpc17_uart.h (97%) rename nuttx/arch/arm/src/lpc17xx/{ => chip}/lpc17_usb.h (99%) create mode 100644 nuttx/arch/arm/src/lpc17xx/chip/lpc17_wdt.h create mode 100644 nuttx/arch/arm/src/lpc17xx/lpc17_clockconfig.h create mode 100644 nuttx/arch/arm/src/lpc17xx/lpc17_clrpend.h delete mode 100644 nuttx/arch/arm/src/lpc17xx/lpc17_internal.h create mode 100644 nuttx/arch/arm/src/lpc17xx/lpc17_lowputc.h diff --git a/nuttx/arch/arm/include/lpc17xx/irq.h b/nuttx/arch/arm/include/lpc17xx/irq.h index c058f63674..91875804ce 100644 --- a/nuttx/arch/arm/include/lpc17xx/irq.h +++ b/nuttx/arch/arm/include/lpc17xx/irq.h @@ -114,7 +114,7 @@ extern "C" #ifdef __cplusplus } #endif -#endif __ASSEMBLY__ +#endif /* __ASSEMBLY__ */ #endif /* __ARCH_ARM_INCLUDE_LPC17XX_IRQ_H */ diff --git a/nuttx/arch/arm/src/lpc17xx/chip.h b/nuttx/arch/arm/src/lpc17xx/chip.h index 60dda773d3..d9b3998fec 100644 --- a/nuttx/arch/arm/src/lpc17xx/chip.h +++ b/nuttx/arch/arm/src/lpc17xx/chip.h @@ -1,7 +1,7 @@ /************************************************************************************ * arch/arm/src/lpc17xx/chip.h * - * Copyright (C) 2010-2011 Gregory Nutt. All rights reserved. + * Copyright (C) 2010-2011, 2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -47,7 +47,7 @@ * file for the proper setup */ -#include "lpc17_memorymap.h" +#include "chip/lpc17_memorymap.h" /************************************************************************************ * Pre-processor Definitions diff --git a/nuttx/arch/arm/src/lpc17xx/lpc17_memorymap.h b/nuttx/arch/arm/src/lpc17xx/chip/lpc176x_memorymap.h similarity index 96% rename from nuttx/arch/arm/src/lpc17xx/lpc17_memorymap.h rename to nuttx/arch/arm/src/lpc17xx/chip/lpc176x_memorymap.h index ae66b684cb..094a47788f 100644 --- a/nuttx/arch/arm/src/lpc17xx/lpc17_memorymap.h +++ b/nuttx/arch/arm/src/lpc17xx/chip/lpc176x_memorymap.h @@ -1,7 +1,7 @@ /************************************************************************************ - * arch/arm/src/lpc17xx/lpc17_memorymap.h + * arch/arm/src/lpc17xx/lpc176x_memorymap.h * - * Copyright (C) 2010 Gregory Nutt. All rights reserved. + * Copyright (C) 2010, 2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -33,8 +33,8 @@ * ************************************************************************************/ -#ifndef __ARCH_ARM_SRC_LPC17XX_LPC17_MEMORYMAP_H -#define __ARCH_ARM_SRC_LPC17XX_LPC17_MEMORYMAP_H +#ifndef __ARCH_ARM_SRC_LPC17XX_LPC176X_MEMORYMAP_H +#define __ARCH_ARM_SRC_LPC17XX_LPC176X_MEMORYMAP_H /************************************************************************************ * Included Files @@ -133,4 +133,4 @@ * Public Functions ************************************************************************************/ -#endif /* __ARCH_ARM_SRC_LPC17XX_LPC17_MEMORYMAP_H */ +#endif /* __ARCH_ARM_SRC_LPC17XX_LPC176X_MEMORYMAP_H */ diff --git a/nuttx/arch/arm/src/lpc17xx/chip/lpc176x_pinconfig.h b/nuttx/arch/arm/src/lpc17xx/chip/lpc176x_pinconfig.h new file mode 100644 index 0000000000..fb0c7c7000 --- /dev/null +++ b/nuttx/arch/arm/src/lpc17xx/chip/lpc176x_pinconfig.h @@ -0,0 +1,234 @@ +/************************************************************************************ + * arch/arm/src/lpc17xx/chip/lp176x_pinconfig.h + * + * Copyright (C) 2009-2011, 2013 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * 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. + * + ************************************************************************************/ + +#ifndef __ARCH_ARM_SRC_LPC17XX_CHIP_LPC176X_PINCONFIG_H +#define __ARCH_ARM_SRC_LPC17XX_CHIP_LPC176X_PINCONFIG_H + +/************************************************************************************ + * Included Files + ************************************************************************************/ + +#include + +/************************************************************************************ + * Definitions + ************************************************************************************/ +/* GPIO pin definitions *************************************************************/ +/* NOTE that functions have a alternate pins that can be selected. These alternates + * are identified with a numerica suffix like _1, _2, or _3. Your board.h file + * should select the correct alternative for your board by including definitions + * such as: + * + * #define GPIO_UART1_RXD GPIO_UART1_RXD_1 + * + * (without the suffix) + */ + +#define GPIO_CAN1_RD_1 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN0) +#define GPIO_UART3_TXD_1 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN0) +#define GPIO_I2C1_SDA_1 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN0) +#define GPIO_CAN1_TD_1 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN1) +#define GPIO_UART3_RXD_1 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN1) +#define GPIO_I2C1_SCL_1 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN1) +#define GPIO_UART0_TXD (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN2) +#define GPIO_AD0p7 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN2) +#define GPIO_UART0_RXD (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN3) +#define GPIO_AD0p6 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN3) +#define GPIO_I2S_RXCLK_1 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN4) +#define GPIO_CAN2_RD (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN4) +#define GPIO_CAP2p0 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN4) +#define GPIO_I2S_RXWS_1 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN5) +#define GPIO_CAN2_TD (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN5) +#define GPIO_CAP2p1 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN5) +#define GPIO_I2S_RXSDA_1 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN6) +#define GPIO_SSP1_SSEL (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN6) +#define GPIO_MAT2p0_1 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN6) +#define GPIO_I2S_TXCLK_1 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN7) +#define GPIO_SSP1_SCK_1 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN7) +#define GPIO_MAT2p1_1 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN7) +#define GPIO_I2S_TXWS_1 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN8) +#define GPIO_SSP1_MISO (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN8) +#define GPIO_MAT2p2 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN8) +#define GPIO_I2S_TXSDA_1 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN9) +#define GPIO_SSP1_MOSI (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN9) +#define GPIO_MAT2p3 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN9) +#define GPIO_UART2_TXD_1 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN10) +#define GPIO_I2C2_SDA (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN10) +#define GPIO_MAT3p0 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN10) +#define GPIO_UART2_RXD_1 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN11) +#define GPIO_I2C2_SCL (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN11) +#define GPIO_MAT3p1 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN11) +#define GPIO_UART1_TXD_1 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN15) +#define GPIO_SSP0_SCK_1 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN15) +#define GPIO_SPI_SCK (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN15) +#define GPIO_UART1_RXD_1 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN16) +#define GPIO_SSP0_SSEL_1 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN16) +#define GPIO_SPI_SSEL (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN16) +#define GPIO_UART1_CTS_1 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN17) +#define GPIO_SSP0_MISO_1 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN17) +#define GPIO_SPI_MISO (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN17) +#define GPIO_UART1_DCD_1 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN18) +#define GPIO_SSP0_MOSI_1 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN18) +#define GPIO_SPI_MOSI (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN18) +#define GPIO_UART1_DSR_1 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN19) +#define GPIO_I2C1_SDA_2 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN19) +#define GPIO_UART1_DTR_1 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN20) +#define GPIO_I2C1_SCL_2 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN20) +#define GPIO_UART1_RI_1 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN21) +#define GPIO_CAN1_RD_2 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN21) +#define GPIO_UART1_RTS_1 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN22) +#define GPIO_CAN1_TD_2 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN22) +#define GPIO_AD0p0 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN23) +#define GPIO_I2S_RXCLK_2 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN23) +#define GPIO_CAP3p0 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN23) +#define GPIO_AD0p1 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN24) +#define GPIO_I2S_RXWS_2 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN24) +#define GPIO_CAP3p1 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN24) +#define GPIO_AD0p2 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN25) +#define GPIO_I2S_RXSDA_2 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN25) +#define GPIO_UART3_TXD_2 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN25) +#define GPIO_AD0p3 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN26) +#define GPIO_AOUT (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN26) +#define GPIO_UART3_RXD_2 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN26) +#define GPIO_I2C0_SDA (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN27) +#define GPIO_USB_SDA (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN27) +#define GPIO_I2C0_SCL (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN28) +#define GPIO_USB_SCL (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN28) +#define GPIO_USB_DP (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN29) +#define GPIO_USB_DM (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN30) +#define GPIO_ENET_TXD0 (GPIO_ALT1 | GPIO_FLOAT | GPIO_PORT1 | GPIO_PIN0) +#define GPIO_ENET_TXD1 (GPIO_ALT1 | GPIO_FLOAT | GPIO_PORT1 | GPIO_PIN1) +#define GPIO_ENET_TXEN (GPIO_ALT1 | GPIO_FLOAT | GPIO_PORT1 | GPIO_PIN4) +#define GPIO_ENET_CRS (GPIO_ALT1 | GPIO_FLOAT | GPIO_PORT1 | GPIO_PIN8) +#define GPIO_ENET_RXD0 (GPIO_ALT1 | GPIO_FLOAT | GPIO_PORT1 | GPIO_PIN9) +#define GPIO_ENET_RXD1 (GPIO_ALT1 | GPIO_FLOAT | GPIO_PORT1 | GPIO_PIN10) +#define GPIO_ENET_RXER (GPIO_ALT1 | GPIO_FLOAT | GPIO_PORT1 | GPIO_PIN14) +#define GPIO_ENET_REFCLK (GPIO_ALT1 | GPIO_FLOAT | GPIO_PORT1 | GPIO_PIN15) +#define GPIO_ENET_MDC_1 (GPIO_ALT1 | GPIO_FLOAT | GPIO_PORT1 | GPIO_PIN16) +#define GPIO_ENET_MDIO_1 (GPIO_ALT1 | GPIO_FLOAT | GPIO_PORT1 | GPIO_PIN17) +#define GPIO_USB_UPLED (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN18) +#define GPIO_PWM1p1_1 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN18) +#define GPIO_CAP1p0 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN18) +#define GPIO_MCPWM_MCOA0 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN19) +#define GPIO_USB_PPWR (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN19) +#define GPIO_CAP1p1 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN19) +#define GPIO_MCPWM_MCI0 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN20) +#define GPIO_PWM1p2_1 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN20) +#define GPIO_SSP0_SCK_2 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN20) +#define GPIO_MCPWM_MCABORT (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN21) +#define GPIO_PWM1p3_1 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN21) +#define GPIO_SSP0_SSEL_2 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN21) +#define GPIO_MCPWM_MCOB0 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN22) +#define GPIO_USB_PWRD (GPIO_ALT2 | GPIO_PULLDN | GPIO_PORT1 | GPIO_PIN22) +#define GPIO_MAT1p0 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN22) +#define GPIO_MCPWM_MCI1 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN23) +#define GPIO_PWM1p4_1 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN23) +#define GPIO_SSP0_MISO_2 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN23) +#define GPIO_MCPWM_MCI2 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN24) +#define GPIO_PWM1p5_1 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN24) +#define GPIO_SSP0_MOSI_2 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN24) +#define GPIO_MCPWM_MCOA1 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN25) +#define GPIO_MAT1p1 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN25) +#define GPIO_MCPWM_MCOB1 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN26) +#define GPIO_PWM1p6_1 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN26) +#define GPIO_CAP0p0 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN26) +#define GPIO_CLKOUT (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN27) +#define GPIO_USB_OVRCR (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN27) +#define GPIO_CAP0p1 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN27) +#define GPIO_MCPWM_MCOA2 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN28) +#define GPIO_PCAP1p0_1 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN28) +#define GPIO_MAT0p0_1 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN28) +#define GPIO_MCPWM_MCOB2 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN29) +#define GPIO_PCAP1p1 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN29) +#define GPIO_MAT0p1_1 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN29) +#define GPIO_USB_VBUS (GPIO_ALT2 | GPIO_FLOAT | GPIO_PORT1 | GPIO_PIN30) +#define GPIO_AD0p4 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN30) +#define GPIO_SSP1_SCK_2 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN31) +#define GPIO_AD0p5 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN31) +#define GPIO_PWM1p1_2 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN0) +#define GPIO_UART1_TXD_2 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN0) +#define GPIO_PWM1p2_2 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN1) +#define GPIO_UART1_RXD_2 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN1) +#define GPIO_PWM1p3_2 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN2) +#define GPIO_UART1_CTS_2 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN2) +#define GPIO_PWM1p4_2 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN3) +#define GPIO_UART1_DCD_2 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN3) +#define GPIO_PWM1p5_2 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN4) +#define GPIO_UART1_DSR_2 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN4) +#define GPIO_PWM1p6_2 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN5) +#define GPIO_UART1_DTR_2 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN5) +#define GPIO_PCAP1p0_2 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN6) +#define GPIO_UART1_RI_2 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN6) +#define GPIO_CAN2_RD_2 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN7) +#define GPIO_UART1_RTS_2 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN7) +#define GPIO_CAN2_TD_2 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN8) +#define GPIO_UART2_TXD_2 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN8) +#define GPIO_ENET_MDC_2 (GPIO_ALT3 | GPIO_FLOAT | GPIO_PORT2 | GPIO_PIN8) +#define GPIO_USB_CONNECT (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN9) +#define GPIO_UART2_RXD_2 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN9) +#define GPIO_ENET_MDIO_2 (GPIO_ALT3 | GPIO_FLOAT | GPIO_PORT2 | GPIO_PIN9) +#define GPIO_EINT0 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN10) +#define GPIO_NMI (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN10) +#define GPIO_EINT1 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN11) +#define GPIO_I2S_TXCLK_2 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN11) +#define GPIO_PEINT2 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN12) +#define GPIO_I2S_TXWS_2 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN12) +#define GPIO_EINT3 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN13) +#define GPIO_I2S_TXSDA_2 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN13) +#define GPIO_MAT0p0_2 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT3 | GPIO_PIN25) +#define GPIO_PWM1p2_3 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT3 | GPIO_PIN25) +#define GPIO_STCLK (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT3 | GPIO_PIN26) +#define GPIO_MAT0p1_2 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT3 | GPIO_PIN26) +#define GPIO_PWM1p3_3 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT3 | GPIO_PIN26) +#define GPIO_RXMCLK (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT4 | GPIO_PIN28) +#define GPIO_MAT2p0_2 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT4 | GPIO_PIN28) +#define GPIO_UART3_TXD_3 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT4 | GPIO_PIN28) +#define GPIO_TXMCLK (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT4 | GPIO_PIN29) +#define GPIO_MAT2p1_2 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT4 | GPIO_PIN29) +#define GPIO_UART3_RXD_3 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT4 | GPIO_PIN29) + +/************************************************************************************ + * Public Types + ************************************************************************************/ + +/************************************************************************************ + * Public Data + ************************************************************************************/ + +/************************************************************************************ + * Public Function Prototypes + ************************************************************************************/ + + #endif /* __ARCH_ARM_SRC_LPC17XX_CHIP_LPC176X_PINCONFIG_H */ diff --git a/nuttx/arch/arm/src/lpc17xx/chip/lpc178x_memorymap.h b/nuttx/arch/arm/src/lpc17xx/chip/lpc178x_memorymap.h new file mode 100644 index 0000000000..21e8e6c339 --- /dev/null +++ b/nuttx/arch/arm/src/lpc17xx/chip/lpc178x_memorymap.h @@ -0,0 +1,64 @@ +/************************************************************************************ + * arch/arm/src/lpc17xx/lpc178x_memorymap.h + * + * Copyright (C) 2013 Gregory Nutt. All rights reserved. + * Authors: Rommel Marcelo + * Gregory Nutt + * + * 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. + * + ************************************************************************************/ + +#ifndef __ARCH_ARM_SRC_LPC17XX_LPC178X_MEMORYMAP_H +#define __ARCH_ARM_SRC_LPC17XX_LPC178X_MEMORYMAP_H + +/************************************************************************************ + * Included Files + ************************************************************************************/ + +#include + +#include "chip.h" + +/************************************************************************************ + * Pre-processor Definitions + ************************************************************************************/ + +/************************************************************************************ + * Public Types + ************************************************************************************/ + +/************************************************************************************ + * Public Data + ************************************************************************************/ + +/************************************************************************************ + * Public Functions + ************************************************************************************/ + +#endif /* __ARCH_ARM_SRC_LPC17XX_LPC178X_MEMORYMAP_H */ diff --git a/nuttx/arch/arm/src/lpc17xx/chip/lpc178x_pinconfig.h b/nuttx/arch/arm/src/lpc17xx/chip/lpc178x_pinconfig.h new file mode 100644 index 0000000000..53c2b26a9f --- /dev/null +++ b/nuttx/arch/arm/src/lpc17xx/chip/lpc178x_pinconfig.h @@ -0,0 +1,72 @@ +/************************************************************************************ + * arch/arm/src/lpc17xx/chip/lp178x_pinconfig.h + * + * Copyright (C) 2013 Gregory Nutt. All rights reserved. + * Authors: Rommel Marcelo + * Gregory Nutt + * + * 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. + * + ************************************************************************************/ + +#ifndef __ARCH_ARM_SRC_LPC17XX_CHIP_LPC178X_PINCONFIG_H +#define __ARCH_ARM_SRC_LPC17XX_CHIP_LPC178X_PINCONFIG_H + +/************************************************************************************ + * Included Files + ************************************************************************************/ + +#include + +/************************************************************************************ + * Definitions + ************************************************************************************/ +/* GPIO pin definitions *************************************************************/ +/* NOTE that functions have a alternate pins that can be selected. These alternates + * are identified with a numerica suffix like _1, _2, or _3. Your board.h file + * should select the correct alternative for your board by including definitions + * such as: + * + * #define GPIO_UART1_RXD GPIO_UART1_RXD_1 + * + * (without the suffix) + */ + +/************************************************************************************ + * Public Types + ************************************************************************************/ + +/************************************************************************************ + * Public Data + ************************************************************************************/ + +/************************************************************************************ + * Public Function Prototypes + ************************************************************************************/ + + #endif /* __ARCH_ARM_SRC_LPC17XX_CHIP_LPC178X_PINCONFIG_H */ diff --git a/nuttx/arch/arm/src/lpc17xx/chip/lpc17_adc.h b/nuttx/arch/arm/src/lpc17xx/chip/lpc17_adc.h new file mode 100644 index 0000000000..8cec0d3250 --- /dev/null +++ b/nuttx/arch/arm/src/lpc17xx/chip/lpc17_adc.h @@ -0,0 +1,180 @@ +/************************************************************************************ + * arch/arm/src/lpc17xx/chip/lpc17_adc.h + * + * Copyright (C) 2010, 2012, 2013 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * 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. + * + ************************************************************************************/ + +#ifndef __ARCH_ARM_SRC_LPC17XX_LPC17_CHIP_ADC_H +#define __ARCH_ARM_SRC_LPC17XX_LPC17_CHIP_ADC_H + +/************************************************************************************ + * Included Files + ************************************************************************************/ + +#include + +#include "chip.h" +#include "chip/lpc17_memorymap.h" + +/************************************************************************************ + * Pre-processor Definitions + ************************************************************************************/ + +/* Register offsets *****************************************************************/ + +#define LPC17_ADC_CR_OFFSET 0x0000 /* A/D Control Register */ +#define LPC17_ADC_GDR_OFFSET 0x0004 /* A/D Global Data Register */ +#define LPC17_ADC_INTEN_OFFSET 0x000c /* A/D Interrupt Enable Register */ + +#define LPC17_ADC_DR_OFFSET(n) (0x0010+((n) << 2)) +#define LPC17_ADC_DR0_OFFSET 0x0010 /* A/D Channel 0 Data Register */ +#define LPC17_ADC_DR1_OFFSET 0x0014 /* A/D Channel 1 Data Register */ +#define LPC17_ADC_DR2_OFFSET 0x0018 /* A/D Channel 2 Data Register */ +#define LPC17_ADC_DR3_OFFSET 0x001c /* A/D Channel 3 Data Register */ +#define LPC17_ADC_DR4_OFFSET 0x0020 /* A/D Channel 4 Data Register */ +#define LPC17_ADC_DR5_OFFSET 0x0024 /* A/D Channel 5 Data Register */ +#define LPC17_ADC_DR6_OFFSET 0x0028 /* A/D Channel 6 Data Register */ +#define LPC17_ADC_DR7_OFFSET 0x002c /* A/D Channel 7 Data Register */ + +#define LPC17_ADC_STAT_OFFSET 0x0030 /* A/D Status Register */ +#define LPC17_ADC_TRM_OFFSET 0x0034 /* ADC trim register */ + +/* Register addresses ***************************************************************/ + +#define LPC17_ADC_CR (LPC17_ADC_BASE+LPC17_ADC_CR_OFFSET) +#define LPC17_ADC_GDR (LPC17_ADC_BASE+LPC17_ADC_GDR_OFFSET) +#define LPC17_ADC_INTEN (LPC17_ADC_BASE+LPC17_ADC_INTEN_OFFSET) + +#define LPC17_ADC_DR(n) (LPC17_ADC_BASE+LPC17_ADC_DR_OFFSET(n)) +#define LPC17_ADC_DR0 (LPC17_ADC_BASE+LPC17_ADC_DR0_OFFSET) +#define LPC17_ADC_DR1 (LPC17_ADC_BASE+LPC17_ADC_DR1_OFFSET) +#define LPC17_ADC_DR2 (LPC17_ADC_BASE+LPC17_ADC_DR2_OFFSET) +#define LPC17_ADC_DR3 (LPC17_ADC_BASE+LPC17_ADC_DR3_OFFSET) +#define LPC17_ADC_DR4 (LPC17_ADC_BASE+LPC17_ADC_DR4_OFFSET) +#define LPC17_ADC_DR5 (LPC17_ADC_BASE+LPC17_ADC_DR5_OFFSET) +#define LPC17_ADC_DR6 (LPC17_ADC_BASE+LPC17_ADC_DR6_OFFSET) +#define LPC17_ADC_DR7 (LPC17_ADC_BASE+LPC17_ADC_DR7_OFFSET) + +#define LPC17_ADC_STAT (LPC17_ADC_BASE+LPC17_ADC_STAT_OFFSET) +#define LPC17_ADC_TRM (LPC17_ADC_BASE+LPC17_ADC_TRM_OFFSET) + +/* Register bit definitions *********************************************************/ + +/* A/D Control Register */ + +#define ADC_CR_SEL_SHIFT (0) /* Bits 0-7: Selects pins to be sampled */ +#define ADC_CR_SEL_MASK (0xff << ADC_CR_SEL_MASK) +#define ADC_CR_CLKDIV_SHIFT (8) /* Bits 8-15: APB clock (PCLK_ADC0) divisor */ +#define ADC_CR_CLKDIV_MASK (0xff << ADC_CR_CLKDIV_SHIFT) +#define ADC_CR_BURST (1 << 16) /* Bit 16: A/D Repeated conversions */ + /* Bits 17-20: Reserved */ +#define ADC_CR_PDN (1 << 21) /* Bit 21: A/D converter power-down mode */ + /* Bits 22-23: Reserved */ +#define ADC_CR_START_SHIFT (24) /* Bits 24-26: Control A/D conversion start */ +#define ADC_CR_START_MASK (7 << ADC_CR_START_SHIFT) +# define ADC_CR_START_NOSTART (0 << ADC_CR_START_SHIFT) /* No start */ +# define ADC_CR_START_NOW (1 << ADC_CR_START_SHIFT) /* Start now */ +# define ADC_CR_START_P2p10 (2 << ADC_CR_START_SHIFT) /* Start edge on P2.10/EINT0/NMI */ +# define ADC_CR_START_P1p27 (3 << ADC_CR_START_SHIFT) /* Start edge on P1.27/CLKOUT/USB_OVRCRn/CAP0.1 */ +# define ADC_CR_START_MAT0p1 (4 << ADC_CR_START_SHIFT) /* Start edge on MAT0.1 */ +# define ADC_CR_START_MAT0p3 (5 << ADC_CR_START_SHIFT) /* Start edge on MAT0.3 */ +# define ADC_CR_START_MAT1p0 (6 << ADC_CR_START_SHIFT) /* Start edge on MAT1.0 */ +# define ADC_CR_START_MAT1p1 (7 << ADC_CR_START_SHIFT) /* Start edge on MAT1.1 */ +#define ADC_CR_EDGE (1 << 27) /* Bit 27: Start on falling edge */ + /* Bits 28-31: Reserved */ +/* A/D Global Data Register AND Channel 0-7 Data Register */ + /* Bits 0-3: Reserved */ +#define ADC_DR_RESULT_SHIFT (4) /* Bits 4-15: Result of conversion (DONE==1) */ +#define ADC_DR_RESULT_MASK (0x0fff << ADC_DR_RESULT_SHIFT) + /* Bits 16-23: Reserved */ +#define ADC_DR_CHAN_SHIFT (24) /* Bits 24-26: Channel converted */ +#define ADC_DR_CHAN_MASK (3 << ADC_DR_CHN_SHIFT) + /* Bits 27-29: Reserved */ +#define ADC_DR_OVERRUN (1 << 30) /* Bit 30: Conversion(s) lost/overwritten*/ +#define ADC_DR_DONE (1 << 31) /* Bit 31: A/D conversion complete*/ + +/* A/D Interrupt Enable Register */ + +#define ADC_INTEN_CHAN(n) (1 << (n)) +#define ADC_INTEN_CHAN0 (1 << 0) /* Bit 0: Enable ADC chan 0 complete intterrupt */ +#define ADC_INTEN_CHAN1 (1 << 1) /* Bit 1: Enable ADC chan 1 complete interrupt */ +#define ADC_INTEN_CHAN2 (1 << 2) /* Bit 2: Enable ADC chan 2 complete interrupt */ +#define ADC_INTEN_CHAN3 (1 << 3) /* Bit 3: Enable ADC chan 3 complete interrupt */ +#define ADC_INTEN_CHAN4 (1 << 4) /* Bit 4: Enable ADC chan 4 complete interrupt */ +#define ADC_INTEN_CHAN5 (1 << 5) /* Bit 5: Enable ADC chan 5 complete interrupt */ +#define ADC_INTEN_CHAN6 (1 << 6) /* Bit 6: Enable ADC chan 6 complete interrupt */ +#define ADC_INTEN_CHAN7 (1 << 7) /* Bit 7: Enable ADC chan 7 complete interrupt */ +#define ADC_INTEN_GLOBAL (1 << 8) /* Bit 8: Only the global DONE generates interrupt */ + /* Bits 9-31: Reserved */ +/* A/D Status Register */ + +#define ADC_STAT_DONE(n) (1 << (n)) +#define ADC_STAT_DONE0 (1 << 0) /* Bit 0: A/D chan 0 DONE */ +#define ADC_STAT_DONE1 (1 << 1) /* Bit 1: A/D chan 1 DONE */ +#define ADC_STAT_DONE2 (1 << 2) /* Bit 2: A/D chan 2 DONE */ +#define ADC_STAT_DONE3 (1 << 3) /* Bit 3: A/D chan 3 DONE */ +#define ADC_STAT_DONE4 (1 << 4) /* Bit 4: A/D chan 4 DONE */ +#define ADC_STAT_DONE5 (1 << 5) /* Bit 5: A/D chan 5 DONE */ +#define ADC_STAT_DONE6 (1 << 6) /* Bit 6: A/D chan 6 DONE */ +#define ADC_STAT_DONE7 (1 << 7) /* Bit 7: A/D chan 7 DONE */ +#define ADC_STAT_OVERRUN(n) ((1 << (n)) + 8) +#define ADC_STAT_OVERRUN0 (1 << 8) /* Bit 8: A/D chan 0 OVERRUN */ +#define ADC_STAT_OVERRUN1 (1 << 9) /* Bit 9: A/D chan 1 OVERRUN */ +#define ADC_STAT_OVERRUN2 (1 << 10) /* Bit 10: A/D chan 2 OVERRUN */ +#define ADC_STAT_OVERRUN3 (1 << 11) /* Bit 11: A/D chan 3 OVERRUN */ +#define ADC_STAT_OVERRUN4 (1 << 12) /* Bit 12: A/D chan 4 OVERRUN */ +#define ADC_STAT_OVERRUN5 (1 << 13) /* Bit 13: A/D chan 5 OVERRUN */ +#define ADC_STAT_OVERRUN6 (1 << 14) /* Bit 14: A/D chan 6 OVERRUN */ +#define ADC_STAT_OVERRUN7 (1 << 15) /* Bit 15: A/D chan 7 OVERRUN */ +#define ADC_STAT_INT (1 << 16) /* Bit 15: A/D interrupt */ + /* Bits 17-31: Reserved */ +/* ADC trim register */ + /* Bits 0-3: Reserved */ +#define ADC_TRM_ADCOFFS_SHIFT (4) /* Bits 4-7: A/D offset trim bits */ +#define ADC_TRM_ADCOFFS_MASK (15 << ADC_TRM_ADCOFFS_SHIFT) +#define ADC_TRM_TRIM_SHIFT (8) /* Bits 8-11: Written-to by boot code */ +#define ADC_TRM_TRIM_MASK (15 << ADC_TRM_TRIM_SHIFT) + /* Bits 12-31: Reserved */ + +/************************************************************************************ + * Public Types + ************************************************************************************/ + +/************************************************************************************ + * Public Data + ************************************************************************************/ + +/************************************************************************************ + * Public Functions + ************************************************************************************/ + +#endif /* __ARCH_ARM_SRC_LPC17XX_LPC17_CHIP_ADC_H */ diff --git a/nuttx/arch/arm/src/lpc17xx/chip/lpc17_can.h b/nuttx/arch/arm/src/lpc17xx/chip/lpc17_can.h new file mode 100644 index 0000000000..84b019d619 --- /dev/null +++ b/nuttx/arch/arm/src/lpc17xx/chip/lpc17_can.h @@ -0,0 +1,510 @@ +/************************************************************************************ + * arch/arm/src/lpc17xx/chip/lpc17_can.h + * + * Copyright (C) 2010-2012, 2013 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * 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. + * + ************************************************************************************/ + +#ifndef __ARCH_ARM_SRC_LPC17XX_LPC17_CHIP_CAN_H +#define __ARCH_ARM_SRC_LPC17XX_LPC17_CHIP_CAN_H + +/************************************************************************************ + * Included Files + ************************************************************************************/ + +#include + +#include "chip.h" +#include "chip/lpc17_memorymap.h" + +/************************************************************************************ + * Pre-processor Definitions + ************************************************************************************/ + +/* Register offsets *****************************************************************/ +/* CAN acceptance filter registers */ + +#define LPC17_CANAF_AFMR_OFFSET 0x0000 /* Acceptance Filter Register */ +#define LPC17_CANAF_SFFSA_OFFSET 0x0004 /* Standard Frame Individual Start Address Register */ +#define LPC17_CANAF_SFFGRPSA_OFFSET 0x0008 /* Standard Frame Group Start Address Register */ +#define LPC17_CANAF_EFFSA_OFFSET 0x000c /* Extended Frame Start Address Register */ +#define LPC17_CANAF_EFFGRPSA_OFFSET 0x0010 /* Extended Frame Group Start Address Register */ +#define LPC17_CANAF_EOT_OFFSET 0x0014 /* End of AF Tables register */ +#define LPC17_CANAF_LUTERRAD_OFFSET 0x0018 /* LUT Error Address register */ +#define LPC17_CANAF_LUTERR_OFFSET 0x001c /* LUT Error Register */ +#define LPC17_CANAF_FCANIE_OFFSET 0x0020 /* FullCAN interrupt enable register */ +#define LPC17_CANAF_FCANIC0_OFFSET 0x0024 /* FullCAN interrupt and capture register 0 */ +#define LPC17_CANAF_FCANIC1_OFFSET 0x0028 /* FullCAN interrupt and capture register 1 */ + +/* Central CAN registers */ + +#define LPC17_CAN_TXSR_OFFSET 0x0000 /* CAN Central Transmit Status Register */ +#define LPC17_CAN_RXSR_OFFSET 0x0004 /* CAN Central Receive Status Register */ +#define LPC17_CAN_MSR_OFFSET 0x0008 /* CAN Central Miscellaneous Register */ + +/* CAN1/2 registers */ + +#define LPC17_CAN_MOD_OFFSET 0x0000 /* CAN operating mode */ +#define LPC17_CAN_CMR_OFFSET 0x0004 /* Command bits */ +#define LPC17_CAN_GSR_OFFSET 0x0008 /* Controller Status and Error Counters */ +#define LPC17_CAN_ICR_OFFSET 0x000c /* Interrupt and capure register */ +#define LPC17_CAN_IER_OFFSET 0x0010 /* Interrupt Enable */ +#define LPC17_CAN_BTR_OFFSET 0x0014 /* Bus Timing */ +#define LPC17_CAN_EWL_OFFSET 0x0018 /* Error Warning Limit */ +#define LPC17_CAN_SR_OFFSET 0x001c /* Status Register */ +#define LPC17_CAN_RFS_OFFSET 0x0020 /* Receive frame status */ +#define LPC17_CAN_RID_OFFSET 0x0024 /* Received Identifier */ +#define LPC17_CAN_RDA_OFFSET 0x0028 /* Received data bytes 1-4 */ +#define LPC17_CAN_RDB_OFFSET 0x002c /* Received data bytes 5-8 */ +#define LPC17_CAN_TFI1_OFFSET 0x0030 /* Transmit frame info (Tx Buffer 1) */ +#define LPC17_CAN_TID1_OFFSET 0x0034 /* Transmit Identifier (Tx Buffer 1) */ +#define LPC17_CAN_TDA1_OFFSET 0x0038 /* Transmit data bytes 1-4 (Tx Buffer 1) */ +#define LPC17_CAN_TDB1_OFFSET 0x003c /* Transmit data bytes 5-8 (Tx Buffer 1) */ +#define LPC17_CAN_TFI2_OFFSET 0x0040 /* Transmit frame info (Tx Buffer 2) */ +#define LPC17_CAN_TID2_OFFSET 0x0044 /* Transmit Identifier (Tx Buffer 2) */ +#define LPC17_CAN_TDA2_OFFSET 0x0048 /* Transmit data bytes 1-4 (Tx Buffer 2) */ +#define LPC17_CAN_TDB2_OFFSET 0x004c /* Transmit data bytes 5-8 (Tx Buffer 2) */ +#define LPC17_CAN_TFI3_OFFSET 0x0050 /* Transmit frame info (Tx Buffer 3) */ +#define LPC17_CAN_TID3_OFFSET 0x0054 /* Transmit Identifier (Tx Buffer 3) */ +#define LPC17_CAN_TDA3_OFFSET 0x0058 /* Transmit data bytes 1-4 (Tx Buffer 3) */ +#define LPC17_CAN_TDB3_OFFSET 0x005c /* Transmit data bytes 5-8 (Tx Buffer 3) */ + +/* Register addresses ***************************************************************/ +/* CAN acceptance filter registers */ + +#define LPC17_CANAF_AFMR (LPC17_CANAF_BASE+LPC17_CANAF_AFMR_OFFSET) +#define LPC17_CANAF_SFFSA (LPC17_CANAF_BASE+LPC17_CANAF_SFFSA_OFFSET) +#define LPC17_CANAF_SFFGRPSA (LPC17_CANAF_BASE+LPC17_CANAF_SFFGRPSA_OFFSET) +#define LPC17_CANAF_EFFSA (LPC17_CANAF_BASE+LPC17_CANAF_EFFSA_OFFSET) +#define LPC17_CANAF_EFFGRPSA (LPC17_CANAF_BASE+LPC17_CANAF_EFFGRPSA_OFFSET) +#define LPC17_CANAF_EOT (LPC17_CANAF_BASE+LPC17_CANAF_EOT_OFFSET) +#define LPC17_CANAF_LUTERRAD (LPC17_CANAF_BASE+LPC17_CANAF_LUTERRAD_OFFSET) +#define LPC17_CANAF_LUTERR (LPC17_CANAF_BASE+LPC17_CANAF_LUTERR_OFFSET) +#define LPC17_CANAF_FCANIE (LPC17_CANAF_BASE+LPC17_CANAF_FCANIE_OFFSET) +#define LPC17_CANAF_FCANIC0 (LPC17_CANAF_BASE+LPC17_CANAF_FCANIC0_OFFSET) +#define LPC17_CANAF_FCANIC1 (LPC17_CANAF_BASE+LPC17_CANAF_FCANIC1_OFFSET) + +/* Central CAN registers */ + +#define LPC17_CAN_TXSR (LPC17_CAN_BASE+LPC17_CAN_TXSR_OFFSET) +#define LPC17_CAN_RXSR (LPC17_CAN_BASE+LPC17_CAN_RXSR_OFFSET) +#define LPC17_CAN_MSR (LPC17_CAN_BASE+LPC17_CAN_MSR_OFFSET) + +/* CAN1/2 registers */ + +#define LPC17_CAN1_MOD (LPC17_CAN1_BASE+LPC17_CAN_MOD_OFFSET) +#define LPC17_CAN1_CMR (LPC17_CAN1_BASE+LPC17_CAN_CMR_OFFSET) +#define LPC17_CAN1_GSR (LPC17_CAN1_BASE+LPC17_CAN_GSR_OFFSET) +#define LPC17_CAN1_ICR (LPC17_CAN1_BASE+LPC17_CAN_ICR_OFFSET) +#define LPC17_CAN1_IER (LPC17_CAN1_BASE+LPC17_CAN_IER_OFFSET) +#define LPC17_CAN1_BTR (LPC17_CAN1_BASE+LPC17_CAN_BTR_OFFSET) +#define LPC17_CAN1_EWL (LPC17_CAN1_BASE+LPC17_CAN_EWL_OFFSET) +#define LPC17_CAN1_SR (LPC17_CAN1_BASE+LPC17_CAN_SR_OFFSET) +#define LPC17_CAN1_RFS (LPC17_CAN1_BASE+LPC17_CAN_RFS_OFFSET) +#define LPC17_CAN1_RID (LPC17_CAN1_BASE+LPC17_CAN_RID_OFFSET) +#define LPC17_CAN1_RDA (LPC17_CAN1_BASE+LPC17_CAN_RDA_OFFSET) +#define LPC17_CAN1_RDB (LPC17_CAN1_BASE+LPC17_CAN_RDB_OFFSET) +#define LPC17_CAN1_TFI1 (LPC17_CAN1_BASE+LPC17_CAN_TFI1_OFFSET) +#define LPC17_CAN1_TID1 (LPC17_CAN1_BASE+LPC17_CAN_TID1_OFFSET) +#define LPC17_CAN1_TDA1 (LPC17_CAN1_BASE+LPC17_CAN_TDA1_OFFSET) +#define LPC17_CAN1_TDB1 (LPC17_CAN1_BASE+LPC17_CAN_TDB1_OFFSET) +#define LPC17_CAN1_TFI2 (LPC17_CAN1_BASE+LPC17_CAN_TFI2_OFFSET) +#define LPC17_CAN1_TID2 (LPC17_CAN1_BASE+LPC17_CAN_TID2_OFFSET) +#define LPC17_CAN1_TDA2 (LPC17_CAN1_BASE+LPC17_CAN_TDA2_OFFSET) +#define LPC17_CAN1_TDB2 (LPC17_CAN1_BASE+LPC17_CAN_TDB2_OFFSET) +#define LPC17_CAN1_TFI3 (LPC17_CAN1_BASE+LPC17_CAN_TFI3_OFFSET) +#define LPC17_CAN1_TID3 (LPC17_CAN1_BASE+LPC17_CAN_TID3_OFFSET) +#define LPC17_CAN1_TDA3 (LPC17_CAN1_BASE+LPC17_CAN_TDA3_OFFSET) +#define LPC17_CAN1_TDB3 (LPC17_CAN1_BASE+LPC17_CAN_TDB3_OFFSET) + +#define LPC17_CAN2_MOD (LPC17_CAN2_BASE+LPC17_CAN_MOD_OFFSET) +#define LPC17_CAN2_CMR (LPC17_CAN2_BASE+LPC17_CAN_CMR_OFFSET) +#define LPC17_CAN2_GSR (LPC17_CAN2_BASE+LPC17_CAN_GSR_OFFSET) +#define LPC17_CAN2_ICR (LPC17_CAN2_BASE+LPC17_CAN_ICR_OFFSET) +#define LPC17_CAN2_IER (LPC17_CAN2_BASE+LPC17_CAN_IER_OFFSET) +#define LPC17_CAN2_BTR (LPC17_CAN2_BASE+LPC17_CAN_BTR_OFFSET) +#define LPC17_CAN2_EWL (LPC17_CAN2_BASE+LPC17_CAN_EWL_OFFSET) +#define LPC17_CAN2_SR (LPC17_CAN2_BASE+LPC17_CAN_SR_OFFSET) +#define LPC17_CAN2_RFS (LPC17_CAN2_BASE+LPC17_CAN_RFS_OFFSET) +#define LPC17_CAN2_RID (LPC17_CAN2_BASE+LPC17_CAN_RID_OFFSET) +#define LPC17_CAN2_RDA (LPC17_CAN2_BASE+LPC17_CAN_RDA_OFFSET) +#define LPC17_CAN2_RDB (LPC17_CAN2_BASE+LPC17_CAN_RDB_OFFSET) +#define LPC17_CAN2_TFI1 (LPC17_CAN2_BASE+LPC17_CAN_TFI1_OFFSET) +#define LPC17_CAN2_TID1 (LPC17_CAN2_BASE+LPC17_CAN_TID1_OFFSET) +#define LPC17_CAN2_TDA1 (LPC17_CAN2_BASE+LPC17_CAN_TDA1_OFFSET) +#define LPC17_CAN2_TDB1 (LPC17_CAN2_BASE+LPC17_CAN_TDB1_OFFSET) +#define LPC17_CAN2_TFI2 (LPC17_CAN2_BASE+LPC17_CAN_TFI2_OFFSET) +#define LPC17_CAN2_TID2 (LPC17_CAN2_BASE+LPC17_CAN_TID2_OFFSET) +#define LPC17_CAN2_TDA2 (LPC17_CAN2_BASE+LPC17_CAN_TDA2_OFFSET) +#define LPC17_CAN2_TDB2 (LPC17_CAN2_BASE+LPC17_CAN_TDB2_OFFSET) +#define LPC17_CAN2_TFI3 (LPC17_CAN2_BASE+LPC17_CAN_TFI3_OFFSET) +#define LPC17_CAN2_TID3 (LPC17_CAN2_BASE+LPC17_CAN_TID3_OFFSET) +#define LPC17_CAN2_TDA3 (LPC17_CAN2_BASE+LPC17_CAN_TDA3_OFFSET) +#define LPC17_CAN2_TDB3 (LPC17_CAN2_BASE+LPC17_CAN_TDB3_OFFSET) + +/* Register bit definitions *********************************************************/ +/* CAN acceptance filter registers */ +/* Acceptance Filter Register */ + +#define CANAF_AFMR_ACCOFF (1 << 0) /* Bit 0: AF non-operational; All RX messages ignored */ +#define CANAF_AFMR_ACCBP (1 << 1) /* Bit 1: AF bypass: All RX messages accepted */ +#define CANAF_AFMR_EFCAN (1 << 2) /* Bit 2: Enable Full CAN mode */ + /* Bits 3-31: Reserved */ +/* Standard Frame Individual Start Address Register */ + /* Bits 0-1: Reserved */ +#define CANAF_SFFSA_SHIFT (2) /* Bits 2-10: Address of Standard Identifiers in AF Lookup RAM */ +#define CANAF_SFFSA_MASK (0x01ff << CANAF_SFFSA_SHIFT) + /* Bits 11-31: Reserved */ +/* Standard Frame Group Start Address Register */ + /* Bits 0-1: Reserved */ +#define CANAF_SFFGRPSA_SHIFT (2) /* Bits 2-10: Address of grouped Standard Identifiers in AF Lookup RAM */ +#define CANAF_SFFGRPSA_MASK (0x01ff << CANAF_SFFGRPSA_SHIFT) + /* Bits 11-31: Reserved */ +/* Extended Frame Start Address Register */ + /* Bits 0-1: Reserved */ +#define CANAF_EFFSA_SHIFT (2) /* Bits 2-10: Address of Extended Identifiers in AF Lookup RAM */ +#define CANAF_EFFSA_MASK (0x01ff << CANAF_EFFSA_SHIFT) + /* Bits 11-31: Reserved */ +/* Extended Frame Group Start Address Register */ + /* Bits 0-1: Reserved */ +#define CANAF_EFFGRPSA_SHIFT (2) /* Bits 2-10: Address of grouped Extended Identifiers in AF Lookup RAM */ +#define CANAF_EFFGRPSA_MASK (0x01ff << CANAF_EFFGRPSA_SHIFT) + /* Bits 11-31: Reserved */ +/* End of AF Tables register */ + /* Bits 0-1: Reserved */ +#define CANAF_EOT_SHIFT (2) /* Bits 2-10: Last active address in last active AF table */ +#define CANAF_EOT_MASK (0x01ff << CANAF_EOT_SHIFT) + /* Bits 11-31: Reserved */ +/* LUT Error Address register */ + /* Bits 0-1: Reserved */ +#define CANAF_LUTERRAD_SHIFT (2) /* Bits 2-10: Address in AF Lookup RAM of error */ +#define CANAF_LUTERRAD_MASK (0x01ff << CANAF_EOT_SHIFT) + /* Bits 11-31: Reserved */ +/* LUT Error Register */ + +#define CANAF_LUTERR_LUTERR (1 << 0) /* Bit 0: AF error in AF RAM tables */ + /* Bits 1-31: Reserved */ +/* FullCAN interrupt enable register */ + +#define CANAF_FCANIE_FCANIE (1 << 0) /* Bit 0: Global FullCAN Interrupt Enable */ + /* Bits 1-31: Reserved */ + +/* FullCAN interrupt and capture register 0 */ + +#define CANAF_FCANIC0_INTPND(n) (1 << (n)) /* n=0,1,2,... 31 */ + +/* FullCAN interrupt and capture register 1 */ + +#define CANAF_FCANIC1_INTPND(n) (1 << ((n)-32)) /* n=32,33,...63 */ + +/* Central CAN registers */ +/* CAN Central Transmit Status Register */ + +#define CAN_TXSR_TS1 (1 << 0) /* Bit 0: CAN1 sending */ +#define CAN_TXSR_TS2 (1 << 1) /* Bit 1: CAN2 sending */ + /* Bits 2-7: Reserved */ +#define CAN_TXSR_TBS1 (1 << 8) /* Bit 8: All 3 CAN1 TX buffers available */ +#define CAN_TXSR_TBS2 (1 << 9) /* Bit 9: All 3 CAN2 TX buffers available */ + /* Bits 10-15: Reserved */ +#define CAN_TXSR_TCS1 (1 << 16) /* Bit 16: All CAN1 xmissions completed */ +#define CAN_TXSR_TCS2 (1 << 17) /* Bit 17: All CAN2 xmissions completed */ + /* Bits 18-31: Reserved */ +/* CAN Central Receive Status Register */ + +#define CAN_RXSR_RS1 (1 << 0) /* Bit 0: CAN1 receiving */ +#define CAN_RXSR_RS2 (1 << 1) /* Bit 1: CAN2 receiving */ + /* Bits 2-7: Reserved */ +#define CAN_RXSR_RB1 (1 << 8) /* Bit 8: CAN1 received message available */ +#define CAN_RXSR_RB2 (1 << 9) /* Bit 9: CAN2 received message available */ + /* Bits 10-15: Reserved */ +#define CAN_RXSR_DOS1 (1 << 16) /* Bit 16: All CAN1 message lost */ +#define CAN_RXSR_DOS2 (1 << 17) /* Bit 17: All CAN2 message lost */ + /* Bits 18-31: Reserved */ +/* CAN Central Miscellaneous Register */ + +#define CAN_MSR_E1 (1 << 0) /* Bit 0: CAN1 error counters at limit */ +#define CAN_MSR_E2 (1 << 1) /* Bit 1: CAN2 error counters at limit */ + /* Bits 2-7: Reserved */ +#define CAN_MSR_BS1 (1 << 8) /* Bit 8: CAN1 busy */ +#define CAN_MSR_BS2 (1 << 9) /* Bit 7: CAN2 busy */ + /* Bits 10-31: Reserved */ +/* CAN1/2 registers */ +/* CAN operating mode */ + +#define CAN_MOD_RM (1 << 0) /* Bit 0: Reset Mode */ +#define CAN_MOD_LOM (1 << 1) /* Bit 1: Listen Only Mode */ +#define CAN_MOD_STM (1 << 2) /* Bit 2: Self Test Mode */ +#define CAN_MOD_TPM (1 << 3) /* Bit 3: Transmit Priority Mode */ +#define CAN_MOD_SM (1 << 4) /* Bit 4: Sleep Mode */ +#define CAN_MOD_RPM (1 << 5) /* Bit 5: Receive Polarity Mode */ + /* Bit 6: Reserved */ +#define CAN_MOD_TM (1 << 7) /* Bit 7: Test Mode */ + /* Bits 8-31: Reserved */ +/* Command bits */ + +#define CAN_CMR_TR (1 << 0) /* Bit 0: Transmission Request */ +#define CAN_CMR_AT (1 << 1) /* Bit 1: Abort Transmission */ +#define CAN_CMR_RRB (1 << 2) /* Bit 2: Release Receive Buffer */ +#define CAN_CMR_CDO (1 << 3) /* Bit 3: Clear Data Overrun */ +#define CAN_CMR_SRR (1 << 4) /* Bit 4: Self Reception Request */ +#define CAN_CMR_STB1 (1 << 5) /* Bit 5: Select Tx Buffer 1 */ +#define CAN_CMR_STB2 (1 << 6) /* Bit 6: Select Tx Buffer 2 */ +#define CAN_CMR_STB3 (1 << 7) /* Bit 7: Select Tx Buffer 3 */ + /* Bits 8-31: Reserved */ +/* Controller Status and Error Counters */ + +#define CAN_GSR_RBS (1 << 0) /* Bit 0: Receive Buffer Status */ +#define CAN_GSR_DOS (1 << 1) /* Bit 1: Data Overrun Status */ +#define CAN_GSR_TBS (1 << 2) /* Bit 2: Transmit Buffer Status */ +#define CAN_GSR_TCS (1 << 3) /* Bit 3: Transmit Complete Status */ +#define CAN_GSR_RS (1 << 4) /* Bit 4: Receive Status */ +#define CAN_GSR_TS (1 << 5) /* Bit 5: Transmit Status */ +#define CAN_GSR_ES (1 << 6) /* Bit 6: Error Status */ +#define CAN_GSR_BS (1 << 7) /* Bit 7: Bus Status */ + /* Bits 8-15: Reserved */ +#define CAN_GSR_RXERR_SHIFT (16) /* Bits 16-23: Rx Error Counter */ +#define CAN_GSR_RXERR_MASK (0xff << CAN_GSR_RXERR_SHIFT) +#define CAN_GSR_TXERR_SHIFT (24) /* Bits 24-31: Tx Error Counter */ +#define CAN_GSR_TXERR_MASK (0xff << CAN_GSR_TXERR_SHIFT) + +/* Interrupt and capture register */ + +#define CAN_ICR_RI (1 << 0) /* Bit 0: Receive Interrupt */ +#define CAN_ICR_TI1 (1 << 1) /* Bit 1: Transmit Interrupt 1 */ +#define CAN_ICR_EI (1 << 2) /* Bit 2: Error Warning Interrupt */ +#define CAN_ICR_DOI (1 << 3) /* Bit 3: Data Overrun Interrupt */ +#define CAN_ICR_WUI (1 << 4) /* Bit 4: Wake-Up Interrupt */ +#define CAN_ICR_EPI (1 << 5) /* Bit 5: Error Passive Interrupt */ +#define CAN_ICR_ALI (1 << 6) /* Bit 6: Arbitration Lost Interrupt */ +#define CAN_ICR_BEI (1 << 7) /* Bit 7: Bus Error Interrupt */ +#define CAN_ICR_IDI (1 << 8) /* Bit 8: ID Ready Interrupt */ +#define CAN_ICR_TI2 (1 << 9) /* Bit 9: Transmit Interrupt 2 */ +#define CAN_ICR_TI3 (1 << 10) /* Bit 10: Transmit Interrupt 3 */ + /* Bits 11-15: Reserved */ +#define CAN_ICR_ERRBIT_SHIFT (16) /* Bits 16-20: Error Code Capture */ +#define CAN_ICR_ERRBIT_MASK (0x1f << CAN_ICR_ERRBIT_SHIFT) +# define CAN_ICR_ERRBIT_SOF (3 << CAN_ICR_ERRBIT_SHIFT) /* Start of Frame */ +# define CAN_ICR_ERRBIT_ID28 (2 << CAN_ICR_ERRBIT_SHIFT) /* ID28 ... ID21 */ +# define CAN_ICR_ERRBIT_SRTR (4 << CAN_ICR_ERRBIT_SHIFT) /* SRTR Bit */ +# define CAN_ICR_ERRBIT_IDE (5 << CAN_ICR_ERRBIT_SHIFT) /* DE bit */ +# define CAN_ICR_ERRBIT_ID20 (6 << CAN_ICR_ERRBIT_SHIFT) /* ID20 ... ID18 */ +# define CAN_ICR_ERRBIT_ID17 (7 << CAN_ICR_ERRBIT_SHIFT) /* ID17 ... 13 */ +# define CAN_ICR_ERRBIT_CRC (8 << CAN_ICR_ERRBIT_SHIFT) /* CRC Sequence */ +# define CAN_ICR_ERRBIT_DATA (10 << CAN_ICR_ERRBIT_SHIFT) /* Data Field */ +# define CAN_ICR_ERRBIT_LEN (11 << CAN_ICR_ERRBIT_SHIFT) /* Data Length Code */ +# define CAN_ICR_ERRBIT_ RTR (12 << CAN_ICR_ERRBIT_SHIFT) /* RTR Bit */ +# define CAN_ICR_ERRBIT_ID4 (14 << CAN_ICR_ERRBIT_SHIFT) /* ID4 ... ID0 */ +# define CAN_ICR_ERRBIT_ID12 (15 << CAN_ICR_ERRBIT_SHIFT) /* ID12 ... ID5 */ +# define CAN_ICR_ERRBIT_AERR (17 << CAN_ICR_ERRBIT_SHIFT) /* Active Error Flag */ +# define CAN_ICR_ERRBIT_INTERMSN (18 << CAN_ICR_ERRBIT_SHIFT) /* Intermission */ +# define CAN_ICR_ERRBIT_DOM (19 << CAN_ICR_ERRBIT_SHIFT) /* Tolerate Dominant Bits */ +# define CAN_ICR_ERRBIT_PERR (22 << CAN_ICR_ERRBIT_SHIFT) /* Passive Error Flag */ +# define CAN_ICR_ERRBIT_ERRDLM (23 << CAN_ICR_ERRBIT_SHIFT) /* Error Delimiter */ +# define CAN_ICR_ERRBIT_CRCDLM (24 << CAN_ICR_ERRBIT_SHIFT) /* CRC Delimiter */ +# define CAN_ICR_ERRBIT_ACKSLT (25 << CAN_ICR_ERRBIT_SHIFT) /* Acknowledge Slot */ +# define CAN_ICR_ERRBIT_EOF (26 << CAN_ICR_ERRBIT_SHIFT) /* End of Frame */ +# define CAN_ICR_ERRBIT_ACKDLM (27 << CAN_ICR_ERRBIT_SHIFT) /* Acknowledge Delimiter */ +# define CAN_ICR_ERRBIT_OVLD (28 << CAN_ICR_ERRBIT_SHIFT) /* Overload flag */ +#define CAN_ICR_ERRDIR (1 << 21) /* Bit 21: Direction bit at time of error */ +#define CAN_ICR_ERRC_SHIFT (22) /* Bits 22-23: Type of error */ +#define CAN_ICR_ERRC_MASK (3 << CAN_ICR_ERRC_SHIFT) +# define CAN_ICR_ERRC_BIT (0 << CAN_ICR_ERRC_SHIFT) +# define CAN_ICR_ERRC_FORM (1 << CAN_ICR_ERRC_SHIFT) +# define CAN_ICR_ERRC_STUFF (2 << CAN_ICR_ERRC_SHIFT) +# define CAN_ICR_ERRC_OTHER (3 << CAN_ICR_ERRC_SHIFT) +#define CAN_ICR_ALCBIT_SHIFT (24) /* Bits 24-31: Bit number within frame */ +#define CAN_ICR_ALCBIT_MASK (0xff << CAN_ICR_ALCBIT_SHIFT) + +/* Interrupt Enable */ + +#define CAN_IER_RIE (1 << 0) /* Bit 0: Receiver Interrupt Enable */ +#define CAN_IER_TIE1 (1 << 1) /* Bit 1: Transmit Interrupt Enable for Buffer1 */ +#define CAN_IER_EIE (1 << 2) /* Bit 2: Error Warning Interrupt Enable */ +#define CAN_IER_DOIE (1 << 3) /* Bit 3: Data Overrun Interrupt Enable */ +#define CAN_IER_WUIE (1 << 4) /* Bit 4: Wake-Up Interrupt Enable */ +#define CAN_IER_EPIE (1 << 5) /* Bit 5: Error Passive Interrupt Enable */ +#define CAN_IER_ALIE (1 << 6) /* Bit 6: Arbitration Lost Interrupt Enable */ +#define CAN_IER_BEIE (1 << 7) /* Bit 7: Bus Error Interrupt */ +#define CAN_IER_IDIE (1 << 8) /* Bit 8: ID Ready Interrupt Enable */ +#define CAN_IER_TIE2 (1 << 9) /* Bit 9: Transmit Interrupt Enable for Buffer2 */ +#define CAN_IER_TIE3 (1 << 10) /* Bit 10: Transmit Interrupt Enable for Buffer3 */ + /* Bits 11-31: Reserved */ +/* Bus Timing */ + +#define CAN_BTR_BRP_SHIFT (0) /* Bits 0-9: Baud Rate Prescaler */ +#define CAN_BTR_BRP_MASK (0x3ff << CAN_BTR_BRP_SHIFT) + /* Bits 10-13: Reserved */ +#define CAN_BTR_SJW_SHIFT (14) /* Bits 14-15: Synchronization Jump Width */ +#define CAN_BTR_SJW_MASK (3 << CAN_BTR_SJW_SHIFT) +#define CAN_BTR_TSEG1_SHIFT (16) /* Bits 16-19: Sync to sample delay */ +#define CAN_BTR_TSEG1_MASK (15 << CAN_BTR_TSEG1_SHIFT) +#define CAN_BTR_TSEG2_SHIFT (20) /* Bits 20-22: smaple to next delay */ +#define CAN_BTR_TSEG2_MASK (7 << CAN_BTR_TSEG2_SHIFT) +#define CAN_BTR_SAM (1 << 23) /* Bit 23: Sampling */ + /* Bits 24-31: Reserved */ + +#define CAN_BTR_BRP_MAX (1024) /* Maximum BTR value (without decrement) */ +#define CAN_BTR_TSEG1_MAX (16) /* Maximum TSEG1 value (without decrement) */ +#define CAN_BTR_TSEG2_MAX (8) /* Maximum TSEG2 value (without decrement) */ + +/* Error Warning Limit */ + +#define CAN_EWL_SHIFT (0) /* Bits 0-7: Error warning limit */ +#define CAN_EWL_MASK (0xff << CAN_EWL_SHIFT) + /* Bits 8-31: Reserved */ +/* Status Register */ + +#define CAN_SR_RBS1 (1 << 0) /* Bit 0: Receive Buffer Status */ +#define CAN_SR_DOS1 (1 << 1) /* Bit 1: Data Overrun Status */ +#define CAN_SR_TBS1 (1 << 2) /* Bit 2: Transmit Buffer Status 1 */ +#define CAN_SR_TCS1 (1 << 3) /* Bit 3: Transmission Complete Status */ +#define CAN_SR_RS1 (1 << 4) /* Bit 4: Receive Status */ +#define CAN_SR_TS1 (1 << 5) /* Bit 5: Transmit Status 1 */ +#define CAN_SR_ES1 (1 << 6) /* Bit 6: Error Status */ +#define CAN_SR_BS1 (1 << 7) /* Bit 7: Bus Status */ +#define CAN_SR_RBS2 (1 << 8) /* Bit 8: Receive Buffer Status */ +#define CAN_SR_DOS2 (1 << 9) /* Bit 9: Data Overrun Status */ +#define CAN_SR_TBS2 (1 << 10) /* Bit 10: Transmit Buffer Status 2 */ +#define CAN_SR_TCS2 (1 << 11) /* Bit 11: Transmission Complete Status */ +#define CAN_SR_RS2 (1 << 12) /* Bit 12: Receive Status */ +#define CAN_SR_TS2 (1 << 13) /* Bit 13: Transmit Status 2 */ +#define CAN_SR_ES2 (1 << 14) /* Bit 14: Error Status */ +#define CAN_SR_BS2 (1 << 15) /* Bit 15: Bus Status */ +#define CAN_SR_RBS3 (1 << 16) /* Bit 16: Receive Buffer Status */ +#define CAN_SR_DOS3 (1 << 17) /* Bit 17: Data Overrun Status */ +#define CAN_SR_TBS3 (1 << 18) /* Bit 18: Transmit Buffer Status 3 */ +#define CAN_SR_TCS3 (1 << 19) /* Bit 19: Transmission Complete Status */ +#define CAN_SR_RS3 (1 << 20) /* Bit 20: Receive Status */ +#define CAN_SR_TS3 (1 << 21) /* Bit 21: Transmit Status 3 */ +#define CAN_SR_ES3 (1 << 22) /* Bit 22: Error Status */ +#define CAN_SR_BS3 (1 << 23) /* Bit 23: Bus Status */ + /* Bits 24-31: Reserved */ +/* Receive frame status */ + +#define CAN_RFS_ID_SHIFT (0) /* Bits 0-9: ID Index */ +#define CAN_RFS_ID_MASK (0x03ff << CAN_RFS_ID_SHIFT) +#define CAN_RFS_BP (1 << 10) /* Bit 10: Received in AF Bypass mode */ + /* Bits 11-15: Reserved */ +#define CAN_RFS_DLC_SHIFT (16) /* Bits 16-19: Message Data Length Code (DLC) */ +#define CAN_RFS_DLC_MASK (15 << CAN_RFS_DLC_SHIFT) + /* Bits 20-29: Reserved */ +#define CAN_RFS_RTR (1 << 30) /* Bit 30: Message Remote Transmission Request */ +#define CAN_RFS_FF (1 << 31) /* Bit 31: Message 29-bit vs 11-bit ID */ + +/* Received Identifier */ + +#define CAN_RID_ID11_MASK (0x7ff) /* Bits 0-10: 11-bit Identifier (FF=0) */ + /* Bits 11-31: Reserved */ +#define CAN_RID_ID29_MASK (0x1fffffff) /* Bits 0-28: 29-bit Identifiter (FF=1) */ + /* Bits 29-31: Reserved */ +/* Received data bytes 1-4 */ + +#define CAN_RDA_DATA1_SHIFT (0) /* Bits 0-7: If CANRFS >= 1 */ +#define CAN_RDA_DATA1_MASK (0x0ff << CAN_RDA_DATA1_SHIFT) +#define CAN_RDA_DATA2_SHIFT (8) /* Bits 8-15: If CANRFS >= 2 */ +#define CAN_RDA_DATA2_MASK (0x0ff << CAN_RDA_DATA2_SHIFT) +#define CAN_RDA_DATA3_SHIFT (16) /* Bits 16-23: If CANRFS >= 3 */ +#define CAN_RDA_DATA3_MASK (0x0ff << CAN_RDA_DATA3_SHIFT) +#define CAN_RDA_DATA4_SHIFT (24) /* Bits 24-31: If CANRFS >= 4 */ +#define CAN_RDA_DATA4_MASK (0x0ff << CAN_RDA_DATA4_SHIFT) + +/* Received data bytes 5-8 */ + +#define CAN_RDB_DATA5_SHIFT (0) /* Bits 0-7: If CANRFS >= 5 */ +#define CAN_RDB_DATA5_MASK (0x0ff << CAN_RDB_DATA5_SHIFT) +#define CAN_RDB_DATA6_SHIFT (8) /* Bits 8-15: If CANRFS >= 6 */ +#define CAN_RDB_DATA6_MASK (0x0ff << CAN_RDB_DATA6_SHIFT) +#define CAN_RDB_DATA7_SHIFT (16) /* Bits 16-23: If CANRFS >= 7 */ +#define CAN_RDB_DATA7_MASK (0x0ff << CAN_RDB_DATA7_SHIFT) +#define CAN_RDB_DATA8_SHIFT (24) /* Bits 24-31: If CANRFS >= 8 */ +#define CAN_RDB_DATA8_MASK (0x0ff << CAN_RDB_DATA8_SHIFT) + +/* Transmit frame info (Tx Buffer 1), Transmit frame info (Tx Buffer 2), and + * Transmit frame info (Tx Buffer 3) common bit field definitions + */ + +#define CAN_TFI_PRIO_SHIFT (0) /* Bits 0-7: TX buffer priority */ +#define CAN_TFI_PRIO_MASK (0xff << CAN_TFI_PRIO_SHIFT) + /* Bits 8-15: Reserved */ +#define CAN_TFI_DLC_SHIFT (16) /* Bits 16-19: TX Data Length Code */ +#define CAN_TFI_DLC_MASK (15 << CAN_TFI_DLC_SHIFT) + /* Bits 20-29: Reserved */ +#define CAN_TFI_RTR (1 << 30) /* Bit 30: TX RTR bit */ +#define CAN_TFI_FF (1 << 31) /* Bit 31: Message 29-bit vs 11-bit ID */ + +/* Transmit Identifier (Tx Buffer 1), Transmit Identifier (Tx Buffer 2), and + * Transmit Identifier (Tx Buffer 3) common bit field definitions. + */ + +#define CAN_TID_ID11_MASK (0x7ff) /* Bits 0-10: 11-bit Identifier (FF=0) */ + /* Bits 11-31: Reserved */ +#define CAN_TID_ID29_MASK (0x1fffffff) /* Bits 0-28: 29-bit Identifiter (FF=1) */ + /* Bits 29-31: Reserved */ + +/* Transmit data bytes 1-4 (Tx Buffer 1), Transmit data bytes 1-4 (Tx Buffer 2), and + * Transmit data bytes 1-4 (Tx Buffer 3) common bit field definitions. + */ + +#define CAN_TDA_DATA1_SHIFT (0) /* Bits 0-7: RTR=0 && DLC >= 1 */ +#define CAN_TDA_DATA1_MASK (0x0ff << CAN_TDA_DATA1_SHIFT) +#define CAN_TDA_DATA2_SHIFT (8) /* Bits 8-15: RTR=0 && DLC >= 2 */ +#define CAN_TDA_DATA2_MASK (0x0ff << CAN_TDA_DATA2_SHIFT) +#define CAN_TDA_DATA3_SHIFT (16) /* Bits 16-23: RTR=0 && DLC >= 3 */ +#define CAN_TDA_DATA3_MASK (0x0ff << CAN_TDA_DATA3_SHIFT) +#define CAN_TDA_DATA4_SHIFT (24) /* Bits 24-31: RTR=0 && DLC >= 4 */ +#define CAN_TDA_DATA4_MASK (0x0ff << CAN_TDA_DATA4_SHIFT) + +/* Transmit data bytes 5-8 (Tx Buffer 1), Transmit data bytes 5-8 (Tx Buffer 2), and + * Transmit data bytes 5-8 (Tx Buffer 3) common bit field definitions. + */ + +#define CAN_RDB_DATA5_SHIFT (0) /* Bits 0-7: RTR=0 && DLC >= 5 */ +#define CAN_RDB_DATA5_MASK (0x0ff << CAN_RDB_DATA5_SHIFT) +#define CAN_RDB_DATA6_SHIFT (8) /* Bits 8-15: RTR=0 && DLC >= 6 */ +#define CAN_RDB_DATA6_MASK (0x0ff << CAN_RDB_DATA6_SHIFT) +#define CAN_RDB_DATA7_SHIFT (16) /* Bits 16-23: RTR=0 && DLC >= 7 */ +#define CAN_RDB_DATA7_MASK (0x0ff << CAN_RDB_DATA7_SHIFT) +#define CAN_RDB_DATA8_SHIFT (24) /* Bits 24-31: RTR=0 && DLC >= 8 */ +#define CAN_RDB_DATA8_MASK (0x0ff << CAN_RDB_DATA8_SHIFT) + +/************************************************************************************ + * Public Types + ************************************************************************************/ + +/************************************************************************************ + * Public Data + ************************************************************************************/ + +/************************************************************************************ + * Public Functions + ************************************************************************************/ + +#endif /* __ARCH_ARM_SRC_LPC17XX_LPC17_CHIP_CAN_H */ diff --git a/nuttx/arch/arm/src/lpc17xx/chip/lpc17_dac.h b/nuttx/arch/arm/src/lpc17xx/chip/lpc17_dac.h new file mode 100644 index 0000000000..be78bef059 --- /dev/null +++ b/nuttx/arch/arm/src/lpc17xx/chip/lpc17_dac.h @@ -0,0 +1,97 @@ +/************************************************************************************ + * arch/arm/src/lpc17xx/chip/lpc17_dac.h + * + * Copyright (C) 2010, 2013 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * 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. + * + ************************************************************************************/ + +#ifndef __ARCH_ARM_SRC_LPC17XX_LPC17_CHIP_DAC_H +#define __ARCH_ARM_SRC_LPC17XX_LPC17_CHIP_DAC_H + +/************************************************************************************ + * Included Files + ************************************************************************************/ + +#include + +#include "chip.h" +#include "chip/lpc17_memorymap.h" + +/************************************************************************************ + * Pre-processor Definitions + ************************************************************************************/ + +/* Register offsets *****************************************************************/ + +#define LPC17_DAC_CR_OFFSET 0x0000 /* D/A Converter Register */ +#define LPC17_DAC_CTRL_OFFSET 0x0004 /* DAC Control register */ +#define LPC17_DAC_CNTVAL_OFFSET 0x0008 /* DAC Counter Value register */ + +/* Register addresses ***************************************************************/ + +#define LPC17_DAC_CR (LPC17_DAC_BASE+LPC17_DAC_CR_OFFSET) +#define LPC17_DAC_CTRL (LPC17_DAC_BASE+LPC17_DAC_CTRL_OFFSET) +#define LPC17_DAC_CNTVAL (LPC17_DAC_BASE+LPC17_DAC_CNTVAL_OFFSET) + +/* Register bit definitions *********************************************************/ + +/* D/A Converter Register */ + /* Bits 0-5: Reserved */ +#define DAC_CR_VALUE_SHIFT (6) /* Bits 6-15: Controls voltage on the AOUT pin */ +#define DAC_CR_VALUE_MASK (0x3ff << DAC_CR_VALUE_SHIFT) +#define DAC_CR_BIAS (1 << 16) /* Bit 16: Controls DAC settling time */ + /* Bits 17-31: Reserved */ +/* DAC Control register */ + +#define DAC_CTRL_INTDMAREQ (1 << 0) /* Bit 0: Timer timed out */ +#define DAC_CTRL_DBLBUFEN (1 << 1) /* Bit 1: Enable DACR double-buffering */ +#define DAC_CTRL_CNTEN (1 << 2) /* Bit 2: Enable timeout counter */ +#define DAC_CTRL_DMAEN (1 << 3) /* Bit 3: Enable DMA access */ + /* Bits 4-31: Reserved */ +/* DAC Counter Value register */ + +#define DAC_CNTVAL_SHIFT (0) /* Bits 0-15: Reload value for DAC interrupt/DMA timer */ +#define DAC_CNTVAL_MASK (0xffff << DAC_CNTVAL_SHIFT) + /* Bits 8-31: Reserved */ + +/************************************************************************************ + * Public Types + ************************************************************************************/ + +/************************************************************************************ + * Public Data + ************************************************************************************/ + +/************************************************************************************ + * Public Functions + ************************************************************************************/ + +#endif /* __ARCH_ARM_SRC_LPC17XX_LPC17_CHIP_DAC_H */ diff --git a/nuttx/arch/arm/src/lpc17xx/chip/lpc17_ethernet.h b/nuttx/arch/arm/src/lpc17xx/chip/lpc17_ethernet.h new file mode 100644 index 0000000000..b0791ced96 --- /dev/null +++ b/nuttx/arch/arm/src/lpc17xx/chip/lpc17_ethernet.h @@ -0,0 +1,597 @@ +/************************************************************************************ + * arch/arm/src/lpc17xx/chip/lpc17_ethernet.h + * + * Copyright (C) 2010, 2013 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * 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. + * + ************************************************************************************/ + +#ifndef __ARCH_ARM_SRC_LPC17XX_CHIP_LPC17_ETHERNET_H +#define __ARCH_ARM_SRC_LPC17XX_CHIP_LPC17_ETHERNET_H + +/************************************************************************************ + * Included Files + ************************************************************************************/ + +#include + +#include "chip.h" +#include "chip/lpc17_memorymap.h" + +/************************************************************************************ + * Pre-processor Definitions + ************************************************************************************/ + +/* Register offsets *****************************************************************/ +/* MAC registers */ + +#define LPC17_ETH_MAC1_OFFSET 0x0000 /* MAC configuration register 1 */ +#define LPC17_ETH_MAC2_OFFSET 0x0004 /* MAC configuration register 2 */ +#define LPC17_ETH_IPGT_OFFSET 0x0008 /* Back-to-Back Inter-Packet-Gap register */ +#define LPC17_ETH_IPGR_OFFSET 0x000c /* Non Back-to-Back Inter-Packet-Gap register */ +#define LPC17_ETH_CLRT_OFFSET 0x0010 /* Collision window / Retry register */ +#define LPC17_ETH_MAXF_OFFSET 0x0014 /* Maximum Frame register */ +#define LPC17_ETH_SUPP_OFFSET 0x0018 /* PHY Support register */ +#define LPC17_ETH_TEST_OFFSET 0x001c /* Test register */ +#define LPC17_ETH_MCFG_OFFSET 0x0020 /* MII Mgmt Configuration register */ +#define LPC17_ETH_MCMD_OFFSET 0x0024 /* MII Mgmt Command register */ +#define LPC17_ETH_MADR_OFFSET 0x0028 /* MII Mgmt Address register */ +#define LPC17_ETH_MWTD_OFFSET 0x002c /* MII Mgmt Write Data register */ +#define LPC17_ETH_MRDD_OFFSET 0x0030 /* MII Mgmt Read Data register */ +#define LPC17_ETH_MIND_OFFSET 0x0034 /* MII Mgmt Indicators register */ +#define LPC17_ETH_SA0_OFFSET 0x0040 /* Station Address 0 register */ +#define LPC17_ETH_SA1_OFFSET 0x0044 /* Station Address 1 register */ +#define LPC17_ETH_SA2_OFFSET 0x0048 /* Station Address 2 register */ + +/* Control registers */ + +#define LPC17_ETH_CMD_OFFSET 0x0100 /* Command register */ +#define LPC17_ETH_STAT_OFFSET 0x0104 /* Status register */ +#define LPC17_ETH_RXDESC_OFFSET 0x0108 /* Receive descriptor base address register */ +#define LPC17_ETH_RXSTAT_OFFSET 0x010c /* Receive status base address register */ +#define LPC17_ETH_RXDESCNO_OFFSET 0x0110 /* Receive number of descriptors register */ +#define LPC17_ETH_RXPRODIDX_OFFSET 0x0114 /* Receive produce index register */ +#define LPC17_ETH_RXCONSIDX_OFFSET 0x0118 /* Receive consume index register */ +#define LPC17_ETH_TXDESC_OFFSET 0x011c /* Transmit descriptor base address register */ +#define LPC17_ETH_TXSTAT_OFFSET 0x0120 /* Transmit status base address register */ +#define LPC17_ETH_TXDESCRNO_OFFSET 0x0124 /* Transmit number of descriptors register */ +#define LPC17_ETH_TXPRODIDX_OFFSET 0x0128 /* Transmit produce index register */ +#define LPC17_ETH_TXCONSIDX_OFFSET 0x012c /* Transmit consume index register */ +#define LPC17_ETH_TSV0_OFFSET 0x0158 /* Transmit status vector 0 register */ +#define LPC17_ETH_TSV1_OFFSET 0x015c /* Transmit status vector 1 register */ +#define LPC17_ETH_RSV_OFFSET 0x0160 /* Receive status vector register */ +#define LPC17_ETH_FCCNTR_OFFSET 0x0170 /* Flow control counter register */ +#define LPC17_ETH_FCSTAT_OFFSET 0x0174 /* Flow control status register */ + +/* Rx filter registers */ + +#define LPC17_ETH_RXFLCTRL_OFFSET 0x0200 /* Receive filter control register */ +#define LPC17_ETH_RXFLWOLST_OFFSET 0x0204 /* Receive filter WoL status register */ +#define LPC17_ETH_RXFLWOLCLR_OFFSET 0x0208 /* Receive filter WoL clear register */ +#define LPC17_ETH_HASHFLL_OFFSET 0x0210 /* Hash filter table LSBs register */ +#define LPC17_ETH_HASHFLH_OFFSET 0x0214 /* Hash filter table MSBs register */ + +/* Module control registers */ + +#define LPC17_ETH_INTST_OFFSET 0x0fe0 /* Interrupt status register */ +#define LPC17_ETH_INTEN_OFFSET 0x0fe4 /* Interrupt enable register */ +#define LPC17_ETH_INTCLR_OFFSET 0x0fe8 /* Interrupt clear register */ +#define LPC17_ETH_INTSET_OFFSET 0x0fec /* Interrupt set register */ +#define LPC17_ETH_PWRDOWN_OFFSET 0x0ff4 /* Power-down register */ + +/* Register addresses ***************************************************************/ +/* MAC registers */ + +#define LPC17_ETH_MAC1 (LPC17_ETH_BASE+LPC17_ETH_MAC1_OFFSET) +#define LPC17_ETH_MAC2 (LPC17_ETH_BASE+LPC17_ETH_MAC2_OFFSET) +#define LPC17_ETH_IPGT (LPC17_ETH_BASE+LPC17_ETH_IPGT_OFFSET) +#define LPC17_ETH_IPGR (LPC17_ETH_BASE+LPC17_ETH_IPGR_OFFSET) +#define LPC17_ETH_CLRT (LPC17_ETH_BASE+LPC17_ETH_CLRT_OFFSET) +#define LPC17_ETH_MAXF (LPC17_ETH_BASE+LPC17_ETH_MAXF_OFFSET) +#define LPC17_ETH_SUPP (LPC17_ETH_BASE+LPC17_ETH_SUPP_OFFSET) +#define LPC17_ETH_TEST (LPC17_ETH_BASE+LPC17_ETH_TEST_OFFSET) +#define LPC17_ETH_MCFG (LPC17_ETH_BASE+LPC17_ETH_MCFG_OFFSET) +#define LPC17_ETH_MCMD (LPC17_ETH_BASE+LPC17_ETH_MCMD_OFFSET) +#define LPC17_ETH_MADR (LPC17_ETH_BASE+LPC17_ETH_MADR_OFFSET) +#define LPC17_ETH_MWTD (LPC17_ETH_BASE+LPC17_ETH_MWTD_OFFSET) +#define LPC17_ETH_MRDD (LPC17_ETH_BASE+LPC17_ETH_MRDD_OFFSET) +#define LPC17_ETH_MIND (LPC17_ETH_BASE+LPC17_ETH_MIND_OFFSET) +#define LPC17_ETH_SA0 (LPC17_ETH_BASE+LPC17_ETH_SA0_OFFSET) +#define LPC17_ETH_SA1 (LPC17_ETH_BASE+LPC17_ETH_SA1_OFFSET) +#define LPC17_ETH_SA2 (LPC17_ETH_BASE+LPC17_ETH_SA2_OFFSET) + +/* Control registers */ + +#define LPC17_ETH_CMD (LPC17_ETH_BASE+LPC17_ETH_CMD_OFFSET) +#define LPC17_ETH_STAT (LPC17_ETH_BASE+LPC17_ETH_STAT_OFFSET) +#define LPC17_ETH_RXDESC (LPC17_ETH_BASE+LPC17_ETH_RXDESC_OFFSET) +#define LPC17_ETH_RXSTAT (LPC17_ETH_BASE+LPC17_ETH_RXSTAT_OFFSET) +#define LPC17_ETH_RXDESCNO (LPC17_ETH_BASE+LPC17_ETH_RXDESCNO_OFFSET) +#define LPC17_ETH_RXPRODIDX (LPC17_ETH_BASE+LPC17_ETH_RXPRODIDX_OFFSET) +#define LPC17_ETH_RXCONSIDX (LPC17_ETH_BASE+LPC17_ETH_RXCONSIDX_OFFSET) +#define LPC17_ETH_TXDESC (LPC17_ETH_BASE+LPC17_ETH_TXDESC_OFFSET) +#define LPC17_ETH_TXSTAT (LPC17_ETH_BASE+LPC17_ETH_TXSTAT_OFFSET) +#define LPC17_ETH_TXDESCRNO (LPC17_ETH_BASE+LPC17_ETH_TXDESCRNO_OFFSET) +#define LPC17_ETH_TXPRODIDX (LPC17_ETH_BASE+LPC17_ETH_TXPRODIDX_OFFSET) +#define LPC17_ETH_TXCONSIDX (LPC17_ETH_BASE+LPC17_ETH_TXCONSIDX_OFFSET) +#define LPC17_ETH_TSV0 (LPC17_ETH_BASE+LPC17_ETH_TSV0_OFFSET) +#define LPC17_ETH_TSV1 (LPC17_ETH_BASE+LPC17_ETH_TSV1_OFFSET) +#define LPC17_ETH_RSV (LPC17_ETH_BASE+LPC17_ETH_RSV_OFFSET) +#define LPC17_ETH_FCCNTR (LPC17_ETH_BASE+LPC17_ETH_FCCNTR_OFFSET) +#define LPC17_ETH_FCSTAT (LPC17_ETH_BASE+LPC17_ETH_FCSTAT_OFFSET) + +/* Rx filter registers */ + +#define LPC17_ETH_RXFLCTRL (LPC17_ETH_BASE+LPC17_ETH_RXFLCTRL_OFFSET) +#define LPC17_ETH_RXFLWOLST (LPC17_ETH_BASE+LPC17_ETH_RXFLWOLST_OFFSET) +#define LPC17_ETH_RXFLWOLCLR (LPC17_ETH_BASE+LPC17_ETH_RXFLWOLCLR_OFFSET) +#define LPC17_ETH_HASHFLL (LPC17_ETH_BASE+LPC17_ETH_HASHFLL_OFFSET) +#define LPC17_ETH_HASHFLH (LPC17_ETH_BASE+LPC17_ETH_HASHFLH_OFFSET) + +/* Module control registers */ + +#define LPC17_ETH_INTST (LPC17_ETH_BASE+LPC17_ETH_INTST_OFFSET) +#define LPC17_ETH_INTEN (LPC17_ETH_BASE+LPC17_ETH_INTEN_OFFSET) +#define LPC17_ETH_INTCLR (LPC17_ETH_BASE+LPC17_ETH_INTCLR_OFFSET) +#define LPC17_ETH_INTSET (LPC17_ETH_BASE+LPC17_ETH_INTSET_OFFSET) +#define LPC17_ETH_PWRDOWN (LPC17_ETH_BASE+LPC17_ETH_PWRDOWN_OFFSET) + +/* Register bit definitions *********************************************************/ +/* MAC registers */ +/* MAC configuration register 1 (MAC1) */ + +#define ETH_MAC1_RE (1 << 0) /* Bit 0: Receive enable */ +#define ETH_MAC1_PARF (1 << 1) /* Bit 1: Passall all receive frames */ +#define ETH_MAC1_RFC (1 << 2) /* Bit 2: RX flow control */ +#define ETH_MAC1_TFC (1 << 3) /* Bit 3: TX flow control */ +#define ETH_MAC1_LPBK (1 << 4) /* Bit 4: Loopback */ + /* Bits 5-7: Reserved */ +#define ETH_MAC1_TXRST (1 << 8) /* Bit 8: Reset TX */ +#define ETH_MAC1_MCSTXRST (1 << 9) /* Bit 9: Reset MCS/TX */ +#define ETH_MAC1_RXRST (1 << 10) /* Bit 10: Reset RX */ +#define ETH_MAC1_MCSRXRST (1 << 11) /* Bit 11: Reset MCS/RX */ + /* Bits 12-13: Reserved */ +#define ETH_MAC1_SIMRST (1 << 14) /* Bit 14: Simulation reset */ +#define ETH_MAC1_SOFTRST (1 << 15) /* Bit 15: Soft reset */ + /* Bits 16-31: Reserved */ +/* MAC configuration register 2 (MAC2) */ + +#define ETH_MAC2_FD (1 << 0) /* Bit 0: Full duplex */ +#define ETH_MAC2_FLC (1 << 1) /* Bit 1: Frame length checking */ +#define ETH_MAC2_HFE (1 << 2) /* Bit 2: Huge frame enable */ +#define ETH_MAC2_DCRC (1 << 3) /* Bit 3: Delayed CRC */ +#define ETH_MAC2_CRCEN (1 << 4) /* Bit 4: CRC enable */ +#define ETH_MAC2_PADCRCEN (1 << 5) /* Bit 5: Pad/CRC enable */ +#define ETH_MAC2_VLANPADEN (1 << 6) /* Bit 6: VLAN pad enable */ +#define ETH_MAC2_AUTOPADEN (1 << 7) /* Bit 7: Auto detect pad enable */ +#define ETH_MAC2_PPE (1 << 8) /* Bit 8: Pure preamble enforcement */ +#define ETH_MAC2_LPE (1 << 9) /* Bit 9: Long preamble enforcement */ + /* Bits 10-11: Reserved */ +#define ETH_MAC2_NBKOFF (1 << 12) /* Bit 12: No backoff */ +#define ETH_MAC2_BPNBKOFF (1 << 13) /* Bit 13: Back pressure/no backoff */ +#define ETH_MAC2_EXDEF (1 << 14) /* Bit 14: Excess defer */ + /* Bits 15-31: Reserved */ +/* Back-to-Back Inter-Packet-Gap register (IPGT) */ + +#define ETH_IPGT_SHIFT (0) /* Bits 0-6 */ +#define ETH_IPGT_MASK (0x7f << ETH_IPGT_SHIFT) + /* Bits 7-31: Reserved */ +/* Non Back-to-Back Inter-Packet-Gap register (IPGR) */ + +#define ETH_IPGR_GAP2_SHIFT (0) /* Bits 0-6: Gap part 2 */ +#define ETH_IPGR_GAP2_MASK (0x7f << ETH_IPGR_GAP2_SHIFT) + /* Bit 7: Reserved */ +#define ETH_IPGR_GAP1_SHIFT (8) /* Bits 8-18: Gap part 1 */ +#define ETH_IPGR_GAP1_MASK (0x7f << ETH_IPGR_GAP2_SHIFT) + /* Bits 15-31: Reserved */ +/* Collision window / Retry register (CLRT) */ + +#define ETH_CLRT_RMAX_SHIFT (0) /* Bits 0-3: Retransmission maximum */ +#define ETH_CLRT_RMAX_MASK (15 << ETH_CLRT_RMAX_SHIFT) + /* Bits 4-7: Reserved */ +#define ETH_CLRT_COLWIN_SHIFT (8) /* Bits 8-13: Collision window */ +#define ETH_CLRT_COLWIN_MASK (0x3f << ETH_CLRT_COLWIN_SHIFT) + /* Bits 14-31: Reserved */ +/* Maximum Frame register (MAXF) */ + +#define ETH_MAXF_SHIFT (0) /* Bits 0-15 */ +#define ETH_MAXF_MASK (0xffff << ETH_MAXF_SHIFT) + /* Bits 16-31: Reserved */ +/* PHY Support register (SUPP) */ + /* Bits 0-7: Reserved */ +#define ETH_SUPP_SPEED (1 << 8) /* Bit 8: 0=10Bps 1=100Bps */ + /* Bits 9-31: Reserved */ +/* Test register (TEST) */ + +#define ETH_TEST_SPQ (1 << 0) /* Bit 0: Shortcut pause quanta */ +#define ETH_TEST_TP (1 << 1) /* Bit 1: Test pause */ +#define ETH_TEST_TBP (1 << 2) /* Bit 2: Test packpressure */ + /* Bits 3-31: Reserved */ +/* MII Mgmt Configuration register (MCFG) */ + +#define ETH_MCFG_SCANINC (1 << 0) /* Bit 0: Scan increment */ +#define ETH_MCFG_SUPPRE (1 << 1) /* Bit 1: Suppress preamble */ +#define ETH_MCFG_CLKSEL_SHIFT (2) /* Bits 2-5: Clock select */ +#define ETH_MCFG_CLKSEL_MASK (15 << ETH_MCFG_CLKSEL_SHIFT) +# define ETH_MCFG_CLKSEL_DIV4 (0 << ETH_MCFG_CLKSEL_SHIFT) +# define ETH_MCFG_CLKSEL_DIV6 (2 << ETH_MCFG_CLKSEL_SHIFT) +# define ETH_MCFG_CLKSEL_DIV8 (3 << ETH_MCFG_CLKSEL_SHIFT) +# define ETH_MCFG_CLKSEL_DIV10 (4 << ETH_MCFG_CLKSEL_SHIFT) +# define ETH_MCFG_CLKSEL_DIV14 (5 << ETH_MCFG_CLKSEL_SHIFT) +# define ETH_MCFG_CLKSEL_DIV20 (6 << ETH_MCFG_CLKSEL_SHIFT) +# define ETH_MCFG_CLKSEL_DIV28 (7 << ETH_MCFG_CLKSEL_SHIFT) +# define ETH_MCFG_CLKSEL_DIV36 (8 << ETH_MCFG_CLKSEL_SHIFT) +# define ETH_MCFG_CLKSEL_DIV40 (9 << ETH_MCFG_CLKSEL_SHIFT) +# define ETH_MCFG_CLKSEL_DIV44 (10 << ETH_MCFG_CLKSEL_SHIFT) +# define ETH_MCFG_CLKSEL_DIV48 (11 << ETH_MCFG_CLKSEL_SHIFT) +# define ETH_MCFG_CLKSEL_DIV52 (12 << ETH_MCFG_CLKSEL_SHIFT) +# define ETH_MCFG_CLKSEL_DIV56 (13 << ETH_MCFG_CLKSEL_SHIFT) +# define ETH_MCFG_CLKSEL_DIV60 (14 << ETH_MCFG_CLKSEL_SHIFT) +# define ETH_MCFG_CLKSEL_DIV64 (15 << ETH_MCFG_CLKSEL_SHIFT) + /* Bits 6-14: Reserved */ +#define ETH_MCFG_MIIRST (1 << 15) /* Bit 15: Reset MII mgmt */ + /* Bits 16-31: Reserved */ +/* MII Mgmt Command register (MCMD) */ + +#define ETH_MCMD_READ (1 << 0) /* Bit 0: Single read cycle */ +#define ETH_MCMD_SCAN (1 << 1) /* Bit 1: Continuous read cycles */ + /* Bits 2-31: Reserved */ +#define ETH_MCMD_WRITE (0) + +/* MII Mgmt Address register (MADR) */ + +#define ETH_MADR_REGADDR_SHIFT (0) /* Bits 0-4: Register address */ +#define ETH_MADR_REGADDR_MASK (31 << ETH_MADR_REGADDR_SHIFT) + /* Bits 7-5: Reserved */ +#define ETH_MADR_PHYADDR_SHIFT (8) /* Bits 8-12: PHY address */ +#define ETH_MADR_PHYADDR_MASK (31 << ETH_MADR_PHYADDR_SHIFT) + /* Bits 13-31: Reserved */ +/* MII Mgmt Write Data register (MWTD) */ + +#define ETH_MWTD_SHIFT (0) /* Bits 0-15 */ +#define ETH_MWTD_MASK (0xffff << ETH_MWTD_SHIFT) + /* Bits 16-31: Reserved */ +/* MII Mgmt Read Data register (MRDD) */ + +#define ETH_MRDD_SHIFT (0) /* Bits 0-15 */ +#define ETH_MRDD_MASK (0xffff << ETH_MRDD_SHIFT) + /* Bits 16-31: Reserved */ +/* MII Mgmt Indicators register (MIND) */ + +#define ETH_MIND_BUSY (1 << 0) /* Bit 0: Busy */ +#define ETH_MIND_SCANNING (1 << 1) /* Bit 1: Scanning */ +#define ETH_MIND_NVALID (1 << 2) /* Bit 2: Not valid */ +#define ETH_MIND_MIIFAIL (1 << 3) /* Bit 3: MII link fail */ + /* Bits 4-31: Reserved */ +/* Station Address 0 register (SA0) */ + +#define ETH_SA0_OCTET2_SHIFT (0) /* Bits 0-7: Station address 2nd octet */ +#define ETH_SA0_OCTET2_MASK (0xff << ETH_SA0_OCTET2_SHIFT) +#define ETH_SA0_OCTET1_SHIFT (8) /* Bits 8-15: Station address 1st octet */ +#define ETH_SA0_OCTET1_MASK (0xff << ETH_SA0_OCTET1_SHIFT) + /* Bits 16-31: Reserved */ +/* Station Address 1 register (SA1) */ + +#define ETH_SA1_OCTET4_SHIFT (0) /* Bits 0-7: Station address 4th octet */ +#define ETH_SA1_OCTET4_MASK (0xff << ETH_SA0_OCTET4_SHIFT) +#define ETH_SA1_OCTET3_SHIFT (8) /* Bits 8-15: Station address 3rd octet */ +#define ETH_SA1_OCTET3_MASK (0xff << ETH_SA0_OCTET3_SHIFT) + /* Bits 16-31: Reserved */ +/* Station Address 2 register (SA2) */ + +#define ETH_SA2_OCTET6_SHIFT (0) /* Bits 0-7: Station address 5th octet */ +#define ETH_SA2_OCTET6_MASK (0xff << ETH_SA0_OCTET6_SHIFT) +#define ETH_SA2_OCTET5_SHIFT (8) /* Bits 8-15: Station address 6th octet */ +#define ETH_SA2_OCTET5_MASK (0xff << ETH_SA0_OCTET5_SHIFT) + /* Bits 16-31: Reserved */ +/* Control registers */ +/* Command register (CMD) */ + +#define ETH_CMD_RXEN (1 << 0) /* Bit 0: Receive enable */ +#define ETH_CMD_TXEN (1 << 1) /* Bit 1: Transmit enable */ + /* Bit 2: Reserved */ +#define ETH_CMD_REGRST (1 << 3) /* Bit 3: Reset host registers */ +#define ETH_CMD_TXRST (1 << 4) /* Bit 4: Reset transmit datapath */ +#define ETH_CMD_RXRST (1 << 5) /* Bit 5: Reset receive datapath */ +#define ETH_CMD_PRFRAME (1 << 6) /* Bit 6: Pass run frame */ +#define ETH_CMD_PRFILTER (1 << 7) /* Bit 7: Pass RX filter */ +#define ETH_CMD_TXFC (1 << 8) /* Bit 8: TX flow control */ +#define ETH_CMD_RMII (1 << 9) /* Bit 9: RMII mode */ +#define ETH_CMD_FD (1 << 10) /* Bit 10: Full duplex */ + /* Bits 11-31: Reserved */ +/* Status register */ + +#define ETH_STAT_RX (1 << 0) /* Bit 0: RX status */ +#define ETH_STAT_TX (1 << 1) /* Bit 1: TX status */ + /* Bits 2-31: Reserved */ +/* Receive descriptor base address register (RXDESC) + * + * The receive descriptor base address is a byte address aligned to a word + * boundary i.e. LSB 1:0 are fixed to 00. The register contains the lowest + * address in the array of descriptors. + */ + +/* Receive status base address register (RXSTAT) + * + * The receive status base address is a byte address aligned to a double word + * boundary i.e. LSB 2:0 are fixed to 000. + */ + +/* Receive number of descriptors register (RXDESCNO) */ + +#define ETH_RXDESCNO_SHIFT (0) /* Bits 0-15 */ +#define ETH_RXDESCNO_MASK (0xffff << ETH_RXDESCNO_SHIFT) + /* Bits 16-31: Reserved */ +/* Receive produce index register (RXPRODIDX) */ + +#define ETH_RXPRODIDX_SHIFT (0) /* Bits 0-15 */ +#define ETH_RXPRODIDX_MASK (0xffff << ETH_RXPRODIDX_SHIFT) + /* Bits 16-31: Reserved */ +/* Receive consume index register (RXCONSIDX) */ + +#define ETH_RXCONSIDX_SHIFT (0) /* Bits 0-15 */ +#define ETH_RXCONSIDX_MASK (0xffff << ETH_RXPRODIDX_SHIFT) + /* Bits 16-31: Reserved */ +/* Transmit descriptor base address register (TXDESC) + * + * The transmit descriptor base address is a byte address aligned to a word + * boundary i.e. LSB 1:0 are fixed to 00. The register contains the lowest + * address in the array of descriptors. + */ + +/* Transmit status base address register (TXSTAT) + * + * The transmit status base address is a byte address aligned to a word + * boundary i.e. LSB1:0 are fixed to 00. The register contains the lowest + * address in the array of statuses. + */ + +/* Transmit number of descriptors register (TXDESCRNO) */ + +#define ETH_TXDESCRNO_SHIFT (0) /* Bits 0-15 */ +#define ETH_TXDESCRNO_MASK (0xffff << ETH_TXDESCRNO_SHIFT) + /* Bits 16-31: Reserved */ +/* Transmit produce index register (TXPRODIDX) */ + +#define ETH_TXPRODIDX_SHIFT (0) /* Bits 0-15 */ +#define ETH_TXPRODIDX_MASK (0xffff << ETH_TXPRODIDX_SHIFT) + /* Bits 16-31: Reserved */ +/* Transmit consume index register (TXCONSIDX) */ + +#define ETH_TXCONSIDX_SHIFT (0) /* Bits 0-15 */ +#define ETH_TXCONSIDX_MASK (0xffff << ETH_TXPRODIDX_SHIFT) + /* Bits 16-31: Reserved */ +/* Transmit status vector 0 register (TSV0) */ + +#define ETH_TSV0_CRCERR (1 << 0) /* Bit 0: CRC error */ +#define ETH_TSV0_LENCHKERR (1 << 1) /* Bit 1: Length check error */ +#define ETH_TSV0_LENOOR (1 << 2) /* Bit 2: Length out of range */ +#define ETH_TSV0_DONE (1 << 3) /* Bit 3: Done */ +#define ETH_TSV0_MCAST (1 << 4) /* Bit 4: Multicast */ +#define ETH_TSV0_BCAST (1 << 5) /* Bit 5: Broadcast */ +#define ETH_TSV0_PKTDEFER (1 << 6) /* Bit 6: Packet Defer */ +#define ETH_TSV0_EXCDEFER (1 << 7) /* Bit 7: Excessive Defer */ +#define ETH_TSV0_EXCCOL (1 << 8) /* Bit 8: Excessive Collision */ +#define ETH_TSV0_LATECOL (1 << 9) /* Bit 9: Late Collision */ +#define ETH_TSV0_GIANT (1 << 10) /* Bit 10: Giant */ +#define ETH_TSV0_UNDRUN (1 << 11) /* Bit 11: Underrun */ +#define ETH_TSV0_TOTBYTES_SHIFT (12) /* Bits 12-27:Total bytes */ +#define ETH_TSV0_TOTBYTES_MASK (0xffff << ETH_TSV0_TOTBYTES_SHIFT) +#define ETH_TSV0_CTLFRAME (1 << 28) /* Bit 28: Control frame */ +#define ETH_TSV0_PAUSE (1 << 29) /* Bit 29: Pause */ +#define ETH_TSV0_BP (1 << 30) /* Bit 30: Backpressure */ +#define ETH_TSV0_VLAN (1 << 31) /* Bit 31: VLAN */ + +/* Transmit status vector 1 register (TSV1) */ + +#define ETH_TSV1_TXCNT_SHIFT (0) /* Bits 0-15: Transmit byte count */ +#define ETH_TSV1_TXCNT_MASK (0xffff << ETH_TSV1_TXCNT_SHIFT) +#define ETH_TSV1_COLCNT_SHIFT (16) /* Bits 16-19: Transmit collision count */ +#define ETH_TSV1_COLCNT_MASK (15 << ETH_TSV1_COLCNT_SHIFT) + /* Bits 20-31: Reserved */ +/* Receive status vector register (RSV) */ + +#define ETH_RSV_RXCNT_SHIFT (0) /* Bits 0-15: Received byte count */ +#define ETH_RSV_RXCNT_MASK (0xffff << ETH_RSV_RXCNT_SHIFT) +#define ETH_RSV_PKTPI (1 << 16) /* Bit 16: Packet previously ignored */ +#define ETH_RSV_RXEPS (1 << 17) /* Bit 17: RXDV event previously seen */ +#define ETH_RSV_CEPS (1 << 18) /* Bit 18: Carrier event previously seen */ +#define ETH_RSV_RXCV (1 << 19) /* Bit 19: Receive code violation */ +#define ETH_RSV_CRCERR (1 << 20) /* Bit 20: CRC error */ +#define ETH_RSV_LENCHKERR (1 << 21) /* Bit 21: Length check error */ +#define ETH_RSV_LENOOR (1 << 22) /* Bit 22: Length out of range */ +#define ETH_RSV_RXOK (1 << 23) /* Bit 23: Receive OK */ +#define ETH_RSV_MCAST (1 << 24) /* Bit 24: Multicast */ +#define ETH_RSV_BCAST (1 << 25) /* Bit 25: Broadcast */ +#define ETH_RSV_DRIBNIB (1 << 26) /* Bit 26: Dribble Nibble */ +#define ETH_RSV_CTLFRAME (1 << 27) /* Bit 27: Control frame */ +#define ETH_RSV_PAUSE (1 << 28) /* Bit 28: Pause */ +#define ETH_RSV_UNSUPOP (1 << 29) /* Bit 29: Unsupported Opcode */ +#define ETH_RSV_VLAN (1 << 30) /* Bit 30: VLAN */ + /* Bit 31: Reserved */ +/* Flow control counter register (FCCNTR) */ + +#define ETH_FCCNTR_MCOUNT_SHIFT (0) /* Bits 0-15: Mirror count */ +#define ETH_FCCNTR_MCOUNT_MASK (0xffff << ETH_FCCNTR_MCOUNT_SHIFT) +#define ETH_FCCNTR_PTMR_SHIFT (16) /* Bits 16-31: Pause timer */ +#define ETH_FCCNTR_PTMR_MASK (0xffff << ETH_FCCNTR_PTMR_SHIFT) + +/* Flow control status register (FCSTAT) */ + +#define ETH_FCSTAT_MCOUNT_SHIFT (0) /* Bits 0-15: Current mirror count */ +#define ETH_FCSTAT_MCOUNT_MASK (0xffff << ETH_FCSTAT_MCOUNT_SHIFT) + /* Bits 16-31: Reserved */ +/* Rx filter registers */ +/* Receive filter control register (RXFLCTRL) */ + +#define ETH_RXFLCTRL_UCASTEN (1 << 0) /* Bit 0: Accept all unicast frames */ +#define ETH_RXFLCTRL_BCASTEN (1 << 1) /* Bit 1: Accept all broadcast frames */ +#define ETH_RXFLCTRL_MCASTEN (1 << 2) /* Bit 2: Accept all multicast frames */ +#define ETH_RXFLCTRL_UCASTHASHEN (1 << 3) /* Bit 3: Accept hashed unicast */ +#define ETH_RXFLCTRL_MCASTHASHEN (1 << 4) /* Bit 4: Accect hashed multicast */ +#define ETH_RXFLCTRL_PERFEN (1 << 5) /* Bit 5: Accept perfect dest match */ + /* Bits 6-11: Reserved */ +#define ETH_RXFLCTRL_MPKTEN (1 << 12) /* Bit 12: Magic pkt filter WoL int */ +#define ETH_RXFLCTRL_RXFILEN (1 << 13) /* Bit 13: Perfect match WoL interrupt */ + /* Bits 14-31: Reserved */ +/* Receive filter WoL status register (RXFLWOLST) AND + * Receive filter WoL clear register (RXFLWOLCLR) + */ + +#define ETH_RXFLWOL_UCAST (1 << 0) /* Bit 0: Unicast frame WoL */ +#define ETH_RXFLWOL_BCAST (1 << 1) /* Bit 1: Broadcast frame WoL */ +#define ETH_RXFLWOL_MCAST (1 << 2) /* Bit 2: Multicast frame WoL */ +#define ETH_RXFLWOL_UCASTHASH (1 << 3) /* Bit 3: Unicast hash filter WoL */ +#define ETH_RXFLWOL_MCASTHASH (1 << 4) /* Bit 4: Multiicast hash filter WoL */ +#define ETH_RXFLWOL_PERF (1 << 5) /* Bit 5: Perfect addr match WoL */ + /* Bit 6: Reserved */ +#define ETH_RXFLWOL_RXFIL (1 << 7) /* Bit 7: Receive filter WoL */ +#define ETH_RXFLWOL_MPKT (1 << 8) /* Bit 8: Magic pkt filter WoL */ + /* Bits 9-31: Reserved */ +/* Hash filter table LSBs register (HASHFLL) AND Hash filter table MSBs register +* (HASHFLH) Are registers containing a 32-bit value with no bitfield. + */ + +/* Module control registers */ +/* Interrupt status register (INTST), Interrupt enable register (INTEN), Interrupt + * clear register (INTCLR), and Interrupt set register (INTSET) common bit field + * definition: + */ + +#define ETH_INT_RXOVR (1 << 0) /* Bit 0: RX overrun interrupt */ +#define ETH_INT_RXERR (1 << 1) /* Bit 1: RX error interrupt */ +#define ETH_INT_RXFIN (1 << 2) /* Bit 2: RX finished interrupt */ +#define ETH_INT_RXDONE (1 << 3) /* Bit 3: RX done interrupt */ +#define ETH_INT_TXUNR (1 << 4) /* Bit 4: TX underrun interrupt */ +#define ETH_INT_TXERR (1 << 5) /* Bit 5: TX error interrupt */ +#define ETH_INT_TXFIN (1 << 6) /* Bit 6: TX finished interrupt */ +#define ETH_INT_TXDONE (1 << 7) /* Bit 7: TX done interrupt */ + /* Bits 8-11: Reserved */ +#define ETH_INT_SOFT (1 << 12) /* Bit 12: Soft interrupt */ +#define ETH_INT_WKUP (1 << 13) /* Bit 13: Wakeup interrupt */ + /* Bits 14-31: Reserved */ +/* Power-down register */ + /* Bits 0-30: Reserved */ +#define ETH_PWRDOWN_MACAHB (1 << 31) /* Power down MAC/AHB */ + +/* Descriptors Offsets **************************************************************/ + +/* Tx descriptor offsets */ + +#define LPC17_TXDESC_PACKET 0x00 /* Base address of the Tx data buffer */ +#define LPC17_TXDESC_CONTROL 0x04 /* Control Information */ +#define LPC17_TXDESC_SIZE 0x08 /* Size in bytes of one Tx descriptor */ + +/* Tx status offsets */ + +#define LPC17_TXSTAT_INFO 0x00 /* Transmit status return flags */ +#define LPC17_TXSTAT_SIZE 0x04 /* Size in bytes of one Tx status */ + +/* Rx descriptor offsets */ + +#define LPC17_RXDESC_PACKET 0x00 /* Base address of the Rx data buffer */ +#define LPC17_RXDESC_CONTROL 0x04 /* Control Information */ +#define LPC17_RXDESC_SIZE 0x08 /* Size in bytes of one Rx descriptor */ + +/* Rx status offsets */ + +#define LPC17_RXSTAT_INFO 0x00 /* Receive status return flags */ +#define LPC17_RXSTAT_HASHCRC 0x04 /* Dest and source hash CRC */ +#define LPC17_RXSTAT_SIZE 0x08 /* Size in bytes of one Rx status */ + +/* Descriptor Bit Definitions *******************************************************/ + +/* Tx descriptor bit definitions */ + +#define TXDESC_CONTROL_SIZE_SHIFT (0) /* Bits 0-10: Size of data buffer */ +#define TXDESC_CONTROL_SIZE_MASK (0x7ff << RXDESC_CONTROL_SIZE_SHIFT) + +#define TXDESC_CONTROL_OVERRIDE (1 << 26 /* Bit 26: Per-frame override */ +#define TXDESC_CONTROL_HUGE (1 << 27) /* Bit 27: Enable huge frame size */ +#define TXDESC_CONTROL_PAD (1 << 28) /* Bit 28: Pad short frames */ +#define TXDESC_CONTROL_CRC (1 << 29) /* Bit 29: Append CRC */ +#define TXDESC_CONTROL_LAST (1 << 30) /* Bit 30: Last descriptor of a fragment */ +#define TXDESC_CONTROL_INT (1 << 31) /* Bit 31: Generate TxDone interrupt */ + +/* Tx status bit definitions */ + +#define TXSTAT_INFO_COLCNT_SHIFT (21) /* Bits 21-24: Number of collisions */ +#define TXSTAT_INFO_COLCNT_MASK (15 << TXSTAT_INFO_COLCNT_SHIFT) +#define TXSTAT_INFO_DEFER (1 << 25) /* Bit 25: Packet deffered */ +#define TXSTAT_INFO_EXCESSDEFER (1 << 26) /* Bit 26: Excessive packet defferals */ +#define TXSTAT_INFO_EXCESSCOL (1 << 27) /* Bit 27: Excessive packet collisions */ +#define TXSTAT_INFO_LATECOL (1 << 28) /* Bit 28: Out of window collision */ +#define TXSTAT_INFO_UNDERRUN (1 << 29) /* Bit 29: Tx underrun */ +#define TXSTAT_INFO_NODESC (1 << 30) /* Bit 29: No Tx descriptor available */ +#define TXSTAT_INFO_ERROR (1 << 31) /* Bit 31: OR of other error conditions */ + +/* Rx descriptor bit definitions */ + +#define RXDESC_CONTROL_SIZE_SHIFT (0) /* Bits 0-10: Size of data buffer */ +#define RXDESC_CONTROL_SIZE_MASK (0x7ff << RXDESC_CONTROL_SIZE_SHIFT) +#define RXDESC_CONTROL_INT (1 << 31) /* Bit 31: Generate RxDone interrupt */ + +/* Rx status bit definitions */ + +#define RXSTAT_SAHASHCRC_SHIFT (0) /* Bits 0-8: Hash CRC calculated from the source address */ +#define RXSTAT_SAHASHCRC_MASK (0x1ff << RXSTAT_SAHASHCRC_SHIFT) +#define RXSTAT_DAHASHCRC_SHIFT (16) /* Bits 16-24: Hash CRC calculated from the dest address */ +#define RXSTAT_DAHASHCRC_MASK (0x1ff << RXSTAT_DAHASHCRC_SHIFT) + +#define RXSTAT_INFO_RXSIZE_SHIFT (0) /* Bits 0-10: Size of actual data transferred */ +#define RXSTAT_INFO_RXSIZE_MASK (0x7ff << RXSTAT_INFO_RXSIZE_SHIFT) +#define RXSTAT_INFO_CONTROL (1 << 18) /* Bit 18: This is a control frame */ +#define RXSTAT_INFO_VLAN (1 << 19) /* Bit 19: This is a VLAN frame */ +#define RXSTAT_INFO_FAILFILTER (1 << 20) /* Bit 20: Frame failed Rx filter */ +#define RXSTAT_INFO_MULTICAST (1 << 21) /* Bit 21: This is a multicast frame */ +#define RXSTAT_INFO_BROADCAST (1 << 22) /* Bit 22: This is a broadcast frame */ +#define RXSTAT_INFO_CRCERROR (1 << 23) /* Bit 23: Received frame had a CRC error */ +#define RXSTAT_INFO_SYMBOLERROR (1 << 24) /* Bit 24: PHY reported bit error */ +#define RXSTAT_INFO_LENGTHERROR (1 << 25) /* Bit 25: Invalid frame length */ +#define RXSTAT_INFO_RANGEERROR (1 << 26) /* Bit 26: Exceeds maximum packet size */ +#define RXSTAT_INFO_ALIGNERROR (1 << 27) /* Bit 27: Alignment error */ +#define RXSTAT_INFO_OVERRUN (1 << 28) /* Bit 28: Receive overrun error */ +#define RXSTAT_INFO_NODESC (1 << 29) /* Bit 29: No Rx descriptor available */ +#define RXSTAT_INFO_LASTFLAG (1 << 30) /* Bit 30: Last fragment of a frame */ +#define RXSTAT_INFO_ERROR (1 << 31) /* Bit 31: OR of other error conditions */ + +/************************************************************************************ + * Public Types + ************************************************************************************/ + +/************************************************************************************ + * Public Data + ************************************************************************************/ + +/************************************************************************************ + * Public Functions + ************************************************************************************/ + +#endif /* __ARCH_ARM_SRC_LPC17XX_CHIP_LPC17_ETHERNET_H */ diff --git a/nuttx/arch/arm/src/lpc17xx/chip/lpc17_gpdma.h b/nuttx/arch/arm/src/lpc17xx/chip/lpc17_gpdma.h new file mode 100644 index 0000000000..4a14c18538 --- /dev/null +++ b/nuttx/arch/arm/src/lpc17xx/chip/lpc17_gpdma.h @@ -0,0 +1,417 @@ +/************************************************************************************ + * arch/arm/src/lpc17xx/chip/lpc17_gpdma.h + * + * Copyright (C) 2010, 2013 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * 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. + * + ************************************************************************************/ + +#ifndef __ARCH_ARM_SRC_LPC17XX_CHIP_LPC17_GPDMA_H +#define __ARCH_ARM_SRC_LPC17XX_CHIP_LPC17_GPDMA_H + +/************************************************************************************ + * Included Files + ************************************************************************************/ + +#include + +#include "chip.h" +#include "chip/lpc17_memorymap.h" + +/************************************************************************************ + * Pre-processor Definitions + ************************************************************************************/ + +/* Register offsets *****************************************************************/ + +/* General registers (see also LPC17_SYSCON_DMAREQSEL_OFFSET in lpc17_syscon.h) */ + +#define LPC17_DMA_INTST_OFFSET 0x0000 /* DMA Interrupt Status Register */ +#define LPC17_DMA_INTTCST_OFFSET 0x0004 /* DMA Interrupt Terminal Count Request Status Register */ +#define LPC17_DMA_INTTCCLR_OFFSET 0x0008 /* DMA Interrupt Terminal Count Request Clear Register */ +#define LPC17_DMA_INTERRST_OFFSET 0x000c /* DMA Interrupt Error Status Register */ +#define LPC17_DMA_INTERRCLR_OFFSET 0x0010 /* DMA Interrupt Error Clear Register */ +#define LPC17_DMA_RAWINTTCST_OFFSET 0x0014 /* DMA Raw Interrupt Terminal Count Status Register */ +#define LPC17_DMA_RAWINTERRST_OFFSET 0x0018 /* DMA Raw Error Interrupt Status Register */ +#define LPC17_DMA_ENBLDCHNS_OFFSET 0x001c /* DMA Enabled Channel Register */ +#define LPC17_DMA_SOFTBREQ_OFFSET 0x0020 /* DMA Software Burst Request Register */ +#define LPC17_DMA_SOFTSREQ_OFFSET 0x0024 /* DMA Software Single Request Register */ +#define LPC17_DMA_SOFTLBREQ_OFFSET 0x0028 /* DMA Software Last Burst Request Register */ +#define LPC17_DMA_SOFTLSREQ_OFFSET 0x002c /* DMA Software Last Single Request Register */ +#define LPC17_DMA_CONFIG_OFFSET 0x0030 /* DMA Configuration Register */ +#define LPC17_DMA_SYNC_OFFSET 0x0034 /* DMA Synchronization Register */ + +/* Channel Registers */ + +#define LPC17_DMA_CHAN_OFFSET(n) (0x0100 + ((n) << 5)) /* n=0,1,...7 */ + +#define LPC17_DMACH_SRCADDR_OFFSET 0x0000 /* DMA Channel Source Address Register */ +#define LPC17_DMACH_DESTADDR_OFFSET 0x0004 /* DMA Channel Destination Address Register */ +#define LPC17_DMACH_LLI_OFFSET 0x0008 /* DMA Channel Linked List Item Register */ +#define LPC17_DMACH_CONTROL_OFFSET 0x000c /* DMA Channel Control Register */ +#define LPC17_DMACH_CONFIG_OFFSET 0x0010 /* DMA Channel Configuration Register */ + +#define LPC17_DMACH0_SRCADDR_OFFSET (0x100+LPC17_DMACH_SRCADDR_OFFSET) +#define LPC17_DMACH0_DESTADDR_OFFSET (0x100+LPC17_DMACH_DESTADDR_OFFSET) +#define LPC17_DMACH0_LLI_OFFSET (0x100+LPC17_DMACH_LLI_OFFSET) +#define LPC17_DMACH0_CONTROL_OFFSET (0x100+LPC17_DMACH_CONTROL_OFFSET) +#define LPC17_DMACH0_CONFIG_OFFSET (0x100+LPC17_DMACH_CONFIG_OFFSET) + +#define LPC17_DMACH1_SRCADDR_OFFSET (0x120+LPC17_DMACH_SRCADDR_OFFSET) +#define LPC17_DMACH1_DESTADDR_OFFSET (0x120+LPC17_DMACH_DESTADDR_OFFSET) +#define LPC17_DMACH1_LLI_OFFSET (0x120+LPC17_DMACH_LLI_OFFSET) +#define LPC17_DMACH1_CONTROL_OFFSET (0x120+LPC17_DMACH_CONTROL_OFFSET) +#define LPC17_DMACH1_CONFIG_OFFSET (0x120+LPC17_DMACH_CONFIG_OFFSET) + +#define LPC17_DMACH2_SRCADDR_OFFSET (0x140+LPC17_DMACH_SRCADDR_OFFSET) +#define LPC17_DMACH2_DESTADDR_OFFSET (0x140+LPC17_DMACH_DESTADDR_OFFSET) +#define LPC17_DMACH2_LLI_OFFSET (0x140+LPC17_DMACH_LLI_OFFSET) +#define LPC17_DMACH2_CONTROL_OFFSET (0x140+LPC17_DMACH_CONTROL_OFFSET) +#define LPC17_DMACH2_CONFIG_OFFSET (0x140+LPC17_DMACH_CONFIG_OFFSET) + +#define LPC17_DMACH3_SRCADDR_OFFSET (0x160+LPC17_DMACH_SRCADDR_OFFSET) +#define LPC17_DMACH3_DESTADDR_OFFSET (0x160+LPC17_DMACH_DESTADDR_OFFSET) +#define LPC17_DMACH3_LLI_OFFSET (0x160+LPC17_DMACH_LLI_OFFSET) +#define LPC17_DMACH3_CONTROL_OFFSET (0x160+LPC17_DMACH_CONTROL_OFFSET) +#define LPC17_DMACH3_CONFIG_OFFSET (0x160+LPC17_DMACH_CONFIG_OFFSET) + +#define LPC17_DMACH4_SRCADDR_OFFSET (0x180+LPC17_DMACH_SRCADDR_OFFSET) +#define LPC17_DMACH4_DESTADDR_OFFSET (0x180+LPC17_DMACH_DESTADDR_OFFSET) +#define LPC17_DMACH4_LLI_OFFSET (0x180+LPC17_DMACH_LLI_OFFSET) +#define LPC17_DMACH4_CONTROL_OFFSET (0x180+LPC17_DMACH_CONTROL_OFFSET) +#define LPC17_DMACH4_CONFIG_OFFSET (0x180+LPC17_DMACH_CONFIG_OFFSET) + +#define LPC17_DMACH5_SRCADDR_OFFSET (0x1a0+LPC17_DMACH_SRCADDR_OFFSET) +#define LPC17_DMACH5_DESTADDR_OFFSET (0x1a0+LPC17_DMACH_DESTADDR_OFFSET) +#define LPC17_DMACH5_LLI_OFFSET (0x1a0+LPC17_DMACH_LLI_OFFSET) +#define LPC17_DMACH5_CONTROL_OFFSET (0x1a0+LPC17_DMACH_CONTROL_OFFSET) +#define LPC17_DMACH5_CONFIG_OFFSET (0x1a0+LPC17_DMACH_CONFIG_OFFSET) + +#define LPC17_DMACH6_SRCADDR_OFFSET (0x1c0+LPC17_DMACH_SRCADDR_OFFSET) +#define LPC17_DMACH6_DESTADDR_OFFSET (0x1c0+LPC17_DMACH_DESTADDR_OFFSET) +#define LPC17_DMACH6_LLI_OFFSET (0x1c0+LPC17_DMACH_LLI_OFFSET) +#define LPC17_DMACH6_CONTROL_OFFSET (0x1c0+LPC17_DMACH_CONTROL_OFFSET) +#define LPC17_DMACH6_CONFIG_OFFSET (0x1c0+LPC17_DMACH_CONFIG_OFFSET) + +#define LPC17_DMACH7_SRCADDR_OFFSET (0x1e0+LPC17_DMACH_SRCADDR_OFFSET) +#define LPC17_DMACH7_DESTADDR_OFFSET (0x1e0+LPC17_DMACH_DESTADDR_OFFSET) +#define LPC17_DMACH7_LLI_OFFSET (0x1e0+LPC17_DMACH_LLI_OFFSET) +#define LPC17_DMACH7_CONTROL_OFFSET (0x1e0+LPC17_DMACH_CONTROL_OFFSET) +#define LPC17_DMACH7_CONFIG_OFFSET (0x1e0+LPC17_DMACH_CONFIG_OFFSET) + +/* Register addresses ***************************************************************/ +/* General registers (see also LPC17_SYSCON_DMAREQSEL in lpc17_syscon.h) */ + +#define LPC17_DMA_INTST (LPC17_GPDMA_BASE+LPC17_DMA_INTST_OFFSET) +#define LPC17_DMA_INTTCST (LPC17_GPDMA_BASE+LPC17_DMA_INTTCST_OFFSET) +#define LPC17_DMA_INTTCCLR (LPC17_GPDMA_BASE+LPC17_DMA_INTTCCLR_OFFSET) +#define LPC17_DMA_INTERRST (LPC17_GPDMA_BASE+LPC17_DMA_INTERRST_OFFSET) +#define LPC17_DMA_INTERRCLR (LPC17_GPDMA_BASE+LPC17_DMA_INTERRCLR_OFFSET) +#define LPC17_DMA_RAWINTTCST (LPC17_GPDMA_BASE+LPC17_DMA_RAWINTTCST_OFFSET) +#define LPC17_DMA_RAWINTERRST (LPC17_GPDMA_BASE+LPC17_DMA_RAWINTERRST_OFFSET) +#define LPC17_DMA_ENBLDCHNS (LPC17_GPDMA_BASE+LPC17_DMA_ENBLDCHNS_OFFSET) +#define LPC17_DMA_SOFTBREQ (LPC17_GPDMA_BASE+LPC17_DMA_SOFTBREQ_OFFSET) +#define LPC17_DMA_SOFTSREQ (LPC17_GPDMA_BASE+LPC17_DMA_SOFTSREQ_OFFSET) +#define LPC17_DMA_SOFTLBREQ (LPC17_GPDMA_BASE+LPC17_DMA_SOFTLBREQ_OFFSET) +#define LPC17_DMA_SOFTLSREQ (LPC17_GPDMA_BASE+LPC17_DMA_SOFTLSREQ_OFFSET) +#define LPC17_DMA_CONFIG (LPC17_GPDMA_BASE+LPC17_DMA_CONFIG_OFFSET) +#define LPC17_DMA_SYNC (LPC17_GPDMA_BASE+LPC17_DMA_SYNC_OFFSET) + +/* Channel Registers */ + +#define LPC17_DMACH_BASE(n) (LPC17_GPDMA_BASE+LPC17_DMA_CHAN_OFFSET(n)) + +#define LPC17_DMACH_SRCADDR(n) (LPC17_DMACH_BASE(n)+LPC17_DMACH_SRCADDR_OFFSET) +#define LPC17_DMACH_DESTADDR(n) (LPC17_DMACH_BASE(n)+LPC17_DMACH_DESTADDR_OFFSET) +#define LPC17_DMACH_LLI(n) (LPC17_DMACH_BASE(n)+LPC17_DMACH_LLI_OFFSET) +#define LPC17_DMACH_CONTROL(n) (LPC17_DMACH_BASE(n)+LPC17_DMACH_CONTROL_OFFSET) +#define LPC17_DMACH_CONFIG(n) (LPC17_DMACH_BASE(n)+LPC17_DMACH_CONFIG_OFFSET) + +#define LPC17_DMACH0_SRCADDR (LPC17_GPDMA_BASE+LPC17_DMACH0_SRCADDR_OFFSET) +#define LPC17_DMACH0_DESTADDR (LPC17_GPDMA_BASE+LPC17_DMACH0_DESTADDR_OFFSET) +#define LPC17_DMACH0_LLI (LPC17_GPDMA_BASE+LPC17_DMACH0_LLI_OFFSET) +#define LPC17_DMACH0_CONTROL (LPC17_GPDMA_BASE+LPC17_DMACH0_CONTROL_OFFSET) +#define LPC17_DMACH0_CONFIG (LPC17_GPDMA_BASE+LPC17_DMACH0_CONFIG_OFFSET) + +#define LPC17_DMACH1_SRCADDR (LPC17_GPDMA_BASE+LPC17_DMACH1_SRCADDR_OFFSET) +#define LPC17_DMACH1_DESTADDR (LPC17_GPDMA_BASE+LPC17_DMACH1_DESTADDR_OFFSET) +#define LPC17_DMACH1_LLI (LPC17_GPDMA_BASE+LPC17_DMACH1_LLI_OFFSET) +#define LPC17_DMACH1_CONTROL (LPC17_GPDMA_BASE+LPC17_DMACH1_CONTROL_OFFSET) +#define LPC17_DMACH1_CONFIG (LPC17_GPDMA_BASE+LPC17_DMACH1_CONFIG_OFFSET) + +#define LPC17_DMACH2_SRCADDR (LPC17_GPDMA_BASE+LPC17_DMACH2_SRCADDR_OFFSET) +#define LPC17_DMACH2_DESTADDR (LPC17_GPDMA_BASE+LPC17_DMACH2_DESTADDR_OFFSET) +#define LPC17_DMACH2_LLI (LPC17_GPDMA_BASE+LPC17_DMACH2_LLI_OFFSET) +#define LPC17_DMACH2_CONTROL (LPC17_GPDMA_BASE+LPC17_DMACH2_CONTROL_OFFSET) +#define LPC17_DMACH2_CONFIG (LPC17_GPDMA_BASE+LPC17_DMACH2_CONFIG_OFFSET) + +#define LPC17_DMACH3_SRCADDR (LPC17_GPDMA_BASE+LPC17_DMACH3_SRCADDR_OFFSET) +#define LPC17_DMACH3_DESTADDR (LPC17_GPDMA_BASE+LPC17_DMACH3_DESTADDR_OFFSET) +#define LPC17_DMACH3_LLI (LPC17_GPDMA_BASE+LPC17_DMACH3_LLI_OFFSET) +#define LPC17_DMACH3_CONTROL (LPC17_GPDMA_BASE+LPC17_DMACH3_CONTROL_OFFSET) +#define LPC17_DMACH3_CONFIG (LPC17_GPDMA_BASE+LPC17_DMACH3_CONFIG_OFFSET) + +#define LPC17_DMACH4_SRCADDR (LPC17_GPDMA_BASE+LPC17_DMACH4_SRCADDR_OFFSET) +#define LPC17_DMACH4_DESTADDR (LPC17_GPDMA_BASE+LPC17_DMACH4_DESTADDR_OFFSET) +#define LPC17_DMACH4_LLI (LPC17_GPDMA_BASE+LPC17_DMACH4_LLI_OFFSET) +#define LPC17_DMACH4_CONTROL (LPC17_GPDMA_BASE+LPC17_DMACH4_CONTROL_OFFSET) +#define LPC17_DMACH4_CONFIG (LPC17_GPDMA_BASE+LPC17_DMACH4_CONFIG_OFFSET) + +#define LPC17_DMACH5_SRCADDR (LPC17_GPDMA_BASE+LPC17_DMACH5_SRCADDR_OFFSET) +#define LPC17_DMACH5_DESTADDR (LPC17_GPDMA_BASE+LPC17_DMACH5_DESTADDR_OFFSET) +#define LPC17_DMACH5_LLI (LPC17_GPDMA_BASE+LPC17_DMACH5_LLI_OFFSET) +#define LPC17_DMACH5_CONTROL (LPC17_GPDMA_BASE+LPC17_DMACH5_CONTROL_OFFSET) +#define LPC17_DMACH5_CONFIG (LPC17_GPDMA_BASE+LPC17_DMACH5_CONFIG_OFFSET) + +#define LPC17_DMACH6_SRCADDR (LPC17_GPDMA_BASE+LPC17_DMACH6_SRCADDR_OFFSET) +#define LPC17_DMACH6_DESTADDR (LPC17_GPDMA_BASE+LPC17_DMACH6_DESTADDR_OFFSET) +#define LPC17_DMACH6_LLI (LPC17_GPDMA_BASE+LPC17_DMACH6_LLI_OFFSET) +#define LPC17_DMACH6_CONTROL (LPC17_GPDMA_BASE+LPC17_DMACH6_CONTROL_OFFSET) +#define LPC17_DMACH6_CONFIG (LPC17_GPDMA_BASE+LPC17_DMACH6_CONFIG_OFFSET) + +#define LPC17_DMACH7_SRCADDR (LPC17_GPDMA_BASE+LPC17_DMACH7_SRCADDR_OFFSET) +#define LPC17_DMACH7_DESTADDR (LPC17_GPDMA_BASE+LPC17_DMACH7_DESTADDR_OFFSET) +#define LPC17_DMACH7_LLI (LPC17_GPDMA_BASE+LPC17_DMACH7_LLI_OFFSET) +#define LPC17_DMACH7_CONTROL (LPC17_GPDMA_BASE+LPC17_DMACH7_CONTROL_OFFSET) +#define LPC17_DMACH7_CONFIG (LPC17_GPDMA_BASE+LPC17_DMACH7_CONFIG_OFFSET) + +/* Register bit definitions *********************************************************/ +/* DMA request connections */ + +#define DMA_REQ_SSP0TX (0) +#define DMA_REQ_SSP0RX (1) +#define DMA_REQ_SSP1TX (2) +#define DMA_REQ_SSP1RX (3) +#define DMA_REQ_ADC (4) +#define DMA_REQ_I2SCH0 (5) +#define DMA_REQ_I2SCH1 (6) +#define DMA_REQ_DAC (7) + +#define DMA_REQ_UART0TX (8) +#define DMA_REQ_UART0RX (9) +#define DMA_REQ_UART1TX (10) +#define DMA_REQ_UART1RX (11) +#define DMA_REQ_UART2TX (12) +#define DMA_REQ_UART2RX (13) +#define DMA_REQ_UART3TX (14) +#define DMA_REQ_UART3RX (15) + +#define DMA_REQ_MAT0p0 (8) +#define DMA_REQ_MAT0p1 (9) +#define DMA_REQ_MAT1p0 (10) +#define DMA_REQ_MAT1p1 (11) +#define DMA_REQ_MAT2p0 (12) +#define DMA_REQ_MAT2p1 (13) +#define DMA_REQ_MAT3p0 (14) +#define DMA_REQ_MAT3p1 (15) + +/* General registers (see also LPC17_SYSCON_DMAREQSEL in lpc17_syscon.h) */ +/* Fach of the following registers, bits 0-7 controls DMA channels 9-7, + * respectively. Bits 8-31 are reserved. + * + * DMA Interrupt Status Register + * DMA Interrupt Terminal Count Request Status Register + * DMA Interrupt Terminal Count Request Clear Register + * DMA Interrupt Error Status Register + * DMA Interrupt Error Clear Register + * DMA Raw Interrupt Terminal Count Status Register + * DMA Raw Error Interrupt Status Register + * DMA Enabled Channel Register + */ + +#define DMACH(n) (1 << (n)) /* n=0,1,...7 */ + +/* For each of the following registers, bits 0-15 represent a set of encoded + * DMA sources. Bits 16-31 are reserved in each case. + * + * DMA Software Burst Request Register + * DMA Software Single Request Register + * DMA Software Last Burst Request Register + * DMA Software Last Single Request Register + * DMA Synchronization Register + */ + +#define DMA_REQ_SSP0TX_BIT (1 << DMA_REQ_SSP0TX) +#define DMA_REQ_SSP0RX_BIT (1 << DMA_REQ_SSP0RX) +#define DMA_REQ_SSP1TX_BIT (1 << DMA_REQ_SSP1TX) +#define DMA_REQ_SSP1RX_BIT (1 << DMA_REQ_SSP0RX) +#define DMA_REQ_ADC_BIT (1 << DMA_REQ_ADC) +#define DMA_REQ_I2SCH0_BIT (1 << DMA_REQ_I2SCH0) +#define DMA_REQ_I2SCH1_BIT (1 << DMA_REQ_I2SCH1) +#define DMA_REQ_DAC_BIT (1 << DMA_REQ_DAC) + +#define DMA_REQ_UART0TX_BIT (1 << DMA_REQ_UART0TX) +#define DMA_REQ_UART0RX_BIT (1 << DMA_REQ_UART0RX) +#define DMA_REQ_UART1TX_BIT (1 << DMA_REQ_UART1TX) +#define DMA_REQ_UART1RX_BIT (1 << DMA_REQ_UART1RX) +#define DMA_REQ_UART2TX_BIT (1 << DMA_REQ_UART2TX) +#define DMA_REQ_UART2RX_BIT (1 << DMA_REQ_UART2RX) +#define DMA_REQ_UART3TX_BIT (1 << DMA_REQ_UART3TX) +#define DMA_REQ_UART3RX_BIT (1 << DMA_REQ_UART3RX) + +#define DMA_REQ_MAT0p0_BIT (1 << DMA_REQ_MAT0p0) +#define DMA_REQ_MAT0p1_BIT (1 << DMA_REQ_MAT0p1) +#define DMA_REQ_MAT1p0_BIT (1 << DMA_REQ_MAT1p0) +#define DMA_REQ_MAT1p1_BIT (1 << DMA_REQ_MAT1p1) +#define DMA_REQ_MAT2p0_BIT (1 << DMA_REQ_MAT2p0) +#define DMA_REQ_MAT2p1_BIT (1 << DMA_REQ_MAT2p1) +#define DMA_REQ_MAT3p0_BIT (1 << DMA_REQ_MAT3p0) +#define DMA_REQ_MAT3p1_BIT (1 << DMA_REQ_MAT3p1) + +/* DMA Configuration Register */ + +#define DMA_CONFIG_E (1 << 0) /* Bit 0: DMA Controller enable */ +#define DMA_CONFIG_M (1 << 1) /* Bit 1: AHB Master endianness configuration */ + /* Bits 2-31: Reserved */ +/* Channel Registers */ + +/* DMA Channel Source Address Register (Bits 0-31: Source Address) */ +/* DMA Channel Destination Address Register Bits 0-31: Destination Address) */ +/* DMA Channel Linked List Item Register (Bits 0-31: Address of next link list + * item. Bits 0-1 must be zero. + */ + +/* DMA Channel Control Register */ + +#define DMACH_CONTROL_XFRSIZE_SHIFT (0) /* Bits 0-11: Transfer size */ +#define DMACH_CONTROL_XFRSIZE_MASK (0x0fff << DMACH_CONTROL_XFRSIZE_SHIFT) +#define DMACH_CONTROL_SBSIZE_SHIFT (12) /* Bits 12-14: Source burst size */ +#define DMACH_CONTROL_SBSIZE_MASK (7 << DMACH_CONTROL_SBSIZE_SHIFT) +# define DMACH_CONTROL_SBSIZE_1 (0 << DMACH_CONTROL_SBSIZE_SHIFT) +# define DMACH_CONTROL_SBSIZE_4 (1 << DMACH_CONTROL_SBSIZE_SHIFT) +# define DMACH_CONTROL_SBSIZE_8 (2 << DMACH_CONTROL_SBSIZE_SHIFT) +# define DMACH_CONTROL_SBSIZE_16 (3 << DMACH_CONTROL_SBSIZE_SHIFT) +# define DMACH_CONTROL_SBSIZE_32 (4 << DMACH_CONTROL_SBSIZE_SHIFT) +# define DMACH_CONTROL_SBSIZE_64 (5 << DMACH_CONTROL_SBSIZE_SHIFT) +# define DMACH_CONTROL_SBSIZE_128 (6 << DMACH_CONTROL_SBSIZE_SHIFT) +# define DMACH_CONTROL_SBSIZE_256 (7 << DMACH_CONTROL_SBSIZE_SHIFT) +#define DMACH_CONTROL_DBSIZE_SHIFT (15) /* Bits 15-17: Destination burst size */ +#define DMACH_CONTROL_DBSIZE_MASK (7 << DMACH_CONTROL_DBSIZE_SHIFT) +# define DMACH_CONTROL_DBSIZE_1 (0 << DMACH_CONTROL_DBSIZE_SHIFT) +# define DMACH_CONTROL_DBSIZE_4 (1 << DMACH_CONTROL_DBSIZE_SHIFT) +# define DMACH_CONTROL_DBSIZE_8 (2 << DMACH_CONTROL_DBSIZE_SHIFT) +# define DMACH_CONTROL_DBSIZE_16 (3 << DMACH_CONTROL_DBSIZE_SHIFT) +# define DMACH_CONTROL_DBSIZE_32 (4 << DMACH_CONTROL_DBSIZE_SHIFT) +# define DMACH_CONTROL_DBSIZE_64 (5 << DMACH_CONTROL_DBSIZE_SHIFT) +# define DMACH_CONTROL_DBSIZE_128 (6 << DMACH_CONTROL_DBSIZE_SHIFT) +# define DMACH_CONTROL_DBSIZE_256 (7 << DMACH_CONTROL_DBSIZE_SHIFT) +#define DMACH_CONTROL_SWIDTH_SHIFT (18) /* Bits 18-20: Source transfer width */ +#define DMACH_CONTROL_SWIDTH_MASK (7 << DMACH_CONTROL_SWIDTH_SHIFT) +#define DMACH_CONTROL_DWIDTH_SHIFT (21) /* Bits 21-23: Destination transfer width */ +#define DMACH_CONTROL_DWIDTH_MASK (7 << DMACH_CONTROL_DWIDTH_SHIFT) +#define DMACH_CONTROL_SI (1 << 26) /* Bit 26: Source increment */ +#define DMACH_CONTROL_DI (1 << 27) /* Bit 27: Destination increment */ +#define DMACH_CONTROL_PROT1 (1 << 28) /* Bit 28: User/priviledged mode */ +#define DMACH_CONTROL_PROT2 (1 << 29) /* Bit 29: Bufferable */ +#define DMACH_CONTROL_PROT3 (1 << 30) /* Bit 30: Cacheable */ +#define DMACH_CONTROL_I (1 << 31) /* Bit 31: Terminal count interrupt enable */ + +/* DMA Channel Configuration Register */ + + +#define DMACH_CONFIG_E (1 << 0) /* Bit 0: Channel enable */ +#define DMACH_CONFIG_SRCPER_SHIFT (1) /* Bits 1-5: Source peripheral */ +#define DMACH_CONFIG_SRCPER_MASK (31 << DMACH_CONFIG_SRCPER_SHIFT) +# define DMACH_CONFIG_SRCPER_SSP0TX (DMA_REQ_SSP0TX << DMACH_CONFIG_SRCPER_SHIFT) +# define DMACH_CONFIG_SRCPER_SSP0RX (DMA_REQ_SSP0RX << DMACH_CONFIG_SRCPER_SHIFT) +# define DMACH_CONFIG_SRCPER_SSP1TX (DMA_REQ_SSP1TX << DMACH_CONFIG_SRCPER_SHIFT) +# define DMACH_CONFIG_SRCPER_SSP1RX (DMA_REQ_SSP0RX << DMACH_CONFIG_SRCPER_SHIFT) +# define DMACH_CONFIG_SRCPER_ADC (DMA_REQ_ADC << DMACH_CONFIG_SRCPER_SHIFT) +# define DMACH_CONFIG_SRCPER_I2SCH0 (DMA_REQ_I2SCH0 << DMACH_CONFIG_SRCPER_SHIFT) +# define DMACH_CONFIG_SRCPER_I2SCH1 (DMA_REQ_I2SCH1 << DMACH_CONFIG_SRCPER_SHIFT) +# define DMACH_CONFIG_SRCPER_DAC (DMA_REQ_DAC << DMACH_CONFIG_SRCPER_SHIFT) +# define DMACH_CONFIG_SRCPER_UART0TX (DMA_REQ_UART0TX << DMACH_CONFIG_SRCPER_SHIFT) +# define DMACH_CONFIG_SRCPER_UART0RX (DMA_REQ_UART0RX << DMACH_CONFIG_SRCPER_SHIFT) +# define DMACH_CONFIG_SRCPER_UART1TX (DMA_REQ_UART1TX << DMACH_CONFIG_SRCPER_SHIFT) +# define DMACH_CONFIG_SRCPER_UART1RX (DMA_REQ_UART1RX << DMACH_CONFIG_SRCPER_SHIFT) +# define DMACH_CONFIG_SRCPER_UART2TX (DMA_REQ_UART2TX << DMACH_CONFIG_SRCPER_SHIFT) +# define DMACH_CONFIG_SRCPER_UART2RX (DMA_REQ_UART2RX << DMACH_CONFIG_SRCPER_SHIFT) +# define DMACH_CONFIG_SRCPER_UART3TX (DMA_REQ_UART3TX << DMACH_CONFIG_SRCPER_SHIFT) +# define DMACH_CONFIG_SRCPER_UART3RX (DMA_REQ_UART3RX << DMACH_CONFIG_SRCPER_SHIFT) +# define DMACH_CONFIG_SRCPER_MAT0p0 (DMA_REQ_MAT0p0 << DMACH_CONFIG_SRCPER_SHIFT) +# define DMACH_CONFIG_SRCPER_MAT0p1 (DMA_REQ_MAT0p1 << DMACH_CONFIG_SRCPER_SHIFT) +# define DMACH_CONFIG_SRCPER_MAT1p0 (DMA_REQ_MAT1p0 << DMACH_CONFIG_SRCPER_SHIFT) +# define DMACH_CONFIG_SRCPER_MAT1p1 (DMA_REQ_MAT1p1 << DMACH_CONFIG_SRCPER_SHIFT) +# define DMACH_CONFIG_SRCPER_MAT2p0 (DMA_REQ_MAT2p0 << DMACH_CONFIG_SRCPER_SHIFT) +# define DMACH_CONFIG_SRCPER_MAT2p1 (DMA_REQ_MAT2p1 << DMACH_CONFIG_SRCPER_SHIFT) +# define DMACH_CONFIG_SRCPER_MAT3p0 (DMA_REQ_MAT3p0 << DMACH_CONFIG_SRCPER_SHIFT) +# define DMACH_CONFIG_SRCPER_MAT3p1 (DMA_REQ_MAT3p1 << DMACH_CONFIG_SRCPER_SHIFT) +#define DMACH_CONFIG_DSTPER_SHIFT (6) /* Bits 6-10: Source peripheral */ +#define DMACH_CONFIG_DSTPER_MASK (31 << DMACH_CONFIG_DSTPER_SHIFT) +# define DMACH_CONFIG_DSTPER_SSP0TX (DMA_REQ_SSP0TX << DMACH_CONFIG_DSTPER_SHIFT) +# define DMACH_CONFIG_DSTPER_SSP0RX (DMA_REQ_SSP0RX << DMACH_CONFIG_DSTPER_SHIFT) +# define DMACH_CONFIG_DSTPER_SSP1TX (DMA_REQ_SSP1TX << DMACH_CONFIG_DSTPER_SHIFT) +# define DMACH_CONFIG_DSTPER_SSP1RX (DMA_REQ_SSP0RX << DMACH_CONFIG_DSTPER_SHIFT) +# define DMACH_CONFIG_DSTPER_ADC (DMA_REQ_ADC << DMACH_CONFIG_DSTPER_SHIFT) +# define DMACH_CONFIG_DSTPER_I2SCH0 (DMA_REQ_I2SCH0 << DMACH_CONFIG_DSTPER_SHIFT) +# define DMACH_CONFIG_DSTPER_I2SCH1 (DMA_REQ_I2SCH1 << DMACH_CONFIG_DSTPER_SHIFT) +# define DMACH_CONFIG_DSTPER_DAC (DMA_REQ_DAC << DMACH_CONFIG_DSTPER_SHIFT) +# define DMACH_CONFIG_DSTPER_UART0TX (DMA_REQ_UART0TX << DMACH_CONFIG_DSTPER_SHIFT) +# define DMACH_CONFIG_DSTPER_UART0RX (DMA_REQ_UART0RX << DMACH_CONFIG_DSTPER_SHIFT) +# define DMACH_CONFIG_DSTPER_UART1TX (DMA_REQ_UART1TX << DMACH_CONFIG_DSTPER_SHIFT) +# define DMACH_CONFIG_DSTPER_UART1RX (DMA_REQ_UART1RX << DMACH_CONFIG_DSTPER_SHIFT) +# define DMACH_CONFIG_DSTPER_UART2TX (DMA_REQ_UART2TX << DMACH_CONFIG_DSTPER_SHIFT) +# define DMACH_CONFIG_DSTPER_UART2RX (DMA_REQ_UART2RX << DMACH_CONFIG_DSTPER_SHIFT) +# define DMACH_CONFIG_DSTPER_UART3TX (DMA_REQ_UART3TX << DMACH_CONFIG_DSTPER_SHIFT) +# define DMACH_CONFIG_DSTPER_UART3RX (DMA_REQ_UART3RX << DMACH_CONFIG_DSTPER_SHIFT) +# define DMACH_CONFIG_DSTPER_MAT0p0 (DMA_REQ_MAT0p0 << DMACH_CONFIG_DSTPER_SHIFT) +# define DMACH_CONFIG_DSTPER_MAT0p1 (DMA_REQ_MAT0p1 << DMACH_CONFIG_DSTPER_SHIFT) +# define DMACH_CONFIG_DSTPER_MAT1p0 (DMA_REQ_MAT1p0 << DMACH_CONFIG_DSTPER_SHIFT) +# define DMACH_CONFIG_DSTPER_MAT1p1 (DMA_REQ_MAT1p1 << DMACH_CONFIG_DSTPER_SHIFT) +# define DMACH_CONFIG_DSTPER_MAT2p0 (DMA_REQ_MAT2p0 << DMACH_CONFIG_DSTPER_SHIFT) +# define DMACH_CONFIG_DSTPER_MAT2p1 (DMA_REQ_MAT2p1 << DMACH_CONFIG_DSTPER_SHIFT) +# define DMACH_CONFIG_DSTPER_MAT3p0 (DMA_REQ_MAT3p0 << DMACH_CONFIG_DSTPER_SHIFT) +# define DMACH_CONFIG_DSTPER_MAT3p1 (DMA_REQ_MAT3p1 << DMACH_CONFIG_DSTPER_SHIFT) +#define DMACH_CONFIG_XFRTYPE_SHIFT (11) /* Bits 11-13: Type of transfer */ +#define DMACH_CONFIG_XFRTYPE_MASK (7 << DMACH_CONFIG_XFRTYPE_SHIFT) +# define DMACH_CONFIG_XFRTYPE_M2M (0 << DMACH_CONFIG_XFRTYPE_SHIFT) /* Memory to memory DMA */ +# define DMACH_CONFIG_XFRTYPE_M2P (1 << DMACH_CONFIG_XFRTYPE_SHIFT) /* Memory to peripheral DMA */ +# define DMACH_CONFIG_XFRTYPE_P2M (2 << DMACH_CONFIG_XFRTYPE_SHIFT) /* Peripheral to memory DMA */ +# define DMACH_CONFIG_XFRTYPE_P2P (3 << DMACH_CONFIG_XFRTYPE_SHIFT) /* Peripheral to peripheral DMA */ +#define DMACH_CONFIG_IE (1 << 14) /* Bit 14: Interrupt error mask */ +#define DMACH_CONFIG_ ITC (1 << 15) /* Bit 15: Terminal count interrupt mask */ +#define DMACH_CONFIG_L (1 << 16) /* Bit 16: Lock */ +#define DMACH_CONFIG_A (1 << 17) /* Bit 17: Active */ +#define DMACH_CONFIG_H (1 << 18) /* Bit 18: Halt */ + /* Bits 19-31: Reserved */ + +/************************************************************************************ + * Public Types + ************************************************************************************/ + +/************************************************************************************ + * Public Data + ************************************************************************************/ + +/************************************************************************************ + * Public Functions + ************************************************************************************/ + +#endif /* __ARCH_ARM_SRC_LPC17XX_CHIP_LPC17_GPDMA_H */ diff --git a/nuttx/arch/arm/src/lpc17xx/chip/lpc17_gpio.h b/nuttx/arch/arm/src/lpc17xx/chip/lpc17_gpio.h new file mode 100644 index 0000000000..20b4ae3801 --- /dev/null +++ b/nuttx/arch/arm/src/lpc17xx/chip/lpc17_gpio.h @@ -0,0 +1,293 @@ +/************************************************************************************ + * arch/arm/src/lpc17xx/chip/lpc17_gpio.h + * + * Copyright (C) 2010, 2013 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * 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. + * + ************************************************************************************/ + +#ifndef __ARCH_ARM_SRC_LPC17XX_LPC17_CHIP_GPIO_H +#define __ARCH_ARM_SRC_LPC17XX_LPC17_CHIP_GPIO_H + +/************************************************************************************ + * Included Files + ************************************************************************************/ + +#include + +#include "chip.h" +#include "chip/lpc17_memorymap.h" + +/************************************************************************************ + * Pre-processor Definitions + ************************************************************************************/ + +/* Register offsets *****************************************************************/ +/* GPIO block register offsets ******************************************************/ + +#define LPC17_FIO0_OFFSET 0x0000 +#define LPC17_FIO1_OFFSET 0x0020 +#define LPC17_FIO2_OFFSET 0x0040 +#define LPC17_FIO3_OFFSET 0x0060 +#define LPC17_FIO4_OFFSET 0x0080 + +#define LPC17_FIO_DIR_OFFSET 0x0000 /* Fast GPIO Port Direction control */ +#define LPC17_FIO_MASK_OFFSET 0x0010 /* Fast Mask register for ports */ +#define LPC17_FIO_PIN_OFFSET 0x0014 /* Fast Port Pin value registers */ +#define LPC17_FIO_SET_OFFSET 0x0018 /* Fast Port Output Set registers */ +#define LPC17_FIO_CLR_OFFSET 0x001c /* Fast Port Output Clear register */ + +/* GPIO interrupt block register offsets ********************************************/ + +#define LPC17_GPIOINT_OFFSET(n) (0x10*(n) + 0x80) +#define LPC17_GPIOINT0_OFFSET 0x0080 +#define LPC17_GPIOINT2_OFFSET 0x00a0 + +#define LPC17_GPIOINT_IOINTSTATUS_OFFSET 0x0000 /* GPIO overall Interrupt Status */ +#define LPC17_GPIOINT_INTSTATR_OFFSET 0x0004 /* GPIO Interrupt Status Rising edge */ +#define LPC17_GPIOINT_INTSTATF_OFFSET 0x0008 /* GPIO Interrupt Status Falling edge */ +#define LPC17_GPIOINT_INTCLR_OFFSET 0x000c /* GPIO Interrupt Clear */ +#define LPC17_GPIOINT_INTENR_OFFSET 0x0010 /* GPIO Interrupt Enable Rising edge */ +#define LPC17_GPIOINT_INTENF_OFFSET 0x0014 /* GPIO Interrupt Enable Falling edge */ + +/* Register addresses ***************************************************************/ +/* GPIO block register addresses ****************************************************/ + +#define LPC17_FIO_BASE(n) (LPC17_GPIO_BASE+LPC17_GPIOINT_OFFSET(n)) +#define LPC17_FIO0_BASE (LPC17_GPIO_BASE+LPC17_FIO0_OFFSET) +#define LPC17_FIO1_BASE (LPC17_GPIO_BASE+LPC17_FIO1_OFFSET) +#define LPC17_FIO2_BASE (LPC17_GPIO_BASE+LPC17_FIO2_OFFSET) +#define LPC17_FIO3_BASE (LPC17_GPIO_BASE+LPC17_FIO3_OFFSET) +#define LPC17_FIO4_BASE (LPC17_GPIO_BASE+LPC17_FIO4_OFFSET) + +#define LPC17_FIO_DIR(n) (LPC17_FIO_BASE(n)+LPC17_FIO_DIR_OFFSET) +#define LPC17_FIO_MASK(n) (LPC17_FIO_BASE(n)+LPC17_FIO_MASK_OFFSET) +#define LPC17_FIO_PIN(n) (LPC17_FIO_BASE(n)+LPC17_FIO_PIN_OFFSET) +#define LPC17_FIO_SET(n) (LPC17_FIO_BASE(n)+LPC17_FIO_SET_OFFSET) +#define LPC17_FIO_CLR(n) (LPC17_FIO_BASE(n)+LPC17_FIO_CLR_OFFSET) + +#define LPC17_FIO0_DIR (LPC17_FIO0_BASE+LPC17_FIO_DIR_OFFSET) +#define LPC17_FIO0_MASK (LPC17_FIO0_BASE+LPC17_FIO_MASK_OFFSET) +#define LPC17_FIO0_PIN (LPC17_FIO0_BASE+LPC17_FIO_PIN_OFFSET) +#define LPC17_FIO0_SET (LPC17_FIO0_BASE+LPC17_FIO_SET_OFFSET) +#define LPC17_FIO0_CLR (LPC17_FIO0_BASE+LPC17_FIO_CLR_OFFSET) + +#define LPC17_FIO1_DIR (LPC17_FIO1_BASE+LPC17_FIO_DIR_OFFSET) +#define LPC17_FIO1_MASK (LPC17_FIO1_BASE+LPC17_FIO_MASK_OFFSET) +#define LPC17_FIO1_PIN (LPC17_FIO1_BASE+LPC17_FIO_PIN_OFFSET) +#define LPC17_FIO1_SET (LPC17_FIO1_BASE+LPC17_FIO_SET_OFFSET) +#define LPC17_FIO1_CLR (LPC17_FIO1_BASE+LPC17_FIO_CLR_OFFSET) + +#define LPC17_FIO2_DIR (LPC17_FIO2_BASE+LPC17_FIO_DIR_OFFSET) +#define LPC17_FIO2_MASK (LPC17_FIO2_BASE+LPC17_FIO_MASK_OFFSET) +#define LPC17_FIO2_PIN (LPC17_FIO2_BASE+LPC17_FIO_PIN_OFFSET) +#define LPC17_FIO2_SET (LPC17_FIO2_BASE+LPC17_FIO_SET_OFFSET) +#define LPC17_FIO2_CLR (LPC17_FIO2_BASE+LPC17_FIO_CLR_OFFSET) + +#define LPC17_FIO3_DIR (LPC17_FIO3_BASE+LPC17_FIO_DIR_OFFSET) +#define LPC17_FIO3_MASK (LPC17_FIO3_BASE+LPC17_FIO_MASK_OFFSET) +#define LPC17_FIO3_PIN (LPC17_FIO3_BASE+LPC17_FIO_PIN_OFFSET) +#define LPC17_FIO3_SET (LPC17_FIO3_BASE+LPC17_FIO_SET_OFFSET) +#define LPC17_FIO3_CLR (LPC17_FIO3_BASE+LPC17_FIO_CLR_OFFSET) + +#define LPC17_FIO4_DIR (LPC17_FIO4_BASE+LPC17_FIO_DIR_OFFSET) +#define LPC17_FIO4_MASK (LPC17_FIO4_BASE+LPC17_FIO_MASK_OFFSET) +#define LPC17_FIO4_PIN (LPC17_FIO4_BASE+LPC17_FIO_PIN_OFFSET) +#define LPC17_FIO4_SET (LPC17_FIO4_BASE+LPC17_FIO_SET_OFFSET) +#define LPC17_FIO4_CLR (LPC17_FIO4_BASE+LPC17_FIO_CLR_OFFSET) + +/* GPIO interrupt block register addresses ******************************************/ + +#define LPC17_GPIOINTn_BASE(n) (LPC17_GPIOINT_BASE+LPC17_GPIOINT_OFFSET(n)) +#define LPC17_GPIOINT0_BASE (LPC17_GPIOINT_BASE+LPC17_GPIOINT0_OFFSET) +#define LPC17_GPIOINT2_BASE (LPC17_GPIOINT_BASE+LPC17_GPIOINT2_OFFSET) + +#define LPC17_GPIOINT_IOINTSTATUS (LPC17_GPIOINT0_BASE+LPC17_GPIOINT_IOINTSTATUS_OFFSET) + +#define LPC17_GPIOINT_INTSTATR(n) (LPC17_GPIOINTn_BASE(n)+LPC17_GPIOINT_INTSTATR_OFFSET) +#define LPC17_GPIOINT_INTSTATF(n) (LPC17_GPIOINTn_BASE(n)+LPC17_GPIOINT_INTSTATF_OFFSET) +#define LPC17_GPIOINT_INTCLR(n) (LPC17_GPIOINTn_BASE(n)+LPC17_GPIOINT_INTCLR_OFFSET) +#define LPC17_GPIOINT_INTENR(n) (LPC17_GPIOINTn_BASE(n)+LPC17_GPIOINT_INTENR_OFFSET) +#define LPC17_GPIOINT_INTENF(n) (LPC17_GPIOINTn_BASE(n)+LPC17_GPIOINT_INTENF_OFFSET) + +/* Pins P0.0-31 (P0.12-14 nad P0.31 are reserved) */ + +#define LPC17_GPIOINT0_INTSTATR (LPC17_GPIOINT0_BASE+LPC17_GPIOINT_INTSTATR_OFFSET) +#define LPC17_GPIOINT0_INTSTATF (LPC17_GPIOINT0_BASE+LPC17_GPIOINT_INTSTATF_OFFSET) +#define LPC17_GPIOINT0_INTCLR (LPC17_GPIOINT0_BASE+LPC17_GPIOINT_INTCLR_OFFSET) +#define LPC17_GPIOINT0_INTENR (LPC17_GPIOINT0_BASE+LPC17_GPIOINT_INTENR_OFFSET) +#define LPC17_GPIOINT0_INTENF (LPC17_GPIOINT0_BASE+LPC17_GPIOINT_INTENF_OFFSET) + +/* Pins P2.0-13 (P0.14-31 are reserved) */ + +#define LPC17_GPIOINT2_INTSTATR (LPC17_GPIOINT2_BASE+LPC17_GPIOINT_INTSTATR_OFFSET) +#define LPC17_GPIOINT2_INTSTATF (LPC17_GPIOINT2_BASE+LPC17_GPIOINT_INTSTATF_OFFSET) +#define LPC17_GPIOINT2_INTCLR (LPC17_GPIOINT2_BASE+LPC17_GPIOINT_INTCLR_OFFSET) +#define LPC17_GPIOINT2_INTENR (LPC17_GPIOINT2_BASE+LPC17_GPIOINT_INTENR_OFFSET) +#define LPC17_GPIOINT2_INTENF (LPC17_GPIOINT2_BASE+LPC17_GPIOINT_INTENF_OFFSET) + +/* Register bit definitions *********************************************************/ +/* GPIO block register bit definitions **********************************************/ + +/* Fast GPIO Port Direction control registers (FIODIR) */ +/* Fast Mask register for ports (FIOMASK) */ +/* Fast Port Pin value registers using FIOMASK (FIOPIN) */ +/* Fast Port Output Set registers using FIOMASK (FIOSET) */ +/* Fast Port Output Clear register using FIOMASK (FIOCLR) */ + +#define FIO(n) (1 << (n)) /* n=0,1,..31 */ + +/* GPIO interrupt block register bit definitions ************************************/ + +/* GPIO overall Interrupt Status (IOINTSTATUS) */ +#define GPIOINT_IOINTSTATUS_P0INT (1 << 0) /* Bit 0: Port 0 GPIO interrupt pending */ + /* Bit 1: Reserved */ +#define GPIOINT_IOINTSTATUS_P2INT (1 << 2) /* Bit 2: Port 2 GPIO interrupt pending */ + /* Bits 3-31: Reserved */ + +/* GPIO Interrupt Status for Rising edge (INTSTATR) + * GPIO Interrupt Status for Falling edge (INTSTATF) + * GPIO Interrupt Clear (INTCLR) + * GPIO Interrupt Enable for Rising edge (INTENR) + * GPIO Interrupt Enable for Falling edge (INTENF) + */ + +#define GPIOINT(n) (1 << (n)) /* n=0,1,..31 */ + +/************************************************************************************ + * Public Types + ************************************************************************************/ + +/************************************************************************************ + * Public Data + ************************************************************************************/ + +#ifndef __ASSEMBLY__ +#ifdef __cplusplus +extern "C" +{ +#endif + +/************************************************************************************ + * Public Functions + ************************************************************************************/ + +/************************************************************************************ + * Name: lpc17_gpioirqinitialize + * + * Description: + * Initialize logic to support a second level of interrupt decoding for GPIO pins. + * + ************************************************************************************/ + +#ifdef CONFIG_GPIO_IRQ +void lpc17_gpioirqinitialize(void); +#else +# define lpc17_gpioirqinitialize() +#endif + +/************************************************************************************ + * Name: lpc17_configgpio + * + * Description: + * Configure a GPIO pin based on bit-encoded description of the pin. + * + ************************************************************************************/ + +int lpc17_configgpio(uint16_t cfgset); + +/************************************************************************************ + * Name: lpc17_gpiowrite + * + * Description: + * Write one or zero to the selected GPIO pin + * + ************************************************************************************/ + +void lpc17_gpiowrite(uint16_t pinset, bool value); + +/************************************************************************************ + * Name: lpc17_gpioread + * + * Description: + * Read one or zero from the selected GPIO pin + * + ************************************************************************************/ + +bool lpc17_gpioread(uint16_t pinset); + +/************************************************************************************ + * Name: lpc17_gpioirqenable + * + * Description: + * Enable the interrupt for specified GPIO IRQ + * + ************************************************************************************/ + +#ifdef CONFIG_GPIO_IRQ +void lpc17_gpioirqenable(int irq); +#else +# define lpc17_gpioirqenable(irq) +#endif + +/************************************************************************************ + * Name: lpc17_gpioirqdisable + * + * Description: + * Disable the interrupt for specified GPIO IRQ + * + ************************************************************************************/ + +#ifdef CONFIG_GPIO_IRQ +void lpc17_gpioirqdisable(int irq); +#else +# define lpc17_gpioirqdisable(irq) +#endif + +/************************************************************************************ + * Function: lpc17_dumpgpio + * + * Description: + * Dump all GPIO registers associated with the base address of the provided pinset. + * + ************************************************************************************/ + +#ifdef CONFIG_DEBUG_GPIO +int lpc17_dumpgpio(uint16_t pinset, const char *msg); +#else +# define lpc17_dumpgpio(p,m) +#endif + +#if defined(__cplusplus) +} +#endif + +#endif /* __ASSEMBLY__ */ +#endif /* __ARCH_ARM_SRC_LPC17XX_LPC17_CHIP_GPIO_H */ diff --git a/nuttx/arch/arm/src/lpc17xx/chip/lpc17_i2c.h b/nuttx/arch/arm/src/lpc17xx/chip/lpc17_i2c.h new file mode 100644 index 0000000000..96b6f19b1a --- /dev/null +++ b/nuttx/arch/arm/src/lpc17xx/chip/lpc17_i2c.h @@ -0,0 +1,208 @@ +/************************************************************************************ + * arch/arm/src/lpc17xx/chip/lpc17_i2c.h + * + * Copyright (C) 2010, 2013 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * 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. + * + ************************************************************************************/ + +#ifndef __ARCH_ARM_SRC_LPC17XX_CHIP_LPC17_I2C_H +#define __ARCH_ARM_SRC_LPC17XX_CHIP_LPC17_I2C_H + +/************************************************************************************ + * Included Files + ************************************************************************************/ + +#include + +#include "chip.h" +#include "chip/lpc17_memorymap.h" + +/************************************************************************************ + * Pre-processor Definitions + ************************************************************************************/ + +/* Register offsets *****************************************************************/ + +#define LPC17_I2C_CONSET_OFFSET 0x0000 /* I2C Control Set Register */ +#define LPC17_I2C_STAT_OFFSET 0x0004 /* I2C Status Register */ +#define LPC17_I2C_DAT_OFFSET 0x0008 /* I2C Data Register */ +#define LPC17_I2C_ADR0_OFFSET 0x000c /* I2C Slave Address Register 0 */ +#define LPC17_I2C_SCLH_OFFSET 0x0010 /* SCH Duty Cycle Register High Half Word */ +#define LPC17_I2C_SCLL_OFFSET 0x0014 /* SCL Duty Cycle Register Low Half Word */ +#define LPC17_I2C_CONCLR_OFFSET 0x0018 /* I2C Control Clear Register */ +#define LPC17_I2C_MMCTRL_OFFSET 0x001c /* Monitor mode control register */ +#define LPC17_I2C_ADR1_OFFSET 0x0020 /* I2C Slave Address Register 1 */ +#define LPC17_I2C_ADR2_OFFSET 0x0024 /* I2C Slave Address Register 2 */ +#define LPC17_I2C_ADR3_OFFSET 0x0028 /* I2C Slave Address Register 3 */ +#define LPC17_I2C_BUFR_OFFSET 0x002c /* Data buffer register */ +#define LPC17_I2C_MASK0_OFFSET 0x0030 /* I2C Slave address mask register 0 */ +#define LPC17_I2C_MASK1_OFFSET 0x0034 /* I2C Slave address mask register 1 */ +#define LPC17_I2C_MASK2_OFFSET 0x0038 /* I2C Slave address mask register 2 */ +#define LPC17_I2C_MASK3_OFFSET 0x003c /* I2C Slave address mask register */ + +/* Register addresses ***************************************************************/ + +#define LPC17_I2C0_CONSET (LPC17_I2C0_BASE+LPC17_I2C_CONSET_OFFSET) +#define LPC17_I2C0_STAT (LPC17_I2C0_BASE+LPC17_I2C_STAT_OFFSET) +#define LPC17_I2C0_DAT (LPC17_I2C0_BASE+LPC17_I2C_DAT_OFFSET) +#define LPC17_I2C0_ADR0 (LPC17_I2C0_BASE+LPC17_I2C_ADR0_OFFSET) +#define LPC17_I2C0_SCLH (LPC17_I2C0_BASE+LPC17_I2C_SCLH_OFFSET) +#define LPC17_I2C0_SCLL (LPC17_I2C0_BASE+LPC17_I2C_SCLL_OFFSET) +#define LPC17_I2C0_CONCLR (LPC17_I2C0_BASE+LPC17_I2C_CONCLR_OFFSET) +#define LPC17_I2C0_MMCTRL (LPC17_I2C0_BASE+LPC17_I2C_MMCTRL_OFFSET) +#define LPC17_I2C0_ADR1 (LPC17_I2C0_BASE+LPC17_I2C_ADR1_OFFSET) +#define LPC17_I2C0_ADR2 (LPC17_I2C0_BASE+LPC17_I2C_ADR2_OFFSET) +#define LPC17_I2C0_ADR3 (LPC17_I2C0_BASE+LPC17_I2C_ADR3_OFFSET) +#define LPC17_I2C0_BUFR (LPC17_I2C0_BASE+LPC17_I2C_BUFR_OFFSET) +#define LPC17_I2C0_MASK0 (LPC17_I2C0_BASE+LPC17_I2C_MASK0_OFFSET) +#define LPC17_I2C0_MASK1 (LPC17_I2C0_BASE+LPC17_I2C_MASK1_OFFSET) +#define LPC17_I2C0_MASK2 (LPC17_I2C0_BASE+LPC17_I2C_MASK2_OFFSET) +#define LPC17_I2C0_MASK3 (LPC17_I2C0_BASE+LPC17_I2C_MASK3_OFFSET) + +#define LPC17_I2C1_CONSET (LPC17_I2C1_BASE+LPC17_I2C_CONSET_OFFSET) +#define LPC17_I2C1_STAT (LPC17_I2C1_BASE+LPC17_I2C_STAT_OFFSET) +#define LPC17_I2C1_DAT (LPC17_I2C1_BASE+LPC17_I2C_DAT_OFFSET) +#define LPC17_I2C1_ADR0 (LPC17_I2C1_BASE+LPC17_I2C_ADR0_OFFSET) +#define LPC17_I2C1_SCLH (LPC17_I2C1_BASE+LPC17_I2C_SCLH_OFFSET) +#define LPC17_I2C1_SCLL (LPC17_I2C1_BASE+LPC17_I2C_SCLL_OFFSET) +#define LPC17_I2C1_CONCLR (LPC17_I2C1_BASE+LPC17_I2C_CONCLR_OFFSET) +#define LPC17_I2C1_MMCTRL (LPC17_I2C1_BASE+LPC17_I2C_MMCTRL_OFFSET) +#define LPC17_I2C1_ADR1 (LPC17_I2C1_BASE+LPC17_I2C_ADR1_OFFSET) +#define LPC17_I2C1_ADR2 (LPC17_I2C1_BASE+LPC17_I2C_ADR2_OFFSET) +#define LPC17_I2C1_ADR3 (LPC17_I2C1_BASE+LPC17_I2C_ADR3_OFFSET) +#define LPC17_I2C1_BUFR (LPC17_I2C1_BASE+LPC17_I2C_BUFR_OFFSET) +#define LPC17_I2C1_MASK0 (LPC17_I2C1_BASE+LPC17_I2C_MASK0_OFFSET) +#define LPC17_I2C1_MASK1 (LPC17_I2C1_BASE+LPC17_I2C_MASK1_OFFSET) +#define LPC17_I2C1_MASK2 (LPC17_I2C1_BASE+LPC17_I2C_MASK2_OFFSET) +#define LPC17_I2C1_MASK3 (LPC17_I2C1_BASE+LPC17_I2C_MASK3_OFFSET) + +#define LPC17_I2C2_CONSET (LPC17_I2C2_BASE+LPC17_I2C_CONSET_OFFSET) +#define LPC17_I2C2_STAT (LPC17_I2C2_BASE+LPC17_I2C_STAT_OFFSET) +#define LPC17_I2C2_DAT (LPC17_I2C2_BASE+LPC17_I2C_DAT_OFFSET) +#define LPC17_I2C2_ADR0 (LPC17_I2C2_BASE+LPC17_I2C_ADR0_OFFSET) +#define LPC17_I2C2_SCLH (LPC17_I2C2_BASE+LPC17_I2C_SCLH_OFFSET) +#define LPC17_I2C2_SCLL (LPC17_I2C2_BASE+LPC17_I2C_SCLL_OFFSET) +#define LPC17_I2C2_CONCLR (LPC17_I2C2_BASE+LPC17_I2C_CONCLR_OFFSET) +#define LPC17_I2C2_MMCTRL (LPC17_I2C2_BASE+LPC17_I2C_MMCTRL_OFFSET) +#define LPC17_I2C2_ADR1 (LPC17_I2C2_BASE+LPC17_I2C_ADR1_OFFSET) +#define LPC17_I2C2_ADR2 (LPC17_I2C2_BASE+LPC17_I2C_ADR2_OFFSET) +#define LPC17_I2C2_ADR3 (LPC17_I2C2_BASE+LPC17_I2C_ADR3_OFFSET) +#define LPC17_I2C2_BUFR (LPC17_I2C2_BASE+LPC17_I2C_BUFR_OFFSET) +#define LPC17_I2C2_MASK0 (LPC17_I2C2_BASE+LPC17_I2C_MASK0_OFFSET) +#define LPC17_I2C2_MASK1 (LPC17_I2C2_BASE+LPC17_I2C_MASK1_OFFSET) +#define LPC17_I2C2_MASK2 (LPC17_I2C2_BASE+LPC17_I2C_MASK2_OFFSET) +#define LPC17_I2C2_MASK3 (LPC17_I2C2_BASE+LPC17_I2C_MASK3_OFFSET) + +/* Register bit definitions *********************************************************/ +/* I2C Control Set Register */ + /* Bits 0-1: Reserved */ +#define I2C_CONSET_AA (1 << 2) /* Bit 2: Assert acknowledge flag */ +#define I2C_CONSET_SI (1 << 3) /* Bit 3: I2C interrupt flag */ +#define I2C_CONSET_STO (1 << 4) /* Bit 4: STOP flag */ +#define I2C_CONSET_STA (1 << 5) /* Bit 5: START flag */ +#define I2C_CONSET_I2EN (1 << 6) /* Bit 6: I2C interface enable */ + /* Bits 7-31: Reserved */ +/* I2C Control Clear Register */ + /* Bits 0-1: Reserved */ +#define I2C_CONCLR_AAC (1 << 2) /* Bit 2: Assert acknowledge Clear bit */ +#define I2C_CONCLR_SIC (1 << 3) /* Bit 3: I2C interrupt Clear bit */ + /* Bit 4: Reserved */ +#define I2C_CONCLR_STAC (1 << 5) /* Bit 5: START flag Clear bit */ +#define I2C_CONCLRT_I2ENC (1 << 6) /* Bit 6: I2C interface Disable bit */ + /* Bits 7-31: Reserved */ +/* I2C Status Register + * + * See tables 399-402 in the "LPC17xx User Manual" (UM10360), Rev. 01, 4 January + * 2010, NXP for definitions of status codes. + */ + +#define I2C_STAT_MASK (0xff) /* Bits 0-7: I2C interface status + * Bits 0-1 always zero */ + /* Bits 8-31: Reserved */ +/* I2C Data Register */ + +#define I2C_DAT_MASK (0xff) /* Bits 0-7: I2C data */ + /* Bits 8-31: Reserved */ +/* Monitor mode control register */ + +#define I2C_MMCTRL_MMENA (1 << 0) /* Bit 0: Monitor mode enable */ +#define I2C_MMCTRL_ENASCL (1 << 1) /* Bit 1: SCL output enable */ +#define I2C_MMCTRL_MATCHALL (1 << 2) /* Bit 2: Select interrupt register match */ + /* Bits 3-31: Reserved */ +/* Data buffer register */ + +#define I2C_BUFR_MASK (0xff) /* Bits 0-7: 8 MSBs of the I2DAT shift register */ + /* Bits 8-31: Reserved */ +/* I2C Slave address registers: + * + * I2C Slave Address Register 0 + * I2C Slave Address Register 1 + * I2C Slave Address Register 2 + * I2C Slave Address Register 3 + */ + +#define I2C_ADR_GC (1 << 0) /* Bit 0: GC General Call enable bit */ +#define I2C_ADR_ADDR_SHIFT (1) /* Bits 1-7: I2C slave address */ +#define I2C_ADR_ADDR_MASK (0x7f << I2C_ADR_ADDR_SHIFT) + /* Bits 8-31: Reserved */ +/* I2C Slave address mask registers: + * + * I2C Slave address mask register 0 + * I2C Slave address mask register 1 + * I2C Slave address mask register 2 + * I2C Slave address mask register 3 + */ + /* Bit 0: Reserved */ +#define I2C_MASK_SHIFT (1) /* Bits 1-7: I2C mask bits */ +#define I2C_MASK_MASK (0x7f << I2C_ADR_ADDR_SHIFT) + /* Bits 8-31: Reserved */ +/* SCH Duty Cycle Register High Half Word */ + +#define I2C_SCLH_MASK (0xffff) /* Bit 0-15: Count for SCL HIGH time period selection */ + /* Bits 16-31: Reserved */ +/* SCL Duty Cycle Register Low Half Word */ + +#define I2C_SCLL_MASK (0xffff) /* Bit 0-15: Count for SCL LOW time period selection */ + /* Bits 16-31: Reserved */ + +/************************************************************************************ + * Public Types + ************************************************************************************/ + +/************************************************************************************ + * Public Data + ************************************************************************************/ + +/************************************************************************************ + * Public Functions + ************************************************************************************/ + +#endif /* __ARCH_ARM_SRC_LPC17XX_CHIP_LPC17_I2C_H */ diff --git a/nuttx/arch/arm/src/lpc17xx/chip/lpc17_i2s.h b/nuttx/arch/arm/src/lpc17xx/chip/lpc17_i2s.h new file mode 100644 index 0000000000..ab9a30425d --- /dev/null +++ b/nuttx/arch/arm/src/lpc17xx/chip/lpc17_i2s.h @@ -0,0 +1,62 @@ +/************************************************************************************ + * arch/arm/src/lpc17xx/chip/lpc17_i2s + * + * Copyright (C) 2010, 2012-2013 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * 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. + * + ************************************************************************************/ + +#ifndef __ARCH_ARM_SRC_LPC17XX_CHIP_LPC17_I2S_H +#define __ARCH_ARM_SRC_LPC17XX_CHIP_LPC17_I2S_H + +/************************************************************************************ + * Included Files + ************************************************************************************/ + +#include +#include "chip/lpc17_i2s.h" + +/************************************************************************************ + * Pre-processor Definitions + ************************************************************************************/ + +/************************************************************************************ + * Public Types + ************************************************************************************/ + +/************************************************************************************ + * Public Data + ************************************************************************************/ + +/************************************************************************************ + * Public Functions + ************************************************************************************/ + +#endif /* __ARCH_ARM_SRC_LPC17XX_CHIP_LPC17_I2S_H */ diff --git a/nuttx/arch/arm/src/lpc17xx/lpc17_mcpwm.h b/nuttx/arch/arm/src/lpc17xx/chip/lpc17_mcpwm.h similarity index 98% rename from nuttx/arch/arm/src/lpc17xx/lpc17_mcpwm.h rename to nuttx/arch/arm/src/lpc17xx/chip/lpc17_mcpwm.h index 370aa42de3..6ec4a6b200 100644 --- a/nuttx/arch/arm/src/lpc17xx/lpc17_mcpwm.h +++ b/nuttx/arch/arm/src/lpc17xx/chip/lpc17_mcpwm.h @@ -1,7 +1,7 @@ /************************************************************************************ - * arch/arm/src/lpc17xx/lpc17_mcpwm.h + * arch/arm/src/lpc17xx/chip/lpc17_mcpwm.h * - * Copyright (C) 2010 Gregory Nutt. All rights reserved. + * Copyright (C) 2010, 2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -33,8 +33,8 @@ * ************************************************************************************/ -#ifndef __ARCH_ARM_SRC_LPC17XX_LPC17_MCPWM_H -#define __ARCH_ARM_SRC_LPC17XX_LPC17_MCPWM_H +#ifndef __ARCH_ARM_SRC_LPC17XX_CHIP_LPC17_MCPWM_H +#define __ARCH_ARM_SRC_LPC17XX_CHIP_LPC17_MCPWM_H /************************************************************************************ * Included Files @@ -43,7 +43,7 @@ #include #include "chip.h" -#include "lpc17_memorymap.h" +#include "chip/lpc17_memorymap.h" /************************************************************************************ * Pre-processor Definitions @@ -277,4 +277,4 @@ * Public Functions ************************************************************************************/ -#endif /* __ARCH_ARM_SRC_LPC17XX_LPC17_MCPWM_H */ +#endif /* __ARCH_ARM_SRC_LPC17XX_CHIP_LPC17_MCPWM_H */ diff --git a/nuttx/arch/arm/src/lpc17xx/chip/lpc17_memorymap.h b/nuttx/arch/arm/src/lpc17xx/chip/lpc17_memorymap.h new file mode 100644 index 0000000000..d3bdf79ab1 --- /dev/null +++ b/nuttx/arch/arm/src/lpc17xx/chip/lpc17_memorymap.h @@ -0,0 +1,71 @@ +/************************************************************************************ + * arch/arm/src/lpc17xx/chip/lp17_memorymap.h + * + * Copyright (C) 2009-2011, 2013 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * 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. + * + ************************************************************************************/ + +#ifndef __ARCH_ARM_SRC_LPC17XX_CHIP_LPC17_MEMORYMAP_H +#define __ARCH_ARM_SRC_LPC17XX_CHIP_LPC17_MEMORYMAP_H + +/************************************************************************************ + * Included Files + ************************************************************************************/ + +#include + +#include + +#if defined(LPC176x) +# include "chip/lpc176x_memorymap.h" +#elif defined(LPC178x) +# include "chip/lpc178x_memorymap.h" +#else +# error "Unrecognized LPC17xx family" +#endif + +/************************************************************************************ + * Definitions + ************************************************************************************/ + +/************************************************************************************ + * Public Types + ************************************************************************************/ + +/************************************************************************************ + * Public Data + ************************************************************************************/ + +/************************************************************************************ + * Public Function Prototypes + ************************************************************************************/ + + #endif /* __ARCH_ARM_SRC_LPC17XX_CHIP_LPC17_MEMORYMAP_H */ diff --git a/nuttx/arch/arm/src/lpc17xx/chip/lpc17_pinconfig.h b/nuttx/arch/arm/src/lpc17xx/chip/lpc17_pinconfig.h new file mode 100644 index 0000000000..fb4a487c27 --- /dev/null +++ b/nuttx/arch/arm/src/lpc17xx/chip/lpc17_pinconfig.h @@ -0,0 +1,71 @@ +/************************************************************************************ + * arch/arm/src/lpc17xx/chip/lp17_pinconfig.h + * + * Copyright (C) 2009-2011, 2013 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * 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. + * + ************************************************************************************/ + +#ifndef __ARCH_ARM_SRC_LPC17XX_CHIP_LPC17_PINCONFIG_H +#define __ARCH_ARM_SRC_LPC17XX_CHIP_LPC17_PINCONFIG_H + +/************************************************************************************ + * Included Files + ************************************************************************************/ + +#include + +#include + +#if defined(LPC176x) +# include "chip/lpc176x_pinconfig.h" +#elif defined(LPC178x) +# include "chip/lpc178x_pinconfig.h" +#else +# error "Unrecognized LPC17xx family" +#endif + +/************************************************************************************ + * Definitions + ************************************************************************************/ + +/************************************************************************************ + * Public Types + ************************************************************************************/ + +/************************************************************************************ + * Public Data + ************************************************************************************/ + +/************************************************************************************ + * Public Function Prototypes + ************************************************************************************/ + + #endif /* __ARCH_ARM_SRC_LPC17XX_CHIP_LPC17_PINCONFIG_H */ diff --git a/nuttx/arch/arm/src/lpc17xx/lpc17_pinconn.h b/nuttx/arch/arm/src/lpc17xx/chip/lpc17_pinconn.h similarity index 99% rename from nuttx/arch/arm/src/lpc17xx/lpc17_pinconn.h rename to nuttx/arch/arm/src/lpc17xx/chip/lpc17_pinconn.h index c0e0ec9160..d8b8e0d37d 100644 --- a/nuttx/arch/arm/src/lpc17xx/lpc17_pinconn.h +++ b/nuttx/arch/arm/src/lpc17xx/chip/lpc17_pinconn.h @@ -1,7 +1,7 @@ /************************************************************************************ - * arch/arm/src/lpc17xx/lpc17_pinconn.h + * arch/arm/src/lpc17xx/chip/lpc17_pinconn.h * - * Copyright (C) 2010 Gregory Nutt. All rights reserved. + * Copyright (C) 2010, 2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -33,8 +33,8 @@ * ************************************************************************************/ -#ifndef __ARCH_ARM_SRC_LPC17XX_LPC17_PINCONN_H -#define __ARCH_ARM_SRC_LPC17XX_LPC17_PINCONN_H +#ifndef __ARCH_ARM_SRC_LPC17XX_CHIP_LPC17_PINCONN_H +#define __ARCH_ARM_SRC_LPC17XX_CHIP_LPC17_PINCONN_H /************************************************************************************ * Included Files @@ -43,7 +43,7 @@ #include #include "chip.h" -#include "lpc17_memorymap.h" +#include "chip/lpc17_memorymap.h" /************************************************************************************ * Pre-processor Definitions @@ -632,4 +632,4 @@ * Public Functions ************************************************************************************/ -#endif /* __ARCH_ARM_SRC_LPC17XX_LPC17_PINCONN_H */ +#endif /* __ARCH_ARM_SRC_LPC17XX_CHIP_LPC17_PINCONN_H */ diff --git a/nuttx/arch/arm/src/lpc17xx/chip/lpc17_pwm.h b/nuttx/arch/arm/src/lpc17xx/chip/lpc17_pwm.h new file mode 100644 index 0000000000..8a7931104e --- /dev/null +++ b/nuttx/arch/arm/src/lpc17xx/chip/lpc17_pwm.h @@ -0,0 +1,63 @@ +/************************************************************************************ + * arch/arm/src/lpc17xx/chip/lpc17_pwm.h + * + * Copyright (C) 2010, 2013 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * 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. + * + ************************************************************************************/ + +#ifndef __ARCH_ARM_SRC_LPC17XX_CHIP_LPC17_PWM_H +#define __ARCH_ARM_SRC_LPC17XX_CHIP_LPC17_PWM_H + +/************************************************************************************ + * Included Files + ************************************************************************************/ + +#include +#include "chip/lpc17_pwm.h" +#include "chip/lpc17_mcpwm.h" + +/************************************************************************************ + * Pre-processor Definitions + ************************************************************************************/ + +/************************************************************************************ + * Public Types + ************************************************************************************/ + +/************************************************************************************ + * Public Data + ************************************************************************************/ + +/************************************************************************************ + * Public Functions + ************************************************************************************/ + +#endif /* __ARCH_ARM_SRC_LPC17XX_CHIP_LPC17_PWM_H */ diff --git a/nuttx/arch/arm/src/lpc17xx/chip/lpc17_qei.h b/nuttx/arch/arm/src/lpc17xx/chip/lpc17_qei.h new file mode 100644 index 0000000000..4179ac9653 --- /dev/null +++ b/nuttx/arch/arm/src/lpc17xx/chip/lpc17_qei.h @@ -0,0 +1,190 @@ +/************************************************************************************ + * arch/arm/src/lpc17xx/chip/lpc17_qei.h + * + * Copyright (C) 2010, 2013 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * 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. + * + ************************************************************************************/ + +#ifndef __ARCH_ARM_SRC_LPC17XX_CHIP_LPC17_QEI_H +#define __ARCH_ARM_SRC_LPC17XX_CHIP_LPC17_QEI_H + +/************************************************************************************ + * Included Files + ************************************************************************************/ + +#include + +#include "chip.h" +#include "chip/lpc17_memorymap.h" + +/************************************************************************************ + * Pre-processor Definitions + ************************************************************************************/ + +/* Register offsets *****************************************************************/ +/* Control registers */ + +#define LPC17_QEI_CON_OFFSET 0x0000 /* Control register */ +#define LPC17_QEI_STAT_OFFSET 0x0004 /* Encoder status register */ +#define LPC17_QEI_CONF_OFFSET 0x0008 /* Configuration register */ + +/* Position, index, and timer registers */ + +#define LPC17_QEI_POS_OFFSET 0x000c /* Position register */ +#define LPC17_QEI_MAXPOS_OFFSET 0x0010 /* Maximum position register */ +#define LPC17_QEI_CMPOS0_OFFSET 0x0014 /* Position compare register */ +#define LPC17_QEI_CMPOS1_OFFSET 0x0018 /* Position compare register */ +#define LPC17_QEI_CMPOS2_OFFSET 0x001c /* Position compare register */ +#define LPC17_QEI_INXCNT_OFFSET 0x0020 /* Index count register */ +#define LPC17_QEI_INXCMP_OFFSET 0x0024 /* Index compare register */ +#define LPC17_QEI_LOAD_OFFSET 0x0028 /* Velocity timer reload register */ +#define LPC17_QEI_TIME_OFFSET 0x002c /* Velocity timer register */ +#define LPC17_QEI_VEL_OFFSET 0x0030 /* Velocity counter register */ +#define LPC17_QEI_CAP_OFFSET 0x0034 /* Velocity capture register */ +#define LPC17_QEI_VELCOMP_OFFSET 0x0038 /* Velocity compare register */ +#define LPC17_QEI_FILTER_OFFSET 0x003c /* Digital filter register */ + +/* Interrupt registers */ + +#define LPC17_QEI_IEC_OFFSET 0x0fd8 /* Interrupt enable clear register */ +#define LPC17_QEI_IES_OFFSET 0x0fdc /* Interrupt enable set register */ +#define LPC17_QEI_INTSTAT_OFFSET 0x0fe0 /* Interrupt status register */ +#define LPC17_QEI_IE_OFFSET 0x0fe4 /* Interrupt enable register */ +#define LPC17_QEI_CLR_OFFSET 0x0fe8 /* Interrupt status clear register */ +#define LPC17_QEI_SET_OFFSET 0x0fec /* Interrupt status set register */ + +/* Register addresses ***************************************************************/ +/* Control registers */ + +#define LPC17_QEI_CON (LPC17_QEI_BASE+LPC17_QEI_CON_OFFSET) +#define LPC17_QEI_STAT (LPC17_QEI_BASE+LPC17_QEI_STAT_OFFSET) +#define LPC17_QEI_CONF (LPC17_QEI_BASE+LPC17_QEI_CONF_OFFSET) + +/* Position, index, and timer registers */ + +#define LPC17_QEI_POS (LPC17_QEI_BASE+LPC17_QEI_POS_OFFSET) +#define LPC17_QEI_MAXPOS (LPC17_QEI_BASE+LPC17_QEI_MAXPOS_OFFSET) +#define LPC17_QEI_CMPOS0 (LPC17_QEI_BASE+LPC17_QEI_CMPOS0_OFFSET) +#define LPC17_QEI_CMPOS1 (LPC17_QEI_BASE+LPC17_QEI_CMPOS1_OFFSET) +#define LPC17_QEI_CMPOS2 (LPC17_QEI_BASE+LPC17_QEI_CMPOS2_OFFSET) +#define LPC17_QEI_INXCNT (LPC17_QEI_BASE+LPC17_QEI_INXCNT_OFFSET) +#define LPC17_QEI_INXCMP (LPC17_QEI_BASE+LPC17_QEI_INXCMP_OFFSET) +#define LPC17_QEI_LOAD (LPC17_QEI_BASE+LPC17_QEI_LOAD_OFFSET) +#define LPC17_QEI_TIME (LPC17_QEI_BASE+LPC17_QEI_TIME_OFFSET) +#define LPC17_QEI_VEL (LPC17_QEI_BASE+LPC17_QEI_VEL_OFFSET) +#define LPC17_QEI_CAP (LPC17_QEI_BASE+LPC17_QEI_CAP_OFFSET) +#define LPC17_QEI_VELCOMP (LPC17_QEI_BASE+LPC17_QEI_VELCOMP_OFFSET) +#define LPC17_QEI_FILTER (LPC17_QEI_BASE+LPC17_QEI_FILTER_OFFSET) + +/* Interrupt registers */ + +#define LPC17_QEI_IEC (LPC17_QEI_BASE+LPC17_QEI_IEC_OFFSET) +#define LPC17_QEI_IES (LPC17_QEI_BASE+LPC17_QEI_IES_OFFSET) +#define LPC17_QEI_INTSTAT (LPC17_QEI_BASE+LPC17_QEI_INTSTAT_OFFSET) +#define LPC17_QEI_IE (LPC17_QEI_BASE+LPC17_QEI_IE_OFFSET) +#define LPC17_QEI_CLR (LPC17_QEI_BASE+LPC17_QEI_CLR_OFFSET) +#define LPC17_QEI_SET (LPC17_QEI_BASE+LPC17_QEI_SET_OFFSET) + +/* Register bit definitions *********************************************************/ +/* The following registers hold 32-bit integer values and have no bit fields defined + * in this section: + * + * Position register (POS) + * Maximum position register (MAXPOS) + * Position compare register 0 (CMPOS0) + * Position compare register 1 (CMPOS) + * Position compare register 2 (CMPOS2) + * Index count register (INXCNT) + * Index compare register (INXCMP) + * Velocity timer reload register (LOAD) + * Velocity timer register (TIME) + * Velocity counter register (VEL) + * Velocity capture register (CAP) + * Velocity compare register (VELCOMP) + * Digital filter register (FILTER) + */ + +/* Control registers */ +/* Control register */ + +#define QEI_CON_RESP (1 << 0) /* Bit 0: Reset position counter */ +#define QEI_CON_RESPI (1 << 1) /* Bit 1: Reset position counter on index */ +#define QEI_CON_RESV (1 << 2) /* Bit 2: Reset velocity */ +#define QEI_CON_RESI (1 << 3) /* Bit 3: Reset index counter */ + /* Bits 4-31: reserved */ +/* Encoder status register */ + +#define QEI_STAT_DIR (1 << 0) /* Bit 0: Direction bit */ + /* Bits 1-31: reserved */ +/* Configuration register */ + +#define QEI_CONF_DIRINV (1 << 0) /* Bit 0: Direction invert */ +#define QEI_CONF_SIGMODE (1 << 1) /* Bit 1: Signal Mode */ +#define QEI_CONF_CAPMODE (1 << 2) /* Bit 2: Capture Mode */ +#define QEI_CONF_INVINX (1 << 3) /* Bit 3: Invert Index */ + /* Bits 4-31: reserved */ +/* Position, index, and timer registers (all 32-bit integer values with not bit fields */ + +/* Interrupt registers */ +/* Interrupt enable clear register (IEC), Interrupt enable set register (IES), + * Interrupt status register (INTSTAT), Interrupt enable register (IE), Interrupt + * status clear register (CLR), and Interrupt status set register (SET) common + * bit definitions. + */ + +#define QEI_INT_INX (1 << 0) /* Bit 0: Index pulse detected */ +#define QEI_INT_TIM (1 << 1) /* Bit 1: Velocity timer overflow occurred */ +#define QEI_INT_VELC (1 << 2) /* Bit 2: Captured velocity less than compare velocity */ +#define QEI_INT_DIR (1 << 3) /* Bit 3: Change of direction detected */ +#define QEI_INT_ERR (1 << 4) /* Bit 4: Encoder phase error detected */ +#define QEI_INT_ENCLK (1 << 5) /* Bit 5: Eencoder clock pulse detected */ +#define QEI_INT_POS0 (1 << 6) /* Bit 6: Position 0 compare equal to current position */ +#define QEI_INT_POS1 (1 << 7) /* Bit 7: Position 1 compare equal to current position */ +#define QEI_INT_POS2 (1 << 8) /* Bit 8: Position 2 compare equal to current position */ +#define QEI_INT_REV (1 << 9) /* Bit 9: Index compare value equal to current index count */ +#define QEI_INT_POS0REV (1 << 10) /* Bit 10: Combined position 0 and revolution count interrupt */ +#define QEI_INT_POS1REV (1 << 11) /* Bit 11: Position 1 and revolution count interrupt */ +#define QEI_INT_POS2REV (1 << 12) /* Bit 12: Position 2 and revolution count interrupt */ + /* Bits 13-31: reserved */ + +/************************************************************************************ + * Public Types + ************************************************************************************/ + +/************************************************************************************ + * Public Data + ************************************************************************************/ + +/************************************************************************************ + * Public Functions + ************************************************************************************/ + +#endif /* __ARCH_ARM_SRC_LPC17XX_CHIP_LPC17_QEI_H */ diff --git a/nuttx/arch/arm/src/lpc17xx/chip/lpc17_rit.h b/nuttx/arch/arm/src/lpc17xx/chip/lpc17_rit.h new file mode 100644 index 0000000000..00029f8fe7 --- /dev/null +++ b/nuttx/arch/arm/src/lpc17xx/chip/lpc17_rit.h @@ -0,0 +1,92 @@ +/************************************************************************************ + * arch/arm/src/lpc17xx/chip/lpc17_rit.h + * + * Copyright (C) 2010, 2013 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * 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. + * + ************************************************************************************/ + +#ifndef __ARCH_ARM_SRC_LPC17XX_CHIP_LPC17_RIT_H +#define __ARCH_ARM_SRC_LPC17XX_CHIP_LPC17_RIT_H + +/************************************************************************************ + * Included Files + ************************************************************************************/ + +#include + +#include "chip.h" +#include "chip/lpc17_memorymap.h" + +/************************************************************************************ + * Pre-processor Definitions + ************************************************************************************/ + +/* Register offsets *****************************************************************/ + +#define LPC17_RIT_COMPVAL_OFFSET 0x0000 /* Compare register */ +#define LPC17_RIT_MASK_OFFSET 0x0004 /* Mask register */ +#define LPC17_RIT_CTRL_OFFSET 0x0008 /* Control register */ +#define LPC17_RIT_COUNTER_OFFSET 0x000c /* 32-bit counter */ + +/* Register addresses ***************************************************************/ + +#define LPC17_RIT_COMPVAL (LPC17_RIT_BASE+LPC17_RIT_COMPVAL_OFFSET) +#define LPC17_RIT_MASK (LPC17_RIT_BASE+LPC17_RIT_MASK_OFFSET) +#define LPC17_RIT_CTRL (LPC17_RIT_BASE+LPC17_RIT_CTRL_OFFSET) +#define LPC17_RIT_COUNTER (LPC17_RIT_BASE+LPC17_RIT_COUNTER_OFFSET) + +/* Register bit definitions *********************************************************/ +/* Compare register (Bits 0-31: value compared to the counter) */ + +/* Mask register (Bits 0-31: 32-bit mask value) */ + +/* Control register */ + +#define RIT_CTRL_INT (1 << 0) /* Bit 0: Interrupt flag */ +#define RIT_CTRL_ENCLR (1 << 1) /* Bit 1: Timer enable clear */ +#define RIT_CTRL_ENBR (1 << 2) /* Bit 2: Timer enable for debug */ +#define RIT_CTRL_EN (1 << 3) /* Bit 3: Timer enable */ + /* Bits 4-31: Reserved */ +/* 32-bit counter (Bits 0-31: 32-bit up counter) */ + +/************************************************************************************ + * Public Types + ************************************************************************************/ + +/************************************************************************************ + * Public Data + ************************************************************************************/ + +/************************************************************************************ + * Public Functions + ************************************************************************************/ + +#endif /* __ARCH_ARM_SRC_LPC17XX_CHIP_LPC17_RIT_H */ diff --git a/nuttx/arch/arm/src/lpc17xx/chip/lpc17_rtc.h b/nuttx/arch/arm/src/lpc17xx/chip/lpc17_rtc.h new file mode 100644 index 0000000000..ddc44d59f3 --- /dev/null +++ b/nuttx/arch/arm/src/lpc17xx/chip/lpc17_rtc.h @@ -0,0 +1,270 @@ +/************************************************************************************ + * arch/arm/src/lpc17xx/chip/lpc17_rtc.h + * + * Copyright (C) 2010, 2012-2013 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * 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. + * + ************************************************************************************/ + +#ifndef __ARCH_ARM_SRC_LPC17XX_CHIP_LPC17_RTC_H +#define __ARCH_ARM_SRC_LPC17XX_CHIP_LPC17_RTC_H + +/************************************************************************************ + * Included Files + ************************************************************************************/ + +#include + +#include "chip.h" +#include "chip/lpc17_memorymap.h" + +/************************************************************************************ + * Pre-processor Definitions + ************************************************************************************/ + +/* Register offsets *****************************************************************/ +/* Miscellaneous registers */ + +#define LPC17_RTC_ILR_OFFSET 0x0000 /* Interrupt Location Register */ +#define LPC17_RTC_CCR_OFFSET 0x0008 /* Clock Control Register */ +#define LPC17_RTC_CIIR_OFFSET 0x000c /* Counter Increment Interrupt Register */ +#define LPC17_RTC_AMR_OFFSET 0x0010 /* Alarm Mask Register */ +#define LPC17_RTC_AUXEN_OFFSET 0x0058 /* RTC Auxiliary Enable register */ +#define LPC17_RTC_AUX_OFFSET 0x005c /* RTC Auxiliary control register */ + +/* Consolidated time registers */ + +#define LPC17_RTC_CTIME0_OFFSET 0x0014 /* Consolidated Time Register 0 */ +#define LPC17_RTC_CTIME1_OFFSET 0x0018 /* Consolidated Time Register 1 */ +#define LPC17_RTC_CTIME2_OFFSET 0x001c /* Consolidated Time Register 2 */ + +/* Time counter registers */ + +#define LPC17_RTC_SEC_OFFSET 0x0020 /* Seconds Counter */ +#define LPC17_RTC_MIN_OFFSET 0x0024 /* Minutes Register */ +#define LPC17_RTC_HOUR_OFFSET 0x0028 /* Hours Register */ +#define LPC17_RTC_DOM_OFFSET 0x002c /* Day of Month Register */ +#define LPC17_RTC_DOW_OFFSET 0x0030 /* Day of Week Register */ +#define LPC17_RTC_DOY_OFFSET 0x0034 /* Day of Year Register */ +#define LPC17_RTC_MONTH_OFFSET 0x0038 /* Months Register */ +#define LPC17_RTC_YEAR_OFFSET 0x003c /* Years Register */ +#define LPC17_RTC_CALIB_OFFSET 0x0040 /* Calibration Value Register */ + +/* General purpose registers */ + +#define LPC17_RTC_GPREG0_OFFSET 0x0044 /* General Purpose Register 0 */ +#define LPC17_RTC_GPREG1_OFFSET 0x0048 /* General Purpose Register 1 */ +#define LPC17_RTC_GPREG2_OFFSET 0x004c /* General Purpose Register 2 */ +#define LPC17_RTC_GPREG3_OFFSET 0x0050 /* General Purpose Register 3 */ +#define LPC17_RTC_GPREG4_OFFSET 0x0054 /* General Purpose Register 4 */ + +/* Alarm register group */ + +#define LPC17_RTC_ALSEC_OFFSET 0x0060 /* Alarm value for Seconds */ +#define LPC17_RTC_ALMIN_OFFSET 0x0064 /* Alarm value for Minutes */ +#define LPC17_RTC_ALHOUR_OFFSET 0x0068 /* Alarm value for Hours */ +#define LPC17_RTC_ALDOM_OFFSET 0x006c /* Alarm value for Day of Month */ +#define LPC17_RTC_ALDOW_OFFSET 0x0070 /* Alarm value for Day of Week */ +#define LPC17_RTC_ALDOY_OFFSET 0x0074 /* Alarm value for Day of Year */ +#define LPC17_RTC_ALMON_OFFSET 0x0078 /* Alarm value for Months */ +#define LPC17_RTC_ALYEAR_OFFSET 0x007c /* Alarm value for Year */ + +/* Register addresses ***************************************************************/ +/* Miscellaneous registers */ + +#define LPC17_RTC_ILR (LPC17_RTC_BASE+LPC17_RTC_ILR_OFFSET) +#define LPC17_RTC_CCR (LPC17_RTC_BASE+LPC17_RTC_CCR_OFFSET) +#define LPC17_RTC_CIIR (LPC17_RTC_BASE+LPC17_RTC_CIIR_OFFSET) +#define LPC17_RTC_AMR (LPC17_RTC_BASE+LPC17_RTC_AMR_OFFSET) +#define LPC17_RTC_AUXEN (LPC17_RTC_BASE+LPC17_RTC_AUXEN_OFFSET) +#define LPC17_RTC_AUX (LPC17_RTC_BASE+LPC17_RTC_AUX_OFFSET) + +/* Consolidated time registers */ + +#define LPC17_RTC_CTIME0 (LPC17_RTC_BASE+LPC17_RTC_CTIME0_OFFSET) +#define LPC17_RTC_CTIME1 (LPC17_RTC_BASE+LPC17_RTC_CTIME1_OFFSET) +#define LPC17_RTC_CTIME2 (LPC17_RTC_BASE+LPC17_RTC_CTIME2_OFFSET) + +/* Time counter registers */ + +#define LPC17_RTC_SEC (LPC17_RTC_BASE+LPC17_RTC_SEC_OFFSET) +#define LPC17_RTC_MIN (LPC17_RTC_BASE+LPC17_RTC_MIN_OFFSET) +#define LPC17_RTC_HOUR (LPC17_RTC_BASE+LPC17_RTC_HOUR_OFFSET) +#define LPC17_RTC_DOM (LPC17_RTC_BASE+LPC17_RTC_DOM_OFFSET) +#define LPC17_RTC_DOW (LPC17_RTC_BASE+LPC17_RTC_DOW_OFFSET) +#define LPC17_RTC_DOY (LPC17_RTC_BASE+LPC17_RTC_DOY_OFFSET) +#define LPC17_RTC_MONTH (LPC17_RTC_BASE+LPC17_RTC_MONTH_OFFSET) +#define LPC17_RTC_YEAR (LPC17_RTC_BASE+LPC17_RTC_YEAR_OFFSET) +#define LPC17_RTC_CALIB (LPC17_RTC_BASE+LPC17_RTC_CALIB_OFFSET) + +/* General purpose registers */ + +#define LPC17_RTC_GPREG0 (LPC17_RTC_BASE+LPC17_RTC_GPREG0_OFFSET) +#define LPC17_RTC_GPREG1 (LPC17_RTC_BASE+LPC17_RTC_GPREG1_OFFSET) +#define LPC17_RTC_GPREG2 (LPC17_RTC_BASE+LPC17_RTC_GPREG2_OFFSET) +#define LPC17_RTC_GPREG3 (LPC17_RTC_BASE+LPC17_RTC_GPREG3_OFFSET) +#define LPC17_RTC_GPREG4 (LPC17_RTC_BASE+LPC17_RTC_GPREG4_OFFSET) + +/* Alarm register group */ + +#define LPC17_RTC_ALSEC (LPC17_RTC_BASE+LPC17_RTC_ALSEC_OFFSET) +#define LPC17_RTC_ALMIN (LPC17_RTC_BASE+LPC17_RTC_ALMIN_OFFSET) +#define LPC17_RTC_ALHOUR (LPC17_RTC_BASE+LPC17_RTC_ALHOUR_OFFSET) +#define LPC17_RTC_ALDOM (LPC17_RTC_BASE+LPC17_RTC_ALDOM_OFFSET) +#define LPC17_RTC_ALDOW (LPC17_RTC_BASE+LPC17_RTC_ALDOW_OFFSET) +#define LPC17_RTC_ALDOY (LPC17_RTC_BASE+LPC17_RTC_ALDOY_OFFSET) +#define LPC17_RTC_ALMON (LPC17_RTC_BASE+LPC17_RTC_ALMON_OFFSET) +#define LPC17_RTC_ALYEAR (LPC17_RTC_BASE+LPC17_RTC_ALYEAR_OFFSET) + +/* Register bit definitions *********************************************************/ +/* The following registers hold 32-bit values and have no bit fields to be defined: + * + * General Purpose Register 0 + * General Purpose Register 1 + * General Purpose Register 2 + * General Purpose Register 3 + * General Purpose Register 4 + */ + +/* Miscellaneous registers */ +/* Interrupt Location Register */ + +#define RTC_ILR_RTCCIF (1 << 0) /* Bit 0: Counter Increment Interrupt */ +#define RTC_ILR_RTCALF (1 << 1) /* Bit 1: Alarm interrupt */ + /* Bits 2-31: Reserved */ +/* Clock Control Register */ + +#define RTC_CCR_CLKEN (1 << 0) /* Bit 0: Clock Enable */ +#define RTC_CCR_CTCRST (1 << 1) /* Bit 1: CTC Reset */ + /* Bits 2-3: Internal test mode controls */ +#define RTC_CCR_CCALEN (1 << 4) /* Bit 4: Calibration counter enable */ + /* Bits 5-31: Reserved */ +/* Counter Increment Interrupt Register */ + +#define RTC_CIIR_IMSEC (1 << 0) /* Bit 0: Second interrupt */ +#define RTC_CIIR_IMMIN (1 << 1) /* Bit 1: Minute interrupt */ +#define RTC_CIIR_IMHOUR (1 << 2) /* Bit 2: Hour interrupt */ +#define RTC_CIIR_IMDOM (1 << 3) /* Bit 3: Day of Month value interrupt */ +#define RTC_CIIR_IMDOW (1 << 4) /* Bit 4: Day of Week value interrupt */ +#define RTC_CIIR_IMDOY (1 << 5) /* Bit 5: Day of Year interrupt */ +#define RTC_CIIR_IMMON (1 << 6) /* Bit 6: Month interrupt */ +#define RTC_CIIR_IMYEAR (1 << 7) /* Bit 7: Yearinterrupt */ + /* Bits 8-31: Reserved */ +/* Alarm Mask Register */ + +#define RTC_AMR_SEC (1 << 0) /* Bit 0: Second not compared for alarm */ +#define RTC_AMR_MIN (1 << 1) /* Bit 1: Minutes not compared for alarm */ +#define RTC_AMR_HOUR (1 << 2) /* Bit 2: Hour not compared for alarm */ +#define RTC_AMR_DOM (1 << 3) /* Bit 3: Day of Monthnot compared for alarm */ +#define RTC_AMR_DOW (1 << 4) /* Bit 4: Day of Week not compared for alarm */ +#define RTC_AMR_DOY (1 << 5) /* Bit 5: Day of Year not compared for alarm */ +#define RTC_AMR_MON (1 << 6) /* Bit 6: Month not compared for alarm */ +#define RTC_AMR_YEAR (1 << 7) /* Bit 7: Year not compared for alarm */ + /* Bits 8-31: Reserved */ +/* RTC Auxiliary Enable register */ + /* Bits 0-3: Reserved */ +#define RTC_AUXEN_RTCOSCF (1 << 4) /* Bit 4: RTC Oscillator Fail detect flag */ + /* Bits 5-31: Reserved */ +/* RTC Auxiliary control register */ + /* Bits 0-3: Reserved */ +#define RTC_AUX_OSCFEN (1 << 4) /* Bit 4: Oscillator Fail Detect interrupt enable */ + /* Bits 5-31: Reserved */ +/* Consolidated time registers */ +/* Consolidated Time Register 0 */ + +#define RTC_CTIME0_SEC_SHIFT (0) /* Bits 0-5: Seconds */ +#define RTC_CTIME0_SEC_MASK (63 << RTC_CTIME0_SEC_SHIFT) + /* Bits 6-7: Reserved */ +#define RTC_CTIME0_MIN_SHIFT (8) /* Bits 8-13: Minutes */ +#define RTC_CTIME0_MIN_MASK (63 << RTC_CTIME0_MIN_SHIFT) + /* Bits 14-15: Reserved */ +#define RTC_CTIME0_HOURS_SHIFT (16) /* Bits 16-20: Hours */ +#define RTC_CTIME0_HOURS_MASK (31 << RTC_CTIME0_HOURS_SHIFT) + /* Bits 21-23: Reserved */ +#define RTC_CTIME0_DOW_SHIFT (24) /* Bits 24-26: Day of Week */ +#define RTC_CTIME0_DOW_MASK (7 << RTC_CTIME0_DOW_SHIFT) + /* Bits 27-31: Reserved */ +/* Consolidated Time Register 1 */ + +#define RTC_CTIME1_DOM_SHIFT (0) /* Bits 0-4: Day of Month */ +#define RTC_CTIME1_DOM_MASK (31 << RTC_CTIME1_DOM_SHIFT) + /* Bits 5-7: Reserved */ +#define RTC_CTIME1_MON_SHIFT (8) /* Bits 8-11: Month */ +#define RTC_CTIME1_MON_MASK (15 << RTC_CTIME1_MON_SHIFT) + /* Bits 12-15: Reserved */ +#define RTC_CTIME1_YEAR_SHIFT (16) /* Bits 16-27: Year */ +#define RTC_CTIME1_YEAR_MASK (0x0fff << RTC_CTIME1_YEAR_SHIFT) + /* Bits 28-31: Reserved */ +/* Consolidated Time Register 2 */ + +#define RTC_CTIME2_DOY_SHIFT (0) /* Bits 0-11: Day of Year */ +#define RTC_CTIME2_DOY_MASK (0x0fff << RTC_CTIME2_DOY_SHIFT) + /* Bits 12-31: Reserved */ +/* Time counter registers */ + +#define RTC_SEC_MASK (0x003f) +#define RTC_MIN_MASK (0x003f) +#define RTC_HOUR_MASK (0x001f) +#define RTC_DOM_MASK (0x001f) +#define RTC_DOW_MASK (0x0007) +#define RTC_DOY_MASK (0x01ff) +#define RTC_MONTH_MASK (0x000f) +#define RTC_YEAR_MASK (0x0fff) + +/* Calibration Value Register */ + +#define RTC_CALIB_CALVAL_SHIFT (0) /* Bits 0-16: calibration counter counts to this value */ +#define RTC_CALIB_CALVAL_MASK (0xffff << RTC_CALIB_CALVAL_SHIFT) +#define RTC_CALIB_CALDIR (1 << 17) /* Bit 17: Calibration direction */ + /* Bits 18-31: Reserved */ +/* Alarm register group */ + +#define RTC_ALSEC_MASK (0x003f) +#define RTC_ALMIN_MASK (0x003f) +#define RTC_ALHOUR_MASK (0x001f) +#define RTC_ALDOM_MASK (0x001f) +#define RTC_ALDOW_MASK (0x0007) +#define RTC_ALDOY_MASK (0x01ff) +#define RTC_ALMON_MASK (0x000f) +#define RTC_ALYEAR_MASK (0x0fff) + +/************************************************************************************ + * Public Types + ************************************************************************************/ + +/************************************************************************************ + * Public Data + ************************************************************************************/ + +/************************************************************************************ + * Public Functions + ************************************************************************************/ + +#endif /* __ARCH_ARM_SRC_LPC17XX_CHIP_LPC17_RTC_H */ diff --git a/nuttx/arch/arm/src/lpc17xx/chip/lpc17_spi.h b/nuttx/arch/arm/src/lpc17xx/chip/lpc17_spi.h new file mode 100644 index 0000000000..716e70cb54 --- /dev/null +++ b/nuttx/arch/arm/src/lpc17xx/chip/lpc17_spi.h @@ -0,0 +1,141 @@ +/************************************************************************************ + * arch/arm/src/lpc17xx/chip/lpc17_spi.h + * + * Copyright (C) 2010, 2013 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * 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. + * + ************************************************************************************/ + +#ifndef __ARCH_ARM_SRC_LPC17XX_CHIP_LPC17_SPI_H +#define __ARCH_ARM_SRC_LPC17XX_CHIP_LPC17_SPI_H + +/************************************************************************************ + * Included Files + ************************************************************************************/ + +#include + +#include "chip.h" +#include "chip/lpc17_memorymap.h" + +/************************************************************************************ + * Pre-processor Definitions + ************************************************************************************/ + +/* Register offsets *****************************************************************/ + +#define LPC17_SPI_CR_OFFSET 0x0000 /* Control Register */ +#define LPC17_SPI_SR_OFFSET 0x0004 /* SPI Status Register */ +#define LPC17_SPI_DR_OFFSET 0x0008 /* SPI Data Register */ +#define LPC17_SPI_CCR_OFFSET 0x000c /* SPI Clock Counter Register */ +#define LPC17_SPI_TCR_OFFSET 0x0010 /* SPI Test Control Register */ +#define LPC17_SPI_TSR_OFFSET 0x0014 /* SPI Test Status Register */ +#define LPC17_SPI_INT_OFFSET 0x001c /* SPI Interrupt Register */ + +/* Register addresses ***************************************************************/ + +#define LPC17_SPI_CR (LPC17_SPI_BASE+LPC17_SPI_CR_OFFSET) +#define LPC17_SPI_SR (LPC17_SPI_BASE+LPC17_SPI_SR_OFFSET) +#define LPC17_SPI_DR (LPC17_SPI_BASE+LPC17_SPI_DR_OFFSET) +#define LPC17_SPI_CCR (LPC17_SPI_BASE+LPC17_SPI_CCR_OFFSET) +#define LPC17_TCR_CCR (LPC17_SPI_BASE+LPC17_SPI_TCR_OFFSET) +#define LPC17_TSR_CCR (LPC17_SPI_BASE+LPC17_SPI_TSR_OFFSET) +#define LPC17_SPI_INT (LPC17_SPI_BASE+LPC17_SPI_INT_OFFSET) + +/* Register bit definitions *********************************************************/ + +/* Control Register */ + /* Bits 0-1: Reserved */ +#define SPI_CR_BITENABLE (1 << 2) /* Bit 2: Enable word size selected by BITS */ +#define SPI_CR_CPHA (1 << 3) /* Bit 3: Clock phase control */ +#define SPI_CR_CPOL (1 << 4) /* Bit 4: Clock polarity control */ +#define SPI_CR_MSTR (1 << 5) /* Bit 5: Master mode select */ +#define SPI_CR_LSBF (1 << 6) /* Bit 6: SPI data is transferred LSB first */ +#define SPI_CR_SPIE (1 << 7) /* Bit 7: Serial peripheral interrupt enable */ +#define SPI_CR_BITS_SHIFT (8) /* Bits 8-11: Number of bits per word (BITENABLE==1) */ +#define SPI_CR_BITS_MASK (15 << SPI_CR_BITS_SHIFT) +# define SPI_CR_BITS_8BITS (8 << SPI_CR_BITS_SHIFT) /* 8 bits per transfer */ +# define SPI_CR_BITS_9BITS (9 << SPI_CR_BITS_SHIFT) /* 9 bits per transfer */ +# define SPI_CR_BITS_10BITS (10 << SPI_CR_BITS_SHIFT) /* 10 bits per transfer */ +# define SPI_CR_BITS_11BITS (11 << SPI_CR_BITS_SHIFT) /* 11 bits per transfer */ +# define SPI_CR_BITS_12BITS (12 << SPI_CR_BITS_SHIFT) /* 12 bits per transfer */ +# define SPI_CR_BITS_13BITS (13 << SPI_CR_BITS_SHIFT) /* 13 bits per transfer */ +# define SPI_CR_BITS_14BITS (14 << SPI_CR_BITS_SHIFT) /* 14 bits per transfer */ +# define SPI_CR_BITS_15BITS (15 << SPI_CR_BITS_SHIFT) /* 15 bits per transfer */ +# define SPI_CR_BITS_16BITS (0 << SPI_CR_BITS_SHIFT) /* 16 bits per transfer */ + /* Bits 12-31: Reserved */ +/* SPI Status Register */ + /* Bits 0-2: Reserved */ +#define SPI_SR_ABRT (1 << 3) /* Bit 3: Slave abort */ +#define SPI_SR_MODF (1 << 4) /* Bit 4: Mode fault */ +#define SPI_SR_ROVR (1 << 5) /* Bit 5: Read overrun */ +#define SPI_SR_WCOL (1 << 6) /* Bit 6: Write collision */ +#define SPI_SR_SPIF (1 << 7) /* Bit 7: SPI transfer complete */ + /* Bits 8-31: Reserved */ +/* SPI Data Register */ + +#define SPI_DR_MASK (0xff) /* Bits 0-15: SPI Bi-directional data port */ +#define SPI_DR_MASKWIDE (0xffff) /* Bits 0-15: If SPI_CR_BITENABLE != 0 */ + /* Bits 8-31: Reserved */ +/* SPI Clock Counter Register */ + +#define SPI_CCR_MASK (0xff) /* Bits 0-7: SPI Clock counter setting */ + /* Bits 8-31: Reserved */ +/* SPI Test Control Register */ + /* Bit 0: Reserved */ +#define SPI_TCR_TEST_SHIFT (1) /* Bits 1-7: SPI test mode */ +#define SPI_TCR_TEST_MASK (0x7f << SPI_TCR_TEST_SHIFT) + /* Bits 8-31: Reserved */ +/* SPI Test Status Register */ + /* Bits 0-2: Reserved */ +#define SPI_TSR_ABRT (1 << 3) /* Bit 3: Slave abort */ +#define SPI_TSR_MODF (1 << 4) /* Bit 4: Mode fault */ +#define SPI_TSR_ROVR (1 << 5) /* Bit 5: Read overrun */ +#define SPI_TSR_WCOL (1 << 6) /* Bit 6: Write collision */ +#define SPI_TSR_SPIF (1 << 7) /* Bit 7: SPI transfer complete */ + /* Bits 8-31: Reserved */ +/* SPI Interrupt Register */ + +#define SPI_INT_SPIF (1 << 0) /* SPI interrupt */ + /* Bits 1-31: Reserved */ + +/************************************************************************************ + * Public Types + ************************************************************************************/ + +/************************************************************************************ + * Public Data + ************************************************************************************/ + +/************************************************************************************ + * Public Functions + ************************************************************************************/ + +#endif /* __ARCH_ARM_SRC_LPC17XX_CHIP_LPC17_SPI_H */ diff --git a/nuttx/arch/arm/src/lpc17xx/chip/lpc17_ssp.h b/nuttx/arch/arm/src/lpc17xx/chip/lpc17_ssp.h new file mode 100644 index 0000000000..e97a670a87 --- /dev/null +++ b/nuttx/arch/arm/src/lpc17xx/chip/lpc17_ssp.h @@ -0,0 +1,174 @@ +/************************************************************************************ + * arch/arm/src/lpc17xx/chip/lpc17_ssp.h + * + * Copyright (C) 2010, 2012-2013 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * 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. + * + ************************************************************************************/ + +#ifndef __ARCH_ARM_SRC_LPC17XX_CHIP_LPC17_SSP_H +#define __ARCH_ARM_SRC_LPC17XX_CHIP_LPC17_SSP_H + +/************************************************************************************ + * Included Files + ************************************************************************************/ + +#include + +#include "chip.h" +#include "chip/lpc17_memorymap.h" + +/************************************************************************************ + * Pre-processor Definitions + ************************************************************************************/ +/* 8 frame FIFOs for both transmit and receive */ + +#define LPC17_SSP_FIFOSZ 8 + +/* Register offsets *****************************************************************/ + +#define LPC17_SSP_CR0_OFFSET 0x0000 /* Control Register 0 */ +#define LPC17_SSP_CR1_OFFSET 0x0004 /* Control Register 1 */ +#define LPC17_SSP_DR_OFFSET 0x0008 /* Data Register */ +#define LPC17_SSP_SR_OFFSET 0x000c /* Status Register */ +#define LPC17_SSP_CPSR_OFFSET 0x0010 /* Clock Prescale Register */ +#define LPC17_SSP_IMSC_OFFSET 0x0014 /* Interrupt Mask Set and Clear Register */ +#define LPC17_SSP_RIS_OFFSET 0x0018 /* Raw Interrupt Status Register */ +#define LPC17_SSP_MIS_OFFSET 0x001c /* Masked Interrupt Status Register */ +#define LPC17_SSP_ICR_OFFSET 0x0020 /* Interrupt Clear Register */ +#define LPC17_SSP_DMACR_OFFSET 0x0024 /* DMA Control Register */ + +/* Register addresses ***************************************************************/ + +#define LPC17_SSP0_CR0 (LPC17_SSP0_BASE+LPC17_SSP_CR0_OFFSET) +#define LPC17_SSP0_CR1 (LPC17_SSP0_BASE+LPC17_SSP_CR1_OFFSET) +#define LPC17_SSP0_DR (LPC17_SSP0_BASE+LPC17_SSP_DR_OFFSET) +#define LPC17_SSP0_SR (LPC17_SSP0_BASE+LPC17_SSP_SR_OFFSET) +#define LPC17_SSP0_CPSR (LPC17_SSP0_BASE+LPC17_SSP_CPSR_OFFSET) +#define LPC17_SSP0_IMSC (LPC17_SSP0_BASE+LPC17_SSP_IMSC_OFFSET) +#define LPC17_SSP0_RIS (LPC17_SSP0_BASE+LPC17_SSP_RIS_OFFSET) +#define LPC17_SSP0_MIS (LPC17_SSP0_BASE+LPC17_SSP_MIS_OFFSET) +#define LPC17_SSP0_ICR (LPC17_SSP0_BASE+LPC17_SSP_ICR_OFFSET) +#define LPC17_SSP0_DMACR (LPC17_SSP0_BASE+LPC17_SSP_DMACR_OFFSET) + +#define LPC17_SSP1_CR0 (LPC17_SSP1_BASE+LPC17_SSP_CR0_OFFSET) +#define LPC17_SSP1_CR1 (LPC17_SSP1_BASE+LPC17_SSP_CR1_OFFSET) +#define LPC17_SSP1_DR (LPC17_SSP1_BASE+LPC17_SSP_DR_OFFSET) +#define LPC17_SSP1_SR (LPC17_SSP1_BASE+LPC17_SSP_SR_OFFSET) +#define LPC17_SSP1_CPSR (LPC17_SSP1_BASE+LPC17_SSP_CPSR_OFFSET) +#define LPC17_SSP1_IMSC (LPC17_SSP1_BASE+LPC17_SSP_IMSC_OFFSET) +#define LPC17_SSP1_RIS (LPC17_SSP1_BASE+LPC17_SSP_RIS_OFFSET) +#define LPC17_SSP1_MIS (LPC17_SSP1_BASE+LPC17_SSP_MIS_OFFSET) +#define LPC17_SSP1_ICR (LPC17_SSP1_BASE+LPC17_SSP_ICR_OFFSET) +#define LPC17_SSP1_DMACR (LPC17_SSP1_BASE+LPC17_SSP_DMACR_OFFSET) + +/* Register bit definitions *********************************************************/ +/* Control Register 0 */ + +#define SSP_CR0_DSS_SHIFT (0) /* Bits 0-3: DSS Data Size Select */ +#define SSP_CR0_DSS_MASK (15 << SSP_CR0_DSS_SHIFT) +# define SSP_CR0_DSS_4BIT (3 << SSP_CR0_DSS_SHIFT) +# define SSP_CR0_DSS_5BIT (4 << SSP_CR0_DSS_SHIFT) +# define SSP_CR0_DSS_6BIT (5 << SSP_CR0_DSS_SHIFT) +# define SSP_CR0_DSS_7BIT (6 << SSP_CR0_DSS_SHIFT) +# define SSP_CR0_DSS_8BIT (7 << SSP_CR0_DSS_SHIFT) +# define SSP_CR0_DSS_9BIT (8 << SSP_CR0_DSS_SHIFT) +# define SSP_CR0_DSS_10BIT (9 << SSP_CR0_DSS_SHIFT) +# define SSP_CR0_DSS_11BIT (10 << SSP_CR0_DSS_SHIFT) +# define SSP_CR0_DSS_12BIT (11 << SSP_CR0_DSS_SHIFT) +# define SSP_CR0_DSS_13BIT (12 << SSP_CR0_DSS_SHIFT) +# define SSP_CR0_DSS_14BIT (13 << SSP_CR0_DSS_SHIFT) +# define SSP_CR0_DSS_15BIT (14 << SSP_CR0_DSS_SHIFT) +# define SSP_CR0_DSS_16BIT (15 << SSP_CR0_DSS_SHIFT) +#define SSP_CR0_FRF_SHIFT (4) /* Bits 4-5: FRF Frame Format */ +#define SSP_CR0_FRF_MASK (3 << SSP_CR0_FRF_SHIFT) +# define SSP_CR0_FRF_SPI (0 << SSP_CR0_FRF_SHIFT) +# define SSP_CR0_FRF_TI (1 << SSP_CR0_FRF_SHIFT) +# define SSP_CR0_FRF_UWIRE (2 << SSP_CR0_FRF_SHIFT) +#define SSP_CR0_CPOL (1 << 6) /* Bit 6: Clock Out Polarity */ +#define SSP_CR0_CPHA (1 << 7) /* Bit 7: Clock Out Phase */ +#define SSP_CR0_SCR_SHIFT (8) /* Bits 8-15: Serial Clock Rate */ +#define SSP_CR0_SCR_MASK (0xff << SSP_CR0_SCR_SHIFT) + /* Bits 8-31: Reserved */ +/* Control Register 1 */ + +#define SSP_CR1_LBM (1 << 0) /* Bit 0: Loop Back Mode */ +#define SSP_CR1_SSE (1 << 1) /* Bit 1: SSP Enable */ +#define SSP_CR1_MS (1 << 2) /* Bit 2: Master/Slave Mode */ +#define SSP_CR1_SOD (1 << 3) /* Bit 3: Slave Output Disable */ + /* Bits 4-31: Reserved */ +/* Data Register */ + +#define SSP_DR_MASK (0xffff) /* Bits 0-15: Data */ + /* Bits 16-31: Reserved */ +/* Status Register */ + +#define SSP_SR_TFE (1 << 0) /* Bit 0: Transmit FIFO Empty */ +#define SSP_SR_TNF (1 << 1) /* Bit 1: Transmit FIFO Not Full */ +#define SSP_SR_RNE (1 << 2) /* Bit 2: Receive FIFO Not Empty */ +#define SSP_SR_RFF (1 << 3) /* Bit 3: Receive FIFO Full */ +#define SSP_SR_BSY (1 << 4) /* Bit 4: Busy */ + /* Bits 5-31: Reserved */ +/* Clock Prescale Register */ + +#define SSP_CPSR_DVSR_MASK (0xff) /* Bits 0-7: clock = SSP_PCLK/DVSR */ + /* Bits 8-31: Reserved */ +/* Common format for interrupt control registers: + * + * Interrupt Mask Set and Clear Register (IMSC) + * Raw Interrupt Status Register (RIS) + * Masked Interrupt Status Register (MIS) + * Interrupt Clear Register (ICR) + */ + +#define SSP_INT_ROR (1 << 0) /* Bit 0: RX FIFO overrun */ +#define SSP_INT_RT (1 << 1) /* Bit 1: RX FIFO timeout */ +#define SSP_INT_RX (1 << 2) /* Bit 2: RX FIFO at least half full (not ICR) */ +#define SSP_INT_TX (1 << 3 ) /* Bit 3: TX FIFO at least half empy (not ICR) */ + /* Bits 4-31: Reserved */ +/* DMA Control Register */ + +#define SSP_DMACR_RXDMAE (1 << 0) /* Bit 0: Receive DMA Enable */ +#define SSP_DMACR_TXDMAE (1 << 1) /* Bit 1: Transmit DMA Enable */ + /* Bits 2-31: Reserved */ + +/************************************************************************************ + * Public Types + ************************************************************************************/ + +/************************************************************************************ + * Public Data + ************************************************************************************/ + +/************************************************************************************ + * Public Functions + ************************************************************************************/ + +#endif /* __ARCH_ARM_SRC_LPC17XX_CHIP_LPC17_SSP_H */ diff --git a/nuttx/arch/arm/src/lpc17xx/lpc17_syscon.h b/nuttx/arch/arm/src/lpc17xx/chip/lpc17_syscon.h similarity index 99% rename from nuttx/arch/arm/src/lpc17xx/lpc17_syscon.h rename to nuttx/arch/arm/src/lpc17xx/chip/lpc17_syscon.h index 3b9c325260..15be1e6723 100644 --- a/nuttx/arch/arm/src/lpc17xx/lpc17_syscon.h +++ b/nuttx/arch/arm/src/lpc17xx/chip/lpc17_syscon.h @@ -1,7 +1,7 @@ /************************************************************************************ - * arch/arm/src/lpc17xx/lpc17_syscon.h + * arch/arm/src/lpc17xx/chip/lpc17_syscon.h * - * Copyright (C) 2010 Gregory Nutt. All rights reserved. + * Copyright (C) 2010, 2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -33,8 +33,8 @@ * ************************************************************************************/ -#ifndef __ARCH_ARM_SRC_LPC17XX_LPC17_SYSCON_H -#define __ARCH_ARM_SRC_LPC17XX_LPC17_SYSCON_H +#ifndef __ARCH_ARM_SRC_LPC17XX_CHIP_LPC17_SYSCON_H +#define __ARCH_ARM_SRC_LPC17XX_CHIP_LPC17_SYSCON_H /************************************************************************************ * Included Files @@ -43,7 +43,7 @@ #include #include "chip.h" -#include "lpc17_memorymap.h" +#include "chip/lpc17_memorymap.h" /************************************************************************************ * Pre-processor Definitions @@ -491,4 +491,4 @@ * Public Functions ************************************************************************************/ -#endif /* __ARCH_ARM_SRC_LPC17XX_LPC17_SYSCON_H */ +#endif /* __ARCH_ARM_SRC_LPC17XX_CHIP_LPC17_SYSCON_H */ diff --git a/nuttx/arch/arm/src/lpc17xx/chip/lpc17_timer.h b/nuttx/arch/arm/src/lpc17xx/chip/lpc17_timer.h new file mode 100644 index 0000000000..455133ee7e --- /dev/null +++ b/nuttx/arch/arm/src/lpc17xx/chip/lpc17_timer.h @@ -0,0 +1,250 @@ +/************************************************************************************ + * arch/arm/src/lpc17xx/chip/lpc17_timer.h + * + * Copyright (C) 2010, 2012-2013 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * 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. + * + ************************************************************************************/ + +#ifndef __ARCH_ARM_SRC_LPC17XX_CHIP_LPC17_TIMER_H +#define __ARCH_ARM_SRC_LPC17XX_CHIP_LPC17_TIMER_H + +/************************************************************************************ + * Included Files + ************************************************************************************/ + +#include + +#include "chip.h" +#include "chip/lpc17_memorymap.h" + +/************************************************************************************ + * Pre-processor Definitions + ************************************************************************************/ + +/* Register offsets *****************************************************************/ + +#define LPC17_TMR_IR_OFFSET 0x0000 /* Interrupt Register */ +#define LPC17_TMR_TCR_OFFSET 0x0004 /* Timer Control Register */ +#define LPC17_TMR_TC_OFFSET 0x0008 /* Timer Counter */ +#define LPC17_TMR_PR_OFFSET 0x000c /* Prescale Register */ +#define LPC17_TMR_PC_OFFSET 0x0010 /* Prescale Counter */ +#define LPC17_TMR_MCR_OFFSET 0x0014 /* Match Control Register */ +#define LPC17_TMR_MR0_OFFSET 0x0018 /* Match Register 0 */ +#define LPC17_TMR_MR1_OFFSET 0x001c /* Match Register 1 */ +#define LPC17_TMR_MR2_OFFSET 0x0020 /* Match Register 2 */ +#define LPC17_TMR_MR3_OFFSET 0x0024 /* Match Register 3 */ +#define LPC17_TMR_CCR_OFFSET 0x0028 /* Capture Control Register */ +#define LPC17_TMR_CR0_OFFSET 0x002c /* Capture Register 0 */ +#define LPC17_TMR_CR1_OFFSET 0x0030 /* Capture Register 1 */ +#define LPC17_TMR_EMR_OFFSET 0x003c /* External Match Register */ +#define LPC17_TMR_CTCR_OFFSET 0x0070 /* Count Control Register */ + +/* Register addresses ***************************************************************/ + +#define LPC17_TMR0_IR (LPC17_TMR0_BASE+LPC17_TMR_IR_OFFSET) +#define LPC17_TMR0_TCR (LPC17_TMR0_BASE+LPC17_TMR_TCR_OFFSET) +#define LPC17_TMR0_TC (LPC17_TMR0_BASE+LPC17_TMR_TC_OFFSET) +#define LPC17_TMR0_PR (LPC17_TMR0_BASE+LPC17_TMR_PR_OFFSET) +#define LPC17_TMR0_PC (LPC17_TMR0_BASE+LPC17_TMR_PC_OFFSET) +#define LPC17_TMR0_MCR (LPC17_TMR0_BASE+LPC17_TMR_MCR_OFFSET) +#define LPC17_TMR0_MR0 (LPC17_TMR0_BASE+LPC17_TMR_MR0_OFFSET) +#define LPC17_TMR0_MR1 (LPC17_TMR0_BASE+LPC17_TMR_MR1_OFFSET) +#define LPC17_TMR0_MR2 (LPC17_TMR0_BASE+LPC17_TMR_MR2_OFFSET) +#define LPC17_TMR0_MR3 (LPC17_TMR0_BASE+LPC17_TMR_MR3_OFFSET) +#define LPC17_TMR0_CCR (LPC17_TMR0_BASE+LPC17_TMR_CCR_OFFSET) +#define LPC17_TMR0_CR0 (LPC17_TMR0_BASE+LPC17_TMR_CR0_OFFSET) +#define LPC17_TMR0_CR1 (LPC17_TMR0_BASE+LPC17_TMR_CR1_OFFSET) +#define LPC17_TMR0_EMR (LPC17_TMR0_BASE+LPC17_TMR_EMR_OFFSET) +#define LPC17_TMR0_CTCR (LPC17_TMR0_BASE+LPC17_TMR_CTCR_OFFSET) + +#define LPC17_TMR1_IR (LPC17_TMR1_BASE+LPC17_TMR_IR_OFFSET) +#define LPC17_TMR1_TCR (LPC17_TMR1_BASE+LPC17_TMR_TCR_OFFSET) +#define LPC17_TMR1_TC (LPC17_TMR1_BASE+LPC17_TMR_TC_OFFSET) +#define LPC17_TMR1_PR (LPC17_TMR1_BASE+LPC17_TMR_PR_OFFSET) +#define LPC17_TMR1_PC (LPC17_TMR1_BASE+LPC17_TMR_PC_OFFSET) +#define LPC17_TMR1_MCR (LPC17_TMR1_BASE+LPC17_TMR_MCR_OFFSET) +#define LPC17_TMR1_MR0 (LPC17_TMR1_BASE+LPC17_TMR_MR0_OFFSET) +#define LPC17_TMR1_MR1 (LPC17_TMR1_BASE+LPC17_TMR_MR1_OFFSET) +#define LPC17_TMR1_MR2 (LPC17_TMR1_BASE+LPC17_TMR_MR2_OFFSET) +#define LPC17_TMR1_MR3 (LPC17_TMR1_BASE+LPC17_TMR_MR3_OFFSET) +#define LPC17_TMR1_CCR (LPC17_TMR1_BASE+LPC17_TMR_CCR_OFFSET) +#define LPC17_TMR1_CR0 (LPC17_TMR1_BASE+LPC17_TMR_CR0_OFFSET) +#define LPC17_TMR1_CR1 (LPC17_TMR1_BASE+LPC17_TMR_CR1_OFFSET) +#define LPC17_TMR1_EMR (LPC17_TMR1_BASE+LPC17_TMR_EMR_OFFSET) +#define LPC17_TMR1_CTCR (LPC17_TMR1_BASE+LPC17_TMR_CTCR_OFFSET) + +#define LPC17_TMR2_IR (LPC17_TMR2_BASE+LPC17_TMR_IR_OFFSET) +#define LPC17_TMR2_TCR (LPC17_TMR2_BASE+LPC17_TMR_TCR_OFFSET) +#define LPC17_TMR2_TC (LPC17_TMR2_BASE+LPC17_TMR_TC_OFFSET) +#define LPC17_TMR2_PR (LPC17_TMR2_BASE+LPC17_TMR_PR_OFFSET) +#define LPC17_TMR2_PC (LPC17_TMR2_BASE+LPC17_TMR_PC_OFFSET) +#define LPC17_TMR2_MCR (LPC17_TMR2_BASE+LPC17_TMR_MCR_OFFSET) +#define LPC17_TMR2_MR0 (LPC17_TMR2_BASE+LPC17_TMR_MR0_OFFSET) +#define LPC17_TMR2_MR1 (LPC17_TMR2_BASE+LPC17_TMR_MR1_OFFSET) +#define LPC17_TMR2_MR2 (LPC17_TMR2_BASE+LPC17_TMR_MR2_OFFSET) +#define LPC17_TMR2_MR3 (LPC17_TMR2_BASE+LPC17_TMR_MR3_OFFSET) +#define LPC17_TMR2_CCR (LPC17_TMR2_BASE+LPC17_TMR_CCR_OFFSET) +#define LPC17_TMR2_CR0 (LPC17_TMR2_BASE+LPC17_TMR_CR0_OFFSET) +#define LPC17_TMR2_CR1 (LPC17_TMR2_BASE+LPC17_TMR_CR1_OFFSET) +#define LPC17_TMR2_EMR (LPC17_TMR2_BASE+LPC17_TMR_EMR_OFFSET) +#define LPC17_TMR2_CTCR (LPC17_TMR2_BASE+LPC17_TMR_CTCR_OFFSET) + +#define LPC17_TMR3_IR (LPC17_TMR3_BASE+LPC17_TMR_IR_OFFSET) +#define LPC17_TMR3_TCR (LPC17_TMR3_BASE+LPC17_TMR_TCR_OFFSET) +#define LPC17_TMR3_TC (LPC17_TMR3_BASE+LPC17_TMR_TC_OFFSET) +#define LPC17_TMR3_PR (LPC17_TMR3_BASE+LPC17_TMR_PR_OFFSET) +#define LPC17_TMR3_PC (LPC17_TMR3_BASE+LPC17_TMR_PC_OFFSET) +#define LPC17_TMR3_MCR (LPC17_TMR3_BASE+LPC17_TMR_MCR_OFFSET) +#define LPC17_TMR3_MR0 (LPC17_TMR3_BASE+LPC17_TMR_MR0_OFFSET) +#define LPC17_TMR3_MR1 (LPC17_TMR3_BASE+LPC17_TMR_MR1_OFFSET) +#define LPC17_TMR3_MR2 (LPC17_TMR3_BASE+LPC17_TMR_MR2_OFFSET) +#define LPC17_TMR3_MR3 (LPC17_TMR3_BASE+LPC17_TMR_MR3_OFFSET) +#define LPC17_TMR3_CCR (LPC17_TMR3_BASE+LPC17_TMR_CCR_OFFSET) +#define LPC17_TMR3_CR0 (LPC17_TMR3_BASE+LPC17_TMR_CR0_OFFSET) +#define LPC17_TMR3_CR1 (LPC17_TMR3_BASE+LPC17_TMR_CR1_OFFSET) +#define LPC17_TMR3_EMR (LPC17_TMR3_BASE+LPC17_TMR_EMR_OFFSET) +#define LPC17_TMR3_CTCR (LPC17_TMR3_BASE+LPC17_TMR_CTCR_OFFSET) + +/* Register bit definitions *********************************************************/ +/* Registers holding 32-bit numeric values (no bit field definitions): + * + * Timer Counter (TC) + * Prescale Register (PR) + * Prescale Counter (PC) + * Match Register 0 (MR0) + * Match Register 1 (MR1) + * Match Register 2 (MR2) + * Match Register 3 (MR3) + * Capture Register 0 (CR0) + * Capture Register 1 (CR1) + */ + +/* Interrupt Register */ + +#define TMR_IR_MR0 (1 << 0) /* Bit 0: Match channel 0 interrupt */ +#define TMR_IR_MR1 (1 << 1) /* Bit 1: Match channel 1 interrupt */ +#define TMR_IR_MR2 (1 << 2) /* Bit 2: Match channel 2 interrupt */ +#define TMR_IR_MR3 (1 << 3) /* Bit 3: Match channel 3 interrupt */ +#define TMR_IR_CR0 (1 << 4) /* Bit 4: Capture channel 0 interrupt */ +#define TMR_IR_CR1 (1 << 5) /* Bit 5: Capture channel 1 interrupt */ + /* Bits 6-31: Reserved */ +/* Timer Control Register */ + +#define TMR_TCR_EN (1 << 0) /* Bit 0: Counter Enable */ +#define TMR_TCR_RESET (1 << 1) /* Bit 1: Counter Reset */ + /* Bits 2-31: Reserved */ +/* Match Control Register */ + +#define TMR_MCR_MR0I (1 << 0) /* Bit 0: Interrupt on MR0 */ +#define TMR_MCR_MR0R (1 << 1) /* Bit 1: Reset on MR0 */ +#define TMR_MCR_MR0S (1 << 2) /* Bit 2: Stop on MR0 */ +#define TMR_MCR_MR1I (1 << 3) /* Bit 3: Interrupt on MR1 */ +#define TMR_MCR_MR1R (1 << 4) /* Bit 4: Reset on MR1 */ +#define TMR_MCR_MR1S (1 << 5) /* Bit 5: Stop on MR1 */ +#define TMR_MCR_MR2I (1 << 6) /* Bit 6: Interrupt on MR2 */ +#define TMR_MCR_MR2R (1 << 7) /* Bit 7: Reset on MR2 */ +#define TMR_MCR_MR2S (1 << 8) /* Bit 8: Stop on MR2 */ +#define TMR_MCR_MR3I (1 << 9) /* Bit 9: Interrupt on MR3 */ +#define TMR_MCR_MR3R (1 << 10) /* Bit 10: Reset on MR3 */ +#define TMR_MCR_MR3S (1 << 11) /* Bit 11: Stop on MR3 */ + /* Bits 12-31: Reserved */ +/* Capture Control Register */ + +#define TMR_CCR_CAP0RE (1 << 0) /* Bit 0: Capture on CAPn.0 rising edge */ +#define TMR_CCR_CAP0FE (1 << 1) /* Bit 1: Capture on CAPn.0 falling edge */ +#define TMR_CCR_CAP0I (1 << 2) /* Bit 2: Interrupt on CAPn.0 */ +#define TMR_CCR_CAP1RE (1 << 3) /* Bit 3: Capture on CAPn.1 rising edge */ +#define TMR_CCR_CAP1FE (1 << 4) /* Bit 4: Capture on CAPn.1 falling edge */ +#define TMR_CCR_CAP1I (1 << 5) /* Bit 5: Interrupt on CAPn.1 */ + /* Bits 6-31: Reserved */ +/* External Match Register */ + +#define TMR_EMR_NOTHING (0) /* Do Nothing */ +#define TMR_EMR_CLEAR (1) /* Clear external match bit MATn.m */ +#define TMR_EMR_SET (2) /* Set external match bit MATn.m */ +#define TMR_EMR_TOGGLE (3) /* Toggle external match bit MATn.m */ + +#define TMR_EMR_EM0 (1 << 0) /* Bit 0: External Match 0 */ +#define TMR_EMR_EM1 (1 << 1) /* Bit 1: External Match 1 */ +#define TMR_EMR_EM2 (1 << 2) /* Bit 2: External Match 2 */ +#define TMR_EMR_EM3 (1 << 3) /* Bit 3: External Match 3 */ +#define TMR_EMR_EMC0_SHIFT (4) /* Bits 4-5: External Match Control 0 */ +#define TMR_EMR_EMC0_MASK (3 << TMR_EMR_EMC0_SHIFTy) +# define TMR_EMR_EMC0_NOTHING (TMR_EMR_NOTHING << TMR_EMR_EMC0_SHIFT) +# define TMR_EMR_EMC0_CLEAR (TMR_EMR_CLEAR << TMR_EMR_EMC0_SHIFT) +# define TMR_EMR_EMC0_SET (TMR_EMR_SET << TMR_EMR_EMC0_SHIFT) +# define TMR_EMR_EMC0_TOGGLE (TMR_EMR_TOGGLE << TMR_EMR_EMC0_SHIFT) +#define TMR_EMR_EMC1_SHIFT (6) /* Bits 6-7: External Match Control 1 */ +#define TMR_EMR_EMC1_MASK (3 << TMR_EMR_EMC1_SHIFT) +# define TMR_EMR_EMC1_NOTHING (TMR_EMR_NOTHING << TMR_EMR_EMC1_SHIFT) +# define TMR_EMR_EMC1_CLEAR (TMR_EMR_CLEAR << TMR_EMR_EMC1_SHIFT) +# define TMR_EMR_EMC1_SET (TMR_EMR_SET << TMR_EMR_EMC1_SHIFT) +# define TMR_EMR_EMC1_TOGGLE (TMR_EMR_TOGGLE << TMR_EMR_EMC1_SHIFT) +#define TMR_EMR_EMC2_SHIFT (8) /* Bits 8-9: External Match Control 2 */ +#define TMR_EMR_EMC2_MASK (3 << TMR_EMR_EMC2_SHIFT) +# define TMR_EMR_EMC2_NOTHING (TMR_EMR_NOTHING << TMR_EMR_EMC2_SHIFT) +# define TMR_EMR_EMC2_CLEAR (TMR_EMR_CLEAR << TMR_EMR_EMC2_SHIFT) +# define TMR_EMR_EMC2_SET (TMR_EMR_SET << TMR_EMR_EMC2_SHIFT) +# define TMR_EMR_EMC2_TOGGLE (TMR_EMR_TOGGLE << TMR_EMR_EMC2_SHIFT) +#define TMR_EMR_EMC3_SHIFT (10) /* Bits 10-11: External Match Control 3 */ +#define TMR_EMR_EMC3_MASK (3 << TMR_EMR_EMC3_SHIFT) +# define TMR_EMR_EMC3_NOTHING (TMR_EMR_NOTHING << TMR_EMR_EMC3_SHIFT) +# define TMR_EMR_EMC3_CLEAR (TMR_EMR_CLEAR << TMR_EMR_EMC3_SHIFT) +# define TMR_EMR_EMC3_SET (TMR_EMR_SET << TMR_EMR_EMC3_SHIFT) +# define TMR_EMR_EMC3_TOGGLE (TMR_EMR_TOGGLE << TMR_EMR_EMC3_SHIFT) + /* Bits 12-31: Reserved */ +/* Count Control Register */ + +#define TMR_CTCR_MODE_SHIFT (0) /* Bits 0-1: Counter/Timer Mode */ +#define TMR_CTCR_MODE_MASK (3 << TMR_CTCR_MODE_SHIFT) +# define TMR_CTCR_MODE_TIMER (0 << TMR_CTCR_MODE_SHIFT) /* Timer Mode, prescale match */ +# define TMR_CTCR_MODE_CNTRRE (1 << TMR_CTCR_MODE_SHIFT) /* Counter Mode, CAP rising edge */ +# define TMR_CTCR_MODE_CNTRFE (2 << TMR_CTCR_MODE_SHIFT) /* Counter Mode, CAP falling edge */ +# define TMR_CTCR_MODE_CNTRBE (3 << TMR_CTCR_MODE_SHIFT) /* Counter Mode, CAP both edges */ +#define TMR_CTCR_INPSEL_SHIFT (2) /* Bits 2-3: Count Input Select */ +#define TMR_CTCR_INPSEL_MASK (3 << TMR_CTCR_INPSEL_SHIFT) +# define TMR_CTCR_INPSEL_CAPNp0 (0 << TMR_CTCR_INPSEL_SHIFT) /* CAPn.0 for TIMERn */ +# define TMR_CTCR_INPSEL_CAPNp1 (1 << TMR_CTCR_INPSEL_SHIFT) /* CAPn.1 for TIMERn */ + /* Bits 4-31: Reserved */ + +/************************************************************************************ + * Public Types + ************************************************************************************/ + +/************************************************************************************ + * Public Data + ************************************************************************************/ + +/************************************************************************************ + * Public Functions + ************************************************************************************/ + +#endif /* __ARCH_ARM_SRC_LPC17XX_CHIP_LPC17_TIMER_H */ diff --git a/nuttx/arch/arm/src/lpc17xx/lpc17_uart.h b/nuttx/arch/arm/src/lpc17xx/chip/lpc17_uart.h similarity index 97% rename from nuttx/arch/arm/src/lpc17xx/lpc17_uart.h rename to nuttx/arch/arm/src/lpc17xx/chip/lpc17_uart.h index 3664a0cb8c..1def0d009c 100644 --- a/nuttx/arch/arm/src/lpc17xx/lpc17_uart.h +++ b/nuttx/arch/arm/src/lpc17xx/chip/lpc17_uart.h @@ -1,339 +1,339 @@ -/************************************************************************************ - * arch/arm/src/lpc17xx/lpc17_uart.h - * - * Copyright (C) 2010, 2012 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt - * - * 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. - * - ************************************************************************************/ - -#ifndef __ARCH_ARM_SRC_LPC17XX_LPC17_UART_H -#define __ARCH_ARM_SRC_LPC17XX_LPC17_UART_H - -/************************************************************************************ - * Included Files - ************************************************************************************/ - -#include - -#include "chip.h" -#include "lpc17_memorymap.h" - -/************************************************************************************ - * Pre-processor Definitions - ************************************************************************************/ - -/* Register offsets *****************************************************************/ - -#define LPC17_UART_RBR_OFFSET 0x0000 /* (DLAB =0) Receiver Buffer Register (all) */ -#define LPC17_UART_THR_OFFSET 0x0000 /* (DLAB =0) Transmit Holding Register (all) */ -#define LPC17_UART_DLL_OFFSET 0x0000 /* (DLAB =1) Divisor Latch LSB (all) */ -#define LPC17_UART_DLM_OFFSET 0x0004 /* (DLAB =1) Divisor Latch MSB (all) */ -#define LPC17_UART_IER_OFFSET 0x0004 /* (DLAB =0) Interrupt Enable Register (all) */ -#define LPC17_UART_IIR_OFFSET 0x0008 /* Interrupt ID Register (all) */ -#define LPC17_UART_FCR_OFFSET 0x0008 /* FIFO Control Register (all) */ -#define LPC17_UART_LCR_OFFSET 0x000c /* Line Control Register (all) */ -#define LPC17_UART_MCR_OFFSET 0x0010 /* Modem Control Register (UART1 only) */ -#define LPC17_UART_LSR_OFFSET 0x0014 /* Line Status Register (all) */ -#define LPC17_UART_MSR_OFFSET 0x0018 /* Modem Status Register (UART1 only) */ -#define LPC17_UART_SCR_OFFSET 0x001c /* Scratch Pad Register (all) */ -#define LPC17_UART_ACR_OFFSET 0x0020 /* Auto-baud Control Register (all) */ -#define LPC17_UART_ICR_OFFSET 0x0024 /* IrDA Control Register (UART0,2,3 only) */ -#define LPC17_UART_FDR_OFFSET 0x0028 /* Fractional Divider Register (all) */ -#define LPC17_UART_TER_OFFSET 0x0030 /* Transmit Enable Register (all) */ -#define LPC17_UART_RS485CTRL_OFFSET 0x004c /* RS-485/EIA-485 Control (UART1 only) */ -#define LPC17_UART_ADRMATCH_OFFSET 0x0050 /* RS-485/EIA-485 address match (UART1 only) */ -#define LPC17_UART_RS485DLY_OFFSET 0x0054 /* RS-485/EIA-485 direction control delay (UART1 only) */ -#define LPC17_UART_FIFOLVL_OFFSET 0x0058 /* FIFO Level register (all) */ - -/* Register addresses ***************************************************************/ - -#define LPC17_UART0_RBR (LPC17_UART0_BASE+LPC17_UART_RBR_OFFSET) -#define LPC17_UART0_THR (LPC17_UART0_BASE+LPC17_UART_THR_OFFSET) -#define LPC17_UART0_DLL (LPC17_UART0_BASE+LPC17_UART_DLL_OFFSET) -#define LPC17_UART0_DLM (LPC17_UART0_BASE+LPC17_UART_DLM_OFFSET) -#define LPC17_UART0_IER (LPC17_UART0_BASE+LPC17_UART_IER_OFFSET) -#define LPC17_UART0_IIR (LPC17_UART0_BASE+LPC17_UART_IIR_OFFSET) -#define LPC17_UART0_FCR (LPC17_UART0_BASE+LPC17_UART_FCR_OFFSET) -#define LPC17_UART0_LCR (LPC17_UART0_BASE+LPC17_UART_LCR_OFFSET) -#define LPC17_UART0_LSR (LPC17_UART0_BASE+LPC17_UART_LSR_OFFSET) -#define LPC17_UART0_SCR (LPC17_UART0_BASE+LPC17_UART_SCR_OFFSET) -#define LPC17_UART0_ACR (LPC17_UART0_BASE+LPC17_UART_ACR_OFFSET) -#define LPC17_UART0_ICR (LPC17_UART0_BASE+LPC17_UART_ICR_OFFSET) -#define LPC17_UART0_FDR (LPC17_UART0_BASE+LPC17_UART_FDR_OFFSET) -#define LPC17_UART0_TER (LPC17_UART0_BASE+LPC17_UART_TER_OFFSET) -#define LPC17_UART0_FIFOLVL (LPC17_UART0_BASE+LPC17_UART_FIFOLVL_OFFSET) - -#define LPC17_UART1_RBR (LPC17_UART1_BASE+LPC17_UART_RBR_OFFSET) -#define LPC17_UART1_THR (LPC17_UART1_BASE+LPC17_UART_THR_OFFSET) -#define LPC17_UART1_DLL (LPC17_UART1_BASE+LPC17_UART_DLL_OFFSET) -#define LPC17_UART1_DLM (LPC17_UART1_BASE+LPC17_UART_DLM_OFFSET) -#define LPC17_UART1_IER (LPC17_UART1_BASE+LPC17_UART_IER_OFFSET) -#define LPC17_UART1_IIR (LPC17_UART1_BASE+LPC17_UART_IIR_OFFSET) -#define LPC17_UART1_FCR (LPC17_UART1_BASE+LPC17_UART_FCR_OFFSET) -#define LPC17_UART1_LCR (LPC17_UART1_BASE+LPC17_UART_LCR_OFFSET) -#define LPC17_UART1_MCR (LPC17_UART1_BASE+LPC17_UART_MCR_OFFSET) -#define LPC17_UART1_LSR (LPC17_UART1_BASE+LPC17_UART_LSR_OFFSET) -#define LPC17_UART1_MSR (LPC17_UART1_BASE+LPC17_UART_MSR_OFFSET) -#define LPC17_UART1_SCR (LPC17_UART1_BASE+LPC17_UART_SCR_OFFSET) -#define LPC17_UART1_ACR (LPC17_UART1_BASE+LPC17_UART_ACR_OFFSET) -#define LPC17_UART1_FDR (LPC17_UART1_BASE+LPC17_UART_FDR_OFFSET) -#define LPC17_UART1_TER (LPC17_UART1_BASE+LPC17_UART_TER_OFFSET) -#define LPC17_UART1_RS485CTRL (LPC17_UART1_BASE+LPC17_UART_RS485CTRL_OFFSET) -#define LPC17_UART1_ADRMATCH (LPC17_UART1_BASE+LPC17_UART_ADRMATCH_OFFSET) -#define LPC17_UART1_RS485DLY (LPC17_UART1_BASE+LPC17_UART_RS485DLY_OFFSET) -#define LPC17_UART1_FIFOLVL (LPC17_UART1_BASE+LPC17_UART_FIFOLVL_OFFSET) - -#define LPC17_UART2_RBR (LPC17_UART2_BASE+LPC17_UART_RBR_OFFSET) -#define LPC17_UART2_THR (LPC17_UART2_BASE+LPC17_UART_THR_OFFSET) -#define LPC17_UART2_DLL (LPC17_UART2_BASE+LPC17_UART_DLL_OFFSET) -#define LPC17_UART2_DLM (LPC17_UART2_BASE+LPC17_UART_DLM_OFFSET) -#define LPC17_UART2_IER (LPC17_UART2_BASE+LPC17_UART_IER_OFFSET) -#define LPC17_UART2_IIR (LPC17_UART2_BASE+LPC17_UART_IIR_OFFSET) -#define LPC17_UART2_FCR (LPC17_UART2_BASE+LPC17_UART_FCR_OFFSET) -#define LPC17_UART2_LCR (LPC17_UART2_BASE+LPC17_UART_LCR_OFFSET) -#define LPC17_UART2_LSR (LPC17_UART2_BASE+LPC17_UART_LSR_OFFSET) -#define LPC17_UART2_SCR (LPC17_UART2_BASE+LPC17_UART_SCR_OFFSET) -#define LPC17_UART2_ACR (LPC17_UART2_BASE+LPC17_UART_ACR_OFFSET) -#define LPC17_UART2_ICR (LPC17_UART2_BASE+LPC17_UART_ICR_OFFSET) -#define LPC17_UART2_FDR (LPC17_UART2_BASE+LPC17_UART_FDR_OFFSET) -#define LPC17_UART2_TER (LPC17_UART2_BASE+LPC17_UART_TER_OFFSET) -#define LPC17_UART2_FIFOLVL (LPC17_UART2_BASE+LPC17_UART_FIFOLVL_OFFSET) - -#define LPC17_UART3_RBR (LPC17_UART3_BASE+LPC17_UART_RBR_OFFSET) -#define LPC17_UART3_THR (LPC17_UART3_BASE+LPC17_UART_THR_OFFSET) -#define LPC17_UART3_DLL (LPC17_UART3_BASE+LPC17_UART_DLL_OFFSET) -#define LPC17_UART3_DLM (LPC17_UART3_BASE+LPC17_UART_DLM_OFFSET) -#define LPC17_UART3_IER (LPC17_UART3_BASE+LPC17_UART_IER_OFFSET) -#define LPC17_UART3_IIR (LPC17_UART3_BASE+LPC17_UART_IIR_OFFSET) -#define LPC17_UART3_FCR (LPC17_UART3_BASE+LPC17_UART_FCR_OFFSET) -#define LPC17_UART3_LCR (LPC17_UART3_BASE+LPC17_UART_LCR_OFFSET) -#define LPC17_UART3_LSR (LPC17_UART3_BASE+LPC17_UART_LSR_OFFSET) -#define LPC17_UART3_SCR (LPC17_UART3_BASE+LPC17_UART_SCR_OFFSET) -#define LPC17_UART3_ACR (LPC17_UART3_BASE+LPC17_UART_ACR_OFFSET) -#define LPC17_UART3_ICR (LPC17_UART3_BASE+LPC17_UART_ICR_OFFSET) -#define LPC17_UART3_FDR (LPC17_UART3_BASE+LPC17_UART_FDR_OFFSET) -#define LPC17_UART3_TER (LPC17_UART3_BASE+LPC17_UART_TER_OFFSET) -#define LPC17_UART3_FIFOLVL (LPC17_UART3_BASE+LPC17_UART_FIFOLVL_OFFSET) - -/* Register bit definitions *********************************************************/ - -/* RBR (DLAB =0) Receiver Buffer Register (all) */ - -#define UART_RBR_MASK (0xff) /* Bits 0-7: Oldest received byte in RX FIFO */ - /* Bits 8-31: Reserved */ - -/* THR (DLAB =0) Transmit Holding Register (all) */ - -#define UART_THR_MASK (0xff) /* Bits 0-7: Adds byte to TX FIFO */ - /* Bits 8-31: Reserved */ - -/* DLL (DLAB =1) Divisor Latch LSB (all) */ - -#define UART_DLL_MASK (0xff) /* Bits 0-7: DLL */ - /* Bits 8-31: Reserved */ - -/* DLM (DLAB =1) Divisor Latch MSB (all) */ - -#define UART_DLM_MASK (0xff) /* Bits 0-7: DLM */ - /* Bits 8-31: Reserved */ - -/* IER (DLAB =0) Interrupt Enable Register (all) */ - -#define UART_IER_RBRIE (1 << 0) /* Bit 0: RBR Interrupt Enable */ -#define UART_IER_THREIE (1 << 1) /* Bit 1: THRE Interrupt Enable */ -#define UART_IER_RLSIE (1 << 2) /* Bit 2: RX Line Status Interrupt Enable */ -#define UART_IER_MSIE (1 << 3) /* Bit 3: Modem Status Interrupt Enable (UART1 only) */ - /* Bits 4-6: Reserved */ -#define UART_IER_CTSIE (1 << 7) /* Bit 7: CTS transition interrupt (UART1 only) */ -#define UART_IER_ABEOIE (1 << 8) /* Bit 8: Enables the end of auto-baud interrupt */ -#define UART_IER_ABTOIE (1 << 9) /* Bit 9: Enables the auto-baud time-out interrupt */ - /* Bits 10-31: Reserved */ -#define UART_IER_ALLIE (0x038f) - -/* IIR Interrupt ID Register (all) */ - -#define UART_IIR_INTSTATUS (1 << 0) /* Bit 0: Interrupt status (active low) */ -#define UART_IIR_INTID_SHIFT (1) /* Bits 1-3: Interrupt identification */ -#define UART_IIR_INTID_MASK (7 << UART_IIR_INTID_SHIFT) -# define UART_IIR_INTID_MSI (0 << UART_IIR_INTID_SHIFT) /* Modem Status (UART1 only) */ -# define UART_IIR_INTID_THRE (1 << UART_IIR_INTID_SHIFT) /* THRE Interrupt */ -# define UART_IIR_INTID_RDA (2 << UART_IIR_INTID_SHIFT) /* 2a - Receive Data Available (RDA) */ -# define UART_IIR_INTID_RLS (3 << UART_IIR_INTID_SHIFT) /* 1 - Receive Line Status (RLS) */ -# define UART_IIR_INTID_CTI (6 << UART_IIR_INTID_SHIFT) /* 2b - Character Time-out Indicator (CTI) */ - /* Bits 4-5: Reserved */ -#define UART_IIR_FIFOEN_SHIFT (6) /* Bits 6-7: Copies of FCR bit 0 */ -#define UART_IIR_FIFOEN_MASK (3 << UART_IIR_FIFOEN_SHIFT) -#define UART_IIR_ABEOINT (1 << 8) /* Bit 8: End of auto-baud interrupt */ -#define UART_IIR_ABTOINT (1 << 9) /* Bit 9: Auto-baud time-out interrupt */ - /* Bits 10-31: Reserved */ -/* FCR FIFO Control Register (all) */ - -#define UART_FCR_FIFOEN (1 << 0) /* Bit 0: Enable FIFOs */ -#define UART_FCR_RXRST (1 << 1) /* Bit 1: RX FIFO Reset */ -#define UART_FCR_TXRST (1 << 2) /* Bit 2: TX FIFO Reset */ -#define UART_FCR_DMAMODE (1 << 3) /* Bit 3: DMA Mode Select */ - /* Bits 4-5: Reserved */ -#define UART_FCR_RXTRIGGER_SHIFT (6) /* Bits 6-7: RX Trigger Level */ -#define UART_FCR_RXTRIGGER_MASK (3 << UART_FCR_RXTRIGGER_SHIFT) -# define UART_FCR_RXTRIGGER_0 (0 << UART_FCR_RXTRIGGER_SHIFT) /* Trigger level 0 (1 character) */ -# define UART_FCR_RXTRIGGER_4 (1 << UART_FCR_RXTRIGGER_SHIFT) /* Trigger level 1 (4 characters) */ -# define UART_FCR_RXTRIGGER_8 (2 << UART_FCR_RXTRIGGER_SHIFT) /* Trigger level 2 (8 characters) */ -# define UART_FCR_RXTRIGGER_14 (3 << UART_FCR_RXTRIGGER_SHIFT) /* Trigger level 3 (14 characters) */ - /* Bits 8-31: Reserved */ -/* LCR Line Control Register (all) */ - -#define UART_LCR_WLS_SHIFT (0) /* Bit 0-1: Word Length Select */ -#define UART_LCR_WLS_MASK (3 << UART_LCR_WLS_SHIFT) -# define UART_LCR_WLS_5BIT (0 << UART_LCR_WLS_SHIFT) -# define UART_LCR_WLS_6BIT (1 << UART_LCR_WLS_SHIFT) -# define UART_LCR_WLS_7BIT (2 << UART_LCR_WLS_SHIFT) -# define UART_LCR_WLS_8BIT (3 << UART_LCR_WLS_SHIFT) -#define UART_LCR_STOP (1 << 2) /* Bit 2: Stop Bit Select */ -#define UART_LCR_PE (1 << 3) /* Bit 3: Parity Enable */ -#define UART_LCR_PS_SHIFT (4) /* Bits 4-5: Parity Select */ -#define UART_LCR_PS_MASK (3 << UART_LCR_PS_SHIFT) -# define UART_LCR_PS_ODD (0 << UART_LCR_PS_SHIFT) /* Odd parity */ -# define UART_LCR_PS_EVEN (1 << UART_LCR_PS_SHIFT) /* Even Parity */ -# define UART_LCR_PS_STICK1 (2 << UART_LCR_PS_SHIFT) /* Forced "1" stick parity */ -# define UART_LCR_PS_STICK0 (3 << UART_LCR_PS_SHIFT) /* Forced "0" stick parity */ -#define UART_LCR_BRK (1 << 6) /* Bit 6: Break Control */ -#define UART_LCR_DLAB (1 << 7) /* Bit 7: Divisor Latch Access Bit (DLAB) */ - /* Bits 8-31: Reserved */ -/* MCR Modem Control Register (UART1 only) */ - -#define UART_MCR_DTR (1 << 0) /* Bit 0: DTR Control Source for DTR output */ -#define UART_MCR_RTS (1 << 1) /* Bit 1: Control Source for RTS output */ - /* Bits 2-3: Reserved */ -#define UART_MCR_LPBK (1 << 4) /* Bit 4: Loopback Mode Select */ - /* Bit 5: Reserved */ -#define UART_MCR_RTSEN (1 << 6) /* Bit 6: Enable auto-rts flow control */ -#define UART_MCR_CTSEN (1 << 7) /* Bit 7: Enable auto-cts flow control */ - /* Bits 8-31: Reserved */ -/* LSR Line Status Register (all) */ - -#define UART_LSR_RDR (1 << 0) /* Bit 0: Receiver Data Ready */ -#define UART_LSR_OE (1 << 1) /* Bit 1: Overrun Error */ -#define UART_LSR_PE (1 << 2) /* Bit 2: Parity Error */ -#define UART_LSR_FE (1 << 3) /* Bit 3: Framing Error */ -#define UART_LSR_BI (1 << 4) /* Bit 4: Break Interrupt */ -#define UART_LSR_THRE (1 << 5) /* Bit 5: Transmitter Holding Register Empty */ -#define UART_LSR_TEMT (1 << 6) /* Bit 6: Transmitter Empty */ -#define UART_LSR_RXFE (1 << 7) /* Bit 7: Error in RX FIFO (RXFE) */ - /* Bits 8-31: Reserved */ -/* MSR Modem Status Register (UART1 only) */ - -#define UART_MSR_DELTACTS (1 << 0) /* Bit 0: CTS state change */ -#define UART_MSR_DELTADSR (1 << 1) /* Bit 1: DSR state change */ -#define UART_MSR_RIEDGE (1 << 2) /* Bit 2: RI ow to high transition */ -#define UART_MSR_DELTADCD (1 << 3) /* Bit 3: DCD state change */ -#define UART_MSR_CTS (1 << 4) /* Bit 4: CTS State */ -#define UART_MSR_DSR (1 << 5) /* Bit 5: DSR State */ -#define UART_MSR_RI (1 << 6) /* Bit 6: Ring Indicator State */ -#define UART_MSR_DCD (1 << 7) /* Bit 7: Data Carrier Detect State */ - /* Bits 8-31: Reserved */ -/* SCR Scratch Pad Register (all) */ - -#define UART_SCR_MASK (0xff) /* Bits 0-7: SCR data */ - /* Bits 8-31: Reserved */ -/* ACR Auto-baud Control Register (all) */ - -#define UART_ACR_START (1 << 0) /* Bit 0: Auto-baud start/running*/ -#define UART_ACR_MODE (1 << 1) /* Bit 1: Auto-baud mode select*/ -#define UART_ACR_AUTORESTART (1 << 2) /* Bit 2: Restart in case of time-out*/ - /* Bits 3-7: Reserved */ -#define UART_ACR_ABEOINTCLR (1 << 8) /* Bit 8: End of auto-baud interrupt clear */ -#define UART_ACR_ABTOINTCLRT (1 << 9) /* Bit 9: Auto-baud time-out interrupt clear */ - /* Bits 10-31: Reserved */ -/* ICA IrDA Control Register (UART0,2,3 only) */ - -#define UART_ICR_IRDAEN (1 << 0) /* Bit 0: Enable IrDA mode */ -#define UART_ICR_IRDAINV (1 << 1) /* Bit 1: Invert serial input */ -#define UART_ICR_FIXPULSEEN (1 << 2) /* Bit 2: Enable IrDA fixed pulse width mode */ -#define UART_ICR_PULSEDIV_SHIFT (3) /* Bits 3-5: Configures the pulse when FixPulseEn = 1 */ -#define UART_ICR_PULSEDIV_MASK (7 << UART_ICR_PULSEDIV_SHIFT) -# define UART_ICR_PULSEDIV_2TPCLK (0 << UART_ICR_PULSEDIV_SHIFT) /* 2 x TPCLK */ -# define UART_ICR_PULSEDIV_4TPCLK (1 << UART_ICR_PULSEDIV_SHIFT) /* 4 x TPCLK */ -# define UART_ICR_PULSEDIV_8TPCLK (2 << UART_ICR_PULSEDIV_SHIFT) /* 8 x TPCLK */ -# define UART_ICR_PULSEDIV_16TPCLK (3 << UART_ICR_PULSEDIV_SHIFT) /* 16 x TPCLK */ -# define UART_ICR_PULSEDIV_32TPCLK (4 << UART_ICR_PULSEDIV_SHIFT) /* 32 x TPCLK */ -# define UART_ICR_PULSEDIV_64TPCLK (5 << UART_ICR_PULSEDIV_SHIFT) /* 64 x TPCLK */ -# define UART_ICR_PULSEDIV_128TPCLK (6 << UART_ICR_PULSEDIV_SHIFT) /* 128 x TPCLK */ -# define UART_ICR_PULSEDIV_256TPCLK (7 << UART_ICR_PULSEDIV_SHIFT) /* 246 x TPCLK */ - /* Bits 6-31: Reserved */ -/* FDR Fractional Divider Register (all) */ - -#define UART_FDR_DIVADDVAL_SHIFT (0) /* Bits 0-3: Baud-rate generation pre-scaler divisor value */ -#define UART_FDR_DIVADDVAL_MASK (15 << UART_FDR_DIVADDVAL_SHIFT) -#define UART_FDR_MULVAL_SHIFT (3) /* Bits 4-7 Baud-rate pre-scaler multiplier value */ -#define UART_FDR_MULVAL_MASK (15 << UART_FDR_MULVAL_SHIFT) - /* Bits 8-31: Reserved */ -/* TER Transmit Enable Register (all) */ - /* Bits 0-6: Reserved */ -#define UART_TER_TXEN (1 << 7) /* Bit 7: TX Enable */ - /* Bits 8-31: Reserved */ -/* RS-485/EIA-485 Control (UART1 only) */ - -#define UART_RS485CTRL_NMMEN (1 << 0) /* Bit 0: RS-485/EIA-485 Normal Multidrop Mode (NMM) enabled */ -#define UART_RS485CTRL_RXDIS (1 << 1) /* Bit 1: Receiver is disabled */ -#define UART_RS485CTRL_AADEN (1 << 2) /* Bit 2: Auto Address Detect (AAD) is enabled */ -#define UART_RS485CTRL_SEL (1 << 3) /* Bit 3: RTS/DTR used for direction control (DCTRL=1) */ -#define UART_RS485CTRL_DCTRL (1 << 4) /* Bit 4: Enable Auto Direction Control */ -#define UART_RS485CTRL_OINV (1 << 5) /* Bit 5: Polarity of the direction control signal on RTS/DTR */ - /* Bits 6-31: Reserved */ -/* RS-485/EIA-485 address match (UART1 only) */ - -#define UART_ADRMATCH_MASK (0xff) /* Bits 0-7: Address match value */ - /* Bits 8-31: Reserved */ -/* RS-485/EIA-485 direction control delay (UART1 only) */ - -#define UART_RS485DLY_MASK (0xff) /* Bits 0-7: Direction control (RTS/DTR) delay */ - /* Bits 8-31: Reserved */ -/* FIFOLVL FIFO Level register (all) */ - -#define UART_FIFOLVL_RX_SHIFT (0) /* Bits 0-3: Current level of the UART RX FIFO */ -#define UART_FIFOLVL_RX_MASK (15 << UART_FIFOLVL_RX_SHIFT) - /* Bits 4-7: Reserved */ -#define UART_FIFOLVL_TX_SHIFT (8) /* Bits 8-11: Current level of the UART TX FIFO */ -#define UART_FIFOLVL_TX_MASK (15 << UART_FIFOLVL_TX_SHIFT) - /* Bits 12-31: Reserved */ - -/************************************************************************************ - * Public Types - ************************************************************************************/ - -/************************************************************************************ - * Public Data - ************************************************************************************/ - -/************************************************************************************ - * Public Functions - ************************************************************************************/ - -#endif /* __ARCH_ARM_SRC_LPC17XX_LPC17_UART_H */ +/************************************************************************************ + * arch/arm/src/lpc17xx/chip/lpc17_uart.h + * + * Copyright (C) 2010, 2012-2013 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * 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. + * + ************************************************************************************/ + +#ifndef __ARCH_ARM_SRC_LPC17XX_CHIP_LPC17_UART_H +#define __ARCH_ARM_SRC_LPC17XX_CHIP_LPC17_UART_H + +/************************************************************************************ + * Included Files + ************************************************************************************/ + +#include + +#include "chip.h" +#include "chip/lpc17_memorymap.h" + +/************************************************************************************ + * Pre-processor Definitions + ************************************************************************************/ + +/* Register offsets *****************************************************************/ + +#define LPC17_UART_RBR_OFFSET 0x0000 /* (DLAB =0) Receiver Buffer Register (all) */ +#define LPC17_UART_THR_OFFSET 0x0000 /* (DLAB =0) Transmit Holding Register (all) */ +#define LPC17_UART_DLL_OFFSET 0x0000 /* (DLAB =1) Divisor Latch LSB (all) */ +#define LPC17_UART_DLM_OFFSET 0x0004 /* (DLAB =1) Divisor Latch MSB (all) */ +#define LPC17_UART_IER_OFFSET 0x0004 /* (DLAB =0) Interrupt Enable Register (all) */ +#define LPC17_UART_IIR_OFFSET 0x0008 /* Interrupt ID Register (all) */ +#define LPC17_UART_FCR_OFFSET 0x0008 /* FIFO Control Register (all) */ +#define LPC17_UART_LCR_OFFSET 0x000c /* Line Control Register (all) */ +#define LPC17_UART_MCR_OFFSET 0x0010 /* Modem Control Register (UART1 only) */ +#define LPC17_UART_LSR_OFFSET 0x0014 /* Line Status Register (all) */ +#define LPC17_UART_MSR_OFFSET 0x0018 /* Modem Status Register (UART1 only) */ +#define LPC17_UART_SCR_OFFSET 0x001c /* Scratch Pad Register (all) */ +#define LPC17_UART_ACR_OFFSET 0x0020 /* Auto-baud Control Register (all) */ +#define LPC17_UART_ICR_OFFSET 0x0024 /* IrDA Control Register (UART0,2,3 only) */ +#define LPC17_UART_FDR_OFFSET 0x0028 /* Fractional Divider Register (all) */ +#define LPC17_UART_TER_OFFSET 0x0030 /* Transmit Enable Register (all) */ +#define LPC17_UART_RS485CTRL_OFFSET 0x004c /* RS-485/EIA-485 Control (UART1 only) */ +#define LPC17_UART_ADRMATCH_OFFSET 0x0050 /* RS-485/EIA-485 address match (UART1 only) */ +#define LPC17_UART_RS485DLY_OFFSET 0x0054 /* RS-485/EIA-485 direction control delay (UART1 only) */ +#define LPC17_UART_FIFOLVL_OFFSET 0x0058 /* FIFO Level register (all) */ + +/* Register addresses ***************************************************************/ + +#define LPC17_UART0_RBR (LPC17_UART0_BASE+LPC17_UART_RBR_OFFSET) +#define LPC17_UART0_THR (LPC17_UART0_BASE+LPC17_UART_THR_OFFSET) +#define LPC17_UART0_DLL (LPC17_UART0_BASE+LPC17_UART_DLL_OFFSET) +#define LPC17_UART0_DLM (LPC17_UART0_BASE+LPC17_UART_DLM_OFFSET) +#define LPC17_UART0_IER (LPC17_UART0_BASE+LPC17_UART_IER_OFFSET) +#define LPC17_UART0_IIR (LPC17_UART0_BASE+LPC17_UART_IIR_OFFSET) +#define LPC17_UART0_FCR (LPC17_UART0_BASE+LPC17_UART_FCR_OFFSET) +#define LPC17_UART0_LCR (LPC17_UART0_BASE+LPC17_UART_LCR_OFFSET) +#define LPC17_UART0_LSR (LPC17_UART0_BASE+LPC17_UART_LSR_OFFSET) +#define LPC17_UART0_SCR (LPC17_UART0_BASE+LPC17_UART_SCR_OFFSET) +#define LPC17_UART0_ACR (LPC17_UART0_BASE+LPC17_UART_ACR_OFFSET) +#define LPC17_UART0_ICR (LPC17_UART0_BASE+LPC17_UART_ICR_OFFSET) +#define LPC17_UART0_FDR (LPC17_UART0_BASE+LPC17_UART_FDR_OFFSET) +#define LPC17_UART0_TER (LPC17_UART0_BASE+LPC17_UART_TER_OFFSET) +#define LPC17_UART0_FIFOLVL (LPC17_UART0_BASE+LPC17_UART_FIFOLVL_OFFSET) + +#define LPC17_UART1_RBR (LPC17_UART1_BASE+LPC17_UART_RBR_OFFSET) +#define LPC17_UART1_THR (LPC17_UART1_BASE+LPC17_UART_THR_OFFSET) +#define LPC17_UART1_DLL (LPC17_UART1_BASE+LPC17_UART_DLL_OFFSET) +#define LPC17_UART1_DLM (LPC17_UART1_BASE+LPC17_UART_DLM_OFFSET) +#define LPC17_UART1_IER (LPC17_UART1_BASE+LPC17_UART_IER_OFFSET) +#define LPC17_UART1_IIR (LPC17_UART1_BASE+LPC17_UART_IIR_OFFSET) +#define LPC17_UART1_FCR (LPC17_UART1_BASE+LPC17_UART_FCR_OFFSET) +#define LPC17_UART1_LCR (LPC17_UART1_BASE+LPC17_UART_LCR_OFFSET) +#define LPC17_UART1_MCR (LPC17_UART1_BASE+LPC17_UART_MCR_OFFSET) +#define LPC17_UART1_LSR (LPC17_UART1_BASE+LPC17_UART_LSR_OFFSET) +#define LPC17_UART1_MSR (LPC17_UART1_BASE+LPC17_UART_MSR_OFFSET) +#define LPC17_UART1_SCR (LPC17_UART1_BASE+LPC17_UART_SCR_OFFSET) +#define LPC17_UART1_ACR (LPC17_UART1_BASE+LPC17_UART_ACR_OFFSET) +#define LPC17_UART1_FDR (LPC17_UART1_BASE+LPC17_UART_FDR_OFFSET) +#define LPC17_UART1_TER (LPC17_UART1_BASE+LPC17_UART_TER_OFFSET) +#define LPC17_UART1_RS485CTRL (LPC17_UART1_BASE+LPC17_UART_RS485CTRL_OFFSET) +#define LPC17_UART1_ADRMATCH (LPC17_UART1_BASE+LPC17_UART_ADRMATCH_OFFSET) +#define LPC17_UART1_RS485DLY (LPC17_UART1_BASE+LPC17_UART_RS485DLY_OFFSET) +#define LPC17_UART1_FIFOLVL (LPC17_UART1_BASE+LPC17_UART_FIFOLVL_OFFSET) + +#define LPC17_UART2_RBR (LPC17_UART2_BASE+LPC17_UART_RBR_OFFSET) +#define LPC17_UART2_THR (LPC17_UART2_BASE+LPC17_UART_THR_OFFSET) +#define LPC17_UART2_DLL (LPC17_UART2_BASE+LPC17_UART_DLL_OFFSET) +#define LPC17_UART2_DLM (LPC17_UART2_BASE+LPC17_UART_DLM_OFFSET) +#define LPC17_UART2_IER (LPC17_UART2_BASE+LPC17_UART_IER_OFFSET) +#define LPC17_UART2_IIR (LPC17_UART2_BASE+LPC17_UART_IIR_OFFSET) +#define LPC17_UART2_FCR (LPC17_UART2_BASE+LPC17_UART_FCR_OFFSET) +#define LPC17_UART2_LCR (LPC17_UART2_BASE+LPC17_UART_LCR_OFFSET) +#define LPC17_UART2_LSR (LPC17_UART2_BASE+LPC17_UART_LSR_OFFSET) +#define LPC17_UART2_SCR (LPC17_UART2_BASE+LPC17_UART_SCR_OFFSET) +#define LPC17_UART2_ACR (LPC17_UART2_BASE+LPC17_UART_ACR_OFFSET) +#define LPC17_UART2_ICR (LPC17_UART2_BASE+LPC17_UART_ICR_OFFSET) +#define LPC17_UART2_FDR (LPC17_UART2_BASE+LPC17_UART_FDR_OFFSET) +#define LPC17_UART2_TER (LPC17_UART2_BASE+LPC17_UART_TER_OFFSET) +#define LPC17_UART2_FIFOLVL (LPC17_UART2_BASE+LPC17_UART_FIFOLVL_OFFSET) + +#define LPC17_UART3_RBR (LPC17_UART3_BASE+LPC17_UART_RBR_OFFSET) +#define LPC17_UART3_THR (LPC17_UART3_BASE+LPC17_UART_THR_OFFSET) +#define LPC17_UART3_DLL (LPC17_UART3_BASE+LPC17_UART_DLL_OFFSET) +#define LPC17_UART3_DLM (LPC17_UART3_BASE+LPC17_UART_DLM_OFFSET) +#define LPC17_UART3_IER (LPC17_UART3_BASE+LPC17_UART_IER_OFFSET) +#define LPC17_UART3_IIR (LPC17_UART3_BASE+LPC17_UART_IIR_OFFSET) +#define LPC17_UART3_FCR (LPC17_UART3_BASE+LPC17_UART_FCR_OFFSET) +#define LPC17_UART3_LCR (LPC17_UART3_BASE+LPC17_UART_LCR_OFFSET) +#define LPC17_UART3_LSR (LPC17_UART3_BASE+LPC17_UART_LSR_OFFSET) +#define LPC17_UART3_SCR (LPC17_UART3_BASE+LPC17_UART_SCR_OFFSET) +#define LPC17_UART3_ACR (LPC17_UART3_BASE+LPC17_UART_ACR_OFFSET) +#define LPC17_UART3_ICR (LPC17_UART3_BASE+LPC17_UART_ICR_OFFSET) +#define LPC17_UART3_FDR (LPC17_UART3_BASE+LPC17_UART_FDR_OFFSET) +#define LPC17_UART3_TER (LPC17_UART3_BASE+LPC17_UART_TER_OFFSET) +#define LPC17_UART3_FIFOLVL (LPC17_UART3_BASE+LPC17_UART_FIFOLVL_OFFSET) + +/* Register bit definitions *********************************************************/ + +/* RBR (DLAB =0) Receiver Buffer Register (all) */ + +#define UART_RBR_MASK (0xff) /* Bits 0-7: Oldest received byte in RX FIFO */ + /* Bits 8-31: Reserved */ + +/* THR (DLAB =0) Transmit Holding Register (all) */ + +#define UART_THR_MASK (0xff) /* Bits 0-7: Adds byte to TX FIFO */ + /* Bits 8-31: Reserved */ + +/* DLL (DLAB =1) Divisor Latch LSB (all) */ + +#define UART_DLL_MASK (0xff) /* Bits 0-7: DLL */ + /* Bits 8-31: Reserved */ + +/* DLM (DLAB =1) Divisor Latch MSB (all) */ + +#define UART_DLM_MASK (0xff) /* Bits 0-7: DLM */ + /* Bits 8-31: Reserved */ + +/* IER (DLAB =0) Interrupt Enable Register (all) */ + +#define UART_IER_RBRIE (1 << 0) /* Bit 0: RBR Interrupt Enable */ +#define UART_IER_THREIE (1 << 1) /* Bit 1: THRE Interrupt Enable */ +#define UART_IER_RLSIE (1 << 2) /* Bit 2: RX Line Status Interrupt Enable */ +#define UART_IER_MSIE (1 << 3) /* Bit 3: Modem Status Interrupt Enable (UART1 only) */ + /* Bits 4-6: Reserved */ +#define UART_IER_CTSIE (1 << 7) /* Bit 7: CTS transition interrupt (UART1 only) */ +#define UART_IER_ABEOIE (1 << 8) /* Bit 8: Enables the end of auto-baud interrupt */ +#define UART_IER_ABTOIE (1 << 9) /* Bit 9: Enables the auto-baud time-out interrupt */ + /* Bits 10-31: Reserved */ +#define UART_IER_ALLIE (0x038f) + +/* IIR Interrupt ID Register (all) */ + +#define UART_IIR_INTSTATUS (1 << 0) /* Bit 0: Interrupt status (active low) */ +#define UART_IIR_INTID_SHIFT (1) /* Bits 1-3: Interrupt identification */ +#define UART_IIR_INTID_MASK (7 << UART_IIR_INTID_SHIFT) +# define UART_IIR_INTID_MSI (0 << UART_IIR_INTID_SHIFT) /* Modem Status (UART1 only) */ +# define UART_IIR_INTID_THRE (1 << UART_IIR_INTID_SHIFT) /* THRE Interrupt */ +# define UART_IIR_INTID_RDA (2 << UART_IIR_INTID_SHIFT) /* 2a - Receive Data Available (RDA) */ +# define UART_IIR_INTID_RLS (3 << UART_IIR_INTID_SHIFT) /* 1 - Receive Line Status (RLS) */ +# define UART_IIR_INTID_CTI (6 << UART_IIR_INTID_SHIFT) /* 2b - Character Time-out Indicator (CTI) */ + /* Bits 4-5: Reserved */ +#define UART_IIR_FIFOEN_SHIFT (6) /* Bits 6-7: Copies of FCR bit 0 */ +#define UART_IIR_FIFOEN_MASK (3 << UART_IIR_FIFOEN_SHIFT) +#define UART_IIR_ABEOINT (1 << 8) /* Bit 8: End of auto-baud interrupt */ +#define UART_IIR_ABTOINT (1 << 9) /* Bit 9: Auto-baud time-out interrupt */ + /* Bits 10-31: Reserved */ +/* FCR FIFO Control Register (all) */ + +#define UART_FCR_FIFOEN (1 << 0) /* Bit 0: Enable FIFOs */ +#define UART_FCR_RXRST (1 << 1) /* Bit 1: RX FIFO Reset */ +#define UART_FCR_TXRST (1 << 2) /* Bit 2: TX FIFO Reset */ +#define UART_FCR_DMAMODE (1 << 3) /* Bit 3: DMA Mode Select */ + /* Bits 4-5: Reserved */ +#define UART_FCR_RXTRIGGER_SHIFT (6) /* Bits 6-7: RX Trigger Level */ +#define UART_FCR_RXTRIGGER_MASK (3 << UART_FCR_RXTRIGGER_SHIFT) +# define UART_FCR_RXTRIGGER_0 (0 << UART_FCR_RXTRIGGER_SHIFT) /* Trigger level 0 (1 character) */ +# define UART_FCR_RXTRIGGER_4 (1 << UART_FCR_RXTRIGGER_SHIFT) /* Trigger level 1 (4 characters) */ +# define UART_FCR_RXTRIGGER_8 (2 << UART_FCR_RXTRIGGER_SHIFT) /* Trigger level 2 (8 characters) */ +# define UART_FCR_RXTRIGGER_14 (3 << UART_FCR_RXTRIGGER_SHIFT) /* Trigger level 3 (14 characters) */ + /* Bits 8-31: Reserved */ +/* LCR Line Control Register (all) */ + +#define UART_LCR_WLS_SHIFT (0) /* Bit 0-1: Word Length Select */ +#define UART_LCR_WLS_MASK (3 << UART_LCR_WLS_SHIFT) +# define UART_LCR_WLS_5BIT (0 << UART_LCR_WLS_SHIFT) +# define UART_LCR_WLS_6BIT (1 << UART_LCR_WLS_SHIFT) +# define UART_LCR_WLS_7BIT (2 << UART_LCR_WLS_SHIFT) +# define UART_LCR_WLS_8BIT (3 << UART_LCR_WLS_SHIFT) +#define UART_LCR_STOP (1 << 2) /* Bit 2: Stop Bit Select */ +#define UART_LCR_PE (1 << 3) /* Bit 3: Parity Enable */ +#define UART_LCR_PS_SHIFT (4) /* Bits 4-5: Parity Select */ +#define UART_LCR_PS_MASK (3 << UART_LCR_PS_SHIFT) +# define UART_LCR_PS_ODD (0 << UART_LCR_PS_SHIFT) /* Odd parity */ +# define UART_LCR_PS_EVEN (1 << UART_LCR_PS_SHIFT) /* Even Parity */ +# define UART_LCR_PS_STICK1 (2 << UART_LCR_PS_SHIFT) /* Forced "1" stick parity */ +# define UART_LCR_PS_STICK0 (3 << UART_LCR_PS_SHIFT) /* Forced "0" stick parity */ +#define UART_LCR_BRK (1 << 6) /* Bit 6: Break Control */ +#define UART_LCR_DLAB (1 << 7) /* Bit 7: Divisor Latch Access Bit (DLAB) */ + /* Bits 8-31: Reserved */ +/* MCR Modem Control Register (UART1 only) */ + +#define UART_MCR_DTR (1 << 0) /* Bit 0: DTR Control Source for DTR output */ +#define UART_MCR_RTS (1 << 1) /* Bit 1: Control Source for RTS output */ + /* Bits 2-3: Reserved */ +#define UART_MCR_LPBK (1 << 4) /* Bit 4: Loopback Mode Select */ + /* Bit 5: Reserved */ +#define UART_MCR_RTSEN (1 << 6) /* Bit 6: Enable auto-rts flow control */ +#define UART_MCR_CTSEN (1 << 7) /* Bit 7: Enable auto-cts flow control */ + /* Bits 8-31: Reserved */ +/* LSR Line Status Register (all) */ + +#define UART_LSR_RDR (1 << 0) /* Bit 0: Receiver Data Ready */ +#define UART_LSR_OE (1 << 1) /* Bit 1: Overrun Error */ +#define UART_LSR_PE (1 << 2) /* Bit 2: Parity Error */ +#define UART_LSR_FE (1 << 3) /* Bit 3: Framing Error */ +#define UART_LSR_BI (1 << 4) /* Bit 4: Break Interrupt */ +#define UART_LSR_THRE (1 << 5) /* Bit 5: Transmitter Holding Register Empty */ +#define UART_LSR_TEMT (1 << 6) /* Bit 6: Transmitter Empty */ +#define UART_LSR_RXFE (1 << 7) /* Bit 7: Error in RX FIFO (RXFE) */ + /* Bits 8-31: Reserved */ +/* MSR Modem Status Register (UART1 only) */ + +#define UART_MSR_DELTACTS (1 << 0) /* Bit 0: CTS state change */ +#define UART_MSR_DELTADSR (1 << 1) /* Bit 1: DSR state change */ +#define UART_MSR_RIEDGE (1 << 2) /* Bit 2: RI ow to high transition */ +#define UART_MSR_DELTADCD (1 << 3) /* Bit 3: DCD state change */ +#define UART_MSR_CTS (1 << 4) /* Bit 4: CTS State */ +#define UART_MSR_DSR (1 << 5) /* Bit 5: DSR State */ +#define UART_MSR_RI (1 << 6) /* Bit 6: Ring Indicator State */ +#define UART_MSR_DCD (1 << 7) /* Bit 7: Data Carrier Detect State */ + /* Bits 8-31: Reserved */ +/* SCR Scratch Pad Register (all) */ + +#define UART_SCR_MASK (0xff) /* Bits 0-7: SCR data */ + /* Bits 8-31: Reserved */ +/* ACR Auto-baud Control Register (all) */ + +#define UART_ACR_START (1 << 0) /* Bit 0: Auto-baud start/running*/ +#define UART_ACR_MODE (1 << 1) /* Bit 1: Auto-baud mode select*/ +#define UART_ACR_AUTORESTART (1 << 2) /* Bit 2: Restart in case of time-out*/ + /* Bits 3-7: Reserved */ +#define UART_ACR_ABEOINTCLR (1 << 8) /* Bit 8: End of auto-baud interrupt clear */ +#define UART_ACR_ABTOINTCLRT (1 << 9) /* Bit 9: Auto-baud time-out interrupt clear */ + /* Bits 10-31: Reserved */ +/* ICA IrDA Control Register (UART0,2,3 only) */ + +#define UART_ICR_IRDAEN (1 << 0) /* Bit 0: Enable IrDA mode */ +#define UART_ICR_IRDAINV (1 << 1) /* Bit 1: Invert serial input */ +#define UART_ICR_FIXPULSEEN (1 << 2) /* Bit 2: Enable IrDA fixed pulse width mode */ +#define UART_ICR_PULSEDIV_SHIFT (3) /* Bits 3-5: Configures the pulse when FixPulseEn = 1 */ +#define UART_ICR_PULSEDIV_MASK (7 << UART_ICR_PULSEDIV_SHIFT) +# define UART_ICR_PULSEDIV_2TPCLK (0 << UART_ICR_PULSEDIV_SHIFT) /* 2 x TPCLK */ +# define UART_ICR_PULSEDIV_4TPCLK (1 << UART_ICR_PULSEDIV_SHIFT) /* 4 x TPCLK */ +# define UART_ICR_PULSEDIV_8TPCLK (2 << UART_ICR_PULSEDIV_SHIFT) /* 8 x TPCLK */ +# define UART_ICR_PULSEDIV_16TPCLK (3 << UART_ICR_PULSEDIV_SHIFT) /* 16 x TPCLK */ +# define UART_ICR_PULSEDIV_32TPCLK (4 << UART_ICR_PULSEDIV_SHIFT) /* 32 x TPCLK */ +# define UART_ICR_PULSEDIV_64TPCLK (5 << UART_ICR_PULSEDIV_SHIFT) /* 64 x TPCLK */ +# define UART_ICR_PULSEDIV_128TPCLK (6 << UART_ICR_PULSEDIV_SHIFT) /* 128 x TPCLK */ +# define UART_ICR_PULSEDIV_256TPCLK (7 << UART_ICR_PULSEDIV_SHIFT) /* 246 x TPCLK */ + /* Bits 6-31: Reserved */ +/* FDR Fractional Divider Register (all) */ + +#define UART_FDR_DIVADDVAL_SHIFT (0) /* Bits 0-3: Baud-rate generation pre-scaler divisor value */ +#define UART_FDR_DIVADDVAL_MASK (15 << UART_FDR_DIVADDVAL_SHIFT) +#define UART_FDR_MULVAL_SHIFT (3) /* Bits 4-7 Baud-rate pre-scaler multiplier value */ +#define UART_FDR_MULVAL_MASK (15 << UART_FDR_MULVAL_SHIFT) + /* Bits 8-31: Reserved */ +/* TER Transmit Enable Register (all) */ + /* Bits 0-6: Reserved */ +#define UART_TER_TXEN (1 << 7) /* Bit 7: TX Enable */ + /* Bits 8-31: Reserved */ +/* RS-485/EIA-485 Control (UART1 only) */ + +#define UART_RS485CTRL_NMMEN (1 << 0) /* Bit 0: RS-485/EIA-485 Normal Multidrop Mode (NMM) enabled */ +#define UART_RS485CTRL_RXDIS (1 << 1) /* Bit 1: Receiver is disabled */ +#define UART_RS485CTRL_AADEN (1 << 2) /* Bit 2: Auto Address Detect (AAD) is enabled */ +#define UART_RS485CTRL_SEL (1 << 3) /* Bit 3: RTS/DTR used for direction control (DCTRL=1) */ +#define UART_RS485CTRL_DCTRL (1 << 4) /* Bit 4: Enable Auto Direction Control */ +#define UART_RS485CTRL_OINV (1 << 5) /* Bit 5: Polarity of the direction control signal on RTS/DTR */ + /* Bits 6-31: Reserved */ +/* RS-485/EIA-485 address match (UART1 only) */ + +#define UART_ADRMATCH_MASK (0xff) /* Bits 0-7: Address match value */ + /* Bits 8-31: Reserved */ +/* RS-485/EIA-485 direction control delay (UART1 only) */ + +#define UART_RS485DLY_MASK (0xff) /* Bits 0-7: Direction control (RTS/DTR) delay */ + /* Bits 8-31: Reserved */ +/* FIFOLVL FIFO Level register (all) */ + +#define UART_FIFOLVL_RX_SHIFT (0) /* Bits 0-3: Current level of the UART RX FIFO */ +#define UART_FIFOLVL_RX_MASK (15 << UART_FIFOLVL_RX_SHIFT) + /* Bits 4-7: Reserved */ +#define UART_FIFOLVL_TX_SHIFT (8) /* Bits 8-11: Current level of the UART TX FIFO */ +#define UART_FIFOLVL_TX_MASK (15 << UART_FIFOLVL_TX_SHIFT) + /* Bits 12-31: Reserved */ + +/************************************************************************************ + * Public Types + ************************************************************************************/ + +/************************************************************************************ + * Public Data + ************************************************************************************/ + +/************************************************************************************ + * Public Functions + ************************************************************************************/ + +#endif /* __ARCH_ARM_SRC_LPC17XX_CHIP_LPC17_UART_H */ diff --git a/nuttx/arch/arm/src/lpc17xx/lpc17_usb.h b/nuttx/arch/arm/src/lpc17xx/chip/lpc17_usb.h similarity index 99% rename from nuttx/arch/arm/src/lpc17xx/lpc17_usb.h rename to nuttx/arch/arm/src/lpc17xx/chip/lpc17_usb.h index 8fd5995846..d1e6dd0136 100644 --- a/nuttx/arch/arm/src/lpc17xx/lpc17_usb.h +++ b/nuttx/arch/arm/src/lpc17xx/chip/lpc17_usb.h @@ -1,7 +1,7 @@ /************************************************************************************ - * arch/arm/src/lpc17xx/lpc17_usb.h + * arch/arm/src/lpc17xx/chip/lpc17_usb.h * - * Copyright (C) 2010 Gregory Nutt. All rights reserved. + * Copyright (C) 2010, 2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -33,8 +33,8 @@ * ************************************************************************************/ -#ifndef __ARCH_ARM_SRC_LPC17XX_LPC17_USB_H -#define __ARCH_ARM_SRC_LPC17XX_LPC17_USB_H +#ifndef __ARCH_ARM_SRC_LPC17XX_CHIP_LPC17_USB_H +#define __ARCH_ARM_SRC_LPC17XX_CHIP_LPC17_USB_H /************************************************************************************ * Included Files @@ -44,7 +44,7 @@ #include #include "chip.h" -#include "lpc17_memorymap.h" +#include "chip/lpc17_memorymap.h" /************************************************************************************ * Pre-processor Definitions @@ -775,4 +775,4 @@ * Public Functions ************************************************************************************/ -#endif /* __ARCH_ARM_SRC_LPC17XX_LPC17_USB_H */ +#endif /* __ARCH_ARM_SRC_LPC17XX_CHIP_LPC17_USB_H */ diff --git a/nuttx/arch/arm/src/lpc17xx/chip/lpc17_wdt.h b/nuttx/arch/arm/src/lpc17xx/chip/lpc17_wdt.h new file mode 100644 index 0000000000..9c83ac4de5 --- /dev/null +++ b/nuttx/arch/arm/src/lpc17xx/chip/lpc17_wdt.h @@ -0,0 +1,108 @@ +/************************************************************************************ + * arch/arm/src/lpc17xx/chip/lpc17_wdt.h + * + * Copyright (C) 2010, 2013 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * 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. + * + ************************************************************************************/ + +#ifndef __ARCH_ARM_SRC_LPC17XX_LPC17_WDT_H +#define __ARCH_ARM_SRC_LPC17XX_LPC17_WDT_H + +/************************************************************************************ + * Included Files + ************************************************************************************/ + +#include + +#include "chip.h" +#include "chip/lpc17_memorymap.h" + +/************************************************************************************ + * Pre-processor Definitions + ************************************************************************************/ + +/* Register offsets *****************************************************************/ + +#define LPC17_WDT_WDMOD_OFFSET 0x0000 /* Watchdog mode register */ +#define LPC17_WDT_WDTC_OFFSET 0x0004 /* Watchdog timer constant register */ +#define LPC17_WDT_WDFEED_OFFSET 0x0008 /* Watchdog feed sequence register */ +#define LPC17_WDT_WDTV_OFFSET 0x000c /* Watchdog timer value register */ +#define LPC17_WDT_WDCLKSEL_OFFSET 0x0010 /* Watchdog clock source selection register */ + +/* Register addresses ***************************************************************/ + +#define LPC17_WDT_WDMOD (LPC17_WDT_BASE+LPC17_WDT_WDMOD_OFFSET) +#define LPC17_WDT_WDTC (LPC17_WDT_BASE+LPC17_WDT_WDTC_OFFSET) +#define LPC17_WDT_WDFEED (LPC17_WDT_BASE+LPC17_WDT_WDFEED_OFFSET) +#define LPC17_WDT_WDTV (LPC17_WDT_BASE+LPC17_WDT_WDTV_OFFSET) +#define LPC17_WDT_WDCLKSEL (LPC17_WDT_BASE+LPC17_WDT_WDCLKSEL_OFFSET) + +/* Register bit definitions *********************************************************/ + +/* Watchdog mode register */ + +#define WDT_WDMOD_WDEN (1 << 0) /* Bit 0: Watchdog enable */ +#define WDT_WDMOD_WDRESET (1 << 1) /* Bit 1: Watchdog reset enable */ +#define WDT_WDMOD_WDTOF (1 << 2) /* Bit 2: Watchdog time-out */ +#define WDT_WDMOD_WDINT (1 << 3) /* Bit 3: Watchdog interrupt */ + /* Bits 14-31: Reserved */ + +/* Watchdog timer constant register (Bits 0-31: Watchdog time-out interval) */ + +/* Watchdog feed sequence register */ + +#define WDT_WDFEED_MASK (0xff) /* Bits 0-7: Feed value should be 0xaa followed by 0x55 */ + /* Bits 14-31: Reserved */ +/* Watchdog timer value register (Bits 0-31: Counter timer value) */ + +/* Watchdog clock source selection register */ + +#define WDT_WDCLKSEL_WDSEL_SHIFT (0) /* Bits 0-1: Clock source for the Watchdog timer */ +#define WDT_WDCLKSEL_WDSEL_MASK (3 << WDT_WDCLKSEL_WDSEL_SHIFT) +# define WDT_WDCLKSEL_WDSEL_INTRC (0 << WDT_WDCLKSEL_WDSEL_SHIFT) /* Internal RC osc */ +# define WDT_WDCLKSEL_WDSEL_APB (1 << WDT_WDCLKSEL_WDSEL_SHIFT) /* APB peripheral clock (watchdog pclk) */ +# define WDT_WDCLKSEL_WDSEL_RTC (2 << WDT_WDCLKSEL_WDSEL_SHIFT) /* RTC oscillator (rtc_clk) */ + /* Bits 2-30: Reserved */ +#define WDT_WDCLKSEL_WDLOCK (1 << 31) /* Bit 31: Lock WDT register bits if set */ + +/************************************************************************************ + * Public Types + ************************************************************************************/ + +/************************************************************************************ + * Public Data + ************************************************************************************/ + +/************************************************************************************ + * Public Functions + ************************************************************************************/ + +#endif /* __ARCH_ARM_SRC_LPC17XX_LPC17_WDT_H */ diff --git a/nuttx/arch/arm/src/lpc17xx/lpc17_adc.c b/nuttx/arch/arm/src/lpc17xx/lpc17_adc.c index ebc05d13ee..81e13e3421 100644 --- a/nuttx/arch/arm/src/lpc17xx/lpc17_adc.c +++ b/nuttx/arch/arm/src/lpc17xx/lpc17_adc.c @@ -60,9 +60,8 @@ #include "up_arch.h" #include "chip.h" -#include "lpc17_internal.h" -#include "lpc17_syscon.h" -#include "lpc17_pinconn.h" +#include "chip/lpc17_syscon.h" +#include "lpc17_gpio.h" #include "lpc17_adc.h" #if defined(CONFIG_LPC17_ADC) diff --git a/nuttx/arch/arm/src/lpc17xx/lpc17_adc.h b/nuttx/arch/arm/src/lpc17xx/lpc17_adc.h index 6b9a583453..5a1bef14ab 100644 --- a/nuttx/arch/arm/src/lpc17xx/lpc17_adc.h +++ b/nuttx/arch/arm/src/lpc17xx/lpc17_adc.h @@ -1,180 +1,88 @@ -/************************************************************************************ - * arch/arm/src/lpc17xx/lpc17_adc.h - * - * Copyright (C) 2010, 2012 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt - * - * 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. - * - ************************************************************************************/ - -#ifndef __ARCH_ARM_SRC_LPC17XX_LPC17_ADC_H -#define __ARCH_ARM_SRC_LPC17XX_LPC17_ADC_H - -/************************************************************************************ - * Included Files - ************************************************************************************/ - -#include - -#include "chip.h" -#include "lpc17_memorymap.h" - -/************************************************************************************ - * Pre-processor Definitions - ************************************************************************************/ - -/* Register offsets *****************************************************************/ - -#define LPC17_ADC_CR_OFFSET 0x0000 /* A/D Control Register */ -#define LPC17_ADC_GDR_OFFSET 0x0004 /* A/D Global Data Register */ -#define LPC17_ADC_INTEN_OFFSET 0x000c /* A/D Interrupt Enable Register */ - -#define LPC17_ADC_DR_OFFSET(n) (0x0010+((n) << 2)) -#define LPC17_ADC_DR0_OFFSET 0x0010 /* A/D Channel 0 Data Register */ -#define LPC17_ADC_DR1_OFFSET 0x0014 /* A/D Channel 1 Data Register */ -#define LPC17_ADC_DR2_OFFSET 0x0018 /* A/D Channel 2 Data Register */ -#define LPC17_ADC_DR3_OFFSET 0x001c /* A/D Channel 3 Data Register */ -#define LPC17_ADC_DR4_OFFSET 0x0020 /* A/D Channel 4 Data Register */ -#define LPC17_ADC_DR5_OFFSET 0x0024 /* A/D Channel 5 Data Register */ -#define LPC17_ADC_DR6_OFFSET 0x0028 /* A/D Channel 6 Data Register */ -#define LPC17_ADC_DR7_OFFSET 0x002c /* A/D Channel 7 Data Register */ - -#define LPC17_ADC_STAT_OFFSET 0x0030 /* A/D Status Register */ -#define LPC17_ADC_TRM_OFFSET 0x0034 /* ADC trim register */ - -/* Register addresses ***************************************************************/ - -#define LPC17_ADC_CR (LPC17_ADC_BASE+LPC17_ADC_CR_OFFSET) -#define LPC17_ADC_GDR (LPC17_ADC_BASE+LPC17_ADC_GDR_OFFSET) -#define LPC17_ADC_INTEN (LPC17_ADC_BASE+LPC17_ADC_INTEN_OFFSET) - -#define LPC17_ADC_DR(n) (LPC17_ADC_BASE+LPC17_ADC_DR_OFFSET(n)) -#define LPC17_ADC_DR0 (LPC17_ADC_BASE+LPC17_ADC_DR0_OFFSET) -#define LPC17_ADC_DR1 (LPC17_ADC_BASE+LPC17_ADC_DR1_OFFSET) -#define LPC17_ADC_DR2 (LPC17_ADC_BASE+LPC17_ADC_DR2_OFFSET) -#define LPC17_ADC_DR3 (LPC17_ADC_BASE+LPC17_ADC_DR3_OFFSET) -#define LPC17_ADC_DR4 (LPC17_ADC_BASE+LPC17_ADC_DR4_OFFSET) -#define LPC17_ADC_DR5 (LPC17_ADC_BASE+LPC17_ADC_DR5_OFFSET) -#define LPC17_ADC_DR6 (LPC17_ADC_BASE+LPC17_ADC_DR6_OFFSET) -#define LPC17_ADC_DR7 (LPC17_ADC_BASE+LPC17_ADC_DR7_OFFSET) - -#define LPC17_ADC_STAT (LPC17_ADC_BASE+LPC17_ADC_STAT_OFFSET) -#define LPC17_ADC_TRM (LPC17_ADC_BASE+LPC17_ADC_TRM_OFFSET) - -/* Register bit definitions *********************************************************/ - -/* A/D Control Register */ - -#define ADC_CR_SEL_SHIFT (0) /* Bits 0-7: Selects pins to be sampled */ -#define ADC_CR_SEL_MASK (0xff << ADC_CR_SEL_MASK) -#define ADC_CR_CLKDIV_SHIFT (8) /* Bits 8-15: APB clock (PCLK_ADC0) divisor */ -#define ADC_CR_CLKDIV_MASK (0xff << ADC_CR_CLKDIV_SHIFT) -#define ADC_CR_BURST (1 << 16) /* Bit 16: A/D Repeated conversions */ - /* Bits 17-20: Reserved */ -#define ADC_CR_PDN (1 << 21) /* Bit 21: A/D converter power-down mode */ - /* Bits 22-23: Reserved */ -#define ADC_CR_START_SHIFT (24) /* Bits 24-26: Control A/D conversion start */ -#define ADC_CR_START_MASK (7 << ADC_CR_START_SHIFT) -# define ADC_CR_START_NOSTART (0 << ADC_CR_START_SHIFT) /* No start */ -# define ADC_CR_START_NOW (1 << ADC_CR_START_SHIFT) /* Start now */ -# define ADC_CR_START_P2p10 (2 << ADC_CR_START_SHIFT) /* Start edge on P2.10/EINT0/NMI */ -# define ADC_CR_START_P1p27 (3 << ADC_CR_START_SHIFT) /* Start edge on P1.27/CLKOUT/USB_OVRCRn/CAP0.1 */ -# define ADC_CR_START_MAT0p1 (4 << ADC_CR_START_SHIFT) /* Start edge on MAT0.1 */ -# define ADC_CR_START_MAT0p3 (5 << ADC_CR_START_SHIFT) /* Start edge on MAT0.3 */ -# define ADC_CR_START_MAT1p0 (6 << ADC_CR_START_SHIFT) /* Start edge on MAT1.0 */ -# define ADC_CR_START_MAT1p1 (7 << ADC_CR_START_SHIFT) /* Start edge on MAT1.1 */ -#define ADC_CR_EDGE (1 << 27) /* Bit 27: Start on falling edge */ - /* Bits 28-31: Reserved */ -/* A/D Global Data Register AND Channel 0-7 Data Register */ - /* Bits 0-3: Reserved */ -#define ADC_DR_RESULT_SHIFT (4) /* Bits 4-15: Result of conversion (DONE==1) */ -#define ADC_DR_RESULT_MASK (0x0fff << ADC_DR_RESULT_SHIFT) - /* Bits 16-23: Reserved */ -#define ADC_DR_CHAN_SHIFT (24) /* Bits 24-26: Channel converted */ -#define ADC_DR_CHAN_MASK (3 << ADC_DR_CHN_SHIFT) - /* Bits 27-29: Reserved */ -#define ADC_DR_OVERRUN (1 << 30) /* Bit 30: Conversion(s) lost/overwritten*/ -#define ADC_DR_DONE (1 << 31) /* Bit 31: A/D conversion complete*/ - -/* A/D Interrupt Enable Register */ - -#define ADC_INTEN_CHAN(n) (1 << (n)) -#define ADC_INTEN_CHAN0 (1 << 0) /* Bit 0: Enable ADC chan 0 complete intterrupt */ -#define ADC_INTEN_CHAN1 (1 << 1) /* Bit 1: Enable ADC chan 1 complete interrupt */ -#define ADC_INTEN_CHAN2 (1 << 2) /* Bit 2: Enable ADC chan 2 complete interrupt */ -#define ADC_INTEN_CHAN3 (1 << 3) /* Bit 3: Enable ADC chan 3 complete interrupt */ -#define ADC_INTEN_CHAN4 (1 << 4) /* Bit 4: Enable ADC chan 4 complete interrupt */ -#define ADC_INTEN_CHAN5 (1 << 5) /* Bit 5: Enable ADC chan 5 complete interrupt */ -#define ADC_INTEN_CHAN6 (1 << 6) /* Bit 6: Enable ADC chan 6 complete interrupt */ -#define ADC_INTEN_CHAN7 (1 << 7) /* Bit 7: Enable ADC chan 7 complete interrupt */ -#define ADC_INTEN_GLOBAL (1 << 8) /* Bit 8: Only the global DONE generates interrupt */ - /* Bits 9-31: Reserved */ -/* A/D Status Register */ - -#define ADC_STAT_DONE(n) (1 << (n)) -#define ADC_STAT_DONE0 (1 << 0) /* Bit 0: A/D chan 0 DONE */ -#define ADC_STAT_DONE1 (1 << 1) /* Bit 1: A/D chan 1 DONE */ -#define ADC_STAT_DONE2 (1 << 2) /* Bit 2: A/D chan 2 DONE */ -#define ADC_STAT_DONE3 (1 << 3) /* Bit 3: A/D chan 3 DONE */ -#define ADC_STAT_DONE4 (1 << 4) /* Bit 4: A/D chan 4 DONE */ -#define ADC_STAT_DONE5 (1 << 5) /* Bit 5: A/D chan 5 DONE */ -#define ADC_STAT_DONE6 (1 << 6) /* Bit 6: A/D chan 6 DONE */ -#define ADC_STAT_DONE7 (1 << 7) /* Bit 7: A/D chan 7 DONE */ -#define ADC_STAT_OVERRUN(n) ((1 << (n)) + 8) -#define ADC_STAT_OVERRUN0 (1 << 8) /* Bit 8: A/D chan 0 OVERRUN */ -#define ADC_STAT_OVERRUN1 (1 << 9) /* Bit 9: A/D chan 1 OVERRUN */ -#define ADC_STAT_OVERRUN2 (1 << 10) /* Bit 10: A/D chan 2 OVERRUN */ -#define ADC_STAT_OVERRUN3 (1 << 11) /* Bit 11: A/D chan 3 OVERRUN */ -#define ADC_STAT_OVERRUN4 (1 << 12) /* Bit 12: A/D chan 4 OVERRUN */ -#define ADC_STAT_OVERRUN5 (1 << 13) /* Bit 13: A/D chan 5 OVERRUN */ -#define ADC_STAT_OVERRUN6 (1 << 14) /* Bit 14: A/D chan 6 OVERRUN */ -#define ADC_STAT_OVERRUN7 (1 << 15) /* Bit 15: A/D chan 7 OVERRUN */ -#define ADC_STAT_INT (1 << 16) /* Bit 15: A/D interrupt */ - /* Bits 17-31: Reserved */ -/* ADC trim register */ - /* Bits 0-3: Reserved */ -#define ADC_TRM_ADCOFFS_SHIFT (4) /* Bits 4-7: A/D offset trim bits */ -#define ADC_TRM_ADCOFFS_MASK (15 << ADC_TRM_ADCOFFS_SHIFT) -#define ADC_TRM_TRIM_SHIFT (8) /* Bits 8-11: Written-to by boot code */ -#define ADC_TRM_TRIM_MASK (15 << ADC_TRM_TRIM_SHIFT) - /* Bits 12-31: Reserved */ - -/************************************************************************************ - * Public Types - ************************************************************************************/ - -/************************************************************************************ - * Public Data - ************************************************************************************/ - -/************************************************************************************ - * Public Functions - ************************************************************************************/ - -#endif /* __ARCH_ARM_SRC_LPC17XX_LPC17_ADC_H */ +/**************************************************************************** + * arch/arm/src/lpc17xx/lpc17_adc.h + * + * Copyright (C) 2010, 2012, 2013 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * 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. + * + ****************************************************************************/ + +#ifndef __ARCH_ARM_SRC_LPC17XX_LPC17_ADC_H +#define __ARCH_ARM_SRC_LPC17XX_LPC17_ADC_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include +#include "chip/lpc17_adc.h" + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +/**************************************************************************** + * Public Types + ****************************************************************************/ + +/**************************************************************************** + * Public Data + ****************************************************************************/ + +#ifndef __ASSEMBLY__ +#ifdef __cplusplus +extern "C" +{ +#endif + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: lpc17_adcinitialize + * + * Description: + * Initialize the adc + * + * Returned Value: + * Valid can device structure reference on succcess; a NULL on failure + * + ****************************************************************************/ + +#ifdef CONFIG_LPC17_ADC +FAR struct adc_dev_s *lpc17_adcinitialize(void); +#endif + +#ifdef __cplusplus +} +#endif +#endif /* __ASSEMBLY__ */ + +#endif /* __ARCH_ARM_SRC_LPC17XX_LPC17_ADC_H */ diff --git a/nuttx/arch/arm/src/lpc17xx/lpc17_allocateheap.c b/nuttx/arch/arm/src/lpc17xx/lpc17_allocateheap.c index 501358716e..5da6ffa22f 100644 --- a/nuttx/arch/arm/src/lpc17xx/lpc17_allocateheap.c +++ b/nuttx/arch/arm/src/lpc17xx/lpc17_allocateheap.c @@ -50,7 +50,7 @@ #include "up_arch.h" #include "up_internal.h" -#include "lpc17_memorymap.h" +#include "chip/lpc17_memorymap.h" #include "lpc17_emacram.h" #include "lpc17_ohciram.h" diff --git a/nuttx/arch/arm/src/lpc17xx/lpc17_can.c b/nuttx/arch/arm/src/lpc17xx/lpc17_can.c index 409785d290..abdf8c7b76 100644 --- a/nuttx/arch/arm/src/lpc17xx/lpc17_can.c +++ b/nuttx/arch/arm/src/lpc17xx/lpc17_can.c @@ -62,9 +62,8 @@ #include "up_arch.h" #include "chip.h" -#include "lpc17_internal.h" -#include "lpc17_syscon.h" -#include "lpc17_pinconn.h" +#include "chip/lpc17_syscon.h" +#include "lpc17_gpio.h" #include "lpc17_can.h" #if defined(CONFIG_LPC17_CAN1) || defined(CONFIG_LPC17_CAN2) diff --git a/nuttx/arch/arm/src/lpc17xx/lpc17_can.h b/nuttx/arch/arm/src/lpc17xx/lpc17_can.h index e990958fd4..e15eaced5a 100644 --- a/nuttx/arch/arm/src/lpc17xx/lpc17_can.h +++ b/nuttx/arch/arm/src/lpc17xx/lpc17_can.h @@ -1,7 +1,7 @@ -/************************************************************************************ +/**************************************************************************** * arch/arm/src/lpc17xx/lpc17_can.h * - * Copyright (C) 2010-2012 Gregory Nutt. All rights reserved. + * Copyright (C) 2010-2012, 2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -31,480 +31,62 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - ************************************************************************************/ + ****************************************************************************/ #ifndef __ARCH_ARM_SRC_LPC17XX_LPC17_CAN_H #define __ARCH_ARM_SRC_LPC17XX_LPC17_CAN_H -/************************************************************************************ +/**************************************************************************** * Included Files - ************************************************************************************/ + ****************************************************************************/ #include +#include "chip/lpc17_can.h" -#include "chip.h" -#include "lpc17_memorymap.h" - -/************************************************************************************ +/**************************************************************************** * Pre-processor Definitions - ************************************************************************************/ + ****************************************************************************/ -/* Register offsets *****************************************************************/ -/* CAN acceptance filter registers */ - -#define LPC17_CANAF_AFMR_OFFSET 0x0000 /* Acceptance Filter Register */ -#define LPC17_CANAF_SFFSA_OFFSET 0x0004 /* Standard Frame Individual Start Address Register */ -#define LPC17_CANAF_SFFGRPSA_OFFSET 0x0008 /* Standard Frame Group Start Address Register */ -#define LPC17_CANAF_EFFSA_OFFSET 0x000c /* Extended Frame Start Address Register */ -#define LPC17_CANAF_EFFGRPSA_OFFSET 0x0010 /* Extended Frame Group Start Address Register */ -#define LPC17_CANAF_EOT_OFFSET 0x0014 /* End of AF Tables register */ -#define LPC17_CANAF_LUTERRAD_OFFSET 0x0018 /* LUT Error Address register */ -#define LPC17_CANAF_LUTERR_OFFSET 0x001c /* LUT Error Register */ -#define LPC17_CANAF_FCANIE_OFFSET 0x0020 /* FullCAN interrupt enable register */ -#define LPC17_CANAF_FCANIC0_OFFSET 0x0024 /* FullCAN interrupt and capture register 0 */ -#define LPC17_CANAF_FCANIC1_OFFSET 0x0028 /* FullCAN interrupt and capture register 1 */ - -/* Central CAN registers */ - -#define LPC17_CAN_TXSR_OFFSET 0x0000 /* CAN Central Transmit Status Register */ -#define LPC17_CAN_RXSR_OFFSET 0x0004 /* CAN Central Receive Status Register */ -#define LPC17_CAN_MSR_OFFSET 0x0008 /* CAN Central Miscellaneous Register */ - -/* CAN1/2 registers */ - -#define LPC17_CAN_MOD_OFFSET 0x0000 /* CAN operating mode */ -#define LPC17_CAN_CMR_OFFSET 0x0004 /* Command bits */ -#define LPC17_CAN_GSR_OFFSET 0x0008 /* Controller Status and Error Counters */ -#define LPC17_CAN_ICR_OFFSET 0x000c /* Interrupt and capure register */ -#define LPC17_CAN_IER_OFFSET 0x0010 /* Interrupt Enable */ -#define LPC17_CAN_BTR_OFFSET 0x0014 /* Bus Timing */ -#define LPC17_CAN_EWL_OFFSET 0x0018 /* Error Warning Limit */ -#define LPC17_CAN_SR_OFFSET 0x001c /* Status Register */ -#define LPC17_CAN_RFS_OFFSET 0x0020 /* Receive frame status */ -#define LPC17_CAN_RID_OFFSET 0x0024 /* Received Identifier */ -#define LPC17_CAN_RDA_OFFSET 0x0028 /* Received data bytes 1-4 */ -#define LPC17_CAN_RDB_OFFSET 0x002c /* Received data bytes 5-8 */ -#define LPC17_CAN_TFI1_OFFSET 0x0030 /* Transmit frame info (Tx Buffer 1) */ -#define LPC17_CAN_TID1_OFFSET 0x0034 /* Transmit Identifier (Tx Buffer 1) */ -#define LPC17_CAN_TDA1_OFFSET 0x0038 /* Transmit data bytes 1-4 (Tx Buffer 1) */ -#define LPC17_CAN_TDB1_OFFSET 0x003c /* Transmit data bytes 5-8 (Tx Buffer 1) */ -#define LPC17_CAN_TFI2_OFFSET 0x0040 /* Transmit frame info (Tx Buffer 2) */ -#define LPC17_CAN_TID2_OFFSET 0x0044 /* Transmit Identifier (Tx Buffer 2) */ -#define LPC17_CAN_TDA2_OFFSET 0x0048 /* Transmit data bytes 1-4 (Tx Buffer 2) */ -#define LPC17_CAN_TDB2_OFFSET 0x004c /* Transmit data bytes 5-8 (Tx Buffer 2) */ -#define LPC17_CAN_TFI3_OFFSET 0x0050 /* Transmit frame info (Tx Buffer 3) */ -#define LPC17_CAN_TID3_OFFSET 0x0054 /* Transmit Identifier (Tx Buffer 3) */ -#define LPC17_CAN_TDA3_OFFSET 0x0058 /* Transmit data bytes 1-4 (Tx Buffer 3) */ -#define LPC17_CAN_TDB3_OFFSET 0x005c /* Transmit data bytes 5-8 (Tx Buffer 3) */ - -/* Register addresses ***************************************************************/ -/* CAN acceptance filter registers */ - -#define LPC17_CANAF_AFMR (LPC17_CANAF_BASE+LPC17_CANAF_AFMR_OFFSET) -#define LPC17_CANAF_SFFSA (LPC17_CANAF_BASE+LPC17_CANAF_SFFSA_OFFSET) -#define LPC17_CANAF_SFFGRPSA (LPC17_CANAF_BASE+LPC17_CANAF_SFFGRPSA_OFFSET) -#define LPC17_CANAF_EFFSA (LPC17_CANAF_BASE+LPC17_CANAF_EFFSA_OFFSET) -#define LPC17_CANAF_EFFGRPSA (LPC17_CANAF_BASE+LPC17_CANAF_EFFGRPSA_OFFSET) -#define LPC17_CANAF_EOT (LPC17_CANAF_BASE+LPC17_CANAF_EOT_OFFSET) -#define LPC17_CANAF_LUTERRAD (LPC17_CANAF_BASE+LPC17_CANAF_LUTERRAD_OFFSET) -#define LPC17_CANAF_LUTERR (LPC17_CANAF_BASE+LPC17_CANAF_LUTERR_OFFSET) -#define LPC17_CANAF_FCANIE (LPC17_CANAF_BASE+LPC17_CANAF_FCANIE_OFFSET) -#define LPC17_CANAF_FCANIC0 (LPC17_CANAF_BASE+LPC17_CANAF_FCANIC0_OFFSET) -#define LPC17_CANAF_FCANIC1 (LPC17_CANAF_BASE+LPC17_CANAF_FCANIC1_OFFSET) - -/* Central CAN registers */ - -#define LPC17_CAN_TXSR (LPC17_CAN_BASE+LPC17_CAN_TXSR_OFFSET) -#define LPC17_CAN_RXSR (LPC17_CAN_BASE+LPC17_CAN_RXSR_OFFSET) -#define LPC17_CAN_MSR (LPC17_CAN_BASE+LPC17_CAN_MSR_OFFSET) - -/* CAN1/2 registers */ - -#define LPC17_CAN1_MOD (LPC17_CAN1_BASE+LPC17_CAN_MOD_OFFSET) -#define LPC17_CAN1_CMR (LPC17_CAN1_BASE+LPC17_CAN_CMR_OFFSET) -#define LPC17_CAN1_GSR (LPC17_CAN1_BASE+LPC17_CAN_GSR_OFFSET) -#define LPC17_CAN1_ICR (LPC17_CAN1_BASE+LPC17_CAN_ICR_OFFSET) -#define LPC17_CAN1_IER (LPC17_CAN1_BASE+LPC17_CAN_IER_OFFSET) -#define LPC17_CAN1_BTR (LPC17_CAN1_BASE+LPC17_CAN_BTR_OFFSET) -#define LPC17_CAN1_EWL (LPC17_CAN1_BASE+LPC17_CAN_EWL_OFFSET) -#define LPC17_CAN1_SR (LPC17_CAN1_BASE+LPC17_CAN_SR_OFFSET) -#define LPC17_CAN1_RFS (LPC17_CAN1_BASE+LPC17_CAN_RFS_OFFSET) -#define LPC17_CAN1_RID (LPC17_CAN1_BASE+LPC17_CAN_RID_OFFSET) -#define LPC17_CAN1_RDA (LPC17_CAN1_BASE+LPC17_CAN_RDA_OFFSET) -#define LPC17_CAN1_RDB (LPC17_CAN1_BASE+LPC17_CAN_RDB_OFFSET) -#define LPC17_CAN1_TFI1 (LPC17_CAN1_BASE+LPC17_CAN_TFI1_OFFSET) -#define LPC17_CAN1_TID1 (LPC17_CAN1_BASE+LPC17_CAN_TID1_OFFSET) -#define LPC17_CAN1_TDA1 (LPC17_CAN1_BASE+LPC17_CAN_TDA1_OFFSET) -#define LPC17_CAN1_TDB1 (LPC17_CAN1_BASE+LPC17_CAN_TDB1_OFFSET) -#define LPC17_CAN1_TFI2 (LPC17_CAN1_BASE+LPC17_CAN_TFI2_OFFSET) -#define LPC17_CAN1_TID2 (LPC17_CAN1_BASE+LPC17_CAN_TID2_OFFSET) -#define LPC17_CAN1_TDA2 (LPC17_CAN1_BASE+LPC17_CAN_TDA2_OFFSET) -#define LPC17_CAN1_TDB2 (LPC17_CAN1_BASE+LPC17_CAN_TDB2_OFFSET) -#define LPC17_CAN1_TFI3 (LPC17_CAN1_BASE+LPC17_CAN_TFI3_OFFSET) -#define LPC17_CAN1_TID3 (LPC17_CAN1_BASE+LPC17_CAN_TID3_OFFSET) -#define LPC17_CAN1_TDA3 (LPC17_CAN1_BASE+LPC17_CAN_TDA3_OFFSET) -#define LPC17_CAN1_TDB3 (LPC17_CAN1_BASE+LPC17_CAN_TDB3_OFFSET) - -#define LPC17_CAN2_MOD (LPC17_CAN2_BASE+LPC17_CAN_MOD_OFFSET) -#define LPC17_CAN2_CMR (LPC17_CAN2_BASE+LPC17_CAN_CMR_OFFSET) -#define LPC17_CAN2_GSR (LPC17_CAN2_BASE+LPC17_CAN_GSR_OFFSET) -#define LPC17_CAN2_ICR (LPC17_CAN2_BASE+LPC17_CAN_ICR_OFFSET) -#define LPC17_CAN2_IER (LPC17_CAN2_BASE+LPC17_CAN_IER_OFFSET) -#define LPC17_CAN2_BTR (LPC17_CAN2_BASE+LPC17_CAN_BTR_OFFSET) -#define LPC17_CAN2_EWL (LPC17_CAN2_BASE+LPC17_CAN_EWL_OFFSET) -#define LPC17_CAN2_SR (LPC17_CAN2_BASE+LPC17_CAN_SR_OFFSET) -#define LPC17_CAN2_RFS (LPC17_CAN2_BASE+LPC17_CAN_RFS_OFFSET) -#define LPC17_CAN2_RID (LPC17_CAN2_BASE+LPC17_CAN_RID_OFFSET) -#define LPC17_CAN2_RDA (LPC17_CAN2_BASE+LPC17_CAN_RDA_OFFSET) -#define LPC17_CAN2_RDB (LPC17_CAN2_BASE+LPC17_CAN_RDB_OFFSET) -#define LPC17_CAN2_TFI1 (LPC17_CAN2_BASE+LPC17_CAN_TFI1_OFFSET) -#define LPC17_CAN2_TID1 (LPC17_CAN2_BASE+LPC17_CAN_TID1_OFFSET) -#define LPC17_CAN2_TDA1 (LPC17_CAN2_BASE+LPC17_CAN_TDA1_OFFSET) -#define LPC17_CAN2_TDB1 (LPC17_CAN2_BASE+LPC17_CAN_TDB1_OFFSET) -#define LPC17_CAN2_TFI2 (LPC17_CAN2_BASE+LPC17_CAN_TFI2_OFFSET) -#define LPC17_CAN2_TID2 (LPC17_CAN2_BASE+LPC17_CAN_TID2_OFFSET) -#define LPC17_CAN2_TDA2 (LPC17_CAN2_BASE+LPC17_CAN_TDA2_OFFSET) -#define LPC17_CAN2_TDB2 (LPC17_CAN2_BASE+LPC17_CAN_TDB2_OFFSET) -#define LPC17_CAN2_TFI3 (LPC17_CAN2_BASE+LPC17_CAN_TFI3_OFFSET) -#define LPC17_CAN2_TID3 (LPC17_CAN2_BASE+LPC17_CAN_TID3_OFFSET) -#define LPC17_CAN2_TDA3 (LPC17_CAN2_BASE+LPC17_CAN_TDA3_OFFSET) -#define LPC17_CAN2_TDB3 (LPC17_CAN2_BASE+LPC17_CAN_TDB3_OFFSET) - -/* Register bit definitions *********************************************************/ -/* CAN acceptance filter registers */ -/* Acceptance Filter Register */ - -#define CANAF_AFMR_ACCOFF (1 << 0) /* Bit 0: AF non-operational; All RX messages ignored */ -#define CANAF_AFMR_ACCBP (1 << 1) /* Bit 1: AF bypass: All RX messages accepted */ -#define CANAF_AFMR_EFCAN (1 << 2) /* Bit 2: Enable Full CAN mode */ - /* Bits 3-31: Reserved */ -/* Standard Frame Individual Start Address Register */ - /* Bits 0-1: Reserved */ -#define CANAF_SFFSA_SHIFT (2) /* Bits 2-10: Address of Standard Identifiers in AF Lookup RAM */ -#define CANAF_SFFSA_MASK (0x01ff << CANAF_SFFSA_SHIFT) - /* Bits 11-31: Reserved */ -/* Standard Frame Group Start Address Register */ - /* Bits 0-1: Reserved */ -#define CANAF_SFFGRPSA_SHIFT (2) /* Bits 2-10: Address of grouped Standard Identifiers in AF Lookup RAM */ -#define CANAF_SFFGRPSA_MASK (0x01ff << CANAF_SFFGRPSA_SHIFT) - /* Bits 11-31: Reserved */ -/* Extended Frame Start Address Register */ - /* Bits 0-1: Reserved */ -#define CANAF_EFFSA_SHIFT (2) /* Bits 2-10: Address of Extended Identifiers in AF Lookup RAM */ -#define CANAF_EFFSA_MASK (0x01ff << CANAF_EFFSA_SHIFT) - /* Bits 11-31: Reserved */ -/* Extended Frame Group Start Address Register */ - /* Bits 0-1: Reserved */ -#define CANAF_EFFGRPSA_SHIFT (2) /* Bits 2-10: Address of grouped Extended Identifiers in AF Lookup RAM */ -#define CANAF_EFFGRPSA_MASK (0x01ff << CANAF_EFFGRPSA_SHIFT) - /* Bits 11-31: Reserved */ -/* End of AF Tables register */ - /* Bits 0-1: Reserved */ -#define CANAF_EOT_SHIFT (2) /* Bits 2-10: Last active address in last active AF table */ -#define CANAF_EOT_MASK (0x01ff << CANAF_EOT_SHIFT) - /* Bits 11-31: Reserved */ -/* LUT Error Address register */ - /* Bits 0-1: Reserved */ -#define CANAF_LUTERRAD_SHIFT (2) /* Bits 2-10: Address in AF Lookup RAM of error */ -#define CANAF_LUTERRAD_MASK (0x01ff << CANAF_EOT_SHIFT) - /* Bits 11-31: Reserved */ -/* LUT Error Register */ - -#define CANAF_LUTERR_LUTERR (1 << 0) /* Bit 0: AF error in AF RAM tables */ - /* Bits 1-31: Reserved */ -/* FullCAN interrupt enable register */ - -#define CANAF_FCANIE_FCANIE (1 << 0) /* Bit 0: Global FullCAN Interrupt Enable */ - /* Bits 1-31: Reserved */ - -/* FullCAN interrupt and capture register 0 */ - -#define CANAF_FCANIC0_INTPND(n) (1 << (n)) /* n=0,1,2,... 31 */ - -/* FullCAN interrupt and capture register 1 */ - -#define CANAF_FCANIC1_INTPND(n) (1 << ((n)-32)) /* n=32,33,...63 */ - -/* Central CAN registers */ -/* CAN Central Transmit Status Register */ - -#define CAN_TXSR_TS1 (1 << 0) /* Bit 0: CAN1 sending */ -#define CAN_TXSR_TS2 (1 << 1) /* Bit 1: CAN2 sending */ - /* Bits 2-7: Reserved */ -#define CAN_TXSR_TBS1 (1 << 8) /* Bit 8: All 3 CAN1 TX buffers available */ -#define CAN_TXSR_TBS2 (1 << 9) /* Bit 9: All 3 CAN2 TX buffers available */ - /* Bits 10-15: Reserved */ -#define CAN_TXSR_TCS1 (1 << 16) /* Bit 16: All CAN1 xmissions completed */ -#define CAN_TXSR_TCS2 (1 << 17) /* Bit 17: All CAN2 xmissions completed */ - /* Bits 18-31: Reserved */ -/* CAN Central Receive Status Register */ - -#define CAN_RXSR_RS1 (1 << 0) /* Bit 0: CAN1 receiving */ -#define CAN_RXSR_RS2 (1 << 1) /* Bit 1: CAN2 receiving */ - /* Bits 2-7: Reserved */ -#define CAN_RXSR_RB1 (1 << 8) /* Bit 8: CAN1 received message available */ -#define CAN_RXSR_RB2 (1 << 9) /* Bit 9: CAN2 received message available */ - /* Bits 10-15: Reserved */ -#define CAN_RXSR_DOS1 (1 << 16) /* Bit 16: All CAN1 message lost */ -#define CAN_RXSR_DOS2 (1 << 17) /* Bit 17: All CAN2 message lost */ - /* Bits 18-31: Reserved */ -/* CAN Central Miscellaneous Register */ - -#define CAN_MSR_E1 (1 << 0) /* Bit 0: CAN1 error counters at limit */ -#define CAN_MSR_E2 (1 << 1) /* Bit 1: CAN2 error counters at limit */ - /* Bits 2-7: Reserved */ -#define CAN_MSR_BS1 (1 << 8) /* Bit 8: CAN1 busy */ -#define CAN_MSR_BS2 (1 << 9) /* Bit 7: CAN2 busy */ - /* Bits 10-31: Reserved */ -/* CAN1/2 registers */ -/* CAN operating mode */ - -#define CAN_MOD_RM (1 << 0) /* Bit 0: Reset Mode */ -#define CAN_MOD_LOM (1 << 1) /* Bit 1: Listen Only Mode */ -#define CAN_MOD_STM (1 << 2) /* Bit 2: Self Test Mode */ -#define CAN_MOD_TPM (1 << 3) /* Bit 3: Transmit Priority Mode */ -#define CAN_MOD_SM (1 << 4) /* Bit 4: Sleep Mode */ -#define CAN_MOD_RPM (1 << 5) /* Bit 5: Receive Polarity Mode */ - /* Bit 6: Reserved */ -#define CAN_MOD_TM (1 << 7) /* Bit 7: Test Mode */ - /* Bits 8-31: Reserved */ -/* Command bits */ - -#define CAN_CMR_TR (1 << 0) /* Bit 0: Transmission Request */ -#define CAN_CMR_AT (1 << 1) /* Bit 1: Abort Transmission */ -#define CAN_CMR_RRB (1 << 2) /* Bit 2: Release Receive Buffer */ -#define CAN_CMR_CDO (1 << 3) /* Bit 3: Clear Data Overrun */ -#define CAN_CMR_SRR (1 << 4) /* Bit 4: Self Reception Request */ -#define CAN_CMR_STB1 (1 << 5) /* Bit 5: Select Tx Buffer 1 */ -#define CAN_CMR_STB2 (1 << 6) /* Bit 6: Select Tx Buffer 2 */ -#define CAN_CMR_STB3 (1 << 7) /* Bit 7: Select Tx Buffer 3 */ - /* Bits 8-31: Reserved */ -/* Controller Status and Error Counters */ - -#define CAN_GSR_RBS (1 << 0) /* Bit 0: Receive Buffer Status */ -#define CAN_GSR_DOS (1 << 1) /* Bit 1: Data Overrun Status */ -#define CAN_GSR_TBS (1 << 2) /* Bit 2: Transmit Buffer Status */ -#define CAN_GSR_TCS (1 << 3) /* Bit 3: Transmit Complete Status */ -#define CAN_GSR_RS (1 << 4) /* Bit 4: Receive Status */ -#define CAN_GSR_TS (1 << 5) /* Bit 5: Transmit Status */ -#define CAN_GSR_ES (1 << 6) /* Bit 6: Error Status */ -#define CAN_GSR_BS (1 << 7) /* Bit 7: Bus Status */ - /* Bits 8-15: Reserved */ -#define CAN_GSR_RXERR_SHIFT (16) /* Bits 16-23: Rx Error Counter */ -#define CAN_GSR_RXERR_MASK (0xff << CAN_GSR_RXERR_SHIFT) -#define CAN_GSR_TXERR_SHIFT (24) /* Bits 24-31: Tx Error Counter */ -#define CAN_GSR_TXERR_MASK (0xff << CAN_GSR_TXERR_SHIFT) - -/* Interrupt and capture register */ - -#define CAN_ICR_RI (1 << 0) /* Bit 0: Receive Interrupt */ -#define CAN_ICR_TI1 (1 << 1) /* Bit 1: Transmit Interrupt 1 */ -#define CAN_ICR_EI (1 << 2) /* Bit 2: Error Warning Interrupt */ -#define CAN_ICR_DOI (1 << 3) /* Bit 3: Data Overrun Interrupt */ -#define CAN_ICR_WUI (1 << 4) /* Bit 4: Wake-Up Interrupt */ -#define CAN_ICR_EPI (1 << 5) /* Bit 5: Error Passive Interrupt */ -#define CAN_ICR_ALI (1 << 6) /* Bit 6: Arbitration Lost Interrupt */ -#define CAN_ICR_BEI (1 << 7) /* Bit 7: Bus Error Interrupt */ -#define CAN_ICR_IDI (1 << 8) /* Bit 8: ID Ready Interrupt */ -#define CAN_ICR_TI2 (1 << 9) /* Bit 9: Transmit Interrupt 2 */ -#define CAN_ICR_TI3 (1 << 10) /* Bit 10: Transmit Interrupt 3 */ - /* Bits 11-15: Reserved */ -#define CAN_ICR_ERRBIT_SHIFT (16) /* Bits 16-20: Error Code Capture */ -#define CAN_ICR_ERRBIT_MASK (0x1f << CAN_ICR_ERRBIT_SHIFT) -# define CAN_ICR_ERRBIT_SOF (3 << CAN_ICR_ERRBIT_SHIFT) /* Start of Frame */ -# define CAN_ICR_ERRBIT_ID28 (2 << CAN_ICR_ERRBIT_SHIFT) /* ID28 ... ID21 */ -# define CAN_ICR_ERRBIT_SRTR (4 << CAN_ICR_ERRBIT_SHIFT) /* SRTR Bit */ -# define CAN_ICR_ERRBIT_IDE (5 << CAN_ICR_ERRBIT_SHIFT) /* DE bit */ -# define CAN_ICR_ERRBIT_ID20 (6 << CAN_ICR_ERRBIT_SHIFT) /* ID20 ... ID18 */ -# define CAN_ICR_ERRBIT_ID17 (7 << CAN_ICR_ERRBIT_SHIFT) /* ID17 ... 13 */ -# define CAN_ICR_ERRBIT_CRC (8 << CAN_ICR_ERRBIT_SHIFT) /* CRC Sequence */ -# define CAN_ICR_ERRBIT_DATA (10 << CAN_ICR_ERRBIT_SHIFT) /* Data Field */ -# define CAN_ICR_ERRBIT_LEN (11 << CAN_ICR_ERRBIT_SHIFT) /* Data Length Code */ -# define CAN_ICR_ERRBIT_ RTR (12 << CAN_ICR_ERRBIT_SHIFT) /* RTR Bit */ -# define CAN_ICR_ERRBIT_ID4 (14 << CAN_ICR_ERRBIT_SHIFT) /* ID4 ... ID0 */ -# define CAN_ICR_ERRBIT_ID12 (15 << CAN_ICR_ERRBIT_SHIFT) /* ID12 ... ID5 */ -# define CAN_ICR_ERRBIT_AERR (17 << CAN_ICR_ERRBIT_SHIFT) /* Active Error Flag */ -# define CAN_ICR_ERRBIT_INTERMSN (18 << CAN_ICR_ERRBIT_SHIFT) /* Intermission */ -# define CAN_ICR_ERRBIT_DOM (19 << CAN_ICR_ERRBIT_SHIFT) /* Tolerate Dominant Bits */ -# define CAN_ICR_ERRBIT_PERR (22 << CAN_ICR_ERRBIT_SHIFT) /* Passive Error Flag */ -# define CAN_ICR_ERRBIT_ERRDLM (23 << CAN_ICR_ERRBIT_SHIFT) /* Error Delimiter */ -# define CAN_ICR_ERRBIT_CRCDLM (24 << CAN_ICR_ERRBIT_SHIFT) /* CRC Delimiter */ -# define CAN_ICR_ERRBIT_ACKSLT (25 << CAN_ICR_ERRBIT_SHIFT) /* Acknowledge Slot */ -# define CAN_ICR_ERRBIT_EOF (26 << CAN_ICR_ERRBIT_SHIFT) /* End of Frame */ -# define CAN_ICR_ERRBIT_ACKDLM (27 << CAN_ICR_ERRBIT_SHIFT) /* Acknowledge Delimiter */ -# define CAN_ICR_ERRBIT_OVLD (28 << CAN_ICR_ERRBIT_SHIFT) /* Overload flag */ -#define CAN_ICR_ERRDIR (1 << 21) /* Bit 21: Direction bit at time of error */ -#define CAN_ICR_ERRC_SHIFT (22) /* Bits 22-23: Type of error */ -#define CAN_ICR_ERRC_MASK (3 << CAN_ICR_ERRC_SHIFT) -# define CAN_ICR_ERRC_BIT (0 << CAN_ICR_ERRC_SHIFT) -# define CAN_ICR_ERRC_FORM (1 << CAN_ICR_ERRC_SHIFT) -# define CAN_ICR_ERRC_STUFF (2 << CAN_ICR_ERRC_SHIFT) -# define CAN_ICR_ERRC_OTHER (3 << CAN_ICR_ERRC_SHIFT) -#define CAN_ICR_ALCBIT_SHIFT (24) /* Bits 24-31: Bit number within frame */ -#define CAN_ICR_ALCBIT_MASK (0xff << CAN_ICR_ALCBIT_SHIFT) - -/* Interrupt Enable */ - -#define CAN_IER_RIE (1 << 0) /* Bit 0: Receiver Interrupt Enable */ -#define CAN_IER_TIE1 (1 << 1) /* Bit 1: Transmit Interrupt Enable for Buffer1 */ -#define CAN_IER_EIE (1 << 2) /* Bit 2: Error Warning Interrupt Enable */ -#define CAN_IER_DOIE (1 << 3) /* Bit 3: Data Overrun Interrupt Enable */ -#define CAN_IER_WUIE (1 << 4) /* Bit 4: Wake-Up Interrupt Enable */ -#define CAN_IER_EPIE (1 << 5) /* Bit 5: Error Passive Interrupt Enable */ -#define CAN_IER_ALIE (1 << 6) /* Bit 6: Arbitration Lost Interrupt Enable */ -#define CAN_IER_BEIE (1 << 7) /* Bit 7: Bus Error Interrupt */ -#define CAN_IER_IDIE (1 << 8) /* Bit 8: ID Ready Interrupt Enable */ -#define CAN_IER_TIE2 (1 << 9) /* Bit 9: Transmit Interrupt Enable for Buffer2 */ -#define CAN_IER_TIE3 (1 << 10) /* Bit 10: Transmit Interrupt Enable for Buffer3 */ - /* Bits 11-31: Reserved */ -/* Bus Timing */ - -#define CAN_BTR_BRP_SHIFT (0) /* Bits 0-9: Baud Rate Prescaler */ -#define CAN_BTR_BRP_MASK (0x3ff << CAN_BTR_BRP_SHIFT) - /* Bits 10-13: Reserved */ -#define CAN_BTR_SJW_SHIFT (14) /* Bits 14-15: Synchronization Jump Width */ -#define CAN_BTR_SJW_MASK (3 << CAN_BTR_SJW_SHIFT) -#define CAN_BTR_TSEG1_SHIFT (16) /* Bits 16-19: Sync to sample delay */ -#define CAN_BTR_TSEG1_MASK (15 << CAN_BTR_TSEG1_SHIFT) -#define CAN_BTR_TSEG2_SHIFT (20) /* Bits 20-22: smaple to next delay */ -#define CAN_BTR_TSEG2_MASK (7 << CAN_BTR_TSEG2_SHIFT) -#define CAN_BTR_SAM (1 << 23) /* Bit 23: Sampling */ - /* Bits 24-31: Reserved */ - -#define CAN_BTR_BRP_MAX (1024) /* Maximum BTR value (without decrement) */ -#define CAN_BTR_TSEG1_MAX (16) /* Maximum TSEG1 value (without decrement) */ -#define CAN_BTR_TSEG2_MAX (8) /* Maximum TSEG2 value (without decrement) */ - -/* Error Warning Limit */ - -#define CAN_EWL_SHIFT (0) /* Bits 0-7: Error warning limit */ -#define CAN_EWL_MASK (0xff << CAN_EWL_SHIFT) - /* Bits 8-31: Reserved */ -/* Status Register */ - -#define CAN_SR_RBS1 (1 << 0) /* Bit 0: Receive Buffer Status */ -#define CAN_SR_DOS1 (1 << 1) /* Bit 1: Data Overrun Status */ -#define CAN_SR_TBS1 (1 << 2) /* Bit 2: Transmit Buffer Status 1 */ -#define CAN_SR_TCS1 (1 << 3) /* Bit 3: Transmission Complete Status */ -#define CAN_SR_RS1 (1 << 4) /* Bit 4: Receive Status */ -#define CAN_SR_TS1 (1 << 5) /* Bit 5: Transmit Status 1 */ -#define CAN_SR_ES1 (1 << 6) /* Bit 6: Error Status */ -#define CAN_SR_BS1 (1 << 7) /* Bit 7: Bus Status */ -#define CAN_SR_RBS2 (1 << 8) /* Bit 8: Receive Buffer Status */ -#define CAN_SR_DOS2 (1 << 9) /* Bit 9: Data Overrun Status */ -#define CAN_SR_TBS2 (1 << 10) /* Bit 10: Transmit Buffer Status 2 */ -#define CAN_SR_TCS2 (1 << 11) /* Bit 11: Transmission Complete Status */ -#define CAN_SR_RS2 (1 << 12) /* Bit 12: Receive Status */ -#define CAN_SR_TS2 (1 << 13) /* Bit 13: Transmit Status 2 */ -#define CAN_SR_ES2 (1 << 14) /* Bit 14: Error Status */ -#define CAN_SR_BS2 (1 << 15) /* Bit 15: Bus Status */ -#define CAN_SR_RBS3 (1 << 16) /* Bit 16: Receive Buffer Status */ -#define CAN_SR_DOS3 (1 << 17) /* Bit 17: Data Overrun Status */ -#define CAN_SR_TBS3 (1 << 18) /* Bit 18: Transmit Buffer Status 3 */ -#define CAN_SR_TCS3 (1 << 19) /* Bit 19: Transmission Complete Status */ -#define CAN_SR_RS3 (1 << 20) /* Bit 20: Receive Status */ -#define CAN_SR_TS3 (1 << 21) /* Bit 21: Transmit Status 3 */ -#define CAN_SR_ES3 (1 << 22) /* Bit 22: Error Status */ -#define CAN_SR_BS3 (1 << 23) /* Bit 23: Bus Status */ - /* Bits 24-31: Reserved */ -/* Receive frame status */ - -#define CAN_RFS_ID_SHIFT (0) /* Bits 0-9: ID Index */ -#define CAN_RFS_ID_MASK (0x03ff << CAN_RFS_ID_SHIFT) -#define CAN_RFS_BP (1 << 10) /* Bit 10: Received in AF Bypass mode */ - /* Bits 11-15: Reserved */ -#define CAN_RFS_DLC_SHIFT (16) /* Bits 16-19: Message Data Length Code (DLC) */ -#define CAN_RFS_DLC_MASK (15 << CAN_RFS_DLC_SHIFT) - /* Bits 20-29: Reserved */ -#define CAN_RFS_RTR (1 << 30) /* Bit 30: Message Remote Transmission Request */ -#define CAN_RFS_FF (1 << 31) /* Bit 31: Message 29-bit vs 11-bit ID */ - -/* Received Identifier */ - -#define CAN_RID_ID11_MASK (0x7ff) /* Bits 0-10: 11-bit Identifier (FF=0) */ - /* Bits 11-31: Reserved */ -#define CAN_RID_ID29_MASK (0x1fffffff) /* Bits 0-28: 29-bit Identifiter (FF=1) */ - /* Bits 29-31: Reserved */ -/* Received data bytes 1-4 */ - -#define CAN_RDA_DATA1_SHIFT (0) /* Bits 0-7: If CANRFS >= 1 */ -#define CAN_RDA_DATA1_MASK (0x0ff << CAN_RDA_DATA1_SHIFT) -#define CAN_RDA_DATA2_SHIFT (8) /* Bits 8-15: If CANRFS >= 2 */ -#define CAN_RDA_DATA2_MASK (0x0ff << CAN_RDA_DATA2_SHIFT) -#define CAN_RDA_DATA3_SHIFT (16) /* Bits 16-23: If CANRFS >= 3 */ -#define CAN_RDA_DATA3_MASK (0x0ff << CAN_RDA_DATA3_SHIFT) -#define CAN_RDA_DATA4_SHIFT (24) /* Bits 24-31: If CANRFS >= 4 */ -#define CAN_RDA_DATA4_MASK (0x0ff << CAN_RDA_DATA4_SHIFT) - -/* Received data bytes 5-8 */ - -#define CAN_RDB_DATA5_SHIFT (0) /* Bits 0-7: If CANRFS >= 5 */ -#define CAN_RDB_DATA5_MASK (0x0ff << CAN_RDB_DATA5_SHIFT) -#define CAN_RDB_DATA6_SHIFT (8) /* Bits 8-15: If CANRFS >= 6 */ -#define CAN_RDB_DATA6_MASK (0x0ff << CAN_RDB_DATA6_SHIFT) -#define CAN_RDB_DATA7_SHIFT (16) /* Bits 16-23: If CANRFS >= 7 */ -#define CAN_RDB_DATA7_MASK (0x0ff << CAN_RDB_DATA7_SHIFT) -#define CAN_RDB_DATA8_SHIFT (24) /* Bits 24-31: If CANRFS >= 8 */ -#define CAN_RDB_DATA8_MASK (0x0ff << CAN_RDB_DATA8_SHIFT) - -/* Transmit frame info (Tx Buffer 1), Transmit frame info (Tx Buffer 2), and - * Transmit frame info (Tx Buffer 3) common bit field definitions - */ - -#define CAN_TFI_PRIO_SHIFT (0) /* Bits 0-7: TX buffer priority */ -#define CAN_TFI_PRIO_MASK (0xff << CAN_TFI_PRIO_SHIFT) - /* Bits 8-15: Reserved */ -#define CAN_TFI_DLC_SHIFT (16) /* Bits 16-19: TX Data Length Code */ -#define CAN_TFI_DLC_MASK (15 << CAN_TFI_DLC_SHIFT) - /* Bits 20-29: Reserved */ -#define CAN_TFI_RTR (1 << 30) /* Bit 30: TX RTR bit */ -#define CAN_TFI_FF (1 << 31) /* Bit 31: Message 29-bit vs 11-bit ID */ - -/* Transmit Identifier (Tx Buffer 1), Transmit Identifier (Tx Buffer 2), and - * Transmit Identifier (Tx Buffer 3) common bit field definitions. - */ - -#define CAN_TID_ID11_MASK (0x7ff) /* Bits 0-10: 11-bit Identifier (FF=0) */ - /* Bits 11-31: Reserved */ -#define CAN_TID_ID29_MASK (0x1fffffff) /* Bits 0-28: 29-bit Identifiter (FF=1) */ - /* Bits 29-31: Reserved */ - -/* Transmit data bytes 1-4 (Tx Buffer 1), Transmit data bytes 1-4 (Tx Buffer 2), and - * Transmit data bytes 1-4 (Tx Buffer 3) common bit field definitions. - */ - -#define CAN_TDA_DATA1_SHIFT (0) /* Bits 0-7: RTR=0 && DLC >= 1 */ -#define CAN_TDA_DATA1_MASK (0x0ff << CAN_TDA_DATA1_SHIFT) -#define CAN_TDA_DATA2_SHIFT (8) /* Bits 8-15: RTR=0 && DLC >= 2 */ -#define CAN_TDA_DATA2_MASK (0x0ff << CAN_TDA_DATA2_SHIFT) -#define CAN_TDA_DATA3_SHIFT (16) /* Bits 16-23: RTR=0 && DLC >= 3 */ -#define CAN_TDA_DATA3_MASK (0x0ff << CAN_TDA_DATA3_SHIFT) -#define CAN_TDA_DATA4_SHIFT (24) /* Bits 24-31: RTR=0 && DLC >= 4 */ -#define CAN_TDA_DATA4_MASK (0x0ff << CAN_TDA_DATA4_SHIFT) - -/* Transmit data bytes 5-8 (Tx Buffer 1), Transmit data bytes 5-8 (Tx Buffer 2), and - * Transmit data bytes 5-8 (Tx Buffer 3) common bit field definitions. - */ - -#define CAN_RDB_DATA5_SHIFT (0) /* Bits 0-7: RTR=0 && DLC >= 5 */ -#define CAN_RDB_DATA5_MASK (0x0ff << CAN_RDB_DATA5_SHIFT) -#define CAN_RDB_DATA6_SHIFT (8) /* Bits 8-15: RTR=0 && DLC >= 6 */ -#define CAN_RDB_DATA6_MASK (0x0ff << CAN_RDB_DATA6_SHIFT) -#define CAN_RDB_DATA7_SHIFT (16) /* Bits 16-23: RTR=0 && DLC >= 7 */ -#define CAN_RDB_DATA7_MASK (0x0ff << CAN_RDB_DATA7_SHIFT) -#define CAN_RDB_DATA8_SHIFT (24) /* Bits 24-31: RTR=0 && DLC >= 8 */ -#define CAN_RDB_DATA8_MASK (0x0ff << CAN_RDB_DATA8_SHIFT) - -/************************************************************************************ +/**************************************************************************** * Public Types - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +/**************************************************************************** * Public Data - ************************************************************************************/ + ****************************************************************************/ -/************************************************************************************ +#ifndef __ASSEMBLY__ +#ifdef __cplusplus +extern "C" +{ +#endif + +/**************************************************************************** * Public Functions - ************************************************************************************/ + ****************************************************************************/ + +/**************************************************************************** + * Name: lpc17_caninitialize + * + * Description: + * Initialize the selected can port + * + * Input Parameter: + * Port number (for hardware that has mutiple can interfaces) + * + * Returned Value: + * Valid can device structure reference on succcess; a NULL on failure + * + ****************************************************************************/ + +#if defined(CONFIG_CAN) && (defined(CONFIG_LPC17_CAN1) || defined(CONFIG_LPC17_CAN2)) +struct can_dev_s; +FAR struct can_dev_s *lpc17_caninitialize(int port); +#endif + +#ifdef __cplusplus +} +#endif +#endif /* __ASSEMBLY__ */ #endif /* __ARCH_ARM_SRC_LPC17XX_LPC17_CAN_H */ diff --git a/nuttx/arch/arm/src/lpc17xx/lpc17_clockconfig.c b/nuttx/arch/arm/src/lpc17xx/lpc17_clockconfig.c index 635090e9f1..aba2079e4d 100644 --- a/nuttx/arch/arm/src/lpc17xx/lpc17_clockconfig.c +++ b/nuttx/arch/arm/src/lpc17xx/lpc17_clockconfig.c @@ -48,8 +48,8 @@ #include "up_arch.h" #include "up_internal.h" -#include "lpc17_internal.h" -#include "lpc17_syscon.h" +#include "lpc17_clockconfig.h" +#include "chip/lpc17_syscon.h" /**************************************************************************** * Pre-processor Definitions diff --git a/nuttx/arch/arm/src/lpc17xx/lpc17_clockconfig.h b/nuttx/arch/arm/src/lpc17xx/lpc17_clockconfig.h new file mode 100644 index 0000000000..ffc9fa88dd --- /dev/null +++ b/nuttx/arch/arm/src/lpc17xx/lpc17_clockconfig.h @@ -0,0 +1,84 @@ +/************************************************************************************ + * arch/arm/src/lpc17xx/lpc17_clockconfig.h + * + * Copyright (C) 2013 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * 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. + * + ************************************************************************************/ + +#ifndef __ARCH_ARM_SRC_LPC17XX_LPC17_CLOCKCONFIG_H +#define __ARCH_ARM_SRC_LPC17XX_LPC17_CLOCKCONFIG_H + +/************************************************************************************ + * Included Files + ************************************************************************************/ + +#include + +/************************************************************************************ + * Pre-processor Definitions + ************************************************************************************/ + +/************************************************************************************ + * Public Types + ************************************************************************************/ + +/************************************************************************************ + * Public Data + ************************************************************************************/ + +#ifndef __ASSEMBLY__ +#ifdef __cplusplus +extern "C" +{ +#endif + +/************************************************************************************ + * Public Functions + ************************************************************************************/ + +/************************************************************************************ + * Name: lpc17_clockconfig + * + * Description: + * Called to initialize the LPC17XX. This does whatever setup is needed to put the + * MCU in a usable state. This includes the initialization of clocking using the + * settings in board.h. + * + ************************************************************************************/ + +void lpc17_clockconfig(void); + +#ifdef __cplusplus +} +#endif +#endif /* __ASSEMBLY__ */ + +#endif /* __ARCH_ARM_SRC_LPC17XX_LPC17_CLOCKCONFIG_H */ diff --git a/nuttx/arch/arm/src/lpc17xx/lpc17_clrpend.c b/nuttx/arch/arm/src/lpc17xx/lpc17_clrpend.c index 242f7ac4ff..dcea79e7b0 100644 --- a/nuttx/arch/arm/src/lpc17xx/lpc17_clrpend.c +++ b/nuttx/arch/arm/src/lpc17xx/lpc17_clrpend.c @@ -44,7 +44,7 @@ #include "nvic.h" #include "up_arch.h" -#include "lpc17_internal.h" +#include "lpc17_clrpend.h" /**************************************************************************** * Definitions diff --git a/nuttx/arch/arm/src/lpc17xx/lpc17_clrpend.h b/nuttx/arch/arm/src/lpc17xx/lpc17_clrpend.h new file mode 100644 index 0000000000..d7bf5b90dc --- /dev/null +++ b/nuttx/arch/arm/src/lpc17xx/lpc17_clrpend.h @@ -0,0 +1,84 @@ +/************************************************************************************ + * arch/arm/src/lpc17xx/lpc17_clrpend.h + * + * Copyright (C) 2013 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * 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. + * + ************************************************************************************/ + +#ifndef __ARCH_ARM_SRC_LPC17XX_LPC17_CLRPEND_H +#define __ARCH_ARM_SRC_LPC17XX_LPC17_CLRPEND_H + +/************************************************************************************ + * Included Files + ************************************************************************************/ + +#include + +/************************************************************************************ + * Pre-processor Definitions + ************************************************************************************/ + +/************************************************************************************ + * Public Types + ************************************************************************************/ + +/************************************************************************************ + * Public Data + ************************************************************************************/ + +#ifndef __ASSEMBLY__ +#ifdef __cplusplus +extern "C" +{ +#endif + +/************************************************************************************ + * Public Functions + ************************************************************************************/ + +/************************************************************************************ + * Name: lpc17_clrpend + * + * Description: + * Clear a pending interrupt at the NVIC. This does not seem to be required + * for most interrupts. Don't know why... but the LPC1766 Ethernet EMAC + * interrupt definitely needs it! + * + ************************************************************************************/ + +void lpc17_clrpend(int irq); + +#ifdef __cplusplus +} +#endif +#endif /* __ASSEMBLY__ */ + +#endif /* __ARCH_ARM_SRC_LPC17XX_LPC17_CLRPEND_H */ diff --git a/nuttx/arch/arm/src/lpc17xx/lpc17_dac.c b/nuttx/arch/arm/src/lpc17xx/lpc17_dac.c index 13ac212f6e..87f49ba33e 100644 --- a/nuttx/arch/arm/src/lpc17xx/lpc17_dac.c +++ b/nuttx/arch/arm/src/lpc17xx/lpc17_dac.c @@ -60,9 +60,8 @@ #include "up_arch.h" #include "chip.h" -#include "lpc17_internal.h" -#include "lpc17_syscon.h" -#include "lpc17_pinconn.h" + +#include "chip/lpc17_syscon.h" #include "lpc17_dac.h" #ifdef CONFIG_LPC17_DAC diff --git a/nuttx/arch/arm/src/lpc17xx/lpc17_dac.h b/nuttx/arch/arm/src/lpc17xx/lpc17_dac.h index a35e16eae4..ac8477507c 100644 --- a/nuttx/arch/arm/src/lpc17xx/lpc17_dac.h +++ b/nuttx/arch/arm/src/lpc17xx/lpc17_dac.h @@ -1,7 +1,7 @@ /************************************************************************************ * arch/arm/src/lpc17xx/lpc17_dac.h * - * Copyright (C) 2010 Gregory Nutt. All rights reserved. + * Copyright (C) 2010, 2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -41,47 +41,12 @@ ************************************************************************************/ #include - -#include "chip.h" -#include "lpc17_memorymap.h" +#include "chip/lpc17_dac.h" /************************************************************************************ * Pre-processor Definitions ************************************************************************************/ -/* Register offsets *****************************************************************/ - -#define LPC17_DAC_CR_OFFSET 0x0000 /* D/A Converter Register */ -#define LPC17_DAC_CTRL_OFFSET 0x0004 /* DAC Control register */ -#define LPC17_DAC_CNTVAL_OFFSET 0x0008 /* DAC Counter Value register */ - -/* Register addresses ***************************************************************/ - -#define LPC17_DAC_CR (LPC17_DAC_BASE+LPC17_DAC_CR_OFFSET) -#define LPC17_DAC_CTRL (LPC17_DAC_BASE+LPC17_DAC_CTRL_OFFSET) -#define LPC17_DAC_CNTVAL (LPC17_DAC_BASE+LPC17_DAC_CNTVAL_OFFSET) - -/* Register bit definitions *********************************************************/ - -/* D/A Converter Register */ - /* Bits 0-5: Reserved */ -#define DAC_CR_VALUE_SHIFT (6) /* Bits 6-15: Controls voltage on the AOUT pin */ -#define DAC_CR_VALUE_MASK (0x3ff << DAC_CR_VALUE_SHIFT) -#define DAC_CR_BIAS (1 << 16) /* Bit 16: Controls DAC settling time */ - /* Bits 17-31: Reserved */ -/* DAC Control register */ - -#define DAC_CTRL_INTDMAREQ (1 << 0) /* Bit 0: Timer timed out */ -#define DAC_CTRL_DBLBUFEN (1 << 1) /* Bit 1: Enable DACR double-buffering */ -#define DAC_CTRL_CNTEN (1 << 2) /* Bit 2: Enable timeout counter */ -#define DAC_CTRL_DMAEN (1 << 3) /* Bit 3: Enable DMA access */ - /* Bits 4-31: Reserved */ -/* DAC Counter Value register */ - -#define DAC_CNTVAL_SHIFT (0) /* Bits 0-15: Reload value for DAC interrupt/DMA timer */ -#define DAC_CNTVAL_MASK (0xffff << DAC_CNTVAL_SHIFT) - /* Bits 8-31: Reserved */ - /************************************************************************************ * Public Types ************************************************************************************/ @@ -90,8 +55,34 @@ * Public Data ************************************************************************************/ +#ifndef __ASSEMBLY__ +#ifdef __cplusplus +extern "C" +{ +#endif + /************************************************************************************ * Public Functions ************************************************************************************/ +/**************************************************************************** + * Name: lpc17_dacinitialize + * + * Description: + * Initialize the DAC + * + * Returned Value: + * Valid dac device structure reference on succcess; a NULL on failure + * + ****************************************************************************/ + +#ifdef CONFIG_LPC17_DAC +FAR struct dac_dev_s *lpc17_dacinitialize(void); +#endif + +#ifdef __cplusplus +} +#endif +#endif /* __ASSEMBLY__ */ + #endif /* __ARCH_ARM_SRC_LPC17XX_LPC17_DAC_H */ diff --git a/nuttx/arch/arm/src/lpc17xx/lpc17_emacram.h b/nuttx/arch/arm/src/lpc17xx/lpc17_emacram.h index 700ad7ec32..84a7ebb15f 100644 --- a/nuttx/arch/arm/src/lpc17xx/lpc17_emacram.h +++ b/nuttx/arch/arm/src/lpc17xx/lpc17_emacram.h @@ -42,7 +42,7 @@ #include #include "chip.h" -#include "lpc17_memorymap.h" +#include "chip/lpc17_memorymap.h" /************************************************************************************ * Pre-processor Definitions diff --git a/nuttx/arch/arm/src/lpc17xx/lpc17_ethernet.c b/nuttx/arch/arm/src/lpc17xx/lpc17_ethernet.c index 47a22ec2ed..bf6d18287b 100644 --- a/nuttx/arch/arm/src/lpc17xx/lpc17_ethernet.c +++ b/nuttx/arch/arm/src/lpc17xx/lpc17_ethernet.c @@ -57,12 +57,13 @@ #include #include -#include "chip.h" #include "up_arch.h" -#include "lpc17_syscon.h" +#include "chip.h" +#include "chip/lpc17_syscon.h" +#include "lpc17_gpio.h" #include "lpc17_ethernet.h" #include "lpc17_emacram.h" -#include "lpc17_internal.h" +#include "lpc17_clrpend.h" #include diff --git a/nuttx/arch/arm/src/lpc17xx/lpc17_ethernet.h b/nuttx/arch/arm/src/lpc17xx/lpc17_ethernet.h index f48c6d9539..77ce1cc0f4 100644 --- a/nuttx/arch/arm/src/lpc17xx/lpc17_ethernet.h +++ b/nuttx/arch/arm/src/lpc17xx/lpc17_ethernet.h @@ -1,7 +1,7 @@ /************************************************************************************ * arch/arm/src/lpc17xx/lpc17_ethernet.h * - * Copyright (C) 2010 Gregory Nutt. All rights reserved. + * Copyright (C) 2010, 2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -41,547 +41,12 @@ ************************************************************************************/ #include - -#include "chip.h" -#include "lpc17_memorymap.h" +#include "chip/lpc17_ethernet.h" /************************************************************************************ * Pre-processor Definitions ************************************************************************************/ -/* Register offsets *****************************************************************/ -/* MAC registers */ - -#define LPC17_ETH_MAC1_OFFSET 0x0000 /* MAC configuration register 1 */ -#define LPC17_ETH_MAC2_OFFSET 0x0004 /* MAC configuration register 2 */ -#define LPC17_ETH_IPGT_OFFSET 0x0008 /* Back-to-Back Inter-Packet-Gap register */ -#define LPC17_ETH_IPGR_OFFSET 0x000c /* Non Back-to-Back Inter-Packet-Gap register */ -#define LPC17_ETH_CLRT_OFFSET 0x0010 /* Collision window / Retry register */ -#define LPC17_ETH_MAXF_OFFSET 0x0014 /* Maximum Frame register */ -#define LPC17_ETH_SUPP_OFFSET 0x0018 /* PHY Support register */ -#define LPC17_ETH_TEST_OFFSET 0x001c /* Test register */ -#define LPC17_ETH_MCFG_OFFSET 0x0020 /* MII Mgmt Configuration register */ -#define LPC17_ETH_MCMD_OFFSET 0x0024 /* MII Mgmt Command register */ -#define LPC17_ETH_MADR_OFFSET 0x0028 /* MII Mgmt Address register */ -#define LPC17_ETH_MWTD_OFFSET 0x002c /* MII Mgmt Write Data register */ -#define LPC17_ETH_MRDD_OFFSET 0x0030 /* MII Mgmt Read Data register */ -#define LPC17_ETH_MIND_OFFSET 0x0034 /* MII Mgmt Indicators register */ -#define LPC17_ETH_SA0_OFFSET 0x0040 /* Station Address 0 register */ -#define LPC17_ETH_SA1_OFFSET 0x0044 /* Station Address 1 register */ -#define LPC17_ETH_SA2_OFFSET 0x0048 /* Station Address 2 register */ - -/* Control registers */ - -#define LPC17_ETH_CMD_OFFSET 0x0100 /* Command register */ -#define LPC17_ETH_STAT_OFFSET 0x0104 /* Status register */ -#define LPC17_ETH_RXDESC_OFFSET 0x0108 /* Receive descriptor base address register */ -#define LPC17_ETH_RXSTAT_OFFSET 0x010c /* Receive status base address register */ -#define LPC17_ETH_RXDESCNO_OFFSET 0x0110 /* Receive number of descriptors register */ -#define LPC17_ETH_RXPRODIDX_OFFSET 0x0114 /* Receive produce index register */ -#define LPC17_ETH_RXCONSIDX_OFFSET 0x0118 /* Receive consume index register */ -#define LPC17_ETH_TXDESC_OFFSET 0x011c /* Transmit descriptor base address register */ -#define LPC17_ETH_TXSTAT_OFFSET 0x0120 /* Transmit status base address register */ -#define LPC17_ETH_TXDESCRNO_OFFSET 0x0124 /* Transmit number of descriptors register */ -#define LPC17_ETH_TXPRODIDX_OFFSET 0x0128 /* Transmit produce index register */ -#define LPC17_ETH_TXCONSIDX_OFFSET 0x012c /* Transmit consume index register */ -#define LPC17_ETH_TSV0_OFFSET 0x0158 /* Transmit status vector 0 register */ -#define LPC17_ETH_TSV1_OFFSET 0x015c /* Transmit status vector 1 register */ -#define LPC17_ETH_RSV_OFFSET 0x0160 /* Receive status vector register */ -#define LPC17_ETH_FCCNTR_OFFSET 0x0170 /* Flow control counter register */ -#define LPC17_ETH_FCSTAT_OFFSET 0x0174 /* Flow control status register */ - -/* Rx filter registers */ - -#define LPC17_ETH_RXFLCTRL_OFFSET 0x0200 /* Receive filter control register */ -#define LPC17_ETH_RXFLWOLST_OFFSET 0x0204 /* Receive filter WoL status register */ -#define LPC17_ETH_RXFLWOLCLR_OFFSET 0x0208 /* Receive filter WoL clear register */ -#define LPC17_ETH_HASHFLL_OFFSET 0x0210 /* Hash filter table LSBs register */ -#define LPC17_ETH_HASHFLH_OFFSET 0x0214 /* Hash filter table MSBs register */ - -/* Module control registers */ - -#define LPC17_ETH_INTST_OFFSET 0x0fe0 /* Interrupt status register */ -#define LPC17_ETH_INTEN_OFFSET 0x0fe4 /* Interrupt enable register */ -#define LPC17_ETH_INTCLR_OFFSET 0x0fe8 /* Interrupt clear register */ -#define LPC17_ETH_INTSET_OFFSET 0x0fec /* Interrupt set register */ -#define LPC17_ETH_PWRDOWN_OFFSET 0x0ff4 /* Power-down register */ - -/* Register addresses ***************************************************************/ -/* MAC registers */ - -#define LPC17_ETH_MAC1 (LPC17_ETH_BASE+LPC17_ETH_MAC1_OFFSET) -#define LPC17_ETH_MAC2 (LPC17_ETH_BASE+LPC17_ETH_MAC2_OFFSET) -#define LPC17_ETH_IPGT (LPC17_ETH_BASE+LPC17_ETH_IPGT_OFFSET) -#define LPC17_ETH_IPGR (LPC17_ETH_BASE+LPC17_ETH_IPGR_OFFSET) -#define LPC17_ETH_CLRT (LPC17_ETH_BASE+LPC17_ETH_CLRT_OFFSET) -#define LPC17_ETH_MAXF (LPC17_ETH_BASE+LPC17_ETH_MAXF_OFFSET) -#define LPC17_ETH_SUPP (LPC17_ETH_BASE+LPC17_ETH_SUPP_OFFSET) -#define LPC17_ETH_TEST (LPC17_ETH_BASE+LPC17_ETH_TEST_OFFSET) -#define LPC17_ETH_MCFG (LPC17_ETH_BASE+LPC17_ETH_MCFG_OFFSET) -#define LPC17_ETH_MCMD (LPC17_ETH_BASE+LPC17_ETH_MCMD_OFFSET) -#define LPC17_ETH_MADR (LPC17_ETH_BASE+LPC17_ETH_MADR_OFFSET) -#define LPC17_ETH_MWTD (LPC17_ETH_BASE+LPC17_ETH_MWTD_OFFSET) -#define LPC17_ETH_MRDD (LPC17_ETH_BASE+LPC17_ETH_MRDD_OFFSET) -#define LPC17_ETH_MIND (LPC17_ETH_BASE+LPC17_ETH_MIND_OFFSET) -#define LPC17_ETH_SA0 (LPC17_ETH_BASE+LPC17_ETH_SA0_OFFSET) -#define LPC17_ETH_SA1 (LPC17_ETH_BASE+LPC17_ETH_SA1_OFFSET) -#define LPC17_ETH_SA2 (LPC17_ETH_BASE+LPC17_ETH_SA2_OFFSET) - -/* Control registers */ - -#define LPC17_ETH_CMD (LPC17_ETH_BASE+LPC17_ETH_CMD_OFFSET) -#define LPC17_ETH_STAT (LPC17_ETH_BASE+LPC17_ETH_STAT_OFFSET) -#define LPC17_ETH_RXDESC (LPC17_ETH_BASE+LPC17_ETH_RXDESC_OFFSET) -#define LPC17_ETH_RXSTAT (LPC17_ETH_BASE+LPC17_ETH_RXSTAT_OFFSET) -#define LPC17_ETH_RXDESCNO (LPC17_ETH_BASE+LPC17_ETH_RXDESCNO_OFFSET) -#define LPC17_ETH_RXPRODIDX (LPC17_ETH_BASE+LPC17_ETH_RXPRODIDX_OFFSET) -#define LPC17_ETH_RXCONSIDX (LPC17_ETH_BASE+LPC17_ETH_RXCONSIDX_OFFSET) -#define LPC17_ETH_TXDESC (LPC17_ETH_BASE+LPC17_ETH_TXDESC_OFFSET) -#define LPC17_ETH_TXSTAT (LPC17_ETH_BASE+LPC17_ETH_TXSTAT_OFFSET) -#define LPC17_ETH_TXDESCRNO (LPC17_ETH_BASE+LPC17_ETH_TXDESCRNO_OFFSET) -#define LPC17_ETH_TXPRODIDX (LPC17_ETH_BASE+LPC17_ETH_TXPRODIDX_OFFSET) -#define LPC17_ETH_TXCONSIDX (LPC17_ETH_BASE+LPC17_ETH_TXCONSIDX_OFFSET) -#define LPC17_ETH_TSV0 (LPC17_ETH_BASE+LPC17_ETH_TSV0_OFFSET) -#define LPC17_ETH_TSV1 (LPC17_ETH_BASE+LPC17_ETH_TSV1_OFFSET) -#define LPC17_ETH_RSV (LPC17_ETH_BASE+LPC17_ETH_RSV_OFFSET) -#define LPC17_ETH_FCCNTR (LPC17_ETH_BASE+LPC17_ETH_FCCNTR_OFFSET) -#define LPC17_ETH_FCSTAT (LPC17_ETH_BASE+LPC17_ETH_FCSTAT_OFFSET) - -/* Rx filter registers */ - -#define LPC17_ETH_RXFLCTRL (LPC17_ETH_BASE+LPC17_ETH_RXFLCTRL_OFFSET) -#define LPC17_ETH_RXFLWOLST (LPC17_ETH_BASE+LPC17_ETH_RXFLWOLST_OFFSET) -#define LPC17_ETH_RXFLWOLCLR (LPC17_ETH_BASE+LPC17_ETH_RXFLWOLCLR_OFFSET) -#define LPC17_ETH_HASHFLL (LPC17_ETH_BASE+LPC17_ETH_HASHFLL_OFFSET) -#define LPC17_ETH_HASHFLH (LPC17_ETH_BASE+LPC17_ETH_HASHFLH_OFFSET) - -/* Module control registers */ - -#define LPC17_ETH_INTST (LPC17_ETH_BASE+LPC17_ETH_INTST_OFFSET) -#define LPC17_ETH_INTEN (LPC17_ETH_BASE+LPC17_ETH_INTEN_OFFSET) -#define LPC17_ETH_INTCLR (LPC17_ETH_BASE+LPC17_ETH_INTCLR_OFFSET) -#define LPC17_ETH_INTSET (LPC17_ETH_BASE+LPC17_ETH_INTSET_OFFSET) -#define LPC17_ETH_PWRDOWN (LPC17_ETH_BASE+LPC17_ETH_PWRDOWN_OFFSET) - -/* Register bit definitions *********************************************************/ -/* MAC registers */ -/* MAC configuration register 1 (MAC1) */ - -#define ETH_MAC1_RE (1 << 0) /* Bit 0: Receive enable */ -#define ETH_MAC1_PARF (1 << 1) /* Bit 1: Passall all receive frames */ -#define ETH_MAC1_RFC (1 << 2) /* Bit 2: RX flow control */ -#define ETH_MAC1_TFC (1 << 3) /* Bit 3: TX flow control */ -#define ETH_MAC1_LPBK (1 << 4) /* Bit 4: Loopback */ - /* Bits 5-7: Reserved */ -#define ETH_MAC1_TXRST (1 << 8) /* Bit 8: Reset TX */ -#define ETH_MAC1_MCSTXRST (1 << 9) /* Bit 9: Reset MCS/TX */ -#define ETH_MAC1_RXRST (1 << 10) /* Bit 10: Reset RX */ -#define ETH_MAC1_MCSRXRST (1 << 11) /* Bit 11: Reset MCS/RX */ - /* Bits 12-13: Reserved */ -#define ETH_MAC1_SIMRST (1 << 14) /* Bit 14: Simulation reset */ -#define ETH_MAC1_SOFTRST (1 << 15) /* Bit 15: Soft reset */ - /* Bits 16-31: Reserved */ -/* MAC configuration register 2 (MAC2) */ - -#define ETH_MAC2_FD (1 << 0) /* Bit 0: Full duplex */ -#define ETH_MAC2_FLC (1 << 1) /* Bit 1: Frame length checking */ -#define ETH_MAC2_HFE (1 << 2) /* Bit 2: Huge frame enable */ -#define ETH_MAC2_DCRC (1 << 3) /* Bit 3: Delayed CRC */ -#define ETH_MAC2_CRCEN (1 << 4) /* Bit 4: CRC enable */ -#define ETH_MAC2_PADCRCEN (1 << 5) /* Bit 5: Pad/CRC enable */ -#define ETH_MAC2_VLANPADEN (1 << 6) /* Bit 6: VLAN pad enable */ -#define ETH_MAC2_AUTOPADEN (1 << 7) /* Bit 7: Auto detect pad enable */ -#define ETH_MAC2_PPE (1 << 8) /* Bit 8: Pure preamble enforcement */ -#define ETH_MAC2_LPE (1 << 9) /* Bit 9: Long preamble enforcement */ - /* Bits 10-11: Reserved */ -#define ETH_MAC2_NBKOFF (1 << 12) /* Bit 12: No backoff */ -#define ETH_MAC2_BPNBKOFF (1 << 13) /* Bit 13: Back pressure/no backoff */ -#define ETH_MAC2_EXDEF (1 << 14) /* Bit 14: Excess defer */ - /* Bits 15-31: Reserved */ -/* Back-to-Back Inter-Packet-Gap register (IPGT) */ - -#define ETH_IPGT_SHIFT (0) /* Bits 0-6 */ -#define ETH_IPGT_MASK (0x7f << ETH_IPGT_SHIFT) - /* Bits 7-31: Reserved */ -/* Non Back-to-Back Inter-Packet-Gap register (IPGR) */ - -#define ETH_IPGR_GAP2_SHIFT (0) /* Bits 0-6: Gap part 2 */ -#define ETH_IPGR_GAP2_MASK (0x7f << ETH_IPGR_GAP2_SHIFT) - /* Bit 7: Reserved */ -#define ETH_IPGR_GAP1_SHIFT (8) /* Bits 8-18: Gap part 1 */ -#define ETH_IPGR_GAP1_MASK (0x7f << ETH_IPGR_GAP2_SHIFT) - /* Bits 15-31: Reserved */ -/* Collision window / Retry register (CLRT) */ - -#define ETH_CLRT_RMAX_SHIFT (0) /* Bits 0-3: Retransmission maximum */ -#define ETH_CLRT_RMAX_MASK (15 << ETH_CLRT_RMAX_SHIFT) - /* Bits 4-7: Reserved */ -#define ETH_CLRT_COLWIN_SHIFT (8) /* Bits 8-13: Collision window */ -#define ETH_CLRT_COLWIN_MASK (0x3f << ETH_CLRT_COLWIN_SHIFT) - /* Bits 14-31: Reserved */ -/* Maximum Frame register (MAXF) */ - -#define ETH_MAXF_SHIFT (0) /* Bits 0-15 */ -#define ETH_MAXF_MASK (0xffff << ETH_MAXF_SHIFT) - /* Bits 16-31: Reserved */ -/* PHY Support register (SUPP) */ - /* Bits 0-7: Reserved */ -#define ETH_SUPP_SPEED (1 << 8) /* Bit 8: 0=10Bps 1=100Bps */ - /* Bits 9-31: Reserved */ -/* Test register (TEST) */ - -#define ETH_TEST_SPQ (1 << 0) /* Bit 0: Shortcut pause quanta */ -#define ETH_TEST_TP (1 << 1) /* Bit 1: Test pause */ -#define ETH_TEST_TBP (1 << 2) /* Bit 2: Test packpressure */ - /* Bits 3-31: Reserved */ -/* MII Mgmt Configuration register (MCFG) */ - -#define ETH_MCFG_SCANINC (1 << 0) /* Bit 0: Scan increment */ -#define ETH_MCFG_SUPPRE (1 << 1) /* Bit 1: Suppress preamble */ -#define ETH_MCFG_CLKSEL_SHIFT (2) /* Bits 2-5: Clock select */ -#define ETH_MCFG_CLKSEL_MASK (15 << ETH_MCFG_CLKSEL_SHIFT) -# define ETH_MCFG_CLKSEL_DIV4 (0 << ETH_MCFG_CLKSEL_SHIFT) -# define ETH_MCFG_CLKSEL_DIV6 (2 << ETH_MCFG_CLKSEL_SHIFT) -# define ETH_MCFG_CLKSEL_DIV8 (3 << ETH_MCFG_CLKSEL_SHIFT) -# define ETH_MCFG_CLKSEL_DIV10 (4 << ETH_MCFG_CLKSEL_SHIFT) -# define ETH_MCFG_CLKSEL_DIV14 (5 << ETH_MCFG_CLKSEL_SHIFT) -# define ETH_MCFG_CLKSEL_DIV20 (6 << ETH_MCFG_CLKSEL_SHIFT) -# define ETH_MCFG_CLKSEL_DIV28 (7 << ETH_MCFG_CLKSEL_SHIFT) -# define ETH_MCFG_CLKSEL_DIV36 (8 << ETH_MCFG_CLKSEL_SHIFT) -# define ETH_MCFG_CLKSEL_DIV40 (9 << ETH_MCFG_CLKSEL_SHIFT) -# define ETH_MCFG_CLKSEL_DIV44 (10 << ETH_MCFG_CLKSEL_SHIFT) -# define ETH_MCFG_CLKSEL_DIV48 (11 << ETH_MCFG_CLKSEL_SHIFT) -# define ETH_MCFG_CLKSEL_DIV52 (12 << ETH_MCFG_CLKSEL_SHIFT) -# define ETH_MCFG_CLKSEL_DIV56 (13 << ETH_MCFG_CLKSEL_SHIFT) -# define ETH_MCFG_CLKSEL_DIV60 (14 << ETH_MCFG_CLKSEL_SHIFT) -# define ETH_MCFG_CLKSEL_DIV64 (15 << ETH_MCFG_CLKSEL_SHIFT) - /* Bits 6-14: Reserved */ -#define ETH_MCFG_MIIRST (1 << 15) /* Bit 15: Reset MII mgmt */ - /* Bits 16-31: Reserved */ -/* MII Mgmt Command register (MCMD) */ - -#define ETH_MCMD_READ (1 << 0) /* Bit 0: Single read cycle */ -#define ETH_MCMD_SCAN (1 << 1) /* Bit 1: Continuous read cycles */ - /* Bits 2-31: Reserved */ -#define ETH_MCMD_WRITE (0) - -/* MII Mgmt Address register (MADR) */ - -#define ETH_MADR_REGADDR_SHIFT (0) /* Bits 0-4: Register address */ -#define ETH_MADR_REGADDR_MASK (31 << ETH_MADR_REGADDR_SHIFT) - /* Bits 7-5: Reserved */ -#define ETH_MADR_PHYADDR_SHIFT (8) /* Bits 8-12: PHY address */ -#define ETH_MADR_PHYADDR_MASK (31 << ETH_MADR_PHYADDR_SHIFT) - /* Bits 13-31: Reserved */ -/* MII Mgmt Write Data register (MWTD) */ - -#define ETH_MWTD_SHIFT (0) /* Bits 0-15 */ -#define ETH_MWTD_MASK (0xffff << ETH_MWTD_SHIFT) - /* Bits 16-31: Reserved */ -/* MII Mgmt Read Data register (MRDD) */ - -#define ETH_MRDD_SHIFT (0) /* Bits 0-15 */ -#define ETH_MRDD_MASK (0xffff << ETH_MRDD_SHIFT) - /* Bits 16-31: Reserved */ -/* MII Mgmt Indicators register (MIND) */ - -#define ETH_MIND_BUSY (1 << 0) /* Bit 0: Busy */ -#define ETH_MIND_SCANNING (1 << 1) /* Bit 1: Scanning */ -#define ETH_MIND_NVALID (1 << 2) /* Bit 2: Not valid */ -#define ETH_MIND_MIIFAIL (1 << 3) /* Bit 3: MII link fail */ - /* Bits 4-31: Reserved */ -/* Station Address 0 register (SA0) */ - -#define ETH_SA0_OCTET2_SHIFT (0) /* Bits 0-7: Station address 2nd octet */ -#define ETH_SA0_OCTET2_MASK (0xff << ETH_SA0_OCTET2_SHIFT) -#define ETH_SA0_OCTET1_SHIFT (8) /* Bits 8-15: Station address 1st octet */ -#define ETH_SA0_OCTET1_MASK (0xff << ETH_SA0_OCTET1_SHIFT) - /* Bits 16-31: Reserved */ -/* Station Address 1 register (SA1) */ - -#define ETH_SA1_OCTET4_SHIFT (0) /* Bits 0-7: Station address 4th octet */ -#define ETH_SA1_OCTET4_MASK (0xff << ETH_SA0_OCTET4_SHIFT) -#define ETH_SA1_OCTET3_SHIFT (8) /* Bits 8-15: Station address 3rd octet */ -#define ETH_SA1_OCTET3_MASK (0xff << ETH_SA0_OCTET3_SHIFT) - /* Bits 16-31: Reserved */ -/* Station Address 2 register (SA2) */ - -#define ETH_SA2_OCTET6_SHIFT (0) /* Bits 0-7: Station address 5th octet */ -#define ETH_SA2_OCTET6_MASK (0xff << ETH_SA0_OCTET6_SHIFT) -#define ETH_SA2_OCTET5_SHIFT (8) /* Bits 8-15: Station address 6th octet */ -#define ETH_SA2_OCTET5_MASK (0xff << ETH_SA0_OCTET5_SHIFT) - /* Bits 16-31: Reserved */ -/* Control registers */ -/* Command register (CMD) */ - -#define ETH_CMD_RXEN (1 << 0) /* Bit 0: Receive enable */ -#define ETH_CMD_TXEN (1 << 1) /* Bit 1: Transmit enable */ - /* Bit 2: Reserved */ -#define ETH_CMD_REGRST (1 << 3) /* Bit 3: Reset host registers */ -#define ETH_CMD_TXRST (1 << 4) /* Bit 4: Reset transmit datapath */ -#define ETH_CMD_RXRST (1 << 5) /* Bit 5: Reset receive datapath */ -#define ETH_CMD_PRFRAME (1 << 6) /* Bit 6: Pass run frame */ -#define ETH_CMD_PRFILTER (1 << 7) /* Bit 7: Pass RX filter */ -#define ETH_CMD_TXFC (1 << 8) /* Bit 8: TX flow control */ -#define ETH_CMD_RMII (1 << 9) /* Bit 9: RMII mode */ -#define ETH_CMD_FD (1 << 10) /* Bit 10: Full duplex */ - /* Bits 11-31: Reserved */ -/* Status register */ - -#define ETH_STAT_RX (1 << 0) /* Bit 0: RX status */ -#define ETH_STAT_TX (1 << 1) /* Bit 1: TX status */ - /* Bits 2-31: Reserved */ -/* Receive descriptor base address register (RXDESC) - * - * The receive descriptor base address is a byte address aligned to a word - * boundary i.e. LSB 1:0 are fixed to 00. The register contains the lowest - * address in the array of descriptors. - */ - -/* Receive status base address register (RXSTAT) - * - * The receive status base address is a byte address aligned to a double word - * boundary i.e. LSB 2:0 are fixed to 000. - */ - -/* Receive number of descriptors register (RXDESCNO) */ - -#define ETH_RXDESCNO_SHIFT (0) /* Bits 0-15 */ -#define ETH_RXDESCNO_MASK (0xffff << ETH_RXDESCNO_SHIFT) - /* Bits 16-31: Reserved */ -/* Receive produce index register (RXPRODIDX) */ - -#define ETH_RXPRODIDX_SHIFT (0) /* Bits 0-15 */ -#define ETH_RXPRODIDX_MASK (0xffff << ETH_RXPRODIDX_SHIFT) - /* Bits 16-31: Reserved */ -/* Receive consume index register (RXCONSIDX) */ - -#define ETH_RXCONSIDX_SHIFT (0) /* Bits 0-15 */ -#define ETH_RXCONSIDX_MASK (0xffff << ETH_RXPRODIDX_SHIFT) - /* Bits 16-31: Reserved */ -/* Transmit descriptor base address register (TXDESC) - * - * The transmit descriptor base address is a byte address aligned to a word - * boundary i.e. LSB 1:0 are fixed to 00. The register contains the lowest - * address in the array of descriptors. - */ - -/* Transmit status base address register (TXSTAT) - * - * The transmit status base address is a byte address aligned to a word - * boundary i.e. LSB1:0 are fixed to 00. The register contains the lowest - * address in the array of statuses. - */ - -/* Transmit number of descriptors register (TXDESCRNO) */ - -#define ETH_TXDESCRNO_SHIFT (0) /* Bits 0-15 */ -#define ETH_TXDESCRNO_MASK (0xffff << ETH_TXDESCRNO_SHIFT) - /* Bits 16-31: Reserved */ -/* Transmit produce index register (TXPRODIDX) */ - -#define ETH_TXPRODIDX_SHIFT (0) /* Bits 0-15 */ -#define ETH_TXPRODIDX_MASK (0xffff << ETH_TXPRODIDX_SHIFT) - /* Bits 16-31: Reserved */ -/* Transmit consume index register (TXCONSIDX) */ - -#define ETH_TXCONSIDX_SHIFT (0) /* Bits 0-15 */ -#define ETH_TXCONSIDX_MASK (0xffff << ETH_TXPRODIDX_SHIFT) - /* Bits 16-31: Reserved */ -/* Transmit status vector 0 register (TSV0) */ - -#define ETH_TSV0_CRCERR (1 << 0) /* Bit 0: CRC error */ -#define ETH_TSV0_LENCHKERR (1 << 1) /* Bit 1: Length check error */ -#define ETH_TSV0_LENOOR (1 << 2) /* Bit 2: Length out of range */ -#define ETH_TSV0_DONE (1 << 3) /* Bit 3: Done */ -#define ETH_TSV0_MCAST (1 << 4) /* Bit 4: Multicast */ -#define ETH_TSV0_BCAST (1 << 5) /* Bit 5: Broadcast */ -#define ETH_TSV0_PKTDEFER (1 << 6) /* Bit 6: Packet Defer */ -#define ETH_TSV0_EXCDEFER (1 << 7) /* Bit 7: Excessive Defer */ -#define ETH_TSV0_EXCCOL (1 << 8) /* Bit 8: Excessive Collision */ -#define ETH_TSV0_LATECOL (1 << 9) /* Bit 9: Late Collision */ -#define ETH_TSV0_GIANT (1 << 10) /* Bit 10: Giant */ -#define ETH_TSV0_UNDRUN (1 << 11) /* Bit 11: Underrun */ -#define ETH_TSV0_TOTBYTES_SHIFT (12) /* Bits 12-27:Total bytes */ -#define ETH_TSV0_TOTBYTES_MASK (0xffff << ETH_TSV0_TOTBYTES_SHIFT) -#define ETH_TSV0_CTLFRAME (1 << 28) /* Bit 28: Control frame */ -#define ETH_TSV0_PAUSE (1 << 29) /* Bit 29: Pause */ -#define ETH_TSV0_BP (1 << 30) /* Bit 30: Backpressure */ -#define ETH_TSV0_VLAN (1 << 31) /* Bit 31: VLAN */ - -/* Transmit status vector 1 register (TSV1) */ - -#define ETH_TSV1_TXCNT_SHIFT (0) /* Bits 0-15: Transmit byte count */ -#define ETH_TSV1_TXCNT_MASK (0xffff << ETH_TSV1_TXCNT_SHIFT) -#define ETH_TSV1_COLCNT_SHIFT (16) /* Bits 16-19: Transmit collision count */ -#define ETH_TSV1_COLCNT_MASK (15 << ETH_TSV1_COLCNT_SHIFT) - /* Bits 20-31: Reserved */ -/* Receive status vector register (RSV) */ - -#define ETH_RSV_RXCNT_SHIFT (0) /* Bits 0-15: Received byte count */ -#define ETH_RSV_RXCNT_MASK (0xffff << ETH_RSV_RXCNT_SHIFT) -#define ETH_RSV_PKTPI (1 << 16) /* Bit 16: Packet previously ignored */ -#define ETH_RSV_RXEPS (1 << 17) /* Bit 17: RXDV event previously seen */ -#define ETH_RSV_CEPS (1 << 18) /* Bit 18: Carrier event previously seen */ -#define ETH_RSV_RXCV (1 << 19) /* Bit 19: Receive code violation */ -#define ETH_RSV_CRCERR (1 << 20) /* Bit 20: CRC error */ -#define ETH_RSV_LENCHKERR (1 << 21) /* Bit 21: Length check error */ -#define ETH_RSV_LENOOR (1 << 22) /* Bit 22: Length out of range */ -#define ETH_RSV_RXOK (1 << 23) /* Bit 23: Receive OK */ -#define ETH_RSV_MCAST (1 << 24) /* Bit 24: Multicast */ -#define ETH_RSV_BCAST (1 << 25) /* Bit 25: Broadcast */ -#define ETH_RSV_DRIBNIB (1 << 26) /* Bit 26: Dribble Nibble */ -#define ETH_RSV_CTLFRAME (1 << 27) /* Bit 27: Control frame */ -#define ETH_RSV_PAUSE (1 << 28) /* Bit 28: Pause */ -#define ETH_RSV_UNSUPOP (1 << 29) /* Bit 29: Unsupported Opcode */ -#define ETH_RSV_VLAN (1 << 30) /* Bit 30: VLAN */ - /* Bit 31: Reserved */ -/* Flow control counter register (FCCNTR) */ - -#define ETH_FCCNTR_MCOUNT_SHIFT (0) /* Bits 0-15: Mirror count */ -#define ETH_FCCNTR_MCOUNT_MASK (0xffff << ETH_FCCNTR_MCOUNT_SHIFT) -#define ETH_FCCNTR_PTMR_SHIFT (16) /* Bits 16-31: Pause timer */ -#define ETH_FCCNTR_PTMR_MASK (0xffff << ETH_FCCNTR_PTMR_SHIFT) - -/* Flow control status register (FCSTAT) */ - -#define ETH_FCSTAT_MCOUNT_SHIFT (0) /* Bits 0-15: Current mirror count */ -#define ETH_FCSTAT_MCOUNT_MASK (0xffff << ETH_FCSTAT_MCOUNT_SHIFT) - /* Bits 16-31: Reserved */ -/* Rx filter registers */ -/* Receive filter control register (RXFLCTRL) */ - -#define ETH_RXFLCTRL_UCASTEN (1 << 0) /* Bit 0: Accept all unicast frames */ -#define ETH_RXFLCTRL_BCASTEN (1 << 1) /* Bit 1: Accept all broadcast frames */ -#define ETH_RXFLCTRL_MCASTEN (1 << 2) /* Bit 2: Accept all multicast frames */ -#define ETH_RXFLCTRL_UCASTHASHEN (1 << 3) /* Bit 3: Accept hashed unicast */ -#define ETH_RXFLCTRL_MCASTHASHEN (1 << 4) /* Bit 4: Accect hashed multicast */ -#define ETH_RXFLCTRL_PERFEN (1 << 5) /* Bit 5: Accept perfect dest match */ - /* Bits 6-11: Reserved */ -#define ETH_RXFLCTRL_MPKTEN (1 << 12) /* Bit 12: Magic pkt filter WoL int */ -#define ETH_RXFLCTRL_RXFILEN (1 << 13) /* Bit 13: Perfect match WoL interrupt */ - /* Bits 14-31: Reserved */ -/* Receive filter WoL status register (RXFLWOLST) AND - * Receive filter WoL clear register (RXFLWOLCLR) - */ - -#define ETH_RXFLWOL_UCAST (1 << 0) /* Bit 0: Unicast frame WoL */ -#define ETH_RXFLWOL_BCAST (1 << 1) /* Bit 1: Broadcast frame WoL */ -#define ETH_RXFLWOL_MCAST (1 << 2) /* Bit 2: Multicast frame WoL */ -#define ETH_RXFLWOL_UCASTHASH (1 << 3) /* Bit 3: Unicast hash filter WoL */ -#define ETH_RXFLWOL_MCASTHASH (1 << 4) /* Bit 4: Multiicast hash filter WoL */ -#define ETH_RXFLWOL_PERF (1 << 5) /* Bit 5: Perfect addr match WoL */ - /* Bit 6: Reserved */ -#define ETH_RXFLWOL_RXFIL (1 << 7) /* Bit 7: Receive filter WoL */ -#define ETH_RXFLWOL_MPKT (1 << 8) /* Bit 8: Magic pkt filter WoL */ - /* Bits 9-31: Reserved */ -/* Hash filter table LSBs register (HASHFLL) AND Hash filter table MSBs register -* (HASHFLH) Are registers containing a 32-bit value with no bitfield. - */ - -/* Module control registers */ -/* Interrupt status register (INTST), Interrupt enable register (INTEN), Interrupt - * clear register (INTCLR), and Interrupt set register (INTSET) common bit field - * definition: - */ - -#define ETH_INT_RXOVR (1 << 0) /* Bit 0: RX overrun interrupt */ -#define ETH_INT_RXERR (1 << 1) /* Bit 1: RX error interrupt */ -#define ETH_INT_RXFIN (1 << 2) /* Bit 2: RX finished interrupt */ -#define ETH_INT_RXDONE (1 << 3) /* Bit 3: RX done interrupt */ -#define ETH_INT_TXUNR (1 << 4) /* Bit 4: TX underrun interrupt */ -#define ETH_INT_TXERR (1 << 5) /* Bit 5: TX error interrupt */ -#define ETH_INT_TXFIN (1 << 6) /* Bit 6: TX finished interrupt */ -#define ETH_INT_TXDONE (1 << 7) /* Bit 7: TX done interrupt */ - /* Bits 8-11: Reserved */ -#define ETH_INT_SOFT (1 << 12) /* Bit 12: Soft interrupt */ -#define ETH_INT_WKUP (1 << 13) /* Bit 13: Wakeup interrupt */ - /* Bits 14-31: Reserved */ -/* Power-down register */ - /* Bits 0-30: Reserved */ -#define ETH_PWRDOWN_MACAHB (1 << 31) /* Power down MAC/AHB */ - -/* Descriptors Offsets **************************************************************/ - -/* Tx descriptor offsets */ - -#define LPC17_TXDESC_PACKET 0x00 /* Base address of the Tx data buffer */ -#define LPC17_TXDESC_CONTROL 0x04 /* Control Information */ -#define LPC17_TXDESC_SIZE 0x08 /* Size in bytes of one Tx descriptor */ - -/* Tx status offsets */ - -#define LPC17_TXSTAT_INFO 0x00 /* Transmit status return flags */ -#define LPC17_TXSTAT_SIZE 0x04 /* Size in bytes of one Tx status */ - -/* Rx descriptor offsets */ - -#define LPC17_RXDESC_PACKET 0x00 /* Base address of the Rx data buffer */ -#define LPC17_RXDESC_CONTROL 0x04 /* Control Information */ -#define LPC17_RXDESC_SIZE 0x08 /* Size in bytes of one Rx descriptor */ - -/* Rx status offsets */ - -#define LPC17_RXSTAT_INFO 0x00 /* Receive status return flags */ -#define LPC17_RXSTAT_HASHCRC 0x04 /* Dest and source hash CRC */ -#define LPC17_RXSTAT_SIZE 0x08 /* Size in bytes of one Rx status */ - -/* Descriptor Bit Definitions *******************************************************/ - -/* Tx descriptor bit definitions */ - -#define TXDESC_CONTROL_SIZE_SHIFT (0) /* Bits 0-10: Size of data buffer */ -#define TXDESC_CONTROL_SIZE_MASK (0x7ff << RXDESC_CONTROL_SIZE_SHIFT) - -#define TXDESC_CONTROL_OVERRIDE (1 << 26 /* Bit 26: Per-frame override */ -#define TXDESC_CONTROL_HUGE (1 << 27) /* Bit 27: Enable huge frame size */ -#define TXDESC_CONTROL_PAD (1 << 28) /* Bit 28: Pad short frames */ -#define TXDESC_CONTROL_CRC (1 << 29) /* Bit 29: Append CRC */ -#define TXDESC_CONTROL_LAST (1 << 30) /* Bit 30: Last descriptor of a fragment */ -#define TXDESC_CONTROL_INT (1 << 31) /* Bit 31: Generate TxDone interrupt */ - -/* Tx status bit definitions */ - -#define TXSTAT_INFO_COLCNT_SHIFT (21) /* Bits 21-24: Number of collisions */ -#define TXSTAT_INFO_COLCNT_MASK (15 << TXSTAT_INFO_COLCNT_SHIFT) -#define TXSTAT_INFO_DEFER (1 << 25) /* Bit 25: Packet deffered */ -#define TXSTAT_INFO_EXCESSDEFER (1 << 26) /* Bit 26: Excessive packet defferals */ -#define TXSTAT_INFO_EXCESSCOL (1 << 27) /* Bit 27: Excessive packet collisions */ -#define TXSTAT_INFO_LATECOL (1 << 28) /* Bit 28: Out of window collision */ -#define TXSTAT_INFO_UNDERRUN (1 << 29) /* Bit 29: Tx underrun */ -#define TXSTAT_INFO_NODESC (1 << 30) /* Bit 29: No Tx descriptor available */ -#define TXSTAT_INFO_ERROR (1 << 31) /* Bit 31: OR of other error conditions */ - -/* Rx descriptor bit definitions */ - -#define RXDESC_CONTROL_SIZE_SHIFT (0) /* Bits 0-10: Size of data buffer */ -#define RXDESC_CONTROL_SIZE_MASK (0x7ff << RXDESC_CONTROL_SIZE_SHIFT) -#define RXDESC_CONTROL_INT (1 << 31) /* Bit 31: Generate RxDone interrupt */ - -/* Rx status bit definitions */ - -#define RXSTAT_SAHASHCRC_SHIFT (0) /* Bits 0-8: Hash CRC calculated from the source address */ -#define RXSTAT_SAHASHCRC_MASK (0x1ff << RXSTAT_SAHASHCRC_SHIFT) -#define RXSTAT_DAHASHCRC_SHIFT (16) /* Bits 16-24: Hash CRC calculated from the dest address */ -#define RXSTAT_DAHASHCRC_MASK (0x1ff << RXSTAT_DAHASHCRC_SHIFT) - -#define RXSTAT_INFO_RXSIZE_SHIFT (0) /* Bits 0-10: Size of actual data transferred */ -#define RXSTAT_INFO_RXSIZE_MASK (0x7ff << RXSTAT_INFO_RXSIZE_SHIFT) -#define RXSTAT_INFO_CONTROL (1 << 18) /* Bit 18: This is a control frame */ -#define RXSTAT_INFO_VLAN (1 << 19) /* Bit 19: This is a VLAN frame */ -#define RXSTAT_INFO_FAILFILTER (1 << 20) /* Bit 20: Frame failed Rx filter */ -#define RXSTAT_INFO_MULTICAST (1 << 21) /* Bit 21: This is a multicast frame */ -#define RXSTAT_INFO_BROADCAST (1 << 22) /* Bit 22: This is a broadcast frame */ -#define RXSTAT_INFO_CRCERROR (1 << 23) /* Bit 23: Received frame had a CRC error */ -#define RXSTAT_INFO_SYMBOLERROR (1 << 24) /* Bit 24: PHY reported bit error */ -#define RXSTAT_INFO_LENGTHERROR (1 << 25) /* Bit 25: Invalid frame length */ -#define RXSTAT_INFO_RANGEERROR (1 << 26) /* Bit 26: Exceeds maximum packet size */ -#define RXSTAT_INFO_ALIGNERROR (1 << 27) /* Bit 27: Alignment error */ -#define RXSTAT_INFO_OVERRUN (1 << 28) /* Bit 28: Receive overrun error */ -#define RXSTAT_INFO_NODESC (1 << 29) /* Bit 29: No Rx descriptor available */ -#define RXSTAT_INFO_LASTFLAG (1 << 30) /* Bit 30: Last fragment of a frame */ -#define RXSTAT_INFO_ERROR (1 << 31) /* Bit 31: OR of other error conditions */ - /************************************************************************************ * Public Types ************************************************************************************/ @@ -590,8 +55,19 @@ * Public Data ************************************************************************************/ +#ifndef __ASSEMBLY__ +#ifdef __cplusplus +extern "C" +{ +#endif + /************************************************************************************ * Public Functions ************************************************************************************/ +#ifdef __cplusplus +} +#endif +#endif /* __ASSEMBLY__ */ + #endif /* __ARCH_ARM_SRC_LPC17XX_LPC17_ETHERNET_H */ diff --git a/nuttx/arch/arm/src/lpc17xx/lpc17_gpdma.c b/nuttx/arch/arm/src/lpc17xx/lpc17_gpdma.c index f567d52c09..4833fff3bb 100644 --- a/nuttx/arch/arm/src/lpc17xx/lpc17_gpdma.c +++ b/nuttx/arch/arm/src/lpc17xx/lpc17_gpdma.c @@ -51,8 +51,8 @@ #include "up_arch.h" #include "chip.h" -#include "lpc17_internal.h" -#include "lpc17_syscon.h" + +#include "chip/lpc17_syscon.h" #include "lpc17_gpdma.h" #ifdef CONFIG_LPC17_GPDMA diff --git a/nuttx/arch/arm/src/lpc17xx/lpc17_gpdma.h b/nuttx/arch/arm/src/lpc17xx/lpc17_gpdma.h index c0e70efa5f..41e60877d1 100644 --- a/nuttx/arch/arm/src/lpc17xx/lpc17_gpdma.h +++ b/nuttx/arch/arm/src/lpc17xx/lpc17_gpdma.h @@ -1,7 +1,7 @@ /************************************************************************************ * arch/arm/src/lpc17xx/lpc17_gpdma.h * - * Copyright (C) 2010 Gregory Nutt. All rights reserved. + * Copyright (C) 2010, 2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -41,377 +41,190 @@ ************************************************************************************/ #include - -#include "chip.h" -#include "lpc17_memorymap.h" +#include "chip/lpc17_gpdma.h" /************************************************************************************ * Pre-processor Definitions ************************************************************************************/ -/* Register offsets *****************************************************************/ - -/* General registers (see also LPC17_SYSCON_DMAREQSEL_OFFSET in lpc17_syscon.h) */ - -#define LPC17_DMA_INTST_OFFSET 0x0000 /* DMA Interrupt Status Register */ -#define LPC17_DMA_INTTCST_OFFSET 0x0004 /* DMA Interrupt Terminal Count Request Status Register */ -#define LPC17_DMA_INTTCCLR_OFFSET 0x0008 /* DMA Interrupt Terminal Count Request Clear Register */ -#define LPC17_DMA_INTERRST_OFFSET 0x000c /* DMA Interrupt Error Status Register */ -#define LPC17_DMA_INTERRCLR_OFFSET 0x0010 /* DMA Interrupt Error Clear Register */ -#define LPC17_DMA_RAWINTTCST_OFFSET 0x0014 /* DMA Raw Interrupt Terminal Count Status Register */ -#define LPC17_DMA_RAWINTERRST_OFFSET 0x0018 /* DMA Raw Error Interrupt Status Register */ -#define LPC17_DMA_ENBLDCHNS_OFFSET 0x001c /* DMA Enabled Channel Register */ -#define LPC17_DMA_SOFTBREQ_OFFSET 0x0020 /* DMA Software Burst Request Register */ -#define LPC17_DMA_SOFTSREQ_OFFSET 0x0024 /* DMA Software Single Request Register */ -#define LPC17_DMA_SOFTLBREQ_OFFSET 0x0028 /* DMA Software Last Burst Request Register */ -#define LPC17_DMA_SOFTLSREQ_OFFSET 0x002c /* DMA Software Last Single Request Register */ -#define LPC17_DMA_CONFIG_OFFSET 0x0030 /* DMA Configuration Register */ -#define LPC17_DMA_SYNC_OFFSET 0x0034 /* DMA Synchronization Register */ - -/* Channel Registers */ - -#define LPC17_DMA_CHAN_OFFSET(n) (0x0100 + ((n) << 5)) /* n=0,1,...7 */ - -#define LPC17_DMACH_SRCADDR_OFFSET 0x0000 /* DMA Channel Source Address Register */ -#define LPC17_DMACH_DESTADDR_OFFSET 0x0004 /* DMA Channel Destination Address Register */ -#define LPC17_DMACH_LLI_OFFSET 0x0008 /* DMA Channel Linked List Item Register */ -#define LPC17_DMACH_CONTROL_OFFSET 0x000c /* DMA Channel Control Register */ -#define LPC17_DMACH_CONFIG_OFFSET 0x0010 /* DMA Channel Configuration Register */ - -#define LPC17_DMACH0_SRCADDR_OFFSET (0x100+LPC17_DMACH_SRCADDR_OFFSET) -#define LPC17_DMACH0_DESTADDR_OFFSET (0x100+LPC17_DMACH_DESTADDR_OFFSET) -#define LPC17_DMACH0_LLI_OFFSET (0x100+LPC17_DMACH_LLI_OFFSET) -#define LPC17_DMACH0_CONTROL_OFFSET (0x100+LPC17_DMACH_CONTROL_OFFSET) -#define LPC17_DMACH0_CONFIG_OFFSET (0x100+LPC17_DMACH_CONFIG_OFFSET) - -#define LPC17_DMACH1_SRCADDR_OFFSET (0x120+LPC17_DMACH_SRCADDR_OFFSET) -#define LPC17_DMACH1_DESTADDR_OFFSET (0x120+LPC17_DMACH_DESTADDR_OFFSET) -#define LPC17_DMACH1_LLI_OFFSET (0x120+LPC17_DMACH_LLI_OFFSET) -#define LPC17_DMACH1_CONTROL_OFFSET (0x120+LPC17_DMACH_CONTROL_OFFSET) -#define LPC17_DMACH1_CONFIG_OFFSET (0x120+LPC17_DMACH_CONFIG_OFFSET) - -#define LPC17_DMACH2_SRCADDR_OFFSET (0x140+LPC17_DMACH_SRCADDR_OFFSET) -#define LPC17_DMACH2_DESTADDR_OFFSET (0x140+LPC17_DMACH_DESTADDR_OFFSET) -#define LPC17_DMACH2_LLI_OFFSET (0x140+LPC17_DMACH_LLI_OFFSET) -#define LPC17_DMACH2_CONTROL_OFFSET (0x140+LPC17_DMACH_CONTROL_OFFSET) -#define LPC17_DMACH2_CONFIG_OFFSET (0x140+LPC17_DMACH_CONFIG_OFFSET) - -#define LPC17_DMACH3_SRCADDR_OFFSET (0x160+LPC17_DMACH_SRCADDR_OFFSET) -#define LPC17_DMACH3_DESTADDR_OFFSET (0x160+LPC17_DMACH_DESTADDR_OFFSET) -#define LPC17_DMACH3_LLI_OFFSET (0x160+LPC17_DMACH_LLI_OFFSET) -#define LPC17_DMACH3_CONTROL_OFFSET (0x160+LPC17_DMACH_CONTROL_OFFSET) -#define LPC17_DMACH3_CONFIG_OFFSET (0x160+LPC17_DMACH_CONFIG_OFFSET) - -#define LPC17_DMACH4_SRCADDR_OFFSET (0x180+LPC17_DMACH_SRCADDR_OFFSET) -#define LPC17_DMACH4_DESTADDR_OFFSET (0x180+LPC17_DMACH_DESTADDR_OFFSET) -#define LPC17_DMACH4_LLI_OFFSET (0x180+LPC17_DMACH_LLI_OFFSET) -#define LPC17_DMACH4_CONTROL_OFFSET (0x180+LPC17_DMACH_CONTROL_OFFSET) -#define LPC17_DMACH4_CONFIG_OFFSET (0x180+LPC17_DMACH_CONFIG_OFFSET) - -#define LPC17_DMACH5_SRCADDR_OFFSET (0x1a0+LPC17_DMACH_SRCADDR_OFFSET) -#define LPC17_DMACH5_DESTADDR_OFFSET (0x1a0+LPC17_DMACH_DESTADDR_OFFSET) -#define LPC17_DMACH5_LLI_OFFSET (0x1a0+LPC17_DMACH_LLI_OFFSET) -#define LPC17_DMACH5_CONTROL_OFFSET (0x1a0+LPC17_DMACH_CONTROL_OFFSET) -#define LPC17_DMACH5_CONFIG_OFFSET (0x1a0+LPC17_DMACH_CONFIG_OFFSET) - -#define LPC17_DMACH6_SRCADDR_OFFSET (0x1c0+LPC17_DMACH_SRCADDR_OFFSET) -#define LPC17_DMACH6_DESTADDR_OFFSET (0x1c0+LPC17_DMACH_DESTADDR_OFFSET) -#define LPC17_DMACH6_LLI_OFFSET (0x1c0+LPC17_DMACH_LLI_OFFSET) -#define LPC17_DMACH6_CONTROL_OFFSET (0x1c0+LPC17_DMACH_CONTROL_OFFSET) -#define LPC17_DMACH6_CONFIG_OFFSET (0x1c0+LPC17_DMACH_CONFIG_OFFSET) - -#define LPC17_DMACH7_SRCADDR_OFFSET (0x1e0+LPC17_DMACH_SRCADDR_OFFSET) -#define LPC17_DMACH7_DESTADDR_OFFSET (0x1e0+LPC17_DMACH_DESTADDR_OFFSET) -#define LPC17_DMACH7_LLI_OFFSET (0x1e0+LPC17_DMACH_LLI_OFFSET) -#define LPC17_DMACH7_CONTROL_OFFSET (0x1e0+LPC17_DMACH_CONTROL_OFFSET) -#define LPC17_DMACH7_CONFIG_OFFSET (0x1e0+LPC17_DMACH_CONFIG_OFFSET) - -/* Register addresses ***************************************************************/ -/* General registers (see also LPC17_SYSCON_DMAREQSEL in lpc17_syscon.h) */ - -#define LPC17_DMA_INTST (LPC17_GPDMA_BASE+LPC17_DMA_INTST_OFFSET) -#define LPC17_DMA_INTTCST (LPC17_GPDMA_BASE+LPC17_DMA_INTTCST_OFFSET) -#define LPC17_DMA_INTTCCLR (LPC17_GPDMA_BASE+LPC17_DMA_INTTCCLR_OFFSET) -#define LPC17_DMA_INTERRST (LPC17_GPDMA_BASE+LPC17_DMA_INTERRST_OFFSET) -#define LPC17_DMA_INTERRCLR (LPC17_GPDMA_BASE+LPC17_DMA_INTERRCLR_OFFSET) -#define LPC17_DMA_RAWINTTCST (LPC17_GPDMA_BASE+LPC17_DMA_RAWINTTCST_OFFSET) -#define LPC17_DMA_RAWINTERRST (LPC17_GPDMA_BASE+LPC17_DMA_RAWINTERRST_OFFSET) -#define LPC17_DMA_ENBLDCHNS (LPC17_GPDMA_BASE+LPC17_DMA_ENBLDCHNS_OFFSET) -#define LPC17_DMA_SOFTBREQ (LPC17_GPDMA_BASE+LPC17_DMA_SOFTBREQ_OFFSET) -#define LPC17_DMA_SOFTSREQ (LPC17_GPDMA_BASE+LPC17_DMA_SOFTSREQ_OFFSET) -#define LPC17_DMA_SOFTLBREQ (LPC17_GPDMA_BASE+LPC17_DMA_SOFTLBREQ_OFFSET) -#define LPC17_DMA_SOFTLSREQ (LPC17_GPDMA_BASE+LPC17_DMA_SOFTLSREQ_OFFSET) -#define LPC17_DMA_CONFIG (LPC17_GPDMA_BASE+LPC17_DMA_CONFIG_OFFSET) -#define LPC17_DMA_SYNC (LPC17_GPDMA_BASE+LPC17_DMA_SYNC_OFFSET) - -/* Channel Registers */ - -#define LPC17_DMACH_BASE(n) (LPC17_GPDMA_BASE+LPC17_DMA_CHAN_OFFSET(n)) - -#define LPC17_DMACH_SRCADDR(n) (LPC17_DMACH_BASE(n)+LPC17_DMACH_SRCADDR_OFFSET) -#define LPC17_DMACH_DESTADDR(n) (LPC17_DMACH_BASE(n)+LPC17_DMACH_DESTADDR_OFFSET) -#define LPC17_DMACH_LLI(n) (LPC17_DMACH_BASE(n)+LPC17_DMACH_LLI_OFFSET) -#define LPC17_DMACH_CONTROL(n) (LPC17_DMACH_BASE(n)+LPC17_DMACH_CONTROL_OFFSET) -#define LPC17_DMACH_CONFIG(n) (LPC17_DMACH_BASE(n)+LPC17_DMACH_CONFIG_OFFSET) - -#define LPC17_DMACH0_SRCADDR (LPC17_GPDMA_BASE+LPC17_DMACH0_SRCADDR_OFFSET) -#define LPC17_DMACH0_DESTADDR (LPC17_GPDMA_BASE+LPC17_DMACH0_DESTADDR_OFFSET) -#define LPC17_DMACH0_LLI (LPC17_GPDMA_BASE+LPC17_DMACH0_LLI_OFFSET) -#define LPC17_DMACH0_CONTROL (LPC17_GPDMA_BASE+LPC17_DMACH0_CONTROL_OFFSET) -#define LPC17_DMACH0_CONFIG (LPC17_GPDMA_BASE+LPC17_DMACH0_CONFIG_OFFSET) - -#define LPC17_DMACH1_SRCADDR (LPC17_GPDMA_BASE+LPC17_DMACH1_SRCADDR_OFFSET) -#define LPC17_DMACH1_DESTADDR (LPC17_GPDMA_BASE+LPC17_DMACH1_DESTADDR_OFFSET) -#define LPC17_DMACH1_LLI (LPC17_GPDMA_BASE+LPC17_DMACH1_LLI_OFFSET) -#define LPC17_DMACH1_CONTROL (LPC17_GPDMA_BASE+LPC17_DMACH1_CONTROL_OFFSET) -#define LPC17_DMACH1_CONFIG (LPC17_GPDMA_BASE+LPC17_DMACH1_CONFIG_OFFSET) - -#define LPC17_DMACH2_SRCADDR (LPC17_GPDMA_BASE+LPC17_DMACH2_SRCADDR_OFFSET) -#define LPC17_DMACH2_DESTADDR (LPC17_GPDMA_BASE+LPC17_DMACH2_DESTADDR_OFFSET) -#define LPC17_DMACH2_LLI (LPC17_GPDMA_BASE+LPC17_DMACH2_LLI_OFFSET) -#define LPC17_DMACH2_CONTROL (LPC17_GPDMA_BASE+LPC17_DMACH2_CONTROL_OFFSET) -#define LPC17_DMACH2_CONFIG (LPC17_GPDMA_BASE+LPC17_DMACH2_CONFIG_OFFSET) - -#define LPC17_DMACH3_SRCADDR (LPC17_GPDMA_BASE+LPC17_DMACH3_SRCADDR_OFFSET) -#define LPC17_DMACH3_DESTADDR (LPC17_GPDMA_BASE+LPC17_DMACH3_DESTADDR_OFFSET) -#define LPC17_DMACH3_LLI (LPC17_GPDMA_BASE+LPC17_DMACH3_LLI_OFFSET) -#define LPC17_DMACH3_CONTROL (LPC17_GPDMA_BASE+LPC17_DMACH3_CONTROL_OFFSET) -#define LPC17_DMACH3_CONFIG (LPC17_GPDMA_BASE+LPC17_DMACH3_CONFIG_OFFSET) - -#define LPC17_DMACH4_SRCADDR (LPC17_GPDMA_BASE+LPC17_DMACH4_SRCADDR_OFFSET) -#define LPC17_DMACH4_DESTADDR (LPC17_GPDMA_BASE+LPC17_DMACH4_DESTADDR_OFFSET) -#define LPC17_DMACH4_LLI (LPC17_GPDMA_BASE+LPC17_DMACH4_LLI_OFFSET) -#define LPC17_DMACH4_CONTROL (LPC17_GPDMA_BASE+LPC17_DMACH4_CONTROL_OFFSET) -#define LPC17_DMACH4_CONFIG (LPC17_GPDMA_BASE+LPC17_DMACH4_CONFIG_OFFSET) - -#define LPC17_DMACH5_SRCADDR (LPC17_GPDMA_BASE+LPC17_DMACH5_SRCADDR_OFFSET) -#define LPC17_DMACH5_DESTADDR (LPC17_GPDMA_BASE+LPC17_DMACH5_DESTADDR_OFFSET) -#define LPC17_DMACH5_LLI (LPC17_GPDMA_BASE+LPC17_DMACH5_LLI_OFFSET) -#define LPC17_DMACH5_CONTROL (LPC17_GPDMA_BASE+LPC17_DMACH5_CONTROL_OFFSET) -#define LPC17_DMACH5_CONFIG (LPC17_GPDMA_BASE+LPC17_DMACH5_CONFIG_OFFSET) - -#define LPC17_DMACH6_SRCADDR (LPC17_GPDMA_BASE+LPC17_DMACH6_SRCADDR_OFFSET) -#define LPC17_DMACH6_DESTADDR (LPC17_GPDMA_BASE+LPC17_DMACH6_DESTADDR_OFFSET) -#define LPC17_DMACH6_LLI (LPC17_GPDMA_BASE+LPC17_DMACH6_LLI_OFFSET) -#define LPC17_DMACH6_CONTROL (LPC17_GPDMA_BASE+LPC17_DMACH6_CONTROL_OFFSET) -#define LPC17_DMACH6_CONFIG (LPC17_GPDMA_BASE+LPC17_DMACH6_CONFIG_OFFSET) - -#define LPC17_DMACH7_SRCADDR (LPC17_GPDMA_BASE+LPC17_DMACH7_SRCADDR_OFFSET) -#define LPC17_DMACH7_DESTADDR (LPC17_GPDMA_BASE+LPC17_DMACH7_DESTADDR_OFFSET) -#define LPC17_DMACH7_LLI (LPC17_GPDMA_BASE+LPC17_DMACH7_LLI_OFFSET) -#define LPC17_DMACH7_CONTROL (LPC17_GPDMA_BASE+LPC17_DMACH7_CONTROL_OFFSET) -#define LPC17_DMACH7_CONFIG (LPC17_GPDMA_BASE+LPC17_DMACH7_CONFIG_OFFSET) - -/* Register bit definitions *********************************************************/ -/* DMA request connections */ - -#define DMA_REQ_SSP0TX (0) -#define DMA_REQ_SSP0RX (1) -#define DMA_REQ_SSP1TX (2) -#define DMA_REQ_SSP1RX (3) -#define DMA_REQ_ADC (4) -#define DMA_REQ_I2SCH0 (5) -#define DMA_REQ_I2SCH1 (6) -#define DMA_REQ_DAC (7) - -#define DMA_REQ_UART0TX (8) -#define DMA_REQ_UART0RX (9) -#define DMA_REQ_UART1TX (10) -#define DMA_REQ_UART1RX (11) -#define DMA_REQ_UART2TX (12) -#define DMA_REQ_UART2RX (13) -#define DMA_REQ_UART3TX (14) -#define DMA_REQ_UART3RX (15) - -#define DMA_REQ_MAT0p0 (8) -#define DMA_REQ_MAT0p1 (9) -#define DMA_REQ_MAT1p0 (10) -#define DMA_REQ_MAT1p1 (11) -#define DMA_REQ_MAT2p0 (12) -#define DMA_REQ_MAT2p1 (13) -#define DMA_REQ_MAT3p0 (14) -#define DMA_REQ_MAT3p1 (15) - -/* General registers (see also LPC17_SYSCON_DMAREQSEL in lpc17_syscon.h) */ -/* Fach of the following registers, bits 0-7 controls DMA channels 9-7, - * respectively. Bits 8-31 are reserved. - * - * DMA Interrupt Status Register - * DMA Interrupt Terminal Count Request Status Register - * DMA Interrupt Terminal Count Request Clear Register - * DMA Interrupt Error Status Register - * DMA Interrupt Error Clear Register - * DMA Raw Interrupt Terminal Count Status Register - * DMA Raw Error Interrupt Status Register - * DMA Enabled Channel Register - */ - -#define DMACH(n) (1 << (n)) /* n=0,1,...7 */ - -/* For each of the following registers, bits 0-15 represent a set of encoded - * DMA sources. Bits 16-31 are reserved in each case. - * - * DMA Software Burst Request Register - * DMA Software Single Request Register - * DMA Software Last Burst Request Register - * DMA Software Last Single Request Register - * DMA Synchronization Register - */ - -#define DMA_REQ_SSP0TX_BIT (1 << DMA_REQ_SSP0TX) -#define DMA_REQ_SSP0RX_BIT (1 << DMA_REQ_SSP0RX) -#define DMA_REQ_SSP1TX_BIT (1 << DMA_REQ_SSP1TX) -#define DMA_REQ_SSP1RX_BIT (1 << DMA_REQ_SSP0RX) -#define DMA_REQ_ADC_BIT (1 << DMA_REQ_ADC) -#define DMA_REQ_I2SCH0_BIT (1 << DMA_REQ_I2SCH0) -#define DMA_REQ_I2SCH1_BIT (1 << DMA_REQ_I2SCH1) -#define DMA_REQ_DAC_BIT (1 << DMA_REQ_DAC) - -#define DMA_REQ_UART0TX_BIT (1 << DMA_REQ_UART0TX) -#define DMA_REQ_UART0RX_BIT (1 << DMA_REQ_UART0RX) -#define DMA_REQ_UART1TX_BIT (1 << DMA_REQ_UART1TX) -#define DMA_REQ_UART1RX_BIT (1 << DMA_REQ_UART1RX) -#define DMA_REQ_UART2TX_BIT (1 << DMA_REQ_UART2TX) -#define DMA_REQ_UART2RX_BIT (1 << DMA_REQ_UART2RX) -#define DMA_REQ_UART3TX_BIT (1 << DMA_REQ_UART3TX) -#define DMA_REQ_UART3RX_BIT (1 << DMA_REQ_UART3RX) - -#define DMA_REQ_MAT0p0_BIT (1 << DMA_REQ_MAT0p0) -#define DMA_REQ_MAT0p1_BIT (1 << DMA_REQ_MAT0p1) -#define DMA_REQ_MAT1p0_BIT (1 << DMA_REQ_MAT1p0) -#define DMA_REQ_MAT1p1_BIT (1 << DMA_REQ_MAT1p1) -#define DMA_REQ_MAT2p0_BIT (1 << DMA_REQ_MAT2p0) -#define DMA_REQ_MAT2p1_BIT (1 << DMA_REQ_MAT2p1) -#define DMA_REQ_MAT3p0_BIT (1 << DMA_REQ_MAT3p0) -#define DMA_REQ_MAT3p1_BIT (1 << DMA_REQ_MAT3p1) - -/* DMA Configuration Register */ - -#define DMA_CONFIG_E (1 << 0) /* Bit 0: DMA Controller enable */ -#define DMA_CONFIG_M (1 << 1) /* Bit 1: AHB Master endianness configuration */ - /* Bits 2-31: Reserved */ -/* Channel Registers */ - -/* DMA Channel Source Address Register (Bits 0-31: Source Address) */ -/* DMA Channel Destination Address Register Bits 0-31: Destination Address) */ -/* DMA Channel Linked List Item Register (Bits 0-31: Address of next link list - * item. Bits 0-1 must be zero. - */ - -/* DMA Channel Control Register */ - -#define DMACH_CONTROL_XFRSIZE_SHIFT (0) /* Bits 0-11: Transfer size */ -#define DMACH_CONTROL_XFRSIZE_MASK (0x0fff << DMACH_CONTROL_XFRSIZE_SHIFT) -#define DMACH_CONTROL_SBSIZE_SHIFT (12) /* Bits 12-14: Source burst size */ -#define DMACH_CONTROL_SBSIZE_MASK (7 << DMACH_CONTROL_SBSIZE_SHIFT) -# define DMACH_CONTROL_SBSIZE_1 (0 << DMACH_CONTROL_SBSIZE_SHIFT) -# define DMACH_CONTROL_SBSIZE_4 (1 << DMACH_CONTROL_SBSIZE_SHIFT) -# define DMACH_CONTROL_SBSIZE_8 (2 << DMACH_CONTROL_SBSIZE_SHIFT) -# define DMACH_CONTROL_SBSIZE_16 (3 << DMACH_CONTROL_SBSIZE_SHIFT) -# define DMACH_CONTROL_SBSIZE_32 (4 << DMACH_CONTROL_SBSIZE_SHIFT) -# define DMACH_CONTROL_SBSIZE_64 (5 << DMACH_CONTROL_SBSIZE_SHIFT) -# define DMACH_CONTROL_SBSIZE_128 (6 << DMACH_CONTROL_SBSIZE_SHIFT) -# define DMACH_CONTROL_SBSIZE_256 (7 << DMACH_CONTROL_SBSIZE_SHIFT) -#define DMACH_CONTROL_DBSIZE_SHIFT (15) /* Bits 15-17: Destination burst size */ -#define DMACH_CONTROL_DBSIZE_MASK (7 << DMACH_CONTROL_DBSIZE_SHIFT) -# define DMACH_CONTROL_DBSIZE_1 (0 << DMACH_CONTROL_DBSIZE_SHIFT) -# define DMACH_CONTROL_DBSIZE_4 (1 << DMACH_CONTROL_DBSIZE_SHIFT) -# define DMACH_CONTROL_DBSIZE_8 (2 << DMACH_CONTROL_DBSIZE_SHIFT) -# define DMACH_CONTROL_DBSIZE_16 (3 << DMACH_CONTROL_DBSIZE_SHIFT) -# define DMACH_CONTROL_DBSIZE_32 (4 << DMACH_CONTROL_DBSIZE_SHIFT) -# define DMACH_CONTROL_DBSIZE_64 (5 << DMACH_CONTROL_DBSIZE_SHIFT) -# define DMACH_CONTROL_DBSIZE_128 (6 << DMACH_CONTROL_DBSIZE_SHIFT) -# define DMACH_CONTROL_DBSIZE_256 (7 << DMACH_CONTROL_DBSIZE_SHIFT) -#define DMACH_CONTROL_SWIDTH_SHIFT (18) /* Bits 18-20: Source transfer width */ -#define DMACH_CONTROL_SWIDTH_MASK (7 << DMACH_CONTROL_SWIDTH_SHIFT) -#define DMACH_CONTROL_DWIDTH_SHIFT (21) /* Bits 21-23: Destination transfer width */ -#define DMACH_CONTROL_DWIDTH_MASK (7 << DMACH_CONTROL_DWIDTH_SHIFT) -#define DMACH_CONTROL_SI (1 << 26) /* Bit 26: Source increment */ -#define DMACH_CONTROL_DI (1 << 27) /* Bit 27: Destination increment */ -#define DMACH_CONTROL_PROT1 (1 << 28) /* Bit 28: User/priviledged mode */ -#define DMACH_CONTROL_PROT2 (1 << 29) /* Bit 29: Bufferable */ -#define DMACH_CONTROL_PROT3 (1 << 30) /* Bit 30: Cacheable */ -#define DMACH_CONTROL_I (1 << 31) /* Bit 31: Terminal count interrupt enable */ - -/* DMA Channel Configuration Register */ - - -#define DMACH_CONFIG_E (1 << 0) /* Bit 0: Channel enable */ -#define DMACH_CONFIG_SRCPER_SHIFT (1) /* Bits 1-5: Source peripheral */ -#define DMACH_CONFIG_SRCPER_MASK (31 << DMACH_CONFIG_SRCPER_SHIFT) -# define DMACH_CONFIG_SRCPER_SSP0TX (DMA_REQ_SSP0TX << DMACH_CONFIG_SRCPER_SHIFT) -# define DMACH_CONFIG_SRCPER_SSP0RX (DMA_REQ_SSP0RX << DMACH_CONFIG_SRCPER_SHIFT) -# define DMACH_CONFIG_SRCPER_SSP1TX (DMA_REQ_SSP1TX << DMACH_CONFIG_SRCPER_SHIFT) -# define DMACH_CONFIG_SRCPER_SSP1RX (DMA_REQ_SSP0RX << DMACH_CONFIG_SRCPER_SHIFT) -# define DMACH_CONFIG_SRCPER_ADC (DMA_REQ_ADC << DMACH_CONFIG_SRCPER_SHIFT) -# define DMACH_CONFIG_SRCPER_I2SCH0 (DMA_REQ_I2SCH0 << DMACH_CONFIG_SRCPER_SHIFT) -# define DMACH_CONFIG_SRCPER_I2SCH1 (DMA_REQ_I2SCH1 << DMACH_CONFIG_SRCPER_SHIFT) -# define DMACH_CONFIG_SRCPER_DAC (DMA_REQ_DAC << DMACH_CONFIG_SRCPER_SHIFT) -# define DMACH_CONFIG_SRCPER_UART0TX (DMA_REQ_UART0TX << DMACH_CONFIG_SRCPER_SHIFT) -# define DMACH_CONFIG_SRCPER_UART0RX (DMA_REQ_UART0RX << DMACH_CONFIG_SRCPER_SHIFT) -# define DMACH_CONFIG_SRCPER_UART1TX (DMA_REQ_UART1TX << DMACH_CONFIG_SRCPER_SHIFT) -# define DMACH_CONFIG_SRCPER_UART1RX (DMA_REQ_UART1RX << DMACH_CONFIG_SRCPER_SHIFT) -# define DMACH_CONFIG_SRCPER_UART2TX (DMA_REQ_UART2TX << DMACH_CONFIG_SRCPER_SHIFT) -# define DMACH_CONFIG_SRCPER_UART2RX (DMA_REQ_UART2RX << DMACH_CONFIG_SRCPER_SHIFT) -# define DMACH_CONFIG_SRCPER_UART3TX (DMA_REQ_UART3TX << DMACH_CONFIG_SRCPER_SHIFT) -# define DMACH_CONFIG_SRCPER_UART3RX (DMA_REQ_UART3RX << DMACH_CONFIG_SRCPER_SHIFT) -# define DMACH_CONFIG_SRCPER_MAT0p0 (DMA_REQ_MAT0p0 << DMACH_CONFIG_SRCPER_SHIFT) -# define DMACH_CONFIG_SRCPER_MAT0p1 (DMA_REQ_MAT0p1 << DMACH_CONFIG_SRCPER_SHIFT) -# define DMACH_CONFIG_SRCPER_MAT1p0 (DMA_REQ_MAT1p0 << DMACH_CONFIG_SRCPER_SHIFT) -# define DMACH_CONFIG_SRCPER_MAT1p1 (DMA_REQ_MAT1p1 << DMACH_CONFIG_SRCPER_SHIFT) -# define DMACH_CONFIG_SRCPER_MAT2p0 (DMA_REQ_MAT2p0 << DMACH_CONFIG_SRCPER_SHIFT) -# define DMACH_CONFIG_SRCPER_MAT2p1 (DMA_REQ_MAT2p1 << DMACH_CONFIG_SRCPER_SHIFT) -# define DMACH_CONFIG_SRCPER_MAT3p0 (DMA_REQ_MAT3p0 << DMACH_CONFIG_SRCPER_SHIFT) -# define DMACH_CONFIG_SRCPER_MAT3p1 (DMA_REQ_MAT3p1 << DMACH_CONFIG_SRCPER_SHIFT) -#define DMACH_CONFIG_DSTPER_SHIFT (6) /* Bits 6-10: Source peripheral */ -#define DMACH_CONFIG_DSTPER_MASK (31 << DMACH_CONFIG_DSTPER_SHIFT) -# define DMACH_CONFIG_DSTPER_SSP0TX (DMA_REQ_SSP0TX << DMACH_CONFIG_DSTPER_SHIFT) -# define DMACH_CONFIG_DSTPER_SSP0RX (DMA_REQ_SSP0RX << DMACH_CONFIG_DSTPER_SHIFT) -# define DMACH_CONFIG_DSTPER_SSP1TX (DMA_REQ_SSP1TX << DMACH_CONFIG_DSTPER_SHIFT) -# define DMACH_CONFIG_DSTPER_SSP1RX (DMA_REQ_SSP0RX << DMACH_CONFIG_DSTPER_SHIFT) -# define DMACH_CONFIG_DSTPER_ADC (DMA_REQ_ADC << DMACH_CONFIG_DSTPER_SHIFT) -# define DMACH_CONFIG_DSTPER_I2SCH0 (DMA_REQ_I2SCH0 << DMACH_CONFIG_DSTPER_SHIFT) -# define DMACH_CONFIG_DSTPER_I2SCH1 (DMA_REQ_I2SCH1 << DMACH_CONFIG_DSTPER_SHIFT) -# define DMACH_CONFIG_DSTPER_DAC (DMA_REQ_DAC << DMACH_CONFIG_DSTPER_SHIFT) -# define DMACH_CONFIG_DSTPER_UART0TX (DMA_REQ_UART0TX << DMACH_CONFIG_DSTPER_SHIFT) -# define DMACH_CONFIG_DSTPER_UART0RX (DMA_REQ_UART0RX << DMACH_CONFIG_DSTPER_SHIFT) -# define DMACH_CONFIG_DSTPER_UART1TX (DMA_REQ_UART1TX << DMACH_CONFIG_DSTPER_SHIFT) -# define DMACH_CONFIG_DSTPER_UART1RX (DMA_REQ_UART1RX << DMACH_CONFIG_DSTPER_SHIFT) -# define DMACH_CONFIG_DSTPER_UART2TX (DMA_REQ_UART2TX << DMACH_CONFIG_DSTPER_SHIFT) -# define DMACH_CONFIG_DSTPER_UART2RX (DMA_REQ_UART2RX << DMACH_CONFIG_DSTPER_SHIFT) -# define DMACH_CONFIG_DSTPER_UART3TX (DMA_REQ_UART3TX << DMACH_CONFIG_DSTPER_SHIFT) -# define DMACH_CONFIG_DSTPER_UART3RX (DMA_REQ_UART3RX << DMACH_CONFIG_DSTPER_SHIFT) -# define DMACH_CONFIG_DSTPER_MAT0p0 (DMA_REQ_MAT0p0 << DMACH_CONFIG_DSTPER_SHIFT) -# define DMACH_CONFIG_DSTPER_MAT0p1 (DMA_REQ_MAT0p1 << DMACH_CONFIG_DSTPER_SHIFT) -# define DMACH_CONFIG_DSTPER_MAT1p0 (DMA_REQ_MAT1p0 << DMACH_CONFIG_DSTPER_SHIFT) -# define DMACH_CONFIG_DSTPER_MAT1p1 (DMA_REQ_MAT1p1 << DMACH_CONFIG_DSTPER_SHIFT) -# define DMACH_CONFIG_DSTPER_MAT2p0 (DMA_REQ_MAT2p0 << DMACH_CONFIG_DSTPER_SHIFT) -# define DMACH_CONFIG_DSTPER_MAT2p1 (DMA_REQ_MAT2p1 << DMACH_CONFIG_DSTPER_SHIFT) -# define DMACH_CONFIG_DSTPER_MAT3p0 (DMA_REQ_MAT3p0 << DMACH_CONFIG_DSTPER_SHIFT) -# define DMACH_CONFIG_DSTPER_MAT3p1 (DMA_REQ_MAT3p1 << DMACH_CONFIG_DSTPER_SHIFT) -#define DMACH_CONFIG_XFRTYPE_SHIFT (11) /* Bits 11-13: Type of transfer */ -#define DMACH_CONFIG_XFRTYPE_MASK (7 << DMACH_CONFIG_XFRTYPE_SHIFT) -# define DMACH_CONFIG_XFRTYPE_M2M (0 << DMACH_CONFIG_XFRTYPE_SHIFT) /* Memory to memory DMA */ -# define DMACH_CONFIG_XFRTYPE_M2P (1 << DMACH_CONFIG_XFRTYPE_SHIFT) /* Memory to peripheral DMA */ -# define DMACH_CONFIG_XFRTYPE_P2M (2 << DMACH_CONFIG_XFRTYPE_SHIFT) /* Peripheral to memory DMA */ -# define DMACH_CONFIG_XFRTYPE_P2P (3 << DMACH_CONFIG_XFRTYPE_SHIFT) /* Peripheral to peripheral DMA */ -#define DMACH_CONFIG_IE (1 << 14) /* Bit 14: Interrupt error mask */ -#define DMACH_CONFIG_ ITC (1 << 15) /* Bit 15: Terminal count interrupt mask */ -#define DMACH_CONFIG_L (1 << 16) /* Bit 16: Lock */ -#define DMACH_CONFIG_A (1 << 17) /* Bit 17: Active */ -#define DMACH_CONFIG_H (1 << 18) /* Bit 18: Halt */ - /* Bits 19-31: Reserved */ - /************************************************************************************ * Public Types ************************************************************************************/ +#ifdef CONFIG_LPC17_GPDMA + +typedef FAR void *DMA_HANDLE; +typedef void (*dma_callback_t)(DMA_HANDLE handle, void *arg, int result); + +/* The following is used for sampling DMA registers when CONFIG DEBUG_DMA is selected */ + +#ifdef CONFIG_DEBUG_DMA +struct lpc17_dmaglobalregs_s +{ + /* Global Registers */ + + uint32_t intst; /* DMA Interrupt Status Register */ + uint32_t inttcst; /* DMA Interrupt Terminal Count Request Status Register */ + uint32_t interrst; /* DMA Interrupt Error Status Register */ + uint32_t rawinttcst; /* DMA Raw Interrupt Terminal Count Status Register */ + uint32_t rawinterrst; /* DMA Raw Error Interrupt Status Register */ + uint32_t enbldchns; /* DMA Enabled Channel Register */ + uint32_t softbreq; /* DMA Software Burst Request Register */ + uint32_t softsreq; /* DMA Software Single Request Register */ + uint32_t softlbreq; /* DMA Software Last Burst Request Register */ + uint32_t softlsreq; /* DMA Software Last Single Request Register */ + uint32_t config; /* DMA Configuration Register */ + uint32_t sync; /* DMA Synchronization Register */ +}; + +struct lpc17_dmachanregs_s +{ + /* Channel Registers */ + + uint32_t srcaddr; /* DMA Channel Source Address Register */ + uint32_t destaddr; /* DMA Channel Destination Address Register */ + uint32_t lli; /* DMA Channel Linked List Item Register */ + uint32_t control; /* DMA Channel Control Register */ + uint32_t config; /* DMA Channel Configuration Register */ +}; + +struct lpc17_dmaregs_s +{ + /* Global Registers */ + + struct lpc17_dmaglobalregs_s gbl; + + /* Channel Registers */ + + struct lpc17_dmachanregs_s ch; +}; + +#endif /* CONFIG_DEBUG_DMA */ + /************************************************************************************ * Public Data ************************************************************************************/ +#ifndef __ASSEMBLY__ +#ifdef __cplusplus +extern "C" +{ +#endif + /************************************************************************************ * Public Functions ************************************************************************************/ +/**************************************************************************** + * Name: lpc17_dmainitialize + * + * Description: + * Initialize the GPDMA subsystem. + * + * Returned Value: + * None + * + ****************************************************************************/ + +void lpc17_dmainitilaize(void); + +/**************************************************************************** + * Name: lpc17_dmachannel + * + * Description: + * Allocate a DMA channel. This function sets aside a DMA channel and + * gives the caller exclusive access to the DMA channel. + * + * Returned Value: + * One success, this function returns a non-NULL, void* DMA channel + * handle. NULL is returned on any failure. This function can fail only + * if no DMA channel is available. + * + ****************************************************************************/ + +DMA_HANDLE lpc17_dmachannel(void); + +/**************************************************************************** + * Name: lpc17_dmafree + * + * Description: + * Release a DMA channel. NOTE: The 'handle' used in this argument must + * NEVER be used again until lpc17_dmachannel() is called again to re-gain + * a valid handle. + * + * Returned Value: + * None + * + ****************************************************************************/ + +void lpc17_dmafree(DMA_HANDLE handle); + +/**************************************************************************** + * Name: lpc17_dmasetup + * + * Description: + * Configure DMA for one transfer. + * + ****************************************************************************/ + +int lpc17_dmarxsetup(DMA_HANDLE handle, uint32_t control, uint32_t config, + uint32_t srcaddr, uint32_t destaddr, size_t nbytes); + +/**************************************************************************** + * Name: lpc17_dmastart + * + * Description: + * Start the DMA transfer + * + ****************************************************************************/ + +int lpc17_dmastart(DMA_HANDLE handle, dma_callback_t callback, void *arg); + +/**************************************************************************** + * Name: lpc17_dmastop + * + * Description: + * Cancel the DMA. After lpc17_dmastop() is called, the DMA channel is + * reset and lpc17_dmasetup() must be called before lpc17_dmastart() can be + * called again + * + ****************************************************************************/ + +void lpc17_dmastop(DMA_HANDLE handle); + +/**************************************************************************** + * Name: lpc17_dmasample + * + * Description: + * Sample DMA register contents + * + ****************************************************************************/ + +#ifdef CONFIG_DEBUG_DMA +EXTERN void lpc17_dmasample(DMA_HANDLE handle, struct lpc17_dmaregs_s *regs); +#else +# define lpc17_dmasample(handle,regs) +#endif + +/**************************************************************************** + * Name: lpc17_dmadump + * + * Description: + * Dump previously sampled DMA register contents + * + ****************************************************************************/ + +#ifdef CONFIG_DEBUG_DMA +EXTERN void lpc17_dmadump(DMA_HANDLE handle, const struct lpc17_dmaregs_s *regs, + const char *msg); +#else +# define lpc17_dmadump(handle,regs,msg) +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* __ASSEMBLY__ */ +#endif /* CONFIG_LPC17_GPDMA */ #endif /* __ARCH_ARM_SRC_LPC17XX_LPC17_GPDMA_H */ diff --git a/nuttx/arch/arm/src/lpc17xx/lpc17_gpio.c b/nuttx/arch/arm/src/lpc17xx/lpc17_gpio.c index 4cc73a3fc6..9db9b136b4 100644 --- a/nuttx/arch/arm/src/lpc17xx/lpc17_gpio.c +++ b/nuttx/arch/arm/src/lpc17xx/lpc17_gpio.c @@ -39,6 +39,7 @@ #include +#include #include #include #include @@ -49,8 +50,7 @@ #include "up_arch.h" #include "chip.h" #include "lpc17_gpio.h" -#include "lpc17_pinconn.h" -#include "lpc17_internal.h" + /**************************************************************************** * Pre-processor Definitions @@ -199,6 +199,7 @@ static int lpc17_pinsel(unsigned int port, unsigned int pin, unsigned int value) putreg32(regval, regaddr); return OK; } + return -EINVAL; } @@ -265,6 +266,7 @@ static int lpc17_pullup(uint16_t cfgset, unsigned int port, unsigned int pin) putreg32(regval, regaddr); return OK; } + return -EINVAL; } @@ -518,6 +520,7 @@ static int lpc17_configalternate(uint16_t cfgset, unsigned int port, lpc17_setopendrain(port, pin); } + return OK; } @@ -582,6 +585,7 @@ int lpc17_configgpio(uint16_t cfgset) break; } } + return ret; } @@ -651,5 +655,6 @@ bool lpc17_gpioread(uint16_t pinset) pin = (pinset & GPIO_PIN_MASK) >> GPIO_PIN_SHIFT; return ((getreg32(fiobase + LPC17_FIO_PIN_OFFSET) & (1 << pin)) != 0); } - return 0; + + return false; } diff --git a/nuttx/arch/arm/src/lpc17xx/lpc17_gpio.h b/nuttx/arch/arm/src/lpc17xx/lpc17_gpio.h index 002ef3fafe..dad14bc9e2 100644 --- a/nuttx/arch/arm/src/lpc17xx/lpc17_gpio.h +++ b/nuttx/arch/arm/src/lpc17xx/lpc17_gpio.h @@ -1,7 +1,7 @@ /************************************************************************************ * arch/arm/src/lpc17xx/lpc17_gpio.h * - * Copyright (C) 2010 Gregory Nutt. All rights reserved. + * Copyright (C) 2010, 2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -42,144 +42,128 @@ #include -#include "chip.h" -#include "lpc17_memorymap.h" +#ifndef __ASSEMBLY__ +# include +#endif + +#include "chip/lpc17_gpio.h" +#include "chip/lpc17_pinconn.h" +#include "chip/lpc17_pinconfig.h" /************************************************************************************ * Pre-processor Definitions ************************************************************************************/ +/* Bit-encoded input to lpc17_configgpio() ******************************************/ -/* Register offsets *****************************************************************/ -/* GPIO block register offsets ******************************************************/ - -#define LPC17_FIO0_OFFSET 0x0000 -#define LPC17_FIO1_OFFSET 0x0020 -#define LPC17_FIO2_OFFSET 0x0040 -#define LPC17_FIO3_OFFSET 0x0060 -#define LPC17_FIO4_OFFSET 0x0080 - -#define LPC17_FIO_DIR_OFFSET 0x0000 /* Fast GPIO Port Direction control */ -#define LPC17_FIO_MASK_OFFSET 0x0010 /* Fast Mask register for ports */ -#define LPC17_FIO_PIN_OFFSET 0x0014 /* Fast Port Pin value registers */ -#define LPC17_FIO_SET_OFFSET 0x0018 /* Fast Port Output Set registers */ -#define LPC17_FIO_CLR_OFFSET 0x001c /* Fast Port Output Clear register */ - -/* GPIO interrupt block register offsets ********************************************/ - -#define LPC17_GPIOINT_OFFSET(n) (0x10*(n) + 0x80) -#define LPC17_GPIOINT0_OFFSET 0x0080 -#define LPC17_GPIOINT2_OFFSET 0x00a0 - -#define LPC17_GPIOINT_IOINTSTATUS_OFFSET 0x0000 /* GPIO overall Interrupt Status */ -#define LPC17_GPIOINT_INTSTATR_OFFSET 0x0004 /* GPIO Interrupt Status Rising edge */ -#define LPC17_GPIOINT_INTSTATF_OFFSET 0x0008 /* GPIO Interrupt Status Falling edge */ -#define LPC17_GPIOINT_INTCLR_OFFSET 0x000c /* GPIO Interrupt Clear */ -#define LPC17_GPIOINT_INTENR_OFFSET 0x0010 /* GPIO Interrupt Enable Rising edge */ -#define LPC17_GPIOINT_INTENF_OFFSET 0x0014 /* GPIO Interrupt Enable Falling edge */ - -/* Register addresses ***************************************************************/ -/* GPIO block register addresses ****************************************************/ - -#define LPC17_FIO_BASE(n) (LPC17_GPIO_BASE+LPC17_GPIOINT_OFFSET(n)) -#define LPC17_FIO0_BASE (LPC17_GPIO_BASE+LPC17_FIO0_OFFSET) -#define LPC17_FIO1_BASE (LPC17_GPIO_BASE+LPC17_FIO1_OFFSET) -#define LPC17_FIO2_BASE (LPC17_GPIO_BASE+LPC17_FIO2_OFFSET) -#define LPC17_FIO3_BASE (LPC17_GPIO_BASE+LPC17_FIO3_OFFSET) -#define LPC17_FIO4_BASE (LPC17_GPIO_BASE+LPC17_FIO4_OFFSET) - -#define LPC17_FIO_DIR(n) (LPC17_FIO_BASE(n)+LPC17_FIO_DIR_OFFSET) -#define LPC17_FIO_MASK(n) (LPC17_FIO_BASE(n)+LPC17_FIO_MASK_OFFSET) -#define LPC17_FIO_PIN(n) (LPC17_FIO_BASE(n)+LPC17_FIO_PIN_OFFSET) -#define LPC17_FIO_SET(n) (LPC17_FIO_BASE(n)+LPC17_FIO_SET_OFFSET) -#define LPC17_FIO_CLR(n) (LPC17_FIO_BASE(n)+LPC17_FIO_CLR_OFFSET) - -#define LPC17_FIO0_DIR (LPC17_FIO0_BASE+LPC17_FIO_DIR_OFFSET) -#define LPC17_FIO0_MASK (LPC17_FIO0_BASE+LPC17_FIO_MASK_OFFSET) -#define LPC17_FIO0_PIN (LPC17_FIO0_BASE+LPC17_FIO_PIN_OFFSET) -#define LPC17_FIO0_SET (LPC17_FIO0_BASE+LPC17_FIO_SET_OFFSET) -#define LPC17_FIO0_CLR (LPC17_FIO0_BASE+LPC17_FIO_CLR_OFFSET) - -#define LPC17_FIO1_DIR (LPC17_FIO1_BASE+LPC17_FIO_DIR_OFFSET) -#define LPC17_FIO1_MASK (LPC17_FIO1_BASE+LPC17_FIO_MASK_OFFSET) -#define LPC17_FIO1_PIN (LPC17_FIO1_BASE+LPC17_FIO_PIN_OFFSET) -#define LPC17_FIO1_SET (LPC17_FIO1_BASE+LPC17_FIO_SET_OFFSET) -#define LPC17_FIO1_CLR (LPC17_FIO1_BASE+LPC17_FIO_CLR_OFFSET) - -#define LPC17_FIO2_DIR (LPC17_FIO2_BASE+LPC17_FIO_DIR_OFFSET) -#define LPC17_FIO2_MASK (LPC17_FIO2_BASE+LPC17_FIO_MASK_OFFSET) -#define LPC17_FIO2_PIN (LPC17_FIO2_BASE+LPC17_FIO_PIN_OFFSET) -#define LPC17_FIO2_SET (LPC17_FIO2_BASE+LPC17_FIO_SET_OFFSET) -#define LPC17_FIO2_CLR (LPC17_FIO2_BASE+LPC17_FIO_CLR_OFFSET) - -#define LPC17_FIO3_DIR (LPC17_FIO3_BASE+LPC17_FIO_DIR_OFFSET) -#define LPC17_FIO3_MASK (LPC17_FIO3_BASE+LPC17_FIO_MASK_OFFSET) -#define LPC17_FIO3_PIN (LPC17_FIO3_BASE+LPC17_FIO_PIN_OFFSET) -#define LPC17_FIO3_SET (LPC17_FIO3_BASE+LPC17_FIO_SET_OFFSET) -#define LPC17_FIO3_CLR (LPC17_FIO3_BASE+LPC17_FIO_CLR_OFFSET) - -#define LPC17_FIO4_DIR (LPC17_FIO4_BASE+LPC17_FIO_DIR_OFFSET) -#define LPC17_FIO4_MASK (LPC17_FIO4_BASE+LPC17_FIO_MASK_OFFSET) -#define LPC17_FIO4_PIN (LPC17_FIO4_BASE+LPC17_FIO_PIN_OFFSET) -#define LPC17_FIO4_SET (LPC17_FIO4_BASE+LPC17_FIO_SET_OFFSET) -#define LPC17_FIO4_CLR (LPC17_FIO4_BASE+LPC17_FIO_CLR_OFFSET) - -/* GPIO interrupt block register addresses ******************************************/ - -#define LPC17_GPIOINTn_BASE(n) (LPC17_GPIOINT_BASE+LPC17_GPIOINT_OFFSET(n)) -#define LPC17_GPIOINT0_BASE (LPC17_GPIOINT_BASE+LPC17_GPIOINT0_OFFSET) -#define LPC17_GPIOINT2_BASE (LPC17_GPIOINT_BASE+LPC17_GPIOINT2_OFFSET) - -#define LPC17_GPIOINT_IOINTSTATUS (LPC17_GPIOINT0_BASE+LPC17_GPIOINT_IOINTSTATUS_OFFSET) - -#define LPC17_GPIOINT_INTSTATR(n) (LPC17_GPIOINTn_BASE(n)+LPC17_GPIOINT_INTSTATR_OFFSET) -#define LPC17_GPIOINT_INTSTATF(n) (LPC17_GPIOINTn_BASE(n)+LPC17_GPIOINT_INTSTATF_OFFSET) -#define LPC17_GPIOINT_INTCLR(n) (LPC17_GPIOINTn_BASE(n)+LPC17_GPIOINT_INTCLR_OFFSET) -#define LPC17_GPIOINT_INTENR(n) (LPC17_GPIOINTn_BASE(n)+LPC17_GPIOINT_INTENR_OFFSET) -#define LPC17_GPIOINT_INTENF(n) (LPC17_GPIOINTn_BASE(n)+LPC17_GPIOINT_INTENF_OFFSET) - -/* Pins P0.0-31 (P0.12-14 nad P0.31 are reserved) */ - -#define LPC17_GPIOINT0_INTSTATR (LPC17_GPIOINT0_BASE+LPC17_GPIOINT_INTSTATR_OFFSET) -#define LPC17_GPIOINT0_INTSTATF (LPC17_GPIOINT0_BASE+LPC17_GPIOINT_INTSTATF_OFFSET) -#define LPC17_GPIOINT0_INTCLR (LPC17_GPIOINT0_BASE+LPC17_GPIOINT_INTCLR_OFFSET) -#define LPC17_GPIOINT0_INTENR (LPC17_GPIOINT0_BASE+LPC17_GPIOINT_INTENR_OFFSET) -#define LPC17_GPIOINT0_INTENF (LPC17_GPIOINT0_BASE+LPC17_GPIOINT_INTENF_OFFSET) - -/* Pins P2.0-13 (P0.14-31 are reserved) */ - -#define LPC17_GPIOINT2_INTSTATR (LPC17_GPIOINT2_BASE+LPC17_GPIOINT_INTSTATR_OFFSET) -#define LPC17_GPIOINT2_INTSTATF (LPC17_GPIOINT2_BASE+LPC17_GPIOINT_INTSTATF_OFFSET) -#define LPC17_GPIOINT2_INTCLR (LPC17_GPIOINT2_BASE+LPC17_GPIOINT_INTCLR_OFFSET) -#define LPC17_GPIOINT2_INTENR (LPC17_GPIOINT2_BASE+LPC17_GPIOINT_INTENR_OFFSET) -#define LPC17_GPIOINT2_INTENF (LPC17_GPIOINT2_BASE+LPC17_GPIOINT_INTENF_OFFSET) - -/* Register bit definitions *********************************************************/ -/* GPIO block register bit definitions **********************************************/ - -/* Fast GPIO Port Direction control registers (FIODIR) */ -/* Fast Mask register for ports (FIOMASK) */ -/* Fast Port Pin value registers using FIOMASK (FIOPIN) */ -/* Fast Port Output Set registers using FIOMASK (FIOSET) */ -/* Fast Port Output Clear register using FIOMASK (FIOCLR) */ - -#define FIO(n) (1 << (n)) /* n=0,1,..31 */ - -/* GPIO interrupt block register bit definitions ************************************/ - -/* GPIO overall Interrupt Status (IOINTSTATUS) */ -#define GPIOINT_IOINTSTATUS_P0INT (1 << 0) /* Bit 0: Port 0 GPIO interrupt pending */ - /* Bit 1: Reserved */ -#define GPIOINT_IOINTSTATUS_P2INT (1 << 2) /* Bit 2: Port 2 GPIO interrupt pending */ - /* Bits 3-31: Reserved */ - -/* GPIO Interrupt Status for Rising edge (INTSTATR) - * GPIO Interrupt Status for Falling edge (INTSTATF) - * GPIO Interrupt Clear (INTCLR) - * GPIO Interrupt Enable for Rising edge (INTENR) - * GPIO Interrupt Enable for Falling edge (INTENF) +/* Encoding: FFFx MMOV PPPN NNNN + * + * Pin Function: FFF + * Pin Mode bits: MM + * Open drain: O (output pins) + * Initial value: V (output pins) + * Port number: PPP (0-4) + * Pin number: NNNNN (0-31) + */ + +/* Pin Function bits: FFF + * Only meaningful when the GPIO function is GPIO_PIN */ -#define GPIOINT(n) (1 << (n)) /* n=0,1,..31 */ +#define GPIO_FUNC_SHIFT (13) /* Bits 13-15: GPIO mode */ +#define GPIO_FUNC_MASK (7 << GPIO_FUNC_SHIFT) +# define GPIO_INPUT (0 << GPIO_FUNC_SHIFT) /* 000 GPIO input pin */ +# define GPIO_INTFE (1 << GPIO_FUNC_SHIFT) /* 001 GPIO interrupt falling edge */ +# define GPIO_INTRE (2 << GPIO_FUNC_SHIFT) /* 010 GPIO interrupt rising edge */ +# define GPIO_INTBOTH (3 << GPIO_FUNC_SHIFT) /* 011 GPIO interrupt both edges */ +# define GPIO_OUTPUT (4 << GPIO_FUNC_SHIFT) /* 100 GPIO outpout pin */ +# define GPIO_ALT1 (5 << GPIO_FUNC_SHIFT) /* 101 Alternate function 1 */ +# define GPIO_ALT2 (6 << GPIO_FUNC_SHIFT) /* 110 Alternate function 2 */ +# define GPIO_ALT3 (7 << GPIO_FUNC_SHIFT) /* 111 Alternate function 3 */ + +#define GPIO_EDGE_SHIFT (13) /* Bits 13-14: Interrupt edge bits */ +#define GPIO_EDGE_MASK (3 << GPIO_EDGE_SHIFT) + +#define GPIO_INOUT_MASK GPIO_OUTPUT +#define GPIO_FE_MASK GPIO_INTFE +#define GPIO_RE_MASK GPIO_INTRE + +#define GPIO_ISGPIO(ps) ((uint16_t(ps) & GPIO_FUNC_MASK) <= GPIO_OUTPUT) +#define GPIO_ISALT(ps) ((uint16_t(ps) & GPIO_FUNC_MASK) > GPIO_OUTPUT) +#define GPIO_ISINPUT(ps) (((ps) & GPIO_FUNC_MASK) == GPIO_INPUT) +#define GPIO_ISOUTPUT(ps) (((ps) & GPIO_FUNC_MASK) == GPIO_OUTPUT) +#define GPIO_ISINORINT(ps) (((ps) & GPIO_INOUT_MASK) == 0) +#define GPIO_ISOUTORALT(ps) (((ps) & GPIO_INOUT_MASK) != 0) +#define GPIO_ISINTERRUPT(ps) (GPIO_ISOUTPUT(ps) && !GPIO_ISINPUT(ps)) +#define GPIO_ISFE(ps) (((ps) & GPIO_FE_MASK) != 0) +#define GPIO_ISRE(ps) (((ps) & GPIO_RE_MASK) != 0) + +/* Pin Mode: MM */ + +#define GPIO_PUMODE_SHIFT (10) /* Bits 10-11: Pin pull-up mode */ +#define GPIO_PUMODE_MASK (3 << GPIO_PUMODE_SHIFT) +# define GPIO_PULLUP (0 << GPIO_PUMODE_SHIFT) /* Pull-up resistor enabled */ +# define GPIO_REPEATER (1 << GPIO_PUMODE_SHIFT) /* Repeater mode enabled */ +# define GPIO_FLOAT (2 << GPIO_PUMODE_SHIFT) /* Neither pull-up nor -down */ +# define GPIO_PULLDN (3 << GPIO_PUMODE_SHIFT) /* Pull-down resistor enabled */ + +/* Open drain: O */ + +#define GPIO_OPEN_DRAIN (1 << 9) /* Bit 9: Open drain mode */ + +/* Initial value: V */ + +#define GPIO_VALUE (1 << 8) /* Bit 8: Initial GPIO output value */ +#define GPIO_VALUE_ONE GPIO_VALUE +#define GPIO_VALUE_ZERO (0) + +/* Port number: PPP (0-4) */ + +#define GPIO_PORT_SHIFT (5) /* Bit 5-7: Port number */ +#define GPIO_PORT_MASK (7 << GPIO_PORT_SHIFT) +# define GPIO_PORT0 (0 << GPIO_PORT_SHIFT) +# define GPIO_PORT1 (1 << GPIO_PORT_SHIFT) +# define GPIO_PORT2 (2 << GPIO_PORT_SHIFT) +# define GPIO_PORT3 (3 << GPIO_PORT_SHIFT) +# define GPIO_PORT4 (4 << GPIO_PORT_SHIFT) + +#define GPIO_NPORTS 5 + +/* Pin number: NNNNN (0-31) */ + +#define GPIO_PIN_SHIFT 0 /* Bits 0-4: GPIO number: 0-31 */ +#define GPIO_PIN_MASK (31 << GPIO_PIN_SHIFT) +#define GPIO_PIN0 (0 << GPIO_PIN_SHIFT) +#define GPIO_PIN1 (1 << GPIO_PIN_SHIFT) +#define GPIO_PIN2 (2 << GPIO_PIN_SHIFT) +#define GPIO_PIN3 (3 << GPIO_PIN_SHIFT) +#define GPIO_PIN4 (4 << GPIO_PIN_SHIFT) +#define GPIO_PIN5 (5 << GPIO_PIN_SHIFT) +#define GPIO_PIN6 (6 << GPIO_PIN_SHIFT) +#define GPIO_PIN7 (7 << GPIO_PIN_SHIFT) +#define GPIO_PIN8 (8 << GPIO_PIN_SHIFT) +#define GPIO_PIN9 (9 << GPIO_PIN_SHIFT) +#define GPIO_PIN10 (10 << GPIO_PIN_SHIFT) +#define GPIO_PIN11 (11 << GPIO_PIN_SHIFT) +#define GPIO_PIN12 (12 << GPIO_PIN_SHIFT) +#define GPIO_PIN13 (13 << GPIO_PIN_SHIFT) +#define GPIO_PIN14 (14 << GPIO_PIN_SHIFT) +#define GPIO_PIN15 (15 << GPIO_PIN_SHIFT) +#define GPIO_PIN16 (16 << GPIO_PIN_SHIFT) +#define GPIO_PIN17 (17 << GPIO_PIN_SHIFT) +#define GPIO_PIN18 (18 << GPIO_PIN_SHIFT) +#define GPIO_PIN19 (19 << GPIO_PIN_SHIFT) +#define GPIO_PIN20 (20 << GPIO_PIN_SHIFT) +#define GPIO_PIN21 (21 << GPIO_PIN_SHIFT) +#define GPIO_PIN22 (22 << GPIO_PIN_SHIFT) +#define GPIO_PIN23 (23 << GPIO_PIN_SHIFT) +#define GPIO_PIN24 (24 << GPIO_PIN_SHIFT) +#define GPIO_PIN25 (25 << GPIO_PIN_SHIFT) +#define GPIO_PIN26 (26 << GPIO_PIN_SHIFT) +#define GPIO_PIN27 (27 << GPIO_PIN_SHIFT) +#define GPIO_PIN28 (28 << GPIO_PIN_SHIFT) +#define GPIO_PIN29 (29 << GPIO_PIN_SHIFT) +#define GPIO_PIN30 (30 << GPIO_PIN_SHIFT) +#define GPIO_PIN31 (31 << GPIO_PIN_SHIFT) /************************************************************************************ * Public Types @@ -189,8 +173,40 @@ * Public Data ************************************************************************************/ -/************************************************************************************ +#ifndef __ASSEMBLY__ +#undef EXTERN +#if defined(__cplusplus) +#define EXTERN extern "C" +extern "C" +{ +#else +#define EXTERN extern +#endif + +/* These tables have global scope only because they are shared between lpc17_gpio.c, + * lpc17_gpioint.c, and lpc17_gpiodbg.c + */ + +#ifdef CONFIG_GPIO_IRQ +EXTERN uint64_t g_intedge0; +EXTERN uint64_t g_intedge2; +#endif + +EXTERN const uint32_t g_fiobase[GPIO_NPORTS]; +EXTERN const uint32_t g_intbase[GPIO_NPORTS]; +EXTERN const uint32_t g_lopinsel[GPIO_NPORTS]; +EXTERN const uint32_t g_hipinsel[GPIO_NPORTS]; +EXTERN const uint32_t g_lopinmode[GPIO_NPORTS]; +EXTERN const uint32_t g_hipinmode[GPIO_NPORTS]; +EXTERN const uint32_t g_odmode[GPIO_NPORTS]; + +/**************************************************************************** * Public Functions - ************************************************************************************/ + ****************************************************************************/ + +#ifdef __cplusplus +} +#endif +#endif /* __ASSEMBLY__ */ #endif /* __ARCH_ARM_SRC_LPC17XX_LPC17_GPIO_H */ diff --git a/nuttx/arch/arm/src/lpc17xx/lpc17_gpiodbg.c b/nuttx/arch/arm/src/lpc17xx/lpc17_gpiodbg.c index dc4dac33a6..9b16ce6976 100644 --- a/nuttx/arch/arm/src/lpc17xx/lpc17_gpiodbg.c +++ b/nuttx/arch/arm/src/lpc17xx/lpc17_gpiodbg.c @@ -47,7 +47,7 @@ #include "up_arch.h" #include "chip.h" #include "lpc17_gpio.h" -#include "lpc17_internal.h" + /**************************************************************************** * Pre-processor Definitions diff --git a/nuttx/arch/arm/src/lpc17xx/lpc17_gpioint.c b/nuttx/arch/arm/src/lpc17xx/lpc17_gpioint.c index 66988b0b95..7f18a33b45 100644 --- a/nuttx/arch/arm/src/lpc17xx/lpc17_gpioint.c +++ b/nuttx/arch/arm/src/lpc17xx/lpc17_gpioint.c @@ -50,8 +50,7 @@ #include "up_arch.h" #include "chip.h" #include "lpc17_gpio.h" -#include "lpc17_pinconn.h" -#include "lpc17_internal.h" + #ifdef CONFIG_GPIO_IRQ diff --git a/nuttx/arch/arm/src/lpc17xx/lpc17_i2c.c b/nuttx/arch/arm/src/lpc17xx/lpc17_i2c.c index 935dbfa0ce..866a668abb 100644 --- a/nuttx/arch/arm/src/lpc17xx/lpc17_i2c.c +++ b/nuttx/arch/arm/src/lpc17xx/lpc17_i2c.c @@ -53,6 +53,7 @@ #include #include #include +#include #include #include @@ -61,15 +62,13 @@ #include #include -#include "wdog.h" -#include "chip.h" #include "up_arch.h" #include "up_internal.h" #include "os_internal.h" -#include "lpc17_internal.h" -#include "lpc17_syscon.h" -#include "lpc17_pinconn.h" +#include "chip.h" +#include "chip/lpc17_syscon.h" +#include "lpc17_gpio.h" #include "lpc17_i2c.h" #if defined(CONFIG_LPC17_I2C0) || defined(CONFIG_LPC17_I2C1) || defined(CONFIG_LPC17_I2C2) diff --git a/nuttx/arch/arm/src/lpc17xx/lpc17_i2c.h b/nuttx/arch/arm/src/lpc17xx/lpc17_i2c.h index 10e1fbeac6..5d229f4529 100644 --- a/nuttx/arch/arm/src/lpc17xx/lpc17_i2c.h +++ b/nuttx/arch/arm/src/lpc17xx/lpc17_i2c.h @@ -1,7 +1,7 @@ /************************************************************************************ * arch/arm/src/lpc17xx/lpc17_i2c.h * - * Copyright (C) 2010 Gregory Nutt. All rights reserved. + * Copyright (C) 2010, 2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -41,158 +41,12 @@ ************************************************************************************/ #include - -#include "chip.h" -#include "lpc17_memorymap.h" +#include "chip/lpc17_i2c.h" /************************************************************************************ * Pre-processor Definitions ************************************************************************************/ -/* Register offsets *****************************************************************/ - -#define LPC17_I2C_CONSET_OFFSET 0x0000 /* I2C Control Set Register */ -#define LPC17_I2C_STAT_OFFSET 0x0004 /* I2C Status Register */ -#define LPC17_I2C_DAT_OFFSET 0x0008 /* I2C Data Register */ -#define LPC17_I2C_ADR0_OFFSET 0x000c /* I2C Slave Address Register 0 */ -#define LPC17_I2C_SCLH_OFFSET 0x0010 /* SCH Duty Cycle Register High Half Word */ -#define LPC17_I2C_SCLL_OFFSET 0x0014 /* SCL Duty Cycle Register Low Half Word */ -#define LPC17_I2C_CONCLR_OFFSET 0x0018 /* I2C Control Clear Register */ -#define LPC17_I2C_MMCTRL_OFFSET 0x001c /* Monitor mode control register */ -#define LPC17_I2C_ADR1_OFFSET 0x0020 /* I2C Slave Address Register 1 */ -#define LPC17_I2C_ADR2_OFFSET 0x0024 /* I2C Slave Address Register 2 */ -#define LPC17_I2C_ADR3_OFFSET 0x0028 /* I2C Slave Address Register 3 */ -#define LPC17_I2C_BUFR_OFFSET 0x002c /* Data buffer register */ -#define LPC17_I2C_MASK0_OFFSET 0x0030 /* I2C Slave address mask register 0 */ -#define LPC17_I2C_MASK1_OFFSET 0x0034 /* I2C Slave address mask register 1 */ -#define LPC17_I2C_MASK2_OFFSET 0x0038 /* I2C Slave address mask register 2 */ -#define LPC17_I2C_MASK3_OFFSET 0x003c /* I2C Slave address mask register */ - -/* Register addresses ***************************************************************/ - -#define LPC17_I2C0_CONSET (LPC17_I2C0_BASE+LPC17_I2C_CONSET_OFFSET) -#define LPC17_I2C0_STAT (LPC17_I2C0_BASE+LPC17_I2C_STAT_OFFSET) -#define LPC17_I2C0_DAT (LPC17_I2C0_BASE+LPC17_I2C_DAT_OFFSET) -#define LPC17_I2C0_ADR0 (LPC17_I2C0_BASE+LPC17_I2C_ADR0_OFFSET) -#define LPC17_I2C0_SCLH (LPC17_I2C0_BASE+LPC17_I2C_SCLH_OFFSET) -#define LPC17_I2C0_SCLL (LPC17_I2C0_BASE+LPC17_I2C_SCLL_OFFSET) -#define LPC17_I2C0_CONCLR (LPC17_I2C0_BASE+LPC17_I2C_CONCLR_OFFSET) -#define LPC17_I2C0_MMCTRL (LPC17_I2C0_BASE+LPC17_I2C_MMCTRL_OFFSET) -#define LPC17_I2C0_ADR1 (LPC17_I2C0_BASE+LPC17_I2C_ADR1_OFFSET) -#define LPC17_I2C0_ADR2 (LPC17_I2C0_BASE+LPC17_I2C_ADR2_OFFSET) -#define LPC17_I2C0_ADR3 (LPC17_I2C0_BASE+LPC17_I2C_ADR3_OFFSET) -#define LPC17_I2C0_BUFR (LPC17_I2C0_BASE+LPC17_I2C_BUFR_OFFSET) -#define LPC17_I2C0_MASK0 (LPC17_I2C0_BASE+LPC17_I2C_MASK0_OFFSET) -#define LPC17_I2C0_MASK1 (LPC17_I2C0_BASE+LPC17_I2C_MASK1_OFFSET) -#define LPC17_I2C0_MASK2 (LPC17_I2C0_BASE+LPC17_I2C_MASK2_OFFSET) -#define LPC17_I2C0_MASK3 (LPC17_I2C0_BASE+LPC17_I2C_MASK3_OFFSET) - -#define LPC17_I2C1_CONSET (LPC17_I2C1_BASE+LPC17_I2C_CONSET_OFFSET) -#define LPC17_I2C1_STAT (LPC17_I2C1_BASE+LPC17_I2C_STAT_OFFSET) -#define LPC17_I2C1_DAT (LPC17_I2C1_BASE+LPC17_I2C_DAT_OFFSET) -#define LPC17_I2C1_ADR0 (LPC17_I2C1_BASE+LPC17_I2C_ADR0_OFFSET) -#define LPC17_I2C1_SCLH (LPC17_I2C1_BASE+LPC17_I2C_SCLH_OFFSET) -#define LPC17_I2C1_SCLL (LPC17_I2C1_BASE+LPC17_I2C_SCLL_OFFSET) -#define LPC17_I2C1_CONCLR (LPC17_I2C1_BASE+LPC17_I2C_CONCLR_OFFSET) -#define LPC17_I2C1_MMCTRL (LPC17_I2C1_BASE+LPC17_I2C_MMCTRL_OFFSET) -#define LPC17_I2C1_ADR1 (LPC17_I2C1_BASE+LPC17_I2C_ADR1_OFFSET) -#define LPC17_I2C1_ADR2 (LPC17_I2C1_BASE+LPC17_I2C_ADR2_OFFSET) -#define LPC17_I2C1_ADR3 (LPC17_I2C1_BASE+LPC17_I2C_ADR3_OFFSET) -#define LPC17_I2C1_BUFR (LPC17_I2C1_BASE+LPC17_I2C_BUFR_OFFSET) -#define LPC17_I2C1_MASK0 (LPC17_I2C1_BASE+LPC17_I2C_MASK0_OFFSET) -#define LPC17_I2C1_MASK1 (LPC17_I2C1_BASE+LPC17_I2C_MASK1_OFFSET) -#define LPC17_I2C1_MASK2 (LPC17_I2C1_BASE+LPC17_I2C_MASK2_OFFSET) -#define LPC17_I2C1_MASK3 (LPC17_I2C1_BASE+LPC17_I2C_MASK3_OFFSET) - -#define LPC17_I2C2_CONSET (LPC17_I2C2_BASE+LPC17_I2C_CONSET_OFFSET) -#define LPC17_I2C2_STAT (LPC17_I2C2_BASE+LPC17_I2C_STAT_OFFSET) -#define LPC17_I2C2_DAT (LPC17_I2C2_BASE+LPC17_I2C_DAT_OFFSET) -#define LPC17_I2C2_ADR0 (LPC17_I2C2_BASE+LPC17_I2C_ADR0_OFFSET) -#define LPC17_I2C2_SCLH (LPC17_I2C2_BASE+LPC17_I2C_SCLH_OFFSET) -#define LPC17_I2C2_SCLL (LPC17_I2C2_BASE+LPC17_I2C_SCLL_OFFSET) -#define LPC17_I2C2_CONCLR (LPC17_I2C2_BASE+LPC17_I2C_CONCLR_OFFSET) -#define LPC17_I2C2_MMCTRL (LPC17_I2C2_BASE+LPC17_I2C_MMCTRL_OFFSET) -#define LPC17_I2C2_ADR1 (LPC17_I2C2_BASE+LPC17_I2C_ADR1_OFFSET) -#define LPC17_I2C2_ADR2 (LPC17_I2C2_BASE+LPC17_I2C_ADR2_OFFSET) -#define LPC17_I2C2_ADR3 (LPC17_I2C2_BASE+LPC17_I2C_ADR3_OFFSET) -#define LPC17_I2C2_BUFR (LPC17_I2C2_BASE+LPC17_I2C_BUFR_OFFSET) -#define LPC17_I2C2_MASK0 (LPC17_I2C2_BASE+LPC17_I2C_MASK0_OFFSET) -#define LPC17_I2C2_MASK1 (LPC17_I2C2_BASE+LPC17_I2C_MASK1_OFFSET) -#define LPC17_I2C2_MASK2 (LPC17_I2C2_BASE+LPC17_I2C_MASK2_OFFSET) -#define LPC17_I2C2_MASK3 (LPC17_I2C2_BASE+LPC17_I2C_MASK3_OFFSET) - -/* Register bit definitions *********************************************************/ -/* I2C Control Set Register */ - /* Bits 0-1: Reserved */ -#define I2C_CONSET_AA (1 << 2) /* Bit 2: Assert acknowledge flag */ -#define I2C_CONSET_SI (1 << 3) /* Bit 3: I2C interrupt flag */ -#define I2C_CONSET_STO (1 << 4) /* Bit 4: STOP flag */ -#define I2C_CONSET_STA (1 << 5) /* Bit 5: START flag */ -#define I2C_CONSET_I2EN (1 << 6) /* Bit 6: I2C interface enable */ - /* Bits 7-31: Reserved */ -/* I2C Control Clear Register */ - /* Bits 0-1: Reserved */ -#define I2C_CONCLR_AAC (1 << 2) /* Bit 2: Assert acknowledge Clear bit */ -#define I2C_CONCLR_SIC (1 << 3) /* Bit 3: I2C interrupt Clear bit */ - /* Bit 4: Reserved */ -#define I2C_CONCLR_STAC (1 << 5) /* Bit 5: START flag Clear bit */ -#define I2C_CONCLRT_I2ENC (1 << 6) /* Bit 6: I2C interface Disable bit */ - /* Bits 7-31: Reserved */ -/* I2C Status Register - * - * See tables 399-402 in the "LPC17xx User Manual" (UM10360), Rev. 01, 4 January - * 2010, NXP for definitions of status codes. - */ - -#define I2C_STAT_MASK (0xff) /* Bits 0-7: I2C interface status - * Bits 0-1 always zero */ - /* Bits 8-31: Reserved */ -/* I2C Data Register */ - -#define I2C_DAT_MASK (0xff) /* Bits 0-7: I2C data */ - /* Bits 8-31: Reserved */ -/* Monitor mode control register */ - -#define I2C_MMCTRL_MMENA (1 << 0) /* Bit 0: Monitor mode enable */ -#define I2C_MMCTRL_ENASCL (1 << 1) /* Bit 1: SCL output enable */ -#define I2C_MMCTRL_MATCHALL (1 << 2) /* Bit 2: Select interrupt register match */ - /* Bits 3-31: Reserved */ -/* Data buffer register */ - -#define I2C_BUFR_MASK (0xff) /* Bits 0-7: 8 MSBs of the I2DAT shift register */ - /* Bits 8-31: Reserved */ -/* I2C Slave address registers: - * - * I2C Slave Address Register 0 - * I2C Slave Address Register 1 - * I2C Slave Address Register 2 - * I2C Slave Address Register 3 - */ - -#define I2C_ADR_GC (1 << 0) /* Bit 0: GC General Call enable bit */ -#define I2C_ADR_ADDR_SHIFT (1) /* Bits 1-7: I2C slave address */ -#define I2C_ADR_ADDR_MASK (0x7f << I2C_ADR_ADDR_SHIFT) - /* Bits 8-31: Reserved */ -/* I2C Slave address mask registers: - * - * I2C Slave address mask register 0 - * I2C Slave address mask register 1 - * I2C Slave address mask register 2 - * I2C Slave address mask register 3 - */ - /* Bit 0: Reserved */ -#define I2C_MASK_SHIFT (1) /* Bits 1-7: I2C mask bits */ -#define I2C_MASK_MASK (0x7f << I2C_ADR_ADDR_SHIFT) - /* Bits 8-31: Reserved */ -/* SCH Duty Cycle Register High Half Word */ - -#define I2C_SCLH_MASK (0xffff) /* Bit 0-15: Count for SCL HIGH time period selection */ - /* Bits 16-31: Reserved */ -/* SCL Duty Cycle Register Low Half Word */ - -#define I2C_SCLL_MASK (0xffff) /* Bit 0-15: Count for SCL LOW time period selection */ - /* Bits 16-31: Reserved */ - /************************************************************************************ * Public Types ************************************************************************************/ diff --git a/nuttx/arch/arm/src/lpc17xx/lpc17_i2s.h b/nuttx/arch/arm/src/lpc17xx/lpc17_i2s.h index 638d401781..9b5e390d09 100644 --- a/nuttx/arch/arm/src/lpc17xx/lpc17_i2s.h +++ b/nuttx/arch/arm/src/lpc17xx/lpc17_i2s.h @@ -1,190 +1,190 @@ -/************************************************************************************ - * arch/arm/src/lpc17xx/lpc17_i2s - * - * Copyright (C) 2010, 2012 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt - * - * 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. - * - ************************************************************************************/ - -#ifndef __ARCH_ARM_SRC_LPC17XX_LPC17_I2S_H -#define __ARCH_ARM_SRC_LPC17XX_LPC17_I2S_H - -/************************************************************************************ - * Included Files - ************************************************************************************/ - -#include - -#include "chip.h" -#include "lpc17_memorymap.h" - -/************************************************************************************ - * Pre-processor Definitions - ************************************************************************************/ - -/* Register offsets *****************************************************************/ - -#define LPC17_I2S_DAO_OFFSET 0x0000 /* Digital Audio Output Register */ -#define LPC17_I2S_DAI_OFFSET 0x0004 /* Digital Audio Input Register */ -#define LPC17_I2S_TXFIFO_OFFSET 0x0008 /* Transmit FIFO */ -#define LPC17_I2S_RXFIFO_OFFSET 0x000c /* Receive FIFO */ -#define LPC17_I2S_STATE_OFFSET 0x0010 /* Status Feedback Register */ -#define LPC17_I2S_DMA1_OFFSET 0x0014 /* DMA Configuration Register 1 */ -#define LPC17_I2S_DMA2_OFFSET 0x0018 /* DMA Configuration Register 2 */ -#define LPC17_I2S_IRQ_OFFSET 0x001c /* Interrupt Request Control Register */ -#define LPC17_I2S_TXRATE_OFFSET 0x0020 /* Transmit MCLK divider */ -#define LPC17_I2S_RXRATE_OFFSET 0x0024 /* Receive MCLK divider */ -#define LPC17_I2S_TXBITRATE_OFFSET 0x0028 /* Transmit bit rate divider */ -#define LPC17_I2S_RXBITRATE_OFFSET 0x002c /* Receive bit rate divider */ -#define LPC17_I2S_TXMODE_OFFSET 0x0030 /* Transmit mode control */ -#define LPC17_I2S_RXMODE_OFFSET 0x0034 /* Receive mode control */ - -/* Register addresses ***************************************************************/ - -#define LPC17_I2S_DAO (LPC17_I2S_BASE+LPC17_I2S_DAO_OFFSET) -#define LPC17_I2S_DAI (LPC17_I2S_BASE+LPC17_I2S_DAI_OFFSET) -#define LPC17_I2S_TXFIFO (LPC17_I2S_BASE+LPC17_I2S_TXFIFO_OFFSET) -#define LPC17_I2S_RXFIFO (LPC17_I2S_BASE+LPC17_I2S_RXFIFO_OFFSET) -#define LPC17_I2S_STATE (LPC17_I2S_BASE+LPC17_I2S_STATE_OFFSET) -#define LPC17_I2S_DMA1 (LPC17_I2S_BASE+LPC17_I2S_DMA1_OFFSET) -#define LPC17_I2S_DMA2 (LPC17_I2S_BASE+LPC17_I2S_DMA2_OFFSET) -#define LPC17_I2S_IRQ (LPC17_I2S_BASE+LPC17_I2S_IRQ_OFFSET) -#define LPC17_I2S_TXRATE (LPC17_I2S_BASE+LPC17_I2S_TXRATE_OFFSET) -#define LPC17_I2S_RXRATE (LPC17_I2S_BASE+LPC17_I2S_RXRATE_OFFSET) -#define LPC17_I2S_TXBITRATE (LPC17_I2S_BASE+LPC17_I2S_TXBITRATE_OFFSET) -#define LPC17_I2S_RXBITRATE (LPC17_I2S_BASE+LPC17_I2S_RXBITRATE_OFFSET) -#define LPC17_I2S_TXMODE (LPC17_I2S_BASE+LPC17_I2S_TXMODE_OFFSET) -#define LPC17_I2S_RXMODE (LPC17_I2S_BASE+LPC17_I2S_RXMODE_OFFSET) - -/* Register bit definitions *********************************************************/ - -/* Digital Audio Output Register */ - -#define I2S_DAO_WDWID_SHIFT (0) /* Bits 0-1: Selects the number of bytes in data */ -#define I2S_DAO_WDWID_MASK (3 << I2S_DAO_WDWID_SHIFT) -# define I2S_DAO_WDWID_8BITS (0 << I2S_DAO_WDWID_SHIFT) -# define I2S_DAO_WDWID_16BITS (1 << I2S_DAO_WDWID_SHIFT) -# define I2S_DAO_WDWID_32BITS (3 << I2S_DAO_WDWID_SHIFT) -#define I2S_DAO_MONO (1 << 2) /* Bit 2: Mono format */ -#define I2S_DAO_STOP (1 << 3) /* Bit 3: Disable FIFOs / mute mode */ -#define I2S_DAO_RESET (1 << 4) /* Bit 4: Reset TX channel and FIFO */ -#define I2S_DAO_WSSEL (1 << 5) /* Bit 5: Slave mode select */ -#define I2S_DAO_WSHALFPER_SHIFT (6) /* Bits 6-14: Word select half period minus 1 */ -#define I2S_DAO_WSHALFPER_MASK (0x01ff << I2S_DAO_WSHALFPER_SHIFT) -#define I2S_DAO_MUTE (1 << 15) /* Bit 15: Send only zeros on channel */ - /* Bits 16-31: Reserved */ -/* Digital Audio Input Register */ - -#define I2S_DAI_WDWID_SHIFT (0) /* Bits 0-1: Selects the number of bytes in data */ -#define I2S_DAI_WDWID_MASK (3 << I2S_DAI_WDWID_SHIFT) -# define I2S_DAI_WDWID_8BITS (0 << I2S_DAI_WDWID_SHIFT) -# define I2S_DAI_WDWID_16BITS (1 << I2S_DAI_WDWID_SHIFT) -# define I2S_DAI_WDWID_32BITS (3 << I2S_DAI_WDWID_SHIFT) -#define I2S_DAI_MONO (1 << 2) /* Bit 2: Mono format */ -#define I2S_DAI_STOP (1 << 3) /* Bit 3: Disable FIFOs / mute mode */ -#define I2S_DAI_RESET (1 << 4) /* Bit 4: Reset TX channel and FIFO */ -#define I2S_DAI_WSSEL (1 << 5) /* Bit 5: Slave mode select */ -#define I2S_DAI_WSHALFPER_SHIFT (6) /* Bits 6-14: Word select half period minus 1 */ -#define I2S_DAI_WSHALFPER_MASK (0x01ff << I2S_DAI_WSHALFPER_SHIFT) - /* Bits 15-31: Reserved */ -/* Transmit FIFO: 8 × 32-bit transmit FIFO */ -/* Receive FIFO: 8 × 32-bit receive FIFO */ - -/* Status Feedback Register */ - -#define I2S_STATE_IRQ (1 << 0) /* Bit 0: Receive Transmit Interrupt */ -#define I2S_STATE_DMAREQ1 (1 << 1) /* Bit 1: Receive or Transmit DMA Request 1 */ -#define I2S_STATE_DMAREQ2 (1 << 2) /* Bit 2: Receive or Transmit DMA Request 2 */ - /* Bits 3-7: Reserved */ -#define I2S_STATE_RXLEVEL_SHIFT (8) /* Bits 8-11: Current level of the Receive FIFO */ -#define I2S_STATE_RXLEVEL_MASK (15 << I2S_STATE_RXLEVEL_SHIFT) - /* Bits 12-15: Reserved */ -#define I2S_STATE_TXLEVEL_SHIFT (16) /* Bits 16-19: Current level of the Transmit FIFO */ -#define I2S_STATE_TXLEVEL_MASK (15 << I2S_STATE_TXLEVEL_SHIFT) - /* Bits 20-31: Reserved */ -/* DMA Configuration Register 1 and 2 */ - -#define I2S_DMA_RXDMAEN (1 << 0) /* Bit 0: Enable DMA1 for I2S receive */ -#define I2S_DMA_TXDMAEN (1 << 1) /* Bit 1: Enable DMA1 for I2S transmit */ - /* Bits 2-7: Reserved */ -#define I2S_DMA_RXDEPTH_SHIFT (8) /* Bits 8-11: FIFO level that triggers RX request on DMA1 */ -#define I2S_DMA_RXDEPTH_MASK (15 << I2S_DMA_RXDEPTH_SHIFT) - /* Bits 12-15: Reserved */ -#define I2S_DMA_TXDEPTH_SHIFT (16) /* Bits 16-19: FIFO level that triggers a TX request on DMA1 */ -#define I2S_DMA_TXDEPTH_MASK (15 << I2S_DMA_TXDEPTH_SHIFT) - /* Bits 20-31: Reserved */ -/* Interrupt Request Control Register */ - -#define I2S_IRQ_RXEN (1 << 0) /* Bit 0: Enable I2S receive interrupt */ -#define I2S_IRQ_TXEN (1 << 1) /* Bit 1: Enable I2S transmit interrupt */ - /* Bits 2-7: Reserved */ -#define I2S_IRQ_RXDEPTH_SHIFT (8) /* Bits 8-11: Set FIFO level for irq request */ -#define I2S_IRQ_RXDEPTH_MASK (15 << I2S_IRQ_RXDEPTH_SHIFT) - /* Bits 12-15: Reserved */ -#define I2S_IRQ_TXDEPTH_SHIFT (16) /* Bits 16-19: Set FIFO level for irq request */ -#define I2S_IRQ_TXDEPTH_MASK (15 << I2S_IRQ_TXDEPTH_SHIFT) - /* Bits 20-31: Reserved */ -/* Transmit and Receive MCLK divider */ - -#define I2S_RATE_YDIV_SHIFT (0) /* Bits 0-7: I2S transmit MCLK rate denominator */ -#define I2S_RATE_YDIV_MASK (0xff << I2S_RATE_YDIV_SHIFT) -#define I2S_RATE_XDIV_SHIFT (8) /* Bits 8-15: I2S transmit MCLK rate numerator */ -#define I2S_RATE_XDIV_MASK (0xff << I2S_RATE_XDIV_SHIFT) - /* Bits 16-31: Reserved */ - -/* Transmit and received bit rate divider */ - -#define I2S_BITRATE_SHIFT (0) /* Bits 0-5: I2S transmit bit rate */ -#define I2S_BITRATE_MASK (0x3f << I2S_BITRATE_SHIFT) - /* Bits 6-31: Reserved */ -/* Transmit and Receive mode control */ - -#define I2S_MODE_CLKSEL_SHIFT (0) /* Bits 0-1: Clock source for bit clock divider */ -#define I2S_MODE_CLKSEL_MASK (3 << I2S_MODE_CLKSEL_SHIFT) -# define I2S_MODE_CLKSEL_FRACDIV (0 << I2S_MODE_CLKSEL_SHIFT) /* TX/RX fractional rate divider */ -# define I2S_MODE_CLKSEL_RXMCLK (2 << I2S_MODE_CLKSEL_SHIFT) /* RX_CLCK for TX_MCLK source */ -# define I2S_MODE_CLKSEL_TXMCLK (2 << I2S_MODE_CLKSEL_SHIFT) /* TX_CLCK for RX_MCLK source */ -#define I2S_MODE_4PIN (1 << 2) /* Bit 2: Transmit/Receive 4-pin mode selection */ -#define I2S_MODE_MCENA (1 << 3) /* Bit 3: Enable for the TX/RX_MCLK output */ - /* Bits 4-31: Reserved */ - -/************************************************************************************ - * Public Types - ************************************************************************************/ - -/************************************************************************************ - * Public Data - ************************************************************************************/ - -/************************************************************************************ - * Public Functions - ************************************************************************************/ - -#endif /* __ARCH_ARM_SRC_LPC17XX_LPC17_I2S_H */ +/************************************************************************************ + * arch/arm/src/lpc17xx/lpc17_i2s + * + * Copyright (C) 2010, 2012 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * 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. + * + ************************************************************************************/ + +#ifndef __ARCH_ARM_SRC_LPC17XX_LPC17_I2S_H +#define __ARCH_ARM_SRC_LPC17XX_LPC17_I2S_H + +/************************************************************************************ + * Included Files + ************************************************************************************/ + +#include + +#include "chip.h" +#include "chip/lpc17_memorymap.h" + +/************************************************************************************ + * Pre-processor Definitions + ************************************************************************************/ + +/* Register offsets *****************************************************************/ + +#define LPC17_I2S_DAO_OFFSET 0x0000 /* Digital Audio Output Register */ +#define LPC17_I2S_DAI_OFFSET 0x0004 /* Digital Audio Input Register */ +#define LPC17_I2S_TXFIFO_OFFSET 0x0008 /* Transmit FIFO */ +#define LPC17_I2S_RXFIFO_OFFSET 0x000c /* Receive FIFO */ +#define LPC17_I2S_STATE_OFFSET 0x0010 /* Status Feedback Register */ +#define LPC17_I2S_DMA1_OFFSET 0x0014 /* DMA Configuration Register 1 */ +#define LPC17_I2S_DMA2_OFFSET 0x0018 /* DMA Configuration Register 2 */ +#define LPC17_I2S_IRQ_OFFSET 0x001c /* Interrupt Request Control Register */ +#define LPC17_I2S_TXRATE_OFFSET 0x0020 /* Transmit MCLK divider */ +#define LPC17_I2S_RXRATE_OFFSET 0x0024 /* Receive MCLK divider */ +#define LPC17_I2S_TXBITRATE_OFFSET 0x0028 /* Transmit bit rate divider */ +#define LPC17_I2S_RXBITRATE_OFFSET 0x002c /* Receive bit rate divider */ +#define LPC17_I2S_TXMODE_OFFSET 0x0030 /* Transmit mode control */ +#define LPC17_I2S_RXMODE_OFFSET 0x0034 /* Receive mode control */ + +/* Register addresses ***************************************************************/ + +#define LPC17_I2S_DAO (LPC17_I2S_BASE+LPC17_I2S_DAO_OFFSET) +#define LPC17_I2S_DAI (LPC17_I2S_BASE+LPC17_I2S_DAI_OFFSET) +#define LPC17_I2S_TXFIFO (LPC17_I2S_BASE+LPC17_I2S_TXFIFO_OFFSET) +#define LPC17_I2S_RXFIFO (LPC17_I2S_BASE+LPC17_I2S_RXFIFO_OFFSET) +#define LPC17_I2S_STATE (LPC17_I2S_BASE+LPC17_I2S_STATE_OFFSET) +#define LPC17_I2S_DMA1 (LPC17_I2S_BASE+LPC17_I2S_DMA1_OFFSET) +#define LPC17_I2S_DMA2 (LPC17_I2S_BASE+LPC17_I2S_DMA2_OFFSET) +#define LPC17_I2S_IRQ (LPC17_I2S_BASE+LPC17_I2S_IRQ_OFFSET) +#define LPC17_I2S_TXRATE (LPC17_I2S_BASE+LPC17_I2S_TXRATE_OFFSET) +#define LPC17_I2S_RXRATE (LPC17_I2S_BASE+LPC17_I2S_RXRATE_OFFSET) +#define LPC17_I2S_TXBITRATE (LPC17_I2S_BASE+LPC17_I2S_TXBITRATE_OFFSET) +#define LPC17_I2S_RXBITRATE (LPC17_I2S_BASE+LPC17_I2S_RXBITRATE_OFFSET) +#define LPC17_I2S_TXMODE (LPC17_I2S_BASE+LPC17_I2S_TXMODE_OFFSET) +#define LPC17_I2S_RXMODE (LPC17_I2S_BASE+LPC17_I2S_RXMODE_OFFSET) + +/* Register bit definitions *********************************************************/ + +/* Digital Audio Output Register */ + +#define I2S_DAO_WDWID_SHIFT (0) /* Bits 0-1: Selects the number of bytes in data */ +#define I2S_DAO_WDWID_MASK (3 << I2S_DAO_WDWID_SHIFT) +# define I2S_DAO_WDWID_8BITS (0 << I2S_DAO_WDWID_SHIFT) +# define I2S_DAO_WDWID_16BITS (1 << I2S_DAO_WDWID_SHIFT) +# define I2S_DAO_WDWID_32BITS (3 << I2S_DAO_WDWID_SHIFT) +#define I2S_DAO_MONO (1 << 2) /* Bit 2: Mono format */ +#define I2S_DAO_STOP (1 << 3) /* Bit 3: Disable FIFOs / mute mode */ +#define I2S_DAO_RESET (1 << 4) /* Bit 4: Reset TX channel and FIFO */ +#define I2S_DAO_WSSEL (1 << 5) /* Bit 5: Slave mode select */ +#define I2S_DAO_WSHALFPER_SHIFT (6) /* Bits 6-14: Word select half period minus 1 */ +#define I2S_DAO_WSHALFPER_MASK (0x01ff << I2S_DAO_WSHALFPER_SHIFT) +#define I2S_DAO_MUTE (1 << 15) /* Bit 15: Send only zeros on channel */ + /* Bits 16-31: Reserved */ +/* Digital Audio Input Register */ + +#define I2S_DAI_WDWID_SHIFT (0) /* Bits 0-1: Selects the number of bytes in data */ +#define I2S_DAI_WDWID_MASK (3 << I2S_DAI_WDWID_SHIFT) +# define I2S_DAI_WDWID_8BITS (0 << I2S_DAI_WDWID_SHIFT) +# define I2S_DAI_WDWID_16BITS (1 << I2S_DAI_WDWID_SHIFT) +# define I2S_DAI_WDWID_32BITS (3 << I2S_DAI_WDWID_SHIFT) +#define I2S_DAI_MONO (1 << 2) /* Bit 2: Mono format */ +#define I2S_DAI_STOP (1 << 3) /* Bit 3: Disable FIFOs / mute mode */ +#define I2S_DAI_RESET (1 << 4) /* Bit 4: Reset TX channel and FIFO */ +#define I2S_DAI_WSSEL (1 << 5) /* Bit 5: Slave mode select */ +#define I2S_DAI_WSHALFPER_SHIFT (6) /* Bits 6-14: Word select half period minus 1 */ +#define I2S_DAI_WSHALFPER_MASK (0x01ff << I2S_DAI_WSHALFPER_SHIFT) + /* Bits 15-31: Reserved */ +/* Transmit FIFO: 8 × 32-bit transmit FIFO */ +/* Receive FIFO: 8 × 32-bit receive FIFO */ + +/* Status Feedback Register */ + +#define I2S_STATE_IRQ (1 << 0) /* Bit 0: Receive Transmit Interrupt */ +#define I2S_STATE_DMAREQ1 (1 << 1) /* Bit 1: Receive or Transmit DMA Request 1 */ +#define I2S_STATE_DMAREQ2 (1 << 2) /* Bit 2: Receive or Transmit DMA Request 2 */ + /* Bits 3-7: Reserved */ +#define I2S_STATE_RXLEVEL_SHIFT (8) /* Bits 8-11: Current level of the Receive FIFO */ +#define I2S_STATE_RXLEVEL_MASK (15 << I2S_STATE_RXLEVEL_SHIFT) + /* Bits 12-15: Reserved */ +#define I2S_STATE_TXLEVEL_SHIFT (16) /* Bits 16-19: Current level of the Transmit FIFO */ +#define I2S_STATE_TXLEVEL_MASK (15 << I2S_STATE_TXLEVEL_SHIFT) + /* Bits 20-31: Reserved */ +/* DMA Configuration Register 1 and 2 */ + +#define I2S_DMA_RXDMAEN (1 << 0) /* Bit 0: Enable DMA1 for I2S receive */ +#define I2S_DMA_TXDMAEN (1 << 1) /* Bit 1: Enable DMA1 for I2S transmit */ + /* Bits 2-7: Reserved */ +#define I2S_DMA_RXDEPTH_SHIFT (8) /* Bits 8-11: FIFO level that triggers RX request on DMA1 */ +#define I2S_DMA_RXDEPTH_MASK (15 << I2S_DMA_RXDEPTH_SHIFT) + /* Bits 12-15: Reserved */ +#define I2S_DMA_TXDEPTH_SHIFT (16) /* Bits 16-19: FIFO level that triggers a TX request on DMA1 */ +#define I2S_DMA_TXDEPTH_MASK (15 << I2S_DMA_TXDEPTH_SHIFT) + /* Bits 20-31: Reserved */ +/* Interrupt Request Control Register */ + +#define I2S_IRQ_RXEN (1 << 0) /* Bit 0: Enable I2S receive interrupt */ +#define I2S_IRQ_TXEN (1 << 1) /* Bit 1: Enable I2S transmit interrupt */ + /* Bits 2-7: Reserved */ +#define I2S_IRQ_RXDEPTH_SHIFT (8) /* Bits 8-11: Set FIFO level for irq request */ +#define I2S_IRQ_RXDEPTH_MASK (15 << I2S_IRQ_RXDEPTH_SHIFT) + /* Bits 12-15: Reserved */ +#define I2S_IRQ_TXDEPTH_SHIFT (16) /* Bits 16-19: Set FIFO level for irq request */ +#define I2S_IRQ_TXDEPTH_MASK (15 << I2S_IRQ_TXDEPTH_SHIFT) + /* Bits 20-31: Reserved */ +/* Transmit and Receive MCLK divider */ + +#define I2S_RATE_YDIV_SHIFT (0) /* Bits 0-7: I2S transmit MCLK rate denominator */ +#define I2S_RATE_YDIV_MASK (0xff << I2S_RATE_YDIV_SHIFT) +#define I2S_RATE_XDIV_SHIFT (8) /* Bits 8-15: I2S transmit MCLK rate numerator */ +#define I2S_RATE_XDIV_MASK (0xff << I2S_RATE_XDIV_SHIFT) + /* Bits 16-31: Reserved */ + +/* Transmit and received bit rate divider */ + +#define I2S_BITRATE_SHIFT (0) /* Bits 0-5: I2S transmit bit rate */ +#define I2S_BITRATE_MASK (0x3f << I2S_BITRATE_SHIFT) + /* Bits 6-31: Reserved */ +/* Transmit and Receive mode control */ + +#define I2S_MODE_CLKSEL_SHIFT (0) /* Bits 0-1: Clock source for bit clock divider */ +#define I2S_MODE_CLKSEL_MASK (3 << I2S_MODE_CLKSEL_SHIFT) +# define I2S_MODE_CLKSEL_FRACDIV (0 << I2S_MODE_CLKSEL_SHIFT) /* TX/RX fractional rate divider */ +# define I2S_MODE_CLKSEL_RXMCLK (2 << I2S_MODE_CLKSEL_SHIFT) /* RX_CLCK for TX_MCLK source */ +# define I2S_MODE_CLKSEL_TXMCLK (2 << I2S_MODE_CLKSEL_SHIFT) /* TX_CLCK for RX_MCLK source */ +#define I2S_MODE_4PIN (1 << 2) /* Bit 2: Transmit/Receive 4-pin mode selection */ +#define I2S_MODE_MCENA (1 << 3) /* Bit 3: Enable for the TX/RX_MCLK output */ + /* Bits 4-31: Reserved */ + +/************************************************************************************ + * Public Types + ************************************************************************************/ + +/************************************************************************************ + * Public Data + ************************************************************************************/ + +/************************************************************************************ + * Public Functions + ************************************************************************************/ + +#endif /* __ARCH_ARM_SRC_LPC17XX_LPC17_I2S_H */ diff --git a/nuttx/arch/arm/src/lpc17xx/lpc17_internal.h b/nuttx/arch/arm/src/lpc17xx/lpc17_internal.h deleted file mode 100644 index 8b43581969..0000000000 --- a/nuttx/arch/arm/src/lpc17xx/lpc17_internal.h +++ /dev/null @@ -1,854 +0,0 @@ -/************************************************************************************ - * arch/arm/src/lpc17xx/lpc17_internal.h - * - * Copyright (C) 2009-2011 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt - * - * 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. - * - ************************************************************************************/ - -#ifndef __ARCH_ARM_SRC_LPC17XX_LPC17_INTERNAL_H -#define __ARCH_ARM_SRC_LPC17XX_LPC17_INTERNAL_H - -/************************************************************************************ - * Included Files - ************************************************************************************/ - -#include -#include - -#include -#include -#include - -#if defined(CONFIG_LPC17_SPI) || defined(CONFIG_LPC17_SSP0) || defined(CONFIG_LPC17_SSP1) -# include -#endif - -#include "up_internal.h" -#include "chip.h" - -/************************************************************************************ - * Definitions - ************************************************************************************/ - -/* Configuration ********************************************************************/ - -/* Bit-encoded input to lpc17_configgpio() ******************************************/ - -/* Encoding: FFFx MMOV PPPN NNNN - * - * Pin Function: FFF - * Pin Mode bits: MM - * Open drain: O (output pins) - * Initial value: V (output pins) - * Port number: PPP (0-4) - * Pin number: NNNNN (0-31) - */ - -/* Pin Function bits: FFF - * Only meaningful when the GPIO function is GPIO_PIN - */ - -#define GPIO_FUNC_SHIFT (13) /* Bits 13-15: GPIO mode */ -#define GPIO_FUNC_MASK (7 << GPIO_FUNC_SHIFT) -# define GPIO_INPUT (0 << GPIO_FUNC_SHIFT) /* 000 GPIO input pin */ -# define GPIO_INTFE (1 << GPIO_FUNC_SHIFT) /* 001 GPIO interrupt falling edge */ -# define GPIO_INTRE (2 << GPIO_FUNC_SHIFT) /* 010 GPIO interrupt rising edge */ -# define GPIO_INTBOTH (3 << GPIO_FUNC_SHIFT) /* 011 GPIO interrupt both edges */ -# define GPIO_OUTPUT (4 << GPIO_FUNC_SHIFT) /* 100 GPIO outpout pin */ -# define GPIO_ALT1 (5 << GPIO_FUNC_SHIFT) /* 101 Alternate function 1 */ -# define GPIO_ALT2 (6 << GPIO_FUNC_SHIFT) /* 110 Alternate function 2 */ -# define GPIO_ALT3 (7 << GPIO_FUNC_SHIFT) /* 111 Alternate function 3 */ - -#define GPIO_EDGE_SHIFT (13) /* Bits 13-14: Interrupt edge bits */ -#define GPIO_EDGE_MASK (3 << GPIO_EDGE_SHIFT) - -#define GPIO_INOUT_MASK GPIO_OUTPUT -#define GPIO_FE_MASK GPIO_INTFE -#define GPIO_RE_MASK GPIO_INTRE - -#define GPIO_ISGPIO(ps) ((uint16_t(ps) & GPIO_FUNC_MASK) <= GPIO_OUTPUT) -#define GPIO_ISALT(ps) ((uint16_t(ps) & GPIO_FUNC_MASK) > GPIO_OUTPUT) -#define GPIO_ISINPUT(ps) (((ps) & GPIO_FUNC_MASK) == GPIO_INPUT) -#define GPIO_ISOUTPUT(ps) (((ps) & GPIO_FUNC_MASK) == GPIO_OUTPUT) -#define GPIO_ISINORINT(ps) (((ps) & GPIO_INOUT_MASK) == 0) -#define GPIO_ISOUTORALT(ps) (((ps) & GPIO_INOUT_MASK) != 0) -#define GPIO_ISINTERRUPT(ps) (GPIO_ISOUTPUT(ps) && !GPIO_ISINPUT(ps)) -#define GPIO_ISFE(ps) (((ps) & GPIO_FE_MASK) != 0) -#define GPIO_ISRE(ps) (((ps) & GPIO_RE_MASK) != 0) - -/* Pin Mode: MM */ - -#define GPIO_PUMODE_SHIFT (10) /* Bits 10-11: Pin pull-up mode */ -#define GPIO_PUMODE_MASK (3 << GPIO_PUMODE_SHIFT) -# define GPIO_PULLUP (0 << GPIO_PUMODE_SHIFT) /* Pull-up resistor enabled */ -# define GPIO_REPEATER (1 << GPIO_PUMODE_SHIFT) /* Repeater mode enabled */ -# define GPIO_FLOAT (2 << GPIO_PUMODE_SHIFT) /* Neither pull-up nor -down */ -# define GPIO_PULLDN (3 << GPIO_PUMODE_SHIFT) /* Pull-down resistor enabled */ - -/* Open drain: O */ - -#define GPIO_OPEN_DRAIN (1 << 9) /* Bit 9: Open drain mode */ - -/* Initial value: V */ - -#define GPIO_VALUE (1 << 8) /* Bit 8: Initial GPIO output value */ -#define GPIO_VALUE_ONE GPIO_VALUE -#define GPIO_VALUE_ZERO (0) - -/* Port number: PPP (0-4) */ - -#define GPIO_PORT_SHIFT (5) /* Bit 5-7: Port number */ -#define GPIO_PORT_MASK (7 << GPIO_PORT_SHIFT) -# define GPIO_PORT0 (0 << GPIO_PORT_SHIFT) -# define GPIO_PORT1 (1 << GPIO_PORT_SHIFT) -# define GPIO_PORT2 (2 << GPIO_PORT_SHIFT) -# define GPIO_PORT3 (3 << GPIO_PORT_SHIFT) -# define GPIO_PORT4 (4 << GPIO_PORT_SHIFT) - -#define GPIO_NPORTS 5 - -/* Pin number: NNNNN (0-31) */ - -#define GPIO_PIN_SHIFT 0 /* Bits 0-4: GPIO number: 0-31 */ -#define GPIO_PIN_MASK (31 << GPIO_PIN_SHIFT) -#define GPIO_PIN0 (0 << GPIO_PIN_SHIFT) -#define GPIO_PIN1 (1 << GPIO_PIN_SHIFT) -#define GPIO_PIN2 (2 << GPIO_PIN_SHIFT) -#define GPIO_PIN3 (3 << GPIO_PIN_SHIFT) -#define GPIO_PIN4 (4 << GPIO_PIN_SHIFT) -#define GPIO_PIN5 (5 << GPIO_PIN_SHIFT) -#define GPIO_PIN6 (6 << GPIO_PIN_SHIFT) -#define GPIO_PIN7 (7 << GPIO_PIN_SHIFT) -#define GPIO_PIN8 (8 << GPIO_PIN_SHIFT) -#define GPIO_PIN9 (9 << GPIO_PIN_SHIFT) -#define GPIO_PIN10 (10 << GPIO_PIN_SHIFT) -#define GPIO_PIN11 (11 << GPIO_PIN_SHIFT) -#define GPIO_PIN12 (12 << GPIO_PIN_SHIFT) -#define GPIO_PIN13 (13 << GPIO_PIN_SHIFT) -#define GPIO_PIN14 (14 << GPIO_PIN_SHIFT) -#define GPIO_PIN15 (15 << GPIO_PIN_SHIFT) -#define GPIO_PIN16 (16 << GPIO_PIN_SHIFT) -#define GPIO_PIN17 (17 << GPIO_PIN_SHIFT) -#define GPIO_PIN18 (18 << GPIO_PIN_SHIFT) -#define GPIO_PIN19 (19 << GPIO_PIN_SHIFT) -#define GPIO_PIN20 (20 << GPIO_PIN_SHIFT) -#define GPIO_PIN21 (21 << GPIO_PIN_SHIFT) -#define GPIO_PIN22 (22 << GPIO_PIN_SHIFT) -#define GPIO_PIN23 (23 << GPIO_PIN_SHIFT) -#define GPIO_PIN24 (24 << GPIO_PIN_SHIFT) -#define GPIO_PIN25 (25 << GPIO_PIN_SHIFT) -#define GPIO_PIN26 (26 << GPIO_PIN_SHIFT) -#define GPIO_PIN27 (27 << GPIO_PIN_SHIFT) -#define GPIO_PIN28 (28 << GPIO_PIN_SHIFT) -#define GPIO_PIN29 (29 << GPIO_PIN_SHIFT) -#define GPIO_PIN30 (30 << GPIO_PIN_SHIFT) -#define GPIO_PIN31 (31 << GPIO_PIN_SHIFT) - -/* GPIO pin definitions *************************************************************/ -/* NOTE that functions have a alternate pins that can be selected. These alternates - * are identified with a numerica suffix like _1, _2, or _3. Your board.h file - * should select the correct alternative for your board by including definitions - * such as: - * - * #define GPIO_UART1_RXD GPIO_UART1_RXD_1 - * - * (without the suffix) - */ - -#define GPIO_CAN1_RD_1 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN0) -#define GPIO_UART3_TXD_1 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN0) -#define GPIO_I2C1_SDA_1 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN0) -#define GPIO_CAN1_TD_1 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN1) -#define GPIO_UART3_RXD_1 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN1) -#define GPIO_I2C1_SCL_1 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN1) -#define GPIO_UART0_TXD (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN2) -#define GPIO_AD0p7 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN2) -#define GPIO_UART0_RXD (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN3) -#define GPIO_AD0p6 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN3) -#define GPIO_I2S_RXCLK_1 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN4) -#define GPIO_CAN2_RD (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN4) -#define GPIO_CAP2p0 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN4) -#define GPIO_I2S_RXWS_1 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN5) -#define GPIO_CAN2_TD (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN5) -#define GPIO_CAP2p1 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN5) -#define GPIO_I2S_RXSDA_1 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN6) -#define GPIO_SSP1_SSEL (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN6) -#define GPIO_MAT2p0_1 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN6) -#define GPIO_I2S_TXCLK_1 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN7) -#define GPIO_SSP1_SCK_1 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN7) -#define GPIO_MAT2p1_1 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN7) -#define GPIO_I2S_TXWS_1 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN8) -#define GPIO_SSP1_MISO (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN8) -#define GPIO_MAT2p2 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN8) -#define GPIO_I2S_TXSDA_1 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN9) -#define GPIO_SSP1_MOSI (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN9) -#define GPIO_MAT2p3 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN9) -#define GPIO_UART2_TXD_1 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN10) -#define GPIO_I2C2_SDA (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN10) -#define GPIO_MAT3p0 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN10) -#define GPIO_UART2_RXD_1 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN11) -#define GPIO_I2C2_SCL (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN11) -#define GPIO_MAT3p1 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN11) -#define GPIO_UART1_TXD_1 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN15) -#define GPIO_SSP0_SCK_1 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN15) -#define GPIO_SPI_SCK (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN15) -#define GPIO_UART1_RXD_1 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN16) -#define GPIO_SSP0_SSEL_1 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN16) -#define GPIO_SPI_SSEL (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN16) -#define GPIO_UART1_CTS_1 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN17) -#define GPIO_SSP0_MISO_1 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN17) -#define GPIO_SPI_MISO (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN17) -#define GPIO_UART1_DCD_1 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN18) -#define GPIO_SSP0_MOSI_1 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN18) -#define GPIO_SPI_MOSI (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN18) -#define GPIO_UART1_DSR_1 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN19) -#define GPIO_I2C1_SDA_2 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN19) -#define GPIO_UART1_DTR_1 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN20) -#define GPIO_I2C1_SCL_2 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN20) -#define GPIO_UART1_RI_1 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN21) -#define GPIO_CAN1_RD_2 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN21) -#define GPIO_UART1_RTS_1 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN22) -#define GPIO_CAN1_TD_2 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN22) -#define GPIO_AD0p0 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN23) -#define GPIO_I2S_RXCLK_2 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN23) -#define GPIO_CAP3p0 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN23) -#define GPIO_AD0p1 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN24) -#define GPIO_I2S_RXWS_2 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN24) -#define GPIO_CAP3p1 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN24) -#define GPIO_AD0p2 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN25) -#define GPIO_I2S_RXSDA_2 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN25) -#define GPIO_UART3_TXD_2 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN25) -#define GPIO_AD0p3 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN26) -#define GPIO_AOUT (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN26) -#define GPIO_UART3_RXD_2 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN26) -#define GPIO_I2C0_SDA (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN27) -#define GPIO_USB_SDA (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN27) -#define GPIO_I2C0_SCL (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN28) -#define GPIO_USB_SCL (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN28) -#define GPIO_USB_DP (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN29) -#define GPIO_USB_DM (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN30) -#define GPIO_ENET_TXD0 (GPIO_ALT1 | GPIO_FLOAT | GPIO_PORT1 | GPIO_PIN0) -#define GPIO_ENET_TXD1 (GPIO_ALT1 | GPIO_FLOAT | GPIO_PORT1 | GPIO_PIN1) -#define GPIO_ENET_TXEN (GPIO_ALT1 | GPIO_FLOAT | GPIO_PORT1 | GPIO_PIN4) -#define GPIO_ENET_CRS (GPIO_ALT1 | GPIO_FLOAT | GPIO_PORT1 | GPIO_PIN8) -#define GPIO_ENET_RXD0 (GPIO_ALT1 | GPIO_FLOAT | GPIO_PORT1 | GPIO_PIN9) -#define GPIO_ENET_RXD1 (GPIO_ALT1 | GPIO_FLOAT | GPIO_PORT1 | GPIO_PIN10) -#define GPIO_ENET_RXER (GPIO_ALT1 | GPIO_FLOAT | GPIO_PORT1 | GPIO_PIN14) -#define GPIO_ENET_REFCLK (GPIO_ALT1 | GPIO_FLOAT | GPIO_PORT1 | GPIO_PIN15) -#define GPIO_ENET_MDC_1 (GPIO_ALT1 | GPIO_FLOAT | GPIO_PORT1 | GPIO_PIN16) -#define GPIO_ENET_MDIO_1 (GPIO_ALT1 | GPIO_FLOAT | GPIO_PORT1 | GPIO_PIN17) -#define GPIO_USB_UPLED (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN18) -#define GPIO_PWM1p1_1 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN18) -#define GPIO_CAP1p0 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN18) -#define GPIO_MCPWM_MCOA0 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN19) -#define GPIO_USB_PPWR (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN19) -#define GPIO_CAP1p1 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN19) -#define GPIO_MCPWM_MCI0 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN20) -#define GPIO_PWM1p2_1 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN20) -#define GPIO_SSP0_SCK_2 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN20) -#define GPIO_MCPWM_MCABORT (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN21) -#define GPIO_PWM1p3_1 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN21) -#define GPIO_SSP0_SSEL_2 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN21) -#define GPIO_MCPWM_MCOB0 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN22) -#define GPIO_USB_PWRD (GPIO_ALT2 | GPIO_PULLDN | GPIO_PORT1 | GPIO_PIN22) -#define GPIO_MAT1p0 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN22) -#define GPIO_MCPWM_MCI1 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN23) -#define GPIO_PWM1p4_1 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN23) -#define GPIO_SSP0_MISO_2 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN23) -#define GPIO_MCPWM_MCI2 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN24) -#define GPIO_PWM1p5_1 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN24) -#define GPIO_SSP0_MOSI_2 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN24) -#define GPIO_MCPWM_MCOA1 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN25) -#define GPIO_MAT1p1 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN25) -#define GPIO_MCPWM_MCOB1 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN26) -#define GPIO_PWM1p6_1 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN26) -#define GPIO_CAP0p0 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN26) -#define GPIO_CLKOUT (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN27) -#define GPIO_USB_OVRCR (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN27) -#define GPIO_CAP0p1 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN27) -#define GPIO_MCPWM_MCOA2 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN28) -#define GPIO_PCAP1p0_1 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN28) -#define GPIO_MAT0p0_1 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN28) -#define GPIO_MCPWM_MCOB2 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN29) -#define GPIO_PCAP1p1 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN29) -#define GPIO_MAT0p1_1 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN29) -#define GPIO_USB_VBUS (GPIO_ALT2 | GPIO_FLOAT | GPIO_PORT1 | GPIO_PIN30) -#define GPIO_AD0p4 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN30) -#define GPIO_SSP1_SCK_2 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN31) -#define GPIO_AD0p5 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN31) -#define GPIO_PWM1p1_2 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN0) -#define GPIO_UART1_TXD_2 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN0) -#define GPIO_PWM1p2_2 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN1) -#define GPIO_UART1_RXD_2 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN1) -#define GPIO_PWM1p3_2 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN2) -#define GPIO_UART1_CTS_2 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN2) -#define GPIO_PWM1p4_2 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN3) -#define GPIO_UART1_DCD_2 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN3) -#define GPIO_PWM1p5_2 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN4) -#define GPIO_UART1_DSR_2 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN4) -#define GPIO_PWM1p6_2 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN5) -#define GPIO_UART1_DTR_2 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN5) -#define GPIO_PCAP1p0_2 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN6) -#define GPIO_UART1_RI_2 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN6) -#define GPIO_CAN2_RD_2 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN7) -#define GPIO_UART1_RTS_2 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN7) -#define GPIO_CAN2_TD_2 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN8) -#define GPIO_UART2_TXD_2 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN8) -#define GPIO_ENET_MDC_2 (GPIO_ALT3 | GPIO_FLOAT | GPIO_PORT2 | GPIO_PIN8) -#define GPIO_USB_CONNECT (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN9) -#define GPIO_UART2_RXD_2 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN9) -#define GPIO_ENET_MDIO_2 (GPIO_ALT3 | GPIO_FLOAT | GPIO_PORT2 | GPIO_PIN9) -#define GPIO_EINT0 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN10) -#define GPIO_NMI (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN10) -#define GPIO_EINT1 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN11) -#define GPIO_I2S_TXCLK_2 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN11) -#define GPIO_PEINT2 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN12) -#define GPIO_I2S_TXWS_2 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN12) -#define GPIO_EINT3 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN13) -#define GPIO_I2S_TXSDA_2 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN13) -#define GPIO_MAT0p0_2 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT3 | GPIO_PIN25) -#define GPIO_PWM1p2_3 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT3 | GPIO_PIN25) -#define GPIO_STCLK (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT3 | GPIO_PIN26) -#define GPIO_MAT0p1_2 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT3 | GPIO_PIN26) -#define GPIO_PWM1p3_3 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT3 | GPIO_PIN26) -#define GPIO_RXMCLK (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT4 | GPIO_PIN28) -#define GPIO_MAT2p0_2 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT4 | GPIO_PIN28) -#define GPIO_UART3_TXD_3 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT4 | GPIO_PIN28) -#define GPIO_TXMCLK (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT4 | GPIO_PIN29) -#define GPIO_MAT2p1_2 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT4 | GPIO_PIN29) -#define GPIO_UART3_RXD_3 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT4 | GPIO_PIN29) - -/************************************************************************************ - * Public Types - ************************************************************************************/ - -typedef FAR void *DMA_HANDLE; -typedef void (*dma_callback_t)(DMA_HANDLE handle, void *arg, int result); - -/* The following is used for sampling DMA registers when CONFIG DEBUG_DMA is selected */ - -#ifdef CONFIG_DEBUG_DMA -struct lpc17_dmaglobalregs_s -{ - /* Global Registers */ - - uint32_t intst; /* DMA Interrupt Status Register */ - uint32_t inttcst; /* DMA Interrupt Terminal Count Request Status Register */ - uint32_t interrst; /* DMA Interrupt Error Status Register */ - uint32_t rawinttcst; /* DMA Raw Interrupt Terminal Count Status Register */ - uint32_t rawinterrst; /* DMA Raw Error Interrupt Status Register */ - uint32_t enbldchns; /* DMA Enabled Channel Register */ - uint32_t softbreq; /* DMA Software Burst Request Register */ - uint32_t softsreq; /* DMA Software Single Request Register */ - uint32_t softlbreq; /* DMA Software Last Burst Request Register */ - uint32_t softlsreq; /* DMA Software Last Single Request Register */ - uint32_t config; /* DMA Configuration Register */ - uint32_t sync; /* DMA Synchronization Register */ -}; - -struct lpc17_dmachanregs_s -{ - /* Channel Registers */ - - uint32_t srcaddr; /* DMA Channel Source Address Register */ - uint32_t destaddr; /* DMA Channel Destination Address Register */ - uint32_t lli; /* DMA Channel Linked List Item Register */ - uint32_t control; /* DMA Channel Control Register */ - uint32_t config; /* DMA Channel Configuration Register */ -}; - -struct lpc17_dmaregs_s -{ - /* Global Registers */ - - struct lpc17_dmaglobalregs_s gbl; - - /* Channel Registers */ - - struct lpc17_dmachanregs_s ch; -}; -#endif - -/************************************************************************************ - * Inline Functions - ************************************************************************************/ - -#ifndef __ASSEMBLY__ - -/************************************************************************************ - * Public Data - ************************************************************************************/ - -#undef EXTERN -#if defined(__cplusplus) -#define EXTERN extern "C" -extern "C" { -#else -#define EXTERN extern -#endif - -/* These tables have global scope only because they are shared between lpc17_gpio.c, - * lpc17_gpioint.c, and lpc17_gpiodbg.c - */ - -#ifdef CONFIG_GPIO_IRQ -EXTERN uint64_t g_intedge0; -EXTERN uint64_t g_intedge2; -#endif - -EXTERN const uint32_t g_fiobase[GPIO_NPORTS]; -EXTERN const uint32_t g_intbase[GPIO_NPORTS]; -EXTERN const uint32_t g_lopinsel[GPIO_NPORTS]; -EXTERN const uint32_t g_hipinsel[GPIO_NPORTS]; -EXTERN const uint32_t g_lopinmode[GPIO_NPORTS]; -EXTERN const uint32_t g_hipinmode[GPIO_NPORTS]; -EXTERN const uint32_t g_odmode[GPIO_NPORTS]; - -/************************************************************************************ - * Public Function Prototypes - ************************************************************************************/ - -/************************************************************************************ - * Name: lpc17_clockconfig - * - * Description: - * Called to initialize the LPC17XX. This does whatever setup is needed to put the - * MCU in a usable state. This includes the initialization of clocking using the - * settings in board.h. - * - ************************************************************************************/ - -EXTERN void lpc17_clockconfig(void); - -/************************************************************************************ - * Name: lpc17_lowsetup - * - * Description: - * Called at the very beginning of _start. Performs low level initialization - * including setup of the console UART. This UART done early so that the serial - * console is available for debugging very early in the boot sequence. - * - ************************************************************************************/ - -EXTERN void lpc17_lowsetup(void); - -/************************************************************************************ - * Name: lpc17_gpioirqinitialize - * - * Description: - * Initialize logic to support a second level of interrupt decoding for GPIO pins. - * - ************************************************************************************/ - -#ifdef CONFIG_GPIO_IRQ -EXTERN void lpc17_gpioirqinitialize(void); -#else -# define lpc17_gpioirqinitialize() -#endif - -/************************************************************************************ - * Name: lpc17_configgpio - * - * Description: - * Configure a GPIO pin based on bit-encoded description of the pin. - * - ************************************************************************************/ - -EXTERN int lpc17_configgpio(uint16_t cfgset); - -/************************************************************************************ - * Name: lpc17_gpiowrite - * - * Description: - * Write one or zero to the selected GPIO pin - * - ************************************************************************************/ - -EXTERN void lpc17_gpiowrite(uint16_t pinset, bool value); - -/************************************************************************************ - * Name: lpc17_gpioread - * - * Description: - * Read one or zero from the selected GPIO pin - * - ************************************************************************************/ - -EXTERN bool lpc17_gpioread(uint16_t pinset); - -/************************************************************************************ - * Name: lpc17_gpioirqenable - * - * Description: - * Enable the interrupt for specified GPIO IRQ - * - ************************************************************************************/ - -#ifdef CONFIG_GPIO_IRQ -EXTERN void lpc17_gpioirqenable(int irq); -#else -# define lpc17_gpioirqenable(irq) -#endif - -/************************************************************************************ - * Name: lpc17_gpioirqdisable - * - * Description: - * Disable the interrupt for specified GPIO IRQ - * - ************************************************************************************/ - -#ifdef CONFIG_GPIO_IRQ -EXTERN void lpc17_gpioirqdisable(int irq); -#else -# define lpc17_gpioirqdisable(irq) -#endif - -/************************************************************************************ - * Function: lpc17_dumpgpio - * - * Description: - * Dump all GPIO registers associated with the base address of the provided pinset. - * - ************************************************************************************/ - -#ifdef CONFIG_DEBUG_GPIO -EXTERN int lpc17_dumpgpio(uint16_t pinset, const char *msg); -#else -# define lpc17_dumpgpio(p,m) -#endif - -/************************************************************************************ - * Name: lpc17_clrpend - * - * Description: - * Clear a pending interrupt at the NVIC. This does not seem to be required - * for most interrupts. Don't know why... but the LPC1766 Ethernet EMAC - * interrupt definitely needs it! - * - ************************************************************************************/ - -EXTERN void lpc17_clrpend(int irq); - -/************************************************************************************ - * Name: lpc17_spi/ssp0/ssp1select, lpc17_spi/ssp0/ssp1status, and - * lpc17_spi/ssp0/ssp1cmddata - * - * Description: - * These external functions must be provided by board-specific logic. They are - * implementations of the select, status, and cmddata methods of the SPI interface - * defined by struct spi_ops_s (see include/nuttx/spi.h). All other methods - * including up_spiinitialize()) are provided by common LPC17xx logic. To use - * this common SPI logic on your board: - * - * 1. Provide logic in lpc17_boardinitialize() to configure SPI/SSP chip select - * pins. - * 2. Provide lpc17_spi/ssp0/ssp1select() and lpc17_spi/ssp0/ssp1status() functions - * in your board-specific logic. These functions will perform chip selection - * and status operations using GPIOs in the way your board is configured. - * 2. If CONFIG_SPI_CMDDATA is defined in the NuttX configuration, provide - * lpc17_spi/ssp0/ssp1cmddata() functions in your board-specific logic. These - * functions will perform cmd/data selection operations using GPIOs in the way - * your board is configured. - * 3. Add a call to up_spiinitialize() in your low level application - * initialization logic - * 4. The handle returned by up_spiinitialize() may then be used to bind the - * SPI driver to higher level logic (e.g., calling - * mmcsd_spislotinitialize(), for example, will bind the SPI driver to - * the SPI MMC/SD driver). - * - ************************************************************************************/ - -#ifdef CONFIG_LPC17_SPI -EXTERN void lpc17_spiselect(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected); -EXTERN uint8_t lpc17_spistatus(FAR struct spi_dev_s *dev, enum spi_dev_e devid); -#ifdef CONFIG_SPI_CMDDATA -EXTERN int lpc17_spicmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd); -#endif -#endif - -#ifdef CONFIG_LPC17_SSP0 -EXTERN void lpc17_ssp0select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected); -EXTERN uint8_t lpc17_ssp0status(FAR struct spi_dev_s *dev, enum spi_dev_e devid); -#ifdef CONFIG_SPI_CMDDATA -EXTERN int lpc17_ssp0cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd); -#endif -#endif - -#ifdef CONFIG_LPC17_SSP1 -EXTERN void lpc17_ssp1select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected); -EXTERN uint8_t lpc17_ssp1status(FAR struct spi_dev_s *dev, enum spi_dev_e devid); -#ifdef CONFIG_SPI_CMDDATA -EXTERN int lpc17_ssp1cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd); -#endif -#endif - -/**************************************************************************** - * Name: spi_flush - * - * Description: - * Flush and discard any words left in the RX fifo. This can be called - * from ssp0/1select after a device is deselected (if you worry about such - * things). - * - * Input Parameters: - * dev - Device-specific state data - * - * Returned Value: - * None - * - ****************************************************************************/ - -#ifdef CONFIG_LPC17_SPI -EXTERN void spi_flush(FAR struct spi_dev_s *dev); -#endif - -#if defined(CONFIG_LPC17_SSP0) || defined(CONFIG_LPC17_SSP1) -EXTERN void ssp_flush(FAR struct spi_dev_s *dev); -#endif - -/**************************************************************************** - * Name: lpc17_spi/ssp0/1register - * - * Description: - * If the board supports a card detect callback to inform the SPI-based - * MMC/SD drvier when an SD card is inserted or removed, then - * CONFIG_SPI_CALLBACK should be defined and the following function(s) must - * must be implemented. These functiosn implements the registercallback - * method of the SPI interface (see include/nuttx/spi.h for details) - * - * Input Parameters: - * dev - Device-specific state data - * callback - The funtion to call on the media change - * arg - A caller provided value to return with the callback - * - * Returned Value: - * 0 on success; negated errno on failure. - * - ****************************************************************************/ - -#ifdef CONFIG_SPI_CALLBACK -#ifdef CONFIG_LPC17_SPI -EXTERN int lpc17_spiregister(FAR struct spi_dev_s *dev, - spi_mediachange_t callback, void *arg); -#endif - -#ifdef CONFIG_LPC17_SSP0 -EXTERN int lpc17_ssp0register(FAR struct spi_dev_s *dev, - spi_mediachange_t callback, void *arg); -#endif - -#ifdef CONFIG_LPC17_SSP1 -EXTERN int lpc17_ssp1register(FAR struct spi_dev_s *dev, - spi_mediachange_t callback, void *arg); -#endif -#endif - -/**************************************************************************** - * Name: lpc17_dmainitialize - * - * Description: - * Initialize the GPDMA subsystem. - * - * Returned Value: - * None - * - ****************************************************************************/ - -#ifdef CONFIG_LPC17_GPDMA -EXTERN void lpc17_dmainitilaize(void); -#endif - -/**************************************************************************** - * Name: lpc17_dmachannel - * - * Description: - * Allocate a DMA channel. This function sets aside a DMA channel and - * gives the caller exclusive access to the DMA channel. - * - * Returned Value: - * One success, this function returns a non-NULL, void* DMA channel - * handle. NULL is returned on any failure. This function can fail only - * if no DMA channel is available. - * - ****************************************************************************/ - -#ifdef CONFIG_LPC17_GPDMA -EXTERN DMA_HANDLE lpc17_dmachannel(void); -#endif - -/**************************************************************************** - * Name: lpc17_dmafree - * - * Description: - * Release a DMA channel. NOTE: The 'handle' used in this argument must - * NEVER be used again until lpc17_dmachannel() is called again to re-gain - * a valid handle. - * - * Returned Value: - * None - * - ****************************************************************************/ - -#ifdef CONFIG_LPC17_GPDMA -EXTERN void lpc17_dmafree(DMA_HANDLE handle); -#endif - -/**************************************************************************** - * Name: lpc17_dmasetup - * - * Description: - * Configure DMA for one transfer. - * - ****************************************************************************/ - -#ifdef CONFIG_LPC17_GPDMA -EXTERN int lpc17_dmarxsetup(DMA_HANDLE handle, - uint32_t control, uint32_t config, - uint32_t srcaddr, uint32_t destaddr, - size_t nbytes); -#endif - -/**************************************************************************** - * Name: lpc17_dmastart - * - * Description: - * Start the DMA transfer - * - ****************************************************************************/ - -#ifdef CONFIG_LPC17_GPDMA -EXTERN int lpc17_dmastart(DMA_HANDLE handle, dma_callback_t callback, void *arg); -#endif - -/**************************************************************************** - * Name: lpc17_dmastop - * - * Description: - * Cancel the DMA. After lpc17_dmastop() is called, the DMA channel is - * reset and lpc17_dmasetup() must be called before lpc17_dmastart() can be - * called again - * - ****************************************************************************/ - -#ifdef CONFIG_LPC17_GPDMA -EXTERN void lpc17_dmastop(DMA_HANDLE handle); -#endif - -/**************************************************************************** - * Name: lpc17_dmasample - * - * Description: - * Sample DMA register contents - * - ****************************************************************************/ - -#ifdef CONFIG_LPC17_GPDMA -#ifdef CONFIG_DEBUG_DMA -EXTERN void lpc17_dmasample(DMA_HANDLE handle, struct lpc17_dmaregs_s *regs); -#else -# define lpc17_dmasample(handle,regs) -#endif -#endif - -/**************************************************************************** - * Name: lpc17_dmadump - * - * Description: - * Dump previously sampled DMA register contents - * - ****************************************************************************/ - -#ifdef CONFIG_LPC17_GPDMA -#ifdef CONFIG_DEBUG_DMA -EXTERN void lpc17_dmadump(DMA_HANDLE handle, const struct lpc17_dmaregs_s *regs, - const char *msg); -#else -# define lpc17_dmadump(handle,regs,msg) -#endif -#endif - -/**************************************************************************** - * Name: lpc17_adcinitialize - * - * Description: - * Initialize the adc - * - * Returned Value: - * Valid can device structure reference on succcess; a NULL on failure - * - ****************************************************************************/ - -#ifdef CONFIG_LPC17_ADC -FAR struct adc_dev_s *lpc17_adcinitialize(void); -#endif - -/**************************************************************************** - * Name: lpc17_dacinitialize - * - * Description: - * Initialize the DAC - * - * Returned Value: - * Valid dac device structure reference on succcess; a NULL on failure - * - ****************************************************************************/ - -#ifdef CONFIG_LPC17_DAC -EXTERN FAR struct dac_dev_s *lpc17_dacinitialize(void); -#endif - -/**************************************************************************** - * Name: lpc17_caninitialize - * - * Description: - * Initialize the selected can port - * - * Input Parameter: - * Port number (for hardware that has mutiple can interfaces) - * - * Returned Value: - * Valid can device structure reference on succcess; a NULL on failure - * - ****************************************************************************/ - -#if defined(CONFIG_CAN) && (defined(CONFIG_LPC17_CAN1) || defined(CONFIG_LPC17_CAN2)) -struct can_dev_s; -EXTERN FAR struct can_dev_s *lpc17_caninitialize(int port); -#endif - -#undef EXTERN -#if defined(__cplusplus) -} -#endif - -#endif /* __ASSEMBLY__ */ -#endif /* __ARCH_ARM_SRC_LPC17XX_LPC17_INTERNAL_H */ diff --git a/nuttx/arch/arm/src/lpc17xx/lpc17_irq.c b/nuttx/arch/arm/src/lpc17xx/lpc17_irq.c index 8af2adafe7..f3e93ffc2b 100644 --- a/nuttx/arch/arm/src/lpc17xx/lpc17_irq.c +++ b/nuttx/arch/arm/src/lpc17xx/lpc17_irq.c @@ -51,7 +51,9 @@ #include "up_arch.h" #include "os_internal.h" #include "up_internal.h" -#include "lpc17_internal.h" + +#include "lpc17_gpio.h" +#include "lpc17_clrpend.h" /**************************************************************************** * Definitions diff --git a/nuttx/arch/arm/src/lpc17xx/lpc17_lowputc.c b/nuttx/arch/arm/src/lpc17xx/lpc17_lowputc.c index ba90c1ff6a..5c34bda1b2 100644 --- a/nuttx/arch/arm/src/lpc17xx/lpc17_lowputc.c +++ b/nuttx/arch/arm/src/lpc17xx/lpc17_lowputc.c @@ -47,9 +47,11 @@ #include "up_internal.h" #include "up_arch.h" -#include "lpc17_internal.h" -#include "lpc17_syscon.h" -#include "lpc17_uart.h" +#include "chip/lpc17_syscon.h" +#include "chip/lpc17_uart.h" + +#include "lpc17_gpio.h" +#include "lpc17_lowputc.h" #include "lpc17_serial.h" /************************************************************************** diff --git a/nuttx/arch/arm/src/lpc17xx/lpc17_lowputc.h b/nuttx/arch/arm/src/lpc17xx/lpc17_lowputc.h new file mode 100644 index 0000000000..b1b226e035 --- /dev/null +++ b/nuttx/arch/arm/src/lpc17xx/lpc17_lowputc.h @@ -0,0 +1,84 @@ +/************************************************************************************ + * arch/arm/src/lpc17xx/lpc17_lowputc.h + * + * Copyright (C) 2013 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * 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. + * + ************************************************************************************/ + +#ifndef __ARCH_ARM_SRC_LPC17XX_LPC17_LOWPUTC_H +#define __ARCH_ARM_SRC_LPC17XX_LPC17_LOWPUTC_H + +/************************************************************************************ + * Included Files + ************************************************************************************/ + +#include + +/************************************************************************************ + * Pre-processor Definitions + ************************************************************************************/ + +/************************************************************************************ + * Public Types + ************************************************************************************/ + +/************************************************************************************ + * Public Data + ************************************************************************************/ + +#ifndef __ASSEMBLY__ +#ifdef __cplusplus +extern "C" +{ +#endif + +/************************************************************************************ + * Public Functions + ************************************************************************************/ + +/************************************************************************************ + * Name: lpc17_lowsetup + * + * Description: + * Called at the very beginning of _start. Performs low level initialization + * including setup of the console UART. This UART done early so that the serial + * console is available for debugging very early in the boot sequence. + * + ************************************************************************************/ + +void lpc17_lowsetup(void); + +#ifdef __cplusplus +} +#endif +#endif /* __ASSEMBLY__ */ + +#endif /* __ARCH_ARM_SRC_LPC17XX_LPC17_LOWPUTC_H */ diff --git a/nuttx/arch/arm/src/lpc17xx/lpc17_ohciram.h b/nuttx/arch/arm/src/lpc17xx/lpc17_ohciram.h index 1e0564a874..c508ddf6a2 100644 --- a/nuttx/arch/arm/src/lpc17xx/lpc17_ohciram.h +++ b/nuttx/arch/arm/src/lpc17xx/lpc17_ohciram.h @@ -42,7 +42,7 @@ #include #include "chip.h" -#include "lpc17_memorymap.h" +#include "chip/lpc17_memorymap.h" /************************************************************************************ * Pre-processor Definitions diff --git a/nuttx/arch/arm/src/lpc17xx/lpc17_pwm.h b/nuttx/arch/arm/src/lpc17xx/lpc17_pwm.h index 6555ce6166..d16c612105 100644 --- a/nuttx/arch/arm/src/lpc17xx/lpc17_pwm.h +++ b/nuttx/arch/arm/src/lpc17xx/lpc17_pwm.h @@ -43,7 +43,7 @@ #include #include "chip.h" -#include "lpc17_memorymap.h" +#include "chip/lpc17_memorymap.h" /************************************************************************************ * Pre-processor Definitions diff --git a/nuttx/arch/arm/src/lpc17xx/lpc17_qei.h b/nuttx/arch/arm/src/lpc17xx/lpc17_qei.h index d1637f9432..e2515b1028 100644 --- a/nuttx/arch/arm/src/lpc17xx/lpc17_qei.h +++ b/nuttx/arch/arm/src/lpc17xx/lpc17_qei.h @@ -1,7 +1,7 @@ /************************************************************************************ * arch/arm/src/lpc17xx/lpc17_qei.h * - * Copyright (C) 2010 Gregory Nutt. All rights reserved. + * Copyright (C) 2010, 2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -41,140 +41,12 @@ ************************************************************************************/ #include - -#include "chip.h" -#include "lpc17_memorymap.h" +#include "chip/lpc17_qei.h" /************************************************************************************ * Pre-processor Definitions ************************************************************************************/ -/* Register offsets *****************************************************************/ -/* Control registers */ - -#define LPC17_QEI_CON_OFFSET 0x0000 /* Control register */ -#define LPC17_QEI_STAT_OFFSET 0x0004 /* Encoder status register */ -#define LPC17_QEI_CONF_OFFSET 0x0008 /* Configuration register */ - -/* Position, index, and timer registers */ - -#define LPC17_QEI_POS_OFFSET 0x000c /* Position register */ -#define LPC17_QEI_MAXPOS_OFFSET 0x0010 /* Maximum position register */ -#define LPC17_QEI_CMPOS0_OFFSET 0x0014 /* Position compare register */ -#define LPC17_QEI_CMPOS1_OFFSET 0x0018 /* Position compare register */ -#define LPC17_QEI_CMPOS2_OFFSET 0x001c /* Position compare register */ -#define LPC17_QEI_INXCNT_OFFSET 0x0020 /* Index count register */ -#define LPC17_QEI_INXCMP_OFFSET 0x0024 /* Index compare register */ -#define LPC17_QEI_LOAD_OFFSET 0x0028 /* Velocity timer reload register */ -#define LPC17_QEI_TIME_OFFSET 0x002c /* Velocity timer register */ -#define LPC17_QEI_VEL_OFFSET 0x0030 /* Velocity counter register */ -#define LPC17_QEI_CAP_OFFSET 0x0034 /* Velocity capture register */ -#define LPC17_QEI_VELCOMP_OFFSET 0x0038 /* Velocity compare register */ -#define LPC17_QEI_FILTER_OFFSET 0x003c /* Digital filter register */ - -/* Interrupt registers */ - -#define LPC17_QEI_IEC_OFFSET 0x0fd8 /* Interrupt enable clear register */ -#define LPC17_QEI_IES_OFFSET 0x0fdc /* Interrupt enable set register */ -#define LPC17_QEI_INTSTAT_OFFSET 0x0fe0 /* Interrupt status register */ -#define LPC17_QEI_IE_OFFSET 0x0fe4 /* Interrupt enable register */ -#define LPC17_QEI_CLR_OFFSET 0x0fe8 /* Interrupt status clear register */ -#define LPC17_QEI_SET_OFFSET 0x0fec /* Interrupt status set register */ - -/* Register addresses ***************************************************************/ -/* Control registers */ - -#define LPC17_QEI_CON (LPC17_QEI_BASE+LPC17_QEI_CON_OFFSET) -#define LPC17_QEI_STAT (LPC17_QEI_BASE+LPC17_QEI_STAT_OFFSET) -#define LPC17_QEI_CONF (LPC17_QEI_BASE+LPC17_QEI_CONF_OFFSET) - -/* Position, index, and timer registers */ - -#define LPC17_QEI_POS (LPC17_QEI_BASE+LPC17_QEI_POS_OFFSET) -#define LPC17_QEI_MAXPOS (LPC17_QEI_BASE+LPC17_QEI_MAXPOS_OFFSET) -#define LPC17_QEI_CMPOS0 (LPC17_QEI_BASE+LPC17_QEI_CMPOS0_OFFSET) -#define LPC17_QEI_CMPOS1 (LPC17_QEI_BASE+LPC17_QEI_CMPOS1_OFFSET) -#define LPC17_QEI_CMPOS2 (LPC17_QEI_BASE+LPC17_QEI_CMPOS2_OFFSET) -#define LPC17_QEI_INXCNT (LPC17_QEI_BASE+LPC17_QEI_INXCNT_OFFSET) -#define LPC17_QEI_INXCMP (LPC17_QEI_BASE+LPC17_QEI_INXCMP_OFFSET) -#define LPC17_QEI_LOAD (LPC17_QEI_BASE+LPC17_QEI_LOAD_OFFSET) -#define LPC17_QEI_TIME (LPC17_QEI_BASE+LPC17_QEI_TIME_OFFSET) -#define LPC17_QEI_VEL (LPC17_QEI_BASE+LPC17_QEI_VEL_OFFSET) -#define LPC17_QEI_CAP (LPC17_QEI_BASE+LPC17_QEI_CAP_OFFSET) -#define LPC17_QEI_VELCOMP (LPC17_QEI_BASE+LPC17_QEI_VELCOMP_OFFSET) -#define LPC17_QEI_FILTER (LPC17_QEI_BASE+LPC17_QEI_FILTER_OFFSET) - -/* Interrupt registers */ - -#define LPC17_QEI_IEC (LPC17_QEI_BASE+LPC17_QEI_IEC_OFFSET) -#define LPC17_QEI_IES (LPC17_QEI_BASE+LPC17_QEI_IES_OFFSET) -#define LPC17_QEI_INTSTAT (LPC17_QEI_BASE+LPC17_QEI_INTSTAT_OFFSET) -#define LPC17_QEI_IE (LPC17_QEI_BASE+LPC17_QEI_IE_OFFSET) -#define LPC17_QEI_CLR (LPC17_QEI_BASE+LPC17_QEI_CLR_OFFSET) -#define LPC17_QEI_SET (LPC17_QEI_BASE+LPC17_QEI_SET_OFFSET) - -/* Register bit definitions *********************************************************/ -/* The following registers hold 32-bit integer values and have no bit fields defined - * in this section: - * - * Position register (POS) - * Maximum position register (MAXPOS) - * Position compare register 0 (CMPOS0) - * Position compare register 1 (CMPOS) - * Position compare register 2 (CMPOS2) - * Index count register (INXCNT) - * Index compare register (INXCMP) - * Velocity timer reload register (LOAD) - * Velocity timer register (TIME) - * Velocity counter register (VEL) - * Velocity capture register (CAP) - * Velocity compare register (VELCOMP) - * Digital filter register (FILTER) - */ - -/* Control registers */ -/* Control register */ - -#define QEI_CON_RESP (1 << 0) /* Bit 0: Reset position counter */ -#define QEI_CON_RESPI (1 << 1) /* Bit 1: Reset position counter on index */ -#define QEI_CON_RESV (1 << 2) /* Bit 2: Reset velocity */ -#define QEI_CON_RESI (1 << 3) /* Bit 3: Reset index counter */ - /* Bits 4-31: reserved */ -/* Encoder status register */ - -#define QEI_STAT_DIR (1 << 0) /* Bit 0: Direction bit */ - /* Bits 1-31: reserved */ -/* Configuration register */ - -#define QEI_CONF_DIRINV (1 << 0) /* Bit 0: Direction invert */ -#define QEI_CONF_SIGMODE (1 << 1) /* Bit 1: Signal Mode */ -#define QEI_CONF_CAPMODE (1 << 2) /* Bit 2: Capture Mode */ -#define QEI_CONF_INVINX (1 << 3) /* Bit 3: Invert Index */ - /* Bits 4-31: reserved */ -/* Position, index, and timer registers (all 32-bit integer values with not bit fields */ - -/* Interrupt registers */ -/* Interrupt enable clear register (IEC), Interrupt enable set register (IES), - * Interrupt status register (INTSTAT), Interrupt enable register (IE), Interrupt - * status clear register (CLR), and Interrupt status set register (SET) common - * bit definitions. - */ - -#define QEI_INT_INX (1 << 0) /* Bit 0: Index pulse detected */ -#define QEI_INT_TIM (1 << 1) /* Bit 1: Velocity timer overflow occurred */ -#define QEI_INT_VELC (1 << 2) /* Bit 2: Captured velocity less than compare velocity */ -#define QEI_INT_DIR (1 << 3) /* Bit 3: Change of direction detected */ -#define QEI_INT_ERR (1 << 4) /* Bit 4: Encoder phase error detected */ -#define QEI_INT_ENCLK (1 << 5) /* Bit 5: Eencoder clock pulse detected */ -#define QEI_INT_POS0 (1 << 6) /* Bit 6: Position 0 compare equal to current position */ -#define QEI_INT_POS1 (1 << 7) /* Bit 7: Position 1 compare equal to current position */ -#define QEI_INT_POS2 (1 << 8) /* Bit 8: Position 2 compare equal to current position */ -#define QEI_INT_REV (1 << 9) /* Bit 9: Index compare value equal to current index count */ -#define QEI_INT_POS0REV (1 << 10) /* Bit 10: Combined position 0 and revolution count interrupt */ -#define QEI_INT_POS1REV (1 << 11) /* Bit 11: Position 1 and revolution count interrupt */ -#define QEI_INT_POS2REV (1 << 12) /* Bit 12: Position 2 and revolution count interrupt */ - /* Bits 13-31: reserved */ - /************************************************************************************ * Public Types ************************************************************************************/ diff --git a/nuttx/arch/arm/src/lpc17xx/lpc17_rit.h b/nuttx/arch/arm/src/lpc17xx/lpc17_rit.h index 2da0164bde..4c0949a467 100644 --- a/nuttx/arch/arm/src/lpc17xx/lpc17_rit.h +++ b/nuttx/arch/arm/src/lpc17xx/lpc17_rit.h @@ -1,7 +1,7 @@ /************************************************************************************ * arch/arm/src/lpc17xx/lpc17_rit.h * - * Copyright (C) 2010 Gregory Nutt. All rights reserved. + * Copyright (C) 2010, 2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -41,42 +41,12 @@ ************************************************************************************/ #include - -#include "chip.h" -#include "lpc17_memorymap.h" +#include "chip/lpc17_rit.h" /************************************************************************************ * Pre-processor Definitions ************************************************************************************/ -/* Register offsets *****************************************************************/ - -#define LPC17_RIT_COMPVAL_OFFSET 0x0000 /* Compare register */ -#define LPC17_RIT_MASK_OFFSET 0x0004 /* Mask register */ -#define LPC17_RIT_CTRL_OFFSET 0x0008 /* Control register */ -#define LPC17_RIT_COUNTER_OFFSET 0x000c /* 32-bit counter */ - -/* Register addresses ***************************************************************/ - -#define LPC17_RIT_COMPVAL (LPC17_RIT_BASE+LPC17_RIT_COMPVAL_OFFSET) -#define LPC17_RIT_MASK (LPC17_RIT_BASE+LPC17_RIT_MASK_OFFSET) -#define LPC17_RIT_CTRL (LPC17_RIT_BASE+LPC17_RIT_CTRL_OFFSET) -#define LPC17_RIT_COUNTER (LPC17_RIT_BASE+LPC17_RIT_COUNTER_OFFSET) - -/* Register bit definitions *********************************************************/ -/* Compare register (Bits 0-31: value compared to the counter) */ - -/* Mask register (Bits 0-31: 32-bit mask value) */ - -/* Control register */ - -#define RIT_CTRL_INT (1 << 0) /* Bit 0: Interrupt flag */ -#define RIT_CTRL_ENCLR (1 << 1) /* Bit 1: Timer enable clear */ -#define RIT_CTRL_ENBR (1 << 2) /* Bit 2: Timer enable for debug */ -#define RIT_CTRL_EN (1 << 3) /* Bit 3: Timer enable */ - /* Bits 4-31: Reserved */ -/* 32-bit counter (Bits 0-31: 32-bit up counter) */ - /************************************************************************************ * Public Types ************************************************************************************/ diff --git a/nuttx/arch/arm/src/lpc17xx/lpc17_rtc.h b/nuttx/arch/arm/src/lpc17xx/lpc17_rtc.h index 195e403c10..9011cd84ae 100644 --- a/nuttx/arch/arm/src/lpc17xx/lpc17_rtc.h +++ b/nuttx/arch/arm/src/lpc17xx/lpc17_rtc.h @@ -1,270 +1,62 @@ -/************************************************************************************ - * arch/arm/src/lpc17xx/lpc17_rtc.h - * - * Copyright (C) 2010, 2012 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt - * - * 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. - * - ************************************************************************************/ - -#ifndef __ARCH_ARM_SRC_LPC17XX_LPC17_RTC_H -#define __ARCH_ARM_SRC_LPC17XX_LPC17_RTC_H - -/************************************************************************************ - * Included Files - ************************************************************************************/ - -#include - -#include "chip.h" -#include "lpc17_memorymap.h" - -/************************************************************************************ - * Pre-processor Definitions - ************************************************************************************/ - -/* Register offsets *****************************************************************/ -/* Miscellaneous registers */ - -#define LPC17_RTC_ILR_OFFSET 0x0000 /* Interrupt Location Register */ -#define LPC17_RTC_CCR_OFFSET 0x0008 /* Clock Control Register */ -#define LPC17_RTC_CIIR_OFFSET 0x000c /* Counter Increment Interrupt Register */ -#define LPC17_RTC_AMR_OFFSET 0x0010 /* Alarm Mask Register */ -#define LPC17_RTC_AUXEN_OFFSET 0x0058 /* RTC Auxiliary Enable register */ -#define LPC17_RTC_AUX_OFFSET 0x005c /* RTC Auxiliary control register */ - -/* Consolidated time registers */ - -#define LPC17_RTC_CTIME0_OFFSET 0x0014 /* Consolidated Time Register 0 */ -#define LPC17_RTC_CTIME1_OFFSET 0x0018 /* Consolidated Time Register 1 */ -#define LPC17_RTC_CTIME2_OFFSET 0x001c /* Consolidated Time Register 2 */ - -/* Time counter registers */ - -#define LPC17_RTC_SEC_OFFSET 0x0020 /* Seconds Counter */ -#define LPC17_RTC_MIN_OFFSET 0x0024 /* Minutes Register */ -#define LPC17_RTC_HOUR_OFFSET 0x0028 /* Hours Register */ -#define LPC17_RTC_DOM_OFFSET 0x002c /* Day of Month Register */ -#define LPC17_RTC_DOW_OFFSET 0x0030 /* Day of Week Register */ -#define LPC17_RTC_DOY_OFFSET 0x0034 /* Day of Year Register */ -#define LPC17_RTC_MONTH_OFFSET 0x0038 /* Months Register */ -#define LPC17_RTC_YEAR_OFFSET 0x003c /* Years Register */ -#define LPC17_RTC_CALIB_OFFSET 0x0040 /* Calibration Value Register */ - -/* General purpose registers */ - -#define LPC17_RTC_GPREG0_OFFSET 0x0044 /* General Purpose Register 0 */ -#define LPC17_RTC_GPREG1_OFFSET 0x0048 /* General Purpose Register 1 */ -#define LPC17_RTC_GPREG2_OFFSET 0x004c /* General Purpose Register 2 */ -#define LPC17_RTC_GPREG3_OFFSET 0x0050 /* General Purpose Register 3 */ -#define LPC17_RTC_GPREG4_OFFSET 0x0054 /* General Purpose Register 4 */ - -/* Alarm register group */ - -#define LPC17_RTC_ALSEC_OFFSET 0x0060 /* Alarm value for Seconds */ -#define LPC17_RTC_ALMIN_OFFSET 0x0064 /* Alarm value for Minutes */ -#define LPC17_RTC_ALHOUR_OFFSET 0x0068 /* Alarm value for Hours */ -#define LPC17_RTC_ALDOM_OFFSET 0x006c /* Alarm value for Day of Month */ -#define LPC17_RTC_ALDOW_OFFSET 0x0070 /* Alarm value for Day of Week */ -#define LPC17_RTC_ALDOY_OFFSET 0x0074 /* Alarm value for Day of Year */ -#define LPC17_RTC_ALMON_OFFSET 0x0078 /* Alarm value for Months */ -#define LPC17_RTC_ALYEAR_OFFSET 0x007c /* Alarm value for Year */ - -/* Register addresses ***************************************************************/ -/* Miscellaneous registers */ - -#define LPC17_RTC_ILR (LPC17_RTC_BASE+LPC17_RTC_ILR_OFFSET) -#define LPC17_RTC_CCR (LPC17_RTC_BASE+LPC17_RTC_CCR_OFFSET) -#define LPC17_RTC_CIIR (LPC17_RTC_BASE+LPC17_RTC_CIIR_OFFSET) -#define LPC17_RTC_AMR (LPC17_RTC_BASE+LPC17_RTC_AMR_OFFSET) -#define LPC17_RTC_AUXEN (LPC17_RTC_BASE+LPC17_RTC_AUXEN_OFFSET) -#define LPC17_RTC_AUX (LPC17_RTC_BASE+LPC17_RTC_AUX_OFFSET) - -/* Consolidated time registers */ - -#define LPC17_RTC_CTIME0 (LPC17_RTC_BASE+LPC17_RTC_CTIME0_OFFSET) -#define LPC17_RTC_CTIME1 (LPC17_RTC_BASE+LPC17_RTC_CTIME1_OFFSET) -#define LPC17_RTC_CTIME2 (LPC17_RTC_BASE+LPC17_RTC_CTIME2_OFFSET) - -/* Time counter registers */ - -#define LPC17_RTC_SEC (LPC17_RTC_BASE+LPC17_RTC_SEC_OFFSET) -#define LPC17_RTC_MIN (LPC17_RTC_BASE+LPC17_RTC_MIN_OFFSET) -#define LPC17_RTC_HOUR (LPC17_RTC_BASE+LPC17_RTC_HOUR_OFFSET) -#define LPC17_RTC_DOM (LPC17_RTC_BASE+LPC17_RTC_DOM_OFFSET) -#define LPC17_RTC_DOW (LPC17_RTC_BASE+LPC17_RTC_DOW_OFFSET) -#define LPC17_RTC_DOY (LPC17_RTC_BASE+LPC17_RTC_DOY_OFFSET) -#define LPC17_RTC_MONTH (LPC17_RTC_BASE+LPC17_RTC_MONTH_OFFSET) -#define LPC17_RTC_YEAR (LPC17_RTC_BASE+LPC17_RTC_YEAR_OFFSET) -#define LPC17_RTC_CALIB (LPC17_RTC_BASE+LPC17_RTC_CALIB_OFFSET) - -/* General purpose registers */ - -#define LPC17_RTC_GPREG0 (LPC17_RTC_BASE+LPC17_RTC_GPREG0_OFFSET) -#define LPC17_RTC_GPREG1 (LPC17_RTC_BASE+LPC17_RTC_GPREG1_OFFSET) -#define LPC17_RTC_GPREG2 (LPC17_RTC_BASE+LPC17_RTC_GPREG2_OFFSET) -#define LPC17_RTC_GPREG3 (LPC17_RTC_BASE+LPC17_RTC_GPREG3_OFFSET) -#define LPC17_RTC_GPREG4 (LPC17_RTC_BASE+LPC17_RTC_GPREG4_OFFSET) - -/* Alarm register group */ - -#define LPC17_RTC_ALSEC (LPC17_RTC_BASE+LPC17_RTC_ALSEC_OFFSET) -#define LPC17_RTC_ALMIN (LPC17_RTC_BASE+LPC17_RTC_ALMIN_OFFSET) -#define LPC17_RTC_ALHOUR (LPC17_RTC_BASE+LPC17_RTC_ALHOUR_OFFSET) -#define LPC17_RTC_ALDOM (LPC17_RTC_BASE+LPC17_RTC_ALDOM_OFFSET) -#define LPC17_RTC_ALDOW (LPC17_RTC_BASE+LPC17_RTC_ALDOW_OFFSET) -#define LPC17_RTC_ALDOY (LPC17_RTC_BASE+LPC17_RTC_ALDOY_OFFSET) -#define LPC17_RTC_ALMON (LPC17_RTC_BASE+LPC17_RTC_ALMON_OFFSET) -#define LPC17_RTC_ALYEAR (LPC17_RTC_BASE+LPC17_RTC_ALYEAR_OFFSET) - -/* Register bit definitions *********************************************************/ -/* The following registers hold 32-bit values and have no bit fields to be defined: - * - * General Purpose Register 0 - * General Purpose Register 1 - * General Purpose Register 2 - * General Purpose Register 3 - * General Purpose Register 4 - */ - -/* Miscellaneous registers */ -/* Interrupt Location Register */ - -#define RTC_ILR_RTCCIF (1 << 0) /* Bit 0: Counter Increment Interrupt */ -#define RTC_ILR_RTCALF (1 << 1) /* Bit 1: Alarm interrupt */ - /* Bits 2-31: Reserved */ -/* Clock Control Register */ - -#define RTC_CCR_CLKEN (1 << 0) /* Bit 0: Clock Enable */ -#define RTC_CCR_CTCRST (1 << 1) /* Bit 1: CTC Reset */ - /* Bits 2-3: Internal test mode controls */ -#define RTC_CCR_CCALEN (1 << 4) /* Bit 4: Calibration counter enable */ - /* Bits 5-31: Reserved */ -/* Counter Increment Interrupt Register */ - -#define RTC_CIIR_IMSEC (1 << 0) /* Bit 0: Second interrupt */ -#define RTC_CIIR_IMMIN (1 << 1) /* Bit 1: Minute interrupt */ -#define RTC_CIIR_IMHOUR (1 << 2) /* Bit 2: Hour interrupt */ -#define RTC_CIIR_IMDOM (1 << 3) /* Bit 3: Day of Month value interrupt */ -#define RTC_CIIR_IMDOW (1 << 4) /* Bit 4: Day of Week value interrupt */ -#define RTC_CIIR_IMDOY (1 << 5) /* Bit 5: Day of Year interrupt */ -#define RTC_CIIR_IMMON (1 << 6) /* Bit 6: Month interrupt */ -#define RTC_CIIR_IMYEAR (1 << 7) /* Bit 7: Yearinterrupt */ - /* Bits 8-31: Reserved */ -/* Alarm Mask Register */ - -#define RTC_AMR_SEC (1 << 0) /* Bit 0: Second not compared for alarm */ -#define RTC_AMR_MIN (1 << 1) /* Bit 1: Minutes not compared for alarm */ -#define RTC_AMR_HOUR (1 << 2) /* Bit 2: Hour not compared for alarm */ -#define RTC_AMR_DOM (1 << 3) /* Bit 3: Day of Monthnot compared for alarm */ -#define RTC_AMR_DOW (1 << 4) /* Bit 4: Day of Week not compared for alarm */ -#define RTC_AMR_DOY (1 << 5) /* Bit 5: Day of Year not compared for alarm */ -#define RTC_AMR_MON (1 << 6) /* Bit 6: Month not compared for alarm */ -#define RTC_AMR_YEAR (1 << 7) /* Bit 7: Year not compared for alarm */ - /* Bits 8-31: Reserved */ -/* RTC Auxiliary Enable register */ - /* Bits 0-3: Reserved */ -#define RTC_AUXEN_RTCOSCF (1 << 4) /* Bit 4: RTC Oscillator Fail detect flag */ - /* Bits 5-31: Reserved */ -/* RTC Auxiliary control register */ - /* Bits 0-3: Reserved */ -#define RTC_AUX_OSCFEN (1 << 4) /* Bit 4: Oscillator Fail Detect interrupt enable */ - /* Bits 5-31: Reserved */ -/* Consolidated time registers */ -/* Consolidated Time Register 0 */ - -#define RTC_CTIME0_SEC_SHIFT (0) /* Bits 0-5: Seconds */ -#define RTC_CTIME0_SEC_MASK (63 << RTC_CTIME0_SEC_SHIFT) - /* Bits 6-7: Reserved */ -#define RTC_CTIME0_MIN_SHIFT (8) /* Bits 8-13: Minutes */ -#define RTC_CTIME0_MIN_MASK (63 << RTC_CTIME0_MIN_SHIFT) - /* Bits 14-15: Reserved */ -#define RTC_CTIME0_HOURS_SHIFT (16) /* Bits 16-20: Hours */ -#define RTC_CTIME0_HOURS_MASK (31 << RTC_CTIME0_HOURS_SHIFT) - /* Bits 21-23: Reserved */ -#define RTC_CTIME0_DOW_SHIFT (24) /* Bits 24-26: Day of Week */ -#define RTC_CTIME0_DOW_MASK (7 << RTC_CTIME0_DOW_SHIFT) - /* Bits 27-31: Reserved */ -/* Consolidated Time Register 1 */ - -#define RTC_CTIME1_DOM_SHIFT (0) /* Bits 0-4: Day of Month */ -#define RTC_CTIME1_DOM_MASK (31 << RTC_CTIME1_DOM_SHIFT) - /* Bits 5-7: Reserved */ -#define RTC_CTIME1_MON_SHIFT (8) /* Bits 8-11: Month */ -#define RTC_CTIME1_MON_MASK (15 << RTC_CTIME1_MON_SHIFT) - /* Bits 12-15: Reserved */ -#define RTC_CTIME1_YEAR_SHIFT (16) /* Bits 16-27: Year */ -#define RTC_CTIME1_YEAR_MASK (0x0fff << RTC_CTIME1_YEAR_SHIFT) - /* Bits 28-31: Reserved */ -/* Consolidated Time Register 2 */ - -#define RTC_CTIME2_DOY_SHIFT (0) /* Bits 0-11: Day of Year */ -#define RTC_CTIME2_DOY_MASK (0x0fff << RTC_CTIME2_DOY_SHIFT) - /* Bits 12-31: Reserved */ -/* Time counter registers */ - -#define RTC_SEC_MASK (0x003f) -#define RTC_MIN_MASK (0x003f) -#define RTC_HOUR_MASK (0x001f) -#define RTC_DOM_MASK (0x001f) -#define RTC_DOW_MASK (0x0007) -#define RTC_DOY_MASK (0x01ff) -#define RTC_MONTH_MASK (0x000f) -#define RTC_YEAR_MASK (0x0fff) - -/* Calibration Value Register */ - -#define RTC_CALIB_CALVAL_SHIFT (0) /* Bits 0-16: calibration counter counts to this value */ -#define RTC_CALIB_CALVAL_MASK (0xffff << RTC_CALIB_CALVAL_SHIFT) -#define RTC_CALIB_CALDIR (1 << 17) /* Bit 17: Calibration direction */ - /* Bits 18-31: Reserved */ -/* Alarm register group */ - -#define RTC_ALSEC_MASK (0x003f) -#define RTC_ALMIN_MASK (0x003f) -#define RTC_ALHOUR_MASK (0x001f) -#define RTC_ALDOM_MASK (0x001f) -#define RTC_ALDOW_MASK (0x0007) -#define RTC_ALDOY_MASK (0x01ff) -#define RTC_ALMON_MASK (0x000f) -#define RTC_ALYEAR_MASK (0x0fff) - -/************************************************************************************ - * Public Types - ************************************************************************************/ - -/************************************************************************************ - * Public Data - ************************************************************************************/ - -/************************************************************************************ - * Public Functions - ************************************************************************************/ - -#endif /* __ARCH_ARM_SRC_LPC17XX_LPC17_RTC_H */ +/************************************************************************************ + * arch/arm/src/lpc17xx/lpc17_rtc.h + * + * Copyright (C) 2010, 2012-2013 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * 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. + * + ************************************************************************************/ + +#ifndef __ARCH_ARM_SRC_LPC17XX_LPC17_RTC_H +#define __ARCH_ARM_SRC_LPC17XX_LPC17_RTC_H + +/************************************************************************************ + * Included Files + ************************************************************************************/ + +#include +#include "chip/lpc17_rtc.h" + +/************************************************************************************ + * Pre-processor Definitions + ************************************************************************************/ + +/************************************************************************************ + * Public Types + ************************************************************************************/ + +/************************************************************************************ + * Public Data + ************************************************************************************/ + +/************************************************************************************ + * Public Functions + ************************************************************************************/ + +#endif /* __ARCH_ARM_SRC_LPC17XX_LPC17_RTC_H */ diff --git a/nuttx/arch/arm/src/lpc17xx/lpc17_serial.c b/nuttx/arch/arm/src/lpc17xx/lpc17_serial.c index 5ea6348e08..c94f2ff60f 100644 --- a/nuttx/arch/arm/src/lpc17xx/lpc17_serial.c +++ b/nuttx/arch/arm/src/lpc17xx/lpc17_serial.c @@ -58,13 +58,13 @@ #include #include -#include "chip.h" #include "up_arch.h" #include "os_internal.h" #include "up_internal.h" -#include "lpc17_internal.h" -#include "lpc17_uart.h" +#include "chip.h" +#include "chip/lpc17_uart.h" +#include "lpc17_gpio.h" #include "lpc17_serial.h" /**************************************************************************** diff --git a/nuttx/arch/arm/src/lpc17xx/lpc17_serial.h b/nuttx/arch/arm/src/lpc17xx/lpc17_serial.h index 27d7da9d13..95e8155de8 100644 --- a/nuttx/arch/arm/src/lpc17xx/lpc17_serial.h +++ b/nuttx/arch/arm/src/lpc17xx/lpc17_serial.h @@ -43,8 +43,10 @@ #include #include -#include "lpc17_uart.h" -#include "lpc17_syscon.h" +#include "chip/lpc17_uart.h" +#include "chip/lpc17_syscon.h" + +#include "lpc17_gpio.h" /************************************************************************************ * Pre-processor Definitions diff --git a/nuttx/arch/arm/src/lpc17xx/lpc17_spi.c b/nuttx/arch/arm/src/lpc17xx/lpc17_spi.c index a7bb159317..05e7914347 100644 --- a/nuttx/arch/arm/src/lpc17xx/lpc17_spi.c +++ b/nuttx/arch/arm/src/lpc17xx/lpc17_spi.c @@ -54,9 +54,8 @@ #include "up_arch.h" #include "chip.h" -#include "lpc17_internal.h" -#include "lpc17_syscon.h" -#include "lpc17_pinconn.h" +#include "chip/lpc17_syscon.h" +#include "lpc17_gpio.h" #include "lpc17_spi.h" #ifdef CONFIG_LPC17_SPI diff --git a/nuttx/arch/arm/src/lpc17xx/lpc17_spi.h b/nuttx/arch/arm/src/lpc17xx/lpc17_spi.h index 880966eb1c..e6898aac76 100644 --- a/nuttx/arch/arm/src/lpc17xx/lpc17_spi.h +++ b/nuttx/arch/arm/src/lpc17xx/lpc17_spi.h @@ -1,7 +1,7 @@ /************************************************************************************ * arch/arm/src/lpc17xx/lpc17_spi.h * - * Copyright (C) 2010 Gregory Nutt. All rights reserved. + * Copyright (C) 2010, 2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -42,90 +42,14 @@ #include -#include "chip.h" -#include "lpc17_memorymap.h" +#include + +#include "chip/lpc17_spi.h" /************************************************************************************ * Pre-processor Definitions ************************************************************************************/ -/* Register offsets *****************************************************************/ - -#define LPC17_SPI_CR_OFFSET 0x0000 /* Control Register */ -#define LPC17_SPI_SR_OFFSET 0x0004 /* SPI Status Register */ -#define LPC17_SPI_DR_OFFSET 0x0008 /* SPI Data Register */ -#define LPC17_SPI_CCR_OFFSET 0x000c /* SPI Clock Counter Register */ -#define LPC17_SPI_TCR_OFFSET 0x0010 /* SPI Test Control Register */ -#define LPC17_SPI_TSR_OFFSET 0x0014 /* SPI Test Status Register */ -#define LPC17_SPI_INT_OFFSET 0x001c /* SPI Interrupt Register */ - -/* Register addresses ***************************************************************/ - -#define LPC17_SPI_CR (LPC17_SPI_BASE+LPC17_SPI_CR_OFFSET) -#define LPC17_SPI_SR (LPC17_SPI_BASE+LPC17_SPI_SR_OFFSET) -#define LPC17_SPI_DR (LPC17_SPI_BASE+LPC17_SPI_DR_OFFSET) -#define LPC17_SPI_CCR (LPC17_SPI_BASE+LPC17_SPI_CCR_OFFSET) -#define LPC17_TCR_CCR (LPC17_SPI_BASE+LPC17_SPI_TCR_OFFSET) -#define LPC17_TSR_CCR (LPC17_SPI_BASE+LPC17_SPI_TSR_OFFSET) -#define LPC17_SPI_INT (LPC17_SPI_BASE+LPC17_SPI_INT_OFFSET) - -/* Register bit definitions *********************************************************/ - -/* Control Register */ - /* Bits 0-1: Reserved */ -#define SPI_CR_BITENABLE (1 << 2) /* Bit 2: Enable word size selected by BITS */ -#define SPI_CR_CPHA (1 << 3) /* Bit 3: Clock phase control */ -#define SPI_CR_CPOL (1 << 4) /* Bit 4: Clock polarity control */ -#define SPI_CR_MSTR (1 << 5) /* Bit 5: Master mode select */ -#define SPI_CR_LSBF (1 << 6) /* Bit 6: SPI data is transferred LSB first */ -#define SPI_CR_SPIE (1 << 7) /* Bit 7: Serial peripheral interrupt enable */ -#define SPI_CR_BITS_SHIFT (8) /* Bits 8-11: Number of bits per word (BITENABLE==1) */ -#define SPI_CR_BITS_MASK (15 << SPI_CR_BITS_SHIFT) -# define SPI_CR_BITS_8BITS (8 << SPI_CR_BITS_SHIFT) /* 8 bits per transfer */ -# define SPI_CR_BITS_9BITS (9 << SPI_CR_BITS_SHIFT) /* 9 bits per transfer */ -# define SPI_CR_BITS_10BITS (10 << SPI_CR_BITS_SHIFT) /* 10 bits per transfer */ -# define SPI_CR_BITS_11BITS (11 << SPI_CR_BITS_SHIFT) /* 11 bits per transfer */ -# define SPI_CR_BITS_12BITS (12 << SPI_CR_BITS_SHIFT) /* 12 bits per transfer */ -# define SPI_CR_BITS_13BITS (13 << SPI_CR_BITS_SHIFT) /* 13 bits per transfer */ -# define SPI_CR_BITS_14BITS (14 << SPI_CR_BITS_SHIFT) /* 14 bits per transfer */ -# define SPI_CR_BITS_15BITS (15 << SPI_CR_BITS_SHIFT) /* 15 bits per transfer */ -# define SPI_CR_BITS_16BITS (0 << SPI_CR_BITS_SHIFT) /* 16 bits per transfer */ - /* Bits 12-31: Reserved */ -/* SPI Status Register */ - /* Bits 0-2: Reserved */ -#define SPI_SR_ABRT (1 << 3) /* Bit 3: Slave abort */ -#define SPI_SR_MODF (1 << 4) /* Bit 4: Mode fault */ -#define SPI_SR_ROVR (1 << 5) /* Bit 5: Read overrun */ -#define SPI_SR_WCOL (1 << 6) /* Bit 6: Write collision */ -#define SPI_SR_SPIF (1 << 7) /* Bit 7: SPI transfer complete */ - /* Bits 8-31: Reserved */ -/* SPI Data Register */ - -#define SPI_DR_MASK (0xff) /* Bits 0-15: SPI Bi-directional data port */ -#define SPI_DR_MASKWIDE (0xffff) /* Bits 0-15: If SPI_CR_BITENABLE != 0 */ - /* Bits 8-31: Reserved */ -/* SPI Clock Counter Register */ - -#define SPI_CCR_MASK (0xff) /* Bits 0-7: SPI Clock counter setting */ - /* Bits 8-31: Reserved */ -/* SPI Test Control Register */ - /* Bit 0: Reserved */ -#define SPI_TCR_TEST_SHIFT (1) /* Bits 1-7: SPI test mode */ -#define SPI_TCR_TEST_MASK (0x7f << SPI_TCR_TEST_SHIFT) - /* Bits 8-31: Reserved */ -/* SPI Test Status Register */ - /* Bits 0-2: Reserved */ -#define SPI_TSR_ABRT (1 << 3) /* Bit 3: Slave abort */ -#define SPI_TSR_MODF (1 << 4) /* Bit 4: Mode fault */ -#define SPI_TSR_ROVR (1 << 5) /* Bit 5: Read overrun */ -#define SPI_TSR_WCOL (1 << 6) /* Bit 6: Write collision */ -#define SPI_TSR_SPIF (1 << 7) /* Bit 7: SPI transfer complete */ - /* Bits 8-31: Reserved */ -/* SPI Interrupt Register */ - -#define SPI_INT_SPIF (1 << 0) /* SPI interrupt */ - /* Bits 1-31: Reserved */ - /************************************************************************************ * Public Types ************************************************************************************/ @@ -134,8 +58,97 @@ * Public Data ************************************************************************************/ +#ifdef CONFIG_LPC17_SPI + +#ifndef __ASSEMBLY__ +#ifdef __cplusplus +extern "C" +{ +#endif + /************************************************************************************ * Public Functions ************************************************************************************/ +/************************************************************************************ + * Name: lpc17_spiselect, lpc17_status, and lpc17_spicmddata + * + * Description: + * These external functions must be provided by board-specific logic. They are + * implementations of the select, status, and cmddata methods of the SPI interface + * defined by struct spi_ops_s (see include/nuttx/spi.h). All other methods + * including up_spiinitialize()) are provided by common LPC17xx logic. To use + * this common SPI logic on your board: + * + * 1. Provide logic in lpc17_boardinitialize() to configure SPI chip select pins. + * 2. Provide lpc17_spiselect() and lpc17_spistatus() functions in your board- + * specific logic. These functions will perform chip selection and status + * operations using GPIOs in the way your board is configured. + * 2. If CONFIG_SPI_CMDDATA is defined in the NuttX configuration, provide + * lpc17_spicmddata() functions in your board-specific logic. This function + * will perform cmd/data selection operations using GPIOs in the way your + * board is configured. + * 3. Add a call to up_spiinitialize() in your low level application + * initialization logic + * 4. The handle returned by up_spiinitialize() may then be used to bind the + * SPI driver to higher level logic (e.g., calling mmcsd_spislotinitialize(), + * for example, will bind the SPI driver to the SPI MMC/SD driver). + * + ************************************************************************************/ + +void lpc17_spiselect(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected); +uint8_t lpc17_spistatus(FAR struct spi_dev_s *dev, enum spi_dev_e devid); +#ifdef CONFIG_SPI_CMDDATA +int lpc17_spicmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd); +#endif + +/**************************************************************************** + * Name: spi_flush + * + * Description: + * Flush and discard any words left in the RX fifo. This can be called + * from spiselect after a device is deselected (if you worry about such + * things). + * + * Input Parameters: + * dev - Device-specific state data + * + * Returned Value: + * None + * + ****************************************************************************/ + +void spi_flush(FAR struct spi_dev_s *dev); + +/**************************************************************************** + * Name: lpc17_spiregister + * + * Description: + * If the board supports a card detect callback to inform the SPI-based + * MMC/SD drvier when an SD card is inserted or removed, then + * CONFIG_SPI_CALLBACK should be defined and the following function must + * must be implemented. These functions implements the registercallback + * method of the SPI interface (see include/nuttx/spi.h for details) + * + * Input Parameters: + * dev - Device-specific state data + * callback - The funtion to call on the media change + * arg - A caller provided value to return with the callback + * + * Returned Value: + * 0 on success; negated errno on failure. + * + ****************************************************************************/ + +#ifdef CONFIG_SPI_CALLBACK +nt lpc17_spiregister(FAR struct spi_dev_s *dev, spi_mediachange_t callback, + FAR void *arg); +#endif + +#if defined(__cplusplus) +} +#endif + +#endif /* __ASSEMBLY__ */ +#endif /* CONFIG_LPC17_SPI */ #endif /* __ARCH_ARM_SRC_LPC17XX_LPC17_SPI_H */ diff --git a/nuttx/arch/arm/src/lpc17xx/lpc17_ssp.c b/nuttx/arch/arm/src/lpc17xx/lpc17_ssp.c index db6fbe1f82..96b66d7a16 100644 --- a/nuttx/arch/arm/src/lpc17xx/lpc17_ssp.c +++ b/nuttx/arch/arm/src/lpc17xx/lpc17_ssp.c @@ -54,9 +54,8 @@ #include "up_arch.h" #include "chip.h" -#include "lpc17_internal.h" -#include "lpc17_syscon.h" -#include "lpc17_pinconn.h" +#include "chip/lpc17_syscon.h" +#include "lpc17_gpio.h" #include "lpc17_ssp.h" #if defined(CONFIG_LPC17_SSP0) || defined(CONFIG_LPC17_SSP1) diff --git a/nuttx/arch/arm/src/lpc17xx/lpc17_ssp.h b/nuttx/arch/arm/src/lpc17xx/lpc17_ssp.h index 52b88da68d..edc6846baf 100644 --- a/nuttx/arch/arm/src/lpc17xx/lpc17_ssp.h +++ b/nuttx/arch/arm/src/lpc17xx/lpc17_ssp.h @@ -1,174 +1,173 @@ -/************************************************************************************ - * arch/arm/src/lpc17xx/lpc17_ssp.h - * - * Copyright (C) 2010, 2012 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt - * - * 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. - * - ************************************************************************************/ - -#ifndef __ARCH_ARM_SRC_LPC17XX_LPC17_SSP_H -#define __ARCH_ARM_SRC_LPC17XX_LPC17_SSP_H - -/************************************************************************************ - * Included Files - ************************************************************************************/ - -#include - -#include "chip.h" -#include "lpc17_memorymap.h" - -/************************************************************************************ - * Pre-processor Definitions - ************************************************************************************/ -/* 8 frame FIFOs for both transmit and receive */ - -#define LPC17_SSP_FIFOSZ 8 - -/* Register offsets *****************************************************************/ - -#define LPC17_SSP_CR0_OFFSET 0x0000 /* Control Register 0 */ -#define LPC17_SSP_CR1_OFFSET 0x0004 /* Control Register 1 */ -#define LPC17_SSP_DR_OFFSET 0x0008 /* Data Register */ -#define LPC17_SSP_SR_OFFSET 0x000c /* Status Register */ -#define LPC17_SSP_CPSR_OFFSET 0x0010 /* Clock Prescale Register */ -#define LPC17_SSP_IMSC_OFFSET 0x0014 /* Interrupt Mask Set and Clear Register */ -#define LPC17_SSP_RIS_OFFSET 0x0018 /* Raw Interrupt Status Register */ -#define LPC17_SSP_MIS_OFFSET 0x001c /* Masked Interrupt Status Register */ -#define LPC17_SSP_ICR_OFFSET 0x0020 /* Interrupt Clear Register */ -#define LPC17_SSP_DMACR_OFFSET 0x0024 /* DMA Control Register */ - -/* Register addresses ***************************************************************/ - -#define LPC17_SSP0_CR0 (LPC17_SSP0_BASE+LPC17_SSP_CR0_OFFSET) -#define LPC17_SSP0_CR1 (LPC17_SSP0_BASE+LPC17_SSP_CR1_OFFSET) -#define LPC17_SSP0_DR (LPC17_SSP0_BASE+LPC17_SSP_DR_OFFSET) -#define LPC17_SSP0_SR (LPC17_SSP0_BASE+LPC17_SSP_SR_OFFSET) -#define LPC17_SSP0_CPSR (LPC17_SSP0_BASE+LPC17_SSP_CPSR_OFFSET) -#define LPC17_SSP0_IMSC (LPC17_SSP0_BASE+LPC17_SSP_IMSC_OFFSET) -#define LPC17_SSP0_RIS (LPC17_SSP0_BASE+LPC17_SSP_RIS_OFFSET) -#define LPC17_SSP0_MIS (LPC17_SSP0_BASE+LPC17_SSP_MIS_OFFSET) -#define LPC17_SSP0_ICR (LPC17_SSP0_BASE+LPC17_SSP_ICR_OFFSET) -#define LPC17_SSP0_DMACR (LPC17_SSP0_BASE+LPC17_SSP_DMACR_OFFSET) - -#define LPC17_SSP1_CR0 (LPC17_SSP1_BASE+LPC17_SSP_CR0_OFFSET) -#define LPC17_SSP1_CR1 (LPC17_SSP1_BASE+LPC17_SSP_CR1_OFFSET) -#define LPC17_SSP1_DR (LPC17_SSP1_BASE+LPC17_SSP_DR_OFFSET) -#define LPC17_SSP1_SR (LPC17_SSP1_BASE+LPC17_SSP_SR_OFFSET) -#define LPC17_SSP1_CPSR (LPC17_SSP1_BASE+LPC17_SSP_CPSR_OFFSET) -#define LPC17_SSP1_IMSC (LPC17_SSP1_BASE+LPC17_SSP_IMSC_OFFSET) -#define LPC17_SSP1_RIS (LPC17_SSP1_BASE+LPC17_SSP_RIS_OFFSET) -#define LPC17_SSP1_MIS (LPC17_SSP1_BASE+LPC17_SSP_MIS_OFFSET) -#define LPC17_SSP1_ICR (LPC17_SSP1_BASE+LPC17_SSP_ICR_OFFSET) -#define LPC17_SSP1_DMACR (LPC17_SSP1_BASE+LPC17_SSP_DMACR_OFFSET) - -/* Register bit definitions *********************************************************/ -/* Control Register 0 */ - -#define SSP_CR0_DSS_SHIFT (0) /* Bits 0-3: DSS Data Size Select */ -#define SSP_CR0_DSS_MASK (15 << SSP_CR0_DSS_SHIFT) -# define SSP_CR0_DSS_4BIT (3 << SSP_CR0_DSS_SHIFT) -# define SSP_CR0_DSS_5BIT (4 << SSP_CR0_DSS_SHIFT) -# define SSP_CR0_DSS_6BIT (5 << SSP_CR0_DSS_SHIFT) -# define SSP_CR0_DSS_7BIT (6 << SSP_CR0_DSS_SHIFT) -# define SSP_CR0_DSS_8BIT (7 << SSP_CR0_DSS_SHIFT) -# define SSP_CR0_DSS_9BIT (8 << SSP_CR0_DSS_SHIFT) -# define SSP_CR0_DSS_10BIT (9 << SSP_CR0_DSS_SHIFT) -# define SSP_CR0_DSS_11BIT (10 << SSP_CR0_DSS_SHIFT) -# define SSP_CR0_DSS_12BIT (11 << SSP_CR0_DSS_SHIFT) -# define SSP_CR0_DSS_13BIT (12 << SSP_CR0_DSS_SHIFT) -# define SSP_CR0_DSS_14BIT (13 << SSP_CR0_DSS_SHIFT) -# define SSP_CR0_DSS_15BIT (14 << SSP_CR0_DSS_SHIFT) -# define SSP_CR0_DSS_16BIT (15 << SSP_CR0_DSS_SHIFT) -#define SSP_CR0_FRF_SHIFT (4) /* Bits 4-5: FRF Frame Format */ -#define SSP_CR0_FRF_MASK (3 << SSP_CR0_FRF_SHIFT) -# define SSP_CR0_FRF_SPI (0 << SSP_CR0_FRF_SHIFT) -# define SSP_CR0_FRF_TI (1 << SSP_CR0_FRF_SHIFT) -# define SSP_CR0_FRF_UWIRE (2 << SSP_CR0_FRF_SHIFT) -#define SSP_CR0_CPOL (1 << 6) /* Bit 6: Clock Out Polarity */ -#define SSP_CR0_CPHA (1 << 7) /* Bit 7: Clock Out Phase */ -#define SSP_CR0_SCR_SHIFT (8) /* Bits 8-15: Serial Clock Rate */ -#define SSP_CR0_SCR_MASK (0xff << SSP_CR0_SCR_SHIFT) - /* Bits 8-31: Reserved */ -/* Control Register 1 */ - -#define SSP_CR1_LBM (1 << 0) /* Bit 0: Loop Back Mode */ -#define SSP_CR1_SSE (1 << 1) /* Bit 1: SSP Enable */ -#define SSP_CR1_MS (1 << 2) /* Bit 2: Master/Slave Mode */ -#define SSP_CR1_SOD (1 << 3) /* Bit 3: Slave Output Disable */ - /* Bits 4-31: Reserved */ -/* Data Register */ - -#define SSP_DR_MASK (0xffff) /* Bits 0-15: Data */ - /* Bits 16-31: Reserved */ -/* Status Register */ - -#define SSP_SR_TFE (1 << 0) /* Bit 0: Transmit FIFO Empty */ -#define SSP_SR_TNF (1 << 1) /* Bit 1: Transmit FIFO Not Full */ -#define SSP_SR_RNE (1 << 2) /* Bit 2: Receive FIFO Not Empty */ -#define SSP_SR_RFF (1 << 3) /* Bit 3: Receive FIFO Full */ -#define SSP_SR_BSY (1 << 4) /* Bit 4: Busy */ - /* Bits 5-31: Reserved */ -/* Clock Prescale Register */ - -#define SSP_CPSR_DVSR_MASK (0xff) /* Bits 0-7: clock = SSP_PCLK/DVSR */ - /* Bits 8-31: Reserved */ -/* Common format for interrupt control registers: - * - * Interrupt Mask Set and Clear Register (IMSC) - * Raw Interrupt Status Register (RIS) - * Masked Interrupt Status Register (MIS) - * Interrupt Clear Register (ICR) - */ - -#define SSP_INT_ROR (1 << 0) /* Bit 0: RX FIFO overrun */ -#define SSP_INT_RT (1 << 1) /* Bit 1: RX FIFO timeout */ -#define SSP_INT_RX (1 << 2) /* Bit 2: RX FIFO at least half full (not ICR) */ -#define SSP_INT_TX (1 << 3 ) /* Bit 3: TX FIFO at least half empy (not ICR) */ - /* Bits 4-31: Reserved */ -/* DMA Control Register */ - -#define SSP_DMACR_RXDMAE (1 << 0) /* Bit 0: Receive DMA Enable */ -#define SSP_DMACR_TXDMAE (1 << 1) /* Bit 1: Transmit DMA Enable */ - /* Bits 2-31: Reserved */ - -/************************************************************************************ - * Public Types - ************************************************************************************/ - -/************************************************************************************ - * Public Data - ************************************************************************************/ - -/************************************************************************************ - * Public Functions - ************************************************************************************/ - -#endif /* __ARCH_ARM_SRC_LPC17XX_LPC17_SSP_H */ +/************************************************************************************ + * arch/arm/src/lpc17xx/lpc17_ssp.h + * + * Copyright (C) 2010, 2012-2013 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * 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. + * + ************************************************************************************/ + +#ifndef __ARCH_ARM_SRC_LPC17XX_LPC17_SSP_H +#define __ARCH_ARM_SRC_LPC17XX_LPC17_SSP_H + +/************************************************************************************ + * Included Files + ************************************************************************************/ + +#include + +#include + +#include "chip/lpc17_ssp.h" + +#if defined(CONFIG_LPC17_SSP0) || defined(CONFIG_LPC17_SSP1) + +/************************************************************************************ + * Pre-processor Definitions + ************************************************************************************/ + +/************************************************************************************ + * Public Types + ************************************************************************************/ + +#ifndef __ASSEMBLY__ +#ifdef __cplusplus +extern "C" +{ +#endif + +/************************************************************************************ + * Public Data + ************************************************************************************/ + +/************************************************************************************ + * Public Functions + ************************************************************************************/ + +/************************************************************************************ + * Name: lpc17_ssp0/ssp1select, lpc17_ssp0/ssp1status, and lpc17_ssp0/ssp1cmddata + * + * Description: + * These external functions must be provided by board-specific logic. They are + * implementations of the select, status, and cmddata methods of the SPI interface + * defined by struct spi_ops_s (see include/nuttx/spi.h). All other methods + * including up_spiinitialize()) are provided by common LPC17xx logic. To use + * this common SPI logic on your board: + * + * 1. Provide logic in lpc17_boardinitialize() to configure SSP chip select pins. + * 2. Provide lpc17_ssp0/ssp1select() and lpc17_ssp0/ssp1status() functions + * in your board-specific logic. These functions will perform chip selection + * and status operations using GPIOs in the way your board is configured. + * 2. If CONFIG_SPI_CMDDATA is defined in the NuttX configuration, provide + * lpc17_ssp0/ssp1cmddata() functions in your board-specific logic. These + * functions will perform cmd/data selection operations using GPIOs in the way + * your board is configured. + * 3. Add a call to up_spiinitialize() in your low level application + * initialization logic + * 4. The handle returned by up_spiinitialize() may then be used to bind the + * SSP driver to higher level logic (e.g., calling mmcsd_spislotinitialize(), + * for example, will bind the SSP driver to the SPI MMC/SD driver). + * + ************************************************************************************/ + +#ifdef CONFIG_LPC17_SSP0 +void lpc17_ssp0select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected); +uint8_t lpc17_ssp0status(FAR struct spi_dev_s *dev, enum spi_dev_e devid); +#ifdef CONFIG_SPI_CMDDATA +int lpc17_ssp0cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd); +#endif +#endif + +#ifdef CONFIG_LPC17_SSP1 +void lpc17_ssp1select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected); +uint8_t lpc17_ssp1status(FAR struct spi_dev_s *dev, enum spi_dev_e devid); +#ifdef CONFIG_SPI_CMDDATA +int lpc17_ssp1cmddata(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool cmd); +#endif +#endif + +/**************************************************************************** + * Name: ssp_flush + * + * Description: + * Flush and discard any words left in the RX fifo. This can be called + * from ssp0/1select after a device is deselected (if you worry about such + * things). + * + * Input Parameters: + * dev - Device-specific state data + * + * Returned Value: + * None + * + ****************************************************************************/ + +#if defined(CONFIG_LPC17_SSP0) || defined(CONFIG_LPC17_SSP1) +void ssp_flush(FAR struct spi_dev_s *dev); +#endif + +/**************************************************************************** + * Name: lpc17_ssp0/1register + * + * Description: + * If the board supports a card detect callback to inform the SPI-based + * MMC/SD drvier when an SD card is inserted or removed, then + * CONFIG_SPI_CALLBACK should be defined and the following function(s) must + * must be implemented. These functiosn implements the registercallback + * method of the SPI interface (see include/nuttx/spi.h for details) + * + * Input Parameters: + * dev - Device-specific state data + * callback - The funtion to call on the media change + * arg - A caller provided value to return with the callback + * + * Returned Value: + * 0 on success; negated errno on failure. + * + ****************************************************************************/ + +#ifdef CONFIG_SPI_CALLBACK +#ifdef CONFIG_LPC17_SSP0 +int lpc17_ssp0register(FAR struct spi_dev_s *dev, spi_mediachange_t callback, + FAR void *arg); +#endif + +#ifdef CONFIG_LPC17_SSP1 +int lpc17_ssp1register(FAR struct spi_dev_s *dev, spi_mediachange_t callback, + FAR void *arg); +#endif +#endif + +#if defined(__cplusplus) +} +#endif + +#endif /* __ASSEMBLY__ */ +#endif /* CONFIG_LPC17_SSP0 || CONFIG_LPC17_SSP1 */ +#endif /* __ARCH_ARM_SRC_LPC17XX_LPC17_SSP_H */ diff --git a/nuttx/arch/arm/src/lpc17xx/lpc17_start.c b/nuttx/arch/arm/src/lpc17xx/lpc17_start.c index abbe6e2132..45e5b4551b 100644 --- a/nuttx/arch/arm/src/lpc17xx/lpc17_start.c +++ b/nuttx/arch/arm/src/lpc17xx/lpc17_start.c @@ -50,7 +50,8 @@ #include "up_arch.h" #include "up_internal.h" -#include "lpc17_internal.h" +#include "lpc17_clockconfig.h" +#include "lpc17_lowputc.h" /**************************************************************************** * Private Definitions diff --git a/nuttx/arch/arm/src/lpc17xx/lpc17_timer.h b/nuttx/arch/arm/src/lpc17xx/lpc17_timer.h index 207c6d5cce..d548fada51 100644 --- a/nuttx/arch/arm/src/lpc17xx/lpc17_timer.h +++ b/nuttx/arch/arm/src/lpc17xx/lpc17_timer.h @@ -1,250 +1,62 @@ -/************************************************************************************ - * arch/arm/src/lpc17xx/lpc17_timer.h - * - * Copyright (C) 2010, 2012 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt - * - * 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. - * - ************************************************************************************/ - -#ifndef __ARCH_ARM_SRC_LPC17XX_LPC17_TIMER_H -#define __ARCH_ARM_SRC_LPC17XX_LPC17_TIMER_H - -/************************************************************************************ - * Included Files - ************************************************************************************/ - -#include - -#include "chip.h" -#include "lpc17_memorymap.h" - -/************************************************************************************ - * Pre-processor Definitions - ************************************************************************************/ - -/* Register offsets *****************************************************************/ - -#define LPC17_TMR_IR_OFFSET 0x0000 /* Interrupt Register */ -#define LPC17_TMR_TCR_OFFSET 0x0004 /* Timer Control Register */ -#define LPC17_TMR_TC_OFFSET 0x0008 /* Timer Counter */ -#define LPC17_TMR_PR_OFFSET 0x000c /* Prescale Register */ -#define LPC17_TMR_PC_OFFSET 0x0010 /* Prescale Counter */ -#define LPC17_TMR_MCR_OFFSET 0x0014 /* Match Control Register */ -#define LPC17_TMR_MR0_OFFSET 0x0018 /* Match Register 0 */ -#define LPC17_TMR_MR1_OFFSET 0x001c /* Match Register 1 */ -#define LPC17_TMR_MR2_OFFSET 0x0020 /* Match Register 2 */ -#define LPC17_TMR_MR3_OFFSET 0x0024 /* Match Register 3 */ -#define LPC17_TMR_CCR_OFFSET 0x0028 /* Capture Control Register */ -#define LPC17_TMR_CR0_OFFSET 0x002c /* Capture Register 0 */ -#define LPC17_TMR_CR1_OFFSET 0x0030 /* Capture Register 1 */ -#define LPC17_TMR_EMR_OFFSET 0x003c /* External Match Register */ -#define LPC17_TMR_CTCR_OFFSET 0x0070 /* Count Control Register */ - -/* Register addresses ***************************************************************/ - -#define LPC17_TMR0_IR (LPC17_TMR0_BASE+LPC17_TMR_IR_OFFSET) -#define LPC17_TMR0_TCR (LPC17_TMR0_BASE+LPC17_TMR_TCR_OFFSET) -#define LPC17_TMR0_TC (LPC17_TMR0_BASE+LPC17_TMR_TC_OFFSET) -#define LPC17_TMR0_PR (LPC17_TMR0_BASE+LPC17_TMR_PR_OFFSET) -#define LPC17_TMR0_PC (LPC17_TMR0_BASE+LPC17_TMR_PC_OFFSET) -#define LPC17_TMR0_MCR (LPC17_TMR0_BASE+LPC17_TMR_MCR_OFFSET) -#define LPC17_TMR0_MR0 (LPC17_TMR0_BASE+LPC17_TMR_MR0_OFFSET) -#define LPC17_TMR0_MR1 (LPC17_TMR0_BASE+LPC17_TMR_MR1_OFFSET) -#define LPC17_TMR0_MR2 (LPC17_TMR0_BASE+LPC17_TMR_MR2_OFFSET) -#define LPC17_TMR0_MR3 (LPC17_TMR0_BASE+LPC17_TMR_MR3_OFFSET) -#define LPC17_TMR0_CCR (LPC17_TMR0_BASE+LPC17_TMR_CCR_OFFSET) -#define LPC17_TMR0_CR0 (LPC17_TMR0_BASE+LPC17_TMR_CR0_OFFSET) -#define LPC17_TMR0_CR1 (LPC17_TMR0_BASE+LPC17_TMR_CR1_OFFSET) -#define LPC17_TMR0_EMR (LPC17_TMR0_BASE+LPC17_TMR_EMR_OFFSET) -#define LPC17_TMR0_CTCR (LPC17_TMR0_BASE+LPC17_TMR_CTCR_OFFSET) - -#define LPC17_TMR1_IR (LPC17_TMR1_BASE+LPC17_TMR_IR_OFFSET) -#define LPC17_TMR1_TCR (LPC17_TMR1_BASE+LPC17_TMR_TCR_OFFSET) -#define LPC17_TMR1_TC (LPC17_TMR1_BASE+LPC17_TMR_TC_OFFSET) -#define LPC17_TMR1_PR (LPC17_TMR1_BASE+LPC17_TMR_PR_OFFSET) -#define LPC17_TMR1_PC (LPC17_TMR1_BASE+LPC17_TMR_PC_OFFSET) -#define LPC17_TMR1_MCR (LPC17_TMR1_BASE+LPC17_TMR_MCR_OFFSET) -#define LPC17_TMR1_MR0 (LPC17_TMR1_BASE+LPC17_TMR_MR0_OFFSET) -#define LPC17_TMR1_MR1 (LPC17_TMR1_BASE+LPC17_TMR_MR1_OFFSET) -#define LPC17_TMR1_MR2 (LPC17_TMR1_BASE+LPC17_TMR_MR2_OFFSET) -#define LPC17_TMR1_MR3 (LPC17_TMR1_BASE+LPC17_TMR_MR3_OFFSET) -#define LPC17_TMR1_CCR (LPC17_TMR1_BASE+LPC17_TMR_CCR_OFFSET) -#define LPC17_TMR1_CR0 (LPC17_TMR1_BASE+LPC17_TMR_CR0_OFFSET) -#define LPC17_TMR1_CR1 (LPC17_TMR1_BASE+LPC17_TMR_CR1_OFFSET) -#define LPC17_TMR1_EMR (LPC17_TMR1_BASE+LPC17_TMR_EMR_OFFSET) -#define LPC17_TMR1_CTCR (LPC17_TMR1_BASE+LPC17_TMR_CTCR_OFFSET) - -#define LPC17_TMR2_IR (LPC17_TMR2_BASE+LPC17_TMR_IR_OFFSET) -#define LPC17_TMR2_TCR (LPC17_TMR2_BASE+LPC17_TMR_TCR_OFFSET) -#define LPC17_TMR2_TC (LPC17_TMR2_BASE+LPC17_TMR_TC_OFFSET) -#define LPC17_TMR2_PR (LPC17_TMR2_BASE+LPC17_TMR_PR_OFFSET) -#define LPC17_TMR2_PC (LPC17_TMR2_BASE+LPC17_TMR_PC_OFFSET) -#define LPC17_TMR2_MCR (LPC17_TMR2_BASE+LPC17_TMR_MCR_OFFSET) -#define LPC17_TMR2_MR0 (LPC17_TMR2_BASE+LPC17_TMR_MR0_OFFSET) -#define LPC17_TMR2_MR1 (LPC17_TMR2_BASE+LPC17_TMR_MR1_OFFSET) -#define LPC17_TMR2_MR2 (LPC17_TMR2_BASE+LPC17_TMR_MR2_OFFSET) -#define LPC17_TMR2_MR3 (LPC17_TMR2_BASE+LPC17_TMR_MR3_OFFSET) -#define LPC17_TMR2_CCR (LPC17_TMR2_BASE+LPC17_TMR_CCR_OFFSET) -#define LPC17_TMR2_CR0 (LPC17_TMR2_BASE+LPC17_TMR_CR0_OFFSET) -#define LPC17_TMR2_CR1 (LPC17_TMR2_BASE+LPC17_TMR_CR1_OFFSET) -#define LPC17_TMR2_EMR (LPC17_TMR2_BASE+LPC17_TMR_EMR_OFFSET) -#define LPC17_TMR2_CTCR (LPC17_TMR2_BASE+LPC17_TMR_CTCR_OFFSET) - -#define LPC17_TMR3_IR (LPC17_TMR3_BASE+LPC17_TMR_IR_OFFSET) -#define LPC17_TMR3_TCR (LPC17_TMR3_BASE+LPC17_TMR_TCR_OFFSET) -#define LPC17_TMR3_TC (LPC17_TMR3_BASE+LPC17_TMR_TC_OFFSET) -#define LPC17_TMR3_PR (LPC17_TMR3_BASE+LPC17_TMR_PR_OFFSET) -#define LPC17_TMR3_PC (LPC17_TMR3_BASE+LPC17_TMR_PC_OFFSET) -#define LPC17_TMR3_MCR (LPC17_TMR3_BASE+LPC17_TMR_MCR_OFFSET) -#define LPC17_TMR3_MR0 (LPC17_TMR3_BASE+LPC17_TMR_MR0_OFFSET) -#define LPC17_TMR3_MR1 (LPC17_TMR3_BASE+LPC17_TMR_MR1_OFFSET) -#define LPC17_TMR3_MR2 (LPC17_TMR3_BASE+LPC17_TMR_MR2_OFFSET) -#define LPC17_TMR3_MR3 (LPC17_TMR3_BASE+LPC17_TMR_MR3_OFFSET) -#define LPC17_TMR3_CCR (LPC17_TMR3_BASE+LPC17_TMR_CCR_OFFSET) -#define LPC17_TMR3_CR0 (LPC17_TMR3_BASE+LPC17_TMR_CR0_OFFSET) -#define LPC17_TMR3_CR1 (LPC17_TMR3_BASE+LPC17_TMR_CR1_OFFSET) -#define LPC17_TMR3_EMR (LPC17_TMR3_BASE+LPC17_TMR_EMR_OFFSET) -#define LPC17_TMR3_CTCR (LPC17_TMR3_BASE+LPC17_TMR_CTCR_OFFSET) - -/* Register bit definitions *********************************************************/ -/* Registers holding 32-bit numeric values (no bit field definitions): - * - * Timer Counter (TC) - * Prescale Register (PR) - * Prescale Counter (PC) - * Match Register 0 (MR0) - * Match Register 1 (MR1) - * Match Register 2 (MR2) - * Match Register 3 (MR3) - * Capture Register 0 (CR0) - * Capture Register 1 (CR1) - */ - -/* Interrupt Register */ - -#define TMR_IR_MR0 (1 << 0) /* Bit 0: Match channel 0 interrupt */ -#define TMR_IR_MR1 (1 << 1) /* Bit 1: Match channel 1 interrupt */ -#define TMR_IR_MR2 (1 << 2) /* Bit 2: Match channel 2 interrupt */ -#define TMR_IR_MR3 (1 << 3) /* Bit 3: Match channel 3 interrupt */ -#define TMR_IR_CR0 (1 << 4) /* Bit 4: Capture channel 0 interrupt */ -#define TMR_IR_CR1 (1 << 5) /* Bit 5: Capture channel 1 interrupt */ - /* Bits 6-31: Reserved */ -/* Timer Control Register */ - -#define TMR_TCR_EN (1 << 0) /* Bit 0: Counter Enable */ -#define TMR_TCR_RESET (1 << 1) /* Bit 1: Counter Reset */ - /* Bits 2-31: Reserved */ -/* Match Control Register */ - -#define TMR_MCR_MR0I (1 << 0) /* Bit 0: Interrupt on MR0 */ -#define TMR_MCR_MR0R (1 << 1) /* Bit 1: Reset on MR0 */ -#define TMR_MCR_MR0S (1 << 2) /* Bit 2: Stop on MR0 */ -#define TMR_MCR_MR1I (1 << 3) /* Bit 3: Interrupt on MR1 */ -#define TMR_MCR_MR1R (1 << 4) /* Bit 4: Reset on MR1 */ -#define TMR_MCR_MR1S (1 << 5) /* Bit 5: Stop on MR1 */ -#define TMR_MCR_MR2I (1 << 6) /* Bit 6: Interrupt on MR2 */ -#define TMR_MCR_MR2R (1 << 7) /* Bit 7: Reset on MR2 */ -#define TMR_MCR_MR2S (1 << 8) /* Bit 8: Stop on MR2 */ -#define TMR_MCR_MR3I (1 << 9) /* Bit 9: Interrupt on MR3 */ -#define TMR_MCR_MR3R (1 << 10) /* Bit 10: Reset on MR3 */ -#define TMR_MCR_MR3S (1 << 11) /* Bit 11: Stop on MR3 */ - /* Bits 12-31: Reserved */ -/* Capture Control Register */ - -#define TMR_CCR_CAP0RE (1 << 0) /* Bit 0: Capture on CAPn.0 rising edge */ -#define TMR_CCR_CAP0FE (1 << 1) /* Bit 1: Capture on CAPn.0 falling edge */ -#define TMR_CCR_CAP0I (1 << 2) /* Bit 2: Interrupt on CAPn.0 */ -#define TMR_CCR_CAP1RE (1 << 3) /* Bit 3: Capture on CAPn.1 rising edge */ -#define TMR_CCR_CAP1FE (1 << 4) /* Bit 4: Capture on CAPn.1 falling edge */ -#define TMR_CCR_CAP1I (1 << 5) /* Bit 5: Interrupt on CAPn.1 */ - /* Bits 6-31: Reserved */ -/* External Match Register */ - -#define TMR_EMR_NOTHING (0) /* Do Nothing */ -#define TMR_EMR_CLEAR (1) /* Clear external match bit MATn.m */ -#define TMR_EMR_SET (2) /* Set external match bit MATn.m */ -#define TMR_EMR_TOGGLE (3) /* Toggle external match bit MATn.m */ - -#define TMR_EMR_EM0 (1 << 0) /* Bit 0: External Match 0 */ -#define TMR_EMR_EM1 (1 << 1) /* Bit 1: External Match 1 */ -#define TMR_EMR_EM2 (1 << 2) /* Bit 2: External Match 2 */ -#define TMR_EMR_EM3 (1 << 3) /* Bit 3: External Match 3 */ -#define TMR_EMR_EMC0_SHIFT (4) /* Bits 4-5: External Match Control 0 */ -#define TMR_EMR_EMC0_MASK (3 << TMR_EMR_EMC0_SHIFTy) -# define TMR_EMR_EMC0_NOTHING (TMR_EMR_NOTHING << TMR_EMR_EMC0_SHIFT) -# define TMR_EMR_EMC0_CLEAR (TMR_EMR_CLEAR << TMR_EMR_EMC0_SHIFT) -# define TMR_EMR_EMC0_SET (TMR_EMR_SET << TMR_EMR_EMC0_SHIFT) -# define TMR_EMR_EMC0_TOGGLE (TMR_EMR_TOGGLE << TMR_EMR_EMC0_SHIFT) -#define TMR_EMR_EMC1_SHIFT (6) /* Bits 6-7: External Match Control 1 */ -#define TMR_EMR_EMC1_MASK (3 << TMR_EMR_EMC1_SHIFT) -# define TMR_EMR_EMC1_NOTHING (TMR_EMR_NOTHING << TMR_EMR_EMC1_SHIFT) -# define TMR_EMR_EMC1_CLEAR (TMR_EMR_CLEAR << TMR_EMR_EMC1_SHIFT) -# define TMR_EMR_EMC1_SET (TMR_EMR_SET << TMR_EMR_EMC1_SHIFT) -# define TMR_EMR_EMC1_TOGGLE (TMR_EMR_TOGGLE << TMR_EMR_EMC1_SHIFT) -#define TMR_EMR_EMC2_SHIFT (8) /* Bits 8-9: External Match Control 2 */ -#define TMR_EMR_EMC2_MASK (3 << TMR_EMR_EMC2_SHIFT) -# define TMR_EMR_EMC2_NOTHING (TMR_EMR_NOTHING << TMR_EMR_EMC2_SHIFT) -# define TMR_EMR_EMC2_CLEAR (TMR_EMR_CLEAR << TMR_EMR_EMC2_SHIFT) -# define TMR_EMR_EMC2_SET (TMR_EMR_SET << TMR_EMR_EMC2_SHIFT) -# define TMR_EMR_EMC2_TOGGLE (TMR_EMR_TOGGLE << TMR_EMR_EMC2_SHIFT) -#define TMR_EMR_EMC3_SHIFT (10) /* Bits 10-11: External Match Control 3 */ -#define TMR_EMR_EMC3_MASK (3 << TMR_EMR_EMC3_SHIFT) -# define TMR_EMR_EMC3_NOTHING (TMR_EMR_NOTHING << TMR_EMR_EMC3_SHIFT) -# define TMR_EMR_EMC3_CLEAR (TMR_EMR_CLEAR << TMR_EMR_EMC3_SHIFT) -# define TMR_EMR_EMC3_SET (TMR_EMR_SET << TMR_EMR_EMC3_SHIFT) -# define TMR_EMR_EMC3_TOGGLE (TMR_EMR_TOGGLE << TMR_EMR_EMC3_SHIFT) - /* Bits 12-31: Reserved */ -/* Count Control Register */ - -#define TMR_CTCR_MODE_SHIFT (0) /* Bits 0-1: Counter/Timer Mode */ -#define TMR_CTCR_MODE_MASK (3 << TMR_CTCR_MODE_SHIFT) -# define TMR_CTCR_MODE_TIMER (0 << TMR_CTCR_MODE_SHIFT) /* Timer Mode, prescale match */ -# define TMR_CTCR_MODE_CNTRRE (1 << TMR_CTCR_MODE_SHIFT) /* Counter Mode, CAP rising edge */ -# define TMR_CTCR_MODE_CNTRFE (2 << TMR_CTCR_MODE_SHIFT) /* Counter Mode, CAP falling edge */ -# define TMR_CTCR_MODE_CNTRBE (3 << TMR_CTCR_MODE_SHIFT) /* Counter Mode, CAP both edges */ -#define TMR_CTCR_INPSEL_SHIFT (2) /* Bits 2-3: Count Input Select */ -#define TMR_CTCR_INPSEL_MASK (3 << TMR_CTCR_INPSEL_SHIFT) -# define TMR_CTCR_INPSEL_CAPNp0 (0 << TMR_CTCR_INPSEL_SHIFT) /* CAPn.0 for TIMERn */ -# define TMR_CTCR_INPSEL_CAPNp1 (1 << TMR_CTCR_INPSEL_SHIFT) /* CAPn.1 for TIMERn */ - /* Bits 4-31: Reserved */ - -/************************************************************************************ - * Public Types - ************************************************************************************/ - -/************************************************************************************ - * Public Data - ************************************************************************************/ - -/************************************************************************************ - * Public Functions - ************************************************************************************/ - -#endif /* __ARCH_ARM_SRC_LPC17XX_LPC17_TIMER_H */ +/************************************************************************************ + * arch/arm/src/lpc17xx/lpc17_timer.h + * + * Copyright (C) 2010, 2012-2013 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * 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. + * + ************************************************************************************/ + +#ifndef __ARCH_ARM_SRC_LPC17XX_LPC17_TIMER_H +#define __ARCH_ARM_SRC_LPC17XX_LPC17_TIMER_H + +/************************************************************************************ + * Included Files + ************************************************************************************/ + +#include +#include "chip/lpc17_timer.h" + +/************************************************************************************ + * Pre-processor Definitions + ************************************************************************************/ + +/************************************************************************************ + * Public Types + ************************************************************************************/ + +/************************************************************************************ + * Public Data + ************************************************************************************/ + +/************************************************************************************ + * Public Functions + ************************************************************************************/ + +#endif /* __ARCH_ARM_SRC_LPC17XX_LPC17_TIMER_H */ diff --git a/nuttx/arch/arm/src/lpc17xx/lpc17_timerisr.c b/nuttx/arch/arm/src/lpc17xx/lpc17_timerisr.c index 918c153a4b..ffe975e92d 100644 --- a/nuttx/arch/arm/src/lpc17xx/lpc17_timerisr.c +++ b/nuttx/arch/arm/src/lpc17xx/lpc17_timerisr.c @@ -52,7 +52,7 @@ #include "up_arch.h" #include "chip.h" -#include "lpc17_internal.h" + /**************************************************************************** * Definitions diff --git a/nuttx/arch/arm/src/lpc17xx/lpc17_usbdev.c b/nuttx/arch/arm/src/lpc17xx/lpc17_usbdev.c index a5cb443e4b..b1ddb59282 100644 --- a/nuttx/arch/arm/src/lpc17xx/lpc17_usbdev.c +++ b/nuttx/arch/arm/src/lpc17xx/lpc17_usbdev.c @@ -55,13 +55,14 @@ #include #include -#include "chip.h" #include "up_arch.h" #include "up_internal.h" -#include "lpc17_internal.h" -#include "lpc17_usb.h" -#include "lpc17_syscon.h" +#include "chip.h" +#include "chip/lpc17_usb.h" +#include "chip/lpc17_syscon.h" +#include "lpc17_gpio.h" +#include "lpc17_gpdma.h" /******************************************************************************* * Definitions diff --git a/nuttx/arch/arm/src/lpc17xx/lpc17_usbhost.c b/nuttx/arch/arm/src/lpc17xx/lpc17_usbhost.c index de880cac10..b0e9958e93 100644 --- a/nuttx/arch/arm/src/lpc17xx/lpc17_usbhost.c +++ b/nuttx/arch/arm/src/lpc17xx/lpc17_usbhost.c @@ -56,15 +56,15 @@ #include -#include "lpc17_internal.h" /* Includes default GPIO settings */ #include /* May redefine GPIO settings */ -#include "chip.h" #include "up_arch.h" #include "up_internal.h" -#include "lpc17_usb.h" -#include "lpc17_syscon.h" +#include "chip.h" +#include "chip/lpc17_usb.h" +#include "chip/lpc17_syscon.h" +#include "lpc17_gpio.h" #include "lpc17_ohciram.h" /******************************************************************************* diff --git a/nuttx/arch/arm/src/lpc17xx/lpc17_wdt.h b/nuttx/arch/arm/src/lpc17xx/lpc17_wdt.h index bd7790a6ea..b9ef49fc35 100644 --- a/nuttx/arch/arm/src/lpc17xx/lpc17_wdt.h +++ b/nuttx/arch/arm/src/lpc17xx/lpc17_wdt.h @@ -1,7 +1,7 @@ /************************************************************************************ * arch/arm/src/lpc17xx/lpc17_wdt.h * - * Copyright (C) 2010 Gregory Nutt. All rights reserved. + * Copyright (C) 2010, 2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -41,58 +41,12 @@ ************************************************************************************/ #include - -#include "chip.h" -#include "lpc17_memorymap.h" +#include "chip/lpc17_wdt.h" /************************************************************************************ * Pre-processor Definitions ************************************************************************************/ -/* Register offsets *****************************************************************/ - -#define LPC17_WDT_WDMOD_OFFSET 0x0000 /* Watchdog mode register */ -#define LPC17_WDT_WDTC_OFFSET 0x0004 /* Watchdog timer constant register */ -#define LPC17_WDT_WDFEED_OFFSET 0x0008 /* Watchdog feed sequence register */ -#define LPC17_WDT_WDTV_OFFSET 0x000c /* Watchdog timer value register */ -#define LPC17_WDT_WDCLKSEL_OFFSET 0x0010 /* Watchdog clock source selection register */ - -/* Register addresses ***************************************************************/ - -#define LPC17_WDT_WDMOD (LPC17_WDT_BASE+LPC17_WDT_WDMOD_OFFSET) -#define LPC17_WDT_WDTC (LPC17_WDT_BASE+LPC17_WDT_WDTC_OFFSET) -#define LPC17_WDT_WDFEED (LPC17_WDT_BASE+LPC17_WDT_WDFEED_OFFSET) -#define LPC17_WDT_WDTV (LPC17_WDT_BASE+LPC17_WDT_WDTV_OFFSET) -#define LPC17_WDT_WDCLKSEL (LPC17_WDT_BASE+LPC17_WDT_WDCLKSEL_OFFSET) - -/* Register bit definitions *********************************************************/ - -/* Watchdog mode register */ - -#define WDT_WDMOD_WDEN (1 << 0) /* Bit 0: Watchdog enable */ -#define WDT_WDMOD_WDRESET (1 << 1) /* Bit 1: Watchdog reset enable */ -#define WDT_WDMOD_WDTOF (1 << 2) /* Bit 2: Watchdog time-out */ -#define WDT_WDMOD_WDINT (1 << 3) /* Bit 3: Watchdog interrupt */ - /* Bits 14-31: Reserved */ - -/* Watchdog timer constant register (Bits 0-31: Watchdog time-out interval) */ - -/* Watchdog feed sequence register */ - -#define WDT_WDFEED_MASK (0xff) /* Bits 0-7: Feed value should be 0xaa followed by 0x55 */ - /* Bits 14-31: Reserved */ -/* Watchdog timer value register (Bits 0-31: Counter timer value) */ - -/* Watchdog clock source selection register */ - -#define WDT_WDCLKSEL_WDSEL_SHIFT (0) /* Bits 0-1: Clock source for the Watchdog timer */ -#define WDT_WDCLKSEL_WDSEL_MASK (3 << WDT_WDCLKSEL_WDSEL_SHIFT) -# define WDT_WDCLKSEL_WDSEL_INTRC (0 << WDT_WDCLKSEL_WDSEL_SHIFT) /* Internal RC osc */ -# define WDT_WDCLKSEL_WDSEL_APB (1 << WDT_WDCLKSEL_WDSEL_SHIFT) /* APB peripheral clock (watchdog pclk) */ -# define WDT_WDCLKSEL_WDSEL_RTC (2 << WDT_WDCLKSEL_WDSEL_SHIFT) /* RTC oscillator (rtc_clk) */ - /* Bits 2-30: Reserved */ -#define WDT_WDCLKSEL_WDLOCK (1 << 31) /* Bit 31: Lock WDT register bits if set */ - /************************************************************************************ * Public Types ************************************************************************************/ diff --git a/nuttx/configs/lincoln60/src/up_boot.c b/nuttx/configs/lincoln60/src/up_boot.c index 42b01a3ea3..6e67f777b4 100644 --- a/nuttx/configs/lincoln60/src/up_boot.c +++ b/nuttx/configs/lincoln60/src/up_boot.c @@ -47,7 +47,6 @@ #include "up_arch.h" #include "up_internal.h" -#include "lpc17_internal.h" #include "lincoln60_internal.h" /************************************************************************************ diff --git a/nuttx/configs/lincoln60/src/up_buttons.c b/nuttx/configs/lincoln60/src/up_buttons.c index 55781846d5..76cb1f2d9e 100644 --- a/nuttx/configs/lincoln60/src/up_buttons.c +++ b/nuttx/configs/lincoln60/src/up_buttons.c @@ -1,7 +1,7 @@ /**************************************************************************** * configs/lincoln60/src/up_buttons.c * - * Copyright (C) 2012 Gregory Nutt. All rights reserved. + * Copyright (C) 2012-2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -47,7 +47,7 @@ #include -#include "lpc17_internal.h" +#include "lpc17_gpio.h" #include "lincoln60_internal.h" #ifdef CONFIG_ARCH_BUTTONS diff --git a/nuttx/configs/lincoln60/src/up_leds.c b/nuttx/configs/lincoln60/src/up_leds.c index fe00895b16..3b8692d939 100644 --- a/nuttx/configs/lincoln60/src/up_leds.c +++ b/nuttx/configs/lincoln60/src/up_leds.c @@ -2,7 +2,7 @@ * configs/lincoln60/src/up_leds.c * arch/arm/src/board/up_leds.c * - * Copyright (C) 2012 Gregory Nutt. All rights reserved. + * Copyright (C) 2012-2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -50,7 +50,7 @@ #include "up_arch.h" #include "up_internal.h" -#include "lpc17_internal.h" +#include "lpc17_gpio.h" #include "lincoln60_internal.h" diff --git a/nuttx/configs/lpcxpresso-lpc1768/src/lpcxpresso_internal.h b/nuttx/configs/lpcxpresso-lpc1768/src/lpcxpresso_internal.h index 41ec1ce111..3e7dfa4e5e 100644 --- a/nuttx/configs/lpcxpresso-lpc1768/src/lpcxpresso_internal.h +++ b/nuttx/configs/lpcxpresso-lpc1768/src/lpcxpresso_internal.h @@ -141,8 +141,8 @@ * SD Signal Pin Pin * --- ----------- ----- -------- * CS PIO1_11* 55 P2.2 (See LPCXPRESSO_SD_CS) - * DIN PIO0_9-MOSI 5 P0.9 MOSI1 (See GPIO_SSP1_MOSI in lpc17_internal.h) - * DOUT PIO0_8-MISO 6 P0.8 MISO1 (See GPIO_SSP1_MISO in lpc17_internal.h) + * DIN PIO0_9-MOSI 5 P0.9 MOSI1 (See GPIO_SSP1_MOSI in chip/lpc17_ssp.h) + * DOUT PIO0_8-MISO 6 P0.8 MISO1 (See GPIO_SSP1_MISO in chip/lpc17_ssp.h) * CLK PIO2_11-SCK 7 P0.9 SCK1 (See GPIO_SSP1_SCK in board.h) * CD PIO2_10 52 P2.11 (See LPCXPRESSO_SD_CD) */ diff --git a/nuttx/configs/lpcxpresso-lpc1768/src/up_boot.c b/nuttx/configs/lpcxpresso-lpc1768/src/up_boot.c index f672c4517d..9766569a95 100644 --- a/nuttx/configs/lpcxpresso-lpc1768/src/up_boot.c +++ b/nuttx/configs/lpcxpresso-lpc1768/src/up_boot.c @@ -47,7 +47,7 @@ #include "up_arch.h" #include "up_internal.h" -#include "lpc17_internal.h" +#include "lpc17_ssp.h" #include "lpcxpresso_internal.h" /************************************************************************************ diff --git a/nuttx/configs/lpcxpresso-lpc1768/src/up_leds.c b/nuttx/configs/lpcxpresso-lpc1768/src/up_leds.c index cebf3a143d..85539b3787 100644 --- a/nuttx/configs/lpcxpresso-lpc1768/src/up_leds.c +++ b/nuttx/configs/lpcxpresso-lpc1768/src/up_leds.c @@ -2,7 +2,7 @@ * configs/lpcxpresso-lpc1768/src/up_leds.c * arch/arm/src/board/up_leds.c * - * Copyright (C) 2011 Gregory Nutt. All rights reserved. + * Copyright (C) 2011, 2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -46,7 +46,7 @@ #include "up_arch.h" #include "up_internal.h" -#include "lpc17_internal.h" +#include "lpc17_gpio.h" #include "lpcxpresso_internal.h" #ifdef CONFIG_ARCH_LEDS diff --git a/nuttx/configs/lpcxpresso-lpc1768/src/up_oled.c b/nuttx/configs/lpcxpresso-lpc1768/src/up_oled.c index f3ecde9095..c22b09ceb3 100644 --- a/nuttx/configs/lpcxpresso-lpc1768/src/up_oled.c +++ b/nuttx/configs/lpcxpresso-lpc1768/src/up_oled.c @@ -2,7 +2,7 @@ * config/lpcxpresso-lpc1768/src/up_oled.c * arch/arm/src/board/up_oled.c * - * Copyright (C) 2011 Gregory Nutt. All rights reserved. + * Copyright (C) 2011, 2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -48,7 +48,8 @@ #include #include -#include "lpc17_internal.h" +#include "lpc17_gpio.h" +#include "lpc17_ssp.h" #include "lpcxpresso_internal.h" /**************************************************************************** diff --git a/nuttx/configs/lpcxpresso-lpc1768/src/up_ssp.c b/nuttx/configs/lpcxpresso-lpc1768/src/up_ssp.c index 7b5f02e31c..3504d78c79 100644 --- a/nuttx/configs/lpcxpresso-lpc1768/src/up_ssp.c +++ b/nuttx/configs/lpcxpresso-lpc1768/src/up_ssp.c @@ -2,7 +2,7 @@ * configs/lpcxpresso-lpc1768/src/up_ssp.c * arch/arm/src/board/up_ssp.c * - * Copyright (C) 2011 Gregory Nutt. All rights reserved. + * Copyright (C) 2011, 2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -49,7 +49,8 @@ #include "up_arch.h" #include "chip.h" -#include "lpc17_internal.h" +#include "lpc17_gpio.h" +#include "lpc17_ssp.h" #include "lpcxpresso_internal.h" #if defined(CONFIG_LPC17_SSP0) || defined(CONFIG_LPC17_SSP1) @@ -155,11 +156,11 @@ void weak_function lpc17_sspinitialize(void) void lpc17_ssp0select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected) { sspdbg("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert"); - ssp_dumpgpio("lpc17_spi0select() Entry"); + ssp_dumpgpio("lpc17_ssp0select() Entry"); #warning "Assert CS here (false)" - ssp_dumpgpio("lpc17_spi0select() Exit"); + ssp_dumpgpio("lpc17_ssp0select() Exit"); } uint8_t lpc17_ssp0status(FAR struct spi_dev_s *dev, enum spi_dev_e devid) @@ -173,7 +174,7 @@ uint8_t lpc17_ssp0status(FAR struct spi_dev_s *dev, enum spi_dev_e devid) void lpc17_ssp1select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected) { sspdbg("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert"); - ssp_dumpgpio("lpc17_spi1select() Entry"); + ssp_dumpgpio("lpc17_ssp1select() Entry"); if (devid == SPIDEV_MMCSD) { @@ -189,7 +190,7 @@ void lpc17_ssp1select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool sel (void)lpc17_gpiowrite(LPCXPRESSO_OLED_CS, !selected); } #endif - ssp_dumpgpio("lpc17_spi1select() Exit"); + ssp_dumpgpio("lpc17_ssp1select() Exit"); } uint8_t lpc17_ssp1status(FAR struct spi_dev_s *dev, enum spi_dev_e devid) diff --git a/nuttx/configs/mbed/src/up_boot.c b/nuttx/configs/mbed/src/up_boot.c index 42dd54bf56..489c0a58ce 100644 --- a/nuttx/configs/mbed/src/up_boot.c +++ b/nuttx/configs/mbed/src/up_boot.c @@ -47,7 +47,6 @@ #include "up_arch.h" #include "up_internal.h" -#include "lpc17_internal.h" #include "mbed_internal.h" /************************************************************************************ @@ -80,3 +79,4 @@ void lpc17_boardinitialize(void) up_ledinit(); #endif } + diff --git a/nuttx/configs/mbed/src/up_leds.c b/nuttx/configs/mbed/src/up_leds.c index bc8a870452..c8c78e3add 100644 --- a/nuttx/configs/mbed/src/up_leds.c +++ b/nuttx/configs/mbed/src/up_leds.c @@ -2,7 +2,7 @@ * configs/mbed/src/up_leds.c * arch/arm/src/board/up_leds.c * - * Copyright (C) 2010 Gregory Nutt. All rights reserved. + * Copyright (C) 2010, 2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -50,7 +50,7 @@ #include "up_arch.h" #include "up_internal.h" -#include "lpc17_internal.h" +#include "lpc17_gpio.h" #include "mbed_internal.h" diff --git a/nuttx/configs/nucleus2g/src/up_boot.c b/nuttx/configs/nucleus2g/src/up_boot.c index d4c44a4556..4718e9f823 100644 --- a/nuttx/configs/nucleus2g/src/up_boot.c +++ b/nuttx/configs/nucleus2g/src/up_boot.c @@ -47,7 +47,7 @@ #include "up_arch.h" #include "up_internal.h" -#include "lpc17_internal.h" +#include "lpc17_ssp.h" #include "nucleus2g_internal.h" /************************************************************************************ diff --git a/nuttx/configs/nucleus2g/src/up_leds.c b/nuttx/configs/nucleus2g/src/up_leds.c index 41f955af48..e1c39f5155 100644 --- a/nuttx/configs/nucleus2g/src/up_leds.c +++ b/nuttx/configs/nucleus2g/src/up_leds.c @@ -2,7 +2,7 @@ * configs/nucleus2g/src/up_leds.c * arch/arm/src/board/up_leds.c * - * Copyright (C) 2010 Gregory Nutt. All rights reserved. + * Copyright (C) 2010, 2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -50,7 +50,7 @@ #include "up_arch.h" #include "up_internal.h" -#include "lpc17_internal.h" +#include "lpc17_gpio.h" #include "nucleus2g_internal.h" diff --git a/nuttx/configs/nucleus2g/src/up_outputs.c b/nuttx/configs/nucleus2g/src/up_outputs.c index 749f331eb4..beb979ae00 100644 --- a/nuttx/configs/nucleus2g/src/up_outputs.c +++ b/nuttx/configs/nucleus2g/src/up_outputs.c @@ -7,7 +7,7 @@ * * This file is part of NuttX: * - * Copyright (C) 2012 Gregory Nutt. All rights reserved. + * Copyright (C) 2012-2013 Gregory Nutt. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -54,7 +54,7 @@ #include "up_arch.h" #include "up_internal.h" -#include "lpc17_internal.h" +#include "lpc17_gpio.h" #include "nucleus2g_internal.h" diff --git a/nuttx/configs/nucleus2g/src/up_ssp.c b/nuttx/configs/nucleus2g/src/up_ssp.c index 13a7681301..77c07f3ebc 100644 --- a/nuttx/configs/nucleus2g/src/up_ssp.c +++ b/nuttx/configs/nucleus2g/src/up_ssp.c @@ -2,7 +2,7 @@ * configs/nucleus2g/src/up_ssp.c * arch/arm/src/board/up_ssp.c * - * Copyright (C) 2010 Gregory Nutt. All rights reserved. + * Copyright (C) 2010, 2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -49,7 +49,8 @@ #include "up_arch.h" #include "chip.h" -#include "lpc17_internal.h" +#include "lpc17_gpio.h" +#include "lpc17_ssp.h" #include "nucleus2g_internal.h" #if defined(CONFIG_LPC17_SSP0) || defined(CONFIG_LPC17_SSP1) @@ -158,7 +159,7 @@ void weak_function lpc17_sspinitialize(void) void lpc17_ssp0select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected) { sspdbg("devid: %d CS: %s\n", (int)devid, selected ? "assert" : "de-assert"); - ssp_dumpgpio("lpc17_spiselect() Entry"); + ssp_dumpgpio("lpc17_ssp0select() Entry"); if (devid == SPIDEV_MMCSD) { @@ -166,7 +167,7 @@ void lpc17_ssp0select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool sel lpc17_gpiowrite(NUCLEUS2G_MMCSD_CS, !selected); } - ssp_dumpgpio("lpc17_spiselect() Exit"); + ssp_dumpgpio("lpc17_ssp0select() Exit"); } uint8_t lpc17_ssp0status(FAR struct spi_dev_s *dev, enum spi_dev_e devid) diff --git a/nuttx/configs/olimex-lpc1766stk/src/up_boot.c b/nuttx/configs/olimex-lpc1766stk/src/up_boot.c index 9d4c3ad3ba..9f42000046 100644 --- a/nuttx/configs/olimex-lpc1766stk/src/up_boot.c +++ b/nuttx/configs/olimex-lpc1766stk/src/up_boot.c @@ -47,7 +47,7 @@ #include "up_arch.h" #include "up_internal.h" -#include "lpc17_internal.h" +#include "lpc17_ssp.h" #include "lpc1766stk_internal.h" /************************************************************************************ diff --git a/nuttx/configs/olimex-lpc1766stk/src/up_buttons.c b/nuttx/configs/olimex-lpc1766stk/src/up_buttons.c index bcafc73370..6d47d2890e 100644 --- a/nuttx/configs/olimex-lpc1766stk/src/up_buttons.c +++ b/nuttx/configs/olimex-lpc1766stk/src/up_buttons.c @@ -47,7 +47,7 @@ #include -#include "lpc17_internal.h" +#include "lpc17_gpio.h" #include "lpc1766stk_internal.h" #ifdef CONFIG_ARCH_BUTTONS diff --git a/nuttx/configs/olimex-lpc1766stk/src/up_can.c b/nuttx/configs/olimex-lpc1766stk/src/up_can.c index f947c827e1..51d8423e3f 100644 --- a/nuttx/configs/olimex-lpc1766stk/src/up_can.c +++ b/nuttx/configs/olimex-lpc1766stk/src/up_can.c @@ -49,7 +49,6 @@ #include "chip.h" #include "up_arch.h" -#include "lpc17_internal.h" #include "lpc17_can.h" #include "lpc1766stk_internal.h" diff --git a/nuttx/configs/olimex-lpc1766stk/src/up_lcd.c b/nuttx/configs/olimex-lpc1766stk/src/up_lcd.c index 93923b91a3..4e4c948564 100644 --- a/nuttx/configs/olimex-lpc1766stk/src/up_lcd.c +++ b/nuttx/configs/olimex-lpc1766stk/src/up_lcd.c @@ -52,7 +52,7 @@ #include "up_arch.h" #include "lpc17_syscon.h" #include "lpc17_pwm.h" -#include "lpc17_internal.h" +#include "lpc17_gpio.h" #include "lpc1766stk_internal.h" #if defined(CONFIG_NX_LCDDRIVER) && defined(CONFIG_LCD_NOKIA6100) && defined(CONFIG_LPC17_SSP0) diff --git a/nuttx/configs/olimex-lpc1766stk/src/up_leds.c b/nuttx/configs/olimex-lpc1766stk/src/up_leds.c index 75c6a8ce0a..e590be39f4 100644 --- a/nuttx/configs/olimex-lpc1766stk/src/up_leds.c +++ b/nuttx/configs/olimex-lpc1766stk/src/up_leds.c @@ -50,7 +50,7 @@ #include "up_arch.h" #include "up_internal.h" -#include "lpc17_internal.h" +#include "lpc17_gpio.h" #include "lpc1766stk_internal.h" diff --git a/nuttx/configs/olimex-lpc1766stk/src/up_nsh.c b/nuttx/configs/olimex-lpc1766stk/src/up_nsh.c index 036350dede..99e9c4d9c2 100644 --- a/nuttx/configs/olimex-lpc1766stk/src/up_nsh.c +++ b/nuttx/configs/olimex-lpc1766stk/src/up_nsh.c @@ -2,7 +2,7 @@ * config/olimex-lpc1766stk/src/up_nsh.c * arch/arm/src/board/up_nsh.c * - * Copyright (C) 2010 Gregory Nutt. All rights reserved. + * Copyright (C) 2010, 2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -49,7 +49,7 @@ #include #include -#include "lpc17_internal.h" +#include "lpc17_gpio.h" #include "lpc1766stk_internal.h" /**************************************************************************** diff --git a/nuttx/configs/olimex-lpc1766stk/src/up_ssp.c b/nuttx/configs/olimex-lpc1766stk/src/up_ssp.c index 272a170650..2c6c613c79 100644 --- a/nuttx/configs/olimex-lpc1766stk/src/up_ssp.c +++ b/nuttx/configs/olimex-lpc1766stk/src/up_ssp.c @@ -53,7 +53,8 @@ #include "up_arch.h" #include "chip.h" -#include "lpc17_internal.h" +#include "lpc17_gpio.h" +#include "lpc17_ssp.h" #include "lpc1766stk_internal.h" #if defined(CONFIG_LPC17_SSP0) || defined(CONFIG_LPC17_SSP1) diff --git a/nuttx/configs/olimex-lpc1766stk/src/up_usbmsc.c b/nuttx/configs/olimex-lpc1766stk/src/up_usbmsc.c index 08c5fb8874..ce7c757718 100644 --- a/nuttx/configs/olimex-lpc1766stk/src/up_usbmsc.c +++ b/nuttx/configs/olimex-lpc1766stk/src/up_usbmsc.c @@ -48,7 +48,7 @@ #include #include -#include "lpc17_internal.h" +#include "lpc17_gpio.h" #include "lpc1766stk_internal.h" /**************************************************************************** From a79a2bfbd6470061ec9a81340ff66c90ec54a376 Mon Sep 17 00:00:00 2001 From: patacongo Date: Fri, 18 Jan 2013 20:25:32 +0000 Subject: [PATCH 089/118] More LPC1788 register definitions from Rommel Marcelo git-svn-id: http://svn.code.sf.net/p/nuttx/code/trunk@5535 42af7a65-404d-4744-a932-0658087f49c3 --- .../arm/src/lpc17xx/chip/lpc176x_syscon.h | 494 +++++++++++++++ .../arm/src/lpc17xx/chip/lpc178x_memorymap.h | 90 +++ .../arm/src/lpc17xx/chip/lpc178x_pinconfig.h | 589 ++++++++++++++++- .../arm/src/lpc17xx/chip/lpc178x_syscon.h | 598 ++++++++++++++++++ nuttx/arch/arm/src/lpc17xx/chip/lpc17_gpio.h | 115 +--- .../arch/arm/src/lpc17xx/chip/lpc17_syscon.h | 441 +------------ nuttx/arch/arm/src/lpc17xx/lpc17_gpio.c | 16 +- nuttx/arch/arm/src/lpc17xx/lpc17_gpio.h | 233 +++++++ 8 files changed, 2036 insertions(+), 540 deletions(-) create mode 100644 nuttx/arch/arm/src/lpc17xx/chip/lpc176x_syscon.h create mode 100644 nuttx/arch/arm/src/lpc17xx/chip/lpc178x_syscon.h diff --git a/nuttx/arch/arm/src/lpc17xx/chip/lpc176x_syscon.h b/nuttx/arch/arm/src/lpc17xx/chip/lpc176x_syscon.h new file mode 100644 index 0000000000..ddacc05b59 --- /dev/null +++ b/nuttx/arch/arm/src/lpc17xx/chip/lpc176x_syscon.h @@ -0,0 +1,494 @@ +/************************************************************************************ + * arch/arm/src/lpc17xx/chip/lpc176x_syscon.h + * + * Copyright (C) 2010, 2013 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * 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. + * + ************************************************************************************/ + +#ifndef __ARCH_ARM_SRC_LPC17XX_CHIP_LPC176X_SYSCON_H +#define __ARCH_ARM_SRC_LPC17XX_CHIP_LPC176X_SYSCON_H + +/************************************************************************************ + * Included Files + ************************************************************************************/ + +#include + +#include "chip.h" +#include "chip/lpc17_memorymap.h" + +/************************************************************************************ + * Pre-processor Definitions + ************************************************************************************/ + +/* Register offsets *****************************************************************/ +/* Flash accelerator module */ + +#define LPC17_SYSCON_FLASHCFG_OFFSET 0x0000 /* Flash Accelerator Configuration Register */ + +/* Memory Mapping Control register (MEMMAP - 0x400F C040) */ + +#define LPC17_SYSCON_MEMMAP_OFFSET 0x0040 /* Memory Mapping Control register */ + +/* Clocking and power control - Phase locked loops */ + +#define LPC17_SYSCON_PLL0CON_OFFSET 0x0080 /* PLL0 Control Register */ +#define LPC17_SYSCON_PLL0CFG_OFFSET 0x0084 /* PLL0 Configuration Register */ +#define LPC17_SYSCON_PLL0STAT_OFFSET 0x0088 /* PLL0 Status Register */ +#define LPC17_SYSCON_PLL0FEED_OFFSET 0x008c /* PLL0 Feed Register */ + +#define LPC17_SYSCON_PLL1CON_OFFSET 0x00a0 /* PLL1 Control Register */ +#define LPC17_SYSCON_PLL1CFG_OFFSET 0x00a4 /* PLL1 Configuration Register */ +#define LPC17_SYSCON_PLL1STAT_OFFSET 0x00a8 /* PLL1 Status Register */ +#define LPC17_SYSCON_PLL1FEED_OFFSET 0x00ac /* PLL1 Feed Register */ + +/* Clocking and power control - Peripheral power control registers */ + +#define LPC17_SYSCON_PCON_OFFSET 0x00c0 /* Power Control Register */ +#define LPC17_SYSCON_PCONP_OFFSET 0x00c4 /* Power Control for Peripherals Register */ + +/* Clocking and power control -- Clock dividers */ + +#define LPC17_SYSCON_CCLKCFG_OFFSET 0x0104 /* CPU Clock Configuration Register */ +#define LPC17_SYSCON_USBCLKCFG_OFFSET 0x0108 /* USB Clock Configuration Register */ + +/* 0x400f c110 - 0x400f c114: CAN Wake and Sleep Registers */ + +/* Clocking and power control -- Clock source selection */ + +#define LPC17_SYSCON_CLKSRCSEL_OFFSET 0x010c /* Clock Source Select Register */ + +/* System control registers -- External Interrupts */ + +#define LPC17_SYSCON_EXTINT_OFFSET 0x0140 /* External Interrupt Flag Register */ + +#define LPC17_SYSCON_EXTMODE_OFFSET 0x0148 /* External Interrupt Mode register */ +#define LPC17_SYSCON_EXTPOLAR_OFFSET 0x014c /* External Interrupt Polarity Register */ + +/* System control registers -- Reset */ + +#define LPC17_SYSCON_RSID_OFFSET 0x0180 /* Reset Source Identification Register */ + +/* System control registers -- Syscon Miscellaneous Registers */ + +#define LPC17_SYSCON_SCS_OFFSET 0x01a0 /* System Control and Status */ + +/* More clocking and power control -- Clock dividers */ + +#define LPC17_SYSCON_PCLKSEL0_OFFSET 0x01a8 /* Peripheral Clock Selection register 0 */ +#define LPC17_SYSCON_PCLKSEL1_OFFSET 0x01ac /* Peripheral Clock Selection register 1 */ + +/* Device Interrupt Registers (Might be a error in the User Manual, might be at 0x5000c1c0) */ + +#define LPC17_SYSCON_USBINTST_OFFSET 0x01c0 /* USB Interrupt Status */ + +/* DMA Request Select Register */ + +#define LPC17_SYSCON_DMAREQSEL_OFFSET 0x01c4 /* Selects between UART and timer DMA requests */ + +/* More clocking and power control -- Utility */ + +#define LPC17_SYSCON_CLKOUTCFG_OFFSET 0x01c8 /* Clock Output Configuration Register */ + +/* Register addresses ***************************************************************/ +/* Flash accelerator module */ + +#define LPC17_SYSCON_FLASHCFG (LPC17_SYSCON_BASE+LPC17_SYSCON_FLASHCFG_OFFSET) + +/* Memory Mapping Control register (MEMMAP - 0x400F C040) */ + +#define LPC17_SYSCON_MEMMAP (LPC17_SYSCON_BASE+LPC17_SYSCON_MEMMAP_OFFSET) + +/* Clocking and power control - Phase locked loops */ + +#define LPC17_SYSCON_PLL0CON (LPC17_SYSCON_BASE+LPC17_SYSCON_PLL0CON_OFFSET) +#define LPC17_SYSCON_PLL0CFG (LPC17_SYSCON_BASE+LPC17_SYSCON_PLL0CFG_OFFSET) +#define LPC17_SYSCON_PLL0STAT (LPC17_SYSCON_BASE+LPC17_SYSCON_PLL0STAT_OFFSET) +#define LPC17_SYSCON_PLL0FEED (LPC17_SYSCON_BASE+LPC17_SYSCON_PLL0FEED_OFFSET) + +#define LPC17_SYSCON_PLL1CON (LPC17_SYSCON_BASE+LPC17_SYSCON_PLL1CON_OFFSET) +#define LPC17_SYSCON_PLL1CFG (LPC17_SYSCON_BASE+LPC17_SYSCON_PLL1CFG_OFFSET) +#define LPC17_SYSCON_PLL1STAT (LPC17_SYSCON_BASE+LPC17_SYSCON_PLL1STAT_OFFSET) +#define LPC17_SYSCON_PLL1FEED (LPC17_SYSCON_BASE+LPC17_SYSCON_PLL1FEED_OFFSET) + +/* Clocking and power control - Peripheral power control registers */ + +#define LPC17_SYSCON_PCON (LPC17_SYSCON_BASE+LPC17_SYSCON_PCON_OFFSET) +#define LPC17_SYSCON_PCONP (LPC17_SYSCON_BASE+LPC17_SYSCON_PCONP_OFFSET) + +/* Clocking and power control -- Clock dividers */ + +#define LPC17_SYSCON_CCLKCFG (LPC17_SYSCON_BASE+LPC17_SYSCON_CCLKCFG_OFFSET) +#define LPC17_SYSCON_USBCLKCFG (LPC17_SYSCON_BASE+LPC17_SYSCON_USBCLKCFG_OFFSET) + +/* 0x400f c110 - 0x400f c114: CAN Wake and Sleep Registers */ + +/* Clocking and power control -- Clock source selection */ + +#define LPC17_SYSCON_CLKSRCSEL (LPC17_SYSCON_BASE+LPC17_SYSCON_CLKSRCSEL_OFFSET) + +/* System control registers -- External Interrupts */ + +#define LPC17_SYSCON_EXTINT (LPC17_SYSCON_BASE+LPC17_SYSCON_EXTINT_OFFSET) + +#define LPC17_SYSCON_EXTMODE (LPC17_SYSCON_BASE+LPC17_SYSCON_EXTMODE_OFFSET) +#define LPC17_SYSCON_EXTPOLAR (LPC17_SYSCON_BASE+LPC17_SYSCON_EXTPOLAR_OFFSET) + +/* System control registers -- Reset */ + +#define LPC17_SYSCON_RSID (LPC17_SYSCON_BASE+LPC17_SYSCON_RSID_OFFSET) + +/* System control registers -- Syscon Miscellaneous Registers */ + +#define LPC17_SYSCON_SCS (LPC17_SYSCON_BASE+LPC17_SYSCON_SCS_OFFSET) + +/* More clocking and power control -- Clock dividers */ + +#define LPC17_SYSCON_PCLKSEL0 (LPC17_SYSCON_BASE+LPC17_SYSCON_PCLKSEL0_OFFSET) +#define LPC17_SYSCON_PCLKSEL1 (LPC17_SYSCON_BASE+LPC17_SYSCON_PCLKSEL1_OFFSET) + +/* Device Interrupt Registers (Might be a error in the User Manual, might be at 0x5000c1c0) */ + +#define LPC17_SYSCON_USBINTST (LPC17_SYSCON_BASE+LPC17_SYSCON_USBINTST_OFFSET) + +/* DMA Request Select Register */ + +#define LPC17_SYSCON_DMAREQSEL (LPC17_SYSCON_BASE+LPC17_SYSCON_DMAREQSEL_OFFSET) + +/* More clocking and power control -- Utility */ + +#define LPC17_SYSCON_CLKOUTCFG (LPC17_SYSCON_BASE+LPC17_SYSCON_CLKOUTCFG_OFFSET) + +/* Register bit definitions *********************************************************/ +/* Flash accelerator module */ + /* Bits 0-11: Reserved */ +#define SYSCON_FLASHCFG_TIM_SHIFT (12) /* Bits 12-15: FLASHTIM Flash access time */ +#define SYSCON_FLASHCFG_TIM_MASK (15 << SYSCON_FLASHCFG_TIM_SHIFT) +# define SYSCON_FLASHCFG_TIM_1 (0 << SYSCON_FLASHCFG_TIM_SHIFT) /* 1 CPU clock <= 20 MHz CPU clock */ +# define SYSCON_FLASHCFG_TIM_2 (1 << SYSCON_FLASHCFG_TIM_SHIFT) /* 2 CPU clock <= 40 MHz CPU clock */ +# define SYSCON_FLASHCFG_TIM_3 (2 << SYSCON_FLASHCFG_TIM_SHIFT) /* 3 CPU clock <= 60 MHz CPU clock */ +# define SYSCON_FLASHCFG_TIM_4 (3 << SYSCON_FLASHCFG_TIM_SHIFT) /* 4 CPU clock <= 80 MHz CPU clock */ +# define SYSCON_FLASHCFG_TIM_5 (4 << SYSCON_FLASHCFG_TIM_SHIFT) /* 5 CPU clock <= 100 MHz CPU clock + * (Up to 120 Mhz for LPC1759/69 only */ +# define SYSCON_FLASHCFG_TIM_6 (5 << SYSCON_FLASHCFG_TIM_SHIFT) /* "safe" setting for any conditions */ + /* Bits 16-31: Reserved */ + +/* Memory Mapping Control register (MEMMAP - 0x400F C040) */ + +#define SYSCON_MEMMAP_MAP (1 << 0) /* Bit 0: + * 0:Boot mode. A portion of the Boot ROM is mapped to address 0. + * 1:User mode. The on-chip Flash memory is mapped to address 0 */ + /* Bits 1-31: Reserved */ + +/* Clocking and power control -- Clock source selection */ + +#define SYSCON_CLKSRCSEL_SHIFT (0) /* Bits 0-1: Clock selection */ +#define SYSCON_CLKSRCSEL_MASK (3 << SYSCON_CLKSRCSEL_SHIFT) +# define SYSCON_CLKSRCSEL_INTRC (0 << SYSCON_CLKSRCSEL_SHIFT) /* PLL0 source = internal RC oscillator */ +# define SYSCON_CLKSRCSEL_MAIN (1 << SYSCON_CLKSRCSEL_SHIFT) /* PLL0 source = main oscillator */ +# define SYSCON_CLKSRCSEL_RTC (2 << SYSCON_CLKSRCSEL_SHIFT) /* PLL0 source = RTC oscillator */ + /* Bits 2-31: Reserved */ + +/* Clocking and power control - Phase locked loops */ +/* PLL0/1 Control register */ + +#define SYSCON_PLLCON_PLLE (1 << 0) /* Bit 0: PLL0/1 Enable */ +#define SYSCON_PLLCON_PLLC (1 << 1) /* Bit 1: PLL0/1 Connect */ + /* Bits 2-31: Reserved */ +/* PLL0 Configuration register */ + +#define SYSCON_PLL0CFG_MSEL_SHIFT (0) /* Bit 0-14: PLL0 Multiplier value */ +#define SYSCON_PLL0CFG_MSEL_MASK (0x7fff << SYSCON_PLL0CFG_MSEL_SHIFT) + /* Bit 15: Reserved */ +#define SYSCON_PLL0CFG_NSEL_SHIFT (16) /* Bit 16-23: PLL0 Pre-Divider value */ +#define SYSCON_PLL0CFG_NSEL_MASK (0xff << SYSCON_PLL0CFG_NSEL_SHIFT) + /* Bits 24-31: Reserved */ +/* PLL1 Configuration register */ + +#define SYSCON_PLL1CFG_MSEL_SHIFT (0) /* Bit 0-4: PLL1 Multiplier value */ +#define SYSCON_PLL1CFG_MSEL_MASK (0x1f < SYSCON_PLL1CFG_MSEL_SHIFT) +#define SYSCON_PLL1CFG_NSEL_SHIFT (5) /* Bit 5-6: PLL1 Pre-Divider value */ +#define SYSCON_PLL1CFG_NSEL_MASK (3 << SYSCON_PLL1CFG_NSEL_SHIFT) + /* Bits 7-31: Reserved */ +/* PLL0 Status register */ + +#define SYSCON_PLL0STAT_MSEL_SHIFT (0) /* Bit 0-14: PLL0 Multiplier value readback */ +#define SYSCON_PLL0STAT_MSEL_MASK (0x7fff << SYSCON_PLL0STAT_MSEL_SHIFT) + /* Bit 15: Reserved */ +#define SYSCON_PLL0STAT_NSEL_SHIFT (16) /* Bit 16-23: PLL0 Pre-Divider value readback */ +#define SYSCON_PLL0STAT_NSEL_MASK (0xff << SYSCON_PLL0STAT_NSEL_SHIFT) +#define SYSCON_PLL0STAT_PLLE (1 << 24) /* Bit 24: PLL0 enable readback */ +#define SYSCON_PLL0STAT_PLLC (1 << 25) /* Bit 25: PLL0 connect readback */ +#define SYSCON_PLL0STAT_PLOCK (1 << 26) /* Bit 26: PLL0 lock status */ + /* Bits 27-31: Reserved */ +/* PLL1 Status register */ + +#define SYSCON_PLL1STAT_MSEL_SHIFT (0) /* Bit 0-4: PLL1 Multiplier value readback */ +#define SYSCON_PLL1STAT_MSEL_MASK (0x1f << SYSCON_PLL1STAT_MSEL_SHIFT) +#define SYSCON_PLL1STAT_NSEL_SHIFT (5) /* Bit 5-6: PLL1 Pre-Divider value readback */ +#define SYSCON_PLL1STAT_NSEL_MASK (3 << SYSCON_PLL1STAT_NSEL_SHIFT) + /* Bit 7: Reserved */ +#define SYSCON_PLL1STAT_PLLE (1 << 8) /* Bit 8: PLL1 enable readback */ +#define SYSCON_PLL1STAT_PLLC (1 << 9) /* Bit 9: PLL1 connect readback */ +#define SYSCON_PLL1STAT_PLOCK (1 << 10) /* Bit 10: PLL1 lock status */ + /* Bits 11-31: Reserved */ +/* PLL0/1 Feed register */ + +#define SYSCON_PLLFEED_SHIFT (0) /* Bit 0-7: PLL0/1 feed sequence */ +#define SYSCON_PLLFEED_MASK (0xff << SYSCON_PLLFEED_SHIFT) + /* Bits 8-31: Reserved */ +/* Clocking and power control -- Clock dividers */ +/* CPU Clock Configuration register */ + +#define SYSCON_CCLKCFG_SHIFT (0) /* 0-7: Divide value for CPU clock (CCLK) */ +#define SYSCON_CCLKCFG_MASK (0xff << SYSCON_CCLKCFG_SHIFT) +# define SYSCON_CCLKCFG_DIV(n) ((n-1) << SYSCON_CCLKCFG_SHIFT) /* n=2,3,..255 */ + /* Bits 8-31: Reserved */ +/* USB Clock Configuration register */ + +#define SYSCON_USBCLKCFG_SHIFT (0) /* Bits 0-3: PLL0 divide value USB clock */ +#define SYSCON_USBCLKCFG_MASK (15 << SYSCON_USBCLKCFG_SHIFT) +# define SYSCON_USBCLKCFG_DIV6 (5 << SYSCON_USBCLKCFG_SHIFT) /* PLL0/6 for PLL0=288 MHz */ +# define SYSCON_USBCLKCFG_DIV8 (7 << SYSCON_USBCLKCFG_SHIFT) /* PLL0/8 for PLL0=384 MHz */ +# define SYSCON_USBCLKCFG_DIV10 (9 << SYSCON_USBCLKCFG_SHIFT) /* PLL0/10 for PLL0=480 MHz */ + /* Bits 8-31: Reserved */ +/* Peripheral Clock Selection registers 0 and 1 */ + +#define SYSCON_PCLKSEL_CCLK4 (0) /* PCLK_peripheral = CCLK/4 */ +#define SYSCON_PCLKSEL_CCLK (1) /* PCLK_peripheral = CCLK */ +#define SYSCON_PCLKSEL_CCLK2 (2) /* PCLK_peripheral = CCLK/2 */ +#define SYSCON_PCLKSEL_CCLK8 (3) /* PCLK_peripheral = CCLK/8 (except CAN1, CAN2, and CAN) */ +#define SYSCON_PCLKSEL_CCLK6 (3) /* PCLK_peripheral = CCLK/6 (CAN1, CAN2, and CAN) */ +#define SYSCON_PCLKSEL_MASK (3) + +#define SYSCON_PCLKSEL0_WDT_SHIFT (0) /* Bits 0-1: Peripheral clock WDT */ +#define SYSCON_PCLKSEL0_WDT_MASK (3 << SYSCON_PCLKSEL0_WDT_SHIFT) +#define SYSCON_PCLKSEL0_TMR0_SHIFT (2) /* Bits 2-3: Peripheral clock TIMER0 */ +#define SYSCON_PCLKSEL0_TMR0_MASK (3 << SYSCON_PCLKSEL0_TMR0_SHIFT) +#define SYSCON_PCLKSEL0_TMR1_SHIFT (4) /* Bits 4-5: Peripheral clock TIMER1 */ +#define SYSCON_PCLKSEL0_TMR1_MASK (3 << SYSCON_PCLKSEL0_TMR1_SHIFT) +#define SYSCON_PCLKSEL0_UART0_SHIFT (6) /* Bits 6-7: Peripheral clock UART0 */ +#define SYSCON_PCLKSEL0_UART0_MASK (3 << SYSCON_PCLKSEL0_UART0_SHIFT) +#define SYSCON_PCLKSEL0_UART1_SHIFT (8) /* Bits 8-9: Peripheral clock UART1 */ +#define SYSCON_PCLKSEL0_UART1_MASK (3 << SYSCON_PCLKSEL0_UART1_SHIFT) + /* Bits 10-11: Reserved */ +#define SYSCON_PCLKSEL0_PWM1_SHIFT (12) /* Bits 12-13: Peripheral clock PWM1 */ +#define SYSCON_PCLKSEL0_PWM1_MASK (3 << SYSCON_PCLKSEL0_PWM1_SHIFT) +#define SYSCON_PCLKSEL0_I2C0_SHIFT (14) /* Bits 14-15: Peripheral clock I2C0 */ +#define SYSCON_PCLKSEL0_I2C0_MASK (3 << SYSCON_PCLKSEL0_I2C0_SHIFT) +#define SYSCON_PCLKSEL0_SPI_SHIFT (16) /* Bits 16-17: Peripheral clock SPI */ +#define SYSCON_PCLKSEL0_SPI_MASK (3 << SYSCON_PCLKSEL0_SPI_SHIFT) + /* Bits 18-19: Reserved */ +#define SYSCON_PCLKSEL0_SSP1_SHIFT (20) /* Bits 20-21: Peripheral clock SSP1 */ +#define SYSCON_PCLKSEL0_SSP1_MASK (3 << SYSCON_PCLKSEL0_SSP1_SHIFT) +#define SYSCON_PCLKSEL0_DAC_SHIFT (22) /* Bits 22-23: Peripheral clock DAC */ +#define SYSCON_PCLKSEL0_DAC_MASK (3 << SYSCON_PCLKSEL0_DAC_SHIFT) +#define SYSCON_PCLKSEL0_ADC_SHIFT (24) /* Bits 24-25: Peripheral clock ADC */ +#define SYSCON_PCLKSEL0_ADC_MASK (3 << SYSCON_PCLKSEL0_ADC_SHIFT) +#define SYSCON_PCLKSEL0_CAN1_SHIFT (26) /* Bits 26-27: Peripheral clock CAN1 */ +#define SYSCON_PCLKSEL0_CAN1_MASK (3 << SYSCON_PCLKSEL0_CAN1_SHIFT) +#define SYSCON_PCLKSEL0_CAN2_SHIFT (28) /* Bits 28-29: Peripheral clock CAN2 */ +#define SYSCON_PCLKSEL0_CAN2_MASK (3 << SYSCON_PCLKSEL0_CAN2_SHIFT) +#define SYSCON_PCLKSEL0_ACF_SHIFT (30) /* Bits 30-31: Peripheral clock CAN AF */ +#define SYSCON_PCLKSEL0_ACF_MASK (3 << SYSCON_PCLKSEL0_ACF_SHIFT) + +#define SYSCON_PCLKSEL1_QEI_SHIFT (0) /* Bits 0-1: Peripheral clock Quadrature Encoder */ +#define SYSCON_PCLKSEL1_QEI_MASK (3 << SYSCON_PCLKSEL1_QEI_SHIFT) +#define SYSCON_PCLKSEL1_GPIOINT_SHIFT (2) /* Bits 2-3: Peripheral clock GPIO interrupts */ +#define SYSCON_PCLKSEL1_GPIOINT_MASK (3 << SYSCON_PCLKSEL1_GPIOINT_SHIFT) +#define SYSCON_PCLKSEL1_PCB_SHIFT (4) /* Bits 4-5: Peripheral clock the Pin Connect block */ +#define SYSCON_PCLKSEL1_PCB_MASK (3 << SYSCON_PCLKSEL1_PCB_SHIFT) +#define SYSCON_PCLKSEL1_I2C1_SHIFT (6) /* Bits 6-7: Peripheral clock I2C1 */ +#define SYSCON_PCLKSEL1_I2C1_MASK (3 << SYSCON_PCLKSEL1_I2C1_SHIFT) + /* Bits 8-9: Reserved */ +#define SYSCON_PCLKSEL1_SSP0_SHIFT (10) /* Bits 10-11: Peripheral clock SSP0 */ +#define SYSCON_PCLKSEL1_SSP0_MASK (3 << SYSCON_PCLKSEL1_SSP0_SHIFT) +#define SYSCON_PCLKSEL1_TMR2_SHIFT (12) /* Bits 12-13: Peripheral clock TIMER2 */ +#define SYSCON_PCLKSEL1_TMR2_MASK (3 << SYSCON_PCLKSEL1_TMR2_SHIFT) +#define SYSCON_PCLKSEL1_TMR3_SHIFT (14) /* Bits 14-15: Peripheral clock TIMER3 */ +#define SYSCON_PCLKSEL1_TMR3_MASK (3 << SYSCON_PCLKSEL1_TMR3_SHIFT) +#define SYSCON_PCLKSEL1_UART2_SHIFT (16) /* Bits 16-17: Peripheral clock UART2 */ +#define SYSCON_PCLKSEL1_UART2_MASK (3 << SYSCON_PCLKSEL1_UART2_SHIFT) +#define SYSCON_PCLKSEL1_UART3_SHIFT (18) /* Bits 18-19: Peripheral clock UART3 */ +#define SYSCON_PCLKSEL1_UART3_MASK (3 << SYSCON_PCLKSEL1_UART3_SHIFT) +#define SYSCON_PCLKSEL1_I2C2_SHIFT (20) /* Bits 20-21: Peripheral clock I2C2 */ +#define SYSCON_PCLKSEL1_I2C2_MASK (3 << SYSCON_PCLKSEL1_I2C2_SHIFT) +#define SYSCON_PCLKSEL1_I2S_SHIFT (22) /* Bits 22-23: Peripheral clock I2S */ +#define SYSCON_PCLKSEL1_I2S_MASK (3 << SYSCON_PCLKSEL1_I2S_SHIFT) + /* Bits 24-25: Reserved */ +#define SYSCON_PCLKSEL1_RIT_SHIFT (26) /* Bits 26-27: Peripheral clock Repetitive Interrupt Timer */ +#define SYSCON_PCLKSEL1_RIT_MASK (3 << SYSCON_PCLKSEL1_RIT_SHIFT) +#define SYSCON_PCLKSEL1_SYSCON_SHIFT (28) /* Bits 28-29: Peripheral clock the System Control block */ +#define SYSCON_PCLKSEL1_SYSCON_MASK (3 << SYSCON_PCLKSEL1_SYSCON_SHIFT) +#define SYSCON_PCLKSEL1_MC_SHIFT (30) /* Bits 30-31: Peripheral clock the Motor Control PWM */ +#define SYSCON_PCLKSEL1_MC_MASK (3 << SYSCON_PCLKSEL1_MC_SHIFT) + +/* Clocking and power control - Peripheral power control registers */ +/* Power Control Register */ + +#define SYSCON_PCON_PM0 (1 << 0) /* Bit 0: Power mode control bit 0 */ +#define SYSCON_PCON_PM1 (1 << 1) /* Bit 1: Power mode control bit 1 */ +#define SYSCON_PCON_BODRPM (1 << 2) /* Bit 2: Brown-Out Reduced Power Mode */ +#define SYSCON_PCON_BOGD (1 << 3) /* Bit 3: Brown-Out Global Disable */ +#define SYSCON_PCON_BORD (1 << 4) /* Bit 4: Brown-Out Reset Disable */ + /* Bits 5-7: Reserved */ +#define SYSCON_PCON_SMFLAG (1 << 8) /* Bit 8: Sleep Mode entry flag */ +#define SYSCON_PCON_DSFLAG (1 << 9) /* Bit 9: Deep Sleep entry flag */ +#define SYSCON_PCON_PDFLAG (1 << 10) /* Bit 10: Power-down entry flag */ +#define SYSCON_PCON_DPDFLAG (1 << 11) /* Bit 11: Deep Power-down entry flag */ + /* Bits 12-31: Reserved */ +/* Power Control for Peripherals Register */ + + /* Bit 0: Reserved */ +#define SYSCON_PCONP_PCTIM0 (1 << 1) /* Bit 1: Timer/Counter 0 power/clock control */ +#define SYSCON_PCONP_PCTIM1 (1 << 2) /* Bit 2: Timer/Counter 1 power/clock control */ +#define SYSCON_PCONP_PCUART0 (1 << 3) /* Bit 3: UART0 power/clock control */ +#define SYSCON_PCONP_PCUART1 (1 << 4) /* Bit 4: UART1 power/clock control */ + /* Bit 5: Reserved */ +#define SYSCON_PCONP_PCPWM1 (1 << 6) /* Bit 6: PWM1 power/clock control */ +#define SYSCON_PCONP_PCI2C0 (1 << 7) /* Bit 7: I2C0 power/clock control */ +#define SYSCON_PCONP_PCSPI (1 << 8) /* Bit 8: SPI power/clock control */ +#define SYSCON_PCONP_PCRTC (1 << 9) /* Bit 9: RTC power/clock control */ +#define SYSCON_PCONP_PCSSP1 (1 << 10) /* Bit 10: SSP 1 power/clock control */ + /* Bit 11: Reserved */ +#define SYSCON_PCONP_PCADC (1 << 12) /* Bit 12: A/D converter (ADC) power/clock control */ +#define SYSCON_PCONP_PCCAN1 (1 << 13) /* Bit 13: CAN Controller 1 power/clock control */ +#define SYSCON_PCONP_PCCAN2 (1 << 14) /* Bit 14: CAN Controller 2 power/clock control */ +#define SYSCON_PCONP_PCGPIO (1 << 15) /* Bit 15: GPIOs power/clock enable */ +#define SYSCON_PCONP_PCRIT (1 << 16) /* Bit 16: Repetitive Interrupt Timer power/clock control */ +#define SYSCON_PCONP_PCMCPWM (1 << 17) /* Bit 17: Motor Control PWM */ +#define SYSCON_PCONP_PCQEI (1 << 18) /* Bit 18: Quadrature Encoder power/clock control */ +#define SYSCON_PCONP_PCI2C1 (1 << 19) /* Bit 19: I2C1 power/clock control */ + /* Bit 20: Reserved */ +#define SYSCON_PCONP_PCSSP0 (1 << 21) /* Bit 21: SSP0 power/clock control */ +#define SYSCON_PCONP_PCTIM2 (1 << 22) /* Bit 22: Timer 2 power/clock control */ +#define SYSCON_PCONP_PCTIM3 (1 << 23) /* Bit 23: Timer 3 power/clock control */ +#define SYSCON_PCONP_PCUART2 (1 << 24) /* Bit 24: UART 2 power/clock control */ +#define SYSCON_PCONP_PCUART3 (1 << 25) /* Bit 25: UART 3 power/clock control */ +#define SYSCON_PCONP_PCI2C2 (1 << 26) /* Bit 26: I2C 2 power/clock control */ +#define SYSCON_PCONP_PCI2S (1 << 27) /* Bit 27: I2S power/clock control */ + /* Bit 28: Reserved */ +#define SYSCON_PCONP_PCGPDMA (1 << 29) /* Bit 29: GPDMA function power/clock control */ +#define SYSCON_PCONP_PCENET (1 << 30) /* Bit 30: Ethernet block power/clock control */ +#define SYSCON_PCONP_PCUSB (1 << 31) /* Bit 31: USB power/clock control */ + +/* More clocking and power control -- Utility */ + +#define SYSCON_CLKOUTCFG_SEL_SHIFT (0) /* Bits 0-3: Selects clock source for CLKOUT */ +#define SYSCON_CLKOUTCFG_SEL_MASK (15 << SYSCON_CLKOUTCFG_SEL_SHIFT) +# define SYSCON_CLKOUTCFG_SEL_CPU (0 << SYSCON_CLKOUTCFG_SEL_SHIFT) /* CLKOUT source=CPU clock */ +# define SYSCON_CLKOUTCFG_SEL_MAIN (1 << SYSCON_CLKOUTCFG_SEL_SHIFT) /* CLKOUT source=main osc */ +# define SYSCON_CLKOUTCFG_SEL_INTRC (2 << SYSCON_CLKOUTCFG_SEL_SHIFT) /* CLKOUT source=internal RC osc */ +# define SYSCON_CLKOUTCFG_SEL_USB (3 << SYSCON_CLKOUTCFG_SEL_SHIFT) /* CLKOUT source=USB clock */ +# define SYSCON_CLKOUTCFG_SEL_RTC (4 << SYSCON_CLKOUTCFG_SEL_SHIFT) /* CLKOUT source=RTC osc */ +#define SYSCON_CLKOUTCFG_DIV_SHIFT (4) /* Bits 4-7: CLKOUT divisor */ +#define SYSCON_CLKOUTCFG_DIV_MASK (15 << SYSCON_CLKOUTCFG_DIV_SHIFT) +# define SYSCON_CLKOUTCFG_DIV(n) ((n-1) << SYSCON_CLKOUTCFG_DIV_SHIFT) /* n=1..16 */ +#define SYSCON_CLKOUTCFG_EN (1 << 8) /* Bit 8: CLKOUT enable control */ +#define SYSCON_CLKOUTCFG_ACT (1 << 9) /* Bit 9: CLKOUT activity indication */ + /* Bits 10-31: Reserved */ +/* System control registers -- External Interrupts */ +/* External Interrupt Flag register */ + +#define SYSCON_EXTINT_EINT0 (1 << 0) /* Bit 0: EINT0 */ +#define SYSCON_EXTINT_EINT1 (1 << 1) /* Bit 1: EINT1 */ +#define SYSCON_EXTINT_EINT2 (1 << 2) /* Bit 2: EINT2 */ +#define SYSCON_EXTINT_EINT3 (1 << 3) /* Bit 3: EINT3 */ + /* Bits 4-31: Reserved */ +/* External Interrupt Mode register */ + +#define SYSCON_EXTMODE_EINT0 (1 << 0) /* Bit 0: 1=EINT0 edge sensitive */ +#define SYSCON_EXTMODE_EINT1 (1 << 1) /* Bit 1: 1=EINT1 edge sensitive */ +#define SYSCON_EXTMODE_EINT2 (1 << 2) /* Bit 2: 1=EINT2 edge sensitive */ +#define SYSCON_EXTMODE_EINT3 (1 << 3) /* Bit 3: 1=EINT3 edge sensitive */ + /* Bits 4-31: Reserved */ +/* External Interrupt Polarity register */ + +#define SYSCON_EXTPOLAR_EINT0 (1 << 0) /* Bit 0: 1=EINT0 high active/rising edge */ +#define SYSCON_EXTPOLAR_EINT1 (1 << 1) /* Bit 1: 1=EINT1 high active/rising edge */ +#define SYSCON_EXTPOLAR_EINT2 (1 << 2) /* Bit 2: 1=EINT2 high active/rising edge */ +#define SYSCON_EXTPOLAR_EINT3 (1 << 3) /* Bit 3: 1=EINT3 high active/rising edge */ + /* Bits 4-31: Reserved */ +/* System control registers -- Reset */ +/* Reset Source Identification Register */ + +#define SYSCON_RSID_POR (1 << 0) /* Bit 0: Power on reset */ +#define SYSCON_RSID_EXTR (1 << 1) /* Bit 1: external RESET signal */ +#define SYSCON_RSID_WDTR (1 << 2) /* Bit 2: Watchdog Timer time out w/WDTRESET */ +#define SYSCON_RSID_BODR (1 << 3) /* Bit 3: Brown out detection */ + /* Bits 4-31: Reserved */ +/* System control registers -- Syscon Miscellaneous Registers */ + + /* Bits 0-3: Reserved */ +#define SYSCON_SCS_OSCRANGE (1 << 4) /* Bit 4: Main oscillator range select */ +#define SYSCON_SCS_OSCEN (1 << 5) /* Bit 5: Main oscillator enable */ +#define SYSCON_SCS_OSCSTAT (1 << 6) /* Bit 6: Main oscillator status */ + /* Bits 7-31: Reserved */ +/* Device Interrupt Registers */ +/* USB Interrupt Status register */ + +#define SYSCON_USBINTST_REQLP (1 << 0) /* Bit 0: Low priority interrupt line status */ +#define SYSCON_USBINTST_REQHP (1 << 1) /* Bit 1: High priority interrupt line status */ +#define SYSCON_USBINTST_REQDMA (1 << 2) /* Bit 2: DMA interrupt line status */ +#define SYSCON_USBINTST_HOSTINT (1 << 3) /* Bit 3: USB host interrupt line status */ +#define SYSCON_USBINTST_ATXINT (1 << 4) /* Bit 4: External ATX interrupt line status */ +#define SYSCON_USBINTST_OTGINT (1 << 5) /* Bit 5: OTG interrupt line status */ +#define SYSCON_USBINTST_I2CINT (1 << 6) /* Bit 6: I2C module interrupt line status */ + /* Bit 7: Reserved */ +#define SYSCON_USBINTST_NEEDCLK (1 << 8) /* Bit 8: USB need clock indicator */ + /* Bits 9-30: Reserved */ +#define SYSCON_USBINTST_ENINTS (1 << 31) /* Bit 31: Enable all USB interrupts */ + +/* DMA Request Select Register */ + +#define SYSCON_DMAREQSEL_INP8 (1 << 0) /* Bit 0: Input 8 0=UART0 TX 1=Timer 0 match 0 */ +#define SYSCON_DMAREQSEL_INP9 (1 << 1) /* Bit 1: Input 8 0=UART0 RX 1=Timer 0 match 1 */ +#define SYSCON_DMAREQSEL_INP10 (1 << 2) /* Bit 2: Input 8 0=UART1 TX 1=Timer 1 match 0 */ +#define SYSCON_DMAREQSEL_INP11 (1 << 3) /* Bit 3: Input 8 0=UART1 RX 1=Timer 1 match 1 */ +#define SYSCON_DMAREQSEL_INP12 (1 << 4) /* Bit 4: Input 8 0=UART2 TX 1=Timer 2 match 0 */ +#define SYSCON_DMAREQSEL_INP13 (1 << 5) /* Bit 5: Input 8 0=UART2 RX 1=Timer 2 match 1 */ +#define SYSCON_DMAREQSEL_INP14 (1 << 6) /* Bit 6: Input 8 0=UART3 TX 1=Timer 3 match 0 */ +#define SYSCON_DMAREQSEL_INP15 (1 << 7) /* Bit 7: Input 8 0=UART3 RX 1=Timer 3 match 1 */ + /* Bits 8-31: Reserved */ + +/************************************************************************************ + * Public Types + ************************************************************************************/ + +/************************************************************************************ + * Public Data + ************************************************************************************/ + +/************************************************************************************ + * Public Functions + ************************************************************************************/ + +#endif /* __ARCH_ARM_SRC_LPC17XX_CHIP_LPC176X_SYSCON_H */ diff --git a/nuttx/arch/arm/src/lpc17xx/chip/lpc178x_memorymap.h b/nuttx/arch/arm/src/lpc17xx/chip/lpc178x_memorymap.h index 21e8e6c339..295e1a0eed 100644 --- a/nuttx/arch/arm/src/lpc17xx/chip/lpc178x_memorymap.h +++ b/nuttx/arch/arm/src/lpc17xx/chip/lpc178x_memorymap.h @@ -48,6 +48,96 @@ /************************************************************************************ * Pre-processor Definitions ************************************************************************************/ +/* Memory Map ***********************************************************************/ + +#define LPC17_FLASH_BASE 0x00000000 /* -0x1fffffff: On-chip non-volatile memory */ +#define LPC17_SRAM_BASE 0x10000000 /* -0x10007fff: On-chip SRAM (devices <=32Kb) */ +#define LPC17_ROM_BASE 0x1fff0000 /* -0x1fffffff: 8Kb Boot ROM with flash services */ +#define LPC17_AHBSRAM_BASE 0x20000000 /* -0x3fffffff: On-chip Peripheral SRAM (devices >32Kb) */ +# define LPC17_SRAM_BANK0 0x20000000 /* -0x20003fff: On-chip Peripheral SRAM Bank0 (devices >=32Kb) */ +# define LPC17_SRAM_BANK1 0x20004000 /* -0x20007fff: On-chip Peripheral SRAM Bank1 (devices 64Kb) */ +#define LPC17_AHB_BASE 0x20080000 /* -0x2008ffff: DMA Controller, Ethernet, and USB */ +#define LPC17_SPIFI_BASE 0x28000000 +#define LPC17_APB_BASE 0x40000000 /* -0x5fffffff: APB Peripherals */ +# define LPC17_APB0_BASE 0x40000000 /* -0x4007ffff: APB0 Peripherals */ +# define LPC17_APB1_BASE 0x40080000 /* -0x400fffff: APB1 Peripherals */ + +/* Off chip Memory via External Memory Interface */ + +#define LPC17_EXTRAM_BASE 0x80000000 /* */ +# define LPC17_EXTSRAM_CS0 0x80000000 /* Chip select 0 /up to 64MB/ */ +# define LPC17_EXTSRAM_CS1 0x90000000 /* Chip select 1 /up to 64MB/ */ +# define LPC17_EXTSRAM_CS2 0x98000000 /* Chip select 2 /up to 64MB/ */ +# define LPC17_EXTSRAM_CS3 0x9c000000 /* Chip select 3 /up to 64MB/ */ + +# define LPC17_EXTDRAM_CS0 0x9c000000 /* Chip select 0 /up to 256MB/ */ +# define LPC17_EXTDRAM_CS1 0x9c000000 /* Chip select 1 /up to 256MB/ */ +# define LPC17_EXTDRAM_CS2 0x9c000000 /* Chip select 2 /up to 256MB/ */ +# define LPC17_EXTDRAM_CS3 0x9c000000 /* Chip select 3 /up to 256MB/ */ + +#define LPC17_CORTEXM3_BASE 0xe0000000 /* -0xe00fffff: (see armv7-m/nvic.h) */ +#define LPC17_SCS_BASE 0xe000e000 +#define LPC17_DEBUGMCU_BASE 0xe0042000 + +/* AHB SRAM Bank sizes **************************************************************/ + +#define LPC17_BANK0_SIZE (16*1024) /* Size of AHB SRAM Bank0 (if present) */ +#define LPC17_BANK1_SIZE (16*1024) /* Size of AHB SRAM Bank1 (if present) */ + +/* APB0 Peripherals *****************************************************************/ + +#define LPC17_WDT_BASE 0x40000000 /* -0x40003fff: Watchdog timer */ +#define LPC17_TMR0_BASE 0x40004000 /* -0x40007fff: Timer 0 */ +#define LPC17_TMR1_BASE 0x40008000 /* -0x4000bfff: Timer 1 */ +#define LPC17_UART0_BASE 0x4000c000 /* -0x4000ffff: UART 0 */ +#define LPC17_UART1_BASE 0x40010000 /* -0x40013fff: UART 1 */ +#define LPC17_PWM0_BASE 0x40014000 /* -0x40017fff: PWM 0 */ +#define LPC17_PWM1_BASE 0x40018000 /* -0x4001bfff: PWM 1 */ +#define LPC17_I2C0_BASE 0x4001c000 /* -0x4001ffff: I2C 0 */ + /* -0x40023fff: Reserved */ +#define LPC17_RTC_BASE 0x40024000 /* -0x40027fff: RTC + backup registers */ +#define LPC17_GPIOINT_BASE 0x40028000 /* -0x4002bfff: GPIO interrupts */ +#define LPC17_PINCONN_BASE 0x4002c000 /* -0x4002ffff: Pin connect block */ +#define LPC17_SSP1_BASE 0x40030000 /* -0x40033fff: SSP 1 */ +#define LPC17_ADC_BASE 0x40034000 /* -0x40037fff: ADC */ +#define LPC17_CANAFRAM_BASE 0x40038000 /* -0x4003bfff: CAN acceptance filter (AF) RAM */ +#define LPC17_CANAF_BASE 0x4003c000 /* -0x4003ffff: CAN acceptance filter (AF) registers */ +#define LPC17_CAN_BASE 0x40040000 /* -0x40043fff: CAN common registers */ +#define LPC17_CAN1_BASE 0x40044000 /* -0x40047fff: CAN controller l */ +#define LPC17_CAN2_BASE 0x40048000 /* -0x4004bfff: CAN controller 2 */ + /* -0x4005bfff: Reserved */ +#define LPC17_I2C1_BASE 0x4005c000 /* -0x4005ffff: I2C 1 */ + /* -0x4007ffff: Reserved */ + +/* APB1 Peripherals *****************************************************************/ + + /* -0x40087fff: Reserved */ +#define LPC17_SSP0_BASE 0x40088000 /* -0x4008bfff: SSP 0 */ +#define LPC17_DAC_BASE 0x4008c000 /* -0x4008ffff: DAC */ +#define LPC17_TMR2_BASE 0x40090000 /* -0x40093fff: Timer 2 */ +#define LPC17_TMR3_BASE 0x40094000 /* -0x40097fff: Timer 3 */ +#define LPC17_UART2_BASE 0x40098000 /* -0x4009bfff: UART 2 */ +#define LPC17_UART3_BASE 0x4009c000 /* -0x4009ffff: UART 3 */ +#define LPC17_I2C2_BASE 0x400a0000 /* -0x400a3fff: I2C 2 */ + /* -0x400a7fff: Reserved */ +#define LPC17_I2S_BASE 0x400a8000 /* -0x400abfff: I2S */ +#define LPC17_SSP2_BASE 0x400ac000 /* -0x400affff: SSP2 */ + /* -0x400b3fff: Reserved */ + /* -0x400b7fff: Reserved */ +#define LPC17_MCPWM_BASE 0x400b8000 /* -0x400bbfff: Motor control PWM */ +#define LPC17_QEI_BASE 0x400bc000 /* -0x400bffff: Quadrature encoder interface */ +#define LPC17_MCI_BASE 0x400c0000 /* -0x400fbfff: SD interface */ +#define LPC17_SYSCON_BASE 0x400fc000 /* -0x400fffff: System control */ + +/* AHB Peripherals ******************************************************************/ + +#define LPC17_GPDMA_BASE 0x20080000 /* GPDMA controller */ +#define LPC17_ETH_BASE 0x20084000 /* Ethernet controller */ +#define LPC17_LCD_BASE 0x20088000 /* LCD controller */ +#define LPC17_USB_BASE 0x2008c000 /* USB controller */ +#define LPC17_CRC_BASE 0x20090000 /* CRC engine */ +#define LPC17_GPIO_BASE 0x20098000 /* GPIO */ +#define LPC17_EMC_BASE 0x2009c000 /* External Memory Controller */ /************************************************************************************ * Public Types diff --git a/nuttx/arch/arm/src/lpc17xx/chip/lpc178x_pinconfig.h b/nuttx/arch/arm/src/lpc17xx/chip/lpc178x_pinconfig.h index 53c2b26a9f..37a16c1e03 100644 --- a/nuttx/arch/arm/src/lpc17xx/chip/lpc178x_pinconfig.h +++ b/nuttx/arch/arm/src/lpc17xx/chip/lpc178x_pinconfig.h @@ -48,7 +48,7 @@ ************************************************************************************/ /* GPIO pin definitions *************************************************************/ /* NOTE that functions have a alternate pins that can be selected. These alternates - * are identified with a numerica suffix like _1, _2, or _3. Your board.h file + * are identified with a numerical suffix like _1, _2, or _3. Your board.h file * should select the correct alternative for your board by including definitions * such as: * @@ -57,6 +57,593 @@ * (without the suffix) */ +#define GPIO_CAN1_RD_1 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN0) +#define GPIO_UART3_TXD_1 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN0) +#define GPIO_I2C1_SDA_1 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN0) +#define GPIO_UART0_TXD_1 (GPIO_ALT4 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN0) + +#define GPIO_CAN1_TD_1 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN1) +#define GPIO_UART3_RXD_1 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN1) +#define GPIO_I2C1_SCL_1 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN1) +#define GPIO_UART0_RXD_1 (GPIO_ALT4 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN1) + +#define GPIO_UART0_TXD (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN2) +#define GPIO_UART3_TXD (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN2) + +#define GPIO_UART0_RXD (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN3) +#define GPIO_UART3_RXD (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN3) + +#define GPIO_I2S_RXCLK_1 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN4) +#define GPIO_CAN2_RD (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN4) +#define GPIO_CAP2p0 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN4) +#define GPIO_LCD_VD0_1 (GPIO_ALT4 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN4) + +#define GPIO_I2S_RXWS_1 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN5) +#define GPIO_CAN2_TD (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN5) +#define GPIO_CAP2p1 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN5) +#define GPIO_LCD_VD1_1 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN5) + +#define GPIO_I2S_RXSDA_1 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN6) +#define GPIO_SSP1_SSEL (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN6) +#define GPIO_MAT2p0_1 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN6) +#define GPIO_UART1_RTS_1 (GPIO_ALT4 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN6) +#define GPIO_LCD_VD8 (GPIO_ALT5 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN6) + +#define GPIO_I2S_TXCLK_1 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN7) +#define GPIO_SSP1_SCK_1 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN7) +#define GPIO_MAT2p1_1 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN7) +#define GPIO_RTC_EV0_1 (GPIO_ALT4 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN7) +#define GPIO_LCD_VD9 (GPIO_ALT5 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN7) + +#define GPIO_I2S_TXWS_1 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN8) +#define GPIO_SSP1_MISO (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN8) +#define GPIO_MAT2p2 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN8) +#define GPIO_RTC_EV1_1 (GPIO_ALT4 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN8) +#define GPIO_LCD_VD16 (GPIO_ALT5 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN8) + +#define GPIO_I2S_TXSDA_1 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN9) +#define GPIO_SSP1_MOSI (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN9) +#define GPIO_MAT2p3 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN9) +#define GPIO_RTC_EV2_1 (GPIO_ALT4 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN9) +#define GPIO_LCD_VD17 (GPIO_ALT5 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN9) + +#define GPIO_UART2_TXD_1 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN10) +#define GPIO_I2C2_SDA (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN10) +#define GPIO_MAT3p0 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN10) + +#define GPIO_UART2_RXD_1 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN11) +#define GPIO_I2C2_SCL (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN11) +#define GPIO_MAT3p1 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN11) + +#define GPIO_USB_PPWR2 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN12) +#define GPIO_SSP1_MISO (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN12) +#define GPIO_AD0p6 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN12) + +#define GPIO_USB_LED2 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN13) +#define GPIO_SSP1_MOSI (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN13) +#define GPIO_AD0p7 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN13) + +#define GPIO_USB_HSTEN2 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN14) +#define GPIO_SSP1_SSEL (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN14) +#define GPIO_USB_CONNECT2 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN14) + +#define GPIO_UART1_TXD_1 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN15) +#define GPIO_SSP0_SCK_1 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN15) +#define GPIO_SPIFI_IO2 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN15) + +#define GPIO_UART1_RXD_1 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN16) +#define GPIO_SSP0_SSEL_1 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN16) +#define GPIO_SPIFI_IO3 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN16) + +#define GPIO_UART1_CTS_1 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN17) +#define GPIO_SSP0_MISO_1 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN17) +#define GPIO_SPIFI_IO1 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN17) + +#define GPIO_UART1_DCD_1 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN18) +#define GPIO_SSP0_MOSI_1 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN18) +#define GPIO_SPIFI_IO0 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN18) + +#define GPIO_UART1_DSR_1 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN19) +#define GPIO_SD_CLK (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN19) +#define GPIO_I2C1_SDA_2 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN19) + +#define GPIO_UART1_DTR_1 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN20) +#define GPIO_SD_CMD (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN20) +#define GPIO_I2C1_SCL_2 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN20) + +#define GPIO_UART1_RI_1 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN21) +#define GPIO_SD_PWR (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN21) +#define GPIO_UART4_OE (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN21) +#define GPIO_CAN1_RD_2 (GPIO_ALT4 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN21) +#define GPIO_UART4_SCLK (GPIO_ALT5 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN21) + +#define GPIO_UART1_RTS_1 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN22) +#define GPIO_SD_DAT0 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN22) +#define GPIO_UART4_TXD (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN22) +#define GPIO_CAN1_TD_2 (GPIO_ALT4 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN22) +#define GPIO_SPIFI_SCLK (GPIO_ALT5 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN22) + +#define GPIO_AD0p0 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN23) +#define GPIO_I2S_RXCLK_2 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN23) +#define GPIO_CAP3p0 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN23) + +#define GPIO_AD0p1 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN24) +#define GPIO_I2S_RXWS_2 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN24) +#define GPIO_CAP3p1 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN24) + +#define GPIO_AD0p2 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN25) +#define GPIO_I2S_RXSDA_2 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN25) +#define GPIO_UART3_TXD_2 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN25) + +#define GPIO_AD0p3 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN26) +#define GPIO_AOUT (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN26) +#define GPIO_UART3_RXD_2 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN26) + +#define GPIO_I2C0_SDA (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN27) +#define GPIO_USB_SDA (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN27) + +#define GPIO_I2C0_SCL (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN28) +#define GPIO_USB_SCL (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN28) + +#define GPIO_USB1DP (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN29) +#define GPIO_EINT0 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN29) + +#define GPIO_USB1DM (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN30) +#define GPIO_EINT1 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN30) + +#define GPIO_USB2_DP (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN31) + +#define GPIO_ENET_TXD0 (GPIO_ALT1 | GPIO_FLOAT | GPIO_PORT1 | GPIO_PIN0) +#define GPIO_CAP3p1 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN0) +#define GPIO_SSP2_SCK (GPIO_ALT4 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN0) + +#define GPIO_ENET_TXD1 (GPIO_ALT1 | GPIO_FLOAT | GPIO_PORT1 | GPIO_PIN1) +#define GPIO_MAT3p3 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN1) +#define GPIO_SSP2_MOSI (GPIO_ALT4 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN1) + +#define GPIO_ENET_TXD2 (GPIO_ALT1 | GPIO_FLOAT | GPIO_PORT1 | GPIO_PIN2) +#define GPIO_SD_CLK (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN2) +#define GPIO_PWM0p1 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN2) + +#define GPIO_ENET_TXD3 (GPIO_ALT1 | GPIO_FLOAT | GPIO_PORT1 | GPIO_PIN3) +#define GPIO_SD_CMD (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN3) +#define GPIO_PWM0p2 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN3) + +#define GPIO_ENET_TXEN (GPIO_ALT1 | GPIO_FLOAT | GPIO_PORT1 | GPIO_PIN4) +#define GPIO_MAT3p2 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN4) +#define GPIO_SSP2_MISO (GPIO_ALT4 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN4) + +#define GPIO_ENET_TX_ER (GPIO_ALT1 | GPIO_FLOAT | GPIO_PORT1 | GPIO_PIN5) +#define GPIO_SD_PWR (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN5) +#define GPIO_PWM0p3 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN5) + +#define GPIO_ENET_TX_CLK (GPIO_ALT1 | GPIO_FLOAT | GPIO_PORT1 | GPIO_PIN6) +#define GPIO_SD_DAT0 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN6) +#define GPIO_PWM0p4 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN6) + +#define GPIO_ENET_COL (GPIO_ALT1 | GPIO_FLOAT | GPIO_PORT1 | GPIO_PIN7) +#define GPIO_SD_DAT1 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN7) +#define GPIO_PWM0p5 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN7) + +#define GPIO_ENET_CRSDV (GPIO_ALT1 | GPIO_FLOAT | GPIO_PORT1 | GPIO_PIN8) +#define GPIO_MAT3p1 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN8) +#define GPIO_SSP2_SSEL (GPIO_ALT4 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN8) + +#define GPIO_ENET_RXD0 (GPIO_ALT1 | GPIO_FLOAT | GPIO_PORT1 | GPIO_PIN9) +#define GPIO_MAT3p0 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN9) + +#define GPIO_ENET_RXD1 (GPIO_ALT1 | GPIO_FLOAT | GPIO_PORT1 | GPIO_PIN10) +#define GPIO_CAP3p0 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN10) + +#define GPIO_ENET_RXD2 (GPIO_ALT1 | GPIO_FLOAT | GPIO_PORT1 | GPIO_PIN11) +#define GPIO_SD_DAT2 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN11) +#define GPIO_PWM0p6 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN11) + +#define GPIO_ENET_RXD3 (GPIO_ALT1 | GPIO_FLOAT | GPIO_PORT1 | GPIO_PIN12) +#define GPIO_SD_DAT3 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN12) +#define GPIO_PWM0CAPp0 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN12) + +#define GPIO_ENET_RX_DV (GPIO_ALT1 | GPIO_FLOAT | GPIO_PORT1 | GPIO_PIN13) + +#define GPIO_ENET_RXER (GPIO_ALT1 | GPIO_FLOAT | GPIO_PORT1 | GPIO_PIN14) +#define GPIO_CAP2p0 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN14) + +#define GPIO_ENET_REFCLK (GPIO_ALT1 | GPIO_FLOAT | GPIO_PORT1 | GPIO_PIN15) +#define GPIO_I2C2_SDA (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN15) + +#define GPIO_ENET_MDC_1 (GPIO_ALT1 | GPIO_FLOAT | GPIO_PORT1 | GPIO_PIN16) +#define GPIO_I2S_TXMCLK (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN16) + +#define GPIO_ENET_MDIO_1 (GPIO_ALT1 | GPIO_FLOAT | GPIO_PORT1 | GPIO_PIN17) +#define GPIO_I2S_RXMCLK (GPIO_ALT2 | GPIO_FLOAT | GPIO_PORT1 | GPIO_PIN17) + +#define GPIO_USB_UPLED (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN18) +#define GPIO_PWM1p1_1 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN18) +#define GPIO_CAP1p0 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN18) +#define GPIO_SSP1_MISO (GPIO_ALT5 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN18) + +#define GPIO_USB1_TXE (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN19) +#define GPIO_USB1_PPWR (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN19) +#define GPIO_CAP1p1 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN19) +#define GPIO_MCPWM_MC0A (GPIO_ALT4 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN19) +#define GPIO_SSP1_SCK (GPIO_ALT5 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN19) +#define GPIO_UART2_OE (GPIO_ALT6 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN19) + +#define GPIO_USB1_TXDP (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN20) +#define GPIO_PWM1p2_1 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN20) +#define GPIO_QEI_PHA (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN20) +#define GPIO_MCPWM_MCFB0 (GPIO_ALT4 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN20) +#define GPIO_SSP0_SCK (GPIO_ALT5 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN20) +#define GPIO_LCD_VD6 (GPIO_ALT6 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN20) +#define GPIO_LCD_VD10 (GPIO_ALT7 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN20) + +#define GPIO_USB1_TXDM (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN21) +#define GPIO_PWM1p3_1 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN21) +#define GPIO_SSP0_SSEL_2 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN21) +#define GPIO_MCPWM_ABORT (GPIO_ALT4 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN21) +#define GPIO_LCD_VD7 (GPIO_ALT6 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN21) +#define GPIO_LCD_VD11 (GPIO_ALT7 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN21) + +#define GPIO_USB1_RCV (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN22) +#define GPIO_USB1_PWRD (GPIO_ALT2 | GPIO_PULLDN | GPIO_PORT1 | GPIO_PIN22) +#define GPIO_MAT1p0 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN22) +#define GPIO_MCPWM_MCOB (GPIO_ALT4 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN22) +#define GPIO_SSP1_MOSI (GPIO_ALT5 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN22) +#define GPIO_LCD_VD8 (GPIO_ALT6 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN22) +#define GPIO_LCD_VD12 (GPIO_ALT7 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN22) + +#define GPIO_USB1_RXDP (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN23) +#define GPIO_PWM1p4 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN23) +#define GPIO_QEI_PHB (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN23) +#define GPIO_MCPWM_MCFB1 (GPIO_ALT4 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN23) +#define GPPIO_SSP0_MOSI (GPIO_ALT5 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN23) +#define GPIO_LCD_VD9 (GPIO_ALT6 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN23) +#define GPIO_LCD_VD13 (GPIO_ALT7 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN23) + +#define GPIO_USB1_RXDM (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN24) +#define GPIO_PWM1p5_1 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN24) +#define GPIO_QEI_IDX (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN24) +#define GPIO_MCPWM_MCFB2 (GPIO_ALT4 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN24) +#define GPIO_SSP0_MOSI_2 (GPIO_ALT5 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN24) +#define GPIO_LCD_VD10_VD14 (GPIO_ALT6 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN24) +#define GPIO_LCD_VD10_VD14 (GPIO_ALT7 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN24) + +#define GPIO_USB1_LS (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN25) +#define GPIO_USB1_HSTEN (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN25) +#define GPIO_MAT1p1 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN25) +#define GPIO_MCPWM_MC1A (GPIO_ALT4 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN25) +#define GPIO_CLKOUT_ (GPIO_ALT5 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN25) +#define GPIO_LCD_VD11 (GPIO_ALT6 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN25) +#define GPIO_LCD_VD15 (GPIO_ALT7 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN25) + +#define GPIO_USB1_SSPND (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN26) +#define GPIO_PWM1p6_1 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN26) +#define GPIO_CAP0p0 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN26) +#define GPIO_MCPWM_MC1B (GPIO_ALT4 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN26) +#define GPIO_SSP1_SSEL (GPIO_ALT5 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN26) +#define GPIO_LCD_VD12 (GPIO_ALT6 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN26) +#define GPIO_LCD_VD20 (GPIO_ALT7 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN26) + +#define GPIO_USB1_INT (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN27) +#define GPIO_USB1_OVRCR (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN27) +#define GPIO_CAP0p1 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN27) +#define GPIO_CLKOUT_2 (GPIO_ALT4 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN27) +#define GPIO_LCD_VD13 (GPIO_ALT6 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN27) +#define GPIO_LCD_VD21 (GPIO_ALT7 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN27) + +#define GPIO_USB1_SCL (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN28) +#define GPIO_PCAP1p0_1 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN28) +#define GPIO_MAT0p0_1 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN28) +#define GPIO_MCPWM_MC2A (GPIO_ALT4 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN28) +#define GPIO_SSP0_SSEL (GPIO_ALT5 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN28) +#define GPIO_LCD_VD14 (GPIO_ALT6 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN28) +#define GPIO_LCD_VD22 (GPIO_ALT7 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN28) + +#define GPIO_USB1_SDA (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN29) +#define GPIO_PCAP1p1 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN29) +#define GPIO_MAT0p1_1 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN29) +#define GPIO_MCPWM_MC2B (GPIO_ALT4 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN29) +#define GPIO_UART4_TXD (GPIO_ALT5 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN29) +#define GPIO_LCD_VD15 (GPIO_ALT6 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN29) +#define GPIO_LCD_VD23 (GPIO_ALT7 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN29) + +#define GPIO_USB2_PWRD (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN30) +#define GPIO_USB_VBUS (GPIO_ALT2 | GPIO_FLOAT | GPIO_PORT1 | GPIO_PIN30) +#define GPIO_AD0p4 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN30) +#define GPIO_I2C0_SDA (GPIO_ALT4 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN30) +#define GPIO_UART3_OE (GPIO_ALT5 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN30) + +#define GPIO_USB2_OVRCR (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN31) +#define GPIO_SSP1_SCK_2 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN31) +#define GPIO_AD0p5 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN31) +#define GPIO_I2C0_SCL (GPIO_ALT4 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN31) + +#define GPIO_PWM1p1_2 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN0) +#define GPIO_UART1_TXD_2 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN0) +#define GPIO_LCD_PWR (GPIO_ALT7 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN0) + +#define GPIO_PWM1p2_2 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN1) +#define GPIO_UART1_RXD_2 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN1) +#define GPIO_LCD_LE (GPIO_ALT7 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN1) + +#define GPIO_PWM1p3_2 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN2) +#define GPIO_UART1_CTS_2 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN2) +#define GPIO_MAT2p3 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN2) +#define GPIO_TRACEDATA3 (GPIO_ALT5 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN2) +#define GPIO_LCD_DCLK (GPIO_ALT7 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN2) + +#define GPIO_PWM1p4_2 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN3) +#define GPIO_UART1_DCD_2 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN3) +#define GPIO_MAT2p2 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN3) +#define GPIO_TRACEDATA2 (GPIO_ALT5 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN3) +#define GPIO_LCD_FP (GPIO_ALT7 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN3) + +#define GPIO_PWM1p5_2 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN4) +#define GPIO_UART1_DSR_2 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN4) +#define GPIO_MAT2p1 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN4) +#define GPIO_TRACEDATA1 (GPIO_ALT5 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN4) +#define GPIO_LCD_ENABM (GPIO_ALT7 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN4) + +#define GPIO_PWM1p6_2 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN5) +#define GPIO_UART1_DTR_2 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN5) +#define GPIO_MAT2p0 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN5) +#define GPIO_TRACEDATA0 (GPIO_ALT5 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN5) +#define GPIO_LCD_LP (GPIO_ALT7 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN5) + +#define GPIO_PCAP1p0_2 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN6) +#define GPIO_UART1_RI_2 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN6) +#define GPIO_CAP2p0 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN6) +#define GPIO_UART2_OE (GPIO_ALT4 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN6) +#define GPIO_TRACECLK (GPIO_ALT5 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN6) +#define GPIO_LCD_VD0_2 (GPIO_ALT6 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN6) +#define GPIO_LCD_VD4 (GPIO_ALT7 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN6) + +#define GPIO_CAN2_RD_2 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN7) +#define GPIO_UART1_RTS_2 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN7) +#define GPIO_SPIFI_CS (GPIO_ALT5 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN7) +#define GPIO_LCD_VD1_2 (GPIO_ALT6 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN7) +#define GPIO_LCD_VD5 (GPIO_ALT7 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN7) + +#define GPIO_CAN2_TD_2 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN8) +#define GPIO_UART2_TXD_2 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN8) +#define GPIO_UART1_CTS (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN8) +#define GPIO_ENET_MDC_2 (GPIO_ALT4 | GPIO_FLOAT | GPIO_PORT2 | GPIO_PIN8) +#define GPIO_LCD_VD2 (GPIO_ALT6 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN8) +#define GPIO_LCD_VD6 (GPIO_ALT7 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN8) + +#define GPIO_USB1_CONNECT (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN9) +#define GPIO_UART2_RXD_2 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN9) +#define GPIO_UART4_RXD_2 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN9) +#define GPIO_ENET_MDIO_2 (GPIO_ALT4 | GPIO_FLOAT | GPIO_PORT2 | GPIO_PIN9) +#define GPIO_LCD_VD3 (GPIO_ALT6 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN9) +#define GPIO_LCD_VD7 (GPIO_ALT7 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN9) + +#define GPIO_EINT0 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN10) +#define GPIO_NMI (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN10) + +#define GPIO_EINT1 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN11) +#define GPIO_SD_DAT1 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN11) +#define GPIO_I2S_TXCLK_2 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN11) +#define GPIO_LCD_CLKIN (GPIO_ALT7 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN11) + +#define GPIO_EINT2 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN12) +#define GPIO_SD_DAT2 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN12) +#define GPIO_I2S_TXWS_2 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN12) +#define GPIO_LCD_VD4 (GPIO_ALT4 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN12) +#define GPIO_LCD_VD3 (GPIO_ALT5 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN12) +#define GPIO_LCD_VD8 (GPIO_ALT6 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN12) +#define GPIO_LCD_VD18 (GPIO_ALT7 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN12) + +#define GPIO_EINT3 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN13) +#define GPIO_SD_DAT3 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN13) +#define GPIO_I2S_TXSDA_2 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN13) +#define GPIO_LCD_VD5 (GPIO_ALT5 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN13) +#define GPIO_LCD_VD9 (GPIO_ALT6 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN13) +#define GPIO_LCD_VD19 (GPIO_ALT7 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN13) + +#define GPIO_EMC_CS2 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN14) +#define GPIO_I2C1_SDA (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN14) +#define GPIO_CAP2p0 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN14) + +#define GPIO_EMC_CS3 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN15) +#define GPIO_I2C1_SCL (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN15) +#define GPIO_CAP2p1 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN15) + +#define GPIO_EMC_CAS (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN16) +#define GPIO_EMC_RAS (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN17) +#define GPIO_EMC_CLK0 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN18) + +#define GPIO_EMC_CLK1 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN19) +#define GPIO_EMC_DYCS0 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN20) +#define GPIO_EMC_DYCS1 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN21) + +#define GPIO_EMC_DYCS2 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN22) +#define GPIO_SSP0_SCK (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN22) +#define GPIO_CAP3p0 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN22) + +#define GPIO_EMC_DYCS3 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN23) +#define GPIO_SSP0_SSEL (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN23) +#define GPIO_CAP3p1 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN23) + +#define GPIO_EMC_CKE0 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN24) +#define GPIO_EMC_CKE1 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN25) + +#define GPIO_EMC_CKE2 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN26) +#define GPIO_SSP0_MISO (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN26) +#define GPIO_MAT3p0 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN26) + +#define GPIO_EMC_CKE3 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN27) +#define GPIO_SSP0_MOSI (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN27) +#define GPIO_MAT3p1 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN27) + +#define GPIO_EMC_DQM0 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN28) +#define GPIO_EMC_DQM1 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN29) + +#define GPIO_EMC_DQM2 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN30) +#define GPIO_I2C2_SDA (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN30) +#define GPIO_MAT3p2 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN30) + +#define GPIO_EMC_DQM3 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN30) +#define GPIO_I2C2_SCL (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN30) +#define GPIO_MAT3p3 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN30) + +#define GPIO_EMC_D0 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT3 | GPIO_PIN0) +#define GPIO_EMC_D1 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT3 | GPIO_PIN1) +#define GPIO_EMC_D2 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT3 | GPIO_PIN2) +#define GPIO_EMC_D3 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT3 | GPIO_PIN3) +#define GPIO_EMC_D4 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT3 | GPIO_PIN4) +#define GPIO_EMC_D5 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT3 | GPIO_PIN5) +#define GPIO_EMC_D6 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT3 | GPIO_PIN6) +#define GPIO_EMC_D7 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT3 | GPIO_PIN7) +#define GPIO_EMC_D8 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT3 | GPIO_PIN8) +#define GPIO_EMC_D9 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT3 | GPIO_PIN9) +#define GPIO_EMC_D10 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT3 | GPIO_PIN10) +#define GPIO_EMC_D11 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT3 | GPIO_PIN11) +#define GPIO_EMC_12 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT3 | GPIO_PIN12) +#define GPIO_EMC_D13 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT3 | GPIO_PIN13) +#define GPIO_EMC_D14 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT3 | GPIO_PIN14) +#define GPIO_EMC_D15 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT3 | GPIO_PIN15) + +#define GPIO_EMC_D16 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT3 | GPIO_PIN16) +#define GPIO_PWM0p1 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT3 | GPIO_PIN16) +#define GPIO_UART1_TXD (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT3 | GPIO_PIN16) + +#define GPIO_EMC_D17 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT3 | GPIO_PIN17) +#define GPIO_PWM0p2 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT3 | GPIO_PIN17) +#define GPIO_UART1_RXD (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT3 | GPIO_PIN17) + +#define GPIO_EMC_D18 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT3 | GPIO_PIN18) +#define GPIO_PWM0p3 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT3 | GPIO_PIN18) +#define GPIO_UART1_CTS (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT3 | GPIO_PIN18) + +#define GPIO_EMC_D19 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT3 | GPIO_PIN19) +#define GPIO_PWM0p4 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT3 | GPIO_PIN19) +#define GPIO_UART1_DCD (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT3 | GPIO_PIN19) + +#define GPIO_EMC_D20 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT3 | GPIO_PIN20) +#define GPIO_PWM0p5 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT3 | GPIO_PIN20) +#define GPIO_UART1_DSR (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT3 | GPIO_PIN20) + +#define GPIO_EMC_D21 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT3 | GPIO_PIN21) +#define GPIO_PWM0p6 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT3 | GPIO_PIN21) +#define GPIO_UART1_DTR (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT3 | GPIO_PIN21) + +#define GPIO_EMC_D22 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT3 | GPIO_PIN22) +#define GPIO_PWM0CAPp0 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT3 | GPIO_PIN22) +#define GPIO_UART1_RI (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT3 | GPIO_PIN22) + +#define GPIO_EMC_D23 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT3 | GPIO_PIN23) +#define GPIO_PWM1CAPp0 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT3 | GPIO_PIN23) +#define GPIO_CAP0p0 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT3 | GPIO_PIN23) + +#define GPIO_EMC_D24 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT3 | GPIO_PIN24) +#define GPIO_PWM1p1 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT3 | GPIO_PIN24) +#define GPIO_CAP0p1 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT3 | GPIO_PIN24) + +#define GPIO_EMC_D25 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT3 | GPIO_PIN25) +#define GPIO_PWM1p2 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT3 | GPIO_PIN25) +#define GPIO_MAT0p0 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT3 | GPIO_PIN25) + +#define GPIO_EMC_D26 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT3 | GPIO_PIN26) +#define GPIO_PWM1p3 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT3 | GPIO_PIN26) +#define GPIO_MAT0p1 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT3 | GPIO_PIN26) +#define GPIO_STCLK (GPIO_ALT4 | GPIO_PULLUP | GPIO_PORT3 | GPIO_PIN26) + +#define GPIO_EMC_D27 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT3 | GPIO_PIN27) +#define GPIO_PWM1p4 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT3 | GPIO_PIN27) +#define GPIO_CAP1p0 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT3 | GPIO_PIN27) + +#define GPIO_EMC_D28 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT3 | GPIO_PIN28) +#define GPIO_PWM1p5 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT3 | GPIO_PIN28) +#define GPIO_CAP1p1 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT3 | GPIO_PIN28) + +#define GPIO_EMC_D29 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT3 | GPIO_PIN29) +#define GPIO_PWM1p6 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT3 | GPIO_PIN29) +#define GPIO_MAT1p0 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT3 | GPIO_PIN29) + +#define GPIO_EMC_D30 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT3 | GPIO_PIN30) +#define GPIO_UART1_RTS (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT3 | GPIO_PIN30) +#define GPIO_MAT1p1 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT3 | GPIO_PIN30) + +#define GPIO_EMC_D31 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT3 | GPIO_PIN31) +#define GPIO_MAT1p2 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT3 | GPIO_PIN31) + +#define GPIO_EMC_A0 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT4 | GPIO_PIN0) +#define GPIO_EMC_A1 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT4 | GPIO_PIN1) +#define GPIO_EMC_A2 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT4 | GPIO_PIN2) +#define GPIO_EMC_A3 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT4 | GPIO_PIN3) +#define GPIO_EMC_A4 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT4 | GPIO_PIN4) +#define GPIO_EMC_A5 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT4 | GPIO_PIN5) +#define GPIO_EMC_A6 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT4 | GPIO_PIN6) +#define GPIO_EMC_A7 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT4 | GPIO_PIN7) +#define GPIO_EMC_A8 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT4 | GPIO_PIN8) +#define GPIO_EMC_A9 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT4 | GPIO_PIN9) +#define GPIO_EMC_A10 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT4 | GPIO_PIN10) +#define GPIO_EMC_A11 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT4 | GPIO_PIN11) +#define GPIO_EMC_A12 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT4 | GPIO_PIN12) +#define GPIO_EMC_A13 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT4 | GPIO_PIN13) +#define GPIO_EMC_A14 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT4 | GPIO_PIN14) +#define GPIO_EMC_A15 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT4 | GPIO_PIN15) +#define GPIO_EMC_A16 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT4 | GPIO_PIN16) +#define GPIO_EMC_A17 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT4 | GPIO_PIN17) +#define GPIO_EMC_A18 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT4 | GPIO_PIN18) +#define GPIO_EMC_A19 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT4 | GPIO_PIN19) + +#define GPIO_EMC_A20 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT4 | GPIO_PIN20) +#define GPIO_I2C2_SDA (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT4 | GPIO_PIN20) +#define GPIO_SSP1_SCK (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT4 | GPIO_PIN20) + +#define GPIO_EMC_A21 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT4 | GPIO_PIN21) +#define GPIO_I2C2_SCL (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT4 | GPIO_PIN21) +#define GPIO_SSP1_SSEL (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT4 | GPIO_PIN21) + +#define GPIO_EMC_A22 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT4 | GPIO_PIN22) +#define GPIO_UART2_TXD (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT4 | GPIO_PIN22) +#define GPIO_SSP1_MISO (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT4 | GPIO_PIN22) + +#define GPIO_EMC_A23 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT4 | GPIO_PIN23) +#define GPIO_UART2_RXD (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT4 | GPIO_PIN23) +#define GPIO_SSP1_MOSI (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT4 | GPIO_PIN23) + +#define GPIO_EMC_OE (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT4 | GPIO_PIN24) +#define GPIO_EMC_WE (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT4 | GPIO_PIN25) +#define GPIO_EMC_BLS0 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT4 | GPIO_PIN26) +#define GPIO_EMC_BLS1 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT4 | GPIO_PIN27) + +#define GPIO_EMC_BLS2 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT4 | GPIO_PIN28) +#define GPIO_UART3_TXD (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT4 | GPIO_PIN28) +#define GPIO_MAT2p0 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT4 | GPIO_PIN28) +#define GPIO_LCD_VD6 (GPIO_ALT5 | GPIO_PULLUP | GPIO_PORT4 | GPIO_PIN28) +#define GPIO_LCD_VD10 (GPIO_ALT6 | GPIO_PULLUP | GPIO_PORT4 | GPIO_PIN28) +#define GPIO_LCD_VD2 (GPIO_ALT7 | GPIO_PULLUP | GPIO_PORT4 | GPIO_PIN28) + +#define GPIO_EMC_BLS3 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT4 | GPIO_PIN29) +#define GPIO_UART3_RXD (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT4 | GPIO_PIN29) +#define GPIO_MAT2p1 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT4 | GPIO_PIN29) +#define GPIO_I2C2_SCL (GPIO_ALT4 | GPIO_PULLUP | GPIO_PORT4 | GPIO_PIN29) +#define GPIO_LCD_VD7 (GPIO_ALT5 | GPIO_PULLUP | GPIO_PORT4 | GPIO_PIN29) +#define GPIO_LCD_VD11 (GPIO_ALT6 | GPIO_PULLUP | GPIO_PORT4 | GPIO_PIN29) +#define GPIO_LCD_VD2 (GPIO_ALT7 | GPIO_PULLUP | GPIO_PORT4 | GPIO_PIN29) + +#define GPIO_EMC_CS0 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT4 | GPIO_PIN30) +#define GPIO_EMC_CS1 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT4 | GPIO_PIN31) + +#define GPIO_EMC_A24 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT5 | GPIO_PIN0) +#define GPIO_MAT2p2 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT5 | GPIO_PIN0) + +#define GPIO_EMC_A25 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT5 | GPIO_PIN1) +#define GPIO_MAT2p3 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT5 | GPIO_PIN1) + +#define GPIO_MAT3p2 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT5 | GPIO_PIN2) +#define GPIO_I2C0_SDA (GPIO_ALT5 | GPIO_PULLUP | GPIO_PORT5 | GPIO_PIN2) + +#define GPIO_UART4_RXD (GPIO_ALT4 | GPIO_PULLUP | GPIO_PORT5 | GPIO_PIN3) +#define GPIO_I2C0_SCL0 (GPIO_ALT5 | GPIO_PULLUP | GPIO_PORT5 | GPIO_PIN3) + +#define GPIO_UART4_OE (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT5 | GPIO_PIN4) +#define GPIO_MAT3p3 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT5 | GPIO_PIN4) +#define GPIO_UART4_TXD (GPIO_ALT4 | GPIO_PULLUP | GPIO_PORT5 | GPIO_PIN4) + /************************************************************************************ * Public Types ************************************************************************************/ diff --git a/nuttx/arch/arm/src/lpc17xx/chip/lpc178x_syscon.h b/nuttx/arch/arm/src/lpc17xx/chip/lpc178x_syscon.h new file mode 100644 index 0000000000..5aafce7a65 --- /dev/null +++ b/nuttx/arch/arm/src/lpc17xx/chip/lpc178x_syscon.h @@ -0,0 +1,598 @@ +/**************************************************************************************************** + * arch/arm/src/lpc17xx/chip/lpc178x_syscon.h + * + * Copyright (C) 2013 Gregory Nutt. All rights reserved. + * Authors: Rommel Marcelo + * Gregory Nutt + * + * 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. + * + ****************************************************************************************************/ + +#ifndef __ARCH_ARM_SRC_LPC17XX_CHIP_LPC178X_SYSCON_H +#define __ARCH_ARM_SRC_LPC17XX_CHIP_LPC178X_SYSCON_H + +/**************************************************************************************************** + * Included Files + ****************************************************************************************************/ + +#include + +#include "chip.h" +#include "chip/lpc17_memorymap.h" + +/**************************************************************************************************** + * Pre-processor Definitions + ****************************************************************************************************/ + +/* Register offsets *********************************************************************************/ +/* Flash accelerator module */ + +#define LPC17_SYSCON_FLASHCFG_OFFSET 0x0000 /* Flash Accelerator Configuration Register */ + +/* Memory Mapping Control register (MEMMAP - 0x400F C040) */ + +#define LPC17_SYSCON_MEMMAP_OFFSET 0x0040 /* Memory Mapping Control register */ + +/* Clocking and power control - Phase locked loops */ + +#define LPC17_SYSCON_PLL0CON_OFFSET 0x0080 /* PLL0 Control Register */ +#define LPC17_SYSCON_PLL0CFG_OFFSET 0x0084 /* PLL0 Configuration Register */ +#define LPC17_SYSCON_PLL0STAT_OFFSET 0x0088 /* PLL0 Status Register */ +#define LPC17_SYSCON_PLL0FEED_OFFSET 0x008c /* PLL0 Feed Register */ + +#define LPC17_SYSCON_PLL1CON_OFFSET 0x00a0 /* PLL1 Control Register */ +#define LPC17_SYSCON_PLL1CFG_OFFSET 0x00a4 /* PLL1 Configuration Register */ +#define LPC17_SYSCON_PLL1STAT_OFFSET 0x00a8 /* PLL1 Status Register */ +#define LPC17_SYSCON_PLL1FEED_OFFSET 0x00ac /* PLL1 Feed Register */ + +/* Clocking and power control - Peripheral power control registers */ + +#define LPC17_SYSCON_PCON_OFFSET 0x00c0 /* Power Control Register */ +#define LPC17_SYSCON_PCONP_OFFSET 0x00c4 /* Power Control for Peripherals Register */ + +/* Clocking and power control -- Clock dividers */ + +#define LPC17_SYSCON_EMCCLKCFG_OFFSET 0x0100 /* EMC Clock Configuration Register */ +#define LPC17_SYSCON_CCLKCFG_OFFSET 0x0104 /* CPU Clock Configuration Register */ +#define LPC17_SYSCON_USBCLKCFG_OFFSET 0x0108 /* USB Clock Configuration Register */ + +/* 0x400f c110 - 0x400f c114: CAN Wake and Sleep Registers */ + +/* Clocking and power control -- Clock source selection */ + +#define LPC17_SYSCON_CLKSRCSEL_OFFSET 0x010c /* Clock Source Select Register */ +#define LPC17_SYSCON_CANSLEEPCLR_OFFSET 0x0110 /* CAN Channel Sleep State Register */ +#define LPC17_SYSCON_CANWAKEFLAGS_OFFSET 0x0114 /* CAN Channel Wake-Up State Register */ + +/* System control registers -- External Interrupts */ + +#define LPC17_SYSCON_EXTINT_OFFSET 0x0140 /* External Interrupt Flag Register */ +#define LPC17_SYSCON_EXTMODE_OFFSET 0x0148 /* External Interrupt Mode register */ +#define LPC17_SYSCON_EXTPOLAR_OFFSET 0x014c /* External Interrupt Polarity Register */ + +/* System control registers -- Reset */ + +#define LPC17_SYSCON_RSID_OFFSET 0x0180 /* Reset Source Identification Register */ + +/* System control registers -- Syscon Miscellaneous Registers */ + +#define LPC17_SYSCON_MATRIXARB_OFFSET 0x0188 /* Matrix Arbitration Register */ +#define LPC17_SYSCON_SCS_OFFSET 0x01a0 /* System Control and Status */ +#define LPC17_SYSCON_PCLKSEL_OFFSET 0x01a8 /* Peripheral Clock Selection Register */ +#define LPC17_SYSCON_PBOOST_OFFSET 0x01b0 /* Power Boost Register */ +#define LPC17_SYSCON_SPIFICLKSEL_OFFSET 0x01b4 /* SPIFI Clock Selection Register */ +#define LPC17_SYSCON_LCDCFG_OFFSET 0x01b8 /* LCD Clock Configuration Register */ + +/* Device Interrupt Registers (Might be a error in the User Manual, might be at 0x5000c1c0) */ + +#define LPC17_SYSCON_USBINTST_OFFSET 0x01c0 /* USB Interrupt Status */ + +/* DMA Request Select Register */ + +#define LPC17_SYSCON_DMAREQSEL_OFFSET 0x01c4 /* Selects between UART and timer DMA requests */ + +/* More clocking and power control -- Utility */ + +#define LPC17_SYSCON_CLKOUTCFG_OFFSET 0x01c8 /* Clock Output Configuration Register */ + +/* Peripheral Reset Control */ + +#define LPC17_SYSCON_RSTCON0_OFFSET 0x01cc /* Individual Peripheral Reset Control Bits */ +#define LPC17_SYSCON_RSTCON1_OFFSET 0x01d0 /* Individual Peripheral Reset Control Bits */ + +/* EMC Clock Control and Calibration */ + +#define LPC17_SYSCON_EMCDLYCTL_OFFSET 0x01dc /* Programmable Delays for SDRAM Operation */ +#define LPC17_SYSCON_EMCCAL_OFFSET 0x01e0 /* Calibration Counter for EMCDLYCTL */ + + +/* Register addresses *******************************************************************************/ +/* Flash accelerator module */ + +#define LPC17_SYSCON_FLASHCFG (LPC17_SYSCON_BASE+LPC17_SYSCON_FLASHCFG_OFFSET) + +/* Memory Mapping Control register (MEMMAP - 0x400F C040) */ + +#define LPC17_SYSCON_MEMMAP (LPC17_SYSCON_BASE+LPC17_SYSCON_MEMMAP_OFFSET) + +/* Clocking and power control - Phase locked loops */ + +#define LPC17_SYSCON_PLL0CON (LPC17_SYSCON_BASE+LPC17_SYSCON_PLL0CON_OFFSET) +#define LPC17_SYSCON_PLL0CFG (LPC17_SYSCON_BASE+LPC17_SYSCON_PLL0CFG_OFFSET) +#define LPC17_SYSCON_PLL0STAT (LPC17_SYSCON_BASE+LPC17_SYSCON_PLL0STAT_OFFSET) +#define LPC17_SYSCON_PLL0FEED (LPC17_SYSCON_BASE+LPC17_SYSCON_PLL0FEED_OFFSET) + +#define LPC17_SYSCON_PLL1CON (LPC17_SYSCON_BASE+LPC17_SYSCON_PLL1CON_OFFSET) +#define LPC17_SYSCON_PLL1CFG (LPC17_SYSCON_BASE+LPC17_SYSCON_PLL1CFG_OFFSET) +#define LPC17_SYSCON_PLL1STAT (LPC17_SYSCON_BASE+LPC17_SYSCON_PLL1STAT_OFFSET) +#define LPC17_SYSCON_PLL1FEED (LPC17_SYSCON_BASE+LPC17_SYSCON_PLL1FEED_OFFSET) + +/* Clocking and power control - Peripheral power control registers */ + +#define LPC17_SYSCON_PCON (LPC17_SYSCON_BASE+LPC17_SYSCON_PCON_OFFSET) +#define LPC17_SYSCON_PCONP (LPC17_SYSCON_BASE+LPC17_SYSCON_PCONP_OFFSET) + +/* Clocking and power control -- Clock dividers */ + +#define LPC17_SYSCON_EMCCLKCFG (LPC17_SYSCON_BASE+LPC17_SYSCON_EMCCLKCFG_OFFSET) +#define LPC17_SYSCON_CCLKCFG (LPC17_SYSCON_BASE+LPC17_SYSCON_CCLKCFG_OFFSET) +#define LPC17_SYSCON_USBCLKCFG (LPC17_SYSCON_BASE+LPC17_SYSCON_USBCLKCFG_OFFSET) + +/* 0x400f c110 - 0x400f c114: CAN Wake and Sleep Registers */ + +/* Clocking and power control -- Clock source selection */ + +#define LPC17_SYSCON_CLKSRCSEL (LPC17_SYSCON_BASE+LPC17_SYSCON_CLKSRCSEL_OFFSET) +#define LPC17_SYSCON_CANSLEEPCLR (LPC17_SYSCON_BASE+LPC17_SYSCON_CANSLEEPCLR_OFFSET) +#define LPC17_SYSCON_CANWAKEFLAGS (LPC17_SYSCON_BASE+LPC17_SYSCON_CANWAKEFLAGS_OFFSET) + +/* System control registers -- External Interrupts */ + +#define LPC17_SYSCON_EXTINT (LPC17_SYSCON_BASE+LPC17_SYSCON_EXTINT_OFFSET) + +#define LPC17_SYSCON_EXTMODE (LPC17_SYSCON_BASE+LPC17_SYSCON_EXTMODE_OFFSET) +#define LPC17_SYSCON_EXTPOLAR (LPC17_SYSCON_BASE+LPC17_SYSCON_EXTPOLAR_OFFSET) + +/* System control registers -- Reset */ + +#define LPC17_SYSCON_RSID (LPC17_SYSCON_BASE+LPC17_SYSCON_RSID_OFFSET) + +/* System control registers -- Syscon Miscellaneous Registers */ + +#define LPC17_SYSCON_MATRIXARB (LPC17_SYSCON_BASE+LPC17_SYSCON_MATRIXARB_OFFSET) +#define LPC17_SYSCON_SCS (LPC17_SYSCON_BASE+LPC17_SYSCON_SCS_OFFSET) +#define LPC17_SYSCON_PCLKSEL (LPC17_SYSCON_BASE+LPC17_SYSCON_PCLKSEL_OFFSET) +#define LPC17_SYSCON_PBOOST (LPC17_SYSCON_BASE+LPC17_SYSCON_PBOOST_OFFSET) +#define LPC17_SYSCON_SPIFICLKSEL (LPC17_SYSCON_BASE+LPC17_SYSCON_SPIFICLKSEL_OFFSET) +#define LPC17_SYSCON_LCDCFG (LPC17_SYSCON_BASE+LPC17_SYSCON_LCDCFG_OFFSET) + +/* Device Interrupt Registers (Might be a error in the User Manual, might be at 0x5000c1c0) */ + +#define LPC17_SYSCON_USBINTST (LPC17_SYSCON_BASE+LPC17_SYSCON_USBINTST_OFFSET) + +/* DMA Request Select Register */ + +#define LPC17_SYSCON_DMAREQSEL (LPC17_SYSCON_BASE+LPC17_SYSCON_DMAREQSEL_OFFSET) + +/* More clocking and power control -- Utility */ + +#define LPC17_SYSCON_CLKOUTCFG (LPC17_SYSCON_BASE+LPC17_SYSCON_CLKOUTCFG_OFFSET) + + +/* Peripheral Reset Control */ + +#define LPC17_SYSCON_RSTCON0 (LPC17_SYSCON_BASE+LPC17_SYSCON_RSTCON0_OFFSET) +#define LPC17_SYSCON_RSTCON1 (LPC17_SYSCON_BASE+LPC17_SYSCON_RSTCON1_OFFSET) + +/* EMC Clock Control and Calibration */ + +#define LPC17_SYSCON_EMCDLYCTL (LPC17_SYSCON_BASE+LPC17_SYSCON_EMCDLYCTL_OFFSET) +#define LPC17_SYSCON_EMCCAL (LPC17_SYSCON_BASE+LPC17_SYSCON_EMCCAL_OFFSET) + +/* Register bit definitions *************************************************************************/ +/* Flash accelerator module */ + /* Bits 0-11: Reserved */ +#define SYSCON_FLASHCFG_TIM_SHIFT (12) /* Bits 12-15: FLASHTIM Flash access time */ +#define SYSCON_FLASHCFG_TIM_MASK (15 << SYSCON_FLASHCFG_TIM_SHIFT) +# define SYSCON_FLASHCFG_TIM_1 (0 << SYSCON_FLASHCFG_TIM_SHIFT) /* 1 CPU clock <= 20 MHz CPU clock */ +# define SYSCON_FLASHCFG_TIM_2 (1 << SYSCON_FLASHCFG_TIM_SHIFT) /* 2 CPU clock <= 40 MHz CPU clock */ +# define SYSCON_FLASHCFG_TIM_3 (2 << SYSCON_FLASHCFG_TIM_SHIFT) /* 3 CPU clock <= 60 MHz CPU clock */ +# define SYSCON_FLASHCFG_TIM_4 (3 << SYSCON_FLASHCFG_TIM_SHIFT) /* 4 CPU clock <= 80 MHz CPU clock */ +# define SYSCON_FLASHCFG_TIM_5 (4 << SYSCON_FLASHCFG_TIM_SHIFT) /* 5 CPU clock <= 100 MHz CPU clock + * (Up to 120 Mhz for LPC1788x) */ +# define SYSCON_FLASHCFG_TIM_6 (5 << SYSCON_FLASHCFG_TIM_SHIFT) /* "safe" setting for any conditions */ + /* Bits 16-31: Reserved */ +/* Memory Mapping Control register (MEMMAP - 0x400F C040) */ + +#define SYSCON_MEMMAP_MAP (1 << 0) /* Bit 0: + * 0:Boot mode. A portion of the Boot ROM is mapped to address 0. + * 1:User mode. The on-chip Flash memory is mapped to address 0 */ + /* Bits 1-31: Reserved */ +/* Clocking and power control -- Clock source selection */ + +#define SYSCON_CLKSRCSEL_SHIFT (0) /* Bits 0: Clock selection */ +#define SYSCON_CLKSRCSEL_MASK (1 << SYSCON_CLKSRCSEL_SHIFT) +# define SYSCON_CLKSRCSEL_INTRC (0 << SYSCON_CLKSRCSEL_SHIFT) /* PLL0 source = internal RC oscillator */ +# define SYSCON_CLKSRCSEL_MAIN (1 << SYSCON_CLKSRCSEL_SHIFT) /* PLL0 source = main oscillator */ + /* Bits 1-31: Reserved */ +/* Clocking and power control - Phase locked loops */ +/* PLL0/1 Control register */ + +#define SYSCON_PLLCON_PLLE (1 << 0) /* Bit 0: PLL Enable */ + /* Bits 1-31: Reserved */ +/* PLL0/1 Configuration register */ + +#define SYSCON_PLLCFG_MSEL_SHIFT (0) /* Bit 0-4: PLL Multiplier value */ +#define SYSCON_PLLCFG_MSEL_MASK (0x1f << SYSCON_PLL0CFG_MSEL_SHIFT) +#define SYSCON_PLLCFG_PSEL_SHIFT (5) /* Bit 5-6: PLL Pre-Divider value */ +#define SYSCON_PLLCFG_PSEL_MASK (3 << SYSCON_PLL0CFG_PSEL_SHIFT) + +/* PLL0/1 Status register */ + +#define SYSCON_PLLSTAT_MSEL_SHIFT (0) /* Bit 0-4: PLLMultiplier value readback */ +#define SYSCON_PLLSTAT_MSEL_MASK (0x1f << SYSCON_PLLSTAT_MSEL_SHIFT) +#define SYSCON_PLLSTAT_PSEL_SHIFT (5) /* Bit 5-6: PLL Pre-Divider value readback */ +#define SYSCON_PLLSTAT_PSEL_MASK (3 << SYSCON_PLLSTAT_PSEL_SHIFT) + /* Bit 7: Reserved */ +#define SYSCON_PLLSTAT_PLLE (1 << 8) /* Bit 8: PLL enable readback */ +#define SYSCON_PLLSTAT_PLLC (1 << 9) /* Bit 9: PLL connect readback */ +#define SYSCON_PLLSTAT_PLOCK (1 << 10) /* Bit 10: PLL lock status */ + /* Bits 11-31: Reserved */ +/* PLL0/1 Feed register */ + +#define SYSCON_PLLFEED_SHIFT (0) /* Bit 0-7: PLL0/1 feed sequence */ +#define SYSCON_PLLFEED_MASK (0xff << SYSCON_PLLFEED_SHIFT) + /* Bits 8-31: Reserved */ +/* Clocking and power control -- Clock dividers */ + +/* EMC Clock Selection Register */ + +#define SYSCON_EMCDIV (1 << 0) /* Bit 0: EMC Clock rate relative to CPU */ + /* 0: EMC uses same clock as CPU */ + /* 1: EMC uses half the rate of CPU */ + /* Bits 1-31: Reserved +/* CPU Clock Configuration register */ + +#define SYSCON_CCLKCFG_CCLKDIV_SHIFT (0) /* 0-4: Divide value for CPU clock (CCLK) */ +#define SYSCON_CCLKCFG_CCLKDIV_MASK (0x1f << SYSCON_CCLKCFG_CCLKDIV_SHIFT) +# define SYSCON_CCLKCFG_CCLKDIV(n) ((n-1) << SYSCON_CCLKCFG_CCLKDIV_SHIFT) /* n = 2 - 31 */ + /* Bits 5-7: Reserved */ +#define SYSCON_CCLKCFG_CCLKSEL (1 << 8) /* Bit 8: Select input clock to CPU clock divider */ + /* 0: Sysclk used as input to CCLKDIV */ + /* 1: Main PLL used as input to CCLKDIV */ + /* Bits 9-31: Reserved */ +/* USB Clock Configuration register */ + +#define SYSCON_USBCLKCFG_USBDIV_SHIFT (0) /* Bits 0-4: PLL0/1 divide value USB clock */ +#define SYSCON_USBCLKCFG_USBDIV_MASK (0x1f << SYSCON_USBCLKCFG_USBDIV_SHIFT) +# define SYSCON_USBCLKCFG_USBDIV_DIV1 (1 << SYSCON_USBCLKCFG_USBDIV_SHIFT) /* PLL0/1 output must be 48MHz */ +# define SYSCON_USBCLKCFG_USBDIV_DIV2 (2 << SYSCON_USBCLKCFG_USBDIV_SHIFT) /* PLL0/1 output must be 96MHz */ +# define SYSCON_USBCLKCFG_USBDIV_DIV3 (3 << SYSCON_USBCLKCFG_USBDIV_SHIFT) /* PLL0/1 output must be 144MHz */ + /* Bits 5-7: Reserved */ +#define SYSCON_USBCLKCFG_USBSEL_SHIFT (8) /* Bits 8-9: Input clock to USBDIV */ +#define SYSCON_USBCLKCFG_USBSEL_MASK (3 << SYSCON_USBCLKCFG_USBSEL_SHIFT) +#define SYSCON_USBCLKCFG_USBSEL_MAINPLL (1 << SYSCON_USBCLKCFG_USBSEL_SHIFT) /* 01: PLL0 is used as input clock to USBDIV */ +#define SYSCON_USBCLKCFG_USBSEL_ALTPLL (2 << SYSCON_USBCLKCFG_USBSEL_SHIFT) /* 10: PLL1 is used as input clock to USBDIV */ + /* 11: unused */ + /* Bits 10-31: Reserved */ +/* CAN0/1 Sleep Clear Register */ + /* Bit 0: Reserved */ +#define SYSCON_CANSLEEPCLR_SHIFT (1) /* Bits 1-2: CAN0/1 Sleep Status and Control */ +#define SYSCON_CANSLEEPCLR_MASK (3 << SYSCON_CANSLEEPCLR_SHIFT) /* */ +#define SYSCON_CANSLEEPCLR_CAN1 (1 << SYSCON_CANSLEEPCLR_SHIFT) /* CAN1 Sleep Status */ +#define SYSCON_CANSLEEPCLR_CAN2 (2 << SYSCON_CANSLEEPCLR_SHIFT) /* CAN2 Sleep Status */ + /* Read 1: CAN channel in sleep mode */ + /* Write 1: CAN channel clocks restored */ + /* Bits 3-31: Reserved */ +/* CAN0/1 WakeUp Flags Register */ + /* Bit 0: Reserved */ +#define SYSCON_CANWAKEFLAGS_SHIFT (1) /* Bits 1-2: CAN0/1 WakeUp Status */ +#define SYSCON_CANWAKEFLAGS_MASK (3 << SYSCON_CANWAKEFLAGS_SHIFT) /* */ +#define SYSCON_CANWAKEFLAGS_CAN1 (1 << SYSCON_CANWAKEFLAGS_SHIFT) /* CAN1 WakeUp Status */ +#define SYSCON_CANWAKEFLAGS_CAN2 (2 << SYSCON_CANWAKEFLAGS_SHIFT) /* CAN2 WakeUp Status */ + /* Read 1: CAN channel falling edge occur on receive line */ + /* Write 1: CAN channel clears wakeup flag bit */ + /* Bits 3-31: Reserved */ +/* Peripheral Clock Selection register */ +/* PCLK is common to all peripheral */ + +#define SYSCON_PCLKSEL_PCLKDIV_SHIFT (0) /* Bits 0-4: Clock divide value for all APB peripherals */ +#define SYSCON_PCLKSEL_PCLKDIV_MASK (0x1f << SYSCON_PCLKSEL_PCLKDIV_SHIFT) +# define SYSCON_PCLKSEL_PCLKDIV(n) ((n-1) << SYSCON_PCLKSEL_PCLKDIV_SHIFT) /* n = 2 - 31 */ + /* Bits 5-31: Reserved */ +/* Power Boost Control Register */ + +#define SYSCON_PBOOST_BOOST_SHIFT (0) /* Bits 0-1: Boost control bits */ +#define SYSCON_PBOOST_BOOST_MASK (3 << SYSCON_PBOOST_BOOST_SHIFT) +#define SYSCON_PBOOST_BOOST_OFF (0) /* Boost OFF, operation must be below 100MHz */ +#define SYSCON_PBOOST_BOOST_ON (3) /* Boost ON, operation upto 120MHz allowed */ + /* Bits 2-31: Reserved */ +/* SPIFI Clock Selection Register */ + +#define SYSCON_SPIFICLKSEL_SPIFIDIV_SHIFT (0) /* Bits 0-4: divide value for SPIFI clock */ +#define SYSCON_SPIFICLKSEL_SPIFIDIV_MASK (0x1f << SYSCON_SPIFICLKSEL_SPIFIDIV_SHIFT) +# define SYSCON_SPIFICLKSEL_SPIFIDIV(n) ((n-1) << SYSCON_SPIFICLKSEL_SPIFIDIV_SHIFT) /* n = 2 - 31 */ + /* Bits 5-7: Reserved */ +#define SYSCON_SPIFICLKSEL_SPIFISEL_SHIFT (8) /* Bits 8-9: Selects input clock for SPIFI clock divider */ +#define SYSCON_SPIFICLKSEL_SPIFISEL_MASK (3 << SYSCON_SPIFICLKSEL_SPIFISEL_SHIFT) +#define SYSCON_SPIFICLKSEL_SPIFISEL_SYSCLK (0) /* Sysclk used as input to SPIFIDIV */ +#define SYSCON_SPIFICLKSEL_SPIFISEL_PLL0 (1 << SYSCON_SPIFICLKSEL_SPIFISEL_SHIFT) /* Main PLL used as input to SPIFIDIV */ +#define SYSCON_SPIFICLKSEL_SPIFISEL_PLL1 (2 << SYSCON_SPIFICLKSEL_SPIFISEL_SHIFT) /* Alt PLL used as input to SPIFIDIV */ + /* Bits 10-31: Reserved */ +/* LCD Configuration Register */ + +#define SYSCON_LCDCFG_CLKDIV_SHIFT (0) /* Bits 0-4: LCD Panel clock prescaler */ +#define SYSCON_LCDCFG_CLKDIV_MASK (0x1f << SYSCON_LCDCFG_CLKDIV_SHIFT) +#define SYSCON_LCDCFG_CLKDIV(n) ((n+1) << SYSCON_LCDCFG_CLKDIV_SHIFT) /* n = 0 - 31 */ + /* Bits 5-31: Reserved */ +/* Clocking and power control - Peripheral power control registers */ +/* Power Control Register */ + +#define SYSCON_PCON_PM0 (1 << 0) /* Bit 0: Power mode control bit 0 */ +#define SYSCON_PCON_PM1 (1 << 1) /* Bit 1: Power mode control bit 1 */ +#define SYSCON_PCON_BODRPM (1 << 2) /* Bit 2: Brown-Out Reduced Power Mode */ +#define SYSCON_PCON_BOGD (1 << 3) /* Bit 3: Brown-Out Global Disable */ +#define SYSCON_PCON_BORD (1 << 4) /* Bit 4: Brown-Out Reset Disable */ + /* Bits 5-7: Reserved */ +#define SYSCON_PCON_SMFLAG (1 << 8) /* Bit 8: Sleep Mode entry flag */ +#define SYSCON_PCON_DSFLAG (1 << 9) /* Bit 9: Deep Sleep entry flag */ +#define SYSCON_PCON_PDFLAG (1 << 10) /* Bit 10: Power-down entry flag */ +#define SYSCON_PCON_DPDFLAG (1 << 11) /* Bit 11: Deep Power-down entry flag */ + /* Bits 12-31: Reserved */ +/* Power Control for Peripherals Register */ + +#define SYSCON_PCONP_PCLCD (1 << 0) /* Bit 0: LCD power/clock control */ +#define SYSCON_PCONP_PCTIM0 (1 << 1) /* Bit 1: Timer/Counter 0 power/clock control */ +#define SYSCON_PCONP_PCTIM1 (1 << 2) /* Bit 2: Timer/Counter 1 power/clock control */ +#define SYSCON_PCONP_PCUART0 (1 << 3) /* Bit 3: UART0 power/clock control */ +#define SYSCON_PCONP_PCUART1 (1 << 4) /* Bit 4: UART1 power/clock control */ +#define SYSCON_PCONP_PCPWM0 (1 << 5) /* Bit 5: PWM0 power/clock control */ +#define SYSCON_PCONP_PCPWM1 (1 << 6) /* Bit 6: PWM1 power/clock control */ +#define SYSCON_PCONP_PCI2C0 (1 << 7) /* Bit 7: I2C0 power/clock control */ +#define SYSCON_PCONP_PCSPI (1 << 8) /* Bit 8: SPI power/clock control */ +#define SYSCON_PCONP_PCRTC (1 << 9) /* Bit 9: RTC power/clock control */ +#define SYSCON_PCONP_PCSSP1 (1 << 10) /* Bit 10: SSP 1 power/clock control */ +#define SYSCON_PCONP_PCEMC (1 << 11) /* Bit 11: External Memory */ +#define SYSCON_PCONP_PCADC (1 << 12) /* Bit 12: A/D converter (ADC) power/clock control */ +#define SYSCON_PCONP_PCCAN1 (1 << 13) /* Bit 13: CAN Controller 1 power/clock control */ +#define SYSCON_PCONP_PCCAN2 (1 << 14) /* Bit 14: CAN Controller 2 power/clock control */ +#define SYSCON_PCONP_PCGPIO (1 << 15) /* Bit 15: GPIOs power/clock enable */ +#define SYSCON_PCONP_PCRIT (1 << 16) /* Bit 16: Repetitive Interrupt Timer power/clock control */ +#define SYSCON_PCONP_PCMCPWM (1 << 17) /* Bit 17: Motor Control PWM */ +#define SYSCON_PCONP_PCQEI (1 << 18) /* Bit 18: Quadrature Encoder power/clock control */ +#define SYSCON_PCONP_PCI2C1 (1 << 19) /* Bit 19: I2C1 power/clock control */ +#define SYSCON_PCONP_PCSSP0 (1 << 20) /* Bit 20: SSP2 power/clock control */ +#define SYSCON_PCONP_PCSSP0 (1 << 21) /* Bit 21: SSP0 power/clock control */ +#define SYSCON_PCONP_PCTIM2 (1 << 22) /* Bit 22: Timer 2 power/clock control */ +#define SYSCON_PCONP_PCTIM3 (1 << 23) /* Bit 23: Timer 3 power/clock control */ +#define SYSCON_PCONP_PCUART2 (1 << 24) /* Bit 24: UART 2 power/clock control */ +#define SYSCON_PCONP_PCUART3 (1 << 25) /* Bit 25: UART 3 power/clock control */ +#define SYSCON_PCONP_PCI2C2 (1 << 26) /* Bit 26: I2C 2 power/clock control */ +#define SYSCON_PCONP_PCI2S (1 << 27) /* Bit 27: I2S power/clock control */ +#define SYSCON_PCONP_PCSDC (1 << 28) /* Bit 28: SD Card power/clock control */ +#define SYSCON_PCONP_PCGPDMA (1 << 29) /* Bit 29: GPDMA function power/clock control */ +#define SYSCON_PCONP_PCENET (1 << 30) /* Bit 30: Ethernet block power/clock control */ +#define SYSCON_PCONP_PCUSB (1 << 31) /* Bit 31: USB power/clock control */ + +/* More clocking and power control -- Utility */ + +#define SYSCON_CLKOUTCFG_SEL_SHIFT (0) /* Bits 0-3: Selects clock source for CLKOUT */ +#define SYSCON_CLKOUTCFG_SEL_MASK (15 << SYSCON_CLKOUTCFG_SEL_SHIFT) +# define SYSCON_CLKOUTCFG_SEL_CPU (0 << SYSCON_CLKOUTCFG_SEL_SHIFT) /* CLKOUT source=CPU clock */ +# define SYSCON_CLKOUTCFG_SEL_MAIN (1 << SYSCON_CLKOUTCFG_SEL_SHIFT) /* CLKOUT source=main osc */ +# define SYSCON_CLKOUTCFG_SEL_INTRC (2 << SYSCON_CLKOUTCFG_SEL_SHIFT) /* CLKOUT source=internal RC osc */ +# define SYSCON_CLKOUTCFG_SEL_USB (3 << SYSCON_CLKOUTCFG_SEL_SHIFT) /* CLKOUT source=USB clock */ +# define SYSCON_CLKOUTCFG_SEL_RTC (4 << SYSCON_CLKOUTCFG_SEL_SHIFT) /* CLKOUT source=RTC osc */ +# define SYSCON_CLKOUTCFG_SEL_SPIFI (5 << SYSCON_CLKOUTCFG_SEL_SHIFT) /* CLKOUT source=SPIFI osc */ +#define SYSCON_CLKOUTCFG_DIV_SHIFT (4) /* Bits 4-7: CLKOUT divisor */ +#define SYSCON_CLKOUTCFG_DIV_MASK (15 << SYSCON_CLKOUTCFG_DIV_SHIFT) +# define SYSCON_CLKOUTCFG_DIV(n) ((n-1) << SYSCON_CLKOUTCFG_DIV_SHIFT) /* n=1..16 */ +#define SYSCON_CLKOUTCFG_EN (1 << 8) /* Bit 8: CLKOUT enable control */ +#define SYSCON_CLKOUTCFG_ACT (1 << 9) /* Bit 9: CLKOUT activity indication */ + /* Bits 10-31: Reserved */ +/* System control registers -- External Interrupts */ +/* External Interrupt Flag register */ + +#define SYSCON_EXTINT_EINT0 (1 << 0) /* Bit 0: EINT0 */ +#define SYSCON_EXTINT_EINT1 (1 << 1) /* Bit 1: EINT1 */ +#define SYSCON_EXTINT_EINT2 (1 << 2) /* Bit 2: EINT2 */ +#define SYSCON_EXTINT_EINT3 (1 << 3) /* Bit 3: EINT3 */ + /* Bits 4-31: Reserved */ +/* External Interrupt Mode register */ + +#define SYSCON_EXTMODE_EINT0 (1 << 0) /* Bit 0: 1=EINT0 edge sensitive */ +#define SYSCON_EXTMODE_EINT1 (1 << 1) /* Bit 1: 1=EINT1 edge sensitive */ +#define SYSCON_EXTMODE_EINT2 (1 << 2) /* Bit 2: 1=EINT2 edge sensitive */ +#define SYSCON_EXTMODE_EINT3 (1 << 3) /* Bit 3: 1=EINT3 edge sensitive */ + /* Bits 4-31: Reserved */ +/* External Interrupt Polarity register */ + +#define SYSCON_EXTPOLAR_EINT0 (1 << 0) /* Bit 0: 1=EINT0 high active/rising edge */ +#define SYSCON_EXTPOLAR_EINT1 (1 << 1) /* Bit 1: 1=EINT1 high active/rising edge */ +#define SYSCON_EXTPOLAR_EINT2 (1 << 2) /* Bit 2: 1=EINT2 high active/rising edge */ +#define SYSCON_EXTPOLAR_EINT3 (1 << 3) /* Bit 3: 1=EINT3 high active/rising edge */ + /* Bits 4-31: Reserved */ +/* System control registers -- Reset */ +/* Reset Source Identification Register */ + +#define SYSCON_RSID_POR (1 << 0) /* Bit 0: Power on reset */ +#define SYSCON_RSID_EXTR (1 << 1) /* Bit 1: external RESET signal */ +#define SYSCON_RSID_WDTR (1 << 2) /* Bit 2: Watchdog Timer time out w/WDTRESET */ +#define SYSCON_RSID_BODR (1 << 3) /* Bit 3: Brown out detection */ +#define SYSCON_RSID_SYSRESET (1 << 4) /* Bit 4: System Reset */ +#define SYSCON_RSID_LOCKUP (1 << 5) /* Bit 5: Lockup Reset */ + /* Bits 6-31: Reserved */ +/* System control registers -- Matrix Arbitration Priorities */ +/*TODO*/ +#define SYSCON_MATRIXARB_PRI_ICODE (3 << 0) /* Bit 0-1: I-Code bus priority (should be lower than D-Code */ +#define SYSCON_MATRIXARB_PRI_DCODE (3 << 2) /* Bit 2-3: D-Code bus priority */ +#define SYSCON_MATRIXARB_PRI_SYS (3 << 4) /* Bit 4-5: System bus priority */ +#define SYSCON_MATRIXARB_PRI_GPDMA (3 << 6) /* Bit 6-7: General Purpose DMA priority */ +#define SYSCON_MATRIXARB_PRI_ETH (3 << 8) /* Bit 8-9: Ethernet DMA priority */ +#define SYSCON_MATRIXARB_PRI_LCD (3 << 10) /* Bit 10-11: LCD DMA priority */ +#define SYSCON_MATRIXARB_PRI_USB (3 << 12) /* Bit 12-13: USB DMA priority */ + /* Bits 14-15: Reserved */ +#define SYSCON_MATRIXARB_ROM_LAT (1 << 16) /* Bit 16: ROM Latency select (should always be zero) */ + /* Bits 17-31: Reserved */ +/* System control registers -- Syscon Miscellaneous Registers */ + +#define SYSCON_SCS_EMCSC (1 << 0) /* Bit 0: EMC shift control */ +#define SYSCON_SCS_EMCRD (1 << 1) /* Bit 1: EMC reset disable */ +#define SYSCON_SCS_EMCBC (1 << 2) /* Bit 2: EMC burst control */ +#define SYSCON_SCS_MCIPWRAL (1 << 3) /* Bit 3: MCI power active level */ +#define SYSCON_SCS_OSCRS (1 << 4) /* Bit 4: Main oscillator range select */ +#define SYSCON_SCS_OSCEN (1 << 5) /* Bit 5: Main oscillator enable */ +#define SYSCON_SCS_OSCSTAT (1 << 6) /* Bit 6: Main oscillator status */ + /* Bits 7-31: Reserved */ +/* Device Interrupt Registers */ +/* USB Interrupt Status register */ + +#define SYSCON_USBINTST_REQLP (1 << 0) /* Bit 0: Low priority interrupt line status */ +#define SYSCON_USBINTST_REQHP (1 << 1) /* Bit 1: High priority interrupt line status */ +#define SYSCON_USBINTST_REQDMA (1 << 2) /* Bit 2: DMA interrupt line status */ +#define SYSCON_USBINTST_HOSTINT (1 << 3) /* Bit 3: USB host interrupt line status */ +#define SYSCON_USBINTST_ATXINT (1 << 4) /* Bit 4: External ATX interrupt line status */ +#define SYSCON_USBINTST_OTGINT (1 << 5) /* Bit 5: OTG interrupt line status */ +#define SYSCON_USBINTST_I2CINT (1 << 6) /* Bit 6: I2C module interrupt line status */ + /* Bit 7: Reserved */ +#define SYSCON_USBINTST_NEEDCLK (1 << 8) /* Bit 8: USB need clock indicator */ + /* Bits 9-30: Reserved */ +#define SYSCON_USBINTST_ENINTS (1 << 31) /* Bit 31: Enable all USB interrupts */ + +/* DMA Request Select Register */ + +#define SYSCON_DMAREQSEL_INP0 (1 << 0) /* Bit 0: Input 0 0=unused 1=Timer 0 match 0 */ +#define SYSCON_DMAREQSEL_INP1 (1 << 1) /* Bit 1: Input 1 0=SD 1=Timer 0 match 1 */ +#define SYSCON_DMAREQSEL_INP2 (1 << 2) /* Bit 2: Input 2 0=SSP0 TX 1=Timer 1 match 0 */ +#define SYSCON_DMAREQSEL_INP3 (1 << 3) /* Bit 3: Input 3 0=SSP0 RX 1=Timer 1 match 1 */ +#define SYSCON_DMAREQSEL_INP4 (1 << 4) /* Bit 4: Input 4 0=SSP1 TX 1=Timer 2 match 0 */ +#define SYSCON_DMAREQSEL_INP5 (1 << 5) /* Bit 5: Input 5 0=SSP1 RX 1=Timer 2 match 1 */ +#define SYSCON_DMAREQSEL_INP6 (1 << 6) /* Bit 6: Input 6 0=SSP2 TX 1=I2S0 */ +#define SYSCON_DMAREQSEL_INP7 (1 << 7) /* Bit 7: Input 7 0=SSP2 RX 1=I2S1 */ + /* Bits 8-9: Reserved */ +#define SYSCON_DMAREQSEL_INP10 (1 << 10) /* Bit 10: Input 10 0=UART0 TX 1=UART3 TX */ +#define SYSCON_DMAREQSEL_INP11 (1 << 11) /* Bit 11: Input 11 0=UART0 RX 1=UART3 RX */ +#define SYSCON_DMAREQSEL_INP12 (1 << 12) /* Bit 12: Input 12 0=UART1 TX 1=UART4 TX */ +#define SYSCON_DMAREQSEL_INP13 (1 << 13) /* Bit 13: Input 13 0=UART1 RX 1=UART4 RX */ +#define SYSCON_DMAREQSEL_INP14 (1 << 14) /* Bit 14: Input 14 0=UART2 TX 1=Timer 3 match 0 */ +#define SYSCON_DMAREQSEL_INP15 (1 << 15) /* Bit 15: Input 15 0=UART2 RX 1=Timer 3 match 1 */ + /* Bits 16-31: Reserved */ +/* Reset Control Register 0 */ + +#define SYSCON_RSTCON0_RSTLCD (1 << 0) /* LCD controller reset control bit */ +#define SYSCON_RSTCON0_RSTTIM0 (1 << 1) /* Timer/Counter 0 reset control bit */ +#define SYSCON_RSTCON0_RSTTIM1 (1 << 2) /* Timer/Counter 1 reset control bit */ +#define SYSCON_RSTCON0_RSTUART0 (1 << 3) /* UART0 reset control bit */ +#define SYSCON_RSTCON0_RSTUART1 (1 << 4) /* UART1 reset control bit */ +#define SYSCON_RSTCON0_RSTPWM0 (1 << 5) /* PWM0 reset control bit */ +#define SYSCON_RSTCON0_RSTPWM1 (1 << 6) /* PWM1 reset control bit */ +#define SYSCON_RSTCON0_RSTI2C0 (1 << 7) /* The I2C0 interface reset control bit */ +#define SYSCON_RSTCON0_RSTUART4 (1 << 8) /* UART4 reset control bit */ +#define SYSCON_RSTCON0_RSTRTC (1 << 9) /* RTC and Event Monitor/Recorder reset control bit. RTC reset is limited */ +#define SYSCON_RSTCON0_RSTSSP1 (1 << 10) /* The SSP 1 interface reset control bit */ +#define SYSCON_RSTCON0_RSTEMC (1 << 11) /* External Memory Controller reset control bit */ +#define SYSCON_RSTCON0_RSTADC (1 << 12) /* A/D converter (ADC) reset control bit */ +#define SYSCON_RSTCON0_RSTCAN1 (1 << 13) /* CAN Controller 1 reset control bit */ + /* Note: The CAN acceptance filter may be reset by 0 + * a separate bit in the RSTCON1 register. */ +#define SYSCON_RSTCON0_RSTCAN2 (1 << 14) /* CAN Controller 2 reset control bit */ + /* Note: The CAN acceptance filter may be reset by 0 + * a separate bit in the RSTCON1 register */ +#define SYSCON_RSTCON0_RSTGPIO (1 << 15) /* Reset control bit for GPIO, and GPIO interrupts */ + /* Note: IOCON may be reset by a 0 + * separate bit in the RSTCON1 register */ +#define SYSCON_RSTCON0_RSTSPIFI (1 << 16) /* SPI Flash Interface reset control bit (LPC1773 only) */ +#define SYSCON_RSTCON0_RSTMCPWM (1 << 17) /* Motor Control PWM reset control bit */ +#define SYSCON_RSTCON0_RSTQEI (1 << 18) /* Quadrature Encoder Interface reset control bit */ +#define SYSCON_RSTCON0_RSTI2C1 (1 << 19) /* The I2C1 interface reset control bit */ +#define SYSCON_RSTCON0_RSTSSP2 (1 << 20) /* The SSP2 interface reset control bit */ +#define SYSCON_RSTCON0_RSTSSP0 (1 << 21) /* The SSP0 interface reset control bit */ +#define SYSCON_RSTCON0_RSTTIM2 (1 << 22) /* Timer 2 reset control bit */ +#define SYSCON_RSTCON0_RSTTIM3 (1 << 23) /* Timer 3 reset control bit */ +#define SYSCON_RSTCON0_RSTUART2 (1 << 24) /* UART 2 reset control bit */ +#define SYSCON_RSTCON0_RSTUART3 (1 << 25) /* UART 3 reset control bit */ +#define SYSCON_RSTCON0_RSTI2C2 (1 << 26) /* I2C2 interface reset control bit.*/ +#define SYSCON_RSTCON0_RSTI2S (1 << 27) /* I2S interface reset control bit */ +#define SYSCON_RSTCON0_RSTSDC (1 << 28) /* SD Card interface reset control bit */ +#define SYSCON_RSTCON0_RSTGPDMA (1 << 29) /* GPDMA function reset control bit */ + +#define SYSCON_RSTCON0_RSTENET (1 << 30) /* Ethernet block reset control bit */ +#define SYSCON_RSTCON0_RSTUSB (1 << 31) /* USB interface reset control bit */ + +/* Reset Control Register 1 */ + +#define SYSCON_RSTCON1_RSTIOCON (1 << 0) /* Reset control bit for the IOCON registers */ +#define SYSCON_RSTCON1_RSTDAC (1 << 1) /* D/A converter (DAC) reset control bit */ +#define SYSCON_RSTCON1_RSTCANACC (1 << 2) /* CAN acceptance filter reset control bit */ + /* Bits 3-31: Reserved */ +/* Delay Control Register - EMC */ + /* Delay values multiplied by 250 picoseconds */ +#define SYSCON_EMCDLYCTL_CMDDLY_SHIFT (0) /* Bits 0-4: Delay value for EMC outputs in command delayed mode */ +#define SYSCON_EMCDLYCTL_CMDDLY_MASK (0x1f << SYSCON_EMCDLYCTL_CMDDLY_SHIFT) +# define SYSCON_EMCDLYCTL_CMDDLY(n) ((n+1) << SYSCON_EMCDLYCTL_CMDDLY_SHIFT) /* n = 2 - 31 */ + /* Bits 5-7: Reserved */ +#define SYSCON_EMCDLYCTL_FBCLKDLY_SHIFT (8) /* Bits 8-12: Delay value for the feedback clock that controls input data sampling */ +#define SYSCON_EMCDLYCTL_FBCLKDLY_MASK (0x1f << SYSCON_EMCDLYCTL_FBCLKDLY_SHIFT) +#define SYSCON_EMCDLYCTL_FBCLKDLY(n) ((n+1)<< SYSCON_EMCDLYCTL_FBCLKDLY_SHIFT) /* n = 2 - 31 */ + /* Bits 13-15: Reserved */ +#define SYSCON_EMCDLYCTL_CLKOUT0DLY_SHIFT (16) /* Bits 16-20: Delay value for the CLKOUT0 output */ +#define SYSCON_EMCDLYCTL_CLKOUT0DLY_MASK (0x1f << SYSCON_EMCDLYCTL_CLKOUT0DLY_SHIFT) +# define SYSCON_EMCDLYCTL_CLKOUT0DLY(n) ((n+1) << SYSCON_EMCDLYCTL_CLKOUT0DLY_SHIFT) /* n = 2 - 31 */ + /* Bits 21-23: Reserved */ +#define SYSCON_EMCDLYCTL_CLKOUT1DLY_SHIFT (24) /* Bits 24-28: Delay value for the CLKOUT1 output */ +#define SYSCON_EMCDLYCTL_CLKOUT1DLY_MASK (0x1f << SYSCON_EMCDLYCTL_CLKOUT1DLY_SHIFT) +# define SYSCON_EMCDLYCTL_CLKOUT1DLY(n) ((n+1) << SYSCON_EMCDLYCTL_CLKOUT1DLY_SHIFT) /* n = 2 - 31 */ + /* Bits 29-31: Reserved */ +/* Calibration Register - EMC */ + +#define SYSCON_EMCCAL_CALVALUE_SHIFT (0) /* Bits 0-7: Ring oscillator count during 32 clocks of Internal RC */ +#define SYSCON_EMCCAL_CALVALUE_MASK (0xff << SYSCON_EMCCAL_CALVALUE_SHIFT) +//~ #define SYSCON_EMCCAL_CALVALUE + /* Bits 8-13: Reserved */ +#define SYSCON_EMCCAL_START_SHIFT (14) /* Bit 14: Start control bit for EMC calibration counter */ +#define SYSCON_EMCCAL_START_MASK (1 << SYSCON_EMCCAL_START_SHIFT) +# define SYSCON_EMCCAL_START (1) /* Automatically cleared when measurement is done */ +#define SYSCON_EMCCAL_DONE_SHIFT (15) /* Bit 15: Measurement completetion flag bit */ +#define SYSCON_EMCCAL_DONE_MASK (1 << SYSCON_EMCCAL_DONE_SHIFT) + /* Automatically cleared when START bit is set */ +//~ # define SYSCON_EMCCAL_DONE + /* Bits 16-31: Reserved */ +/**************************************************************************************************** + * Public Types + ****************************************************************************************************/ + +/**************************************************************************************************** + * Public Data + ****************************************************************************************************/ + +/**************************************************************************************************** + * Public Functions + ****************************************************************************************************/ + +#endif /* __ARCH_ARM_SRC_LPC17XX_CHIP_LPC178X_SYSCON_H */ diff --git a/nuttx/arch/arm/src/lpc17xx/chip/lpc17_gpio.h b/nuttx/arch/arm/src/lpc17xx/chip/lpc17_gpio.h index 20b4ae3801..aa5c0f57b0 100644 --- a/nuttx/arch/arm/src/lpc17xx/chip/lpc17_gpio.h +++ b/nuttx/arch/arm/src/lpc17xx/chip/lpc17_gpio.h @@ -57,6 +57,9 @@ #define LPC17_FIO2_OFFSET 0x0040 #define LPC17_FIO3_OFFSET 0x0060 #define LPC17_FIO4_OFFSET 0x0080 +#ifdef LPC178x +# define LPC17_FIO5_OFFSET 0x00a0 +#endif #define LPC17_FIO_DIR_OFFSET 0x0000 /* Fast GPIO Port Direction control */ #define LPC17_FIO_MASK_OFFSET 0x0010 /* Fast Mask register for ports */ @@ -86,6 +89,9 @@ #define LPC17_FIO2_BASE (LPC17_GPIO_BASE+LPC17_FIO2_OFFSET) #define LPC17_FIO3_BASE (LPC17_GPIO_BASE+LPC17_FIO3_OFFSET) #define LPC17_FIO4_BASE (LPC17_GPIO_BASE+LPC17_FIO4_OFFSET) +#ifdef LPC178x +# define LPC17_FIO5_BASE (LPC17_GPIO_BASE+LPC17_FIO5_OFFSET) +#endif #define LPC17_FIO_DIR(n) (LPC17_FIO_BASE(n)+LPC17_FIO_DIR_OFFSET) #define LPC17_FIO_MASK(n) (LPC17_FIO_BASE(n)+LPC17_FIO_MASK_OFFSET) @@ -123,6 +129,14 @@ #define LPC17_FIO4_SET (LPC17_FIO4_BASE+LPC17_FIO_SET_OFFSET) #define LPC17_FIO4_CLR (LPC17_FIO4_BASE+LPC17_FIO_CLR_OFFSET) +#ifdef LPC178x +# define LPC17_FIO5_DIR (LPC17_FIO5_BASE+LPC17_FIO_DIR_OFFSET) +# define LPC17_FIO5_MASK (LPC17_FIO5_BASE+LPC17_FIO_MASK_OFFSET) +# define LPC17_FIO5_PIN (LPC17_FIO5_BASE+LPC17_FIO_PIN_OFFSET) +# define LPC17_FIO5_SET (LPC17_FIO5_BASE+LPC17_FIO_SET_OFFSET) +# define LPC17_FIO5_CLR (LPC17_FIO5_BASE+LPC17_FIO_CLR_OFFSET) +#endif + /* GPIO interrupt block register addresses ******************************************/ #define LPC17_GPIOINTn_BASE(n) (LPC17_GPIOINT_BASE+LPC17_GPIOINT_OFFSET(n)) @@ -137,7 +151,7 @@ #define LPC17_GPIOINT_INTENR(n) (LPC17_GPIOINTn_BASE(n)+LPC17_GPIOINT_INTENR_OFFSET) #define LPC17_GPIOINT_INTENF(n) (LPC17_GPIOINTn_BASE(n)+LPC17_GPIOINT_INTENF_OFFSET) -/* Pins P0.0-31 (P0.12-14 nad P0.31 are reserved) */ +/* Pins P0.0-31 */ #define LPC17_GPIOINT0_INTSTATR (LPC17_GPIOINT0_BASE+LPC17_GPIOINT_INTSTATR_OFFSET) #define LPC17_GPIOINT0_INTSTATF (LPC17_GPIOINT0_BASE+LPC17_GPIOINT_INTSTATF_OFFSET) @@ -145,7 +159,7 @@ #define LPC17_GPIOINT0_INTENR (LPC17_GPIOINT0_BASE+LPC17_GPIOINT_INTENR_OFFSET) #define LPC17_GPIOINT0_INTENF (LPC17_GPIOINT0_BASE+LPC17_GPIOINT_INTENF_OFFSET) -/* Pins P2.0-13 (P0.14-31 are reserved) */ +/* Pins P2.0-31 */ #define LPC17_GPIOINT2_INTSTATR (LPC17_GPIOINT2_BASE+LPC17_GPIOINT_INTSTATR_OFFSET) #define LPC17_GPIOINT2_INTSTATF (LPC17_GPIOINT2_BASE+LPC17_GPIOINT_INTSTATF_OFFSET) @@ -189,105 +203,8 @@ * Public Data ************************************************************************************/ -#ifndef __ASSEMBLY__ -#ifdef __cplusplus -extern "C" -{ -#endif - /************************************************************************************ * Public Functions ************************************************************************************/ -/************************************************************************************ - * Name: lpc17_gpioirqinitialize - * - * Description: - * Initialize logic to support a second level of interrupt decoding for GPIO pins. - * - ************************************************************************************/ - -#ifdef CONFIG_GPIO_IRQ -void lpc17_gpioirqinitialize(void); -#else -# define lpc17_gpioirqinitialize() -#endif - -/************************************************************************************ - * Name: lpc17_configgpio - * - * Description: - * Configure a GPIO pin based on bit-encoded description of the pin. - * - ************************************************************************************/ - -int lpc17_configgpio(uint16_t cfgset); - -/************************************************************************************ - * Name: lpc17_gpiowrite - * - * Description: - * Write one or zero to the selected GPIO pin - * - ************************************************************************************/ - -void lpc17_gpiowrite(uint16_t pinset, bool value); - -/************************************************************************************ - * Name: lpc17_gpioread - * - * Description: - * Read one or zero from the selected GPIO pin - * - ************************************************************************************/ - -bool lpc17_gpioread(uint16_t pinset); - -/************************************************************************************ - * Name: lpc17_gpioirqenable - * - * Description: - * Enable the interrupt for specified GPIO IRQ - * - ************************************************************************************/ - -#ifdef CONFIG_GPIO_IRQ -void lpc17_gpioirqenable(int irq); -#else -# define lpc17_gpioirqenable(irq) -#endif - -/************************************************************************************ - * Name: lpc17_gpioirqdisable - * - * Description: - * Disable the interrupt for specified GPIO IRQ - * - ************************************************************************************/ - -#ifdef CONFIG_GPIO_IRQ -void lpc17_gpioirqdisable(int irq); -#else -# define lpc17_gpioirqdisable(irq) -#endif - -/************************************************************************************ - * Function: lpc17_dumpgpio - * - * Description: - * Dump all GPIO registers associated with the base address of the provided pinset. - * - ************************************************************************************/ - -#ifdef CONFIG_DEBUG_GPIO -int lpc17_dumpgpio(uint16_t pinset, const char *msg); -#else -# define lpc17_dumpgpio(p,m) -#endif - -#if defined(__cplusplus) -} -#endif - -#endif /* __ASSEMBLY__ */ #endif /* __ARCH_ARM_SRC_LPC17XX_LPC17_CHIP_GPIO_H */ diff --git a/nuttx/arch/arm/src/lpc17xx/chip/lpc17_syscon.h b/nuttx/arch/arm/src/lpc17xx/chip/lpc17_syscon.h index 15be1e6723..ebe39cb723 100644 --- a/nuttx/arch/arm/src/lpc17xx/chip/lpc17_syscon.h +++ b/nuttx/arch/arm/src/lpc17xx/chip/lpc17_syscon.h @@ -42,443 +42,20 @@ #include -#include "chip.h" -#include "chip/lpc17_memorymap.h" +#include + +#if defined(LPC176x) +# include "chip/lpc176x_syscon.h" +#elif defined(LPC178x) +# include "chip/lpc178x_syscon.h" +#else +# error "Unrecognized LPC17xx family" +#endif /************************************************************************************ * Pre-processor Definitions ************************************************************************************/ -/* Register offsets *****************************************************************/ -/* Flash accelerator module */ - -#define LPC17_SYSCON_FLASHCFG_OFFSET 0x0000 /* Flash Accelerator Configuration Register */ - -/* Memory Mapping Control register (MEMMAP - 0x400F C040) */ - -#define LPC17_SYSCON_MEMMAP_OFFSET 0x0040 /* Memory Mapping Control register */ - -/* Clocking and power control - Phase locked loops */ - -#define LPC17_SYSCON_PLL0CON_OFFSET 0x0080 /* PLL0 Control Register */ -#define LPC17_SYSCON_PLL0CFG_OFFSET 0x0084 /* PLL0 Configuration Register */ -#define LPC17_SYSCON_PLL0STAT_OFFSET 0x0088 /* PLL0 Status Register */ -#define LPC17_SYSCON_PLL0FEED_OFFSET 0x008c /* PLL0 Feed Register */ - -#define LPC17_SYSCON_PLL1CON_OFFSET 0x00a0 /* PLL1 Control Register */ -#define LPC17_SYSCON_PLL1CFG_OFFSET 0x00a4 /* PLL1 Configuration Register */ -#define LPC17_SYSCON_PLL1STAT_OFFSET 0x00a8 /* PLL1 Status Register */ -#define LPC17_SYSCON_PLL1FEED_OFFSET 0x00ac /* PLL1 Feed Register */ - -/* Clocking and power control - Peripheral power control registers */ - -#define LPC17_SYSCON_PCON_OFFSET 0x00c0 /* Power Control Register */ -#define LPC17_SYSCON_PCONP_OFFSET 0x00c4 /* Power Control for Peripherals Register */ - -/* Clocking and power control -- Clock dividers */ - -#define LPC17_SYSCON_CCLKCFG_OFFSET 0x0104 /* CPU Clock Configuration Register */ -#define LPC17_SYSCON_USBCLKCFG_OFFSET 0x0108 /* USB Clock Configuration Register */ - -/* 0x400f c110 - 0x400f c114: CAN Wake and Sleep Registers */ - -/* Clocking and power control -- Clock source selection */ - -#define LPC17_SYSCON_CLKSRCSEL_OFFSET 0x010c /* Clock Source Select Register */ - -/* System control registers -- External Interrupts */ - -#define LPC17_SYSCON_EXTINT_OFFSET 0x0140 /* External Interrupt Flag Register */ - -#define LPC17_SYSCON_EXTMODE_OFFSET 0x0148 /* External Interrupt Mode register */ -#define LPC17_SYSCON_EXTPOLAR_OFFSET 0x014c /* External Interrupt Polarity Register */ - -/* System control registers -- Reset */ - -#define LPC17_SYSCON_RSID_OFFSET 0x0180 /* Reset Source Identification Register */ - -/* System control registers -- Syscon Miscellaneous Registers */ - -#define LPC17_SYSCON_SCS_OFFSET 0x01a0 /* System Control and Status */ - -/* More clocking and power control -- Clock dividers */ - -#define LPC17_SYSCON_PCLKSEL0_OFFSET 0x01a8 /* Peripheral Clock Selection register 0 */ -#define LPC17_SYSCON_PCLKSEL1_OFFSET 0x01ac /* Peripheral Clock Selection register 1 */ - -/* Device Interrupt Registers (Might be a error in the User Manual, might be at 0x5000c1c0) */ - -#define LPC17_SYSCON_USBINTST_OFFSET 0x01c0 /* USB Interrupt Status */ - -/* DMA Request Select Register */ - -#define LPC17_SYSCON_DMAREQSEL_OFFSET 0x01c4 /* Selects between UART and timer DMA requests */ - -/* More clocking and power control -- Utility */ - -#define LPC17_SYSCON_CLKOUTCFG_OFFSET 0x01c8 /* Clock Output Configuration Register */ - -/* Register addresses ***************************************************************/ -/* Flash accelerator module */ - -#define LPC17_SYSCON_FLASHCFG (LPC17_SYSCON_BASE+LPC17_SYSCON_FLASHCFG_OFFSET) - -/* Memory Mapping Control register (MEMMAP - 0x400F C040) */ - -#define LPC17_SYSCON_MEMMAP (LPC17_SYSCON_BASE+LPC17_SYSCON_MEMMAP_OFFSET) - -/* Clocking and power control - Phase locked loops */ - -#define LPC17_SYSCON_PLL0CON (LPC17_SYSCON_BASE+LPC17_SYSCON_PLL0CON_OFFSET) -#define LPC17_SYSCON_PLL0CFG (LPC17_SYSCON_BASE+LPC17_SYSCON_PLL0CFG_OFFSET) -#define LPC17_SYSCON_PLL0STAT (LPC17_SYSCON_BASE+LPC17_SYSCON_PLL0STAT_OFFSET) -#define LPC17_SYSCON_PLL0FEED (LPC17_SYSCON_BASE+LPC17_SYSCON_PLL0FEED_OFFSET) - -#define LPC17_SYSCON_PLL1CON (LPC17_SYSCON_BASE+LPC17_SYSCON_PLL1CON_OFFSET) -#define LPC17_SYSCON_PLL1CFG (LPC17_SYSCON_BASE+LPC17_SYSCON_PLL1CFG_OFFSET) -#define LPC17_SYSCON_PLL1STAT (LPC17_SYSCON_BASE+LPC17_SYSCON_PLL1STAT_OFFSET) -#define LPC17_SYSCON_PLL1FEED (LPC17_SYSCON_BASE+LPC17_SYSCON_PLL1FEED_OFFSET) - -/* Clocking and power control - Peripheral power control registers */ - -#define LPC17_SYSCON_PCON (LPC17_SYSCON_BASE+LPC17_SYSCON_PCON_OFFSET) -#define LPC17_SYSCON_PCONP (LPC17_SYSCON_BASE+LPC17_SYSCON_PCONP_OFFSET) - -/* Clocking and power control -- Clock dividers */ - -#define LPC17_SYSCON_CCLKCFG (LPC17_SYSCON_BASE+LPC17_SYSCON_CCLKCFG_OFFSET) -#define LPC17_SYSCON_USBCLKCFG (LPC17_SYSCON_BASE+LPC17_SYSCON_USBCLKCFG_OFFSET) - -/* 0x400f c110 - 0x400f c114: CAN Wake and Sleep Registers */ - -/* Clocking and power control -- Clock source selection */ - -#define LPC17_SYSCON_CLKSRCSEL (LPC17_SYSCON_BASE+LPC17_SYSCON_CLKSRCSEL_OFFSET) - -/* System control registers -- External Interrupts */ - -#define LPC17_SYSCON_EXTINT (LPC17_SYSCON_BASE+LPC17_SYSCON_EXTINT_OFFSET) - -#define LPC17_SYSCON_EXTMODE (LPC17_SYSCON_BASE+LPC17_SYSCON_EXTMODE_OFFSET) -#define LPC17_SYSCON_EXTPOLAR (LPC17_SYSCON_BASE+LPC17_SYSCON_EXTPOLAR_OFFSET) - -/* System control registers -- Reset */ - -#define LPC17_SYSCON_RSID (LPC17_SYSCON_BASE+LPC17_SYSCON_RSID_OFFSET) - -/* System control registers -- Syscon Miscellaneous Registers */ - -#define LPC17_SYSCON_SCS (LPC17_SYSCON_BASE+LPC17_SYSCON_SCS_OFFSET) - -/* More clocking and power control -- Clock dividers */ - -#define LPC17_SYSCON_PCLKSEL0 (LPC17_SYSCON_BASE+LPC17_SYSCON_PCLKSEL0_OFFSET) -#define LPC17_SYSCON_PCLKSEL1 (LPC17_SYSCON_BASE+LPC17_SYSCON_PCLKSEL1_OFFSET) - -/* Device Interrupt Registers (Might be a error in the User Manual, might be at 0x5000c1c0) */ - -#define LPC17_SYSCON_USBINTST (LPC17_SYSCON_BASE+LPC17_SYSCON_USBINTST_OFFSET) - -/* DMA Request Select Register */ - -#define LPC17_SYSCON_DMAREQSEL (LPC17_SYSCON_BASE+LPC17_SYSCON_DMAREQSEL_OFFSET) - -/* More clocking and power control -- Utility */ - -#define LPC17_SYSCON_CLKOUTCFG (LPC17_SYSCON_BASE+LPC17_SYSCON_CLKOUTCFG_OFFSET) - -/* Register bit definitions *********************************************************/ -/* Flash accelerator module */ - /* Bits 0-11: Reserved */ -#define SYSCON_FLASHCFG_TIM_SHIFT (12) /* Bits 12-15: FLASHTIM Flash access time */ -#define SYSCON_FLASHCFG_TIM_MASK (15 << SYSCON_FLASHCFG_TIM_SHIFT) -# define SYSCON_FLASHCFG_TIM_1 (0 << SYSCON_FLASHCFG_TIM_SHIFT) /* 1 CPU clock <= 20 MHz CPU clock */ -# define SYSCON_FLASHCFG_TIM_2 (1 << SYSCON_FLASHCFG_TIM_SHIFT) /* 2 CPU clock <= 40 MHz CPU clock */ -# define SYSCON_FLASHCFG_TIM_3 (2 << SYSCON_FLASHCFG_TIM_SHIFT) /* 3 CPU clock <= 60 MHz CPU clock */ -# define SYSCON_FLASHCFG_TIM_4 (3 << SYSCON_FLASHCFG_TIM_SHIFT) /* 4 CPU clock <= 80 MHz CPU clock */ -# define SYSCON_FLASHCFG_TIM_5 (4 << SYSCON_FLASHCFG_TIM_SHIFT) /* 5 CPU clock <= 100 MHz CPU clock - * (Up to 120 Mhz for LPC1759/69 only */ -# define SYSCON_FLASHCFG_TIM_6 (5 << SYSCON_FLASHCFG_TIM_SHIFT) /* "safe" setting for any conditions */ - /* Bits 16-31: Reserved */ - -/* Memory Mapping Control register (MEMMAP - 0x400F C040) */ - -#define SYSCON_MEMMAP_MAP (1 << 0) /* Bit 0: - * 0:Boot mode. A portion of the Boot ROM is mapped to address 0. - * 1:User mode. The on-chip Flash memory is mapped to address 0 */ - /* Bits 1-31: Reserved */ - -/* Clocking and power control -- Clock source selection */ - -#define SYSCON_CLKSRCSEL_SHIFT (0) /* Bits 0-1: Clock selection */ -#define SYSCON_CLKSRCSEL_MASK (3 << SYSCON_CLKSRCSEL_SHIFT) -# define SYSCON_CLKSRCSEL_INTRC (0 << SYSCON_CLKSRCSEL_SHIFT) /* PLL0 source = internal RC oscillator */ -# define SYSCON_CLKSRCSEL_MAIN (1 << SYSCON_CLKSRCSEL_SHIFT) /* PLL0 source = main oscillator */ -# define SYSCON_CLKSRCSEL_RTC (2 << SYSCON_CLKSRCSEL_SHIFT) /* PLL0 source = RTC oscillator */ - /* Bits 2-31: Reserved */ - -/* Clocking and power control - Phase locked loops */ -/* PLL0/1 Control register */ - -#define SYSCON_PLLCON_PLLE (1 << 0) /* Bit 0: PLL0/1 Enable */ -#define SYSCON_PLLCON_PLLC (1 << 1) /* Bit 1: PLL0/1 Connect */ - /* Bits 2-31: Reserved */ -/* PLL0 Configuration register */ - -#define SYSCON_PLL0CFG_MSEL_SHIFT (0) /* Bit 0-14: PLL0 Multiplier value */ -#define SYSCON_PLL0CFG_MSEL_MASK (0x7fff << SYSCON_PLL0CFG_MSEL_SHIFT) - /* Bit 15: Reserved */ -#define SYSCON_PLL0CFG_NSEL_SHIFT (16) /* Bit 16-23: PLL0 Pre-Divider value */ -#define SYSCON_PLL0CFG_NSEL_MASK (0xff << SYSCON_PLL0CFG_NSEL_SHIFT) - /* Bits 24-31: Reserved */ -/* PLL1 Configuration register */ - -#define SYSCON_PLL1CFG_MSEL_SHIFT (0) /* Bit 0-4: PLL1 Multiplier value */ -#define SYSCON_PLL1CFG_MSEL_MASK (0x1f < SYSCON_PLL1CFG_MSEL_SHIFT) -#define SYSCON_PLL1CFG_NSEL_SHIFT (5) /* Bit 5-6: PLL1 Pre-Divider value */ -#define SYSCON_PLL1CFG_NSEL_MASK (3 << SYSCON_PLL1CFG_NSEL_SHIFT) - /* Bits 7-31: Reserved */ -/* PLL0 Status register */ - -#define SYSCON_PLL0STAT_MSEL_SHIFT (0) /* Bit 0-14: PLL0 Multiplier value readback */ -#define SYSCON_PLL0STAT_MSEL_MASK (0x7fff << SYSCON_PLL0STAT_MSEL_SHIFT) - /* Bit 15: Reserved */ -#define SYSCON_PLL0STAT_NSEL_SHIFT (16) /* Bit 16-23: PLL0 Pre-Divider value readback */ -#define SYSCON_PLL0STAT_NSEL_MASK (0xff << SYSCON_PLL0STAT_NSEL_SHIFT) -#define SYSCON_PLL0STAT_PLLE (1 << 24) /* Bit 24: PLL0 enable readback */ -#define SYSCON_PLL0STAT_PLLC (1 << 25) /* Bit 25: PLL0 connect readback */ -#define SYSCON_PLL0STAT_PLOCK (1 << 26) /* Bit 26: PLL0 lock status */ - /* Bits 27-31: Reserved */ -/* PLL1 Status register */ - -#define SYSCON_PLL1STAT_MSEL_SHIFT (0) /* Bit 0-4: PLL1 Multiplier value readback */ -#define SYSCON_PLL1STAT_MSEL_MASK (0x1f << SYSCON_PLL1STAT_MSEL_SHIFT) -#define SYSCON_PLL1STAT_NSEL_SHIFT (5) /* Bit 5-6: PLL1 Pre-Divider value readback */ -#define SYSCON_PLL1STAT_NSEL_MASK (3 << SYSCON_PLL1STAT_NSEL_SHIFT) - /* Bit 7: Reserved */ -#define SYSCON_PLL1STAT_PLLE (1 << 8) /* Bit 8: PLL1 enable readback */ -#define SYSCON_PLL1STAT_PLLC (1 << 9) /* Bit 9: PLL1 connect readback */ -#define SYSCON_PLL1STAT_PLOCK (1 << 10) /* Bit 10: PLL1 lock status */ - /* Bits 11-31: Reserved */ -/* PLL0/1 Feed register */ - -#define SYSCON_PLLFEED_SHIFT (0) /* Bit 0-7: PLL0/1 feed sequence */ -#define SYSCON_PLLFEED_MASK (0xff << SYSCON_PLLFEED_SHIFT) - /* Bits 8-31: Reserved */ -/* Clocking and power control -- Clock dividers */ -/* CPU Clock Configuration register */ - -#define SYSCON_CCLKCFG_SHIFT (0) /* 0-7: Divide value for CPU clock (CCLK) */ -#define SYSCON_CCLKCFG_MASK (0xff << SYSCON_CCLKCFG_SHIFT) -# define SYSCON_CCLKCFG_DIV(n) ((n-1) << SYSCON_CCLKCFG_SHIFT) /* n=2,3,..255 */ - /* Bits 8-31: Reserved */ -/* USB Clock Configuration register */ - -#define SYSCON_USBCLKCFG_SHIFT (0) /* Bits 0-3: PLL0 divide value USB clock */ -#define SYSCON_USBCLKCFG_MASK (15 << SYSCON_USBCLKCFG_SHIFT) -# define SYSCON_USBCLKCFG_DIV6 (5 << SYSCON_USBCLKCFG_SHIFT) /* PLL0/6 for PLL0=288 MHz */ -# define SYSCON_USBCLKCFG_DIV8 (7 << SYSCON_USBCLKCFG_SHIFT) /* PLL0/8 for PLL0=384 MHz */ -# define SYSCON_USBCLKCFG_DIV10 (9 << SYSCON_USBCLKCFG_SHIFT) /* PLL0/10 for PLL0=480 MHz */ - /* Bits 8-31: Reserved */ -/* Peripheral Clock Selection registers 0 and 1 */ - -#define SYSCON_PCLKSEL_CCLK4 (0) /* PCLK_peripheral = CCLK/4 */ -#define SYSCON_PCLKSEL_CCLK (1) /* PCLK_peripheral = CCLK */ -#define SYSCON_PCLKSEL_CCLK2 (2) /* PCLK_peripheral = CCLK/2 */ -#define SYSCON_PCLKSEL_CCLK8 (3) /* PCLK_peripheral = CCLK/8 (except CAN1, CAN2, and CAN) */ -#define SYSCON_PCLKSEL_CCLK6 (3) /* PCLK_peripheral = CCLK/6 (CAN1, CAN2, and CAN) */ -#define SYSCON_PCLKSEL_MASK (3) - -#define SYSCON_PCLKSEL0_WDT_SHIFT (0) /* Bits 0-1: Peripheral clock WDT */ -#define SYSCON_PCLKSEL0_WDT_MASK (3 << SYSCON_PCLKSEL0_WDT_SHIFT) -#define SYSCON_PCLKSEL0_TMR0_SHIFT (2) /* Bits 2-3: Peripheral clock TIMER0 */ -#define SYSCON_PCLKSEL0_TMR0_MASK (3 << SYSCON_PCLKSEL0_TMR0_SHIFT) -#define SYSCON_PCLKSEL0_TMR1_SHIFT (4) /* Bits 4-5: Peripheral clock TIMER1 */ -#define SYSCON_PCLKSEL0_TMR1_MASK (3 << SYSCON_PCLKSEL0_TMR1_SHIFT) -#define SYSCON_PCLKSEL0_UART0_SHIFT (6) /* Bits 6-7: Peripheral clock UART0 */ -#define SYSCON_PCLKSEL0_UART0_MASK (3 << SYSCON_PCLKSEL0_UART0_SHIFT) -#define SYSCON_PCLKSEL0_UART1_SHIFT (8) /* Bits 8-9: Peripheral clock UART1 */ -#define SYSCON_PCLKSEL0_UART1_MASK (3 << SYSCON_PCLKSEL0_UART1_SHIFT) - /* Bits 10-11: Reserved */ -#define SYSCON_PCLKSEL0_PWM1_SHIFT (12) /* Bits 12-13: Peripheral clock PWM1 */ -#define SYSCON_PCLKSEL0_PWM1_MASK (3 << SYSCON_PCLKSEL0_PWM1_SHIFT) -#define SYSCON_PCLKSEL0_I2C0_SHIFT (14) /* Bits 14-15: Peripheral clock I2C0 */ -#define SYSCON_PCLKSEL0_I2C0_MASK (3 << SYSCON_PCLKSEL0_I2C0_SHIFT) -#define SYSCON_PCLKSEL0_SPI_SHIFT (16) /* Bits 16-17: Peripheral clock SPI */ -#define SYSCON_PCLKSEL0_SPI_MASK (3 << SYSCON_PCLKSEL0_SPI_SHIFT) - /* Bits 18-19: Reserved */ -#define SYSCON_PCLKSEL0_SSP1_SHIFT (20) /* Bits 20-21: Peripheral clock SSP1 */ -#define SYSCON_PCLKSEL0_SSP1_MASK (3 << SYSCON_PCLKSEL0_SSP1_SHIFT) -#define SYSCON_PCLKSEL0_DAC_SHIFT (22) /* Bits 22-23: Peripheral clock DAC */ -#define SYSCON_PCLKSEL0_DAC_MASK (3 << SYSCON_PCLKSEL0_DAC_SHIFT) -#define SYSCON_PCLKSEL0_ADC_SHIFT (24) /* Bits 24-25: Peripheral clock ADC */ -#define SYSCON_PCLKSEL0_ADC_MASK (3 << SYSCON_PCLKSEL0_ADC_SHIFT) -#define SYSCON_PCLKSEL0_CAN1_SHIFT (26) /* Bits 26-27: Peripheral clock CAN1 */ -#define SYSCON_PCLKSEL0_CAN1_MASK (3 << SYSCON_PCLKSEL0_CAN1_SHIFT) -#define SYSCON_PCLKSEL0_CAN2_SHIFT (28) /* Bits 28-29: Peripheral clock CAN2 */ -#define SYSCON_PCLKSEL0_CAN2_MASK (3 << SYSCON_PCLKSEL0_CAN2_SHIFT) -#define SYSCON_PCLKSEL0_ACF_SHIFT (30) /* Bits 30-31: Peripheral clock CAN AF */ -#define SYSCON_PCLKSEL0_ACF_MASK (3 << SYSCON_PCLKSEL0_ACF_SHIFT) - -#define SYSCON_PCLKSEL1_QEI_SHIFT (0) /* Bits 0-1: Peripheral clock Quadrature Encoder */ -#define SYSCON_PCLKSEL1_QEI_MASK (3 << SYSCON_PCLKSEL1_QEI_SHIFT) -#define SYSCON_PCLKSEL1_GPIOINT_SHIFT (2) /* Bits 2-3: Peripheral clock GPIO interrupts */ -#define SYSCON_PCLKSEL1_GPIOINT_MASK (3 << SYSCON_PCLKSEL1_GPIOINT_SHIFT) -#define SYSCON_PCLKSEL1_PCB_SHIFT (4) /* Bits 4-5: Peripheral clock the Pin Connect block */ -#define SYSCON_PCLKSEL1_PCB_MASK (3 << SYSCON_PCLKSEL1_PCB_SHIFT) -#define SYSCON_PCLKSEL1_I2C1_SHIFT (6) /* Bits 6-7: Peripheral clock I2C1 */ -#define SYSCON_PCLKSEL1_I2C1_MASK (3 << SYSCON_PCLKSEL1_I2C1_SHIFT) - /* Bits 8-9: Reserved */ -#define SYSCON_PCLKSEL1_SSP0_SHIFT (10) /* Bits 10-11: Peripheral clock SSP0 */ -#define SYSCON_PCLKSEL1_SSP0_MASK (3 << SYSCON_PCLKSEL1_SSP0_SHIFT) -#define SYSCON_PCLKSEL1_TMR2_SHIFT (12) /* Bits 12-13: Peripheral clock TIMER2 */ -#define SYSCON_PCLKSEL1_TMR2_MASK (3 << SYSCON_PCLKSEL1_TMR2_SHIFT) -#define SYSCON_PCLKSEL1_TMR3_SHIFT (14) /* Bits 14-15: Peripheral clock TIMER3 */ -#define SYSCON_PCLKSEL1_TMR3_MASK (3 << SYSCON_PCLKSEL1_TMR3_SHIFT) -#define SYSCON_PCLKSEL1_UART2_SHIFT (16) /* Bits 16-17: Peripheral clock UART2 */ -#define SYSCON_PCLKSEL1_UART2_MASK (3 << SYSCON_PCLKSEL1_UART2_SHIFT) -#define SYSCON_PCLKSEL1_UART3_SHIFT (18) /* Bits 18-19: Peripheral clock UART3 */ -#define SYSCON_PCLKSEL1_UART3_MASK (3 << SYSCON_PCLKSEL1_UART3_SHIFT) -#define SYSCON_PCLKSEL1_I2C2_SHIFT (20) /* Bits 20-21: Peripheral clock I2C2 */ -#define SYSCON_PCLKSEL1_I2C2_MASK (3 << SYSCON_PCLKSEL1_I2C2_SHIFT) -#define SYSCON_PCLKSEL1_I2S_SHIFT (22) /* Bits 22-23: Peripheral clock I2S */ -#define SYSCON_PCLKSEL1_I2S_MASK (3 << SYSCON_PCLKSEL1_I2S_SHIFT) - /* Bits 24-25: Reserved */ -#define SYSCON_PCLKSEL1_RIT_SHIFT (26) /* Bits 26-27: Peripheral clock Repetitive Interrupt Timer */ -#define SYSCON_PCLKSEL1_RIT_MASK (3 << SYSCON_PCLKSEL1_RIT_SHIFT) -#define SYSCON_PCLKSEL1_SYSCON_SHIFT (28) /* Bits 28-29: Peripheral clock the System Control block */ -#define SYSCON_PCLKSEL1_SYSCON_MASK (3 << SYSCON_PCLKSEL1_SYSCON_SHIFT) -#define SYSCON_PCLKSEL1_MC_SHIFT (30) /* Bits 30-31: Peripheral clock the Motor Control PWM */ -#define SYSCON_PCLKSEL1_MC_MASK (3 << SYSCON_PCLKSEL1_MC_SHIFT) - -/* Clocking and power control - Peripheral power control registers */ -/* Power Control Register */ - -#define SYSCON_PCON_PM0 (1 << 0) /* Bit 0: Power mode control bit 0 */ -#define SYSCON_PCON_PM1 (1 << 1) /* Bit 1: Power mode control bit 1 */ -#define SYSCON_PCON_BODRPM (1 << 2) /* Bit 2: Brown-Out Reduced Power Mode */ -#define SYSCON_PCON_BOGD (1 << 3) /* Bit 3: Brown-Out Global Disable */ -#define SYSCON_PCON_BORD (1 << 4) /* Bit 4: Brown-Out Reset Disable */ - /* Bits 5-7: Reserved */ -#define SYSCON_PCON_SMFLAG (1 << 8) /* Bit 8: Sleep Mode entry flag */ -#define SYSCON_PCON_DSFLAG (1 << 9) /* Bit 9: Deep Sleep entry flag */ -#define SYSCON_PCON_PDFLAG (1 << 10) /* Bit 10: Power-down entry flag */ -#define SYSCON_PCON_DPDFLAG (1 << 11) /* Bit 11: Deep Power-down entry flag */ - /* Bits 12-31: Reserved */ -/* Power Control for Peripherals Register */ - - /* Bit 0: Reserved */ -#define SYSCON_PCONP_PCTIM0 (1 << 1) /* Bit 1: Timer/Counter 0 power/clock control */ -#define SYSCON_PCONP_PCTIM1 (1 << 2) /* Bit 2: Timer/Counter 1 power/clock control */ -#define SYSCON_PCONP_PCUART0 (1 << 3) /* Bit 3: UART0 power/clock control */ -#define SYSCON_PCONP_PCUART1 (1 << 4) /* Bit 4: UART1 power/clock control */ - /* Bit 5: Reserved */ -#define SYSCON_PCONP_PCPWM1 (1 << 6) /* Bit 6: PWM1 power/clock control */ -#define SYSCON_PCONP_PCI2C0 (1 << 7) /* Bit 7: I2C0 power/clock control */ -#define SYSCON_PCONP_PCSPI (1 << 8) /* Bit 8: SPI power/clock control */ -#define SYSCON_PCONP_PCRTC (1 << 9) /* Bit 9: RTC power/clock control */ -#define SYSCON_PCONP_PCSSP1 (1 << 10) /* Bit 10: SSP 1 power/clock control */ - /* Bit 11: Reserved */ -#define SYSCON_PCONP_PCADC (1 << 12) /* Bit 12: A/D converter (ADC) power/clock control */ -#define SYSCON_PCONP_PCCAN1 (1 << 13) /* Bit 13: CAN Controller 1 power/clock control */ -#define SYSCON_PCONP_PCCAN2 (1 << 14) /* Bit 14: CAN Controller 2 power/clock control */ -#define SYSCON_PCONP_PCGPIO (1 << 15) /* Bit 15: GPIOs power/clock enable */ -#define SYSCON_PCONP_PCRIT (1 << 16) /* Bit 16: Repetitive Interrupt Timer power/clock control */ -#define SYSCON_PCONP_PCMCPWM (1 << 17) /* Bit 17: Motor Control PWM */ -#define SYSCON_PCONP_PCQEI (1 << 18) /* Bit 18: Quadrature Encoder power/clock control */ -#define SYSCON_PCONP_PCI2C1 (1 << 19) /* Bit 19: I2C1 power/clock control */ - /* Bit 20: Reserved */ -#define SYSCON_PCONP_PCSSP0 (1 << 21) /* Bit 21: SSP0 power/clock control */ -#define SYSCON_PCONP_PCTIM2 (1 << 22) /* Bit 22: Timer 2 power/clock control */ -#define SYSCON_PCONP_PCTIM3 (1 << 23) /* Bit 23: Timer 3 power/clock control */ -#define SYSCON_PCONP_PCUART2 (1 << 24) /* Bit 24: UART 2 power/clock control */ -#define SYSCON_PCONP_PCUART3 (1 << 25) /* Bit 25: UART 3 power/clock control */ -#define SYSCON_PCONP_PCI2C2 (1 << 26) /* Bit 26: I2C 2 power/clock control */ -#define SYSCON_PCONP_PCI2S (1 << 27) /* Bit 27: I2S power/clock control */ - /* Bit 28: Reserved */ -#define SYSCON_PCONP_PCGPDMA (1 << 29) /* Bit 29: GPDMA function power/clock control */ -#define SYSCON_PCONP_PCENET (1 << 30) /* Bit 30: Ethernet block power/clock control */ -#define SYSCON_PCONP_PCUSB (1 << 31) /* Bit 31: USB power/clock control */ - -/* More clocking and power control -- Utility */ - -#define SYSCON_CLKOUTCFG_SEL_SHIFT (0) /* Bits 0-3: Selects clock source for CLKOUT */ -#define SYSCON_CLKOUTCFG_SEL_MASK (15 << SYSCON_CLKOUTCFG_SEL_SHIFT) -# define SYSCON_CLKOUTCFG_SEL_CPU (0 << SYSCON_CLKOUTCFG_SEL_SHIFT) /* CLKOUT source=CPU clock */ -# define SYSCON_CLKOUTCFG_SEL_MAIN (1 << SYSCON_CLKOUTCFG_SEL_SHIFT) /* CLKOUT source=main osc */ -# define SYSCON_CLKOUTCFG_SEL_INTRC (2 << SYSCON_CLKOUTCFG_SEL_SHIFT) /* CLKOUT source=internal RC osc */ -# define SYSCON_CLKOUTCFG_SEL_USB (3 << SYSCON_CLKOUTCFG_SEL_SHIFT) /* CLKOUT source=USB clock */ -# define SYSCON_CLKOUTCFG_SEL_RTC (4 << SYSCON_CLKOUTCFG_SEL_SHIFT) /* CLKOUT source=RTC osc */ -#define SYSCON_CLKOUTCFG_DIV_SHIFT (4) /* Bits 4-7: CLKOUT divisor */ -#define SYSCON_CLKOUTCFG_DIV_MASK (15 << SYSCON_CLKOUTCFG_DIV_SHIFT) -# define SYSCON_CLKOUTCFG_DIV(n) ((n-1) << SYSCON_CLKOUTCFG_DIV_SHIFT) /* n=1..16 */ -#define SYSCON_CLKOUTCFG_EN (1 << 8) /* Bit 8: CLKOUT enable control */ -#define SYSCON_CLKOUTCFG_ACT (1 << 9) /* Bit 9: CLKOUT activity indication */ - /* Bits 10-31: Reserved */ -/* System control registers -- External Interrupts */ -/* External Interrupt Flag register */ - -#define SYSCON_EXTINT_EINT0 (1 << 0) /* Bit 0: EINT0 */ -#define SYSCON_EXTINT_EINT1 (1 << 1) /* Bit 1: EINT1 */ -#define SYSCON_EXTINT_EINT2 (1 << 2) /* Bit 2: EINT2 */ -#define SYSCON_EXTINT_EINT3 (1 << 3) /* Bit 3: EINT3 */ - /* Bits 4-31: Reserved */ -/* External Interrupt Mode register */ - -#define SYSCON_EXTMODE_EINT0 (1 << 0) /* Bit 0: 1=EINT0 edge sensitive */ -#define SYSCON_EXTMODE_EINT1 (1 << 1) /* Bit 1: 1=EINT1 edge sensitive */ -#define SYSCON_EXTMODE_EINT2 (1 << 2) /* Bit 2: 1=EINT2 edge sensitive */ -#define SYSCON_EXTMODE_EINT3 (1 << 3) /* Bit 3: 1=EINT3 edge sensitive */ - /* Bits 4-31: Reserved */ -/* External Interrupt Polarity register */ - -#define SYSCON_EXTPOLAR_EINT0 (1 << 0) /* Bit 0: 1=EINT0 high active/rising edge */ -#define SYSCON_EXTPOLAR_EINT1 (1 << 1) /* Bit 1: 1=EINT1 high active/rising edge */ -#define SYSCON_EXTPOLAR_EINT2 (1 << 2) /* Bit 2: 1=EINT2 high active/rising edge */ -#define SYSCON_EXTPOLAR_EINT3 (1 << 3) /* Bit 3: 1=EINT3 high active/rising edge */ - /* Bits 4-31: Reserved */ -/* System control registers -- Reset */ -/* Reset Source Identification Register */ - -#define SYSCON_RSID_POR (1 << 0) /* Bit 0: Power on reset */ -#define SYSCON_RSID_EXTR (1 << 1) /* Bit 1: external RESET signal */ -#define SYSCON_RSID_WDTR (1 << 2) /* Bit 2: Watchdog Timer time out w/WDTRESET */ -#define SYSCON_RSID_BODR (1 << 3) /* Bit 3: Brown out detection */ - /* Bits 4-31: Reserved */ -/* System control registers -- Syscon Miscellaneous Registers */ - - /* Bits 0-3: Reserved */ -#define SYSCON_SCS_OSCRANGE (1 << 4) /* Bit 4: Main oscillator range select */ -#define SYSCON_SCS_OSCEN (1 << 5) /* Bit 5: Main oscillator enable */ -#define SYSCON_SCS_OSCSTAT (1 << 6) /* Bit 6: Main oscillator status */ - /* Bits 7-31: Reserved */ -/* Device Interrupt Registers */ -/* USB Interrupt Status register */ - -#define SYSCON_USBINTST_REQLP (1 << 0) /* Bit 0: Low priority interrupt line status */ -#define SYSCON_USBINTST_REQHP (1 << 1) /* Bit 1: High priority interrupt line status */ -#define SYSCON_USBINTST_REQDMA (1 << 2) /* Bit 2: DMA interrupt line status */ -#define SYSCON_USBINTST_HOSTINT (1 << 3) /* Bit 3: USB host interrupt line status */ -#define SYSCON_USBINTST_ATXINT (1 << 4) /* Bit 4: External ATX interrupt line status */ -#define SYSCON_USBINTST_OTGINT (1 << 5) /* Bit 5: OTG interrupt line status */ -#define SYSCON_USBINTST_I2CINT (1 << 6) /* Bit 6: I2C module interrupt line status */ - /* Bit 7: Reserved */ -#define SYSCON_USBINTST_NEEDCLK (1 << 8) /* Bit 8: USB need clock indicator */ - /* Bits 9-30: Reserved */ -#define SYSCON_USBINTST_ENINTS (1 << 31) /* Bit 31: Enable all USB interrupts */ - -/* DMA Request Select Register */ - -#define SYSCON_DMAREQSEL_INP8 (1 << 0) /* Bit 0: Input 8 0=UART0 TX 1=Timer 0 match 0 */ -#define SYSCON_DMAREQSEL_INP9 (1 << 1) /* Bit 1: Input 8 0=UART0 RX 1=Timer 0 match 1 */ -#define SYSCON_DMAREQSEL_INP10 (1 << 2) /* Bit 2: Input 8 0=UART1 TX 1=Timer 1 match 0 */ -#define SYSCON_DMAREQSEL_INP11 (1 << 3) /* Bit 3: Input 8 0=UART1 RX 1=Timer 1 match 1 */ -#define SYSCON_DMAREQSEL_INP12 (1 << 4) /* Bit 4: Input 8 0=UART2 TX 1=Timer 2 match 0 */ -#define SYSCON_DMAREQSEL_INP13 (1 << 5) /* Bit 5: Input 8 0=UART2 RX 1=Timer 2 match 1 */ -#define SYSCON_DMAREQSEL_INP14 (1 << 6) /* Bit 6: Input 8 0=UART3 TX 1=Timer 3 match 0 */ -#define SYSCON_DMAREQSEL_INP15 (1 << 7) /* Bit 7: Input 8 0=UART3 RX 1=Timer 3 match 1 */ - /* Bits 8-31: Reserved */ - /************************************************************************************ * Public Types ************************************************************************************/ diff --git a/nuttx/arch/arm/src/lpc17xx/lpc17_gpio.c b/nuttx/arch/arm/src/lpc17xx/lpc17_gpio.c index 9db9b136b4..73939a3890 100644 --- a/nuttx/arch/arm/src/lpc17xx/lpc17_gpio.c +++ b/nuttx/arch/arm/src/lpc17xx/lpc17_gpio.c @@ -212,7 +212,7 @@ static int lpc17_pinsel(unsigned int port, unsigned int pin, unsigned int value) * ****************************************************************************/ -static int lpc17_pullup(uint16_t cfgset, unsigned int port, unsigned int pin) +static int lpc17_pullup(lpc17_pinset_t cfgset, unsigned int port, unsigned int pin) { const uint32_t *table; uint32_t regaddr; @@ -355,7 +355,7 @@ static void lpc17_clropendrain(unsigned int port, unsigned int pin) * ****************************************************************************/ -static inline int lpc17_configinput(uint16_t cfgset, unsigned int port, unsigned int pin) +static inline int lpc17_configinput(lpc17_pinset_t cfgset, unsigned int port, unsigned int pin) { uint32_t regval; uint32_t fiobase; @@ -419,7 +419,7 @@ static inline int lpc17_configinput(uint16_t cfgset, unsigned int port, unsigned * ****************************************************************************/ -static inline int lpc17_configinterrupt(uint16_t cfgset, unsigned int port, +static inline int lpc17_configinterrupt(lpc17_pinset_t cfgset, unsigned int port, unsigned int pin) { /* First, configure the port as a generic input so that we have a known @@ -445,7 +445,7 @@ static inline int lpc17_configinterrupt(uint16_t cfgset, unsigned int port, * ****************************************************************************/ -static inline int lpc17_configoutput(uint16_t cfgset, unsigned int port, +static inline int lpc17_configoutput(lpc17_pinset_t cfgset, unsigned int port, unsigned int pin) { uint32_t fiobase; @@ -494,7 +494,7 @@ static inline int lpc17_configoutput(uint16_t cfgset, unsigned int port, * ****************************************************************************/ -static int lpc17_configalternate(uint16_t cfgset, unsigned int port, +static int lpc17_configalternate(lpc17_pinset_t cfgset, unsigned int port, unsigned int pin, uint32_t alt) { /* First, configure the port as an input so that we have a known @@ -536,7 +536,7 @@ static int lpc17_configalternate(uint16_t cfgset, unsigned int port, * ****************************************************************************/ -int lpc17_configgpio(uint16_t cfgset) +int lpc17_configgpio(lpc17_pinset_t cfgset) { unsigned int port; unsigned int pin; @@ -597,7 +597,7 @@ int lpc17_configgpio(uint16_t cfgset) * ****************************************************************************/ -void lpc17_gpiowrite(uint16_t pinset, bool value) +void lpc17_gpiowrite(lpc17_pinset_t pinset, bool value) { uint32_t fiobase; uint32_t offset; @@ -637,7 +637,7 @@ void lpc17_gpiowrite(uint16_t pinset, bool value) * ****************************************************************************/ -bool lpc17_gpioread(uint16_t pinset) +bool lpc17_gpioread(lpc17_pinset_t pinset) { uint32_t fiobase; unsigned int port; diff --git a/nuttx/arch/arm/src/lpc17xx/lpc17_gpio.h b/nuttx/arch/arm/src/lpc17xx/lpc17_gpio.h index dad14bc9e2..f3a003255f 100644 --- a/nuttx/arch/arm/src/lpc17xx/lpc17_gpio.h +++ b/nuttx/arch/arm/src/lpc17xx/lpc17_gpio.h @@ -46,6 +46,8 @@ # include #endif +#include + #include "chip/lpc17_gpio.h" #include "chip/lpc17_pinconn.h" #include "chip/lpc17_pinconfig.h" @@ -55,6 +57,8 @@ ************************************************************************************/ /* Bit-encoded input to lpc17_configgpio() ******************************************/ +#if defined(LPC176x) + /* Encoding: FFFx MMOV PPPN NNNN * * Pin Function: FFF @@ -165,10 +169,153 @@ #define GPIO_PIN30 (30 << GPIO_PIN_SHIFT) #define GPIO_PIN31 (31 << GPIO_PIN_SHIFT) +#elif defined(LPC178x) + +/* Encoding: TT FFFF MMOV PPPN NNNN + Encoding: TTTT TTTT FFFF MMOV PPPN NNNN + */ +/* Encoding: FFFF MMOV PPPN NNNN + * + * Pin Function: FFFF + * Pin Mode bits: MM + * Open drain: O (output pins) + * Initial value: V (output pins) + * Port number: PPP (0-4) + * Pin number: NNNNN (0-31) + */ + +/* Pin Function bits: FFFF + * Only meaningful when the GPIO function is GPIO_PIN + */ + +#define GPIO_FUNC_SHIFT (12) /* Bits 12-15: GPIO mode */ +#define GPIO_FUNC_MASK (15 << GPIO_FUNC_SHIFT) +# define GPIO_INPUT (0 << GPIO_FUNC_SHIFT) /* 0000 GPIO input pin */ +# define GPIO_INTFE (1 << GPIO_FUNC_SHIFT) /* 0001 GPIO interrupt falling edge */ +# define GPIO_INTRE (2 << GPIO_FUNC_SHIFT) /* 0010 GPIO interrupt rising edge */ +# define GPIO_INTBOTH (3 << GPIO_FUNC_SHIFT) /* 0011 GPIO interrupt both edges */ +# define GPIO_OUTPUT (4 << GPIO_FUNC_SHIFT) /* 0100 GPIO outpout pin */ +# define GPIO_ALT1 (5 << GPIO_FUNC_SHIFT) /* 0101 Alternate function 1 */ +# define GPIO_ALT2 (6 << GPIO_FUNC_SHIFT) /* 0110 Alternate function 2 */ +# define GPIO_ALT3 (7 << GPIO_FUNC_SHIFT) /* 0111 Alternate function 3 */ + +# define GPIO_ALT4 (8 << GPIO_FUNC_SHIFT) /* 1000 Alternate function 4 */ +# define GPIO_ALT5 (9 << GPIO_FUNC_SHIFT) /* 1001 Alternate function 5 */ +# define GPIO_ALT6 (10 << GPIO_FUNC_SHIFT) /* 1010 Alternate function 6 */ +# define GPIO_ALT7 (11 << GPIO_FUNC_SHIFT) /* 1011 Alternate function 7 */ + +/* Options for each IOCON Types */ +//~ #define GPIO_TYPE_SHIFT (16) +//~ #define GPIO_TYPE_MASK (3 << GPIO_TYPE_SHIFT) +//~ # define GPIO_HYSTERIS (<< 0 << ) +//~ # define GPIO_INVERTED (<< 1 << ) +//~ # define GPIO_SLEW (<< 2 << ) +//~ # define GPIO_ADMODE (<< 3 << ) +//~ # define GPIO_FILTER (<< 4 << ) +//~ # define GPIO_DACEN (<< 5 << ) +//~ # define GPIO_I2CHS (<< 6 << ) +//~ # define GPIO_HIDRIVE (<< 7 << ) + +#define GPIO_EDGE_SHIFT (13) /* Bits 13-14: Interrupt edge bits */ +#define GPIO_EDGE_MASK (3 << GPIO_EDGE_SHIFT) + +#define GPIO_INOUT_MASK GPIO_OUTPUT +#define GPIO_FE_MASK GPIO_INTFE +#define GPIO_RE_MASK GPIO_INTRE + +#define GPIO_ISGPIO(ps) ((uint16_t(ps) & GPIO_FUNC_MASK) <= GPIO_OUTPUT) +#define GPIO_ISALT(ps) ((uint16_t(ps) & GPIO_FUNC_MASK) > GPIO_OUTPUT) +#define GPIO_ISINPUT(ps) (((ps) & GPIO_FUNC_MASK) == GPIO_INPUT) +#define GPIO_ISOUTPUT(ps) (((ps) & GPIO_FUNC_MASK) == GPIO_OUTPUT) +#define GPIO_ISINORINT(ps) (((ps) & GPIO_INOUT_MASK) == 0) +#define GPIO_ISOUTORALT(ps) (((ps) & GPIO_INOUT_MASK) != 0) +#define GPIO_ISINTERRUPT(ps) (GPIO_ISOUTPUT(ps) && !GPIO_ISINPUT(ps)) +#define GPIO_ISFE(ps) (((ps) & GPIO_FE_MASK) != 0) +#define GPIO_ISRE(ps) (((ps) & GPIO_RE_MASK) != 0) + +/* Pin Mode: MM */ + +#define GPIO_PUMODE_SHIFT (10) /* Bits 10-11: Pin pull-up mode */ +#define GPIO_PUMODE_MASK (3 << GPIO_PUMODE_SHIFT) +# define GPIO_PULLUP (0 << GPIO_PUMODE_SHIFT) /* Pull-up resistor enabled */ +# define GPIO_REPEATER (1 << GPIO_PUMODE_SHIFT) /* Repeater mode enabled */ +# define GPIO_FLOAT (2 << GPIO_PUMODE_SHIFT) /* Neither pull-up nor -down */ +# define GPIO_PULLDN (3 << GPIO_PUMODE_SHIFT) /* Pull-down resistor enabled */ + +/* Open drain: O */ + +#define GPIO_OPEN_DRAIN (1 << 9) /* Bit 9: Open drain mode */ + +/* Initial value: V */ + +#define GPIO_VALUE (1 << 8) /* Bit 8: Initial GPIO output value */ +#define GPIO_VALUE_ONE GPIO_VALUE +#define GPIO_VALUE_ZERO (0) + +/* Port number: PPP (0-5) */ + +#define GPIO_PORT_SHIFT (5) /* Bit 5-7: Port number */ +#define GPIO_PORT_MASK (7 << GPIO_PORT_SHIFT) +# define GPIO_PORT0 (0 << GPIO_PORT_SHIFT) +# define GPIO_PORT1 (1 << GPIO_PORT_SHIFT) +# define GPIO_PORT2 (2 << GPIO_PORT_SHIFT) +# define GPIO_PORT3 (3 << GPIO_PORT_SHIFT) +# define GPIO_PORT4 (4 << GPIO_PORT_SHIFT) +# define GPIO_PORT5 (5 << GPIO_PORT_SHIFT) + +#define GPIO_NPORTS 6 + +/* Pin number: NNNNN (0-31) */ + +#define GPIO_PIN_SHIFT 0 /* Bits 0-4: GPIO number: 0-31 */ +#define GPIO_PIN_MASK (31 << GPIO_PIN_SHIFT) +#define GPIO_PIN0 (0 << GPIO_PIN_SHIFT) +#define GPIO_PIN1 (1 << GPIO_PIN_SHIFT) +#define GPIO_PIN2 (2 << GPIO_PIN_SHIFT) +#define GPIO_PIN3 (3 << GPIO_PIN_SHIFT) +#define GPIO_PIN4 (4 << GPIO_PIN_SHIFT) +#define GPIO_PIN5 (5 << GPIO_PIN_SHIFT) +#define GPIO_PIN6 (6 << GPIO_PIN_SHIFT) +#define GPIO_PIN7 (7 << GPIO_PIN_SHIFT) +#define GPIO_PIN8 (8 << GPIO_PIN_SHIFT) +#define GPIO_PIN9 (9 << GPIO_PIN_SHIFT) +#define GPIO_PIN10 (10 << GPIO_PIN_SHIFT) +#define GPIO_PIN11 (11 << GPIO_PIN_SHIFT) +#define GPIO_PIN12 (12 << GPIO_PIN_SHIFT) +#define GPIO_PIN13 (13 << GPIO_PIN_SHIFT) +#define GPIO_PIN14 (14 << GPIO_PIN_SHIFT) +#define GPIO_PIN15 (15 << GPIO_PIN_SHIFT) +#define GPIO_PIN16 (16 << GPIO_PIN_SHIFT) +#define GPIO_PIN17 (17 << GPIO_PIN_SHIFT) +#define GPIO_PIN18 (18 << GPIO_PIN_SHIFT) +#define GPIO_PIN19 (19 << GPIO_PIN_SHIFT) +#define GPIO_PIN20 (20 << GPIO_PIN_SHIFT) +#define GPIO_PIN21 (21 << GPIO_PIN_SHIFT) +#define GPIO_PIN22 (22 << GPIO_PIN_SHIFT) +#define GPIO_PIN23 (23 << GPIO_PIN_SHIFT) +#define GPIO_PIN24 (24 << GPIO_PIN_SHIFT) +#define GPIO_PIN25 (25 << GPIO_PIN_SHIFT) +#define GPIO_PIN26 (26 << GPIO_PIN_SHIFT) +#define GPIO_PIN27 (27 << GPIO_PIN_SHIFT) +#define GPIO_PIN28 (28 << GPIO_PIN_SHIFT) +#define GPIO_PIN29 (29 << GPIO_PIN_SHIFT) +#define GPIO_PIN30 (30 << GPIO_PIN_SHIFT) +#define GPIO_PIN31 (31 << GPIO_PIN_SHIFT) + +#else +# error "Unrecognized LPC17xx family" +#endif + /************************************************************************************ * Public Types ************************************************************************************/ +#ifdef LPC176x +typedef uint16_t lpc17_pinset_t; +#else +typedef uint32_t lpc17_pinset_t; +#endif + /************************************************************************************ * Public Data ************************************************************************************/ @@ -204,6 +351,92 @@ EXTERN const uint32_t g_odmode[GPIO_NPORTS]; * Public Functions ****************************************************************************/ +/************************************************************************************ + * Name: lpc17_gpioirqinitialize + * + * Description: + * Initialize logic to support a second level of interrupt decoding for GPIO pins. + * + ************************************************************************************/ + +#ifdef CONFIG_GPIO_IRQ +void lpc17_gpioirqinitialize(void); +#else +# define lpc17_gpioirqinitialize() +#endif + +/************************************************************************************ + * Name: lpc17_configgpio + * + * Description: + * Configure a GPIO pin based on bit-encoded description of the pin. + * + ************************************************************************************/ + +int lpc17_configgpio(lpc17_pinset_t cfgset); + +/************************************************************************************ + * Name: lpc17_gpiowrite + * + * Description: + * Write one or zero to the selected GPIO pin + * + ************************************************************************************/ + +void lpc17_gpiowrite(lpc17_pinset_t pinset, bool value); + +/************************************************************************************ + * Name: lpc17_gpioread + * + * Description: + * Read one or zero from the selected GPIO pin + * + ************************************************************************************/ + +bool lpc17_gpioread(lpc17_pinset_t pinset); + +/************************************************************************************ + * Name: lpc17_gpioirqenable + * + * Description: + * Enable the interrupt for specified GPIO IRQ + * + ************************************************************************************/ + +#ifdef CONFIG_GPIO_IRQ +void lpc17_gpioirqenable(int irq); +#else +# define lpc17_gpioirqenable(irq) +#endif + +/************************************************************************************ + * Name: lpc17_gpioirqdisable + * + * Description: + * Disable the interrupt for specified GPIO IRQ + * + ************************************************************************************/ + +#ifdef CONFIG_GPIO_IRQ +void lpc17_gpioirqdisable(int irq); +#else +# define lpc17_gpioirqdisable(irq) +#endif + +/************************************************************************************ + * Function: lpc17_dumpgpio + * + * Description: + * Dump all GPIO registers associated with the base address of the provided pinset. + * + ************************************************************************************/ + +#ifdef CONFIG_DEBUG_GPIO +int lpc17_dumpgpio(lpc17_pinset_t pinset, const char *msg); +#else +# define lpc17_dumpgpio(p,m) +#endif + #ifdef __cplusplus } #endif From eb1e5b46af1a5161017553941970163995e00505 Mon Sep 17 00:00:00 2001 From: patacongo Date: Fri, 18 Jan 2013 21:05:17 +0000 Subject: [PATCH 090/118] Add vectors for the LPC1788 - from Rommel Marcelo git-svn-id: http://svn.code.sf.net/p/nuttx/code/trunk@5536 42af7a65-404d-4744-a932-0658087f49c3 --- nuttx/arch/arm/include/lpc17xx/lpc178x_irq.h | 2 +- .../arm/src/lpc17xx/chip/lpc176x_vectors.h | 110 ++++++++++++++++ .../arm/src/lpc17xx/chip/lpc178x_vectors.h | 117 ++++++++++++++++++ nuttx/arch/arm/src/lpc17xx/lpc17_vectors.S | 101 +++++---------- 4 files changed, 258 insertions(+), 72 deletions(-) create mode 100644 nuttx/arch/arm/src/lpc17xx/chip/lpc176x_vectors.h create mode 100644 nuttx/arch/arm/src/lpc17xx/chip/lpc178x_vectors.h diff --git a/nuttx/arch/arm/include/lpc17xx/lpc178x_irq.h b/nuttx/arch/arm/include/lpc17xx/lpc178x_irq.h index 9f7cbf9a77..65738e1c74 100644 --- a/nuttx/arch/arm/include/lpc17xx/lpc178x_irq.h +++ b/nuttx/arch/arm/include/lpc17xx/lpc178x_irq.h @@ -95,7 +95,7 @@ #define LPC17_IRQ_I2C0 (LPC17_IRQ_EXTINT+10) /* I2C0 SI (state change) */ #define LPC17_IRQ_I2C1 (LPC17_IRQ_EXTINT+11) /* I2C1 SI (state change) */ #define LPC17_IRQ_I2C2 (LPC17_IRQ_EXTINT+12) /* I2C2 SI (state change) */ -/* (LPC17_IRQ_EXTINT+13) Unused */ +#define LPC17_IRQ_RESERVED29 (LPC17_IRQ_EXTINT+13) /* Unused */ #define LPC17_IRQ_SSP0 (LPC17_IRQ_EXTINT+14) /* SSP0 Tx FIFO half empty of SSP0 * Rx FIFO half full of SSP0 * Rx Timeout of SSP0 diff --git a/nuttx/arch/arm/src/lpc17xx/chip/lpc176x_vectors.h b/nuttx/arch/arm/src/lpc17xx/chip/lpc176x_vectors.h new file mode 100644 index 0000000000..d6320bd123 --- /dev/null +++ b/nuttx/arch/arm/src/lpc17xx/chip/lpc176x_vectors.h @@ -0,0 +1,110 @@ +/******************************************************************************** + * arch/arm/src/lpc17xx/chip/lpc176x_vectors.h + * + * Copyright (C) 2010-2011, 2013 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * 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. + * + ********************************************************************************/ + +/******************************************************************************** + * Included Files + ********************************************************************************/ + +/******************************************************************************** + * Preprocessor Definitions + ********************************************************************************/ +/* This file is included by lpc17_vectors.S. It provides the macro VECTOR that + * supplies each LPC17xx vector in terms of a (lower-case) ISR label and an + * (upper-case) IRQ number as defined in arch/arm/include/lpc17/lpc17xx_irq.h. + * lpc17_vectors.S will defined the VECTOR in different ways in order to generate + * the interrupt vectors and handlers in their final form. + */ + +/* If the common ARMv7-M vector handling is used, then all it needs is the following + * definition that provides the number of supported vectors. + */ + +#ifdef CONFIG_ARMV7M_CMNVECTOR + +/* Reserve 35 interrupt table entries for I/O interrupts. */ + +# define ARMV7M_PERIPHERAL_INTERRUPTS 35 + +#else + +VECTOR(lpc17_wdt, LPC17_IRQ_WDT) /* Vector 16+0: Watchdog timer */ +VECTOR(lpc17_tmr0, LPC17_IRQ_TMR0) /* Vector 16+1: Timer 0 */ +VECTOR(lpc17_tmr1, LPC17_IRQ_TMR1) /* Vector 16+2: Timer 1 */ +VECTOR(lpc17_tmr2, LPC17_IRQ_TMR2) /* Vector 16+3: Timer 2 */ +VECTOR(lpc17_tmr3, LPC17_IRQ_TMR3) /* Vector 16+4: Timer 3 */ +VECTOR(lpc17_uart0, LPC17_IRQ_UART0) /* Vector 16+5: UART 0 */ +VECTOR(lpc17_uart1, LPC17_IRQ_UART1) /* Vector 16+6: UART 1 */ +VECTOR(lpc17_uart2, LPC17_IRQ_UART2) /* Vector 16+7: UART 2 */ +VECTOR(lpc17_uart3, LPC17_IRQ_UART3) /* Vector 16+8: UART 3 */ +VECTOR(lpc17_pwm1, LPC17_IRQ_PWM1) /* Vector 16+9: PWM 1 */ +VECTOR(lpc17_i2c0, LPC17_IRQ_I2C0) /* Vector 16+10: I2C 0 */ +VECTOR(lpc17_i2c1, LPC17_IRQ_I2C1) /* Vector 16+11: I2C 1 */ +VECTOR(lpc17_i2c2, LPC17_IRQ_I2C2) /* Vector 16+12: I2C 2 */ +VECTOR(lpc17_spif, LPC17_IRQ_SPIF) /* Vector 16+13: SPI */ +VECTOR(lpc17_ssp0, LPC17_IRQ_SSP0) /* Vector 16+14: SSP 0 */ +VECTOR(lpc17_ssp1, LPC17_IRQ_SSP1) /* Vector 16+15: SSP 1 */ +VECTOR(lpc17_pll0, LPC17_IRQ_PLL0) /* Vector 16+16: PLL 0 */ +VECTOR(lpc17_rtc, LPC17_IRQ_RTC) /* Vector 16+17: Real time clock */ +VECTOR(lpc17_eint0, LPC17_IRQ_EINT0) /* Vector 16+18: External interrupt 0 */ +VECTOR(lpc17_eint1, LPC17_IRQ_EINT1) /* Vector 16+19: External interrupt 1 */ +VECTOR(lpc17_eint2, LPC17_IRQ_EINT2) /* Vector 16+20: External interrupt 2 */ +VECTOR(lpc17_eint3, LPC17_IRQ_EINT3) /* Vector 16+21: External interrupt 3 */ +VECTOR(lpc17_adc, LPC17_IRQ_ADC) /* Vector 16+22: A/D Converter */ +VECTOR(lpc17_bod, LPC17_IRQ_BOD) /* Vector 16+23: Brown Out detect */ +VECTOR(lpc17_usb, LPC17_IRQ_USB) /* Vector 16+24: USB */ +VECTOR(lpc17_can, LPC17_IRQ_CAN) /* Vector 16+25: CAN */ +VECTOR(lpc17_gpdma, LPC17_IRQ_GPDMA) /* Vector 16+26: GPDMA */ +VECTOR(lpc17_i2s, LPC17_IRQ_I2S) /* Vector 16+27: I2S */ +VECTOR(lpc17_eth, LPC17_IRQ_ETH) /* Vector 16+28: Ethernet */ +VECTOR(lpc17_ritint, LPC17_IRQ_RITINT) /* Vector 16+29: Repetitive Interrupt Timer */ +VECTOR(lpc17_mcpwm, LPC17_IRQ_MCPWM) /* Vector 16+30: Motor Control PWM */ +VECTOR(lpc17_qei, LPC17_IRQ_QEI) /* Vector 16+31: Quadrature Encoder */ +VECTOR(lpc17_pll1, LPC17_IRQ_PLL1) /* Vector 16+32: PLL 1 */ +VECTOR(lpc17_usbact, LPC17_IRQ_USBACT) /* Vector 16+33: USB Activity Interrupt */ +VECTOR(lpc17_canact, LPC17_IRQ_CANACT) /* Vector 16+34: CAN Activity Interrupt */ + +#endif + +/******************************************************************************** + * Public Types + ********************************************************************************/ + +/******************************************************************************** + * Public Data + ********************************************************************************/ + +/******************************************************************************** + * Public Function Prototypes + ********************************************************************************/ diff --git a/nuttx/arch/arm/src/lpc17xx/chip/lpc178x_vectors.h b/nuttx/arch/arm/src/lpc17xx/chip/lpc178x_vectors.h new file mode 100644 index 0000000000..001cc7690e --- /dev/null +++ b/nuttx/arch/arm/src/lpc17xx/chip/lpc178x_vectors.h @@ -0,0 +1,117 @@ +/************************************************************************************************ + * arch/arm/src/lpc17xx/chip/lpc178x_vectors.h + * + * Copyright (C) 2013 Gregory Nutt. All rights reserved. + * Author: Rommel Marcelo + * Gregory Nutt + * + * 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. + * + ********************************************************************************/ + +/******************************************************************************** + * Included Files + ********************************************************************************/ + +/********************************************************************************* + * Preprocessor Definitions + ********************************************************************************/ +/* This file is included by lpc17_vectors.S. It provides the macro VECTOR that + * supplies each LPC17xx vector in terms of a (lower-case) ISR label and an + * (upper-case) IRQ number as defined in arch/arm/include/lpc17/lpc17xx_irq.h. + * lpc17_vectors.S will defined the VECTOR in different ways in order to generate + * the interrupt vectors and handlers in their final form. + */ + +/* If the common ARMv7-M vector handling is used, then all it needs is the following + * definition that provides the number of supported vectors. + */ + +#ifdef CONFIG_ARMV7M_CMNVECTOR + +/* Reserve 41 interrupt table entries for I/O interrupts. */ + +# define ARMV7M_PERIPHERAL_INTERRUPTS 41 + +#else + +VECTOR(lpc17_wdt, LPC17_IRQ_WDT) /* Vector 16+0: Watchdog timer */ +VECTOR(lpc17_tmr0, LPC17_IRQ_TMR0) /* Vector 16+1: Timer 0 */ +VECTOR(lpc17_tmr1, LPC17_IRQ_TMR1) /* Vector 16+2: Timer 1 */ +VECTOR(lpc17_tmr2, LPC17_IRQ_TMR2) /* Vector 16+3: Timer 2 */ +VECTOR(lpc17_tmr3, LPC17_IRQ_TMR3) /* Vector 16+4: Timer 3 */ +VECTOR(lpc17_uart0, LPC17_IRQ_UART0) /* Vector 16+5: UART 0 */ +VECTOR(lpc17_uart1, LPC17_IRQ_UART1) /* Vector 16+6: UART 1 */ +VECTOR(lpc17_uart2, LPC17_IRQ_UART2) /* Vector 16+7: UART 2 */ +VECTOR(lpc17_uart3, LPC17_IRQ_UART3) /* Vector 16+8: UART 3 */ +VECTOR(lpc17_pwm1, LPC17_IRQ_PWM1) /* Vector 16+9: PWM 1 */ +VECTOR(lpc17_i2c0, LPC17_IRQ_I2C0) /* Vector 16+10: I2C 0 */ +VECTOR(lpc17_i2c1, LPC17_IRQ_I2C1) /* Vector 16+11: I2C 1 */ +VECTOR(lpc17_i2c2, LPC17_IRQ_I2C2) /* Vector 16+12: I2C 2 */ +UNUSED(LPC17_IRQ_RESERVED29) /* Vector 16+13: Reserved */ +VECTOR(lpc17_ssp0, LPC17_IRQ_SSP0) /* Vector 16+14: SSP 0 */ +VECTOR(lpc17_ssp1, LPC17_IRQ_SSP1) /* Vector 16+15: SSP 1 */ +VECTOR(lpc17_pll0, LPC17_IRQ_PLL0) /* Vector 16+16: PLL 0 */ +VECTOR(lpc17_rtc, LPC17_IRQ_RTC) /* Vector 16+17: Real time clock */ +VECTOR(lpc17_eint0, LPC17_IRQ_EINT0) /* Vector 16+18: External interrupt 0 */ +VECTOR(lpc17_eint1, LPC17_IRQ_EINT1) /* Vector 16+19: External interrupt 1 */ +VECTOR(lpc17_eint2, LPC17_IRQ_EINT2) /* Vector 16+20: External interrupt 2 */ +VECTOR(lpc17_eint3, LPC17_IRQ_EINT3) /* Vector 16+21: External interrupt 3 */ +VECTOR(lpc17_adc, LPC17_IRQ_ADC) /* Vector 16+22: A/D Converter */ +VECTOR(lpc17_bod, LPC17_IRQ_BOD) /* Vector 16+23: Brown Out detect */ +VECTOR(lpc17_usb, LPC17_IRQ_USB) /* Vector 16+24: USB */ +VECTOR(lpc17_can, LPC17_IRQ_CAN) /* Vector 16+25: CAN */ +VECTOR(lpc17_gpdma, LPC17_IRQ_GPDMA) /* Vector 16+26: GPDMA */ +VECTOR(lpc17_i2s, LPC17_IRQ_I2S) /* Vector 16+27: I2S */ +VECTOR(lpc17_eth, LPC17_IRQ_ETH) /* Vector 16+28: Ethernet */ +VECTOR(lpc17_mci, LPC17_IRQ_MCI) /* Vector 16+29: MMC/SD */ +VECTOR(lpc17_mcpwm, LPC17_IRQ_MCPWM) /* Vector 16+30: Motor Control PWM */ +VECTOR(lpc17_qei, LPC17_IRQ_QEI) /* Vector 16+31: Quadrature Encoder */ +VECTOR(lpc17_pll1, LPC17_IRQ_PLL1) /* Vector 16+32: PLL 1 */ +VECTOR(lpc17_usbact, LPC17_IRQ_USBACT) /* Vector 16+33: USB Activity Interrupt */ +VECTOR(lpc17_canact, LPC17_IRQ_CANACT) /* Vector 16+34: CAN Activity Interrupt */ +VECTOR(lpc17_uart4, LPC17_IRQ_UART4) /* Vector 16+35: UART 4 */ +VECTOR(lpc17_ssp2, LPC17_IRQ_SSP2) /* Vector 16+36: SSP 2 */ +VECTOR(lpc17_lcd, LPC17_IRQ_LCD) /* Vector 16+37: LCD */ +VECTOR(lpc17_gpio, LPC17_IRQ_GPIO) /* Vector 16+38: GPIO */ +VECTOR(lpc17_pwm0, LPC17_IRQ_PWM0) /* Vector 16+39: PWM0 */ +VECTOR(lpc17_eeprom, LPC17_IRQ_EEPROM) /* Vector 16+40: EEPROM */ + +#endif + +/******************************************************************************** + * Public Types + ********************************************************************************/ + +/******************************************************************************** + * Public Data + ********************************************************************************/ + +/******************************************************************************** + * Public Function Prototypes + ********************************************************************************/ diff --git a/nuttx/arch/arm/src/lpc17xx/lpc17_vectors.S b/nuttx/arch/arm/src/lpc17xx/lpc17_vectors.S index cdb4bef66c..74e53b4115 100644 --- a/nuttx/arch/arm/src/lpc17xx/lpc17_vectors.S +++ b/nuttx/arch/arm/src/lpc17xx/lpc17_vectors.S @@ -2,7 +2,7 @@ * arch/arm/src/lpc17xx/lpc17_vectors.S * arch/arm/src/chip/lpc17_vectors.S * - * Copyright (C) 2010-2011 Gregory Nutt. All rights reserved. + * Copyright (C) 2010-2011, 2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -128,41 +128,20 @@ lpc17_vectors: /* External Interrupts */ - .word lpc17_wdt /* Vector 16+0: Watchdog timer */ - .word lpc17_tmr0 /* Vector 16+1: Timer 0 */ - .word lpc17_tmr1 /* Vector 16+2: Timer 1 */ - .word lpc17_tmr2 /* Vector 16+3: Timer 2 */ - .word lpc17_tmr3 /* Vector 16+4: Timer 3 */ - .word lpc17_uart0 /* Vector 16+5: UART 0 */ - .word lpc17_uart1 /* Vector 16+6: UART 1 */ - .word lpc17_uart2 /* Vector 16+7: UART 2 */ - .word lpc17_uart3 /* Vector 16+8: UART 3 */ - .word lpc17_pwm1 /* Vector 16+9: PWM */ - .word lpc17_i2c0 /* Vector 16+10: I2C 0 */ - .word lpc17_i2c1 /* Vector 16+11: I2C 1 */ - .word lpc17_i2c2 /* Vector 16+12: I2C 2 */ - .word lpc17_spif /* Vector 16+13: SPI */ - .word lpc17_ssp0 /* Vector 16+14: SSP 0 */ - .word lpc17_ssp1 /* Vector 16+15: SSP 1 */ - .word lpc17_pll0 /* Vector 16+16: PLL 0 */ - .word lpc17_rtc /* Vector 16+17: Real time clock */ - .word lpc17_eint0 /* Vector 16+18: External interrupt 0 */ - .word lpc17_eint1 /* Vector 16+19: External interrupt 1 */ - .word lpc17_eint2 /* Vector 16+20: External interrupt 2 */ - .word lpc17_eint3 /* Vector 16+21: External interrupt 3 */ - .word lpc17_adc /* Vector 16+22: A/D Converter */ - .word lpc17_bod /* Vector 16+23: Brown Out detect */ - .word lpc17_usb /* Vector 16+24: USB */ - .word lpc17_can /* Vector 16+25: CAN */ - .word lpc17_gpdma /* Vector 16+26: GPDMA */ - .word lpc17_i2s /* Vector 16+27: I2S */ - .word lpc17_eth /* Vector 16+28: Ethernet */ - .word lpc17_ritint /* Vector 16+29: Repetitive Interrupt Timer */ - .word lpc17_mcpwm /* Vector 16+30: Motor Control PWM */ - .word lpc17_qei /* Vector 16+31: Quadrature Encoder */ - .word lpc17_pll1 /* Vector 16+32: PLL 1 */ - .word lpc17_usbact /* Vector 16+33: USB Activity Interrupt */ - .word lpc17_canact /* Vector 16+34: CAN Activity Interrupt */ +#undef VECTOR +#define VECTOR(l,i) .word l + +#undef UNUSED +#define UNUSED(i) .word lpc17_reserved + +#if defined(LPC176x) +# include "chip/lpc176x_vectors.h" +#elif defined(LPC178x) +# include "chip/lpc178x_vectors.h" +#else +# error "Unrecognized LPC17xx family" +#endif + .size lpc17_vectors, .-lpc17_vectors /************************************************************************************************ @@ -184,41 +163,21 @@ handlers: HANDLER lpc17_pendsv, LPC17_IRQ_PENDSV /* Vector 14: Penable system service request */ HANDLER lpc17_systick, LPC17_IRQ_SYSTICK /* Vector 15: System tick */ - HANDLER lpc17_wdt, LPC17_IRQ_WDT /* Vector 16+0: Watchdog timer */ - HANDLER lpc17_tmr0, LPC17_IRQ_TMR0 /* Vector 16+1: Timer 0 */ - HANDLER lpc17_tmr1, LPC17_IRQ_TMR1 /* Vector 16+2: Timer 1 */ - HANDLER lpc17_tmr2, LPC17_IRQ_TMR2 /* Vector 16+3: Timer 2 */ - HANDLER lpc17_tmr3, LPC17_IRQ_TMR3 /* Vector 16+4: Timer 3 */ - HANDLER lpc17_uart0, LPC17_IRQ_UART0 /* Vector 16+5: UART 0 */ - HANDLER lpc17_uart1, LPC17_IRQ_UART1 /* Vector 16+6: UART 1 */ - HANDLER lpc17_uart2, LPC17_IRQ_UART2 /* Vector 16+7: UART 2 */ - HANDLER lpc17_uart3, LPC17_IRQ_UART3 /* Vector 16+8: UART 3 */ - HANDLER lpc17_pwm1, LPC17_IRQ_PWM1 /* Vector 16+9: PWM 1 */ - HANDLER lpc17_i2c0, LPC17_IRQ_I2C0 /* Vector 16+10: I2C 0 */ - HANDLER lpc17_i2c1, LPC17_IRQ_I2C1 /* Vector 16+11: I2C 1 */ - HANDLER lpc17_i2c2, LPC17_IRQ_I2C2 /* Vector 16+12: I2C 2 */ - HANDLER lpc17_spif, LPC17_IRQ_SPIF /* Vector 16+13: SPI */ - HANDLER lpc17_ssp0, LPC17_IRQ_SSP0 /* Vector 16+14: SSP 0 */ - HANDLER lpc17_ssp1, LPC17_IRQ_SSP1 /* Vector 16+15: SSP 1 */ - HANDLER lpc17_pll0, LPC17_IRQ_PLL0 /* Vector 16+16: PLL 0 */ - HANDLER lpc17_rtc, LPC17_IRQ_RTC /* Vector 16+17: Real time clock */ - HANDLER lpc17_eint0, LPC17_IRQ_EINT0 /* Vector 16+18: External interrupt 0 */ - HANDLER lpc17_eint1, LPC17_IRQ_EINT1 /* Vector 16+19: External interrupt 1 */ - HANDLER lpc17_eint2, LPC17_IRQ_EINT2 /* Vector 16+20: External interrupt 2 */ - HANDLER lpc17_eint3, LPC17_IRQ_EINT3 /* Vector 16+21: External interrupt 3 */ - HANDLER lpc17_adc, LPC17_IRQ_ADC /* Vector 16+22: A/D Converter */ - HANDLER lpc17_bod, LPC17_IRQ_BOD /* Vector 16+23: Brown Out detect */ - HANDLER lpc17_usb, LPC17_IRQ_USB /* Vector 16+24: USB */ - HANDLER lpc17_can, LPC17_IRQ_CAN /* Vector 16+25: CAN */ - HANDLER lpc17_gpdma, LPC17_IRQ_GPDMA /* Vector 16+26: GPDMA */ - HANDLER lpc17_i2s, LPC17_IRQ_I2S /* Vector 16+27: I2S */ - HANDLER lpc17_eth, LPC17_IRQ_ETH /* Vector 16+28: Ethernet */ - HANDLER lpc17_ritint, LPC17_IRQ_RITINT /* Vector 16+29: Repetitive Interrupt Timer */ - HANDLER lpc17_mcpwm, LPC17_IRQ_MCPWM /* Vector 16+30: Motor Control PWM */ - HANDLER lpc17_qei, LPC17_IRQ_QEI /* Vector 16+31: Quadrature Encoder */ - HANDLER lpc17_pll1, LPC17_IRQ_PLL1 /* Vector 16+32: PLL 1 */ - HANDLER lpc17_usbact, LPC17_IRQ_USBACT /* Vector 16+33: USB Activity Interrupt */ - HANDLER lpc17_canact, LPC17_IRQ_CANACT /* Vector 16+34: CAN Activity Interrupt */ +/* External Interrupts */ + +#undef VECTOR +#define VECTOR(l,i) HANDLER l, i + +#undef UNUSED +#define UNUSED(i) + +#if defined(LPC176x) +# include "chip/lpc176x_vectors.h" +#elif defined(LPC178x) +# include "chip/lpc178x_vectors.h" +#else +# error "Unrecognized LPC17xx family" +#endif /* Common IRQ handling logic. On entry here, the return stack is on either * the PSP or the MSP and looks like the following: From 53e8b454bf671e2b7e2cfe1898468543ab231984 Mon Sep 17 00:00:00 2001 From: patacongo Date: Fri, 18 Jan 2013 22:42:37 +0000 Subject: [PATCH 091/118] Add configuration for Wave Share Open1788 (fragmentary) git-svn-id: http://svn.code.sf.net/p/nuttx/code/trunk@5537 42af7a65-404d-4744-a932-0658087f49c3 --- nuttx/ChangeLog | 5 + nuttx/arch/Kconfig | 125 ++++ nuttx/arch/arm/src/lpc17xx/Kconfig | 8 + nuttx/arch/arm/src/lpc31xx/Kconfig | 85 +-- .../arch/arm/src/lpc31xx/lpc31_allocateheap.c | 32 +- nuttx/arch/arm/src/lpc31xx/lpc31_boot.c | 6 +- nuttx/arch/arm/src/lpc31xx/lpc31_memorymap.h | 8 +- nuttx/configs/Kconfig | 12 + nuttx/configs/ea3131/README.txt | 22 +- nuttx/configs/ea3131/nsh/defconfig | 22 +- nuttx/configs/ea3131/ostest/defconfig | 22 +- nuttx/configs/ea3131/pgnsh/defconfig | 22 +- nuttx/configs/ea3131/src/Makefile | 2 +- nuttx/configs/ea3131/src/ea3131_internal.h | 2 +- nuttx/configs/ea3131/src/up_boot.c | 2 +- nuttx/configs/ea3131/src/up_mem.c | 4 +- nuttx/configs/ea3131/usbserial/defconfig | 22 +- nuttx/configs/ea3131/usbstorage/defconfig | 22 +- nuttx/configs/ea3152/README.txt | 22 +- nuttx/configs/ea3152/ostest/defconfig | 22 +- nuttx/configs/ea3152/src/Makefile | 2 +- nuttx/configs/ea3152/src/ea3152_internal.h | 2 +- nuttx/configs/ea3152/src/up_boot.c | 2 +- nuttx/configs/ea3152/src/up_mem.c | 4 +- nuttx/configs/open1788/Kconfig | 7 + nuttx/configs/open1788/README.txt | 38 ++ nuttx/configs/open1788/ostest/Make.defs | 109 ++++ nuttx/configs/open1788/ostest/defconfig | 604 ++++++++++++++++++ nuttx/configs/open1788/ostest/setenv.sh | 73 +++ nuttx/configs/open1788/scripts/ld.script | 135 ++++ 30 files changed, 1254 insertions(+), 189 deletions(-) create mode 100644 nuttx/configs/open1788/Kconfig create mode 100644 nuttx/configs/open1788/README.txt create mode 100644 nuttx/configs/open1788/ostest/Make.defs create mode 100644 nuttx/configs/open1788/ostest/defconfig create mode 100755 nuttx/configs/open1788/ostest/setenv.sh create mode 100755 nuttx/configs/open1788/scripts/ld.script diff --git a/nuttx/ChangeLog b/nuttx/ChangeLog index c61479cadb..a5bcaf1bce 100644 --- a/nuttx/ChangeLog +++ b/nuttx/ChangeLog @@ -3982,3 +3982,8 @@ * configs/olimex-lpc1766stk/nsh: Convert configuration to use the kconfig-frontends tools. * sched/task_reparent.c: Simplify reparenting interface. + * arch/arm/src/[many]: More LPC1788 definitions from Rommel + Marcelo incorporated. + * configs/open1788: Board configuration for the Wave Share + Open1788 board. Still fragmentary (contribnuted by Rommel + Marcelo, adapted to use kconfig-frontends. diff --git a/nuttx/arch/Kconfig b/nuttx/arch/Kconfig index d43137adb9..c0f235c5d3 100644 --- a/nuttx/arch/Kconfig +++ b/nuttx/arch/Kconfig @@ -103,6 +103,131 @@ source arch/x86/Kconfig source arch/z16/Kconfig source arch/z80/Kconfig +comment "External Memory Configuration" + +config ARCH_HAVE_EXTNAND + bool + +config ARCH_HAVE_EXTNOR + bool + +config ARCH_HAVE_EXTDRAM + bool + +config ARCH_HAVE_EXTSRAM0 + bool + +config ARCH_HAVE_EXTSRAM1 + bool + +config ARCH_EXTNAND + bool "Configure external NAND" + default n + depends on ARCH_HAVE_EXTNAND + ---help--- + Configure external NAND memory and, if applicable, map then external + NAND into the memory map. + +if ARCH_EXTNAND + +config ARCH_EXTNANDSIZE + int "External NAND size" + default 0 + ---help--- + Size of the external NAND in bytes. + +endif + +config ARCH_EXTNOR + bool "Configure external NOR memory" + default n + depends on ARCH_HAVE_EXTNOR + ---help--- + Configure external NOR memory and, if applicable, map then external + NOR into the memory map. + +if ARCH_EXTNOR + +config ARCH_EXTNORSIZE + int "External NOR size" + default 0 + ---help--- + Size of the external NOR in bytes. + +endif + +config ARCH_EXTDRAM + bool "Configure external DRAM" + default n + depends on ARCH_HAVE_EXTDRAM + ---help--- + Configure external DRAM memory and, if applicable, map then external + DRAM into the memory map. + +if ARCH_EXTDRAM + +config ARCH_EXTDRAMSIZE + int "External SDRAM size" + default 0 + ---help--- + Size of the external SDRAM in bytes. + +config ARCH_EXTDRAMHEAP + bool "Add external SDRAM to the heap" + default y + ---help--- + Add the external SDRAM into the heap. + +endif + +config ARCH_EXTSRAM0 + bool "Configure external SRAM (Bank 0)" + default n + depends on ARCH_HAVE_EXTSRAM0 + ---help--- + Configure external SRAM Bank 0 memory and, if applicable, map then + external SRAM Bank 0 into the memory map. + +if ARCH_EXTSRAM0 + +config ARCH_EXTSRAM0SIZE + int "External SRAM size" + default 0 + ---help--- + Size of the external SRAM Bank 0 in bytes. + +config ARCH_EXTSRAM0HEAP + bool "Add external SRAM (Bank 0) to the heap" + default y + ---help--- + Add external SRAM Bank 0 into the heap. + +endif + +config ARCH_EXTSRAM1 + bool "Configure external SRAM (Bank 1)" + default n + depends on ARCH_HAVE_EXTSRAM1 + ---help--- + Configure external SRAM Bank 1 memory and, if applicable, map then + external SRAM Bank 1 into the memory map. + +if ARCH_EXTSRAM1 + +config ARCH_EXTSRAM1SIZE + int "External SRAM1 size" + default 0 + ---help--- + Size of the external SRAM Bank 1 in bytes. + +config ARCH_EXTSRAM1HEAP + bool "Add external SRAM (Bank 1) to the heap" + default y + ---help--- + Add external SRAM Bank 1 into the heap. + +endif + comment "Architecture Options" config ARCH_NOINTC diff --git a/nuttx/arch/arm/src/lpc17xx/Kconfig b/nuttx/arch/arm/src/lpc17xx/Kconfig index b7dd7ac34b..22ba6fa044 100644 --- a/nuttx/arch/arm/src/lpc17xx/Kconfig +++ b/nuttx/arch/arm/src/lpc17xx/Kconfig @@ -104,9 +104,17 @@ config ARCH_FAMILY_LPC176X config ARCH_FAMILY_LPC177X bool + select ARCH_HAVE_EXTNAND + select ARCH_HAVE_EXTSRAM0 + select ARCH_HAVE_EXTDRAM + select ARCH_HAVE_EXTNOR config ARCH_FAMILY_LPC178X bool + select ARCH_HAVE_EXTNAND + select ARCH_HAVE_EXTSRAM0 + select ARCH_HAVE_EXTDRAM + select ARCH_HAVE_EXTNOR menu "LPC17xx Peripheral Support" diff --git a/nuttx/arch/arm/src/lpc31xx/Kconfig b/nuttx/arch/arm/src/lpc31xx/Kconfig index ad7bf3d4ed..531cea0af6 100644 --- a/nuttx/arch/arm/src/lpc31xx/Kconfig +++ b/nuttx/arch/arm/src/lpc31xx/Kconfig @@ -12,15 +12,31 @@ choice config ARCH_CHIP_LPC3130 bool "LPC3130" + select ARCH_HAVE_EXTNAN + select ARCH_HAVE_EXTSRAM0 + select ARCH_HAVE_EXTSRAM1 + select ARCH_HAVE_EXTDRAM config ARCH_CHIP_LPC3131 bool "LPC3131" + select ARCH_HAVE_EXTNAND + select ARCH_HAVE_EXTSRAM0 + select ARCH_HAVE_EXTSRAM1 + select ARCH_HAVE_EXTDRAM config ARCH_CHIP_LPC3152 bool "LPC3152" + select ARCH_HAVE_EXTNAND + select ARCH_HAVE_EXTSRAM0 + select ARCH_HAVE_EXTSRAM1 + select ARCH_HAVE_EXTDRAM config ARCH_CHIP_LPC3154 bool "LPC3154" + select ARCH_HAVE_EXTNAND + select ARCH_HAVE_EXTSRAM0 + select ARCH_HAVE_EXTSRAM1 + select ARCH_HAVE_EXTDRAM endchoice @@ -48,79 +64,12 @@ config LPC31_BUILDROOT endchoice -menu "LPC31xx Memory Mapping" - -config LPC31_EXTNAND - bool "Map external NAND" - default n - ---help--- - Map external NAND into the memory map. - -config LPC31_EXTSDRAM - bool "Map external SDRAM" - default n - ---help--- - Map external SDRAM into the memory map. - -config LPC31_EXTSDRAMHEAP - bool "Add external SDRAM to the heap" - default y - depends on LPC31_EXTSDRAM - ---help--- - Add external SDRAM into the heap. - -config LPC31_EXTSDRAMSIZE - int "External SDRAM size" - depends on LPC31_EXTSDRAM - ---help--- - Size of the external SDRAM. - config LPC31_SDRAMHCLK int "External SDRAM HCLK" - depends on LPC31_EXTSDRAM + depends on ARCH_EXTSDRAM ---help--- The SDRAM HCLK may be specified here (if not, it will be calculated). -config LPC31_EXTSRAM0 - bool "Map external SRAM0" - default n - ---help--- - Map external SRAM0 into the memory map. - -config LPC31_EXTSRAM0HEAP - bool "Add external SRAM0 to the heap" - default y - depends on LPC31_EXTSRAM0 - ---help--- - Add external SRAM0 into the heap. - -config LPC31_EXTSRAM0SIZE - int "External SRAM size" - depends on LPC31_EXTSRAM0 - ---help--- - Size of the external SRAM. - -config LPC31_EXTSRAM1 - bool "Map external SRAM0" - default n - ---help--- - Map external SRAM1 into the memory map. - -config LPC31_EXTSRAM1HEAP - bool "Add external SRAM1 to the heap" - default y - depends on LPC31_EXTSRAM1 - ---help--- - Add external SRAM1 into the heap. - -config LPC31_EXTSRAM1SIZE - int "External SRAM1 size" - depends on LPC31_EXTSRAM1 - ---help--- - Size of the external SRAM1. - -endmenu - menu "LPC31xx Peripheral Support" config LPC31_UART diff --git a/nuttx/arch/arm/src/lpc31xx/lpc31_allocateheap.c b/nuttx/arch/arm/src/lpc31xx/lpc31_allocateheap.c index df3c897e11..58772a6300 100644 --- a/nuttx/arch/arm/src/lpc31xx/lpc31_allocateheap.c +++ b/nuttx/arch/arm/src/lpc31xx/lpc31_allocateheap.c @@ -67,31 +67,31 @@ * memory regions that we have been asked to add to the heap. */ -#if defined(CONFIG_LPC31_EXTSRAM0) && defined(CONFIG_LPC31_EXTSRAM0HEAP) -# if defined(CONFIG_LPC31_EXTSRAM1) && defined(CONFIG_LPC31_EXTSRAM1HEAP) -# if defined(CONFIG_LPC31_EXTSDRAM) && defined(CONFIG_LPC31_EXTSDRAMHEAP) +#if defined(CONFIG_ARCH_EXTSRAM0) && defined(CONFIG_ARCH_EXTSRAM0HEAP) +# if defined(CONFIG_ARCH_EXTSRAM1) && defined(CONFIG_ARCH_EXTSRAM1HEAP) +# if defined(CONFIG_ARCH_EXTDRAM) && defined(CONFIG_ARCH_EXTDRAMHEAP) # /* SRAM+EXTSRAM0+EXTSRAM1+EXTSDRAM */ # define LPC31_NEXT_REGIONS 4 # else # /* SRAM+EXTSRAM0+EXTSRAM1 */ # define LPC31_NEXT_REGIONS 3 # endif -# elif defined(CONFIG_LPC31_EXTSDRAM) && defined(CONFIG_LPC31_EXTSDRAMHEAP) +# elif defined(CONFIG_ARCH_EXTDRAM) && defined(CONFIG_ARCH_EXTDRAMHEAP) # /* SRAM+EXTSRAM0+EXTSDRAM */ # define LPC31_NEXT_REGIONS 3 # else # /* SRAM+EXTSRAM0 */ # define LPC31_NEXT_REGIONS 2 # endif -#elif defined(CONFIG_LPC31_EXTSRAM1) && defined(CONFIG_LPC31_EXTSRAM1HEAP) -# if defined(CONFIG_LPC31_EXTSDRAM) && defined(CONFIG_LPC31_EXTSDRAMHEAP) +#elif defined(CONFIG_ARCH_EXTSRAM1) && defined(CONFIG_ARCH_EXTSRAM1HEAP) +# if defined(CONFIG_ARCH_EXTDRAM) && defined(CONFIG_ARCH_EXTDRAMHEAP) # /* SRAM+EXTSRAM1+EXTSDRAM */ # define LPC31_NEXT_REGIONS 3 # else # /* SRAM+EXTSRAM1 */ # define LPC31_NEXT_REGIONS 2 # endif -#elif defined(CONFIG_LPC31_EXTSDRAM) && defined(CONFIG_LPC31_EXTSDRAMHEAP) +#elif defined(CONFIG_ARCH_EXTDRAM) && defined(CONFIG_ARCH_EXTDRAMHEAP) # /* SRAM+EXTSDRAM */ # define LPC31_NEXT_REGIONS 2 #else @@ -105,13 +105,13 @@ # else # error "CONFIG_MM_REGIONS is too large for the selected memory regions" # endif -# if defined(CONFIG_LPC31_EXTSRAM0) && defined(CONFIG_LPC31_EXTSRAM0HEAP) +# if defined(CONFIG_ARCH_EXTSRAM0) && defined(CONFIG_ARCH_EXTSRAM0HEAP) # error "External SRAM0 is selected for heap" # endif -# if defined(CONFIG_LPC31_EXTSRAM1) && defined(CONFIG_LPC31_EXTSRAM1HEAP) +# if defined(CONFIG_ARCH_EXTSRAM1) && defined(CONFIG_ARCH_EXTSRAM1HEAP) # error "External SRAM1 is selected for heap" # endif -# if defined(CONFIG_LPC31_EXTSDRAM) && defined(CONFIG_LPC31_EXTSDRAMHEAP) +# if defined(CONFIG_ARCH_EXTDRAM) && defined(CONFIG_ARCH_EXTDRAMHEAP) # error "External SRAM1 is selected for heap" # endif #endif @@ -191,16 +191,16 @@ void up_allocate_heap(FAR void **heap_start, size_t *heap_size) #if CONFIG_MM_REGIONS > 1 void up_addregion(void) { -#if defined(CONFIG_LPC31_EXTSRAM0) && defined(CONFIG_LPC31_EXTSRAM0HEAP) - mm_addregion((FAR void*)LPC31_EXTSRAM0_VSECTION, CONFIG_LPC31_EXTSRAM0SIZE); +#if defined(CONFIG_ARCH_EXTSRAM0) && defined(CONFIG_ARCH_EXTSRAM0HEAP) + mm_addregion((FAR void*)LPC31_EXTSRAM0_VSECTION, CONFIG_ARCH_EXTSRAM0SIZE); #endif -#if defined(CONFIG_LPC31_EXTSRAM1) && defined(CONFIG_LPC31_EXTSRAM1HEAP) - mm_addregion((FAR void*)LPC31_EXTSRAM1_VSECTION, CONFIG_LPC31_EXTSRAM1SIZE); +#if defined(CONFIG_ARCH_EXTSRAM1) && defined(CONFIG_ARCH_EXTSRAM1HEAP) + mm_addregion((FAR void*)LPC31_EXTSRAM1_VSECTION, CONFIG_ARCH_EXTSRAM1SIZE); #endif -#if defined(CONFIG_LPC31_EXTSDRAM) && defined(CONFIG_LPC31_EXTSDRAMHEAP) - mm_addregion((FAR void*)LPC31_EXTSDRAM_VSECTION, CONFIG_LPC31_EXTSDRAMSIZE); +#if defined(CONFIG_ARCH_EXTDRAM) && defined(CONFIG_ARCH_EXTDRAMHEAP) + mm_addregion((FAR void*)LPC31_EXTSDRAM_VSECTION, CONFIG_ARCH_EXTDRAMSIZE); #endif } #endif diff --git a/nuttx/arch/arm/src/lpc31xx/lpc31_boot.c b/nuttx/arch/arm/src/lpc31xx/lpc31_boot.c index 7abe15d4d0..a7c1acdc8e 100644 --- a/nuttx/arch/arm/src/lpc31xx/lpc31_boot.c +++ b/nuttx/arch/arm/src/lpc31xx/lpc31_boot.c @@ -112,17 +112,17 @@ static const struct section_mapping_s section_mapping[] = LPC31_MCI_MMUFLAGS, LPC31_MCI_NSECTIONS}, { LPC31_USBOTG_PSECTION, LPC31_USBOTG_VSECTION, LPC31_USBOTG_MMUFLAGS, LPC31_USBOTG_NSECTIONS}, -#if defined(CONFIG_LPC31_EXTSRAM0) && CONFIG_LPC31_EXTSRAM0SIZE > 0 +#if defined(CONFIG_ARCH_EXTSRAM0) && CONFIG_ARCH_EXTSRAM0SIZE > 0 { LPC31_EXTSRAM_PSECTION, LPC31_EXTSRAM_VSECTION, LPC31_EXTSDRAM_MMUFLAGS, LPC31_EXTSRAM_NSECTIONS}, #endif -#if defined(CONFIG_LPC31_EXTSDRAM) && CONFIG_LPC31_EXTSDRAMSIZE > 0 +#if defined(CONFIG_ARCH_EXTDRAM) && CONFIG_ARCH_EXTDRAMSIZE > 0 { LPC31_EXTSDRAM0_PSECTION, LPC31_EXTSDRAM0_VSECTION, LPC31_EXTSDRAM_MMUFLAGS, LPC31_EXTSDRAM0_NSECTIONS}, #endif { LPC31_INTC_PSECTION, LPC31_INTC_VSECTION, LPC31_INTC_MMUFLAGS, LPC31_INTC_NSECTIONS}, -#ifdef CONFIG_LPC31_EXTNAND +#ifdef CONFIG_ARCH_EXTNAND { LPC31_NAND_PSECTION, LPC31_NAND_VSECTION LPC31_NAND_MMUFLAGS, LPC31_NAND_NSECTIONS}, #endif diff --git a/nuttx/arch/arm/src/lpc31xx/lpc31_memorymap.h b/nuttx/arch/arm/src/lpc31xx/lpc31_memorymap.h index b5155df89a..8d13019ac8 100644 --- a/nuttx/arch/arm/src/lpc31xx/lpc31_memorymap.h +++ b/nuttx/arch/arm/src/lpc31xx/lpc31_memorymap.h @@ -81,7 +81,7 @@ /* 0x60001000-0x6fffffff: Reserved */ #define LPC31_NAND_PSECTION 0x70000000 /* 0x70000000-0x700007ff: NANDFLASH Ctrl 2Kb */ /* 0x70000800-0xffffffff: Reserved */ -#ifdef CONFIG_LPC31_EXTNAND /* End of the physical address space */ +#ifdef CONFIG_ARCH_EXTNAND /* End of the physical address space */ # define LPC31_LAST_PSECTION (LPC31_NAND_PSECTION + (1 << 20)) #else # define LPC31_LAST_PSECTION (LPC31_INTC_PSECTION + (1 << 20)) @@ -176,8 +176,8 @@ * the size of the SDRAM installed. */ -#if defined(CONFIG_LPC31_EXTSDRAM) && CONFIG_LPC31_EXTSDRAMSIZE > 0 -# define LPC31_EXTSDRAM0_NSECTIONS _NSECTIONS(CONFIG_LPC31_EXTSDRAMSIZE) +#if defined(CONFIG_ARCH_EXTDRAM) && CONFIG_ARCH_EXTDRAMSIZE > 0 +# define LPC31_EXTSDRAM0_NSECTIONS _NSECTIONS(CONFIG_ARCH_EXTDRAMSIZE) #endif /* Section MMU Flags */ @@ -233,7 +233,7 @@ # define LPC31_INTC_VSECTION 0x60000000 /* 0x60000000-0x60000fff: Interrupt controller 4Kb */ # define LPC31_NAND_VSECTION 0x70000000 /* 0x70000000-0x700007ff: NANDFLASH Ctrl 2Kb */ # -# ifdef CONFIG_LPC31_EXTNAND /* End of the virtual address space */ +# ifdef CONFIG_ARCH_EXTNAND /* End of the virtual address space */ # define LPC31_LAST_VSECTION (LPC31_NAND_VSECTION + (1 << 20)) # else # define LPC31_LAST_VSECTION (LPC31_INTC_VSECTION + (1 << 20)) diff --git a/nuttx/configs/Kconfig b/nuttx/configs/Kconfig index d851eeccb1..d72d01058f 100644 --- a/nuttx/configs/Kconfig +++ b/nuttx/configs/Kconfig @@ -346,6 +346,14 @@ config ARCH_BOARD_OLIMEX_STM32P107 Linux or Cygwin. See the http://www.olimex.com for further information. This board features the STMicro STM32F107VC MCU +config ARCH_BOARD_OPEN1788 + bool "Wave Share Open1788" + depends on ARCH_CHIP_LPC1788 + ---help--- + This port uses the Wave Share Open1788 board. See the + http://wvshare.com/product/Open1788-Standard.htm for further + information. This board features the NXP LPC1788 MCU + config ARCH_BOARD_P112 bool "P112 Z180-based platform" depends on ARCH_CHIP_Z8018216FSG @@ -682,6 +690,7 @@ config ARCH_BOARD default "olimex-lpc2378" if ARCH_BOARD_OLIMEXLPC2378 default "olimex-stm32-p107" if ARCH_BOARD_OLIMEX_STM32P107 default "olimex-strp711" if ARCH_BOARD_OLIMEX_STRP711 + default "open1788" if ARCH_BOARD_OPEN1788 default "p112" if ARCH_BOARD_P112 default "pcblogic-pic32mx" if ARCH_BOARD_PCBLOGICPIC32MX default "pic32-starterkit" if ARCH_BOARD_PIC32_STARTERKIT @@ -869,6 +878,9 @@ endif if ARCH_BOARD_OLIMEX_STRP711 source "configs/olimex-strp711/Kconfig" endif +if ARCH_BOARD_OPEN1788 +source "configs/open1788/Kconfig" +endif if ARCH_BOARD_PCBLOGICPIC32MX source "configs/pcblogic-pic32mx/Kconfig" endif diff --git a/nuttx/configs/ea3131/README.txt b/nuttx/configs/ea3131/README.txt index 986b7778cc..f11caab4f9 100644 --- a/nuttx/configs/ea3131/README.txt +++ b/nuttx/configs/ea3131/README.txt @@ -570,23 +570,23 @@ ARM/EA3131-specific Configuration Options External memory available on the board (see also CONFIG_MM_REGIONS) - CONFIG_LPC31_EXTSRAM0 - Select if external SRAM0 is present - CONFIG_LPC31_EXTSRAM0HEAP - Select if external SRAM0 should be + CONFIG_ARCH_EXTSRAM0 - Select if external SRAM0 is present + CONFIG_ARCH_EXTSRAM0HEAP - Select if external SRAM0 should be configured as part of the NuttX heap. - CONFIG_LPC31_EXTSRAM0SIZE - Size (in bytes) of the installed + CONFIG_ARCH_EXTSRAM0SIZE - Size (in bytes) of the installed external SRAM0 memory - CONFIG_LPC31_EXTSRAM1 - Select if external SRAM1 is present - CONFIG_LPC31_EXTSRAM1HEAP - Select if external SRAM1 should be + CONFIG_ARCH_EXTSRAM1 - Select if external SRAM1 is present + CONFIG_ARCH_EXTSRAM1HEAP - Select if external SRAM1 should be configured as part of the NuttX heap. - CONFIG_LPC31_EXTSRAM1SIZE - Size (in bytes) of the installed + CONFIG_ARCH_EXTSRAM1SIZE - Size (in bytes) of the installed external SRAM1 memory - CONFIG_LPC31_EXTSDRAM - Select if external SDRAM is present - CONFIG_LPC31_EXTSDRAMHEAP - Select if external SDRAM should be + CONFIG_ARCH_EXTDRAM - Select if external SDRAM is present + CONFIG_ARCH_EXTDRAMHEAP - Select if external SDRAM should be configured as part of the NuttX heap. - CONFIG_LPC31_EXTSDRAMSIZE - Size (in bytes) of the installed + CONFIG_ARCH_EXTDRAMSIZE - Size (in bytes) of the installed external SDRAM memory - CONFIG_LPC31_EXTNAND - Select if external NAND is present - CONFIG_LPC31_EXTSDRAMSIZE - Size (in bytes) of the installed + CONFIG_ARCH_EXTNAND - Select if external NAND is present + CONFIG_ARCH_EXTNANDSIZE - Size (in bytes) of the installed external NAND memory LPC313X specific device driver settings diff --git a/nuttx/configs/ea3131/nsh/defconfig b/nuttx/configs/ea3131/nsh/defconfig index 43510fa595..04398d1a2c 100644 --- a/nuttx/configs/ea3131/nsh/defconfig +++ b/nuttx/configs/ea3131/nsh/defconfig @@ -79,17 +79,17 @@ CONFIG_LPC31_UART=y # # Exernal memory available on the board (see also CONFIG_MM_REGIONS) # -CONFIG_LPC31_EXTSRAM0=n -CONFIG_LPC31_EXTSRAM0HEAP=n -CONFIG_LPC31_EXTSRAM0SIZE=131072 -CONFIG_LPC31_EXTSRAM1=n -CONFIG_LPC31_EXTSRAM1HEAP=n -CONFIG_LPC31_EXTSRAM1SIZE=131072 -CONFIG_LPC31_EXTSDRAM=n -CONFIG_LPC31_EXTSDRAMHEAP=n -CONFIG_LPC31_EXTSDRAMSIZE=67108864 -CONFIG_LPC31_EXTNAND=n -CONFIG_LPC31_EXTNANDSIZE=67108864 +CONFIG_ARCH_EXTSRAM0=n +CONFIG_ARCH_EXTSRAM0HEAP=n +CONFIG_ARCH_EXTSRAM0SIZE=131072 +CONFIG_ARCH_EXTSRAM1=n +CONFIG_ARCH_EXTSRAM1HEAP=n +CONFIG_ARCH_EXTSRAM1SIZE=131072 +CONFIG_ARCH_EXTDRAM=n +CONFIG_ARCH_EXTDRAMHEAP=n +CONFIG_ARCH_EXTDRAMSIZE=67108864 +CONFIG_ARCH_EXTNAND=n +CONFIG_ARCH_EXTNANDSIZE=67108864 # # LPC31XX specific device driver settings diff --git a/nuttx/configs/ea3131/ostest/defconfig b/nuttx/configs/ea3131/ostest/defconfig index 6da813d9ec..d137835aff 100644 --- a/nuttx/configs/ea3131/ostest/defconfig +++ b/nuttx/configs/ea3131/ostest/defconfig @@ -79,17 +79,17 @@ CONFIG_LPC31_UART=y # # Exernal memory available on the board (see also CONFIG_MM_REGIONS) # -CONFIG_LPC31_EXTSRAM0=n -CONFIG_LPC31_EXTSRAM0HEAP=n -CONFIG_LPC31_EXTSRAM0SIZE=131072 -CONFIG_LPC31_EXTSRAM1=n -CONFIG_LPC31_EXTSRAM1HEAP=n -CONFIG_LPC31_EXTSRAM1SIZE=131072 -CONFIG_LPC31_EXTSDRAM=n -CONFIG_LPC31_EXTSDRAMHEAP=n -CONFIG_LPC31_EXTSDRAMSIZE=67108864 -CONFIG_LPC31_EXTNAND=n -CONFIG_LPC31_EXTNANDSIZE=67108864 +CONFIG_ARCH_EXTSRAM0=n +CONFIG_ARCH_EXTSRAM0HEAP=n +CONFIG_ARCH_EXTSRAM0SIZE=131072 +CONFIG_ARCH_EXTSRAM1=n +CONFIG_ARCH_EXTSRAM1HEAP=n +CONFIG_ARCH_EXTSRAM1SIZE=131072 +CONFIG_ARCH_EXTDRAM=n +CONFIG_ARCH_EXTDRAMHEAP=n +CONFIG_ARCH_EXTDRAMSIZE=67108864 +CONFIG_ARCH_EXTNAND=n +CONFIG_ARCH_EXTNANDSIZE=67108864 # # LPC31XX specific device driver settings diff --git a/nuttx/configs/ea3131/pgnsh/defconfig b/nuttx/configs/ea3131/pgnsh/defconfig index 2a9eeff939..d734bc21cf 100644 --- a/nuttx/configs/ea3131/pgnsh/defconfig +++ b/nuttx/configs/ea3131/pgnsh/defconfig @@ -79,17 +79,17 @@ CONFIG_LPC31_UART=y # # Exernal memory available on the board (see also CONFIG_MM_REGIONS) # -CONFIG_LPC31_EXTSRAM0=n -CONFIG_LPC31_EXTSRAM0HEAP=n -CONFIG_LPC31_EXTSRAM0SIZE=131072 -CONFIG_LPC31_EXTSRAM1=n -CONFIG_LPC31_EXTSRAM1HEAP=n -CONFIG_LPC31_EXTSRAM1SIZE=131072 -CONFIG_LPC31_EXTSDRAM=n -CONFIG_LPC31_EXTSDRAMHEAP=n -CONFIG_LPC31_EXTSDRAMSIZE=67108864 -CONFIG_LPC31_EXTNAND=n -CONFIG_LPC31_EXTNANDSIZE=67108864 +CONFIG_ARCH_EXTSRAM0=n +CONFIG_ARCH_EXTSRAM0HEAP=n +CONFIG_ARCH_EXTSRAM0SIZE=131072 +CONFIG_ARCH_EXTSRAM1=n +CONFIG_ARCH_EXTSRAM1HEAP=n +CONFIG_ARCH_EXTSRAM1SIZE=131072 +CONFIG_ARCH_EXTDRAM=n +CONFIG_ARCH_EXTDRAMHEAP=n +CONFIG_ARCH_EXTDRAMSIZE=67108864 +CONFIG_ARCH_EXTNAND=n +CONFIG_ARCH_EXTNANDSIZE=67108864 # # LPC31XX specific device driver settings diff --git a/nuttx/configs/ea3131/src/Makefile b/nuttx/configs/ea3131/src/Makefile index 778a2b138a..1b91577e9d 100644 --- a/nuttx/configs/ea3131/src/Makefile +++ b/nuttx/configs/ea3131/src/Makefile @@ -44,7 +44,7 @@ CSRCS = up_boot.c up_clkinit.c ifeq ($(CONFIG_ARCH_BUTTONS),y) CSRCS += up_buttons.c endif -ifeq ($(CONFIG_LPC31_EXTSDRAM),y) +ifeq ($(CONFIG_ARCH_EXTDRAM),y) CSRCS += up_mem.c endif ifeq ($(CONFIG_ARCH_LEDS),y) diff --git a/nuttx/configs/ea3131/src/ea3131_internal.h b/nuttx/configs/ea3131/src/ea3131_internal.h index 4a8ae3fa4e..4ba97d83d9 100644 --- a/nuttx/configs/ea3131/src/ea3131_internal.h +++ b/nuttx/configs/ea3131/src/ea3131_internal.h @@ -86,7 +86,7 @@ * ************************************************************************************/ -#ifdef CONFIG_LPC31_EXTSDRAM +#ifdef CONFIG_ARCH_EXTDRAM extern void lpc31_meminitialize(void); #endif diff --git a/nuttx/configs/ea3131/src/up_boot.c b/nuttx/configs/ea3131/src/up_boot.c index 1fd9069f84..c8ae704618 100644 --- a/nuttx/configs/ea3131/src/up_boot.c +++ b/nuttx/configs/ea3131/src/up_boot.c @@ -75,7 +75,7 @@ void lpc31_boardinitialize(void) { /* Initialize configured, external memory resources */ -#ifdef CONFIG_LPC31_EXTSDRAM +#ifdef CONFIG_ARCH_EXTDRAM lpc31_meminitialize(); #endif diff --git a/nuttx/configs/ea3131/src/up_mem.c b/nuttx/configs/ea3131/src/up_mem.c index 060f58eecd..668233d3b9 100644 --- a/nuttx/configs/ea3131/src/up_mem.c +++ b/nuttx/configs/ea3131/src/up_mem.c @@ -59,7 +59,7 @@ #include "lpc31_mpmc.h" #include "ea3131_internal.h" -#ifdef CONFIG_LPC31_EXTSDRAM +#ifdef CONFIG_ARCH_EXTDRAM /**************************************************************************** * Pre-processor Definitions @@ -356,4 +356,4 @@ void lpc31_meminitialize(void) lpc31_sdraminitialize(); } -#endif /* CONFIG_LPC31_EXTSDRAM */ +#endif /* CONFIG_ARCH_EXTDRAM */ diff --git a/nuttx/configs/ea3131/usbserial/defconfig b/nuttx/configs/ea3131/usbserial/defconfig index 40c0897f73..398d9b3bc7 100644 --- a/nuttx/configs/ea3131/usbserial/defconfig +++ b/nuttx/configs/ea3131/usbserial/defconfig @@ -79,17 +79,17 @@ CONFIG_LPC31_UART=y # # Exernal memory available on the board (see also CONFIG_MM_REGIONS) # -CONFIG_LPC31_EXTSRAM0=n -CONFIG_LPC31_EXTSRAM0HEAP=n -CONFIG_LPC31_EXTSRAM0SIZE=131072 -CONFIG_LPC31_EXTSRAM1=n -CONFIG_LPC31_EXTSRAM1HEAP=n -CONFIG_LPC31_EXTSRAM1SIZE=131072 -CONFIG_LPC31_EXTSDRAM=n -CONFIG_LPC31_EXTSDRAMHEAP=n -CONFIG_LPC31_EXTSDRAMSIZE=67108864 -CONFIG_LPC31_EXTNAND=n -CONFIG_LPC31_EXTNANDSIZE=67108864 +CONFIG_ARCH_EXTSRAM0=n +CONFIG_ARCH_EXTSRAM0HEAP=n +CONFIG_ARCH_EXTSRAM0SIZE=131072 +CONFIG_ARCH_EXTSRAM1=n +CONFIG_ARCH_EXTSRAM1HEAP=n +CONFIG_ARCH_EXTSRAM1SIZE=131072 +CONFIG_ARCH_EXTDRAM=n +CONFIG_ARCH_EXTDRAMHEAP=n +CONFIG_ARCH_EXTDRAMSIZE=67108864 +CONFIG_ARCH_EXTNAND=n +CONFIG_ARCH_EXTNANDSIZE=67108864 # # LPC31XX specific device driver settings diff --git a/nuttx/configs/ea3131/usbstorage/defconfig b/nuttx/configs/ea3131/usbstorage/defconfig index 0659383a61..c69379ba96 100644 --- a/nuttx/configs/ea3131/usbstorage/defconfig +++ b/nuttx/configs/ea3131/usbstorage/defconfig @@ -79,17 +79,17 @@ CONFIG_LPC31_UART=y # # Exernal memory available on the board (see also CONFIG_MM_REGIONS) # -CONFIG_LPC31_EXTSRAM0=n -CONFIG_LPC31_EXTSRAM0HEAP=n -CONFIG_LPC31_EXTSRAM0SIZE=131072 -CONFIG_LPC31_EXTSRAM1=n -CONFIG_LPC31_EXTSRAM1HEAP=n -CONFIG_LPC31_EXTSRAM1SIZE=131072 -CONFIG_LPC31_EXTSDRAM=n -CONFIG_LPC31_EXTSDRAMHEAP=n -CONFIG_LPC31_EXTSDRAMSIZE=67108864 -CONFIG_LPC31_EXTNAND=n -CONFIG_LPC31_EXTNANDSIZE=67108864 +CONFIG_ARCH_EXTSRAM0=n +CONFIG_ARCH_EXTSRAM0HEAP=n +CONFIG_ARCH_EXTSRAM0SIZE=131072 +CONFIG_ARCH_EXTSRAM1=n +CONFIG_ARCH_EXTSRAM1HEAP=n +CONFIG_ARCH_EXTSRAM1SIZE=131072 +CONFIG_ARCH_EXTDRAM=n +CONFIG_ARCH_EXTDRAMHEAP=n +CONFIG_ARCH_EXTDRAMSIZE=67108864 +CONFIG_ARCH_EXTNAND=n +CONFIG_ARCH_EXTNANDSIZE=67108864 # # LPC31XX specific device driver settings diff --git a/nuttx/configs/ea3152/README.txt b/nuttx/configs/ea3152/README.txt index 4f507e7b0f..8ede86b4f6 100644 --- a/nuttx/configs/ea3152/README.txt +++ b/nuttx/configs/ea3152/README.txt @@ -376,23 +376,23 @@ ARM/EA3152-specific Configuration Options External memory available on the board (see also CONFIG_MM_REGIONS) - CONFIG_LPC31_EXTSRAM0 - Select if external SRAM0 is present - CONFIG_LPC31_EXTSRAM0HEAP - Select if external SRAM0 should be + CONFIG_ARCH_EXTSRAM0 - Select if external SRAM0 is present + CONFIG_ARCH_EXTSRAM0HEAP - Select if external SRAM0 should be configured as part of the NuttX heap. - CONFIG_LPC31_EXTSRAM0SIZE - Size (in bytes) of the installed + CONFIG_ARCH_EXTSRAM0SIZE - Size (in bytes) of the installed external SRAM0 memory - CONFIG_LPC31_EXTSRAM1 - Select if external SRAM1 is present - CONFIG_LPC31_EXTSRAM1HEAP - Select if external SRAM1 should be + CONFIG_ARCH_EXTSRAM1 - Select if external SRAM1 is present + CONFIG_ARCH_EXTSRAM1HEAP - Select if external SRAM1 should be configured as part of the NuttX heap. - CONFIG_LPC31_EXTSRAM1SIZE - Size (in bytes) of the installed + CONFIG_ARCH_EXTSRAM1SIZE - Size (in bytes) of the installed external SRAM1 memory - CONFIG_LPC31_EXTSDRAM - Select if external SDRAM is present - CONFIG_LPC31_EXTSDRAMHEAP - Select if external SDRAM should be + CONFIG_ARCH_EXTDRAM - Select if external SDRAM is present + CONFIG_ARCH_EXTDRAMHEAP - Select if external SDRAM should be configured as part of the NuttX heap. - CONFIG_LPC31_EXTSDRAMSIZE - Size (in bytes) of the installed + CONFIG_ARCH_EXTDRAMSIZE - Size (in bytes) of the installed external SDRAM memory - CONFIG_LPC31_EXTNAND - Select if external NAND is present - CONFIG_LPC31_EXTSDRAMSIZE - Size (in bytes) of the installed + CONFIG_ARCH_EXTNAND - Select if external NAND is present + CONFIG_ARCH_EXTNANDSIZE - Size (in bytes) of the installed external NAND memory LPC315X specific device driver settings diff --git a/nuttx/configs/ea3152/ostest/defconfig b/nuttx/configs/ea3152/ostest/defconfig index d4d978649b..07a1491ed7 100644 --- a/nuttx/configs/ea3152/ostest/defconfig +++ b/nuttx/configs/ea3152/ostest/defconfig @@ -79,17 +79,17 @@ CONFIG_LPC31_UART=y # # Exernal memory available on the board (see also CONFIG_MM_REGIONS) # -CONFIG_LPC31_EXTSRAM0=n -CONFIG_LPC31_EXTSRAM0HEAP=n -CONFIG_LPC31_EXTSRAM0SIZE=131072 -CONFIG_LPC31_EXTSRAM1=n -CONFIG_LPC31_EXTSRAM1HEAP=n -CONFIG_LPC31_EXTSRAM1SIZE=131072 -CONFIG_LPC31_EXTSDRAM=n -CONFIG_LPC31_EXTSDRAMHEAP=n -CONFIG_LPC31_EXTSDRAMSIZE=67108864 -CONFIG_LPC31_EXTNAND=n -CONFIG_LPC31_EXTNANDSIZE=67108864 +CONFIG_ARCH_EXTSRAM0=n +CONFIG_ARCH_EXTSRAM0HEAP=n +CONFIG_ARCH_EXTSRAM0SIZE=131072 +CONFIG_ARCH_EXTSRAM1=n +CONFIG_ARCH_EXTSRAM1HEAP=n +CONFIG_ARCH_EXTSRAM1SIZE=131072 +CONFIG_ARCH_EXTDRAM=n +CONFIG_ARCH_EXTDRAMHEAP=n +CONFIG_ARCH_EXTDRAMSIZE=67108864 +CONFIG_ARCH_EXTNAND=n +CONFIG_ARCH_EXTNANDSIZE=67108864 # # LPC31XX specific device driver settings diff --git a/nuttx/configs/ea3152/src/Makefile b/nuttx/configs/ea3152/src/Makefile index cb945f5aa1..c184838d51 100644 --- a/nuttx/configs/ea3152/src/Makefile +++ b/nuttx/configs/ea3152/src/Makefile @@ -44,7 +44,7 @@ CSRCS = up_boot.c up_clkinit.c ifeq ($(CONFIG_ARCH_BUTTONS),y) CSRCS += up_buttons.c endif -ifeq ($(CONFIG_LPC31_EXTSDRAM),y) +ifeq ($(CONFIG_ARCH_EXTDRAM),y) CSRCS += up_mem.c endif ifeq ($(CONFIG_ARCH_LEDS),y) diff --git a/nuttx/configs/ea3152/src/ea3152_internal.h b/nuttx/configs/ea3152/src/ea3152_internal.h index ee93c36a1f..84fab13384 100644 --- a/nuttx/configs/ea3152/src/ea3152_internal.h +++ b/nuttx/configs/ea3152/src/ea3152_internal.h @@ -86,7 +86,7 @@ * ************************************************************************************/ -#ifdef CONFIG_LPC31_EXTSDRAM +#ifdef CONFIG_ARCH_EXTDRAM extern void lpc31_meminitialize(void); #endif diff --git a/nuttx/configs/ea3152/src/up_boot.c b/nuttx/configs/ea3152/src/up_boot.c index c8870cfdf7..066808b2f8 100644 --- a/nuttx/configs/ea3152/src/up_boot.c +++ b/nuttx/configs/ea3152/src/up_boot.c @@ -75,7 +75,7 @@ void lpc31_boardinitialize(void) { /* Initialize configured, external memory resources */ -#ifdef CONFIG_LPC31_EXTSDRAM +#ifdef CONFIG_ARCH_EXTDRAM lpc31_meminitialize(); #endif diff --git a/nuttx/configs/ea3152/src/up_mem.c b/nuttx/configs/ea3152/src/up_mem.c index 4f6c71e87e..4ac716f061 100644 --- a/nuttx/configs/ea3152/src/up_mem.c +++ b/nuttx/configs/ea3152/src/up_mem.c @@ -59,7 +59,7 @@ #include "lpc31_mpmc.h" #include "ea3152_internal.h" -#ifdef CONFIG_LPC31_EXTSDRAM +#ifdef CONFIG_ARCH_EXTDRAM /**************************************************************************** * Pre-processor Definitions @@ -356,4 +356,4 @@ void lpc31_meminitialize(void) lpc31_sdraminitialize(); } -#endif /* CONFIG_LPC31_EXTSDRAM */ +#endif /* CONFIG_ARCH_EXTDRAM */ diff --git a/nuttx/configs/open1788/Kconfig b/nuttx/configs/open1788/Kconfig new file mode 100644 index 0000000000..08df7b38d5 --- /dev/null +++ b/nuttx/configs/open1788/Kconfig @@ -0,0 +1,7 @@ +# +# For a description of the syntax of this configuration file, +# see misc/tools/kconfig-language.txt. +# + +if ARCH_BOARD_OPEN1788 +endif diff --git a/nuttx/configs/open1788/README.txt b/nuttx/configs/open1788/README.txt new file mode 100644 index 0000000000..144be5242a --- /dev/null +++ b/nuttx/configs/open1788/README.txt @@ -0,0 +1,38 @@ +README.txt +========== + +This README file discusses the port of NuttX to the WaveShare Open1788 board: +See http://wvshare.com/product/Open1788-Standard.htm. This board features the +NXP LPC1788 MCU + +CONTENTS +======== + + o Configuration + +CONFIGURURATION +=============== + + ostest + ------ + This configuration directory, performs a simple OS test using + apps/examples/ostest. + + NOTES: + + 1. This configuration uses the mconf-based configuration tool. To + change this configuration using that tool, you should: + + a. Build and install the kconfig-mconf tool. See nuttx/README.txt + and misc/tools/ + + b. Execute 'make menuconfig' in nuttx/ in order to start the + reconfiguration process. + + 2. Uses the older, OABI, buildroot toolchain. But that is easily + reconfigured: + + CONFIG_ARMV7M_TOOLCHAIN_BUILDROOT=y : Buildroot toolchain + CONFIG_ARMV7M_OABI_TOOLCHAIN=y : Older, OABI toolchain + + diff --git a/nuttx/configs/open1788/ostest/Make.defs b/nuttx/configs/open1788/ostest/Make.defs new file mode 100644 index 0000000000..d6e1f1a9cc --- /dev/null +++ b/nuttx/configs/open1788/ostest/Make.defs @@ -0,0 +1,109 @@ +############################################################################ +# configs/open1788k/ostest/Make.defs +# +# Copyright (C) 2013 Gregory Nutt. All rights reserved. +# Author: Gregory Nutt +# +# 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 +include ${TOPDIR}/tools/Config.mk +include ${TOPDIR}/arch/arm/src/armv7-m/Toolchain.defs + +ifeq ($(WINTOOL),y) + # Windows-native toolchains + DIRLINK = $(TOPDIR)/tools/copydir.sh + DIRUNLINK = $(TOPDIR)/tools/unlink.sh + MKDEP = $(TOPDIR)/tools/mknulldeps.sh + ARCHINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" + ARCHXXINCLUDES = -I. -isystem "${shell cygpath -w $(TOPDIR)/include}" -isystem "${shell cygpath -w $(TOPDIR)/include/cxx}" + ARCHSCRIPT = -T "${shell cygpath -w $(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/scripts/ld.script}" + MAXOPTIMIZATION = -O2 +else + # Linux/Cygwin-native toolchain + MKDEP = $(TOPDIR)/tools/mkdeps.sh + ARCHINCLUDES = -I. -isystem $(TOPDIR)/include + ARCHXXINCLUDES = -I. -isystem $(TOPDIR)/include -isystem $(TOPDIR)/include/cxx + ARCHSCRIPT = -T$(TOPDIR)/configs/$(CONFIG_ARCH_BOARD)/scripts/ld.script +endif + +CC = $(CROSSDEV)gcc +CXX = $(CROSSDEV)g++ +CPP = $(CROSSDEV)gcc -E +LD = $(CROSSDEV)ld +AR = $(CROSSDEV)ar rcs +NM = $(CROSSDEV)nm +OBJCOPY = $(CROSSDEV)objcopy +OBJDUMP = $(CROSSDEV)objdump + +ARCHCCVERSION = ${shell $(CC) -v 2>&1 | sed -n '/^gcc version/p' | sed -e 's/^gcc version \([0-9\.]\)/\1/g' -e 's/[-\ ].*//g' -e '1q'} +ARCHCCMAJOR = ${shell echo $(ARCHCCVERSION) | cut -d'.' -f1} + +ifeq ($(CONFIG_DEBUG_SYMBOLS),y) + ARCHOPTIMIZATION = -g +else + ARCHOPTIMIZATION = $(MAXOPTIMIZATION) -fno-strict-aliasing -fno-strength-reduce -fomit-frame-pointer +endif + +ARCHCFLAGS = -fno-builtin +ARCHCXXFLAGS = -fno-builtin -fno-exceptions +ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow +ARCHWARNINGSXX = -Wall -Wshadow +ARCHDEFINES = +ARCHPICFLAGS = -fpic -msingle-pic-base -mpic-register=r10 + +CFLAGS = $(ARCHCFLAGS) $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe +CPICFLAGS = $(ARCHPICFLAGS) $(CFLAGS) +CXXFLAGS = $(ARCHCXXFLAGS) $(ARCHWARNINGSXX) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHXXINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) -pipe +CXXPICFLAGS = $(ARCHPICFLAGS) $(CXXFLAGS) +CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES) +AFLAGS = $(CFLAGS) -D__ASSEMBLY__ + +NXFLATLDFLAGS1 = -r -d -warn-common +NXFLATLDFLAGS2 = $(NXFLATLDFLAGS1) -T$(TOPDIR)/binfmt/libnxflat/gnu-nxflat-pcrel.ld -no-check-sections +LDNXFLATFLAGS = -e main -s 2048 + +OBJEXT = .o +LIBEXT = .a +EXEEXT = + +ifneq ($(CROSSDEV),arm-nuttx-elf-) + LDFLAGS += -nostartfiles -nodefaultlibs +endif +ifeq ($(CONFIG_DEBUG_SYMBOLS),y) + LDFLAGS += -g +endif + + +HOSTCC = gcc +HOSTINCLUDES = -I. +HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe +HOSTLDFLAGS = + diff --git a/nuttx/configs/open1788/ostest/defconfig b/nuttx/configs/open1788/ostest/defconfig new file mode 100644 index 0000000000..69c4803449 --- /dev/null +++ b/nuttx/configs/open1788/ostest/defconfig @@ -0,0 +1,604 @@ +# +# Automatically generated file; DO NOT EDIT. +# Nuttx/ Configuration +# +CONFIG_NUTTX_NEWCONFIG=y + +# +# Build Setup +# +# CONFIG_EXPERIMENTAL is not set +CONFIG_HOST_LINUX=y +# CONFIG_HOST_OSX is not set +# CONFIG_HOST_WINDOWS is not set +# CONFIG_HOST_OTHER is not set + +# +# Build Configuration +# +# CONFIG_APPS_DIR="../apps" +# CONFIG_BUILD_2PASS is not set + +# +# Binary Output Formats +# +# CONFIG_RRLOAD_BINARY is not set +CONFIG_INTELHEX_BINARY=y +# CONFIG_MOTOROLA_SREC is not set +# CONFIG_RAW_BINARY is not set + +# +# Customize Header Files +# +# CONFIG_ARCH_STDBOOL_H is not set +# CONFIG_ARCH_MATH_H is not set +# CONFIG_ARCH_FLOAT_H is not set +# CONFIG_ARCH_STDARG_H is not set + +# +# Debug Options +# +# CONFIG_DEBUG is not set +# CONFIG_DEBUG_SYMBOLS is not set + +# +# System Type +# +# CONFIG_ARCH_8051 is not set +CONFIG_ARCH_ARM=y +# CONFIG_ARCH_AVR is not set +# CONFIG_ARCH_HC is not set +# CONFIG_ARCH_MIPS is not set +# CONFIG_ARCH_RGMP is not set +# CONFIG_ARCH_SH is not set +# CONFIG_ARCH_SIM is not set +# CONFIG_ARCH_X86 is not set +# CONFIG_ARCH_Z16 is not set +# CONFIG_ARCH_Z80 is not set +CONFIG_ARCH="arm" + +# +# ARM Options +# +# CONFIG_ARCH_CHIP_C5471 is not set +# CONFIG_ARCH_CHIP_CALYPSO is not set +# CONFIG_ARCH_CHIP_DM320 is not set +# CONFIG_ARCH_CHIP_IMX is not set +# CONFIG_ARCH_CHIP_KINETIS is not set +# CONFIG_ARCH_CHIP_LM is not set +CONFIG_ARCH_CHIP_LPC17XX=y +# CONFIG_ARCH_CHIP_LPC214X is not set +# CONFIG_ARCH_CHIP_LPC2378 is not set +# CONFIG_ARCH_CHIP_LPC31XX is not set +# CONFIG_ARCH_CHIP_LPC43XX is not set +# CONFIG_ARCH_CHIP_SAM3U is not set +# CONFIG_ARCH_CHIP_STM32 is not set +# CONFIG_ARCH_CHIP_STR71X is not set +CONFIG_ARCH_CORTEXM3=y +CONFIG_ARCH_FAMILY="armv7-m" +CONFIG_ARCH_CHIP="lpc17xx" +CONFIG_ARCH_HAVE_MPU=y +# CONFIG_ARMV7M_MPU is not set +CONFIG_BOARD_LOOPSPERMSEC=8079 +# CONFIG_ARCH_CALIBRATION is not set + +# +# ARMV7M Configuration Options +# +CONFIG_ARMV7M_TOOLCHAIN_BUILDROOT=y +# CONFIG_ARMV7M_TOOLCHAIN_CODEREDL is not set +# CONFIG_ARMV7M_TOOLCHAIN_CODESOURCERYL is not set +# CONFIG_ARMV7M_TOOLCHAIN_GNU_EABI is not set +CONFIG_ARMV7M_OABI_TOOLCHAIN=y + +# +# LPC17xx Configuration Options +# +# CONFIG_ARCH_CHIP_LPC1751 is not set +# CONFIG_ARCH_CHIP_LPC1752 is not set +# CONFIG_ARCH_CHIP_LPC1754 is not set +# CONFIG_ARCH_CHIP_LPC1756 is not set +# CONFIG_ARCH_CHIP_LPC1758 is not set +# CONFIG_ARCH_CHIP_LPC1759 is not set +# CONFIG_ARCH_CHIP_LPC1764 is not set +# CONFIG_ARCH_CHIP_LPC1765 is not set +# CONFIG_ARCH_CHIP_LPC1766 is not set +# CONFIG_ARCH_CHIP_LPC1767 is not set +# CONFIG_ARCH_CHIP_LPC1768 is not set +# CONFIG_ARCH_CHIP_LPC1769 is not set +# CONFIG_ARCH_CHIP_LPC1773 is not set +# CONFIG_ARCH_CHIP_LPC1774 is not set +# CONFIG_ARCH_CHIP_LPC1776 is not set +# CONFIG_ARCH_CHIP_LPC1777 is not set +# CONFIG_ARCH_CHIP_LPC1778 is not set +# CONFIG_ARCH_CHIP_LPC1785 is not set +# CONFIG_ARCH_CHIP_LPC1786 is not set +# CONFIG_ARCH_CHIP_LPC1787 is not set +CONFIG_ARCH_CHIP_LPC1788=y +CONFIG_ARCH_FAMILY_LPC178X=y + +# +# LPC17xx Peripheral Support +# +CONFIG_LPC17_MAINOSC=y +CONFIG_LPC17_PLL0=y +CONFIG_LPC17_PLL1=y +# CONFIG_LPC17_ETHERNET is not set +# CONFIG_LPC17_USBHOST is not set +# CONFIG_LPC17_USBDEV is not set +CONFIG_LPC17_UART0=y +# CONFIG_LPC17_UART1 is not set +# CONFIG_LPC17_UART2 is not set +# CONFIG_LPC17_UART3 is not set +# CONFIG_LPC17_CAN1 is not set +# CONFIG_LPC17_CAN2 is not set +# CONFIG_LPC17_SPI is not set +# CONFIG_LPC17_SSP0 is not set +# CONFIG_LPC17_SSP1 is not set +# CONFIG_LPC17_I2C0 is not set +# CONFIG_LPC17_I2C1 is not set +# CONFIG_LPC17_I2C2 is not set +# CONFIG_LPC17_I2S is not set +# CONFIG_LPC17_TMR0 is not set +# CONFIG_LPC17_TMR1 is not set +# CONFIG_LPC17_TMR2 is not set +# CONFIG_LPC17_TMR3 is not set +# CONFIG_LPC17_RIT is not set +# CONFIG_LPC17_PWM is not set +# CONFIG_LPC17_MCPWM is not set +# CONFIG_LPC17_QEI is not set +# CONFIG_LPC17_RTC is not set +# CONFIG_LPC17_WDT is not set +# CONFIG_LPC17_ADC is not set +# CONFIG_LPC17_DAC is not set +# CONFIG_LPC17_GPDMA is not set +# CONFIG_LPC17_FLASH is not set + +# +# Serial driver options +# +# CONFIG_SERIAL_TERMIOS is not set +# CONFIG_UART0_FLOWCONTROL is not set + +# +# ADC driver options +# + +# +# CAN driver options +# +# CONFIG_GPIO_IRQ is not set + +# +# I2C driver options +# + +# +# Ethernet driver options +# + +# +# USB device driver options +# + +# +# USB host driver options +# + +# +# External Memory Configuration +# +CONFIG_ARCH_HAVE_EXTNAND=y +CONFIG_ARCH_HAVE_EXTNOR=y +CONFIG_ARCH_HAVE_EXTDRAM=y +CONFIG_ARCH_HAVE_EXTSRAM0=y +CONFIG_ARCH_EXTNAND=y +CONFIG_ARCH_EXTNANDSIZE=134217728 +CONFIG_ARCH_EXTNOR=y +CONFIG_ARCH_EXTNORSIZE=4194304 +CONFIG_ARCH_EXTDRAM=y +CONFIG_ARCH_EXTDRAMSIZE=67108864 +CONFIG_ARCH_EXTDRAMHEAP=y +CONFIG_ARCH_EXTSRAM0=y +CONFIG_ARCH_EXTSRAM0SIZE=131072 +CONFIG_ARCH_EXTSRAM0HEAP=y + +# +# Architecture Options +# +# CONFIG_ARCH_NOINTC is not set +# CONFIG_ARCH_VECNOTIRQ is not set +# CONFIG_ARCH_DMA is not set +CONFIG_ARCH_IRQPRIO=y +# CONFIG_CUSTOM_STACK is not set +# CONFIG_ADDRENV is not set +CONFIG_ARCH_HAVE_VFORK=y +CONFIG_ARCH_STACKDUMP=y +# CONFIG_ENDIAN_BIG is not set +# CONFIG_ARCH_HAVE_RAMFUNCS is not set + +# +# Board Settings +# +CONFIG_DRAM_START=0x10000000 +CONFIG_DRAM_SIZE=65536 +CONFIG_ARCH_HAVE_INTERRUPTSTACK=y +CONFIG_ARCH_INTERRUPTSTACK=0 + +# +# Boot options +# +# CONFIG_BOOT_RUNFROMEXTSRAM is not set +CONFIG_BOOT_RUNFROMFLASH=y +# CONFIG_BOOT_RUNFROMISRAM is not set +# CONFIG_BOOT_RUNFROMSDRAM is not set +# CONFIG_BOOT_COPYTORAM is not set + +# +# Board Selection +# +CONFIG_ARCH_BOARD_OPEN1788=y +# CONFIG_ARCH_BOARD_CUSTOM is not set +CONFIG_ARCH_BOARD="open1788" + +# +# Common Board Options +# + +# +# Board-Specific Options +# + +# +# RTOS Features +# +CONFIG_MSEC_PER_TICK=10 +CONFIG_RR_INTERVAL=200 +# CONFIG_SCHED_INSTRUMENTATION is not set +CONFIG_TASK_NAME_SIZE=0 +# CONFIG_SCHED_HAVE_PARENT is not set +# CONFIG_JULIAN_TIME is not set +CONFIG_START_YEAR=2013 +CONFIG_START_MONTH=1 +CONFIG_START_DAY=15 +CONFIG_DEV_CONSOLE=y +# CONFIG_MUTEX_TYPES is not set +# CONFIG_PRIORITY_INHERITANCE is not set +# CONFIG_FDCLONE_DISABLE is not set +# CONFIG_FDCLONE_STDIO is not set +CONFIG_SDCLONE_DISABLE=y +# CONFIG_SCHED_WORKQUEUE is not set +# CONFIG_SCHED_WAITPID is not set +# CONFIG_SCHED_ATEXIT is not set +# CONFIG_SCHED_ONEXIT is not set +CONFIG_USER_ENTRYPOINT="ostest_main" +CONFIG_DISABLE_OS_API=y +# CONFIG_DISABLE_CLOCK is not set +# CONFIG_DISABLE_POSIX_TIMERS is not set +# CONFIG_DISABLE_PTHREAD is not set +# CONFIG_DISABLE_SIGNALS is not set +# CONFIG_DISABLE_MQUEUE is not set +CONFIG_DISABLE_MOUNTPOINT=y +CONFIG_DISABLE_ENVIRON=y +CONFIG_DISABLE_POLL=y + +# +# Signal Numbers +# +CONFIG_SIG_SIGUSR1=1 +CONFIG_SIG_SIGUSR2=2 +CONFIG_SIG_SIGALARM=3 +CONFIG_SIG_SIGCONDTIMEDOUT=16 + +# +# Sizes of configurable things (0 disables) +# +CONFIG_MAX_TASKS=16 +CONFIG_MAX_TASK_ARGS=4 +CONFIG_NPTHREAD_KEYS=4 +CONFIG_NFILE_DESCRIPTORS=8 +CONFIG_NFILE_STREAMS=8 +CONFIG_NAME_MAX=32 +CONFIG_PREALLOC_MQ_MSGS=4 +CONFIG_MQ_MAXMSGSIZE=32 +CONFIG_MAX_WDOGPARMS=2 +CONFIG_PREALLOC_WDOGS=4 +CONFIG_PREALLOC_TIMERS=4 + +# +# Stack and heap information +# +CONFIG_IDLETHREAD_STACKSIZE=1024 +CONFIG_USERMAIN_STACKSIZE=2048 +CONFIG_PTHREAD_STACK_MIN=256 +CONFIG_PTHREAD_STACK_DEFAULT=2048 + +# +# Device Drivers +# +CONFIG_DEV_NULL=y +# CONFIG_DEV_ZERO is not set +# CONFIG_LOOP is not set +# CONFIG_RAMDISK is not set +# CONFIG_CAN is not set +# CONFIG_PWM is not set +# CONFIG_I2C is not set +# CONFIG_SPI is not set +# CONFIG_RTC is not set +# CONFIG_WATCHDOG is not set +# CONFIG_ANALOG is not set +# CONFIG_BCH is not set +# CONFIG_INPUT is not set +# CONFIG_LCD is not set +# CONFIG_MMCSD is not set +# CONFIG_MTD is not set +# CONFIG_PIPES is not set +# CONFIG_PM is not set +# CONFIG_POWER is not set +# CONFIG_SENSORS is not set +# CONFIG_SERCOMM_CONSOLE is not set +CONFIG_SERIAL=y +CONFIG_DEV_LOWCONSOLE=y +# CONFIG_16550_UART is not set +CONFIG_ARCH_HAVE_UART0=y +CONFIG_MCU_SERIAL=y +CONFIG_UART0_SERIAL_CONSOLE=y +# CONFIG_NO_SERIAL_CONSOLE is not set + +# +# UART0 Configuration +# +CONFIG_UART0_RXBUFSIZE=256 +CONFIG_UART0_TXBUFSIZE=256 +CONFIG_UART0_BAUD=115200 +CONFIG_UART0_BITS=8 +CONFIG_UART0_PARITY=0 +CONFIG_UART0_2STOP=0 +# CONFIG_USBDEV is not set +# CONFIG_USBHOST is not set +# CONFIG_WIRELESS is not set + +# +# System Logging Device Options +# + +# +# System Logging +# +# CONFIG_RAMLOG is not set + +# +# Networking Support +# +# CONFIG_NET is not set + +# +# File Systems +# + +# +# File system configuration +# +# CONFIG_FS_RAMMAP is not set + +# +# System Logging +# +# CONFIG_SYSLOG is not set + +# +# Graphics Support +# +# CONFIG_NX is not set + +# +# Memory Management +# +# CONFIG_MM_SMALL is not set +CONFIG_MM_REGIONS=2 +# CONFIG_GRAN is not set + +# +# Binary Formats +# +# CONFIG_BINFMT_DISABLE is not set +# CONFIG_NXFLAT is not set +# CONFIG_ELF is not set +# CONFIG_BUILTIN is not set +# CONFIG_PIC is not set +CONFIG_SYMTAB_ORDEREDBYNAME=y + +# +# Library Routines +# + +# +# Standard C Library Options +# +CONFIG_STDIO_BUFFER_SIZE=256 +CONFIG_STDIO_LINEBUFFER=y +CONFIG_NUNGET_CHARS=2 +# CONFIG_LIBM is not set +# CONFIG_NOPRINTF_FIELDWIDTH is not set +# CONFIG_LIBC_FLOATINGPOINT is not set +# CONFIG_EOL_IS_CR is not set +# CONFIG_EOL_IS_LF is not set +# CONFIG_EOL_IS_BOTH_CRLF is not set +CONFIG_EOL_IS_EITHER_CRLF=y +# CONFIG_LIBC_EXECFUNCS is not set +# CONFIG_LIBC_STRERROR is not set +# CONFIG_LIBC_PERROR_STDOUT is not set +CONFIG_ARCH_LOWPUTC=y +CONFIG_LIB_SENDFILE_BUFSIZE=512 +# CONFIG_ARCH_ROMGETC is not set +# CONFIG_ARCH_OPTIMIZED_FUNCTIONS is not set + +# +# Non-standard Helper Functions +# +# CONFIG_LIB_KBDCODEC is not set + +# +# Basic CXX Support +# +# CONFIG_C99_BOOL8 is not set +# CONFIG_HAVE_CXX is not set + +# +# Application Configuration +# + +# +# Built-In Applications +# + +# +# Examples +# +# CONFIG_EXAMPLES_BUTTONS is not set +# CONFIG_EXAMPLES_CAN is not set +# CONFIG_EXAMPLES_CDCACM is not set +# CONFIG_EXAMPLES_COMPOSITE is not set +# CONFIG_EXAMPLES_DHCPD is not set +# CONFIG_EXAMPLES_ELF is not set +# CONFIG_EXAMPLES_FTPC is not set +# CONFIG_EXAMPLES_FTPD is not set +# CONFIG_EXAMPLES_HELLO is not set +# CONFIG_EXAMPLES_HELLOXX is not set +# CONFIG_EXAMPLES_JSON is not set +# CONFIG_EXAMPLES_HIDKBD is not set +# CONFIG_EXAMPLES_KEYPADTEST is not set +# CONFIG_EXAMPLES_IGMP is not set +# CONFIG_EXAMPLES_LCDRW is not set +# CONFIG_EXAMPLES_MM is not set +# CONFIG_EXAMPLES_MOUNT is not set +# CONFIG_EXAMPLES_MODBUS is not set +# CONFIG_EXAMPLES_NETTEST is not set +# CONFIG_EXAMPLES_NSH is not set +# CONFIG_EXAMPLES_NULL is not set +# CONFIG_EXAMPLES_NX is not set +# CONFIG_EXAMPLES_NXCONSOLE is not set +# CONFIG_EXAMPLES_NXFFS is not set +# CONFIG_EXAMPLES_NXFLAT is not set +# CONFIG_EXAMPLES_NXHELLO is not set +# CONFIG_EXAMPLES_NXIMAGE is not set +# CONFIG_EXAMPLES_NXLINES is not set +# CONFIG_EXAMPLES_NXTEXT is not set +CONFIG_EXAMPLES_OSTEST=y +# CONFIG_EXAMPLES_OSTEST_BUILTIN is not set +CONFIG_EXAMPLES_OSTEST_LOOPS=1 +CONFIG_EXAMPLES_OSTEST_STACKSIZE=2048 +CONFIG_EXAMPLES_OSTEST_NBARRIER_THREADS=3 +CONFIG_EXAMPLES_OSTEST_RR_RANGE=10000 +CONFIG_EXAMPLES_OSTEST_RR_RUNS=10 +# CONFIG_EXAMPLES_PASHELLO is not set +# CONFIG_EXAMPLES_PIPE is not set +# CONFIG_EXAMPLES_POLL is not set +# CONFIG_EXAMPLES_POSIXSPAWN is not set +# CONFIG_EXAMPLES_QENCODER is not set +# CONFIG_EXAMPLES_RGMP is not set +# CONFIG_EXAMPLES_ROMFS is not set +# CONFIG_EXAMPLES_SENDMAIL is not set +# CONFIG_EXAMPLES_SERLOOP is not set +# CONFIG_EXAMPLES_TELNETD is not set +# CONFIG_EXAMPLES_THTTPD is not set +# CONFIG_EXAMPLES_TIFF is not set +# CONFIG_EXAMPLES_TOUCHSCREEN is not set +# CONFIG_EXAMPLES_UDP is not set +# CONFIG_EXAMPLES_UIP is not set +# CONFIG_EXAMPLES_USBSERIAL is not set +# CONFIG_EXAMPLES_USBMSC is not set +# CONFIG_EXAMPLES_USBTERM is not set +# CONFIG_EXAMPLES_WATCHDOG is not set + +# +# Interpreters +# + +# +# Interpreters +# +# CONFIG_INTERPRETERS_FICL is not set +# CONFIG_INTERPRETERS_PCODE is not set + +# +# Network Utilities +# + +# +# Networking Utilities +# +# CONFIG_NETUTILS_CODECS is not set +# CONFIG_NETUTILS_DHCPC is not set +# CONFIG_NETUTILS_DHCPD is not set +# CONFIG_NETUTILS_FTPC is not set +# CONFIG_NETUTILS_FTPD is not set +# CONFIG_NETUTILS_JSON is not set +# CONFIG_NETUTILS_RESOLV is not set +# CONFIG_NETUTILS_SMTP is not set +# CONFIG_NETUTILS_TELNETD is not set +# CONFIG_NETUTILS_TFTPC is not set +# CONFIG_NETUTILS_THTTPD is not set +# CONFIG_NETUTILS_UIPLIB is not set +# CONFIG_NETUTILS_WEBCLIENT is not set + +# +# ModBus +# + +# +# FreeModbus +# +# CONFIG_MODBUS is not set + +# +# NSH Library +# +# CONFIG_NSH_LIBRARY is not set + +# +# NxWidgets/NxWM +# + +# +# System NSH Add-Ons +# + +# +# Custom Free Memory Command +# +# CONFIG_SYSTEM_FREE is not set + +# +# I2C tool +# + +# +# FLASH Program Installation +# +# CONFIG_SYSTEM_INSTALL is not set + +# +# readline() +# +# CONFIG_SYSTEM_READLINE is not set + +# +# Power Off +# +# CONFIG_SYSTEM_POWEROFF is not set + +# +# RAMTRON +# +# CONFIG_SYSTEM_RAMTRON is not set + +# +# SD Card +# +# CONFIG_SYSTEM_SDCARD is not set + +# +# Sysinfo +# +# CONFIG_SYSTEM_SYSINFO is not set diff --git a/nuttx/configs/open1788/ostest/setenv.sh b/nuttx/configs/open1788/ostest/setenv.sh new file mode 100755 index 0000000000..ecbc9ef1c3 --- /dev/null +++ b/nuttx/configs/open1788/ostest/setenv.sh @@ -0,0 +1,73 @@ +#!/bin/bash +# configs/open1788/ostest/setenv.sh +# +# Copyright (C) 2013 Gregory Nutt. All rights reserved. +# Author: Gregory Nutt +# +# 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. +# + +if [ "$_" = "$0" ] ; then + echo "You must source this script, not run it!" 1>&2 + exit 1 +fi + +WD=`pwd` +if [ ! -x "setenv.sh" ]; then + echo "This script must be executed from the top-level NuttX build directory" + exit 1 +fi + +if [ -z "${PATH_ORIG}" ]; then + export PATH_ORIG="${PATH}" +fi + +# This is the Cygwin path to the location where I installed the CodeSourcery +# toolchain under windows. You will also have to edit this if you install +# the CodeSourcery toolchain in any other location +# export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/CodeSourcery/Sourcery G++ Lite/bin" + +# These are the Cygwin paths to the locations where I installed the Atollic +# toolchain under windows. You will also have to edit this if you install +# the Atollic toolchain in any other location. /usr/bin is added before +# the Atollic bin path because there is are binaries named gcc.exe and g++.exe +# at those locations as well. +#export TOOLCHAIN_BIN="/usr/bin:/cygdrive/c/Program Files (x86)/Atollic/TrueSTUDIO for ARM Pro 2.3.0/ARMTools/bin" +#export TOOLCHAIN_BIN="/usr/bin:/cygdrive/c/Program Files (x86)/Atollic/TrueSTUDIO for STMicroelectronics STM32 Lite 2.3.0/ARMTools/bin" + +# This is the Cygwin path to the location where I build the buildroot +# toolchain. +export TOOLCHAIN_BIN="${WD}/../misc/buildroot/build_arm_nofpu/staging_dir/bin" + +# The Olimex-lpc1766stk/tools directory +export LPCTOOL_DIR="${WD}/configs/olimex-lpc1766stk/tools" + +# Add the path to the toolchain and tools directory to the PATH varialble +export PATH="${TOOLCHAIN_BIN}:${LPCTOOL_DIR}:/sbin:/usr/sbin:${PATH_ORIG}" + +echo "PATH : ${PATH}" diff --git a/nuttx/configs/open1788/scripts/ld.script b/nuttx/configs/open1788/scripts/ld.script new file mode 100755 index 0000000000..a4ca9cf804 --- /dev/null +++ b/nuttx/configs/open1788/scripts/ld.script @@ -0,0 +1,135 @@ +/**************************************************************************** + * configs/open1788/scripts/ld.script + * + * Copyright (C) 2013 Gregory Nutt. All rights reserved. + * Author: Rommel Marcelo + * Gregory Nutt + * + * 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. + * + ****************************************************************************/ + +/* The LPC1788 has 512Kb of FLASH beginning at address 0x0000:0000 and + * 96Kb of total SRAM: 64Kb of SRAM in the CPU block beginning at address + * 0x10000000 and 32Kb of Peripheral SRAM in two banks, 8Kb at addresses + * 0x20000000 bank0 first and 8kb at 0x20020000 at bank0 second. And 16Kb + * at 0x20040000 on bank1. + * Here we assume that .data and .bss will all fit + * into the 64Kb CPU SRAM address range. + */ + +MEMORY +{ + FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 512K + SRAM (rwx) : ORIGIN = 0x10000000, LENGTH = 64K + PSRAM0 (rwx) : ORIGIN = 0x20000000, LENGTH = 16K /* Peripheral SRAM Bank 0 */ + PSRAM1 (rwx) : ORIGIN = 0x20040000, LENGTH = 16K /* Peripheral SRAM Bank 1 */ +} + +OUTPUT_ARCH(arm) +ENTRY(_stext) +SECTIONS +{ + .text : { + _stext = ABSOLUTE(.); + *(.vectors) + *(.text .text.*) + *(.fixup) + *(.gnu.warning) + *(.rodata .rodata.*) + *(.gnu.linkonce.t.*) + *(.glue_7) + *(.glue_7t) + *(.got) + *(.gcc_except_table) + *(.gnu.linkonce.r.*) + _etext = ABSOLUTE(.); + } > FLASH + + .init_section : { + _sinit = ABSOLUTE(.); + *(.init_array .init_array.*) + _einit = ABSOLUTE(.); + } > FLASH + + .ARM.extab : { + *(.ARM.extab*) + } > FLASH + + __exidx_start = ABSOLUTE(.); + .ARM.exidx : { + *(.ARM.exidx*) + } > FLASH + __exidx_end = ABSOLUTE(.); + + _eronly = ABSOLUTE(.); + + .data : { + _sdata = ABSOLUTE(.); + *(.data .data.*) + *(.gnu.linkonce.d.*) + CONSTRUCTORS + _edata = ABSOLUTE(.); + } > SRAM AT > FLASH + + .bss : { + _sbss = ABSOLUTE(.); + *(.bss .bss.*) + *(.gnu.linkonce.b.*) + *(COMMON) + _ebss = ABSOLUTE(.); + } > SRAM + + .psram0 (NOLOAD) : + { + *(.psram0) + . = ALIGN(4) + } > PSRAM0 + + + .psram1 (NOLOAD) : + { + *(.psram0) + . = ALIGN(4) + } > PSRAM1 + + /* Stabs debugging sections */ + + .stab 0 : { *(.stab) } + .stabstr 0 : { *(.stabstr) } + .stab.excl 0 : { *(.stab.excl) } + .stab.exclstr 0 : { *(.stab.exclstr) } + .stab.index 0 : { *(.stab.index) } + .stab.indexstr 0 : { *(.stab.indexstr) } + .comment 0 : { *(.comment) } + .debug_abbrev 0 : { *(.debug_abbrev) } + .debug_info 0 : { *(.debug_info) } + .debug_line 0 : { *(.debug_line) } + .debug_pubnames 0 : { *(.debug_pubnames) } + .debug_aranges 0 : { *(.debug_aranges) } +} From 070651221f4f60c2074e7641affa10e2b8714f07 Mon Sep 17 00:00:00 2001 From: patacongo Date: Sat, 19 Jan 2013 16:40:43 +0000 Subject: [PATCH 092/118] Add split package logic to improve TCP send performance with delayed ACKs git-svn-id: http://svn.code.sf.net/p/nuttx/code/trunk@5538 42af7a65-404d-4744-a932-0658087f49c3 --- apps/ChangeLog.txt | 2 + apps/examples/ftpd/Makefile | 2 +- nuttx/ChangeLog | 2 + nuttx/configs/olimex-lpc1766stk/nsh/defconfig | 14 +++ nuttx/net/Kconfig | 35 ++++++- nuttx/net/send.c | 99 ++++++++++++++++++- 6 files changed, 150 insertions(+), 4 deletions(-) diff --git a/apps/ChangeLog.txt b/apps/ChangeLog.txt index ba8dec613a..a445c20243 100644 --- a/apps/ChangeLog.txt +++ b/apps/ChangeLog.txt @@ -488,3 +488,5 @@ * apps/nshlib/nsh_fileapp.c: Add the ability to execute a file from a file system using posix_spawn(). * apps/builtin/: Extensions from Mike Smith. + * apps/examples/ftpd/Makefile: Name ftpd_start is not the name of + the entrypoint. Should be ftpd_main (from Yan T.) diff --git a/apps/examples/ftpd/Makefile b/apps/examples/ftpd/Makefile index dd18d5043b..61752931c6 100644 --- a/apps/examples/ftpd/Makefile +++ b/apps/examples/ftpd/Makefile @@ -80,7 +80,7 @@ $(COBJS): %$(OBJEXT): %.c ifeq ($(CONFIG_NSH_BUILTIN_APPS),y) $(BUILTIN_REGISTRY)$(DELIM)ftpd_start.bdat: $(DEPCONFIG) Makefile - $(call REGISTER,ftpd_start,SCHED_PRIORITY_DEFAULT,2048,ftpd_start) + $(call REGISTER,ftpd_start,SCHED_PRIORITY_DEFAULT,2048,ftpd_main) $(BUILTIN_REGISTRY)$(DELIM)ftpd_stop.bdat: $(DEPCONFIG) Makefile $(call REGISTER,ftpd_stop,SCHED_PRIORITY_DEFAULT,2048,ftpd_stop) diff --git a/nuttx/ChangeLog b/nuttx/ChangeLog index a5bcaf1bce..122187410a 100644 --- a/nuttx/ChangeLog +++ b/nuttx/ChangeLog @@ -3987,3 +3987,5 @@ * configs/open1788: Board configuration for the Wave Share Open1788 board. Still fragmentary (contribnuted by Rommel Marcelo, adapted to use kconfig-frontends. + * net/send(): Add logic to work around delayed ACKs by splitting + packets (contributed by Yan T.). diff --git a/nuttx/configs/olimex-lpc1766stk/nsh/defconfig b/nuttx/configs/olimex-lpc1766stk/nsh/defconfig index 0f16933b89..c77f3f0c26 100755 --- a/nuttx/configs/olimex-lpc1766stk/nsh/defconfig +++ b/nuttx/configs/olimex-lpc1766stk/nsh/defconfig @@ -193,6 +193,10 @@ CONFIG_NET_PRIORITY=0 # USB host driver options # +# +# External Memory Configuration +# + # # Architecture Options # @@ -396,6 +400,10 @@ CONFIG_NET_NACTIVESOCKETS=16 CONFIG_NET_SOCKOPTS=y CONFIG_NET_BUFSIZE=562 # CONFIG_NET_TCPURGDATA is not set + +# +# TCP/IP Networking +# CONFIG_NET_TCP=y CONFIG_NET_TCP_CONNS=8 CONFIG_NET_MAX_LISTENPORTS=8 @@ -403,6 +411,12 @@ CONFIG_NET_TCP_READAHEAD_BUFSIZE=562 CONFIG_NET_NTCP_READAHEAD_BUFFERS=16 CONFIG_NET_TCP_RECVDELAY=0 # CONFIG_NET_TCPBACKLOG is not set +CONFIG_NET_TCP_SPLIT=y +CONFIG_NET_TCP_SPLIT_SIZE=40 + +# +# UDP Networking +# CONFIG_NET_UDP=y CONFIG_NET_UDP_CHECKSUMS=y CONFIG_NET_UDP_CONNS=8 diff --git a/nuttx/net/Kconfig b/nuttx/net/Kconfig index d4ea8befb5..6a084914fb 100644 --- a/nuttx/net/Kconfig +++ b/nuttx/net/Kconfig @@ -97,14 +97,14 @@ config NET_TCPURGDATA compiled in. Urgent data (out-of-band data) is a rarely used TCP feature that is very seldom would be required. +menu "TCP/IP Networking" + config NET_TCP bool "TCP/IP Networking" default n ---help--- TCP support on or off -endif - if NET_TCP config NET_TCP_CONNS int "Number of TCP/IP connections" @@ -164,7 +164,36 @@ config NET_TCPBACKLOG Incoming connections pend in a backlog until accept() is called. The size of the backlog is selected when listen() is called. +config NET_TCP_SPLIT + bool "Enable packet splitting" + default n + ---help--- + send() will not return until the the transfer has been ACKed by the + recipient. But under RFC 1122, the host need not ACK each packet + immediately; the host may wait for 500 MS before ACKing. This + combination can cause very slow performance with small transfers are + made to an RFC 1122 client. However, the RFC 1122 must ACK at least + every second (odd) packet. + + This option enables logic to trick the RFC 1122 host be exploiting + this last RFC 1122 requirement: If an odd number of packets were to + be sent, then send() will split the last even packet to guarantee + that an even number of packets will be sent and the RFC 1122 host + will ACK the final packet immediately. + +if NET_TCP_SPLIT + +config NET_TCP_SPLIT_SIZE + int "Split size threshold" + default 40 + ---help--- + Packets of this size or smaller than this will not be split. + endif +endif +endmenu + +menu "UDP Networking" config NET_UDP bool "UDP Networking" @@ -193,6 +222,7 @@ config NET_BROADCAST Incoming UDP broadcast support endif +endmenu config NET_ICMP bool "ICMP networking support" @@ -321,3 +351,4 @@ config SLIP_DEFPRIO The priority of the SLIP RX and TX tasks. Default: 128 endif +endif diff --git a/nuttx/net/send.c b/nuttx/net/send.c index 8a5154191e..b75a864e3b 100644 --- a/nuttx/net/send.c +++ b/nuttx/net/send.c @@ -1,7 +1,7 @@ /**************************************************************************** * net/send.c * - * Copyright (C) 2007-2012 Gregory Nutt. All rights reserved. + * Copyright (C) 2007-2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -42,7 +42,9 @@ #include #include + #include +#include #include #include #include @@ -62,6 +64,10 @@ * Definitions ****************************************************************************/ +#if defined(CONFIG_NET_TCP_SPLIT) && !defined(CONFIG_NET_TCP_SPLIT_SIZE) +# define CONFIG_NET_TCP_SPLIT_SIZE 40 +#endif + #define TCPBUF ((struct uip_tcpip_hdr *)&dev->d_buf[UIP_LLH_LEN]) /**************************************************************************** @@ -85,6 +91,9 @@ struct send_s #if defined(CONFIG_NET_SOCKOPTS) && !defined(CONFIG_DISABLE_CLOCK) uint32_t snd_time; /* last send time for determining timeout */ #endif +#if defined(CONFIG_NET_TCP_SPLIT) + bool snd_odd; /* True: Odd packet in pair transaction */ +#endif }; /**************************************************************************** @@ -200,6 +209,14 @@ static uint16_t send_interrupt(struct uip_driver_s *dev, void *pvconn, pstate->snd_sent = pstate->snd_acked; +#if defined(CONFIG_NET_TCP_SPLIT) + /* Reset the the even/odd indicator to even since we need to + * retransmit. + */ + + pstate->snd_odd = false; +#endif + /* Fall through to re-send data from the last that was ACKed */ } @@ -242,6 +259,86 @@ static uint16_t send_interrupt(struct uip_driver_s *dev, void *pvconn, /* Get the amount of data that we can send in the next packet */ uint32_t sndlen = pstate->snd_buflen - pstate->snd_sent; + + +#if defined(CONFIG_NET_TCP_SPLIT) + + /* RFC 1122 states that a host may delay ACKing for up to 500ms but + * must respond to every second segment). This logic here will trick + * the RFC 1122 recipient into responding sooner. This logic will be + * activated if: + * + * 1. An even number of packets has been send (where zero is an even + * number), + * 2. There is more data be sent (more than or equal to + * CONFIG_NET_TCP_SPLIT_SIZE), but + * 3. Not enough data for two packets. + * + * Then we will split the remaining, single packet into two partial + * packets. This will stimulate the RFC 1122 not into ACKing sooner. + * + * Check if there is more data to be sent (more than or equal to + * CONFIG_NET_TCP_SPLIT_SIZE): + */ + + if (sndlen >= CONFIG_NET_TCP_SPLIT_SIZE) + { + /* sndlen is the number of bytes remaining to be sent. + * uip_mss(conn) will return the number of bytes that can sent + * in one packet. The difference, then, is the number of bytes + * that would be sent in the next packet after this one. + */ + + int32_t next_sndlen = sndlen - uip_mss(conn); + + /* Is this the even packet in the packet pair transaction? */ + + if (!pstate->snd_odd) + { + /* next_sndlen <= 0 means that the entire remaining data + * could fit into this single packet. This is condition + * in which we must do the split. + */ + + if (next_sndlen <= 0) + { + /* Split so that there will be an odd packet. Here + * we know that 0 < sndlen <= MSS + */ + + sndlen = (sndlen / 2) + 1; + } + } + + /* No... this is the odd packet in the packet pair transaction */ + + else + { + /* Will there be another (even) packet afer this one? + * (next_sndlen > 0) Will the split conidition occur on that + * next, even packet? ((next_sndlen - uip_mss(conn)) < 0) If + * so, then perform the split now to avoid the case where the + * byte count is less than CONFIG_NET_TCP_SPLIT_SIZE on the + * next pair. + */ + + if (next_sndlen > 0 && (next_sndlen - uip_mss(conn)) < 0) + { + /* Here, we know that sndlen must be MSS <= sndlen <= 2*MSS + * and so (sndlen / 2) is <= MSS. + */ + + sndlen /= 2; + } + } + } + + /* Toggle the even/odd indicator */ + + pstate->snd_odd ^= true; + +#endif /* CONFIG_NET_TCP_SPLIT */ + if (sndlen > uip_mss(conn)) { sndlen = uip_mss(conn); From 1094575ce544860bc66b7c88d6b5eaf419d5ed7d Mon Sep 17 00:00:00 2001 From: patacongo Date: Sat, 19 Jan 2013 19:18:44 +0000 Subject: [PATCH 093/118] Fix a bug where recv[from]() would hang when remote host gracefully closed connection git-svn-id: http://svn.code.sf.net/p/nuttx/code/trunk@5539 42af7a65-404d-4744-a932-0658087f49c3 --- nuttx/ChangeLog | 4 ++++ nuttx/net/recvfrom.c | 24 +++++++++++++++++++++++- nuttx/net/send.c | 2 +- 3 files changed, 28 insertions(+), 2 deletions(-) diff --git a/nuttx/ChangeLog b/nuttx/ChangeLog index 122187410a..80944db66b 100644 --- a/nuttx/ChangeLog +++ b/nuttx/ChangeLog @@ -3989,3 +3989,7 @@ Marcelo, adapted to use kconfig-frontends. * net/send(): Add logic to work around delayed ACKs by splitting packets (contributed by Yan T.). + * net/recvfrom(): Fix a bug. When the host closes a connection + (gracefully). recv[from]() returned success and the closure + was never detected. Hmmm.. I don't know why the network monitor + did not catch this event. This is an important bug fix. diff --git a/nuttx/net/recvfrom.c b/nuttx/net/recvfrom.c index 6bfbd31ad3..679b5e8ce6 100644 --- a/nuttx/net/recvfrom.c +++ b/nuttx/net/recvfrom.c @@ -83,7 +83,7 @@ struct recvfrom_s FAR struct sockaddr_in *rf_from; /* Address of sender */ #endif size_t rf_recvlen; /* The received length */ - int rf_result; /* OK:success, failure:negated errno */ + int rf_result; /* Success:OK, failure:negated errno */ }; #endif /* CONFIG_NET_UDP || CONFIG_NET_TCP */ @@ -553,6 +553,8 @@ static uint16_t recvfrom_tcpinterrupt(struct uip_driver_s *dev, void *conn, else if ((flags & (UIP_CLOSE|UIP_ABORT|UIP_TIMEDOUT)) != 0) { + FAR struct socket *psock = 0; + nllvdbg("error\n"); /* Stop further callbacks */ @@ -563,9 +565,29 @@ static uint16_t recvfrom_tcpinterrupt(struct uip_driver_s *dev, void *conn, /* If the peer gracefully closed the connection, then return zero * (end-of-file). Otherwise, report a not-connected error + * _SF_CONNECTED==0 && _SF_CLOSED==1 - the socket was + * gracefully disconnected + * _SF_CONNECTED==0 && _SF_CLOSED==0 - the socket was + * rudely disconnected */ + psock = pstate->rf_sock; if ((flags & UIP_CLOSE) != 0) + { + psock->s_flags &= ~_SF_CONNECTED; + psock->s_flags |= _SF_CLOSED; + } + else + { + psock->s_flags &= ~(_SF_CONNECTED |_SF_CLOSED); + } + + /* If no data has been received, then return ENOTCONN. + * Otherwise, let this return success. The failure will + * be reported the next time that recv[from]() is called. + */ + + if (pstate->rf_recvlen > 0) { pstate->rf_result = 0; } diff --git a/nuttx/net/send.c b/nuttx/net/send.c index b75a864e3b..8c07b391c8 100644 --- a/nuttx/net/send.c +++ b/nuttx/net/send.c @@ -324,7 +324,7 @@ static uint16_t send_interrupt(struct uip_driver_s *dev, void *pvconn, if (next_sndlen > 0 && (next_sndlen - uip_mss(conn)) < 0) { - /* Here, we know that sndlen must be MSS <= sndlen <= 2*MSS + /* Here, we know that sndlen must be MSS < sndlen <= 2*MSS * and so (sndlen / 2) is <= MSS. */ From 598b4b28793536198ffd145b895e2821334332da Mon Sep 17 00:00:00 2001 From: patacongo Date: Sat, 19 Jan 2013 19:45:08 +0000 Subject: [PATCH 094/118] Minor tweak to last bugfix git-svn-id: http://svn.code.sf.net/p/nuttx/code/trunk@5540 42af7a65-404d-4744-a932-0658087f49c3 --- nuttx/net/recvfrom.c | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/nuttx/net/recvfrom.c b/nuttx/net/recvfrom.c index 679b5e8ce6..ac8065f81b 100644 --- a/nuttx/net/recvfrom.c +++ b/nuttx/net/recvfrom.c @@ -563,12 +563,18 @@ static uint16_t recvfrom_tcpinterrupt(struct uip_driver_s *dev, void *conn, pstate->rf_cb->priv = NULL; pstate->rf_cb->event = NULL; - /* If the peer gracefully closed the connection, then return zero - * (end-of-file). Otherwise, report a not-connected error - * _SF_CONNECTED==0 && _SF_CLOSED==1 - the socket was - * gracefully disconnected - * _SF_CONNECTED==0 && _SF_CLOSED==0 - the socket was - * rudely disconnected + /* Check if the peer gracefully closed the connection. We need + * these flags in case we return zero (below) to remember the + * state of the connection. + * + * _SF_CONNECTED==0 && _SF_CLOSED==1 - the socket was + * gracefully disconnected + * _SF_CONNECTED==0 && _SF_CLOSED==0 - the socket was + * rudely disconnected + * + * These flag settings are probably not necessary if + * CONFIG_NET_TCP_RECVDELAY == 0; in that case we know that + * pstate->rf_recvlen == 0 and we will always return -ENOTCONN. */ psock = pstate->rf_sock; @@ -587,6 +593,7 @@ static uint16_t recvfrom_tcpinterrupt(struct uip_driver_s *dev, void *conn, * be reported the next time that recv[from]() is called. */ +#if CONFIG_NET_TCP_RECVDELAY > 0 if (pstate->rf_recvlen > 0) { pstate->rf_result = 0; @@ -595,6 +602,9 @@ static uint16_t recvfrom_tcpinterrupt(struct uip_driver_s *dev, void *conn, { pstate->rf_result = -ENOTCONN; } +#else + pstate->rf_result = -ENOTCONN; +#endif /* Wake up the waiting thread */ From 28a0cf4aa03e0a43d63492844ef3f3eee9da84a5 Mon Sep 17 00:00:00 2001 From: patacongo Date: Sun, 20 Jan 2013 00:41:33 +0000 Subject: [PATCH 095/118] Yet another repair for the previouis botched recvfrom() fix; Fix telnet driver: It needs to break out of the read loop if 0 (meaning not conneced) of a value < 0 (an error) is encountered. git-svn-id: http://svn.code.sf.net/p/nuttx/code/trunk@5541 42af7a65-404d-4744-a932-0658087f49c3 --- apps/ChangeLog.txt | 2 ++ apps/netutils/telnetd/telnetd_driver.c | 18 +++++++++-- nuttx/ChangeLog | 3 ++ nuttx/net/recvfrom.c | 45 +++++++++++++++----------- 4 files changed, 47 insertions(+), 21 deletions(-) diff --git a/apps/ChangeLog.txt b/apps/ChangeLog.txt index a445c20243..bcc0ac172c 100644 --- a/apps/ChangeLog.txt +++ b/apps/ChangeLog.txt @@ -490,3 +490,5 @@ * apps/builtin/: Extensions from Mike Smith. * apps/examples/ftpd/Makefile: Name ftpd_start is not the name of the entrypoint. Should be ftpd_main (from Yan T.) + * apps/netutils/telnetd/telnetd_driver: Was stuck in a loop if + recv[from]() ever returned a value <= 0. diff --git a/apps/netutils/telnetd/telnetd_driver.c b/apps/netutils/telnetd/telnetd_driver.c index 1183a2f70e..274fde3701 100644 --- a/apps/netutils/telnetd/telnetd_driver.c +++ b/apps/netutils/telnetd/telnetd_driver.c @@ -558,6 +558,8 @@ static ssize_t telnetd_read(FAR struct file *filep, FAR char *buffer, size_t len { if (priv->td_pending > 0) { + /* Process the buffered telnet data */ + FAR const char *src = &priv->td_rxbuffer[priv->td_offset]; ret = telnetd_receive(priv, src, priv->td_pending, buffer, len); } @@ -568,13 +570,25 @@ static ssize_t telnetd_read(FAR struct file *filep, FAR char *buffer, size_t len { ret = psock_recv(&priv->td_psock, priv->td_rxbuffer, CONFIG_TELNETD_RXBUFFER_SIZE, 0); + + /* Did we receive anything? */ + if (ret > 0) { - /* Process the received telnet data */ + /* Yes.. Process the newly received telnet data */ telnetd_dumpbuffer("Received buffer", priv->td_rxbuffer, ret); ret = telnetd_receive(priv, priv->td_rxbuffer, ret, buffer, len); } + + /* Otherwise the peer closed the connection (ret == 0) or an error + * occurred (ret < 0). + */ + + else + { + break; + } } } while (ret == 0); @@ -746,7 +760,7 @@ FAR char *telnetd_driver(int sd, FAR struct telnetd_s *daemon) * instance resided in the daemon's socket array). */ - psock = sockfd_socket(sd); + psock = sockfd_socket(sd); if (!psock) { nlldbg("Failed to convert sd=%d to a socket structure\n", sd); diff --git a/nuttx/ChangeLog b/nuttx/ChangeLog index 80944db66b..77441dd21d 100644 --- a/nuttx/ChangeLog +++ b/nuttx/ChangeLog @@ -3993,3 +3993,6 @@ (gracefully). recv[from]() returned success and the closure was never detected. Hmmm.. I don't know why the network monitor did not catch this event. This is an important bug fix. + * net/recvfrom(): Fix a introduced with the last bugfix. If + the peer does an orderly closure of the socket, report 0 not + -ENOTCONN diff --git a/nuttx/net/recvfrom.c b/nuttx/net/recvfrom.c index ac8065f81b..a1a6742c51 100644 --- a/nuttx/net/recvfrom.c +++ b/nuttx/net/recvfrom.c @@ -571,40 +571,47 @@ static uint16_t recvfrom_tcpinterrupt(struct uip_driver_s *dev, void *conn, * gracefully disconnected * _SF_CONNECTED==0 && _SF_CLOSED==0 - the socket was * rudely disconnected - * - * These flag settings are probably not necessary if - * CONFIG_NET_TCP_RECVDELAY == 0; in that case we know that - * pstate->rf_recvlen == 0 and we will always return -ENOTCONN. */ psock = pstate->rf_sock; if ((flags & UIP_CLOSE) != 0) { + /* Report that the connection was gracefully closed */ + psock->s_flags &= ~_SF_CONNECTED; psock->s_flags |= _SF_CLOSED; - } - else - { - psock->s_flags &= ~(_SF_CONNECTED |_SF_CLOSED); - } - /* If no data has been received, then return ENOTCONN. - * Otherwise, let this return success. The failure will - * be reported the next time that recv[from]() is called. - */ + /* This case should always return success (zero)! The value of + * rf_recvlen, if zero, will indicate that the connection was + * gracefully closed. + */ -#if CONFIG_NET_TCP_RECVDELAY > 0 - if (pstate->rf_recvlen > 0) - { pstate->rf_result = 0; } else { - pstate->rf_result = -ENOTCONN; - } + /* Report that the connection was rudely lost */ + + psock->s_flags &= ~(_SF_CONNECTED |_SF_CLOSED); + + /* If no data has been received, then return ENOTCONN. + * Otherwise, let this return success. The failure will + * be reported the next time that recv[from]() is called. + */ + +#if CONFIG_NET_TCP_RECVDELAY > 0 + if (pstate->rf_recvlen > 0) + { + pstate->rf_result = 0; + } + else + { + pstate->rf_result = -ENOTCONN; + } #else - pstate->rf_result = -ENOTCONN; + pstate->rf_result = -ENOTCONN; #endif + } /* Wake up the waiting thread */ From 70cab4d7975291861185e38a12a75f6c232fae56 Mon Sep 17 00:00:00 2001 From: patacongo Date: Sun, 20 Jan 2013 17:21:42 +0000 Subject: [PATCH 096/118] Centralize TCP loss-of-connection bit twiddling git-svn-id: http://svn.code.sf.net/p/nuttx/code/trunk@5542 42af7a65-404d-4744-a932-0658087f49c3 --- apps/netutils/telnetd/telnetd_driver.c | 9 ++- nuttx/net/net_internal.h | 62 ++++++++--------- nuttx/net/net_monitor.c | 93 +++++++++++++++++--------- nuttx/net/recvfrom.c | 37 +++------- nuttx/net/send.c | 11 ++- 5 files changed, 120 insertions(+), 92 deletions(-) diff --git a/apps/netutils/telnetd/telnetd_driver.c b/apps/netutils/telnetd/telnetd_driver.c index 274fde3701..1b04bfbe59 100644 --- a/apps/netutils/telnetd/telnetd_driver.c +++ b/apps/netutils/telnetd/telnetd_driver.c @@ -1,7 +1,7 @@ /**************************************************************************** * apps/netutils/telnetd_driver.c * - * Copyright (C) 2007, 2009, 2011-2012 Gregory Nutt. All rights reserved. + * Copyright (C) 2007, 2009, 2011-2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * This is a leverage of similar logic from uIP which has a compatible BSD @@ -593,6 +593,13 @@ static ssize_t telnetd_read(FAR struct file *filep, FAR char *buffer, size_t len } while (ret == 0); + /* Return: + * + * ret > 0: The number of characters copied into the user buffer by + * telnetd_receive(). + * ret <= 0: Loss of connection or error events reported by recv(). + */ + return ret; } diff --git a/nuttx/net/net_internal.h b/nuttx/net/net_internal.h index ed2f12aa75..0726c7a80f 100644 --- a/nuttx/net/net_internal.h +++ b/nuttx/net/net_internal.h @@ -1,7 +1,7 @@ /**************************************************************************** * net/net_internal.h * - * Copyright (C) 2007-2009, 2011-2012 Gregory Nutt. All rights reserved. + * Copyright (C) 2007-2009, 2011-2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -139,94 +139,96 @@ * Public Variables ****************************************************************************/ +#undef EXTERN +#if defined(__cplusplus) +#define EXTERN extern "C" +extern "C" +{ +#else +#define EXTERN extern +#endif + /* List of registered ethernet device drivers */ #if CONFIG_NSOCKET_DESCRIPTORS > 0 -extern struct uip_driver_s *g_netdevices; +EXTERN struct uip_driver_s *g_netdevices; #endif /**************************************************************************** * Public Function Prototypes ****************************************************************************/ -#undef EXTERN -#if defined(__cplusplus) -#define EXTERN extern "C" -extern "C" { -#else -#define EXTERN extern -#endif - /* net_sockets.c *************************************************************/ -EXTERN int sockfd_allocate(int minsd); -EXTERN void sock_release(FAR struct socket *psock); -EXTERN void sockfd_release(int sockfd); -EXTERN FAR struct socket *sockfd_socket(int sockfd); +int sockfd_allocate(int minsd); +void sock_release(FAR struct socket *psock); +void sockfd_release(int sockfd); +FAR struct socket *sockfd_socket(int sockfd); /* net_connect.c *************************************************************/ #ifdef CONFIG_NET_TCP -EXTERN int net_startmonitor(FAR struct socket *psock); -EXTERN void net_stopmonitor(FAR struct uip_conn *conn); +int net_startmonitor(FAR struct socket *psock); +void net_stopmonitor(FAR struct uip_conn *conn); +void net_lostconnection(FAR struct socket *psock, uint16_t flags); #endif /* net_close.c ***************************************************************/ -EXTERN int psock_close(FAR struct socket *psock); +int psock_close(FAR struct socket *psock); /* sockopt support ***********************************************************/ #if defined(CONFIG_NET_SOCKOPTS) && !defined(CONFIG_DISABLE_CLOCK) -EXTERN int net_timeo(uint32_t start_time, socktimeo_t timeo); -EXTERN socktimeo_t net_timeval2dsec(struct timeval *tv); -EXTERN void net_dsec2timeval(uint16_t dsec, struct timeval *tv); +int net_timeo(uint32_t start_time, socktimeo_t timeo); +socktimeo_t net_timeval2dsec(FAR struct timeval *tv); +void net_dsec2timeval(uint16_t dsec, FAR struct timeval *tv); #endif /* net_register.c ************************************************************/ #if CONFIG_NSOCKET_DESCRIPTORS > 0 -EXTERN void netdev_seminit(void); -EXTERN void netdev_semtake(void); -EXTERN void netdev_semgive(void); +void netdev_seminit(void); +void netdev_semtake(void); +void netdev_semgive(void); #endif /* net_findbyname.c **********************************************************/ #if CONFIG_NSOCKET_DESCRIPTORS > 0 -EXTERN FAR struct uip_driver_s *netdev_findbyname(const char *ifname); +FAR struct uip_driver_s *netdev_findbyname(FAR const char *ifname); #endif /* net_findbyaddr.c **********************************************************/ #if CONFIG_NSOCKET_DESCRIPTORS > 0 -EXTERN FAR struct uip_driver_s *netdev_findbyaddr(const uip_ipaddr_t *raddr); +FAR struct uip_driver_s *netdev_findbyaddr(FAR const uip_ipaddr_t *raddr); #endif /* net_txnotify.c ************************************************************/ #if CONFIG_NSOCKET_DESCRIPTORS > 0 -EXTERN void netdev_txnotify(const uip_ipaddr_t *raddr); +void netdev_txnotify(const uip_ipaddr_t *raddr); #endif /* net_count.c ***************************************************************/ #if CONFIG_NSOCKET_DESCRIPTORS > 0 -EXTERN int netdev_count(void); +int netdev_count(void); #endif /* net_arptimer.c ************************************************************/ #ifdef CONFIG_NET_ARP -EXTERN void arptimer_init(void); +void arptimer_init(void); #else # define arptimer_init() #endif /* send.c ********************************************************************/ -EXTERN ssize_t psock_send(FAR struct socket *psock, const void *buf, - size_t len, int flags); +ssize_t psock_send(FAR struct socket *psock, FAR const void *buf, size_t len, + int flags); #undef EXTERN #if defined(__cplusplus) diff --git a/nuttx/net/net_monitor.c b/nuttx/net/net_monitor.c index 4bdae4ccf3..1eeb4bd276 100644 --- a/nuttx/net/net_monitor.c +++ b/nuttx/net/net_monitor.c @@ -1,7 +1,7 @@ /**************************************************************************** * net/net_monitor.c * - * Copyright (C) 2007-2012 Gregory Nutt. All rights reserved. + * Copyright (C) 2007-2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -67,7 +67,6 @@ static void connection_event(struct uip_conn *conn, uint16_t flags); * Some connection related event has occurred * * Parameters: - * dev The sructure of the network driver that caused the interrupt * conn The connection structure associated with the socket * flags Set of events describing why the callback was invoked * @@ -79,7 +78,7 @@ static void connection_event(struct uip_conn *conn, uint16_t flags); * ****************************************************************************/ -static void connection_event(struct uip_conn *conn, uint16_t flags) +static void connection_event(FAR struct uip_conn *conn, uint16_t flags) { FAR struct socket *psock = (FAR struct socket *)conn->connection_private; @@ -87,37 +86,11 @@ static void connection_event(struct uip_conn *conn, uint16_t flags) { nllvdbg("flags: %04x s_flags: %02x\n", flags, psock->s_flags); - /* These loss-of-connection events may be reported: - * - * UIP_CLOSE: The remote host has closed the connection - * UIP_ABORT: The remote host has aborted the connection - * UIP_TIMEDOUT: Connection aborted due to too many retransmissions. - * - * And we need to set these two socket status bits appropriately: - * - * _SF_CONNECTED==1 && _SF_CLOSED==0 - the socket is connected - * _SF_CONNECTED==0 && _SF_CLOSED==1 - the socket was gracefully disconnected - * _SF_CONNECTED==0 && _SF_CLOSED==0 - the socket was rudely disconnected - */ + /* UIP_CLOSE, UIP_ABORT, or UIP_TIMEDOUT: Loss-of-connection events */ - if ((flags & UIP_CLOSE) != 0) + if ((flags & (UIP_CLOSE|UIP_ABORT|UIP_TIMEDOUT)) != 0) { - /* The peer gracefully closed the connection. Marking the - * connection as disconnected will suppress some subsequent - * ENOTCONN errors from receive. A graceful disconnection is - * not handle as an error but as an "end-of-file" - */ - - psock->s_flags &= ~_SF_CONNECTED; - psock->s_flags |= _SF_CLOSED; - } - else if ((flags & (UIP_ABORT|UIP_TIMEDOUT)) != 0) - { - /* The loss of connection was less than graceful. This will (eventually) - * be reported as an ENOTCONN error. - */ - - psock->s_flags &= ~(_SF_CONNECTED |_SF_CLOSED); + net_lostconnection(psock, flags); } /* UIP_CONNECTED: The socket is successfully connected */ @@ -184,4 +157,60 @@ void net_stopmonitor(FAR struct uip_conn *conn) conn->connection_event = NULL; } +/**************************************************************************** + * Name: net_lostconnection + * + * Description: + * Called when a loss-of-connection event has occurred. + * + * Parameters: + * psock The TCP socket structure associated. + * flags Set of connection events events + * + * Returned Value: + * None + * + * Assumptions: + * Running at the interrupt level + * + ****************************************************************************/ + +void net_lostconnection(FAR struct socket *psock, uint16_t flags) +{ + DEBUGASSERT(psock) + + /* These loss-of-connection events may be reported: + * + * UIP_CLOSE: The remote host has closed the connection + * UIP_ABORT: The remote host has aborted the connection + * UIP_TIMEDOUT: Connection aborted due to too many retransmissions. + * + * And we need to set these two socket status bits appropriately: + * + * _SF_CONNECTED==1 && _SF_CLOSED==0 - the socket is connected + * _SF_CONNECTED==0 && _SF_CLOSED==1 - the socket was gracefully disconnected + * _SF_CONNECTED==0 && _SF_CLOSED==0 - the socket was rudely disconnected + */ + + if ((flags & UIP_CLOSE) != 0) + { + /* The peer gracefully closed the connection. Marking the + * connection as disconnected will suppress some subsequent + * ENOTCONN errors from receive. A graceful disconnection is + * not handle as an error but as an "end-of-file" + */ + + psock->s_flags &= ~_SF_CONNECTED; + psock->s_flags |= _SF_CLOSED; + } + else if ((flags & (UIP_ABORT|UIP_TIMEDOUT)) != 0) + { + /* The loss of connection was less than graceful. This will (eventually) + * be reported as an ENOTCONN error. + */ + + psock->s_flags &= ~(_SF_CONNECTED |_SF_CLOSED); + } +} + #endif /* CONFIG_NET && CONFIG_NET_TCP */ diff --git a/nuttx/net/recvfrom.c b/nuttx/net/recvfrom.c index a1a6742c51..6864dace37 100644 --- a/nuttx/net/recvfrom.c +++ b/nuttx/net/recvfrom.c @@ -1,7 +1,7 @@ /**************************************************************************** * net/recvfrom.c * - * Copyright (C) 2007-2009, 2011-2012 Gregory Nutt. All rights reserved. + * Copyright (C) 2007-2009, 2011-2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -464,10 +464,11 @@ static inline void recvfrom_tcpsender(struct uip_driver_s *dev, struct recvfrom_ ****************************************************************************/ #ifdef CONFIG_NET_TCP -static uint16_t recvfrom_tcpinterrupt(struct uip_driver_s *dev, void *conn, - void *pvpriv, uint16_t flags) +static uint16_t recvfrom_tcpinterrupt(FAR struct uip_driver_s *dev, + FAR void *conn, FAR void *pvpriv, + uint16_t flags) { - struct recvfrom_s *pstate = (struct recvfrom_s *)pvpriv; + FAR struct recvfrom_s *pstate = (struct recvfrom_s *)pvpriv; nllvdbg("flags: %04x\n", flags); @@ -553,9 +554,7 @@ static uint16_t recvfrom_tcpinterrupt(struct uip_driver_s *dev, void *conn, else if ((flags & (UIP_CLOSE|UIP_ABORT|UIP_TIMEDOUT)) != 0) { - FAR struct socket *psock = 0; - - nllvdbg("error\n"); + nllvdbg("Lost connection\n"); /* Stop further callbacks */ @@ -563,24 +562,14 @@ static uint16_t recvfrom_tcpinterrupt(struct uip_driver_s *dev, void *conn, pstate->rf_cb->priv = NULL; pstate->rf_cb->event = NULL; - /* Check if the peer gracefully closed the connection. We need - * these flags in case we return zero (below) to remember the - * state of the connection. - * - * _SF_CONNECTED==0 && _SF_CLOSED==1 - the socket was - * gracefully disconnected - * _SF_CONNECTED==0 && _SF_CLOSED==0 - the socket was - * rudely disconnected - */ + /* Handle loss-of-connection event */ + + net_lostconnection(pstate->rf_sock, flags); + + /* Check if the peer gracefully closed the connection. */ - psock = pstate->rf_sock; if ((flags & UIP_CLOSE) != 0) { - /* Report that the connection was gracefully closed */ - - psock->s_flags &= ~_SF_CONNECTED; - psock->s_flags |= _SF_CLOSED; - /* This case should always return success (zero)! The value of * rf_recvlen, if zero, will indicate that the connection was * gracefully closed. @@ -590,10 +579,6 @@ static uint16_t recvfrom_tcpinterrupt(struct uip_driver_s *dev, void *conn, } else { - /* Report that the connection was rudely lost */ - - psock->s_flags &= ~(_SF_CONNECTED |_SF_CLOSED); - /* If no data has been received, then return ENOTCONN. * Otherwise, let this return success. The failure will * be reported the next time that recv[from]() is called. diff --git a/nuttx/net/send.c b/nuttx/net/send.c index 8c07b391c8..79dfef4ecd 100644 --- a/nuttx/net/send.c +++ b/nuttx/net/send.c @@ -227,6 +227,8 @@ static uint16_t send_interrupt(struct uip_driver_s *dev, void *pvconn, /* Report not connected */ nllvdbg("Lost connection\n"); + + net_lostconnection(pstate->snd_sock, flags); pstate->snd_sent = -ENOTCONN; goto end_wait; } @@ -275,10 +277,13 @@ static uint16_t send_interrupt(struct uip_driver_s *dev, void *pvconn, * 3. Not enough data for two packets. * * Then we will split the remaining, single packet into two partial - * packets. This will stimulate the RFC 1122 not into ACKing sooner. + * packets. This will stimulate the RFC 1122 peer to ACK sooner. * - * Check if there is more data to be sent (more than or equal to - * CONFIG_NET_TCP_SPLIT_SIZE): + * Don't try to split very small packets (less than CONFIG_NET_TCP_SPLIT_SIZE). + * Only the first even packet and the last odd packets could have + * sndlen less than CONFIG_NET_TCP_SPLIT_SIZE. The value of sndlen on + * the last even packet is guaranteed to be at least MSS/2 by the + * logic below. */ if (sndlen >= CONFIG_NET_TCP_SPLIT_SIZE) From 724252768c6978d7f776895811a3e30cb3e77368 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sat, 19 Jan 2013 12:58:02 +1100 Subject: [PATCH 097/118] stdio: added vdprintf() for printf to a file descriptor --- nuttx/libc/lib_internal.h | 1 + nuttx/libc/stdio/Make.defs | 2 +- nuttx/libc/stdio/lib_rawprintf.c | 15 ++++++ nuttx/libc/stdio/lib_vdprintf.c | 81 ++++++++++++++++++++++++++++++++ 4 files changed, 98 insertions(+), 1 deletion(-) create mode 100644 nuttx/libc/stdio/lib_vdprintf.c diff --git a/nuttx/libc/lib_internal.h b/nuttx/libc/lib_internal.h index c09c751d4a..efe895465e 100644 --- a/nuttx/libc/lib_internal.h +++ b/nuttx/libc/lib_internal.h @@ -140,6 +140,7 @@ int lib_vsprintf(FAR struct lib_outstream_s *obj, /* Defined lib_rawprintf.c */ int lib_rawvprintf(const char *src, va_list ap); +int lib_rawvdprintf(int fd, const char *fmt, va_list ap); /* Defined lib_lowprintf.c */ diff --git a/nuttx/libc/stdio/Make.defs b/nuttx/libc/stdio/Make.defs index e18ab0220f..0670724da6 100644 --- a/nuttx/libc/stdio/Make.defs +++ b/nuttx/libc/stdio/Make.defs @@ -59,7 +59,7 @@ CSRCS += lib_fopen.c lib_fclose.c lib_fread.c lib_libfread.c lib_fseek.c \ lib_gets.c lib_fwrite.c lib_libfwrite.c lib_fflush.c \ lib_libflushall.c lib_libfflush.c lib_rdflush.c lib_wrflush.c \ lib_fputc.c lib_puts.c lib_fputs.c lib_ungetc.c lib_vprintf.c \ - lib_fprintf.c lib_vfprintf.c lib_stdinstream.c lib_stdoutstream.c \ + lib_fprintf.c lib_vfprintf.c lib_vdprintf.c lib_stdinstream.c lib_stdoutstream.c \ lib_perror.c lib_feof.c lib_ferror.c lib_clearerr.c endif diff --git a/nuttx/libc/stdio/lib_rawprintf.c b/nuttx/libc/stdio/lib_rawprintf.c index 98bbbea053..ddbb84f94b 100644 --- a/nuttx/libc/stdio/lib_rawprintf.c +++ b/nuttx/libc/stdio/lib_rawprintf.c @@ -149,3 +149,18 @@ int lib_rawprintf(const char *fmt, ...) return ret; } + + +/**************************************************************************** + * Name: lib_rawvdprintf + ****************************************************************************/ + +int lib_rawvdprintf(int fd, const char *fmt, va_list ap) +{ + /* Wrap the fd in a stream object and let lib_vsprintf + * do the work. + */ + struct lib_rawoutstream_s rawoutstream; + lib_rawoutstream(&rawoutstream, fd); + return lib_vsprintf(&rawoutstream.public, fmt, ap); +} diff --git a/nuttx/libc/stdio/lib_vdprintf.c b/nuttx/libc/stdio/lib_vdprintf.c new file mode 100644 index 0000000000..932342e1c0 --- /dev/null +++ b/nuttx/libc/stdio/lib_vdprintf.c @@ -0,0 +1,81 @@ +/**************************************************************************** + * libc/stdio/lib_vdprintf.c + * + * Copyright (C) 2007-2009, 2011 Andrew Tridgell. All rights reserved. + * Author: Andrew Tridgell + * + * 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. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include + +#include "lib_internal.h" + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +/**************************************************************************** + * Private Type Declarations + ****************************************************************************/ + +/**************************************************************************** + * Private Function Prototypes + ****************************************************************************/ + +/**************************************************************************** + * Global Constant Data + ****************************************************************************/ + +/**************************************************************************** + * Global Variables + ****************************************************************************/ + +/**************************************************************************** + * Private Constant Data + ****************************************************************************/ + +/**************************************************************************** + * Private Variables + ****************************************************************************/ + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +int vdprintf(int fd, FAR const char *fmt, va_list ap) +{ + return lib_rawvdprintf(fd, fmt, ap); +} From 96fa586589da450c9cc9669ed94fdcb0ee5add2d Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Mon, 14 Jan 2013 16:20:20 +1100 Subject: [PATCH 098/118] px4: enable APPS_BINDIR support useful for APM startup script --- nuttx/configs/px4fmu/nsh/defconfig | 3 +++ 1 file changed, 3 insertions(+) diff --git a/nuttx/configs/px4fmu/nsh/defconfig b/nuttx/configs/px4fmu/nsh/defconfig index 0b27b552e1..b6de5864bc 100755 --- a/nuttx/configs/px4fmu/nsh/defconfig +++ b/nuttx/configs/px4fmu/nsh/defconfig @@ -1045,3 +1045,6 @@ CONFIG_PTHREAD_STACK_MIN=512 CONFIG_PTHREAD_STACK_DEFAULT=2048 CONFIG_HEAP_BASE= CONFIG_HEAP_SIZE= + +# enable bindir +CONFIG_APPS_BINDIR=y From 09ddf7f1b3e79bd37227520610847fbcf94187ce Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Mon, 21 Jan 2013 08:16:03 +1100 Subject: [PATCH 099/118] ROMFS: add support for EXTERNAL_SCRIPTS this adds support for an EXTERNAL_SCRIPTS directory, to complement the EXTERNAL_APPS option. It allows external apps to install scripts in ROMFS --- ROMFS/Makefile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ROMFS/Makefile b/ROMFS/Makefile index ec4221b93a..3b024de06d 100644 --- a/ROMFS/Makefile +++ b/ROMFS/Makefile @@ -35,6 +35,10 @@ ROMFS_FSSPEC := $(SRCROOT)/scripts/rcS~init.d/rcS \ $(SRCROOT)/mixers/FMU_octo_+.mix~mixers/FMU_octo_+.mix \ $(SRCROOT)/logging/logconv.m~logging/logconv.m +# the EXTERNAL_SCRIPTS variable is used to add out of tree scripts +# to ROMFS. +ROMFS_FSSPEC += $(EXTERNAL_SCRIPTS) + # # Add the PX4IO firmware to the spec if someone has dropped it into the # source directory, or otherwise specified its location. From ff35e5a58347f4d03d097f5939f19751ed82ae06 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Mon, 21 Jan 2013 08:15:13 +1100 Subject: [PATCH 100/118] if rc.APM is installed, run it --- ROMFS/scripts/rcS | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/ROMFS/scripts/rcS b/ROMFS/scripts/rcS index 69d791da52..660bf61e9d 100755 --- a/ROMFS/scripts/rcS +++ b/ROMFS/scripts/rcS @@ -69,6 +69,16 @@ else fi fi +# if this is an APM build then there will be a rc.APM script +# from an EXTERNAL_SCRIPTS build option +if [ -f /etc/init.d/rc.APM ] +then + echo Running rc.APM + # if APM startup is successful then nsh will exit + sh /etc/init.d/rc.APM +fi + + # # If we are still in flight mode, work out what airframe # configuration we have and start up accordingly. From aa88fc315e563345c4a9ab2667563c02edb967aa Mon Sep 17 00:00:00 2001 From: patacongo Date: Mon, 21 Jan 2013 14:17:11 +0000 Subject: [PATCH 101/118] poll was not checking if the socket was still connected git-svn-id: http://svn.code.sf.net/p/nuttx/code/trunk@5543 42af7a65-404d-4744-a932-0658087f49c3 --- nuttx/net/net_poll.c | 38 +++++++++++++++++++++++++++----------- 1 file changed, 27 insertions(+), 11 deletions(-) diff --git a/nuttx/net/net_poll.c b/nuttx/net/net_poll.c index 815c6a71df..2e73bd73c2 100644 --- a/nuttx/net/net_poll.c +++ b/nuttx/net/net_poll.c @@ -125,16 +125,22 @@ static uint16_t poll_interrupt(struct uip_driver_s *dev, FAR void *conn, if ((flags & UIP_POLL) != 0) { - eventset |= POLLOUT & fds->events; + eventset |= (POLLOUT & fds->events); } - /* Check for a loss of connection events */ + /* Check for a loss of connection events. + * + * REVISIT: Need to call net_lostconnection() here, but don't have + * the psock instance. What should we do? + */ if ((flags & (UIP_CLOSE|UIP_ABORT|UIP_TIMEDOUT)) != 0) { - eventset |= (POLLERR|POLLHUP); + eventset |= (POLLERR | POLLHUP); } + /* Awaken the caller of poll() is requested event occurred. */ + if (eventset) { fds->revents |= eventset; @@ -192,9 +198,9 @@ static inline int net_pollsetup(FAR struct socket *psock, struct pollfd *fds) goto errout_with_irq; } - /* Initialize the callbcack structure */ + /* Initialize the callback structure */ - cb->flags = UIP_NEWDATA|UIP_BACKLOG|UIP_POLL|UIP_CLOSE|UIP_ABORT|UIP_TIMEDOUT; + cb->flags = (UIP_NEWDATA|UIP_BACKLOG|UIP_POLL|UIP_CLOSE|UIP_ABORT|UIP_TIMEDOUT); cb->priv = (FAR void *)fds; cb->event = poll_interrupt; @@ -212,13 +218,23 @@ static inline int net_pollsetup(FAR struct socket *psock, struct pollfd *fds) if (!sq_empty(&conn->readahead)) #endif { - fds->revents = fds->events & POLLIN; - if (fds->revents != 0) - { - /* If data is available now, the signal the poll logic */ + fds->revents |= (POLLOUT & fds->events); + } - sem_post(fds->sem); - } + /* Check for a loss of connection events */ + + if (!_SS_ISCONNECTED(psock->s_flags)) + { + fds->revents |= (POLLERR | POLLHUP); + } + + /* Check if any requested events are already in effect */ + + if (fds->revents != 0) + { + /* Yes.. then signal the poll logic */ + + sem_post(fds->sem); } uip_unlock(flags); From 41b7f883e55c3ad085e4e538b5703369ae6e59d2 Mon Sep 17 00:00:00 2001 From: patacongo Date: Mon, 21 Jan 2013 16:56:29 +0000 Subject: [PATCH 102/118] LM3S OpenOCD configuration from Jose Pablo Carballo git-svn-id: http://svn.code.sf.net/p/nuttx/code/trunk@5544 42af7a65-404d-4744-a932-0658087f49c3 --- nuttx/configs/lm3s6965-ek/README.txt | 80 +++++++++++ .../configs/lm3s6965-ek/tools/lm3s6965-ek.cfg | 131 ++++++++++++++++++ nuttx/configs/lm3s6965-ek/tools/oocd.sh | 52 +++++++ nuttx/drivers/lcd/README.txt | 72 ++++++---- nuttx/include/nuttx/lcd/ug-2864ambag01.h | 1 + nuttx/include/nuttx/lcd/ug-2864hsweg01.h | 1 + nuttx/include/nuttx/lcd/ug-9664hswag01.h | 1 + 7 files changed, 311 insertions(+), 27 deletions(-) create mode 100644 nuttx/configs/lm3s6965-ek/tools/lm3s6965-ek.cfg create mode 100755 nuttx/configs/lm3s6965-ek/tools/oocd.sh diff --git a/nuttx/configs/lm3s6965-ek/README.txt b/nuttx/configs/lm3s6965-ek/README.txt index 77f034bf5d..94cf4d9021 100644 --- a/nuttx/configs/lm3s6965-ek/README.txt +++ b/nuttx/configs/lm3s6965-ek/README.txt @@ -15,6 +15,7 @@ Contents NXFLAT Toolchain USB Device Controller Functions OLED + Using OpenOCD and GDB with an FT2232 JTAG emulator Stellaris LM3S6965 Evaluation Kit Configuration Options Configurations @@ -103,6 +104,85 @@ OLED display. Some tweaks to drivers/lcd/p14201.c would be required to support that LCD. +Using OpenOCD and GDB with an FT2232 JTAG emulator +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + Building OpenOCD under Cygwin: + + Refer to configs/olimex-lpc1766stk/README.txt + + Installing OpenOCD in Linux: + + sudo apt-get install openocd + + Helper Scripts. + + I have been using the on-board FT2232 JTAG/SWD/SWO interface. OpenOCD + requires a configuration file. I keep the one I used last here: + + configs/lm3s6965-ek/tools/lm3s6965-ek.cfg + + However, the "correct" configuration script to use with OpenOCD may + change as the features of OpenOCD evolve. So you should at least + compare that lm3s6965-ek.cfg file with configuration files in + /usr/share/openocd/scripts. As of this writing, the configuration + files of interest were: + + /usr/share/openocd/scripts/interface/luminary.cfg + /usr/share/openocd/scripts/board/ek-lm3s6965.cfg + /usr/share/openocd/scripts/target/stellaris.cfg + + There is also a script on the tools/ directory that I use to start + the OpenOCD daemon on my system called oocd.sh. That script will + probably require some modifications to work in another environment: + + - Possibly the value of OPENOCD_PATH and TARGET_PATH + - It assumes that the correct script to use is the one at + configs/lm3s6965-ek/tools/lm3s6965-ek.cfg + + Starting OpenOCD + + Then you should be able to start the OpenOCD daemon like: + + configs/lm3s6965-ek/tools/oocd.sh $PWD + + Connecting GDB + + Once the OpenOCD daemon has been started, you can connect to it via + GDB using the following GDB command: + + arm-nuttx-elf-gdb + (gdb) target remote localhost:3333 + + NOTE: The name of your GDB program may differ. For example, with the + CodeSourcery toolchain, the ARM GDB would be called arm-none-eabi-gdb. + + After starting GDB, you can load the NuttX ELF file: + + (gdb) symbol-file nuttx + (gdb) monitor reset + (gdb) monitor halt + (gdb) load nuttx + + NOTES: + 1. Loading the symbol-file is only useful if you have built NuttX to + include debug symbols (by setting CONFIG_DEBUG_SYMBOLS=y in the + .config file). + 2. The MCU must be halted prior to loading code using 'mon reset' + as described below. + + OpenOCD will support several special 'monitor' commands. These + GDB commands will send comments to the OpenOCD monitor. Here + are a couple that you will need to use: + + (gdb) monitor reset + (gdb) monitor halt + + NOTES: + 1. The MCU must be halted using 'mon halt' prior to loading code. + 2. Reset will restart the processor after loading code. + 3. The 'monitor' command can be abbreviated as just 'mon'. + Development Environment ^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/nuttx/configs/lm3s6965-ek/tools/lm3s6965-ek.cfg b/nuttx/configs/lm3s6965-ek/tools/lm3s6965-ek.cfg new file mode 100644 index 0000000000..a82aa4cb9e --- /dev/null +++ b/nuttx/configs/lm3s6965-ek/tools/lm3s6965-ek.cfg @@ -0,0 +1,131 @@ +# +# TI/Luminary Stellaris LM3S6965 Evaluation Kits +# +# http://www.luminarymicro.com/products/lm3s6965_ethernet_evaluation_kit.html + +# NOTE: using the on-board FT2232 JTAG/SWD/SWO interface is optional! +# so is using it in JTAG mode, as done here. + +# Interface configuration + +interface ft2232 +ft2232_device_desc "Stellaris Evaluation Board" +ft2232_layout luminary_icdi +ft2232_vid_pid 0x0403 0xbcd9 + +# Board configuration + +# 20k working area +set WORKAREASIZE 0x5000 +set CHIPNAME lm3s6965 + +# Target configuration + +# Some devices have errata in returning their device class. +# DEVICECLASS is provided as a manual override +# Manual setting of a device class of 0xff is not allowed + +global _DEVICECLASS + +if { [info exists DEVICECLASS ] } { + set _DEVICECLASS $DEVICECLASS +} else { + set _DEVICECLASS 0xff +} + +# Luminary chips support both JTAG and SWD transports. +# Adapt based on what transport is active. +source [find target/swj-dp.tcl] + +# For now we ignore the SPI and UART options, which +# are usable only for ISP style initial flash programming. + +if { [info exists CHIPNAME] } { + set _CHIPNAME $CHIPNAME +} else { + set _CHIPNAME lm3s +} + +# CPU TAP ID 0x1ba00477 for early Sandstorm parts +# CPU TAP ID 0x2ba00477 for later SandStorm parts, e.g. lm3s811 Rev C2 +# CPU TAP ID 0x3ba00477 for Cortex-M3 r1p2 (on Fury, DustDevil) +# CPU TAP ID 0x4ba00477 for Cortex-M3 r2p0 (on Tempest) +# ... we'll ignore the JTAG version field, rather than list every +# chip revision that turns up. +if { [info exists CPUTAPID ] } { + set _CPUTAPID $CPUTAPID +} else { + set _CPUTAPID 0x3ba00477 +} + +# SWD DAP, and JTAG TAP, take same params for now; +# ... even though SWD ignores all except TAPID, and +# JTAG shouldn't need anything more then irlen. (and TAPID). +swj_newdap $_CHIPNAME cpu -irlen 4 -irmask 0xf \ + -expected-id $_CPUTAPID -ignore-version + +if { [info exists WORKAREASIZE ] } { + set _WORKAREASIZE $WORKAREASIZE +} else { + # default to 8K working area + set _WORKAREASIZE 0x2000 +} + +set _TARGETNAME $_CHIPNAME.cpu +target create $_TARGETNAME cortex_m3 -chain-position $_CHIPNAME.cpu + +# 8K working area at base of ram, not backed up +# +# NOTE: you may need or want to reconfigure the work area; +# some parts have just 6K, and you may want to use other +# addresses (at end of mem not beginning) or back it up. +$_TARGETNAME configure -work-area-phys 0x20000000 -work-area-size $_WORKAREASIZE + +# JTAG speed ... slow enough to work with a 12 MHz RC oscillator; +# LM3S parts don't support RTCK +# +# NOTE: this may be increased by a reset-init handler, after it +# configures and enables the PLL. Or you might need to decrease +# this, if you're using a slower clock. +adapter_khz 500 + +source [find mem_helper.tcl] + +$_TARGETNAME configure -event reset-start { + adapter_khz 500 + + # + # When nRST is asserted on most Stellaris devices, it clears some of + # the debug state. The ARMv7M and Cortex-M3 TRMs say that's wrong; + # and OpenOCD depends on those TRMs. So we won't use SRST on those + # chips. (Only power-on reset should affect debug state, beyond a + # few specified bits; not the chip's nRST input, wired to SRST.) + # + # REVISIT current errata specs don't seem to cover this issue. + # Do we have more details than this email? + # https://lists.berlios.de/pipermail + # /openocd-development/2008-August/003065.html + # + + global _DEVICECLASS + + if {$_DEVICECLASS != 0xff} { + set device_class $_DEVICECLASS + } else { + set device_class [expr (([mrw 0x400fe000] >> 16) & 0xff)] + } + + if {$device_class == 0 || $device_class == 1 || $device_class == 3} { + # Sandstorm, Fury and DustDevil are able to use NVIC SYSRESETREQ + cortex_m3 reset_config sysresetreq + } else { + # Tempest and newer default to using NVIC VECTRESET + # this does mean a reset-init event handler is required to reset + # any peripherals + cortex_m3 reset_config vectreset + } +} + +# flash configuration ... autodetects sizes, autoprobed +flash bank $_CHIPNAME.flash stellaris 0 0 0 0 $_TARGETNAME + diff --git a/nuttx/configs/lm3s6965-ek/tools/oocd.sh b/nuttx/configs/lm3s6965-ek/tools/oocd.sh new file mode 100755 index 0000000000..28bcc48a79 --- /dev/null +++ b/nuttx/configs/lm3s6965-ek/tools/oocd.sh @@ -0,0 +1,52 @@ +#!/bin/sh +# +# See configs/lm3s6965-ek/README.txt for information about +# this file. + +TOPDIR=$1 +USAGE="$0 [-d]" +if [ -z "${TOPDIR}" ]; then + echo "Missing argument" + echo $USAGE + exit 1 +fi + +# Assume that OpenOCD was installed and at /usr/local/bin. Uncomment +# the following to run directly from the build directory +#OPENOCD_PATH="/home/OpenOCD/openocd/src" +#TARGET_PATH="/home/OpenOCD/openocd/tcl" +OPENOCD_PATH="/usr/bin" +TARGET_PATH="/usr/share/openocd/scripts" + +# Assume a Unix development environment. Uncomment to use a Windows +# like environment +#OPENOCD_EXE=openocd.exe +OPENOCD_EXE=openocd +OPENOCD_CFG="${TOPDIR}/configs/lm3s6965-ek/tools/ek-lm3s6965.cfg" +OPENOCD_ARGS="-f ${OPENOCD_CFG} -s ${TARGET_PATH}" + +if [ "X$2" = "X-d" ]; then + OPENOCD_ARGS=$OPENOCD_ARGS" -d3" + set -x +fi + +if [ ! -d ${OPENOCD_PATH} ]; then + echo "OpenOCD path does not exist: ${OPENOCD_PATH}" + exit 1 +fi +if [ ! -x ${OPENOCD_PATH}/${OPENOCD_EXE} ]; then + echo "OpenOCD does not exist: ${OPENOCD_PATH}/${OPENOCD_EXE}" + exit 1 +fi +if [ ! -f ${OPENOCD_CFG} ]; then + echo "OpenOCD config file does not exist: ${OPENOCD_CFG}" + exit 1 +fi + +echo "Starting OpenOCD" +cd ${OPENOCD_PATH} || { echo "Failed to CD to ${OPENOCD_PATH}"; exit 1; } +${OPENOCD_EXE} ${OPENOCD_ARGS} & +echo "OpenOCD daemon started" +ps -ef | grep openocd +echo "In GDB: target remote localhost:3333" + diff --git a/nuttx/drivers/lcd/README.txt b/nuttx/drivers/lcd/README.txt index 77ae536b2b..198be18a16 100644 --- a/nuttx/drivers/lcd/README.txt +++ b/nuttx/drivers/lcd/README.txt @@ -119,47 +119,65 @@ that support additional LCDs. LCD drivers in the configuration directory if they support some differ LCD interface (such as a parallel interface) that makes then less re-usable: - configs/compal_e99/src/ssd1783.c + SSD1783 Drivers: - SSD1783 + configs/compal_e99/src/ssd1783.c - configs/hymini-stm32v/src/ssd1289.c. See also drivers/lcd/ssd1298.c - above. + SSD1289 Drivers: + + configs/hymini-stm32v/src/ssd1289.c. See also drivers/lcd/ssd1298.c + above. + configs/stm32f4discovery/src/up_ssd1289.c. This examples is the + bottom half for the SSD1289 driver at drivers/lcd/ssd1289.c + configs/hymini-stm32v/src/ssd1289.c. See also drivers/lcd/ssd1298.c + above. + configs/shenzhou/src/up_ssd1289.c + + kwikstik-k40: - SSD1289 + configs/kwikstik-k40/src/up_lcd.c. Don't waste your time. This is + just a stub. - configs/kwikstik-k40/src/up_lcd.c. Don't waste your time. This is - just a stub. + Nokia LCD Drivers: - configs/olimex-lpc1766stk/src/up_lcd.c. This examples is the - bottom half for the SSD1289 driver at drivers/lcd/nokia6100.c. - This was never completedly debugged ... there are probably issues - with that nasty 9-bit SPI interfaces. + configs/olimex-lpc1766stk/src/up_lcd.c. This examples is the + bottom half for the driver at drivers/lcd/nokia6100.c. + This was never completedly debugged ... there are probably issues + with that nasty 9-bit SPI interfaces. - configs/sam3u-ek/src/up_lcd.c - - The SAM3U-EK developement board features a TFT/Transmissive color - LCD module with touch-screen, FTM280C12D, with integrated driver IC - HX8346. + HX8346: - configs/skp16c26/src/up_lcd.c. Untested alphanumeric LCD driver. + configs/sam3u-ek/src/up_lcd.c. The SAM3U-EK developement board features + a TFT/Transmissive color LCD module with touch-screen, FTM280C12D, + with integrated driver IC HX8346. - configs/stm3210e-eval/src/up_lcd.c + ILI93xx and Similar: - This driver supports the following LCDs: + configs/stm3210e-eval/src/up_lcd.c. This driver supports the following + LCDs: - 1. Ampire AM-240320LTNQW00H - 2. Orise Tech SPFD5408B - 3. RenesasSP R61580 + 1. Ampire AM-240320LTNQW00H + 2. Orise Tech SPFD5408B + 3. RenesasSP R61580 - configs/stm3220g-eval/src/up_lcd.c and configs/stm3240g-eval/src/up_lcd.c. - AM-240320L8TNQW00H (LCD_ILI9320 or LCD_ILI9321) and - AM-240320D5TOQW01H (LCD_ILI9325) + configs/stm3220g-eval/src/up_lcd.c and configs/stm3240g-eval/src/up_lcd.c. + AM-240320L8TNQW00H (LCD_ILI9320 or LCD_ILI9321) and + AM-240320D5TOQW01H (LCD_ILI9325) + configs/shenzhou/src/up_ili93xx.c. Another ILI93xx driver. - configs/stm32f4discovery/src/up_ssd1289.c. This examples is the - bottom half for the SSD1289 driver at drivers/lcd/ssd1289.c + OLEDs: + + configs/stm32f4discovery/src/up_ug2864ambag01.c + configs/stm32f4discovery/src/up_ug2864hsweg01.c + configs/zp214xpa/src/up_ug2864ambag01.c + + Alphnumeric Displays: + + configs/skp16c26/src/up_lcd.c. Untested alphanumeric LCD driver. + configs/stm32f4discovery/src/up_lcd1602.c graphics/ ========= See also the usage of the LCD driver in the graphics/ directory. + diff --git a/nuttx/include/nuttx/lcd/ug-2864ambag01.h b/nuttx/include/nuttx/lcd/ug-2864ambag01.h index deb5689812..86362d7736 100644 --- a/nuttx/include/nuttx/lcd/ug-2864ambag01.h +++ b/nuttx/include/nuttx/lcd/ug-2864ambag01.h @@ -1,5 +1,6 @@ /************************************************************************************** * include/nuttx/lcd/ug-2864ambag01.h + * * Driver for Univision UG-2864AMBAG01 OLED display (wih SH1101A controller) in SPI * mode * diff --git a/nuttx/include/nuttx/lcd/ug-2864hsweg01.h b/nuttx/include/nuttx/lcd/ug-2864hsweg01.h index bbefd39be0..e387419672 100644 --- a/nuttx/include/nuttx/lcd/ug-2864hsweg01.h +++ b/nuttx/include/nuttx/lcd/ug-2864hsweg01.h @@ -1,5 +1,6 @@ /************************************************************************************** * include/nuttx/lcd/ug-2864hsweg01.h + * * Driver for Univision UG-2864HSWEG01 OLED display (wih SSD1306 controller) in SPI * mode * diff --git a/nuttx/include/nuttx/lcd/ug-9664hswag01.h b/nuttx/include/nuttx/lcd/ug-9664hswag01.h index b470e0895e..a60b5ed67b 100644 --- a/nuttx/include/nuttx/lcd/ug-9664hswag01.h +++ b/nuttx/include/nuttx/lcd/ug-9664hswag01.h @@ -1,5 +1,6 @@ /**************************************************************************** * include/nuttx/lcd/ug-9664hswag01.h + * * Driver for the Univision UG-9664HSWAG01 Display with the Solomon Systech * SSD1305 LCD controller. * From e504d643fc23cefe61340e4d3a75d6e80f4b76fb Mon Sep 17 00:00:00 2001 From: patacongo Date: Mon, 21 Jan 2013 22:46:37 +0000 Subject: [PATCH 103/118] Beginning of support for LCD1602 git-svn-id: http://svn.code.sf.net/p/nuttx/code/trunk@5545 42af7a65-404d-4744-a932-0658087f49c3 --- nuttx/ChangeLog | 5 + nuttx/arch/mips/src/pic32mx/pic32mx-pmp.h | 3 +- .../configs/pcblogic-pic32mx/src/up_lcd1602.c | 374 ++++++++++++++++++ nuttx/configs/pic32mx7mmb/src/up_mio283qt2.c | 2 +- nuttx/drivers/lcd/README.txt | 10 +- nuttx/include/nuttx/lcd/hd4478ou.h | 118 ++++++ 6 files changed, 508 insertions(+), 4 deletions(-) create mode 100644 nuttx/configs/pcblogic-pic32mx/src/up_lcd1602.c create mode 100644 nuttx/include/nuttx/lcd/hd4478ou.h diff --git a/nuttx/ChangeLog b/nuttx/ChangeLog index 77441dd21d..41f38bd91d 100644 --- a/nuttx/ChangeLog +++ b/nuttx/ChangeLog @@ -3996,3 +3996,8 @@ * net/recvfrom(): Fix a introduced with the last bugfix. If the peer does an orderly closure of the socket, report 0 not -ENOTCONN + * configs/lm3s6965-ek/README.txt and tools/: Add an OpenOCD + configuration for the LM3S (from Jose Pablo Carballo). + * nuttx/lcd/hd4478ou.h and configs/pcblogic-pic32mx/src/up_lcd1602: + Start of support of LCD1602 alphanumeric LCD. I need a few + more parts before I can finish integrating this one. diff --git a/nuttx/arch/mips/src/pic32mx/pic32mx-pmp.h b/nuttx/arch/mips/src/pic32mx/pic32mx-pmp.h index 745c56a3d9..abfc3358b5 100644 --- a/nuttx/arch/mips/src/pic32mx/pic32mx-pmp.h +++ b/nuttx/arch/mips/src/pic32mx/pic32mx-pmp.h @@ -157,7 +157,8 @@ # define PMP_MODE_MODE_SLAVE (1 << PMP_MODE_MODE_SHIFT) /* Enhanced slave mode */ # define PMP_MODE_MODE_MODE2 (2 << PMP_MODE_MODE_SHIFT) /* Master mode 2 */ # define PMP_MODE_MODE_MODE1 (3 << PMP_MODE_MODE_SHIFT) /* Master mode 1 */ -#define PMP_MODE_MODE16 (1 << 10) /* Bit 10: 8/16-bit mode */ +#define PMP_MODE_MODE16 (1 << 10) /* Bit 10: 1=16-bit mode */ +#define PMP_MODE_MODE8 (0) /* 0=8-bit mode */ #define PMP_MODE_INCM_SHIFT (11) /* Bits 11-12: Increment Mode */ #define PMP_MODE_INCM_MASK (3 << PMP_MODE_INCM_SHIFT) # define PMP_MODE_INCM_NONE (0 << PMP_MODE_INCM_SHIFT) /* No incr or decr of addr */ diff --git a/nuttx/configs/pcblogic-pic32mx/src/up_lcd1602.c b/nuttx/configs/pcblogic-pic32mx/src/up_lcd1602.c new file mode 100644 index 0000000000..3f99baee1f --- /dev/null +++ b/nuttx/configs/pcblogic-pic32mx/src/up_lcd1602.c @@ -0,0 +1,374 @@ +/**************************************************************************** + * configs/pcblocic-pic32mx/src/up_lcd1602.c + * + * This logic supports the connection of an LCD1602 LCD to the + * STM32F4Discovery board. The LCD1602 is based on the Hitachi HD44780U LCD + * controller + * + * Copyright (C) 2013 Gregory Nutt. All rights reserved. + * Authors: Gregory Nutt + * + * 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. + * + ****************************************************************************/ + + /* LCD pin mapping (see configs/pcblogic-pic32mx/README.txt) + * + * ----------------------------------- ---------- ---------------------------------- + * PIC32 LCD1602 UBW32 PIN + * PIN SIGNAL NAME PIN NAME(s) + * ----------------------------------- ---------- ---------------------------------- + * 1. Vss GND + * 2. Vdd Vcc (5V) + * 3. Vee To ground via 10K potentiometer + * 4 AN15/OCFB/PMALL/PMA0/CN12/RB15 4. RS PMA0, Selects registers + * 82 PMRD/CN14/RD5 5. RW PMRD/PMWR, Selects read or write + * 81 OC5/PMWR/CN13/RD4 6. E PMENB, Starts data read/write + * 93 PMD0/RE0 7. D0 PMD0 + * 94 PMD1/RE1 8. D1 PMD1 + * 98 PMD2/RE2 9. D2 PMD2 + * 99 PMD3/RE3 10. D3 PMD3 + * 100 PMD4/RE4 11. D4 PMD4 + * 3 PMD5/RE5 12. D5 PMD5 + * 4 PMD6/RE6 13. D6 PMD6 + * 5 PMD7/RE7 14. D7 PMD7 + * 15. A To Vcc (5V) via 10K potentiometer + * 16. K GND + * ----------------------------------- ---------- ---------------------------------- + */ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include + +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include "up_arch.h" +#include "pic32mx-pmp.h" +#include "pic32mx-int.h" +#include "pic32mx-internal.h" +#include "pcblogic-internal.h" + +#ifdef CONFIG_LCD_LCD1602 + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ +/* Configuration ************************************************************/ + +#ifndef CONFIG_PIC32MX_PMP +# error "CONFIG_PIC32MX_PMP is required to use the LCD" +#endif + +/* Define CONFIG_DEBUG_LCD to enable detailed LCD debug output. Verbose debug must + * also be enabled. + */ + +#ifndef CONFIG_DEBUG +# undef CONFIG_DEBUG_VERBOSE +# undef CONFIG_DEBUG_GRAPHICS +# undef CONFIG_DEBUG_LCD +#endif + +#ifndef CONFIG_DEBUG_VERBOSE +# undef CONFIG_DEBUG_LCD +#endif + +/* Pin configuratin *********************************************************/ +/* RB15, RS -- High values selects data */ + +#define GPIO_LCD_RS (GPIO_OUTPUT|GPIO_VALUE_ZERO|GPIO_PORTB|GPIO_PIN15) + +/* Debug ********************************************************************/ + +#ifdef CONFIG_DEBUG_LCD +# define lcddbg dbg +# define lcdvdbg vdbg +#else +# define lcddbg(x...) +# define lcdvdbg(x...) +#endif + +/**************************************************************************** + * Private Type Definition + ****************************************************************************/ + +struct lpc1620_s +{ + bool initialized; /* True: Completed initialization sequence */ +}; + +/**************************************************************************** + * Private Function Protototypes + ****************************************************************************/ + +static ssize_t lcd_read(FAR struct file *, FAR char *, size_t); +static ssize_t lcd_write(FAR struct file *, FAR const char *, size_t); +#ifndef CONFIG_DISABLE_POLL +static int lcd_poll(FAR struct file *filp, FAR struct pollfd *fds, + bool setup); +#endif + +/**************************************************************************** + * Private Data + ****************************************************************************/ + +/* This is the driver state structure (there is no retained state information) */ + +static const struct file_operations g_lcd1602 = +{ + 0, /* open */ + 0, /* close */ + lcd_read, /* read */ + lcd_write, /* write */ + 0, /* seek */ + 0 /* ioctl */ +#ifndef CONFIG_DISABLE_POLL + , lcd_poll /* poll */ +#endif +}; + +/**************************************************************************** + * Private Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: lcd_wrcommand + * + * Description: + * Configure to write an LCD command + * + ****************************************************************************/ + +static void lcd_wrcommand(uint8_t cmd) +{ + /* Address bit A0 is RS. Set the address latch to A0=0 */ + + putreg32(1, PIC32MX_PMP_ADDRCLR); + + /* And write the command to the data out register */ + + putreg32((uint32_t)cmd, PIC32MX_PMP_DOUT); +} + +/**************************************************************************** + * Name: lcd_wrdata + * + * Description: + * Configure to read or write LCD data + * + ****************************************************************************/ + +static void lcd_wrdata(uint8_t data) +{ + /* Address bit A0 is RS. Set the address latch to A0=1 */ + + putreg32(1, PIC32MX_PMP_ADDRSET); + + /* And write the data to the data out register */ + + putreg32((uint32_t)data, PIC32MX_PMP_DOUT); +} + +/**************************************************************************** + * Name: lcd_rddata + * + * Description: + * Configure to read or write LCD data + * + ****************************************************************************/ + +static uint8_t lcd_rddata(void) +{ + /* Address bit A0 is RS. Set the address latch to A0=1 */ + + putreg32(1, PIC32MX_PMP_ADDRSET); + + /* And read the data to the data in register */ + + return (uint8_t)getreg32(PIC32MX_PMP_DIN); +} + +/**************************************************************************** + * Name: lcd_read + ****************************************************************************/ + +static ssize_t lcd_read(FAR struct file *filp, FAR char *buffer, size_t len) +{ + int i; + + for (i = 0; i < len; i++) + { + *buffer++ = lcd_rddata(); + } + + return len; +} + +/**************************************************************************** + * Name: lcd_write + ****************************************************************************/ + +static ssize_t lcd_write(FAR struct file *filp, FAR const char *buffer, size_t len) +{ + int i; + + for (i = 0; i < len; i++) + { + uint8_t data = *buffer++; + lcd_wrdata(data); + } + + return len; +} + +/**************************************************************************** + * Name: lcd_poll + ****************************************************************************/ + +#ifndef CONFIG_DISABLE_POLL +static int lcd_poll(FAR struct file *filp, FAR struct pollfd *fds, + bool setup) +{ + if (setup) + { + /* Data is always avaialble to be read */ + + fds->revents |= (fds->events & (POLLIN|POLLOUT)); + if (fds->revents != 0) + { + sem_post(fds->sem); + } + } + return OK; +} +#endif + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: up_lcd1602_initialize + * + * Description: + * Initialize the LCD1602 hardware and register the character driver. + * + ****************************************************************************/ + +int up_lcd1602_initialize(void) +{ + uint32_t regval; + int ret = OK; + + /* Only initialize the driver once. */ + + if (!g_lcd1602.initialized) + { + lcdvdbg("Initializing\n"); + + /* PMP Master mode configuration */ + /* Make sure that interrupts are disabled */ + + putreg32(INT_PMP, PIC32MX_INT_IEC1CLR); + + /* Stop and reset the PMP module and clear the mode and control registers. */ + + putreg32(0, PIC32MX_PMP_MODE); + putreg32(0, PIC32MX_PMP_AEN); + putreg32(0, PIC32MX_PMP_CON); + putreg32(0, PIC32MX_PMP_ADDR); + + /* Set LCD timing values, PMP master mode 3, 8-bit mode, no address + * increment, and no interrupts. + */ + + regval = (PMP_MODE_WAITE_RD(0) | PMP_MODE_WAITM(3) | PMP_MODE_WAITB_1TPB | + PMP_MODE_MODE_MODE1 | PMP_MODE_MODE8 | PMP_MODE_INCM_NONE | + PMP_MODE_IRQM_NONE); + putreg32(regval, PIC32MX_PMP_MODE); + + /* Enable the PMP for reading and writing + * PMRD/PMWR is active high (1=RD; 0=WR) + * PMENB is active high. + * No chip selects + * Address latch is active high + * Enable PMRD/PMWR, PMENB, and the PMP. + */ + + + regval = (PMP_CON_RDSP | PMP_CON_WRSP | PMP_CON_ALP | + PMP_CON_CSF_ADDR1415 | PMP_CON_PTRDEN | PMP_CON_PTWREN | + PMP_CON_ADRMUX_NONE | PMP_CON_ON); + putreg32(regval, PIC32MX_PMP_CON); + + /* Configure and enable the LCD */ + /* Wait > 15 milliseconds afer Vdd > 4.5V */ + + up_mdelay(100); + + /* Select the 8-bit interface. BF cannot be checked before this command. + * This needs to be done a few times with some magic delays. + */ + + lcd_wrcommand(HD4478OU_FUNC | HD4478OU_FUNC_DL8D | HD4478OU_FUNC_N1); + up_mdelay(50); + lcd_wrcommand(HD4478OU_FUNC | HD4478OU_FUNC_DL8D | HD4478OU_FUNC_N1); + up_udelay(50); + lcd_wrcommand(HD4478OU_FUNC | HD4478OU_FUNC_DL8D | HD4478OU_FUNC_N1); + lcd_wrcommand(HD4478OU_FUNC | HD4478OU_FUNC_DL8D | HD4478OU_FUNC_N1); + + /* Configure the display */ + + lcd_wrcommand(HD4478OU_DISPLAY); /* Display, cursor, and blink off */ + lcd_wrcommand(HD4478OU_CLEAR); /* Clear the display */ + lcd_wrcommand(HD4478OU_INPUT | HD4478OU_INPUT_INCR); /* Increment mode */ + lcd_wrcommand(HD4478OU_DISPLAY | HD4478OU_DISPLAY_ON); /* Display on, cursor and blink off */ + lcd_wrcommand(HD4478OU_DDRAM_AD(0)); /* Select DDRAM RAM AD=0 */ + + /* Register the LCD device driver */ + + ret = register_driver("/dev/lcd1602", &g_lcd1602, 0644, &g_lcd1602); + g_lcd1602.initialized = true; + } + + return ret; +} + +#endif /* CONFIG_LCD_LCD1602 */ diff --git a/nuttx/configs/pic32mx7mmb/src/up_mio283qt2.c b/nuttx/configs/pic32mx7mmb/src/up_mio283qt2.c index 22d6252a98..7ab4353c60 100644 --- a/nuttx/configs/pic32mx7mmb/src/up_mio283qt2.c +++ b/nuttx/configs/pic32mx7mmb/src/up_mio283qt2.c @@ -138,7 +138,7 @@ #define GPIO_LCD_RS (GPIO_OUTPUT|GPIO_VALUE_ZERO|GPIO_PORTB|GPIO_PIN15) - /* Debug ******************************************************************************/ +/* Debug ******************************************************************************/ #ifdef CONFIG_DEBUG_LCD # define lcddbg dbg diff --git a/nuttx/drivers/lcd/README.txt b/nuttx/drivers/lcd/README.txt index 198be18a16..0472043e67 100644 --- a/nuttx/drivers/lcd/README.txt +++ b/nuttx/drivers/lcd/README.txt @@ -151,6 +151,12 @@ that makes then less re-usable: a TFT/Transmissive color LCD module with touch-screen, FTM280C12D, with integrated driver IC HX8346. + HX8347: + + configs/pic32mx7mmb/src/up_mio283qt2.c. This driver is for the MI0283QT-2 + LCD from Multi-Inno Technology Co., Ltd. This LCD is based on the Himax + HX8347-D LCD controller. + ILI93xx and Similar: configs/stm3210e-eval/src/up_lcd.c. This driver supports the following @@ -171,10 +177,10 @@ that makes then less re-usable: configs/stm32f4discovery/src/up_ug2864hsweg01.c configs/zp214xpa/src/up_ug2864ambag01.c - Alphnumeric Displays: + Alphnumeric LCD Displays: configs/skp16c26/src/up_lcd.c. Untested alphanumeric LCD driver. - configs/stm32f4discovery/src/up_lcd1602.c + configs/pcblogic-pic32/src/up_lcd1602.c graphics/ ========= diff --git a/nuttx/include/nuttx/lcd/hd4478ou.h b/nuttx/include/nuttx/lcd/hd4478ou.h new file mode 100644 index 0000000000..4bb93fca92 --- /dev/null +++ b/nuttx/include/nuttx/lcd/hd4478ou.h @@ -0,0 +1,118 @@ +/******************************************************************************************** + * include/nuttx/lcd/hd4478ou.h + * + * Definitions for the Hitachi HD44780U LCD controller (as used in the + * LCD1602). + * + * Copyright (C) 2013 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * 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. + * + ********************************************************************************************/ + +#ifndef __INCLUDE_NUTTX_HD4478OU_H +#define __INCLUDE_NUTTX_HD4478OU_H + +/******************************************************************************************** + * Included Files + ********************************************************************************************/ +/* Command set: + * + * RS=0 R/W=0 : Command + * RS=0 R/W=1 : Busy/AD, Read CT (see below) + * RS=1 R/W=0 : Write data to CGRAM or DDRAM + * RS=1 R/W=0 : Read data from CGRAM or DDRAM + */ + +#define HD4478OU_CLEAR (0x01) /* Screen Clear, Set AC to 0 */ +#define HD4478OU_RETURN (0x02) /* DDRAM AD=0, return */ +#define HD4478OU_INPUT (0x04) /* Set moving direction of cursor */ +# define HD4478OU_INPUT_SHIFT (1 << 0) /* Shift */ +# define HD4478OU_INPUT_INCR (1 << 1) /* Increment mode */ +# define HD4478OU_INPUT_DECR (0x00) /* Decrement mode */ +#define HD4478OU_DISPLAY (0x08) /* Set display, cursor, blink on/off */ +# define HD4478OU_DISPLAY_BLINK (1 << 0) /* Blink on/off */ +# define HD4478OU_DISPLAY_CURSOR (1 << 1) /* Cursor on/off */ +# define HD4478OU_DISPLAY_ON (1 << 2) /* Display on/off */ +#define HD4478OU_SHIFT (0x10) /* Remove cursor and whole diplay */ +# define HD4478OU_SHIFT_RIGHT (1 << 2) /* Shift right */ +# define HD4478OU_SHIFT_LEFT (0x00) /* Shift right */ +# define HD4478OU_SHIFT_DISPLAY (1 << 3) /* Display shift */ +# define HD4478OU_SHIFT_CURSOR (0x00) /* Cursor shift */ +#define HD4478OU_FUNC (0x20) /* Set DL, display line, font */ +# define HD4478OU_FUNC_F5x10 (1 << 2) /* 5x10 Style */ +# define HD4478OU_FUNC_F5x7 (0x00) /* 5x7 Style */ +# define HD4478OU_FUNC_N1 (1 << 3) /* N=2R */ +# define HD4478OU_FUNC_N0 (0x00) /* N=1R */ +# define HD4478OU_FUNC_DL8D (1 << 4) /* DL=8D, 8-bit interface */ +# define HD4478OU_FUNC_DL4D (0x00) /* DL=4D, 4-bit interface */ +#define HD4478OU_CGRAM_AD(a) (0x40|(a)) /* Set CGRAM AD, send receive data */ +#define HD4478OU_DDRAM_AD(a) (0x80|(a)) /* Set DDRAM AD, send receive data */ + +/* RS=0 R/W=1 : Execute internal function, read AD of CT */ + +#define HD4478OU_BUSY(bf,ac) ((bf) << 7 | (ac)) + +/******************************************************************************************** + * Pre-processor Definitions + ********************************************************************************************/ + +/******************************************************************************************** + * Public Types + ********************************************************************************************/ + +/******************************************************************************************** + * Public Data + ********************************************************************************************/ + +#ifdef __cplusplus +extern "C" +{ +#endif + +/******************************************************************************************** + * Public Function Prototypes + ********************************************************************************************/ + +/******************************************************************************************** + * Name: up_lcd1602_initialize + * + * Description: + * the LCD1602 is an HD4478OU-based LCD from Wave share. This function initializes the + * LCD1602 hardware and registers the character driver as /dev/lcd1602. + * + ********************************************************************************************/ + +int up_lcd1602_initialize(void); + +#ifdef __cplusplus +} +#endif + +#endif /* __INCLUDE_NUTTX_HD4478OU_H */ From 4742f55507b6e1392f459a2c228efb75b567b62e Mon Sep 17 00:00:00 2001 From: patacongo Date: Tue, 22 Jan 2013 01:25:40 +0000 Subject: [PATCH 104/118] Add option to use BASEPRI instead of PRIMASK to disable interrupts in all ARMv7-M architectures git-svn-id: http://svn.code.sf.net/p/nuttx/code/trunk@5546 42af7a65-404d-4744-a932-0658087f49c3 --- nuttx/arch/arm/Kconfig | 19 +- nuttx/arch/arm/include/armv7-m/irq.h | 141 ++-- nuttx/arch/arm/include/kinetis/chip.h | 850 ++++++++++++++++++++++ nuttx/arch/arm/include/lm/chip.h | 14 + nuttx/arch/arm/include/lm/irq.h | 24 +- nuttx/arch/arm/include/lm/lm3s_irq.h | 16 - nuttx/arch/arm/include/lpc17xx/chip.h | 14 + nuttx/arch/arm/include/lpc43xx/chip.h | 31 +- nuttx/arch/arm/include/sam3u/chip.h | 95 +++ nuttx/arch/arm/include/stm32/chip.h | 10 + nuttx/arch/arm/src/armv7-m/up_hardfault.c | 8 +- nuttx/arch/arm/src/kinetis/chip.h | 799 +------------------- nuttx/arch/arm/src/kinetis/kinetis_irq.c | 43 +- nuttx/arch/arm/src/lm/chip.h | 16 +- nuttx/arch/arm/src/lm/lm_irq.c | 43 +- nuttx/arch/arm/src/lpc17xx/chip.h | 16 +- nuttx/arch/arm/src/lpc17xx/lpc17_irq.c | 43 +- nuttx/arch/arm/src/lpc43xx/chip.h | 19 +- nuttx/arch/arm/src/lpc43xx/lpc43_irq.c | 42 +- nuttx/arch/arm/src/sam3u/chip.h | 45 +- nuttx/arch/arm/src/sam3u/sam3u_irq.c | 43 +- nuttx/arch/arm/src/stm32/chip.h | 2 +- nuttx/arch/arm/src/stm32/stm32.h | 6 - nuttx/arch/arm/src/stm32/stm32_irq.c | 43 +- 24 files changed, 1401 insertions(+), 981 deletions(-) create mode 100644 nuttx/arch/arm/include/kinetis/chip.h create mode 100644 nuttx/arch/arm/include/sam3u/chip.h diff --git a/nuttx/arch/arm/Kconfig b/nuttx/arch/arm/Kconfig index 36343e3199..5709f890fa 100644 --- a/nuttx/arch/arm/Kconfig +++ b/nuttx/arch/arm/Kconfig @@ -46,7 +46,6 @@ config ARCH_CHIP_KINETIS bool "Freescale Kinetis" select ARCH_CORTEXM4 select ARCH_HAVE_MPU - select ARCH_IRQPRIO select ARCH_HAVE_RAMFUNCS select ARCH_RAMFUNCS ---help--- @@ -55,7 +54,6 @@ config ARCH_CHIP_KINETIS config ARCH_CHIP_LM bool "TI Stellaris" select ARCH_HAVE_MPU - select ARCH_IRQPRIO ---help--- TI Stellaris LMS3 architecutres (ARM Cortex-M3) @@ -63,7 +61,6 @@ config ARCH_CHIP_LPC17XX bool "NXP LPC17xx" select ARCH_CORTEXM3 select ARCH_HAVE_MPU - select ARCH_IRQPRIO ---help--- NXP LPC17xx architectures (ARM Cortex-M3) @@ -95,7 +92,6 @@ config ARCH_CHIP_LPC43XX select ARCH_HAVE_CMNVECTOR select ARMV7M_CMNVECTOR select ARCH_HAVE_MPU - select ARCH_IRQPRIO ---help--- NPX LPC43XX architectures (ARM Cortex-M4). @@ -103,7 +99,6 @@ config ARCH_CHIP_SAM3U bool "Atmel AT91SAM3U" select ARCH_CORTEXM3 select ARCH_HAVE_MPU - select ARCH_IRQPRIO ---help--- Atmel AT91SAM3U architectures (ARM Cortex-M3) @@ -112,7 +107,6 @@ config ARCH_CHIP_STM32 select ARCH_HAVE_CMNVECTOR select ARCH_HAVE_MPU select ARCH_HAVE_I2CRESET - select ARCH_IRQPRIO ---help--- STMicro STM32 architectures (ARM Cortex-M3/4). @@ -136,9 +130,11 @@ config ARCH_ARM920T config ARCH_CORTEXM3 bool + select ARCH_IRQPRIO config ARCH_CORTEXM4 bool + select ARCH_IRQPRIO config ARCH_FAMILY string @@ -162,6 +158,17 @@ config ARCH_CHIP default "stm32" if ARCH_CHIP_STM32 default "str71x" if ARCH_CHIP_STR71X +config ARMV7M_USEBASEPRI + bool "Use BASEPRI Register" + default n + depends on ARCH_CORTEXM3 || ARCH_CORTEXM4 + ---help--- + Use the BASEPRI register to enable and disable able interrupts. By + default, the PRIMASK register is used for this purpose. This + usually results in hardfaults that are properly handling by the + RTOS. Using the BASEPRI register will avoid these hardfault. + That is needed primarily for integration with some toolchains. + config ARCH_HAVE_CMNVECTOR bool diff --git a/nuttx/arch/arm/include/armv7-m/irq.h b/nuttx/arch/arm/include/armv7-m/irq.h index 606b3988f4..9491e57c09 100644 --- a/nuttx/arch/arm/include/armv7-m/irq.h +++ b/nuttx/arch/arm/include/armv7-m/irq.h @@ -60,6 +60,10 @@ # include #endif +#ifdef CONFIG_ARMV7M_USEBASEPRI +# include +#endif + /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ @@ -130,64 +134,6 @@ struct xcptcontext #ifndef __ASSEMBLY__ -/* Disable IRQs */ - -static inline void irqdisable(void) inline_function; -static inline void irqdisable(void) -{ - __asm__ __volatile__ ("\tcpsid i\n"); -} - -/* Save the current primask state & disable IRQs */ - -static inline irqstate_t irqsave(void) inline_function; -static inline irqstate_t irqsave(void) -{ - unsigned short primask; - - /* Return the current value of primask register and set - * bit 0 of the primask register to disable interrupts - */ - - __asm__ __volatile__ - ( - "\tmrs %0, primask\n" - "\tcpsid i\n" - : "=r" (primask) - : - : "memory"); - - return primask; -} - -/* Enable IRQs */ - -static inline void irqenable(void) inline_function; -static inline void irqenable(void) -{ - __asm__ __volatile__ ("\tcpsie i\n"); -} - -/* Restore saved primask state */ - -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 - * interupts. - */ - - __asm__ __volatile__ - ( - "\ttst %0, #1\n" - "\tbne 1f\n" - "\tcpsie i\n" - "1:\n" - : - : "r" (primask) - : "memory"); -} - /* Get/set the primask register */ static inline uint8_t getprimask(void) inline_function; @@ -243,6 +189,85 @@ static inline void setbasepri(uint32_t basepri) : "memory"); } +/* Disable IRQs */ + +static inline void irqdisable(void) inline_function; +static inline void irqdisable(void) +{ +#ifdef CONFIG_ARMV7M_USEBASEPRI + setbasepri(NVIC_SYSH_DISABLE_PRIORITY); +#else + __asm__ __volatile__ ("\tcpsid i\n"); +#endif +} + +/* Save the current primask state & disable IRQs */ + +static inline irqstate_t irqsave(void) inline_function; +static inline irqstate_t irqsave(void) +{ +#ifdef CONFIG_ARMV7M_USEBASEPRI + + uint8_t basepri = getbasepri(); + setbasepri(NVIC_SYSH_DISABLE_PRIORITY); + return basepri; + +#else + + unsigned short primask; + + /* Return the current value of primask register and set + * bit 0 of the primask register to disable interrupts + */ + + __asm__ __volatile__ + ( + "\tmrs %0, primask\n" + "\tcpsid i\n" + : "=r" (primask) + : + : "memory"); + + return primask; +#endif +} + +/* Enable IRQs */ + +static inline void irqenable(void) inline_function; +static inline void irqenable(void) +{ +#ifdef CONFIG_ARMV7M_USEBASEPRI + setbasepri(NVIC_SYSH_PRIORITY_MIN); +#else + __asm__ __volatile__ ("\tcpsie i\n"); +#endif +} + +/* Restore saved primask state */ + +static inline void irqrestore(irqstate_t flags) inline_function; +static inline void irqrestore(irqstate_t flags) +{ +#ifdef CONFIG_ARMV7M_USEBASEPRI + setbasepri(flags); +#else + /* If bit 0 of the primask is 0, then we need to restore + * interupts. + */ + + __asm__ __volatile__ + ( + "\ttst %0, #1\n" + "\tbne 1f\n" + "\tcpsie i\n" + "1:\n" + : + : "r" (flags) + : "memory"); +#endif +} + /* Get/set IPSR */ static inline uint32_t getipsr(void) inline_function; diff --git a/nuttx/arch/arm/include/kinetis/chip.h b/nuttx/arch/arm/include/kinetis/chip.h new file mode 100644 index 0000000000..cb686c5d62 --- /dev/null +++ b/nuttx/arch/arm/include/kinetis/chip.h @@ -0,0 +1,850 @@ +/************************************************************************************ + * arch/arm/include/kinetis/chip.h + * + * Copyright (C) 2011, 2013 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * 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. + * + ************************************************************************************/ + +#ifndef __ARCH_ARM_INCLUDE_KINETIS_CHIP_H +#define __ARCH_ARM_INCLUDE_KINETIS_CHIP_H + +/************************************************************************************ + * Included Files + ************************************************************************************/ + +#include + +/************************************************************************************ + * Pre-processor Definitions + ************************************************************************************/ + +/* Get customizations for each supported chip */ + +#if defined(CONFIG_ARCH_CHIP_MK40X64VFX50) || defined(CONFIG_ARCH_CHIP_MK40X64VLH50) || \ + defined(CONFIG_ARCH_CHIP_MK40X64VLK50) || defined(CONFIG_ARCH_CHIP_MK40X64VMB50) +# define KINETIS_K40 1 /* Kinetics K40 family */ +# undef KINETIS_K60 /* Not Kinetis K60 family */ +# define KINETIS_FLASH_SIZE (64*1024) /* 64Kb */ +# define KINETIS_FLEXMEM_SIZE (32*1024) /* 32Kb */ +# define KINETIS_SRAM_SIZE (16*1024) /* 16Kb */ +# undef KINETIS_MPU /* No memory protection unit */ +# undef KINETIS_EXTBUS /* No external bus interface */ +# define KINETIS_NDMACH 16 /* Up to 16 DMA channels */ +# undef KINETIS_NENET /* No Ethernet controller */ +# define KINETIS_NUSBHOST 1 /* One USB host controller */ +# define KINETIS_NUSBOTG 1 /* With USB OTG controller */ +# define KINETIS_NUSBDEV 1 /* One USB device controller */ +# undef KINETIS_NSDHC /* No SD host controller */ +# undef KINETIS_NTOUCHIF /* Xtrinsic touch sensing interface */ +# define KINETIS_NI2C 2 /* Two I2C modules */ +# undef KINETIS_NISO7816 /* No UART with ISO-786 */ +# define KINETIS_NUART 6 /* Six UARTs */ +# define KINETIS_NSPI 3 /* Three SPI modules */ +# if defined(CONFIG_ARCH_CHIP_MK40X64VLK50) || defined(CONFIG_ARCH_CHIP_MK40X64VMB50) +# define KINETIS_NCAN 2 /* Two CAN controllers */ +# else +# undef KINETIS_NCAN /* No CAN in 64-pin chips */ +# endif +# define KINETIS_NI2S 1 /* One I2S module */ +# define KINETIS_NSLCD 1 /* One segment LCD interface (up to 25x8/29x4) */ +# define KINETIS_NADC16 4 /* Four 16-bit ADC */ +# undef KINETIS_NADC12 /* No 12-channel ADC */ +# undef KINETIS_NADC13 /* No 13-channel ADC */ +# undef KINETIS_NADC15 /* No 15-channel ADC */ +# undef KINETIS_NADC18 /* No 18-channel ADC */ +# define KINETIS_NPGA 2 /* Two Programmable Gain Amplifiers */ +# define KINETIS_NCMP 3 /* Three analog comparators */ +# define KINETIS_NDAC6 3 /* Three 6-bit DAC */ +# define KINETIS_NDAC12 2 /* Two 12-bit DAC */ +# define KINETIS_NVREF 1 /* Voltage reference */ +# define KINETIS_NTIMERS12 3 /* Three 12 channel timers */ +# undef KINETIS_NTIMERS20 /* No 20 channel timers */ +# undef KINETIS_NRNG /* No random number generator */ +# define KINETIS_NRTC 1 /* Real time clock */ +# undef KINETIS_NMMCAU /* No hardware encryption */ +# undef KINETIS_NTAMPER /* No tamper detect */ +# define KINETIS_NCRC 1 /* CRC */ + +#elif defined(CONFIG_ARCH_CHIP_MK40X128VFX50) || defined(CONFIG_ARCH_CHIP_MK40X128VLH50) || \ + defined(CONFIG_ARCH_CHIP_MK40X128VLK50) || defined(CONFIG_ARCH_CHIP_MK40X128VMB50) || \ + defined(CONFIG_ARCH_CHIP_MK40X128VLL50) || defined(CONFIG_ARCH_CHIP_MK40X128VML50) || \ + defined(CONFIG_ARCH_CHIP_MK40X128VFX72) || defined(CONFIG_ARCH_CHIP_MK40X128VLH72) || \ + defined(CONFIG_ARCH_CHIP_MK40X128VLK72) || defined(CONFIG_ARCH_CHIP_MK40X128VMB72) || \ + defined(CONFIG_ARCH_CHIP_MK40X128VLL72) || defined(CONFIG_ARCH_CHIP_MK40X128VML72) +# define KINETIS_K40 1 /* Kinetics K40 family */ +# undef KINETIS_K60 /* Not Kinetis K60 family */ +# define KINETIS_FLASH_SIZE (128*1024) /* 128Kb */ +# define KINETIS_FLEXMEM_SIZE (32*1024) /* 32Kb */ +# define KINETIS_SRAM_SIZE (32*1024) /* 32Kb */ +# undef KINETIS_MPU /* No memory protection unit */ +# undef KINETIS_EXTBUS /* No external bus interface */ +# define KINETIS_NDMACH 16 /* Up to 16 DMA channels */ +# undef KINETIS_NENET /* No Ethernet controller */ +# define KINETIS_NUSBHOST 1 /* One USB host controller */ +# define KINETIS_NUSBOTG 1 /* With USB OTG controller */ +# define KINETIS_NUSBDEV 1 /* One USB device controller */ +# undef KINETIS_NSDHC /* No SD host controller */ +# undef KINETIS_NTOUCHIF /* Xtrinsic touch sensing interface */ +# define KINETIS_NI2C 2 /* Two I2C modules */ +# undef KINETIS_NISO7816 /* No UART with ISO-786 */ +# define KINETIS_NUART 6 /* Six UARTs */ +# define KINETIS_NSPI 3 /* Three SPI modules */ +# define KINETIS_NCAN 2 /* Two CAN controllers */ +# define KINETIS_NI2S 1 /* One I2S module */ +# define KINETIS_NSLCD 1 /* One segment LCD interface (up to 36x8/40x4) */ +# define KINETIS_NADC16 4 /* Four 16-bit ADC */ +# undef KINETIS_NADC12 /* No 12-channel ADC */ +# undef KINETIS_NADC13 /* No 13-channel ADC */ +# undef KINETIS_NADC15 /* No 15-channel ADC */ +# undef KINETIS_NADC18 /* No 18-channel ADC */ +# define KINETIS_NPGA 2 /* Two Programmable Gain Amplifiers */ +# define KINETIS_NCMP 3 /* Three analog comparators */ +# define KINETIS_NDAC6 3 /* Three 6-bit DAC */ +# define KINETIS_NDAC12 2 /* Two 12-bit DAC */ +# define KINETIS_NVREF 1 /* Voltage reference */ +# define KINETIS_NTIMERS12 3 /* Three 12 channel timers */ +# undef KINETIS_NTIMERS20 /* No 20 channel timers */ +# define KINETIS_NRTC 1 /* Real time clock */ +# undef KINETIS_NRNG /* No random number generator */ +# undef KINETIS_NMMCAU /* No hardware encryption */ +# undef KINETIS_NTAMPER /* No tamper detect */ +# define KINETIS_NCRC 1 /* CRC */ + +#elif defined(CONFIG_ARCH_CHIP_MK40X256VLK72) || defined(CONFIG_ARCH_CHIP_MK40X256VMB72) || \ + defined(CONFIG_ARCH_CHIP_MK40X256VLL72) || defined(CONFIG_ARCH_CHIP_MK40X256VML72) +# define KINETIS_K40 1 /* Kinetics K40 family */ +# undef KINETIS_K60 /* Not Kinetis K60 family */ +# define KINETIS_FLASH_SIZE (256*1024) /* 256Kb */ +# define KINETIS_FLEXMEM_SIZE (32*1024) /* 32Kb */ +# define KINETIS_SRAM_SIZE (32*1024) /* 64Kb */ +# undef KINETIS_MPU /* No memory protection unit */ +# undef KINETIS_EXTBUS /* No external bus interface */ +# define KINETIS_NDMACH 16 /* Up to 16 DMA channels */ +# undef KINETIS_NENET /* No Ethernet controller */ +# define KINETIS_NUSBHOST 1 /* One USB host controller */ +# define KINETIS_NUSBOTG 1 /* With USB OTG controller */ +# define KINETIS_NUSBDEV 1 /* One USB device controller */ +# undef KINETIS_NSDHC /* No SD host controller */ +# undef KINETIS_NTOUCHIF /* Xtrinsic touch sensing interface */ +# define KINETIS_NI2C 2 /* Two I2C modules */ +# undef KINETIS_NISO7816 /* No UART with ISO-786 */ +# define KINETIS_NUART 6 /* Six UARTs */ +# define KINETIS_NSPI 3 /* Three SPI modules */ +# define KINETIS_NCAN 2 /* Two CAN controllers */ +# define KINETIS_NI2S 1 /* One I2S module */ +# define KINETIS_NSLCD 1 /* One segment LCD interface (up to 36x8/40x4) */ +# define KINETIS_NADC16 4 /* Four 16-bit ADC */ +# undef KINETIS_NADC12 /* No 12-channel ADC */ +# undef KINETIS_NADC13 /* No 13-channel ADC */ +# undef KINETIS_NADC15 /* No 15-channel ADC */ +# undef KINETIS_NADC18 /* No 18-channel ADC */ +# define KINETIS_NPGA 2 /* Two Programmable Gain Amplifiers */ +# define KINETIS_NCMP 3 /* Three analog comparators */ +# define KINETIS_NDAC6 3 /* Three 6-bit DAC */ +# define KINETIS_NDAC12 2 /* Two 12-bit DAC */ +# define KINETIS_NVREF 1 /* Voltage reference */ +# define KINETIS_NTIMERS12 3 /* Three 12 channel timers */ +# undef KINETIS_NTIMERS20 /* No 20 channel timers */ +# define KINETIS_NRTC 1 /* Real time clock */ +# undef KINETIS_NRNG /* No random number generator */ +# undef KINETIS_NMMCAU /* No hardware encryption */ +# undef KINETIS_NTAMPER /* No tamper detect */ +# define KINETIS_NCRC 1 /* CRC */ + +#elif defined(CONFIG_ARCH_CHIP_MK40X128VLQ100) || defined(CONFIG_ARCH_CHIP_MK40X128VMD100) +# define KINETIS_K40 1 /* Kinetics K40 family */ +# undef KINETIS_K60 /* Not Kinetis K60 family */ +# define KINETIS_FLASH_SIZE (128*1024) /* 128Kb */ +# define KINETIS_FLEXMEM_SIZE (128*1024) /* 128Kb */ +# define KINETIS_SRAM_SIZE (32*1024) /* 32Kb */ +# define KINETIS_MPU 1 /* Memory protection unit */ +# define KINETIS_EXTBUS 1 /* External bus interface */ +# define KINETIS_NDMACH 16 /* Up to 16 DMA channels */ +# undef KINETIS_NENET /* No Ethernet controller */ +# define KINETIS_NUSBHOST 1 /* One USB host controller */ +# define KINETIS_NUSBOTG 1 /* With USB OTG controller */ +# define KINETIS_NUSBDEV 1 /* One USB device controller */ +# define KINETIS_NSDHC 1 /* One SD host controller */ +# undef KINETIS_NTOUCHIF /* Xtrinsic touch sensing interface */ +# define KINETIS_NI2C 2 /* Two I2C modules */ +# undef KINETIS_NISO7816 /* No UART with ISO-786 */ +# define KINETIS_NUART 6 /* Six UARTs */ +# define KINETIS_NSPI 3 /* Three SPI modules */ +# define KINETIS_NCAN 2 /* Two CAN controllers */ +# define KINETIS_NI2S 1 /* One I2S module */ +# define KINETIS_NSLCD 1 /* One segment LCD interface (up to 40x8/44x4)*/ +# define KINETIS_NADC16 4 /* Four 16-bit ADC */ +# undef KINETIS_NADC12 /* No 12-channel ADC */ +# undef KINETIS_NADC13 /* No 13-channel ADC */ +# undef KINETIS_NADC15 /* No 15-channel ADC */ +# undef KINETIS_NADC18 /* No 18-channel ADC */ +# define KINETIS_NPGA 2 /* Two Programmable Gain Amplifiers */ +# define KINETIS_NCMP 3 /* Three analog comparators */ +# define KINETIS_NDAC6 3 /* Three 6-bit DAC */ +# define KINETIS_NDAC12 2 /* Two 12-bit DAC */ +# define KINETIS_NVREF 1 /* Voltage reference */ +# define KINETIS_NTIMERS12 3 /* Three 12 channel timers */ +# undef KINETIS_NTIMERS20 /* No 20 channel timers */ +# define KINETIS_NRTC 1 /* Real time clock */ +# undef KINETIS_NRNG /* No random number generator */ +# undef KINETIS_NMMCAU /* No hardware encryption */ +# undef KINETIS_NTAMPER /* No tamper detect */ +# define KINETIS_NCRC 1 /* CRC */ + +#elif defined(CONFIG_ARCH_CHIP_MK40X256VLQ100) || defined(CONFIG_ARCH_CHIP_MK40X256VMD100) +# define KINETIS_K40 1 /* Kinetics K40 family */ +# undef KINETIS_K60 /* Not Kinetis K60 family */ +# define KINETIS_FLASH_SIZE (256*1024) /* 256Kb */ +# define KINETIS_FLEXMEM_SIZE (256*1024) /* 256Kb */ +# define KINETIS_SRAM_SIZE (64*1024) /* 32Kb */ +# define KINETIS_MPU 1 /* Memory protection unit */ +# define KINETIS_EXTBUS 1 /* External bus interface */ +# define KINETIS_NDMACH 16 /* Up to 16 DMA channels */ +# undef KINETIS_NENET /* No Ethernet controller */ +# define KINETIS_NUSBHOST 1 /* One USB host controller */ +# define KINETIS_NUSBOTG 1 /* With USB OTG controller */ +# define KINETIS_NUSBDEV 1 /* One USB device controller */ +# define KINETIS_NSDHC 1 /* One SD host controller */ +# undef KINETIS_NTOUCHIF /* Xtrinsic touch sensing interface */ +# define KINETIS_NI2C 2 /* Two I2C modules */ +# undef KINETIS_NISO7816 /* No UART with ISO-786 */ +# define KINETIS_NUART 6 /* Six UARTs */ +# define KINETIS_NSPI 3 /* Three SPI modules */ +# define KINETIS_NCAN 2 /* Two CAN controllers */ +# define KINETIS_NI2S 1 /* One I2S module */ +# define KINETIS_NSLCD 1 /* One segment LCD interface (up to 40x8/44x4)*/ +# define KINETIS_NADC16 4 /* Four 16-bit ADC */ +# undef KINETIS_NADC12 /* No 12-channel ADC */ +# undef KINETIS_NADC13 /* No 13-channel ADC */ +# undef KINETIS_NADC15 /* No 15-channel ADC */ +# undef KINETIS_NADC18 /* No 18-channel ADC */ +# define KINETIS_NPGA 2 /* Two Programmable Gain Amplifiers */ +# define KINETIS_NCMP 3 /* Three analog comparators */ +# define KINETIS_NDAC6 3 /* Three 6-bit DAC */ +# define KINETIS_NDAC12 2 /* Two 12-bit DAC */ +# define KINETIS_NVREF 1 /* Voltage reference */ +# define KINETIS_NTIMERS12 3 /* Three 12 channel timers */ +# undef KINETIS_NTIMERS20 /* No 20 channel timers */ +# define KINETIS_NRTC 1 /* Real time clock */ +# undef KINETIS_NRNG /* No random number generator */ +# undef KINETIS_NMMCAU /* No hardware encryption */ +# undef KINETIS_NTAMPER /* No tamper detect */ +# define KINETIS_NCRC 1 /* CRC */ + +#elif defined(CONFIG_ARCH_CHIP_MK40N512VLK100) || defined(CONFIG_ARCH_CHIP_MK40N512VMB100) || \ + defined(CONFIG_ARCH_CHIP_MK40N512VLL100) || defined(CONFIG_ARCH_CHIP_MK40N512VML100) || \ + defined(CONFIG_ARCH_CHIP_MK40N512VLQ100) || defined(CONFIG_ARCH_CHIP_MK40N512VMD100) +# define KINETIS_K40 1 /* Kinetics K40 family */ +# undef KINETIS_K60 /* Not Kinetis K60 family */ +# define KINETIS_FLASH_SIZE (512*1024) /* 512Kb */ +# undef KINETIS_FLEXMEM_SIZE /* No FlexMemory */ +# define KINETIS_SRAM_SIZE (128*1024) /* 128Kb */ +# define KINETIS_MPU 1 /* Memory protection unit */ +# define KINETIS_EXTBUS 1 /* External bus interface */ +# define KINETIS_NDMACH 16 /* Up to 16 DMA channels */ +# undef KINETIS_NENET /* No Ethernet controller */ +# define KINETIS_NUSBHOST 1 /* One USB host controller */ +# define KINETIS_NUSBOTG 1 /* With USB OTG controller */ +# define KINETIS_NUSBDEV 1 /* One USB device controller */ +# define KINETIS_NSDHC 1 /* One SD host controller */ +# undef KINETIS_NTOUCHIF /* Xtrinsic touch sensing interface */ +# define KINETIS_NI2C 2 /* Two I2C modules */ +# undef KINETIS_NISO7816 /* No UART with ISO-786 */ +# define KINETIS_NUART 6 /* Six UARTs */ +# define KINETIS_NSPI 3 /* Three SPI modules */ +# define KINETIS_NCAN 2 /* Two CAN controllers */ +# define KINETIS_NI2S 1 /* One I2S module */ +# define KINETIS_NSLCD 1 /* One segment LCD interface (up to 40x8/44x4)*/ +# define KINETIS_NADC16 4 /* Four 16-bit ADC */ +# undef KINETIS_NADC12 /* No 12-channel ADC */ +# undef KINETIS_NADC13 /* No 13-channel ADC */ +# undef KINETIS_NADC15 /* No 15-channel ADC */ +# undef KINETIS_NADC18 /* No 18-channel ADC */ +# define KINETIS_NPGA 2 /* Two Programmable Gain Amplifiers */ +# define KINETIS_NCMP 3 /* Three analog comparators */ +# define KINETIS_NDAC6 3 /* Three 6-bit DAC */ +# define KINETIS_NDAC12 2 /* Two 12-bit DAC */ +# define KINETIS_NVREF 1 /* Voltage reference */ +# define KINETIS_NTIMERS12 3 /* Three 12 channel timers */ +# undef KINETIS_NTIMERS20 /* No 20 channel timers */ +# define KINETIS_NRTC 1 /* Real time clock */ +# undef KINETIS_NRNG /* No random number generator */ +# undef KINETIS_NMMCAU /* No hardware encryption */ +# undef KINETIS_NTAMPER /* No tamper detect */ +# define KINETIS_NCRC 1 /* CRC */ + +#elif defined(CONFIG_ARCH_CHIP_MK60N256VLL100) +# undef KINETIS_K40 /* Not Kinetics K40 family */ +# define KINETIS_K60 1 /* Kinetis K60 family */ +# define KINETIS_FLASH_SIZE (256*1024) /* 256Kb */ +# undef KINETIS_FLEXNVM_SIZE /* No FlexNVM */ +# undef KINETIS_FLEXRAM_SIZE /* No FlexRAM */ +# define KINETIS_SRAM_SIZE (64*1024) /* 64Kb */ +# define KINETIS_MPU 1 /* Memory protection unit */ +# define KINETIS_EXTBUS 1 /* External bus interface */ +# define KINETIS_NDMACH 16 /* Up to 16 DMA channels */ +# define KINETIS_NENET 1 /* One IEEE 1588 Ethernet controller */ +# define KINETIS_NUSBHOST 1 /* One USB host controller */ +# define KINETIS_NUSBOTG 1 /* With USB OTG controller */ +# define KINETIS_NUSBDEV 1 /* One USB device controller */ +# define KINETIS_NSDHC 1 /* SD host controller */ +# define KINETIS_NTOUCHIF 1 /* Xtrinsic touch sensing interface */ +# define KINETIS_NI2C 3 /* Three I2C modules */ +# define KINETIS_NISO7816 1 /* One UART with ISO-786 */ +# define KINETIS_NUART 4 /* Four additional UARTs */ +# define KINETIS_NSPI 3 /* Three SPI modules */ +# define KINETIS_NCAN 2 /* Two CAN controllers */ +# define KINETIS_NI2S 2 /* Two I2S modules */ +# define KINETIS_NSLCD 1 /* One segment LCD interface (up to 36x8/40x4) */ +# define KINETIS_NADC16 4 /* Four 16-bit ADC */ +# define KINETIS_NADC12 1 /* One 12-channel ADC (ADC0)*/ +# define KINETIS_NADC13 1 /* No 13-channel ADC (ADC1) */ +# undef KINETIS_NADC15 /* No 15-channel ADC */ +# undef KINETIS_NADC18 /* No 18-channel ADC */ +# define KINETIS_NPGA 4 /* Four Programmable Gain Amplifiers */ +# define KINETIS_NCMP 3 /* Three analog comparators */ +# undef KINETIS_NDAC6 /* No 6-bit DAC */ +# define KINETIS_NDAC12 1 /* One 12-bit DAC */ +# define KINETIS_NVREF 1 /* Voltage reference */ +# undef KINETIS_NTIMERS12 /* No 12 channel timers */ +# define KINETIS_NTIMERS20 4 /* Four 20 channel timers */ +# define KINETIS_NTIMERS12 3 /* Three 12 channel timers */ +# undef KINETIS_NTIMERS20 /* No 20 channel timers */ +# define KINETIS_NRTC 1 /* Real time clock */ +# undef KINETIS_NRNG /* No random number generator */ +# undef KINETIS_NMMCAU /* No hardware encryption */ +# undef KINETIS_NTAMPER /* No tamper detect */ +# define KINETIS_NCRC 1 /* CRC */ + +#elif defined(CONFIG_ARCH_CHIP_MK60X256VLL100) +# undef KINETIS_K40 /* Not Kinetics K40 family */ +# define KINETIS_K60 1 /* Kinetis K60 family */ +# define KINETIS_FLASH_SIZE (256*1024) /* 256Kb */ +# define KINETIS_FLEXNVM_SIZE (256*1024) /* 256Kb */ +# define KINETIS_FLEXRAM_SIZE (4*1024) /* 32Kb */ +# define KINETIS_SRAM_SIZE (64*1024) /* 64Kb */ +# define KINETIS_MPU 1 /* Memory protection unit */ +# define KINETIS_EXTBUS 1 /* External bus interface */ +# define KINETIS_NDMACH 16 /* Up to 16 DMA channels */ +# define KINETIS_NENET 1 /* One IEEE 1588 Ethernet controller */ +# define KINETIS_NUSBHOST 1 /* One USB host controller */ +# define KINETIS_NUSBOTG 1 /* With USB OTG controller */ +# define KINETIS_NUSBDEV 1 /* One USB device controller */ +# define KINETIS_NSDHC 1 /* SD host controller */ +# define KINETIS_NTOUCHIF 1 /* Xtrinsic touch sensing interface */ +# define KINETIS_NI2C 3 /* Three I2C modules */ +# define KINETIS_NISO7816 1 /* One UART with ISO-786 */ +# define KINETIS_NUART 4 /* Four additional UARTs */ +# define KINETIS_NSPI 3 /* Three SPI modules */ +# define KINETIS_NCAN 2 /* Two CAN controllers */ +# define KINETIS_NI2S 2 /* Two I2S modules */ +# define KINETIS_NSLCD 1 /* One segment LCD interface (up to 36x8/40x4) */ +# define KINETIS_NADC16 4 /* Four 16-bit ADC */ +# define KINETIS_NADC12 1 /* One 12-channel ADC (ADC0)*/ +# define KINETIS_NADC13 1 /* No 13-channel ADC (ADC1) */ +# undef KINETIS_NADC15 /* No 15-channel ADC */ +# undef KINETIS_NADC18 /* No 18-channel ADC */ +# define KINETIS_NPGA 4 /* Four Programmable Gain Amplifiers */ +# define KINETIS_NCMP 3 /* Three analog comparators */ +# undef KINETIS_NDAC6 /* No 6-bit DAC */ +# define KINETIS_NDAC12 1 /* One 12-bit DAC */ +# define KINETIS_NVREF 1 /* Voltage reference */ +# undef KINETIS_NTIMERS12 /* No 12 channel timers */ +# define KINETIS_NTIMERS20 4 /* Four 20 channel timers */ +# define KINETIS_NTIMERS12 3 /* Three 12 channel timers */ +# undef KINETIS_NTIMERS20 /* No 20 channel timers */ +# define KINETIS_NRTC 1 /* Real time clock */ +# undef KINETIS_NRNG /* No random number generator */ +# undef KINETIS_NMMCAU /* No hardware encryption */ +# undef KINETIS_NTAMPER /* No tamper detect */ +# define KINETIS_NCRC 1 /* CRC */ + +#elif defined(CONFIG_ARCH_CHIP_MK60N512VLL100) +# undef KINETIS_K40 /* Not Kinetics K40 family */ +# define KINETIS_K60 1 /* Kinetis K60 family */ +# define KINETIS_FLASH_SIZE (512*1024) /* 256Kb */ +# undef KINETIS_FLEXNVM_SIZE /* No FlexNVM */ +# undef KINETIS_FLEXRAM_SIZE /* No FlexRAM */ +# define KINETIS_SRAM_SIZE (128*1024) /* 128Kb */ +# define KINETIS_MPU 1 /* Memory protection unit */ +# define KINETIS_EXTBUS 1 /* External bus interface */ +# define KINETIS_NDMACH 16 /* Up to 16 DMA channels */ +# define KINETIS_NENET 1 /* One IEEE 1588 Ethernet controller */ +# define KINETIS_NUSBHOST 1 /* One USB host controller */ +# define KINETIS_NUSBOTG 1 /* With USB OTG controller */ +# define KINETIS_NUSBDEV 1 /* One USB device controller */ +# define KINETIS_NSDHC 1 /* SD host controller */ +# define KINETIS_NTOUCHIF 1 /* Xtrinsic touch sensing interface */ +# define KINETIS_NI2C 3 /* Three I2C modules */ +# define KINETIS_NISO7816 1 /* One UART with ISO-786 */ +# define KINETIS_NUART 4 /* Four additional UARTs */ +# define KINETIS_NSPI 3 /* Three SPI modules */ +# define KINETIS_NCAN 2 /* Two CAN controllers */ +# define KINETIS_NI2S 2 /* Two I2S modules */ +# define KINETIS_NSLCD 1 /* One segment LCD interface (up to 36x8/40x4) */ +# define KINETIS_NADC16 4 /* Four 16-bit ADC */ +# define KINETIS_NADC12 1 /* One 12-channel ADC (ADC0)*/ +# define KINETIS_NADC13 1 /* No 13-channel ADC (ADC1) */ +# undef KINETIS_NADC15 /* No 15-channel ADC */ +# undef KINETIS_NADC18 /* No 18-channel ADC */ +# define KINETIS_NPGA 4 /* Four Programmable Gain Amplifiers */ +# define KINETIS_NCMP 3 /* Three analog comparators */ +# undef KINETIS_NDAC6 /* No 6-bit DAC */ +# define KINETIS_NDAC12 1 /* One 12-bit DAC */ +# define KINETIS_NVREF 1 /* Voltage reference */ +# undef KINETIS_NTIMERS12 /* No 12 channel timers */ +# define KINETIS_NTIMERS20 4 /* Four 20 channel timers */ +# define KINETIS_NTIMERS12 3 /* Three 12 channel timers */ +# undef KINETIS_NTIMERS20 /* No 20 channel timers */ +# define KINETIS_NRTC 1 /* Real time clock */ +# undef KINETIS_NRNG /* No random number generator */ +# undef KINETIS_NMMCAU /* No hardware encryption */ +# undef KINETIS_NTAMPER /* No tamper detect */ +# define KINETIS_NCRC 1 /* CRC */ + +#elif defined(CONFIG_ARCH_CHIP_MK60N256VML100) +# undef KINETIS_K40 /* Not Kinetics K40 family */ +# define KINETIS_K60 1 /* Kinetis K60 family */ +# define KINETIS_FLASH_SIZE (256*1024) /* 256Kb */ +# undef KINETIS_FLEXNVM_SIZE /* No FlexNVM */ +# undef KINETIS_FLEXRAM_SIZE /* No FlexRAM */ +# define KINETIS_SRAM_SIZE (64*1024) /* 64Kb */ +# define KINETIS_MPU 1 /* Memory protection unit */ +# define KINETIS_EXTBUS 1 /* External bus interface */ +# define KINETIS_NDMACH 16 /* Up to 16 DMA channels */ +# define KINETIS_NENET 1 /* One IEEE 1588 Ethernet controller */ +# define KINETIS_NUSBHOST 1 /* One USB host controller */ +# define KINETIS_NUSBOTG 1 /* With USB OTG controller */ +# define KINETIS_NUSBDEV 1 /* One USB device controller */ +# define KINETIS_NSDHC 1 /* SD host controller */ +# define KINETIS_NTOUCHIF 1 /* Xtrinsic touch sensing interface */ +# define KINETIS_NI2C 3 /* Three I2C modules */ +# define KINETIS_NISO7816 1 /* One UART with ISO-786 */ +# define KINETIS_NUART 4 /* Four additional UARTs */ +# define KINETIS_NSPI 3 /* Three SPI modules */ +# define KINETIS_NCAN 2 /* Two CAN controllers */ +# define KINETIS_NI2S 2 /* Two I2S modules */ +# define KINETIS_NSLCD 1 /* One segment LCD interface (up to 36x8/40x4) */ +# define KINETIS_NADC16 4 /* Four 16-bit ADC */ +# define KINETIS_NADC12 1 /* One 12-channel ADC (ADC0)*/ +# undef KINETIS_NADC13 /* No 13-channel ADC */ +# define KINETIS_NADC15 1 /* One 15-channel ADC (ADC1) */ +# undef KINETIS_NADC18 /* No 18-channel ADC */ +# define KINETIS_NPGA 4 /* Four Programmable Gain Amplifiers */ +# define KINETIS_NCMP 3 /* Three analog comparators */ +# undef KINETIS_NDAC6 /* No 6-bit DAC */ +# define KINETIS_NDAC12 1 /* One 12-bit DAC */ +# define KINETIS_NVREF 1 /* Voltage reference */ +# undef KINETIS_NTIMERS12 /* No 12 channel timers */ +# define KINETIS_NTIMERS20 4 /* Four 20 channel timers */ +# define KINETIS_NTIMERS12 3 /* Three 12 channel timers */ +# undef KINETIS_NTIMERS20 /* No 20 channel timers */ +# define KINETIS_NRTC 1 /* Real time clock */ +# undef KINETIS_NRNG /* No random number generator */ +# undef KINETIS_NMMCAU /* No hardware encryption */ +# undef KINETIS_NTAMPER /* No tamper detect */ +# define KINETIS_NCRC 1 /* CRC */ + +#elif defined(CONFIG_ARCH_CHIP_MK60X256VML100) +# undef KINETIS_K40 /* Not Kinetics K40 family */ +# define KINETIS_K60 1 /* Kinetis K60 family */ +# define KINETIS_FLASH_SIZE (256*1024) /* 256Kb */ +# define KINETIS_FLEXNVM_SIZE (256*1024) /* 256Kb */ +# define KINETIS_FLEXRAM_SIZE (4*1024) /* 4Kb */ +# define KINETIS_SRAM_SIZE (64*1024) /* 64Kb */ +# define KINETIS_MPU 1 /* Memory protection unit */ +# define KINETIS_EXTBUS 1 /* External bus interface */ +# define KINETIS_NDMACH 16 /* Up to 16 DMA channels */ +# define KINETIS_NENET 1 /* One IEEE 1588 Ethernet controller */ +# define KINETIS_NUSBHOST 1 /* One USB host controller */ +# define KINETIS_NUSBOTG 1 /* With USB OTG controller */ +# define KINETIS_NUSBDEV 1 /* One USB device controller */ +# define KINETIS_NSDHC 1 /* SD host controller */ +# define KINETIS_NTOUCHIF 1 /* Xtrinsic touch sensing interface */ +# define KINETIS_NI2C 3 /* Three I2C modules */ +# define KINETIS_NISO7816 1 /* One UART with ISO-786 */ +# define KINETIS_NUART 4 /* Four additional UARTs */ +# define KINETIS_NSPI 3 /* Three SPI modules */ +# define KINETIS_NCAN 2 /* Two CAN controllers */ +# define KINETIS_NI2S 2 /* Two I2S modules */ +# define KINETIS_NSLCD 1 /* One segment LCD interface (up to 36x8/40x4) */ +# define KINETIS_NADC16 4 /* Four 16-bit ADC */ +# define KINETIS_NADC12 1 /* One 12-channel ADC (ADC0)*/ +# undef KINETIS_NADC13 /* No 13-channel ADC */ +# define KINETIS_NADC15 1 /* One 15-channel ADC (ADC1) */ +# undef KINETIS_NADC18 /* No 18-channel ADC */ +# define KINETIS_NPGA 4 /* Four Programmable Gain Amplifiers */ +# define KINETIS_NCMP 3 /* Three analog comparators */ +# undef KINETIS_NDAC6 /* No 6-bit DAC */ +# define KINETIS_NDAC12 1 /* One 12-bit DAC */ +# define KINETIS_NVREF 1 /* Voltage reference */ +# undef KINETIS_NTIMERS12 /* No 12 channel timers */ +# define KINETIS_NTIMERS20 4 /* Four 20 channel timers */ +# define KINETIS_NTIMERS12 3 /* Three 12 channel timers */ +# undef KINETIS_NTIMERS20 /* No 20 channel timers */ +# define KINETIS_NRTC 1 /* Real time clock */ +# undef KINETIS_NRNG /* No random number generator */ +# undef KINETIS_NMMCAU /* No hardware encryption */ +# undef KINETIS_NTAMPER /* No tamper detect */ +# define KINETIS_NCRC 1 /* CRC */ + +#elif defined(CONFIG_ARCH_CHIP_MK60N512VML100) +# undef KINETIS_K40 /* Not Kinetics K40 family */ +# define KINETIS_K60 1 /* Kinetis K60 family */ +# define KINETIS_FLASH_SIZE (512*1024) /* 256Kb */ +# undef KINETIS_FLEXNVM_SIZE /* No FlexNVM */ +# undef KINETIS_FLEXRAM_SIZE /* No FlexRAM */ +# define KINETIS_SRAM_SIZE (128*1024) /* 128Kb */ +# define KINETIS_MPU 1 /* Memory protection unit */ +# define KINETIS_EXTBUS 1 /* External bus interface */ +# define KINETIS_NDMACH 16 /* Up to 16 DMA channels */ +# define KINETIS_NENET 1 /* One IEEE 1588 Ethernet controller */ +# define KINETIS_NUSBHOST 1 /* One USB host controller */ +# define KINETIS_NUSBOTG 1 /* With USB OTG controller */ +# define KINETIS_NUSBDEV 1 /* One USB device controller */ +# define KINETIS_NSDHC 1 /* SD host controller */ +# define KINETIS_NTOUCHIF 1 /* Xtrinsic touch sensing interface */ +# define KINETIS_NI2C 3 /* Three I2C modules */ +# define KINETIS_NISO7816 1 /* One UART with ISO-786 */ +# define KINETIS_NUART 4 /* Four additional UARTs */ +# define KINETIS_NSPI 3 /* Three SPI modules */ +# define KINETIS_NCAN 2 /* Two CAN controllers */ +# define KINETIS_NI2S 2 /* Two I2S modules */ +# define KINETIS_NSLCD 1 /* One segment LCD interface (up to 36x8/40x4) */ +# define KINETIS_NADC16 4 /* Four 16-bit ADC */ +# define KINETIS_NADC12 1 /* One 12-channel ADC (ADC0)*/ +# undef KINETIS_NADC13 /* No 13-channel ADC */ +# define KINETIS_NADC15 1 /* One 15-channel ADC (ADC1) */ +# undef KINETIS_NADC18 /* No 18-channel ADC */ +# define KINETIS_NPGA 4 /* Four Programmable Gain Amplifiers */ +# define KINETIS_NCMP 3 /* Three analog comparators */ +# undef KINETIS_NDAC6 /* No 6-bit DAC */ +# define KINETIS_NDAC12 1 /* One 12-bit DAC */ +# define KINETIS_NVREF 1 /* Voltage reference */ +# undef KINETIS_NTIMERS12 /* No 12 channel timers */ +# define KINETIS_NTIMERS20 4 /* Four 20 channel timers */ +# define KINETIS_NTIMERS12 3 /* Three 12 channel timers */ +# undef KINETIS_NTIMERS20 /* No 20 channel timers */ +# define KINETIS_NRTC 1 /* Real time clock */ +# undef KINETIS_NRNG /* No random number generator */ +# undef KINETIS_NMMCAU /* No hardware encryption */ +# undef KINETIS_NTAMPER /* No tamper detect */ +# define KINETIS_NCRC 1 /* CRC */ + +#elif defined(CONFIG_ARCH_CHIP_MK60N256VLQ100) +# undef KINETIS_K40 /* Not Kinetics K40 family */ +# define KINETIS_K60 1 /* Kinetis K60 family */ +# define KINETIS_FLASH_SIZE (256*1024) /* 256Kb */ +# undef KINETIS_FLEXNVM_SIZE /* No FlexNVM */ +# undef KINETIS_FLEXRAM_SIZE /* No FlexRAM */ +# define KINETIS_SRAM_SIZE (64*1024) /* 64Kb */ +# define KINETIS_MPU 1 /* Memory protection unit */ +# define KINETIS_EXTBUS 1 /* External bus interface */ +# define KINETIS_NDMACH 16 /* Up to 16 DMA channels */ +# define KINETIS_NENET 1 /* One IEEE 1588 Ethernet controller */ +# define KINETIS_NUSBHOST 1 /* One USB host controller */ +# define KINETIS_NUSBOTG 1 /* With USB OTG controller */ +# define KINETIS_NUSBDEV 1 /* One USB device controller */ +# define KINETIS_NSDHC 1 /* SD host controller */ +# define KINETIS_NTOUCHIF 1 /* Xtrinsic touch sensing interface */ +# define KINETIS_NI2C 3 /* Three I2C modules */ +# define KINETIS_NISO7816 1 /* One UART with ISO-786 */ +# define KINETIS_NUART 5 /* Five additional UARTs */ +# define KINETIS_NSPI 3 /* Three SPI modules */ +# define KINETIS_NCAN 2 /* Two CAN controllers */ +# define KINETIS_NI2S 2 /* Two I2S modules */ +# define KINETIS_NSLCD 1 /* One segment LCD interface (up to 36x8/40x4) */ +# define KINETIS_NADC16 4 /* Four 16-bit ADC */ +# undef KINETIS_NADC12 /* No 12-channel ADC */ +# undef KINETIS_NADC13 /* No 13-channel ADC */ +# define KINETIS_NADC15 1 /* One 15-channel ADC (ADC0) */ +# define KINETIS_NADC18 1 /* One 18-channel ADC (ADC1) */ +# define KINETIS_NPGA 4 /* Four Programmable Gain Amplifiers */ +# define KINETIS_NCMP 3 /* Three analog comparators */ +# undef KINETIS_NDAC6 /* No 6-bit DAC */ +# define KINETIS_NDAC12 2 /* Twp 12-bit DACs */ +# define KINETIS_NVREF 1 /* Voltage reference */ +# undef KINETIS_NTIMERS12 /* No 12 channel timers */ +# define KINETIS_NTIMERS20 4 /* Four 20 channel timers */ +# define KINETIS_NTIMERS12 3 /* Three 12 channel timers */ +# undef KINETIS_NTIMERS20 /* No 20 channel timers */ +# define KINETIS_NRTC 1 /* Real time clock */ +# undef KINETIS_NRNG /* No random number generator */ +# undef KINETIS_NMMCAU /* No hardware encryption */ +# undef KINETIS_NTAMPER /* No tamper detect */ +# define KINETIS_NCRC 1 /* CRC */ + +#elif defined(CONFIG_ARCH_CHIP_MK60X256VLQ100) +# undef KINETIS_K40 /* Not Kinetics K40 family */ +# define KINETIS_K60 1 /* Kinetis K60 family */ +# define KINETIS_FLASH_SIZE (256*1024) /* 256Kb */ +# define KINETIS_FLEXNVM_SIZE (256*1024) /* 256Kb */ +# define KINETIS_FLEXRAM_SIZE (4*1024) /* 4Kb */ +# define KINETIS_SRAM_SIZE (64*1024) /* 64Kb */ +# define KINETIS_MPU 1 /* Memory protection unit */ +# define KINETIS_EXTBUS 1 /* External bus interface */ +# define KINETIS_NDMACH 16 /* Up to 16 DMA channels */ +# define KINETIS_NENET 1 /* One IEEE 1588 Ethernet controller */ +# define KINETIS_NUSBHOST 1 /* One USB host controller */ +# define KINETIS_NUSBOTG 1 /* With USB OTG controller */ +# define KINETIS_NUSBDEV 1 /* One USB device controller */ +# define KINETIS_NSDHC 1 /* SD host controller */ +# define KINETIS_NTOUCHIF 1 /* Xtrinsic touch sensing interface */ +# define KINETIS_NI2C 3 /* Three I2C modules */ +# define KINETIS_NISO7816 1 /* One UART with ISO-786 */ +# define KINETIS_NUART 5 /* Five additional UARTs */ +# define KINETIS_NSPI 3 /* Three SPI modules */ +# define KINETIS_NCAN 2 /* Two CAN controllers */ +# define KINETIS_NI2S 2 /* Two I2S modules */ +# define KINETIS_NSLCD 1 /* One segment LCD interface (up to 36x8/40x4) */ +# define KINETIS_NADC16 4 /* Four 16-bit ADC */ +# undef KINETIS_NADC12 /* No 12-channel ADC */ +# undef KINETIS_NADC13 /* No 13-channel ADC */ +# define KINETIS_NADC15 1 /* One 15-channel ADC (ADC0) */ +# define KINETIS_NADC18 1 /* One 18-channel ADC (ADC1) */ +# define KINETIS_NPGA 4 /* Four Programmable Gain Amplifiers */ +# define KINETIS_NCMP 3 /* Three analog comparators */ +# undef KINETIS_NDAC6 /* No 6-bit DAC */ +# define KINETIS_NDAC12 2 /* Twp 12-bit DACs */ +# define KINETIS_NVREF 1 /* Voltage reference */ +# undef KINETIS_NTIMERS12 /* No 12 channel timers */ +# define KINETIS_NTIMERS20 4 /* Four 20 channel timers */ +# define KINETIS_NTIMERS12 3 /* Three 12 channel timers */ +# undef KINETIS_NTIMERS20 /* No 20 channel timers */ +# define KINETIS_NRTC 1 /* Real time clock */ +# undef KINETIS_NRNG /* No random number generator */ +# undef KINETIS_NMMCAU /* No hardware encryption */ +# undef KINETIS_NTAMPER /* No tamper detect */ +# define KINETIS_NCRC 1 /* CRC */ + +#elif defined(CONFIG_ARCH_CHIP_MK60N512VLQ100) +# undef KINETIS_K40 /* Not Kinetics K40 family */ +# define KINETIS_K60 1 /* Kinetis K60 family */ +# define KINETIS_FLASH_SIZE (512*1024) /* 512Kb */ +# undef KINETIS_FLEXNVM_SIZE /* No FlexNVM */ +# undef KINETIS_FLEXRAM_SIZE /* No FlexRAM */ +# define KINETIS_SRAM_SIZE (128*1024) /* 128Kb */ +# define KINETIS_MPU 1 /* Memory protection unit */ +# define KINETIS_EXTBUS 1 /* External bus interface */ +# define KINETIS_NDMACH 16 /* Up to 16 DMA channels */ +# define KINETIS_NENET 1 /* One IEEE 1588 Ethernet controller */ +# define KINETIS_NUSBHOST 1 /* One USB host controller */ +# define KINETIS_NUSBOTG 1 /* With USB OTG controller */ +# define KINETIS_NUSBDEV 1 /* One USB device controller */ +# define KINETIS_NSDHC 1 /* SD host controller */ +# define KINETIS_NTOUCHIF 1 /* Xtrinsic touch sensing interface */ +# define KINETIS_NI2C 3 /* Three I2C modules */ +# define KINETIS_NISO7816 1 /* One UART with ISO-786 */ +# define KINETIS_NUART 5 /* Five additional UARTs */ +# define KINETIS_NSPI 3 /* Three SPI modules */ +# define KINETIS_NCAN 2 /* Two CAN controllers */ +# define KINETIS_NI2S 2 /* Two I2S modules */ +# define KINETIS_NSLCD 1 /* One segment LCD interface (up to 36x8/40x4) */ +# define KINETIS_NADC16 4 /* Four 16-bit ADC */ +# undef KINETIS_NADC12 /* No 12-channel ADC */ +# undef KINETIS_NADC13 /* No 13-channel ADC */ +# define KINETIS_NADC15 1 /* One 15-channel ADC (ADC0) */ +# define KINETIS_NADC18 1 /* One 18-channel ADC (ADC1) */ +# define KINETIS_NPGA 4 /* Four Programmable Gain Amplifiers */ +# define KINETIS_NCMP 3 /* Three analog comparators */ +# undef KINETIS_NDAC6 /* No 6-bit DAC */ +# define KINETIS_NDAC12 2 /* Twp 12-bit DACs */ +# define KINETIS_NVREF 1 /* Voltage reference */ +# undef KINETIS_NTIMERS12 /* No 12 channel timers */ +# define KINETIS_NTIMERS20 4 /* Four 20 channel timers */ +# define KINETIS_NTIMERS12 3 /* Three 12 channel timers */ +# undef KINETIS_NTIMERS20 /* No 20 channel timers */ +# define KINETIS_NRTC 1 /* Real time clock */ +# undef KINETIS_NRNG /* No random number generator */ +# undef KINETIS_NMMCAU /* No hardware encryption */ +# undef KINETIS_NTAMPER /* No tamper detect */ +# define KINETIS_NCRC 1 /* CRC */ + +#elif defined(CONFIG_ARCH_CHIP_MK60N256VMD100) +# undef KINETIS_K40 /* Not Kinetics K40 family */ +# define KINETIS_K60 1 /* Kinetis K60 family */ +# define KINETIS_FLASH_SIZE (256*1024) /* 256Kb */ +# undef KINETIS_FLEXNVM_SIZE /* No FlexNVM */ +# undef KINETIS_FLEXRAM_SIZE /* No FlexRAM */ +# define KINETIS_SRAM_SIZE (64*1024) /* 64Kb */ +# define KINETIS_MPU 1 /* Memory protection unit */ +# define KINETIS_EXTBUS 1 /* External bus interface */ +# define KINETIS_NDMACH 16 /* Up to 16 DMA channels */ +# define KINETIS_NENET 1 /* One IEEE 1588 Ethernet controller */ +# define KINETIS_NUSBHOST 1 /* One USB host controller */ +# define KINETIS_NUSBOTG 1 /* With USB OTG controller */ +# define KINETIS_NUSBDEV 1 /* One USB device controller */ +# define KINETIS_NSDHC 1 /* SD host controller */ +# define KINETIS_NTOUCHIF 1 /* Xtrinsic touch sensing interface */ +# define KINETIS_NI2C 3 /* Three I2C modules */ +# define KINETIS_NISO7816 1 /* One UART with ISO-786 */ +# define KINETIS_NUART 5 /* Five additional UARTs */ +# define KINETIS_NSPI 3 /* Three SPI modules */ +# define KINETIS_NCAN 2 /* Two CAN controllers */ +# define KINETIS_NI2S 2 /* Two I2S modules */ +# define KINETIS_NSLCD 1 /* One segment LCD interface (up to 36x8/40x4) */ +# define KINETIS_NADC16 4 /* Four 16-bit ADC */ +# undef KINETIS_NADC12 /* No 12-channel ADC */ +# undef KINETIS_NADC13 /* No 13-channel ADC */ +# define KINETIS_NADC15 1 /* One 15-channel ADC (ADC0) */ +# define KINETIS_NADC18 1 /* One 18-channel ADC (ADC1) */ +# define KINETIS_NPGA 4 /* Four Programmable Gain Amplifiers */ +# define KINETIS_NCMP 3 /* Three analog comparators */ +# undef KINETIS_NDAC6 /* No 6-bit DAC */ +# define KINETIS_NDAC12 2 /* Twp 12-bit DACs */ +# define KINETIS_NVREF 1 /* Voltage reference */ +# undef KINETIS_NTIMERS12 /* No 12 channel timers */ +# define KINETIS_NTIMERS20 4 /* Four 20 channel timers */ +# define KINETIS_NTIMERS12 3 /* Three 12 channel timers */ +# undef KINETIS_NTIMERS20 /* No 20 channel timers */ +# define KINETIS_NRTC 1 /* Real time clock */ +# undef KINETIS_NRNG /* No random number generator */ +# undef KINETIS_NMMCAU /* No hardware encryption */ +# undef KINETIS_NTAMPER /* No tamper detect */ +# define KINETIS_NCRC 1 /* CRC */ + +#elif defined(CONFIG_ARCH_CHIP_MK60X256VMD100) +# undef KINETIS_K40 /* Not Kinetics K40 family */ +# define KINETIS_K60 1 /* Kinetis K60 family */ +# define KINETIS_FLASH_SIZE (256*1024) /* 256Kb */ +# define KINETIS_FLEXNVM_SIZE (256*1024) /* 256Kb */ +# define KINETIS_FLEXRAM_SIZE (4*1024) /* 4Kb */ +# define KINETIS_SRAM_SIZE (64*1024) /* 64Kb */ +# define KINETIS_MPU 1 /* Memory protection unit */ +# define KINETIS_EXTBUS 1 /* External bus interface */ +# define KINETIS_NDMACH 16 /* Up to 16 DMA channels */ +# define KINETIS_NENET 1 /* One IEEE 1588 Ethernet controller */ +# define KINETIS_NUSBHOST 1 /* One USB host controller */ +# define KINETIS_NUSBOTG 1 /* With USB OTG controller */ +# define KINETIS_NUSBDEV 1 /* One USB device controller */ +# define KINETIS_NSDHC 1 /* SD host controller */ +# define KINETIS_NTOUCHIF 1 /* Xtrinsic touch sensing interface */ +# define KINETIS_NI2C 3 /* Three I2C modules */ +# define KINETIS_NISO7816 1 /* One UART with ISO-786 */ +# define KINETIS_NUART 5 /* Five additional UARTs */ +# define KINETIS_NSPI 3 /* Three SPI modules */ +# define KINETIS_NCAN 2 /* Two CAN controllers */ +# define KINETIS_NI2S 2 /* Two I2S modules */ +# define KINETIS_NSLCD 1 /* One segment LCD interface (up to 36x8/40x4) */ +# define KINETIS_NADC16 4 /* Four 16-bit ADC */ +# undef KINETIS_NADC12 /* No 12-channel ADC */ +# undef KINETIS_NADC13 /* No 13-channel ADC */ +# define KINETIS_NADC15 1 /* One 15-channel ADC (ADC0) */ +# define KINETIS_NADC18 1 /* One 18-channel ADC (ADC1) */ +# define KINETIS_NPGA 4 /* Four Programmable Gain Amplifiers */ +# define KINETIS_NCMP 3 /* Three analog comparators */ +# undef KINETIS_NDAC6 /* No 6-bit DAC */ +# define KINETIS_NDAC12 2 /* Twp 12-bit DACs */ +# define KINETIS_NVREF 1 /* Voltage reference */ +# undef KINETIS_NTIMERS12 /* No 12 channel timers */ +# define KINETIS_NTIMERS20 4 /* Four 20 channel timers */ +# define KINETIS_NTIMERS12 3 /* Three 12 channel timers */ +# undef KINETIS_NTIMERS20 /* No 20 channel timers */ +# define KINETIS_NRTC 1 /* Real time clock */ +# undef KINETIS_NRNG /* No random number generator */ +# undef KINETIS_NMMCAU /* No hardware encryption */ +# undef KINETIS_NTAMPER /* No tamper detect */ +# define KINETIS_NCRC 1 /* CRC */ + +#elif defined(CONFIG_ARCH_CHIP_MK60N512VMD100) +# undef KINETIS_K40 /* Not Kinetics K40 family */ +# define KINETIS_K60 1 /* Kinetis K60 family */ +# define KINETIS_FLASH_SIZE (512*1024) /* 512Kb */ +# undef KINETIS_FLEXNVM_SIZE /* No FlexNVM */ +# undef KINETIS_FLEXRAM_SIZE /* No FlexRAM */ +# define KINETIS_SRAM_SIZE (128*1024) /* 128Kb */ +# define KINETIS_MPU 1 /* Memory protection unit */ +# define KINETIS_EXTBUS 1 /* External bus interface */ +# define KINETIS_NDMACH 16 /* Up to 16 DMA channels */ +# define KINETIS_NENET 1 /* One IEEE 1588 Ethernet controller */ +# define KINETIS_NUSBHOST 1 /* One USB host controller */ +# define KINETIS_NUSBOTG 1 /* With USB OTG controller */ +# define KINETIS_NUSBDEV 1 /* One USB device controller */ +# define KINETIS_NSDHC 1 /* SD host controller */ +# define KINETIS_NTOUCHIF 1 /* Xtrinsic touch sensing interface */ +# define KINETIS_NI2C 3 /* Three I2C modules */ +# define KINETIS_NISO7816 1 /* One UART with ISO-786 */ +# define KINETIS_NUART 5 /* Five additional UARTs */ +# define KINETIS_NSPI 3 /* Three SPI modules */ +# define KINETIS_NCAN 2 /* Two CAN controllers */ +# define KINETIS_NI2S 2 /* Two I2S modules */ +# define KINETIS_NSLCD 1 /* One segment LCD interface (up to 36x8/40x4) */ +# define KINETIS_NADC16 4 /* Four 16-bit ADC */ +# undef KINETIS_NADC12 /* No 12-channel ADC */ +# undef KINETIS_NADC13 /* No 13-channel ADC */ +# define KINETIS_NADC15 1 /* One 15-channel ADC (ADC0) */ +# define KINETIS_NADC18 1 /* One 18-channel ADC (ADC1) */ +# define KINETIS_NPGA 4 /* Four Programmable Gain Amplifiers */ +# define KINETIS_NCMP 3 /* Three analog comparators */ +# undef KINETIS_NDAC6 /* No 6-bit DAC */ +# define KINETIS_NDAC12 2 /* Twp 12-bit DACs */ +# define KINETIS_NVREF 1 /* Voltage reference */ +# undef KINETIS_NTIMERS12 /* No 12 channel timers */ +# define KINETIS_NTIMERS20 4 /* Four 20 channel timers */ +# define KINETIS_NTIMERS12 3 /* Three 12 channel timers */ +# undef KINETIS_NTIMERS20 /* No 20 channel timers */ +# define KINETIS_NRTC 1 /* Real time clock */ +# undef KINETIS_NRNG /* No random number generator */ +# undef KINETIS_NMMCAU /* No hardware encryption */ +# undef KINETIS_NTAMPER /* No tamper detect */ +# define KINETIS_NCRC 1 /* CRC */ + +#else +# error "Unsupported Kinetis chip" +#endif + +/* NVIC priority levels *************************************************************/ +/* Each priority field holds a priority value, 0-15. The lower the value, the greater + * the priority of the corresponding interrupt. The processor implements only + * bits[7:4] of each field, bits[3:0] read as zero and ignore writes. + */ + +#define NVIC_SYSH_PRIORITY_MIN 0xf0 /* All bits[7:4] set is minimum priority */ +#define NVIC_SYSH_PRIORITY_DEFAULT 0x80 /* Midpoint is the default */ +#define NVIC_SYSH_PRIORITY_MAX 0x00 /* Zero is maximum priority */ +#define NVIC_SYSH_PRIORITY_STEP 0x10 /* Steps between supported priority values */ + +#define NVIC_SYSH_DISABLE_PRIORITY (NVIC_SYSH_PRIORITY_MAX + NVIC_SYSH_PRIORITY_STEP) +#define NVIC_SYSH_SVCALL_PRIORITY NVIC_SYSH_PRIORITY_MAX + +/************************************************************************************ + * Public Types + ************************************************************************************/ + +/************************************************************************************ + * Public Data + ************************************************************************************/ + +/************************************************************************************ + * Public Functions + ************************************************************************************/ + +#endif /* __ARCH_ARM_INCLUDE_KINETIS_CHIP_H */ diff --git a/nuttx/arch/arm/include/lm/chip.h b/nuttx/arch/arm/include/lm/chip.h index 8293c79380..6b49fe2ced 100644 --- a/nuttx/arch/arm/include/lm/chip.h +++ b/nuttx/arch/arm/include/lm/chip.h @@ -108,6 +108,20 @@ # error "Capabilities not specified for this Stellaris chip" #endif +/* The LM3S69xx only supports 8 priority levels. The hardware priority mechanism + * will only look at the upper N bits of the 8-bit priority level (where N is 3 for + * the Stellaris family), so any prioritization must be performed in those bits. + * The default priority level is set to the middle value + */ + +#define NVIC_SYSH_PRIORITY_MIN 0xe0 /* Bits [5:7] set in minimum priority */ +#define NVIC_SYSH_PRIORITY_DEFAULT 0x80 /* Midpoint is the default */ +#define NVIC_SYSH_PRIORITY_MAX 0x00 /* Zero is maximum priority */ +#define NVIC_SYSH_PRIORITY_STEP 0x20 /* Three bits of interrupt priority used */ + +#define NVIC_SYSH_DISABLE_PRIORITY (NVIC_SYSH_PRIORITY_MAX + NVIC_SYSH_PRIORITY_STEP) +#define NVIC_SYSH_SVCALL_PRIORITY NVIC_SYSH_PRIORITY_MAX + /************************************************************************************ * Public Types ************************************************************************************/ diff --git a/nuttx/arch/arm/include/lm/irq.h b/nuttx/arch/arm/include/lm/irq.h index 3b984a8262..4f72e98248 100644 --- a/nuttx/arch/arm/include/lm/irq.h +++ b/nuttx/arch/arm/include/lm/irq.h @@ -43,6 +43,26 @@ #include #include +/************************************************************************************ + * Pre-processor Definitions + ************************************************************************************/ + +/* Processor Exceptions (vectors 0-15) */ + +#define LM_IRQ_RESERVED (0) /* Reserved vector (only used with CONFIG_DEBUG) */ + /* Vector 0: Reset stack pointer value */ + /* Vector 1: Reset (not handler as an IRQ) */ +#define LM_IRQ_NMI (2) /* Vector 2: Non-Maskable Interrupt (NMI) */ +#define LM_IRQ_HARDFAULT (3) /* Vector 3: Hard fault */ +#define LM_IRQ_MEMFAULT (4) /* Vector 4: Memory management (MPU) */ +#define LM_IRQ_BUSFAULT (5) /* Vector 5: Bus fault */ +#define LM_IRQ_USAGEFAULT (6) /* Vector 6: Usage fault */ +#define LM_IRQ_SVCALL (11) /* Vector 11: SVC call */ +#define LM_IRQ_DBGMONITOR (12) /* Vector 12: Debug Monitor */ + /* Vector 13: Reserved */ +#define LM_IRQ_PENDSV (14) /* Vector 14: Pendable system service request */ +#define LM_IRQ_SYSTICK (15) /* Vector 15: System tick */ + #if defined(CONFIG_ARCH_CHIP_LM3S) # include #elif defined(CONFIG_ARCH_CHIP_LM4F) @@ -51,10 +71,6 @@ # error "Unsupported Stellaris IRQ file" #endif -/************************************************************************************ - * Pre-processor Definitions - ************************************************************************************/ - /* GPIO IRQs -- Note that support for individual GPIO ports can * be disabled in order to reduce the size of the implemenation. */ diff --git a/nuttx/arch/arm/include/lm/lm3s_irq.h b/nuttx/arch/arm/include/lm/lm3s_irq.h index a9d0640d99..e9cfe8bdc1 100644 --- a/nuttx/arch/arm/include/lm/lm3s_irq.h +++ b/nuttx/arch/arm/include/lm/lm3s_irq.h @@ -51,22 +51,6 @@ * to handle mapping tables. */ -/* Processor Exceptions (vectors 0-15) */ - -#define LM_IRQ_RESERVED (0) /* Reserved vector (only used with CONFIG_DEBUG) */ - /* Vector 0: Reset stack pointer value */ - /* Vector 1: Reset (not handler as an IRQ) */ -#define LM_IRQ_NMI (2) /* Vector 2: Non-Maskable Interrupt (NMI) */ -#define LM_IRQ_HARDFAULT (3) /* Vector 3: Hard fault */ -#define LM_IRQ_MEMFAULT (4) /* Vector 4: Memory management (MPU) */ -#define LM_IRQ_BUSFAULT (5) /* Vector 5: Bus fault */ -#define LM_IRQ_USAGEFAULT (6) /* Vector 6: Usage fault */ -#define LM_IRQ_SVCALL (11) /* Vector 11: SVC call */ -#define LM_IRQ_DBGMONITOR (12) /* Vector 12: Debug Monitor */ - /* Vector 13: Reserved */ -#define LM_IRQ_PENDSV (14) /* Vector 14: Pendable system service request */ -#define LM_IRQ_SYSTICK (15) /* Vector 15: System tick */ - /* External interrupts (vectors >= 16) */ #define LM_IRQ_INTERRUPTS (16) /* Vector number of the first external interrupt */ diff --git a/nuttx/arch/arm/include/lpc17xx/chip.h b/nuttx/arch/arm/include/lpc17xx/chip.h index d2c436d357..c22c6aa609 100644 --- a/nuttx/arch/arm/include/lpc17xx/chip.h +++ b/nuttx/arch/arm/include/lpc17xx/chip.h @@ -362,6 +362,20 @@ # error "Unsupported LPC17xx chip" #endif +/* NVIC priority levels *************************************************************/ +/* Each priority field holds a priority value, 0-31. The lower the value, the greater + * the priority of the corresponding interrupt. The processor implements only + * bits[7:3] of each field, bits[2:0] read as zero and ignore writes. + */ + +#define NVIC_SYSH_PRIORITY_MIN 0xf8 /* All bits[7:3] set is minimum priority */ +#define NVIC_SYSH_PRIORITY_DEFAULT 0x80 /* Midpoint is the default */ +#define NVIC_SYSH_PRIORITY_MAX 0x00 /* Zero is maximum priority */ +#define NVIC_SYSH_PRIORITY_STEP 0x08 /* Five bits of interrupt priority used */ + +#define NVIC_SYSH_DISABLE_PRIORITY (NVIC_SYSH_PRIORITY_MAX + NVIC_SYSH_PRIORITY_STEP) +#define NVIC_SYSH_SVCALL_PRIORITY NVIC_SYSH_PRIORITY_MAX + /************************************************************************************ * Public Types ************************************************************************************/ diff --git a/nuttx/arch/arm/include/lpc43xx/chip.h b/nuttx/arch/arm/include/lpc43xx/chip.h index 220ce38d0d..7ff787e489 100644 --- a/nuttx/arch/arm/include/lpc43xx/chip.h +++ b/nuttx/arch/arm/include/lpc43xx/chip.h @@ -1,7 +1,7 @@ /************************************************************************************ * arch/arm/include/lpc43xx/chip.h * - * Copyright (C) 2012 Gregory Nutt. All rights reserved. + * Copyright (C) 2012-2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -542,6 +542,35 @@ # error "Unsupported LPC43xx chip" #endif +/* NVIC priority levels *************************************************************/ +/* Each priority field holds a priority value, 0-31. The lower the value, the greater + * the priority of the corresponding interrupt. + * + * The Cortex-M4 core supports up to 53 interrupts an 8 prgrammable interrupt + * priority levels; The Cortex-M0 core supports up to 32 interrupts with 4 + * programmable interrupt priorities. + */ + +#define LPC43M4_SYSH_PRIORITY_MIN 0xe0 /* All bits[7:5] set is minimum priority */ +#define LPC43M4_SYSH_PRIORITY_DEFAULT 0x80 /* Midpoint is the default */ +#define LPC43M4_SYSH_PRIORITY_MAX 0x00 /* Zero is maximum priority */ +#define LPC43M4_SYSH_PRIORITY_STEP 0x10 /* Steps between priorities */ + +#define LPC43M0_SYSH_PRIORITY_MIN 0xc0 /* All bits[7:6] set is minimum priority */ +#define LPC43M0_SYSH_PRIORITY_DEFAULT 0x80 /* Midpoint is the default */ +#define LPC43M0_SYSH_PRIORITY_MAX 0x00 /* Zero is maximum priority */ +#define LPC43M0_SYSH_PRIORITY_STEP 0x20 /* Steps between priorities */ + +/* Only the Cortex-M4 is supported by Nuttx */ + +#define NVIC_SYSH_PRIORITY_MIN LPC43M4_SYSH_PRIORITY_MIN +#define NVIC_SYSH_PRIORITY_DEFAULT LPC43M4_SYSH_PRIORITY_DEFAULT +#define NVIC_SYSH_PRIORITY_MAX LPC43M4_SYSH_PRIORITY_MAX +#define NVIC_SYSH_PRIORITY_STEP LPC43M4_SYSH_PRIORITY_INCR + +#define NVIC_SYSH_DISABLE_PRIORITY (NVIC_SYSH_PRIORITY_MAX + NVIC_SYSH_PRIORITY_STEP) +#define NVIC_SYSH_SVCALL_PRIORITY NVIC_SYSH_PRIORITY_MAX + /************************************************************************************ * Public Types ************************************************************************************/ diff --git a/nuttx/arch/arm/include/sam3u/chip.h b/nuttx/arch/arm/include/sam3u/chip.h new file mode 100644 index 0000000000..da8c283452 --- /dev/null +++ b/nuttx/arch/arm/include/sam3u/chip.h @@ -0,0 +1,95 @@ +/************************************************************************************ + * arch/arm/include/sam3u/chip.h + * + * Copyright (C) 2009-2010, 2013 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * 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. + * + ************************************************************************************/ + +#ifndef __ARCH_ARM_INCLUDE_SAM3U_CHIP_H +#define __ARCH_ARM_INCLUDE_SAM3U_CHIP_H + +/************************************************************************************ + * Included Files + ************************************************************************************/ + +#include + +/************************************************************************************ + * Pre-processor Definitions + ************************************************************************************/ + +/* Get customizations for each supported chip */ + +#ifdef CONFIG_ARCH_CHIP_AT91SAM3U4E +/* Internal memory */ + +# define CONFIG_SAM3U_SRAM0_SIZE 0x00008000 /* 32Kb */ +# define CONFIG_SAM3U_SRAM1_SIZE 0x00004000 /* 16Kb */ +# define CONFIG_SAM3U_NFCSRAM_SIZE 0x00001000 /* 4Kb */ + +/* DMA */ + +# define CONFIG_SAM3U_NDMACHAN 4 /* 4 DMA Channels */ + +/* Memory card interface */ + +# define CONFIG_SAM3U_MCI2 1 +#else +# error "Unknown SAM3U chip type" +#endif + +/* NVIC priority levels *************************************************************/ +/* Each priority field holds a priority value, 0-15. The lower the value, the greater + * the priority of the corresponding interrupt. The processor implements only + * bits[7:4] of each field, bits[3:0] read as zero and ignore writes. + */ + +#define NVIC_SYSH_PRIORITY_MIN 0xf0 /* All bits[7:4] set is minimum priority */ +#define NVIC_SYSH_PRIORITY_DEFAULT 0x80 /* Midpoint is the default */ +#define NVIC_SYSH_PRIORITY_MAX 0x00 /* Zero is maximum priority */ +#define NVIC_SYSH_PRIORITY_STEP 0x10 /* Four bits of interrupt priority used */ + +#define NVIC_SYSH_DISABLE_PRIORITY (NVIC_SYSH_PRIORITY_MAX + NVIC_SYSH_PRIORITY_STEP) +#define NVIC_SYSH_SVCALL_PRIORITY NVIC_SYSH_PRIORITY_MAX + +/************************************************************************************ + * Public Types + ************************************************************************************/ + +/************************************************************************************ + * Public Data + ************************************************************************************/ + +/************************************************************************************ + * Public Functions + ************************************************************************************/ + +#endif /* __ARCH_ARM_INCLUDE_SAM3U_CHIP_H */ diff --git a/nuttx/arch/arm/include/stm32/chip.h b/nuttx/arch/arm/include/stm32/chip.h index b7ec7dbba7..14d92ea3d9 100644 --- a/nuttx/arch/arm/include/stm32/chip.h +++ b/nuttx/arch/arm/include/stm32/chip.h @@ -692,5 +692,15 @@ # error "Unsupported STM32 chip" #endif +/* NVIC priority levels *************************************************************/ + +#define NVIC_SYSH_PRIORITY_MIN 0xf0 /* All bits set in minimum priority */ +#define NVIC_SYSH_PRIORITY_DEFAULT 0x80 /* Midpoint is the default */ +#define NVIC_SYSH_PRIORITY_MAX 0x00 /* Zero is maximum priority */ +#define NVIC_SYSH_PRIORITY_STEP 0x10 /* Four bits of interrupt priority used */ + +#define NVIC_SYSH_DISABLE_PRIORITY (NVIC_SYSH_PRIORITY_MAX + NVIC_SYSH_PRIORITY_STEP) +#define NVIC_SYSH_SVCALL_PRIORITY NVIC_SYSH_PRIORITY_MAX + #endif /* __ARCH_ARM_INCLUDE_STM32_CHIP_H */ diff --git a/nuttx/arch/arm/src/armv7-m/up_hardfault.c b/nuttx/arch/arm/src/armv7-m/up_hardfault.c index c30015ad22..b043db3df1 100644 --- a/nuttx/arch/arm/src/armv7-m/up_hardfault.c +++ b/nuttx/arch/arm/src/armv7-m/up_hardfault.c @@ -93,17 +93,16 @@ int up_hardfault(int irq, FAR void *context) { uint32_t *regs = (uint32_t*)context; - uint16_t *pc; - uint16_t insn; /* Get the value of the program counter where the fault occurred */ - pc = (uint16_t*)regs[REG_PC] - 1; +#ifndef CONFIG_ARMV7M_USEBASEPRI + uint16_t *pc = (uint16_t*)regs[REG_PC] - 1; if ((void*)pc >= (void*)&_stext && (void*)pc < (void*)&_etext) { /* Fetch the instruction that caused the Hard fault */ - insn = *pc; + uint16_t insn = *pc; hfdbg(" PC: %p INSN: %04x\n", pc, insn); /* If this was the instruction 'svc 0', then forward processing @@ -116,6 +115,7 @@ int up_hardfault(int irq, FAR void *context) return up_svcall(irq, context); } } +#endif /* Dump some hard fault info */ diff --git a/nuttx/arch/arm/src/kinetis/chip.h b/nuttx/arch/arm/src/kinetis/chip.h index 6ad781c208..0ed152bac2 100644 --- a/nuttx/arch/arm/src/kinetis/chip.h +++ b/nuttx/arch/arm/src/kinetis/chip.h @@ -42,802 +42,17 @@ #include +/* Include the memory map and the chip definitions file. Other chip hardware files + * should then include this file for the proper setup. + */ + +#include +#include "kinetis_memorymap.h" + /************************************************************************************ * Pre-processor Definitions ************************************************************************************/ -/* Get customizations for each supported chip */ - -#if defined(CONFIG_ARCH_CHIP_MK40X64VFX50) || defined(CONFIG_ARCH_CHIP_MK40X64VLH50) || \ - defined(CONFIG_ARCH_CHIP_MK40X64VLK50) || defined(CONFIG_ARCH_CHIP_MK40X64VMB50) -# define KINETIS_K40 1 /* Kinetics K40 family */ -# undef KINETIS_K60 /* Not Kinetis K60 family */ -# define KINETIS_FLASH_SIZE (64*1024) /* 64Kb */ -# define KINETIS_FLEXMEM_SIZE (32*1024) /* 32Kb */ -# define KINETIS_SRAM_SIZE (16*1024) /* 16Kb */ -# undef KINETIS_MPU /* No memory protection unit */ -# undef KINETIS_EXTBUS /* No external bus interface */ -# define KINETIS_NDMACH 16 /* Up to 16 DMA channels */ -# undef KINETIS_NENET /* No Ethernet controller */ -# define KINETIS_NUSBHOST 1 /* One USB host controller */ -# define KINETIS_NUSBOTG 1 /* With USB OTG controller */ -# define KINETIS_NUSBDEV 1 /* One USB device controller */ -# undef KINETIS_NSDHC /* No SD host controller */ -# undef KINETIS_NTOUCHIF /* Xtrinsic touch sensing interface */ -# define KINETIS_NI2C 2 /* Two I2C modules */ -# undef KINETIS_NISO7816 /* No UART with ISO-786 */ -# define KINETIS_NUART 6 /* Six UARTs */ -# define KINETIS_NSPI 3 /* Three SPI modules */ -# if defined(CONFIG_ARCH_CHIP_MK40X64VLK50) || defined(CONFIG_ARCH_CHIP_MK40X64VMB50) -# define KINETIS_NCAN 2 /* Two CAN controllers */ -# else -# undef KINETIS_NCAN /* No CAN in 64-pin chips */ -# endif -# define KINETIS_NI2S 1 /* One I2S module */ -# define KINETIS_NSLCD 1 /* One segment LCD interface (up to 25x8/29x4) */ -# define KINETIS_NADC16 4 /* Four 16-bit ADC */ -# undef KINETIS_NADC12 /* No 12-channel ADC */ -# undef KINETIS_NADC13 /* No 13-channel ADC */ -# undef KINETIS_NADC15 /* No 15-channel ADC */ -# undef KINETIS_NADC18 /* No 18-channel ADC */ -# define KINETIS_NPGA 2 /* Two Programmable Gain Amplifiers */ -# define KINETIS_NCMP 3 /* Three analog comparators */ -# define KINETIS_NDAC6 3 /* Three 6-bit DAC */ -# define KINETIS_NDAC12 2 /* Two 12-bit DAC */ -# define KINETIS_NVREF 1 /* Voltage reference */ -# define KINETIS_NTIMERS12 3 /* Three 12 channel timers */ -# undef KINETIS_NTIMERS20 /* No 20 channel timers */ -# undef KINETIS_NRNG /* No random number generator */ -# define KINETIS_NRTC 1 /* Real time clock */ -# undef KINETIS_NMMCAU /* No hardware encryption */ -# undef KINETIS_NTAMPER /* No tamper detect */ -# define KINETIS_NCRC 1 /* CRC */ - -#elif defined(CONFIG_ARCH_CHIP_MK40X128VFX50) || defined(CONFIG_ARCH_CHIP_MK40X128VLH50) || \ - defined(CONFIG_ARCH_CHIP_MK40X128VLK50) || defined(CONFIG_ARCH_CHIP_MK40X128VMB50) || \ - defined(CONFIG_ARCH_CHIP_MK40X128VLL50) || defined(CONFIG_ARCH_CHIP_MK40X128VML50) || \ - defined(CONFIG_ARCH_CHIP_MK40X128VFX72) || defined(CONFIG_ARCH_CHIP_MK40X128VLH72) || \ - defined(CONFIG_ARCH_CHIP_MK40X128VLK72) || defined(CONFIG_ARCH_CHIP_MK40X128VMB72) || \ - defined(CONFIG_ARCH_CHIP_MK40X128VLL72) || defined(CONFIG_ARCH_CHIP_MK40X128VML72) -# define KINETIS_K40 1 /* Kinetics K40 family */ -# undef KINETIS_K60 /* Not Kinetis K60 family */ -# define KINETIS_FLASH_SIZE (128*1024) /* 128Kb */ -# define KINETIS_FLEXMEM_SIZE (32*1024) /* 32Kb */ -# define KINETIS_SRAM_SIZE (32*1024) /* 32Kb */ -# undef KINETIS_MPU /* No memory protection unit */ -# undef KINETIS_EXTBUS /* No external bus interface */ -# define KINETIS_NDMACH 16 /* Up to 16 DMA channels */ -# undef KINETIS_NENET /* No Ethernet controller */ -# define KINETIS_NUSBHOST 1 /* One USB host controller */ -# define KINETIS_NUSBOTG 1 /* With USB OTG controller */ -# define KINETIS_NUSBDEV 1 /* One USB device controller */ -# undef KINETIS_NSDHC /* No SD host controller */ -# undef KINETIS_NTOUCHIF /* Xtrinsic touch sensing interface */ -# define KINETIS_NI2C 2 /* Two I2C modules */ -# undef KINETIS_NISO7816 /* No UART with ISO-786 */ -# define KINETIS_NUART 6 /* Six UARTs */ -# define KINETIS_NSPI 3 /* Three SPI modules */ -# define KINETIS_NCAN 2 /* Two CAN controllers */ -# define KINETIS_NI2S 1 /* One I2S module */ -# define KINETIS_NSLCD 1 /* One segment LCD interface (up to 36x8/40x4) */ -# define KINETIS_NADC16 4 /* Four 16-bit ADC */ -# undef KINETIS_NADC12 /* No 12-channel ADC */ -# undef KINETIS_NADC13 /* No 13-channel ADC */ -# undef KINETIS_NADC15 /* No 15-channel ADC */ -# undef KINETIS_NADC18 /* No 18-channel ADC */ -# define KINETIS_NPGA 2 /* Two Programmable Gain Amplifiers */ -# define KINETIS_NCMP 3 /* Three analog comparators */ -# define KINETIS_NDAC6 3 /* Three 6-bit DAC */ -# define KINETIS_NDAC12 2 /* Two 12-bit DAC */ -# define KINETIS_NVREF 1 /* Voltage reference */ -# define KINETIS_NTIMERS12 3 /* Three 12 channel timers */ -# undef KINETIS_NTIMERS20 /* No 20 channel timers */ -# define KINETIS_NRTC 1 /* Real time clock */ -# undef KINETIS_NRNG /* No random number generator */ -# undef KINETIS_NMMCAU /* No hardware encryption */ -# undef KINETIS_NTAMPER /* No tamper detect */ -# define KINETIS_NCRC 1 /* CRC */ - -#elif defined(CONFIG_ARCH_CHIP_MK40X256VLK72) || defined(CONFIG_ARCH_CHIP_MK40X256VMB72) || \ - defined(CONFIG_ARCH_CHIP_MK40X256VLL72) || defined(CONFIG_ARCH_CHIP_MK40X256VML72) -# define KINETIS_K40 1 /* Kinetics K40 family */ -# undef KINETIS_K60 /* Not Kinetis K60 family */ -# define KINETIS_FLASH_SIZE (256*1024) /* 256Kb */ -# define KINETIS_FLEXMEM_SIZE (32*1024) /* 32Kb */ -# define KINETIS_SRAM_SIZE (32*1024) /* 64Kb */ -# undef KINETIS_MPU /* No memory protection unit */ -# undef KINETIS_EXTBUS /* No external bus interface */ -# define KINETIS_NDMACH 16 /* Up to 16 DMA channels */ -# undef KINETIS_NENET /* No Ethernet controller */ -# define KINETIS_NUSBHOST 1 /* One USB host controller */ -# define KINETIS_NUSBOTG 1 /* With USB OTG controller */ -# define KINETIS_NUSBDEV 1 /* One USB device controller */ -# undef KINETIS_NSDHC /* No SD host controller */ -# undef KINETIS_NTOUCHIF /* Xtrinsic touch sensing interface */ -# define KINETIS_NI2C 2 /* Two I2C modules */ -# undef KINETIS_NISO7816 /* No UART with ISO-786 */ -# define KINETIS_NUART 6 /* Six UARTs */ -# define KINETIS_NSPI 3 /* Three SPI modules */ -# define KINETIS_NCAN 2 /* Two CAN controllers */ -# define KINETIS_NI2S 1 /* One I2S module */ -# define KINETIS_NSLCD 1 /* One segment LCD interface (up to 36x8/40x4) */ -# define KINETIS_NADC16 4 /* Four 16-bit ADC */ -# undef KINETIS_NADC12 /* No 12-channel ADC */ -# undef KINETIS_NADC13 /* No 13-channel ADC */ -# undef KINETIS_NADC15 /* No 15-channel ADC */ -# undef KINETIS_NADC18 /* No 18-channel ADC */ -# define KINETIS_NPGA 2 /* Two Programmable Gain Amplifiers */ -# define KINETIS_NCMP 3 /* Three analog comparators */ -# define KINETIS_NDAC6 3 /* Three 6-bit DAC */ -# define KINETIS_NDAC12 2 /* Two 12-bit DAC */ -# define KINETIS_NVREF 1 /* Voltage reference */ -# define KINETIS_NTIMERS12 3 /* Three 12 channel timers */ -# undef KINETIS_NTIMERS20 /* No 20 channel timers */ -# define KINETIS_NRTC 1 /* Real time clock */ -# undef KINETIS_NRNG /* No random number generator */ -# undef KINETIS_NMMCAU /* No hardware encryption */ -# undef KINETIS_NTAMPER /* No tamper detect */ -# define KINETIS_NCRC 1 /* CRC */ - -#elif defined(CONFIG_ARCH_CHIP_MK40X128VLQ100) || defined(CONFIG_ARCH_CHIP_MK40X128VMD100) -# define KINETIS_K40 1 /* Kinetics K40 family */ -# undef KINETIS_K60 /* Not Kinetis K60 family */ -# define KINETIS_FLASH_SIZE (128*1024) /* 128Kb */ -# define KINETIS_FLEXMEM_SIZE (128*1024) /* 128Kb */ -# define KINETIS_SRAM_SIZE (32*1024) /* 32Kb */ -# define KINETIS_MPU 1 /* Memory protection unit */ -# define KINETIS_EXTBUS 1 /* External bus interface */ -# define KINETIS_NDMACH 16 /* Up to 16 DMA channels */ -# undef KINETIS_NENET /* No Ethernet controller */ -# define KINETIS_NUSBHOST 1 /* One USB host controller */ -# define KINETIS_NUSBOTG 1 /* With USB OTG controller */ -# define KINETIS_NUSBDEV 1 /* One USB device controller */ -# define KINETIS_NSDHC 1 /* One SD host controller */ -# undef KINETIS_NTOUCHIF /* Xtrinsic touch sensing interface */ -# define KINETIS_NI2C 2 /* Two I2C modules */ -# undef KINETIS_NISO7816 /* No UART with ISO-786 */ -# define KINETIS_NUART 6 /* Six UARTs */ -# define KINETIS_NSPI 3 /* Three SPI modules */ -# define KINETIS_NCAN 2 /* Two CAN controllers */ -# define KINETIS_NI2S 1 /* One I2S module */ -# define KINETIS_NSLCD 1 /* One segment LCD interface (up to 40x8/44x4)*/ -# define KINETIS_NADC16 4 /* Four 16-bit ADC */ -# undef KINETIS_NADC12 /* No 12-channel ADC */ -# undef KINETIS_NADC13 /* No 13-channel ADC */ -# undef KINETIS_NADC15 /* No 15-channel ADC */ -# undef KINETIS_NADC18 /* No 18-channel ADC */ -# define KINETIS_NPGA 2 /* Two Programmable Gain Amplifiers */ -# define KINETIS_NCMP 3 /* Three analog comparators */ -# define KINETIS_NDAC6 3 /* Three 6-bit DAC */ -# define KINETIS_NDAC12 2 /* Two 12-bit DAC */ -# define KINETIS_NVREF 1 /* Voltage reference */ -# define KINETIS_NTIMERS12 3 /* Three 12 channel timers */ -# undef KINETIS_NTIMERS20 /* No 20 channel timers */ -# define KINETIS_NRTC 1 /* Real time clock */ -# undef KINETIS_NRNG /* No random number generator */ -# undef KINETIS_NMMCAU /* No hardware encryption */ -# undef KINETIS_NTAMPER /* No tamper detect */ -# define KINETIS_NCRC 1 /* CRC */ - -#elif defined(CONFIG_ARCH_CHIP_MK40X256VLQ100) || defined(CONFIG_ARCH_CHIP_MK40X256VMD100) -# define KINETIS_K40 1 /* Kinetics K40 family */ -# undef KINETIS_K60 /* Not Kinetis K60 family */ -# define KINETIS_FLASH_SIZE (256*1024) /* 256Kb */ -# define KINETIS_FLEXMEM_SIZE (256*1024) /* 256Kb */ -# define KINETIS_SRAM_SIZE (64*1024) /* 32Kb */ -# define KINETIS_MPU 1 /* Memory protection unit */ -# define KINETIS_EXTBUS 1 /* External bus interface */ -# define KINETIS_NDMACH 16 /* Up to 16 DMA channels */ -# undef KINETIS_NENET /* No Ethernet controller */ -# define KINETIS_NUSBHOST 1 /* One USB host controller */ -# define KINETIS_NUSBOTG 1 /* With USB OTG controller */ -# define KINETIS_NUSBDEV 1 /* One USB device controller */ -# define KINETIS_NSDHC 1 /* One SD host controller */ -# undef KINETIS_NTOUCHIF /* Xtrinsic touch sensing interface */ -# define KINETIS_NI2C 2 /* Two I2C modules */ -# undef KINETIS_NISO7816 /* No UART with ISO-786 */ -# define KINETIS_NUART 6 /* Six UARTs */ -# define KINETIS_NSPI 3 /* Three SPI modules */ -# define KINETIS_NCAN 2 /* Two CAN controllers */ -# define KINETIS_NI2S 1 /* One I2S module */ -# define KINETIS_NSLCD 1 /* One segment LCD interface (up to 40x8/44x4)*/ -# define KINETIS_NADC16 4 /* Four 16-bit ADC */ -# undef KINETIS_NADC12 /* No 12-channel ADC */ -# undef KINETIS_NADC13 /* No 13-channel ADC */ -# undef KINETIS_NADC15 /* No 15-channel ADC */ -# undef KINETIS_NADC18 /* No 18-channel ADC */ -# define KINETIS_NPGA 2 /* Two Programmable Gain Amplifiers */ -# define KINETIS_NCMP 3 /* Three analog comparators */ -# define KINETIS_NDAC6 3 /* Three 6-bit DAC */ -# define KINETIS_NDAC12 2 /* Two 12-bit DAC */ -# define KINETIS_NVREF 1 /* Voltage reference */ -# define KINETIS_NTIMERS12 3 /* Three 12 channel timers */ -# undef KINETIS_NTIMERS20 /* No 20 channel timers */ -# define KINETIS_NRTC 1 /* Real time clock */ -# undef KINETIS_NRNG /* No random number generator */ -# undef KINETIS_NMMCAU /* No hardware encryption */ -# undef KINETIS_NTAMPER /* No tamper detect */ -# define KINETIS_NCRC 1 /* CRC */ - -#elif defined(CONFIG_ARCH_CHIP_MK40N512VLK100) || defined(CONFIG_ARCH_CHIP_MK40N512VMB100) || \ - defined(CONFIG_ARCH_CHIP_MK40N512VLL100) || defined(CONFIG_ARCH_CHIP_MK40N512VML100) || \ - defined(CONFIG_ARCH_CHIP_MK40N512VLQ100) || defined(CONFIG_ARCH_CHIP_MK40N512VMD100) -# define KINETIS_K40 1 /* Kinetics K40 family */ -# undef KINETIS_K60 /* Not Kinetis K60 family */ -# define KINETIS_FLASH_SIZE (512*1024) /* 512Kb */ -# undef KINETIS_FLEXMEM_SIZE /* No FlexMemory */ -# define KINETIS_SRAM_SIZE (128*1024) /* 128Kb */ -# define KINETIS_MPU 1 /* Memory protection unit */ -# define KINETIS_EXTBUS 1 /* External bus interface */ -# define KINETIS_NDMACH 16 /* Up to 16 DMA channels */ -# undef KINETIS_NENET /* No Ethernet controller */ -# define KINETIS_NUSBHOST 1 /* One USB host controller */ -# define KINETIS_NUSBOTG 1 /* With USB OTG controller */ -# define KINETIS_NUSBDEV 1 /* One USB device controller */ -# define KINETIS_NSDHC 1 /* One SD host controller */ -# undef KINETIS_NTOUCHIF /* Xtrinsic touch sensing interface */ -# define KINETIS_NI2C 2 /* Two I2C modules */ -# undef KINETIS_NISO7816 /* No UART with ISO-786 */ -# define KINETIS_NUART 6 /* Six UARTs */ -# define KINETIS_NSPI 3 /* Three SPI modules */ -# define KINETIS_NCAN 2 /* Two CAN controllers */ -# define KINETIS_NI2S 1 /* One I2S module */ -# define KINETIS_NSLCD 1 /* One segment LCD interface (up to 40x8/44x4)*/ -# define KINETIS_NADC16 4 /* Four 16-bit ADC */ -# undef KINETIS_NADC12 /* No 12-channel ADC */ -# undef KINETIS_NADC13 /* No 13-channel ADC */ -# undef KINETIS_NADC15 /* No 15-channel ADC */ -# undef KINETIS_NADC18 /* No 18-channel ADC */ -# define KINETIS_NPGA 2 /* Two Programmable Gain Amplifiers */ -# define KINETIS_NCMP 3 /* Three analog comparators */ -# define KINETIS_NDAC6 3 /* Three 6-bit DAC */ -# define KINETIS_NDAC12 2 /* Two 12-bit DAC */ -# define KINETIS_NVREF 1 /* Voltage reference */ -# define KINETIS_NTIMERS12 3 /* Three 12 channel timers */ -# undef KINETIS_NTIMERS20 /* No 20 channel timers */ -# define KINETIS_NRTC 1 /* Real time clock */ -# undef KINETIS_NRNG /* No random number generator */ -# undef KINETIS_NMMCAU /* No hardware encryption */ -# undef KINETIS_NTAMPER /* No tamper detect */ -# define KINETIS_NCRC 1 /* CRC */ - -#elif defined(CONFIG_ARCH_CHIP_MK60N256VLL100) -# undef KINETIS_K40 /* Not Kinetics K40 family */ -# define KINETIS_K60 1 /* Kinetis K60 family */ -# define KINETIS_FLASH_SIZE (256*1024) /* 256Kb */ -# undef KINETIS_FLEXNVM_SIZE /* No FlexNVM */ -# undef KINETIS_FLEXRAM_SIZE /* No FlexRAM */ -# define KINETIS_SRAM_SIZE (64*1024) /* 64Kb */ -# define KINETIS_MPU 1 /* Memory protection unit */ -# define KINETIS_EXTBUS 1 /* External bus interface */ -# define KINETIS_NDMACH 16 /* Up to 16 DMA channels */ -# define KINETIS_NENET 1 /* One IEEE 1588 Ethernet controller */ -# define KINETIS_NUSBHOST 1 /* One USB host controller */ -# define KINETIS_NUSBOTG 1 /* With USB OTG controller */ -# define KINETIS_NUSBDEV 1 /* One USB device controller */ -# define KINETIS_NSDHC 1 /* SD host controller */ -# define KINETIS_NTOUCHIF 1 /* Xtrinsic touch sensing interface */ -# define KINETIS_NI2C 3 /* Three I2C modules */ -# define KINETIS_NISO7816 1 /* One UART with ISO-786 */ -# define KINETIS_NUART 4 /* Four additional UARTs */ -# define KINETIS_NSPI 3 /* Three SPI modules */ -# define KINETIS_NCAN 2 /* Two CAN controllers */ -# define KINETIS_NI2S 2 /* Two I2S modules */ -# define KINETIS_NSLCD 1 /* One segment LCD interface (up to 36x8/40x4) */ -# define KINETIS_NADC16 4 /* Four 16-bit ADC */ -# define KINETIS_NADC12 1 /* One 12-channel ADC (ADC0)*/ -# define KINETIS_NADC13 1 /* No 13-channel ADC (ADC1) */ -# undef KINETIS_NADC15 /* No 15-channel ADC */ -# undef KINETIS_NADC18 /* No 18-channel ADC */ -# define KINETIS_NPGA 4 /* Four Programmable Gain Amplifiers */ -# define KINETIS_NCMP 3 /* Three analog comparators */ -# undef KINETIS_NDAC6 /* No 6-bit DAC */ -# define KINETIS_NDAC12 1 /* One 12-bit DAC */ -# define KINETIS_NVREF 1 /* Voltage reference */ -# undef KINETIS_NTIMERS12 /* No 12 channel timers */ -# define KINETIS_NTIMERS20 4 /* Four 20 channel timers */ -# define KINETIS_NTIMERS12 3 /* Three 12 channel timers */ -# undef KINETIS_NTIMERS20 /* No 20 channel timers */ -# define KINETIS_NRTC 1 /* Real time clock */ -# undef KINETIS_NRNG /* No random number generator */ -# undef KINETIS_NMMCAU /* No hardware encryption */ -# undef KINETIS_NTAMPER /* No tamper detect */ -# define KINETIS_NCRC 1 /* CRC */ - -#elif defined(CONFIG_ARCH_CHIP_MK60X256VLL100) -# undef KINETIS_K40 /* Not Kinetics K40 family */ -# define KINETIS_K60 1 /* Kinetis K60 family */ -# define KINETIS_FLASH_SIZE (256*1024) /* 256Kb */ -# define KINETIS_FLEXNVM_SIZE (256*1024) /* 256Kb */ -# define KINETIS_FLEXRAM_SIZE (4*1024) /* 32Kb */ -# define KINETIS_SRAM_SIZE (64*1024) /* 64Kb */ -# define KINETIS_MPU 1 /* Memory protection unit */ -# define KINETIS_EXTBUS 1 /* External bus interface */ -# define KINETIS_NDMACH 16 /* Up to 16 DMA channels */ -# define KINETIS_NENET 1 /* One IEEE 1588 Ethernet controller */ -# define KINETIS_NUSBHOST 1 /* One USB host controller */ -# define KINETIS_NUSBOTG 1 /* With USB OTG controller */ -# define KINETIS_NUSBDEV 1 /* One USB device controller */ -# define KINETIS_NSDHC 1 /* SD host controller */ -# define KINETIS_NTOUCHIF 1 /* Xtrinsic touch sensing interface */ -# define KINETIS_NI2C 3 /* Three I2C modules */ -# define KINETIS_NISO7816 1 /* One UART with ISO-786 */ -# define KINETIS_NUART 4 /* Four additional UARTs */ -# define KINETIS_NSPI 3 /* Three SPI modules */ -# define KINETIS_NCAN 2 /* Two CAN controllers */ -# define KINETIS_NI2S 2 /* Two I2S modules */ -# define KINETIS_NSLCD 1 /* One segment LCD interface (up to 36x8/40x4) */ -# define KINETIS_NADC16 4 /* Four 16-bit ADC */ -# define KINETIS_NADC12 1 /* One 12-channel ADC (ADC0)*/ -# define KINETIS_NADC13 1 /* No 13-channel ADC (ADC1) */ -# undef KINETIS_NADC15 /* No 15-channel ADC */ -# undef KINETIS_NADC18 /* No 18-channel ADC */ -# define KINETIS_NPGA 4 /* Four Programmable Gain Amplifiers */ -# define KINETIS_NCMP 3 /* Three analog comparators */ -# undef KINETIS_NDAC6 /* No 6-bit DAC */ -# define KINETIS_NDAC12 1 /* One 12-bit DAC */ -# define KINETIS_NVREF 1 /* Voltage reference */ -# undef KINETIS_NTIMERS12 /* No 12 channel timers */ -# define KINETIS_NTIMERS20 4 /* Four 20 channel timers */ -# define KINETIS_NTIMERS12 3 /* Three 12 channel timers */ -# undef KINETIS_NTIMERS20 /* No 20 channel timers */ -# define KINETIS_NRTC 1 /* Real time clock */ -# undef KINETIS_NRNG /* No random number generator */ -# undef KINETIS_NMMCAU /* No hardware encryption */ -# undef KINETIS_NTAMPER /* No tamper detect */ -# define KINETIS_NCRC 1 /* CRC */ - -#elif defined(CONFIG_ARCH_CHIP_MK60N512VLL100) -# undef KINETIS_K40 /* Not Kinetics K40 family */ -# define KINETIS_K60 1 /* Kinetis K60 family */ -# define KINETIS_FLASH_SIZE (512*1024) /* 256Kb */ -# undef KINETIS_FLEXNVM_SIZE /* No FlexNVM */ -# undef KINETIS_FLEXRAM_SIZE /* No FlexRAM */ -# define KINETIS_SRAM_SIZE (128*1024) /* 128Kb */ -# define KINETIS_MPU 1 /* Memory protection unit */ -# define KINETIS_EXTBUS 1 /* External bus interface */ -# define KINETIS_NDMACH 16 /* Up to 16 DMA channels */ -# define KINETIS_NENET 1 /* One IEEE 1588 Ethernet controller */ -# define KINETIS_NUSBHOST 1 /* One USB host controller */ -# define KINETIS_NUSBOTG 1 /* With USB OTG controller */ -# define KINETIS_NUSBDEV 1 /* One USB device controller */ -# define KINETIS_NSDHC 1 /* SD host controller */ -# define KINETIS_NTOUCHIF 1 /* Xtrinsic touch sensing interface */ -# define KINETIS_NI2C 3 /* Three I2C modules */ -# define KINETIS_NISO7816 1 /* One UART with ISO-786 */ -# define KINETIS_NUART 4 /* Four additional UARTs */ -# define KINETIS_NSPI 3 /* Three SPI modules */ -# define KINETIS_NCAN 2 /* Two CAN controllers */ -# define KINETIS_NI2S 2 /* Two I2S modules */ -# define KINETIS_NSLCD 1 /* One segment LCD interface (up to 36x8/40x4) */ -# define KINETIS_NADC16 4 /* Four 16-bit ADC */ -# define KINETIS_NADC12 1 /* One 12-channel ADC (ADC0)*/ -# define KINETIS_NADC13 1 /* No 13-channel ADC (ADC1) */ -# undef KINETIS_NADC15 /* No 15-channel ADC */ -# undef KINETIS_NADC18 /* No 18-channel ADC */ -# define KINETIS_NPGA 4 /* Four Programmable Gain Amplifiers */ -# define KINETIS_NCMP 3 /* Three analog comparators */ -# undef KINETIS_NDAC6 /* No 6-bit DAC */ -# define KINETIS_NDAC12 1 /* One 12-bit DAC */ -# define KINETIS_NVREF 1 /* Voltage reference */ -# undef KINETIS_NTIMERS12 /* No 12 channel timers */ -# define KINETIS_NTIMERS20 4 /* Four 20 channel timers */ -# define KINETIS_NTIMERS12 3 /* Three 12 channel timers */ -# undef KINETIS_NTIMERS20 /* No 20 channel timers */ -# define KINETIS_NRTC 1 /* Real time clock */ -# undef KINETIS_NRNG /* No random number generator */ -# undef KINETIS_NMMCAU /* No hardware encryption */ -# undef KINETIS_NTAMPER /* No tamper detect */ -# define KINETIS_NCRC 1 /* CRC */ - -#elif defined(CONFIG_ARCH_CHIP_MK60N256VML100) -# undef KINETIS_K40 /* Not Kinetics K40 family */ -# define KINETIS_K60 1 /* Kinetis K60 family */ -# define KINETIS_FLASH_SIZE (256*1024) /* 256Kb */ -# undef KINETIS_FLEXNVM_SIZE /* No FlexNVM */ -# undef KINETIS_FLEXRAM_SIZE /* No FlexRAM */ -# define KINETIS_SRAM_SIZE (64*1024) /* 64Kb */ -# define KINETIS_MPU 1 /* Memory protection unit */ -# define KINETIS_EXTBUS 1 /* External bus interface */ -# define KINETIS_NDMACH 16 /* Up to 16 DMA channels */ -# define KINETIS_NENET 1 /* One IEEE 1588 Ethernet controller */ -# define KINETIS_NUSBHOST 1 /* One USB host controller */ -# define KINETIS_NUSBOTG 1 /* With USB OTG controller */ -# define KINETIS_NUSBDEV 1 /* One USB device controller */ -# define KINETIS_NSDHC 1 /* SD host controller */ -# define KINETIS_NTOUCHIF 1 /* Xtrinsic touch sensing interface */ -# define KINETIS_NI2C 3 /* Three I2C modules */ -# define KINETIS_NISO7816 1 /* One UART with ISO-786 */ -# define KINETIS_NUART 4 /* Four additional UARTs */ -# define KINETIS_NSPI 3 /* Three SPI modules */ -# define KINETIS_NCAN 2 /* Two CAN controllers */ -# define KINETIS_NI2S 2 /* Two I2S modules */ -# define KINETIS_NSLCD 1 /* One segment LCD interface (up to 36x8/40x4) */ -# define KINETIS_NADC16 4 /* Four 16-bit ADC */ -# define KINETIS_NADC12 1 /* One 12-channel ADC (ADC0)*/ -# undef KINETIS_NADC13 /* No 13-channel ADC */ -# define KINETIS_NADC15 1 /* One 15-channel ADC (ADC1) */ -# undef KINETIS_NADC18 /* No 18-channel ADC */ -# define KINETIS_NPGA 4 /* Four Programmable Gain Amplifiers */ -# define KINETIS_NCMP 3 /* Three analog comparators */ -# undef KINETIS_NDAC6 /* No 6-bit DAC */ -# define KINETIS_NDAC12 1 /* One 12-bit DAC */ -# define KINETIS_NVREF 1 /* Voltage reference */ -# undef KINETIS_NTIMERS12 /* No 12 channel timers */ -# define KINETIS_NTIMERS20 4 /* Four 20 channel timers */ -# define KINETIS_NTIMERS12 3 /* Three 12 channel timers */ -# undef KINETIS_NTIMERS20 /* No 20 channel timers */ -# define KINETIS_NRTC 1 /* Real time clock */ -# undef KINETIS_NRNG /* No random number generator */ -# undef KINETIS_NMMCAU /* No hardware encryption */ -# undef KINETIS_NTAMPER /* No tamper detect */ -# define KINETIS_NCRC 1 /* CRC */ - -#elif defined(CONFIG_ARCH_CHIP_MK60X256VML100) -# undef KINETIS_K40 /* Not Kinetics K40 family */ -# define KINETIS_K60 1 /* Kinetis K60 family */ -# define KINETIS_FLASH_SIZE (256*1024) /* 256Kb */ -# define KINETIS_FLEXNVM_SIZE (256*1024) /* 256Kb */ -# define KINETIS_FLEXRAM_SIZE (4*1024) /* 4Kb */ -# define KINETIS_SRAM_SIZE (64*1024) /* 64Kb */ -# define KINETIS_MPU 1 /* Memory protection unit */ -# define KINETIS_EXTBUS 1 /* External bus interface */ -# define KINETIS_NDMACH 16 /* Up to 16 DMA channels */ -# define KINETIS_NENET 1 /* One IEEE 1588 Ethernet controller */ -# define KINETIS_NUSBHOST 1 /* One USB host controller */ -# define KINETIS_NUSBOTG 1 /* With USB OTG controller */ -# define KINETIS_NUSBDEV 1 /* One USB device controller */ -# define KINETIS_NSDHC 1 /* SD host controller */ -# define KINETIS_NTOUCHIF 1 /* Xtrinsic touch sensing interface */ -# define KINETIS_NI2C 3 /* Three I2C modules */ -# define KINETIS_NISO7816 1 /* One UART with ISO-786 */ -# define KINETIS_NUART 4 /* Four additional UARTs */ -# define KINETIS_NSPI 3 /* Three SPI modules */ -# define KINETIS_NCAN 2 /* Two CAN controllers */ -# define KINETIS_NI2S 2 /* Two I2S modules */ -# define KINETIS_NSLCD 1 /* One segment LCD interface (up to 36x8/40x4) */ -# define KINETIS_NADC16 4 /* Four 16-bit ADC */ -# define KINETIS_NADC12 1 /* One 12-channel ADC (ADC0)*/ -# undef KINETIS_NADC13 /* No 13-channel ADC */ -# define KINETIS_NADC15 1 /* One 15-channel ADC (ADC1) */ -# undef KINETIS_NADC18 /* No 18-channel ADC */ -# define KINETIS_NPGA 4 /* Four Programmable Gain Amplifiers */ -# define KINETIS_NCMP 3 /* Three analog comparators */ -# undef KINETIS_NDAC6 /* No 6-bit DAC */ -# define KINETIS_NDAC12 1 /* One 12-bit DAC */ -# define KINETIS_NVREF 1 /* Voltage reference */ -# undef KINETIS_NTIMERS12 /* No 12 channel timers */ -# define KINETIS_NTIMERS20 4 /* Four 20 channel timers */ -# define KINETIS_NTIMERS12 3 /* Three 12 channel timers */ -# undef KINETIS_NTIMERS20 /* No 20 channel timers */ -# define KINETIS_NRTC 1 /* Real time clock */ -# undef KINETIS_NRNG /* No random number generator */ -# undef KINETIS_NMMCAU /* No hardware encryption */ -# undef KINETIS_NTAMPER /* No tamper detect */ -# define KINETIS_NCRC 1 /* CRC */ - -#elif defined(CONFIG_ARCH_CHIP_MK60N512VML100) -# undef KINETIS_K40 /* Not Kinetics K40 family */ -# define KINETIS_K60 1 /* Kinetis K60 family */ -# define KINETIS_FLASH_SIZE (512*1024) /* 256Kb */ -# undef KINETIS_FLEXNVM_SIZE /* No FlexNVM */ -# undef KINETIS_FLEXRAM_SIZE /* No FlexRAM */ -# define KINETIS_SRAM_SIZE (128*1024) /* 128Kb */ -# define KINETIS_MPU 1 /* Memory protection unit */ -# define KINETIS_EXTBUS 1 /* External bus interface */ -# define KINETIS_NDMACH 16 /* Up to 16 DMA channels */ -# define KINETIS_NENET 1 /* One IEEE 1588 Ethernet controller */ -# define KINETIS_NUSBHOST 1 /* One USB host controller */ -# define KINETIS_NUSBOTG 1 /* With USB OTG controller */ -# define KINETIS_NUSBDEV 1 /* One USB device controller */ -# define KINETIS_NSDHC 1 /* SD host controller */ -# define KINETIS_NTOUCHIF 1 /* Xtrinsic touch sensing interface */ -# define KINETIS_NI2C 3 /* Three I2C modules */ -# define KINETIS_NISO7816 1 /* One UART with ISO-786 */ -# define KINETIS_NUART 4 /* Four additional UARTs */ -# define KINETIS_NSPI 3 /* Three SPI modules */ -# define KINETIS_NCAN 2 /* Two CAN controllers */ -# define KINETIS_NI2S 2 /* Two I2S modules */ -# define KINETIS_NSLCD 1 /* One segment LCD interface (up to 36x8/40x4) */ -# define KINETIS_NADC16 4 /* Four 16-bit ADC */ -# define KINETIS_NADC12 1 /* One 12-channel ADC (ADC0)*/ -# undef KINETIS_NADC13 /* No 13-channel ADC */ -# define KINETIS_NADC15 1 /* One 15-channel ADC (ADC1) */ -# undef KINETIS_NADC18 /* No 18-channel ADC */ -# define KINETIS_NPGA 4 /* Four Programmable Gain Amplifiers */ -# define KINETIS_NCMP 3 /* Three analog comparators */ -# undef KINETIS_NDAC6 /* No 6-bit DAC */ -# define KINETIS_NDAC12 1 /* One 12-bit DAC */ -# define KINETIS_NVREF 1 /* Voltage reference */ -# undef KINETIS_NTIMERS12 /* No 12 channel timers */ -# define KINETIS_NTIMERS20 4 /* Four 20 channel timers */ -# define KINETIS_NTIMERS12 3 /* Three 12 channel timers */ -# undef KINETIS_NTIMERS20 /* No 20 channel timers */ -# define KINETIS_NRTC 1 /* Real time clock */ -# undef KINETIS_NRNG /* No random number generator */ -# undef KINETIS_NMMCAU /* No hardware encryption */ -# undef KINETIS_NTAMPER /* No tamper detect */ -# define KINETIS_NCRC 1 /* CRC */ - -#elif defined(CONFIG_ARCH_CHIP_MK60N256VLQ100) -# undef KINETIS_K40 /* Not Kinetics K40 family */ -# define KINETIS_K60 1 /* Kinetis K60 family */ -# define KINETIS_FLASH_SIZE (256*1024) /* 256Kb */ -# undef KINETIS_FLEXNVM_SIZE /* No FlexNVM */ -# undef KINETIS_FLEXRAM_SIZE /* No FlexRAM */ -# define KINETIS_SRAM_SIZE (64*1024) /* 64Kb */ -# define KINETIS_MPU 1 /* Memory protection unit */ -# define KINETIS_EXTBUS 1 /* External bus interface */ -# define KINETIS_NDMACH 16 /* Up to 16 DMA channels */ -# define KINETIS_NENET 1 /* One IEEE 1588 Ethernet controller */ -# define KINETIS_NUSBHOST 1 /* One USB host controller */ -# define KINETIS_NUSBOTG 1 /* With USB OTG controller */ -# define KINETIS_NUSBDEV 1 /* One USB device controller */ -# define KINETIS_NSDHC 1 /* SD host controller */ -# define KINETIS_NTOUCHIF 1 /* Xtrinsic touch sensing interface */ -# define KINETIS_NI2C 3 /* Three I2C modules */ -# define KINETIS_NISO7816 1 /* One UART with ISO-786 */ -# define KINETIS_NUART 5 /* Five additional UARTs */ -# define KINETIS_NSPI 3 /* Three SPI modules */ -# define KINETIS_NCAN 2 /* Two CAN controllers */ -# define KINETIS_NI2S 2 /* Two I2S modules */ -# define KINETIS_NSLCD 1 /* One segment LCD interface (up to 36x8/40x4) */ -# define KINETIS_NADC16 4 /* Four 16-bit ADC */ -# undef KINETIS_NADC12 /* No 12-channel ADC */ -# undef KINETIS_NADC13 /* No 13-channel ADC */ -# define KINETIS_NADC15 1 /* One 15-channel ADC (ADC0) */ -# define KINETIS_NADC18 1 /* One 18-channel ADC (ADC1) */ -# define KINETIS_NPGA 4 /* Four Programmable Gain Amplifiers */ -# define KINETIS_NCMP 3 /* Three analog comparators */ -# undef KINETIS_NDAC6 /* No 6-bit DAC */ -# define KINETIS_NDAC12 2 /* Twp 12-bit DACs */ -# define KINETIS_NVREF 1 /* Voltage reference */ -# undef KINETIS_NTIMERS12 /* No 12 channel timers */ -# define KINETIS_NTIMERS20 4 /* Four 20 channel timers */ -# define KINETIS_NTIMERS12 3 /* Three 12 channel timers */ -# undef KINETIS_NTIMERS20 /* No 20 channel timers */ -# define KINETIS_NRTC 1 /* Real time clock */ -# undef KINETIS_NRNG /* No random number generator */ -# undef KINETIS_NMMCAU /* No hardware encryption */ -# undef KINETIS_NTAMPER /* No tamper detect */ -# define KINETIS_NCRC 1 /* CRC */ - -#elif defined(CONFIG_ARCH_CHIP_MK60X256VLQ100) -# undef KINETIS_K40 /* Not Kinetics K40 family */ -# define KINETIS_K60 1 /* Kinetis K60 family */ -# define KINETIS_FLASH_SIZE (256*1024) /* 256Kb */ -# define KINETIS_FLEXNVM_SIZE (256*1024) /* 256Kb */ -# define KINETIS_FLEXRAM_SIZE (4*1024) /* 4Kb */ -# define KINETIS_SRAM_SIZE (64*1024) /* 64Kb */ -# define KINETIS_MPU 1 /* Memory protection unit */ -# define KINETIS_EXTBUS 1 /* External bus interface */ -# define KINETIS_NDMACH 16 /* Up to 16 DMA channels */ -# define KINETIS_NENET 1 /* One IEEE 1588 Ethernet controller */ -# define KINETIS_NUSBHOST 1 /* One USB host controller */ -# define KINETIS_NUSBOTG 1 /* With USB OTG controller */ -# define KINETIS_NUSBDEV 1 /* One USB device controller */ -# define KINETIS_NSDHC 1 /* SD host controller */ -# define KINETIS_NTOUCHIF 1 /* Xtrinsic touch sensing interface */ -# define KINETIS_NI2C 3 /* Three I2C modules */ -# define KINETIS_NISO7816 1 /* One UART with ISO-786 */ -# define KINETIS_NUART 5 /* Five additional UARTs */ -# define KINETIS_NSPI 3 /* Three SPI modules */ -# define KINETIS_NCAN 2 /* Two CAN controllers */ -# define KINETIS_NI2S 2 /* Two I2S modules */ -# define KINETIS_NSLCD 1 /* One segment LCD interface (up to 36x8/40x4) */ -# define KINETIS_NADC16 4 /* Four 16-bit ADC */ -# undef KINETIS_NADC12 /* No 12-channel ADC */ -# undef KINETIS_NADC13 /* No 13-channel ADC */ -# define KINETIS_NADC15 1 /* One 15-channel ADC (ADC0) */ -# define KINETIS_NADC18 1 /* One 18-channel ADC (ADC1) */ -# define KINETIS_NPGA 4 /* Four Programmable Gain Amplifiers */ -# define KINETIS_NCMP 3 /* Three analog comparators */ -# undef KINETIS_NDAC6 /* No 6-bit DAC */ -# define KINETIS_NDAC12 2 /* Twp 12-bit DACs */ -# define KINETIS_NVREF 1 /* Voltage reference */ -# undef KINETIS_NTIMERS12 /* No 12 channel timers */ -# define KINETIS_NTIMERS20 4 /* Four 20 channel timers */ -# define KINETIS_NTIMERS12 3 /* Three 12 channel timers */ -# undef KINETIS_NTIMERS20 /* No 20 channel timers */ -# define KINETIS_NRTC 1 /* Real time clock */ -# undef KINETIS_NRNG /* No random number generator */ -# undef KINETIS_NMMCAU /* No hardware encryption */ -# undef KINETIS_NTAMPER /* No tamper detect */ -# define KINETIS_NCRC 1 /* CRC */ - -#elif defined(CONFIG_ARCH_CHIP_MK60N512VLQ100) -# undef KINETIS_K40 /* Not Kinetics K40 family */ -# define KINETIS_K60 1 /* Kinetis K60 family */ -# define KINETIS_FLASH_SIZE (512*1024) /* 512Kb */ -# undef KINETIS_FLEXNVM_SIZE /* No FlexNVM */ -# undef KINETIS_FLEXRAM_SIZE /* No FlexRAM */ -# define KINETIS_SRAM_SIZE (128*1024) /* 128Kb */ -# define KINETIS_MPU 1 /* Memory protection unit */ -# define KINETIS_EXTBUS 1 /* External bus interface */ -# define KINETIS_NDMACH 16 /* Up to 16 DMA channels */ -# define KINETIS_NENET 1 /* One IEEE 1588 Ethernet controller */ -# define KINETIS_NUSBHOST 1 /* One USB host controller */ -# define KINETIS_NUSBOTG 1 /* With USB OTG controller */ -# define KINETIS_NUSBDEV 1 /* One USB device controller */ -# define KINETIS_NSDHC 1 /* SD host controller */ -# define KINETIS_NTOUCHIF 1 /* Xtrinsic touch sensing interface */ -# define KINETIS_NI2C 3 /* Three I2C modules */ -# define KINETIS_NISO7816 1 /* One UART with ISO-786 */ -# define KINETIS_NUART 5 /* Five additional UARTs */ -# define KINETIS_NSPI 3 /* Three SPI modules */ -# define KINETIS_NCAN 2 /* Two CAN controllers */ -# define KINETIS_NI2S 2 /* Two I2S modules */ -# define KINETIS_NSLCD 1 /* One segment LCD interface (up to 36x8/40x4) */ -# define KINETIS_NADC16 4 /* Four 16-bit ADC */ -# undef KINETIS_NADC12 /* No 12-channel ADC */ -# undef KINETIS_NADC13 /* No 13-channel ADC */ -# define KINETIS_NADC15 1 /* One 15-channel ADC (ADC0) */ -# define KINETIS_NADC18 1 /* One 18-channel ADC (ADC1) */ -# define KINETIS_NPGA 4 /* Four Programmable Gain Amplifiers */ -# define KINETIS_NCMP 3 /* Three analog comparators */ -# undef KINETIS_NDAC6 /* No 6-bit DAC */ -# define KINETIS_NDAC12 2 /* Twp 12-bit DACs */ -# define KINETIS_NVREF 1 /* Voltage reference */ -# undef KINETIS_NTIMERS12 /* No 12 channel timers */ -# define KINETIS_NTIMERS20 4 /* Four 20 channel timers */ -# define KINETIS_NTIMERS12 3 /* Three 12 channel timers */ -# undef KINETIS_NTIMERS20 /* No 20 channel timers */ -# define KINETIS_NRTC 1 /* Real time clock */ -# undef KINETIS_NRNG /* No random number generator */ -# undef KINETIS_NMMCAU /* No hardware encryption */ -# undef KINETIS_NTAMPER /* No tamper detect */ -# define KINETIS_NCRC 1 /* CRC */ - -#elif defined(CONFIG_ARCH_CHIP_MK60N256VMD100) -# undef KINETIS_K40 /* Not Kinetics K40 family */ -# define KINETIS_K60 1 /* Kinetis K60 family */ -# define KINETIS_FLASH_SIZE (256*1024) /* 256Kb */ -# undef KINETIS_FLEXNVM_SIZE /* No FlexNVM */ -# undef KINETIS_FLEXRAM_SIZE /* No FlexRAM */ -# define KINETIS_SRAM_SIZE (64*1024) /* 64Kb */ -# define KINETIS_MPU 1 /* Memory protection unit */ -# define KINETIS_EXTBUS 1 /* External bus interface */ -# define KINETIS_NDMACH 16 /* Up to 16 DMA channels */ -# define KINETIS_NENET 1 /* One IEEE 1588 Ethernet controller */ -# define KINETIS_NUSBHOST 1 /* One USB host controller */ -# define KINETIS_NUSBOTG 1 /* With USB OTG controller */ -# define KINETIS_NUSBDEV 1 /* One USB device controller */ -# define KINETIS_NSDHC 1 /* SD host controller */ -# define KINETIS_NTOUCHIF 1 /* Xtrinsic touch sensing interface */ -# define KINETIS_NI2C 3 /* Three I2C modules */ -# define KINETIS_NISO7816 1 /* One UART with ISO-786 */ -# define KINETIS_NUART 5 /* Five additional UARTs */ -# define KINETIS_NSPI 3 /* Three SPI modules */ -# define KINETIS_NCAN 2 /* Two CAN controllers */ -# define KINETIS_NI2S 2 /* Two I2S modules */ -# define KINETIS_NSLCD 1 /* One segment LCD interface (up to 36x8/40x4) */ -# define KINETIS_NADC16 4 /* Four 16-bit ADC */ -# undef KINETIS_NADC12 /* No 12-channel ADC */ -# undef KINETIS_NADC13 /* No 13-channel ADC */ -# define KINETIS_NADC15 1 /* One 15-channel ADC (ADC0) */ -# define KINETIS_NADC18 1 /* One 18-channel ADC (ADC1) */ -# define KINETIS_NPGA 4 /* Four Programmable Gain Amplifiers */ -# define KINETIS_NCMP 3 /* Three analog comparators */ -# undef KINETIS_NDAC6 /* No 6-bit DAC */ -# define KINETIS_NDAC12 2 /* Twp 12-bit DACs */ -# define KINETIS_NVREF 1 /* Voltage reference */ -# undef KINETIS_NTIMERS12 /* No 12 channel timers */ -# define KINETIS_NTIMERS20 4 /* Four 20 channel timers */ -# define KINETIS_NTIMERS12 3 /* Three 12 channel timers */ -# undef KINETIS_NTIMERS20 /* No 20 channel timers */ -# define KINETIS_NRTC 1 /* Real time clock */ -# undef KINETIS_NRNG /* No random number generator */ -# undef KINETIS_NMMCAU /* No hardware encryption */ -# undef KINETIS_NTAMPER /* No tamper detect */ -# define KINETIS_NCRC 1 /* CRC */ - -#elif defined(CONFIG_ARCH_CHIP_MK60X256VMD100) -# undef KINETIS_K40 /* Not Kinetics K40 family */ -# define KINETIS_K60 1 /* Kinetis K60 family */ -# define KINETIS_FLASH_SIZE (256*1024) /* 256Kb */ -# define KINETIS_FLEXNVM_SIZE (256*1024) /* 256Kb */ -# define KINETIS_FLEXRAM_SIZE (4*1024) /* 4Kb */ -# define KINETIS_SRAM_SIZE (64*1024) /* 64Kb */ -# define KINETIS_MPU 1 /* Memory protection unit */ -# define KINETIS_EXTBUS 1 /* External bus interface */ -# define KINETIS_NDMACH 16 /* Up to 16 DMA channels */ -# define KINETIS_NENET 1 /* One IEEE 1588 Ethernet controller */ -# define KINETIS_NUSBHOST 1 /* One USB host controller */ -# define KINETIS_NUSBOTG 1 /* With USB OTG controller */ -# define KINETIS_NUSBDEV 1 /* One USB device controller */ -# define KINETIS_NSDHC 1 /* SD host controller */ -# define KINETIS_NTOUCHIF 1 /* Xtrinsic touch sensing interface */ -# define KINETIS_NI2C 3 /* Three I2C modules */ -# define KINETIS_NISO7816 1 /* One UART with ISO-786 */ -# define KINETIS_NUART 5 /* Five additional UARTs */ -# define KINETIS_NSPI 3 /* Three SPI modules */ -# define KINETIS_NCAN 2 /* Two CAN controllers */ -# define KINETIS_NI2S 2 /* Two I2S modules */ -# define KINETIS_NSLCD 1 /* One segment LCD interface (up to 36x8/40x4) */ -# define KINETIS_NADC16 4 /* Four 16-bit ADC */ -# undef KINETIS_NADC12 /* No 12-channel ADC */ -# undef KINETIS_NADC13 /* No 13-channel ADC */ -# define KINETIS_NADC15 1 /* One 15-channel ADC (ADC0) */ -# define KINETIS_NADC18 1 /* One 18-channel ADC (ADC1) */ -# define KINETIS_NPGA 4 /* Four Programmable Gain Amplifiers */ -# define KINETIS_NCMP 3 /* Three analog comparators */ -# undef KINETIS_NDAC6 /* No 6-bit DAC */ -# define KINETIS_NDAC12 2 /* Twp 12-bit DACs */ -# define KINETIS_NVREF 1 /* Voltage reference */ -# undef KINETIS_NTIMERS12 /* No 12 channel timers */ -# define KINETIS_NTIMERS20 4 /* Four 20 channel timers */ -# define KINETIS_NTIMERS12 3 /* Three 12 channel timers */ -# undef KINETIS_NTIMERS20 /* No 20 channel timers */ -# define KINETIS_NRTC 1 /* Real time clock */ -# undef KINETIS_NRNG /* No random number generator */ -# undef KINETIS_NMMCAU /* No hardware encryption */ -# undef KINETIS_NTAMPER /* No tamper detect */ -# define KINETIS_NCRC 1 /* CRC */ - -#elif defined(CONFIG_ARCH_CHIP_MK60N512VMD100) -# undef KINETIS_K40 /* Not Kinetics K40 family */ -# define KINETIS_K60 1 /* Kinetis K60 family */ -# define KINETIS_FLASH_SIZE (512*1024) /* 512Kb */ -# undef KINETIS_FLEXNVM_SIZE /* No FlexNVM */ -# undef KINETIS_FLEXRAM_SIZE /* No FlexRAM */ -# define KINETIS_SRAM_SIZE (128*1024) /* 128Kb */ -# define KINETIS_MPU 1 /* Memory protection unit */ -# define KINETIS_EXTBUS 1 /* External bus interface */ -# define KINETIS_NDMACH 16 /* Up to 16 DMA channels */ -# define KINETIS_NENET 1 /* One IEEE 1588 Ethernet controller */ -# define KINETIS_NUSBHOST 1 /* One USB host controller */ -# define KINETIS_NUSBOTG 1 /* With USB OTG controller */ -# define KINETIS_NUSBDEV 1 /* One USB device controller */ -# define KINETIS_NSDHC 1 /* SD host controller */ -# define KINETIS_NTOUCHIF 1 /* Xtrinsic touch sensing interface */ -# define KINETIS_NI2C 3 /* Three I2C modules */ -# define KINETIS_NISO7816 1 /* One UART with ISO-786 */ -# define KINETIS_NUART 5 /* Five additional UARTs */ -# define KINETIS_NSPI 3 /* Three SPI modules */ -# define KINETIS_NCAN 2 /* Two CAN controllers */ -# define KINETIS_NI2S 2 /* Two I2S modules */ -# define KINETIS_NSLCD 1 /* One segment LCD interface (up to 36x8/40x4) */ -# define KINETIS_NADC16 4 /* Four 16-bit ADC */ -# undef KINETIS_NADC12 /* No 12-channel ADC */ -# undef KINETIS_NADC13 /* No 13-channel ADC */ -# define KINETIS_NADC15 1 /* One 15-channel ADC (ADC0) */ -# define KINETIS_NADC18 1 /* One 18-channel ADC (ADC1) */ -# define KINETIS_NPGA 4 /* Four Programmable Gain Amplifiers */ -# define KINETIS_NCMP 3 /* Three analog comparators */ -# undef KINETIS_NDAC6 /* No 6-bit DAC */ -# define KINETIS_NDAC12 2 /* Twp 12-bit DACs */ -# define KINETIS_NVREF 1 /* Voltage reference */ -# undef KINETIS_NTIMERS12 /* No 12 channel timers */ -# define KINETIS_NTIMERS20 4 /* Four 20 channel timers */ -# define KINETIS_NTIMERS12 3 /* Three 12 channel timers */ -# undef KINETIS_NTIMERS20 /* No 20 channel timers */ -# define KINETIS_NRTC 1 /* Real time clock */ -# undef KINETIS_NRNG /* No random number generator */ -# undef KINETIS_NMMCAU /* No hardware encryption */ -# undef KINETIS_NTAMPER /* No tamper detect */ -# define KINETIS_NCRC 1 /* CRC */ - -#else -# error "Unsupported Kinetis chip" -#endif - -/* Include only the memory map. Other chip hardware files should then include this - * file for the proper setup - */ - -#include "kinetis_memorymap.h" - -/* NVIC priority levels *************************************************************/ -/* Each priority field holds a priority value, 0-15. The lower the value, the greater - * the priority of the corresponding interrupt. The processor implements only - * bits[7:4] of each field, bits[3:0] read as zero and ignore writes. - */ - -#define NVIC_SYSH_PRIORITY_MIN 0xf0 /* All bits[7:4] set is minimum priority */ -#define NVIC_SYSH_PRIORITY_DEFAULT 0x80 /* Midpoint is the default */ -#define NVIC_SYSH_PRIORITY_MAX 0x00 /* Zero is maximum priority */ -#define NVIC_SYSH_PRIORITY_STEP 0x10 /* Steps between supported priority values */ - /************************************************************************************ * Public Types ************************************************************************************/ diff --git a/nuttx/arch/arm/src/kinetis/kinetis_irq.c b/nuttx/arch/arm/src/kinetis/kinetis_irq.c index 6fb58c6bf9..31310b03c1 100644 --- a/nuttx/arch/arm/src/kinetis/kinetis_irq.c +++ b/nuttx/arch/arm/src/kinetis/kinetis_irq.c @@ -2,7 +2,7 @@ * arch/arm/src/lpc17/kinetis_irq.c * arch/arm/src/chip/kinetis_irq.c * - * Copyright (C) 2011 Gregory Nutt. All rights reserved. + * Copyright (C) 2011, 2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -208,6 +208,35 @@ static int kinetis_reserved(int irq, FAR void *context) } #endif +/**************************************************************************** + * Name: up_prioritize_irq + * + * Description: + * Set the priority of an exception. This function may be needed + * internally even if support for prioritized interrupts is not enabled. + * + ****************************************************************************/ + +#if !defined(CONFIG_ARCH_IRQPRIO) && defined(CONFIG_ARMV7M_USEBASEPRI) +static int up_prioritize_irq(int irq, int priority) +{ + uint32_t regaddr; + uint32_t regval; + int shift; + + irq -= 4; + regaddr = NVIC_SYSH_PRIORITY(irq); + regval = getreg32(regaddr); + shift = ((irq & 3) << 3); + regval &= ~(0xff << shift); + regval |= (priority << shift); + putreg32(regval, regaddr); + + stm32_dumpnvic("prioritize", irq); + return OK; +} +#endif + /**************************************************************************** * Name: kinetis_irqinfo * @@ -358,6 +387,9 @@ void up_irqinitialize(void) #ifdef CONFIG_ARCH_IRQPRIO /* up_prioritize_irq(KINETIS_IRQ_PENDSV, NVIC_SYSH_PRIORITY_MIN); */ +#endif +#ifdef CONFIG_ARMV7M_USEBASEPRI + up_prioritize_irq(KINETIS_IRQ_SVCALL, NVIC_SYSH_SVCALL_PRIORITY); #endif /* If the MPU is enabled, then attach and enable the Memory Management @@ -486,7 +518,14 @@ int up_prioritize_irq(int irq, int priority) uint32_t regval; int shift; - DEBUGASSERT(irq >= KINETIS_IRQ_MEMFAULT && irq < NR_IRQS && (unsigned)priority <= NVIC_SYSH_PRIORITY_MIN); +#ifdef CONFIG_ARMV7M_USEBASEPRI + DEBUGASSERT(irq >= KINETIS_IRQ_MEMFAULT && irq < NR_IRQS && + priority >= NVIC_SYSH_DISABLE_PRIORITY && + priority <= NVIC_SYSH_PRIORITY_MIN); +#else + DEBUGASSERT(irq >= KINETIS_IRQ_MEMFAULT && irq < NR_IRQS && + (unsigned)priority <= NVIC_SYSH_PRIORITY_MIN); +#endif if (irq < KINETIS_IRQ_EXTINT) { diff --git a/nuttx/arch/arm/src/lm/chip.h b/nuttx/arch/arm/src/lm/chip.h index b5974b5dcf..e476ce4353 100644 --- a/nuttx/arch/arm/src/lm/chip.h +++ b/nuttx/arch/arm/src/lm/chip.h @@ -43,10 +43,6 @@ #include #include -/************************************************************************************ - * Pre-processor Definitions - ************************************************************************************/ - /* Then get all of the register definitions */ #include "chip/lm_memorymap.h" /* Memory map */ @@ -58,15 +54,9 @@ #include "chip/lm_ethernet.h" /* Ethernet MAC and PHY */ #include "chip/lm_flash.h" /* FLASH */ -/* The LM3S69xx only supports 8 priority levels. The hardware priority mechanism - * will only look at the upper N bits of the 8-bit priority level (where N is 3 for - * the Stellaris family), so any prioritization must be performed in those bits. - * The default priority level is set to the middle value - */ - -#define NVIC_SYSH_PRIORITY_MIN 0xe0 /* All bits set in minimum priority */ -#define NVIC_SYSH_PRIORITY_DEFAULT 0x80 /* Midpoint is the default */ -#define NVIC_SYSH_PRIORITY_MAX 0x00 /* Zero is maximum priority */ +/************************************************************************************ + * Pre-processor Definitions + ************************************************************************************/ /************************************************************************************ * Public Types diff --git a/nuttx/arch/arm/src/lm/lm_irq.c b/nuttx/arch/arm/src/lm/lm_irq.c index fa8e271bc8..dc9997afa5 100644 --- a/nuttx/arch/arm/src/lm/lm_irq.c +++ b/nuttx/arch/arm/src/lm/lm_irq.c @@ -2,7 +2,7 @@ * arch/arm/src/lm/lm_irq.c * arch/arm/src/chip/lm_irq.c * - * Copyright (C) 2009, 2011 Gregory Nutt. All rights reserved. + * Copyright (C) 2009, 2011, 2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -190,6 +190,35 @@ static int lm_reserved(int irq, FAR void *context) } #endif +/**************************************************************************** + * Name: up_prioritize_irq + * + * Description: + * Set the priority of an exception. This function may be needed + * internally even if support for prioritized interrupts is not enabled. + * + ****************************************************************************/ + +#if !defined(CONFIG_ARCH_IRQPRIO) && defined(CONFIG_ARMV7M_USEBASEPRI) +static int up_prioritize_irq(int irq, int priority) +{ + uint32_t regaddr; + uint32_t regval; + int shift; + + irq -= 4; + regaddr = NVIC_SYSH_PRIORITY(irq); + regval = getreg32(regaddr); + shift = ((irq & 3) << 3); + regval &= ~(0xff << shift); + regval |= (priority << shift); + putreg32(regval, regaddr); + + stm32_dumpnvic("prioritize", irq); + return OK; +} +#endif + /**************************************************************************** * Name: lm_irqinfo * @@ -316,6 +345,9 @@ void up_irqinitialize(void) #ifdef CONFIG_ARCH_IRQPRIO /* up_prioritize_irq(LM_IRQ_PENDSV, NVIC_SYSH_PRIORITY_MIN); */ +#endif +#ifdef CONFIG_ARMV7M_USEBASEPRI + up_prioritize_irq(LM_IRQ_SVCALL, NVIC_SYSH_SVCALL_PRIORITY); #endif /* If the MPU is enabled, then attach and enable the Memory Management @@ -433,7 +465,14 @@ int up_prioritize_irq(int irq, int priority) uint32_t regval; int shift; - DEBUGASSERT(irq >= LM_IRQ_MEMFAULT && irq < NR_IRQS && (unsigned)priority <= NVIC_SYSH_PRIORITY_MIN); +#ifdef CONFIG_ARMV7M_USEBASEPRI + DEBUGASSERT(irq >= LM_IRQ_MEMFAULT && irq < NR_IRQS && + priority >= NVIC_SYSH_DISABLE_PRIORITY && + priority <= NVIC_SYSH_PRIORITY_MIN); +#else + DEBUGASSERT(irq >= LM_IRQ_MEMFAULT && irq < NR_IRQS && + (unsigned)priority <= NVIC_SYSH_PRIORITY_MIN); +#endif if (irq < LM_IRQ_INTERRUPTS) { diff --git a/nuttx/arch/arm/src/lpc17xx/chip.h b/nuttx/arch/arm/src/lpc17xx/chip.h index d9b3998fec..7bc1ab3459 100644 --- a/nuttx/arch/arm/src/lpc17xx/chip.h +++ b/nuttx/arch/arm/src/lpc17xx/chip.h @@ -41,28 +41,18 @@ ************************************************************************************/ #include -#include -/* Include only the memory map. Other chip hardware files should then include this - * file for the proper setup +/* Include the memory map and the chip definitions file. Other chip hardware files + * should then include this file for the proper setup. */ +#include #include "chip/lpc17_memorymap.h" /************************************************************************************ * Pre-processor Definitions ************************************************************************************/ -/* NVIC priority levels *************************************************************/ -/* Each priority field holds a priority value, 0-31. The lower the value, the greater - * the priority of the corresponding interrupt. The processor implements only - * bits[7:3] of each field, bits[2:0] read as zero and ignore writes. - */ - -#define NVIC_SYSH_PRIORITY_MIN 0xf8 /* All bits[7:3] set is minimum priority */ -#define NVIC_SYSH_PRIORITY_DEFAULT 0x80 /* Midpoint is the default */ -#define NVIC_SYSH_PRIORITY_MAX 0x00 /* Zero is maximum priority */ - /************************************************************************************ * Public Types ************************************************************************************/ diff --git a/nuttx/arch/arm/src/lpc17xx/lpc17_irq.c b/nuttx/arch/arm/src/lpc17xx/lpc17_irq.c index f3e93ffc2b..2d66dd0b15 100644 --- a/nuttx/arch/arm/src/lpc17xx/lpc17_irq.c +++ b/nuttx/arch/arm/src/lpc17xx/lpc17_irq.c @@ -2,7 +2,7 @@ * arch/arm/src/lpc17/lpc17_irq.c * arch/arm/src/chip/lpc17_irq.c * - * Copyright (C) 2010-2011 Gregory Nutt. All rights reserved. + * Copyright (C) 2010-2011, 2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -189,6 +189,35 @@ static int lpc17_reserved(int irq, FAR void *context) } #endif +/**************************************************************************** + * Name: up_prioritize_irq + * + * Description: + * Set the priority of an exception. This function may be needed + * internally even if support for prioritized interrupts is not enabled. + * + ****************************************************************************/ + +#if !defined(CONFIG_ARCH_IRQPRIO) && defined(CONFIG_ARMV7M_USEBASEPRI) +static int up_prioritize_irq(int irq, int priority) +{ + uint32_t regaddr; + uint32_t regval; + int shift; + + irq -= 4; + regaddr = NVIC_SYSH_PRIORITY(irq); + regval = getreg32(regaddr); + shift = ((irq & 3) << 3); + regval &= ~(0xff << shift); + regval |= (priority << shift); + putreg32(regval, regaddr); + + stm32_dumpnvic("prioritize", irq); + return OK; +} +#endif + /**************************************************************************** * Name: lpc17_irqinfo * @@ -304,6 +333,9 @@ void up_irqinitialize(void) #ifdef CONFIG_ARCH_IRQPRIO /* up_prioritize_irq(LPC17_IRQ_PENDSV, NVIC_SYSH_PRIORITY_MIN); */ +#endif +#ifdef CONFIG_ARMV7M_USEBASEPRI + up_prioritize_irq(LPC17_IRQ_SVCALL, NVIC_SYSH_SVCALL_PRIORITY); #endif /* If the MPU is enabled, then attach and enable the Memory Management @@ -448,7 +480,14 @@ int up_prioritize_irq(int irq, int priority) uint32_t regval; int shift; - DEBUGASSERT(irq >= LPC17_IRQ_MEMFAULT && irq < LPC17_IRQ_NIRQS && (unsigned)priority <= NVIC_SYSH_PRIORITY_MIN); +#ifdef CONFIG_ARMV7M_USEBASEPRI + DEBUGASSERT(irq >= LPC17_IRQ_MEMFAULT && irq < LPC17_IRQ_NIRQS && + priority >= NVIC_SYSH_DISABLE_PRIORITY && + priority <= NVIC_SYSH_PRIORITY_MIN); +#else + DEBUGASSERT(irq >= LPC17_IRQ_MEMFAULT && irq < LPC17_IRQ_NIRQS && + (unsigned)priority <= NVIC_SYSH_PRIORITY_MIN); +#endif if (irq < LPC17_IRQ_EXTINT) { diff --git a/nuttx/arch/arm/src/lpc43xx/chip.h b/nuttx/arch/arm/src/lpc43xx/chip.h index 35150d08c6..151571e74f 100644 --- a/nuttx/arch/arm/src/lpc43xx/chip.h +++ b/nuttx/arch/arm/src/lpc43xx/chip.h @@ -1,7 +1,7 @@ /************************************************************************************ * arch/arm/src/lpc43xx/chip.h * - * Copyright (C) 2012 Gregory Nutt. All rights reserved. + * Copyright (C) 2012-2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -141,23 +141,6 @@ * Pre-processor Definitions ************************************************************************************/ -/* NVIC priority levels *************************************************************/ -/* Each priority field holds a priority value, 0-31. The lower the value, the greater - * the priority of the corresponding interrupt. - * - * The Cortex-M4 core supports up to 53 interrupts an 8 prgrammable interrupt - * priority levels; The Cortex-M0 core supports up to 32 interrupts with 4 - * programmable interrupt priorities. - */ - -#define LPC43M4_SYSH_PRIORITY_MIN 0xe0 /* All bits[7:5] set is minimum priority */ -#define LPC43M4_SYSH_PRIORITY_DEFAULT 0x80 /* Midpoint is the default */ -#define LPC43M4_SYSH_PRIORITY_MAX 0x00 /* Zero is maximum priority */ - -#define LPC43M0_SYSH_PRIORITY_MIN 0xc0 /* All bits[7:6] set is minimum priority */ -#define LPC43M0_SYSH_PRIORITY_DEFAULT 0x80 /* Midpoint is the default */ -#define LPC43M0_SYSH_PRIORITY_MAX 0x00 /* Zero is maximum priority */ - /************************************************************************************ * Public Types ************************************************************************************/ diff --git a/nuttx/arch/arm/src/lpc43xx/lpc43_irq.c b/nuttx/arch/arm/src/lpc43xx/lpc43_irq.c index 9cbb8238cb..2fddd79ad9 100644 --- a/nuttx/arch/arm/src/lpc43xx/lpc43_irq.c +++ b/nuttx/arch/arm/src/lpc43xx/lpc43_irq.c @@ -2,7 +2,7 @@ * arch/arm/src/lpc43/lpc43_irq.c * arch/arm/src/chip/lpc43_irq.c * - * Copyright (C) 2012 Gregory Nutt. All rights reserved. + * Copyright (C) 2012-2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -191,6 +191,35 @@ static int lpc43_reserved(int irq, FAR void *context) } #endif +/**************************************************************************** + * Name: up_prioritize_irq + * + * Description: + * Set the priority of an exception. This function may be needed + * internally even if support for prioritized interrupts is not enabled. + * + ****************************************************************************/ + +#if !defined(CONFIG_ARCH_IRQPRIO) && defined(CONFIG_ARMV7M_USEBASEPRI) +static int up_prioritize_irq(int irq, int priority) +{ + uint32_t regaddr; + uint32_t regval; + int shift; + + irq -= 4; + regaddr = NVIC_SYSH_PRIORITY(irq); + regval = getreg32(regaddr); + shift = ((irq & 3) << 3); + regval &= ~(0xff << shift); + regval |= (priority << shift); + putreg32(regval, regaddr); + + stm32_dumpnvic("prioritize", irq); + return OK; +} +#endif + /**************************************************************************** * Name: lpc43_irqinfo * @@ -333,6 +362,9 @@ void up_irqinitialize(void) #ifdef CONFIG_ARCH_IRQPRIO /* up_prioritize_irq(LPC43_IRQ_PENDSV, NVIC_SYSH_PRIORITY_MIN); */ +#endif +#ifdef CONFIG_ARMV7M_USEBASEPRI + up_prioritize_irq(LPC43_IRQ_SVCALL, NVIC_SYSH_SVCALL_PRIORITY); #endif /* If the MPU is enabled, then attach and enable the Memory Management @@ -477,8 +509,14 @@ int up_prioritize_irq(int irq, int priority) uint32_t regval; int shift; +#ifdef CONFIG_ARMV7M_USEBASEPRI DEBUGASSERT(irq >= LPC43_IRQ_MEMFAULT && irq < NR_IRQS && - (unsigned)priority <= LPC43M4_SYSH_PRIORITY_MIN); + priority >= NVIC_SYSH_DISABLE_PRIORITY && + priority <= NVIC_SYSH_PRIORITY_MIN); +#else + DEBUGASSERT(irq >= LPC43_IRQ_MEMFAULT && irq < NR_IRQS && + (unsigned)priority <= NVIC_SYSH_PRIORITY_MIN); +#endif if (irq < LPC43_IRQ_EXTINT) { diff --git a/nuttx/arch/arm/src/sam3u/chip.h b/nuttx/arch/arm/src/sam3u/chip.h index 865cad5eac..1ce104ab24 100644 --- a/nuttx/arch/arm/src/sam3u/chip.h +++ b/nuttx/arch/arm/src/sam3u/chip.h @@ -1,7 +1,7 @@ /************************************************************************************ * arch/arm/src/sam3u/chip.h * - * Copyright (C) 2009-2010 Gregory Nutt. All rights reserved. + * Copyright (C) 2009-2010, 2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -42,46 +42,17 @@ #include +/* Include the memory map and the chip definitions file. Other chip hardware files + * should then include this file for the proper setup. + */ + +#include +#include "sam3u_memorymap.h" + /************************************************************************************ * Pre-processor Definitions ************************************************************************************/ -/* Get customizations for each supported chip */ - -#ifdef CONFIG_ARCH_CHIP_AT91SAM3U4E -/* Internal memory */ - -# define CONFIG_SAM3U_SRAM0_SIZE 0x00008000 /* 32Kb */ -# define CONFIG_SAM3U_SRAM1_SIZE 0x00004000 /* 16Kb */ -# define CONFIG_SAM3U_NFCSRAM_SIZE 0x00001000 /* 4Kb */ - -/* DMA */ - -# define CONFIG_SAM3U_NDMACHAN 4 /* 4 DMA Channels */ - -/* Memory card interface */ - -# define CONFIG_SAM3U_MCI2 1 -#else -# error "Unknown SAM3U chip type" -#endif - -/* Include only the memory map. Other chip hardware files should then include this - * file for the proper setup - */ - -#include "sam3u_memorymap.h" - -/* NVIC priority levels *************************************************************/ -/* Each priority field holds a priority value, 0-15. The lower the value, the greater - * the priority of the corresponding interrupt. The processor implements only - * bits[7:4] of each field, bits[3:0] read as zero and ignore writes. - */ - -#define NVIC_SYSH_PRIORITY_MIN 0xf0 /* All bits[7:4] set is minimum priority */ -#define NVIC_SYSH_PRIORITY_DEFAULT 0x80 /* Midpoint is the default */ -#define NVIC_SYSH_PRIORITY_MAX 0x00 /* Zero is maximum priority */ - /************************************************************************************ * Public Types ************************************************************************************/ diff --git a/nuttx/arch/arm/src/sam3u/sam3u_irq.c b/nuttx/arch/arm/src/sam3u/sam3u_irq.c index db79314c00..d9fd4dac8b 100644 --- a/nuttx/arch/arm/src/sam3u/sam3u_irq.c +++ b/nuttx/arch/arm/src/sam3u/sam3u_irq.c @@ -2,7 +2,7 @@ * arch/arm/src/sam3u/sam3u_irq.c * arch/arm/src/chip/sam3u_irq.c * - * Copyright (C) 2009, 2011 Gregory Nutt. All rights reserved. + * Copyright (C) 2009, 2011, 2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -184,6 +184,35 @@ static int sam3u_reserved(int irq, FAR void *context) } #endif +/**************************************************************************** + * Name: up_prioritize_irq + * + * Description: + * Set the priority of an exception. This function may be needed + * internally even if support for prioritized interrupts is not enabled. + * + ****************************************************************************/ + +#if !defined(CONFIG_ARCH_IRQPRIO) && defined(CONFIG_ARMV7M_USEBASEPRI) +static int up_prioritize_irq(int irq, int priority) +{ + uint32_t regaddr; + uint32_t regval; + int shift; + + irq -= 4; + regaddr = NVIC_SYSH_PRIORITY(irq); + regval = getreg32(regaddr); + shift = ((irq & 3) << 3); + regval &= ~(0xff << shift); + regval |= (priority << shift); + putreg32(regval, regaddr); + + stm32_dumpnvic("prioritize", irq); + return OK; +} +#endif + /**************************************************************************** * Name: sam3u_irqinfo * @@ -295,6 +324,9 @@ void up_irqinitialize(void) #ifdef CONFIG_ARCH_IRQPRIO /* up_prioritize_irq(SAM3U_IRQ_PENDSV, NVIC_SYSH_PRIORITY_MIN); */ +#endif +#ifdef CONFIG_ARMV7M_USEBASEPRI + up_prioritize_irq(SAM3U_IRQ_SVCALL, NVIC_SYSH_SVCALL_PRIORITY); #endif /* If the MPU is enabled, then attach and enable the Memory Management @@ -436,7 +468,14 @@ int up_prioritize_irq(int irq, int priority) uint32_t regval; int shift; - DEBUGASSERT(irq >= SAM3U_IRQ_MEMFAULT && irq < SAM3U_IRQ_NIRQS && (unsigned)priority <= NVIC_SYSH_PRIORITY_MIN); +#ifdef CONFIG_ARMV7M_USEBASEPRI + DEBUGASSERT(irq >= SAM3U_IRQ_MEMFAULT && irq < SAM3U_IRQ_NIRQS && + priority >= NVIC_SYSH_DISABLE_PRIORITY && + priority <= NVIC_SYSH_PRIORITY_MIN); +#else + DEBUGASSERT(irq >= SAM3U_IRQ_MEMFAULT && irq < SAM3U_IRQ_NIRQS && + (unsigned)priority <= NVIC_SYSH_PRIORITY_MIN); +#endif if (irq < SAM3U_IRQ_EXTINT) { diff --git a/nuttx/arch/arm/src/stm32/chip.h b/nuttx/arch/arm/src/stm32/chip.h index 3fac597ef2..41a87feae0 100644 --- a/nuttx/arch/arm/src/stm32/chip.h +++ b/nuttx/arch/arm/src/stm32/chip.h @@ -1,7 +1,7 @@ /************************************************************************************ * arch/arm/src/stm32/chip.h * - * Copyright (C) 2009, 2011-2012 Gregory Nutt. All rights reserved. + * Copyright (C) 2009, 2011-2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without diff --git a/nuttx/arch/arm/src/stm32/stm32.h b/nuttx/arch/arm/src/stm32/stm32.h index 44a23aece4..95fd19779e 100644 --- a/nuttx/arch/arm/src/stm32/stm32.h +++ b/nuttx/arch/arm/src/stm32/stm32.h @@ -68,12 +68,6 @@ # undef CONFIG_DEBUG_QENCODER #endif -/* NVIC priority levels *************************************************************/ - -#define NVIC_SYSH_PRIORITY_MIN 0xff /* All bits set in minimum priority */ -#define NVIC_SYSH_PRIORITY_DEFAULT 0x80 /* Midpoint is the default */ -#define NVIC_SYSH_PRIORITY_MAX 0x00 /* Zero is maximum priority */ - /* Peripherals **********************************************************************/ #include "chip.h" diff --git a/nuttx/arch/arm/src/stm32/stm32_irq.c b/nuttx/arch/arm/src/stm32/stm32_irq.c index 36a5cf5fa7..8f2b070fb8 100644 --- a/nuttx/arch/arm/src/stm32/stm32_irq.c +++ b/nuttx/arch/arm/src/stm32/stm32_irq.c @@ -2,7 +2,7 @@ * arch/arm/src/stm32/stm32_irq.c * arch/arm/src/chip/stm32_irq.c * - * Copyright (C) 2009-2012 Gregory Nutt. All rights reserved. + * Copyright (C) 2009-2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -194,6 +194,35 @@ static int stm32_reserved(int irq, FAR void *context) } #endif +/**************************************************************************** + * Name: up_prioritize_irq + * + * Description: + * Set the priority of an exception. This function may be needed + * internally even if support for prioritized interrupts is not enabled. + * + ****************************************************************************/ + +#if !defined(CONFIG_ARCH_IRQPRIO) && defined(CONFIG_ARMV7M_USEBASEPRI) +static int up_prioritize_irq(int irq, int priority) +{ + uint32_t regaddr; + uint32_t regval; + int shift; + + irq -= 4; + regaddr = NVIC_SYSH_PRIORITY(irq); + regval = getreg32(regaddr); + shift = ((irq & 3) << 3); + regval &= ~(0xff << shift); + regval |= (priority << shift); + putreg32(regval, regaddr); + + stm32_dumpnvic("prioritize", irq); + return OK; +} +#endif + /**************************************************************************** * Name: stm32_irqinfo * @@ -334,6 +363,9 @@ void up_irqinitialize(void) #ifdef CONFIG_ARCH_IRQPRIO /* up_prioritize_irq(STM32_IRQ_PENDSV, NVIC_SYSH_PRIORITY_MIN); */ +#endif +#ifdef CONFIG_ARMV7M_USEBASEPRI + up_prioritize_irq(STM32_IRQ_SVCALL, NVIC_SYSH_SVCALL_PRIORITY); #endif /* If the MPU is enabled, then attach and enable the Memory Management @@ -451,7 +483,14 @@ int up_prioritize_irq(int irq, int priority) uint32_t regval; int shift; - DEBUGASSERT(irq >= STM32_IRQ_MEMFAULT && irq < NR_IRQS && (unsigned)priority <= NVIC_SYSH_PRIORITY_MIN); +#ifdef CONFIG_ARMV7M_USEBASEPRI + DEBUGASSERT(irq >= STM32_IRQ_MEMFAULT && irq < NR_IRQS && + priority >= NVIC_SYSH_DISABLE_PRIORITY && + priority <= NVIC_SYSH_PRIORITY_MIN); +#else + DEBUGASSERT(irq >= STM32_IRQ_MEMFAULT && irq < NR_IRQS && + (unsigned)priority <= NVIC_SYSH_PRIORITY_MIN); +#endif if (irq < STM32_IRQ_INTERRUPTS) { From 9375b285f28c3636edab8bc60540f156aa11eaf7 Mon Sep 17 00:00:00 2001 From: patacongo Date: Tue, 22 Jan 2013 14:37:17 +0000 Subject: [PATCH 105/118] More logic to use BASEPRI to control interrupts -- still doesn't work git-svn-id: http://svn.code.sf.net/p/nuttx/code/trunk@5547 42af7a65-404d-4744-a932-0658087f49c3 --- nuttx/ChangeLog | 10 ++++++++ nuttx/TODO | 23 +------------------ nuttx/arch/arm/include/armv7-m/irq.h | 21 ++++++++++------- .../arch/arm/include/armv7-m/irq_cmnvector.h | 6 ++++- nuttx/arch/arm/include/armv7-m/irq_lazyfpu.h | 6 ++++- nuttx/arch/arm/include/types.h | 6 +++++ nuttx/arch/arm/src/armv7-m/up_assert.c | 7 +++++- nuttx/arch/arm/src/armv7-m/up_exception.S | 11 ++++++++- nuttx/arch/arm/src/armv7-m/up_hardfault.c | 16 ++++++++++--- nuttx/arch/arm/src/armv7-m/up_initialstate.c | 12 ++++++---- .../arm/src/armv7-m/up_schedulesigaction.c | 18 ++++++++++++++- nuttx/arch/arm/src/armv7-m/up_sigdeliver.c | 10 +++++++- nuttx/arch/arm/src/kinetis/kinetis_irq.c | 3 +-- nuttx/arch/arm/src/kinetis/kinetis_vectors.S | 9 ++++++++ nuttx/arch/arm/src/lm/lm_irq.c | 3 +-- nuttx/arch/arm/src/lm/lm_vectors.S | 9 ++++++++ nuttx/arch/arm/src/lpc17xx/lpc17_irq.c | 3 +-- nuttx/arch/arm/src/lpc17xx/lpc17_vectors.S | 9 ++++++++ nuttx/arch/arm/src/lpc43xx/lpc43_irq.c | 3 +-- nuttx/arch/arm/src/sam3u/sam3u_irq.c | 3 +-- nuttx/arch/arm/src/sam3u/sam3u_vectors.S | 11 ++++++++- nuttx/arch/arm/src/stm32/stm32_irq.c | 3 +-- nuttx/arch/arm/src/stm32/stm32_vectors.S | 17 ++++++++++---- 23 files changed, 159 insertions(+), 60 deletions(-) diff --git a/nuttx/ChangeLog b/nuttx/ChangeLog index 41f38bd91d..75bfd457f3 100644 --- a/nuttx/ChangeLog +++ b/nuttx/ChangeLog @@ -4001,3 +4001,13 @@ * nuttx/lcd/hd4478ou.h and configs/pcblogic-pic32mx/src/up_lcd1602: Start of support of LCD1602 alphanumeric LCD. I need a few more parts before I can finish integrating this one. + * arch/arm/src/*/chip.h and arch/arm/include/*/chip.h: Move all + priority ragnes from the src to the include chip.h header file. + * arch/arm/include/armv7-m/irq.h: Add inline functions to enable + and disable interrupts via the BASEPRI register. + * arch/arm/Kconfig: Add new option CONFIG_ARM7VM_USEBASEI + * arch/arm/src/*/*_irq.c: Set the priority of the SVCALL exception + to the highest possible value. + * arch/armv7-m/up_hardfault.c: Fail if a hardfault occurs + while CONFIG_ARM7VM_USEBASEI=y. + diff --git a/nuttx/TODO b/nuttx/TODO index 91b4aebaae..94c3dba0d8 100644 --- a/nuttx/TODO +++ b/nuttx/TODO @@ -21,7 +21,7 @@ nuttx/ (1) Documentation (Documentation/) (7) Build system / Toolchains (5) Linux/Cywgin simulation (arch/sim) - (6) ARM (arch/arm/) + (5) ARM (arch/arm/) (1) ARM/C5471 (arch/arm/src/c5471/) (3) ARM/DM320 (arch/arm/src/dm320/) (2) ARM/i.MX (arch/arm/src/imx/) @@ -1176,27 +1176,6 @@ o ARM (arch/arm/) Status: Open Priority: Low - Title: SVCALLS AND HARDFAULTS - Description: The Cortex-M3 user context switch logic uses SVCall instructions. - This user context switching time could be improved by eliminating - the SVCalls and developing assembly language implementations - of the context save and restore logic. - Also, because interrupts are always disabled when the SVCall is - executed, the SVC goes to the hard fault handler where it must - be handled as a special case. I recall seeing some controls - somewhere that will allow to suppress one hard fault. I don't - recall the control, but something like this should be used before - executing the SVCall so that it vectors directly to the SVC - handler. - Another, more standard option would be to use interrupt priority - levels to control interrupts. In that case, (1) The SVC would - be the highest priority interrupt (0), (2) irqsave() would set - the interrupt mask level to just above that, and (2) irqrestore - would restore the interrupt level. This would not be diffult, - but does affect a lot of files! - Status: Open - Priority: Low - Title: ARM INTERRUPTS AND USER MODE Description: The ARM interrupt handling (arch/arm/src/arm/up_vectors.S) returns using 'ldmia sp, {r0-r15}^' My understanding is that this works diff --git a/nuttx/arch/arm/include/armv7-m/irq.h b/nuttx/arch/arm/include/armv7-m/irq.h index 9491e57c09..8acec4c07a 100644 --- a/nuttx/arch/arm/include/armv7-m/irq.h +++ b/nuttx/arch/arm/include/armv7-m/irq.h @@ -118,7 +118,11 @@ struct xcptcontext */ uint32_t saved_pc; +#ifdef CONFIG_ARMV7M_USEBASEPRI + uint32_t saved_basepri; +#else uint32_t saved_primask; +#endif uint32_t saved_xpsr; #endif @@ -134,7 +138,7 @@ struct xcptcontext #ifndef __ASSEMBLY__ -/* Get/set the primask register */ +/* Get/set the PRIMASK register */ static inline uint8_t getprimask(void) inline_function; static inline uint8_t getprimask(void) @@ -161,7 +165,11 @@ static inline void setprimask(uint32_t primask) : "memory"); } -/* Get/set the basepri register */ +/* Get/set the BASEPRI register. The BASEPRI register defines the minimum + * priority for exception processing. When BASEPRI is set to a nonzero + * value, it prevents the activation of all exceptions with the same or + * lower priority level as the BASEPRI value. + */ static inline uint8_t getbasepri(void) inline_function; static inline uint8_t getbasepri(void) @@ -210,7 +218,7 @@ static inline irqstate_t irqsave(void) uint8_t basepri = getbasepri(); setbasepri(NVIC_SYSH_DISABLE_PRIORITY); - return basepri; + return (irqstate_t)basepri; #else @@ -237,11 +245,8 @@ static inline irqstate_t irqsave(void) static inline void irqenable(void) inline_function; static inline void irqenable(void) { -#ifdef CONFIG_ARMV7M_USEBASEPRI - setbasepri(NVIC_SYSH_PRIORITY_MIN); -#else + setbasepri(0); __asm__ __volatile__ ("\tcpsie i\n"); -#endif } /* Restore saved primask state */ @@ -250,7 +255,7 @@ static inline void irqrestore(irqstate_t flags) inline_function; static inline void irqrestore(irqstate_t flags) { #ifdef CONFIG_ARMV7M_USEBASEPRI - setbasepri(flags); + setbasepri((uint32_t)flags); #else /* If bit 0 of the primask is 0, then we need to restore * interupts. diff --git a/nuttx/arch/arm/include/armv7-m/irq_cmnvector.h b/nuttx/arch/arm/include/armv7-m/irq_cmnvector.h index e646731ebd..bc67004ed1 100644 --- a/nuttx/arch/arm/include/armv7-m/irq_cmnvector.h +++ b/nuttx/arch/arm/include/armv7-m/irq_cmnvector.h @@ -51,7 +51,11 @@ */ #define REG_R13 (0) /* R13 = SP at time of interrupt */ -#define REG_PRIMASK (1) /* PRIMASK */ +#ifdef CONFIG_ARMV7M_USEBASEPRI +# define REG_BASEPRI (1) /* BASEPRI */ +#else +# define REG_PRIMASK (1) /* PRIMASK */ +#endif #define REG_R4 (2) /* R4 */ #define REG_R5 (3) /* R5 */ #define REG_R6 (4) /* R6 */ diff --git a/nuttx/arch/arm/include/armv7-m/irq_lazyfpu.h b/nuttx/arch/arm/include/armv7-m/irq_lazyfpu.h index 2c3600b7fa..f2380cbb6d 100644 --- a/nuttx/arch/arm/include/armv7-m/irq_lazyfpu.h +++ b/nuttx/arch/arm/include/armv7-m/irq_lazyfpu.h @@ -51,7 +51,11 @@ */ #define REG_R13 (0) /* R13 = SP at time of interrupt */ -#define REG_PRIMASK (1) /* PRIMASK */ +#ifdef CONFIG_ARMV7M_USEBASEPRI +# define REG_BASEPRI (1) /* BASEPRI */ +#else +# define REG_PRIMASK (1) /* PRIMASK */ +#endif #define REG_R4 (2) /* R4 */ #define REG_R5 (3) /* R5 */ #define REG_R6 (4) /* R6 */ diff --git a/nuttx/arch/arm/include/types.h b/nuttx/arch/arm/include/types.h index c06b289503..1d2ea4cfe4 100644 --- a/nuttx/arch/arm/include/types.h +++ b/nuttx/arch/arm/include/types.h @@ -44,6 +44,8 @@ * Included Files ****************************************************************************/ +#include + /**************************************************************************** * Definitions ****************************************************************************/ @@ -87,7 +89,11 @@ typedef unsigned int _uintptr_t; */ #ifdef __thumb2__ +#ifdef CONFIG_ARMV7M_USEBASEPRI +typedef unsigned char irqstate_t; +#else typedef unsigned short irqstate_t; +#endif #else /* __thumb2__ */ typedef unsigned int irqstate_t; #endif /* __thumb2__ */ diff --git a/nuttx/arch/arm/src/armv7-m/up_assert.c b/nuttx/arch/arm/src/armv7-m/up_assert.c index 282ff6a57d..ab30b09f38 100644 --- a/nuttx/arch/arm/src/armv7-m/up_assert.c +++ b/nuttx/arch/arm/src/armv7-m/up_assert.c @@ -1,7 +1,7 @@ /**************************************************************************** * arch/arm/src/armv7-m/up_assert.c * - * Copyright (C) 2009-2010, 2012 Gregory Nutt. All rights reserved. + * Copyright (C) 2009-2010, 2012-2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -147,8 +147,13 @@ static inline void up_registerdump(void) current_regs[REG_R10], current_regs[REG_R11], current_regs[REG_R12], current_regs[REG_R13], current_regs[REG_R14], current_regs[REG_R15]); +#ifdef CONFIG_ARMV7M_USEBASEPRI + lldbg("xPSR: %08x BASEPRI: %08x\n", + current_regs[REG_XPSR], current_regs[REG_BASEPRI]); +#else lldbg("xPSR: %08x PRIMASK: %08x\n", current_regs[REG_XPSR], current_regs[REG_PRIMASK]); +#endif } } #else diff --git a/nuttx/arch/arm/src/armv7-m/up_exception.S b/nuttx/arch/arm/src/armv7-m/up_exception.S index c9f2160274..17344db413 100644 --- a/nuttx/arch/arm/src/armv7-m/up_exception.S +++ b/nuttx/arch/arm/src/armv7-m/up_exception.S @@ -2,7 +2,7 @@ * arch/arm/src/stm32/up_exception.S * arch/arm/src/chip/up_exception.S * - * Copyright (C) 2009-2012 Gregory Nutt. All rights reserved. + * Copyright (C) 2009-2013 Gregory Nutt. All rights reserved. * Copyright (C) 2012 Michael Smith. All rights reserved. * Author: Gregory Nutt * @@ -100,7 +100,11 @@ exception_common: mov r2, r1 /* R2=Copy of the main/process stack pointer */ add r2, #HW_XCPT_SIZE /* R2=MSP/PSP before the interrupt was taken */ /* (ignoring the xPSR[9] alignment bit) */ +#ifdef CONFIG_ARMV7M_USEBASEPRI + mrs r3, basepri /* R3=Current BASEPRI setting */ +#else mrs r3, primask /* R3=Current PRIMASK setting */ +#endif #ifdef CONFIG_ARCH_FPU @@ -205,7 +209,12 @@ exception_common: /* Restore the interrupt state */ +#ifdef CONFIG_ARMV7M_USEBASEPRI + msr basepri, r3 /* Restore interrupts priority masking*/ + cpsie i /* Re-enable interrupts */ +#else msr primask, r3 /* Restore interrupts */ +#endif /* Always return with R14 containing the special value that will: (1) * return to thread mode, and (2) select the correct stack. diff --git a/nuttx/arch/arm/src/armv7-m/up_hardfault.c b/nuttx/arch/arm/src/armv7-m/up_hardfault.c index b043db3df1..fa750b525d 100644 --- a/nuttx/arch/arm/src/armv7-m/up_hardfault.c +++ b/nuttx/arch/arm/src/armv7-m/up_hardfault.c @@ -1,7 +1,7 @@ /**************************************************************************** * arch/arm/src/armv7-m/up_hardfault.c * - * Copyright (C) 2009 Gregory Nutt. All rights reserved. + * Copyright (C) 2009, 2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -55,7 +55,9 @@ * Pre-processor Definitions ****************************************************************************/ -/* Debug output from this file may interfere with context switching! */ +/* If CONFIG_ARMV7M_USEBASEPRI=n, then debug output from this file may + * interfere with context switching! + */ #ifdef CONFIG_DEBUG_HARDFAULT # define hfdbg(format, arg...) lldbg(format, ##arg) @@ -92,7 +94,9 @@ int up_hardfault(int irq, FAR void *context) { +#if defined(CONFIG_DEBUG_HARDFAULT) || !defined(CONFIG_ARMV7M_USEBASEPRI) uint32_t *regs = (uint32_t*)context; +#endif /* Get the value of the program counter where the fault occurred */ @@ -133,7 +137,13 @@ int up_hardfault(int irq, FAR void *context) hfdbg(" R8: %08x %08x %08x %08x %08x %08x %08x %08x\n", regs[REG_R8], regs[REG_R9], regs[REG_R10], regs[REG_R11], regs[REG_R12], regs[REG_R13], regs[REG_R14], regs[REG_R15]); - hfdbg(" PSR=%08x\n", regs[REG_XPSR]); +#ifdef CONFIG_ARMV7M_USEBASEPRI + hfdbg(" xPSR: %08x BASEPRI: %08x (saved)\n", + current_regs[REG_XPSR], current_regs[REG_BASEPRI]); +#else + hfdbg(" xPSR: %08x PRIMASK: %08x (saved)\n", + current_regs[REG_XPSR], current_regs[REG_PRIMASK]); +#endif (void)irqsave(); lldbg("PANIC!!! Hard fault: %08x\n", getreg32(NVIC_HFAULTS)); diff --git a/nuttx/arch/arm/src/armv7-m/up_initialstate.c b/nuttx/arch/arm/src/armv7-m/up_initialstate.c index 81a4dc9eab..635a700fdf 100644 --- a/nuttx/arch/arm/src/armv7-m/up_initialstate.c +++ b/nuttx/arch/arm/src/armv7-m/up_initialstate.c @@ -1,7 +1,7 @@ /**************************************************************************** * arch/arm/src/armv7-m/up_initialstate.c * - * Copyright (C) 2009, 2011-2 Gregory Nutt. All rights reserved. + * Copyright (C) 2009, 2011-2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -148,7 +148,7 @@ void up_initial_state(_TCB *tcb) xcp->regs[REG_FPSCR] = 0; // XXX initial FPSCR should be configurable xcp->regs[REG_FPReserved] = 0; -#endif +#endif /* CONFIG_ARCH_FPU */ #ifdef CONFIG_NUTTX_KERNEL if ((tcb->flags & TCB_FLAG_TTYPE_MASK) != TCB_FLAG_TTYPE_KERNEL) @@ -157,7 +157,7 @@ void up_initial_state(_TCB *tcb) xcp->regs[REG_EXC_RETURN] = EXC_RETURN_PROCESS_STACK; } -#endif +#endif /* CONFIG_NUTTX_KERNEL */ #else /* CONFIG_ARMV7M_CMNVECTOR */ @@ -181,12 +181,16 @@ void up_initial_state(_TCB *tcb) xcp->regs[REG_EXC_RETURN] = EXC_RETURN_UNPRIVTHR; } -#endif +#endif /* CONFIG_NUTTX_KERNEL */ #endif /* CONFIG_ARMV7M_CMNVECTOR */ /* Enable or disable interrupts, based on user configuration */ #ifdef CONFIG_SUPPRESS_INTERRUPTS +#ifdef CONFIG_ARMV7M_USEBASEPRI + xcp->regs[REG_BASEPRI] = NVIC_SYSH_DISABLE_PRIORITY; +#else xcp->regs[REG_PRIMASK] = 1; #endif +#endif /* CONFIG_SUPPRESS_INTERRUPTS */ } diff --git a/nuttx/arch/arm/src/armv7-m/up_schedulesigaction.c b/nuttx/arch/arm/src/armv7-m/up_schedulesigaction.c index 9e6dbd14b4..9221a69a2e 100644 --- a/nuttx/arch/arm/src/armv7-m/up_schedulesigaction.c +++ b/nuttx/arch/arm/src/armv7-m/up_schedulesigaction.c @@ -1,7 +1,7 @@ /**************************************************************************** * arch/arm/src/armv7-m/up_schedulesigaction.c * - * Copyright (C) 2009-2012 Gregory Nutt. All rights reserved. + * Copyright (C) 2009-2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -155,7 +155,11 @@ void up_schedule_sigaction(_TCB *tcb, sig_deliver_t sigdeliver) tcb->xcp.sigdeliver = sigdeliver; tcb->xcp.saved_pc = current_regs[REG_PC]; +#ifdef CONFIG_ARMV7M_USEBASEPRI + tcb->xcp.saved_basepri = current_regs[REG_BASEPRI]; +#else tcb->xcp.saved_primask = current_regs[REG_PRIMASK]; +#endif tcb->xcp.saved_xpsr = current_regs[REG_XPSR]; /* Then set up to vector to the trampoline with interrupts @@ -163,7 +167,11 @@ void up_schedule_sigaction(_TCB *tcb, sig_deliver_t sigdeliver) */ current_regs[REG_PC] = (uint32_t)up_sigdeliver; +#ifdef CONFIG_ARMV7M_USEBASEPRI + current_regs[REG_BASEPRI] = NVIC_SYSH_DISABLE_PRIORITY; +#else current_regs[REG_PRIMASK] = 1; +#endif current_regs[REG_XPSR] = ARMV7M_XPSR_T; /* And make sure that the saved context in the TCB @@ -189,7 +197,11 @@ void up_schedule_sigaction(_TCB *tcb, sig_deliver_t sigdeliver) tcb->xcp.sigdeliver = sigdeliver; tcb->xcp.saved_pc = tcb->xcp.regs[REG_PC]; +#ifdef CONFIG_ARMV7M_USEBASEPRI + tcb->xcp.saved_basepri = tcb->xcp.regs[REG_BASEPRI]; +#else tcb->xcp.saved_primask = tcb->xcp.regs[REG_PRIMASK]; +#endif tcb->xcp.saved_xpsr = tcb->xcp.regs[REG_XPSR]; /* Then set up to vector to the trampoline with interrupts @@ -197,7 +209,11 @@ void up_schedule_sigaction(_TCB *tcb, sig_deliver_t sigdeliver) */ tcb->xcp.regs[REG_PC] = (uint32_t)up_sigdeliver; +#ifdef CONFIG_ARMV7M_USEBASEPRI + tcb->xcp.regs[REG_BASEPRI] = NVIC_SYSH_DISABLE_PRIORITY; +#else tcb->xcp.regs[REG_PRIMASK] = 1; +#endif tcb->xcp.regs[REG_XPSR] = ARMV7M_XPSR_T; } diff --git a/nuttx/arch/arm/src/armv7-m/up_sigdeliver.c b/nuttx/arch/arm/src/armv7-m/up_sigdeliver.c index 38673c41d4..654214b39c 100644 --- a/nuttx/arch/arm/src/armv7-m/up_sigdeliver.c +++ b/nuttx/arch/arm/src/armv7-m/up_sigdeliver.c @@ -1,7 +1,7 @@ /**************************************************************************** * arch/arm/src/armv7-m/up_sigdeliver.c * - * Copyright (C) 2009-2010 Gregory Nutt. All rights reserved. + * Copyright (C) 2009-2010, 2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -102,7 +102,11 @@ void up_sigdeliver(void) up_copystate(regs, rtcb->xcp.regs); regs[REG_PC] = rtcb->xcp.saved_pc; +#ifdef CONFIG_ARMV7M_USEBASEPRI + regs[REG_BASEPRI] = rtcb->xcp.saved_basepri; +#else regs[REG_PRIMASK] = rtcb->xcp.saved_primask; +#endif regs[REG_XPSR] = rtcb->xcp.saved_xpsr; /* Get a local copy of the sigdeliver function pointer. We do this so that @@ -115,7 +119,11 @@ void up_sigdeliver(void) /* Then restore the task interrupt state */ +#ifdef CONFIG_ARMV7M_USEBASEPRI + irqrestore((uint8_t)regs[REG_BASEPRI]); +#else irqrestore((uint16_t)regs[REG_PRIMASK]); +#endif /* Deliver the signals */ diff --git a/nuttx/arch/arm/src/kinetis/kinetis_irq.c b/nuttx/arch/arm/src/kinetis/kinetis_irq.c index 31310b03c1..37a6a4a63e 100644 --- a/nuttx/arch/arm/src/kinetis/kinetis_irq.c +++ b/nuttx/arch/arm/src/kinetis/kinetis_irq.c @@ -428,8 +428,7 @@ void up_irqinitialize(void) /* And finally, enable interrupts */ #ifndef CONFIG_SUPPRESS_INTERRUPTS - setbasepri(NVIC_SYSH_PRIORITY_MAX); - irqrestore(0); + irqenable(); #endif } diff --git a/nuttx/arch/arm/src/kinetis/kinetis_vectors.S b/nuttx/arch/arm/src/kinetis/kinetis_vectors.S index faa1ce7a78..7fa223615b 100644 --- a/nuttx/arch/arm/src/kinetis/kinetis_vectors.S +++ b/nuttx/arch/arm/src/kinetis/kinetis_vectors.S @@ -605,7 +605,11 @@ kinetis_common: mov r2, r1 /* R2=Copy of the main/process stack pointer */ add r2, #HW_XCPT_SIZE /* R2=MSP/PSP before the interrupt was taken */ +#ifdef CONFIG_ARMV7M_USEBASEPRI + mrs r3, basepri /* R3=Current BASEPRI setting */ +#else mrs r3, primask /* R3=Current PRIMASK setting */ +#endif #ifdef CONFIG_NUTTX_KERNEL stmdb r1!, {r2-r11,r14} /* Save the remaining registers plus the SP value */ #else @@ -691,7 +695,12 @@ kinetis_common: /* Restore the interrupt state */ +#ifdef CONFIG_ARMV7M_USEBASEPRI + msr basepri, r3 /* Restore interrupts priority masking*/ + cpsie i /* Re-enable interrupts */ +#else msr primask, r3 /* Restore interrupts */ +#endif /* Always return with R14 containing the special value that will: (1) * return to thread mode, and (2) continue to use the MSP diff --git a/nuttx/arch/arm/src/lm/lm_irq.c b/nuttx/arch/arm/src/lm/lm_irq.c index dc9997afa5..7d8d2135a0 100644 --- a/nuttx/arch/arm/src/lm/lm_irq.c +++ b/nuttx/arch/arm/src/lm/lm_irq.c @@ -379,8 +379,7 @@ void up_irqinitialize(void) /* And finally, enable interrupts */ - setbasepri(NVIC_SYSH_PRIORITY_MAX); - irqrestore(0); + irqenable(); #endif } diff --git a/nuttx/arch/arm/src/lm/lm_vectors.S b/nuttx/arch/arm/src/lm/lm_vectors.S index d3798fbb7b..1d3553b4e1 100644 --- a/nuttx/arch/arm/src/lm/lm_vectors.S +++ b/nuttx/arch/arm/src/lm/lm_vectors.S @@ -203,7 +203,11 @@ lm_irqcommon: mov r2, r1 /* R2=Copy of the main/process stack pointer */ add r2, #HW_XCPT_SIZE /* R2=MSP/PSP before the interrupt was taken */ +#ifdef CONFIG_ARMV7M_USEBASEPRI + mrs r3, basepri /* R3=Current BASEPRI setting */ +#else mrs r3, primask /* R3=Current PRIMASK setting */ +#endif #ifdef CONFIG_NUTTX_KERNEL stmdb r1!, {r2-r11,r14} /* Save the remaining registers plus the SP value */ #else @@ -289,7 +293,12 @@ lm_irqcommon: /* Restore the interrupt state */ +#ifdef CONFIG_ARMV7M_USEBASEPRI + msr basepri, r3 /* Restore interrupts priority masking*/ + cpsie i /* Re-enable interrupts */ +#else msr primask, r3 /* Restore interrupts */ +#endif /* Always return with R14 containing the special value that will: (1) * return to thread mode, and (2) continue to use the MSP diff --git a/nuttx/arch/arm/src/lpc17xx/lpc17_irq.c b/nuttx/arch/arm/src/lpc17xx/lpc17_irq.c index 2d66dd0b15..c9b289d4e2 100644 --- a/nuttx/arch/arm/src/lpc17xx/lpc17_irq.c +++ b/nuttx/arch/arm/src/lpc17xx/lpc17_irq.c @@ -374,8 +374,7 @@ void up_irqinitialize(void) /* And finally, enable interrupts */ #ifndef CONFIG_SUPPRESS_INTERRUPTS - setbasepri(NVIC_SYSH_PRIORITY_MAX); - irqrestore(0); + irqenable(); #endif } diff --git a/nuttx/arch/arm/src/lpc17xx/lpc17_vectors.S b/nuttx/arch/arm/src/lpc17xx/lpc17_vectors.S index 74e53b4115..e2cf91b1c6 100644 --- a/nuttx/arch/arm/src/lpc17xx/lpc17_vectors.S +++ b/nuttx/arch/arm/src/lpc17xx/lpc17_vectors.S @@ -217,7 +217,11 @@ lpc17_common: mov r2, r1 /* R2=Copy of the main/process stack pointer */ add r2, #HW_XCPT_SIZE /* R2=MSP/PSP before the interrupt was taken */ +#ifdef CONFIG_ARMV7M_USEBASEPRI + mrs r3, basepri /* R3=Current BASEPRI setting */ +#else mrs r3, primask /* R3=Current PRIMASK setting */ +#endif #ifdef CONFIG_NUTTX_KERNEL stmdb r1!, {r2-r11,r14} /* Save the remaining registers plus the SP value */ #else @@ -303,7 +307,12 @@ lpc17_common: /* Restore the interrupt state */ +#ifdef CONFIG_ARMV7M_USEBASEPRI + msr basepri, r3 /* Restore interrupts priority masking*/ + cpsie i /* Re-enable interrupts */ +#else msr primask, r3 /* Restore interrupts */ +#endif /* Always return with R14 containing the special value that will: (1) * return to thread mode, and (2) continue to use the MSP diff --git a/nuttx/arch/arm/src/lpc43xx/lpc43_irq.c b/nuttx/arch/arm/src/lpc43xx/lpc43_irq.c index 2fddd79ad9..1867aa1500 100644 --- a/nuttx/arch/arm/src/lpc43xx/lpc43_irq.c +++ b/nuttx/arch/arm/src/lpc43xx/lpc43_irq.c @@ -403,8 +403,7 @@ void up_irqinitialize(void) /* And finally, enable interrupts */ #ifndef CONFIG_SUPPRESS_INTERRUPTS - setbasepri(LPC43M4_SYSH_PRIORITY_MAX); - irqrestore(0); + irqenable(); #endif } diff --git a/nuttx/arch/arm/src/sam3u/sam3u_irq.c b/nuttx/arch/arm/src/sam3u/sam3u_irq.c index d9fd4dac8b..690a075efb 100644 --- a/nuttx/arch/arm/src/sam3u/sam3u_irq.c +++ b/nuttx/arch/arm/src/sam3u/sam3u_irq.c @@ -366,8 +366,7 @@ void up_irqinitialize(void) /* And finally, enable interrupts */ - setbasepri(NVIC_SYSH_PRIORITY_MAX); - irqrestore(0); + irqenable(); #endif } diff --git a/nuttx/arch/arm/src/sam3u/sam3u_vectors.S b/nuttx/arch/arm/src/sam3u/sam3u_vectors.S index 3ed17f7672..53e2f636c0 100644 --- a/nuttx/arch/arm/src/sam3u/sam3u_vectors.S +++ b/nuttx/arch/arm/src/sam3u/sam3u_vectors.S @@ -2,7 +2,7 @@ * arch/arm/src/sam3u/sam3u_vectors.S * arch/arm/src/chip/sam3u_vectors.S * - * Copyright (C) 2009-2010 Gregory Nutt. All rights reserved. + * Copyright (C) 2009-2010, 2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -249,7 +249,11 @@ sam3u_common: mov r2, r1 /* R2=Copy of the main/process stack pointer */ add r2, #HW_XCPT_SIZE /* R2=MSP/PSP before the interrupt was taken */ +#ifdef CONFIG_ARMV7M_USEBASEPRI + mrs r3, basepri /* R3=Current BASEPRI setting */ +#else mrs r3, primask /* R3=Current PRIMASK setting */ +#endif #ifdef CONFIG_NUTTX_KERNEL stmdb r1!, {r2-r11,r14} /* Save the remaining registers plus the SP value */ #else @@ -335,7 +339,12 @@ sam3u_common: /* Restore the interrupt state */ +#ifdef CONFIG_ARMV7M_USEBASEPRI + msr basepri, r3 /* Restore interrupts priority masking*/ + cpsie i /* Re-enable interrupts */ +#else msr primask, r3 /* Restore interrupts */ +#endif /* Always return with R14 containing the special value that will: (1) * return to thread mode, and (2) continue to use the MSP diff --git a/nuttx/arch/arm/src/stm32/stm32_irq.c b/nuttx/arch/arm/src/stm32/stm32_irq.c index 8f2b070fb8..bff3eb2b7d 100644 --- a/nuttx/arch/arm/src/stm32/stm32_irq.c +++ b/nuttx/arch/arm/src/stm32/stm32_irq.c @@ -397,8 +397,7 @@ void up_irqinitialize(void) /* And finally, enable interrupts */ - setbasepri(NVIC_SYSH_PRIORITY_MAX); - irqrestore(0); + irqenable(); #endif } diff --git a/nuttx/arch/arm/src/stm32/stm32_vectors.S b/nuttx/arch/arm/src/stm32/stm32_vectors.S index ab4dadb779..c9b62d7627 100644 --- a/nuttx/arch/arm/src/stm32/stm32_vectors.S +++ b/nuttx/arch/arm/src/stm32/stm32_vectors.S @@ -2,7 +2,7 @@ * arch/arm/src/stm32/stm32_vectors.S * arch/arm/src/chip/stm32_vectors.S * - * Copyright (C) 2009-2012 Gregory Nutt. All rights reserved. + * Copyright (C) 2009-2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -235,7 +235,11 @@ stm32_common: mov r2, r1 /* R2=Copy of the main/process stack pointer */ add r2, #HW_XCPT_SIZE /* R2=MSP/PSP before the interrupt was taken */ +#ifdef CONFIG_ARMV7M_USEBASEPRI + mrs r3, basepri /* R3=Current BASEPRI setting */ +#else mrs r3, primask /* R3=Current PRIMASK setting */ +#endif #ifdef CONFIG_ARCH_FPU /* Skip over the block of memory reserved for floating pointer register save. @@ -248,8 +252,8 @@ stm32_common: #endif /* Save the the remaining registers on the stack after the registers pushed - * by the exception handling logic. r2=SP and r3=primask, r4-r11,r14=register - * values. + * by the exception handling logic. r2=SP and r3=primask or basepri, r4-r11, + * r14=register values. */ #ifdef CONFIG_NUTTX_KERNEL @@ -349,7 +353,7 @@ stm32_common: * Here: * r1 = Address on the target thread's stack position at the start of * the registers saved by hardware - * r3 = primask + * r3 = primask or basepri * r4-r11 = restored register values */ 2: @@ -375,7 +379,12 @@ stm32_common: /* Restore the interrupt state */ +#ifdef CONFIG_ARMV7M_USEBASEPRI + msr basepri, r3 /* Restore interrupts priority masking*/ + cpsie i /* Re-enable interrupts */ +#else msr primask, r3 /* Restore interrupts */ +#endif /* Always return with R14 containing the special value that will: (1) * return to thread mode, and (2) continue to use the MSP From 7dad51762decebe5d104fe7dad9eb23680cabd23 Mon Sep 17 00:00:00 2001 From: patacongo Date: Tue, 22 Jan 2013 16:09:10 +0000 Subject: [PATCH 106/118] Use of BASEPRI to control ARM interrupts is now functional git-svn-id: http://svn.code.sf.net/p/nuttx/code/trunk@5548 42af7a65-404d-4744-a932-0658087f49c3 --- nuttx/arch/arm/src/kinetis/kinetis_irq.c | 32 ++++++++++----------- nuttx/arch/arm/src/lm/lm_irq.c | 32 ++++++++++----------- nuttx/arch/arm/src/lpc17xx/lpc17_ethernet.c | 21 ++++++++++++-- nuttx/arch/arm/src/lpc17xx/lpc17_irq.c | 32 ++++++++++----------- nuttx/arch/arm/src/lpc43xx/lpc43_irq.c | 32 ++++++++++----------- nuttx/arch/arm/src/sam3u/sam3u_irq.c | 32 ++++++++++----------- nuttx/arch/arm/src/stm32/stm32_irq.c | 32 ++++++++++----------- 7 files changed, 115 insertions(+), 98 deletions(-) diff --git a/nuttx/arch/arm/src/kinetis/kinetis_irq.c b/nuttx/arch/arm/src/kinetis/kinetis_irq.c index 37a6a4a63e..b0aea55d15 100644 --- a/nuttx/arch/arm/src/kinetis/kinetis_irq.c +++ b/nuttx/arch/arm/src/kinetis/kinetis_irq.c @@ -209,7 +209,7 @@ static int kinetis_reserved(int irq, FAR void *context) #endif /**************************************************************************** - * Name: up_prioritize_irq + * Name: kinetis_prioritize_syscall * * Description: * Set the priority of an exception. This function may be needed @@ -217,23 +217,17 @@ static int kinetis_reserved(int irq, FAR void *context) * ****************************************************************************/ -#if !defined(CONFIG_ARCH_IRQPRIO) && defined(CONFIG_ARMV7M_USEBASEPRI) -static int up_prioritize_irq(int irq, int priority) +#ifdef CONFIG_ARMV7M_USEBASEPRI +static inline void kinetis_prioritize_syscall(int priority) { - uint32_t regaddr; uint32_t regval; - int shift; - irq -= 4; - regaddr = NVIC_SYSH_PRIORITY(irq); - regval = getreg32(regaddr); - shift = ((irq & 3) << 3); - regval &= ~(0xff << shift); - regval |= (priority << shift); - putreg32(regval, regaddr); + /* SVCALL is system handler 11 */ - stm32_dumpnvic("prioritize", irq); - return OK; + regval = getreg32(NVIC_SYSH8_11_PRIORITY); + regval &= ~NVIC_SYSH_PRIORITY_PR11_MASK; + regval |= (priority << NVIC_SYSH_PRIORITY_PR11_SHIFT); + putreg32(regval, NVIC_SYSH8_11_PRIORITY); } #endif @@ -389,7 +383,7 @@ void up_irqinitialize(void) /* up_prioritize_irq(KINETIS_IRQ_PENDSV, NVIC_SYSH_PRIORITY_MIN); */ #endif #ifdef CONFIG_ARMV7M_USEBASEPRI - up_prioritize_irq(KINETIS_IRQ_SVCALL, NVIC_SYSH_SVCALL_PRIORITY); + kinetis_prioritize_syscall(NVIC_SYSH_SVCALL_PRIORITY); #endif /* If the MPU is enabled, then attach and enable the Memory Management @@ -528,11 +522,17 @@ int up_prioritize_irq(int irq, int priority) if (irq < KINETIS_IRQ_EXTINT) { - irq -= 4; + /* NVIC_SYSH_PRIORITY() maps {0..15} to one of three priority + * registers (0-3 are invalid) + */ + regaddr = NVIC_SYSH_PRIORITY(irq); + irq -= 4; } else { + /* NVIC_IRQ_PRIORITY() maps {0..} to one of many priority registers */ + irq -= KINETIS_IRQ_EXTINT; regaddr = NVIC_IRQ_PRIORITY(irq); } diff --git a/nuttx/arch/arm/src/lm/lm_irq.c b/nuttx/arch/arm/src/lm/lm_irq.c index 7d8d2135a0..d8c0852ed6 100644 --- a/nuttx/arch/arm/src/lm/lm_irq.c +++ b/nuttx/arch/arm/src/lm/lm_irq.c @@ -191,7 +191,7 @@ static int lm_reserved(int irq, FAR void *context) #endif /**************************************************************************** - * Name: up_prioritize_irq + * Name: lm_prioritize_syscall * * Description: * Set the priority of an exception. This function may be needed @@ -199,23 +199,17 @@ static int lm_reserved(int irq, FAR void *context) * ****************************************************************************/ -#if !defined(CONFIG_ARCH_IRQPRIO) && defined(CONFIG_ARMV7M_USEBASEPRI) -static int up_prioritize_irq(int irq, int priority) +#ifdef CONFIG_ARMV7M_USEBASEPRI +static inline void lm_prioritize_syscall(int priority) { - uint32_t regaddr; uint32_t regval; - int shift; - irq -= 4; - regaddr = NVIC_SYSH_PRIORITY(irq); - regval = getreg32(regaddr); - shift = ((irq & 3) << 3); - regval &= ~(0xff << shift); - regval |= (priority << shift); - putreg32(regval, regaddr); + /* SVCALL is system handler 11 */ - stm32_dumpnvic("prioritize", irq); - return OK; + regval = getreg32(NVIC_SYSH8_11_PRIORITY); + regval &= ~NVIC_SYSH_PRIORITY_PR11_MASK; + regval |= (priority << NVIC_SYSH_PRIORITY_PR11_SHIFT); + putreg32(regval, NVIC_SYSH8_11_PRIORITY); } #endif @@ -347,7 +341,7 @@ void up_irqinitialize(void) /* up_prioritize_irq(LM_IRQ_PENDSV, NVIC_SYSH_PRIORITY_MIN); */ #endif #ifdef CONFIG_ARMV7M_USEBASEPRI - up_prioritize_irq(LM_IRQ_SVCALL, NVIC_SYSH_SVCALL_PRIORITY); + lm_prioritize_syscall(NVIC_SYSH_SVCALL_PRIORITY); #endif /* If the MPU is enabled, then attach and enable the Memory Management @@ -475,11 +469,17 @@ int up_prioritize_irq(int irq, int priority) if (irq < LM_IRQ_INTERRUPTS) { - irq -= 4; + /* NVIC_SYSH_PRIORITY() maps {0..15} to one of three priority + * registers (0-3 are invalid) + */ + regaddr = NVIC_SYSH_PRIORITY(irq); + irq -= 4; } else { + /* NVIC_IRQ_PRIORITY() maps {0..} to one of many priority registers */ + irq -= LM_IRQ_INTERRUPTS; regaddr = NVIC_IRQ_PRIORITY(irq); } diff --git a/nuttx/arch/arm/src/lpc17xx/lpc17_ethernet.c b/nuttx/arch/arm/src/lpc17xx/lpc17_ethernet.c index bf6d18287b..0241d4bf73 100644 --- a/nuttx/arch/arm/src/lpc17xx/lpc17_ethernet.c +++ b/nuttx/arch/arm/src/lpc17xx/lpc17_ethernet.c @@ -104,11 +104,28 @@ #endif /* If the user did not specify a priority for Ethernet interrupts, set the - * interrupt priority to the maximum. + * interrupt priority to the maximum (unless CONFIG_ARMV7M_USEBASEPRI is + * defined, then set it to the maximum allowable priority). */ #ifndef CONFIG_NET_PRIORITY -# define CONFIG_NET_PRIORITY NVIC_SYSH_PRIORITY_MAX +# ifdef CONFIG_ARMV7M_USEBASEPRI +# define CONFIG_NET_PRIORITY NVIC_SYSH_DISABLE_PRIORITY +# else +# define CONFIG_NET_PRIORITY NVIC_SYSH_PRIORITY_MAX +# endif +#endif + +/* If the priority is set at the max (0) and CONFIG_ARMV7M_USEBASEPRI is + * defined, then silently drop the priority to NVIC_SYSH_DISABLE_PRIORITY. + * In this configuratin, nothing is permitted to run at priority zero + * except for the SVCALL handler. NVIC_SYSH_DISABLE_PRIORITY is the + * maximum allowable priority in that case. + */ + +#if CONFIG_NET_PRIORITY == 0 && defined(CONFIG_ARMV7M_USEBASEPRI) +# undef CONFIG_NET_PRIORITY +# define CONFIG_NET_PRIORITY NVIC_SYSH_DISABLE_PRIORITY #endif /* Debug Configuration *****************************************************/ diff --git a/nuttx/arch/arm/src/lpc17xx/lpc17_irq.c b/nuttx/arch/arm/src/lpc17xx/lpc17_irq.c index c9b289d4e2..6d96ff386c 100644 --- a/nuttx/arch/arm/src/lpc17xx/lpc17_irq.c +++ b/nuttx/arch/arm/src/lpc17xx/lpc17_irq.c @@ -190,7 +190,7 @@ static int lpc17_reserved(int irq, FAR void *context) #endif /**************************************************************************** - * Name: up_prioritize_irq + * Name: lpc17_prioritize_syscall * * Description: * Set the priority of an exception. This function may be needed @@ -198,23 +198,17 @@ static int lpc17_reserved(int irq, FAR void *context) * ****************************************************************************/ -#if !defined(CONFIG_ARCH_IRQPRIO) && defined(CONFIG_ARMV7M_USEBASEPRI) -static int up_prioritize_irq(int irq, int priority) +#ifdef CONFIG_ARMV7M_USEBASEPRI +static inline void lpc17_prioritize_syscall(int priority) { - uint32_t regaddr; uint32_t regval; - int shift; - irq -= 4; - regaddr = NVIC_SYSH_PRIORITY(irq); - regval = getreg32(regaddr); - shift = ((irq & 3) << 3); - regval &= ~(0xff << shift); - regval |= (priority << shift); - putreg32(regval, regaddr); + /* SVCALL is system handler 11 */ - stm32_dumpnvic("prioritize", irq); - return OK; + regval = getreg32(NVIC_SYSH8_11_PRIORITY); + regval &= ~NVIC_SYSH_PRIORITY_PR11_MASK; + regval |= (priority << NVIC_SYSH_PRIORITY_PR11_SHIFT); + putreg32(regval, NVIC_SYSH8_11_PRIORITY); } #endif @@ -335,7 +329,7 @@ void up_irqinitialize(void) /* up_prioritize_irq(LPC17_IRQ_PENDSV, NVIC_SYSH_PRIORITY_MIN); */ #endif #ifdef CONFIG_ARMV7M_USEBASEPRI - up_prioritize_irq(LPC17_IRQ_SVCALL, NVIC_SYSH_SVCALL_PRIORITY); + lpc17_prioritize_syscall(NVIC_SYSH_SVCALL_PRIORITY); #endif /* If the MPU is enabled, then attach and enable the Memory Management @@ -490,11 +484,17 @@ int up_prioritize_irq(int irq, int priority) if (irq < LPC17_IRQ_EXTINT) { - irq -= 4; + /* NVIC_SYSH_PRIORITY() maps {0..15} to one of three priority + * registers (0-3 are invalid) + */ + regaddr = NVIC_SYSH_PRIORITY(irq); + irq -= 4; } else { + /* NVIC_IRQ_PRIORITY() maps {0..} to one of many priority registers */ + irq -= LPC17_IRQ_EXTINT; regaddr = NVIC_IRQ_PRIORITY(irq); } diff --git a/nuttx/arch/arm/src/lpc43xx/lpc43_irq.c b/nuttx/arch/arm/src/lpc43xx/lpc43_irq.c index 1867aa1500..aa0e4cf096 100644 --- a/nuttx/arch/arm/src/lpc43xx/lpc43_irq.c +++ b/nuttx/arch/arm/src/lpc43xx/lpc43_irq.c @@ -192,7 +192,7 @@ static int lpc43_reserved(int irq, FAR void *context) #endif /**************************************************************************** - * Name: up_prioritize_irq + * Name: lpc43_prioritize_syscall * * Description: * Set the priority of an exception. This function may be needed @@ -200,23 +200,17 @@ static int lpc43_reserved(int irq, FAR void *context) * ****************************************************************************/ -#if !defined(CONFIG_ARCH_IRQPRIO) && defined(CONFIG_ARMV7M_USEBASEPRI) -static int up_prioritize_irq(int irq, int priority) +#ifdef CONFIG_ARMV7M_USEBASEPRI +static inline void lpc43_prioritize_syscall(int priority) { - uint32_t regaddr; uint32_t regval; - int shift; - irq -= 4; - regaddr = NVIC_SYSH_PRIORITY(irq); - regval = getreg32(regaddr); - shift = ((irq & 3) << 3); - regval &= ~(0xff << shift); - regval |= (priority << shift); - putreg32(regval, regaddr); + /* SVCALL is system handler 11 */ - stm32_dumpnvic("prioritize", irq); - return OK; + regval = getreg32(NVIC_SYSH8_11_PRIORITY); + regval &= ~NVIC_SYSH_PRIORITY_PR11_MASK; + regval |= (priority << NVIC_SYSH_PRIORITY_PR11_SHIFT); + putreg32(regval, NVIC_SYSH8_11_PRIORITY); } #endif @@ -364,7 +358,7 @@ void up_irqinitialize(void) /* up_prioritize_irq(LPC43_IRQ_PENDSV, NVIC_SYSH_PRIORITY_MIN); */ #endif #ifdef CONFIG_ARMV7M_USEBASEPRI - up_prioritize_irq(LPC43_IRQ_SVCALL, NVIC_SYSH_SVCALL_PRIORITY); + lpc43_prioritize_syscall(NVIC_SYSH_SVCALL_PRIORITY); #endif /* If the MPU is enabled, then attach and enable the Memory Management @@ -519,11 +513,17 @@ int up_prioritize_irq(int irq, int priority) if (irq < LPC43_IRQ_EXTINT) { - irq -= 4; + /* NVIC_SYSH_PRIORITY() maps {0..15} to one of three priority + * registers (0-3 are invalid) + */ + regaddr = NVIC_SYSH_PRIORITY(irq); + irq -= 4; } else { + /* NVIC_IRQ_PRIORITY() maps {0..} to one of many priority registers */ + irq -= LPC43_IRQ_EXTINT; regaddr = NVIC_IRQ_PRIORITY(irq); } diff --git a/nuttx/arch/arm/src/sam3u/sam3u_irq.c b/nuttx/arch/arm/src/sam3u/sam3u_irq.c index 690a075efb..ed424f91d3 100644 --- a/nuttx/arch/arm/src/sam3u/sam3u_irq.c +++ b/nuttx/arch/arm/src/sam3u/sam3u_irq.c @@ -185,7 +185,7 @@ static int sam3u_reserved(int irq, FAR void *context) #endif /**************************************************************************** - * Name: up_prioritize_irq + * Name: sam3u_prioritize_syscall * * Description: * Set the priority of an exception. This function may be needed @@ -193,23 +193,17 @@ static int sam3u_reserved(int irq, FAR void *context) * ****************************************************************************/ -#if !defined(CONFIG_ARCH_IRQPRIO) && defined(CONFIG_ARMV7M_USEBASEPRI) -static int up_prioritize_irq(int irq, int priority) +#ifdef CONFIG_ARMV7M_USEBASEPRI +static inline void sam3u_prioritize_syscall(int priority) { - uint32_t regaddr; uint32_t regval; - int shift; - irq -= 4; - regaddr = NVIC_SYSH_PRIORITY(irq); - regval = getreg32(regaddr); - shift = ((irq & 3) << 3); - regval &= ~(0xff << shift); - regval |= (priority << shift); - putreg32(regval, regaddr); + /* SVCALL is system handler 11 */ - stm32_dumpnvic("prioritize", irq); - return OK; + regval = getreg32(NVIC_SYSH8_11_PRIORITY); + regval &= ~NVIC_SYSH_PRIORITY_PR11_MASK; + regval |= (priority << NVIC_SYSH_PRIORITY_PR11_SHIFT); + putreg32(regval, NVIC_SYSH8_11_PRIORITY); } #endif @@ -326,7 +320,7 @@ void up_irqinitialize(void) /* up_prioritize_irq(SAM3U_IRQ_PENDSV, NVIC_SYSH_PRIORITY_MIN); */ #endif #ifdef CONFIG_ARMV7M_USEBASEPRI - up_prioritize_irq(SAM3U_IRQ_SVCALL, NVIC_SYSH_SVCALL_PRIORITY); + sam3u_prioritize_syscall(NVIC_SYSH_SVCALL_PRIORITY); #endif /* If the MPU is enabled, then attach and enable the Memory Management @@ -478,11 +472,17 @@ int up_prioritize_irq(int irq, int priority) if (irq < SAM3U_IRQ_EXTINT) { - irq -= 4; + /* NVIC_SYSH_PRIORITY() maps {0..15} to one of three priority + * registers (0-3 are invalid) + */ + regaddr = NVIC_SYSH_PRIORITY(irq); + irq -= 4; } else { + /* NVIC_IRQ_PRIORITY() maps {0..} to one of many priority registers */ + irq -= SAM3U_IRQ_EXTINT; regaddr = NVIC_IRQ_PRIORITY(irq); } diff --git a/nuttx/arch/arm/src/stm32/stm32_irq.c b/nuttx/arch/arm/src/stm32/stm32_irq.c index bff3eb2b7d..a952c2486c 100644 --- a/nuttx/arch/arm/src/stm32/stm32_irq.c +++ b/nuttx/arch/arm/src/stm32/stm32_irq.c @@ -195,7 +195,7 @@ static int stm32_reserved(int irq, FAR void *context) #endif /**************************************************************************** - * Name: up_prioritize_irq + * Name: stm32_prioritize_syscall * * Description: * Set the priority of an exception. This function may be needed @@ -203,23 +203,17 @@ static int stm32_reserved(int irq, FAR void *context) * ****************************************************************************/ -#if !defined(CONFIG_ARCH_IRQPRIO) && defined(CONFIG_ARMV7M_USEBASEPRI) -static int up_prioritize_irq(int irq, int priority) +#ifdef CONFIG_ARMV7M_USEBASEPRI +static inline void stm32_prioritize_syscall(int priority) { - uint32_t regaddr; uint32_t regval; - int shift; - irq -= 4; - regaddr = NVIC_SYSH_PRIORITY(irq); - regval = getreg32(regaddr); - shift = ((irq & 3) << 3); - regval &= ~(0xff << shift); - regval |= (priority << shift); - putreg32(regval, regaddr); + /* SVCALL is system handler 11 */ - stm32_dumpnvic("prioritize", irq); - return OK; + regval = getreg32(NVIC_SYSH8_11_PRIORITY); + regval &= ~NVIC_SYSH_PRIORITY_PR11_MASK; + regval |= (priority << NVIC_SYSH_PRIORITY_PR11_SHIFT); + putreg32(regval, NVIC_SYSH8_11_PRIORITY); } #endif @@ -365,7 +359,7 @@ void up_irqinitialize(void) /* up_prioritize_irq(STM32_IRQ_PENDSV, NVIC_SYSH_PRIORITY_MIN); */ #endif #ifdef CONFIG_ARMV7M_USEBASEPRI - up_prioritize_irq(STM32_IRQ_SVCALL, NVIC_SYSH_SVCALL_PRIORITY); + stm32_prioritize_syscall(NVIC_SYSH_SVCALL_PRIORITY); #endif /* If the MPU is enabled, then attach and enable the Memory Management @@ -493,11 +487,17 @@ int up_prioritize_irq(int irq, int priority) if (irq < STM32_IRQ_INTERRUPTS) { - irq -= 4; + /* NVIC_SYSH_PRIORITY() maps {0..15} to one of three priority + * registers (0-3 are invalid) + */ + regaddr = NVIC_SYSH_PRIORITY(irq); + irq -= 4; } else { + /* NVIC_IRQ_PRIORITY() maps {0..} to one of many priority registers */ + irq -= STM32_IRQ_INTERRUPTS; regaddr = NVIC_IRQ_PRIORITY(irq); } From 336f91b4e6b029e4fd76783931e3d6bd6b879d5f Mon Sep 17 00:00:00 2001 From: patacongo Date: Tue, 22 Jan 2013 23:42:51 +0000 Subject: [PATCH 107/118] lpc1788 update from Rommel Marcelo; Beginning of logic to retain child exit status git-svn-id: http://svn.code.sf.net/p/nuttx/code/trunk@5549 42af7a65-404d-4744-a932-0658087f49c3 --- .../arm/src/lpc17xx/chip/lpc176x_pinconn.h | 635 ++++++++++++++++++ .../arm/src/lpc17xx/chip/lpc178x_memorymap.h | 2 +- .../arm/src/lpc17xx/chip/lpc178x_pinconfig.h | 358 +++++----- .../arch/arm/src/lpc17xx/chip/lpc17_pinconn.h | 582 +--------------- nuttx/arch/arm/src/lpc17xx/lpc17_gpio.h | 52 +- nuttx/include/nuttx/sched.h | 70 +- nuttx/include/sched.h | 65 +- nuttx/sched/Makefile | 5 +- nuttx/sched/os_internal.h | 12 +- nuttx/sched/os_start.c | 11 + nuttx/sched/sched_waitid.c | 2 +- nuttx/sched/task_childstatus.c | 365 ++++++++++ 12 files changed, 1331 insertions(+), 828 deletions(-) create mode 100644 nuttx/arch/arm/src/lpc17xx/chip/lpc176x_pinconn.h create mode 100644 nuttx/sched/task_childstatus.c diff --git a/nuttx/arch/arm/src/lpc17xx/chip/lpc176x_pinconn.h b/nuttx/arch/arm/src/lpc17xx/chip/lpc176x_pinconn.h new file mode 100644 index 0000000000..6d5b05ba9e --- /dev/null +++ b/nuttx/arch/arm/src/lpc17xx/chip/lpc176x_pinconn.h @@ -0,0 +1,635 @@ +/************************************************************************************ + * arch/arm/src/lpc17xx/chip/lpc176x_pinconn.h + * + * Copyright (C) 2010, 2013 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * 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. + * + ************************************************************************************/ + +#ifndef __ARCH_ARM_SRC_LPC17XX_CHIP_LPC176X_PINCONN_H +#define __ARCH_ARM_SRC_LPC17XX_CHIP_LPC176X_PINCONN_H + +/************************************************************************************ + * Included Files + ************************************************************************************/ + +#include + +#include "chip.h" +#include "chip/lpc17_memorymap.h" + +/************************************************************************************ + * Pre-processor Definitions + ************************************************************************************/ + +/* Register offsets *****************************************************************/ + +#define LPC17_PINCONN_PINSEL0_OFFSET 0x0000 /* Pin function select register 0 */ +#define LPC17_PINCONN_PINSEL1_OFFSET 0x0004 /* Pin function select register 1 */ +#define LPC17_PINCONN_PINSEL2_OFFSET 0x0008 /* Pin function select register 2 */ +#define LPC17_PINCONN_PINSEL3_OFFSET 0x000c /* Pin function select register 3 */ +#define LPC17_PINCONN_PINSEL4_OFFSET 0x0010 /* Pin function select register 4 */ +#define LPC17_PINCONN_PINSEL7_OFFSET 0x001c /* Pin function select register 7 */ +#define LPC17_PINCONN_PINSEL8_OFFSET 0x0020 /* Pin function select register 8 */ +#define LPC17_PINCONN_PINSEL9_OFFSET 0x0024 /* Pin function select register 9 */ +#define LPC17_PINCONN_PINSEL10_OFFSET 0x0028 /* Pin function select register 10 */ +#define LPC17_PINCONN_PINMODE0_OFFSET 0x0040 /* Pin mode select register 0 */ +#define LPC17_PINCONN_PINMODE1_OFFSET 0x0044 /* Pin mode select register 1 */ +#define LPC17_PINCONN_PINMODE2_OFFSET 0x0048 /* Pin mode select register 2 */ +#define LPC17_PINCONN_PINMODE3_OFFSET 0x004c /* Pin mode select register 3 */ +#define LPC17_PINCONN_PINMODE4_OFFSET 0x0050 /* Pin mode select register 4 */ +#define LPC17_PINCONN_PINMODE5_OFFSET 0x0054 /* Pin mode select register 5 */ +#define LPC17_PINCONN_PINMODE6_OFFSET 0x0058 /* Pin mode select register 6 */ +#define LPC17_PINCONN_PINMODE7_OFFSET 0x005c /* Pin mode select register 7 */ +#define LPC17_PINCONN_PINMODE9_OFFSET 0x0064 /* Pin mode select register 9 */ +#define LPC17_PINCONN_ODMODE0_OFFSET 0x0068 /* Open drain mode control register 0 */ +#define LPC17_PINCONN_ODMODE1_OFFSET 0x006c /* Open drain mode control register 1 */ +#define LPC17_PINCONN_ODMODE2_OFFSET 0x0070 /* Open drain mode control register 2 */ +#define LPC17_PINCONN_ODMODE3_OFFSET 0x0074 /* Open drain mode control register 3 */ +#define LPC17_PINCONN_ODMODE4_OFFSET 0x0078 /* Open drain mode control register 4 */ +#define LPC17_PINCONN_I2CPADCFG_OFFSET 0x007c /* I2C Pin Configuration register */ + +/* Register addresses ***************************************************************/ + +#define LPC17_PINCONN_PINSEL0 (LPC17_PINCONN_BASE+LPC17_PINCONN_PINSEL0_OFFSET) +#define LPC17_PINCONN_PINSEL1 (LPC17_PINCONN_BASE+LPC17_PINCONN_PINSEL1_OFFSET) +#define LPC17_PINCONN_PINSEL2 (LPC17_PINCONN_BASE+LPC17_PINCONN_PINSEL2_OFFSET) +#define LPC17_PINCONN_PINSEL3 (LPC17_PINCONN_BASE+LPC17_PINCONN_PINSEL3_OFFSET) +#define LPC17_PINCONN_PINSEL4 (LPC17_PINCONN_BASE+LPC17_PINCONN_PINSEL4_OFFSET) +#define LPC17_PINCONN_PINSEL7 (LPC17_PINCONN_BASE+LPC17_PINCONN_PINSEL7_OFFSET) +#define LPC17_PINCONN_PINSEL8 (LPC17_PINCONN_BASE+LPC17_PINCONN_PINSEL8_OFFSET) +#define LPC17_PINCONN_PINSEL9 (LPC17_PINCONN_BASE+LPC17_PINCONN_PINSEL9_OFFSET) +#define LPC17_PINCONN_PINSEL10 (LPC17_PINCONN_BASE+LPC17_PINCONN_PINSEL10_OFFSET) +#define LPC17_PINCONN_PINMODE0 (LPC17_PINCONN_BASE+LPC17_PINCONN_PINMODE0_OFFSET) +#define LPC17_PINCONN_PINMODE1 (LPC17_PINCONN_BASE+LPC17_PINCONN_PINMODE1_OFFSET) +#define LPC17_PINCONN_PINMODE2 (LPC17_PINCONN_BASE+LPC17_PINCONN_PINMODE2_OFFSET) +#define LPC17_PINCONN_PINMODE3 (LPC17_PINCONN_BASE+LPC17_PINCONN_PINMODE3_OFFSET) +#define LPC17_PINCONN_PINMODE4 (LPC17_PINCONN_BASE+LPC17_PINCONN_PINMODE4_OFFSET) +#define LPC17_PINCONN_PINMODE5 (LPC17_PINCONN_BASE+LPC17_PINCONN_PINMODE5_OFFSET) +#define LPC17_PINCONN_PINMODE6 (LPC17_PINCONN_BASE+LPC17_PINCONN_PINMODE6_OFFSET) +#define LPC17_PINCONN_PINMODE7 (LPC17_PINCONN_BASE+LPC17_PINCONN_PINMODE7_OFFSET) +#define LPC17_PINCONN_PINMODE9 (LPC17_PINCONN_BASE+LPC17_PINCONN_PINMODE9_OFFSET) +#define LPC17_PINCONN_ODMODE0 (LPC17_PINCONN_BASE+LPC17_PINCONN_ODMODE0_OFFSET) +#define LPC17_PINCONN_ODMODE1 (LPC17_PINCONN_BASE+LPC17_PINCONN_ODMODE1_OFFSET) +#define LPC17_PINCONN_ODMODE2 (LPC17_PINCONN_BASE+LPC17_PINCONN_ODMODE2_OFFSET) +#define LPC17_PINCONN_ODMODE3 (LPC17_PINCONN_BASE+LPC17_PINCONN_ODMODE3_OFFSET) +#define LPC17_PINCONN_ODMODE4 (LPC17_PINCONN_BASE+LPC17_PINCONN_ODMODE4_OFFSET) +#define LPC17_PINCONN_I2CPADCFG (LPC17_PINCONN_BASE+LPC17_PINCONN_I2CPADCFG_OFFSET) + +/* Register bit definitions *********************************************************/ +/* Pin Function Select register 0 (PINSEL0: 0x4002c000) */ + +#define PINCONN_PINSEL_GPIO (0) +#define PINCONN_PINSEL_ALT1 (1) +#define PINCONN_PINSEL_ALT2 (2) +#define PINCONN_PINSEL_ALT3 (3) +#define PINCONN_PINSEL_MASK (3) + +#define PINCONN_PINSELL_SHIFT(n) ((n) << 1) /* n=0,1,..,15 */ +#define PINCONN_PINSELL_MASK(n) (3 << PINCONN_PINSELL_SHIFT(n)) +#define PINCONN_PINSELH_SHIFT(n) (((n)-16) << 1) /* n=16,17,..31 */ +#define PINCONN_PINSELH_MASK(n) (3 << PINCONN_PINSELH_SHIFT(n)) + +#define PINCONN_PINSEL0_P0_SHIFT(n) PINCONN_PINSELL_SHIFT(n) /* n=0,1,..,15 */ +#define PINCONN_PINSEL0_P0_MASK(n) PINCONN_PINSELL_MASK(n) /* n=0,1,..,15 */ + +#define PINCONN_PINSEL0_P0p0_SHIFT (0) /* Bits 0-1: P0.0 00=GPIO 01=RD1 10=TXD3 11=SDA1 */ +#define PINCONN_PINSEL0_P0p0_MASK (3 << PINCONN_PINSEL0_P0p0_SHIFT) +#define PINCONN_PINSEL0_P0p1_SHIFT (2) /* Bits 2-3: P0.1 00=GPIO 01=TD1 10=RXD3 11=SCL1 */ +#define PINCONN_PINSEL0_P0p1_MASK (3 << PINCONN_PINSEL0_P0p1_SHIFT) +#define PINCONN_PINSEL0_P0p2_SHIFT (4) /* Bits 4-5: P0.2 00=GPIO 01=TXD0 10=AD0.7 11=Reserved */ +#define PINCONN_PINSEL0_P0p2_MASK (3 << PINCONN_PINSEL0_P0p2_SHIFT) +#define PINCONN_PINSEL0_P0p3_SHIFT (6) /* Bits 6-7: P0.3 00=GPIO 01=RXD0 10=AD0.6 11=Reserved */ +#define PINCONN_PINSEL0_P0p3_MASK (3 << PINCONN_PINSEL0_P0p3_SHIFT) +#define PINCONN_PINSEL0_P0p4_SHIFT (8) /* Bits 8-9: P0.4 00=GPIO 01=I2SRX_CLK 10=RD2 11=CAP2.0 */ +#define PINCONN_PINSEL0_P0p4_MASK (3 << PINCONN_PINSEL0_P0p4_SHIFT) +#define PINCONN_PINSEL0_P0p5_SHIFT (10) /* Bits 10-11: P0.5 00=GPIO 01=I2SRX_WS 10=TD2 11=CAP2.1 */ +#define PINCONN_PINSEL0_P0p5_MASK (3 << PINCONN_PINSEL0_P0p5_SHIFT) +#define PINCONN_PINSEL0_P0p6_SHIFT (12) /* Bits 12-13: P0.6 00=GPIO 01=I2SRX_SDA 10=SSEL1 11=MAT2.0 */ +#define PINCONN_PINSEL0_P0p6_MASK (3 << PINCONN_PINSEL0_P0p6_SHIFT) +#define PINCONN_PINSEL0_P0p7_SHIFT (14) /* Bits 14-15: P0.7 00=GPIO 01=I2STX_CLK 10=SCK1 11=MAT2.1 */ +#define PINCONN_PINSEL0_P0p7_MASK (3 << PINCONN_PINSEL0_P0p7_SHIFT) +#define PINCONN_PINSEL0_P0p8_SHIFT (16) /* Bits 16-17: P0.8 00=GPIO 01=I2STX_WS 10=MISO1 11=MAT2.2 */ +#define PINCONN_PINSEL0_P0p8_MASK (3 << PINCONN_PINSEL0_P0p8_SHIFT) +#define PINCONN_PINSEL0_P0p9_SHIFT (18) /* Bits 18-19: P0.9 00=GPIO 01=I2STX_SDA 10=MOSI1 11=MAT2.3 */ +#define PINCONN_PINSEL0_P0p9_MASK (3 << PINCONN_PINSEL0_P0p9_SHIFT) +#define PINCONN_PINSEL0_P0p10_SHIFT (20) /* Bits 20-21: P0.10 00=GPIO 01=TXD2 10=SDA2 11=MAT3.0 */ +#define PINCONN_PINSEL0_P0p10_MASK (3 << PINCONN_PINSEL0_P0p10_SHIFT) +#define PINCONN_PINSEL0_P0p11_SHIFT (22) /* Bits 22-23: P0.11 00=GPIO 01=RXD2 10=SCL2 11=MAT3.1 */ +#define PINCONN_PINSEL0_P0p11_MASK (3 << PINCONN_PINSEL0_P0p11_SHIFT) + /* Bits 24-29: Reserved */ +#define PINCONN_PINSEL0_P0p15_SHIFT (30) /* Bits 30-31: P0.15 00=GPIO 01=TXD1 10=SCK0 11=SCK */ +#define PINCONN_PINSEL0_P0p15_MASK (3 << PINCONN_PINSEL0_P0p15_SHIFT) + +/* Pin Function Select Register 1 (PINSEL1: 0x4002c004) */ + +#define PINCONN_PINSEL1_P0_SHIFT(n) PINCONN_PINSELH_SHIFT(n) /* n=16,17,..31 */ +#define PINCONN_PINSEL1_P0_MASK(n) PINCONN_PINSELH_MASK(n) /* n=16,17,..31 */ + +#define PINCONN_PINSEL1_P0p16_SHIFT (0) /* Bits 0-1: P0.16 00=GPIO 01=RXD1 10=SSEL0 11=SSEL */ +#define PINCONN_PINSEL1_P0p16_MASK (3 << PINCONN_PINSEL1_P0p16_SHIFT) +#define PINCONN_PINSEL1_P0p17_SHIFT (2) /* Bits 2-3: P0.17 00=GPIO 01=CTS1 10=MISO0 11=MISO */ +#define PINCONN_PINSEL1_P0p17_MASK (3 << PINCONN_PINSEL1_P0p17_SHIFT) +#define PINCONN_PINSEL1_P0p18_SHIFT (4) /* Bits 4-5: P0.18 00=GPIO 01=DCD1 10=MOSI0 11=MOSI */ +#define PINCONN_PINSEL1_P0p18_MASK (3 << PINCONN_PINSEL1_P0p18_SHIFT) +#define PINCONN_PINSEL1_P0p19_SHIFT (6) /* Bits 6-7: P0.19 00=GPIO 01=DSR1 10=Reserved 11=SDA1 */ +#define PINCONN_PINSEL1_P0p19_MASK (3 << PINCONN_PINSEL1_P0p19_SHIFT) +#define PINCONN_PINSEL1_P0p20_SHIFT (8) /* Bits 8-9: P0.20 00=GPIO 01=DTR1 10=Reserved 11=SCL1 */ +#define PINCONN_PINSEL1_P0p20_MASK (3 << PINCONN_PINSEL1_P0p20_SHIFT) +#define PINCONN_PINSEL1_P0p21_SHIFT (10) /* Bits 10-11: P0.21 00=GPIO 01=RI1 10=Reserved 11=RD1 */ +#define PINCONN_PINSEL1_P0p21_MASK (3 << PINCONN_PINSEL1_P0p21_SHIFT) +#define PINCONN_PINSEL1_P0p22_SHIFT (12) /* Bits 12-13: P0.22 00=GPIO 01=RTS1 10=Reserved 11=TD1 */ +#define PINCONN_PINSEL1_P0p22_MASK (3 << PINCONN_PINSEL1_P0p22_SHIFT) +#define PINCONN_PINSEL1_P0p23_SHIFT (14) /* Bits 14-15: P0.23 00=GPIO 01=AD0.0 10=I2SRX_CLK 11=CAP3.0 */ +#define PINCONN_PINSEL1_P0p23_MASK (3 << PINCONN_PINSEL1_P0p23_SHIFT) +#define PINCONN_PINSEL1_P0p24_SHIFT (16) /* Bits 16-17: P0.24 00=GPIO 01=AD0.1 10=I2SRX_WS 11=CAP3.1 */ +#define PINCONN_PINSEL1_P0p24_MASK (3 << PINCONN_PINSEL1_P0p24_SHIFT) +#define PINCONN_PINSEL1_P0p25_SHIFT (18) /* Bits 18-19: P0.25 00=GPIO 01=AD0.2 10=I2SRX_SDA 11=TXD3 */ +#define PINCONN_PINSEL1_P0p25_MASK (3 << PINCONN_PINSEL1_P0p25_SHIFT) +#define PINCONN_PINSEL1_P0p26_SHIFT (20) /* Bits 20-21: P0.26 00=GPIO 01=AD0.3 10=AOUT 11=RXD3 */ +#define PINCONN_PINSEL1_P0p26_MASK (3 << PINCONN_PINSEL1_P0p26_SHIFT) +#define PINCONN_PINSEL1_P0p27_SHIFT (22) /* Bits 22-23: P0.27 00=GPIO 01=SDA0 10=USB_SDA 11=Reserved */ +#define PINCONN_PINSEL1_P0p27_MASK (3 << PINCONN_PINSEL1_P0p27_SHIFT) +#define PINCONN_PINSEL1_P0p28_SHIFT (24) /* Bits 24-25: P0.28 00=GPIO 01=SCL0 10=USB_SCL 11=Reserved */ +#define PINCONN_PINSEL1_P0p28_MASK (3 << PINCONN_PINSEL1_P0p28_SHIFT) +#define PINCONN_PINSEL1_P0p29_SHIFT (26) /* Bits 26-27: P0.29 00=GPIO 01=USB_D+ 10=Reserved 11=Reserved */ +#define PINCONN_PINSEL1_P0p29_MASK (3 << PINCONN_PINSEL1_P0p29_SHIFT) +#define PINCONN_PINSEL1_P0p30_SHIFT (28) /* Bits 28-29: P0.30 00=GPIO 01=USB_D- 10=Reserved 11=Reserved */ +#define PINCONN_PINSEL1_P0p30_MASK (3 << PINCONN_PINSEL1_P0p30_SHIFT) + /* Bits 30-31: Reserved */ +/* Pin Function Select register 2 (PINSEL2: 0x4002c008) */ + +#define PINCONN_PINSEL2_P1_SHIFT(n) PINCONN_PINSELL_SHIFT(n) /* n=0,1,..,15 */ +#define PINCONN_PINSEL2_P1_MASK(n) PINCONN_PINSELL_MASK(n) /* n=0,1,..,15 */ + +#define PINCONN_PINSEL2_P1p0_SHIFT (0) /* Bits 0-1: P1.0 00=GPIO 01=ENET_TXD0 10=Reserved 11=Reserved */ +#define PINCONN_PINSEL2_P1p0_MASK (3 << PINCONN_PINSEL2_P1p0_SHIFT) +#define PINCONN_PINSEL2_P1p1_SHIFT (2) /* Bits 2-3: P1.1 00=GPIO 01=ENET_TXD1 10=Reserved 11=Reserved */ +#define PINCONN_PINSEL2_P1p1_MASK (3 << PINCONN_PINSEL2_P1p1_SHIFT) + /* Bits 4-7: Reserved */ +#define PINCONN_PINSEL2_P1p4_SHIFT (8) /* Bits 8-9: P1.4 00=GPIO 01=ENET_TX_EN 10=Reserved 11=Reserved */ +#define PINCONN_PINSEL2_P1p4_MASK (3 << PINCONN_PINSEL2_P1p4_SHIFT) + /* Bits 10-15: Reserved */ +#define PINCONN_PINSEL2_P1p8_SHIFT (16) /* Bits 16-17: P1.8 00=GPIO 01=ENET_CRS 10=Reserved 11=Reserved */ +#define PINCONN_PINSEL2_P1p8_MASK (3 << PINCONN_PINSEL2_P1p8_SHIFT) +#define PINCONN_PINSEL2_P1p9_SHIFT (18) /* Bits 18-19: P1.9 00=GPIO 01=ENET_RXD0 10=Reserved 11=Reserved */ +#define PINCONN_PINSEL2_P1p9_MASK (3 << PINCONN_PINSEL2_P1p9_SHIFT) +#define PINCONN_PINSEL2_P1p10_SHIFT (20) /* Bits 20-21: P1.10 00=GPIO 01=ENET_RXD1 10=Reserved 11=Reserved */ +#define PINCONN_PINSEL2_P1p10_MASK (3 << PINCONN_PINSEL2_P1p10_SHIFT) + /* Bits 22-27: Reserved */ +#define PINCONN_PINSEL2_P1p14_SHIFT (28) /* Bits 28-29: P1.14 00=GPIO 01=ENET_RX_ER 10=Reserved 11=Reserved */ +#define PINCONN_PINSEL2_P1p14_MASK (3 << PINCONN_PINSEL2_P1p14_SHIFT) +#define PINCONN_PINSEL2_P1p15_SHIFT (30) /* Bits 30-31: P1.15 00=GPIO 01=ENET_REF_CLK 10=Reserved 11=Reserved */ +#define PINCONN_PINSEL2_P1p15_MASK (3 << PINCONN_PINSEL2_P1p15_SHIFT) + +/* Pin Function Select Register 3 (PINSEL3: 0x4002c00c) */ + +#define PINCONN_PINSEL3_P1_SHIFT(n) PINCONN_PINSELH_SHIFT(n) /* n=16,17,..31 */ +#define PINCONN_PINSEL3_P1_MASK(n) PINCONN_PINSELH_MASK(n) /* n=16,17,..31 */ + +#define PINCONN_PINSEL3_P1p16_SHIFT (0) /* Bits 0-1: P1.16 00=GPIO 01=ENET_MDC 10=Reserved 11=Reserved */ +#define PINCONN_PINSEL3_P1p16_MASK (3 << PINCONN_PINSEL3_P1p16_SHIFT) +#define PINCONN_PINSEL3_P1p17_SHIFT (2) /* Bits 2-3: P1.17 00=GPIO 01=ENET_MDIO 10=Reserved 11=Reserved */ +#define PINCONN_PINSEL3_P1p17_MASK (3 << PINCONN_PINSEL3_P1p17_SHIFT) +#define PINCONN_PINSEL3_P1p18_SHIFT (4) /* Bits 4-5: P1.18 00=GPIO 01=USB_UP_LED 10=PWM1.1 11=CAP1.0 */ +#define PINCONN_PINSEL3_P1p18_MASK (3 << PINCONN_PINSEL3_P1p18_SHIFT) +#define PINCONN_PINSEL3_P1p19_SHIFT (6) /* Bits 6-7: P1.19 00=GPIO 01=MCOA0 10=USB_PPWR 11=CAP1.1 */ +#define PINCONN_PINSEL3_P1p19_MASK (3 << PINCONN_PINSEL3_P1p19_SHIFT) +#define PINCONN_PINSEL3_P1p20_SHIFT (8) /* Bits 8-9: P1.20 00=GPIO 01=MCI0 10=PWM1.2 11=SCK0 */ +#define PINCONN_PINSEL3_P1p20_MASK (3 << PINCONN_PINSEL3_P1p20_SHIFT) +#define PINCONN_PINSEL3_P1p21_SHIFT (10) /* Bits 10-11: P1.21 00=GPIO 01=MCABORT 10=PWM1.3 11=SSEL0 */ +#define PINCONN_PINSEL3_P1p21_MASK (3 << PINCONN_PINSEL3_P1p21_SHIFT) +#define PINCONN_PINSEL3_P1p22_SHIFT (12) /* Bits 12-13: P1.22 00=GPIO 01=MCOB0 10=USB_PWRD 11=MAT1.0 */ +#define PINCONN_PINSEL3_P1p22_MASK (3 << PINCONN_PINSEL3_P1p22_SHIFT) +#define PINCONN_PINSEL3_P1p23_SHIFT (14) /* Bits 14-15: P1.23 00=GPIO 01=MCI1 10=PWM1.4 11=MISO0 */ +#define PINCONN_PINSEL3_P1p23_MASK (3 << PINCONN_PINSEL3_P1p23_SHIFT) +#define PINCONN_PINSEL3_P1p24_SHIFT (16) /* Bits 16-17: P1.24 00=GPIO 01=MCI2 10=PWM1.5 11=MOSI0 */ +#define PINCONN_PINSEL3_P1p24_MASK (3 << PINCONN_PINSEL3_P1p24_SHIFT) +#define PINCONN_PINSEL3_P1p25_SHIFT (18) /* Bits 18-19: P1.25 00=GPIO 01=MCOA1 10=Reserved 11=MAT1.1 */ +#define PINCONN_PINSEL3_P1p25_MASK (3 << PINCONN_PINSEL3_P1p25_SHIFT) +#define PINCONN_PINSEL3_P1p26_SHIFT (20) /* Bits 20-21: P1.26 00=GPIO 01=MCOB1 10=PWM1.6 11=CAP0.0 */ +#define PINCONN_PINSEL3_P1p26_MASK (3 << PINCONN_PINSEL3_P1p26_SHIFT) +#define PINCONN_PINSEL3_P1p27_SHIFT (22) /* Bits 22-23: P1.27 00=GPIO 01=CLKOUT 10=USB_OVRCR 11=CAP0.1 */ +#define PINCONN_PINSEL3_P1p27_MASK (3 << PINCONN_PINSEL3_P1p27_SHIFT) +#define PINCONN_PINSEL3_P1p28_SHIFT (24) /* Bits 24-25: P1.28 00=GPIO 01=MCOA2 10=PCAP1.0 11=MAT0.0 */ +#define PINCONN_PINSEL3_P1p28_MASK (3 << PINCONN_PINSEL3_P1p28_SHIFT) +#define PINCONN_PINSEL3_P1p29_SHIFT (26) /* Bits 26-27: P1.29 00=GPIO 01=MCOB2 10=PCAP1.1 11=MAT0.1 */ +#define PINCONN_PINSEL3_P1p29_MASK (3 << PINCONN_PINSEL3_P1p29_SHIFT) +#define PINCONN_PINSEL3_P1p30_SHIFT (28) /* Bits 28-29: P1.30 00=GPIO 01=Reserved 10=VBUS 11=AD0.4 */ +#define PINCONN_PINSEL3_P1p30_MASK (3 << PINCONN_PINSEL3_P1p30_SHIFT) +#define PINCONN_PINSEL3_P1p31_SHIFT (30) /* Bits 30-31: P1.31 00=GPIO 01=Reserved 10=SCK1 11=AD0.5 */ +#define PINCONN_PINSEL3_P1p31_MASK (3 << PINCONN_PINSEL3_P1p31_SHIFT) + +/* Pin Function Select Register 4 (PINSEL4: 0x4002c010) */ + +#define PINCONN_PINSEL4_P2_SHIFT(n) PINCONN_PINSELL_SHIFT(n) /* n=0,1,..,15 */ +#define PINCONN_PINSEL4_P2_MASK(n) PINCONN_PINSELL_MASK(n) /* n=0,1,..,15 */ + +#define PINCONN_PINSEL4_P2p0_SHIFT (0) /* Bits 0-1: P2.0 00=GPIO 01=PWM1.1 10=TXD1 11=Reserved */ +#define PINCONN_PINSEL4_P2p0_MASK (3 << PINCONN_PINSEL4_P2p0_SHIFT) +#define PINCONN_PINSEL4_P2p1_SHIFT (2) /* Bits 2-3: P2.1 00=GPIO 01=PWM1.2 10=RXD1 11=Reserved */ +#define PINCONN_PINSEL4_P2p1_MASK (3 << PINCONN_PINSEL4_P2p1_SHIFT) +#define PINCONN_PINSEL4_P2p2_SHIFT (4) /* Bits 4-5: P2.2 00=GPIO 01=PWM1.3 10=CTS1 11=Reserved */ +#define PINCONN_PINSEL4_P2p2_MASK (3 << PINCONN_PINSEL4_P2p2_SHIFT) +#define PINCONN_PINSEL4_P2p3_SHIFT (6) /* Bits 6-7: P2.3 00=GPIO 01=PWM1.4 10=DCD1 11=Reserved */ +#define PINCONN_PINSEL4_P2p3_MASK (3 << PINCONN_PINSEL4_P2p3_SHIFT) +#define PINCONN_PINSEL4_P2p4_SHIFT (8) /* Bits 8-9: P2.4 00=GPIO 01=PWM1.5 10=DSR1 11=Reserved */ +#define PINCONN_PINSEL4_P2p4_MASK (3 << PINCONN_PINSEL4_P2p4_SHIFT) +#define PINCONN_PINSEL4_P2p5_SHIFT (10) /* Bits 10-11: P2.5 00=GPIO 01=PWM1.6 10=DTR1 11=Reserved */ +#define PINCONN_PINSEL4_P2p5_MASK (3 << PINCONN_PINSEL4_P2p5_SHIFT) +#define PINCONN_PINSEL4_P2p6_SHIFT (12) /* Bits 12-13: P2.6 00=GPIO 01=PCAP1.0 10=RI1 11=Reserved */ +#define PINCONN_PINSEL4_P2p6_MASK (3 << PINCONN_PINSEL4_P2p6_SHIFT) +#define PINCONN_PINSEL4_P2p7_SHIFT (14) /* Bits 14-15: P2.7 00=GPIO 01=RD2 10=RTS1 11=Reserved */ +#define PINCONN_PINSEL4_P2p7_MASK (3 << PINCONN_PINSEL4_P2p7_SHIFT) +#define PINCONN_PINSEL4_P2p8_SHIFT (16) /* Bits 16-17: P2.8 00=GPIO 01=TD2 10=TXD2 11=ENET_MDC */ +#define PINCONN_PINSEL4_P2p8_MASK (3 << PINCONN_PINSEL4_P2p8_SHIFT) +#define PINCONN_PINSEL4_P2p9_SHIFT (18) /* Bits 18-19: P2.9 00=GPIO 01=USB_CONNECT 10=RXD2 11=ENET_MDIO */ +#define PINCONN_PINSEL4_P2p9_MASK (3 << PINCONN_PINSEL4_P2p9_SHIFT) +#define PINCONN_PINSEL4_P2p10_SHIFT (20) /* Bits 20-21: P2.10 00=GPIO 01=EINT0 10=NMI 11=Reserved */ +#define PINCONN_PINSEL4_P2p10_MASK (3 << PINCONN_PINSEL4_P2p10_SHIFT) +#define PINCONN_PINSEL4_P2p11_SHIFT (22) /* Bits 22-23: P2.11 00=GPIO 01=EINT1 10=Reserved 11=I2STX_CLK */ +#define PINCONN_PINSEL4_P2p11_MASK (3 << PINCONN_PINSEL4_P2p11_SHIFT) +#define PINCONN_PINSEL4_P2p12_SHIFT (24) /* Bits 24-25: P2.12 00=GPIO 01=PEINT2 10=Reserved 11=I2STX_WS */ +#define PINCONN_PINSEL4_P2p12_MASK (3 << PINCONN_PINSEL4_P2p12_SHIFT) +#define PINCONN_PINSEL4_P2p13_SHIFT (26) /* Bits 26-27: P2.13 00=GPIO 01=EINT3 10=Reserved 11=I2STX_SDA */ +#define PINCONN_PINSEL4_P2p13_MASK (3 << PINCONN_PINSEL4_P2p13_SHIFT) + /* Bits 28-31: Reserved */ +/* Pin Function Select Register 7 (PINSEL7: 0x4002c01c) */ + +#define PINCONN_PINSEL7_P3_SHIFT(n) PINCONN_PINSELH_SHIFT(n) /* n=16,17,..31 */ +#define PINCONN_PINSEL7_P3_MASK(n) PINCONN_PINSELH_MASK(n) /* n=16,17,..31 */ + + /* Bits 0-17: Reserved */ +#define PINCONN_PINSEL7_P3p25_SHIFT (18) /* Bits 18-19: P3.25 00=GPIO 01=Reserved 10=MAT0.0 11=PWM1.2 */ +#define PINCONN_PINSEL7_P3p25_MASK (3 << PINCONN_PINSEL7_P3p25_SHIFT) +#define PINCONN_PINSEL7_P3p26_SHIFT (20) /* Bits 20-21: P3.26 00=GPIO 01=STCLK 10=MAT0.1 11=PWM1.3 */ +#define PINCONN_PINSEL7_P3p26_MASK (3 << PINCONN_PINSEL7_P3p26_SHIFT) + /* Bits 22-31: Reserved */ + +/* Pin Function Select Register 8 (PINSEL8: 0x4002c020) */ +/* No description of bits -- Does this register exist? */ + +/* Pin Function Select Register 9 (PINSEL9: 0x4002c024) */ + +#define PINCONN_PINSEL9_P4_SHIFT(n) PINCONN_PINSELH_SHIFT(n) /* n=16,17,..31 */ +#define PINCONN_PINSEL9_P4_MASK(n) PINCONN_PINSELH_MASK(n) /* n=16,17,..31 */ + + /* Bits 0-23: Reserved */ +#define PINCONN_PINSEL9_P4p28_SHIFT (24) /* Bits 24-25: P4.28 00=GPIO 01=RX_MCLK 10=MAT2.0 11=TXD3 */ +#define PINCONN_PINSEL9_P4p28_MASK (3 << PINCONN_PINSEL9_P4p28_SHIFT) +#define PINCONN_PINSEL9_P4p29_SHIFT (26) /* Bits 26-27: P4.29 00=GPIO 01=TX_MCLK 10=MAT2.1 11=RXD3 */ +#define PINCONN_PINSEL9_P4p29_MASK (3 << PINCONN_PINSEL9_P4p29_SHIFT) + /* Bits 28-31: Reserved */ +/* Pin Function Select Register 10 (PINSEL10: 0x4002c028) */ + /* Bits 0-2: Reserved */ +#define PINCONN_PINSEL10_TPIU (1 << 3) /* Bit 3: 0=TPIU interface disabled; 1=TPIU interface enabled */ + /* Bits 4-31: Reserved */ +/* Pin Mode select register 0 (PINMODE0: 0x4002c040) */ + +#define PINCONN_PINMODE_PU (0) /* 00: pin has a pull-up resistor enabled */ +#define PINCONN_PINMODE_RM (1) /* 01: pin has repeater mode enabled */ +#define PINCONN_PINMODE_FLOAT (2) /* 10: pin has neither pull-up nor pull-down */ +#define PINCONN_PINMODE_PD (3) /* 11: pin has a pull-down resistor enabled */ +#define PINCONN_PINMODE_MASK (3) + +#define PINCONN_PINMODEL_SHIFT(n) ((n) << 1) /* n=0,1,..,15 */ +#define PINCONN_PINMODEL_MASK(n) (3 << PINCONN_PINMODEL_SHIFT(n)) +#define PINCONN_PINMODEH_SHIFT(n) (((n)-16) << 1) /* n=16,17,..31 */ +#define PINCONN_PINMODEH_MASK(n) (3 << PINCONN_PINMODEH_SHIFT(n)) + +#define PINCONN_PINMODE0_P0_SHIFT(n) PINCONN_PINMODEL_SHIFT(n) /* n=0,1,..,15 */ +#define PINCONN_PINMODE0_P0_MASK(n) PINCONN_PINMODEL_MASK(n) /* n=0,1,..,15 */ + +#define PINCONN_PINMODE0_P0p0_SHIFT (0) /* Bits 0-1: P0.0 mode control */ +#define PINCONN_PINMODE0_P0p0_MASK (3 << PINCONN_PINMODE0_P0p0_SHIFT) +#define PINCONN_PINMODE0_P0p1_SHIFT (2) /* Bits 2-3: P0.1 mode control */ +#define PINCONN_PINMODE0_P0p1_MASK (3 << PINCONN_PINMODE0_P0p1_SHIFT) +#define PINCONN_PINMODE0_P0p2_SHIFT (4) /* Bits 4-5: P0.2 mode control */ +#define PINCONN_PINMODE0_P0p2_MASK (3 << PINCONN_PINMODE0_P0p2_SHIFT) +#define PINCONN_PINMODE0_P0p3_SHIFT (6) /* Bits 6-7: P0.3 mode control */ +#define PINCONN_PINMODE0_P0p3_MASK (3 << PINCONN_PINMODE0_P0p3_SHIFT) +#define PINCONN_PINMODE0_P0p4_SHIFT (8) /* Bits 8-9: P0.4 mode control */ +#define PINCONN_PINMODE0_P0p4_MASK (3 << PINCONN_PINMODE0_P0p4_SHIFT) +#define PINCONN_PINMODE0_P0p5_SHIFT (10) /* Bits 10-11: P0.5 mode control */ +#define PINCONN_PINMODE0_P0p5_MASK (3 << PINCONN_PINMODE0_P0p5_SHIFT) +#define PINCONN_PINMODE0_P0p6_SHIFT (12) /* Bits 12-13: P0.6 mode control */ +#define PINCONN_PINMODE0_P0p6_MASK (3 << PINCONN_PINMODE0_P0p6_SHIFT) +#define PINCONN_PINMODE0_P0p7_SHIFT (14) /* Bits 14-15: P0.7 mode control */ +#define PINCONN_PINMODE0_P0p7_MASK (3 << PINCONN_PINMODE0_P0p7_SHIFT) +#define PINCONN_PINMODE0_P0p8_SHIFT (16) /* Bits 16-17: P0.8 mode control */ +#define PINCONN_PINMODE0_P0p8_MASK (3 << PINCONN_PINMODE0_P0p8_SHIFT) +#define PINCONN_PINMODE0_P0p9_SHIFT (18) /* Bits 18-19: P0.9 mode control */ +#define PINCONN_PINMODE0_P0p9_MASK (3 << PINCONN_PINMODE0_P0p9_SHIFT) +#define PINCONN_PINMODE0_P0p10_SHIFT (20) /* Bits 20-21: P0.10 mode control */ +#define PINCONN_PINMODE0_P0p10_MASK (3 << PINCONN_PINMODE0_P0p10_SHIFT) +#define PINCONN_PINMODE0_P0p11_SHIFT (22) /* Bits 22-23: P0.11 mode control */ +#define PINCONN_PINMODE0_P0p11_MASK (3 << PINCONN_PINMODE0_P0p11_SHIFT) + /* Bits 24-29: Reserved */ +#define PINCONN_PINMODE0_P0p15_SHIFT (30) /* Bits 30-31: P0.15 mode control */ +#define PINCONN_PINMODE0_P0p15_MASK (3 << PINCONN_PINMODE0_P0p15_SHIFT) + +/* Pin Mode select register 1 (PINMODE1: 0x4002c044) */ + +#define PINCONN_PINMODE1_P0_SHIFT(n) PINCONN_PINMODEH_SHIFT(n) /* n=16,17,..31 */ +#define PINCONN_PINMODE1_P0_MASK(n) PINCONN_PINMODEH_MASK(n) /* n=16,17,..31 */ + +#define PINCONN_PINMODE1_P0p16_SHIFT (0) /* Bits 0-1: P0.16 mode control */ +#define PINCONN_PINMODE1_P0p16_MASK (3 << PINCONN_PINMODE1_P0p16_SHIFT) +#define PINCONN_PINMODE1_P0p17_SHIFT (2) /* Bits 2-3: P0.17 mode control */ +#define PINCONN_PINMODE1_P0p17_MASK (3 << PINCONN_PINMODE1_P0p17_SHIFT) +#define PINCONN_PINMODE1_P0p18_SHIFT (4) /* Bits 4-5: P0.18 mode control */ +#define PINCONN_PINMODE1_P0p18_MASK (3 << PINCONN_PINMODE1_P0p18_SHIFT) +#define PINCONN_PINMODE1_P0p19_SHIFT (6) /* Bits 6-7: P0.19 mode control */ +#define PINCONN_PINMODE1_P0p19_MASK (3 << PINCONN_PINMODE1_P0p19_SHIFT) +#define PINCONN_PINMODE1_P0p20_SHIFT (8) /* Bits 8-9: P0.20 mode control */ +#define PINCONN_PINMODE1_P0p20_MASK (3 << PINCONN_PINMODE1_P0p20_SHIFT) +#define PINCONN_PINMODE1_P0p21_SHIFT (10) /* Bits 10-11: P0.21 mode control */ +#define PINCONN_PINMODE1_P0p21_MASK (3 << PINCONN_PINMODE1_P0p21_SHIFT) +#define PINCONN_PINMODE1_P0p22_SHIFT (12) /* Bits 12-13: P0.22 mode control */ +#define PINCONN_PINMODE1_P0p22_MASK (3 << PINCONN_PINMODE1_P0p22_SHIFT) +#define PINCONN_PINMODE1_P0p23_SHIFT (14) /* Bits 14-15: P0.23 mode control */ +#define PINCONN_PINMODE1_P0p23_MASK (3 << PINCONN_PINMODE1_P0p23_SHIFT) +#define PINCONN_PINMODE1_P0p24_SHIFT (16) /* Bits 16-17: P0.24 mode control */ +#define PINCONN_PINMODE1_P0p24_MASK (3 << PINCONN_PINMODE1_P0p24_SHIFT) +#define PINCONN_PINMODE1_P0p25_SHIFT (18) /* Bits 18-19: P0.25 mode control */ +#define PINCONN_PINMODE1_P0p25_MASK (3 << PINCONN_PINMODE1_P0p25_SHIFT) +#define PINCONN_PINMODE1_P0p26_SHIFT (20) /* Bits 20-21: P0.26 mode control */ +#define PINCONN_PINMODE1_P0p26_MASK (3 << PINCONN_PINMODE1_P0p26_SHIFT) + /* Bits 22-31: Reserved */ + +/* Pin Mode select register 2 (PINMODE2: 0x4002c048) */ + +#define PINCONN_PINMODE2_P1_SHIFT(n) PINCONN_PINMODEL_SHIFT(n) /* n=0,1,..,15 */ +#define PINCONN_PINMODE2_P1_MASK(n) PINCONN_PINMODEL_MASK(n) /* n=0,1,..,15 */ + +#define PINCONN_PINMODE2_P1p0_SHIFT (0) /* Bits 2-1: P1.0 mode control */ +#define PINCONN_PINMODE2_P1p0_MASK (3 << PINCONN_PINMODE2_P1p0_SHIFT) +#define PINCONN_PINMODE2_P1p1_SHIFT (2) /* Bits 2-3: P1.1 mode control */ +#define PINCONN_PINMODE2_P1p1_MASK (3 << PINCONN_PINMODE2_P1p1_SHIFT) + /* Bits 4-7: Reserved */ +#define PINCONN_PINMODE2_P1p4_SHIFT (8) /* Bits 8-9: P1.4 mode control */ +#define PINCONN_PINMODE2_P1p4_MASK (3 << PINCONN_PINMODE2_P1p4_SHIFT) + /* Bits 10-15: Reserved */ +#define PINCONN_PINMODE2_P1p8_SHIFT (16) /* Bits 16-17: P1.8 mode control */ +#define PINCONN_PINMODE2_P1p8_MASK (3 << PINCONN_PINMODE2_P1p8_SHIFT) +#define PINCONN_PINMODE2_P1p9_SHIFT (18) /* Bits 18-19: P1.9 mode control */ +#define PINCONN_PINMODE2_P1p9_MASK (3 << PINCONN_PINMODE2_P1p9_SHIFT) +#define PINCONN_PINMODE2_P1p10_SHIFT (20) /* Bits 20-21: P1.10 mode control */ +#define PINCONN_PINMODE2_P1p10_MASK (3 << PINCONN_PINMODE2_P1p10_SHIFT) + /* Bits 22-27: Reserved */ +#define PINCONN_PINMODE2_P1p14_SHIFT (28) /* Bits 28-29: P1.14 mode control */ +#define PINCONN_PINMODE2_P1p14_MASK (3 << PINCONN_PINMODE2_P1p14_SHIFT) +#define PINCONN_PINMODE2_P1p15_SHIFT (30) /* Bits 30-31: P1.15 mode control */ +#define PINCONN_PINMODE2_P1p15_MASK (3 << PINCONN_PINMODE2_P1p15_SHIFT) + +/* Pin Mode select register 3 (PINMODE3: 0x4002c04c) */ + +#define PINCONN_PINMODE3_P1_SHIFT(n) PINCONN_PINMODEH_SHIFT(n) /* n=16,17,..31 */ +#define PINCONN_PINMODE3_P1_MASK(n) PINCONN_PINMODEH_MASK(n) /* n=16,17,..31 */ + +#define PINCONN_PINMODE3_P1p16_SHIFT (0) /* Bits 0-1: P1.16 mode control */ +#define PINCONN_PINMODE3_P1p16_MASK (3 << PINCONN_PINMODE3_P1p16_SHIFT) +#define PINCONN_PINMODE3_P1p17_SHIFT (2) /* Bits 2-3: P1.17 mode control */ +#define PINCONN_PINMODE3_P1p17_MASK (3 << PINCONN_PINMODE3_P1p17_SHIFT) +#define PINCONN_PINMODE3_P1p18_SHIFT (4) /* Bits 4-5: P1.18 mode control */ +#define PINCONN_PINMODE3_P1p18_MASK (3 << PINCONN_PINMODE3_P1p18_SHIFT) +#define PINCONN_PINMODE3_P1p19_SHIFT (6) /* Bits 6-7: P1.19 mode control */ +#define PINCONN_PINMODE3_P1p19_MASK (3 << PINCONN_PINMODE3_P1p19_SHIFT) +#define PINCONN_PINMODE3_P1p20_SHIFT (8) /* Bits 8-9: P1.20 mode control */ +#define PINCONN_PINMODE3_P1p20_MASK (3 << PINCONN_PINMODE3_P1p20_SHIFT) +#define PINCONN_PINMODE3_P1p21_SHIFT (10) /* Bits 10-11: P1.21 mode control */ +#define PINCONN_PINMODE3_P1p21_MASK (3 << PINCONN_PINMODE3_P1p21_SHIFT) +#define PINCONN_PINMODE3_P1p22_SHIFT (12) /* Bits 12-13: P1.22 mode control */ +#define PINCONN_PINMODE3_P1p22_MASK (3 << PINCONN_PINMODE3_P1p22_SHIFT) +#define PINCONN_PINMODE3_P1p23_SHIFT (14) /* Bits 14-15: P1.23 mode control */ +#define PINCONN_PINMODE3_P1p23_MASK (3 << PINCONN_PINMODE3_P1p23_SHIFT) +#define PINCONN_PINMODE3_P1p24_SHIFT (16) /* Bits 16-17: P1.24 mode control */ +#define PINCONN_PINMODE3_P1p24_MASK (3 << PINCONN_PINMODE3_P1p24_SHIFT) +#define PINCONN_PINMODE3_P1p25_SHIFT (18) /* Bits 18-19: P1.25 mode control */ +#define PINCONN_PINMODE3_P1p25_MASK (3 << PINCONN_PINMODE3_P1p25_SHIFT) +#define PINCONN_PINMODE3_P1p26_SHIFT (20) /* Bits 20-21: P1.26 mode control */ +#define PINCONN_PINMODE3_P1p26_MASK (3 << PINCONN_PINMODE3_P1p26_SHIFT) +#define PINCONN_PINMODE3_P1p27_SHIFT (22) /* Bits 22-23: P1.27 mode control */ +#define PINCONN_PINMODE3_P1p27_MASK (3 << PINCONN_PINMODE3_P1p27_SHIFT) +#define PINCONN_PINMODE3_P1p28_SHIFT (24) /* Bits 24-25: P1.28 mode control */ +#define PINCONN_PINMODE3_P1p28_MASK (3 << PINCONN_PINMODE3_P1p28_SHIFT) +#define PINCONN_PINMODE3_P1p29_SHIFT (26) /* Bits 26-27: P1.29 mode control */ +#define PINCONN_PINMODE3_P1p29_MASK (3 << PINCONN_PINMODE3_P1p29_SHIFT) +#define PINCONN_PINMODE3_P1p30_SHIFT (28) /* Bits 28-29: P1.30 mode control */ +#define PINCONN_PINMODE3_P1p30_MASK (3 << PINCONN_PINMODE3_P1p30_SHIFT) +#define PINCONN_PINMODE3_P1p31_SHIFT (30) /* Bits 30-31: P1.31 mode control */ +#define PINCONN_PINMODE3_P1p31_MASK (3 << PINCONN_PINMODE3_P1p31_SHIFT) + +/* Pin Mode select register 4 (PINMODE4: 0x4002c050) */ + +#define PINCONN_PINMODE4_P2_SHIFT(n) PINCONN_PINMODEL_SHIFT(n) /* n=0,1,..,15 */ +#define PINCONN_PINMODE4_P2_MASK(n) PINCONN_PINMODEL_MASK(n) /* n=0,1,..,15 */ + +#define PINCONN_PINMODE4_P2p0_SHIFT (0) /* Bits 0-1: P2.0 mode control */ +#define PINCONN_PINMODE4_P2p0_MASK (3 << PINCONN_PINMODE4_P2p0_SHIFT) +#define PINCONN_PINMODE4_P2p1_SHIFT (2) /* Bits 2-3: P2.1 mode control */ +#define PINCONN_PINMODE4_P2p1_MASK (3 << PINCONN_PINMODE4_P2p1_SHIFT) +#define PINCONN_PINMODE4_P2p2_SHIFT (4) /* Bits 4-5: P2.2 mode control */ +#define PINCONN_PINMODE4_P2p2_MASK (3 << PINCONN_PINMODE4_P2p2_SHIFT) +#define PINCONN_PINMODE4_P2p3_SHIFT (6) /* Bits 6-7: P2.3 mode control */ +#define PINCONN_PINMODE4_P2p3_MASK (3 << PINCONN_PINMODE4_P2p3_SHIFT) +#define PINCONN_PINMODE4_P2p4_SHIFT (8) /* Bits 8-9: P2.4 mode control */ +#define PINCONN_PINMODE4_P2p4_MASK (3 << PINCONN_PINMODE4_P2p4_SHIFT) +#define PINCONN_PINMODE4_P2p5_SHIFT (10) /* Bits 10-11: P2.5 mode control */ +#define PINCONN_PINMODE4_P2p5_MASK (3 << PINCONN_PINMODE4_P2p5_SHIFT) +#define PINCONN_PINMODE4_P2p6_SHIFT (12) /* Bits 12-13: P2.6 mode control */ +#define PINCONN_PINMODE4_P2p6_MASK (3 << PINCONN_PINMODE4_P2p6_SHIFT) +#define PINCONN_PINMODE4_P2p7_SHIFT (14) /* Bits 14-15: P2.7 mode control */ +#define PINCONN_PINMODE4_P2p7_MASK (3 << PINCONN_PINMODE4_P2p7_SHIFT) +#define PINCONN_PINMODE4_P2p8_SHIFT (16) /* Bits 16-17: P2.8 mode control */ +#define PINCONN_PINMODE4_P2p8_MASK (3 << PINCONN_PINMODE4_P2p8_SHIFT) +#define PINCONN_PINMODE4_P2p9_SHIFT (18) /* Bits 18-19: P2.9 mode control */ +#define PINCONN_PINMODE4_P2p9_MASK (3 << PINCONN_PINMODE4_P2p9_SHIFT) +#define PINCONN_PINMODE4_P2p10_SHIFT (20) /* Bits 20-21: P2.10 mode control */ +#define PINCONN_PINMODE4_P2p10_MASK (3 << PINCONN_PINMODE4_P2p10_SHIFT) +#define PINCONN_PINMODE4_P2p11_SHIFT (22) /* Bits 22-23: P2.11 mode control */ +#define PINCONN_PINMODE4_P2p11_MASK (3 << PINCONN_PINMODE4_P2p11_SHIFT) +#define PINCONN_PINMODE4_P2p12_SHIFT (24) /* Bits 24-25: P2.12 mode control */ +#define PINCONN_PINMODE4_P2p12_MASK (3 << PINCONN_PINMODE4_P2p12_SHIFT) +#define PINCONN_PINMODE4_P2p13_SHIFT (26) /* Bits 26-27: P2.13 mode control */ +#define PINCONN_PINMODE4_P2p13_MASK (3 << PINCONN_PINMODE4_P2p13_SHIFT) + /* Bits 28-31: Reserved */ +/* Pin Mode select register 5 (PINMODE5: 0x4002c054) + * Pin Mode select register 6 (PINMODE6: 0x4002c058) + * No bit definitions -- do these registers exist? + */ + +#define PINCONN_PINMODE5_P2_SHIFT(n) PINCONN_PINMODEH_SHIFT(n) /* n=16,17,..31 */ +#define PINCONN_PINMODE5_P2_MASK(n) PINCONN_PINMODEH_MASK(n) /* n=16,17,..31 */ + +#define PINCONN_PINMODE6_P3_SHIFT(n) PINCONN_PINMODEL_SHIFT(n) /* n=0,1,..,15 */ +#define PINCONN_PINMODE6_P3_MASK(n) PINCONN_PINMODEL_MASK(n) /* n=0,1,..,15 */ + +/* Pin Mode select register 7 (PINMODE7: 0x4002c05c) */ + +#define PINCONN_PINMODE7_P3_SHIFT(n) PINCONN_PINMODEH_SHIFT(n) /* n=16,17,..31 */ +#define PINCONN_PINMODE7_P3_MASK(n) PINCONN_PINMODEH_MASK(n) /* n=16,17,..31 */ + /* Bits 0-17: Reserved */ +#define PINCONN_PINMODE7_P3p25_SHIFT (18) /* Bits 18-19: P3.25 mode control */ +#define PINCONN_PINMODE7_P3p25_MASK (3 << PINCONN_PINMODE7_P3p25_SHIFT) +#define PINCONN_PINMODE7_P3p26_SHIFT (20) /* Bits 20-21: P3.26 mode control */ +#define PINCONN_PINMODE7_P3p26_MASK (3 << PINCONN_PINMODE7_P3p26_SHIFT) + /* Bits 22-31: Reserved */ +/* Pin Mode select register 9 (PINMODE9: 0x4002c064) */ + +#define PINCONN_PINMODE9_P4_SHIFT(n) PINCONN_PINMODEH_SHIFT(n) /* n=16,17,..31 */ +#define PINCONN_PINMODE9_P4_MASK(n) PINCONN_PINMODEH_MASK(n) /* n=16,17,..31 */ + /* Bits 0-23: Reserved */ +#define PINCONN_PINMODE9_P4p28_SHIFT (24) /* Bits 24-25: P4.28 mode control */ +#define PINCONN_PINMODE9_P4p28_MASK (3 << PINCONN_PINMODE9_P4p28_SHIFT) +#define PINCONN_PINMODE9_P4p29_SHIFT (26) /* Bits 26-27: P4.29 mode control */ +#define PINCONN_PINMODE9_P4p29_MASK (3 << PINCONN_PINMODE9_P4p29_SHIFT) + /* Bits 28-31: Reserved */ +/* Open Drain Pin Mode select register 0 (PINMODE_OD0: 0x4002c068) */ + +#define PINCONN_ODMODE0_P0(n) (1 << (n)) + +#define PINCONN_ODMODE0_P0p0 (1 << 0) /* Bit 0: P0.0 open drain mode */ +#define PINCONN_ODMODE0_P0p1 (1 << 1) /* Bit 1: P0.1 open drain mode */ +#define PINCONN_ODMODE0_P0p2 (1 << 2) /* Bit 2: P0.2 open drain mode */ +#define PINCONN_ODMODE0_P0p3 (1 << 3) /* Bit 3: P0.3 open drain mode */ +#define PINCONN_ODMODE0_P0p4 (1 << 4) /* Bit 4: P0.4 open drain mode */ +#define PINCONN_ODMODE0_P0p5 (1 << 5) /* Bit 5: P0.5 open drain mode */ +#define PINCONN_ODMODE0_P0p6 (1 << 6) /* Bit 6: P0.6 open drain mode */ +#define PINCONN_ODMODE0_P0p7 (1 << 7) /* Bit 7: P0.7 open drain mode */ +#define PINCONN_ODMODE0_P0p8 (1 << 8) /* Bit 8: P0.8 open drain mode */ +#define PINCONN_ODMODE0_P0p9 (1 << 9) /* Bit 9: P0.9 open drain mode */ +#define PINCONN_ODMODE0_P0p10 (1 << 10) /* Bit 10: P0.10 open drain mode */ +#define PINCONN_ODMODE0_P0p11 (1 << 11) /* Bit 11: P0.11 open drain mode */ + /* Bits 12-14: Reserved */ +#define PINCONN_ODMODE0_P0p15 (1 << 15) /* Bit 15: P0.15 open drain mode */ +#define PINCONN_ODMODE0_P0p16 (1 << 16) /* Bit 16: P0.16 open drain mode */ +#define PINCONN_ODMODE0_P0p17 (1 << 17) /* Bit 17: P0.17 open drain mode */ +#define PINCONN_ODMODE0_P0p18 (1 << 18) /* Bit 18: P0.18 open drain mode */ +#define PINCONN_ODMODE0_P0p19 (1 << 19) /* Bit 19: P0.19 open drain mode */ +#define PINCONN_ODMODE0_P0p20 (1 << 20) /* Bit 20: P0.20 open drain mode */ +#define PINCONN_ODMODE0_P0p21 (1 << 21) /* Bit 21: P0.21 open drain mode */ +#define PINCONN_ODMODE0_P0p22 (1 << 22) /* Bit 22: P0.22 open drain mode */ +#define PINCONN_ODMODE0_P0p23 (1 << 23) /* Bit 23: P0.23 open drain mode */ +#define PINCONN_ODMODE0_P0p24 (1 << 24) /* Bit 24: P0.24 open drain mode */ +#define PINCONN_ODMODE0_P0p25 (1 << 25) /* Bit 25: P0.25 open drain mode */ +#define PINCONN_ODMODE0_P0p26 (1 << 25) /* Bit 26: P0.26 open drain mode */ + /* Bits 27-28: Reserved */ +#define PINCONN_ODMODE0_P0p29 (1 << 29) /* Bit 29: P0.29 open drain mode */ +#define PINCONN_ODMODE0_P0p30 (1 << 30) /* Bit 30: P0.30 open drain mode */ + /* Bit 31: Reserved */ +/* Open Drain Pin Mode select register 1 (PINMODE_OD1: 0x4002c06c) */ + +#define PINCONN_ODMODE1_P1(n) (1 << (n)) + +#define PINCONN_ODMODE1_P1p0 (1 << 0) /* Bit 0: P1.0 open drain mode */ +#define PINCONN_ODMODE1_P1p1 (1 << 1) /* Bit 1: P1.1 open drain mode */ + /* Bits 2-3: Reserved */ +#define PINCONN_ODMODE1_P1p4 (1 << 4) /* Bit 4: P1.4 open drain mode */ + /* Bits 5-7: Reserved */ +#define PINCONN_ODMODE1_P1p8 (1 << 8) /* Bit 8: P1.8 open drain mode */ +#define PINCONN_ODMODE1_P1p9 (1 << 9) /* Bit 9: P1.9 open drain mode */ +#define PINCONN_ODMODE1_P1p10 (1 << 10) /* Bit 10: P1.10 open drain mode */ + /* Bits 11-13: Reserved */ +#define PINCONN_ODMODE1_P1p14 (1 << 14) /* Bit 14: P1.14 open drain mode */ +#define PINCONN_ODMODE1_P1p15 (1 << 15) /* Bit 15: P1.15 open drain mode */ +#define PINCONN_ODMODE1_P1p16 (1 << 16) /* Bit 16: P1.16 open drain mode */ +#define PINCONN_ODMODE1_P1p17 (1 << 17) /* Bit 17: P1.17 open drain mode */ +#define PINCONN_ODMODE1_P1p18 (1 << 18) /* Bit 18: P1.18 open drain mode */ +#define PINCONN_ODMODE1_P1p19 (1 << 19) /* Bit 19: P1.19 open drain mode */ +#define PINCONN_ODMODE1_P1p20 (1 << 20) /* Bit 20: P1.20 open drain mode */ +#define PINCONN_ODMODE1_P1p21 (1 << 21) /* Bit 21: P1.21 open drain mode */ +#define PINCONN_ODMODE1_P1p22 (1 << 22) /* Bit 22: P1.22 open drain mode */ +#define PINCONN_ODMODE1_P1p23 (1 << 23) /* Bit 23: P1.23 open drain mode */ +#define PINCONN_ODMODE1_P1p24 (1 << 24) /* Bit 24: P1.24 open drain mode */ +#define PINCONN_ODMODE1_P1p25 (1 << 25) /* Bit 25: P1.25 open drain mode */ +#define PINCONN_ODMODE1_P1p26 (1 << 25) /* Bit 26: P1.26 open drain mode */ +#define PINCONN_ODMODE1_P1p27 (1 << 27) /* Bit 27: P1.27 open drain mode */ +#define PINCONN_ODMODE1_P1p28 (1 << 28) /* Bit 28: P1.28 open drain mode */ +#define PINCONN_ODMODE1_P1p29 (1 << 29) /* Bit 29: P1.29 open drain mode */ +#define PINCONN_ODMODE1_P1p30 (1 << 30) /* Bit 30: P1.30 open drain mode */ +#define PINCONN_ODMODE1_P1p31 (1 << 31) /* Bit 31: P1.31 open drain mode */ + +/* Open Drain Pin Mode select register 2 (PINMODE_OD2: 0x4002c070) */ + +#define PINCONN_ODMODE2_P2(n) (1 << (n)) + +#define PINCONN_ODMODE2_P2p0 (1 << 0) /* Bit 0: P2.0 open drain mode */ +#define PINCONN_ODMODE2_P2p1 (1 << 1) /* Bit 1: P2.1 open drain mode */ +#define PINCONN_ODMODE2_P2p2 (1 << 2) /* Bit 2: P2.2 open drain mode */ +#define PINCONN_ODMODE2_P2p3 (1 << 3) /* Bit 3: P2.3 open drain mode */ +#define PINCONN_ODMODE2_P2p4 (1 << 4) /* Bit 4: P2.4 open drain mode */ +#define PINCONN_ODMODE2_P2p5 (1 << 5) /* Bit 5: P2.5 open drain mode */ +#define PINCONN_ODMODE2_P2p6 (1 << 6) /* Bit 6: P2.6 open drain mode */ +#define PINCONN_ODMODE2_P2p7 (1 << 7) /* Bit 7: P2.7 open drain mode */ +#define PINCONN_ODMODE2_P2p8 (1 << 8) /* Bit 8: P2.8 open drain mode */ +#define PINCONN_ODMODE2_P2p9 (1 << 9) /* Bit 9: P2.9 open drain mode */ +#define PINCONN_ODMODE2_P2p10 (1 << 10) /* Bit 10: P2.10 open drain mode */ +#define PINCONN_ODMODE2_P2p11 (1 << 11) /* Bit 11: P2.11 open drain mode */ +#define PINCONN_ODMODE2_P2p12 (1 << 12) /* Bit 12: P2.12 open drain mode */ +#define PINCONN_ODMODE2_P2p13 (1 << 13) /* Bit 13: P2.13 open drain mode */ + /* Bits 14-31: Reserved */ +/* Open Drain Pin Mode select register 3 (PINMODE_OD3: 0x4002c074) */ + +#define PINCONN_ODMODE3_P3(n) (1 << (n)) + /* Bits 0-24: Reserved */ +#define PINCONN_ODMODE3_P3p25 (1 << 25) /* Bit 25: P3.25 open drain mode */ +#define PINCONN_ODMODE3_P3p26 (1 << 25) /* Bit 26: P3.26 open drain mode */ + /* Bits 17-31: Reserved */ +/* Open Drain Pin Mode select register 4 (PINMODE_OD4: 0x4002c078) */ + +#define PINCONN_ODMODE4_P4(n) (1 << (n)) + /* Bits 0-27: Reserved */ +#define PINCONN_ODMODE4_P4p28 (1 << 28) /* Bit 28: P4.28 open drain mode */ +#define PINCONN_ODMODE4_P4p29 (1 << 29) /* Bit 29: P4.29 open drain mode */ + /* Bits 30-31: Reserved */ +/* I2C Pin Configuration register (I2CPADCFG: 0x4002c07c) */ + +#define PINCONN_I2CPADCFG_SDADRV0 (1 << 0) /* Bit 0: SDA0 pin, P0.27 in Fast Mode Plus */ +#define PINCONN_I2CPADCFG_SDAI2C0 (1 << 1) /* Bit 1: SDA0 pin, P0.27 I2C glitch + * filtering/slew rate control */ +#define PINCONN_I2CPADCFG_SCLDRV0 (1 << 2) /* Bit 2: SCL0 pin, P0.28 in Fast Mode Plus */ +#define PINCONN_I2CPADCFG_SCLI2C0 (1 << 3) /* Bit 3: SCL0 pin, P0.28 I2C glitch + * filtering/slew rate control */ + /* Bits 4-31: Reserved */ + +/************************************************************************************ + * Public Types + ************************************************************************************/ + +/************************************************************************************ + * Public Data + ************************************************************************************/ + +/************************************************************************************ + * Public Functions + ************************************************************************************/ + +#endif /* __ARCH_ARM_SRC_LPC17XX_CHIP_LPC176X_PINCONN_H */ diff --git a/nuttx/arch/arm/src/lpc17xx/chip/lpc178x_memorymap.h b/nuttx/arch/arm/src/lpc17xx/chip/lpc178x_memorymap.h index 295e1a0eed..dfee7d3759 100644 --- a/nuttx/arch/arm/src/lpc17xx/chip/lpc178x_memorymap.h +++ b/nuttx/arch/arm/src/lpc17xx/chip/lpc178x_memorymap.h @@ -97,7 +97,7 @@ /* -0x40023fff: Reserved */ #define LPC17_RTC_BASE 0x40024000 /* -0x40027fff: RTC + backup registers */ #define LPC17_GPIOINT_BASE 0x40028000 /* -0x4002bfff: GPIO interrupts */ -#define LPC17_PINCONN_BASE 0x4002c000 /* -0x4002ffff: Pin connect block */ +#define LPC17_IOCON_BASE 0x4002c000 /* -0x4002ffff: Pin connect block */ #define LPC17_SSP1_BASE 0x40030000 /* -0x40033fff: SSP 1 */ #define LPC17_ADC_BASE 0x40034000 /* -0x40037fff: ADC */ #define LPC17_CANAFRAM_BASE 0x40038000 /* -0x4003bfff: CAN acceptance filter (AF) RAM */ diff --git a/nuttx/arch/arm/src/lpc17xx/chip/lpc178x_pinconfig.h b/nuttx/arch/arm/src/lpc17xx/chip/lpc178x_pinconfig.h index 37a16c1e03..58bd413ea8 100644 --- a/nuttx/arch/arm/src/lpc17xx/chip/lpc178x_pinconfig.h +++ b/nuttx/arch/arm/src/lpc17xx/chip/lpc178x_pinconfig.h @@ -67,64 +67,64 @@ #define GPIO_I2C1_SCL_1 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN1) #define GPIO_UART0_RXD_1 (GPIO_ALT4 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN1) -#define GPIO_UART0_TXD (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN2) -#define GPIO_UART3_TXD (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN2) +#define GPIO_UART0_TXD_2 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN2) +#define GPIO_UART3_TXD_2 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN2) -#define GPIO_UART0_RXD (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN3) -#define GPIO_UART3_RXD (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN3) +#define GPIO_UART0_RXD_2 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN3) +#define GPIO_UART3_RXD_2 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN3) #define GPIO_I2S_RXCLK_1 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN4) -#define GPIO_CAN2_RD (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN4) -#define GPIO_CAP2p0 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN4) +#define GPIO_CAN2_RD_1 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN4) +#define GPIO_CAP2p0_1 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN4) #define GPIO_LCD_VD0_1 (GPIO_ALT4 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN4) #define GPIO_I2S_RXWS_1 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN5) -#define GPIO_CAN2_TD (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN5) -#define GPIO_CAP2p1 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN5) -#define GPIO_LCD_VD1_1 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN5) +#define GPIO_CAN2_TD_1 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN5) +#define GPIO_CAP2p1_1 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN5) +#define GPIO_LCD_VD1_1 (GPIO_ALT7 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN5) #define GPIO_I2S_RXSDA_1 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN6) -#define GPIO_SSP1_SSEL (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN6) +#define GPIO_SSP1_SSEL_1 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN6) #define GPIO_MAT2p0_1 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN6) #define GPIO_UART1_RTS_1 (GPIO_ALT4 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN6) -#define GPIO_LCD_VD8 (GPIO_ALT5 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN6) +#define GPIO_LCD_VD8_1 (GPIO_ALT5 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN6) #define GPIO_I2S_TXCLK_1 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN7) #define GPIO_SSP1_SCK_1 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN7) #define GPIO_MAT2p1_1 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN7) #define GPIO_RTC_EV0_1 (GPIO_ALT4 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN7) -#define GPIO_LCD_VD9 (GPIO_ALT5 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN7) +#define GPIO_LCD_VD9_1 (GPIO_ALT5 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN7) #define GPIO_I2S_TXWS_1 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN8) -#define GPIO_SSP1_MISO (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN8) -#define GPIO_MAT2p2 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN8) +#define GPIO_SSP1_MISO_1 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN8) +#define GPIO_MAT2p2_1 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN8) #define GPIO_RTC_EV1_1 (GPIO_ALT4 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN8) #define GPIO_LCD_VD16 (GPIO_ALT5 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN8) #define GPIO_I2S_TXSDA_1 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN9) -#define GPIO_SSP1_MOSI (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN9) -#define GPIO_MAT2p3 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN9) +#define GPIO_SSP1_MOSI_1 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN9) +#define GPIO_MAT2p3_1 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN9) #define GPIO_RTC_EV2_1 (GPIO_ALT4 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN9) #define GPIO_LCD_VD17 (GPIO_ALT5 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN9) #define GPIO_UART2_TXD_1 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN10) -#define GPIO_I2C2_SDA (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN10) -#define GPIO_MAT3p0 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN10) +#define GPIO_I2C2_SDA_1 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN10) +#define GPIO_MAT3p0_1 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN10) #define GPIO_UART2_RXD_1 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN11) -#define GPIO_I2C2_SCL (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN11) -#define GPIO_MAT3p1 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN11) +#define GPIO_I2C2_SCL_1 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN11) +#define GPIO_MAT3p1_1 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN11) #define GPIO_USB_PPWR2 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN12) -#define GPIO_SSP1_MISO (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN12) +#define GPIO_SSP1_MISO_2 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN12) #define GPIO_AD0p6 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN12) #define GPIO_USB_LED2 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN13) -#define GPIO_SSP1_MOSI (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN13) +#define GPIO_SSP1_MOSI_2 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN13) #define GPIO_AD0p7 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN13) #define GPIO_USB_HSTEN2 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN14) -#define GPIO_SSP1_SSEL (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN14) +#define GPIO_SSP1_SSEL_2 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN14) #define GPIO_USB_CONNECT2 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN14) #define GPIO_UART1_TXD_1 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN15) @@ -153,36 +153,36 @@ #define GPIO_UART1_RI_1 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN21) #define GPIO_SD_PWR (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN21) -#define GPIO_UART4_OE (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN21) +#define GPIO_UART4_OE_1 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN21) #define GPIO_CAN1_RD_2 (GPIO_ALT4 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN21) #define GPIO_UART4_SCLK (GPIO_ALT5 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN21) -#define GPIO_UART1_RTS_1 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN22) +#define GPIO_UART1_RTS_2 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN22) #define GPIO_SD_DAT0 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN22) -#define GPIO_UART4_TXD (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN22) +#define GPIO_UART4_TXD_1 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN22) #define GPIO_CAN1_TD_2 (GPIO_ALT4 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN22) #define GPIO_SPIFI_SCLK (GPIO_ALT5 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN22) #define GPIO_AD0p0 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN23) #define GPIO_I2S_RXCLK_2 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN23) -#define GPIO_CAP3p0 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN23) +#define GPIO_CAP3p0_1 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN23) #define GPIO_AD0p1 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN24) #define GPIO_I2S_RXWS_2 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN24) -#define GPIO_CAP3p1 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN24) +#define GPIO_CAP3p1_1 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN24) #define GPIO_AD0p2 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN25) #define GPIO_I2S_RXSDA_2 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN25) -#define GPIO_UART3_TXD_2 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN25) +#define GPIO_UART3_TXD_3 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN25) #define GPIO_AD0p3 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN26) #define GPIO_AOUT (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN26) -#define GPIO_UART3_RXD_2 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN26) +#define GPIO_UART3_RXD_3 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN26) -#define GPIO_I2C0_SDA (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN27) +#define GPIO_I2C0_SDA_1 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN27) #define GPIO_USB_SDA (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN27) -#define GPIO_I2C0_SCL (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN28) +#define GPIO_I2C0_SCL_1 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN28) #define GPIO_USB_SCL (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN28) #define GPIO_USB1DP (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN29) @@ -194,62 +194,62 @@ #define GPIO_USB2_DP (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT0 | GPIO_PIN31) #define GPIO_ENET_TXD0 (GPIO_ALT1 | GPIO_FLOAT | GPIO_PORT1 | GPIO_PIN0) -#define GPIO_CAP3p1 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN0) -#define GPIO_SSP2_SCK (GPIO_ALT4 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN0) +#define GPIO_CAP3p1_2 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN0) +#define GPIO_SSP2_SCK (GPIO_ALT4 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN0) #define GPIO_ENET_TXD1 (GPIO_ALT1 | GPIO_FLOAT | GPIO_PORT1 | GPIO_PIN1) -#define GPIO_MAT3p3 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN1) -#define GPIO_SSP2_MOSI (GPIO_ALT4 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN1) +#define GPIO_MAT3p3_1 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN1) +#define GPIO_SSP2_MOSI (GPIO_ALT4 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN1) #define GPIO_ENET_TXD2 (GPIO_ALT1 | GPIO_FLOAT | GPIO_PORT1 | GPIO_PIN2) -#define GPIO_SD_CLK (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN2) -#define GPIO_PWM0p1 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN2) +#define GPIO_SD_CLK (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN2) +#define GPIO_PWM0p1_1 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN2) #define GPIO_ENET_TXD3 (GPIO_ALT1 | GPIO_FLOAT | GPIO_PORT1 | GPIO_PIN3) -#define GPIO_SD_CMD (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN3) -#define GPIO_PWM0p2 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN3) +#define GPIO_SD_CMD (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN3) +#define GPIO_PWM0p2_1 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN3) #define GPIO_ENET_TXEN (GPIO_ALT1 | GPIO_FLOAT | GPIO_PORT1 | GPIO_PIN4) -#define GPIO_MAT3p2 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN4) -#define GPIO_SSP2_MISO (GPIO_ALT4 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN4) +#define GPIO_MAT3p2_1 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN4) +#define GPIO_SSP2_MISO (GPIO_ALT4 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN4) #define GPIO_ENET_TX_ER (GPIO_ALT1 | GPIO_FLOAT | GPIO_PORT1 | GPIO_PIN5) -#define GPIO_SD_PWR (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN5) -#define GPIO_PWM0p3 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN5) +#define GPIO_SD_PWR (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN5) +#define GPIO_PWM0p3_1 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN5) #define GPIO_ENET_TX_CLK (GPIO_ALT1 | GPIO_FLOAT | GPIO_PORT1 | GPIO_PIN6) -#define GPIO_SD_DAT0 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN6) -#define GPIO_PWM0p4 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN6) +#define GPIO_SD_DAT0 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN6) +#define GPIO_PWM0p4_1 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN6) #define GPIO_ENET_COL (GPIO_ALT1 | GPIO_FLOAT | GPIO_PORT1 | GPIO_PIN7) -#define GPIO_SD_DAT1 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN7) -#define GPIO_PWM0p5 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN7) +#define GPIO_SD_DAT1 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN7) +#define GPIO_PWM0p5_1 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN7) #define GPIO_ENET_CRSDV (GPIO_ALT1 | GPIO_FLOAT | GPIO_PORT1 | GPIO_PIN8) -#define GPIO_MAT3p1 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN8) -#define GPIO_SSP2_SSEL (GPIO_ALT4 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN8) +#define GPIO_MAT3p1_2 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN8) +#define GPIO_SSP2_SSEL (GPIO_ALT4 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN8) #define GPIO_ENET_RXD0 (GPIO_ALT1 | GPIO_FLOAT | GPIO_PORT1 | GPIO_PIN9) -#define GPIO_MAT3p0 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN9) +#define GPIO_MAT3p0_2 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN9) #define GPIO_ENET_RXD1 (GPIO_ALT1 | GPIO_FLOAT | GPIO_PORT1 | GPIO_PIN10) -#define GPIO_CAP3p0 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN10) +#define GPIO_CAP3p0_2 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN10) #define GPIO_ENET_RXD2 (GPIO_ALT1 | GPIO_FLOAT | GPIO_PORT1 | GPIO_PIN11) #define GPIO_SD_DAT2 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN11) -#define GPIO_PWM0p6 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN11) +#define GPIO_PWM0p6_1 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN11) #define GPIO_ENET_RXD3 (GPIO_ALT1 | GPIO_FLOAT | GPIO_PORT1 | GPIO_PIN12) #define GPIO_SD_DAT3 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN12) -#define GPIO_PWM0CAPp0 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN12) +#define GPIO_PWM0CAPp0_1 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN12) #define GPIO_ENET_RX_DV (GPIO_ALT1 | GPIO_FLOAT | GPIO_PORT1 | GPIO_PIN13) #define GPIO_ENET_RXER (GPIO_ALT1 | GPIO_FLOAT | GPIO_PORT1 | GPIO_PIN14) -#define GPIO_CAP2p0 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN14) +#define GPIO_CAP2p0_2 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN14) #define GPIO_ENET_REFCLK (GPIO_ALT1 | GPIO_FLOAT | GPIO_PORT1 | GPIO_PIN15) -#define GPIO_I2C2_SDA (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN15) +#define GPIO_I2C2_SDA_2 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN15) #define GPIO_ENET_MDC_1 (GPIO_ALT1 | GPIO_FLOAT | GPIO_PORT1 | GPIO_PIN16) #define GPIO_I2S_TXMCLK (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN16) @@ -259,83 +259,83 @@ #define GPIO_USB_UPLED (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN18) #define GPIO_PWM1p1_1 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN18) -#define GPIO_CAP1p0 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN18) -#define GPIO_SSP1_MISO (GPIO_ALT5 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN18) +#define GPIO_CAP1p0_1 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN18) +#define GPIO_SSP1_MISO_3 (GPIO_ALT5 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN18) #define GPIO_USB1_TXE (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN19) #define GPIO_USB1_PPWR (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN19) -#define GPIO_CAP1p1 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN19) +#define GPIO_CAP1p1_1 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN19) #define GPIO_MCPWM_MC0A (GPIO_ALT4 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN19) -#define GPIO_SSP1_SCK (GPIO_ALT5 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN19) -#define GPIO_UART2_OE (GPIO_ALT6 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN19) +#define GPIO_SSP1_SCK_2 (GPIO_ALT5 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN19) +#define GPIO_UART2_OE_1 (GPIO_ALT6 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN19) #define GPIO_USB1_TXDP (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN20) #define GPIO_PWM1p2_1 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN20) #define GPIO_QEI_PHA (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN20) #define GPIO_MCPWM_MCFB0 (GPIO_ALT4 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN20) -#define GPIO_SSP0_SCK (GPIO_ALT5 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN20) -#define GPIO_LCD_VD6 (GPIO_ALT6 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN20) -#define GPIO_LCD_VD10 (GPIO_ALT7 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN20) +#define GPIO_SSP0_SCK_2 (GPIO_ALT5 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN20) +#define GPIO_LCD_VD6_1 (GPIO_ALT6 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN20) +#define GPIO_LCD_VD10_1 (GPIO_ALT7 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN20) #define GPIO_USB1_TXDM (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN21) #define GPIO_PWM1p3_1 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN21) #define GPIO_SSP0_SSEL_2 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN21) #define GPIO_MCPWM_ABORT (GPIO_ALT4 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN21) -#define GPIO_LCD_VD7 (GPIO_ALT6 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN21) -#define GPIO_LCD_VD11 (GPIO_ALT7 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN21) +#define GPIO_LCD_VD7_1 (GPIO_ALT6 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN21) +#define GPIO_LCD_VD11_1 (GPIO_ALT7 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN21) #define GPIO_USB1_RCV (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN22) #define GPIO_USB1_PWRD (GPIO_ALT2 | GPIO_PULLDN | GPIO_PORT1 | GPIO_PIN22) -#define GPIO_MAT1p0 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN22) +#define GPIO_MAT1p0_1 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN22) #define GPIO_MCPWM_MCOB (GPIO_ALT4 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN22) -#define GPIO_SSP1_MOSI (GPIO_ALT5 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN22) -#define GPIO_LCD_VD8 (GPIO_ALT6 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN22) -#define GPIO_LCD_VD12 (GPIO_ALT7 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN22) +#define GPIO_SSP1_MOSI_3 (GPIO_ALT5 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN22) +#define GPIO_LCD_VD8_2 (GPIO_ALT6 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN22) +#define GPIO_LCD_VD12_1 (GPIO_ALT7 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN22) #define GPIO_USB1_RXDP (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN23) -#define GPIO_PWM1p4 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN23) +#define GPIO_PWM1p4_1 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN23) #define GPIO_QEI_PHB (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN23) #define GPIO_MCPWM_MCFB1 (GPIO_ALT4 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN23) -#define GPPIO_SSP0_MOSI (GPIO_ALT5 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN23) -#define GPIO_LCD_VD9 (GPIO_ALT6 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN23) -#define GPIO_LCD_VD13 (GPIO_ALT7 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN23) +#define GPIO_SSP0_MOSI_2 (GPIO_ALT5 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN23) +#define GPIO_LCD_VD9_2 (GPIO_ALT6 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN23) +#define GPIO_LCD_VD13_1 (GPIO_ALT7 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN23) #define GPIO_USB1_RXDM (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN24) #define GPIO_PWM1p5_1 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN24) #define GPIO_QEI_IDX (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN24) #define GPIO_MCPWM_MCFB2 (GPIO_ALT4 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN24) -#define GPIO_SSP0_MOSI_2 (GPIO_ALT5 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN24) -#define GPIO_LCD_VD10_VD14 (GPIO_ALT6 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN24) -#define GPIO_LCD_VD10_VD14 (GPIO_ALT7 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN24) +#define GPIO_SSP0_MOSI_3 (GPIO_ALT5 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN24) +#define GPIO_LCD_VD10_14_1 (GPIO_ALT6 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN24) +#define GPIO_LCD_VD10_14_2 (GPIO_ALT7 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN24) #define GPIO_USB1_LS (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN25) #define GPIO_USB1_HSTEN (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN25) -#define GPIO_MAT1p1 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN25) +#define GPIO_MAT1p1_1 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN25) #define GPIO_MCPWM_MC1A (GPIO_ALT4 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN25) #define GPIO_CLKOUT_ (GPIO_ALT5 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN25) -#define GPIO_LCD_VD11 (GPIO_ALT6 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN25) -#define GPIO_LCD_VD15 (GPIO_ALT7 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN25) +#define GPIO_LCD_VD11_2 (GPIO_ALT6 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN25) +#define GPIO_LCD_VD15_1 (GPIO_ALT7 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN25) #define GPIO_USB1_SSPND (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN26) #define GPIO_PWM1p6_1 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN26) -#define GPIO_CAP0p0 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN26) +#define GPIO_CAP0p0_1 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN26) #define GPIO_MCPWM_MC1B (GPIO_ALT4 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN26) -#define GPIO_SSP1_SSEL (GPIO_ALT5 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN26) -#define GPIO_LCD_VD12 (GPIO_ALT6 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN26) +#define GPIO_SSP1_SSEL_3 (GPIO_ALT5 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN26) +#define GPIO_LCD_VD12_2 (GPIO_ALT6 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN26) #define GPIO_LCD_VD20 (GPIO_ALT7 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN26) #define GPIO_USB1_INT (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN27) #define GPIO_USB1_OVRCR (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN27) -#define GPIO_CAP0p1 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN27) +#define GPIO_CAP0p1_1 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN27) #define GPIO_CLKOUT_2 (GPIO_ALT4 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN27) -#define GPIO_LCD_VD13 (GPIO_ALT6 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN27) +#define GPIO_LCD_VD13_2 (GPIO_ALT6 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN27) #define GPIO_LCD_VD21 (GPIO_ALT7 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN27) #define GPIO_USB1_SCL (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN28) #define GPIO_PCAP1p0_1 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN28) #define GPIO_MAT0p0_1 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN28) #define GPIO_MCPWM_MC2A (GPIO_ALT4 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN28) -#define GPIO_SSP0_SSEL (GPIO_ALT5 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN28) +#define GPIO_SSP0_SSEL_2 (GPIO_ALT5 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN28) #define GPIO_LCD_VD14 (GPIO_ALT6 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN28) #define GPIO_LCD_VD22 (GPIO_ALT7 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN28) @@ -343,20 +343,20 @@ #define GPIO_PCAP1p1 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN29) #define GPIO_MAT0p1_1 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN29) #define GPIO_MCPWM_MC2B (GPIO_ALT4 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN29) -#define GPIO_UART4_TXD (GPIO_ALT5 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN29) -#define GPIO_LCD_VD15 (GPIO_ALT6 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN29) +#define GPIO_UART4_TXD_2 (GPIO_ALT5 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN29) +#define GPIO_LCD_VD15_2 (GPIO_ALT6 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN29) #define GPIO_LCD_VD23 (GPIO_ALT7 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN29) #define GPIO_USB2_PWRD (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN30) #define GPIO_USB_VBUS (GPIO_ALT2 | GPIO_FLOAT | GPIO_PORT1 | GPIO_PIN30) #define GPIO_AD0p4 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN30) -#define GPIO_I2C0_SDA (GPIO_ALT4 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN30) +#define GPIO_I2C0_SDA_2 (GPIO_ALT4 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN30) #define GPIO_UART3_OE (GPIO_ALT5 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN30) #define GPIO_USB2_OVRCR (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN31) -#define GPIO_SSP1_SCK_2 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN31) +#define GPIO_SSP1_SCK_3 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN31) #define GPIO_AD0p5 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN31) -#define GPIO_I2C0_SCL (GPIO_ALT4 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN31) +#define GPIO_I2C0_SCL_2 (GPIO_ALT4 | GPIO_PULLUP | GPIO_PORT1 | GPIO_PIN31) #define GPIO_PWM1p1_2 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN0) #define GPIO_UART1_TXD_2 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN0) @@ -368,54 +368,54 @@ #define GPIO_PWM1p3_2 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN2) #define GPIO_UART1_CTS_2 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN2) -#define GPIO_MAT2p3 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN2) +#define GPIO_MAT2p3_2 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN2) #define GPIO_TRACEDATA3 (GPIO_ALT5 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN2) #define GPIO_LCD_DCLK (GPIO_ALT7 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN2) #define GPIO_PWM1p4_2 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN3) #define GPIO_UART1_DCD_2 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN3) -#define GPIO_MAT2p2 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN3) +#define GPIO_MAT2p2_2 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN3) #define GPIO_TRACEDATA2 (GPIO_ALT5 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN3) #define GPIO_LCD_FP (GPIO_ALT7 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN3) #define GPIO_PWM1p5_2 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN4) #define GPIO_UART1_DSR_2 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN4) -#define GPIO_MAT2p1 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN4) +#define GPIO_MAT2p1_2 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN4) #define GPIO_TRACEDATA1 (GPIO_ALT5 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN4) #define GPIO_LCD_ENABM (GPIO_ALT7 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN4) #define GPIO_PWM1p6_2 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN5) #define GPIO_UART1_DTR_2 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN5) -#define GPIO_MAT2p0 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN5) +#define GPIO_MAT2p0_2 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN5) #define GPIO_TRACEDATA0 (GPIO_ALT5 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN5) #define GPIO_LCD_LP (GPIO_ALT7 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN5) #define GPIO_PCAP1p0_2 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN6) #define GPIO_UART1_RI_2 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN6) -#define GPIO_CAP2p0 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN6) -#define GPIO_UART2_OE (GPIO_ALT4 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN6) +#define GPIO_CAP2p0_3 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN6) +#define GPIO_UART2_OE_2 (GPIO_ALT4 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN6) #define GPIO_TRACECLK (GPIO_ALT5 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN6) #define GPIO_LCD_VD0_2 (GPIO_ALT6 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN6) -#define GPIO_LCD_VD4 (GPIO_ALT7 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN6) +#define GPIO_LCD_VD4_1 (GPIO_ALT7 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN6) #define GPIO_CAN2_RD_2 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN7) #define GPIO_UART1_RTS_2 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN7) #define GPIO_SPIFI_CS (GPIO_ALT5 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN7) #define GPIO_LCD_VD1_2 (GPIO_ALT6 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN7) -#define GPIO_LCD_VD5 (GPIO_ALT7 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN7) +#define GPIO_LCD_VD5_1 (GPIO_ALT7 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN7) #define GPIO_CAN2_TD_2 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN8) #define GPIO_UART2_TXD_2 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN8) -#define GPIO_UART1_CTS (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN8) +#define GPIO_UART1_CTS_3 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN8) #define GPIO_ENET_MDC_2 (GPIO_ALT4 | GPIO_FLOAT | GPIO_PORT2 | GPIO_PIN8) -#define GPIO_LCD_VD2 (GPIO_ALT6 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN8) -#define GPIO_LCD_VD6 (GPIO_ALT7 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN8) +#define GPIO_LCD_VD2_1 (GPIO_ALT6 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN8) +#define GPIO_LCD_VD6_2 (GPIO_ALT7 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN8) #define GPIO_USB1_CONNECT (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN9) #define GPIO_UART2_RXD_2 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN9) -#define GPIO_UART4_RXD_2 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN9) +#define GPIO_UART4_RXD_1 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN9) #define GPIO_ENET_MDIO_2 (GPIO_ALT4 | GPIO_FLOAT | GPIO_PORT2 | GPIO_PIN9) -#define GPIO_LCD_VD3 (GPIO_ALT6 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN9) +#define GPIO_LCD_VD3_1 (GPIO_ALT6 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN9) #define GPIO_LCD_VD7 (GPIO_ALT7 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN9) #define GPIO_EINT0 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN10) @@ -429,25 +429,25 @@ #define GPIO_EINT2 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN12) #define GPIO_SD_DAT2 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN12) #define GPIO_I2S_TXWS_2 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN12) -#define GPIO_LCD_VD4 (GPIO_ALT4 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN12) -#define GPIO_LCD_VD3 (GPIO_ALT5 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN12) +#define GPIO_LCD_VD4_2 (GPIO_ALT4 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN12) +#define GPIO_LCD_VD3_2 (GPIO_ALT5 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN12) #define GPIO_LCD_VD8 (GPIO_ALT6 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN12) #define GPIO_LCD_VD18 (GPIO_ALT7 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN12) #define GPIO_EINT3 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN13) #define GPIO_SD_DAT3 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN13) #define GPIO_I2S_TXSDA_2 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN13) -#define GPIO_LCD_VD5 (GPIO_ALT5 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN13) -#define GPIO_LCD_VD9 (GPIO_ALT6 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN13) +#define GPIO_LCD_VD5_2 (GPIO_ALT5 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN13) +#define GPIO_LCD_VD9_3 (GPIO_ALT6 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN13) #define GPIO_LCD_VD19 (GPIO_ALT7 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN13) #define GPIO_EMC_CS2 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN14) -#define GPIO_I2C1_SDA (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN14) -#define GPIO_CAP2p0 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN14) +#define GPIO_I2C1_SDA_3 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN14) +#define GPIO_CAP2p0_4 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN14) #define GPIO_EMC_CS3 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN15) #define GPIO_I2C1_SCL (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN15) -#define GPIO_CAP2p1 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN15) +#define GPIO_CAP2p1_2 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN15) #define GPIO_EMC_CAS (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN16) #define GPIO_EMC_RAS (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN17) @@ -458,34 +458,34 @@ #define GPIO_EMC_DYCS1 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN21) #define GPIO_EMC_DYCS2 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN22) -#define GPIO_SSP0_SCK (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN22) -#define GPIO_CAP3p0 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN22) +#define GPIO_SSP0_SCK_3 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN22) +#define GPIO_CAP3p0_3 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN22) #define GPIO_EMC_DYCS3 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN23) -#define GPIO_SSP0_SSEL (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN23) -#define GPIO_CAP3p1 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN23) +#define GPIO_SSP0_SSEL_3 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN23) +#define GPIO_CAP3p1_3 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN23) #define GPIO_EMC_CKE0 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN24) #define GPIO_EMC_CKE1 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN25) #define GPIO_EMC_CKE2 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN26) -#define GPIO_SSP0_MISO (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN26) -#define GPIO_MAT3p0 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN26) +#define GPIO_SSP0_MISO_2 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN26) +#define GPIO_MAT3p0_3 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN26) #define GPIO_EMC_CKE3 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN27) -#define GPIO_SSP0_MOSI (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN27) -#define GPIO_MAT3p1 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN27) +#define GPIO_SSP0_MOSI_4 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN27) +#define GPIO_MAT3p1_3 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN27) #define GPIO_EMC_DQM0 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN28) #define GPIO_EMC_DQM1 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN29) #define GPIO_EMC_DQM2 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN30) -#define GPIO_I2C2_SDA (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN30) -#define GPIO_MAT3p2 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN30) +#define GPIO_I2C2_SDA_3 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN30) +#define GPIO_MAT3p2_2 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN30) #define GPIO_EMC_DQM3 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN30) -#define GPIO_I2C2_SCL (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN30) -#define GPIO_MAT3p3 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN30) +#define GPIO_I2C2_SCL_2 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN30) +#define GPIO_MAT3p3_2 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT2 | GPIO_PIN30) #define GPIO_EMC_D0 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT3 | GPIO_PIN0) #define GPIO_EMC_D1 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT3 | GPIO_PIN1) @@ -505,65 +505,65 @@ #define GPIO_EMC_D15 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT3 | GPIO_PIN15) #define GPIO_EMC_D16 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT3 | GPIO_PIN16) -#define GPIO_PWM0p1 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT3 | GPIO_PIN16) -#define GPIO_UART1_TXD (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT3 | GPIO_PIN16) +#define GPIO_PWM0p1_2 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT3 | GPIO_PIN16) +#define GPIO_UART1_TXD_3 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT3 | GPIO_PIN16) #define GPIO_EMC_D17 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT3 | GPIO_PIN17) -#define GPIO_PWM0p2 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT3 | GPIO_PIN17) -#define GPIO_UART1_RXD (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT3 | GPIO_PIN17) +#define GPIO_PWM0p2_2 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT3 | GPIO_PIN17) +#define GPIO_UART1_RXD_3 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT3 | GPIO_PIN17) #define GPIO_EMC_D18 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT3 | GPIO_PIN18) -#define GPIO_PWM0p3 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT3 | GPIO_PIN18) -#define GPIO_UART1_CTS (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT3 | GPIO_PIN18) +#define GPIO_PWM0p3_2 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT3 | GPIO_PIN18) +#define GPIO_UART1_CTS_4 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT3 | GPIO_PIN18) #define GPIO_EMC_D19 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT3 | GPIO_PIN19) -#define GPIO_PWM0p4 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT3 | GPIO_PIN19) -#define GPIO_UART1_DCD (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT3 | GPIO_PIN19) +#define GPIO_PWM0p4_2 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT3 | GPIO_PIN19) +#define GPIO_UART1_DCD_3 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT3 | GPIO_PIN19) #define GPIO_EMC_D20 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT3 | GPIO_PIN20) -#define GPIO_PWM0p5 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT3 | GPIO_PIN20) -#define GPIO_UART1_DSR (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT3 | GPIO_PIN20) +#define GPIO_PWM0p5_2 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT3 | GPIO_PIN20) +#define GPIO_UART1_DSR_3 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT3 | GPIO_PIN20) #define GPIO_EMC_D21 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT3 | GPIO_PIN21) -#define GPIO_PWM0p6 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT3 | GPIO_PIN21) -#define GPIO_UART1_DTR (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT3 | GPIO_PIN21) +#define GPIO_PWM0p6_2 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT3 | GPIO_PIN21) +#define GPIO_UART1_DTR_3 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT3 | GPIO_PIN21) #define GPIO_EMC_D22 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT3 | GPIO_PIN22) -#define GPIO_PWM0CAPp0 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT3 | GPIO_PIN22) -#define GPIO_UART1_RI (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT3 | GPIO_PIN22) +#define GPIO_PWM0CAPp0_2 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT3 | GPIO_PIN22) +#define GPIO_UART1_RI_3 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT3 | GPIO_PIN22) #define GPIO_EMC_D23 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT3 | GPIO_PIN23) #define GPIO_PWM1CAPp0 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT3 | GPIO_PIN23) -#define GPIO_CAP0p0 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT3 | GPIO_PIN23) +#define GPIO_CAP0p0_2 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT3 | GPIO_PIN23) #define GPIO_EMC_D24 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT3 | GPIO_PIN24) -#define GPIO_PWM1p1 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT3 | GPIO_PIN24) -#define GPIO_CAP0p1 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT3 | GPIO_PIN24) +#define GPIO_PWM1p1_3 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT3 | GPIO_PIN24) +#define GPIO_CAP0p1_2 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT3 | GPIO_PIN24) #define GPIO_EMC_D25 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT3 | GPIO_PIN25) -#define GPIO_PWM1p2 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT3 | GPIO_PIN25) -#define GPIO_MAT0p0 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT3 | GPIO_PIN25) +#define GPIO_PWM1p2_3 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT3 | GPIO_PIN25) +#define GPIO_MAT0p0_2 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT3 | GPIO_PIN25) #define GPIO_EMC_D26 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT3 | GPIO_PIN26) -#define GPIO_PWM1p3 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT3 | GPIO_PIN26) -#define GPIO_MAT0p1 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT3 | GPIO_PIN26) +#define GPIO_PWM1p3_3 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT3 | GPIO_PIN26) +#define GPIO_MAT0p1_2 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT3 | GPIO_PIN26) #define GPIO_STCLK (GPIO_ALT4 | GPIO_PULLUP | GPIO_PORT3 | GPIO_PIN26) #define GPIO_EMC_D27 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT3 | GPIO_PIN27) -#define GPIO_PWM1p4 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT3 | GPIO_PIN27) -#define GPIO_CAP1p0 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT3 | GPIO_PIN27) +#define GPIO_PWM1p4_3 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT3 | GPIO_PIN27) +#define GPIO_CAP1p0_2 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT3 | GPIO_PIN27) #define GPIO_EMC_D28 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT3 | GPIO_PIN28) -#define GPIO_PWM1p5 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT3 | GPIO_PIN28) -#define GPIO_CAP1p1 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT3 | GPIO_PIN28) +#define GPIO_PWM1p5_3 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT3 | GPIO_PIN28) +#define GPIO_CAP1p1_2 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT3 | GPIO_PIN28) #define GPIO_EMC_D29 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT3 | GPIO_PIN29) -#define GPIO_PWM1p6 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT3 | GPIO_PIN29) -#define GPIO_MAT1p0 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT3 | GPIO_PIN29) +#define GPIO_PWM1p6_3 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT3 | GPIO_PIN29) +#define GPIO_MAT1p0_2 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT3 | GPIO_PIN29) #define GPIO_EMC_D30 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT3 | GPIO_PIN30) -#define GPIO_UART1_RTS (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT3 | GPIO_PIN30) -#define GPIO_MAT1p1 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT3 | GPIO_PIN30) +#define GPIO_UART1_RTS_3 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT3 | GPIO_PIN30) +#define GPIO_MAT1p1_2 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT3 | GPIO_PIN30) #define GPIO_EMC_D31 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT3 | GPIO_PIN31) #define GPIO_MAT1p2 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT3 | GPIO_PIN31) @@ -590,20 +590,20 @@ #define GPIO_EMC_A19 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT4 | GPIO_PIN19) #define GPIO_EMC_A20 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT4 | GPIO_PIN20) -#define GPIO_I2C2_SDA (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT4 | GPIO_PIN20) -#define GPIO_SSP1_SCK (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT4 | GPIO_PIN20) +#define GPIO_I2C2_SDA_4 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT4 | GPIO_PIN20) +#define GPIO_SSP1_SCK_4 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT4 | GPIO_PIN20) #define GPIO_EMC_A21 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT4 | GPIO_PIN21) -#define GPIO_I2C2_SCL (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT4 | GPIO_PIN21) -#define GPIO_SSP1_SSEL (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT4 | GPIO_PIN21) +#define GPIO_I2C2_SCL_4 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT4 | GPIO_PIN21) +#define GPIO_SSP1_SSEL_4 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT4 | GPIO_PIN21) #define GPIO_EMC_A22 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT4 | GPIO_PIN22) -#define GPIO_UART2_TXD (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT4 | GPIO_PIN22) -#define GPIO_SSP1_MISO (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT4 | GPIO_PIN22) +#define GPIO_UART2_TXD_3 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT4 | GPIO_PIN22) +#define GPIO_SSP1_MISO_4 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT4 | GPIO_PIN22) #define GPIO_EMC_A23 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT4 | GPIO_PIN23) -#define GPIO_UART2_RXD (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT4 | GPIO_PIN23) -#define GPIO_SSP1_MOSI (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT4 | GPIO_PIN23) +#define GPIO_UART2_RXD_3 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT4 | GPIO_PIN23) +#define GPIO_SSP1_MOSI_4 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT4 | GPIO_PIN23) #define GPIO_EMC_OE (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT4 | GPIO_PIN24) #define GPIO_EMC_WE (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT4 | GPIO_PIN25) @@ -611,38 +611,38 @@ #define GPIO_EMC_BLS1 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT4 | GPIO_PIN27) #define GPIO_EMC_BLS2 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT4 | GPIO_PIN28) -#define GPIO_UART3_TXD (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT4 | GPIO_PIN28) -#define GPIO_MAT2p0 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT4 | GPIO_PIN28) -#define GPIO_LCD_VD6 (GPIO_ALT5 | GPIO_PULLUP | GPIO_PORT4 | GPIO_PIN28) -#define GPIO_LCD_VD10 (GPIO_ALT6 | GPIO_PULLUP | GPIO_PORT4 | GPIO_PIN28) -#define GPIO_LCD_VD2 (GPIO_ALT7 | GPIO_PULLUP | GPIO_PORT4 | GPIO_PIN28) +#define GPIO_UART3_TXD_4 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT4 | GPIO_PIN28) +#define GPIO_MAT2p0_3 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT4 | GPIO_PIN28) +#define GPIO_LCD_VD6_3 (GPIO_ALT5 | GPIO_PULLUP | GPIO_PORT4 | GPIO_PIN28) +#define GPIO_LCD_VD10_2 (GPIO_ALT6 | GPIO_PULLUP | GPIO_PORT4 | GPIO_PIN28) +#define GPIO_LCD_VD2_2 (GPIO_ALT7 | GPIO_PULLUP | GPIO_PORT4 | GPIO_PIN28) #define GPIO_EMC_BLS3 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT4 | GPIO_PIN29) -#define GPIO_UART3_RXD (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT4 | GPIO_PIN29) -#define GPIO_MAT2p1 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT4 | GPIO_PIN29) -#define GPIO_I2C2_SCL (GPIO_ALT4 | GPIO_PULLUP | GPIO_PORT4 | GPIO_PIN29) -#define GPIO_LCD_VD7 (GPIO_ALT5 | GPIO_PULLUP | GPIO_PORT4 | GPIO_PIN29) -#define GPIO_LCD_VD11 (GPIO_ALT6 | GPIO_PULLUP | GPIO_PORT4 | GPIO_PIN29) -#define GPIO_LCD_VD2 (GPIO_ALT7 | GPIO_PULLUP | GPIO_PORT4 | GPIO_PIN29) +#define GPIO_UART3_RXD_4 (GPIO_ALT2 | GPIO_PULLUP | GPIO_PORT4 | GPIO_PIN29) +#define GPIO_MAT2p1_3 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT4 | GPIO_PIN29) +#define GPIO_I2C2_SCL_3 (GPIO_ALT4 | GPIO_PULLUP | GPIO_PORT4 | GPIO_PIN29) +#define GPIO_LCD_VD7_2 (GPIO_ALT5 | GPIO_PULLUP | GPIO_PORT4 | GPIO_PIN29) +#define GPIO_LCD_VD11_3 (GPIO_ALT6 | GPIO_PULLUP | GPIO_PORT4 | GPIO_PIN29) +#define GPIO_LCD_VD2_3 (GPIO_ALT7 | GPIO_PULLUP | GPIO_PORT4 | GPIO_PIN29) #define GPIO_EMC_CS0 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT4 | GPIO_PIN30) #define GPIO_EMC_CS1 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT4 | GPIO_PIN31) #define GPIO_EMC_A24 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT5 | GPIO_PIN0) -#define GPIO_MAT2p2 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT5 | GPIO_PIN0) +#define GPIO_MAT2p2_3 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT5 | GPIO_PIN0) #define GPIO_EMC_A25 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT5 | GPIO_PIN1) -#define GPIO_MAT2p3 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT5 | GPIO_PIN1) +#define GPIO_MAT2p3_3 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT5 | GPIO_PIN1) -#define GPIO_MAT3p2 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT5 | GPIO_PIN2) -#define GPIO_I2C0_SDA (GPIO_ALT5 | GPIO_PULLUP | GPIO_PORT5 | GPIO_PIN2) +#define GPIO_MAT3p2_3 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT5 | GPIO_PIN2) +#define GPIO_I2C0_SDA_3 (GPIO_ALT5 | GPIO_PULLUP | GPIO_PORT5 | GPIO_PIN2) -#define GPIO_UART4_RXD (GPIO_ALT4 | GPIO_PULLUP | GPIO_PORT5 | GPIO_PIN3) +#define GPIO_UART4_RXD_2 (GPIO_ALT4 | GPIO_PULLUP | GPIO_PORT5 | GPIO_PIN3) #define GPIO_I2C0_SCL0 (GPIO_ALT5 | GPIO_PULLUP | GPIO_PORT5 | GPIO_PIN3) -#define GPIO_UART4_OE (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT5 | GPIO_PIN4) -#define GPIO_MAT3p3 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT5 | GPIO_PIN4) -#define GPIO_UART4_TXD (GPIO_ALT4 | GPIO_PULLUP | GPIO_PORT5 | GPIO_PIN4) +#define GPIO_UART4_OE_2 (GPIO_ALT1 | GPIO_PULLUP | GPIO_PORT5 | GPIO_PIN4) +#define GPIO_MAT3p3_3 (GPIO_ALT3 | GPIO_PULLUP | GPIO_PORT5 | GPIO_PIN4) +#define GPIO_UART4_TXD_3 (GPIO_ALT4 | GPIO_PULLUP | GPIO_PORT5 | GPIO_PIN4) /************************************************************************************ * Public Types diff --git a/nuttx/arch/arm/src/lpc17xx/chip/lpc17_pinconn.h b/nuttx/arch/arm/src/lpc17xx/chip/lpc17_pinconn.h index d8b8e0d37d..c432c6f258 100644 --- a/nuttx/arch/arm/src/lpc17xx/chip/lpc17_pinconn.h +++ b/nuttx/arch/arm/src/lpc17xx/chip/lpc17_pinconn.h @@ -42,584 +42,20 @@ #include -#include "chip.h" -#include "chip/lpc17_memorymap.h" +#include + +#if defined(LPC176x) +# include "chip/lpc176x_pinconn.h" +#elif defined(LPC178x) +# include "chip/lpc178x_pinconn.h" +#else +# error "Unrecognized LPC17xx family" +#endif /************************************************************************************ * Pre-processor Definitions ************************************************************************************/ -/* Register offsets *****************************************************************/ - -#define LPC17_PINCONN_PINSEL0_OFFSET 0x0000 /* Pin function select register 0 */ -#define LPC17_PINCONN_PINSEL1_OFFSET 0x0004 /* Pin function select register 1 */ -#define LPC17_PINCONN_PINSEL2_OFFSET 0x0008 /* Pin function select register 2 */ -#define LPC17_PINCONN_PINSEL3_OFFSET 0x000c /* Pin function select register 3 */ -#define LPC17_PINCONN_PINSEL4_OFFSET 0x0010 /* Pin function select register 4 */ -#define LPC17_PINCONN_PINSEL7_OFFSET 0x001c /* Pin function select register 7 */ -#define LPC17_PINCONN_PINSEL8_OFFSET 0x0020 /* Pin function select register 8 */ -#define LPC17_PINCONN_PINSEL9_OFFSET 0x0024 /* Pin function select register 9 */ -#define LPC17_PINCONN_PINSEL10_OFFSET 0x0028 /* Pin function select register 10 */ -#define LPC17_PINCONN_PINMODE0_OFFSET 0x0040 /* Pin mode select register 0 */ -#define LPC17_PINCONN_PINMODE1_OFFSET 0x0044 /* Pin mode select register 1 */ -#define LPC17_PINCONN_PINMODE2_OFFSET 0x0048 /* Pin mode select register 2 */ -#define LPC17_PINCONN_PINMODE3_OFFSET 0x004c /* Pin mode select register 3 */ -#define LPC17_PINCONN_PINMODE4_OFFSET 0x0050 /* Pin mode select register 4 */ -#define LPC17_PINCONN_PINMODE5_OFFSET 0x0054 /* Pin mode select register 5 */ -#define LPC17_PINCONN_PINMODE6_OFFSET 0x0058 /* Pin mode select register 6 */ -#define LPC17_PINCONN_PINMODE7_OFFSET 0x005c /* Pin mode select register 7 */ -#define LPC17_PINCONN_PINMODE9_OFFSET 0x0064 /* Pin mode select register 9 */ -#define LPC17_PINCONN_ODMODE0_OFFSET 0x0068 /* Open drain mode control register 0 */ -#define LPC17_PINCONN_ODMODE1_OFFSET 0x006c /* Open drain mode control register 1 */ -#define LPC17_PINCONN_ODMODE2_OFFSET 0x0070 /* Open drain mode control register 2 */ -#define LPC17_PINCONN_ODMODE3_OFFSET 0x0074 /* Open drain mode control register 3 */ -#define LPC17_PINCONN_ODMODE4_OFFSET 0x0078 /* Open drain mode control register 4 */ -#define LPC17_PINCONN_I2CPADCFG_OFFSET 0x007c /* I2C Pin Configuration register */ - -/* Register addresses ***************************************************************/ - -#define LPC17_PINCONN_PINSEL0 (LPC17_PINCONN_BASE+LPC17_PINCONN_PINSEL0_OFFSET) -#define LPC17_PINCONN_PINSEL1 (LPC17_PINCONN_BASE+LPC17_PINCONN_PINSEL1_OFFSET) -#define LPC17_PINCONN_PINSEL2 (LPC17_PINCONN_BASE+LPC17_PINCONN_PINSEL2_OFFSET) -#define LPC17_PINCONN_PINSEL3 (LPC17_PINCONN_BASE+LPC17_PINCONN_PINSEL3_OFFSET) -#define LPC17_PINCONN_PINSEL4 (LPC17_PINCONN_BASE+LPC17_PINCONN_PINSEL4_OFFSET) -#define LPC17_PINCONN_PINSEL7 (LPC17_PINCONN_BASE+LPC17_PINCONN_PINSEL7_OFFSET) -#define LPC17_PINCONN_PINSEL8 (LPC17_PINCONN_BASE+LPC17_PINCONN_PINSEL8_OFFSET) -#define LPC17_PINCONN_PINSEL9 (LPC17_PINCONN_BASE+LPC17_PINCONN_PINSEL9_OFFSET) -#define LPC17_PINCONN_PINSEL10 (LPC17_PINCONN_BASE+LPC17_PINCONN_PINSEL10_OFFSET) -#define LPC17_PINCONN_PINMODE0 (LPC17_PINCONN_BASE+LPC17_PINCONN_PINMODE0_OFFSET) -#define LPC17_PINCONN_PINMODE1 (LPC17_PINCONN_BASE+LPC17_PINCONN_PINMODE1_OFFSET) -#define LPC17_PINCONN_PINMODE2 (LPC17_PINCONN_BASE+LPC17_PINCONN_PINMODE2_OFFSET) -#define LPC17_PINCONN_PINMODE3 (LPC17_PINCONN_BASE+LPC17_PINCONN_PINMODE3_OFFSET) -#define LPC17_PINCONN_PINMODE4 (LPC17_PINCONN_BASE+LPC17_PINCONN_PINMODE4_OFFSET) -#define LPC17_PINCONN_PINMODE5 (LPC17_PINCONN_BASE+LPC17_PINCONN_PINMODE5_OFFSET) -#define LPC17_PINCONN_PINMODE6 (LPC17_PINCONN_BASE+LPC17_PINCONN_PINMODE6_OFFSET) -#define LPC17_PINCONN_PINMODE7 (LPC17_PINCONN_BASE+LPC17_PINCONN_PINMODE7_OFFSET) -#define LPC17_PINCONN_PINMODE9 (LPC17_PINCONN_BASE+LPC17_PINCONN_PINMODE9_OFFSET) -#define LPC17_PINCONN_ODMODE0 (LPC17_PINCONN_BASE+LPC17_PINCONN_ODMODE0_OFFSET) -#define LPC17_PINCONN_ODMODE1 (LPC17_PINCONN_BASE+LPC17_PINCONN_ODMODE1_OFFSET) -#define LPC17_PINCONN_ODMODE2 (LPC17_PINCONN_BASE+LPC17_PINCONN_ODMODE2_OFFSET) -#define LPC17_PINCONN_ODMODE3 (LPC17_PINCONN_BASE+LPC17_PINCONN_ODMODE3_OFFSET) -#define LPC17_PINCONN_ODMODE4 (LPC17_PINCONN_BASE+LPC17_PINCONN_ODMODE4_OFFSET) -#define LPC17_PINCONN_I2CPADCFG (LPC17_PINCONN_BASE+LPC17_PINCONN_I2CPADCFG_OFFSET) - -/* Register bit definitions *********************************************************/ -/* Pin Function Select register 0 (PINSEL0: 0x4002c000) */ - -#define PINCONN_PINSEL_GPIO (0) -#define PINCONN_PINSEL_ALT1 (1) -#define PINCONN_PINSEL_ALT2 (2) -#define PINCONN_PINSEL_ALT3 (3) -#define PINCONN_PINSEL_MASK (3) - -#define PINCONN_PINSELL_SHIFT(n) ((n) << 1) /* n=0,1,..,15 */ -#define PINCONN_PINSELL_MASK(n) (3 << PINCONN_PINSELL_SHIFT(n)) -#define PINCONN_PINSELH_SHIFT(n) (((n)-16) << 1) /* n=16,17,..31 */ -#define PINCONN_PINSELH_MASK(n) (3 << PINCONN_PINSELH_SHIFT(n)) - -#define PINCONN_PINSEL0_P0_SHIFT(n) PINCONN_PINSELL_SHIFT(n) /* n=0,1,..,15 */ -#define PINCONN_PINSEL0_P0_MASK(n) PINCONN_PINSELL_MASK(n) /* n=0,1,..,15 */ - -#define PINCONN_PINSEL0_P0p0_SHIFT (0) /* Bits 0-1: P0.0 00=GPIO 01=RD1 10=TXD3 11=SDA1 */ -#define PINCONN_PINSEL0_P0p0_MASK (3 << PINCONN_PINSEL0_P0p0_SHIFT) -#define PINCONN_PINSEL0_P0p1_SHIFT (2) /* Bits 2-3: P0.1 00=GPIO 01=TD1 10=RXD3 11=SCL1 */ -#define PINCONN_PINSEL0_P0p1_MASK (3 << PINCONN_PINSEL0_P0p1_SHIFT) -#define PINCONN_PINSEL0_P0p2_SHIFT (4) /* Bits 4-5: P0.2 00=GPIO 01=TXD0 10=AD0.7 11=Reserved */ -#define PINCONN_PINSEL0_P0p2_MASK (3 << PINCONN_PINSEL0_P0p2_SHIFT) -#define PINCONN_PINSEL0_P0p3_SHIFT (6) /* Bits 6-7: P0.3 00=GPIO 01=RXD0 10=AD0.6 11=Reserved */ -#define PINCONN_PINSEL0_P0p3_MASK (3 << PINCONN_PINSEL0_P0p3_SHIFT) -#define PINCONN_PINSEL0_P0p4_SHIFT (8) /* Bits 8-9: P0.4 00=GPIO 01=I2SRX_CLK 10=RD2 11=CAP2.0 */ -#define PINCONN_PINSEL0_P0p4_MASK (3 << PINCONN_PINSEL0_P0p4_SHIFT) -#define PINCONN_PINSEL0_P0p5_SHIFT (10) /* Bits 10-11: P0.5 00=GPIO 01=I2SRX_WS 10=TD2 11=CAP2.1 */ -#define PINCONN_PINSEL0_P0p5_MASK (3 << PINCONN_PINSEL0_P0p5_SHIFT) -#define PINCONN_PINSEL0_P0p6_SHIFT (12) /* Bits 12-13: P0.6 00=GPIO 01=I2SRX_SDA 10=SSEL1 11=MAT2.0 */ -#define PINCONN_PINSEL0_P0p6_MASK (3 << PINCONN_PINSEL0_P0p6_SHIFT) -#define PINCONN_PINSEL0_P0p7_SHIFT (14) /* Bits 14-15: P0.7 00=GPIO 01=I2STX_CLK 10=SCK1 11=MAT2.1 */ -#define PINCONN_PINSEL0_P0p7_MASK (3 << PINCONN_PINSEL0_P0p7_SHIFT) -#define PINCONN_PINSEL0_P0p8_SHIFT (16) /* Bits 16-17: P0.8 00=GPIO 01=I2STX_WS 10=MISO1 11=MAT2.2 */ -#define PINCONN_PINSEL0_P0p8_MASK (3 << PINCONN_PINSEL0_P0p8_SHIFT) -#define PINCONN_PINSEL0_P0p9_SHIFT (18) /* Bits 18-19: P0.9 00=GPIO 01=I2STX_SDA 10=MOSI1 11=MAT2.3 */ -#define PINCONN_PINSEL0_P0p9_MASK (3 << PINCONN_PINSEL0_P0p9_SHIFT) -#define PINCONN_PINSEL0_P0p10_SHIFT (20) /* Bits 20-21: P0.10 00=GPIO 01=TXD2 10=SDA2 11=MAT3.0 */ -#define PINCONN_PINSEL0_P0p10_MASK (3 << PINCONN_PINSEL0_P0p10_SHIFT) -#define PINCONN_PINSEL0_P0p11_SHIFT (22) /* Bits 22-23: P0.11 00=GPIO 01=RXD2 10=SCL2 11=MAT3.1 */ -#define PINCONN_PINSEL0_P0p11_MASK (3 << PINCONN_PINSEL0_P0p11_SHIFT) - /* Bits 24-29: Reserved */ -#define PINCONN_PINSEL0_P0p15_SHIFT (30) /* Bits 30-31: P0.15 00=GPIO 01=TXD1 10=SCK0 11=SCK */ -#define PINCONN_PINSEL0_P0p15_MASK (3 << PINCONN_PINSEL0_P0p15_SHIFT) - -/* Pin Function Select Register 1 (PINSEL1: 0x4002c004) */ - -#define PINCONN_PINSEL1_P0_SHIFT(n) PINCONN_PINSELH_SHIFT(n) /* n=16,17,..31 */ -#define PINCONN_PINSEL1_P0_MASK(n) PINCONN_PINSELH_MASK(n) /* n=16,17,..31 */ - -#define PINCONN_PINSEL1_P0p16_SHIFT (0) /* Bits 0-1: P0.16 00=GPIO 01=RXD1 10=SSEL0 11=SSEL */ -#define PINCONN_PINSEL1_P0p16_MASK (3 << PINCONN_PINSEL1_P0p16_SHIFT) -#define PINCONN_PINSEL1_P0p17_SHIFT (2) /* Bits 2-3: P0.17 00=GPIO 01=CTS1 10=MISO0 11=MISO */ -#define PINCONN_PINSEL1_P0p17_MASK (3 << PINCONN_PINSEL1_P0p17_SHIFT) -#define PINCONN_PINSEL1_P0p18_SHIFT (4) /* Bits 4-5: P0.18 00=GPIO 01=DCD1 10=MOSI0 11=MOSI */ -#define PINCONN_PINSEL1_P0p18_MASK (3 << PINCONN_PINSEL1_P0p18_SHIFT) -#define PINCONN_PINSEL1_P0p19_SHIFT (6) /* Bits 6-7: P0.19 00=GPIO 01=DSR1 10=Reserved 11=SDA1 */ -#define PINCONN_PINSEL1_P0p19_MASK (3 << PINCONN_PINSEL1_P0p19_SHIFT) -#define PINCONN_PINSEL1_P0p20_SHIFT (8) /* Bits 8-9: P0.20 00=GPIO 01=DTR1 10=Reserved 11=SCL1 */ -#define PINCONN_PINSEL1_P0p20_MASK (3 << PINCONN_PINSEL1_P0p20_SHIFT) -#define PINCONN_PINSEL1_P0p21_SHIFT (10) /* Bits 10-11: P0.21 00=GPIO 01=RI1 10=Reserved 11=RD1 */ -#define PINCONN_PINSEL1_P0p21_MASK (3 << PINCONN_PINSEL1_P0p21_SHIFT) -#define PINCONN_PINSEL1_P0p22_SHIFT (12) /* Bits 12-13: P0.22 00=GPIO 01=RTS1 10=Reserved 11=TD1 */ -#define PINCONN_PINSEL1_P0p22_MASK (3 << PINCONN_PINSEL1_P0p22_SHIFT) -#define PINCONN_PINSEL1_P0p23_SHIFT (14) /* Bits 14-15: P0.23 00=GPIO 01=AD0.0 10=I2SRX_CLK 11=CAP3.0 */ -#define PINCONN_PINSEL1_P0p23_MASK (3 << PINCONN_PINSEL1_P0p23_SHIFT) -#define PINCONN_PINSEL1_P0p24_SHIFT (16) /* Bits 16-17: P0.24 00=GPIO 01=AD0.1 10=I2SRX_WS 11=CAP3.1 */ -#define PINCONN_PINSEL1_P0p24_MASK (3 << PINCONN_PINSEL1_P0p24_SHIFT) -#define PINCONN_PINSEL1_P0p25_SHIFT (18) /* Bits 18-19: P0.25 00=GPIO 01=AD0.2 10=I2SRX_SDA 11=TXD3 */ -#define PINCONN_PINSEL1_P0p25_MASK (3 << PINCONN_PINSEL1_P0p25_SHIFT) -#define PINCONN_PINSEL1_P0p26_SHIFT (20) /* Bits 20-21: P0.26 00=GPIO 01=AD0.3 10=AOUT 11=RXD3 */ -#define PINCONN_PINSEL1_P0p26_MASK (3 << PINCONN_PINSEL1_P0p26_SHIFT) -#define PINCONN_PINSEL1_P0p27_SHIFT (22) /* Bits 22-23: P0.27 00=GPIO 01=SDA0 10=USB_SDA 11=Reserved */ -#define PINCONN_PINSEL1_P0p27_MASK (3 << PINCONN_PINSEL1_P0p27_SHIFT) -#define PINCONN_PINSEL1_P0p28_SHIFT (24) /* Bits 24-25: P0.28 00=GPIO 01=SCL0 10=USB_SCL 11=Reserved */ -#define PINCONN_PINSEL1_P0p28_MASK (3 << PINCONN_PINSEL1_P0p28_SHIFT) -#define PINCONN_PINSEL1_P0p29_SHIFT (26) /* Bits 26-27: P0.29 00=GPIO 01=USB_D+ 10=Reserved 11=Reserved */ -#define PINCONN_PINSEL1_P0p29_MASK (3 << PINCONN_PINSEL1_P0p29_SHIFT) -#define PINCONN_PINSEL1_P0p30_SHIFT (28) /* Bits 28-29: P0.30 00=GPIO 01=USB_D- 10=Reserved 11=Reserved */ -#define PINCONN_PINSEL1_P0p30_MASK (3 << PINCONN_PINSEL1_P0p30_SHIFT) - /* Bits 30-31: Reserved */ -/* Pin Function Select register 2 (PINSEL2: 0x4002c008) */ - -#define PINCONN_PINSEL2_P1_SHIFT(n) PINCONN_PINSELL_SHIFT(n) /* n=0,1,..,15 */ -#define PINCONN_PINSEL2_P1_MASK(n) PINCONN_PINSELL_MASK(n) /* n=0,1,..,15 */ - -#define PINCONN_PINSEL2_P1p0_SHIFT (0) /* Bits 0-1: P1.0 00=GPIO 01=ENET_TXD0 10=Reserved 11=Reserved */ -#define PINCONN_PINSEL2_P1p0_MASK (3 << PINCONN_PINSEL2_P1p0_SHIFT) -#define PINCONN_PINSEL2_P1p1_SHIFT (2) /* Bits 2-3: P1.1 00=GPIO 01=ENET_TXD1 10=Reserved 11=Reserved */ -#define PINCONN_PINSEL2_P1p1_MASK (3 << PINCONN_PINSEL2_P1p1_SHIFT) - /* Bits 4-7: Reserved */ -#define PINCONN_PINSEL2_P1p4_SHIFT (8) /* Bits 8-9: P1.4 00=GPIO 01=ENET_TX_EN 10=Reserved 11=Reserved */ -#define PINCONN_PINSEL2_P1p4_MASK (3 << PINCONN_PINSEL2_P1p4_SHIFT) - /* Bits 10-15: Reserved */ -#define PINCONN_PINSEL2_P1p8_SHIFT (16) /* Bits 16-17: P1.8 00=GPIO 01=ENET_CRS 10=Reserved 11=Reserved */ -#define PINCONN_PINSEL2_P1p8_MASK (3 << PINCONN_PINSEL2_P1p8_SHIFT) -#define PINCONN_PINSEL2_P1p9_SHIFT (18) /* Bits 18-19: P1.9 00=GPIO 01=ENET_RXD0 10=Reserved 11=Reserved */ -#define PINCONN_PINSEL2_P1p9_MASK (3 << PINCONN_PINSEL2_P1p9_SHIFT) -#define PINCONN_PINSEL2_P1p10_SHIFT (20) /* Bits 20-21: P1.10 00=GPIO 01=ENET_RXD1 10=Reserved 11=Reserved */ -#define PINCONN_PINSEL2_P1p10_MASK (3 << PINCONN_PINSEL2_P1p10_SHIFT) - /* Bits 22-27: Reserved */ -#define PINCONN_PINSEL2_P1p14_SHIFT (28) /* Bits 28-29: P1.14 00=GPIO 01=ENET_RX_ER 10=Reserved 11=Reserved */ -#define PINCONN_PINSEL2_P1p14_MASK (3 << PINCONN_PINSEL2_P1p14_SHIFT) -#define PINCONN_PINSEL2_P1p15_SHIFT (30) /* Bits 30-31: P1.15 00=GPIO 01=ENET_REF_CLK 10=Reserved 11=Reserved */ -#define PINCONN_PINSEL2_P1p15_MASK (3 << PINCONN_PINSEL2_P1p15_SHIFT) - -/* Pin Function Select Register 3 (PINSEL3: 0x4002c00c) */ - -#define PINCONN_PINSEL3_P1_SHIFT(n) PINCONN_PINSELH_SHIFT(n) /* n=16,17,..31 */ -#define PINCONN_PINSEL3_P1_MASK(n) PINCONN_PINSELH_MASK(n) /* n=16,17,..31 */ - -#define PINCONN_PINSEL3_P1p16_SHIFT (0) /* Bits 0-1: P1.16 00=GPIO 01=ENET_MDC 10=Reserved 11=Reserved */ -#define PINCONN_PINSEL3_P1p16_MASK (3 << PINCONN_PINSEL3_P1p16_SHIFT) -#define PINCONN_PINSEL3_P1p17_SHIFT (2) /* Bits 2-3: P1.17 00=GPIO 01=ENET_MDIO 10=Reserved 11=Reserved */ -#define PINCONN_PINSEL3_P1p17_MASK (3 << PINCONN_PINSEL3_P1p17_SHIFT) -#define PINCONN_PINSEL3_P1p18_SHIFT (4) /* Bits 4-5: P1.18 00=GPIO 01=USB_UP_LED 10=PWM1.1 11=CAP1.0 */ -#define PINCONN_PINSEL3_P1p18_MASK (3 << PINCONN_PINSEL3_P1p18_SHIFT) -#define PINCONN_PINSEL3_P1p19_SHIFT (6) /* Bits 6-7: P1.19 00=GPIO 01=MCOA0 10=USB_PPWR 11=CAP1.1 */ -#define PINCONN_PINSEL3_P1p19_MASK (3 << PINCONN_PINSEL3_P1p19_SHIFT) -#define PINCONN_PINSEL3_P1p20_SHIFT (8) /* Bits 8-9: P1.20 00=GPIO 01=MCI0 10=PWM1.2 11=SCK0 */ -#define PINCONN_PINSEL3_P1p20_MASK (3 << PINCONN_PINSEL3_P1p20_SHIFT) -#define PINCONN_PINSEL3_P1p21_SHIFT (10) /* Bits 10-11: P1.21 00=GPIO 01=MCABORT 10=PWM1.3 11=SSEL0 */ -#define PINCONN_PINSEL3_P1p21_MASK (3 << PINCONN_PINSEL3_P1p21_SHIFT) -#define PINCONN_PINSEL3_P1p22_SHIFT (12) /* Bits 12-13: P1.22 00=GPIO 01=MCOB0 10=USB_PWRD 11=MAT1.0 */ -#define PINCONN_PINSEL3_P1p22_MASK (3 << PINCONN_PINSEL3_P1p22_SHIFT) -#define PINCONN_PINSEL3_P1p23_SHIFT (14) /* Bits 14-15: P1.23 00=GPIO 01=MCI1 10=PWM1.4 11=MISO0 */ -#define PINCONN_PINSEL3_P1p23_MASK (3 << PINCONN_PINSEL3_P1p23_SHIFT) -#define PINCONN_PINSEL3_P1p24_SHIFT (16) /* Bits 16-17: P1.24 00=GPIO 01=MCI2 10=PWM1.5 11=MOSI0 */ -#define PINCONN_PINSEL3_P1p24_MASK (3 << PINCONN_PINSEL3_P1p24_SHIFT) -#define PINCONN_PINSEL3_P1p25_SHIFT (18) /* Bits 18-19: P1.25 00=GPIO 01=MCOA1 10=Reserved 11=MAT1.1 */ -#define PINCONN_PINSEL3_P1p25_MASK (3 << PINCONN_PINSEL3_P1p25_SHIFT) -#define PINCONN_PINSEL3_P1p26_SHIFT (20) /* Bits 20-21: P1.26 00=GPIO 01=MCOB1 10=PWM1.6 11=CAP0.0 */ -#define PINCONN_PINSEL3_P1p26_MASK (3 << PINCONN_PINSEL3_P1p26_SHIFT) -#define PINCONN_PINSEL3_P1p27_SHIFT (22) /* Bits 22-23: P1.27 00=GPIO 01=CLKOUT 10=USB_OVRCR 11=CAP0.1 */ -#define PINCONN_PINSEL3_P1p27_MASK (3 << PINCONN_PINSEL3_P1p27_SHIFT) -#define PINCONN_PINSEL3_P1p28_SHIFT (24) /* Bits 24-25: P1.28 00=GPIO 01=MCOA2 10=PCAP1.0 11=MAT0.0 */ -#define PINCONN_PINSEL3_P1p28_MASK (3 << PINCONN_PINSEL3_P1p28_SHIFT) -#define PINCONN_PINSEL3_P1p29_SHIFT (26) /* Bits 26-27: P1.29 00=GPIO 01=MCOB2 10=PCAP1.1 11=MAT0.1 */ -#define PINCONN_PINSEL3_P1p29_MASK (3 << PINCONN_PINSEL3_P1p29_SHIFT) -#define PINCONN_PINSEL3_P1p30_SHIFT (28) /* Bits 28-29: P1.30 00=GPIO 01=Reserved 10=VBUS 11=AD0.4 */ -#define PINCONN_PINSEL3_P1p30_MASK (3 << PINCONN_PINSEL3_P1p30_SHIFT) -#define PINCONN_PINSEL3_P1p31_SHIFT (30) /* Bits 30-31: P1.31 00=GPIO 01=Reserved 10=SCK1 11=AD0.5 */ -#define PINCONN_PINSEL3_P1p31_MASK (3 << PINCONN_PINSEL3_P1p31_SHIFT) - -/* Pin Function Select Register 4 (PINSEL4: 0x4002c010) */ - -#define PINCONN_PINSEL4_P2_SHIFT(n) PINCONN_PINSELL_SHIFT(n) /* n=0,1,..,15 */ -#define PINCONN_PINSEL4_P2_MASK(n) PINCONN_PINSELL_MASK(n) /* n=0,1,..,15 */ - -#define PINCONN_PINSEL4_P2p0_SHIFT (0) /* Bits 0-1: P2.0 00=GPIO 01=PWM1.1 10=TXD1 11=Reserved */ -#define PINCONN_PINSEL4_P2p0_MASK (3 << PINCONN_PINSEL4_P2p0_SHIFT) -#define PINCONN_PINSEL4_P2p1_SHIFT (2) /* Bits 2-3: P2.1 00=GPIO 01=PWM1.2 10=RXD1 11=Reserved */ -#define PINCONN_PINSEL4_P2p1_MASK (3 << PINCONN_PINSEL4_P2p1_SHIFT) -#define PINCONN_PINSEL4_P2p2_SHIFT (4) /* Bits 4-5: P2.2 00=GPIO 01=PWM1.3 10=CTS1 11=Reserved */ -#define PINCONN_PINSEL4_P2p2_MASK (3 << PINCONN_PINSEL4_P2p2_SHIFT) -#define PINCONN_PINSEL4_P2p3_SHIFT (6) /* Bits 6-7: P2.3 00=GPIO 01=PWM1.4 10=DCD1 11=Reserved */ -#define PINCONN_PINSEL4_P2p3_MASK (3 << PINCONN_PINSEL4_P2p3_SHIFT) -#define PINCONN_PINSEL4_P2p4_SHIFT (8) /* Bits 8-9: P2.4 00=GPIO 01=PWM1.5 10=DSR1 11=Reserved */ -#define PINCONN_PINSEL4_P2p4_MASK (3 << PINCONN_PINSEL4_P2p4_SHIFT) -#define PINCONN_PINSEL4_P2p5_SHIFT (10) /* Bits 10-11: P2.5 00=GPIO 01=PWM1.6 10=DTR1 11=Reserved */ -#define PINCONN_PINSEL4_P2p5_MASK (3 << PINCONN_PINSEL4_P2p5_SHIFT) -#define PINCONN_PINSEL4_P2p6_SHIFT (12) /* Bits 12-13: P2.6 00=GPIO 01=PCAP1.0 10=RI1 11=Reserved */ -#define PINCONN_PINSEL4_P2p6_MASK (3 << PINCONN_PINSEL4_P2p6_SHIFT) -#define PINCONN_PINSEL4_P2p7_SHIFT (14) /* Bits 14-15: P2.7 00=GPIO 01=RD2 10=RTS1 11=Reserved */ -#define PINCONN_PINSEL4_P2p7_MASK (3 << PINCONN_PINSEL4_P2p7_SHIFT) -#define PINCONN_PINSEL4_P2p8_SHIFT (16) /* Bits 16-17: P2.8 00=GPIO 01=TD2 10=TXD2 11=ENET_MDC */ -#define PINCONN_PINSEL4_P2p8_MASK (3 << PINCONN_PINSEL4_P2p8_SHIFT) -#define PINCONN_PINSEL4_P2p9_SHIFT (18) /* Bits 18-19: P2.9 00=GPIO 01=USB_CONNECT 10=RXD2 11=ENET_MDIO */ -#define PINCONN_PINSEL4_P2p9_MASK (3 << PINCONN_PINSEL4_P2p9_SHIFT) -#define PINCONN_PINSEL4_P2p10_SHIFT (20) /* Bits 20-21: P2.10 00=GPIO 01=EINT0 10=NMI 11=Reserved */ -#define PINCONN_PINSEL4_P2p10_MASK (3 << PINCONN_PINSEL4_P2p10_SHIFT) -#define PINCONN_PINSEL4_P2p11_SHIFT (22) /* Bits 22-23: P2.11 00=GPIO 01=EINT1 10=Reserved 11=I2STX_CLK */ -#define PINCONN_PINSEL4_P2p11_MASK (3 << PINCONN_PINSEL4_P2p11_SHIFT) -#define PINCONN_PINSEL4_P2p12_SHIFT (24) /* Bits 24-25: P2.12 00=GPIO 01=PEINT2 10=Reserved 11=I2STX_WS */ -#define PINCONN_PINSEL4_P2p12_MASK (3 << PINCONN_PINSEL4_P2p12_SHIFT) -#define PINCONN_PINSEL4_P2p13_SHIFT (26) /* Bits 26-27: P2.13 00=GPIO 01=EINT3 10=Reserved 11=I2STX_SDA */ -#define PINCONN_PINSEL4_P2p13_MASK (3 << PINCONN_PINSEL4_P2p13_SHIFT) - /* Bits 28-31: Reserved */ -/* Pin Function Select Register 7 (PINSEL7: 0x4002c01c) */ - -#define PINCONN_PINSEL7_P3_SHIFT(n) PINCONN_PINSELH_SHIFT(n) /* n=16,17,..31 */ -#define PINCONN_PINSEL7_P3_MASK(n) PINCONN_PINSELH_MASK(n) /* n=16,17,..31 */ - - /* Bits 0-17: Reserved */ -#define PINCONN_PINSEL7_P3p25_SHIFT (18) /* Bits 18-19: P3.25 00=GPIO 01=Reserved 10=MAT0.0 11=PWM1.2 */ -#define PINCONN_PINSEL7_P3p25_MASK (3 << PINCONN_PINSEL7_P3p25_SHIFT) -#define PINCONN_PINSEL7_P3p26_SHIFT (20) /* Bits 20-21: P3.26 00=GPIO 01=STCLK 10=MAT0.1 11=PWM1.3 */ -#define PINCONN_PINSEL7_P3p26_MASK (3 << PINCONN_PINSEL7_P3p26_SHIFT) - /* Bits 22-31: Reserved */ - -/* Pin Function Select Register 8 (PINSEL8: 0x4002c020) */ -/* No description of bits -- Does this register exist? */ - -/* Pin Function Select Register 9 (PINSEL9: 0x4002c024) */ - -#define PINCONN_PINSEL9_P4_SHIFT(n) PINCONN_PINSELH_SHIFT(n) /* n=16,17,..31 */ -#define PINCONN_PINSEL9_P4_MASK(n) PINCONN_PINSELH_MASK(n) /* n=16,17,..31 */ - - /* Bits 0-23: Reserved */ -#define PINCONN_PINSEL9_P4p28_SHIFT (24) /* Bits 24-25: P4.28 00=GPIO 01=RX_MCLK 10=MAT2.0 11=TXD3 */ -#define PINCONN_PINSEL9_P4p28_MASK (3 << PINCONN_PINSEL9_P4p28_SHIFT) -#define PINCONN_PINSEL9_P4p29_SHIFT (26) /* Bits 26-27: P4.29 00=GPIO 01=TX_MCLK 10=MAT2.1 11=RXD3 */ -#define PINCONN_PINSEL9_P4p29_MASK (3 << PINCONN_PINSEL9_P4p29_SHIFT) - /* Bits 28-31: Reserved */ -/* Pin Function Select Register 10 (PINSEL10: 0x4002c028) */ - /* Bits 0-2: Reserved */ -#define PINCONN_PINSEL10_TPIU (1 << 3) /* Bit 3: 0=TPIU interface disabled; 1=TPIU interface enabled */ - /* Bits 4-31: Reserved */ -/* Pin Mode select register 0 (PINMODE0: 0x4002c040) */ - -#define PINCONN_PINMODE_PU (0) /* 00: pin has a pull-up resistor enabled */ -#define PINCONN_PINMODE_RM (1) /* 01: pin has repeater mode enabled */ -#define PINCONN_PINMODE_FLOAT (2) /* 10: pin has neither pull-up nor pull-down */ -#define PINCONN_PINMODE_PD (3) /* 11: pin has a pull-down resistor enabled */ -#define PINCONN_PINMODE_MASK (3) - -#define PINCONN_PINMODEL_SHIFT(n) ((n) << 1) /* n=0,1,..,15 */ -#define PINCONN_PINMODEL_MASK(n) (3 << PINCONN_PINMODEL_SHIFT(n)) -#define PINCONN_PINMODEH_SHIFT(n) (((n)-16) << 1) /* n=16,17,..31 */ -#define PINCONN_PINMODEH_MASK(n) (3 << PINCONN_PINMODEH_SHIFT(n)) - -#define PINCONN_PINMODE0_P0_SHIFT(n) PINCONN_PINMODEL_SHIFT(n) /* n=0,1,..,15 */ -#define PINCONN_PINMODE0_P0_MASK(n) PINCONN_PINMODEL_MASK(n) /* n=0,1,..,15 */ - -#define PINCONN_PINMODE0_P0p0_SHIFT (0) /* Bits 0-1: P0.0 mode control */ -#define PINCONN_PINMODE0_P0p0_MASK (3 << PINCONN_PINMODE0_P0p0_SHIFT) -#define PINCONN_PINMODE0_P0p1_SHIFT (2) /* Bits 2-3: P0.1 mode control */ -#define PINCONN_PINMODE0_P0p1_MASK (3 << PINCONN_PINMODE0_P0p1_SHIFT) -#define PINCONN_PINMODE0_P0p2_SHIFT (4) /* Bits 4-5: P0.2 mode control */ -#define PINCONN_PINMODE0_P0p2_MASK (3 << PINCONN_PINMODE0_P0p2_SHIFT) -#define PINCONN_PINMODE0_P0p3_SHIFT (6) /* Bits 6-7: P0.3 mode control */ -#define PINCONN_PINMODE0_P0p3_MASK (3 << PINCONN_PINMODE0_P0p3_SHIFT) -#define PINCONN_PINMODE0_P0p4_SHIFT (8) /* Bits 8-9: P0.4 mode control */ -#define PINCONN_PINMODE0_P0p4_MASK (3 << PINCONN_PINMODE0_P0p4_SHIFT) -#define PINCONN_PINMODE0_P0p5_SHIFT (10) /* Bits 10-11: P0.5 mode control */ -#define PINCONN_PINMODE0_P0p5_MASK (3 << PINCONN_PINMODE0_P0p5_SHIFT) -#define PINCONN_PINMODE0_P0p6_SHIFT (12) /* Bits 12-13: P0.6 mode control */ -#define PINCONN_PINMODE0_P0p6_MASK (3 << PINCONN_PINMODE0_P0p6_SHIFT) -#define PINCONN_PINMODE0_P0p7_SHIFT (14) /* Bits 14-15: P0.7 mode control */ -#define PINCONN_PINMODE0_P0p7_MASK (3 << PINCONN_PINMODE0_P0p7_SHIFT) -#define PINCONN_PINMODE0_P0p8_SHIFT (16) /* Bits 16-17: P0.8 mode control */ -#define PINCONN_PINMODE0_P0p8_MASK (3 << PINCONN_PINMODE0_P0p8_SHIFT) -#define PINCONN_PINMODE0_P0p9_SHIFT (18) /* Bits 18-19: P0.9 mode control */ -#define PINCONN_PINMODE0_P0p9_MASK (3 << PINCONN_PINMODE0_P0p9_SHIFT) -#define PINCONN_PINMODE0_P0p10_SHIFT (20) /* Bits 20-21: P0.10 mode control */ -#define PINCONN_PINMODE0_P0p10_MASK (3 << PINCONN_PINMODE0_P0p10_SHIFT) -#define PINCONN_PINMODE0_P0p11_SHIFT (22) /* Bits 22-23: P0.11 mode control */ -#define PINCONN_PINMODE0_P0p11_MASK (3 << PINCONN_PINMODE0_P0p11_SHIFT) - /* Bits 24-29: Reserved */ -#define PINCONN_PINMODE0_P0p15_SHIFT (30) /* Bits 30-31: P0.15 mode control */ -#define PINCONN_PINMODE0_P0p15_MASK (3 << PINCONN_PINMODE0_P0p15_SHIFT) - -/* Pin Mode select register 1 (PINMODE1: 0x4002c044) */ - -#define PINCONN_PINMODE1_P0_SHIFT(n) PINCONN_PINMODEH_SHIFT(n) /* n=16,17,..31 */ -#define PINCONN_PINMODE1_P0_MASK(n) PINCONN_PINMODEH_MASK(n) /* n=16,17,..31 */ - -#define PINCONN_PINMODE1_P0p16_SHIFT (0) /* Bits 0-1: P0.16 mode control */ -#define PINCONN_PINMODE1_P0p16_MASK (3 << PINCONN_PINMODE1_P0p16_SHIFT) -#define PINCONN_PINMODE1_P0p17_SHIFT (2) /* Bits 2-3: P0.17 mode control */ -#define PINCONN_PINMODE1_P0p17_MASK (3 << PINCONN_PINMODE1_P0p17_SHIFT) -#define PINCONN_PINMODE1_P0p18_SHIFT (4) /* Bits 4-5: P0.18 mode control */ -#define PINCONN_PINMODE1_P0p18_MASK (3 << PINCONN_PINMODE1_P0p18_SHIFT) -#define PINCONN_PINMODE1_P0p19_SHIFT (6) /* Bits 6-7: P0.19 mode control */ -#define PINCONN_PINMODE1_P0p19_MASK (3 << PINCONN_PINMODE1_P0p19_SHIFT) -#define PINCONN_PINMODE1_P0p20_SHIFT (8) /* Bits 8-9: P0.20 mode control */ -#define PINCONN_PINMODE1_P0p20_MASK (3 << PINCONN_PINMODE1_P0p20_SHIFT) -#define PINCONN_PINMODE1_P0p21_SHIFT (10) /* Bits 10-11: P0.21 mode control */ -#define PINCONN_PINMODE1_P0p21_MASK (3 << PINCONN_PINMODE1_P0p21_SHIFT) -#define PINCONN_PINMODE1_P0p22_SHIFT (12) /* Bits 12-13: P0.22 mode control */ -#define PINCONN_PINMODE1_P0p22_MASK (3 << PINCONN_PINMODE1_P0p22_SHIFT) -#define PINCONN_PINMODE1_P0p23_SHIFT (14) /* Bits 14-15: P0.23 mode control */ -#define PINCONN_PINMODE1_P0p23_MASK (3 << PINCONN_PINMODE1_P0p23_SHIFT) -#define PINCONN_PINMODE1_P0p24_SHIFT (16) /* Bits 16-17: P0.24 mode control */ -#define PINCONN_PINMODE1_P0p24_MASK (3 << PINCONN_PINMODE1_P0p24_SHIFT) -#define PINCONN_PINMODE1_P0p25_SHIFT (18) /* Bits 18-19: P0.25 mode control */ -#define PINCONN_PINMODE1_P0p25_MASK (3 << PINCONN_PINMODE1_P0p25_SHIFT) -#define PINCONN_PINMODE1_P0p26_SHIFT (20) /* Bits 20-21: P0.26 mode control */ -#define PINCONN_PINMODE1_P0p26_MASK (3 << PINCONN_PINMODE1_P0p26_SHIFT) - /* Bits 22-31: Reserved */ - -/* Pin Mode select register 2 (PINMODE2: 0x4002c048) */ - -#define PINCONN_PINMODE2_P1_SHIFT(n) PINCONN_PINMODEL_SHIFT(n) /* n=0,1,..,15 */ -#define PINCONN_PINMODE2_P1_MASK(n) PINCONN_PINMODEL_MASK(n) /* n=0,1,..,15 */ - -#define PINCONN_PINMODE2_P1p0_SHIFT (0) /* Bits 2-1: P1.0 mode control */ -#define PINCONN_PINMODE2_P1p0_MASK (3 << PINCONN_PINMODE2_P1p0_SHIFT) -#define PINCONN_PINMODE2_P1p1_SHIFT (2) /* Bits 2-3: P1.1 mode control */ -#define PINCONN_PINMODE2_P1p1_MASK (3 << PINCONN_PINMODE2_P1p1_SHIFT) - /* Bits 4-7: Reserved */ -#define PINCONN_PINMODE2_P1p4_SHIFT (8) /* Bits 8-9: P1.4 mode control */ -#define PINCONN_PINMODE2_P1p4_MASK (3 << PINCONN_PINMODE2_P1p4_SHIFT) - /* Bits 10-15: Reserved */ -#define PINCONN_PINMODE2_P1p8_SHIFT (16) /* Bits 16-17: P1.8 mode control */ -#define PINCONN_PINMODE2_P1p8_MASK (3 << PINCONN_PINMODE2_P1p8_SHIFT) -#define PINCONN_PINMODE2_P1p9_SHIFT (18) /* Bits 18-19: P1.9 mode control */ -#define PINCONN_PINMODE2_P1p9_MASK (3 << PINCONN_PINMODE2_P1p9_SHIFT) -#define PINCONN_PINMODE2_P1p10_SHIFT (20) /* Bits 20-21: P1.10 mode control */ -#define PINCONN_PINMODE2_P1p10_MASK (3 << PINCONN_PINMODE2_P1p10_SHIFT) - /* Bits 22-27: Reserved */ -#define PINCONN_PINMODE2_P1p14_SHIFT (28) /* Bits 28-29: P1.14 mode control */ -#define PINCONN_PINMODE2_P1p14_MASK (3 << PINCONN_PINMODE2_P1p14_SHIFT) -#define PINCONN_PINMODE2_P1p15_SHIFT (30) /* Bits 30-31: P1.15 mode control */ -#define PINCONN_PINMODE2_P1p15_MASK (3 << PINCONN_PINMODE2_P1p15_SHIFT) - -/* Pin Mode select register 3 (PINMODE3: 0x4002c04c) */ - -#define PINCONN_PINMODE3_P1_SHIFT(n) PINCONN_PINMODEH_SHIFT(n) /* n=16,17,..31 */ -#define PINCONN_PINMODE3_P1_MASK(n) PINCONN_PINMODEH_MASK(n) /* n=16,17,..31 */ - -#define PINCONN_PINMODE3_P1p16_SHIFT (0) /* Bits 0-1: P1.16 mode control */ -#define PINCONN_PINMODE3_P1p16_MASK (3 << PINCONN_PINMODE3_P1p16_SHIFT) -#define PINCONN_PINMODE3_P1p17_SHIFT (2) /* Bits 2-3: P1.17 mode control */ -#define PINCONN_PINMODE3_P1p17_MASK (3 << PINCONN_PINMODE3_P1p17_SHIFT) -#define PINCONN_PINMODE3_P1p18_SHIFT (4) /* Bits 4-5: P1.18 mode control */ -#define PINCONN_PINMODE3_P1p18_MASK (3 << PINCONN_PINMODE3_P1p18_SHIFT) -#define PINCONN_PINMODE3_P1p19_SHIFT (6) /* Bits 6-7: P1.19 mode control */ -#define PINCONN_PINMODE3_P1p19_MASK (3 << PINCONN_PINMODE3_P1p19_SHIFT) -#define PINCONN_PINMODE3_P1p20_SHIFT (8) /* Bits 8-9: P1.20 mode control */ -#define PINCONN_PINMODE3_P1p20_MASK (3 << PINCONN_PINMODE3_P1p20_SHIFT) -#define PINCONN_PINMODE3_P1p21_SHIFT (10) /* Bits 10-11: P1.21 mode control */ -#define PINCONN_PINMODE3_P1p21_MASK (3 << PINCONN_PINMODE3_P1p21_SHIFT) -#define PINCONN_PINMODE3_P1p22_SHIFT (12) /* Bits 12-13: P1.22 mode control */ -#define PINCONN_PINMODE3_P1p22_MASK (3 << PINCONN_PINMODE3_P1p22_SHIFT) -#define PINCONN_PINMODE3_P1p23_SHIFT (14) /* Bits 14-15: P1.23 mode control */ -#define PINCONN_PINMODE3_P1p23_MASK (3 << PINCONN_PINMODE3_P1p23_SHIFT) -#define PINCONN_PINMODE3_P1p24_SHIFT (16) /* Bits 16-17: P1.24 mode control */ -#define PINCONN_PINMODE3_P1p24_MASK (3 << PINCONN_PINMODE3_P1p24_SHIFT) -#define PINCONN_PINMODE3_P1p25_SHIFT (18) /* Bits 18-19: P1.25 mode control */ -#define PINCONN_PINMODE3_P1p25_MASK (3 << PINCONN_PINMODE3_P1p25_SHIFT) -#define PINCONN_PINMODE3_P1p26_SHIFT (20) /* Bits 20-21: P1.26 mode control */ -#define PINCONN_PINMODE3_P1p26_MASK (3 << PINCONN_PINMODE3_P1p26_SHIFT) -#define PINCONN_PINMODE3_P1p27_SHIFT (22) /* Bits 22-23: P1.27 mode control */ -#define PINCONN_PINMODE3_P1p27_MASK (3 << PINCONN_PINMODE3_P1p27_SHIFT) -#define PINCONN_PINMODE3_P1p28_SHIFT (24) /* Bits 24-25: P1.28 mode control */ -#define PINCONN_PINMODE3_P1p28_MASK (3 << PINCONN_PINMODE3_P1p28_SHIFT) -#define PINCONN_PINMODE3_P1p29_SHIFT (26) /* Bits 26-27: P1.29 mode control */ -#define PINCONN_PINMODE3_P1p29_MASK (3 << PINCONN_PINMODE3_P1p29_SHIFT) -#define PINCONN_PINMODE3_P1p30_SHIFT (28) /* Bits 28-29: P1.30 mode control */ -#define PINCONN_PINMODE3_P1p30_MASK (3 << PINCONN_PINMODE3_P1p30_SHIFT) -#define PINCONN_PINMODE3_P1p31_SHIFT (30) /* Bits 30-31: P1.31 mode control */ -#define PINCONN_PINMODE3_P1p31_MASK (3 << PINCONN_PINMODE3_P1p31_SHIFT) - -/* Pin Mode select register 4 (PINMODE4: 0x4002c050) */ - -#define PINCONN_PINMODE4_P2_SHIFT(n) PINCONN_PINMODEL_SHIFT(n) /* n=0,1,..,15 */ -#define PINCONN_PINMODE4_P2_MASK(n) PINCONN_PINMODEL_MASK(n) /* n=0,1,..,15 */ - -#define PINCONN_PINMODE4_P2p0_SHIFT (0) /* Bits 0-1: P2.0 mode control */ -#define PINCONN_PINMODE4_P2p0_MASK (3 << PINCONN_PINMODE4_P2p0_SHIFT) -#define PINCONN_PINMODE4_P2p1_SHIFT (2) /* Bits 2-3: P2.1 mode control */ -#define PINCONN_PINMODE4_P2p1_MASK (3 << PINCONN_PINMODE4_P2p1_SHIFT) -#define PINCONN_PINMODE4_P2p2_SHIFT (4) /* Bits 4-5: P2.2 mode control */ -#define PINCONN_PINMODE4_P2p2_MASK (3 << PINCONN_PINMODE4_P2p2_SHIFT) -#define PINCONN_PINMODE4_P2p3_SHIFT (6) /* Bits 6-7: P2.3 mode control */ -#define PINCONN_PINMODE4_P2p3_MASK (3 << PINCONN_PINMODE4_P2p3_SHIFT) -#define PINCONN_PINMODE4_P2p4_SHIFT (8) /* Bits 8-9: P2.4 mode control */ -#define PINCONN_PINMODE4_P2p4_MASK (3 << PINCONN_PINMODE4_P2p4_SHIFT) -#define PINCONN_PINMODE4_P2p5_SHIFT (10) /* Bits 10-11: P2.5 mode control */ -#define PINCONN_PINMODE4_P2p5_MASK (3 << PINCONN_PINMODE4_P2p5_SHIFT) -#define PINCONN_PINMODE4_P2p6_SHIFT (12) /* Bits 12-13: P2.6 mode control */ -#define PINCONN_PINMODE4_P2p6_MASK (3 << PINCONN_PINMODE4_P2p6_SHIFT) -#define PINCONN_PINMODE4_P2p7_SHIFT (14) /* Bits 14-15: P2.7 mode control */ -#define PINCONN_PINMODE4_P2p7_MASK (3 << PINCONN_PINMODE4_P2p7_SHIFT) -#define PINCONN_PINMODE4_P2p8_SHIFT (16) /* Bits 16-17: P2.8 mode control */ -#define PINCONN_PINMODE4_P2p8_MASK (3 << PINCONN_PINMODE4_P2p8_SHIFT) -#define PINCONN_PINMODE4_P2p9_SHIFT (18) /* Bits 18-19: P2.9 mode control */ -#define PINCONN_PINMODE4_P2p9_MASK (3 << PINCONN_PINMODE4_P2p9_SHIFT) -#define PINCONN_PINMODE4_P2p10_SHIFT (20) /* Bits 20-21: P2.10 mode control */ -#define PINCONN_PINMODE4_P2p10_MASK (3 << PINCONN_PINMODE4_P2p10_SHIFT) -#define PINCONN_PINMODE4_P2p11_SHIFT (22) /* Bits 22-23: P2.11 mode control */ -#define PINCONN_PINMODE4_P2p11_MASK (3 << PINCONN_PINMODE4_P2p11_SHIFT) -#define PINCONN_PINMODE4_P2p12_SHIFT (24) /* Bits 24-25: P2.12 mode control */ -#define PINCONN_PINMODE4_P2p12_MASK (3 << PINCONN_PINMODE4_P2p12_SHIFT) -#define PINCONN_PINMODE4_P2p13_SHIFT (26) /* Bits 26-27: P2.13 mode control */ -#define PINCONN_PINMODE4_P2p13_MASK (3 << PINCONN_PINMODE4_P2p13_SHIFT) - /* Bits 28-31: Reserved */ -/* Pin Mode select register 5 (PINMODE5: 0x4002c054) - * Pin Mode select register 6 (PINMODE6: 0x4002c058) - * No bit definitions -- do these registers exist? - */ - -#define PINCONN_PINMODE5_P2_SHIFT(n) PINCONN_PINMODEH_SHIFT(n) /* n=16,17,..31 */ -#define PINCONN_PINMODE5_P2_MASK(n) PINCONN_PINMODEH_MASK(n) /* n=16,17,..31 */ - -#define PINCONN_PINMODE6_P3_SHIFT(n) PINCONN_PINMODEL_SHIFT(n) /* n=0,1,..,15 */ -#define PINCONN_PINMODE6_P3_MASK(n) PINCONN_PINMODEL_MASK(n) /* n=0,1,..,15 */ - -/* Pin Mode select register 7 (PINMODE7: 0x4002c05c) */ - -#define PINCONN_PINMODE7_P3_SHIFT(n) PINCONN_PINMODEH_SHIFT(n) /* n=16,17,..31 */ -#define PINCONN_PINMODE7_P3_MASK(n) PINCONN_PINMODEH_MASK(n) /* n=16,17,..31 */ - /* Bits 0-17: Reserved */ -#define PINCONN_PINMODE7_P3p25_SHIFT (18) /* Bits 18-19: P3.25 mode control */ -#define PINCONN_PINMODE7_P3p25_MASK (3 << PINCONN_PINMODE7_P3p25_SHIFT) -#define PINCONN_PINMODE7_P3p26_SHIFT (20) /* Bits 20-21: P3.26 mode control */ -#define PINCONN_PINMODE7_P3p26_MASK (3 << PINCONN_PINMODE7_P3p26_SHIFT) - /* Bits 22-31: Reserved */ -/* Pin Mode select register 9 (PINMODE9: 0x4002c064) */ - -#define PINCONN_PINMODE9_P4_SHIFT(n) PINCONN_PINMODEH_SHIFT(n) /* n=16,17,..31 */ -#define PINCONN_PINMODE9_P4_MASK(n) PINCONN_PINMODEH_MASK(n) /* n=16,17,..31 */ - /* Bits 0-23: Reserved */ -#define PINCONN_PINMODE9_P4p28_SHIFT (24) /* Bits 24-25: P4.28 mode control */ -#define PINCONN_PINMODE9_P4p28_MASK (3 << PINCONN_PINMODE9_P4p28_SHIFT) -#define PINCONN_PINMODE9_P4p29_SHIFT (26) /* Bits 26-27: P4.29 mode control */ -#define PINCONN_PINMODE9_P4p29_MASK (3 << PINCONN_PINMODE9_P4p29_SHIFT) - /* Bits 28-31: Reserved */ -/* Open Drain Pin Mode select register 0 (PINMODE_OD0: 0x4002c068) */ - -#define PINCONN_ODMODE0_P0(n) (1 << (n)) - -#define PINCONN_ODMODE0_P0p0 (1 << 0) /* Bit 0: P0.0 open drain mode */ -#define PINCONN_ODMODE0_P0p1 (1 << 1) /* Bit 1: P0.1 open drain mode */ -#define PINCONN_ODMODE0_P0p2 (1 << 2) /* Bit 2: P0.2 open drain mode */ -#define PINCONN_ODMODE0_P0p3 (1 << 3) /* Bit 3: P0.3 open drain mode */ -#define PINCONN_ODMODE0_P0p4 (1 << 4) /* Bit 4: P0.4 open drain mode */ -#define PINCONN_ODMODE0_P0p5 (1 << 5) /* Bit 5: P0.5 open drain mode */ -#define PINCONN_ODMODE0_P0p6 (1 << 6) /* Bit 6: P0.6 open drain mode */ -#define PINCONN_ODMODE0_P0p7 (1 << 7) /* Bit 7: P0.7 open drain mode */ -#define PINCONN_ODMODE0_P0p8 (1 << 8) /* Bit 8: P0.8 open drain mode */ -#define PINCONN_ODMODE0_P0p9 (1 << 9) /* Bit 9: P0.9 open drain mode */ -#define PINCONN_ODMODE0_P0p10 (1 << 10) /* Bit 10: P0.10 open drain mode */ -#define PINCONN_ODMODE0_P0p11 (1 << 11) /* Bit 11: P0.11 open drain mode */ - /* Bits 12-14: Reserved */ -#define PINCONN_ODMODE0_P0p15 (1 << 15) /* Bit 15: P0.15 open drain mode */ -#define PINCONN_ODMODE0_P0p16 (1 << 16) /* Bit 16: P0.16 open drain mode */ -#define PINCONN_ODMODE0_P0p17 (1 << 17) /* Bit 17: P0.17 open drain mode */ -#define PINCONN_ODMODE0_P0p18 (1 << 18) /* Bit 18: P0.18 open drain mode */ -#define PINCONN_ODMODE0_P0p19 (1 << 19) /* Bit 19: P0.19 open drain mode */ -#define PINCONN_ODMODE0_P0p20 (1 << 20) /* Bit 20: P0.20 open drain mode */ -#define PINCONN_ODMODE0_P0p21 (1 << 21) /* Bit 21: P0.21 open drain mode */ -#define PINCONN_ODMODE0_P0p22 (1 << 22) /* Bit 22: P0.22 open drain mode */ -#define PINCONN_ODMODE0_P0p23 (1 << 23) /* Bit 23: P0.23 open drain mode */ -#define PINCONN_ODMODE0_P0p24 (1 << 24) /* Bit 24: P0.24 open drain mode */ -#define PINCONN_ODMODE0_P0p25 (1 << 25) /* Bit 25: P0.25 open drain mode */ -#define PINCONN_ODMODE0_P0p26 (1 << 25) /* Bit 26: P0.26 open drain mode */ - /* Bits 27-28: Reserved */ -#define PINCONN_ODMODE0_P0p29 (1 << 29) /* Bit 29: P0.29 open drain mode */ -#define PINCONN_ODMODE0_P0p30 (1 << 30) /* Bit 30: P0.30 open drain mode */ - /* Bit 31: Reserved */ -/* Open Drain Pin Mode select register 1 (PINMODE_OD1: 0x4002c06c) */ - -#define PINCONN_ODMODE1_P1(n) (1 << (n)) - -#define PINCONN_ODMODE1_P1p0 (1 << 0) /* Bit 0: P1.0 open drain mode */ -#define PINCONN_ODMODE1_P1p1 (1 << 1) /* Bit 1: P1.1 open drain mode */ - /* Bits 2-3: Reserved */ -#define PINCONN_ODMODE1_P1p4 (1 << 4) /* Bit 4: P1.4 open drain mode */ - /* Bits 5-7: Reserved */ -#define PINCONN_ODMODE1_P1p8 (1 << 8) /* Bit 8: P1.8 open drain mode */ -#define PINCONN_ODMODE1_P1p9 (1 << 9) /* Bit 9: P1.9 open drain mode */ -#define PINCONN_ODMODE1_P1p10 (1 << 10) /* Bit 10: P1.10 open drain mode */ - /* Bits 11-13: Reserved */ -#define PINCONN_ODMODE1_P1p14 (1 << 14) /* Bit 14: P1.14 open drain mode */ -#define PINCONN_ODMODE1_P1p15 (1 << 15) /* Bit 15: P1.15 open drain mode */ -#define PINCONN_ODMODE1_P1p16 (1 << 16) /* Bit 16: P1.16 open drain mode */ -#define PINCONN_ODMODE1_P1p17 (1 << 17) /* Bit 17: P1.17 open drain mode */ -#define PINCONN_ODMODE1_P1p18 (1 << 18) /* Bit 18: P1.18 open drain mode */ -#define PINCONN_ODMODE1_P1p19 (1 << 19) /* Bit 19: P1.19 open drain mode */ -#define PINCONN_ODMODE1_P1p20 (1 << 20) /* Bit 20: P1.20 open drain mode */ -#define PINCONN_ODMODE1_P1p21 (1 << 21) /* Bit 21: P1.21 open drain mode */ -#define PINCONN_ODMODE1_P1p22 (1 << 22) /* Bit 22: P1.22 open drain mode */ -#define PINCONN_ODMODE1_P1p23 (1 << 23) /* Bit 23: P1.23 open drain mode */ -#define PINCONN_ODMODE1_P1p24 (1 << 24) /* Bit 24: P1.24 open drain mode */ -#define PINCONN_ODMODE1_P1p25 (1 << 25) /* Bit 25: P1.25 open drain mode */ -#define PINCONN_ODMODE1_P1p26 (1 << 25) /* Bit 26: P1.26 open drain mode */ -#define PINCONN_ODMODE1_P1p27 (1 << 27) /* Bit 27: P1.27 open drain mode */ -#define PINCONN_ODMODE1_P1p28 (1 << 28) /* Bit 28: P1.28 open drain mode */ -#define PINCONN_ODMODE1_P1p29 (1 << 29) /* Bit 29: P1.29 open drain mode */ -#define PINCONN_ODMODE1_P1p30 (1 << 30) /* Bit 30: P1.30 open drain mode */ -#define PINCONN_ODMODE1_P1p31 (1 << 31) /* Bit 31: P1.31 open drain mode */ - -/* Open Drain Pin Mode select register 2 (PINMODE_OD2: 0x4002c070) */ - -#define PINCONN_ODMODE2_P2(n) (1 << (n)) - -#define PINCONN_ODMODE2_P2p0 (1 << 0) /* Bit 0: P2.0 open drain mode */ -#define PINCONN_ODMODE2_P2p1 (1 << 1) /* Bit 1: P2.1 open drain mode */ -#define PINCONN_ODMODE2_P2p2 (1 << 2) /* Bit 2: P2.2 open drain mode */ -#define PINCONN_ODMODE2_P2p3 (1 << 3) /* Bit 3: P2.3 open drain mode */ -#define PINCONN_ODMODE2_P2p4 (1 << 4) /* Bit 4: P2.4 open drain mode */ -#define PINCONN_ODMODE2_P2p5 (1 << 5) /* Bit 5: P2.5 open drain mode */ -#define PINCONN_ODMODE2_P2p6 (1 << 6) /* Bit 6: P2.6 open drain mode */ -#define PINCONN_ODMODE2_P2p7 (1 << 7) /* Bit 7: P2.7 open drain mode */ -#define PINCONN_ODMODE2_P2p8 (1 << 8) /* Bit 8: P2.8 open drain mode */ -#define PINCONN_ODMODE2_P2p9 (1 << 9) /* Bit 9: P2.9 open drain mode */ -#define PINCONN_ODMODE2_P2p10 (1 << 10) /* Bit 10: P2.10 open drain mode */ -#define PINCONN_ODMODE2_P2p11 (1 << 11) /* Bit 11: P2.11 open drain mode */ -#define PINCONN_ODMODE2_P2p12 (1 << 12) /* Bit 12: P2.12 open drain mode */ -#define PINCONN_ODMODE2_P2p13 (1 << 13) /* Bit 13: P2.13 open drain mode */ - /* Bits 14-31: Reserved */ -/* Open Drain Pin Mode select register 3 (PINMODE_OD3: 0x4002c074) */ - -#define PINCONN_ODMODE3_P3(n) (1 << (n)) - /* Bits 0-24: Reserved */ -#define PINCONN_ODMODE3_P3p25 (1 << 25) /* Bit 25: P3.25 open drain mode */ -#define PINCONN_ODMODE3_P3p26 (1 << 25) /* Bit 26: P3.26 open drain mode */ - /* Bits 17-31: Reserved */ -/* Open Drain Pin Mode select register 4 (PINMODE_OD4: 0x4002c078) */ - -#define PINCONN_ODMODE4_P4(n) (1 << (n)) - /* Bits 0-27: Reserved */ -#define PINCONN_ODMODE4_P4p28 (1 << 28) /* Bit 28: P4.28 open drain mode */ -#define PINCONN_ODMODE4_P4p29 (1 << 29) /* Bit 29: P4.29 open drain mode */ - /* Bits 30-31: Reserved */ -/* I2C Pin Configuration register (I2CPADCFG: 0x4002c07c) */ - -#define PINCONN_I2CPADCFG_SDADRV0 (1 << 0) /* Bit 0: SDA0 pin, P0.27 in Fast Mode Plus */ -#define PINCONN_I2CPADCFG_SDAI2C0 (1 << 1) /* Bit 1: SDA0 pin, P0.27 I2C glitch - * filtering/slew rate control */ -#define PINCONN_I2CPADCFG_SCLDRV0 (1 << 2) /* Bit 2: SCL0 pin, P0.28 in Fast Mode Plus */ -#define PINCONN_I2CPADCFG_SCLI2C0 (1 << 3) /* Bit 3: SCL0 pin, P0.28 I2C glitch - * filtering/slew rate control */ - /* Bits 4-31: Reserved */ - /************************************************************************************ * Public Types ************************************************************************************/ diff --git a/nuttx/arch/arm/src/lpc17xx/lpc17_gpio.h b/nuttx/arch/arm/src/lpc17xx/lpc17_gpio.h index f3a003255f..993369aa2d 100644 --- a/nuttx/arch/arm/src/lpc17xx/lpc17_gpio.h +++ b/nuttx/arch/arm/src/lpc17xx/lpc17_gpio.h @@ -171,19 +171,36 @@ #elif defined(LPC178x) -/* Encoding: TT FFFF MMOV PPPN NNNN - Encoding: TTTT TTTT FFFF MMOV PPPN NNNN - */ -/* Encoding: FFFF MMOV PPPN NNNN - * - * Pin Function: FFFF - * Pin Mode bits: MM - * Open drain: O (output pins) - * Initial value: V (output pins) - * Port number: PPP (0-4) - * Pin number: NNNNN (0-31) +/* Encoding: TTTT TTTT FFFF MMOV PPPN NNNN + * + * Special Pin Functions: TTTT TTTT + * Pin Function: FFFF + * Pin Mode bits: MM + * Open drain: O (output pins) + * Initial value: V (output pins) + * Port number: PPP (0-4) + * Pin number: NNNNN (0-31) */ +/* Special Pin Functions + * For pins that has ADC/DAC, USB, I2C + */ + +#define GPIO_IOCON_TYPE_D_MASK (0x0000067f) /* All port except where ADC/DAC, USB, I2C is present */ +#define GPIO_IOCON_TYPE_A_MASK (0x000105df) /* USB/ADC/DAC P0:12 to 13, P0:23 to 26, P1:30 to 31 */ +#define GPIO_IOCON_TYPE_U_MASK (0x00000007) /* USB P0:29 to 31 */ +#define GPIO_IOCON_TYPE_I_MASK (0x00000347) /* I2C/USB P0:27 to 28, P5:2 to 3 */ +#define GPIO_IOCON_TYPE_W_MASK (0x000007ff) /* I2S P0:7 to 9 */ + +# define GPIO_HYS (1 << 16) /* Bit 16: HYSTERESIS: 0-Disable, 1-Enabled */ +# define GPIO_INV (1 << 17) /* Bit 17: Input: 0-Not Inverted, 1-Inverted */ +# define GPIO_SLEW (1 << 18) /* Bit 18: Rate Control: 0-Standard mode, 1-Fast mode */ +# define GPIO_ADMODE (1 << 19) /* Bit 19: A/D Modes: 0-Analog, 1-Digital */ +# define GPIO_FILTER (1 << 20) /* Bit 20: Filter: 0-Off, 1-ON */ +# define GPIO_DACEN (1 << 21) /* Bit 21: DAC: 0-Disabled, 1-Enabled, P0:26 only */ +# define GPIO_I2CHS (1 << 22) /* Bit 22: Filter and Rate Control: 0-Enabled, 1-Disabled */ +# define GPIO_HIDRIVE (1 << 23) /* Bit 23: Current Sink: 0-4mA, 1-20mA P5:2 and P5:3 only,*/ + /* Pin Function bits: FFFF * Only meaningful when the GPIO function is GPIO_PIN */ @@ -198,24 +215,11 @@ # define GPIO_ALT1 (5 << GPIO_FUNC_SHIFT) /* 0101 Alternate function 1 */ # define GPIO_ALT2 (6 << GPIO_FUNC_SHIFT) /* 0110 Alternate function 2 */ # define GPIO_ALT3 (7 << GPIO_FUNC_SHIFT) /* 0111 Alternate function 3 */ - # define GPIO_ALT4 (8 << GPIO_FUNC_SHIFT) /* 1000 Alternate function 4 */ # define GPIO_ALT5 (9 << GPIO_FUNC_SHIFT) /* 1001 Alternate function 5 */ # define GPIO_ALT6 (10 << GPIO_FUNC_SHIFT) /* 1010 Alternate function 6 */ # define GPIO_ALT7 (11 << GPIO_FUNC_SHIFT) /* 1011 Alternate function 7 */ -/* Options for each IOCON Types */ -//~ #define GPIO_TYPE_SHIFT (16) -//~ #define GPIO_TYPE_MASK (3 << GPIO_TYPE_SHIFT) -//~ # define GPIO_HYSTERIS (<< 0 << ) -//~ # define GPIO_INVERTED (<< 1 << ) -//~ # define GPIO_SLEW (<< 2 << ) -//~ # define GPIO_ADMODE (<< 3 << ) -//~ # define GPIO_FILTER (<< 4 << ) -//~ # define GPIO_DACEN (<< 5 << ) -//~ # define GPIO_I2CHS (<< 6 << ) -//~ # define GPIO_HIDRIVE (<< 7 << ) - #define GPIO_EDGE_SHIFT (13) /* Bits 13-14: Interrupt edge bits */ #define GPIO_EDGE_MASK (3 << GPIO_EDGE_SHIFT) diff --git a/nuttx/include/nuttx/sched.h b/nuttx/include/nuttx/sched.h index b2ec1cee4d..9ab96b7d21 100644 --- a/nuttx/include/nuttx/sched.h +++ b/nuttx/include/nuttx/sched.h @@ -62,21 +62,30 @@ /* This is the maximum number of times that a lock can be set */ -#define MAX_LOCK_COUNT 127 +#define MAX_LOCK_COUNT 127 /* Values for the _TCB flags flag bits */ -#define TCB_FLAG_TTYPE_SHIFT (0) /* Bits 0-1: thread type */ -#define TCB_FLAG_TTYPE_MASK (3 << TCB_FLAG_TTYPE_SHIFT) -# define TCB_FLAG_TTYPE_TASK (0 << TCB_FLAG_TTYPE_SHIFT) /* Normal user task */ -# define TCB_FLAG_TTYPE_PTHREAD (1 << TCB_FLAG_TTYPE_SHIFT) /* User pthread */ -# define TCB_FLAG_TTYPE_KERNEL (2 << TCB_FLAG_TTYPE_SHIFT) /* Kernel thread */ -#define TCB_FLAG_NONCANCELABLE (1 << 2) /* Bit 2: Pthread is non-cancelable */ -#define TCB_FLAG_CANCEL_PENDING (1 << 3) /* Bit 3: Pthread cancel is pending */ -#define TCB_FLAG_ROUND_ROBIN (1 << 4) /* Bit 4: Round robin sched enabled */ +#define TCB_FLAG_TTYPE_SHIFT (0) /* Bits 0-1: thread type */ +#define TCB_FLAG_TTYPE_MASK (3 << TCB_FLAG_TTYPE_SHIFT) +# define TCB_FLAG_TTYPE_TASK (0 << TCB_FLAG_TTYPE_SHIFT) /* Normal user task */ +# define TCB_FLAG_TTYPE_PTHREAD (1 << TCB_FLAG_TTYPE_SHIFT) /* User pthread */ +# define TCB_FLAG_TTYPE_KERNEL (2 << TCB_FLAG_TTYPE_SHIFT) /* Kernel thread */ +#define TCB_FLAG_NONCANCELABLE (1 << 2) /* Bit 2: Pthread is non-cancelable */ +#define TCB_FLAG_CANCEL_PENDING (1 << 3) /* Bit 3: Pthread cancel is pending */ +#define TCB_FLAG_ROUND_ROBIN (1 << 4) /* Bit 4: Round robin sched enabled */ + +/* Values for struct child_status_s ch_flags */ + +#define CHILD_FLAG_TTYPE_SHIFT (0) /* Bits 0-1: child thread type */ +#define CHILD_FLAG_TTYPE_MASK (3 << CHILD_FLAG_TTYPE_SHIFT) +# define CHILD_FLAG_TTYPE_TASK (0 << CHILD_FLAG_TTYPE_SHIFT) /* Normal user task */ +# define CHILD_FLAG_TTYPE_PTHREAD (1 << CHILD_FLAG_TTYPE_SHIFT) /* User pthread */ +# define CHILD_FLAG_TTYPE_KERNEL (2 << CHILD_FLAG_TTYPE_SHIFT) /* Kernel thread */ +#define CHILD_FLAG_EXITED (1 << 0) /* Bit 2: The child thread has exit'ed */ /******************************************************************************** - * Global Type Definitions + * Public Type Definitions ********************************************************************************/ #ifndef __ASSEMBLY__ @@ -163,6 +172,22 @@ typedef struct environ_s environ_t; # define SIZEOF_ENVIRON_T(alloc) (sizeof(environ_t) + alloc - 1) #endif +/* This structure is used to maintin information about child tasks. + * pthreads work differently, they have join information. This is + * only for child tasks. + */ + +#ifdef CONFIG_SCHED_CHILD_STATUS +struct child_status_s +{ + FAR struct child_status_s *flink; + + uint8_t ch_flags; /* Child status: See CHILD_FLAG_* definitions */ + pid_y ch_pid; /* Child task ID */ + int ch_status; /* Child exit status */ +}; +#endif + /* This structure describes a reference counted D-Space region. This must be a * separately allocated "break-away" structure that can be owned by a task and * any pthreads created by the task. @@ -202,9 +227,13 @@ struct _TCB /* Task Management Fields *****************************************************/ pid_t pid; /* This is the ID of the thread */ -#ifdef CONFIG_SCHED_HAVE_PARENT +#ifdef CONFIG_SCHED_HAVE_PARENT /* Support parent-child relationship */ pid_t parent; /* This is the ID of the parent thread */ +#ifdef CONFIG_SCHED_CHILD_STATUS /* Retain child thread status */ + FAR struct child_status_s *children; /* Head of a list of child status */ +#else uint16_t nchildren; /* This is the number active children */ +#endif #endif start_t start; /* Thread start function */ entry_t entry; /* Entry Point into the thread */ @@ -357,33 +386,38 @@ typedef void (*sched_foreach_t)(FAR _TCB *tcb, FAR void *arg); #endif /* __ASSEMBLY__ */ /******************************************************************************** - * Global Function Prototypes + * Public Data ********************************************************************************/ #ifndef __ASSEMBLY__ #undef EXTERN #if defined(__cplusplus) #define EXTERN extern "C" -extern "C" { +extern "C" +{ #else #define EXTERN extern #endif +/******************************************************************************** + * Public Function Prototypes + ********************************************************************************/ + /* TCB helpers */ -EXTERN FAR _TCB *sched_self(void); +FAR _TCB *sched_self(void); /* File system helpers */ #if CONFIG_NFILE_DESCRIPTORS > 0 -EXTERN FAR struct filelist *sched_getfiles(void); +FAR struct filelist *sched_getfiles(void); #if CONFIG_NFILE_STREAMS > 0 -EXTERN FAR struct streamlist *sched_getstreams(void); +FAR struct streamlist *sched_getstreams(void); #endif /* CONFIG_NFILE_STREAMS */ #endif /* CONFIG_NFILE_DESCRIPTORS */ #if CONFIG_NSOCKET_DESCRIPTORS > 0 -EXTERN FAR struct socketlist *sched_getsockets(void); +FAR struct socketlist *sched_getsockets(void); #endif /* CONFIG_NSOCKET_DESCRIPTORS */ /* Internal vfork support.The overall sequence is: @@ -417,7 +451,7 @@ void task_vforkabort(FAR _TCB *child, int errcode); * will be disabled throughout this enumeration! */ -EXTERN void sched_foreach(sched_foreach_t handler, FAR void *arg); +void sched_foreach(sched_foreach_t handler, FAR void *arg); #undef EXTERN #if defined(__cplusplus) diff --git a/nuttx/include/sched.h b/nuttx/include/sched.h index 4494d8ef5d..9ccbf57b24 100644 --- a/nuttx/include/sched.h +++ b/nuttx/include/sched.h @@ -79,7 +79,7 @@ #endif /******************************************************************************** - * Global Type Definitions + * Public Type Definitions ********************************************************************************/ /* This is the POSIX-like scheduling parameter structure */ @@ -90,56 +90,61 @@ struct sched_param }; /******************************************************************************** - * Global Function Prototypes + * Public Data ********************************************************************************/ #ifndef __ASSEMBLY__ #undef EXTERN #if defined(__cplusplus) #define EXTERN extern "C" -extern "C" { +extern "C" +{ #else #define EXTERN extern #endif +/******************************************************************************** + * Public Function Prototypes + ********************************************************************************/ + /* Task Control Interfaces (non-standard) */ #ifndef CONFIG_CUSTOM_STACK -EXTERN int task_init(FAR _TCB *tcb, const char *name, int priority, - FAR uint32_t *stack, uint32_t stack_size, - main_t entry, const char *argv[]); +int task_init(FAR _TCB *tcb, const char *name, int priority, + FAR uint32_t *stack, uint32_t stack_size, main_t entry, + FAR const char *argv[]); #else -EXTERN int task_init(FAR _TCB *tcb, const char *name, int priority, - main_t entry, const char *argv[]); +int task_init(FAR _TCB *tcb, const char *name, int priority, main_t entry, + FAR const char *argv[]); #endif -EXTERN int task_activate(FAR _TCB *tcb); +int task_activate(FAR _TCB *tcb); #ifndef CONFIG_CUSTOM_STACK -EXTERN int task_create(const char *name, int priority, int stack_size, - main_t entry, const char *argv[]); +int task_create(FAR const char *name, int priority, int stack_size, main_t entry, + FAR const char *argv[]); #else -EXTERN int task_create(const char *name, int priority, - main_t entry, const char *argv[]); +int task_create(FAR const char *name, int priority, main_t entry, + FAR const char *argv[]); #endif -EXTERN int task_delete(pid_t pid); -EXTERN int task_restart(pid_t pid); +int task_delete(pid_t pid); +int task_restart(pid_t pid); /* Task Scheduling Interfaces (based on POSIX APIs) */ -EXTERN int sched_setparam(pid_t pid, const struct sched_param *param); -EXTERN int sched_getparam(pid_t pid, struct sched_param *param); -EXTERN int sched_setscheduler(pid_t pid, int policy, - const struct sched_param *param); -EXTERN int sched_getscheduler(pid_t pid); -EXTERN int sched_yield(void); -EXTERN int sched_get_priority_max(int policy); -EXTERN int sched_get_priority_min(int policy); -EXTERN int sched_rr_get_interval(pid_t pid, struct timespec *interval); +int sched_setparam(pid_t pid, const struct sched_param *param); +int sched_getparam(pid_t pid, struct sched_param *param); +int sched_setscheduler(pid_t pid, int policy, + FAR const struct sched_param *param); +int sched_getscheduler(pid_t pid); +int sched_yield(void); +int sched_get_priority_max(int policy); +int sched_get_priority_min(int policy); +int sched_rr_get_interval(pid_t pid, FAR struct timespec *interval); /* Task Switching Interfaces (non-standard) */ -EXTERN int sched_lock(void); -EXTERN int sched_unlock(void); -EXTERN int sched_lockcount(void); +int sched_lock(void); +int sched_unlock(void); +int sched_lockcount(void); /* If instrumentation of the scheduler is enabled, then some outboard logic * must provide the following interfaces. @@ -147,9 +152,9 @@ EXTERN int sched_lockcount(void); #ifdef CONFIG_SCHED_INSTRUMENTATION -EXTERN void sched_note_start(FAR _TCB *tcb); -EXTERN void sched_note_stop(FAR _TCB *tcb); -EXTERN void sched_note_switch(FAR _TCB *pFromTcb, FAR _TCB *pToTcb); +void sched_note_start(FAR _TCB *tcb); +void sched_note_stop(FAR _TCB *tcb); +void sched_note_switch(FAR _TCB *pFromTcb, FAR _TCB *pToTcb); #else # define sched_note_start(t) diff --git a/nuttx/sched/Makefile b/nuttx/sched/Makefile index 38d3e047fc..1ad2444507 100644 --- a/nuttx/sched/Makefile +++ b/nuttx/sched/Makefile @@ -74,7 +74,10 @@ SCHED_SRCS += sched_reprioritize.c endif ifeq ($(CONFIG_SCHED_HAVE_PARENT),y) -SCHED_SRCS += task_reparent.c +SCHED_SRCS += task_reparent.c +ifeq ($(CONFIG_SCHED_CHILD_STATUS),y) +SCHED_SRCS += task_childstatus.c +endif endif ifeq ($(CONFIG_SCHED_WAITPID),y) diff --git a/nuttx/sched/os_internal.h b/nuttx/sched/os_internal.h index 95b42c7ae3..b048f00a81 100644 --- a/nuttx/sched/os_internal.h +++ b/nuttx/sched/os_internal.h @@ -1,7 +1,7 @@ /**************************************************************************** * sched/os_internal.h * - * Copyright (C) 2007-2012 Gregory Nutt. All rights reserved. + * Copyright (C) 2007-2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -269,6 +269,16 @@ int task_argsetup(FAR _TCB *tcb, FAR const char *name, FAR const char *argv[]); void task_exithook(FAR _TCB *tcb, int status); int task_deletecurrent(void); #ifdef CONFIG_SCHED_HAVE_PARENT +#ifdef CONFIG_SCHED_CHILD_STATUS +void weak_functiontask_initialize(void); +FAR struct child_status_s *task_allocchild(void); +void task_freechild(FAR struct child_status_s *status); +FAR struct child_status_s *task_addchild(FAR _TCB *tcb, pid_t pid, int status, + uint8_t flags); +FAR struct child_status_s *task_findchild(FAR _TCB *tcb, pid_t pid); +FAR struct child_status_s *task_removechild(FAR _TCB *tcb, pid_t pid); +void task_removechildren(FAR _TCB *tcb); +#endif int task_reparent(pid_t ppid, pid_t chpid); #endif #ifndef CONFIG_CUSTOM_STACK diff --git a/nuttx/sched/os_start.c b/nuttx/sched/os_start.c index a53ac2aa8c..cb6a2c8692 100644 --- a/nuttx/sched/os_start.c +++ b/nuttx/sched/os_start.c @@ -314,6 +314,17 @@ void os_start(void) kmm_initialize((void*)CONFIG_HEAP_BASE, CONFIG_HEAP_SIZE); #endif + /* Initialize tasking data structures */ + +#if defined(CONFIG_SCHED_HAVE_PARENT) && defined(CONFIG_SCHED_CHILD_STATUS) +#ifdef CONFIG_HAVE_WEAKFUNCTIONS + if (task_initialize != NULL) +#endif + { + task_initialize(); + } +#endif + /* Initialize the interrupt handling subsystem (if included) */ #ifdef CONFIG_HAVE_WEAKFUNCTIONS diff --git a/nuttx/sched/sched_waitid.c b/nuttx/sched/sched_waitid.c index eabc69afea..a3f7221df5 100644 --- a/nuttx/sched/sched_waitid.c +++ b/nuttx/sched/sched_waitid.c @@ -155,7 +155,7 @@ int waitid(idtype_t idtype, id_t id, siginfo_t *info, int options) sched_lock(); - /* Verify that this task actually has children and that the the requeste + /* Verify that this task actually has children and that the the requested * TCB is actually a child of this task. */ diff --git a/nuttx/sched/task_childstatus.c b/nuttx/sched/task_childstatus.c new file mode 100644 index 0000000000..ab5ace43a1 --- /dev/null +++ b/nuttx/sched/task_childstatus.c @@ -0,0 +1,365 @@ +/***************************************************************************** + * sched/task_childstatus.c + * + * Copyright (C) 2013 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt + * + * 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. + * + *****************************************************************************/ + +/***************************************************************************** + * Included Files + *****************************************************************************/ + +#include + +#include + +#include "os_internal.h" + +#if defined(CONFIG_SCHED_HAVE_PARENT) && defined(CONFIG_SCHED_CHILD_STATUS) + +/***************************************************************************** + * Private Types + *****************************************************************************/ +/* Globals are maintained in a structure to minimize name collisions. Note + * that there cannot be more that CONFIG_MAX_TASKS tasks in total. So using + * CONFIG_MAX_TASKS should be sufficient (at least one task, the IDLE thread, + * will have no parent). + */ + +struct child_pool_s +{ + struct child_status_s alloc[CONFIG_MAX_TASKS]; + FAR struct child_status_s *freelist; +}; + +/***************************************************************************** + * Private Data + *****************************************************************************/ + +static struct child_pool_s g_child_pool; + +/***************************************************************************** + * Private Functions + *****************************************************************************/ + +/***************************************************************************** + * Public Functions + *****************************************************************************/ + +/***************************************************************************** + * Name: task_initialize + * + * Description: + * Initialize task related status. At present, this includes only the + * initialize of the child status pool. + * + * Parameters: + * None. + * + * Return Value: + * None. + * + * Assumptions: + * Called early in initializatin. No special precautions are required. + * + *****************************************************************************/ + +void task_initialize(void) +{ + FAR struct child_status_s *curr; + FAR struct child_status_s *prev; + int i; + + /* Save all of the child status structures in a free list */ + + prev = &g_child_pool.alloc[0]; + g_child_pool.freelist = prev; + for (i = 0; i < CONFIG_MAX_TASKS; i++) + { + curr = &g_child_pool.alloc[i] + prev->flink = curr; + prev = curr; + } +} + +/***************************************************************************** + * Name: task_allocchild + * + * Description: + * Allocate a child status structure by removing the next entry from a + * free list. + * + * Parameters: + * None. + * + * Return Value: + * On success, a non-NULL pointer to a child status structure. NULL is + * returned if there are no remaining, pre-allocated child status structures. + * + * Assumptions: + * Called during task creation in a safe context. No special precautions + * are required here. + * + *****************************************************************************/ + +FAR struct child_status_s *task_allocchild(void) +{ + FAR struct child_status_s *ret; + + /* Return the status block at the head of the free list */ + + ret = g_child_pool.freelist; + if (ret) + { + g_child_pool.freelist = ret->flink; + ret->flink = NULL; + } + + return ret; +} + +/***************************************************************************** + * Name: task_freechild + * + * Description: + * Release a child status structure by returning it to a free list. + * + * Parameters: + * status - The child status structure to be freed. + * + * Return Value: + * None. + * + * Assumptions: + * Called during task creation in a safe context. No special precautions + * are required here. + * + *****************************************************************************/ + +void task_freechild(FAR struct child_status_s *child) +{ + /* Return the child status structure to the free list */ + + if (child) + { + child->flink = g_child_pool.freelist; + g_child_pool.freelist = child; + } +} + +/***************************************************************************** + * Name: task_addchild + * + * Description: + * Find a child status structure in the given TCB. + * + * Parameters: + * tcb - The TCB of the parent task to containing the child status. + * pid - The ID of the child to create + * status - Child exit status (should be zero) + * flags - Child flags (see CHILD_FLAGS_* defininitions) + * + * Return Value: + * On success, a non-NULL pointer to a child status structure. NULL is + * returned if (1) there are no free status structures, or (2) an entry + * with this PID already exists. + * + * Assumptions: + * Called during task creation processing in a safe context. No special + * precautions are required here. + * + *****************************************************************************/ + +FAR struct child_status_s *task_addchild(FAR _TCB *tcb, pid_t pid, int status, + uint8_t flags) +{ + FAR struct child_status_s *child; + + /* Make sure that there is not already a structure for this PID */ + + child = task_findchild(tcb, pid); + if (child) + { + return NULL; + } + + /* Allocate a new status structure */ + + child = task_allocchild(void); + if (child) + { + /* Initialize the structure */ + + child->ch_flags = flags; + child->ch_pid = pid; + child->ch_status = status; + + /* Add the entry into the TCB list of children */ + + status->flink = tcb->children; + tcb->childen = status; + } + + return child; +} + +/***************************************************************************** + * Name: task_findchild + * + * Description: + * Find a child status structure in the given TCB. A reference to the + * child structure is returned, but the child remains the the TCB's list + * of children. + * + * Parameters: + * tcb - The TCB of the parent task to containing the child status. + * pid - The ID of the child to find. + * + * Return Value: + * On success, a non-NULL pointer to a child status structure. NULL is + * returned if there is child status structure for that pid in the TCB. + * + * Assumptions: + * Called during SIGCHLD processing in a safe context. No special precautions + * are required here. + * + *****************************************************************************/ + +FAR struct child_status_s *task_findchild(FAR _TCB *tcb, pid_t pid) +{ + FAR struct child_status_s *child; + + /* Find the status structure with the matching PID */ + + for (child = tcb->children; child; child = child->flink) + { + if (child->ch_pid == pid) + { + return child; + } + } + + return NULL; +} + +/***************************************************************************** + * Name: task_removechild + * + * Description: + * Remove one child structure from the TCB. The child is removed, but is + * not yet freed. task_freechild must be called in order to free the child + * status structure. + * + * Parameters: + * tcb - The TCB of the parent task to containing the child status. + * pid - The ID of the child to find. + * + * Return Value: + * On success, a non-NULL pointer to a child status structure. NULL is + * returned if there is child status structure for that pid in the TCB. + * + * Assumptions: + * Called during SIGCHLD processing in a safe context. No special precautions + * are required here. + * + *****************************************************************************/ + +FAR struct child_status_s *task_removechild(FAR _TCB *tcb, pid_t pid) +{ + FAR struct child_status_s *curr; + FAR struct child_status_s *prev; + + /* Find the status structure with the matching PID */ + + for (prev = NULL, curr = tcb->children; + curr; + prev = curr, curr = curr->flink) + { + if (curr->ch_pid == pid) + { + break; + } + } + + /* Did we find it? If so, remove it from the TCB. */ + + if (curr) + { + /* Do we remove it from mid-list? Or from the head of the list? */ + + if (prev) + { + prev->flink = curr->flink; + } + else + { + tcb->children = curr->flink; + } + + curr->flink = NULL; + } + + return curr; +} + +/***************************************************************************** + * Name: task_removechildren + * + * Description: + * Remove and free all child structure from the TCB. + * + * Parameters: + * tcb - The TCB of the parent task to containing the child status. + * + * Return Value: + * None. + * + * Assumptions: + * Called during task exit processing in a safe context. No special + * precautions are required here. + * + *****************************************************************************/ + +void task_removechildren(FAR _TCB *tcb) +{ + FAR struct child_status_s *curr; + FAR struct child_status_s *next; + + /* Remove all child structures for the TCB and return them to the freelist */ + + for (curr = tcb->children; curr; curr = next) + { + next = curr->flink; + task_freechild(curr); + } +} + +#endif /* CONFIG_SCHED_HAVE_PARENT && CONFIG_SCHED_CHILD_STATUS */ From 3cb33101a916278c43fd3995880a2a9440794e4c Mon Sep 17 00:00:00 2001 From: patacongo Date: Tue, 22 Jan 2013 23:54:31 +0000 Subject: [PATCH 108/118] Add lpc178x_iocon.h from Rommel Marcelo git-svn-id: http://svn.code.sf.net/p/nuttx/code/trunk@5550 42af7a65-404d-4744-a932-0658087f49c3 --- .../arch/arm/src/lpc17xx/chip/lpc178x_iocon.h | 152 ++++++++++++++++++ .../arch/arm/src/lpc17xx/chip/lpc17_pinconn.h | 2 +- 2 files changed, 153 insertions(+), 1 deletion(-) create mode 100755 nuttx/arch/arm/src/lpc17xx/chip/lpc178x_iocon.h diff --git a/nuttx/arch/arm/src/lpc17xx/chip/lpc178x_iocon.h b/nuttx/arch/arm/src/lpc17xx/chip/lpc178x_iocon.h new file mode 100755 index 0000000000..0f820f7a60 --- /dev/null +++ b/nuttx/arch/arm/src/lpc17xx/chip/lpc178x_iocon.h @@ -0,0 +1,152 @@ +/************************************************************************************ + * arch/arm/src/lpc17xx/chip/lpc178x_iocon.h + * + * Copyright (C) 2013 Gregory Nutt. All rights reserved. + * Author: Rommel Marcelo + * Gregory Nutt + * + * 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. + * + ************************************************************************************/ + +#ifndef __ARCH_ARM_SRC_LPC17XX_CHIP_LPC17_IOCON_H +#define __ARCH_ARM_SRC_LPC17XX_CHIP_LPC17_IOCON_H + +/************************************************************************************ + * Included Files + ************************************************************************************/ + +#include + +#include "chip.h" +#include "chip/lpc17_memorymap.h" + +/************************************************************************************ + * Pre-processor Definitions + ************************************************************************************/ + +/* Register offsets *****************************************************************/ + +#define LPC17_IOCON_P0_OFFSET (LPC17_IOCON_BASE+0x0000) +#define LPC17_IOCON_P1_OFFSET (LPC17_IOCON_BASE+0x0080) +#define LPC17_IOCON_P2_OFFSET (LPC17_IOCON_BASE+0x0100) +#define LPC17_IOCON_P3_OFFSET (LPC17_IOCON_BASE+0x0180) +#define LPC17_IOCON_P4_OFFSET (LPC17_IOCON_BASE+0x0200) +#define LPC17_IOCON_P5_OFFSET (LPC17_IOCON_BASE+0x0280) + +#define LPC17_IOCON_PP0_OFFSET (0x0000) /* IOCON Port(n) register 0 */ +#define LPC17_IOCON_PP1_OFFSET (0x0004) /* IOCON Port(n) register 1 */ +#define LPC17_IOCON_PP2_OFFSET (0x0008) /* IOCON Port(n) register 2 */ +#define LPC17_IOCON_PP3_OFFSET (0x000c) /* IOCON Port(n) register 3 */ +#define LPC17_IOCON_PP4_OFFSET (0x0010) /* IOCON Port(n) register 4 */ +#define LPC17_IOCON_PP5_OFFSET (0x0014) /* IOCON Port(n) register 5 */ +#define LPC17_IOCON_PP6_OFFSET (0x0018) /* IOCON Port(n) register 6 */ +#define LPC17_IOCON_PP7_OFFSET (0x001c) /* IOCON Port(n) register 7 */ +#define LPC17_IOCON_PP8_OFFSET (0x0020) /* IOCON Port(n) register 8 */ +#define LPC17_IOCON_PP9_OFFSET (0x0024) /* IOCON Port(n) register 9 */ +#define LPC17_IOCON_PP10_OFFSET (0x0028) /* IOCON Port(n) register 10 */ +#define LPC17_IOCON_PP11_OFFSET (0x002c) /* IOCON Port(n) register 11 */ +#define LPC17_IOCON_PP12_OFFSET (0x0030) /* IOCON Port(n) register 12 */ +#define LPC17_IOCON_PP13_OFFSET (0x0034) /* IOCON Port(n) register 13 */ +#define LPC17_IOCON_PP14_OFFSET (0x0038) /* IOCON Port(n) register 14 */ +#define LPC17_IOCON_PP15_OFFSET (0x003c) /* IOCON Port(n) register 15 */ +#define LPC17_IOCON_PP16_OFFSET (0x0040) /* IOCON Port(n) register 16 */ +#define LPC17_IOCON_PP17_OFFSET (0x0044) /* IOCON Port(n) register 17 */ +#define LPC17_IOCON_PP18_OFFSET (0x0048) /* IOCON Port(n) register 18 */ +#define LPC17_IOCON_PP19_OFFSET (0x004c) /* IOCON Port(n) register 19 */ +#define LPC17_IOCON_PP20_OFFSET (0x0050) /* IOCON Port(n) register 20 */ +#define LPC17_IOCON_PP21_OFFSET (0x0054) /* IOCON Port(n) register 21 */ +#define LPC17_IOCON_PP22_OFFSET (0x0058) /* IOCON Port(n) register 22 */ +#define LPC17_IOCON_PP23_OFFSET (0x005c) /* IOCON Port(n) register 23 */ +#define LPC17_IOCON_PP24_OFFSET (0x0060) /* IOCON Port(n) register 24 */ +#define LPC17_IOCON_PP25_OFFSET (0x0064) /* IOCON Port(n) register 25 */ +#define LPC17_IOCON_PP26_OFFSET (0x0068) /* IOCON Port(n) register 26 */ +#define LPC17_IOCON_PP27_OFFSET (0x006c) /* IOCON Port(n) register 27 */ +#define LPC17_IOCON_PP28_OFFSET (0x0070) /* IOCON Port(n) register 28 */ +#define LPC17_IOCON_PP29_OFFSET (0x0074) /* IOCON Port(n) register 29 */ +#define LPC17_IOCON_PP30_OFFSET (0x0078) /* IOCON Port(n) register 30 */ +#define LPC17_IOCON_PP31_OFFSET (0x007c) /* IOCON Port(n) register 31 */ + +/* Register addresses ***************************************************************/ + +//~ #define LPC17_IOCON_PP1(portoffset) (portoffset+LPC17_IOCON_P0_OFFSET) + +/* Register bit definitions *********************************************************/ +/* Pin Function Select register 0 (PINSEL0: 0x4002c000) */ +/* IOCON pin function select */ + +#define IOCON_FUNC_GPIO (0) +#define IOCON_FUNC_ALT1 (1) +#define IOCON_FUNC_ALT2 (2) +#define IOCON_FUNC_ALT3 (3) +#define IOCON_FUNC_ALT4 (4) +#define IOCON_FUNC_ALT5 (5) +#define IOCON_FUNC_ALT6 (6) +#define IOCON_FUNC_ALT7 (7) + +#define IOCON_FUNC_SHIFT (0) /* Bits 0-2: All types */ +#define IOCON_FUNC_MASK (7 << IOCON_FUNC_SHIFT) +#define IOCON_MODE_SHIFT (3) /* Bits 3-4: Type D,A,W */ +#define IOCON_MODE_MASK (3 << IOCON_MODE_SHIFT ) +#define IOCON_HYS_SHIFT (5) /* Bit 5: Type D,W */ +#define IOCON_HYS_MASK (1 << IOCON_HYS_SHIFT) +#define IOCON_INV_SHIFT (6) /* Bit 6: Typ D,A,I,W */ +#define IOCON_INV_MASK (1 << IOCON_INV_SHIFT) +#define IOCON_ADMODE_SHIFT (7) /* Bit 7: Type A */ +#define IOCON_ADMODE_MASK (1 << IOCON_ADMODE_SHIFT) +#define IOCON_FILTER_SHIFT (8) /* Bit 8: Type A */ +#define IOCON_FILTER_MASK (1 << IOCON_FILTER_SHIFT) +#define IOCON_SLEW_SHIFT (9) /* Bit 9: Type W*/ +#define IOCON_SLEW_MASK (1 << IOCON_SLEW_SHIFT) +#define IOCON_HIDRIVE_SHIFT (9) /* Bit 9: Type I */ +#define IOCON_HIDRIVE_MASK (1 << IOCON_HIDRIVE_SHIFT) +#define IOCON_OD_SHIFT (10) /* Bit 10: Type D,A,W */ +#define IOCON_OD_MASK (1 << IOCON_OD_SHIFT) +#define IOCON_DACEN_SHIFT (16) /* Bit 16: Type A */ +#define IOCON_DACEN_MASK (1 << IOCON_DACEN_SHIFT) + +/* Pin modes */ + +#define IOCON_MODE_FLOAT (0) /* 00: pin has neither pull-up nor pull-down */ +#define IOCON_MODE_PD (1) /* 00: pin has a pull-down resistor enabled */ +#define IOCON_MODE_PU (2) /* 00: pin has a pull-up resistor enabled */ +#define IOCON_MODE_RM (3) /* 00: pin has repeater mode enabled */ + +/************************************************************************************ + * Public Types + ************************************************************************************/ + +/************************************************************************************ + * Public Data + ************************************************************************************/ + +/************************************************************************************ + * Public Functions + ************************************************************************************/ + +#endif /* __ARCH_ARM_SRC_LPC17XX_CHIP_LPC17_IOCON_H */ diff --git a/nuttx/arch/arm/src/lpc17xx/chip/lpc17_pinconn.h b/nuttx/arch/arm/src/lpc17xx/chip/lpc17_pinconn.h index c432c6f258..1ca4d163f1 100644 --- a/nuttx/arch/arm/src/lpc17xx/chip/lpc17_pinconn.h +++ b/nuttx/arch/arm/src/lpc17xx/chip/lpc17_pinconn.h @@ -47,7 +47,7 @@ #if defined(LPC176x) # include "chip/lpc176x_pinconn.h" #elif defined(LPC178x) -# include "chip/lpc178x_pinconn.h" +# include "chip/lpc178x_iocon.h" #else # error "Unrecognized LPC17xx family" #endif From b10238efee96527ec14de35bc5bc63a8a02dc42c Mon Sep 17 00:00:00 2001 From: patacongo Date: Wed, 23 Jan 2013 00:19:46 +0000 Subject: [PATCH 109/118] Missed changed from last lpc1788 check-in git-svn-id: http://svn.code.sf.net/p/nuttx/code/trunk@5551 42af7a65-404d-4744-a932-0658087f49c3 --- nuttx/arch/arm/src/lpc17xx/chip/lpc178x_iocon.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/nuttx/arch/arm/src/lpc17xx/chip/lpc178x_iocon.h b/nuttx/arch/arm/src/lpc17xx/chip/lpc178x_iocon.h index 0f820f7a60..b8c9ee480c 100755 --- a/nuttx/arch/arm/src/lpc17xx/chip/lpc178x_iocon.h +++ b/nuttx/arch/arm/src/lpc17xx/chip/lpc178x_iocon.h @@ -34,8 +34,8 @@ * ************************************************************************************/ -#ifndef __ARCH_ARM_SRC_LPC17XX_CHIP_LPC17_IOCON_H -#define __ARCH_ARM_SRC_LPC17XX_CHIP_LPC17_IOCON_H +#ifndef __ARCH_ARM_SRC_LPC17XX_CHIP_LPC178X_IOCON_H +#define __ARCH_ARM_SRC_LPC17XX_CHIP_LPC178X_IOCON_H /************************************************************************************ * Included Files @@ -149,4 +149,4 @@ * Public Functions ************************************************************************************/ -#endif /* __ARCH_ARM_SRC_LPC17XX_CHIP_LPC17_IOCON_H */ +#endif /* __ARCH_ARM_SRC_LPC17XX_CHIP_LPC178X_IOCON_H */ From deb5fe51871666073a4e4dbb6de391612df38e4b Mon Sep 17 00:00:00 2001 From: Marco Bauer Date: Wed, 23 Jan 2013 15:29:24 +0100 Subject: [PATCH 110/118] timing changed and amber for manual added --- Makefile | 3 ++- apps/drivers/blinkm/blinkm.cpp | 42 +++++++++++++++++++++++++++------- 2 files changed, 36 insertions(+), 9 deletions(-) diff --git a/Makefile b/Makefile index f91e75d0b6..84086347f5 100644 --- a/Makefile +++ b/Makefile @@ -116,7 +116,8 @@ ifeq ($(SYSTYPE),Linux) SERIAL_PORTS ?= "/dev/ttyACM5,/dev/ttyACM4,/dev/ttyACM3,/dev/ttyACM2,/dev/ttyACM1,/dev/ttyACM0" endif ifeq ($(SERIAL_PORTS),) -SERIAL_PORTS = "\\\\.\\COM32,\\\\.\\COM31,\\\\.\\COM30,\\\\.\\COM29,\\\\.\\COM28,\\\\.\\COM27,\\\\.\\COM26,\\\\.\\COM25,\\\\.\\COM24,\\\\.\\COM23,\\\\.\\COM22,\\\\.\\COM21,\\\\.\\COM20,\\\\.\\COM19,\\\\.\\COM18,\\\\.\\COM17,\\\\.\\COM16,\\\\.\\COM15,\\\\.\\COM14,\\\\.\\COM13,\\\\.\\COM12,\\\\.\\COM11,\\\\.\\COM10,\\\\.\\COM9,\\\\.\\COM8,\\\\.\\COM7,\\\\.\\COM6,\\\\.\\COM5,\\\\.\\COM4,\\\\.\\COM3,\\\\.\\COM2,\\\\.\\COM1,\\\\.\\COM0" +#SERIAL_PORTS = "\\\\.\\COM32,\\\\.\\COM31,\\\\.\\COM30,\\\\.\\COM29,\\\\.\\COM28,\\\\.\\COM27,\\\\.\\COM26,\\\\.\\COM25,\\\\.\\COM24,\\\\.\\COM23,\\\\.\\COM22,\\\\.\\COM21,\\\\.\\COM20,\\\\.\\COM19,\\\\.\\COM18,\\\\.\\COM17,\\\\.\\COM16,\\\\.\\COM15,\\\\.\\COM14,\\\\.\\COM13,\\\\.\\COM12,\\\\.\\COM11,\\\\.\\COM10,\\\\.\\COM9,\\\\.\\COM8,\\\\.\\COM7,\\\\.\\COM6,\\\\.\\COM5,\\\\.\\COM4,\\\\.\\COM3,\\\\.\\COM2,\\\\.\\COM1,\\\\.\\COM0" +SERIAL_PORTS = "\\\\.\\COM3,\\\\.\\COM2,\\\\.\\COM1,\\\\.\\COM0" endif upload: $(FIRMWARE_BUNDLE) $(UPLOADER) diff --git a/apps/drivers/blinkm/blinkm.cpp b/apps/drivers/blinkm/blinkm.cpp index aeee80905a..2ff59d5f3f 100644 --- a/apps/drivers/blinkm/blinkm.cpp +++ b/apps/drivers/blinkm/blinkm.cpp @@ -118,8 +118,8 @@ #include static const float MAX_CELL_VOLTAGE = 4.3f; -static const int LED_ONTIME = 100; -static const int LED_OFFTIME = 100; +static const int LED_ONTIME = 120; +static const int LED_OFFTIME = 120; static const int LED_BLINK = 1; static const int LED_NOBLINK = 0; @@ -167,7 +167,8 @@ private: LED_PURPLE, LED_GREEN, LED_BLUE, - LED_WHITE + LED_WHITE, + LED_AMBER }; work_s _work; @@ -178,6 +179,8 @@ private: int led_color_4; int led_color_5; int led_color_6; + int led_color_7; + int led_color_8; int led_blink; bool systemstate_run; @@ -250,6 +253,8 @@ BlinkM::BlinkM(int bus) : led_color_4(LED_OFF), led_color_5(LED_OFF), led_color_6(LED_OFF), + led_color_7(LED_OFF), + led_color_8(LED_OFF), led_blink(LED_NOBLINK), systemstate_run(false) { @@ -374,7 +379,7 @@ BlinkM::led() static int num_of_cells = 0; static int detected_cells_runcount = 0; - static int t_led_color[6] = { 0, 0, 0, 0, 0, 0}; + static int t_led_color[8] = { 0, 0, 0, 0, 0, 0, 0, 0}; static int t_led_blink = 0; static int led_thread_runcount=0; static int led_interval = 1000; @@ -416,6 +421,8 @@ BlinkM::led() t_led_color[4] = LED_PURPLE; } t_led_color[5] = LED_OFF; + t_led_color[6] = LED_OFF; + t_led_color[7] = LED_OFF; t_led_blink = LED_BLINK; } else { t_led_color[0] = led_color_1; @@ -424,6 +431,8 @@ BlinkM::led() t_led_color[3] = led_color_4; t_led_color[4] = led_color_5; t_led_color[5] = led_color_6; + t_led_color[6] = led_color_7; + t_led_color[7] = led_color_8; t_led_blink = led_blink; } led_thread_ready = false; @@ -434,16 +443,19 @@ BlinkM::led() setLEDColor(LED_OFF); led_interval = LED_OFFTIME; } else { - setLEDColor(t_led_color[(led_thread_runcount / 2) % 6]); + setLEDColor(t_led_color[(led_thread_runcount / 2) % 8]); //led_interval = (led_thread_runcount & 1) : LED_ONTIME; led_interval = LED_ONTIME; } - if (led_thread_runcount == 11) { + if (led_thread_runcount == 15) { /* obtained data for the first file descriptor */ struct vehicle_status_s vehicle_status_raw; struct vehicle_gps_position_s vehicle_gps_position_raw; + memset(&vehicle_status_raw, 0, sizeof(vehicle_status_raw)); + memset(&vehicle_gps_position_raw, 0, sizeof(vehicle_gps_position_raw)); + bool new_data_vehicle_status; bool new_data_vehicle_gps_position; @@ -473,7 +485,8 @@ BlinkM::led() /* get number of used satellites in navigation */ num_of_used_sats = 0; - for(int satloop=0; satloop<20; satloop++) { + //for(int satloop=0; satloop<20; satloop++) { + for(int satloop=0; satloop Date: Wed, 23 Jan 2013 15:29:46 +0100 Subject: [PATCH 111/118] timing changed and amber for manual added --- Makefile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 84086347f5..f91e75d0b6 100644 --- a/Makefile +++ b/Makefile @@ -116,8 +116,7 @@ ifeq ($(SYSTYPE),Linux) SERIAL_PORTS ?= "/dev/ttyACM5,/dev/ttyACM4,/dev/ttyACM3,/dev/ttyACM2,/dev/ttyACM1,/dev/ttyACM0" endif ifeq ($(SERIAL_PORTS),) -#SERIAL_PORTS = "\\\\.\\COM32,\\\\.\\COM31,\\\\.\\COM30,\\\\.\\COM29,\\\\.\\COM28,\\\\.\\COM27,\\\\.\\COM26,\\\\.\\COM25,\\\\.\\COM24,\\\\.\\COM23,\\\\.\\COM22,\\\\.\\COM21,\\\\.\\COM20,\\\\.\\COM19,\\\\.\\COM18,\\\\.\\COM17,\\\\.\\COM16,\\\\.\\COM15,\\\\.\\COM14,\\\\.\\COM13,\\\\.\\COM12,\\\\.\\COM11,\\\\.\\COM10,\\\\.\\COM9,\\\\.\\COM8,\\\\.\\COM7,\\\\.\\COM6,\\\\.\\COM5,\\\\.\\COM4,\\\\.\\COM3,\\\\.\\COM2,\\\\.\\COM1,\\\\.\\COM0" -SERIAL_PORTS = "\\\\.\\COM3,\\\\.\\COM2,\\\\.\\COM1,\\\\.\\COM0" +SERIAL_PORTS = "\\\\.\\COM32,\\\\.\\COM31,\\\\.\\COM30,\\\\.\\COM29,\\\\.\\COM28,\\\\.\\COM27,\\\\.\\COM26,\\\\.\\COM25,\\\\.\\COM24,\\\\.\\COM23,\\\\.\\COM22,\\\\.\\COM21,\\\\.\\COM20,\\\\.\\COM19,\\\\.\\COM18,\\\\.\\COM17,\\\\.\\COM16,\\\\.\\COM15,\\\\.\\COM14,\\\\.\\COM13,\\\\.\\COM12,\\\\.\\COM11,\\\\.\\COM10,\\\\.\\COM9,\\\\.\\COM8,\\\\.\\COM7,\\\\.\\COM6,\\\\.\\COM5,\\\\.\\COM4,\\\\.\\COM3,\\\\.\\COM2,\\\\.\\COM1,\\\\.\\COM0" endif upload: $(FIRMWARE_BUNDLE) $(UPLOADER) From f86f863834bf7eae566e4ccce00ecfef3f914b05 Mon Sep 17 00:00:00 2001 From: patacongo Date: Wed, 23 Jan 2013 14:38:13 +0000 Subject: [PATCH 112/118] Add single-wire UART support to STM32 serial driver git-svn-id: http://svn.code.sf.net/p/nuttx/code/trunk@5552 42af7a65-404d-4744-a932-0658087f49c3 --- nuttx/ChangeLog | 4 +++- nuttx/arch/arm/src/stm32/Kconfig | 19 ++++++++++++++++- nuttx/arch/arm/src/stm32/stm32_serial.c | 27 ++++++++++++++++++++++++- nuttx/include/nuttx/serial/tioctl.h | 25 ++++++++++++++--------- 4 files changed, 63 insertions(+), 12 deletions(-) diff --git a/nuttx/ChangeLog b/nuttx/ChangeLog index 75bfd457f3..6c176c6018 100644 --- a/nuttx/ChangeLog +++ b/nuttx/ChangeLog @@ -4009,5 +4009,7 @@ * arch/arm/src/*/*_irq.c: Set the priority of the SVCALL exception to the highest possible value. * arch/armv7-m/up_hardfault.c: Fail if a hardfault occurs - while CONFIG_ARM7VM_USEBASEI=y. + while CONFIG_ARM7VM_USEBASEPRI=y. + * arch/arm/src/stm32/stm32_serial.c: Add support for USART + single wire more (Contributed by the PX4 team). diff --git a/nuttx/arch/arm/src/stm32/Kconfig b/nuttx/arch/arm/src/stm32/Kconfig index 99dde32093..85cdebd35f 100644 --- a/nuttx/arch/arm/src/stm32/Kconfig +++ b/nuttx/arch/arm/src/stm32/Kconfig @@ -457,32 +457,38 @@ config STM32_USART1 bool "USART1" default n select ARCH_HAVE_USART1 + select STM32_USART config STM32_USART2 bool "USART2" default n select ARCH_HAVE_USART2 + select STM32_USART config STM32_USART3 bool "USART3" default n select ARCH_HAVE_USART3 + select STM32_USART config STM32_UART4 bool "UART4" default n select ARCH_HAVE_UART4 + select STM32_USART config STM32_UART5 bool "UART5" default n select ARCH_HAVE_UART5 + select STM32_USART config STM32_USART6 bool "USART6" default n depends on STM32_STM32F20XX || STM32_STM32F40XX select ARCH_HAVE_USART6 + select STM32_USART config STM32_USB bool "USB Device" @@ -1804,8 +1810,11 @@ config STM32_TIM14_DAC2 endchoice +bool STM32_USART + bool + menu "U[S]ART Configuration" - depends on STM32_USART1 || STM32_USART2 || STM32_USART3 || STM32_USART4 || STM32_USART5 || STM32_USART6 + depends on STM32_USART config USART1_RS485 bool "RS-485 on USART1" @@ -1968,6 +1977,14 @@ config SERIAL_TERMIOS endmenu +config STM32_USART_SINGLEWIRE + bool "Single Wire Support" + default n + depends on STM32_USART + ---help--- + Enable single wire UART support. The option enables support for the + TIOCSSINGLEWIRE ioctl in the STM32 serial driver. + menu "SPI Configuration" depends on STM32_SPI diff --git a/nuttx/arch/arm/src/stm32/stm32_serial.c b/nuttx/arch/arm/src/stm32/stm32_serial.c index e86fbcf6f8..0151bd247c 100644 --- a/nuttx/arch/arm/src/stm32/stm32_serial.c +++ b/nuttx/arch/arm/src/stm32/stm32_serial.c @@ -1,7 +1,7 @@ /**************************************************************************** * arch/arm/src/stm32/stm32_serial.c * - * Copyright (C) 2009-2012 Gregory Nutt. All rights reserved. + * Copyright (C) 2009-2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -1401,6 +1401,31 @@ static int up_ioctl(struct file *filep, int cmd, unsigned long arg) } break; +#ifdef CONFIG_STM32_USART_SINGLEWIRE + case TIOCSSINGLEWIRE: + { + /* Change the TX port to be open-drain/push-pull and enable/disable + * half-duplex mode. + */ + + uint32_t cr = up_serialin(priv, STM32_USART_CR3_OFFSET); + + if (arg == SER_SINGLEWIRE_ENABLED) + { + stm32_configgpio(priv->tx_gpio | GPIO_OPENDRAIN); + cr |= USART_CR3_HDSEL; + } + else + { + stm32_configgpio(priv->tx_gpio | GPIO_PUSHPULL); + cr &= ~USART_CR3_HDSEL; + } + + up_serialout(priv, STM32_USART_CR3_OFFSET, cr); + } + break; +#endif + #ifdef CONFIG_SERIAL_TERMIOS case TCGETS: { diff --git a/nuttx/include/nuttx/serial/tioctl.h b/nuttx/include/nuttx/serial/tioctl.h index b309ff37ce..a98b487a66 100644 --- a/nuttx/include/nuttx/serial/tioctl.h +++ b/nuttx/include/nuttx/serial/tioctl.h @@ -1,7 +1,7 @@ /******************************************************************************************** * include/nuttx/serial/tioctl.h * - * Copyright (C) 2011-2012 Gregory Nutt. All rights reserved. + * Copyright (C) 2011-2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -165,16 +165,23 @@ #define TIOCSRS485 _TIOC(0x002a) /* Set RS485 mode, arg: pointer to struct serial_rs485 */ #define TIOCGRS485 _TIOC(0x002b) /* Get RS485 mode, arg: pointer to struct serial_rs485 */ +/* Definitions for flags used in struct serial_rs485 (Linux compatible) */ + +# define SER_RS485_ENABLED (1 << 0) /* Enable/disble RS-485 support */ +# define SER_RS485_RTS_ON_SEND (1 << 1) /* Logic level for RTS pin when sending */ +# define SER_RS485_RTS_AFTER_SEND (1 << 2) /* Logic level for RTS pin after sent */ +# define SER_RS485_RX_DURING_TX (1 << 4) + +/* Single-wire UART support */ + +#define TIOCSSINGLEWIRE _TIOC(0x002c) /* Set single-wire mode */ +#define TIOCGSINGLEWIRE _TIOC(0x002d) /* Get single-wire mode */ + +# define SER_SINGLEWIRE_ENABLED (1 << 0) /* Enable/disable single-wire support */ + /* Debugging */ -#define TIOCSERGSTRUCT _TIOC(0x002c) /* Get device TTY structure */ - -/* Definitions used in struct serial_rs485 (Linux compatible) */ - -#define SER_RS485_ENABLED (1 << 0) /* Enable/disble RS-485 support */ -#define SER_RS485_RTS_ON_SEND (1 << 1) /* Logic level for RTS pin when sending */ -#define SER_RS485_RTS_AFTER_SEND (1 << 2) /* Logic level for RTS pin after sent */ -#define SER_RS485_RX_DURING_TX (1 << 4) +#define TIOCSERGSTRUCT _TIOC(0x002e) /* Get device TTY structure */ /******************************************************************************************** * Public Type Definitions From efd4250e84980453276f167e6d0ed5f594a37c76 Mon Sep 17 00:00:00 2001 From: Marco Bauer Date: Wed, 23 Jan 2013 15:38:38 +0100 Subject: [PATCH 113/118] timing changed and amber for manual added --- apps/drivers/blinkm/blinkm.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/apps/drivers/blinkm/blinkm.cpp b/apps/drivers/blinkm/blinkm.cpp index 2ff59d5f3f..bc5c74de1f 100644 --- a/apps/drivers/blinkm/blinkm.cpp +++ b/apps/drivers/blinkm/blinkm.cpp @@ -57,7 +57,7 @@ * System armed: * One message is made of 4 Blinks and a pause in the same length as the 4 blinks. * - * X-X-X-X-_-_-_-_- + * X-X-X-X-_-_-_-_-_-_- * ------------------------- * G G G M * P P P O @@ -67,26 +67,26 @@ * (X = on, _=off) * * The first 3 blinks indicates the status of the GPS-Signal (red): - * 0-4 satellites = X-X-X-X-_-_-_-_- - * 5 satellites = X-X-_-X-_-_-_-_- - * 6 satellites = X-_-_-X-_-_-_-_- - * >=7 satellites = _-_-_-X-_-_-_-_- + * 0-4 satellites = X-X-X-X-_-_-_-_-_-_- + * 5 satellites = X-X-_-X-_-_-_-_-_-_- + * 6 satellites = X-_-_-X-_-_-_-_-_-_- + * >=7 satellites = _-_-_-X-_-_-_-_-_-_- * If no GPS is found the first 3 blinks are white * * The fourth Blink indicates the Flightmode: - * MANUAL : off + * MANUAL : amber * STABILIZED : yellow * HOLD : blue * AUTO : green * * Battery Warning (low Battery Level): - * Continuously blinking in yellow X-X-X-X-X-X-X-X + * Continuously blinking in yellow X-X-X-X-X-X-X-X-X-X * * Battery Alert (critical Battery Level) - * Continuously blinking in red X-X-X-X-X-X-X-X + * Continuously blinking in red X-X-X-X-X-X-X-X-X-X * * General Error (no uOrb Data) - * Continuously blinking in white X-X-X-X-X-X-X-X + * Continuously blinking in white X-X-X-X-X-X-X-X-X-X * */ From 340a72b7cdfb3c1c79044f53decc055ee6c06f19 Mon Sep 17 00:00:00 2001 From: patacongo Date: Wed, 23 Jan 2013 22:23:46 +0000 Subject: [PATCH 114/118] Add logic to retain child task exit status if so configured git-svn-id: http://svn.code.sf.net/p/nuttx/code/trunk@5553 42af7a65-404d-4744-a932-0658087f49c3 --- nuttx/ChangeLog | 6 +- nuttx/Documentation/NuttxPortingGuide.html | 66 ++++++++- nuttx/Documentation/NuttxUserGuide.html | 128 ++++++++++++++-- nuttx/arch/arm/src/stm32/Kconfig | 2 +- nuttx/configs/README.txt | 71 ++++++++- nuttx/configs/sim/ostest/defconfig | 11 +- nuttx/include/nuttx/sched.h | 3 +- nuttx/include/signal.h | 12 +- nuttx/include/sys/types.h | 4 +- nuttx/sched/Kconfig | 79 +++++++++- nuttx/sched/os_internal.h | 7 +- nuttx/sched/os_start.c | 2 +- nuttx/sched/pthread_create.c | 11 +- nuttx/sched/sched_waitid.c | 75 ++++++++++ nuttx/sched/sched_waitpid.c | 62 +++++++- nuttx/sched/sig_action.c | 163 +++++++++++++-------- nuttx/sched/task_childstatus.c | 125 ++++++++++------ nuttx/sched/task_create.c | 16 +- nuttx/sched/task_exithook.c | 123 ++++++++++------ nuttx/sched/task_init.c | 3 +- nuttx/sched/task_reparent.c | 23 ++- nuttx/sched/task_setup.c | 68 ++++++++- nuttx/sched/task_vfork.c | 9 +- 23 files changed, 846 insertions(+), 223 deletions(-) diff --git a/nuttx/ChangeLog b/nuttx/ChangeLog index 6c176c6018..38b1b6b1f3 100644 --- a/nuttx/ChangeLog +++ b/nuttx/ChangeLog @@ -4002,7 +4002,7 @@ Start of support of LCD1602 alphanumeric LCD. I need a few more parts before I can finish integrating this one. * arch/arm/src/*/chip.h and arch/arm/include/*/chip.h: Move all - priority ragnes from the src to the include chip.h header file. + priority ranges from the src to the include chip.h header file. * arch/arm/include/armv7-m/irq.h: Add inline functions to enable and disable interrupts via the BASEPRI register. * arch/arm/Kconfig: Add new option CONFIG_ARM7VM_USEBASEI @@ -4012,4 +4012,8 @@ while CONFIG_ARM7VM_USEBASEPRI=y. * arch/arm/src/stm32/stm32_serial.c: Add support for USART single wire more (Contributed by the PX4 team). + * sched/: Implement support for retaining child task status after + the child task exists. This is behavior required by POSIX. + But in NuttX is only enabled with CONFIG_SCHED_HAVE_PARENT and + CONFIG_SCHED_CHILD_STATUS diff --git a/nuttx/Documentation/NuttxPortingGuide.html b/nuttx/Documentation/NuttxPortingGuide.html index fec7106b00..fd358f4231 100644 --- a/nuttx/Documentation/NuttxPortingGuide.html +++ b/nuttx/Documentation/NuttxPortingGuide.html @@ -12,7 +12,7 @@

          NuttX RTOS Porting Guide

          -

          Last Updated: January 13, 2013

          +

          Last Updated: January 23, 2013

          @@ -4481,11 +4481,73 @@ build instrumentation is selected. Set to zero to disable.
        • - CONFIG_SCHED_HAVE_PARENT: Remember the ID of the parent thread when a new child thread is created. + CONFIG_SCHED_HAVE_PARENT: Remember the ID of the parent thread when a new child task is created. This support enables some additional features (such as SIGCHLD) and modifies the behavior of other interfaces. For example, it makes waitpid() more standards complete by restricting the waited-for tasks to the children of the caller. Default: disabled.
        • +
        • + CONFIG_SCHED_CHILD_STATUS: If this option is selected, then the exit status of the child task will be retained after the child task exits. + This option should be selected if you require knowledge of a child process' exit status. + Without this setting, wait(), waitpid() or waitid() may fail. + For example, if you do: +

            +
          1. + Start child task +
          2. +
          3. + Wait for exit status (using wait(), waitpid() or waitid()). +
          4. +

          +

          + This can fail because the child task may run to completion before the wait begins. + There is a non-standard work-around in this case: + The above sequence will work if you disable pre-emption using sched_lock() prior to starting the child task, then re-enable pre-emption with sched_unlock() after the wait completes. + This works because the child task is not permitted to run until the wait is in place. +

          +

          + The standard solution would be to enable CONFIG_SCHED_CHILD_STATUS. + In this case the exit status of the child task is retained after the child exits and the wait will successful obtain the child task's exit status whether it is called before the child task exits or not. +

          +

          + Warning: + If you enable this feature, then your application must either (1) take responsibility for reaping the child status with wait(), waitpid() or waitid(), or (2) suppress retention of child status. + If you do not reap the child status, then you have a memory leak and your system will eventually fail. +

          + Retention of child status can be suppressed on the parent using logic like: +

          +
            +struct sigaction sa;
            +
            +sa.sa_handler = SIG_IGN;
            +sa.sa_flags = SA_NOCLDWAIT;
            +int ret = sigaction(SIGCHLD, &sa, NULL);
            +
          +
        • +
        • + CONFIG_PREALLOC_CHILDSTATUS: To prevent runaway child status allocations and to improve + allocation performance, child task exit status structures are pre-allocated when the system boots. + This setting determines the number of child status structures that will be pre-allocated. + If this setting is not defined or if it is defined to be zero then a value of 2*MAX_TASKS is used. +

          + Note that there cannot be more that CONFIG_MAX_TASKS tasks in total. + However, the number of child status structures may need to be significantly larger because this number includes the maximum number of tasks that are running PLUS the number of tasks that have exit'ed without having their exit status reaped (via wait(), waitpid() or waitid()). +

          +

          + Obviously, if tasks spawn children indefinitely and never have the exit status reaped, then you may have a memory leak! + If you enable the SCHED_CHILD_STATUS feature, then your application must take responsibility for either (1) reaping the child status with wait(), waitpid() or waitid() or it must (2) suppress retention of child status. Otherwise, your system will eventually fail. +

          +

          + Retention of child status can be suppressed on the parent using logic like: +

          +
            +struct sigaction sa;
            +
            +sa.sa_handler = SIG_IGN;
            +sa.sa_flags = SA_NOCLDWAIT;
            +int ret = sigaction(SIGCHLD, &sa, NULL);
            +
          +
        • CONFIG_SYSTEM_TIME16: The range of system time is, by default, 32-bits. diff --git a/nuttx/Documentation/NuttxUserGuide.html b/nuttx/Documentation/NuttxUserGuide.html index 3cfb63f11e..10e5eb7ba4 100644 --- a/nuttx/Documentation/NuttxUserGuide.html +++ b/nuttx/Documentation/NuttxUserGuide.html @@ -13,7 +13,7 @@

          NuttX Operating System

          User's Manual

          by

          Gregory Nutt

          -

          Last Updated: January 13, 2013

          +

          Last Updated: January 23, 2013

          @@ -1767,20 +1767,114 @@ priority of the calling task is returned. -

          Scheduler locking interfaces

          +

          + Task Control Interfaces. +

          -

          Task synchronization interfaces

          + +

          + Parent and Child Tasks. + The task synchronization interfaces historically depend upon parent and child relationships between tasks. + But default, NuttX does not use any parent/child knowledge. + However, there are three important configuration options that can change that. +

            -
          • 2.3.4 waitpid
          • -
          • 2.3.5 waitid
          • -
          • 2.3.6 wait
          • -
          • 2.3.7 atexit
          • -
          • 2.3.8 on_exit
          • +
          • +

            + CONFIG_SCHED_HAVE_PARENT. + If this setting is defined, then it instructs NuttX to remember the task ID of the parent task when each new child task is created. + This support enables some additional features (such as SIGCHLD) and modifies the behavior of other interfaces. + For example, it makes waitpid() more standards complete by restricting the waited-for tasks to the children of the caller. +

            +
          • +
          • +

            + CONFIG_SCHED_CHILD_STATUS + If this option is selected, then the exit status of the child task will be retained after the child task exits. + This option should be selected if you require knowledge of a child process' exit status. + Without this setting, wait(), waitpid() or waitid() may fail. + For example, if you do: +

            +
              +
            1. + Start child task +
            2. +
            3. + Wait for exit status (using wait(), waitpid() or waitid()). +
            4. +
            +

            + This may fail because the child task may run to completion before the wait begins. + There is a non-standard work-around in this case: + The above sequence will work if you disable pre-emption using sched_lock() prior to starting the child task, then re-enable pre-emption with sched_unlock() after the wait completes. + This works because the child task is not permitted to run until the wait is in place. +

            +

            + The standard solution would be to enable CONFIG_SCHED_CHILD_STATUS. + In this case the exit status of the child task is retained after the child exits and the wait will successful obtain the child task's exit status whether it is called before the child task exits or not. +

            +
          • +
          • +

            + CONFIG_PREALLOC_CHILDSTATUS. + To prevent runaway child status allocations and to improve allocation performance, child task exit status structures are pre-allocated when the system boots. + This setting determines the number of child status structures that will be pre-allocated. + If this setting is not defined or if it is defined to be zero then a value of 2*MAX_TASKS is used. +

            +

            + Note that there cannot be more that CONFIG_MAX_TASKS tasks in total. + However, the number of child status structures may need to be significantly larger because this number includes the maximum number of tasks that are running PLUS the number of tasks that have exit'ed without having their exit status reaped (via wait(), waitpid() or waitid()). +

            +

            + Obviously, if tasks spawn children indefinitely and never have the exit status reaped, then you may have a memory leak! + (See Warning below) +

            +
          +

          + Warning: + If you enable the CONFIG_SCHED_CHILD_STATUS feature, then your application must either (1) take responsibility for reaping the child status with wait(), waitpid() or waitid(), or (2) suppress retention of child status. + If you do not reap the child status, then you have a memory leak and your system will eventually fail. +

          + Retention of child status can be suppressed on the parent using logic like: +

          +
            +struct sigaction sa;
            +
            +sa.sa_handler = SIG_IGN;
            +sa.sa_flags = SA_NOCLDWAIT;
            +int ret = sigaction(SIGCHLD, &sa, NULL);
            +

          2.3.1 sched_lock

          @@ -4589,10 +4683,14 @@ sigaction(). interface of the same name. Differences from the POSIX implementation include:
            -
          • Special values of sa_handler in the struct sigaction act input -not handled (SIG_DFL, SIG_IGN). -
          • All sa_flags in struct sigaction of act input are ignored -(all treated like SA_SIGINFO). +
          • + There are no default actions so the special value SIG_DFL is treated like SIG_IGN. +
          • +
          • + All sa_flags in struct sigaction of act input are ignored (all treated like SA_SIGINFO). + The one exception is if CONFIG_SCHED_CHILDSTATUS is defined; + then SA_NOCLDWAIT is supported but only for SIGCHLD. +

          2.8.7 sigprocmask

          diff --git a/nuttx/arch/arm/src/stm32/Kconfig b/nuttx/arch/arm/src/stm32/Kconfig index 85cdebd35f..41724be2d4 100644 --- a/nuttx/arch/arm/src/stm32/Kconfig +++ b/nuttx/arch/arm/src/stm32/Kconfig @@ -1810,7 +1810,7 @@ config STM32_TIM14_DAC2 endchoice -bool STM32_USART +config STM32_USART bool menu "U[S]ART Configuration" diff --git a/nuttx/configs/README.txt b/nuttx/configs/README.txt index babdf7330e..1b78567a3d 100644 --- a/nuttx/configs/README.txt +++ b/nuttx/configs/README.txt @@ -334,12 +334,79 @@ defconfig -- This is a configuration file similar to the Linux CONFIG_TASK_NAME_SIZE - Specifies that maximum size of a task name to save in the TCB. Useful if scheduler instrumentation is selected. Set to zero to disable. - CONFIG_SCHED_HAVE_PARENT - Remember the ID of the parent thread - when a new child thread is created. This support enables some + CONFIG_SCHED_HAVE_PARENT - Remember the ID of the parent task + when a new child task is created. This support enables some additional features (such as SIGCHLD) and modifies the behavior of other interfaces. For example, it makes waitpid() more standards complete by restricting the waited-for tasks to the children of the caller. Default: disabled. + CONFIG_SCHED_CHILD_STATUS + If this option is selected, then the exit status of the child task + will be retained after the child task exits. This option should be + selected if you require knowledge of a child process' exit status. + Without this setting, wait(), waitpid() or waitid() may fail. For + example, if you do: + + 1) Start child task + 2) Wait for exit status (using wait(), waitpid(), or waitid()). + + This can fail because the child task may run to completion before + the wait begins. There is a non-standard work-around in this case: + The above sequence will work if you disable pre-emption using + sched_lock() prior to starting the child task, then re-enable pre- + emption with sched_unlock() after the wait completes. This works + because the child task is not permitted to run until the wait is in + place. + + The standard solution would be to enable CONFIG_SCHED_CHILD_STATUS. In + this case the exit status of the child task is retained after the + child exits and the wait will successful obtain the child task's + exit status whether it is called before the child task exits or not. + + Warning: If you enable this feature, then your application must + either (1) take responsibility for reaping the child status with wait(), + waitpid(), or waitid(), or (2) suppress retention of child status. + If you do not reap the child status, then you have a memory leak and + your system will eventually fail. + + Retention of child status can be suppressed on the parent using logic like: + + struct sigaction sa; + + sa.sa_handler = SIG_IGN; + sa.sa_flags = SA_NOCLDWAIT; + int ret = sigaction(SIGCHLD, &sa, NULL); + + CONFIG_PREALLOC_CHILDSTATUS + To prevent runaway child status allocations and to improve + allocation performance, child task exit status structures are pre- + allocated when the system boots. This setting determines the number + of child status structures that will be pre-allocated. If this + setting is not defined or if it is defined to be zero then a value + of 2*MAX_TASKS is used. + + Note that there cannot be more that CONFIG_MAX_TASKS tasks in total. + However, the number of child status structures may need to be + significantly larger because this number includes the maximum number + of tasks that are running PLUS the number of tasks that have exit'ed + without having their exit status reaped (via wait(), waitid(), or + waitpid()). + + Obviously, if tasks spawn children indefinitely and never have the + exit status reaped, then you may have a memory leak! If you enable + the SCHED_CHILD_STATUS feature, then your application must take + responsibility for either (1) reaping the child status with wait(), + waitpid(), or waitid() or it must (2) suppress retention of child + status. Otherwise, your system will eventually fail. + + Retention of child status can be suppressed on the parent using logic like: + + struct sigaction sa; + + sa.sa_handler = SIG_IGN; + sa.sa_flags = SA_NOCLDWAIT; + int ret = sigaction(SIGCHLD, &sa, NULL); + CONFIG_START_YEAR, CONFIG_START_MONTH, CONFIG_START_DAY - Used to initialize the internal time logic. CONFIG_GREGORIAN_TIME - Enables Gregorian time conversions. diff --git a/nuttx/configs/sim/ostest/defconfig b/nuttx/configs/sim/ostest/defconfig index c8d5c501d7..65f5330fcd 100644 --- a/nuttx/configs/sim/ostest/defconfig +++ b/nuttx/configs/sim/ostest/defconfig @@ -82,10 +82,15 @@ CONFIG_BOARD_LOOPSPERMSEC=100 # CONFIG_SIM_M32 is not set # CONFIG_SIM_WALLTIME is not set +# +# External Memory Configuration +# + # # Architecture Options # # CONFIG_ARCH_NOINTC is not set +# CONFIG_ARCH_VECNOTIRQ is not set # CONFIG_ARCH_DMA is not set # CONFIG_ARCH_IRQPRIO is not set # CONFIG_CUSTOM_STACK is not set @@ -93,6 +98,7 @@ CONFIG_BOARD_LOOPSPERMSEC=100 # CONFIG_ARCH_HAVE_VFORK is not set # CONFIG_ARCH_STACKDUMP is not set # CONFIG_ENDIAN_BIG is not set +# CONFIG_ARCH_HAVE_RAMFUNCS is not set # # Board Settings @@ -132,6 +138,7 @@ CONFIG_RR_INTERVAL=0 # CONFIG_SCHED_INSTRUMENTATION is not set CONFIG_TASK_NAME_SIZE=32 CONFIG_SCHED_HAVE_PARENT=y +# CONFIG_SCHED_CHILD_STATUS is not set # CONFIG_JULIAN_TIME is not set CONFIG_START_YEAR=2007 CONFIG_START_MONTH=2 @@ -242,8 +249,8 @@ CONFIG_SERIAL=y # # File system configuration # -# CONFIG_FS_FAT is not set # CONFIG_FS_RAMMAP is not set +# CONFIG_FS_FAT is not set # CONFIG_FS_NXFFS is not set # CONFIG_FS_ROMFS is not set @@ -271,6 +278,7 @@ CONFIG_MM_REGIONS=1 # CONFIG_BINFMT_EXEPATH is not set # CONFIG_NXFLAT is not set # CONFIG_ELF is not set +# CONFIG_BUILTIN is not set # CONFIG_PIC is not set # CONFIG_SYMTAB_ORDEREDBYNAME is not set @@ -318,7 +326,6 @@ CONFIG_LIB_SENDFILE_BUFSIZE=512 # # Built-In Applications # -# CONFIG_BUILTIN is not set # # Examples diff --git a/nuttx/include/nuttx/sched.h b/nuttx/include/nuttx/sched.h index 9ab96b7d21..1e75b5020f 100644 --- a/nuttx/include/nuttx/sched.h +++ b/nuttx/include/nuttx/sched.h @@ -74,6 +74,7 @@ #define TCB_FLAG_NONCANCELABLE (1 << 2) /* Bit 2: Pthread is non-cancelable */ #define TCB_FLAG_CANCEL_PENDING (1 << 3) /* Bit 3: Pthread cancel is pending */ #define TCB_FLAG_ROUND_ROBIN (1 << 4) /* Bit 4: Round robin sched enabled */ +#define TCB_FLAG_NOCLDWAIT (1 << 5) /* Bit 5: Do not retain child exit status */ /* Values for struct child_status_s ch_flags */ @@ -183,7 +184,7 @@ struct child_status_s FAR struct child_status_s *flink; uint8_t ch_flags; /* Child status: See CHILD_FLAG_* definitions */ - pid_y ch_pid; /* Child task ID */ + pid_t ch_pid; /* Child task ID */ int ch_status; /* Child exit status */ }; #endif diff --git a/nuttx/include/signal.h b/nuttx/include/signal.h index 7c6b4cd553..a021702426 100644 --- a/nuttx/include/signal.h +++ b/nuttx/include/signal.h @@ -129,11 +129,13 @@ /* struct sigaction flag values */ -#define SA_NOCLDSTOP 1 /* Do not generate SIGCHILD when - * children stop (ignored) */ -#define SA_SIGINFO 2 /* Invoke the signal-catching function - * with 3 args instead of 1 - * (always assumed) */ +#define SA_NOCLDSTOP (1 << 0) /* Do not generate SIGCHILD when + * children stop (ignored) */ +#define SA_SIGINFO (1 << 1) /* Invoke the signal-catching function + * with 3 args instead of 1 + * (always assumed) */ +#define SA_NOCLDWAIT (1 << 2) /* If signo=SIGCHLD, exit status of child + * processes will be discarded */ /* These are the possible values of the signfo si_code field */ diff --git a/nuttx/include/sys/types.h b/nuttx/include/sys/types.h index 95feee72ef..38f091e8ae 100644 --- a/nuttx/include/sys/types.h +++ b/nuttx/include/sys/types.h @@ -158,13 +158,13 @@ typedef uint16_t ino_t; * negative PID values are used to represent invalid PIDs. */ -typedef int pid_t; +typedef int16_t pid_t; /* id_t is a general identifier that can be used to contain at least a pid_t, * uid_t, or gid_t. */ -typedef unsigned int id_t; +typedef int16_t id_t; /* Signed integral type of the result of subtracting two pointers */ diff --git a/nuttx/sched/Kconfig b/nuttx/sched/Kconfig index 11d74b5831..fe9a880857 100644 --- a/nuttx/sched/Kconfig +++ b/nuttx/sched/Kconfig @@ -42,13 +42,88 @@ config SCHED_HAVE_PARENT bool "Support parent/child task relationships" default n ---help--- - Remember the ID of the parent thread when a new child thread is + Remember the ID of the parent task when a new child task is created. This support enables some additional features (such as SIGCHLD) and modifies the behavior of other interfaces. For example, it makes waitpid() more standards complete by restricting the waited-for tasks to the children of the caller. Default: disabled. +config SCHED_CHILD_STATUS + bool "Retain child exit status" + default n + depends on SCHED_HAVE_PARENT + ---help--- + If this option is selected, then the exit status of the child task + will be retained after the child task exits. This option should be + selected if you require knowledge of a child process' exit status. + Without this setting, wait(), waitpid() or waitid() may fail. For + example, if you do: + + 1) Start child task + 2) Wait for exit status (using wait(), waitpid(), or waitid()). + + This can fail because the child task may run to completion before + the wait begins. There is a non-standard work-around in this case: + The above sequence will work if you disable pre-emption using + sched_lock() prior to starting the child task, then re-enable pre- + emption with sched_unlock() after the wait completes. This works + because the child task is not permitted to run until the wait is in + place. + + The standard solution would be to enable SCHED_CHILD_STATUS. In + this case the exit status of the child task is retained after the + child exits and the wait will successful obtain the child task's + exit status whether it is called before the child task exits or not. + + Warning: If you enable this feature, then your application must + either (1) take responsibility for reaping the child status with wait(), + waitpid(), or waitid(), or (2) suppress retention of child status. + If you do not reap the child status, then you have a memory leak and + your system will eventually fail. + + Retention of child status can be suppressed on the parent using logic like: + + struct sigaction sa; + + sa.sa_handler = SIG_IGN; + sa.sa_flags = SA_NOCLDWAIT; + int ret = sigaction(SIGCHLD, &sa, NULL); + +config PREALLOC_CHILDSTATUS + int "Number of pre-allocated child status" + default 0 + depends on SCHED_CHILD_STATUS + ---help--- + To prevent runaway child status allocations and to improve + allocation performance, child task exit status structures are pre- + allocated when the system boots. This setting determines the number + of child status structures that will be pre-allocated. If this + setting is not defined or if it is defined to be zero then a value + of 2*MAX_TASKS is used. + + Note that there cannot be more that CONFIG_MAX_TASKS tasks in total. + However, the number of child status structures may need to be + significantly larger because this number includes the maximum number + of tasks that are running PLUS the number of tasks that have exit'ed + without having their exit status reaped (via wait(), waitid(), or + waitpid()). + + Obviously, if tasks spawn children indefinitely and never have the + exit status reaped, then you may have a memory leak! If you enable + the SCHED_CHILD_STATUS feature, then your application must take + responsibility for either (1) reaping the child status with wait(), + waitpid(), or waitid() or it must (2) suppress retention of child + status. Otherwise, your system will eventually fail. + + Retention of child status can be suppressed on the parent using logic like: + + struct sigaction sa; + + sa.sa_handler = SIG_IGN; + sa.sa_flags = SA_NOCLDWAIT; + int ret = sigaction(SIGCHLD, &sa, NULL); + config JULIAN_TIME bool "Enables Julian time conversions" default n @@ -88,7 +163,7 @@ config PRIORITY_INHERITANCE Set to enable support for priority inheritance on mutexes and semaphores. config SEM_PREALLOCHOLDERS - int "Pre-allocated holders" + int "Number of pre-allocated holders" default 16 depends on PRIORITY_INHERITANCE ---help--- diff --git a/nuttx/sched/os_internal.h b/nuttx/sched/os_internal.h index b048f00a81..7d5095bad4 100644 --- a/nuttx/sched/os_internal.h +++ b/nuttx/sched/os_internal.h @@ -264,17 +264,16 @@ extern const tasklist_t g_tasklisttable[NUM_TASK_STATES]; int os_bringup(void); void task_start(void); int task_schedsetup(FAR _TCB *tcb, int priority, start_t start, - main_t main); + main_t main, uint8_t ttype); int task_argsetup(FAR _TCB *tcb, FAR const char *name, FAR const char *argv[]); void task_exithook(FAR _TCB *tcb, int status); int task_deletecurrent(void); #ifdef CONFIG_SCHED_HAVE_PARENT #ifdef CONFIG_SCHED_CHILD_STATUS -void weak_functiontask_initialize(void); +void weak_function task_initialize(void); FAR struct child_status_s *task_allocchild(void); void task_freechild(FAR struct child_status_s *status); -FAR struct child_status_s *task_addchild(FAR _TCB *tcb, pid_t pid, int status, - uint8_t flags); +void task_addchild(FAR _TCB *tcb, FAR struct child_status_s *child); FAR struct child_status_s *task_findchild(FAR _TCB *tcb, pid_t pid); FAR struct child_status_s *task_removechild(FAR _TCB *tcb, pid_t pid); void task_removechildren(FAR _TCB *tcb); diff --git a/nuttx/sched/os_start.c b/nuttx/sched/os_start.c index cb6a2c8692..a6d4e83b92 100644 --- a/nuttx/sched/os_start.c +++ b/nuttx/sched/os_start.c @@ -286,7 +286,7 @@ void os_start(void) /* Initialize the processor-specific portion of the TCB */ - g_idletcb.flags = TCB_FLAG_TTYPE_KERNEL; + g_idletcb.flags = (TCB_FLAG_TTYPE_KERNEL | TCB_FLAG_NOCLDWAIT); up_initial_state(&g_idletcb); /* Initialize the semaphore facility(if in link). This has to be done diff --git a/nuttx/sched/pthread_create.c b/nuttx/sched/pthread_create.c index dc2db29168..f4d0d8fdf7 100644 --- a/nuttx/sched/pthread_create.c +++ b/nuttx/sched/pthread_create.c @@ -1,7 +1,7 @@ /**************************************************************************** * sched/pthread_create.c * - * Copyright (C) 2007-2009, 2011 Gregory Nutt. All rights reserved. + * Copyright (C) 2007-2009, 2011, 2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -354,15 +354,10 @@ int pthread_create(FAR pthread_t *thread, FAR pthread_attr_t *attr, #endif } - /* Mark this task as a pthread (this setting will be needed in - * task_schedsetup() when up_initial_state() is called. - */ - - ptcb->flags |= TCB_FLAG_TTYPE_PTHREAD; - /* Initialize the task control block */ - ret = task_schedsetup(ptcb, priority, pthread_start, (main_t)start_routine); + ret = task_schedsetup(ptcb, priority, pthread_start, (main_t)start_routine, + TCB_FLAG_TTYPE_PTHREAD); if (ret != OK) { sched_releasetcb(ptcb); diff --git a/nuttx/sched/sched_waitid.c b/nuttx/sched/sched_waitid.c index a3f7221df5..37ee26ce0b 100644 --- a/nuttx/sched/sched_waitid.c +++ b/nuttx/sched/sched_waitid.c @@ -159,8 +159,29 @@ int waitid(idtype_t idtype, id_t id, siginfo_t *info, int options) * TCB is actually a child of this task. */ +#ifdef CONFIG_SCHED_CHILD_STATUS + if (rtcb->children == NULL) + { + /* There are no children */ + + err = ECHILD; + goto errout_with_errno; + } + else if (idtype == P_PID) + { + if (task_findchild(rtcb, (pid_t)id) == NULL) + { + /* This specific pid is not a child */ + + err = ECHILD; + goto errout_with_errno; + } + } +#else if (rtcb->nchildren == 0) { + /* There are no children */ + err = ECHILD; goto errout_with_errno; } @@ -175,11 +196,64 @@ int waitid(idtype_t idtype, id_t id, siginfo_t *info, int options) goto errout_with_errno; } } +#endif /* Loop until the child that we are waiting for dies */ for (;;) { +#ifdef CONFIG_SCHED_CHILD_STATUS + /* Check if the task has already died. Signals are not queued in + * NuttX. So a possibility is that the child has died and we + * missed the death of child signal (we got some other signal + * instead). + */ + + DEBUGASSERT(rtcb->children); + if (rtcb->children == NULL) + { + /* This should not happen. I am just wasting your FLASH. */ + + err = ECHILD; + goto errout_with_errno; + } + else if (idtype == P_PID) + { + FAR struct child_status_s *child; + + /* We are waiting for a specific PID. Get the current status + * of the child task. + */ + + child = task_findchild(rtcb, (pid_t)id); + DEBUGASSERT(child); + if (!child) + { + /* Yikes! The child status entry just disappeared! */ + + err = ECHILD; + goto errout_with_errno; + } + + /* Did the child exit? */ + + if ((child->ch_flags & CHILD_FLAG_EXITED) != 0) + { + /* The child has exited. Return the saved exit status */ + + info->si_signo = SIGCHLD; + info->si_code = CLD_EXITED; + info->si_value.sival_ptr = NULL; + info->si_pid = (pid_t)id; + info->si_status = child->ch_status; + + /* Discard the child entry and break out of the loop */ + + (void)task_removechild(rtcb, (pid_t)id); + task_freechild(child); + } + } +#else /* Check if the task has already died. Signals are not queued in * NuttX. So a possibility is that the child has died and we * missed the death of child signal (we got some other signal @@ -197,6 +271,7 @@ int waitid(idtype_t idtype, id_t id, siginfo_t *info, int options) err = EINTR; goto errout_with_errno; } +#endif /* Wait for any death-of-child signal */ diff --git a/nuttx/sched/sched_waitpid.c b/nuttx/sched/sched_waitpid.c index dc715b2e92..fe3f7167dc 100644 --- a/nuttx/sched/sched_waitpid.c +++ b/nuttx/sched/sched_waitpid.c @@ -274,6 +274,9 @@ errout: pid_t waitpid(pid_t pid, int *stat_loc, int options) { FAR _TCB *rtcb = (FAR _TCB *)g_readytorun.head; +#ifdef CONFIG_SCHED_CHILD_STATUS + FAR struct child_status_s *child; +#endif FAR struct siginfo info; sigset_t sigset; int err; @@ -300,12 +303,33 @@ pid_t waitpid(pid_t pid, int *stat_loc, int options) sched_lock(); - /* Verify that this task actually has children and that the the requeste + /* Verify that this task actually has children and that the the request * TCB is actually a child of this task. */ +#ifdef CONFIG_SCHED_CHILD_STATUS + if (rtcb->children == NULL) + { + /* There are no children */ + + err = ECHILD; + goto errout_with_errno; + } + else if (pid != (pid_t)-1) + { + /* This specific pid is not a child */ + + if (task_findchild(rtcb, pid) == NULL) + { + err = ECHILD; + goto errout_with_errno; + } + } +#else if (rtcb->nchildren == 0) { + /* There are no children */ + err = ECHILD; goto errout_with_errno; } @@ -320,6 +344,7 @@ pid_t waitpid(pid_t pid, int *stat_loc, int options) goto errout_with_errno; } } +#endif /* Loop until the child that we are waiting for dies */ @@ -337,7 +362,12 @@ pid_t waitpid(pid_t pid, int *stat_loc, int options) * chilren. */ +#ifdef CONFIG_SCHED_CHILD_STATUS + DEBUGASSERT(rtcb->children); + if (rtcb->children == NULL) +#else if (rtcb->nchildren == 0) +#endif { /* There were one or more children when we started so they * must have exit'ed. There are just no bread crumbs left @@ -351,6 +381,35 @@ pid_t waitpid(pid_t pid, int *stat_loc, int options) } else { +#ifdef CONFIG_SCHED_CHILD_STATUS + /* We are waiting for a specific PID. Get the current status + * of the child task. + */ + + child = task_findchild(rtcb, pid); + DEBUGASSERT(child); + if (!child) + { + /* Yikes! The child status entry just disappeared! */ + + err = ECHILD; + goto errout_with_errno; + } + + /* Did the child exit? */ + + if ((child->ch_flags & CHILD_FLAG_EXITED) != 0) + { + /* The child has exited. Return the saved exit status */ + + *stat_loc = child->ch_status; + + /* Discard the child entry and break out of the loop */ + + (void)task_removechild(rtcb, pid); + task_freechild(child); + } +#else /* We are waiting for a specific PID. We can use kill() with * signal number 0 to determine if that task is still alive. */ @@ -368,6 +427,7 @@ pid_t waitpid(pid_t pid, int *stat_loc, int options) err = ECHILD; goto errout_with_errno; } +#endif } /* Wait for any death-of-child signal */ diff --git a/nuttx/sched/sig_action.c b/nuttx/sched/sig_action.c index fef5f15586..7086679939 100644 --- a/nuttx/sched/sig_action.c +++ b/nuttx/sched/sig_action.c @@ -1,7 +1,7 @@ /**************************************************************************** * sched/sig_action.c * - * Copyright (C) 2007-2009 Gregory Nutt. All rights reserved. + * Copyright (C) 2007-2009, 2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -43,6 +43,7 @@ #include #include #include +#include #include "os_internal.h" #include "sig_internal.h" @@ -156,10 +157,11 @@ static FAR sigactq_t *sig_allocateaction(void) * Assumptions: * * POSIX Compatibility: - * - Special values of sa_handler in the struct sigaction - * act input not handled (SIG_DFL, SIG_IGN). - * - All sa_flags in struct sigaction of act input are - * ignored (all treated like SA_SIGINFO). + * - There are no default actions so the special value SIG_DFL is treated + * like SIG_IGN. + * - All sa_flags in struct sigaction of act input are ignored (all + * treated like SA_SIGINFO). The one exception is if CONFIG_SCHED_CHILDSTATUS + * is defined; then SA_NOCLDWAIT is supported but only for SIGCHLD * ****************************************************************************/ @@ -167,90 +169,129 @@ int sigaction(int signo, FAR const struct sigaction *act, FAR struct sigaction * { FAR _TCB *rtcb = (FAR _TCB*)g_readytorun.head; FAR sigactq_t *sigact; - int ret = ERROR; /* Assume failure */ + int ret; /* Since sigactions can only be installed from the running thread of * execution, no special precautions should be necessary. */ - /* Verify the signal */ + /* Verify the signal number */ - if (GOOD_SIGNO(signo)) + if (!GOOD_SIGNO(signo)) { - ret = OK; /* Assume success */ + set_errno(EINVAL); + return ERROR; + } - /* Find the signal in the sigactionq */ + /* Find the signal in the sigactionq */ - sigact = sig_findaction(rtcb, signo); + sigact = sig_findaction(rtcb, signo); - /* Return the old sigaction value if so requested */ + /* Return the old sigaction value if so requested */ - if (oact) + if (oact) + { + if (sigact) { - if (sigact) - { - COPY_SIGACTION(oact, &sigact->act); - } - else - { - /* There isn't an old value */ - - oact->sa_u._sa_handler = NULL; - oact->sa_mask = NULL_SIGNAL_SET; - oact->sa_flags = 0; - } + COPY_SIGACTION(oact, &sigact->act); } + else + { + /* There isn't an old value */ - /* If no sigaction was found, but one is needed, then - * allocate one. + oact->sa_u._sa_handler = NULL; + oact->sa_mask = NULL_SIGNAL_SET; + oact->sa_flags = 0; + } + } + + /* If the argument act is a null pointer, signal handling is unchanged; + * thus, the call can be used to enquire about the current handling of + * a given signal. + */ + + if (!act) + { + return OK; + } + +#if defined(CONFIG_SCHED_HAVE_PARENT) && defined(CONFIG_SCHED_CHILD_STATUS) + + /* Handle a special case. Retention of child status can be suppressed + * if signo == SIGCHLD and sa_flags == SA_NOCLDWAIT. + * + * POSIX.1 leaves it unspecified whether a SIGCHLD signal is generated + * when a child process terminates. In NuttX, a SIGCHLD signal is + * generated in this case; but in some other implementations, it may not + * be. + */ + + if (signo == SIGCHLD && (act->sa_flags & SA_NOCLDWAIT) != 0) + { + irqstate_t flags; + + /* We do require a critical section to muck with the TCB values that + * can be modified by the child thread. */ - if (!sigact && act && act->sa_u._sa_handler) + flags = irqsave(); + + /* Mark that status should be not be retained */ + + rtcb->flags |= TCB_FLAG_NOCLDWAIT; + + /* Free all pending exit status */ + + task_removechildren(rtcb); + irqrestore(flags); + } +#endif + + /* Handle the case where no sigaction is supplied (SIG_IGN) */ + + if (act->sa_u._sa_handler == SIG_IGN) + { + /* If there is a old sigaction, remove it from sigactionq */ + + sq_rem((FAR sq_entry_t*)sigact, &rtcb->sigactionq); + + /* And deallocate it */ + + sig_releaseaction(sigact); + } + + /* A sigaction has been supplied */ + + else + { + /* Check if a sigaction was found */ + + if (!sigact) { + /* No sigaction was found, but one is needed. Allocate one. */ + sigact = sig_allocateaction(); /* An error has occurred if we could not allocate the sigaction */ if (!sigact) - { - ret = ERROR; - } - else - { - /* Put the signal number in the queue entry */ + { + set_errno(ENOMEM); + return ERROR; + } - sigact->signo = (uint8_t)signo; + /* Put the signal number in the queue entry */ - /* Add the new sigaction to sigactionq */ + sigact->signo = (uint8_t)signo; - sq_addlast((FAR sq_entry_t*)sigact, &rtcb->sigactionq); - } + /* Add the new sigaction to sigactionq */ + + sq_addlast((FAR sq_entry_t*)sigact, &rtcb->sigactionq); } - /* Set the new sigaction if so requested */ + /* Set the new sigaction */ - if ((sigact) && (act)) - { - /* Check if it is a request to install a new handler */ - - if (act->sa_u._sa_handler) - { - COPY_SIGACTION(&sigact->act, act); - } - - /* No.. It is a request to remove the old handler */ - - else - { - /* Remove the old sigaction from sigactionq */ - - sq_rem((FAR sq_entry_t*)sigact, &rtcb->sigactionq); - - /* And deallocate it */ - - sig_releaseaction(sigact); - } - } + COPY_SIGACTION(&sigact->act, act); } return ret; diff --git a/nuttx/sched/task_childstatus.c b/nuttx/sched/task_childstatus.c index ab5ace43a1..0f6d36c296 100644 --- a/nuttx/sched/task_childstatus.c +++ b/nuttx/sched/task_childstatus.c @@ -39,24 +39,44 @@ #include +#include #include +#include #include "os_internal.h" #if defined(CONFIG_SCHED_HAVE_PARENT) && defined(CONFIG_SCHED_CHILD_STATUS) +/***************************************************************************** + * Pre-processor Definitions + *****************************************************************************/ +/* Note that there cannot be more that CONFIG_MAX_TASKS tasks in total. + * However, the number of child status structures may need to be significantly + * larger because this number includes the maximum number of tasks that are + * running PLUS the number of tasks that have exit'ed without having their + * exit status reaped (via wait(), waitid(), or waitpid()). + * + * Obviously, if tasks spawn children indefinitely and never have the exit + * status reaped, then you have a memory leak! + */ + +#if !defined(CONFIG_PREALLOC_CHILDSTATUS) || CONFIG_PREALLOC_CHILDSTATUS == 0 +# undef CONFIG_PREALLOC_CHILDSTATUS +# define CONFIG_PREALLOC_CHILDSTATUS (2*CONFIG_MAX_TASKS) +#endif + +#ifndef CONFIG_DEBUG +# undef CONFIG_DEBUG_CHILDSTATUS +#endif + /***************************************************************************** * Private Types *****************************************************************************/ -/* Globals are maintained in a structure to minimize name collisions. Note - * that there cannot be more that CONFIG_MAX_TASKS tasks in total. So using - * CONFIG_MAX_TASKS should be sufficient (at least one task, the IDLE thread, - * will have no parent). - */ +/* Globals are maintained in a structure to minimize name collisions. */ struct child_pool_s { - struct child_status_s alloc[CONFIG_MAX_TASKS]; + struct child_status_s alloc[CONFIG_PREALLOC_CHILDSTATUS]; FAR struct child_status_s *freelist; }; @@ -70,6 +90,40 @@ static struct child_pool_s g_child_pool; * Private Functions *****************************************************************************/ +/***************************************************************************** + * Name: task_dumpchildren + * + * Description: + * Dump all of the children when the part TCB list is modified. + * + * Parameters: + * tcb - The parent TCB. + * + * Return Value: + * None. + * + * Assumptions: + * Called early in initialization. No special precautions are required. + * + *****************************************************************************/ + +#ifdef CONFIG_DEBUG_CHILDSTATUS +static void task_dumpchildren(FAR _TCB *tcb, FAR const char *msg) +{ + FAR struct child_status_s *child; + int i; + + dbg("Parent TCB=%p: %s\n", tcb, msg); + for (i = 0, child = tcb->children; child; i++, child = child->flink) + { + dbg(" %d. ch_flags=%02x ch_pid=%d ch_status=%d\n", + i, child->ch_flags, child->ch_pid, child->ch_status); + } +} +#else +# task_dumpchildren(t,m) +#endif + /***************************************************************************** * Public Functions *****************************************************************************/ @@ -88,7 +142,7 @@ static struct child_pool_s g_child_pool; * None. * * Assumptions: - * Called early in initializatin. No special precautions are required. + * Called early in initialization. No special precautions are required. * *****************************************************************************/ @@ -102,11 +156,11 @@ void task_initialize(void) prev = &g_child_pool.alloc[0]; g_child_pool.freelist = prev; - for (i = 0; i < CONFIG_MAX_TASKS; i++) + for (i = 0; i < CONFIG_PREALLOC_CHILDSTATUS; i++) { - curr = &g_child_pool.alloc[i] + curr = &g_child_pool.alloc[i]; prev->flink = curr; - prev = curr; + prev = curr; } } @@ -140,7 +194,7 @@ FAR struct child_status_s *task_allocchild(void) if (ret) { g_child_pool.freelist = ret->flink; - ret->flink = NULL; + ret->flink = NULL; } return ret; @@ -170,7 +224,7 @@ void task_freechild(FAR struct child_status_s *child) if (child) { - child->flink = g_child_pool.freelist; + child->flink = g_child_pool.freelist; g_child_pool.freelist = child; } } @@ -179,18 +233,14 @@ void task_freechild(FAR struct child_status_s *child) * Name: task_addchild * * Description: - * Find a child status structure in the given TCB. + * Add a child status structure in the given TCB. * * Parameters: * tcb - The TCB of the parent task to containing the child status. - * pid - The ID of the child to create - * status - Child exit status (should be zero) - * flags - Child flags (see CHILD_FLAGS_* defininitions) + * child - The structure to be added * * Return Value: - * On success, a non-NULL pointer to a child status structure. NULL is - * returned if (1) there are no free status structures, or (2) an entry - * with this PID already exists. + * N * * Assumptions: * Called during task creation processing in a safe context. No special @@ -198,37 +248,14 @@ void task_freechild(FAR struct child_status_s *child) * *****************************************************************************/ -FAR struct child_status_s *task_addchild(FAR _TCB *tcb, pid_t pid, int status, - uint8_t flags) +void task_addchild(FAR _TCB *tcb, FAR struct child_status_s *child) { - FAR struct child_status_s *child; + /* Add the entry into the TCB list of children */ - /* Make sure that there is not already a structure for this PID */ + child->flink = tcb->children; + tcb->children = child; - child = task_findchild(tcb, pid); - if (child) - { - return NULL; - } - - /* Allocate a new status structure */ - - child = task_allocchild(void); - if (child) - { - /* Initialize the structure */ - - child->ch_flags = flags; - child->ch_pid = pid; - child->ch_status = status; - - /* Add the entry into the TCB list of children */ - - status->flink = tcb->children; - tcb->childen = status; - } - - return child; + task_dumpchildren(tcb, "task_addchild"); } /***************************************************************************** @@ -325,6 +352,7 @@ FAR struct child_status_s *task_removechild(FAR _TCB *tcb, pid_t pid) } curr->flink = NULL; + task_dumpchildren(tcb, "task_removechild"); } return curr; @@ -360,6 +388,9 @@ void task_removechildren(FAR _TCB *tcb) next = curr->flink; task_freechild(curr); } + + tcb->children = NULL; + task_dumpchildren(tcb, "task_removechildren"); } #endif /* CONFIG_SCHED_HAVE_PARENT && CONFIG_SCHED_CHILD_STATUS */ diff --git a/nuttx/sched/task_create.c b/nuttx/sched/task_create.c index 801706cbf3..2ed929ab02 100644 --- a/nuttx/sched/task_create.c +++ b/nuttx/sched/task_create.c @@ -1,7 +1,7 @@ /**************************************************************************** * sched/task_create.c * - * Copyright (C) 2007-2010 Gregory Nutt. All rights reserved. + * Copyright (C) 2007-2010, 2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -81,7 +81,7 @@ * * Input Parameters: * name - Name of the new task - * type - Type of the new task + * ttype - Type of the new task * priority - Priority of the new task * stack_size - size (in bytes) of the stack needed * entry - Entry point of a new task @@ -99,10 +99,10 @@ ****************************************************************************/ #ifndef CONFIG_CUSTOM_STACK -static int thread_create(const char *name, uint8_t type, int priority, +static int thread_create(const char *name, uint8_t ttype, int priority, int stack_size, main_t entry, const char **argv) #else -static int thread_create(const char *name, uint8_t type, int priority, +static int thread_create(const char *name, uint8_t ttype, int priority, main_t entry, const char **argv) #endif { @@ -142,15 +142,9 @@ static int thread_create(const char *name, uint8_t type, int priority, } #endif - /* Mark the type of this thread (this setting will be needed in - * task_schedsetup() when up_initial_state() is called. - */ - - tcb->flags |= type; - /* Initialize the task control block */ - ret = task_schedsetup(tcb, priority, task_start, entry); + ret = task_schedsetup(tcb, priority, task_start, entry, ttype); if (ret != OK) { goto errout_with_tcb; diff --git a/nuttx/sched/task_exithook.c b/nuttx/sched/task_exithook.c index 1106f28852..1813c12ed5 100644 --- a/nuttx/sched/task_exithook.c +++ b/nuttx/sched/task_exithook.c @@ -1,7 +1,7 @@ /**************************************************************************** * sched/task_exithook.c * - * Copyright (C) 2011-2012 Gregory Nutt. All rights reserved. + * Copyright (C) 2011-2013 Gregory Nutt. All rights reserved. * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without @@ -202,51 +202,86 @@ static inline void task_sigchild(FAR _TCB *tcb, int status) FAR _TCB *ptcb; siginfo_t info; - /* Keep things stationary through the following */ + /* Only exiting tasks should generate SIGCHLD. pthreads use other + * mechansims. + */ - sched_lock(); - - /* Get the TCB of the receiving task */ - - ptcb = sched_gettcb(tcb->parent); - if (!ptcb) + if ((tcb->flags & TCB_FLAG_TTYPE_MASK) == TCB_FLAG_TTYPE_TASK) { - /* The parent no longer exists... bail */ + /* Keep things stationary through the following */ + sched_lock(); + + /* Get the TCB of the receiving task */ + + ptcb = sched_gettcb(tcb->parent); + if (!ptcb) + { + /* The parent no longer exists... bail */ + + sched_unlock(); + return; + } + +#ifdef CONFIG_SCHED_CHILD_STATUS + /* Check if the parent task has suppressed retention of child exit + * status information. Only 'tasks' report exit status, not pthreads. + * pthreads have a different mechanism. + */ + + if ((ptcb->flags & TCB_FLAG_NOCLDWAIT) == 0) + { + FAR struct child_status_s *child; + + /* No.. Find the exit status entry for this task in the parent TCB */ + + child = task_findchild(ptcb, getpid()); + DEBUGASSERT(child); + if (child) + { + /* Mark that the child has exit'ed */ + + child->ch_flags |= CHILD_FLAG_EXITED; + + /* Save the exit status */ + + child->ch_status = status; + } + } +#else + /* Decrement the number of children from this parent */ + + DEBUGASSERT(ptcb->nchildren > 0); + ptcb->nchildren--; +#endif + + /* Set the parent to an impossible PID. We do this because under + * certain conditions, task_exithook() can be called multiple times. + * If this function is called again, sched_gettcb() will fail on the + * invalid parent PID above, nchildren will be decremented once and + * all will be well. + */ + + tcb->parent = INVALID_PROCESS_ID; + + /* Create the siginfo structure. We don't actually know the cause. + * That is a bug. Let's just say that the child task just exit-ted + * for now. + */ + + info.si_signo = SIGCHLD; + info.si_code = CLD_EXITED; + info.si_value.sival_ptr = NULL; + info.si_pid = tcb->pid; + info.si_status = status; + + /* Send the signal. We need to use this internal interface so that we + * can provide the correct si_code value with the signal. + */ + + (void)sig_received(ptcb, &info); sched_unlock(); - return; } - - /* Decrement the number of children from this parent */ - - DEBUGASSERT(ptcb->nchildren > 0); - ptcb->nchildren--; - - /* Set the parent to an impossible PID. We do this because under certain - * conditions, task_exithook() can be called multiple times. If this - * function is called again, sched_gettcb() will fail on the invalid - * parent PID above, nchildren will be decremented once and all will be - * well. - */ - - tcb->parent = INVALID_PROCESS_ID; - - /* Create the siginfo structure. We don't actually know the cause. That - * is a bug. Let's just say that the child task just exit-ted for now. - */ - - info.si_signo = SIGCHLD; - info.si_code = CLD_EXITED; - info.si_value.sival_ptr = NULL; - info.si_pid = tcb->pid; - info.si_status = status; - - /* Send the signal. We need to use this internal interface so that we can - * provide the correct si_code value with the signal. - */ - - (void)sig_received(ptcb, &info); - sched_unlock(); } #else # define task_sigchild(tcb,status) @@ -344,6 +379,12 @@ void task_exithook(FAR _TCB *tcb, int status) (void)lib_flushall(tcb->streams); #endif + /* Discard any un-reaped child status (no zombies here!) */ + +#if defined(CONFIG_SCHED_HAVE_PARENT) && defined(CONFIG_SCHED_CHILD_STATUS) + task_removechildren(tcb); +#endif + /* Free all file-related resources now. This gets called again * just be be certain when the TCB is delallocated. However, we * really need to close files as soon as possible while we still diff --git a/nuttx/sched/task_init.c b/nuttx/sched/task_init.c index 31fc5ef70b..0f0fdc68eb 100644 --- a/nuttx/sched/task_init.c +++ b/nuttx/sched/task_init.c @@ -141,7 +141,8 @@ int task_init(FAR _TCB *tcb, const char *name, int priority, /* Initialize the task control block */ - ret = task_schedsetup(tcb, priority, task_start, entry); + ret = task_schedsetup(tcb, priority, task_start, entry, + TCB_FLAG_TTYPE_TASK); if (ret == OK) { /* Setup to pass parameters to the new task */ diff --git a/nuttx/sched/task_reparent.c b/nuttx/sched/task_reparent.c index 244825f804..28d371bf10 100644 --- a/nuttx/sched/task_reparent.c +++ b/nuttx/sched/task_reparent.c @@ -71,6 +71,9 @@ int task_reparent(pid_t ppid, pid_t chpid) { +#ifdef CONFIG_SCHED_CHILD_STATUS + FAR struct child_status_s *child; +#endif _TCB *ptcb; _TCB *chtcb; _TCB *otcb; @@ -127,12 +130,30 @@ int task_reparent(pid_t ppid, pid_t chpid) /* Then reparent the child */ + chtcb->parent = ppid; /* The task specified by ppid is the new parent */ + +#ifdef CONFIG_SCHED_CHILD_STATUS + /* Remove the child status entry from old parent TCB */ + + child = task_removechild(otcb, chpid); + if (child) + { + /* Add the child status entry to the new parent TCB */ + + task_addchild(ptcb, child); + ret = OK; + } + else + { + ret = -ENOENT; + } +#else DEBUGASSERT(otcb->nchildren > 0); - chtcb->parent = ppid; /* The task specified by ppid is the new parent */ otcb->nchildren--; /* The orignal parent now has one few children */ ptcb->nchildren++; /* The new parent has one additional child */ ret = OK; +#endif errout_with_ints: irqrestore(flags); diff --git a/nuttx/sched/task_setup.c b/nuttx/sched/task_setup.c index 92897f0ae6..80aefded3a 100644 --- a/nuttx/sched/task_setup.c +++ b/nuttx/sched/task_setup.c @@ -153,7 +153,8 @@ static int task_assignpid(FAR _TCB *tcb) * Save the task ID of the parent task in the child task's TCB. * * Parameters: - * tcb - The TCB of the new, child task. + * tcb - The TCB of the new, child task. + * ttype - Type of the new thread: task, pthread, or kernel thread * * Returned Value: * None @@ -165,13 +166,57 @@ static int task_assignpid(FAR _TCB *tcb) ****************************************************************************/ #ifdef CONFIG_SCHED_HAVE_PARENT -static inline void task_saveparent(FAR _TCB *tcb) +static inline void task_saveparent(FAR _TCB *tcb, uint8_t ttype) { FAR _TCB *rtcb = (FAR _TCB*)g_readytorun.head; - DEBUGASSERT(rtcb->nchildren < UINT16_MAX); + /* Save the parent task's ID in the child task's TCB. I am not sure if + * this makes sense for the case of pthreads or not, but I don't think it + * is harmful in any event. + */ + tcb->parent = rtcb->pid; - rtcb->nchildren++; + + /* Exit status only needs to be retained for the case of tasks, however */ + + if (ttype == TCB_FLAG_TTYPE_TASK) + { +#ifdef CONFIG_SCHED_CHILD_STATUS + FAR struct child_status_s *child; + + /* Make sure that there is not already a structure for this PID in the + * parent TCB. There should not be. + */ + + child = task_findchild(rtcb, tcb->pid); + DEBUGASSERT(!child); + if (!child) + { + /* Allocate a new status structure */ + + child = task_allocchild(); + } + + /* Did we successfully find/allocate the child status structure? */ + + DEBUGASSERT(child); + if (child) + { + /* Yes.. Initialize the structure */ + + child->ch_flags = ttype; + child->ch_pid = tcb->pid; + child->ch_status = 0; + + /* Add the entry into the TCB list of children */ + + task_addchild(rtcb, child); + } +#else + DEBUGASSERT(rtcb->nchildren < UINT16_MAX); + rtcb->nchildren++; +#endif + } } #else # define task_saveparent(tcb) @@ -235,7 +280,7 @@ static inline void task_dupdspace(FAR _TCB *tcb) * priority - Priority of the new task * entry - Entry point of a new task * main - Application start point of the new task - * type - Type of the new thread: task, pthread, or kernel thread + * ttype - Type of the new thread: task, pthread, or kernel thread * * Return Value: * OK on success; ERROR on failure. @@ -245,7 +290,8 @@ static inline void task_dupdspace(FAR _TCB *tcb) * ****************************************************************************/ -int task_schedsetup(FAR _TCB *tcb, int priority, start_t start, main_t main) +int task_schedsetup(FAR _TCB *tcb, int priority, start_t start, main_t main, + uint8_t ttype) { int ret; @@ -264,9 +310,17 @@ int task_schedsetup(FAR _TCB *tcb, int priority, start_t start, main_t main) tcb->start = start; tcb->entry.main = main; + /* Save the thrad type. This setting will be needed in + * up_initial_state() is called. + */ + + ttype &= TCB_FLAG_TTYPE_MASK; + tcb->flags &= ~TCB_FLAG_TTYPE_MASK; + tcb->flags |= ttype; + /* Save the task ID of the parent task in the TCB */ - task_saveparent(tcb); + task_saveparent(tcb, ttype); /* exec(), pthread_create(), task_create(), and vfork() all * inherit the signal mask of the parent thread. diff --git a/nuttx/sched/task_vfork.c b/nuttx/sched/task_vfork.c index 46b2d8e9f4..fece4c596a 100644 --- a/nuttx/sched/task_vfork.c +++ b/nuttx/sched/task_vfork.c @@ -136,12 +136,6 @@ FAR _TCB *task_vforksetup(start_t retaddr) (void)env_dup(child); - /* Mark the type of this thread (this setting will be needed in - * task_schedsetup() when up_initial_state() is called. - */ - - child->flags |= TCB_FLAG_TTYPE_TASK; - /* Get the priority of the parent task */ #ifdef CONFIG_PRIORITY_INHERITANCE @@ -153,7 +147,8 @@ FAR _TCB *task_vforksetup(start_t retaddr) /* Initialize the task control block. This calls up_initial_state() */ svdbg("Child priority=%d start=%p\n", priority, retaddr); - ret = task_schedsetup(child, priority, retaddr, parent->entry.main); + ret = task_schedsetup(child, priority, retaddr, parent->entry.main, + TCB_FLAG_TTYPE_TASK); if (ret != OK) { goto errout_with_tcb; From 63f8c0a954ef61ee416e78ea55899bc322aa313b Mon Sep 17 00:00:00 2001 From: patacongo Date: Wed, 23 Jan 2013 23:11:13 +0000 Subject: [PATCH 115/118] Add option to used keyboard CODEC in apps/examples/keypadtest git-svn-id: http://svn.code.sf.net/p/nuttx/code/trunk@5554 42af7a65-404d-4744-a932-0658087f49c3 --- apps/examples/keypadtest/Kconfig | 8 ++ apps/examples/keypadtest/keypadtest_main.c | 115 +++++++++++++++++++- nuttx/ChangeLog | 2 + nuttx/TODO | 121 +++++++++++++-------- nuttx/arch/arm/src/lpc43xx/lpc43_irq.c | 7 +- 5 files changed, 207 insertions(+), 46 deletions(-) diff --git a/apps/examples/keypadtest/Kconfig b/apps/examples/keypadtest/Kconfig index 9dee80633a..98c6d348e7 100644 --- a/apps/examples/keypadtest/Kconfig +++ b/apps/examples/keypadtest/Kconfig @@ -18,4 +18,12 @@ if EXAMPLES_KEYPADTEST The name of the keypad device that will be opened in order to perform the keypad test. Default: "/dev/keypad" +config EXAMPLES_KEYPADTEST_ENCODED + bool "Use Keyboard CODEC" + default n + ---help--- + Use the keyboard encoded/decoder to pass control information from + the keypad driver to the keypad test. This is the keyboard CODEC + defined in nuttx/input/kbd_codec.h. + endif diff --git a/apps/examples/keypadtest/keypadtest_main.c b/apps/examples/keypadtest/keypadtest_main.c index afdc3e08ae..dd7369c3e9 100644 --- a/apps/examples/keypadtest/keypadtest_main.c +++ b/apps/examples/keypadtest/keypadtest_main.c @@ -50,6 +50,11 @@ #include +#ifdef CONFIG_EXAMPLES_KEYPADTEST_ENCODED +# include +# include +#endif + /**************************************************************************** * Definitions ****************************************************************************/ @@ -67,6 +72,15 @@ * Private Types ****************************************************************************/ +#ifdef CONFIG_EXAMPLES_KEYPADTEST_ENCODED +struct keypad_instream_s +{ + struct lib_instream_s stream; + FAR char *buffer; + ssize_t nbytes; +}; +#endif + /**************************************************************************** * Private Data ****************************************************************************/ @@ -75,6 +89,102 @@ * Private Functions ****************************************************************************/ +/**************************************************************************** + * Name: keypad_getstream + * + * Description: + * Get one character from the keyboard. + * + ****************************************************************************/ + +#ifdef CONFIG_EXAMPLES_KEYPADTEST_ENCODED +static int keypad_getstream(FAR struct lib_instream_s *this) +{ + FAR struct keypad_instream_s *kbdstream = (FAR struct keypad_instream_s *)this; + + DEBUGASSERT(kbdstream && kbdstream->buffer); + if (kbdstream->nbytes > 0) + { + kbdstream->nbytes--; + kbdstream->stream.nget++; + return (int)*kbdstream->buffer++; + } + + return EOF; +} +#endif + +/**************************************************************************** + * Name: keypad_decode + * + * Description: + * Decode encoded keyboard input + * + ****************************************************************************/ + +#ifdef CONFIG_EXAMPLES_KEYPADTEST_ENCODED +static void keypad_decode(FAR char *buffer, ssize_t nbytes) +{ + struct keypad_instream_s kbdstream; + struct kbd_getstate_s state; + uint8_t ch; + int ret; + + /* Initialize */ + + memset(&state, 0, sizeof(struct kbd_getstate_s)); + kbdstream.stream.get = keypad_getstream; + kbdstream.stream.nget = 0; + kbdstream.buffer = buffer; + kbdstream.nbytes = nbytes; + + /* Loop until all of the bytes have been consumed. We implicitly assume + * that the the escaped sequences do not cross buffer boundaries. That + * might be true if the read buffer were small or the data rates high. + */ + + for (;;) + { + /* Decode the next thing from the buffer */ + + ret = kbd_decode((FAR struct lib_instream_s *)&kbdstream, &state, &ch); + if (ret == KBD_ERROR) + { + break; + } + + /* Normal data? Or special key? */ + + switch (ret) + { + case KBD_PRESS: /* Key press event */ + printf("Normal Press: %c [%02x]\n", isprint(ch) ? ch : '.', ch); + break; + + case KBD_RELEASE: /* Key release event */ + printf("Normal Release: %c [%02x]\n", isprint(ch) ? ch : '.', ch); + break; + + case KBD_SPECPRESS: /* Special key press event */ + printf("Special Press: %d\n", ch); + break; + + case KBD_SPECREL: /* Special key release event */ + printf("Special Release: %d\n", ch); + break; + + case KBD_ERROR: /* Error or end-of-file */ + printf("EOF: %d\n", ret); + break; + + default: + printf("Unexpected: %d\n", ret); + break; + } + } +} +#endif + /**************************************************************************** * Public Functions ****************************************************************************/ @@ -125,8 +235,11 @@ int keypadtest_main(int argc, char *argv[]) if (nbytes > 0) { /* On success, echo the buffer to stdout */ - +#ifdef CONFIG_EXAMPLES_KEYPADTEST_ENCODED + keypad_decode(buffer, nbytes); +#else (void)write(1, buffer, nbytes); +#endif } } while (nbytes >= 0); diff --git a/nuttx/ChangeLog b/nuttx/ChangeLog index 38b1b6b1f3..99f6d4a520 100644 --- a/nuttx/ChangeLog +++ b/nuttx/ChangeLog @@ -4016,4 +4016,6 @@ the child task exists. This is behavior required by POSIX. But in NuttX is only enabled with CONFIG_SCHED_HAVE_PARENT and CONFIG_SCHED_CHILD_STATUS + * Add support for keyboard encode to the keypad test (from + Denis Carikli). diff --git a/nuttx/TODO b/nuttx/TODO index 94c3dba0d8..c302760ab4 100644 --- a/nuttx/TODO +++ b/nuttx/TODO @@ -1,4 +1,4 @@ -NuttX TODO List (Last updated January 14, 2013) +NuttX TODO List (Last updated January 23, 2013) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ This file summarizes known NuttX bugs, limitations, inconsistencies with @@ -38,14 +38,14 @@ nuttx/ (3) MIPS/PIC32 (arch/mips) (1) Hitachi/Renesas SH-1 (arch/sh/src/sh1) (4) Renesas M16C/26 (arch/sh/src/m16c) - (10) z80/z8/ez80 (arch/z80/) + (11) z80/z8/ez80/z180 (arch/z80/) (9) z16 (arch/z16/) (1) mc68hc1x (arch/hc) apps/ (5) Network Utilities (apps/netutils/) - (4) NuttShell (NSH) (apps/nshlib) + (5) NuttShell (NSH) (apps/nshlib) (1) System libraries apps/system (apps/system) (5) Other Applications & Tests (apps/examples/) @@ -161,37 +161,6 @@ o Task/Scheduler (sched/) Status: Open Priority: Medium Low for now - Title: RETAINING TASK EXIT STATUS - Description: When a task exists, its exit status should be retained in - so data structure until it is reaped (via waitpid(), or - similar interface) or until the parent thread exists. - - You would think that this should be a clone of the existing - pthread join logic. Howver there is no need for zombies - in NuttX so no need to keep the status if the parent has - already exit'ed. Other simplifications: - - 1. Keep the array/list of return status in the parent - tasks TCB. - 2. Use a fixed size array of return status (perhaps the - the enire array is allocated so that that is con - penalty for tasks that have no childre. - - At present, exit status is not retained. If waitpid() - is called after the child task has exit'ed it simpley - returns with the ECHLD error. That is not too bad, but - does not tell you what the exit status was. - - A work-around is to: - 1) Call sched_lock() to disable pre-emption. - 2) Start the task (it cannot run because pre-emption is - disbled. - 3) Call waitpid(); - 4) Call sched_unlock() to re-enable pre-emption. - - Status: Open - Priority: Low - Title: IMPROVED TASK CONTROL BLOCK STRUCTURE Description: All task resources that are shared amongst threads have their own "break-away", reference-counted structure. The @@ -226,6 +195,23 @@ o Task/Scheduler (sched/) important interfaces. For the average user, these functions are just fine the way they are. + Title: execv() AND vfork() + Description: There is a problem when vfork() calls execv() (or execl()) to + start a new appliction: When the parent thread calls vfork() + it receives and gets the pid of the vforked task, and *not* + the pid of the desired execv'ed application. + + The same tasking arrangement is used by the standard function + posix_spawn(). However, posix_spawn uses the non-standard, internal + NuttX interface task_reparent() to replace the childs parent task + with the caller of posix_spawn(). That cannot be done with vfork() + because we don't know what vfor() is going to do. + + Any solution to this is either very difficult or impossible with + an MMU. + Status: Open + Priority: Low (it might as well be low since it isn't going to be fixed). + o Memory Managment (mm/) ^^^^^^^^^^^^^^^^^^^^^^ @@ -531,7 +517,7 @@ o Network (net/, drivers/net) Status: Open. No changes are planned. Priority: Low - Tile: MULTIPLE NETWORK INTERFACE SUPPORT + Title: MULTIPLE NETWORK INTERFACE SUPPORT Description: uIP polling issues / Multiple network interface support: (1) Current logic will not support multiple ethernet drivers. @@ -681,6 +667,21 @@ o Network (net/, drivers/net) Status: Open Priority: Low... fix defconfig files as necessary. + Title: net_poll() DOES NOT HANDLE LOSS-OF-CONNECTION CORRECTLY + Description: When a loss of connection is detected by any logic waiting on the + networking events, the function net_lostconnection() must be called. + That function just sets some bits in the socket structure so that + it remembers that the connection is lost. + + That is currently done in recvfrom(), send(), and net_monitor.c. But + it is not done in the net_poll() logic; that logic correctly sets + the POLLHUP status, but it does not call net_lostconnection(). As a + result, if recv() is called after the poll() or select(), the system + will hang because the recv() does not know that the connection has + been lost. + Status: Open + Priority: High + o USB (drivers/usbdev, drivers/usbhost) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -1074,13 +1075,13 @@ o Build system Priority: Low -- the kernel build configuration is not fully fielded yet. - Title: mconf NOT AVAILABLE IN NATIVE WINDOWS BUILD - Description: NuttX is migrating to the use of the kconfig-frontends mconf + Title: kconfig-mconf NOT AVAILABLE IN NATIVE WINDOWS BUILD + Description: NuttX is migrating to the use of the kconfig-frontends kconfig-mconf tool for all configurations. In NuttX 6.24, support for native - Windows builds was added. However, the mconf tool does not + Windows builds was added. However, thekconfig- mconf tool does not build to run natively under Windows. - Some effort was spent trying to get a clean mconf build under + Some effort was spent trying to get a clean kconfig-mconf build under Windows. This is documented in the message thread beginning here: http://tech.groups.yahoo.com/group/nuttx/message/2900. The build was successfully completed using: MinGW-GCC, MSYS, @@ -1092,8 +1093,8 @@ o Build system was considered a show stopper and the changs were not checked in. - Options: (1) Use conf (not mconf). confis the text-only - configuration tool, (2) fix mconf, (3) write another variant + Options: (1) Use kconfigs-conf (not kconfig-mconf). confis the text-only + configuration tool, (2) fix kconfig-mconf, (3) write another variant of the configuration tool for windows, or (4) do all configuration under Cygwin or MSYS. I am doing (4) now, but this is very awkward because I have to set the apps path to ../apps (vs @@ -1763,8 +1764,8 @@ o Renesas M16C/26 (arch/sh/src/m16c) Status: Open Priority: Medium -o z80/z8/ez80 (arch/z80) - ^^^^^^^^^^^^^^^^^^^^^^^ +o z80/z8/ez80/z180 (arch/z80) + ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Title: SDCC INTEGER OVERFLOWS Description: The SDCC version the same problems with integer overflow during @@ -1854,6 +1855,14 @@ o z80/z8/ez80 (arch/z80) Status: Open Priority: Med + Title: UNFINISHED Z180 LOGIC NEEDED BY THE P112 BOARD + Description: 1) Need to revist the start-up logic. Looking at the P112 Bios + (Bios.mcd), I see that quite of bit of register setup is done + there. + 2) Finish ESCC driver logic. + Status: Open + Priority: Low (at least until I get P112 hardware) + o z16 (arch/z16) ^^^^^^^^^^^^^^^^ @@ -2045,6 +2054,32 @@ o NuttShell (NSH) (apps/nshlib) Status: Open Priority: Low (enhancement) + Title: RE-DIRECTION OF BUILTIN APPLICATONS + Description: There is a problem with the re-direction of output form built-in + applications in NSH. When output is re-directed, exec_builtin() + spawns a tiny trampoline task that re-directs the output as + requested, starts the built-in task and then exit. + + The problem is that when exec_builtin() starts the trampoline task, + it receives and returns the pid of the trampoline task, and *not* + the pid of the desired builtin application. This bad pid is returned + to NSH and when NSH tries to use that pid in the waitpid() call, it + fails because the trampoline task no longer exists. + + The same tasking arrangement is used by the standard function + posix_spawn(). However, posix_spawn uses the non-standard, internal + NuttX interface task_reparent() to replace the childs parent task + with the caller of posix_spawn(). + + exec_builtin() should not use this internal interface, however, + since it resides in the application space. The suggested solution + is (1) move the exec_builtin() logic into nuttx/sched, (2) make it + a semi-standard interface renamed to task_spawn() and prototyped + in nuttx/include/sched.h, and then (2) use task_reparent to solve + the parental problem in the same way that posix_spawn does. + Status: Open + Priority: Medium + o System libraries apps/system (apps/system) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/nuttx/arch/arm/src/lpc43xx/lpc43_irq.c b/nuttx/arch/arm/src/lpc43xx/lpc43_irq.c index aa0e4cf096..6f49b3e38f 100644 --- a/nuttx/arch/arm/src/lpc43xx/lpc43_irq.c +++ b/nuttx/arch/arm/src/lpc43xx/lpc43_irq.c @@ -386,9 +386,12 @@ void up_irqinitialize(void) lpc43_dumpnvic("initial", LPC43M4_IRQ_NIRQS); - /* If a debugger is connected, try to prevent it from catching hardfaults */ + /* If a debugger is connected, try to prevent it from catching hardfaults. + * If CONFIG_ARMV7M_USEBASEPRI, no hardfaults are expected in normal + * operation. + */ -#ifdef CONFIG_DEBUG +#if defined(CONFIG_DEBUG) && !defined(CONFIG_ARMV7M_USEBASEPRI) regval = getreg32(NVIC_DEMCR); regval &= ~NVIC_DEMCR_VCHARDERR; putreg32(regval, NVIC_DEMCR); From f4da4bb8ca29a48e1bf10958cbc45fc9fb10e9f7 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Thu, 24 Jan 2013 10:00:23 +1100 Subject: [PATCH 116/118] perf_counter: added perf_reset() and perf_reset_all() calls useful for watching counters after system reaches stable flight --- apps/systemlib/perf_counter.c | 45 +++++++++++++++++++++++++++++++++++ apps/systemlib/perf_counter.h | 13 ++++++++++ 2 files changed, 58 insertions(+) diff --git a/apps/systemlib/perf_counter.c b/apps/systemlib/perf_counter.c index ff15ef4793..879f4715af 100644 --- a/apps/systemlib/perf_counter.c +++ b/apps/systemlib/perf_counter.c @@ -218,6 +218,40 @@ perf_end(perf_counter_t handle) } } +void +perf_reset(perf_counter_t handle) +{ + if (handle == NULL) + return; + + switch (handle->type) { + case PC_COUNT: + ((struct perf_ctr_count *)handle)->event_count = 0; + break; + + case PC_ELAPSED: { + struct perf_ctr_elapsed *pce = (struct perf_ctr_elapsed *)handle; + pce->event_count = 0; + pce->time_start = 0; + pce->time_total = 0; + pce->time_least = 0; + pce->time_most = 0; + break; + } + + case PC_INTERVAL: { + struct perf_ctr_interval *pci = (struct perf_ctr_interval *)handle; + pci->event_count = 0; + pci->time_event = 0; + pci->time_first = 0; + pci->time_last = 0; + pci->time_least = 0; + pci->time_most = 0; + break; + } + } +} + void perf_print_counter(perf_counter_t handle) { @@ -270,3 +304,14 @@ perf_print_all(void) handle = (perf_counter_t)sq_next(&handle->link); } } + +void +perf_reset_all(void) +{ + perf_counter_t handle = (perf_counter_t)sq_peek(&perf_counters); + + while (handle != NULL) { + perf_reset(handle); + handle = (perf_counter_t)sq_next(&handle->link); + } +} diff --git a/apps/systemlib/perf_counter.h b/apps/systemlib/perf_counter.h index 6e6c80d5bc..5c2cb15b2f 100644 --- a/apps/systemlib/perf_counter.h +++ b/apps/systemlib/perf_counter.h @@ -97,6 +97,14 @@ __EXPORT extern void perf_begin(perf_counter_t handle); */ __EXPORT extern void perf_end(perf_counter_t handle); +/** + * Reset a performance event. + * + * This call resets performance counter to initial state + * + * @param handle The handle returned from perf_alloc. + */ +__EXPORT extern void perf_reset(perf_counter_t handle); /** * Print one performance counter. @@ -110,6 +118,11 @@ __EXPORT extern void perf_print_counter(perf_counter_t handle); */ __EXPORT extern void perf_print_all(void); +/** + * Reset all of the performance counters. + */ +__EXPORT extern void perf_reset_all(void); + __END_DECLS #endif From 6e751d26e8011616e10b611df5dedbc24aa188bf Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Thu, 24 Jan 2013 10:00:49 +1100 Subject: [PATCH 117/118] perf: added 'perf reset' command resets all perf counters --- apps/systemcmds/perf/perf.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/apps/systemcmds/perf/perf.c b/apps/systemcmds/perf/perf.c index ced942fd6d..64443d019c 100644 --- a/apps/systemcmds/perf/perf.c +++ b/apps/systemcmds/perf/perf.c @@ -39,6 +39,7 @@ #include #include #include +#include #include "systemlib/perf_counter.h" @@ -63,6 +64,15 @@ __EXPORT int perf_main(int argc, char *argv[]); int perf_main(int argc, char *argv[]) { + if (argc > 1) { + if (strcmp(argv[1], "reset") == 0) { + perf_reset_all(); + return 0; + } + printf("Usage: perf \n"); + return -1; + } + perf_print_all(); fflush(stdout); return 0; From 379ed0a0922362a1bb92d03a661684a87824454d Mon Sep 17 00:00:00 2001 From: px4dev Date: Thu, 24 Jan 2013 00:22:01 -0800 Subject: [PATCH 118/118] Trivial compile fix. --- nuttx/sched/task_setup.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nuttx/sched/task_setup.c b/nuttx/sched/task_setup.c index 80aefded3a..43ed24b323 100644 --- a/nuttx/sched/task_setup.c +++ b/nuttx/sched/task_setup.c @@ -219,7 +219,7 @@ static inline void task_saveparent(FAR _TCB *tcb, uint8_t ttype) } } #else -# define task_saveparent(tcb) +# define task_saveparent(tcb, type) #endif /****************************************************************************