diff options
author | Lorenz Meier <lm@inf.ethz.ch> | 2013-06-02 13:18:50 +0200 |
---|---|---|
committer | Lorenz Meier <lm@inf.ethz.ch> | 2013-06-02 13:18:50 +0200 |
commit | 2ac9d47fbae79b8c8af911b229f0b22498cb767f (patch) | |
tree | b063549555183dd9abc2a161a755e147d5b508c8 | |
parent | c2688999fc33e82553a90d14fee079b5dc7efea0 (diff) | |
parent | c239e3577d53cb64869165b2e5b97f659df0d44b (diff) | |
download | nuttx-2ac9d47fbae79b8c8af911b229f0b22498cb767f.tar.gz nuttx-2ac9d47fbae79b8c8af911b229f0b22498cb767f.tar.bz2 nuttx-2ac9d47fbae79b8c8af911b229f0b22498cb767f.zip |
Merge branch 'kconfig_fixes' into integration
295 files changed, 5944 insertions, 2843 deletions
diff --git a/.gitignore b/.gitignore index b299f1469..83f6546a6 100644 --- a/.gitignore +++ b/.gitignore @@ -10,4 +10,3 @@ Make.dep core .gdbinit cscope.out - diff --git a/NxWidgets/ChangeLog.txt b/NxWidgets/ChangeLog.txt index dfd4c8c14..0737e5ca3 100644 --- a/NxWidgets/ChangeLog.txt +++ b/NxWidgets/ChangeLog.txt @@ -366,3 +366,6 @@ NxWidgets::CGlyphSliderHorizontal class. From Ken Pettit (2013-5-17) . * NxWidgets::CGlyphSliderHorizontal: Fix a drawing error. From Ken Pettit (2013-5-17). +* UnitTests/*/Makefile and .gitignore: Update the way that NSH + the Unit Tests are registered as built-in NSH applications (2013-5-30). + diff --git a/NxWidgets/UnitTests/CButton/.gitignore b/NxWidgets/UnitTests/CButton/.gitignore index c63935dc8..b14460823 100644 --- a/NxWidgets/UnitTests/CButton/.gitignore +++ b/NxWidgets/UnitTests/CButton/.gitignore @@ -1,14 +1,10 @@ -Make.dep -.context -.depend -.built -*.swp -*.asm -*.rel -*.lst -*.sym -*.adb -*.lib -*.src - - +/Make.dep +/.depend +/.built +/*.asm +/*.rel +/*.lst +/*.sym +/*.adb +/*.lib +/*.src diff --git a/NxWidgets/UnitTests/CButton/Makefile b/NxWidgets/UnitTests/CButton/Makefile index ea7b5cf25..1547c705e 100644 --- a/NxWidgets/UnitTests/CButton/Makefile +++ b/NxWidgets/UnitTests/CButton/Makefile @@ -1,7 +1,7 @@ ################################################################################# # NxWidgets/Unitests/CButton/Makefile # -# Copyright (C) 2012 Gregory Nutt. All rights reserved. +# Copyright (C) 2012-2013 Gregory Nutt. All rights reserved. # Author: Gregory Nutt <gnutt@nuttx.org> # # Redistribution and use in source and binary forms, with or without @@ -142,15 +142,18 @@ else endif $(Q) touch .built -# Standard housekeeping targets +# Register NSH built-in application -.context: ifeq ($(CONFIG_NSH_BUILTIN_APPS),y) +$(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat: $(DEPCONFIG) Makefile $(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main) + +context: $(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat +else +context: endif - $(Q) touch $@ -context: .context +# Standard housekeeping targets .depend: Makefile $(SRCS) $(Q) $(MKDEP) $(ROOTDEPPATH) $(CXX) -- $(CXXFLAGS) -- $(SRCS) >Make.dep @@ -159,6 +162,7 @@ context: .context depend: .depend clean: + $(call DELFILE, $(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat) $(call DELFILE, .built) $(call CLEAN) diff --git a/NxWidgets/UnitTests/CButtonArray/.gitignore b/NxWidgets/UnitTests/CButtonArray/.gitignore index c63935dc8..b14460823 100644 --- a/NxWidgets/UnitTests/CButtonArray/.gitignore +++ b/NxWidgets/UnitTests/CButtonArray/.gitignore @@ -1,14 +1,10 @@ -Make.dep -.context -.depend -.built -*.swp -*.asm -*.rel -*.lst -*.sym -*.adb -*.lib -*.src - - +/Make.dep +/.depend +/.built +/*.asm +/*.rel +/*.lst +/*.sym +/*.adb +/*.lib +/*.src diff --git a/NxWidgets/UnitTests/CButtonArray/Makefile b/NxWidgets/UnitTests/CButtonArray/Makefile index 6bb490e34..535ceb948 100644 --- a/NxWidgets/UnitTests/CButtonArray/Makefile +++ b/NxWidgets/UnitTests/CButtonArray/Makefile @@ -1,7 +1,7 @@ ################################################################################# # NxWidgets/UnitTests/CButtonArray/Makefile # -# Copyright (C) 2012 Gregory Nutt. All rights reserved. +# Copyright (C) 2012-2013 Gregory Nutt. All rights reserved. # Author: Gregory Nutt <gnutt@nuttx.org> # # Redistribution and use in source and binary forms, with or without @@ -142,15 +142,18 @@ else endif $(Q) touch .built -# Standard housekeeping targets +# Register NSH built-in application -.context: ifeq ($(CONFIG_NSH_BUILTIN_APPS),y) +$(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat: $(DEPCONFIG) Makefile $(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main) + +context: $(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat +else +context: endif - $(Q) touch $@ -context: .context +# Standard housekeeping targets .depend: Makefile $(SRCS) $(Q) $(MKDEP) $(ROOTDEPPATH) $(CXX) -- $(CXXFLAGS) -- $(SRCS) >Make.dep @@ -159,6 +162,7 @@ context: .context depend: .depend clean: + $(call DELFILE, $(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat) $(call DELFILE, .built) $(call CLEAN) diff --git a/NxWidgets/UnitTests/CCheckBox/.gitignore b/NxWidgets/UnitTests/CCheckBox/.gitignore index c63935dc8..b14460823 100644 --- a/NxWidgets/UnitTests/CCheckBox/.gitignore +++ b/NxWidgets/UnitTests/CCheckBox/.gitignore @@ -1,14 +1,10 @@ -Make.dep -.context -.depend -.built -*.swp -*.asm -*.rel -*.lst -*.sym -*.adb -*.lib -*.src - - +/Make.dep +/.depend +/.built +/*.asm +/*.rel +/*.lst +/*.sym +/*.adb +/*.lib +/*.src diff --git a/NxWidgets/UnitTests/CCheckBox/Makefile b/NxWidgets/UnitTests/CCheckBox/Makefile index bd8293983..e2f6a051a 100644 --- a/NxWidgets/UnitTests/CCheckBox/Makefile +++ b/NxWidgets/UnitTests/CCheckBox/Makefile @@ -1,7 +1,7 @@ ################################################################################# # NxWidgets/UnitTests/CCheckBox/Makefile # -# Copyright (C) 2012 Gregory Nutt. All rights reserved. +# Copyright (C) 2012-2013 Gregory Nutt. All rights reserved. # Author: Gregory Nutt <gnutt@nuttx.org> # # Redistribution and use in source and binary forms, with or without @@ -142,15 +142,18 @@ else endif $(Q) touch .built -# Standard housekeeping targets +# Register NSH built-in application -.context: ifeq ($(CONFIG_NSH_BUILTIN_APPS),y) +$(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat: $(DEPCONFIG) Makefile $(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main) + +context: $(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat +else +context: endif - $(Q) touch $@ -context: .context +# Standard housekeeping targets .depend: Makefile $(SRCS) $(Q) $(MKDEP) $(ROOTDEPPATH) $(CXX) -- $(CXXFLAGS) -- $(SRCS) >Make.dep @@ -159,6 +162,7 @@ context: .context depend: .depend clean: + $(call DELFILE, $(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat) $(call DELFILE, .built) $(call CLEAN) diff --git a/NxWidgets/UnitTests/CGlyphButton/.gitignore b/NxWidgets/UnitTests/CGlyphButton/.gitignore index c63935dc8..b14460823 100644 --- a/NxWidgets/UnitTests/CGlyphButton/.gitignore +++ b/NxWidgets/UnitTests/CGlyphButton/.gitignore @@ -1,14 +1,10 @@ -Make.dep -.context -.depend -.built -*.swp -*.asm -*.rel -*.lst -*.sym -*.adb -*.lib -*.src - - +/Make.dep +/.depend +/.built +/*.asm +/*.rel +/*.lst +/*.sym +/*.adb +/*.lib +/*.src diff --git a/NxWidgets/UnitTests/CGlyphButton/Makefile b/NxWidgets/UnitTests/CGlyphButton/Makefile index b69382133..f0ebfa8b6 100644 --- a/NxWidgets/UnitTests/CGlyphButton/Makefile +++ b/NxWidgets/UnitTests/CGlyphButton/Makefile @@ -1,7 +1,7 @@ ################################################################################# # NxWidgets/UnitTests/CGlyphButton/Makefile # -# Copyright (C) 2012 Gregory Nutt. All rights reserved. +# Copyright (C) 2012-2013 Gregory Nutt. All rights reserved. # Author: Gregory Nutt <gnutt@nuttx.org> # # Redistribution and use in source and binary forms, with or without @@ -142,15 +142,18 @@ else endif $(Q) touch .built -# Standard housekeeping targets +# Register NSH built-in application -.context: ifeq ($(CONFIG_NSH_BUILTIN_APPS),y) +$(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat: $(DEPCONFIG) Makefile $(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main) + +context: $(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat +else +context: endif - $(Q) touch $@ -context: .context +# Standard housekeeping targets .depend: Makefile $(SRCS) $(Q) $(MKDEP) $(ROOTDEPPATH) $(CXX) -- $(CXXFLAGS) -- $(SRCS) >Make.dep @@ -159,6 +162,7 @@ context: .context depend: .depend clean: + $(call DELFILE, $(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat) $(call DELFILE, .built) $(call CLEAN) diff --git a/NxWidgets/UnitTests/CGlyphSliderHorizontal/.gitignore b/NxWidgets/UnitTests/CGlyphSliderHorizontal/.gitignore index 22a689acd..b14460823 100644 --- a/NxWidgets/UnitTests/CGlyphSliderHorizontal/.gitignore +++ b/NxWidgets/UnitTests/CGlyphSliderHorizontal/.gitignore @@ -1,12 +1,10 @@ -Make.dep -.context -.depend -.built -*.swp -*.asm -*.rel -*.lst -*.sym -*.adb -*.lib -*.src +/Make.dep +/.depend +/.built +/*.asm +/*.rel +/*.lst +/*.sym +/*.adb +/*.lib +/*.src diff --git a/NxWidgets/UnitTests/CGlyphSliderHorizontal/Makefile b/NxWidgets/UnitTests/CGlyphSliderHorizontal/Makefile index 5ab64b10d..96d825953 100644 --- a/NxWidgets/UnitTests/CGlyphSliderHorizontal/Makefile +++ b/NxWidgets/UnitTests/CGlyphSliderHorizontal/Makefile @@ -1,7 +1,7 @@ ################################################################################# # NxWidgets/UnitTests/CGlyphSliderHorizontal/Makefile # -# Copyright (C) 2012-213 Gregory Nutt. All rights reserved. +# Copyright (C) 2012-2013 Gregory Nutt. All rights reserved. # Author: Gregory Nutt <gnutt@nuttx.org> # # Redistribution and use in source and binary forms, with or without @@ -142,15 +142,18 @@ else endif $(Q) touch .built -# Standard housekeeping targets +# Register NSH built-in application -.context: ifeq ($(CONFIG_NSH_BUILTIN_APPS),y) +$(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat: $(DEPCONFIG) Makefile $(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main) + +context: $(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat +else +context: endif - $(Q) touch $@ -context: .context +# Standard housekeeping targets .depend: Makefile $(SRCS) $(Q) $(MKDEP) $(ROOTDEPPATH) $(CXX) -- $(CXXFLAGS) -- $(SRCS) >Make.dep @@ -159,6 +162,7 @@ context: .context depend: .depend clean: + $(call DELFILE, $(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat) $(call DELFILE, .built) $(call CLEAN) diff --git a/NxWidgets/UnitTests/CImage/.gitignore b/NxWidgets/UnitTests/CImage/.gitignore index c63935dc8..b14460823 100644 --- a/NxWidgets/UnitTests/CImage/.gitignore +++ b/NxWidgets/UnitTests/CImage/.gitignore @@ -1,14 +1,10 @@ -Make.dep -.context -.depend -.built -*.swp -*.asm -*.rel -*.lst -*.sym -*.adb -*.lib -*.src - - +/Make.dep +/.depend +/.built +/*.asm +/*.rel +/*.lst +/*.sym +/*.adb +/*.lib +/*.src diff --git a/NxWidgets/UnitTests/CImage/Makefile b/NxWidgets/UnitTests/CImage/Makefile index 08e22772f..f6416372f 100644 --- a/NxWidgets/UnitTests/CImage/Makefile +++ b/NxWidgets/UnitTests/CImage/Makefile @@ -1,7 +1,7 @@ ################################################################################# # NxWidgets/UnitTests/CImage/Makefile # -# Copyright (C) 2012 Gregory Nutt. All rights reserved. +# Copyright (C) 2012-2013 Gregory Nutt. All rights reserved. # Author: Gregory Nutt <gnutt@nuttx.org> # # Redistribution and use in source and binary forms, with or without @@ -142,15 +142,18 @@ else endif $(Q) touch .built -# Standard housekeeping targets +# Register NSH built-in application -.context: ifeq ($(CONFIG_NSH_BUILTIN_APPS),y) +$(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat: $(DEPCONFIG) Makefile $(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main) + +context: $(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat +else +context: endif - $(Q) touch $@ -context: .context +# Standard housekeeping targets .depend: Makefile $(SRCS) $(Q) $(MKDEP) $(ROOTDEPPATH) $(CXX) -- $(CXXFLAGS) -- $(SRCS) >Make.dep @@ -159,6 +162,7 @@ context: .context depend: .depend clean: + $(call DELFILE, $(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat) $(call DELFILE, .built) $(call CLEAN) diff --git a/NxWidgets/UnitTests/CKeypad/.gitignore b/NxWidgets/UnitTests/CKeypad/.gitignore index c63935dc8..b14460823 100644 --- a/NxWidgets/UnitTests/CKeypad/.gitignore +++ b/NxWidgets/UnitTests/CKeypad/.gitignore @@ -1,14 +1,10 @@ -Make.dep -.context -.depend -.built -*.swp -*.asm -*.rel -*.lst -*.sym -*.adb -*.lib -*.src - - +/Make.dep +/.depend +/.built +/*.asm +/*.rel +/*.lst +/*.sym +/*.adb +/*.lib +/*.src diff --git a/NxWidgets/UnitTests/CKeypad/Makefile b/NxWidgets/UnitTests/CKeypad/Makefile index 0bbf837d8..ea5b0fb15 100644 --- a/NxWidgets/UnitTests/CKeypad/Makefile +++ b/NxWidgets/UnitTests/CKeypad/Makefile @@ -1,7 +1,7 @@ ################################################################################# # NxWidgets/UnitTests/CKeyPad/Makefile # -# Copyright (C) 2012 Gregory Nutt. All rights reserved. +# Copyright (C) 2012-2013 Gregory Nutt. All rights reserved. # Author: Gregory Nutt <gnutt@nuttx.org> # # Redistribution and use in source and binary forms, with or without @@ -142,15 +142,18 @@ else endif $(Q) touch .built -# Standard housekeeping targets +# Register NSH built-in application -.context: ifeq ($(CONFIG_NSH_BUILTIN_APPS),y) +$(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat: $(DEPCONFIG) Makefile $(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main) + +context: $(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat +else +context: endif - $(Q) touch $@ -context: .context +# Standard housekeeping targets .depend: Makefile $(SRCS) $(Q) $(MKDEP) $(ROOTDEPPATH) $(CXX) -- $(CXXFLAGS) -- $(SRCS) >Make.dep @@ -159,6 +162,7 @@ context: .context depend: .depend clean: + $(call DELFILE, $(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat) $(call DELFILE, .built) $(call CLEAN) diff --git a/NxWidgets/UnitTests/CLabel/.gitignore b/NxWidgets/UnitTests/CLabel/.gitignore index c63935dc8..b14460823 100644 --- a/NxWidgets/UnitTests/CLabel/.gitignore +++ b/NxWidgets/UnitTests/CLabel/.gitignore @@ -1,14 +1,10 @@ -Make.dep -.context -.depend -.built -*.swp -*.asm -*.rel -*.lst -*.sym -*.adb -*.lib -*.src - - +/Make.dep +/.depend +/.built +/*.asm +/*.rel +/*.lst +/*.sym +/*.adb +/*.lib +/*.src diff --git a/NxWidgets/UnitTests/CLabel/Makefile b/NxWidgets/UnitTests/CLabel/Makefile index 4cd3d05d8..906e4754d 100644 --- a/NxWidgets/UnitTests/CLabel/Makefile +++ b/NxWidgets/UnitTests/CLabel/Makefile @@ -1,7 +1,7 @@ ################################################################################# # NxWidgets/UnitTests/CLabel/Makefile # -# Copyright (C) 2012 Gregory Nutt. All rights reserved. +# Copyright (C) 2012-2013 Gregory Nutt. All rights reserved. # Author: Gregory Nutt <gnutt@nuttx.org> # # Redistribution and use in source and binary forms, with or without @@ -142,15 +142,18 @@ else endif $(Q) touch .built -# Standard housekeeping targets +# Register NSH built-in application -.context: ifeq ($(CONFIG_NSH_BUILTIN_APPS),y) +$(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat: $(DEPCONFIG) Makefile $(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main) + +context: $(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat +else +context: endif - $(Q) touch $@ -context: .context +# Standard housekeeping targets .depend: Makefile $(SRCS) $(Q) $(MKDEP) $(ROOTDEPPATH) $(CXX) -- $(CXXFLAGS) -- $(SRCS) >Make.dep @@ -159,6 +162,7 @@ context: .context depend: .depend clean: + $(call DELFILE, $(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat) $(call DELFILE, .built) $(call CLEAN) diff --git a/NxWidgets/UnitTests/CLatchButton/.gitignore b/NxWidgets/UnitTests/CLatchButton/.gitignore index c63935dc8..b14460823 100644 --- a/NxWidgets/UnitTests/CLatchButton/.gitignore +++ b/NxWidgets/UnitTests/CLatchButton/.gitignore @@ -1,14 +1,10 @@ -Make.dep -.context -.depend -.built -*.swp -*.asm -*.rel -*.lst -*.sym -*.adb -*.lib -*.src - - +/Make.dep +/.depend +/.built +/*.asm +/*.rel +/*.lst +/*.sym +/*.adb +/*.lib +/*.src diff --git a/NxWidgets/UnitTests/CLatchButton/Makefile b/NxWidgets/UnitTests/CLatchButton/Makefile index 92909ab62..131a96f7a 100644 --- a/NxWidgets/UnitTests/CLatchButton/Makefile +++ b/NxWidgets/UnitTests/CLatchButton/Makefile @@ -1,7 +1,7 @@ ################################################################################# # NxWidgets/UnitTests/CLatchButton/Makefile # -# Copyright (C) 2012 Gregory Nutt. All rights reserved. +# Copyright (C) 2012-2013 Gregory Nutt. All rights reserved. # Author: Gregory Nutt <gnutt@nuttx.org> # # Redistribution and use in source and binary forms, with or without @@ -142,15 +142,18 @@ else endif $(Q) touch .built -# Standard housekeeping targets +# Register NSH built-in application -.context: ifeq ($(CONFIG_NSH_BUILTIN_APPS),y) +$(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat: $(DEPCONFIG) Makefile $(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main) + +context: $(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat +else +context: endif - $(Q) touch $@ -context: .context +# Standard housekeeping targets .depend: Makefile $(SRCS) $(Q) $(MKDEP) $(ROOTDEPPATH) $(CXX) -- $(CXXFLAGS) -- $(SRCS) >Make.dep @@ -159,6 +162,7 @@ context: .context depend: .depend clean: + $(call DELFILE, $(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat) $(call DELFILE, .built) $(call CLEAN) diff --git a/NxWidgets/UnitTests/CLatchButtonArray/.gitignore b/NxWidgets/UnitTests/CLatchButtonArray/.gitignore index c63935dc8..b14460823 100644 --- a/NxWidgets/UnitTests/CLatchButtonArray/.gitignore +++ b/NxWidgets/UnitTests/CLatchButtonArray/.gitignore @@ -1,14 +1,10 @@ -Make.dep -.context -.depend -.built -*.swp -*.asm -*.rel -*.lst -*.sym -*.adb -*.lib -*.src - - +/Make.dep +/.depend +/.built +/*.asm +/*.rel +/*.lst +/*.sym +/*.adb +/*.lib +/*.src diff --git a/NxWidgets/UnitTests/CLatchButtonArray/Makefile b/NxWidgets/UnitTests/CLatchButtonArray/Makefile index 412174ea2..c712142e3 100644 --- a/NxWidgets/UnitTests/CLatchButtonArray/Makefile +++ b/NxWidgets/UnitTests/CLatchButtonArray/Makefile @@ -1,7 +1,7 @@ ################################################################################# # NxWidgets/UnitTests/CLatchButtonArray/Makefile # -# Copyright (C) 2012 Gregory Nutt. All rights reserved. +# Copyright (C) 2012-2013 Gregory Nutt. All rights reserved. # Author: Gregory Nutt <gnutt@nuttx.org> # # Redistribution and use in source and binary forms, with or without @@ -142,15 +142,18 @@ else endif $(Q) touch .built -# Standard housekeeping targets +# Register NSH built-in application -.context: ifeq ($(CONFIG_NSH_BUILTIN_APPS),y) +$(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat: $(DEPCONFIG) Makefile $(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main) + +context: $(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat +else +context: endif - $(Q) touch $@ -context: .context +# Standard housekeeping targets .depend: Makefile $(SRCS) $(Q) $(MKDEP) $(ROOTDEPPATH) $(CXX) -- $(CXXFLAGS) -- $(SRCS) >Make.dep @@ -159,6 +162,7 @@ context: .context depend: .depend clean: + $(call DELFILE, $(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat) $(call DELFILE, .built) $(call CLEAN) diff --git a/NxWidgets/UnitTests/CListBox/.gitignore b/NxWidgets/UnitTests/CListBox/.gitignore index c63935dc8..b14460823 100644 --- a/NxWidgets/UnitTests/CListBox/.gitignore +++ b/NxWidgets/UnitTests/CListBox/.gitignore @@ -1,14 +1,10 @@ -Make.dep -.context -.depend -.built -*.swp -*.asm -*.rel -*.lst -*.sym -*.adb -*.lib -*.src - - +/Make.dep +/.depend +/.built +/*.asm +/*.rel +/*.lst +/*.sym +/*.adb +/*.lib +/*.src diff --git a/NxWidgets/UnitTests/CListBox/Makefile b/NxWidgets/UnitTests/CListBox/Makefile index 58d313b4f..5647002d6 100644 --- a/NxWidgets/UnitTests/CListBox/Makefile +++ b/NxWidgets/UnitTests/CListBox/Makefile @@ -1,7 +1,7 @@ ################################################################################# # NxWidgets/UnitTests/CListBox/Makefile # -# Copyright (C) 2012 Gregory Nutt. All rights reserved. +# Copyright (C) 2012-2013 Gregory Nutt. All rights reserved. # Author: Gregory Nutt <gnutt@nuttx.org> # # Redistribution and use in source and binary forms, with or without @@ -142,15 +142,18 @@ else endif $(Q) touch .built -# Standard housekeeping targets +# Register NSH built-in application -.context: ifeq ($(CONFIG_NSH_BUILTIN_APPS),y) +$(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat: $(DEPCONFIG) Makefile $(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main) + +context: $(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat +else +context: endif - $(Q) touch $@ -context: .context +# Standard housekeeping targets .depend: Makefile $(SRCS) $(Q) $(MKDEP) $(ROOTDEPPATH) $(CXX) -- $(CXXFLAGS) -- $(SRCS) >Make.dep @@ -159,6 +162,7 @@ context: .context depend: .depend clean: + $(call DELFILE, $(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat) $(call DELFILE, .built) $(call CLEAN) diff --git a/NxWidgets/UnitTests/CProgressBar/.gitignore b/NxWidgets/UnitTests/CProgressBar/.gitignore index c63935dc8..b14460823 100644 --- a/NxWidgets/UnitTests/CProgressBar/.gitignore +++ b/NxWidgets/UnitTests/CProgressBar/.gitignore @@ -1,14 +1,10 @@ -Make.dep -.context -.depend -.built -*.swp -*.asm -*.rel -*.lst -*.sym -*.adb -*.lib -*.src - - +/Make.dep +/.depend +/.built +/*.asm +/*.rel +/*.lst +/*.sym +/*.adb +/*.lib +/*.src diff --git a/NxWidgets/UnitTests/CProgressBar/Makefile b/NxWidgets/UnitTests/CProgressBar/Makefile index c57b0cf6e..90e09db72 100644 --- a/NxWidgets/UnitTests/CProgressBar/Makefile +++ b/NxWidgets/UnitTests/CProgressBar/Makefile @@ -1,7 +1,7 @@ ################################################################################# # NxWidgets/UnitTests/CProgressBar/Makefile # -# Copyright (C) 2012 Gregory Nutt. All rights reserved. +# Copyright (C) 2012-2013 Gregory Nutt. All rights reserved. # Author: Gregory Nutt <gnutt@nuttx.org> # # Redistribution and use in source and binary forms, with or without @@ -142,15 +142,18 @@ else endif $(Q) touch .built -# Standard housekeeping targets +# Register NSH built-in application -.context: ifeq ($(CONFIG_NSH_BUILTIN_APPS),y) +$(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat: $(DEPCONFIG) Makefile $(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main) + +context: $(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat +else +context: endif - $(Q) touch $@ -context: .context +# Standard housekeeping targets .depend: Makefile $(SRCS) $(Q) $(MKDEP) $(ROOTDEPPATH) $(CXX) -- $(CXXFLAGS) -- $(SRCS) >Make.dep @@ -159,6 +162,7 @@ context: .context depend: .depend clean: + $(call DELFILE, $(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat) $(call DELFILE, .built) $(call CLEAN) diff --git a/NxWidgets/UnitTests/CRadioButton/.gitignore b/NxWidgets/UnitTests/CRadioButton/.gitignore index c63935dc8..b14460823 100644 --- a/NxWidgets/UnitTests/CRadioButton/.gitignore +++ b/NxWidgets/UnitTests/CRadioButton/.gitignore @@ -1,14 +1,10 @@ -Make.dep -.context -.depend -.built -*.swp -*.asm -*.rel -*.lst -*.sym -*.adb -*.lib -*.src - - +/Make.dep +/.depend +/.built +/*.asm +/*.rel +/*.lst +/*.sym +/*.adb +/*.lib +/*.src diff --git a/NxWidgets/UnitTests/CRadioButton/Makefile b/NxWidgets/UnitTests/CRadioButton/Makefile index 1278c8f53..c64cf008c 100644 --- a/NxWidgets/UnitTests/CRadioButton/Makefile +++ b/NxWidgets/UnitTests/CRadioButton/Makefile @@ -1,7 +1,7 @@ ################################################################################# # NxWidgets/UnitTests/CRadioButton/Makefile # -# Copyright (C) 2012 Gregory Nutt. All rights reserved. +# Copyright (C) 2012-2013 Gregory Nutt. All rights reserved. # Author: Gregory Nutt <gnutt@nuttx.org> # # Redistribution and use in source and binary forms, with or without @@ -142,15 +142,18 @@ else endif $(Q) touch .built -# Standard housekeeping targets +# Register NSH built-in application -.context: ifeq ($(CONFIG_NSH_BUILTIN_APPS),y) +$(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat: $(DEPCONFIG) Makefile $(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main) + +context: $(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat +else +context: endif - $(Q) touch $@ -context: .context +# Standard housekeeping targets .depend: Makefile $(SRCS) $(Q) $(MKDEP) $(ROOTDEPPATH) $(CXX) -- $(CXXFLAGS) -- $(SRCS) >Make.dep @@ -159,6 +162,7 @@ context: .context depend: .depend clean: + $(call DELFILE, $(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat) $(call DELFILE, .built) $(call CLEAN) diff --git a/NxWidgets/UnitTests/CScrollbarHorizontal/.gitignore b/NxWidgets/UnitTests/CScrollbarHorizontal/.gitignore index c63935dc8..b14460823 100644 --- a/NxWidgets/UnitTests/CScrollbarHorizontal/.gitignore +++ b/NxWidgets/UnitTests/CScrollbarHorizontal/.gitignore @@ -1,14 +1,10 @@ -Make.dep -.context -.depend -.built -*.swp -*.asm -*.rel -*.lst -*.sym -*.adb -*.lib -*.src - - +/Make.dep +/.depend +/.built +/*.asm +/*.rel +/*.lst +/*.sym +/*.adb +/*.lib +/*.src diff --git a/NxWidgets/UnitTests/CScrollbarHorizontal/Makefile b/NxWidgets/UnitTests/CScrollbarHorizontal/Makefile index c1edc8936..cf7bf3724 100644 --- a/NxWidgets/UnitTests/CScrollbarHorizontal/Makefile +++ b/NxWidgets/UnitTests/CScrollbarHorizontal/Makefile @@ -1,7 +1,7 @@ ################################################################################# # NxWidgets/UnitTests/CScrollbarHorizontal/Makefile # -# Copyright (C) 2012 Gregory Nutt. All rights reserved. +# Copyright (C) 2012-2013 Gregory Nutt. All rights reserved. # Author: Gregory Nutt <gnutt@nuttx.org> # # Redistribution and use in source and binary forms, with or without @@ -142,15 +142,18 @@ else endif $(Q) touch .built -# Standard housekeeping targets +# Register NSH built-in application -.context: ifeq ($(CONFIG_NSH_BUILTIN_APPS),y) +$(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat: $(DEPCONFIG) Makefile $(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main) + +context: $(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat +else +context: endif - $(Q) touch $@ -context: .context +# Standard housekeeping targets .depend: Makefile $(SRCS) @$(MKDEP) $(ROOTDEPPATH) $(CXX) -- $(CXXFLAGS) -- $(SRCS) >Make.dep @@ -159,6 +162,7 @@ context: .context depend: .depend clean: + $(call DELFILE, $(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat) $(call DELFILE, .built) $(call CLEAN) diff --git a/NxWidgets/UnitTests/CScrollbarVertical/.gitignore b/NxWidgets/UnitTests/CScrollbarVertical/.gitignore index c63935dc8..b14460823 100644 --- a/NxWidgets/UnitTests/CScrollbarVertical/.gitignore +++ b/NxWidgets/UnitTests/CScrollbarVertical/.gitignore @@ -1,14 +1,10 @@ -Make.dep -.context -.depend -.built -*.swp -*.asm -*.rel -*.lst -*.sym -*.adb -*.lib -*.src - - +/Make.dep +/.depend +/.built +/*.asm +/*.rel +/*.lst +/*.sym +/*.adb +/*.lib +/*.src diff --git a/NxWidgets/UnitTests/CScrollbarVertical/Makefile b/NxWidgets/UnitTests/CScrollbarVertical/Makefile index e3367e167..39a5d8528 100644 --- a/NxWidgets/UnitTests/CScrollbarVertical/Makefile +++ b/NxWidgets/UnitTests/CScrollbarVertical/Makefile @@ -1,7 +1,7 @@ ################################################################################# # NxWidgets/UnitTests/CScrollbarVertical/Makefile # -# Copyright (C) 2012 Gregory Nutt. All rights reserved. +# Copyright (C) 2012-2013 Gregory Nutt. All rights reserved. # Author: Gregory Nutt <gnutt@nuttx.org> # # Redistribution and use in source and binary forms, with or without @@ -142,15 +142,18 @@ else endif $(Q) touch .built -# Standard housekeeping targets +# Register NSH built-in application -.context: ifeq ($(CONFIG_NSH_BUILTIN_APPS),y) +$(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat: $(DEPCONFIG) Makefile $(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main) + +context: $(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat +else +context: endif - $(Q) touch $@ -context: .context +# Standard housekeeping targets .depend: Makefile $(SRCS) $(Q) $(MKDEP) $(ROOTDEPPATH) $(CXX) -- $(CXXFLAGS) -- $(SRCS) >Make.dep @@ -159,6 +162,7 @@ context: .context depend: .depend clean: + $(call DELFILE, $(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat) $(call DELFILE, .built) $(call CLEAN) diff --git a/NxWidgets/UnitTests/CSliderHorizonal/.gitignore b/NxWidgets/UnitTests/CSliderHorizonal/.gitignore index c63935dc8..b14460823 100644 --- a/NxWidgets/UnitTests/CSliderHorizonal/.gitignore +++ b/NxWidgets/UnitTests/CSliderHorizonal/.gitignore @@ -1,14 +1,10 @@ -Make.dep -.context -.depend -.built -*.swp -*.asm -*.rel -*.lst -*.sym -*.adb -*.lib -*.src - - +/Make.dep +/.depend +/.built +/*.asm +/*.rel +/*.lst +/*.sym +/*.adb +/*.lib +/*.src diff --git a/NxWidgets/UnitTests/CSliderHorizonal/Makefile b/NxWidgets/UnitTests/CSliderHorizonal/Makefile index c739fef96..d824ffe93 100644 --- a/NxWidgets/UnitTests/CSliderHorizonal/Makefile +++ b/NxWidgets/UnitTests/CSliderHorizonal/Makefile @@ -1,7 +1,7 @@ ################################################################################# # NxWidgets/UnitTests/CSliderHorizontal/Makefile # -# Copyright (C) 2012 Gregory Nutt. All rights reserved. +# Copyright (C) 2012-2013 Gregory Nutt. All rights reserved. # Author: Gregory Nutt <gnutt@nuttx.org> # # Redistribution and use in source and binary forms, with or without @@ -142,15 +142,18 @@ else endif $(Q) touch .built -# Standard housekeeping targets +# Register NSH built-in application -.context: ifeq ($(CONFIG_NSH_BUILTIN_APPS),y) +$(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat: $(DEPCONFIG) Makefile $(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main) + +context: $(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat +else +context: endif - $(Q) touch $@ -context: .context +# Standard housekeeping targets .depend: Makefile $(SRCS) $(Q) $(MKDEP) $(ROOTDEPPATH) $(CXX) -- $(CXXFLAGS) -- $(SRCS) >Make.dep @@ -159,6 +162,7 @@ context: .context depend: .depend clean: + $(call DELFILE, $(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat) $(call DELFILE, .built) $(call CLEAN) diff --git a/NxWidgets/UnitTests/CSliderVertical/.gitignore b/NxWidgets/UnitTests/CSliderVertical/.gitignore index c63935dc8..b14460823 100644 --- a/NxWidgets/UnitTests/CSliderVertical/.gitignore +++ b/NxWidgets/UnitTests/CSliderVertical/.gitignore @@ -1,14 +1,10 @@ -Make.dep -.context -.depend -.built -*.swp -*.asm -*.rel -*.lst -*.sym -*.adb -*.lib -*.src - - +/Make.dep +/.depend +/.built +/*.asm +/*.rel +/*.lst +/*.sym +/*.adb +/*.lib +/*.src diff --git a/NxWidgets/UnitTests/CSliderVertical/Makefile b/NxWidgets/UnitTests/CSliderVertical/Makefile index 82f9c6fc6..a0b33a3ac 100644 --- a/NxWidgets/UnitTests/CSliderVertical/Makefile +++ b/NxWidgets/UnitTests/CSliderVertical/Makefile @@ -1,7 +1,7 @@ ################################################################################# # NxWidgets/UnitTests/CSliderVertical/Makefile # -# Copyright (C) 2012 Gregory Nutt. All rights reserved. +# Copyright (C) 2012-2013 Gregory Nutt. All rights reserved. # Author: Gregory Nutt <gnutt@nuttx.org> # # Redistribution and use in source and binary forms, with or without @@ -142,15 +142,18 @@ else endif $(Q) touch .built -# Standard housekeeping targets +# Register NSH built-in application -.context: ifeq ($(CONFIG_NSH_BUILTIN_APPS),y) +$(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat: $(DEPCONFIG) Makefile $(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main) + +context: $(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat +else +context: endif - $(Q) touch $@ -context: .context +# Standard housekeeping targets .depend: Makefile $(SRCS) $(Q) $(MKDEP) $(ROOTDEPPATH) $(CXX) -- $(CXXFLAGS) -- $(SRCS) >Make.dep @@ -159,6 +162,7 @@ context: .context depend: .depend clean: + $(call DELFILE, $(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat) $(call DELFILE, .built) $(call CLEAN) diff --git a/NxWidgets/UnitTests/CTextBox/.gitignore b/NxWidgets/UnitTests/CTextBox/.gitignore index c63935dc8..b14460823 100644 --- a/NxWidgets/UnitTests/CTextBox/.gitignore +++ b/NxWidgets/UnitTests/CTextBox/.gitignore @@ -1,14 +1,10 @@ -Make.dep -.context -.depend -.built -*.swp -*.asm -*.rel -*.lst -*.sym -*.adb -*.lib -*.src - - +/Make.dep +/.depend +/.built +/*.asm +/*.rel +/*.lst +/*.sym +/*.adb +/*.lib +/*.src diff --git a/NxWidgets/UnitTests/CTextBox/Makefile b/NxWidgets/UnitTests/CTextBox/Makefile index ddd16e95a..94cddcc9f 100644 --- a/NxWidgets/UnitTests/CTextBox/Makefile +++ b/NxWidgets/UnitTests/CTextBox/Makefile @@ -1,7 +1,7 @@ ################################################################################# # NxWidgets/UnitTests/CTextBox/Makefile # -# Copyright (C) 2012 Gregory Nutt. All rights reserved. +# Copyright (C) 2012-2013 Gregory Nutt. All rights reserved. # Author: Gregory Nutt <gnutt@nuttx.org> # # Redistribution and use in source and binary forms, with or without @@ -142,15 +142,18 @@ else endif $(Q) touch .built -# Standard housekeeping targets +# Register NSH built-in application -.context: ifeq ($(CONFIG_NSH_BUILTIN_APPS),y) +$(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat: $(DEPCONFIG) Makefile $(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main) + +context: $(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat +else +context: endif - $(Q) touch $@ -context: .context +# Standard housekeeping targets .depend: Makefile $(SRCS) $(Q) $(MKDEP) $(ROOTDEPPATH) $(CXX) -- $(CXXFLAGS) -- $(SRCS) >Make.dep @@ -159,6 +162,7 @@ context: .context depend: .depend clean: + $(call DELFILE, $(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat) $(call DELFILE, .built) $(call CLEAN) diff --git a/NxWidgets/UnitTests/nxwm/.gitignore b/NxWidgets/UnitTests/nxwm/.gitignore index 83d78ed0d..b14460823 100644 --- a/NxWidgets/UnitTests/nxwm/.gitignore +++ b/NxWidgets/UnitTests/nxwm/.gitignore @@ -1,15 +1,10 @@ -Make.dep -.context -.depend -.built -*.swp -*.asm -*.rel -*.lst -*.sym -*.adb -*.lib -*.src - - - +/Make.dep +/.depend +/.built +/*.asm +/*.rel +/*.lst +/*.sym +/*.adb +/*.lib +/*.src diff --git a/NxWidgets/UnitTests/nxwm/Makefile b/NxWidgets/UnitTests/nxwm/Makefile index 76007da1c..1fa22348e 100644 --- a/NxWidgets/UnitTests/nxwm/Makefile +++ b/NxWidgets/UnitTests/nxwm/Makefile @@ -1,7 +1,7 @@ ################################################################################# # NxWidgets/Unitests/nxwm/Makefile # -# Copyright (C) 2012 Gregory Nutt. All rights reserved. +# Copyright (C) 2012-2013 Gregory Nutt. All rights reserved. # Author: Gregory Nutt <gnutt@nuttx.org> # # Redistribution and use in source and binary forms, with or without @@ -172,15 +172,18 @@ else endif $(Q) touch .built -# Standard housekeeping targets +# Register NSH built-in application -.context: ifeq ($(CONFIG_NSH_BUILTIN_APPS),y) +$(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat: $(DEPCONFIG) Makefile $(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main) + +context: $(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat +else +context: endif - $(Q) touch $@ -context: .context +# Standard housekeeping targets .depend: Makefile $(SRCS) $(Q) $(MKDEP) $(ROOTDEPPATH) $(CXX) -- $(CXXFLAGS) -- $(SRCS) >Make.dep @@ -189,10 +192,12 @@ context: .context depend: .depend clean: + $(call DELFILE, $(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat) $(call DELFILE, .built) $(call CLEAN) distclean: clean + $(call DELFILE, $(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat) $(call DELFILE, Make.dep) $(call DELFILE, .depend) diff --git a/NxWidgets/nxwm/.gitignore b/NxWidgets/nxwm/.gitignore index a3a70d2f3..72d6fc847 100644 --- a/NxWidgets/nxwm/.gitignore +++ b/NxWidgets/nxwm/.gitignore @@ -1,2 +1,2 @@ -nxwm-export.zip +/nxwm-export.zip diff --git a/apps/ChangeLog.txt b/apps/ChangeLog.txt index 4680ab194..f8ba10f72 100644 --- a/apps/ChangeLog.txt +++ b/apps/ChangeLog.txt @@ -566,3 +566,9 @@ (2013-5-26). * apps/examples/slcd: This test now sets the SLCD brightness level to the mid-point as part of its initialization (2013-5-27). + * .gitignore: Clean-up of most all .gitignore files: Make scope of + ignore to be only the current directory; Ignore .dSYM files in + directories where .exe's may be build. Also, in Makefiles, + clean .dSYM files in directories where .exe may be built (2013-5-30). + * apps/examples/nrf35l01_term: Add an example application to demo the + nRF24L01 driver. From Laurent Latil (2013-6-1). diff --git a/apps/builtin/.gitignore b/apps/builtin/.gitignore index 09e35ffb1..8ccdce2c1 100644 --- a/apps/builtin/.gitignore +++ b/apps/builtin/.gitignore @@ -4,8 +4,8 @@ /Make.dep /builtin_list.h /builtin_proto.h -*.src -*.obj -*.lst -*.asm -*.sym +/*.src +/*.obj +/*.lst +/*.asm +/*.sym diff --git a/apps/examples/Kconfig b/apps/examples/Kconfig index 57671ac4c..2546fea40 100644 --- a/apps/examples/Kconfig +++ b/apps/examples/Kconfig @@ -25,6 +25,7 @@ source "$APPSDIR/examples/modbus/Kconfig" source "$APPSDIR/examples/mount/Kconfig" source "$APPSDIR/examples/mtdpart/Kconfig" source "$APPSDIR/examples/nettest/Kconfig" +source "$APPSDIR/examples/nrf24l01_term/Kconfig" source "$APPSDIR/examples/nsh/Kconfig" source "$APPSDIR/examples/null/Kconfig" source "$APPSDIR/examples/nx/Kconfig" diff --git a/apps/examples/Make.defs b/apps/examples/Make.defs index bb411d4f8..91fb19788 100644 --- a/apps/examples/Make.defs +++ b/apps/examples/Make.defs @@ -126,6 +126,10 @@ ifeq ($(CONFIG_EXAMPLES_NETTEST),y) CONFIGURED_APPS += examples/nettest endif +ifeq ($(CONFIG_EXAMPLES_NRF24L01TERM),y) +CONFIGURED_APPS += examples/nrf24l01_term +endif + ifeq ($(CONFIG_EXAMPLES_NSH),y) CONFIGURED_APPS += examples/nsh endif diff --git a/apps/examples/Makefile b/apps/examples/Makefile index 906e479ac..4c093e129 100644 --- a/apps/examples/Makefile +++ b/apps/examples/Makefile @@ -39,11 +39,12 @@ SUBDIRS = adc buttons can cdcacm composite cxxtest dhcpd discover elf SUBDIRS += flash_test ftpc ftpd hello helloxx hidkbd igmp json keypadtest -SUBDIRS += lcdrw mm modbus mount mtdpart nettest nsh null nx nxconsole nxffs -SUBDIRS += nxflat nxhello nximage nxlines nxtext ostest pashello pipe poll -SUBDIRS += posix_spawn pwm qencoder relays rgmp romfs sendmail serloop slcd -SUBDIRS += smart smart_test tcpecho telnetd thttpd tiff touchscreen udp uip -SUBDIRS += usbserial usbstorage usbterm watchdog wget wgetjson xmlrpc +SUBDIRS += lcdrw mm modbus mount mtdpart nettest nrf24l01_term nsh null +SUBDIRS += nx nxconsole nxffs nxflat nxhello nximage nxlines nxtext ostest +SUBDIRS += pashello pipe poll posix_spawn pwm qencoder relays rgmp romfs +SUBDIRS += sendmail serloop slcd smart smart_test tcpecho telnetd thttpd tiff +SUBDIRS += touchscreen udp uip usbserial usbstorage usbterm watchdog +SUBDIRS += wget wgetjson xmlrpc # Sub-directories that might need context setup. Directories may need # context setup for a variety of reasons, but the most common is because @@ -59,8 +60,9 @@ CNTXTDIRS = pwm ifeq ($(CONFIG_NSH_BUILTIN_APPS),y) CNTXTDIRS += adc can cdcacm composite cxxtest dhcpd discover flash_test ftpd -CNTXTDIRS += hello helloxx json keypadtestmodbus mtdpart nettest nxlines relays -CNTXTDIRS += qencoder slcd smart_test tcpecho telnetd watchdog wgetjson +CNTXTDIRS += hello helloxx json keypadtestmodbus mtdpart nettest nxlines +CNTXTDIRS += nrf24l01_term relays qencoder slcd smart_test tcpecho telnetd +CNTXTDIRS += watchdog wgetjson endif ifeq ($(CONFIG_EXAMPLES_LCDRW_BUILTIN),y) diff --git a/apps/examples/adc/.gitignore b/apps/examples/adc/.gitignore index c63935dc8..fa1ec7579 100644 --- a/apps/examples/adc/.gitignore +++ b/apps/examples/adc/.gitignore @@ -1,14 +1,11 @@ -Make.dep -.context -.depend -.built -*.swp -*.asm -*.rel -*.lst -*.sym -*.adb -*.lib -*.src - - +/Make.dep +/.depend +/.built +/*.asm +/*.obj +/*.rel +/*.lst +/*.sym +/*.adb +/*.lib +/*.src diff --git a/apps/examples/buttons/.gitignore b/apps/examples/buttons/.gitignore index c63935dc8..105259c49 100644 --- a/apps/examples/buttons/.gitignore +++ b/apps/examples/buttons/.gitignore @@ -1,14 +1,11 @@ -Make.dep -.context -.depend -.built -*.swp -*.asm -*.rel -*.lst -*.sym -*.adb -*.lib -*.src - - +/Make.dep +/.context +/.depend +/.built +/*.asm +/*.rel +/*.lst +/*.sym +/*.adb +/*.lib +/*.src diff --git a/apps/examples/can/.gitignore b/apps/examples/can/.gitignore index 83d78ed0d..fa1ec7579 100644 --- a/apps/examples/can/.gitignore +++ b/apps/examples/can/.gitignore @@ -1,15 +1,11 @@ -Make.dep -.context -.depend -.built -*.swp -*.asm -*.rel -*.lst -*.sym -*.adb -*.lib -*.src - - - +/Make.dep +/.depend +/.built +/*.asm +/*.obj +/*.rel +/*.lst +/*.sym +/*.adb +/*.lib +/*.src diff --git a/apps/examples/cdcacm/.gitignore b/apps/examples/cdcacm/.gitignore index c63935dc8..fa1ec7579 100644 --- a/apps/examples/cdcacm/.gitignore +++ b/apps/examples/cdcacm/.gitignore @@ -1,14 +1,11 @@ -Make.dep -.context -.depend -.built -*.swp -*.asm -*.rel -*.lst -*.sym -*.adb -*.lib -*.src - - +/Make.dep +/.depend +/.built +/*.asm +/*.obj +/*.rel +/*.lst +/*.sym +/*.adb +/*.lib +/*.src diff --git a/apps/examples/composite/.gitignore b/apps/examples/composite/.gitignore index c63935dc8..fa1ec7579 100644 --- a/apps/examples/composite/.gitignore +++ b/apps/examples/composite/.gitignore @@ -1,14 +1,11 @@ -Make.dep -.context -.depend -.built -*.swp -*.asm -*.rel -*.lst -*.sym -*.adb -*.lib -*.src - - +/Make.dep +/.depend +/.built +/*.asm +/*.obj +/*.rel +/*.lst +/*.sym +/*.adb +/*.lib +/*.src diff --git a/apps/examples/cxxtest/.gitignore b/apps/examples/cxxtest/.gitignore index c63935dc8..105259c49 100644 --- a/apps/examples/cxxtest/.gitignore +++ b/apps/examples/cxxtest/.gitignore @@ -1,14 +1,11 @@ -Make.dep -.context -.depend -.built -*.swp -*.asm -*.rel -*.lst -*.sym -*.adb -*.lib -*.src - - +/Make.dep +/.context +/.depend +/.built +/*.asm +/*.rel +/*.lst +/*.sym +/*.adb +/*.lib +/*.src diff --git a/apps/examples/dhcpd/.gitignore b/apps/examples/dhcpd/.gitignore index 535767507..0ca3d1588 100644 --- a/apps/examples/dhcpd/.gitignore +++ b/apps/examples/dhcpd/.gitignore @@ -1,13 +1,12 @@ -Make.dep -.depend -.built -*.swp -*.o1 -*.src -*.asm -*.rel -*.lst -*.sym -*.adb -*.lib - +/Make.dep +/.depend +/.built +/*.o1 +/*.asm +/*.obj +/*.rel +/*.lst +/*.sym +/*.adb +/*.lib +/*.src diff --git a/apps/examples/discover/.gitignore b/apps/examples/discover/.gitignore index 0411211a8..fa1ec7579 100644 --- a/apps/examples/discover/.gitignore +++ b/apps/examples/discover/.gitignore @@ -1,14 +1,11 @@ -Make.dep -.depend -.built -*.swp -*.asm -*.obj -*.rel -*.lst -*.sym -*.adb -*.lib -*.src - - +/Make.dep +/.depend +/.built +/*.asm +/*.obj +/*.rel +/*.lst +/*.sym +/*.adb +/*.lib +/*.src diff --git a/apps/examples/elf/.gitignore b/apps/examples/elf/.gitignore index 9183fe669..4cfc495be 100644 --- a/apps/examples/elf/.gitignore +++ b/apps/examples/elf/.gitignore @@ -1,5 +1,3 @@ -Make.dep -.depend -.built - - +/Make.dep +/.depend +/.built diff --git a/apps/examples/flash_test/.gitignore b/apps/examples/flash_test/.gitignore index b3c606091..fa1ec7579 100644 --- a/apps/examples/flash_test/.gitignore +++ b/apps/examples/flash_test/.gitignore @@ -1,13 +1,11 @@ -Make.dep -.depend -.built -*.swp -*.asm -*.obj -*.rel -*.lst -*.sym -*.adb -*.lib -*.src - +/Make.dep +/.depend +/.built +/*.asm +/*.obj +/*.rel +/*.lst +/*.sym +/*.adb +/*.lib +/*.src diff --git a/apps/examples/ftpc/.gitignore b/apps/examples/ftpc/.gitignore index a86105f2a..fa1ec7579 100644 --- a/apps/examples/ftpc/.gitignore +++ b/apps/examples/ftpc/.gitignore @@ -1,14 +1,11 @@ -Make.dep -.depend -.built -.context -*.swp -*.asm -*.rel -*.lst -*.sym -*.adb -*.lib -*.src - - +/Make.dep +/.depend +/.built +/*.asm +/*.obj +/*.rel +/*.lst +/*.sym +/*.adb +/*.lib +/*.src diff --git a/apps/examples/ftpd/.gitignore b/apps/examples/ftpd/.gitignore index aa1c17e13..fa1ec7579 100644 --- a/apps/examples/ftpd/.gitignore +++ b/apps/examples/ftpd/.gitignore @@ -1,16 +1,11 @@ -Make.dep -.context -.depend -.built -*.swp -*.asm -*.rel -*.lst -*.sym -*.adb -*.lib -*.src - - - - +/Make.dep +/.depend +/.built +/*.asm +/*.obj +/*.rel +/*.lst +/*.sym +/*.adb +/*.lib +/*.src diff --git a/apps/examples/hello/.gitignore b/apps/examples/hello/.gitignore index 4480560f5..fa1ec7579 100644 --- a/apps/examples/hello/.gitignore +++ b/apps/examples/hello/.gitignore @@ -1,13 +1,11 @@ -Make.dep -.depend -.built -*.swp -*.asm -*.rel -*.lst -*.sym -*.adb -*.lib -*.src - - +/Make.dep +/.depend +/.built +/*.asm +/*.obj +/*.rel +/*.lst +/*.sym +/*.adb +/*.lib +/*.src diff --git a/apps/examples/hello/Makefile b/apps/examples/hello/Makefile index c3b9744d7..d5adb86b0 100644 --- a/apps/examples/hello/Makefile +++ b/apps/examples/hello/Makefile @@ -1,7 +1,7 @@ ############################################################################ # apps/examples/hello/Makefile # -# Copyright (C) 2008, 2010-2012 Gregory Nutt. All rights reserved. +# Copyright (C) 2008, 2010-2013 Gregory Nutt. All rights reserved. # Author: Gregory Nutt <gnutt@nuttx.org> # # Redistribution and use in source and binary forms, with or without diff --git a/apps/examples/helloxx/.gitignore b/apps/examples/helloxx/.gitignore index a3d1ef8fb..fa1ec7579 100644 --- a/apps/examples/helloxx/.gitignore +++ b/apps/examples/helloxx/.gitignore @@ -1,17 +1,11 @@ -Make.dep -.context -.depend -.built -*.swp -*.asm -*.rel -*.lst -*.sym -*.adb -*.lib -*.src - - - - - +/Make.dep +/.depend +/.built +/*.asm +/*.obj +/*.rel +/*.lst +/*.sym +/*.adb +/*.lib +/*.src diff --git a/apps/examples/hidkbd/.gitignore b/apps/examples/hidkbd/.gitignore index 7e5919a78..fa1ec7579 100644 --- a/apps/examples/hidkbd/.gitignore +++ b/apps/examples/hidkbd/.gitignore @@ -1,15 +1,11 @@ -Make.dep -.depend -.built -*.swp -*.asm -*.obj -*.rel -*.lst -*.sym -*.adb -*.lib -*.src - - - +/Make.dep +/.depend +/.built +/*.asm +/*.obj +/*.rel +/*.lst +/*.sym +/*.adb +/*.lib +/*.src diff --git a/apps/examples/igmp/.gitignore b/apps/examples/igmp/.gitignore index 5b16d62c9..c2a890874 100644 --- a/apps/examples/igmp/.gitignore +++ b/apps/examples/igmp/.gitignore @@ -1,12 +1,13 @@ -Make.dep -.depend -host -*.swp -*.asm -*.rel -*.lst -*.sym -*.adb -*.lib -*.src - +/Make.dep +/.depend +/.built +/host +/*.asm +/*.obj +/*.rel +/*.lst +/*.sym +/*.adb +/*.lib +/*.src +/*.exe diff --git a/apps/examples/json/.gitignore b/apps/examples/json/.gitignore index 7e5919a78..fa1ec7579 100644 --- a/apps/examples/json/.gitignore +++ b/apps/examples/json/.gitignore @@ -1,15 +1,11 @@ -Make.dep -.depend -.built -*.swp -*.asm -*.obj -*.rel -*.lst -*.sym -*.adb -*.lib -*.src - - - +/Make.dep +/.depend +/.built +/*.asm +/*.obj +/*.rel +/*.lst +/*.sym +/*.adb +/*.lib +/*.src diff --git a/apps/examples/keypadtest/.gitignore b/apps/examples/keypadtest/.gitignore index 0e5a95e62..fa1ec7579 100644 --- a/apps/examples/keypadtest/.gitignore +++ b/apps/examples/keypadtest/.gitignore @@ -1,17 +1,11 @@ -Make.dep -.context -.depend -.built -*.swp -*.asm -*.obj -*.rel -*.lst -*.sym -*.adb -*.lib -*.src - - - - +/Make.dep +/.depend +/.built +/*.asm +/*.obj +/*.rel +/*.lst +/*.sym +/*.adb +/*.lib +/*.src diff --git a/apps/examples/lcdrw/.gitignore b/apps/examples/lcdrw/.gitignore index 83d78ed0d..fa1ec7579 100644 --- a/apps/examples/lcdrw/.gitignore +++ b/apps/examples/lcdrw/.gitignore @@ -1,15 +1,11 @@ -Make.dep -.context -.depend -.built -*.swp -*.asm -*.rel -*.lst -*.sym -*.adb -*.lib -*.src - - - +/Make.dep +/.depend +/.built +/*.asm +/*.obj +/*.rel +/*.lst +/*.sym +/*.adb +/*.lib +/*.src diff --git a/apps/examples/mm/.gitignore b/apps/examples/mm/.gitignore index 56dd2db00..fa1ec7579 100644 --- a/apps/examples/mm/.gitignore +++ b/apps/examples/mm/.gitignore @@ -1,11 +1,11 @@ -Make.dep -.depend -*.swp -*.asm -*.rel -*.lst -*.sym -*.adb -*.lib - - +/Make.dep +/.depend +/.built +/*.asm +/*.obj +/*.rel +/*.lst +/*.sym +/*.adb +/*.lib +/*.src diff --git a/apps/examples/modbus/.gitignore b/apps/examples/modbus/.gitignore index 661e781c7..fa1ec7579 100644 --- a/apps/examples/modbus/.gitignore +++ b/apps/examples/modbus/.gitignore @@ -1,14 +1,11 @@ -Make.dep -.depend -.built -*.swp -*.asm -*.rel -*.lst -*.sym -*.adb -*.lib -*.src - - - +/Make.dep +/.depend +/.built +/*.asm +/*.obj +/*.rel +/*.lst +/*.sym +/*.adb +/*.lib +/*.src diff --git a/apps/examples/mount/.gitignore b/apps/examples/mount/.gitignore index 7c85c7d82..fa1ec7579 100644 --- a/apps/examples/mount/.gitignore +++ b/apps/examples/mount/.gitignore @@ -1,10 +1,11 @@ -Make.dep -.depend -*.swp -*.asm -*.rel -*.lst -*.sym -*.adb -*.lib - +/Make.dep +/.depend +/.built +/*.asm +/*.obj +/*.rel +/*.lst +/*.sym +/*.adb +/*.lib +/*.src diff --git a/apps/examples/mtdpart/.gitignore b/apps/examples/mtdpart/.gitignore index 106e96227..fa1ec7579 100644 --- a/apps/examples/mtdpart/.gitignore +++ b/apps/examples/mtdpart/.gitignore @@ -1,11 +1,11 @@ -Make.dep -.depend -.built -*.swp -*.asm -*.rel -*.lst -*.sym -*.adb -*.lib -*.src +/Make.dep +/.depend +/.built +/*.asm +/*.obj +/*.rel +/*.lst +/*.sym +/*.adb +/*.lib +/*.src diff --git a/apps/examples/nettest/.gitignore b/apps/examples/nettest/.gitignore index d7d85002f..9724db1ef 100644 --- a/apps/examples/nettest/.gitignore +++ b/apps/examples/nettest/.gitignore @@ -1,17 +1,15 @@ -Make.dep -.depend -.built -host -*.swp -*.asm -*.rel -*.lst -*.sym -*.adb -*.lib -*.src -*.exe -*.hobj - - - +/Make.dep +/.depend +/.built +/host +/*.asm +/*.obj +/*.rel +/*.lst +/*.sym +/*.adb +/*.lib +/*.src +/*.hobj +/*.exe +/*.dSYM diff --git a/apps/examples/nettest/Makefile b/apps/examples/nettest/Makefile index c533c9dd5..727773f69 100644 --- a/apps/examples/nettest/Makefile +++ b/apps/examples/nettest/Makefile @@ -135,6 +135,7 @@ clean: $(call DELFILE, *$(HOSTOBJEXT)) $(call DELFILE, $(HOST_BIN)) $(call DELFILE, .built) + $(call DELFILE, *.dSYM) $(call CLEAN) distclean: clean diff --git a/nuttx/drivers/wireless/cc1101/Kconfig b/apps/examples/nrf24l01_term/Kconfig index ae2bf3130..59fff2382 100644 --- a/nuttx/drivers/wireless/cc1101/Kconfig +++ b/apps/examples/nrf24l01_term/Kconfig @@ -2,3 +2,10 @@ # For a description of the syntax of this configuration file, # see misc/tools/kconfig-language.txt. # + +config EXAMPLES_NRF24L01TERM + bool "Basic nRF24L01 terminal" + default n + +if EXAMPLES_NRF24L01TERM +endif diff --git a/apps/examples/nrf24l01_term/Makefile b/apps/examples/nrf24l01_term/Makefile new file mode 100644 index 000000000..cac8f5a6a --- /dev/null +++ b/apps/examples/nrf24l01_term/Makefile @@ -0,0 +1,109 @@ +############################################################################ +# apps/examples/nrf24l01_term/Makefile +# +# Copyright (C) 2013 Gregory Nutt. All rights reserved. +# Author: Laurent Latil <laurent@latil.nom.fr> +# +# 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 + +# Basic nRF24L01+ terminal demonstration + +ASRCS = +CSRCS = nrf24l01_term.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 . + +# built-in application info + +APPNAME = nrf24l01_term +PRIORITY = SCHED_PRIORITY_DEFAULT +STACKSIZE = 2048 + +# Common build + +VPATH = + +all: .built +.PHONY: context clean depend distclean + +$(AOBJS): %$(OBJEXT): %.S + $(call ASSEMBLE, $<, $@) + +$(COBJS): %$(OBJEXT): %.c + $(call COMPILE, $<, $@) + +.built: $(OBJS) + $(call ARCHIVE, $(BIN), $(OBJS)) + @touch .built + +#ifeq ($(CONFIG_EXAMPLES_NXHELLO_BUILTIN),y) +$(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat: $(DEPCONFIG) Makefile + $(call REGISTER,$(APPNAME),$(PRIORITY),$(STACKSIZE),$(APPNAME)_main) + +context: $(BUILTIN_REGISTRY)$(DELIM)$(APPNAME)_main.bdat +#else +#context: +#endif + +.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/nrf24l01_term/nrf24l01_term.c b/apps/examples/nrf24l01_term/nrf24l01_term.c new file mode 100644 index 000000000..24d6a23ae --- /dev/null +++ b/apps/examples/nrf24l01_term/nrf24l01_term.c @@ -0,0 +1,356 @@ +/**************************************************************************** + * examples/nrf24l01_term/nrf24l01_term.c + * + * Copyright (C) 2013 Laurent Latil. All rights reserved. + * Author: Laurent Latil <laurent@latil.nom.fr> + * + * 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 <nuttx/config.h> + +#include <sys/types.h> +#include <sys/stat.h> +#include <sys/ioctl.h> + +#include <unistd.h> +#include <stdint.h> +#include <stdbool.h> +#include <stdio.h> +#include <unistd.h> +#include <string.h> +#include <stdlib.h> +#include <errno.h> +#include <debug.h> +#include <poll.h> +#include <fcntl.h> + +#include <nuttx/wireless/nrf24l01.h> + +#include <apps/readline.h> + +#ifdef CONFIG_DISABLE_POLL +# error The poll interface is required for the nRF24L01 terminal example. You must disable config option DISABLE_POLL. +#endif + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +#define DEV_NAME "/dev/nrf24l01" + +#ifndef STDIN_FILENO +# define STDIN_FILENO 0 +#endif + +#define DEFAULT_RADIOFREQ 2450 + +#define DEFAULT_TXPOWER -6 /* (0, -6, -12, or -18 dBm) */ + +#ifdef CONFIG_WL_NRF24L01_RXSUPPORT +# define N_PFDS 2 /* If RX support is enabled, poll both stdin and the message reception */ +#else +# define N_PFDS 1 /* If RX support is not enabled, we cannot poll the wireless device */ +#endif + +/**************************************************************************** + * Private Types + ****************************************************************************/ + +/**************************************************************************** + * Private Function Prototypes + ****************************************************************************/ + +int wireless_cfg(int fd); + +int wireless_open(void); + +int send_pkt(int wl_fd); + +int read_pkt(int wl_fd); + +void usage(void); + +/**************************************************************************** + * Private Data + ****************************************************************************/ + +static const uint8_t defaultaddr[NRF24L01_MAX_ADDR_LEN] = { 0x01, 0xCA, 0xFE, 0x12, 0x34}; + +char buff[NRF24L01_MAX_PAYLOAD_LEN + 1] = ""; + +/* polled file descr */ + +static struct pollfd pfds[N_PFDS]; + +/**************************************************************************** + * Private Functions + ****************************************************************************/ + +int wireless_cfg(int fd) +{ + int error = 0; + + uint32_t rf = DEFAULT_RADIOFREQ; + int32_t txpow = DEFAULT_TXPOWER; + nrf24l01_datarate_t datarate = RATE_1Mbps; + + nrf24l01_retrcfg_t retrcfg = + { + .count = 5, + .delay = DELAY_1000us + }; + + uint32_t addrwidth = NRF24L01_MAX_ADDR_LEN; + + uint8_t pipes_en = (1 << 0); /* Only pipe #0 is enabled */ + nrf24l01_pipecfg_t pipe0cfg; + nrf24l01_pipecfg_t *pipes_cfg[NRF24L01_PIPE_COUNT] = {&pipe0cfg, 0, 0, 0, 0, 0}; + + nrf24l01_state_t primrxstate; + +#ifdef CONFIG_WL_NRF24L01_RXSUPPORT + primrxstate = ST_RX; +#else + primrxstate = ST_POWER_DOWN; +#endif + + /* Define the pipe #0 parameters (AA enabled, and dynamic payload length) */ + + pipe0cfg.en_aa = true; + pipe0cfg.payload_length = NRF24L01_DYN_LENGTH; + memcpy (pipe0cfg.rx_addr, defaultaddr, NRF24L01_MAX_ADDR_LEN); + + /* Set radio parameters */ + + ioctl(fd, WLIOC_SETRADIOFREQ, (unsigned long)((uint32_t *)&rf)); + ioctl(fd, WLIOC_SETTXPOWER, (unsigned long)((int32_t *)&txpow)); + ioctl(fd, NRF24L01IOC_SETDATARATE, (unsigned long)((nrf24l01_datarate_t *)&datarate)); + ioctl(fd, NRF24L01IOC_SETRETRCFG, (unsigned long)((nrf24l01_retrcfg_t *)&retrcfg)); + + ioctl(fd, NRF24L01IOC_SETADDRWIDTH, (unsigned long)((uint32_t*) &addrwidth)); + ioctl(fd, NRF24L01IOC_SETTXADDR, (unsigned long)((uint8_t *)&defaultaddr)); + + ioctl(fd, NRF24L01IOC_SETPIPESCFG, (unsigned long)((nrf24l01_pipecfg_t **)&pipes_cfg)); + ioctl(fd, NRF24L01IOC_SETPIPESENABLED, (unsigned long)((uint8_t *)&pipes_en)); + + /* Enable receiver */ + + ioctl(fd, NRF24L01IOC_SETSTATE, (unsigned long)((nrf24l01_state_t *)&primrxstate)); + + return error; +} + +int wireless_open(void) +{ + int fd; + + fd = open(DEV_NAME, O_RDWR); + + if (fd < 0) + { + perror("Cannot open nRF24L01 device"); + } + else + { + wireless_cfg(fd); + } + + return fd; +} + +int send_pkt(int wl_fd) +{ + int ret; + int len; + + /* Remove carriage return */ + + len = strlen(buff); + if (len > 0 && buff[len - 1] == '\n') + { + len --; + buff[len] = '\0'; + } + + ret = write(wl_fd, buff, len); + if (ret < 0) + { + perror("Error sending packet"); + return ret; + } + else + { + int retrcount; + + ioctl(wl_fd, NRF24L01IOC_GETLASTXMITCOUNT, (unsigned long)((uint32_t *)&retrcount)); + printf("Packet sent successfully ! (%d retransmitted packets)\n", retrcount); + } + + return OK; +} + +int read_pkt(int wl_fd) +{ + int ret; + uint32_t pipeno; + + ret = read(wl_fd, buff, sizeof(buff)); + if (ret < 0) + { + perror("Error reading packet\n"); + return ret; + } + + if (ret == 0) + { + /* Should not happen ... */ + printf("Packet payload empty !\n"); + return ERROR; + } + + /* Get the recipient pipe # (for demo purpose, as here the receiving pipe can only be pipe #0...) */ + + ioctl(wl_fd, NRF24L01IOC_GETLASTPIPENO, (unsigned long)((uint32_t *)&pipeno)); + + buff[ret] = '\0'; /* end the string */ + printf("Message received : %s (on pipe #%d)\n", buff, pipeno); + + return 0; +} + +void usage(void) +{ + printf("nRF24L01+ wireless terminal demo.\nUsage:\n"); + printf("- Type in any message ( <= 32 char length) to send it to communication peer.\n"); + printf("- Ctrl-C to exit.\n\n"); +} + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +int nrf24l01_term_main(int argc, char *argv[]) +{ + int ret; + bool quit = false; + + int wl_fd; + + wl_fd = wireless_open(); + if (wl_fd < 0) + { + return -1; + } + + usage(); + + pfds[0].fd = STDIN_FILENO; + pfds[0].events = POLLIN; + +#ifdef CONFIG_WL_NRF24L01_RXSUPPORT + pfds[1].fd = wl_fd; + pfds[1].events = POLLIN; +#endif + + while (!quit) + { + ret = poll(pfds, N_PFDS, -1); + if (ret < 0) + { + perror("Error polling console / wireless"); + goto out; + } + + if (pfds[0].revents & POLLIN) + { + char c; + read(STDIN_FILENO, &c, 1); + + if (c < ' ') + { + /* Any non printable char -> exits */ + + quit = true; + } + else + { + printf("Message to send > %c", c); + fflush(stdout); + + /* Prepend the initial character */ + + buff[0] = c; + +#ifndef CONFIG_SYSTEM_READLINE + /* Use fgets if readline utility method is not enabled */ + + if (fgets(&buff[1], sizeof(buff) - 1, stdin) == NULL) + { + printf("ERROR: fgets failed: %d\n", errno); + goto out; + } +#else + ret = readline(&buff[1], sizeof(buff) - 1, stdin, stdout); + + /* Readline normally returns the number of characters read, + * but will return EOF on end of file or if an error occurs. Either + * will cause the session to terminate. + */ + + if (ret == EOF) + { + printf("ERROR: readline failed: %d\n", ret); + goto out; + } +#endif + /* Send content */ + + send_pkt(wl_fd); + } + } + +#ifdef CONFIG_WL_NRF24L01_RXSUPPORT + if (!quit && (pfds[1].revents & POLLIN)) + { + read_pkt(wl_fd); + } +#endif + } + +out: + close(wl_fd); + + printf ("Bye !\n"); + return 0; +} diff --git a/apps/examples/nsh/.gitignore b/apps/examples/nsh/.gitignore index 7e5919a78..fa1ec7579 100644 --- a/apps/examples/nsh/.gitignore +++ b/apps/examples/nsh/.gitignore @@ -1,15 +1,11 @@ -Make.dep -.depend -.built -*.swp -*.asm -*.obj -*.rel -*.lst -*.sym -*.adb -*.lib -*.src - - - +/Make.dep +/.depend +/.built +/*.asm +/*.obj +/*.rel +/*.lst +/*.sym +/*.adb +/*.lib +/*.src diff --git a/apps/examples/null/.gitignore b/apps/examples/null/.gitignore index 83d78ed0d..fa1ec7579 100644 --- a/apps/examples/null/.gitignore +++ b/apps/examples/null/.gitignore @@ -1,15 +1,11 @@ -Make.dep -.context -.depend -.built -*.swp -*.asm -*.rel -*.lst -*.sym -*.adb -*.lib -*.src - - - +/Make.dep +/.depend +/.built +/*.asm +/*.obj +/*.rel +/*.lst +/*.sym +/*.adb +/*.lib +/*.src diff --git a/apps/examples/nx/.gitignore b/apps/examples/nx/.gitignore index c63935dc8..fa1ec7579 100644 --- a/apps/examples/nx/.gitignore +++ b/apps/examples/nx/.gitignore @@ -1,14 +1,11 @@ -Make.dep -.context -.depend -.built -*.swp -*.asm -*.rel -*.lst -*.sym -*.adb -*.lib -*.src - - +/Make.dep +/.depend +/.built +/*.asm +/*.obj +/*.rel +/*.lst +/*.sym +/*.adb +/*.lib +/*.src diff --git a/apps/examples/nxconsole/.gitignore b/apps/examples/nxconsole/.gitignore index c63935dc8..b14460823 100644 --- a/apps/examples/nxconsole/.gitignore +++ b/apps/examples/nxconsole/.gitignore @@ -1,14 +1,10 @@ -Make.dep -.context -.depend -.built -*.swp -*.asm -*.rel -*.lst -*.sym -*.adb -*.lib -*.src - - +/Make.dep +/.depend +/.built +/*.asm +/*.rel +/*.lst +/*.sym +/*.adb +/*.lib +/*.src diff --git a/apps/examples/nxffs/.gitignore b/apps/examples/nxffs/.gitignore index 4480560f5..fa1ec7579 100644 --- a/apps/examples/nxffs/.gitignore +++ b/apps/examples/nxffs/.gitignore @@ -1,13 +1,11 @@ -Make.dep -.depend -.built -*.swp -*.asm -*.rel -*.lst -*.sym -*.adb -*.lib -*.src - - +/Make.dep +/.depend +/.built +/*.asm +/*.obj +/*.rel +/*.lst +/*.sym +/*.adb +/*.lib +/*.src diff --git a/apps/examples/nxflat/.gitignore b/apps/examples/nxflat/.gitignore index 2c7e46637..4cfc495be 100644 --- a/apps/examples/nxflat/.gitignore +++ b/apps/examples/nxflat/.gitignore @@ -1,3 +1,3 @@ -Make.dep -.depend - +/Make.dep +/.depend +/.built diff --git a/apps/examples/nxhello/.gitignore b/apps/examples/nxhello/.gitignore index 0e5a95e62..fa1ec7579 100644 --- a/apps/examples/nxhello/.gitignore +++ b/apps/examples/nxhello/.gitignore @@ -1,17 +1,11 @@ -Make.dep -.context -.depend -.built -*.swp -*.asm -*.obj -*.rel -*.lst -*.sym -*.adb -*.lib -*.src - - - - +/Make.dep +/.depend +/.built +/*.asm +/*.obj +/*.rel +/*.lst +/*.sym +/*.adb +/*.lib +/*.src diff --git a/apps/examples/nximage/.gitignore b/apps/examples/nximage/.gitignore index 5d4d1454b..fa1ec7579 100644 --- a/apps/examples/nximage/.gitignore +++ b/apps/examples/nximage/.gitignore @@ -1,15 +1,11 @@ -Make.dep -.context -.depend -.built -*.swp -*.asm -*.obj -*.rel -*.lst -*.sym -*.adb -*.lib -*.src - - +/Make.dep +/.depend +/.built +/*.asm +/*.obj +/*.rel +/*.lst +/*.sym +/*.adb +/*.lib +/*.src diff --git a/apps/examples/nxlines/.gitignore b/apps/examples/nxlines/.gitignore index ed627822a..fa1ec7579 100644 --- a/apps/examples/nxlines/.gitignore +++ b/apps/examples/nxlines/.gitignore @@ -1,18 +1,11 @@ -Make.dep -.context -.depend -.built -*.swp -*.asm -*.obj -*.rel -*.lst -*.sym -*.adb -*.lib -*.src - - - - - +/Make.dep +/.depend +/.built +/*.asm +/*.obj +/*.rel +/*.lst +/*.sym +/*.adb +/*.lib +/*.src diff --git a/apps/examples/nxtext/.gitignore b/apps/examples/nxtext/.gitignore index 19c9bb173..fa1ec7579 100644 --- a/apps/examples/nxtext/.gitignore +++ b/apps/examples/nxtext/.gitignore @@ -1,16 +1,11 @@ -Make.dep -.context -.depend -.built -*.swp -*.asm -*.obj -*.rel -*.lst -*.sym -*.adb -*.lib -*.src - - - +/Make.dep +/.depend +/.built +/*.asm +/*.obj +/*.rel +/*.lst +/*.sym +/*.adb +/*.lib +/*.src diff --git a/apps/examples/ostest/.gitignore b/apps/examples/ostest/.gitignore index 7e5919a78..fa1ec7579 100644 --- a/apps/examples/ostest/.gitignore +++ b/apps/examples/ostest/.gitignore @@ -1,15 +1,11 @@ -Make.dep -.depend -.built -*.swp -*.asm -*.obj -*.rel -*.lst -*.sym -*.adb -*.lib -*.src - - - +/Make.dep +/.depend +/.built +/*.asm +/*.obj +/*.rel +/*.lst +/*.sym +/*.adb +/*.lib +/*.src diff --git a/apps/examples/pashello/.gitignore b/apps/examples/pashello/.gitignore index e0d993bd1..3e5ec9dcb 100644 --- a/apps/examples/pashello/.gitignore +++ b/apps/examples/pashello/.gitignore @@ -1,14 +1,13 @@ -Make.dep -.depend -.built -*.o -*.o1 -*.swp -*.asm -*.rel -*.lst -*.sym -*.adb -*.lib -*.err - +/Make.dep +/.depend +/.built +/*.o1 +/*.asm +/*.obj +/*.rel +/*.lst +/*.sym +/*.adb +/*.lib +/*.src +/*.err diff --git a/apps/examples/pipe/.gitignore b/apps/examples/pipe/.gitignore index cc7e6de26..fa1ec7579 100644 --- a/apps/examples/pipe/.gitignore +++ b/apps/examples/pipe/.gitignore @@ -1,11 +1,11 @@ -Make.dep -.depend -*.swp -*.asm -*.rel -*.lst -*.sym -*.adb -*.lib -*.src - +/Make.dep +/.depend +/.built +/*.asm +/*.obj +/*.rel +/*.lst +/*.sym +/*.adb +/*.lib +/*.src diff --git a/apps/examples/poll/.gitignore b/apps/examples/poll/.gitignore index b449d7c96..cfcfc3a67 100644 --- a/apps/examples/poll/.gitignore +++ b/apps/examples/poll/.gitignore @@ -1,17 +1,14 @@ -Make.dep -.depend -.built -host -*.swp -*.asm -*.rel -*.lst -*.sym -*.adb -*.lib -*.src -*.exe - - - - +/Make.dep +/.depend +/.built +/host +/*.asm +/*.obj +/*.rel +/*.lst +/*.sym +/*.adb +/*.lib +/*.src +/*.exe +/*.dSYM diff --git a/apps/examples/poll/Makefile b/apps/examples/poll/Makefile index 13173f125..7507e6449 100644 --- a/apps/examples/poll/Makefile +++ b/apps/examples/poll/Makefile @@ -94,5 +94,6 @@ distclean: clean $(call DELFILE, Make.dep) $(call DELFILE, .depend) $(call DELFILE, host$(HOSTEXEEXT)) + $(call DELFILE, *.dSYM) -include Make.dep diff --git a/apps/examples/posix_spawn/.gitignore b/apps/examples/posix_spawn/.gitignore index b9ac6060c..fa1ec7579 100644 --- a/apps/examples/posix_spawn/.gitignore +++ b/apps/examples/posix_spawn/.gitignore @@ -1,6 +1,11 @@ -Make.dep -.depend -.built - - - +/Make.dep +/.depend +/.built +/*.asm +/*.obj +/*.rel +/*.lst +/*.sym +/*.adb +/*.lib +/*.src diff --git a/apps/examples/posix_spawn/filesystem/hello/.gitignore b/apps/examples/posix_spawn/filesystem/hello/.gitignore index f43841e37..993453898 100644 --- a/apps/examples/posix_spawn/filesystem/hello/.gitignore +++ b/apps/examples/posix_spawn/filesystem/hello/.gitignore @@ -1,5 +1,4 @@ -hello -*.exe - - +/hello +/*.exe +/*.dSYM diff --git a/apps/examples/posix_spawn/filesystem/hello/Makefile b/apps/examples/posix_spawn/filesystem/hello/Makefile index 5cd80411b..ac67f84a0 100644 --- a/apps/examples/posix_spawn/filesystem/hello/Makefile +++ b/apps/examples/posix_spawn/filesystem/hello/Makefile @@ -52,6 +52,7 @@ $(BIN): $(OBJS) clean: $(call DELFILE, $(BIN)) + $(call DELFILE, *.dSYM) $(call CLEAN) install: diff --git a/apps/examples/posix_spawn/filesystem/redirect/.gitignore b/apps/examples/posix_spawn/filesystem/redirect/.gitignore index 8267e1d95..b8396c22d 100644 --- a/apps/examples/posix_spawn/filesystem/redirect/.gitignore +++ b/apps/examples/posix_spawn/filesystem/redirect/.gitignore @@ -1,5 +1,4 @@ -redirect -*.exe - - +/redirect +/*.exe +/*.dSYM diff --git a/apps/examples/posix_spawn/filesystem/redirect/Makefile b/apps/examples/posix_spawn/filesystem/redirect/Makefile index e5f5e985c..59aba9a75 100644 --- a/apps/examples/posix_spawn/filesystem/redirect/Makefile +++ b/apps/examples/posix_spawn/filesystem/redirect/Makefile @@ -52,6 +52,7 @@ $(BIN): $(OBJS) clean: $(call DELFILE, $(BIN)) + $(call DELFILE, *.dSYM) $(call CLEAN) install: diff --git a/apps/examples/pwm/.gitignore b/apps/examples/pwm/.gitignore index c63935dc8..fa1ec7579 100644 --- a/apps/examples/pwm/.gitignore +++ b/apps/examples/pwm/.gitignore @@ -1,14 +1,11 @@ -Make.dep -.context -.depend -.built -*.swp -*.asm -*.rel -*.lst -*.sym -*.adb -*.lib -*.src - - +/Make.dep +/.depend +/.built +/*.asm +/*.obj +/*.rel +/*.lst +/*.sym +/*.adb +/*.lib +/*.src diff --git a/apps/examples/qencoder/.gitignore b/apps/examples/qencoder/.gitignore index 83d78ed0d..fa1ec7579 100644 --- a/apps/examples/qencoder/.gitignore +++ b/apps/examples/qencoder/.gitignore @@ -1,15 +1,11 @@ -Make.dep -.context -.depend -.built -*.swp -*.asm -*.rel -*.lst -*.sym -*.adb -*.lib -*.src - - - +/Make.dep +/.depend +/.built +/*.asm +/*.obj +/*.rel +/*.lst +/*.sym +/*.adb +/*.lib +/*.src diff --git a/apps/examples/relays/.gitignore b/apps/examples/relays/.gitignore index 9183fe669..fa1ec7579 100644 --- a/apps/examples/relays/.gitignore +++ b/apps/examples/relays/.gitignore @@ -1,5 +1,11 @@ -Make.dep -.depend -.built - - +/Make.dep +/.depend +/.built +/*.asm +/*.obj +/*.rel +/*.lst +/*.sym +/*.adb +/*.lib +/*.src diff --git a/apps/examples/rgmp/.gitignore b/apps/examples/rgmp/.gitignore index 0e5a95e62..fa1ec7579 100644 --- a/apps/examples/rgmp/.gitignore +++ b/apps/examples/rgmp/.gitignore @@ -1,17 +1,11 @@ -Make.dep -.context -.depend -.built -*.swp -*.asm -*.obj -*.rel -*.lst -*.sym -*.adb -*.lib -*.src - - - - +/Make.dep +/.depend +/.built +/*.asm +/*.obj +/*.rel +/*.lst +/*.sym +/*.adb +/*.lib +/*.src diff --git a/apps/examples/romfs/.gitignore b/apps/examples/romfs/.gitignore index 19025defb..98aca9189 100644 --- a/apps/examples/romfs/.gitignore +++ b/apps/examples/romfs/.gitignore @@ -1,13 +1,13 @@ -Make.dep -.depend -testdir -testdir.img -*.swp -*.asm -*.rel -*.lst -*.sym -*.adb -*.lib -*.src - +/Make.dep +/.depend +/.built +/testdir +/testdir.img +/*.asm +/*.obj +/*.rel +/*.lst +/*.sym +/*.adb +/*.lib +/*.src diff --git a/apps/examples/sendmail/.gitignore b/apps/examples/sendmail/.gitignore index 2c43cdbc9..565aaaa07 100644 --- a/apps/examples/sendmail/.gitignore +++ b/apps/examples/sendmail/.gitignore @@ -1,14 +1,14 @@ -Make.dep -.depend -net -nuttx -*.swp -*.o1 -*.src -*.asm -*.rel -*.lst -*.sym -*.adb -*.lib - +/Make.dep +/.depend +/.built +/net +/nuttx +/*.o1 +/*.asm +/*.obj +/*.rel +/*.lst +/*.sym +/*.adb +/*.lib +/*.src diff --git a/apps/examples/serloop/.gitignore b/apps/examples/serloop/.gitignore index cc7e6de26..fa1ec7579 100644 --- a/apps/examples/serloop/.gitignore +++ b/apps/examples/serloop/.gitignore @@ -1,11 +1,11 @@ -Make.dep -.depend -*.swp -*.asm -*.rel -*.lst -*.sym -*.adb -*.lib -*.src - +/Make.dep +/.depend +/.built +/*.asm +/*.obj +/*.rel +/*.lst +/*.sym +/*.adb +/*.lib +/*.src diff --git a/apps/examples/slcd/.gitignore b/apps/examples/slcd/.gitignore index 4480560f5..fa1ec7579 100644 --- a/apps/examples/slcd/.gitignore +++ b/apps/examples/slcd/.gitignore @@ -1,13 +1,11 @@ -Make.dep -.depend -.built -*.swp -*.asm -*.rel -*.lst -*.sym -*.adb -*.lib -*.src - - +/Make.dep +/.depend +/.built +/*.asm +/*.obj +/*.rel +/*.lst +/*.sym +/*.adb +/*.lib +/*.src diff --git a/apps/examples/smart/.gitignore b/apps/examples/smart/.gitignore index 3c8fd3435..fa1ec7579 100644 --- a/apps/examples/smart/.gitignore +++ b/apps/examples/smart/.gitignore @@ -1,12 +1,11 @@ -Make.dep -.depend -.built -*.swp -*.asm -*.rel -*.lst -*.sym -*.adb -*.lib -*.src - +/Make.dep +/.depend +/.built +/*.asm +/*.obj +/*.rel +/*.lst +/*.sym +/*.adb +/*.lib +/*.src diff --git a/apps/examples/smart_test/.gitignore b/apps/examples/smart_test/.gitignore index b3c606091..fa1ec7579 100644 --- a/apps/examples/smart_test/.gitignore +++ b/apps/examples/smart_test/.gitignore @@ -1,13 +1,11 @@ -Make.dep -.depend -.built -*.swp -*.asm -*.obj -*.rel -*.lst -*.sym -*.adb -*.lib -*.src - +/Make.dep +/.depend +/.built +/*.asm +/*.obj +/*.rel +/*.lst +/*.sym +/*.adb +/*.lib +/*.src diff --git a/apps/examples/tcpecho/.gitignore b/apps/examples/tcpecho/.gitignore new file mode 100644 index 000000000..fa1ec7579 --- /dev/null +++ b/apps/examples/tcpecho/.gitignore @@ -0,0 +1,11 @@ +/Make.dep +/.depend +/.built +/*.asm +/*.obj +/*.rel +/*.lst +/*.sym +/*.adb +/*.lib +/*.src diff --git a/apps/examples/telnetd/.gitignore b/apps/examples/telnetd/.gitignore index 83d78ed0d..fa1ec7579 100644 --- a/apps/examples/telnetd/.gitignore +++ b/apps/examples/telnetd/.gitignore @@ -1,15 +1,11 @@ -Make.dep -.context -.depend -.built -*.swp -*.asm -*.rel -*.lst -*.sym -*.adb -*.lib -*.src - - - +/Make.dep +/.depend +/.built +/*.asm +/*.obj +/*.rel +/*.lst +/*.sym +/*.adb +/*.lib +/*.src diff --git a/apps/examples/thttpd/.gitignore b/apps/examples/thttpd/.gitignore index abda8b18a..fa1ec7579 100644 --- a/apps/examples/thttpd/.gitignore +++ b/apps/examples/thttpd/.gitignore @@ -1,12 +1,11 @@ -Make.dep -.depend -.built -*.swp -*.src -*.asm -*.rel -*.lst -*.sym -*.adb -*.lib - +/Make.dep +/.depend +/.built +/*.asm +/*.obj +/*.rel +/*.lst +/*.sym +/*.adb +/*.lib +/*.src diff --git a/apps/examples/tiff/.gitignore b/apps/examples/tiff/.gitignore index aa1c17e13..fa1ec7579 100644 --- a/apps/examples/tiff/.gitignore +++ b/apps/examples/tiff/.gitignore @@ -1,16 +1,11 @@ -Make.dep -.context -.depend -.built -*.swp -*.asm -*.rel -*.lst -*.sym -*.adb -*.lib -*.src - - - - +/Make.dep +/.depend +/.built +/*.asm +/*.obj +/*.rel +/*.lst +/*.sym +/*.adb +/*.lib +/*.src diff --git a/apps/examples/touchscreen/.gitignore b/apps/examples/touchscreen/.gitignore index c63935dc8..fa1ec7579 100644 --- a/apps/examples/touchscreen/.gitignore +++ b/apps/examples/touchscreen/.gitignore @@ -1,14 +1,11 @@ -Make.dep -.context -.depend -.built -*.swp -*.asm -*.rel -*.lst -*.sym -*.adb -*.lib -*.src - - +/Make.dep +/.depend +/.built +/*.asm +/*.obj +/*.rel +/*.lst +/*.sym +/*.adb +/*.lib +/*.src diff --git a/apps/examples/udp/.gitignore b/apps/examples/udp/.gitignore index 6e516368a..cfcfc3a67 100644 --- a/apps/examples/udp/.gitignore +++ b/apps/examples/udp/.gitignore @@ -1,12 +1,14 @@ -Make.dep -.depend -host -*.swp -*.asm -*.rel -*.lst -*.sym -*.adb -*.lib -*.exe - +/Make.dep +/.depend +/.built +/host +/*.asm +/*.obj +/*.rel +/*.lst +/*.sym +/*.adb +/*.lib +/*.src +/*.exe +/*.dSYM diff --git a/apps/examples/udp/Makefile b/apps/examples/udp/Makefile index 9c35cc94f..118c42307 100644 --- a/apps/examples/udp/Makefile +++ b/apps/examples/udp/Makefile @@ -119,6 +119,7 @@ clean: $(call DELFILE, .built) $(call DELFILE, $(TARG_BIN)) $(call DELFILE, $(HOST_BIN)) + $(call DELFILE, *.dSYM) $(call CLEAN) distclean: clean diff --git a/apps/examples/uip/.gitignore b/apps/examples/uip/.gitignore index 6fdccf7c4..12109c08d 100644 --- a/apps/examples/uip/.gitignore +++ b/apps/examples/uip/.gitignore @@ -1,15 +1,12 @@ -Make.dep -.depend -.built -*.swp -*.src -*.asm -*.obj -*.rel -*.lst -*.sym -*.adb -*.lib -httpd_fsdata.c - - +/Make.dep +/.depend +/.built +/httpd_fsdata.c +/*.asm +/*.obj +/*.rel +/*.lst +/*.sym +/*.adb +/*.lib +/*.src diff --git a/apps/examples/uip/httpd-fs/.gitignore b/apps/examples/uip/httpd-fs/.gitignore index 0e5a95e62..e75e705d4 100644 --- a/apps/examples/uip/httpd-fs/.gitignore +++ b/apps/examples/uip/httpd-fs/.gitignore @@ -1,17 +1,12 @@ -Make.dep -.context -.depend -.built -*.swp -*.asm -*.obj -*.rel -*.lst -*.sym -*.adb -*.lib -*.src - - - - +/Make.dep +/.context +/.depend +/.built +/*.asm +/*.obj +/*.rel +/*.lst +/*.sym +/*.adb +/*.lib +/*.src diff --git a/apps/examples/usbserial/.gitignore b/apps/examples/usbserial/.gitignore index 83d78ed0d..fa1ec7579 100644 --- a/apps/examples/usbserial/.gitignore +++ b/apps/examples/usbserial/.gitignore @@ -1,15 +1,11 @@ -Make.dep -.context -.depend -.built -*.swp -*.asm -*.rel -*.lst -*.sym -*.adb -*.lib -*.src - - - +/Make.dep +/.depend +/.built +/*.asm +/*.obj +/*.rel +/*.lst +/*.sym +/*.adb +/*.lib +/*.src diff --git a/apps/examples/usbstorage/.gitignore b/apps/examples/usbstorage/.gitignore index 8fd56ec99..fa1ec7579 100644 --- a/apps/examples/usbstorage/.gitignore +++ b/apps/examples/usbstorage/.gitignore @@ -1,13 +1,11 @@ -Make.dep -.context -.depend -.built -*.swp -*.asm -*.rel -*.lst -*.sym -*.adb -*.lib -*.src - +/Make.dep +/.depend +/.built +/*.asm +/*.obj +/*.rel +/*.lst +/*.sym +/*.adb +/*.lib +/*.src diff --git a/apps/examples/usbterm/.gitignore b/apps/examples/usbterm/.gitignore index a3d1ef8fb..fa1ec7579 100644 --- a/apps/examples/usbterm/.gitignore +++ b/apps/examples/usbterm/.gitignore @@ -1,17 +1,11 @@ -Make.dep -.context -.depend -.built -*.swp -*.asm -*.rel -*.lst -*.sym -*.adb -*.lib -*.src - - - - - +/Make.dep +/.depend +/.built +/*.asm +/*.obj +/*.rel +/*.lst +/*.sym +/*.adb +/*.lib +/*.src diff --git a/apps/examples/watchdog/.gitignore b/apps/examples/watchdog/.gitignore index 83d78ed0d..fa1ec7579 100644 --- a/apps/examples/watchdog/.gitignore +++ b/apps/examples/watchdog/.gitignore @@ -1,15 +1,11 @@ -Make.dep -.context -.depend -.built -*.swp -*.asm -*.rel -*.lst -*.sym -*.adb -*.lib -*.src - - - +/Make.dep +/.depend +/.built +/*.asm +/*.obj +/*.rel +/*.lst +/*.sym +/*.adb +/*.lib +/*.src diff --git a/apps/examples/wget/.gitignore b/apps/examples/wget/.gitignore index 2c43cdbc9..565aaaa07 100644 --- a/apps/examples/wget/.gitignore +++ b/apps/examples/wget/.gitignore @@ -1,14 +1,14 @@ -Make.dep -.depend -net -nuttx -*.swp -*.o1 -*.src -*.asm -*.rel -*.lst -*.sym -*.adb -*.lib - +/Make.dep +/.depend +/.built +/net +/nuttx +/*.o1 +/*.asm +/*.obj +/*.rel +/*.lst +/*.sym +/*.adb +/*.lib +/*.src diff --git a/apps/examples/wgetjson/.gitignore b/apps/examples/wgetjson/.gitignore index 1856f2b8d..fa1ec7579 100644 --- a/apps/examples/wgetjson/.gitignore +++ b/apps/examples/wgetjson/.gitignore @@ -1,14 +1,11 @@ -Make.dep -.depend -.built -.context -*.swp -*.src -*.asm -*.rel -*.lst -*.sym -*.adb -*.lib - - +/Make.dep +/.depend +/.built +/*.asm +/*.obj +/*.rel +/*.lst +/*.sym +/*.adb +/*.lib +/*.src diff --git a/apps/examples/wgetjson/webserver/.gitignore b/apps/examples/wgetjson/webserver/.gitignore index 0e5a95e62..e75e705d4 100644 --- a/apps/examples/wgetjson/webserver/.gitignore +++ b/apps/examples/wgetjson/webserver/.gitignore @@ -1,17 +1,12 @@ -Make.dep -.context -.depend -.built -*.swp -*.asm -*.obj -*.rel -*.lst -*.sym -*.adb -*.lib -*.src - - - - +/Make.dep +/.context +/.depend +/.built +/*.asm +/*.obj +/*.rel +/*.lst +/*.sym +/*.adb +/*.lib +/*.src diff --git a/apps/examples/wgetjson/webserver/wgetjson/.gitignore b/apps/examples/wgetjson/webserver/wgetjson/.gitignore index 0e5a95e62..e75e705d4 100644 --- a/apps/examples/wgetjson/webserver/wgetjson/.gitignore +++ b/apps/examples/wgetjson/webserver/wgetjson/.gitignore @@ -1,17 +1,12 @@ -Make.dep -.context -.depend -.built -*.swp -*.asm -*.obj -*.rel -*.lst -*.sym -*.adb -*.lib -*.src - - - - +/Make.dep +/.context +/.depend +/.built +/*.asm +/*.obj +/*.rel +/*.lst +/*.sym +/*.adb +/*.lib +/*.src diff --git a/apps/examples/xmlrpc/.gitignore b/apps/examples/xmlrpc/.gitignore index 0411211a8..fa1ec7579 100644 --- a/apps/examples/xmlrpc/.gitignore +++ b/apps/examples/xmlrpc/.gitignore @@ -1,14 +1,11 @@ -Make.dep -.depend -.built -*.swp -*.asm -*.obj -*.rel -*.lst -*.sym -*.adb -*.lib -*.src - - +/Make.dep +/.depend +/.built +/*.asm +/*.obj +/*.rel +/*.lst +/*.sym +/*.adb +/*.lib +/*.src diff --git a/apps/graphics/screenshot/.gitignore b/apps/graphics/screenshot/.gitignore index 8a83b32c9..83bd7b811 100644 --- a/apps/graphics/screenshot/.gitignore +++ b/apps/graphics/screenshot/.gitignore @@ -1,16 +1,11 @@ -Make.dep -.context -.depend -.built -*.swp -*.asm -*.rel -*.lst -*.sym -*.adb -*.lib -*.src -*.obj - - - +/Make.dep +/.depend +/.built +/*.asm +/*.rel +/*.lst +/*.sym +/*.adb +/*.lib +/*.src +/*.obj diff --git a/apps/modbus/.gitignore b/apps/modbus/.gitignore index 9cd322423..f21c854d1 100644 --- a/apps/modbus/.gitignore +++ b/apps/modbus/.gitignore @@ -1,10 +1,6 @@ /.built /.depend /Make.dep -*.src -*.obj -*.lst - - - - +/*.src +/*.obj +/*.lst diff --git a/apps/netutils/dhcpc/.gitignore b/apps/netutils/dhcpc/.gitignore index 96d55364a..f21c854d1 100644 --- a/apps/netutils/dhcpc/.gitignore +++ b/apps/netutils/dhcpc/.gitignore @@ -1,8 +1,6 @@ -.built -.depend -Make.dep -*.src -*.obj -*.lst - - +/.built +/.depend +/Make.dep +/*.src +/*.obj +/*.lst diff --git a/apps/netutils/dhcpd/.gitignore b/apps/netutils/dhcpd/.gitignore index 96d55364a..f21c854d1 100644 --- a/apps/netutils/dhcpd/.gitignore +++ b/apps/netutils/dhcpd/.gitignore @@ -1,8 +1,6 @@ -.built -.depend -Make.dep -*.src -*.obj -*.lst - - +/.built +/.depend +/Make.dep +/*.src +/*.obj +/*.lst diff --git a/apps/netutils/discover/.gitignore b/apps/netutils/discover/.gitignore index 11750ccf4..f21c854d1 100644 --- a/apps/netutils/discover/.gitignore +++ b/apps/netutils/discover/.gitignore @@ -1,5 +1,6 @@ -.built -.depend -Make.dep - - +/.built +/.depend +/Make.dep +/*.src +/*.obj +/*.lst diff --git a/apps/netutils/ftpc/.gitignore b/apps/netutils/ftpc/.gitignore index 6391507a6..f21c854d1 100644 --- a/apps/netutils/ftpc/.gitignore +++ b/apps/netutils/ftpc/.gitignore @@ -1,6 +1,6 @@ -.built -.depend -Make.dep - - - +/.built +/.depend +/Make.dep +/*.src +/*.obj +/*.lst diff --git a/apps/netutils/ftpd/.gitignore b/apps/netutils/ftpd/.gitignore index 6391507a6..f21c854d1 100644 --- a/apps/netutils/ftpd/.gitignore +++ b/apps/netutils/ftpd/.gitignore @@ -1,6 +1,6 @@ -.built -.depend -Make.dep - - - +/.built +/.depend +/Make.dep +/*.src +/*.obj +/*.lst diff --git a/apps/netutils/json/.gitignore b/apps/netutils/json/.gitignore index 3ea345ce7..16db3b336 100644 --- a/apps/netutils/json/.gitignore +++ b/apps/netutils/json/.gitignore @@ -1,7 +1,7 @@ -.built -.depend -Make.dep -cgi-bin - - - +/.built +/.depend +/Make.dep +/cgi-bin +/*.src +/*.obj +/*.lst diff --git a/apps/netutils/resolv/.gitignore b/apps/netutils/resolv/.gitignore index 8c983c76a..f21c854d1 100644 --- a/apps/netutils/resolv/.gitignore +++ b/apps/netutils/resolv/.gitignore @@ -1,9 +1,6 @@ -.built -.depend -Make.dep -*.src -*.obj -*.lst - - - +/.built +/.depend +/Make.dep +/*.src +/*.obj +/*.lst diff --git a/apps/netutils/smtp/.gitignore b/apps/netutils/smtp/.gitignore index 11750ccf4..f21c854d1 100644 --- a/apps/netutils/smtp/.gitignore +++ b/apps/netutils/smtp/.gitignore @@ -1,5 +1,6 @@ -.built -.depend -Make.dep - - +/.built +/.depend +/Make.dep +/*.src +/*.obj +/*.lst diff --git a/apps/netutils/telnetd/.gitignore b/apps/netutils/telnetd/.gitignore index 11750ccf4..f21c854d1 100644 --- a/apps/netutils/telnetd/.gitignore +++ b/apps/netutils/telnetd/.gitignore @@ -1,5 +1,6 @@ -.built -.depend -Make.dep - - +/.built +/.depend +/Make.dep +/*.src +/*.obj +/*.lst diff --git a/apps/netutils/tftpc/.gitignore b/apps/netutils/tftpc/.gitignore index 96d55364a..f21c854d1 100644 --- a/apps/netutils/tftpc/.gitignore +++ b/apps/netutils/tftpc/.gitignore @@ -1,8 +1,6 @@ -.built -.depend -Make.dep -*.src -*.obj -*.lst - - +/.built +/.depend +/Make.dep +/*.src +/*.obj +/*.lst diff --git a/apps/netutils/thttpd/.gitignore b/apps/netutils/thttpd/.gitignore index 9ca958e62..16db3b336 100644 --- a/apps/netutils/thttpd/.gitignore +++ b/apps/netutils/thttpd/.gitignore @@ -1,6 +1,7 @@ -.built -.depend -Make.dep -cgi-bin - - +/.built +/.depend +/Make.dep +/cgi-bin +/*.src +/*.obj +/*.lst diff --git a/apps/netutils/uiplib/.gitignore b/apps/netutils/uiplib/.gitignore index 96d55364a..f21c854d1 100644 --- a/apps/netutils/uiplib/.gitignore +++ b/apps/netutils/uiplib/.gitignore @@ -1,8 +1,6 @@ -.built -.depend -Make.dep -*.src -*.obj -*.lst - - +/.built +/.depend +/Make.dep +/*.src +/*.obj +/*.lst diff --git a/apps/netutils/webclient/.gitignore b/apps/netutils/webclient/.gitignore index 96d55364a..f21c854d1 100644 --- a/apps/netutils/webclient/.gitignore +++ b/apps/netutils/webclient/.gitignore @@ -1,8 +1,6 @@ -.built -.depend -Make.dep -*.src -*.obj -*.lst - - +/.built +/.depend +/Make.dep +/*.src +/*.obj +/*.lst diff --git a/apps/netutils/webserver/.gitignore b/apps/netutils/webserver/.gitignore index 96d55364a..f21c854d1 100644 --- a/apps/netutils/webserver/.gitignore +++ b/apps/netutils/webserver/.gitignore @@ -1,8 +1,6 @@ -.built -.depend -Make.dep -*.src -*.obj -*.lst - - +/.built +/.depend +/Make.dep +/*.src +/*.obj +/*.lst diff --git a/apps/netutils/xmlrpc/.gitignore b/apps/netutils/xmlrpc/.gitignore index 11750ccf4..f21c854d1 100644 --- a/apps/netutils/xmlrpc/.gitignore +++ b/apps/netutils/xmlrpc/.gitignore @@ -1,5 +1,6 @@ -.built -.depend -Make.dep - - +/.built +/.depend +/Make.dep +/*.src +/*.obj +/*.lst diff --git a/apps/nshlib/.gitignore b/apps/nshlib/.gitignore index e629deaf0..f21c854d1 100644 --- a/apps/nshlib/.gitignore +++ b/apps/nshlib/.gitignore @@ -1,6 +1,6 @@ /.built /.depend /Make.dep -*.src -*.obj -*.lst +/*.src +/*.obj +/*.lst diff --git a/apps/nshlib/Kconfig b/apps/nshlib/Kconfig index 72041ec76..ded9f2e67 100644 --- a/apps/nshlib/Kconfig +++ b/apps/nshlib/Kconfig @@ -252,6 +252,13 @@ config NSH_LINELEN The maximum length of one command line and of one output line. Default: 80 +config NSH_MAXARGUMENTS + int "Maximum number of command arguments" + default 6 + ---help--- + The maximum number of NSH command arguments. + Default: 6 + config NSH_NESTDEPTH int "Maximum command nesting" default 3 @@ -354,6 +361,16 @@ config NSH_ROMFSSECTSIZE increased if the ROMFS volume were to be become large. Any value selected must be a power of 2. +config NSH_ARCHROMFS + bool "Architecture-specific ROMFS header" + default n + depends on NSH_ROMFSETC + ---help--- + Enable this option to provide an architecture-specific ROMFS + header at <arch/board/nsh_romfsimg.h>. Note that this header + will be copied from nuttx/configs/<boardname>/include and should + be stored at this location. + config NSH_FATDEVNO int "FAT block device minor number" default 0 diff --git a/apps/system/flash_eraseall/.gitignore b/apps/system/flash_eraseall/.gitignore index 3cb5027c6..83bd7b811 100644 --- a/apps/system/flash_eraseall/.gitignore +++ b/apps/system/flash_eraseall/.gitignore @@ -1,13 +1,11 @@ -Make.dep -.context -.depend -.built -*.swp -*.asm -*.rel -*.lst -*.sym -*.adb -*.lib -*.src -*.obj +/Make.dep +/.depend +/.built +/*.asm +/*.rel +/*.lst +/*.sym +/*.adb +/*.lib +/*.src +/*.obj diff --git a/apps/system/free/.gitignore b/apps/system/free/.gitignore index 83d78ed0d..83bd7b811 100644 --- a/apps/system/free/.gitignore +++ b/apps/system/free/.gitignore @@ -1,15 +1,11 @@ -Make.dep -.context -.depend -.built -*.swp -*.asm -*.rel -*.lst -*.sym -*.adb -*.lib -*.src - - - +/Make.dep +/.depend +/.built +/*.asm +/*.rel +/*.lst +/*.sym +/*.adb +/*.lib +/*.src +/*.obj diff --git a/apps/system/i2c/.gitignore b/apps/system/i2c/.gitignore index 83d78ed0d..83bd7b811 100644 --- a/apps/system/i2c/.gitignore +++ b/apps/system/i2c/.gitignore @@ -1,15 +1,11 @@ -Make.dep -.context -.depend -.built -*.swp -*.asm -*.rel -*.lst -*.sym -*.adb -*.lib -*.src - - - +/Make.dep +/.depend +/.built +/*.asm +/*.rel +/*.lst +/*.sym +/*.adb +/*.lib +/*.src +/*.obj diff --git a/apps/system/install/.gitignore b/apps/system/install/.gitignore index 83d78ed0d..83bd7b811 100644 --- a/apps/system/install/.gitignore +++ b/apps/system/install/.gitignore @@ -1,15 +1,11 @@ -Make.dep -.context -.depend -.built -*.swp -*.asm -*.rel -*.lst -*.sym -*.adb -*.lib -*.src - - - +/Make.dep +/.depend +/.built +/*.asm +/*.rel +/*.lst +/*.sym +/*.adb +/*.lib +/*.src +/*.obj diff --git a/apps/system/poweroff/.gitignore b/apps/system/poweroff/.gitignore index f8e8a0ee1..83bd7b811 100644 --- a/apps/system/poweroff/.gitignore +++ b/apps/system/poweroff/.gitignore @@ -1,6 +1,11 @@ -.built -.context -.depend -Make.dep - - +/Make.dep +/.depend +/.built +/*.asm +/*.rel +/*.lst +/*.sym +/*.adb +/*.lib +/*.src +/*.obj diff --git a/apps/system/ramtest/.gitignore b/apps/system/ramtest/.gitignore index 8a83b32c9..83bd7b811 100644 --- a/apps/system/ramtest/.gitignore +++ b/apps/system/ramtest/.gitignore @@ -1,16 +1,11 @@ -Make.dep -.context -.depend -.built -*.swp -*.asm -*.rel -*.lst -*.sym -*.adb -*.lib -*.src -*.obj - - - +/Make.dep +/.depend +/.built +/*.asm +/*.rel +/*.lst +/*.sym +/*.adb +/*.lib +/*.src +/*.obj diff --git a/apps/system/ramtron/.gitignore b/apps/system/ramtron/.gitignore index f8e8a0ee1..83bd7b811 100644 --- a/apps/system/ramtron/.gitignore +++ b/apps/system/ramtron/.gitignore @@ -1,6 +1,11 @@ -.built -.context -.depend -Make.dep - - +/Make.dep +/.depend +/.built +/*.asm +/*.rel +/*.lst +/*.sym +/*.adb +/*.lib +/*.src +/*.obj diff --git a/apps/system/readline/.gitignore b/apps/system/readline/.gitignore index ccf581ae8..83bd7b811 100644 --- a/apps/system/readline/.gitignore +++ b/apps/system/readline/.gitignore @@ -1,15 +1,11 @@ -Make.dep -.context -.depend -.built -*.swp -*.asm -*.rel -*.lst -*.sym -*.adb -*.lib -*.src -*.obj - - +/Make.dep +/.depend +/.built +/*.asm +/*.rel +/*.lst +/*.sym +/*.adb +/*.lib +/*.src +/*.obj diff --git a/apps/system/sdcard/.gitignore b/apps/system/sdcard/.gitignore index f8e8a0ee1..83bd7b811 100644 --- a/apps/system/sdcard/.gitignore +++ b/apps/system/sdcard/.gitignore @@ -1,6 +1,11 @@ -.built -.context -.depend -Make.dep - - +/Make.dep +/.depend +/.built +/*.asm +/*.rel +/*.lst +/*.sym +/*.adb +/*.lib +/*.src +/*.obj diff --git a/apps/system/sysinfo/.gitignore b/apps/system/sysinfo/.gitignore index 692251682..83bd7b811 100644 --- a/apps/system/sysinfo/.gitignore +++ b/apps/system/sysinfo/.gitignore @@ -1,7 +1,11 @@ -.built -.context -.depend -Make.dep - - - +/Make.dep +/.depend +/.built +/*.asm +/*.rel +/*.lst +/*.sym +/*.adb +/*.lib +/*.src +/*.obj diff --git a/apps/system/usbmonitor/.gitignore b/apps/system/usbmonitor/.gitignore index 8a83b32c9..83bd7b811 100644 --- a/apps/system/usbmonitor/.gitignore +++ b/apps/system/usbmonitor/.gitignore @@ -1,16 +1,11 @@ -Make.dep -.context -.depend -.built -*.swp -*.asm -*.rel -*.lst -*.sym -*.adb -*.lib -*.src -*.obj - - - +/Make.dep +/.depend +/.built +/*.asm +/*.rel +/*.lst +/*.sym +/*.adb +/*.lib +/*.src +/*.obj diff --git a/misc/.gitignore b/misc/.gitignore index 22726a53a..3bc4bedbb 100644 --- a/misc/.gitignore +++ b/misc/.gitignore @@ -1,2 +1 @@ -archives - +/archives diff --git a/misc/buildroot/package/config/.gitignore b/misc/buildroot/package/config/.gitignore index 105f148b5..f49401fc5 100644 --- a/misc/buildroot/package/config/.gitignore +++ b/misc/buildroot/package/config/.gitignore @@ -1,10 +1,8 @@ -lex.zconf.c -lkc_defs.h -zconf.tab.c -zconf.tab.h -conf -mconf -*.exe - - - +/lex.zconf.c +/lkc_defs.h +/zconf.tab.c +/zconf.tab.h +/conf +/mconf +/*.exe +/*.dSYM diff --git a/misc/buildroot/package/config/Makefile b/misc/buildroot/package/config/Makefile index 430138f77..55bef1d06 100644 --- a/misc/buildroot/package/config/Makefile +++ b/misc/buildroot/package/config/Makefile @@ -129,6 +129,6 @@ ncurses: fi clean: - $(RM) *.o *~ core $(TARGETS) $(MCONF_OBJS) $(CONF_OBJS) \ + $(RM) *.o *.dSYM *~ core $(TARGETS) $(MCONF_OBJS) $(CONF_OBJS) \ conf mconf zconf.tab.c zconf.tab.h lex.zconf.c lkc_defs.h diff --git a/misc/buildroot/package/gnuconfig/testsuite/.gitignore b/misc/buildroot/package/gnuconfig/testsuite/.gitignore index 68a63b3b4..810bd4be4 100644 --- a/misc/buildroot/package/gnuconfig/testsuite/.gitignore +++ b/misc/buildroot/package/gnuconfig/testsuite/.gitignore @@ -1,2 +1 @@ -uname - +/uname diff --git a/misc/buildroot/toolchain/nxflat/.gitignore b/misc/buildroot/toolchain/nxflat/.gitignore index 023eec1be..fe1755aa9 100644 --- a/misc/buildroot/toolchain/nxflat/.gitignore +++ b/misc/buildroot/toolchain/nxflat/.gitignore @@ -5,3 +5,5 @@ /mknxflat /readnxflat /*.exe +/*.dSYM + diff --git a/misc/buildroot/toolchain/nxflat/Makefile b/misc/buildroot/toolchain/nxflat/Makefile index 892362708..8707ba0c1 100644 --- a/misc/buildroot/toolchain/nxflat/Makefile +++ b/misc/buildroot/toolchain/nxflat/Makefile @@ -70,5 +70,5 @@ readnxflat: arch $(READNXFLAT_OBJS) arch/libarch.a clean: -$(MAKE) -C arch clean - rm -f *.o $(BIN) arch *.exe *~ .*.swp + rm -f *.o $(BIN) arch *.exe *.dSYM *~ .*.swp diff --git a/misc/pascal/include/.gitignore b/misc/pascal/include/.gitignore index ee1258409..18e58a752 100644 --- a/misc/pascal/include/.gitignore +++ b/misc/pascal/include/.gitignore @@ -1,2 +1 @@ -config.h - +/config.h diff --git a/misc/pascal/tests/src/.gitignore b/misc/pascal/tests/src/.gitignore index b3dcb28d3..6fa0bd343 100644 --- a/misc/pascal/tests/src/.gitignore +++ b/misc/pascal/tests/src/.gitignore @@ -1,5 +1,4 @@ -*.o1 -*.err -*.lst -*.pex - +/*.o1 +/*.err +/*.lst +/*.pex diff --git a/misc/sims/z80sim/src/.gitignore b/misc/sims/z80sim/src/.gitignore index 66c97c0e6..a97f355a7 100644 --- a/misc/sims/z80sim/src/.gitignore +++ b/misc/sims/z80sim/src/.gitignore @@ -1,4 +1,3 @@ -Z80 -z80sim -Z80-081707.zip - +/Z80 +/z80sim +/Z80-081707.zip diff --git a/misc/tools/.gitignore b/misc/tools/.gitignore index 4ed65c2de..e69de29bb 100644 --- a/misc/tools/.gitignore +++ b/misc/tools/.gitignore @@ -1,2 +0,0 @@ -kconfig-frontends-3.3.0-1 - diff --git a/nuttx/ChangeLog b/nuttx/ChangeLog index 50623ef24..72096da5a 100644 --- a/nuttx/ChangeLog +++ b/nuttx/ChangeLog @@ -4828,3 +4828,25 @@ support from Laurent Latil (2013-5-28) * configs/stm32_tiny: Add support for the STM32 Tiny development board based on th STM32 F103C8T6 MCU (2013-5-28). + * arch/arm/src/stm32/stm32_usbdev.c: Fix an error in NULL packet + handling: If the NULL-packet needed flag ever gets set, then + it is not cleared and inifinite NULL packets result. This only + effects the CDC/ACM class and was the cause of the failure of + configs/stm32f3discovery/usbnsh configureation which works great + after this change (2013-5-29). + * drivers/usbdev/cdcacm.c and pl2303.c and include/nuttx/usb/cdcacm.h: + Change the default IN request buffer size from 64 to 96. This will + avoid requests of exactly MAXPACKET size and, hence, avoid so many + NULL packets. Also, fix the OUT request buffers size to exactly + the max packet size. It cannot be any other size (2013-5-29). + * .gitignore: Clean-up of most all .gitignore files: Make scope of + ignore to be only the current directory; Ignore .dSYM files in + directories where .exe's may be build. Also, in Makefiles, + clean .dSYM files in directories where .exe may be built (2013-5-30). + * drivers/wireless/nrf24101.c/.h and include/nuttx/wireless/nrf24101.h: + Add new driver for the wireless nRF24L01+ transceiver. From Laurent + Latil (2013-6-1). + * drivers/wireless/cc1101: Move files in the cc1101 up one directory. + From Laurent Latil (2013-6-1). + * configs/stm32_tiny: Fix nRF24L01+ driver integration for the STM32 + Tiny. From Laurent Latil (2013-6-01). diff --git a/nuttx/Documentation/NuttX.html b/nuttx/Documentation/NuttX.html index 23aa62d37..c8922cf36 100644 --- a/nuttx/Documentation/NuttX.html +++ b/nuttx/Documentation/NuttX.html @@ -8,7 +8,7 @@ <tr align="center" bgcolor="#e4e4e4"> <td> <h1><big><font color="#3c34ec"><i>NuttX RTOS</i></font></big></h1> - <p>Last Updated: May 24, 2013</p> + <p>Last Updated: May 29, 2013</p> </td> </tr> </table> @@ -1577,7 +1577,7 @@ <li><a href="#arm920t">ARM920T</a> (1) </li> <li><a href="#arm926ejs">ARM926EJS</a> (3) </li> <li><a href="#armcortexm0">ARM Cortex-M0/M0+</a> (2)</li> - <li><a href="#armcortexm3">ARM Cortex-M3</a> (18)</li> + <li><a href="#armcortexm3">ARM Cortex-M3</a> (19)</li> <li><a href="#armcortexm4">ARM Cortex-M4</a> (7)</li> </ul> <li>Atmel AVR @@ -1698,6 +1698,7 @@ <li><a href="#str71x">STMicro STR71x</a> <small>(ARM7TDMI)</small></li> <li><a href="#stm32l152">STMicro STM32L152</a> <small>(STM32 L "EnergyLite" Line, ARM Cortex-M3)</small></li> <li><a href="#stm32f100x">STMicro STM32F100x</a> <small>(STM32 F1 "Value Line"Family, ARM Cortex-M3)</small></li> + <li><a href="#stm32f103cx">STMicro STM32F103C4/C8</a> <small>(STM32 F1 "Low- and Medium-Density Line" Family, ARM Cortex-M3)</small></li> <li><a href="#stm32f103x">STMicro STM32F103x</a> <small>(STM32 F1 Family, ARM Cortex-M3)</small></li> <li><a href="#stm32f107x">STMicro STM32F107x</a> <small>(STM32 F1 "Connectivity Line" family, ARM Cortex-M3)</small></li> <li><a href="#stm32f207x">STMicro STM32F207x</a> <small>(STM32 F2 family, ARM Cortex-M3)</small></li> @@ -2321,6 +2322,29 @@ nsh> There is, however, <i>generic</i> support for STM32F100RC boards. </p> </tr> + <li><a href="#stm32f103cx">STMicro STM32F103C48</a> <small>(STM32 F1 "Low- and Medium-Density Line"Family, ARM Cortex-M3)</small></li> +<tr> + <td><br></td> + <td><hr></td> +</tr> +<tr> + <td><br></td> + <td> + <p> + <a name="stm32f103cx"><b>STMicro STM32F103C4/8 (STM32 F1 Low- and Medium-Density Family)</b>.</a> + This port is for "STM32 Tiny" development board. + This board is available from several vendors on the net, and may be sold under different names. + It is based on a STM32 F103C8T6 MCU, and is bundled with a nRF24L01 wireless communication module. + </p> + <ul> + <p> + <b>STATUS:</b> + The basic STM32F103C8 port was released in NuttX version 6.28. + This work was contributed by Laurent Latil. + </p> + </ul> + </td> +</tr> <tr> <td><br></td> <td><hr></td> diff --git a/nuttx/Documentation/README.html b/nuttx/Documentation/README.html index 8605447a4..e82dd2210 100644 --- a/nuttx/Documentation/README.html +++ b/nuttx/Documentation/README.html @@ -203,6 +203,8 @@ | | | `- <a href="http://sourceforge.net/p/nuttx/git/ci/master/tree/nuttx/configs/stm3220g-eval/README.txt"><b><i>README.txt</i></b></a> | | |- stm3240g-eval/ | | | `- <a href="http://sourceforge.net/p/nuttx/git/ci/master/tree/nuttx/configs/stm3240g-eval/README.txt"><b><i>README.txt</i></b></a> + | | |- stm32_tiny/ + | | | `- <a href="http://sourceforge.net/p/nuttx/git/ci/master/tree/nuttx/configs/stm32_tiny/README.txt"><b><i>README.txt</i></b></a> | | |- stm32f100rc_generic/ | | | `- <a href="http://sourceforge.net/p/nuttx/git/ci/master/tree/nuttx/configs/stm32f100rc_generic/README.txt"><b><i>README.txt</i></b></a> | | |- stm32f3discovery/ diff --git a/nuttx/README.txt b/nuttx/README.txt index 1e4f289f0..4b0c742c6 100644 --- a/nuttx/README.txt +++ b/nuttx/README.txt @@ -1131,6 +1131,8 @@ nuttx | | `- README.txt | |- stm3240g-eval/ | | `- README.txt + | |- stm32_tiny/ + | | `- README.txt | |- stm32f100rc_generic/ | | `- README.txt | |- stm32f3discovery/ diff --git a/nuttx/TODO b/nuttx/TODO index 74bf4e78c..b418f2400 100644 --- a/nuttx/TODO +++ b/nuttx/TODO @@ -1,4 +1,4 @@ -NuttX TODO List (Last updated April 10, 2013) +NuttX TODO List (Last updated May 29, 2013) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ This file summarizes known NuttX bugs, limitations, inconsistencies with @@ -16,7 +16,7 @@ nuttx/ (16) Network (net/, drivers/net) (4) USB (drivers/usbdev, drivers/usbhost) (11) 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/) @@ -32,7 +32,7 @@ nuttx/ (0) ARM/LPC43x (arch/arm/src/lpc43xx/) (3) ARM/STR71x (arch/arm/src/str71x/) (3) ARM/LM3S6918 (arch/arm/src/lm/) - (6) 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/) @@ -1023,6 +1023,14 @@ o File system / Generic drivers (fs/, drivers/) Status: Open Priority: Medium + Title : USE VTF TO MANAGE NAMED MESSAGE QUEUES AND NAMED SEMAPHORES + Description: Currently redundant namespace management logic is use for named + message queues and semaphores. Namesphore management should + be consolidated in the VFS. Perhaps in /ipc/mqueue and /ipc/sem. + Status: Open + Priority: Low. Nothing is broken. This is an enhancement that would + improve the OS design and possible reduce some FLASH usage + o Graphics subystem (graphics/) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -1608,21 +1616,6 @@ o ARM/STM32 (arch/arm/src/stm32/) Status: Open Priority: Low - Title: USB DRIVER IN STM32F3DISCVORY usbnsh CONFIGURATION - Description: The USB device driver is not reliable in the - configs/stm32f3discovery/upnsh configuration. When a large - volume of serial data is sent (for example, by entering - 'help' from the NSH command line), the driver hangs. This - looks like an improperly handled output data overrun problem. - - This is a surprising since this same driver has worked with - the STM32 F1 for some time using the Mass Storage driver - which has considerably higher data rates. So this seems to - be some particular issue with the way that the CDC/ACM driver - sends data through the driver. - Status: Open - Priority: Medium High - o AVR (arch/avr) ^^^^^^^^^^^^^^ diff --git a/nuttx/arch/arm/src/.gitignore b/nuttx/arch/arm/src/.gitignore index d9a7dec41..dfdfc9354 100644 --- a/nuttx/arch/arm/src/.gitignore +++ b/nuttx/arch/arm/src/.gitignore @@ -3,4 +3,3 @@ /locked.r /board /chip - diff --git a/nuttx/arch/arm/src/stm32/stm32_usbdev.c b/nuttx/arch/arm/src/stm32/stm32_usbdev.c index ab3967783..d35e707c3 100644 --- a/nuttx/arch/arm/src/stm32/stm32_usbdev.c +++ b/nuttx/arch/arm/src/stm32/stm32_usbdev.c @@ -1253,7 +1253,16 @@ static int stm32_wrrequest(struct stm32_usbdev_s *priv, struct stm32_ep_s *prive #warning "REVISIT: If the EP supports double buffering, then we can do better" - /* Send the next packet */ + /* Either (1) we are committed to sending the null packet (because txnullpkt == 1 + * && nbytes == 0), or (2) we have not yet send the last packet (nbytes > 0). + * In either case, it is appropriate to clearn txnullpkt now. + */ + + privep->txnullpkt = 0; + + /* If we are not sending a NULL packet, then clip the size to maxpacket + * and check if we need to send a following NULL packet. + */ if (nbytes > 0) { @@ -1261,7 +1270,6 @@ static int stm32_wrrequest(struct stm32_usbdev_s *priv, struct stm32_ep_s *prive * the request. */ - privep->txnullpkt = 0; if (nbytes >= privep->ep.maxpacket) { nbytes = privep->ep.maxpacket; diff --git a/nuttx/arch/arm/src/stm32/stm32f20xxx_rcc.c b/nuttx/arch/arm/src/stm32/stm32f20xxx_rcc.c index ac72fb60b..dd796f86c 100644 --- a/nuttx/arch/arm/src/stm32/stm32f20xxx_rcc.c +++ b/nuttx/arch/arm/src/stm32/stm32f20xxx_rcc.c @@ -631,7 +631,7 @@ static void stm32_stdclockconfig(void) /* Enable FLASH prefetch, instruction cache, data cache, and 5 wait states */ -#ifdef STM32_FLASH_PREFETCH +#ifdef CONFIG_STM32_FLASH_PREFETCH regval = (FLASH_ACR_LATENCY_5 | FLASH_ACR_ICEN | FLASH_ACR_DCEN | FLASH_ACR_PRFTEN); #else regval = (FLASH_ACR_LATENCY_5 | FLASH_ACR_ICEN | FLASH_ACR_DCEN); diff --git a/nuttx/arch/arm/src/stm32/stm32f40xxx_rcc.c b/nuttx/arch/arm/src/stm32/stm32f40xxx_rcc.c index fc7fe1697..82757c43f 100644 --- a/nuttx/arch/arm/src/stm32/stm32f40xxx_rcc.c +++ b/nuttx/arch/arm/src/stm32/stm32f40xxx_rcc.c @@ -669,7 +669,7 @@ static void stm32_stdclockconfig(void) /* Enable FLASH prefetch, instruction cache, data cache, and 5 wait states */ -#ifdef STM32_FLASH_PREFETCH +#ifdef CONFIG_STM32_FLASH_PREFETCH regval = (FLASH_ACR_LATENCY_5 | FLASH_ACR_ICEN | FLASH_ACR_DCEN | FLASH_ACR_PRFTEN); #else regval = (FLASH_ACR_LATENCY_5 | FLASH_ACR_ICEN | FLASH_ACR_DCEN); diff --git a/nuttx/arch/avr/src/.gitignore b/nuttx/arch/avr/src/.gitignore index d9a7dec41..dfdfc9354 100644 --- a/nuttx/arch/avr/src/.gitignore +++ b/nuttx/arch/avr/src/.gitignore @@ -3,4 +3,3 @@ /locked.r /board /chip - diff --git a/nuttx/arch/hc/src/.gitignore b/nuttx/arch/hc/src/.gitignore index b5d295dd6..716af76fe 100644 --- a/nuttx/arch/hc/src/.gitignore +++ b/nuttx/arch/hc/src/.gitignore @@ -3,4 +3,3 @@ /board /chip /*.r - diff --git a/nuttx/arch/mips/src/.gitignore b/nuttx/arch/mips/src/.gitignore index 6a1830c0e..8d209f76a 100644 --- a/nuttx/arch/mips/src/.gitignore +++ b/nuttx/arch/mips/src/.gitignore @@ -2,5 +2,3 @@ /Make.dep /board /chip - - diff --git a/nuttx/arch/rgmp/src/.gitignore b/nuttx/arch/rgmp/src/.gitignore index 83210e8c1..8d209f76a 100644 --- a/nuttx/arch/rgmp/src/.gitignore +++ b/nuttx/arch/rgmp/src/.gitignore @@ -2,4 +2,3 @@ /Make.dep /board /chip - diff --git a/nuttx/arch/sh/src/.gitignore b/nuttx/arch/sh/src/.gitignore index 304c001a2..726d936e1 100644 --- a/nuttx/arch/sh/src/.gitignore +++ b/nuttx/arch/sh/src/.gitignore @@ -1,3 +1,2 @@ -.depend -Make.dep - +/.depend +/Make.dep diff --git a/nuttx/arch/sim/src/.gitignore b/nuttx/arch/sim/src/.gitignore index b5b31ec94..ccd150a8e 100644 --- a/nuttx/arch/sim/src/.gitignore +++ b/nuttx/arch/sim/src/.gitignore @@ -6,4 +6,3 @@ /GNU /chip /board - diff --git a/nuttx/arch/x86/src/.gitignore b/nuttx/arch/x86/src/.gitignore index a80d8bd37..b47dbaebb 100644 --- a/nuttx/arch/x86/src/.gitignore +++ b/nuttx/arch/x86/src/.gitignore @@ -2,4 +2,3 @@ /board /.depend /Make.dep - diff --git a/nuttx/arch/z16/src/.gitignore b/nuttx/arch/z16/src/.gitignore index d61ab1f9b..5bfbd0044 100644 --- a/nuttx/arch/z16/src/.gitignore +++ b/nuttx/arch/z16/src/.gitignore @@ -3,9 +3,8 @@ /board /chip /nuttx.linkcmd -*.asm -*.obj -*.lib -*.map -*.lst - +/*.asm +/*.obj +/*.lib +/*.map +/*.lst diff --git a/nuttx/arch/z80/src/.gitignore b/nuttx/arch/z80/src/.gitignore index 22342dd6d..3db121e5a 100644 --- a/nuttx/arch/z80/src/.gitignore +++ b/nuttx/arch/z80/src/.gitignore @@ -4,20 +4,19 @@ /asm_mem.h /board /chip -*.sym -*.asm -*.obj -*.rel -*.lst -*.src -*.adb -*.rst -*.lib -*.lnk -*.map -*.mem -*.ihx -*.hex -*.linkcmd -*.noi - +/*.sym +/*.asm +/*.obj +/*.rel +/*.lst +/*.src +/*.adb +/*.rst +/*.lib +/*.lnk +/*.map +/*.mem +/*.ihx +/*.hex +/*.linkcmd +/*.noi diff --git a/nuttx/binfmt/.gitignore b/nuttx/binfmt/.gitignore index 7eec3e8b0..037fe5ae4 100644 --- a/nuttx/binfmt/.gitignore +++ b/nuttx/binfmt/.gitignore @@ -1,10 +1,10 @@ /Make.dep /.depend -*.src -*.obj -*.asm -*.rel -*.lst -*.sym -*.adb -*.lib +/*.src +/*.obj +/*.asm +/*.rel +/*.lst +/*.sym +/*.adb +/*.lib diff --git a/nuttx/configs/amber/src/.gitignore b/nuttx/configs/amber/src/.gitignore index dd00ad008..726d936e1 100644 --- a/nuttx/configs/amber/src/.gitignore +++ b/nuttx/configs/amber/src/.gitignore @@ -1,5 +1,2 @@ -.depend -Make.dep - - - +/.depend +/Make.dep diff --git a/nuttx/configs/avr32dev1/src/.gitignore b/nuttx/configs/avr32dev1/src/.gitignore index 304c001a2..726d936e1 100644 --- a/nuttx/configs/avr32dev1/src/.gitignore +++ b/nuttx/configs/avr32dev1/src/.gitignore @@ -1,3 +1,2 @@ -.depend -Make.dep - +/.depend +/Make.dep diff --git a/nuttx/configs/c5471evm/src/.gitignore b/nuttx/configs/c5471evm/src/.gitignore index 304c001a2..726d936e1 100644 --- a/nuttx/configs/c5471evm/src/.gitignore +++ b/nuttx/configs/c5471evm/src/.gitignore @@ -1,3 +1,2 @@ -.depend -Make.dep - +/.depend +/Make.dep diff --git a/nuttx/configs/cloudctrl/src/.gitignore b/nuttx/configs/cloudctrl/src/.gitignore new file mode 100644 index 000000000..726d936e1 --- /dev/null +++ b/nuttx/configs/cloudctrl/src/.gitignore @@ -0,0 +1,2 @@ +/.depend +/Make.dep diff --git a/nuttx/configs/compal_e88/src/.gitignore b/nuttx/configs/compal_e88/src/.gitignore index e9b561c4e..726d936e1 100644 --- a/nuttx/configs/compal_e88/src/.gitignore +++ b/nuttx/configs/compal_e88/src/.gitignore @@ -1,4 +1,2 @@ -.depend -Make.dep - - +/.depend +/Make.dep diff --git a/nuttx/configs/compal_e99/src/.gitignore b/nuttx/configs/compal_e99/src/.gitignore index e9b561c4e..726d936e1 100644 --- a/nuttx/configs/compal_e99/src/.gitignore +++ b/nuttx/configs/compal_e99/src/.gitignore @@ -1,4 +1,2 @@ -.depend -Make.dep - - +/.depend +/Make.dep diff --git a/nuttx/configs/demo9s12ne64/src/.gitignore b/nuttx/configs/demo9s12ne64/src/.gitignore index 304c001a2..726d936e1 100644 --- a/nuttx/configs/demo9s12ne64/src/.gitignore +++ b/nuttx/configs/demo9s12ne64/src/.gitignore @@ -1,3 +1,2 @@ -.depend -Make.dep - +/.depend +/Make.dep diff --git a/nuttx/configs/ea3131/src/.gitignore b/nuttx/configs/ea3131/src/.gitignore index 304c001a2..726d936e1 100644 --- a/nuttx/configs/ea3131/src/.gitignore +++ b/nuttx/configs/ea3131/src/.gitignore @@ -1,3 +1,2 @@ -.depend -Make.dep - +/.depend +/Make.dep diff --git a/nuttx/configs/ea3152/src/.gitignore b/nuttx/configs/ea3152/src/.gitignore index e9b561c4e..726d936e1 100644 --- a/nuttx/configs/ea3152/src/.gitignore +++ b/nuttx/configs/ea3152/src/.gitignore @@ -1,4 +1,2 @@ -.depend -Make.dep - - +/.depend +/Make.dep diff --git a/nuttx/configs/eagle100/src/.gitignore b/nuttx/configs/eagle100/src/.gitignore index 304c001a2..726d936e1 100644 --- a/nuttx/configs/eagle100/src/.gitignore +++ b/nuttx/configs/eagle100/src/.gitignore @@ -1,3 +1,2 @@ -.depend -Make.dep - +/.depend +/Make.dep diff --git a/nuttx/configs/ekk-lm3s9b96/src/.gitignore b/nuttx/configs/ekk-lm3s9b96/src/.gitignore index e9c0adee4..726d936e1 100644 --- a/nuttx/configs/ekk-lm3s9b96/src/.gitignore +++ b/nuttx/configs/ekk-lm3s9b96/src/.gitignore @@ -1,4 +1,2 @@ -Make.dep -.depend - - +/.depend +/Make.dep diff --git a/nuttx/configs/ez80f910200kitg/src/.gitignore b/nuttx/configs/ez80f910200kitg/src/.gitignore index 94abcdb86..b268f1933 100644 --- a/nuttx/configs/ez80f910200kitg/src/.gitignore +++ b/nuttx/configs/ez80f910200kitg/src/.gitignore @@ -1,4 +1,4 @@ -Make.dep -.depend -*.obj +/Make.dep +/.depend +/*.obj diff --git a/nuttx/configs/ez80f910200zco/src/.gitignore b/nuttx/configs/ez80f910200zco/src/.gitignore index 94abcdb86..b268f1933 100644 --- a/nuttx/configs/ez80f910200zco/src/.gitignore +++ b/nuttx/configs/ez80f910200zco/src/.gitignore @@ -1,4 +1,4 @@ -Make.dep -.depend -*.obj +/Make.dep +/.depend +/*.obj diff --git a/nuttx/configs/fire-stm32v2/src/.gitignore b/nuttx/configs/fire-stm32v2/src/.gitignore index e9b561c4e..726d936e1 100644 --- a/nuttx/configs/fire-stm32v2/src/.gitignore +++ b/nuttx/configs/fire-stm32v2/src/.gitignore @@ -1,4 +1,2 @@ -.depend -Make.dep - - +/.depend +/Make.dep diff --git a/nuttx/configs/freedom-kl25z/src/.gitignore b/nuttx/configs/freedom-kl25z/src/.gitignore new file mode 100644 index 000000000..726d936e1 --- /dev/null +++ b/nuttx/configs/freedom-kl25z/src/.gitignore @@ -0,0 +1,2 @@ +/.depend +/Make.dep diff --git a/nuttx/configs/hymini-stm32v/src/.gitignore b/nuttx/configs/hymini-stm32v/src/.gitignore new file mode 100644 index 000000000..726d936e1 --- /dev/null +++ b/nuttx/configs/hymini-stm32v/src/.gitignore @@ -0,0 +1,2 @@ +/.depend +/Make.dep diff --git a/nuttx/configs/kwikstik-k40/src/.gitignore b/nuttx/configs/kwikstik-k40/src/.gitignore index dd00ad008..726d936e1 100644 --- a/nuttx/configs/kwikstik-k40/src/.gitignore +++ b/nuttx/configs/kwikstik-k40/src/.gitignore @@ -1,5 +1,2 @@ -.depend -Make.dep - - - +/.depend +/Make.dep diff --git a/nuttx/configs/lincoln60/src/.gitignore b/nuttx/configs/lincoln60/src/.gitignore index e9b561c4e..726d936e1 100644 --- a/nuttx/configs/lincoln60/src/.gitignore +++ b/nuttx/configs/lincoln60/src/.gitignore @@ -1,4 +1,2 @@ -.depend -Make.dep - - +/.depend +/Make.dep diff --git a/nuttx/configs/lm3s6432-s2e/src/.gitignore b/nuttx/configs/lm3s6432-s2e/src/.gitignore index e9c0adee4..726d936e1 100644 --- a/nuttx/configs/lm3s6432-s2e/src/.gitignore +++ b/nuttx/configs/lm3s6432-s2e/src/.gitignore @@ -1,4 +1,2 @@ -Make.dep -.depend - - +/.depend +/Make.dep diff --git a/nuttx/configs/lm3s6965-ek/src/.gitignore b/nuttx/configs/lm3s6965-ek/src/.gitignore index 304c001a2..726d936e1 100644 --- a/nuttx/configs/lm3s6965-ek/src/.gitignore +++ b/nuttx/configs/lm3s6965-ek/src/.gitignore @@ -1,3 +1,2 @@ -.depend -Make.dep - +/.depend +/Make.dep diff --git a/nuttx/configs/lm3s8962-ek/src/.gitignore b/nuttx/configs/lm3s8962-ek/src/.gitignore index 304c001a2..726d936e1 100644 --- a/nuttx/configs/lm3s8962-ek/src/.gitignore +++ b/nuttx/configs/lm3s8962-ek/src/.gitignore @@ -1,3 +1,2 @@ -.depend -Make.dep - +/.depend +/Make.dep diff --git a/nuttx/configs/lm4f120-launchpad/src/.gitignore b/nuttx/configs/lm4f120-launchpad/src/.gitignore index dd00ad008..726d936e1 100644 --- a/nuttx/configs/lm4f120-launchpad/src/.gitignore +++ b/nuttx/configs/lm4f120-launchpad/src/.gitignore @@ -1,5 +1,2 @@ -.depend -Make.dep - - - +/.depend +/Make.dep diff --git a/nuttx/configs/lpc4330-xplorer/src/.gitignore b/nuttx/configs/lpc4330-xplorer/src/.gitignore new file mode 100644 index 000000000..726d936e1 --- /dev/null +++ b/nuttx/configs/lpc4330-xplorer/src/.gitignore @@ -0,0 +1,2 @@ +/.depend +/Make.dep diff --git a/nuttx/configs/lpcxpresso-lpc1768/src/.gitignore b/nuttx/configs/lpcxpresso-lpc1768/src/.gitignore index e9b561c4e..726d936e1 100644 --- a/nuttx/configs/lpcxpresso-lpc1768/src/.gitignore +++ b/nuttx/configs/lpcxpresso-lpc1768/src/.gitignore @@ -1,4 +1,2 @@ -.depend -Make.dep - - +/.depend +/Make.dep diff --git a/nuttx/configs/m68332evb/src/.gitignore b/nuttx/configs/m68332evb/src/.gitignore new file mode 100644 index 000000000..726d936e1 --- /dev/null +++ b/nuttx/configs/m68332evb/src/.gitignore @@ -0,0 +1,2 @@ +/.depend +/Make.dep diff --git a/nuttx/configs/mbed/src/.gitignore b/nuttx/configs/mbed/src/.gitignore index 304c001a2..726d936e1 100644 --- a/nuttx/configs/mbed/src/.gitignore +++ b/nuttx/configs/mbed/src/.gitignore @@ -1,3 +1,2 @@ -.depend -Make.dep - +/.depend +/Make.dep diff --git a/nuttx/configs/mcu123-lpc214x/src/.gitignore b/nuttx/configs/mcu123-lpc214x/src/.gitignore index 304c001a2..726d936e1 100644 --- a/nuttx/configs/mcu123-lpc214x/src/.gitignore +++ b/nuttx/configs/mcu123-lpc214x/src/.gitignore @@ -1,3 +1,2 @@ -.depend -Make.dep - +/.depend +/Make.dep diff --git a/nuttx/configs/micropendous3/src/.gitignore b/nuttx/configs/micropendous3/src/.gitignore index e9b561c4e..726d936e1 100644 --- a/nuttx/configs/micropendous3/src/.gitignore +++ b/nuttx/configs/micropendous3/src/.gitignore @@ -1,4 +1,2 @@ -.depend -Make.dep - - +/.depend +/Make.dep diff --git a/nuttx/configs/mikroe-stm32f4/kernel/.gitignore b/nuttx/configs/mikroe-stm32f4/kernel/.gitignore new file mode 100644 index 000000000..7bacd5aee --- /dev/null +++ b/nuttx/configs/mikroe-stm32f4/kernel/.gitignore @@ -0,0 +1,2 @@ +/nuttx_user.elf + diff --git a/nuttx/configs/mikroe-stm32f4/src/.gitignore b/nuttx/configs/mikroe-stm32f4/src/.gitignore new file mode 100644 index 000000000..726d936e1 --- /dev/null +++ b/nuttx/configs/mikroe-stm32f4/src/.gitignore @@ -0,0 +1,2 @@ +/.depend +/Make.dep diff --git a/nuttx/configs/mikroe-stm32f4/src/up_clockconfig.c b/nuttx/configs/mikroe-stm32f4/src/up_clockconfig.c index 9618cf8dd..3c55bd950 100644 --- a/nuttx/configs/mikroe-stm32f4/src/up_clockconfig.c +++ b/nuttx/configs/mikroe-stm32f4/src/up_clockconfig.c @@ -128,7 +128,7 @@ void stm32_board_clockconfig(void) /* Enable FLASH prefetch, instruction cache, data cache, and 5 wait states */ -#ifdef STM32_FLASH_PREFETCH +#ifdef CONFIG_STM32_FLASH_PREFETCH regval = (FLASH_ACR_LATENCY_5 | FLASH_ACR_ICEN | FLASH_ACR_DCEN | FLASH_ACR_PRFTEN); #else regval = (FLASH_ACR_LATENCY_5 | FLASH_ACR_ICEN | FLASH_ACR_DCEN); diff --git a/nuttx/configs/mirtoo/src/.gitignore b/nuttx/configs/mirtoo/src/.gitignore index dd00ad008..726d936e1 100644 --- a/nuttx/configs/mirtoo/src/.gitignore +++ b/nuttx/configs/mirtoo/src/.gitignore @@ -1,5 +1,2 @@ -.depend -Make.dep - - - +/.depend +/Make.dep diff --git a/nuttx/configs/mx1ads/src/.gitignore b/nuttx/configs/mx1ads/src/.gitignore index 304c001a2..726d936e1 100644 --- a/nuttx/configs/mx1ads/src/.gitignore +++ b/nuttx/configs/mx1ads/src/.gitignore @@ -1,3 +1,2 @@ -.depend -Make.dep - +/.depend +/Make.dep diff --git a/nuttx/configs/ne64badge/src/.gitignore b/nuttx/configs/ne64badge/src/.gitignore index e9b561c4e..726d936e1 100644 --- a/nuttx/configs/ne64badge/src/.gitignore +++ b/nuttx/configs/ne64badge/src/.gitignore @@ -1,4 +1,2 @@ -.depend -Make.dep - - +/.depend +/Make.dep diff --git a/nuttx/configs/ntosd-dm320/src/.gitignore b/nuttx/configs/ntosd-dm320/src/.gitignore index 304c001a2..726d936e1 100644 --- a/nuttx/configs/ntosd-dm320/src/.gitignore +++ b/nuttx/configs/ntosd-dm320/src/.gitignore @@ -1,3 +1,2 @@ -.depend -Make.dep - +/.depend +/Make.dep diff --git a/nuttx/configs/nucleus2g/src/.gitignore b/nuttx/configs/nucleus2g/src/.gitignore index 304c001a2..726d936e1 100644 --- a/nuttx/configs/nucleus2g/src/.gitignore +++ b/nuttx/configs/nucleus2g/src/.gitignore @@ -1,3 +1,2 @@ -.depend -Make.dep - +/.depend +/Make.dep diff --git a/nuttx/configs/nutiny-nuc120/src/.gitignore b/nuttx/configs/nutiny-nuc120/src/.gitignore index e9b561c4e..726d936e1 100644 --- a/nuttx/configs/nutiny-nuc120/src/.gitignore +++ b/nuttx/configs/nutiny-nuc120/src/.gitignore @@ -1,4 +1,2 @@ -.depend -Make.dep - - +/.depend +/Make.dep diff --git a/nuttx/configs/olimex-lpc1766stk/src/.gitignore b/nuttx/configs/olimex-lpc1766stk/src/.gitignore index 304c001a2..726d936e1 100644 --- a/nuttx/configs/olimex-lpc1766stk/src/.gitignore +++ b/nuttx/configs/olimex-lpc1766stk/src/.gitignore @@ -1,3 +1,2 @@ -.depend -Make.dep - +/.depend +/Make.dep diff --git a/nuttx/configs/olimex-lpc2378/src/.gitignore b/nuttx/configs/olimex-lpc2378/src/.gitignore index 304c001a2..726d936e1 100644 --- a/nuttx/configs/olimex-lpc2378/src/.gitignore +++ b/nuttx/configs/olimex-lpc2378/src/.gitignore @@ -1,3 +1,2 @@ -.depend -Make.dep - +/.depend +/Make.dep diff --git a/nuttx/configs/olimex-stm32-p107/src/.gitignore b/nuttx/configs/olimex-stm32-p107/src/.gitignore index e9b561c4e..726d936e1 100644 --- a/nuttx/configs/olimex-stm32-p107/src/.gitignore +++ b/nuttx/configs/olimex-stm32-p107/src/.gitignore @@ -1,4 +1,2 @@ -.depend -Make.dep - - +/.depend +/Make.dep diff --git a/nuttx/configs/olimex-strp711/src/.gitignore b/nuttx/configs/olimex-strp711/src/.gitignore index 304c001a2..726d936e1 100644 --- a/nuttx/configs/olimex-strp711/src/.gitignore +++ b/nuttx/configs/olimex-strp711/src/.gitignore @@ -1,3 +1,2 @@ -.depend -Make.dep - +/.depend +/Make.dep diff --git a/nuttx/configs/open1788/kernel/.gitignore b/nuttx/configs/open1788/kernel/.gitignore index f2f473a41..7bacd5aee 100644 --- a/nuttx/configs/open1788/kernel/.gitignore +++ b/nuttx/configs/open1788/kernel/.gitignore @@ -1,2 +1,2 @@ -nuttx_user.elf +/nuttx_user.elf diff --git a/nuttx/configs/open1788/src/.gitignore b/nuttx/configs/open1788/src/.gitignore index e9b561c4e..726d936e1 100644 --- a/nuttx/configs/open1788/src/.gitignore +++ b/nuttx/configs/open1788/src/.gitignore @@ -1,4 +1,2 @@ -.depend -Make.dep - - +/.depend +/Make.dep diff --git a/nuttx/configs/p112/src/.gitignore b/nuttx/configs/p112/src/.gitignore new file mode 100644 index 000000000..726d936e1 --- /dev/null +++ b/nuttx/configs/p112/src/.gitignore @@ -0,0 +1,2 @@ +/.depend +/Make.dep diff --git a/nuttx/configs/pcblogic-pic32mx/src/.gitignore b/nuttx/configs/pcblogic-pic32mx/src/.gitignore index dd00ad008..726d936e1 100644 --- a/nuttx/configs/pcblogic-pic32mx/src/.gitignore +++ b/nuttx/configs/pcblogic-pic32mx/src/.gitignore @@ -1,5 +1,2 @@ -.depend -Make.dep - - - +/.depend +/Make.dep diff --git a/nuttx/configs/pic32-starterkit/src/.gitignore b/nuttx/configs/pic32-starterkit/src/.gitignore new file mode 100644 index 000000000..726d936e1 --- /dev/null +++ b/nuttx/configs/pic32-starterkit/src/.gitignore @@ -0,0 +1,2 @@ +/.depend +/Make.dep diff --git a/nuttx/configs/pic32mx7mmb/src/.gitignore b/nuttx/configs/pic32mx7mmb/src/.gitignore index e9b561c4e..726d936e1 100644 --- a/nuttx/configs/pic32mx7mmb/src/.gitignore +++ b/nuttx/configs/pic32mx7mmb/src/.gitignore @@ -1,4 +1,2 @@ -.depend -Make.dep - - +/.depend +/Make.dep diff --git a/nuttx/configs/pirelli_dpl10/src/.gitignore b/nuttx/configs/pirelli_dpl10/src/.gitignore index e9b561c4e..726d936e1 100644 --- a/nuttx/configs/pirelli_dpl10/src/.gitignore +++ b/nuttx/configs/pirelli_dpl10/src/.gitignore @@ -1,4 +1,2 @@ -.depend -Make.dep - - +/.depend +/Make.dep diff --git a/nuttx/configs/pjrc-8051/src/.gitignore b/nuttx/configs/pjrc-8051/src/.gitignore index 63526d43f..04b280c8b 100644 --- a/nuttx/configs/pjrc-8051/src/.gitignore +++ b/nuttx/configs/pjrc-8051/src/.gitignore @@ -1,16 +1,15 @@ -Make.dep -.depend -up_mem.h -*.sym -*.asm -*.rel -*.lst -*.adb -*.rst -*.lib -*.lnk -*.map -*.mem -*.ihx -*.hex - +/Make.dep +/.depend +/up_mem.h +/*.sym +/*.asm +/*.rel +/*.lst +/*.adb +/*.rst +/*.lib +/*.lnk +/*.map +/*.mem +/*.ihx +/*.hex diff --git a/nuttx/configs/qemu-i486/src/.gitignore b/nuttx/configs/qemu-i486/src/.gitignore index e9b561c4e..726d936e1 100644 --- a/nuttx/configs/qemu-i486/src/.gitignore +++ b/nuttx/configs/qemu-i486/src/.gitignore @@ -1,4 +1,2 @@ -.depend -Make.dep - - +/.depend +/Make.dep diff --git a/nuttx/configs/sam3u-ek/kernel/.gitignore b/nuttx/configs/sam3u-ek/kernel/.gitignore index f2f473a41..7bacd5aee 100644 --- a/nuttx/configs/sam3u-ek/kernel/.gitignore +++ b/nuttx/configs/sam3u-ek/kernel/.gitignore @@ -1,2 +1,2 @@ -nuttx_user.elf +/nuttx_user.elf diff --git a/nuttx/configs/sam3u-ek/src/.gitignore b/nuttx/configs/sam3u-ek/src/.gitignore index 304c001a2..726d936e1 100644 --- a/nuttx/configs/sam3u-ek/src/.gitignore +++ b/nuttx/configs/sam3u-ek/src/.gitignore @@ -1,3 +1,2 @@ -.depend -Make.dep - +/.depend +/Make.dep diff --git a/nuttx/configs/shenzhou/src/.gitignore b/nuttx/configs/shenzhou/src/.gitignore index e9b561c4e..726d936e1 100644 --- a/nuttx/configs/shenzhou/src/.gitignore +++ b/nuttx/configs/shenzhou/src/.gitignore @@ -1,4 +1,2 @@ -.depend -Make.dep - - +/.depend +/Make.dep diff --git a/nuttx/configs/sim/src/.gitignore b/nuttx/configs/sim/src/.gitignore new file mode 100644 index 000000000..726d936e1 --- /dev/null +++ b/nuttx/configs/sim/src/.gitignore @@ -0,0 +1,2 @@ +/.depend +/Make.dep diff --git a/nuttx/configs/skp16c26/src/.gitignore b/nuttx/configs/skp16c26/src/.gitignore index 304c001a2..726d936e1 100644 --- a/nuttx/configs/skp16c26/src/.gitignore +++ b/nuttx/configs/skp16c26/src/.gitignore @@ -1,3 +1,2 @@ -.depend -Make.dep - +/.depend +/Make.dep diff --git a/nuttx/configs/stm3210e-eval/src/.gitignore b/nuttx/configs/stm3210e-eval/src/.gitignore index 304c001a2..726d936e1 100644 --- a/nuttx/configs/stm3210e-eval/src/.gitignore +++ b/nuttx/configs/stm3210e-eval/src/.gitignore @@ -1,3 +1,2 @@ -.depend -Make.dep - +/.depend +/Make.dep diff --git a/nuttx/configs/stm3220g-eval/src/.gitignore b/nuttx/configs/stm3220g-eval/src/.gitignore new file mode 100644 index 000000000..726d936e1 --- /dev/null +++ b/nuttx/configs/stm3220g-eval/src/.gitignore @@ -0,0 +1,2 @@ +/.depend +/Make.dep diff --git a/nuttx/configs/stm3240g-eval/src/.gitignore b/nuttx/configs/stm3240g-eval/src/.gitignore index e9b561c4e..726d936e1 100644 --- a/nuttx/configs/stm3240g-eval/src/.gitignore +++ b/nuttx/configs/stm3240g-eval/src/.gitignore @@ -1,4 +1,2 @@ -.depend -Make.dep - - +/.depend +/Make.dep diff --git a/nuttx/configs/stm32_tiny/nsh/defconfig b/nuttx/configs/stm32_tiny/nsh/defconfig index 65d96f12e..0536a6a61 100644 --- a/nuttx/configs/stm32_tiny/nsh/defconfig +++ b/nuttx/configs/stm32_tiny/nsh/defconfig @@ -88,15 +88,34 @@ CONFIG_ARCH_HAVE_MPU=y # # ARMV7M Configuration Options # -# CONFIG_ARMV7M_TOOLCHAIN_BUILDROOT is not set +CONFIG_ARMV7M_TOOLCHAIN_BUILDROOT=y # CONFIG_ARMV7M_TOOLCHAIN_CODEREDL is not set # CONFIG_ARMV7M_TOOLCHAIN_CODESOURCERYL is not set -CONFIG_ARMV7M_TOOLCHAIN_GNU_EABI=y -# CONFIG_SERIAL_TERMIOS is not set +# CONFIG_ARMV7M_TOOLCHAIN_GNU_EABI is not set +# CONFIG_ARMV7M_OABI_TOOLCHAIN is not set +CONFIG_SERIAL_TERMIOS=y # # STM32 Configuration Options # +# CONFIG_ARCH_CHIP_STM32L151C6 is not set +# CONFIG_ARCH_CHIP_STM32L151C8 is not set +# CONFIG_ARCH_CHIP_STM32L151CB is not set +# CONFIG_ARCH_CHIP_STM32L151R6 is not set +# CONFIG_ARCH_CHIP_STM32L151R8 is not set +# CONFIG_ARCH_CHIP_STM32L151RB is not set +# CONFIG_ARCH_CHIP_STM32L151V6 is not set +# CONFIG_ARCH_CHIP_STM32L151V8 is not set +# CONFIG_ARCH_CHIP_STM32L151VB is not set +# CONFIG_ARCH_CHIP_STM32L152C6 is not set +# CONFIG_ARCH_CHIP_STM32L152C8 is not set +# CONFIG_ARCH_CHIP_STM32L152CB is not set +# CONFIG_ARCH_CHIP_STM32L152R6 is not set +# CONFIG_ARCH_CHIP_STM32L152R8 is not set +# CONFIG_ARCH_CHIP_STM32L152RB is not set +# CONFIG_ARCH_CHIP_STM32L152V6 is not set +# CONFIG_ARCH_CHIP_STM32L152V8 is not set +# CONFIG_ARCH_CHIP_STM32L152VB is not set # CONFIG_ARCH_CHIP_STM32F100C8 is not set # CONFIG_ARCH_CHIP_STM32F100CB is not set # CONFIG_ARCH_CHIP_STM32F100R8 is not set @@ -109,8 +128,8 @@ CONFIG_ARMV7M_TOOLCHAIN_GNU_EABI=y # CONFIG_ARCH_CHIP_STM32F100VC is not set # CONFIG_ARCH_CHIP_STM32F100VD is not set # CONFIG_ARCH_CHIP_STM32F100VE is not set -CONFIG_ARCH_CHIP_STM32F103C8=y # CONFIG_ARCH_CHIP_STM32F103C4 is not set +CONFIG_ARCH_CHIP_STM32F103C8=y # CONFIG_ARCH_CHIP_STM32F103RET6 is not set # CONFIG_ARCH_CHIP_STM32F103VCT6 is not set # CONFIG_ARCH_CHIP_STM32F103VET6 is not set @@ -142,9 +161,18 @@ CONFIG_ARCH_CHIP_STM32F103C8=y # CONFIG_ARCH_CHIP_STM32F427V is not set # CONFIG_ARCH_CHIP_STM32F427Z is not set # CONFIG_ARCH_CHIP_STM32F427I is not set +# CONFIG_STM32_STM32L15XX is not set +# CONFIG_STM32_ENERGYLITE is not set CONFIG_STM32_STM32F10XX=y +# CONFIG_STM32_VALUELINE is not set +# CONFIG_STM32_CONNECTIVITYLINE is not set CONFIG_STM32_PERFORMANCELINE=y +# CONFIG_STM32_HIGHDENSITY is not set CONFIG_STM32_MEDIUMDENSITY=y +# CONFIG_STM32_LOWDENSITY is not set +# CONFIG_STM32_STM32F20XX is not set +# CONFIG_STM32_STM32F30XX is not set +# CONFIG_STM32_STM32F40XX is not set # CONFIG_STM32_DFU is not set # @@ -162,11 +190,10 @@ CONFIG_STM32_MEDIUMDENSITY=y # CONFIG_STM32_DAC2 is not set # CONFIG_STM32_I2C1 is not set # CONFIG_STM32_I2C2 is not set -# CONFIG_STM32_IWDG is not set # CONFIG_STM32_PWR is not set # CONFIG_STM32_SDIO is not set # CONFIG_STM32_SPI1 is not set -# CONFIG_STM32_SPI2 is not set +CONFIG_STM32_SPI2=y # CONFIG_STM32_TIM1 is not set # CONFIG_STM32_TIM2 is not set # CONFIG_STM32_TIM3 is not set @@ -181,19 +208,19 @@ CONFIG_STM32_USART1=y # CONFIG_STM32_UART4 is not set # CONFIG_STM32_UART5 is not set # CONFIG_STM32_USB is not set +# CONFIG_STM32_IWDG is not set # CONFIG_STM32_WWDG is not set +CONFIG_STM32_SPI=y # # Alternate Pin Mapping # -# CONFIG_STM32_TIM3_NO_REMAP is not set -# CONFIG_STM32_TIM3_FULL_REMAP is not set -# CONFIG_STM32_TIM3_PARTIAL_REMAP is not set # CONFIG_STM32_USART1_REMAP 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_DISABLE_IDLE_SLEEP_DURING_DEBUG=y # CONFIG_STM32_FORCEPOWER is not set # CONFIG_ARCH_BOARD_STM32_CUSTOM_CLOCKCONFIG is not set CONFIG_STM32_USART=y @@ -205,6 +232,12 @@ CONFIG_STM32_USART=y # CONFIG_STM32_USART_SINGLEWIRE is not set # +# SPI Configuration +# +# CONFIG_STM32_SPI_INTERRUPTS is not set +# CONFIG_STM32_SPI_DMA is not set + +# # USB Host Configuration # @@ -293,13 +326,7 @@ CONFIG_SCHED_WAITPID=y # 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_ENVIRON is not set +# CONFIG_DISABLE_OS_API is not set # # Signal Numbers @@ -308,6 +335,7 @@ CONFIG_SIG_SIGUSR1=1 CONFIG_SIG_SIGUSR2=2 CONFIG_SIG_SIGALARM=3 CONFIG_SIG_SIGCONDTIMEDOUT=16 +CONFIG_SIG_SIGWORK=17 # # Sizes of configurable things (0 disables) @@ -335,7 +363,7 @@ CONFIG_PTHREAD_STACK_DEFAULT=2048 # # Device Drivers # -CONFIG_DISABLE_POLL=y +# CONFIG_DISABLE_POLL is not set CONFIG_DEV_NULL=y # CONFIG_DEV_ZERO is not set # CONFIG_LOOP is not set @@ -344,10 +372,14 @@ CONFIG_DEV_NULL=y # CONFIG_PWM is not set # CONFIG_I2C is not set CONFIG_ARCH_HAVE_I2CRESET=y -# CONFIG_SPI is not set +CONFIG_SPI=y +CONFIG_SPI_OWNBUS=y +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 +# CONFIG_AUDIO_DEVICES is not set # CONFIG_BCH is not set # CONFIG_INPUT is not set # CONFIG_LCD is not set @@ -357,13 +389,13 @@ CONFIG_ARCH_HAVE_I2CRESET=y # 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_USART1=y CONFIG_MCU_SERIAL=y CONFIG_STANDARD_SERIAL=y +CONFIG_SERIAL_NPOLLWAITERS=2 CONFIG_USART1_SERIAL_CONSOLE=y # CONFIG_NO_SERIAL_CONSOLE is not set @@ -378,7 +410,13 @@ CONFIG_USART1_PARITY=0 CONFIG_USART1_2STOP=0 # CONFIG_USBDEV is not set # CONFIG_USBHOST is not set -# CONFIG_WIRELESS is not set +CONFIG_WIRELESS=y +# CONFIG_WL_CC1101 is not set +CONFIG_WL_NRF24L01=y +CONFIG_WL_NRF24L01_DFLT_ADDR_WIDTH=5 +CONFIG_WL_NRF24L01_CHECK_PARAMS=y +CONFIG_WL_NRF24L01_RXSUPPORT=y +CONFIG_WL_NRF24L01_RXFIFO_LEN=128 # # System Logging Device Options @@ -406,6 +444,7 @@ CONFIG_USART1_2STOP=0 # CONFIG_FS_FAT is not set # CONFIG_FS_NXFFS is not set # CONFIG_FS_ROMFS is not set +# CONFIG_FS_SMARTFS is not set # CONFIG_FS_BINFS is not set # @@ -428,6 +467,11 @@ CONFIG_MM_REGIONS=1 # CONFIG_GRAN is not set # +# Audio Support +# +# CONFIG_AUDIO is not set + +# # Binary Formats # # CONFIG_BINFMT_DISABLE is not set @@ -452,6 +496,7 @@ CONFIG_LIB_HOMEDIR="/" # CONFIG_LIBM is not set # CONFIG_NOPRINTF_FIELDWIDTH is not set # CONFIG_LIBC_FLOATINGPOINT is not set +CONFIG_LIB_RAND_ORDER=1 # CONFIG_EOL_IS_CR is not set # CONFIG_EOL_IS_LF is not set # CONFIG_EOL_IS_BOTH_CRLF is not set @@ -469,8 +514,14 @@ CONFIG_LIB_SENDFILE_BUFSIZE=512 # # Non-standard Library Support # -# CONFIG_SCHED_WORKQUEUE is not set +CONFIG_SCHED_WORKQUEUE=y +CONFIG_SCHED_HPWORK=y +CONFIG_SCHED_WORKPRIORITY=192 +CONFIG_SCHED_WORKPERIOD=50000 +CONFIG_SCHED_WORKSTACKSIZE=2048 +# CONFIG_SCHED_LPWORK is not set # CONFIG_LIB_KBDCODEC is not set +# CONFIG_LIB_SLCDCODEC is not set # # Basic CXX Support @@ -505,8 +556,9 @@ CONFIG_BUILTIN_PROXY_STACKSIZE=1024 # 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_MOUNT is not set +CONFIG_EXAMPLES_NRF24L01TERM=y CONFIG_EXAMPLES_NSH=y # CONFIG_EXAMPLES_NULL is not set # CONFIG_EXAMPLES_NX is not set @@ -526,6 +578,10 @@ CONFIG_EXAMPLES_NSH=y # CONFIG_EXAMPLES_ROMFS is not set # CONFIG_EXAMPLES_SENDMAIL is not set # CONFIG_EXAMPLES_SERLOOP is not set +# CONFIG_EXAMPLES_SLCD is not set +# CONFIG_EXAMPLES_SMART_TEST is not set +# CONFIG_EXAMPLES_SMART is not set +# CONFIG_EXAMPLES_TCPECHO is not set # CONFIG_EXAMPLES_TELNETD is not set # CONFIG_EXAMPLES_THTTPD is not set # CONFIG_EXAMPLES_TIFF is not set @@ -622,6 +678,11 @@ CONFIG_NSH_DISABLE_LOSETUP=y # CONFIG_NSH_DISABLE_USLEEP is not set # CONFIG_NSH_DISABLE_WGET is not set # CONFIG_NSH_DISABLE_XD is not set + +# +# Configure Command Options +# +# CONFIG_NSH_CMDOPT_DF_H is not set CONFIG_NSH_CODECS_BUFSIZE=128 CONFIG_NSH_FILEIOSIZE=1024 CONFIG_NSH_LINELEN=80 @@ -634,7 +695,7 @@ CONFIG_NSH_CONSOLE=y # USB Trace Support # # CONFIG_NSH_CONDEV is not set -# CONFIG_NSH_ARCHINIT is not set +CONFIG_NSH_ARCHINIT=y # # NxWidgets/NxWM @@ -659,9 +720,8 @@ CONFIG_NSH_CONSOLE=y # CONFIG_SYSTEM_INSTALL is not set # -# RAM Test +# FLASH Erase-all Command # -# CONFIG_SYSTEM_RAMTEST is not set # # readline() diff --git a/nuttx/configs/stm32_tiny/src/.gitignore b/nuttx/configs/stm32_tiny/src/.gitignore new file mode 100644 index 000000000..726d936e1 --- /dev/null +++ b/nuttx/configs/stm32_tiny/src/.gitignore @@ -0,0 +1,2 @@ +/.depend +/Make.dep diff --git a/nuttx/configs/stm32_tiny/src/up_wireless.c b/nuttx/configs/stm32_tiny/src/up_wireless.c index 6a03ae1f5..7e0c9f5bf 100644 --- a/nuttx/configs/stm32_tiny/src/up_wireless.c +++ b/nuttx/configs/stm32_tiny/src/up_wireless.c @@ -59,8 +59,6 @@ static int stm32tiny_wl_irq_attach(xcpt_t isr); -static void stm32tiny_wl_irq_enable(bool enable); - static void stm32tiny_wl_chip_enable(bool enable); /************************************************************************************ @@ -70,7 +68,6 @@ static void stm32tiny_wl_chip_enable(bool enable); static FAR struct nrf24l01_config_s nrf_cfg = { .irqattach = stm32tiny_wl_irq_attach, - .irqenable = stm32tiny_wl_irq_enable, .chipenable = stm32tiny_wl_chip_enable, }; @@ -82,19 +79,12 @@ static xcpt_t g_isr; static int stm32tiny_wl_irq_attach(xcpt_t isr) { - vdbg("IRQ attached\n"); - + vdbg("Attach IRQ\n"); g_isr = isr; stm32_gpiosetevent(GPIO_NRF24L01_IRQ, false, true, false, g_isr); return OK; } -static void stm32tiny_wl_irq_enable(bool enable) -{ - vdbg("IRQ_enabled:%d\n", enable); - stm32_gpiosetevent(GPIO_NRF24L01_IRQ, false, true, false, enable? g_isr:NULL); -} - static void stm32tiny_wl_chip_enable(bool enable) { vdbg("CE:%d\n", enable); diff --git a/nuttx/configs/stm32f100rc_generic/src/.gitignore b/nuttx/configs/stm32f100rc_generic/src/.gitignore new file mode 100644 index 000000000..726d936e1 --- /dev/null +++ b/nuttx/configs/stm32f100rc_generic/src/.gitignore @@ -0,0 +1,2 @@ +/.depend +/Make.dep diff --git a/nuttx/configs/stm32f3discovery/README.txt b/nuttx/configs/stm32f3discovery/README.txt index 82d5efd1e..8477b797e 100644 --- a/nuttx/configs/stm32f3discovery/README.txt +++ b/nuttx/configs/stm32f3discovery/README.txt @@ -323,7 +323,7 @@ the following settings in the include/board.h file: This can be found on the board at: TX, PA2, Connector P1, pin 14 - RX, PA3, Connector P1, pin 9 + RX, PA3, Connector P1, pin 11 FPU === @@ -726,7 +726,7 @@ Where <subdir> is one of the following: nsh: --- Configures the NuttShell (nsh) located at apps/examples/nsh. The - Configuration enables the serial interfaces on UART2. Support for + Configuration enables the serial interfaces on USART2. Support for builtin applications is enabled, but in the base configuration no builtin applications are selected (see NOTES below). @@ -824,41 +824,59 @@ Where <subdir> is one of the following: for Windows and builds under Cygwin (or probably MSYS). That can easily be reconfigured, of course. - CONFIG_HOST_WINDOWS=y : Builds under Windows - CONFIG_WINDOWS_CYGWIN=y : Using Cygwin - CONFIG_ARMV7M_TOOLCHAIN_CODESOURCERYW=y : CodeSourcery for Windows + Build Setup: + CONFIG_HOST_WINDOWS=y : Builds under Windows + CONFIG_WINDOWS_CYGWIN=y : Using Cygwin - 3. This configuration does have UART2 output enabled and set up as + System Type: + CONFIG_ARMV7M_TOOLCHAIN_CODESOURCERYW=y : CodeSourcery for Windows + + 3. This configuration does have USART2 output enabled and set up as the system logging device: - CONFIG_SYSLOG=y : Enable output to syslog, not console - CONFIG_SYSLOG_CHAR=y : Use a character device for system logging - CONFIG_SYSLOG_DEVPATH="/dev/ttyS0" : UART2 will be /dev/ttyS0 + Device Drivers -> System Logging Device Options: + CONFIG_SYSLOG=y : Enable output to syslog, not console + CONFIG_SYSLOG_CHAR=y : Use a character device for system logging + CONFIG_SYSLOG_DEVPATH="/dev/ttyS0" : USART2 will be /dev/ttyS0 However, there is nothing to generate SYLOG output in the default - configuration so nothing should appear on UART2 unless you enable + configuration so nothing should appear on USART2 unless you enable some debug output or enable the USB monitor. + NOTE: Using the SYSLOG to get debug output has limitations. Among + those are that you cannot get debug output from interrupt handlers. + So, in particularly, debug output is not a useful way to debug the + USB device controller driver. Instead, use the USB monitor with + USB debug off and USB trance on (see below). + 4. Enabling USB monitor SYSLOG output. If tracing is enabled, the USB device will save encoded trace output in in-memory buffer; if the USB monitor is enabled, that trace buffer will be periodically - emptied and dumped to the system loggin device (UART2 in this + emptied and dumped to the system loggin device (USART2 in this configuraion): - CONFIG_USBDEV_TRACE=y : Enable USB trace feature - CONFIG_USBDEV_TRACE_NRECORDS=128 : Buffer 128 records in memory - CONFIG_NSH_USBDEV_TRACE=n : No builtin tracing from NSH - CONFIG_NSH_ARCHINIT=y : Automatically start the USB monitor - CONFIG_SYSTEM_USBMONITOR=y : Enable the USB monitor daemon - CONFIG_SYSTEM_USBMONITOR_STACKSIZE=2048 : USB monitor daemon stack size - CONFIG_SYSTEM_USBMONITOR_PRIORITY=50 : USB monitor daemon priority - CONFIG_SYSTEM_USBMONITOR_INTERVAL=2 : Dump trace data every 2 seconds - - CONFIG_SYSTEM_USBMONITOR_TRACEINIT=y : Enable TRACE output - CONFIG_SYSTEM_USBMONITOR_TRACECLASS=y - CONFIG_SYSTEM_USBMONITOR_TRACETRANSFERS=y - CONFIG_SYSTEM_USBMONITOR_TRACECONTROLLER=y - CONFIG_SYSTEM_USBMONITOR_TRACEINTERRUPTS=y + Device Drivers -> "USB Device Driver Support: + CONFIG_USBDEV_TRACE=y : Enable USB trace feature + CONFIG_USBDEV_TRACE_NRECORDS=256 : Buffer 128 records in memory + + Application Configuration -> NSH LIbrary: + CONFIG_NSH_USBDEV_TRACE=n : No builtin tracing from NSH + CONFIG_NSH_ARCHINIT=y : Automatically start the USB monitor + + Application Configuration -> System NSH Add-Ons: + CONFIG_SYSTEM_USBMONITOR=y : Enable the USB monitor daemon + CONFIG_SYSTEM_USBMONITOR_STACKSIZE=2048 : USB monitor daemon stack size + CONFIG_SYSTEM_USBMONITOR_PRIORITY=50 : USB monitor daemon priority + CONFIG_SYSTEM_USBMONITOR_INTERVAL=1 : Dump trace data every second + CONFIG_SYSTEM_USBMONITOR_TRACEINIT=y : Enable TRACE output + CONFIG_SYSTEM_USBMONITOR_TRACECLASS=y + CONFIG_SYSTEM_USBMONITOR_TRACETRANSFERS=y + CONFIG_SYSTEM_USBMONITOR_TRACECONTROLLER=y + CONFIG_SYSTEM_USBMONITOR_TRACEINTERRUPTS=y + + NOTE: USB debug output also be enabled in this case. Both will appear + on the serial SYSLOG output. However, the debug output will be + asynchronous with the trace output and, hence, difficult to interpret. 5. The STM32F3Discovery board does not provide circuitry for control of the "soft connect" USB pullup. As a result, the host PC does not know @@ -868,15 +886,13 @@ Where <subdir> is one of the following: 1) Start NSH with USB disconnected, then 2) Connect the USB device to the host. - 5. By default, this project assumes that you are *NOT* using the DFU - bootloader. + 6. Using the Prolifics PL2303 Emulation - Using the Prolifics PL2303 Emulation - ------------------------------------ - You could also use the non-standard PL2303 serial device instead of - the standard CDC/ACM serial device by changing: + You could also use the non-standard PL2303 serial device instead of + the standard CDC/ACM serial device by changing: - CONFIG_CDCACM=y : Disable the CDC/ACM serial device class - CONFIG_CDCACM_CONSOLE=y : The CDC/ACM serial device is NOT the console - CONFIG_PL2303=y : The Prolifics PL2303 emulation is enabled - CONFIG_PL2303_CONSOLE=y : The PL2303 serial device is the console + Drivers->USB Device Driver Support + CONFIG_CDCACM=n : Disable the CDC/ACM serial device class + CONFIG_CDCACM_CONSOLE=n : The CDC/ACM serial device is NOT the console + CONFIG_PL2303=y : The Prolifics PL2303 emulation is enabled + CONFIG_PL2303_CONSOLE=y : The PL2303 serial device is the console diff --git a/nuttx/configs/stm32f3discovery/src/.gitignore b/nuttx/configs/stm32f3discovery/src/.gitignore new file mode 100644 index 000000000..726d936e1 --- /dev/null +++ b/nuttx/configs/stm32f3discovery/src/.gitignore @@ -0,0 +1,2 @@ +/.depend +/Make.dep diff --git a/nuttx/configs/stm32f3discovery/usbnsh/defconfig b/nuttx/configs/stm32f3discovery/usbnsh/defconfig index 3f5272231..814fba52b 100644 --- a/nuttx/configs/stm32f3discovery/usbnsh/defconfig +++ b/nuttx/configs/stm32f3discovery/usbnsh/defconfig @@ -69,12 +69,14 @@ 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_KL 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_NUC1XX is not set # CONFIG_ARCH_CHIP_SAM3U is not set CONFIG_ARCH_CHIP_STM32=y # CONFIG_ARCH_CHIP_STR71X is not set @@ -87,8 +89,6 @@ CONFIG_ARCH_HAVE_CMNVECTOR=y # CONFIG_ARCH_FPU is not set CONFIG_ARCH_HAVE_MPU=y # CONFIG_ARMV7M_MPU is not set -CONFIG_BOARD_LOOPSPERMSEC=6522 -# CONFIG_ARCH_CALIBRATION is not set # # ARMV7M Configuration Options @@ -105,6 +105,24 @@ CONFIG_ARMV7M_TOOLCHAIN_CODESOURCERYW=y # # STM32 Configuration Options # +# CONFIG_ARCH_CHIP_STM32L151C6 is not set +# CONFIG_ARCH_CHIP_STM32L151C8 is not set +# CONFIG_ARCH_CHIP_STM32L151CB is not set +# CONFIG_ARCH_CHIP_STM32L151R6 is not set +# CONFIG_ARCH_CHIP_STM32L151R8 is not set +# CONFIG_ARCH_CHIP_STM32L151RB is not set +# CONFIG_ARCH_CHIP_STM32L151V6 is not set +# CONFIG_ARCH_CHIP_STM32L151V8 is not set +# CONFIG_ARCH_CHIP_STM32L151VB is not set +# CONFIG_ARCH_CHIP_STM32L152C6 is not set +# CONFIG_ARCH_CHIP_STM32L152C8 is not set +# CONFIG_ARCH_CHIP_STM32L152CB is not set +# CONFIG_ARCH_CHIP_STM32L152R6 is not set +# CONFIG_ARCH_CHIP_STM32L152R8 is not set +# CONFIG_ARCH_CHIP_STM32L152RB is not set +# CONFIG_ARCH_CHIP_STM32L152V6 is not set +# CONFIG_ARCH_CHIP_STM32L152V8 is not set +# CONFIG_ARCH_CHIP_STM32L152VB is not set # CONFIG_ARCH_CHIP_STM32F100C8 is not set # CONFIG_ARCH_CHIP_STM32F100CB is not set # CONFIG_ARCH_CHIP_STM32F100R8 is not set @@ -117,6 +135,8 @@ CONFIG_ARMV7M_TOOLCHAIN_CODESOURCERYW=y # CONFIG_ARCH_CHIP_STM32F100VC is not set # CONFIG_ARCH_CHIP_STM32F100VD is not set # CONFIG_ARCH_CHIP_STM32F100VE is not set +# CONFIG_ARCH_CHIP_STM32F103C4 is not set +# CONFIG_ARCH_CHIP_STM32F103C8 is not set # CONFIG_ARCH_CHIP_STM32F103RET6 is not set # CONFIG_ARCH_CHIP_STM32F103VCT6 is not set # CONFIG_ARCH_CHIP_STM32F103VET6 is not set @@ -145,7 +165,21 @@ CONFIG_ARCH_CHIP_STM32F303VC=y # CONFIG_ARCH_CHIP_STM32F407ZG is not set # CONFIG_ARCH_CHIP_STM32F407IE is not set # CONFIG_ARCH_CHIP_STM32F407IG is not set +# CONFIG_ARCH_CHIP_STM32F427V is not set +# CONFIG_ARCH_CHIP_STM32F427Z is not set +# CONFIG_ARCH_CHIP_STM32F427I is not set +# CONFIG_STM32_STM32L15XX is not set +# CONFIG_STM32_ENERGYLITE is not set +# CONFIG_STM32_STM32F10XX is not set +# CONFIG_STM32_VALUELINE is not set +# CONFIG_STM32_CONNECTIVITYLINE is not set +# CONFIG_STM32_PERFORMANCELINE is not set +# CONFIG_STM32_HIGHDENSITY is not set +# CONFIG_STM32_MEDIUMDENSITY is not set +# CONFIG_STM32_LOWDENSITY is not set +# CONFIG_STM32_STM32F20XX is not set CONFIG_STM32_STM32F30XX=y +# CONFIG_STM32_STM32F40XX is not set # CONFIG_STM32_DFU is not set # @@ -163,11 +197,9 @@ CONFIG_STM32_STM32F30XX=y # CONFIG_STM32_DAC2 is not set # CONFIG_STM32_I2C1 is not set # CONFIG_STM32_I2C2 is not set -# CONFIG_STM32_IWDG is not set CONFIG_STM32_PWR=y # CONFIG_STM32_SDIO is not set CONFIG_STM32_SPI1=y -# CONFIG_STM32_SPI2 is not set CONFIG_STM32_SYSCFG=y # CONFIG_STM32_TIM1 is not set # CONFIG_STM32_TIM2 is not set @@ -183,6 +215,7 @@ CONFIG_STM32_SYSCFG=y # CONFIG_STM32_USART1 is not set CONFIG_STM32_USART2=y CONFIG_STM32_USB=y +# CONFIG_STM32_IWDG is not set # CONFIG_STM32_WWDG is not set CONFIG_STM32_SPI=y @@ -193,6 +226,7 @@ CONFIG_STM32_SPI=y # CONFIG_STM32_JTAG_FULL_ENABLE is not set # CONFIG_STM32_JTAG_NOJNTRST_ENABLE is not set CONFIG_STM32_JTAG_SW_ENABLE=y +# CONFIG_STM32_DISABLE_IDLE_SLEEP_DURING_DEBUG is not set # CONFIG_STM32_FORCEPOWER is not set # CONFIG_ARCH_BOARD_STM32_CUSTOM_CLOCKCONFIG is not set CONFIG_STM32_USART=y @@ -235,10 +269,14 @@ CONFIG_ARCH_HAVE_VFORK=y CONFIG_ARCH_STACKDUMP=y # CONFIG_ENDIAN_BIG is not set # CONFIG_ARCH_HAVE_RAMFUNCS is not set +CONFIG_ARCH_HAVE_RAMVECTORS=y +# CONFIG_ARCH_RAMVECTORS is not set # # Board Settings # +CONFIG_BOARD_LOOPSPERMSEC=6522 +# CONFIG_ARCH_CALIBRATION is not set CONFIG_DRAM_START=0x20000000 CONFIG_DRAM_SIZE=40960 CONFIG_ARCH_HAVE_INTERRUPTSTACK=y @@ -278,6 +316,7 @@ CONFIG_NSH_MMCSDMINOR=0 # # RTOS Features # +# CONFIG_BOARD_INITIALIZE is not set CONFIG_MSEC_PER_TICK=10 CONFIG_RR_INTERVAL=200 # CONFIG_SCHED_INSTRUMENTATION is not set @@ -293,7 +332,6 @@ CONFIG_START_DAY=27 # 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_STARTHOOK is not set # CONFIG_SCHED_ATEXIT is not set @@ -357,6 +395,7 @@ CONFIG_SPI_EXCHANGE=y # CONFIG_RTC is not set # CONFIG_WATCHDOG is not set # CONFIG_ANALOG is not set +# CONFIG_AUDIO_DEVICES is not set # CONFIG_BCH is not set # CONFIG_INPUT is not set # CONFIG_LCD is not set @@ -366,7 +405,6 @@ CONFIG_SPI_EXCHANGE=y # 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_SERIAL_REMOVABLE=y @@ -389,14 +427,19 @@ CONFIG_USART2_2STOP=0 CONFIG_USBDEV=y # -# Device Controller Driver Options +# USB Device Controller Driver Options # # CONFIG_USBDEV_ISOCHRONOUS is not set # CONFIG_USBDEV_DUALSPEED is not set CONFIG_USBDEV_SELFPOWERED=y # CONFIG_USBDEV_BUSPOWERED is not set +CONFIG_USBDEV_MAXPOWER=100 # CONFIG_USBDEV_DMA is not set # CONFIG_USBDEV_TRACE is not set + +# +# USB Device Class Driver Options +# # CONFIG_USBDEV_COMPOSITE is not set # CONFIG_PL2303 is not set CONFIG_CDCACM=y @@ -449,6 +492,7 @@ CONFIG_CDCACM_PRODUCTSTR="CDC/ACM Serial" # CONFIG_FS_FAT is not set # CONFIG_FS_NXFFS is not set # CONFIG_FS_ROMFS is not set +# CONFIG_FS_SMARTFS is not set # CONFIG_FS_BINFS is not set # @@ -467,11 +511,17 @@ CONFIG_SYSLOG_DEVPATH="/dev/ttyS0" # # Memory Management # +# CONFIG_MM_MULTIHEAP is not set # CONFIG_MM_SMALL is not set CONFIG_MM_REGIONS=2 # CONFIG_GRAN is not set # +# Audio Support +# +# CONFIG_AUDIO is not set + +# # Binary Formats # # CONFIG_BINFMT_DISABLE is not set @@ -496,6 +546,7 @@ CONFIG_LIB_HOMEDIR="/" # CONFIG_LIBM is not set # CONFIG_NOPRINTF_FIELDWIDTH is not set # CONFIG_LIBC_FLOATINGPOINT is not set +CONFIG_LIB_RAND_ORDER=1 # CONFIG_EOL_IS_CR is not set # CONFIG_EOL_IS_LF is not set # CONFIG_EOL_IS_BOTH_CRLF is not set @@ -511,9 +562,11 @@ CONFIG_LIB_SENDFILE_BUFSIZE=512 # CONFIG_ARCH_OPTIMIZED_FUNCTIONS is not set # -# Non-standard Helper Functions +# Non-standard Library Support # +# CONFIG_SCHED_WORKQUEUE is not set # CONFIG_LIB_KBDCODEC is not set +# CONFIG_LIB_SLCDCODEC is not set # # Basic CXX Support @@ -557,8 +610,8 @@ CONFIG_BUILTIN_PROXY_STACKSIZE=1024 # 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_MOUNT is not set CONFIG_EXAMPLES_NSH=y # CONFIG_EXAMPLES_NULL is not set # CONFIG_EXAMPLES_NX is not set @@ -578,6 +631,10 @@ CONFIG_EXAMPLES_NSH=y # CONFIG_EXAMPLES_ROMFS is not set # CONFIG_EXAMPLES_SENDMAIL is not set # CONFIG_EXAMPLES_SERLOOP is not set +# CONFIG_EXAMPLES_SLCD is not set +# CONFIG_EXAMPLES_SMART_TEST is not set +# CONFIG_EXAMPLES_SMART is not set +# CONFIG_EXAMPLES_TCPECHO is not set # CONFIG_EXAMPLES_TELNETD is not set # CONFIG_EXAMPLES_THTTPD is not set # CONFIG_EXAMPLES_TIFF is not set @@ -590,8 +647,9 @@ CONFIG_EXAMPLES_NSH=y # CONFIG_EXAMPLES_WATCHDOG is not set # -# Interpreters +# Graphics Support # +# CONFIG_TIFF is not set # # Interpreters @@ -621,11 +679,7 @@ CONFIG_EXAMPLES_NSH=y # CONFIG_NETUTILS_WEBCLIENT is not set # -# ModBus -# - -# -# FreeModbus +# FreeModBus # # CONFIG_MODBUS is not set @@ -677,6 +731,11 @@ CONFIG_NSH_BUILTIN_APPS=y # CONFIG_NSH_DISABLE_USLEEP is not set # CONFIG_NSH_DISABLE_WGET is not set # CONFIG_NSH_DISABLE_XD is not set + +# +# Configure Command Options +# +# CONFIG_NSH_CMDOPT_DF_H is not set CONFIG_NSH_CODECS_BUFSIZE=128 CONFIG_NSH_FILEIOSIZE=512 CONFIG_NSH_LINELEN=64 @@ -715,6 +774,10 @@ CONFIG_NSH_ARCHINIT=y # CONFIG_SYSTEM_INSTALL is not set # +# FLASH Erase-all Command +# + +# # readline() # CONFIG_SYSTEM_READLINE=y diff --git a/nuttx/configs/stm32f4discovery/README.txt b/nuttx/configs/stm32f4discovery/README.txt index 684c916f5..f3cd7901b 100644 --- a/nuttx/configs/stm32f4discovery/README.txt +++ b/nuttx/configs/stm32f4discovery/README.txt @@ -1641,6 +1641,12 @@ Where <subdir> is one of the following: configuration so nothing should appear on UART2 unless you enable some debug output or enable the USB monitor. + NOTE: Using the SYSLOG to get debug output has limitations. Among + those are that you cannot get debug output from interrupt handlers. + So, in particularly, debug output is not a useful way to debug the + USB device controller driver. Instead, use the USB monitor with + USB debug off and USB trance on (see below). + 4. Enabling USB monitor SYSLOG output. If tracing is enabled, the USB device will save encoded trace output in in-memory buffer; if the USB monitor is enabled, that trace buffer will be periodically @@ -1670,8 +1676,8 @@ Where <subdir> is one of the following: You could also use the non-standard PL2303 serial device instead of the standard CDC/ACM serial device by changing: - CONFIG_CDCACM=y : Disable the CDC/ACM serial device class - CONFIG_CDCACM_CONSOLE=y : The CDC/ACM serial device is NOT the console + CONFIG_CDCACM=n : Disable the CDC/ACM serial device class + CONFIG_CDCACM_CONSOLE=n : The CDC/ACM serial device is NOT the console CONFIG_PL2303=y : The Prolifics PL2303 emulation is enabled CONFIG_PL2303_CONSOLE=y : The PL2303 serial device is the console diff --git a/nuttx/configs/stm32f4discovery/kernel/.gitignore b/nuttx/configs/stm32f4discovery/kernel/.gitignore index f2f473a41..7bacd5aee 100644 --- a/nuttx/configs/stm32f4discovery/kernel/.gitignore +++ b/nuttx/configs/stm32f4discovery/kernel/.gitignore @@ -1,2 +1,2 @@ -nuttx_user.elf +/nuttx_user.elf diff --git a/nuttx/configs/stm32f4discovery/src/.gitignore b/nuttx/configs/stm32f4discovery/src/.gitignore index e9b561c4e..726d936e1 100644 --- a/nuttx/configs/stm32f4discovery/src/.gitignore +++ b/nuttx/configs/stm32f4discovery/src/.gitignore @@ -1,4 +1,2 @@ -.depend -Make.dep - - +/.depend +/Make.dep diff --git a/nuttx/configs/stm32ldiscovery/src/.gitignore b/nuttx/configs/stm32ldiscovery/src/.gitignore new file mode 100644 index 000000000..726d936e1 --- /dev/null +++ b/nuttx/configs/stm32ldiscovery/src/.gitignore @@ -0,0 +1,2 @@ +/.depend +/Make.dep diff --git a/nuttx/configs/sure-pic32mx/README.txt b/nuttx/configs/sure-pic32mx/README.txt index 7592538ff..48877a498 100644 --- a/nuttx/configs/sure-pic32mx/README.txt +++ b/nuttx/configs/sure-pic32mx/README.txt @@ -853,10 +853,11 @@ Where <subdir> is one of the following: You could also use the non-standard PL2303 serial device instead of the standard CDC/ACM serial device by changing: - CONFIG_CDCACM=n : Disable the CDC/ACM serial device class - CONFIG_CDCACM_CONSOLE=n : The CDC/ACM serial device is NOT the console - CONFIG_PL2303=y : The Prolifics PL2303 emulation is enabled - CONFIG_PL2303_CONSOLE=y : The PL2303 serial device is the console + Drivers->USB Device Driver Support + CONFIG_CDCACM=n : Disable the CDC/ACM serial device class + CONFIG_CDCACM_CONSOLE=n : The CDC/ACM serial device is NOT the console + CONFIG_PL2303=y : The Prolifics PL2303 emulation is enabled + CONFIG_PL2303_CONSOLE=y : The PL2303 serial device is the console Why would you want to use a non-standard USB serial driver? You might to use the PL2303 driver with a Windows host because it should @@ -864,9 +865,9 @@ Where <subdir> is one of the following: some effort to get Windows to recognize the CDC/ACM device). 4. Since this configuration is current set for the "DB_DP11215 PIC32 - Storage Demo Board," USART2 is available and is configured to used as + Storage Demo Board," UART2 is available and is configured to used as the SYSLOG device. That means that all debug output will be directed - out USART2. Debug output is not enabled by default, however, so these + out UART2. Debug output is not enabled by default, however, so these settings do nothing until you enable debug ouput. Device Drivers -> System Logging Device Options: @@ -916,7 +917,9 @@ Where <subdir> is one of the following: CONFIG_SYSTEM_USBMONITOR_TRACECONTROLLER=y CONFIG_SYSTEM_USBMONITOR_TRACEINTERRUPTS=y - NOTE: USB debug output should not be enabled in this case. + NOTE: USB debug output also be enabled in this case. Both will appear + on the serial SYSLOG output. However, the debug output will be + asynchronous with the trace output and, hence, difficult to interpret. 6. If you want to try this configuration on the DB-DP11212 PIC32 General Purpose Demo Board", here are the changes that you should make: diff --git a/nuttx/configs/sure-pic32mx/src/.gitignore b/nuttx/configs/sure-pic32mx/src/.gitignore new file mode 100644 index 000000000..726d936e1 --- /dev/null +++ b/nuttx/configs/sure-pic32mx/src/.gitignore @@ -0,0 +1,2 @@ +/.depend +/Make.dep diff --git a/nuttx/configs/teensy/src/.gitignore b/nuttx/configs/teensy/src/.gitignore index 304c001a2..726d936e1 100644 --- a/nuttx/configs/teensy/src/.gitignore +++ b/nuttx/configs/teensy/src/.gitignore @@ -1,3 +1,2 @@ -.depend -Make.dep - +/.depend +/Make.dep diff --git a/nuttx/configs/twr-k60n512/src/.gitignore b/nuttx/configs/twr-k60n512/src/.gitignore index 69f21f16f..726d936e1 100644 --- a/nuttx/configs/twr-k60n512/src/.gitignore +++ b/nuttx/configs/twr-k60n512/src/.gitignore @@ -1,6 +1,2 @@ -.depend -Make.dep - - - - +/.depend +/Make.dep diff --git a/nuttx/configs/ubw32/src/.gitignore b/nuttx/configs/ubw32/src/.gitignore index e9b561c4e..726d936e1 100644 --- a/nuttx/configs/ubw32/src/.gitignore +++ b/nuttx/configs/ubw32/src/.gitignore @@ -1,4 +1,2 @@ -.depend -Make.dep - - +/.depend +/Make.dep diff --git a/nuttx/configs/us7032evb1/src/.gitignore b/nuttx/configs/us7032evb1/src/.gitignore index 304c001a2..726d936e1 100644 --- a/nuttx/configs/us7032evb1/src/.gitignore +++ b/nuttx/configs/us7032evb1/src/.gitignore @@ -1,3 +1,2 @@ -.depend -Make.dep - +/.depend +/Make.dep diff --git a/nuttx/configs/vsn/nsh/defconfig b/nuttx/configs/vsn/nsh/defconfig index 35f787bfc..49de28aa8 100755 --- a/nuttx/configs/vsn/nsh/defconfig +++ b/nuttx/configs/vsn/nsh/defconfig @@ -194,6 +194,7 @@ CONFIG_I2C=y # Note: this has (at the moment) nothing to do with WIFI # CONFIG_WIRELESS=y +CONFIG_WL_CC1101=y # # OS support for hardware RTC diff --git a/nuttx/configs/vsn/src/.gitignore b/nuttx/configs/vsn/src/.gitignore index e9b561c4e..726d936e1 100644 --- a/nuttx/configs/vsn/src/.gitignore +++ b/nuttx/configs/vsn/src/.gitignore @@ -1,4 +1,2 @@ -.depend -Make.dep - - +/.depend +/Make.dep diff --git a/nuttx/configs/xtrs/src/.gitignore b/nuttx/configs/xtrs/src/.gitignore index 8ceafbeda..91e29681e 100644 --- a/nuttx/configs/xtrs/src/.gitignore +++ b/nuttx/configs/xtrs/src/.gitignore @@ -1,14 +1,13 @@ -Make.dep -.depend -*.sym -*.rel -*.lst -*.adb -*.rst -*.lib -*.lnk -*.map -*.mem -*.ihx -*.hex - +/Make.dep +/.depend +/*.sym +/*.rel +/*.lst +/*.adb +/*.rst +/*.lib +/*.lnk +/*.map +/*.mem +/*.ihx +/*.hex diff --git a/nuttx/configs/z16f2800100zcog/src/.gitignore b/nuttx/configs/z16f2800100zcog/src/.gitignore index 94abcdb86..b268f1933 100644 --- a/nuttx/configs/z16f2800100zcog/src/.gitignore +++ b/nuttx/configs/z16f2800100zcog/src/.gitignore @@ -1,4 +1,4 @@ -Make.dep -.depend -*.obj +/Make.dep +/.depend +/*.obj diff --git a/nuttx/configs/z80sim/src/.gitignore b/nuttx/configs/z80sim/src/.gitignore index 63526d43f..101a87210 100644 --- a/nuttx/configs/z80sim/src/.gitignore +++ b/nuttx/configs/z80sim/src/.gitignore @@ -1,16 +1,16 @@ -Make.dep -.depend -up_mem.h -*.sym -*.asm -*.rel -*.lst -*.adb -*.rst -*.lib -*.lnk -*.map -*.mem -*.ihx -*.hex +/Make.dep +/.depend +/up_mem.h +/*.sym +/*.asm +/*.rel +/*.lst +/*.adb +/*.rst +/*.lib +/*.lnk +/*.map +/*.mem +/*.ihx +/*.hex diff --git a/nuttx/configs/z8encore000zco/src/.gitignore b/nuttx/configs/z8encore000zco/src/.gitignore index 94abcdb86..cdc79c5a8 100644 --- a/nuttx/configs/z8encore000zco/src/.gitignore +++ b/nuttx/configs/z8encore000zco/src/.gitignore @@ -1,4 +1,3 @@ -Make.dep -.depend -*.obj - +/Make.dep +/.depend +/*.obj diff --git a/nuttx/configs/z8f64200100kit/src/.gitignore b/nuttx/configs/z8f64200100kit/src/.gitignore index 94abcdb86..b268f1933 100644 --- a/nuttx/configs/z8f64200100kit/src/.gitignore +++ b/nuttx/configs/z8f64200100kit/src/.gitignore @@ -1,4 +1,4 @@ -Make.dep -.depend -*.obj +/Make.dep +/.depend +/*.obj diff --git a/nuttx/configs/zkit-arm-1769/src/.gitignore b/nuttx/configs/zkit-arm-1769/src/.gitignore index e9b561c4e..726d936e1 100644 --- a/nuttx/configs/zkit-arm-1769/src/.gitignore +++ b/nuttx/configs/zkit-arm-1769/src/.gitignore @@ -1,4 +1,2 @@ -.depend -Make.dep - - +/.depend +/Make.dep diff --git a/nuttx/configs/zp214xpa/src/.gitignore b/nuttx/configs/zp214xpa/src/.gitignore index e9b561c4e..726d936e1 100644 --- a/nuttx/configs/zp214xpa/src/.gitignore +++ b/nuttx/configs/zp214xpa/src/.gitignore @@ -1,4 +1,2 @@ -.depend -Make.dep - - +/.depend +/Make.dep diff --git a/nuttx/drivers/.gitignore b/nuttx/drivers/.gitignore index 585270233..4b32ec6a3 100644 --- a/nuttx/drivers/.gitignore +++ b/nuttx/drivers/.gitignore @@ -1,10 +1,10 @@ /Make.dep /.depend -*.asm -*.obj -*.rel -*.lst -*.sym -*.adb -*.lib -*.src +/*.asm +/*.obj +/*.rel +/*.lst +/*.sym +/*.adb +/*.lib +/*.src diff --git a/nuttx/drivers/usbdev/Kconfig b/nuttx/drivers/usbdev/Kconfig index 889f2000b..dba90e599 100644 --- a/nuttx/drivers/usbdev/Kconfig +++ b/nuttx/drivers/usbdev/Kconfig @@ -181,15 +181,15 @@ config PL2303_CONSOLE as the console device. config PL2303_EPINTIN - int "Logical endpoint numbers" + int "Interrupt IN endpoint number" default 1 config PL2303_EPBULKOUT - int "Endpoint Bulkout" + int "Bulk OUT endpoint number" default 2 config PL2303_EPBULKIN - int "Endpoint Bulkin" + int "Bulk IN endpoint number" default 3 config PL2303_EP0MAXPACKET @@ -208,6 +208,16 @@ config PL2303_NRDREQS ---help--- The number of write/read requests that can be in flight +config PL2303_BULKIN_REQLEN + int "Size of one write request buffer" + default 96 + ---help--- + Ideally, the BULKOUT request size should *not* be the same size as + the maxpacket size. That is because IN transfers of exactly the + maxpacket size will be followed by a NULL packet. The BULKOUT, + on the other hand, request buffer size is always the same as the + maxpacket size. + config PL2303_RXBUFSIZE int "Receive buffer size" default 256 @@ -290,63 +300,63 @@ config CDCACM_EP0MAXPACKET Endpoint 0 max packet size. Default 64. config CDCACM_EPINTIN - int "Hardware endpoint that supports interrupt IN operation" + int "Interrupt IN endpoint number" default 1 ---help--- The logical 7-bit address of a hardware endpoint that supports interrupt IN operation. Default 1. config CDCACM_EPINTIN_FSSIZE - int "Endpoint in full speed size" + int "Interupt IN full speed MAXPACKET size" default 64 ---help--- Max package size for the interrupt IN endpoint if full speed mode. Default 64. config CDCACM_EPINTIN_HSSIZE - int "Endpoint in high speed size" + int "Interupt IN high speed MAXPACKET size" default 64 ---help--- Max package size for the interrupt IN endpoint if high speed mode. Default 64. config CDCACM_EPBULKOUT - int "Endpoint bulk out" + int "Bulk OUT endpoint number" default 3 ---help--- The logical 7-bit address of a hardware endpoint that supports bulk OUT operation. Default: 3 config CDCACM_EPBULKOUT_FSSIZE - int "Endpoint bulk out full speed size" + int "Bulk OUT full speed MAXPACKET size" default 64 ---help--- Max package size for the bulk OUT endpoint if full speed mode. Default 64. config CDCACM_EPBULKOUT_HSSIZE - int "Endpoint bulk out high speed size" + int "Bulk OUT out high speed MAXPACKET size" default 512 ---help--- Max package size for the bulk OUT endpoint if high speed mode. Default 512. config CDCACM_EPBULKIN - int "Endpoint bulk in" + int "Bulk IN endpoint number" default 2 ---help--- The logical 7-bit address of a hardware endpoint that supports bulk IN operation. Default: 2 config CDCACM_EPBULKIN_FSSIZE - int "Endpoint bulk in full speed size" + int "Bulk IN full speed MAXPACKET size" default 64 ---help--- Max package size for the bulk IN endpoint if full speed mode. Default 64. config CDCACM_EPBULKIN_HSSIZE - int "Endpoint bulk in high speed size" + int "Bulk IN high speed MAXPACKET size" default 512 ---help--- Max package size for the bulk IN endpoint if high speed mode. @@ -364,6 +374,16 @@ config CDCACM_NRDREQS ---help--- The number of write/read requests that can be in flight +config CDCACM_BULKIN_REQLEN + int "Size of one write request buffer" + default 96 + ---help--- + Ideally, the BULKOUT request size should *not* be the same size as + the maxpacket size. That is because IN transfers of exactly the + maxpacket size will be followed by a NULL packet. The BULKOUT, + on the other hand, request buffer size is always the same as the + maxpacket size. + config CDCACM_RXBUFSIZE int "Receive buffer size" default 256 @@ -463,14 +483,14 @@ config USBMSC_EP0MAXPACKET Max packet size for endpoint 0 config USBMSC_EPBULKOUT - int "Endpoint bulk out" + int "Bulk OUT endpoint number" default 0 ---help--- The logical 7-bit address of a hardware endpoints that support bulk OUT and IN operations config USBMSC_EPBULKIN - int "Endpoint bulk in" + int "Bulk IN endpoint number" default 0 ---help--- The logical 7-bit address of a hardware endpoints that support diff --git a/nuttx/drivers/usbdev/cdcacm.c b/nuttx/drivers/usbdev/cdcacm.c index cf0ebad82..289e1cd10 100644 --- a/nuttx/drivers/usbdev/cdcacm.c +++ b/nuttx/drivers/usbdev/cdcacm.c @@ -359,11 +359,7 @@ static int cdcacm_sndpacket(FAR struct cdcacm_dev_s *priv) /* Get the maximum number of bytes that will fit into one bulk IN request */ -#ifdef CONFIG_CDCACM_BULKREQLEN - reqlen = MAX(CONFIG_CDCACM_BULKREQLEN, ep->maxpacket); -#else - reqlen = ep->maxpacket; -#endif + reqlen = MAX(CONFIG_CDCACM_BULKIN_REQLEN, ep->maxpacket); while (!sq_empty(&priv->reqlist)) { @@ -841,12 +837,7 @@ static void cdcacm_rdcomplete(FAR struct usbdev_ep_s *ep, /* Requeue the read request */ -#ifdef CONFIG_CDCACM_BULKREQLEN - req->len = MAX(CONFIG_CDCACM_BULKREQLEN, ep->maxpacket); -#else req->len = ep->maxpacket; -#endif - ret = EP_SUBMIT(ep, req); if (ret != OK) { @@ -1013,11 +1004,7 @@ static int cdcacm_bind(FAR struct usbdevclass_driver_s *driver, /* Pre-allocate read requests */ -#ifdef CONFIG_CDCACM_BULKREQLEN - reqlen = MAX(CONFIG_CDCACM_BULKREQLEN, priv->epbulkout->maxpacket); -#else reqlen = priv->epbulkout->maxpacket; -#endif for (i = 0; i < CONFIG_CDCACM_NRDREQS; i++) { @@ -1036,11 +1023,7 @@ static int cdcacm_bind(FAR struct usbdevclass_driver_s *driver, /* Pre-allocate write request containers and put in a free list */ -#ifdef CONFIG_CDCACM_BULKREQLEN - reqlen = MAX(CONFIG_CDCACM_BULKREQLEN, priv->epbulkin->maxpacket); -#else - reqlen = priv->epbulkin->maxpacket; -#endif + reqlen = MAX(CONFIG_CDCACM_BULKIN_REQLEN, priv->epbulkin->maxpacket); for (i = 0; i < CONFIG_CDCACM_NWRREQS; i++) { diff --git a/nuttx/drivers/usbdev/pl2303.c b/nuttx/drivers/usbdev/pl2303.c index 9aa65a56c..71918ca41 100644 --- a/nuttx/drivers/usbdev/pl2303.c +++ b/nuttx/drivers/usbdev/pl2303.c @@ -101,7 +101,15 @@ # define CONFIG_PL2303_EP0MAXPACKET 64 #endif -#undef CONFIG_PL2303_BULKREQLEN +/* Ideally, the BULKOUT request size should *not* be the same size as the + * maxpacket size. That is because IN transfers of exactly the maxpacket + * size will be followed by a NULL packet. The BULKOUT request buffer + * size, on the other hand, is always the same as the maxpacket size. + */ + +#ifndef CONFIG_PL2303_BULKIN_REQLEN +# define CONFIG_PL2303_BULKIN_REQLEN 96 +#endif /* Vendor and product IDs and strings */ @@ -608,11 +616,7 @@ static int usbclass_sndpacket(FAR struct pl2303_dev_s *priv) /* Get the maximum number of bytes that will fit into one bulk IN request */ -#ifdef CONFIG_PL2303_BULKREQLEN - reqlen = MAX(CONFIG_PL2303_BULKREQLEN, ep->maxpacket); -#else - reqlen = ep->maxpacket; -#endif + reqlen = max(CONFIG_PL2303_BULKIN_REQLEN, ep->maxpacket); while (!sq_empty(&priv->reqlist)) { @@ -1222,12 +1226,7 @@ static void usbclass_rdcomplete(FAR struct usbdev_ep_s *ep, /* Requeue the read request */ -#ifdef CONFIG_PL2303_BULKREQLEN - req->len = max(CONFIG_PL2303_BULKREQLEN, ep->maxpacket); -#else req->len = ep->maxpacket; -#endif - ret = EP_SUBMIT(ep, req); if (ret != OK) { @@ -1384,11 +1383,7 @@ static int usbclass_bind(FAR struct usbdevclass_driver_s *driver, /* Pre-allocate read requests */ -#ifdef CONFIG_PL2303_BULKREQLEN - reqlen = max(CONFIG_PL2303_BULKREQLEN, priv->epbulkout->maxpacket); -#else reqlen = priv->epbulkout->maxpacket; -#endif for (i = 0; i < CONFIG_PL2303_NRDREQS; i++) { @@ -1400,17 +1395,14 @@ static int usbclass_bind(FAR struct usbdevclass_driver_s *driver, ret = -ENOMEM; goto errout; } + reqcontainer->req->priv = reqcontainer; reqcontainer->req->callback = usbclass_rdcomplete; } /* Pre-allocate write request containers and put in a free list */ -#ifdef CONFIG_PL2303_BULKREQLEN - reqlen = max(CONFIG_PL2303_BULKREQLEN, priv->epbulkin->maxpacket); -#else - reqlen = priv->epbulkin->maxpacket; -#endif + reqlen = max(CONFIG_PL2303_BULKIN_REQLEN, priv->epbulkin->maxpacket); for (i = 0; i < CONFIG_PL2303_NWRREQS; i++) { @@ -1422,6 +1414,7 @@ static int usbclass_bind(FAR struct usbdevclass_driver_s *driver, ret = -ENOMEM; goto errout; } + reqcontainer->req->priv = reqcontainer; reqcontainer->req->callback = usbclass_wrcomplete; diff --git a/nuttx/drivers/wireless/ISM1_868MHzGFSK100kbps.c b/nuttx/drivers/wireless/ISM1_868MHzGFSK100kbps.c new file mode 100644 index 000000000..a02b2838a --- /dev/null +++ b/nuttx/drivers/wireless/ISM1_868MHzGFSK100kbps.c @@ -0,0 +1,123 @@ +/**************************************************************************** + * drivers/wireless/ISM1_868MHzGFSK100kbps.c + * + * Copyright (C) 2011 Uros Platise. All rights reserved. + * Copyright (C) 2011 Ales Verbic. All rights reserved. + * + * Authors: Uros Platise <uros.platise@isotel.eu> + * Ales Verbic <ales.verbic@isotel.eu> + * + * 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 <nuttx/wireless/cc1101.h> + +/**************************************************************************** + * Public Data + ****************************************************************************/ + +/** Settings for 868 MHz, GFSK at 100kbps + * + * ISM Region 1 (Europe) only, Band 868–870 MHz + * + * Frequency ERP Duty Cycle Bandwidth Remarks + * 868 – 868.6 MHz +14 dBm < 1% No limits + * 868.7 – 869.2 MHz +14 dBm < 0.1% No limits + * 869.3 – 869.4 MHz +10 dBm No limits < 25 kHz Appropriate access protocol required + * 869.4 – 869.65 MHz +27 dBm < 10% < 25 kHz Channels may be combined to one high speed channel + * 869.7 -870 MHz +7 dBm No limits No limits + * + * Deviation = 46.142578 + * Base frequency = 867.999985 + * Carrier frequency = 867.999985 + * Channel number = 0 + * Carrier frequency = 867.999985 + * Modulated = true + * Modulation format = GFSK + * Manchester enable = false + * Sync word qualifier mode = 30/32 sync word bits detected + * Preamble count = 4 + * Channel spacing = 199.813843 + * Carrier frequency = 867.999985 + * Data rate = 99.9069 + * RX filter BW = 210.937500 + * Data format = Normal mode + * Length config = Fixed packet length mode. Length configured in PKTLEN register + * CRC enable = true + * Packet length = 62 + * Device address = 00 + * Address config = NO Address check, no broadcast + * CRC autoflush = true + * PA ramping = false + * TX power = 0 + */ + +const struct c1101_rfsettings_s cc1101_rfsettings_ISM1_868MHzGFSK100kbps = +{ + .FSCTRL1 = 0x08, /* FSCTRL1 Frequency Synthesizer Control */ + .FSCTRL0 = 0x00, /* FSCTRL0 Frequency Synthesizer Control */ + + .FREQ2 = 0x20, /* FREQ2 Frequency Control Word, High Byte */ + .FREQ1 = 0x25, /* FREQ1 Frequency Control Word, Middle Byte */ + .FREQ0 = 0xED, /* FREQ0 Frequency Control Word, Low Byte */ + + .MDMCFG4 = 0x8B, /* MDMCFG4 Modem Configuration */ + .MDMCFG3 = 0xE5, /* MDMCFG3 Modem Configuration */ + .MDMCFG2 = 0x13, /* MDMCFG2 Modem Configuration */ + .MDMCFG1 = 0x22, /* MDMCFG1 Modem Configuration */ + .MDMCFG0 = 0xE5, /* MDMCFG0 Modem Configuration */ + + .DEVIATN = 0x46, /* DEVIATN Modem Deviation Setting */ + + .FOCCFG = 0x1D, /* FOCCFG Frequency Offset Compensation Configuration */ + + .BSCFG = 0x1C, /* BSCFG Bit Synchronization Configuration */ + + .AGCCTRL2= 0xC7, /* AGCCTRL2 AGC Control */ + .AGCCTRL1= 0x00, /* AGCCTRL1 AGC Control */ + .AGCCTRL0= 0xB2, /* AGCCTRL0 AGC Control */ + + .FREND1 = 0xB6, /* FREND1 Front End RX Configuration */ + .FREND0 = 0x10, /* FREND0 Front End TX Configuration */ + + .FSCAL3 = 0xEA, /* FSCAL3 Frequency Synthesizer Calibration */ + .FSCAL2 = 0x2A, /* FSCAL2 Frequency Synthesizer Calibration */ + .FSCAL1 = 0x00, /* FSCAL1 Frequency Synthesizer Calibration */ + .FSCAL0 = 0x1F, /* FSCAL0 Frequency Synthesizer Calibration */ + + .CHMIN = 0, /* Fix at 9th channel: 869.80 MHz +- 100 kHz RF Bandwidth */ + .CHMAX = 9, /* single channel */ + + .PAMAX = 8, /* 0 means power OFF, 8 represents PA[7] */ + .PA = {0x03, 0x0F, 0x1E, 0x27, 0x67, 0x50, 0x81, 0xC2} +}; diff --git a/nuttx/drivers/wireless/ISM2_905MHzGFSK250kbps.c b/nuttx/drivers/wireless/ISM2_905MHzGFSK250kbps.c new file mode 100644 index 000000000..c78cee586 --- /dev/null +++ b/nuttx/drivers/wireless/ISM2_905MHzGFSK250kbps.c @@ -0,0 +1,121 @@ +/**************************************************************************** + * drivers/wireless/ISM2_905MHzGFSK250kbps.c + * + * Copyright (C) 2011 Uros Platise. All rights reserved. + * Copyright (C) 2011 Ales Verbic. All rights reserved. + * + * Authors: Uros Platise <uros.platise@isotel.eu> + * Ales Verbic <ales.verbic@isotel.eu> + * + * 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 <nuttx/wireless/cc1101.h> + +/**************************************************************************** + * Public Data + ****************************************************************************/ + +/** Settings for 905 MHz, GFSK at 250kbps + * + * ISM Region 2 (America) only, Band 902–928 MHz + * + * Cordless phones 1 W + * Microwave ovens 750 W + * Industrial heaters 100 kW + * Military radar 1000 kW + * + * Deviation = 126.953125 + * Base frequency = 901.999969 + * Carrier frequency = 905.998993 + * Channel number = 20 + * Carrier frequency = 905.998993 + * Modulated = true + * Modulation format = GFSK + * Manchester enable = false + * Sync word qualifier mode = 30/32 sync word bits detected + * Preamble count = 4 + * Channel spacing = 199.951172 + * Carrier frequency = 905.998993 + * Data rate = 249.939 + * RX filter BW = 541.666667 + * Data format = Normal mode + * Length config = Variable packet length mode. Packet length configured by the first byte after sync word + * CRC enable = true + * Packet length = 61 + * Device address = 0 + * Address config = No address check + * CRC autoflush = false + * PA ramping = false + * TX power = 0 + */ + +const struct c1101_rfsettings_s cc1101_rfsettings_ISM2_905MHzGFSK250kbps = +{ + .FSCTRL1 = 0x0C, /* FSCTRL1 Frequency Synthesizer Control */ + .FSCTRL0 = 0x00, /* FSCTRL0 Frequency Synthesizer Control */ + + .FREQ2 = 0x22, /* FREQ2 Frequency Control Word, High Byte */ + .FREQ1 = 0xB1, /* FREQ1 Frequency Control Word, Middle Byte */ + .FREQ0 = 0x3B, /* FREQ0 Frequency Control Word, Low Byte */ + + .MDMCFG4 = 0x2D, /* MDMCFG4 Modem Configuration */ + .MDMCFG3 = 0x3B, /* MDMCFG3 Modem Configuration */ + .MDMCFG2 = 0x13, /* MDMCFG2 Modem Configuration */ + .MDMCFG1 = 0x22, /* MDMCFG1 Modem Configuration */ + .MDMCFG0 = 0xF8, /* MDMCFG0 Modem Configuration */ + + .DEVIATN = 0x62, /* DEVIATN Modem Deviation Setting */ + + .FOCCFG = 0x1D, /* FOCCFG Frequency Offset Compensation Configuration */ + + .BSCFG = 0x1C, /* BSCFG Bit Synchronization Configuration */ + + .AGCCTRL2= 0xC7, /* AGCCTRL2 AGC Control */ + .AGCCTRL1= 0x00, /* AGCCTRL1 AGC Control */ + .AGCCTRL0= 0xB0, /* AGCCTRL0 AGC Control */ + + .FREND1 = 0xB6, /* FREND1 Front End RX Configuration */ + .FREND0 = 0x10, /* FREND0 Front End TX Configuration */ + + .FSCAL3 = 0xEA, /* FSCAL3 Frequency Synthesizer Calibration */ + .FSCAL2 = 0x2A, /* FSCAL2 Frequency Synthesizer Calibration */ + .FSCAL1 = 0x00, /* FSCAL1 Frequency Synthesizer Calibration */ + .FSCAL0 = 0x1F, /* FSCAL0 Frequency Synthesizer Calibration */ + + .CHMIN = 0, /* VERIFY REGULATIONS! */ + .CHMAX = 0xFF, + + .PAMAX = 8, /* 0 means power OFF, 8 represents PA[7] */ + .PA = {0x03, 0x0E, 0x1E, 0x27, 0x39, 0x8E, 0xCD, 0xC0} +}; diff --git a/nuttx/drivers/wireless/Kconfig b/nuttx/drivers/wireless/Kconfig index ae2bf3130..9e0c09625 100644 --- a/nuttx/drivers/wireless/Kconfig +++ b/nuttx/drivers/wireless/Kconfig @@ -2,3 +2,55 @@ # For a description of the syntax of this configuration file, # see misc/tools/kconfig-language.txt. # + +config WL_CC1101 + bool "CC1101 RF transceiver support" + default n + select SPI + +config WL_NRF24L01 + bool "nRF24l01+ transceiver support" + default n + select SPI + ---help--- + This options adds driver support for the Nordic nRF24L01+ chip. + +if WL_NRF24L01 + +config WL_NRF24L01_DFLT_ADDR_WIDTH + int "Default address width" + default 5 + range 3 5 + ---help--- + Default address width to be used by the nRF24l01+ driver. + Note that this default can be changed through the driver API. + +config WL_NRF24L01_CHECK_PARAMS + bool "Check call parameters" + default y + ---help--- + This option adds some sanity check code to parameters given in the + driver API functions. If this option is disabled, parameter + values are passed 'as is' to the module hardware registers. + +config WL_NRF24L01_RXSUPPORT + bool "Support messages reception" + default y + ---help--- + If this opion is disabled the driver supports only the transmission of messages. + Reception of messages will be disabled (and corresponding functions removed). + Note: this option is intended to reduce driver code size for 'transmission + only' devices. + +if WL_NRF24L01_RXSUPPORT + +config WL_NRF24L01_RXFIFO_LEN + int "RX fifo length" + default 128 + range 34 2048 + ---help--- + Length of the software based fifo used to store content of + received messages. + +endif +endif diff --git a/nuttx/drivers/wireless/Make.defs b/nuttx/drivers/wireless/Make.defs index fa8e8acb5..3e7126acc 100644 --- a/nuttx/drivers/wireless/Make.defs +++ b/nuttx/drivers/wireless/Make.defs @@ -37,11 +37,17 @@ ifeq ($(CONFIG_WIRELESS),y) # Include wireless drivers +ifeq ($(CONFIG_WL_CC1101),y) CSRCS += cc1101.c ISM1_868MHzGFSK100kbps.c ISM2_905MHzGFSK250kbps.c +endif + +ifeq ($(CONFIG_WL_NRF24L01),y) +CSRCS += nrf24l01.c +endif -# Include wireless build support +# Include wireless devices build support -DEPPATH += --dep-path wireless$(DELIM)cc1101 -VPATH += :wireless$(DELIM)cc1101 -CFLAGS += ${shell $(INCDIR) $(INCDIROPT) "$(CC)" $(TOPDIR)$(DELIM)drivers$(DELIM)wireless$(DELIM)cc1101} +DEPPATH += --dep-path wireless +VPATH += :wireless +CFLAGS += ${shell $(INCDIR) $(INCDIROPT) "$(CC)" $(TOPDIR)$(DELIM)drivers$(DELIM)wireless} endif diff --git a/nuttx/drivers/wireless/cc1101/cc1101.c b/nuttx/drivers/wireless/cc1101.c index 45faaecd2..b573a5342 100644 --- a/nuttx/drivers/wireless/cc1101/cc1101.c +++ b/nuttx/drivers/wireless/cc1101.c @@ -1,5 +1,5 @@ /**************************************************************************** - * drivers/wireless/cc1101/cc1101.c + * drivers/wireless/cc1101.c * * Copyright (C) 2011 Uros Platise. All rights reserved. * @@ -34,68 +34,68 @@ * ****************************************************************************/ -/** \file - * \author Uros Platise - * \brief Chipcon CC1101 Device Driver - * - * Features: +/* Features: * - Maximum data length: 61 bytes CC1101_PACKET_MAXDATALEN * - Packet length includes two additional bytes: CC1101_PACKET_MAXTOTALLEN * - Requires one GDO to trigger end-of-packets in RX and TX modes. * - Variable packet length with data payload between 1..61 bytes * (three bytes are reserved for packet length, and RSSI and LQI * appended at the end of RXFIFO after each reception) - * - Support for General Digital Outputs with overload protection + * - Support for General Digital Outputs with overload protection * (single XOSC pin is allowed, otherwise error is returned) * - Loadable RF settings, one for ISM Region 1 (Europe) and one for * ISM Region 2 (Complete America) - * + * * Todo: * - Extend max packet length up to 255 bytes or rather infinite < 4096 bytes * - Power up/down modes * - Sequencing between states or add protection for correct termination of * various different state (so that CC1101 does not block in case of improper use) - * - * \par RSSI and LQI value interpretation - * - * The LQI can be read from the LQI status register or it can be appended - * to the received packet in the RX FIFO. LQI is a metric of the current - * quality of the received signal. The LQI gives an estimate of how easily - * a received signal can be demodulated by accumulating the magnitude of - * the error between ideal constellations and the received signal over - * the 64 symbols immediately following the sync word. LQI is best used - * as a relative measurement of the link quality (a high value indicates - * a better link than what a low value does), since the value is dependent + * + * RSSI and LQI value interpretation + * + * The LQI can be read from the LQI status register or it can be appended + * to the received packet in the RX FIFO. LQI is a metric of the current + * quality of the received signal. The LQI gives an estimate of how easily + * a received signal can be demodulated by accumulating the magnitude of + * the error between ideal constellations and the received signal over + * the 64 symbols immediately following the sync word. LQI is best used + * as a relative measurement of the link quality (a high value indicates + * a better link than what a low value does), since the value is dependent * on the modulation format. - * - * To simplify: If the received modulation is FSK or GFSK, the receiver - * will measure the frequency of each "bit" and compare it with the - * expected frequency based on the channel frequency and the deviation - * and the measured frequency offset. If other modulations are used, the - * error of the modulated parameter (frequency for FSK/GFSK, phase for - * MSK, amplitude for ASK etc) will be measured against the expected + * + * To simplify: If the received modulation is FSK or GFSK, the receiver + * will measure the frequency of each "bit" and compare it with the + * expected frequency based on the channel frequency and the deviation + * and the measured frequency offset. If other modulations are used, the + * error of the modulated parameter (frequency for FSK/GFSK, phase for + * MSK, amplitude for ASK etc) will be measured against the expected * ideal value - * - * RSSI (Received Signal Strength Indicator) is a signal strength - * indication. It does not care about the "quality" or "correctness" of - * the signal. LQI does not care about the actual signal strength, but - * the signal quality often is linked to signal strength. This is because - * a strong signal is likely to be less affected by noise and thus will + * + * RSSI (Received Signal Strength Indicator) is a signal strength + * indication. It does not care about the "quality" or "correctness" of + * the signal. LQI does not care about the actual signal strength, but + * the signal quality often is linked to signal strength. This is because + * a strong signal is likely to be less affected by noise and thus will * be seen as "cleaner" or more "correct" by the receiver. - * - * There are four to five "extreme cases" that can be used to illustrate + * + * There are four to five "extreme cases" that can be used to illustrate * how RSSI and LQI work: * 1. A weak signal in the presence of noise may give low RSSI and low LQI. * 2. A weak signal in "total" absence of noise may give low RSSI and high LQI. * 3. Strong noise (usually coming from an interferer) may give high RSSI and low LQI. * 4. A strong signal without much noise may give high RSSI and high LQI. - * 5. A very strong signal that causes the receiver to saturate may give + * 5. A very strong signal that causes the receiver to saturate may give * high RSSI and low LQI. - * - * Note that both RSSI and LQI are best used as relative measurements since + * + * Note that both RSSI and LQI are best used as relative measurements since * the values are dependent on the modulation format. - **/ - + */ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + #include <nuttx/config.h> #include <assert.h> #include <stdlib.h> @@ -106,9 +106,8 @@ #include <nuttx/kmalloc.h> #include <nuttx/wireless/cc1101.h> - /**************************************************************************** - * Declarations + * Pre-rocessor Definitions ****************************************************************************/ #define CC1101_SPIFREQ_BURST 6500000 /* Hz, no delay */ @@ -221,9 +220,8 @@ #define CC1101_MCSM0_XOSC_FORCE_ON 0x01 - -/* - * Chip Status Byte +/* + * Chip Status Byte */ /* Bit fields in the chip status byte */ @@ -276,13 +274,13 @@ #define CC1101_VERSION_VALUE 0x04 /* - * Others ... + * Others ... */ #define CC1101_LQI_CRC_OK_BM 0x80 #define CC1101_LQI_EST_BM 0x7F - + /**************************************************************************** * Private Data Types ****************************************************************************/ @@ -290,97 +288,96 @@ #define FLAGS_RXONLY 1 /* Indicates receive operation only */ #define FLAGS_XOSCENABLED 2 /* Indicates that one pin is configured as XOSC/n */ -struct cc1101_dev_s { - const struct c1101_rfsettings_s *rfsettings; - - struct spi_dev_s * spi; - uint8_t isrpin; /* CC1101 pin used to trigger interrupts */ - uint32_t pinset; /* GPIO of the MCU */ - uint8_t flags; - uint8_t channel; - uint8_t power; +struct cc1101_dev_s +{ + const struct c1101_rfsettings_s *rfsettings; + + struct spi_dev_s * spi; + uint8_t isrpin; /* CC1101 pin used to trigger interrupts */ + uint32_t pinset; /* GPIO of the MCU */ + uint8_t flags; + uint8_t channel; + uint8_t power; }; - /**************************************************************************** * Private Functions ****************************************************************************/ - + void cc1101_access_begin(struct cc1101_dev_s * dev) { - (void)SPI_LOCK(dev->spi, true); - SPI_SELECT(dev->spi, SPIDEV_WIRELESS, true); - SPI_SETMODE(dev->spi, SPIDEV_MODE0); /* CPOL=0, CPHA=0 */ - SPI_SETBITS(dev->spi, 8); + (void)SPI_LOCK(dev->spi, true); + SPI_SELECT(dev->spi, SPIDEV_WIRELESS, true); + SPI_SETMODE(dev->spi, SPIDEV_MODE0); /* CPOL=0, CPHA=0 */ + SPI_SETBITS(dev->spi, 8); } - void cc1101_access_end(struct cc1101_dev_s * dev) { - SPI_SELECT(dev->spi, SPIDEV_WIRELESS, false); - (void)SPI_LOCK(dev->spi, false); + SPI_SELECT(dev->spi, SPIDEV_WIRELESS, false); + (void)SPI_LOCK(dev->spi, false); } - /** CC1101 Access with Range Check - * + * * \param dev CC1101 Private Structure * \param addr CC1101 Address * \param buf Pointer to buffer, either for read or write access - * \param length when >0 it denotes read access, when <0 it denotes write - * access of -length. abs(length) greater of 1 implies burst mode, - * however + * \param length when >0 it denotes read access, when <0 it denotes write + * access of -length. abs(length) greater of 1 implies burst mode, + * however * \return OK on success or errno is set. */ + int cc1101_access(struct cc1101_dev_s * dev, uint8_t addr, uint8_t *buf, int length) { - int stabyte; + int stabyte; - /* Address cannot explicitly define READ command while length WRITE. - * Also access to these cells is only permitted as one byte, eventhough - * transfer is marked as BURST! - */ + /* Address cannot explicitly define READ command while length WRITE. + * Also access to these cells is only permitted as one byte, eventhough + * transfer is marked as BURST! + */ - if ( (addr & CC1101_READ_SINGLE) && length != 1 ) + if ((addr & CC1101_READ_SINGLE) && length != 1) return ERROR; /* Prepare SPI */ - + cc1101_access_begin(dev); - + if (length>1 || length < -1) SPI_SETFREQUENCY(dev->spi, CC1101_SPIFREQ_BURST); else SPI_SETFREQUENCY(dev->spi, CC1101_SPIFREQ_SINGLE); - + /* Transfer */ - + if (length <= 0) { /* 0 length are command strobes */ - if (length < -1) + if (length < -1) addr |= CC1101_WRITE_BURST; - + stabyte = SPI_SEND(dev->spi, addr); if (length) { SPI_SNDBLOCK(dev->spi, buf, -length); - } + } } else { addr |= CC1101_READ_SINGLE; - if (length > 1) + if (length > 1) addr |= CC1101_READ_BURST; - + stabyte = SPI_SEND(dev->spi, addr); SPI_RECVBLOCK(dev->spi, buf, length); } - + cc1101_access_end(dev); return stabyte; } -/** Strobes command and returns chip status byte - * - * By default commands are send as Write. To a command, +/** Strobes command and returns chip status byte + * + * By default commands are send as Write. To a command, * CC1101_READ_SINGLE may be OR'ed to obtain the number of RX bytes * pending in RX FIFO. */ @@ -390,11 +387,11 @@ inline uint8_t cc1101_strobe(struct cc1101_dev_s * dev, uint8_t command) cc1101_access_begin(dev); SPI_SETFREQUENCY(dev->spi, CC1101_SPIFREQ_SINGLE); - + status = SPI_SEND(dev->spi, command); - + cc1101_access_end(dev); - + return status; } @@ -409,14 +406,14 @@ int cc1101_reset(struct cc1101_dev_s * dev) int cc1101_checkpart(struct cc1101_dev_s * dev) { uint8_t partnum, version; - + if (cc1101_access(dev, CC1101_PARTNUM, &partnum, 1) < 0 || - cc1101_access(dev, CC1101_VERSION, &version, 1) < 0) + cc1101_access(dev, CC1101_VERSION, &version, 1) < 0) return ERROR; - + if (partnum == CC1101_PARTNUM_VALUE && version == CC1101_VERSION_VALUE) return OK; - + return ERROR; } @@ -424,9 +421,9 @@ int cc1101_checkpart(struct cc1101_dev_s * dev) void cc1101_dumpregs(struct cc1101_dev_s * dev, uint8_t addr, uint8_t length) { uint8_t buf[0x30], i; - + cc1101_access(dev, addr, buf, length); - + printf("CC1101[%2x]: ", addr); for (i=0; i<length; i++) printf(" %2x,", buf[i]); printf("\n"); @@ -436,19 +433,19 @@ void cc1101_dumpregs(struct cc1101_dev_s * dev, uint8_t addr, uint8_t length) void cc1101_setpacketctrl(struct cc1101_dev_s * dev) { uint8_t values[3]; - + values[0] = 0; /* Rx FIFO threshold = 32, Tx FIFO threshold = 33 */ cc1101_access(dev, CC1101_FIFOTHR, values, -1); - - /* Packet length - * Limit it to 61 bytes in total: pktlen, data[61], rssi, lqi + + /* Packet length + * Limit it to 61 bytes in total: pktlen, data[61], rssi, lqi */ - - values[0] = CC1101_PACKET_MAXDATALEN; + + values[0] = CC1101_PACKET_MAXDATALEN; cc1101_access(dev, CC1101_PKTLEN, values, -1); /* Packet Control */ - + values[0] = 0x04; /* Append status: RSSI and LQI at the end of received packet */ /* TODO: CRC Auto Flash bit 0x08 ??? */ values[1] = 0x05; /* CRC in Rx and Tx Enabled: Variable Packet mode, defined by first byte */ @@ -456,18 +453,18 @@ void cc1101_setpacketctrl(struct cc1101_dev_s * dev) cc1101_access(dev, CC1101_PKTCTRL1, values, -2); /* Main Radio Control State Machine */ - + values[0] = 0x07; /* No time-out */ values[1] = 0x00; /* Clear channel if RSSI < thr && !receiving; * TX -> RX, RX -> RX: 0x3F */ values[2] = CC1101_MCSM0_VALUE; /* Calibrate on IDLE -> RX/TX, OSC Timeout = ~500 us TODO: has XOSC_FORCE_ON */ cc1101_access(dev, CC1101_MCSM2, values, -3); - + /* Wake-On Radio Control */ - + // Not used yet. - + // WOREVT1:WOREVT0 - 16-bit timeout register } @@ -476,14 +473,14 @@ void cc1101_setpacketctrl(struct cc1101_dev_s * dev) * Callbacks ****************************************************************************/ -volatile int cc1101_interrupt = 0; - -/** External line triggers this callback - * +volatile int cc1101_interrupt = 0; + +/** External line triggers this callback + * * The concept todo is: * - GPIO provides EXTI Interrupt * - It should handle EXTI Interrupts in ISR, to which chipcon can - * register a callback (and others). The ISR then foreach() calls a + * register a callback (and others). The ISR then foreach() calls a * its callback, and it is up to peripheral to find, whether the cause * of EXTI ISR was itself. **/ @@ -498,315 +495,362 @@ int cc1101_eventcb(int irq, FAR void *context) * Public Functions ****************************************************************************/ -struct cc1101_dev_s * cc1101_init(struct spi_dev_s * spi, uint8_t isrpin, +struct cc1101_dev_s * cc1101_init(struct spi_dev_s * spi, uint8_t isrpin, uint32_t pinset, const struct c1101_rfsettings_s * rfsettings) { - struct cc1101_dev_s * dev; - - ASSERT(spi); - - if ( (dev = kmalloc( sizeof(struct cc1101_dev_s) )) == NULL) { - errno = ENOMEM; - return NULL; + struct cc1101_dev_s * dev; + + ASSERT(spi); + + if ((dev = kmalloc(sizeof(struct cc1101_dev_s))) == NULL) + { + errno = ENOMEM; + return NULL; } - - dev->rfsettings = rfsettings; - dev->spi = spi; - dev->isrpin = isrpin; - dev->pinset = pinset; - dev->flags = 0; - dev->channel = rfsettings->CHMIN; - dev->power = rfsettings->PAMAX; - - /* Reset chip, check status bytes */ - - if ( cc1101_reset(dev) < 0 ) { - kfree(dev); - errno = EFAULT; - return NULL; + + dev->rfsettings = rfsettings; + dev->spi = spi; + dev->isrpin = isrpin; + dev->pinset = pinset; + dev->flags = 0; + dev->channel = rfsettings->CHMIN; + dev->power = rfsettings->PAMAX; + + /* Reset chip, check status bytes */ + + if (cc1101_reset(dev) < 0) + { + kfree(dev); + errno = EFAULT; + return NULL; } - /* Check part compatibility */ - - if ( cc1101_checkpart(dev) < 0 ) { - kfree(dev); - errno = ENODEV; - return NULL; + /* Check part compatibility */ + + if (cc1101_checkpart(dev) < 0) + { + kfree(dev); + errno = ENODEV; + return NULL; } - - /* Configure CC1101: - * - disable GDOx for best performance - * - load RF - * - and packet control - */ - - cc1101_setgdo(dev, CC1101_PIN_GDO0, CC1101_GDO_HIZ); - cc1101_setgdo(dev, CC1101_PIN_GDO1, CC1101_GDO_HIZ); - cc1101_setgdo(dev, CC1101_PIN_GDO2, CC1101_GDO_HIZ); - cc1101_setrf(dev, rfsettings); - cc1101_setpacketctrl(dev); - - /* Set the ISR to be triggerred on falling edge of the: - * - * 6 (0x06) Asserts when sync word has been sent / received, and - * de-asserts at the end of the packet. In RX, the pin will de-assert - * when the optional address check fails or the RX FIFO overflows. - * In TX the pin will de-assert if the TX FIFO underflows. - */ - cc1101_setgdo(dev, dev->isrpin, CC1101_GDO_SYNC); - - /* Bind to external interrupt line */ + /* Configure CC1101: + * - disable GDOx for best performance + * - load RF + * - and packet control + */ - // depends on STM32: TODO: Make that config within pinset and - // provide general gpio interface - //stm32_gpiosetevent(pinset, false, true, true, cc1101_eventcb); + cc1101_setgdo(dev, CC1101_PIN_GDO0, CC1101_GDO_HIZ); + cc1101_setgdo(dev, CC1101_PIN_GDO1, CC1101_GDO_HIZ); + cc1101_setgdo(dev, CC1101_PIN_GDO2, CC1101_GDO_HIZ); + cc1101_setrf(dev, rfsettings); + cc1101_setpacketctrl(dev); - return dev; -} + /* Set the ISR to be triggerred on falling edge of the: + * + * 6 (0x06) Asserts when sync word has been sent / received, and + * de-asserts at the end of the packet. In RX, the pin will de-assert + * when the optional address check fails or the RX FIFO overflows. + * In TX the pin will de-assert if the TX FIFO underflows. + */ + + cc1101_setgdo(dev, dev->isrpin, CC1101_GDO_SYNC); + + /* Bind to external interrupt line */ + /* depends on STM32: TODO: Make that config within pinset and + * provide general gpio interface + * stm32_gpiosetevent(pinset, false, true, true, cc1101_eventcb); + */ + + return dev; +} int cc1101_deinit(struct cc1101_dev_s * dev) { - ASSERT(dev); - - /* Release interrupt */ - //stm32_gpiosetevent(pinset, false, false, false, NULL); - - /* Power down chip */ - cc1101_powerdown(dev); - - /* Release external interrupt line */ - kfree(dev); - - return 0; -} + ASSERT(dev); + + /* Release interrupt */ + /* stm32_gpiosetevent(pinset, false, false, false, NULL); */ + + /* Power down chip */ + cc1101_powerdown(dev); + + /* Release external interrupt line */ + + kfree(dev); + return 0; +} int cc1101_powerup(struct cc1101_dev_s * dev) { - ASSERT(dev); - return 0; + ASSERT(dev); + return 0; } - int cc1101_powerdown(struct cc1101_dev_s * dev) { - ASSERT(dev); - return 0; + ASSERT(dev); + return 0; } - int cc1101_setgdo(struct cc1101_dev_s * dev, uint8_t pin, uint8_t function) { - ASSERT(dev); - ASSERT(pin <= CC1101_IOCFG0); - - if (function >= CC1101_GDO_CLK_XOSC1) { - - /* Only one pin can be enabled at a time as XOSC/n */ - - if (dev->flags & FLAGS_XOSCENABLED) return -EPERM; - - /* Force XOSC to stay active even in sleep mode */ - - int value = CC1101_MCSM0_VALUE | CC1101_MCSM0_XOSC_FORCE_ON; - cc1101_access(dev, CC1101_MCSM0, &value, -1); - - dev->flags |= FLAGS_XOSCENABLED; + ASSERT(dev); + ASSERT(pin <= CC1101_IOCFG0); + + if (function >= CC1101_GDO_CLK_XOSC1) + { + /* Only one pin can be enabled at a time as XOSC/n */ + + if (dev->flags & FLAGS_XOSCENABLED) + { + return -EPERM; + } + + /* Force XOSC to stay active even in sleep mode */ + + int value = CC1101_MCSM0_VALUE | CC1101_MCSM0_XOSC_FORCE_ON; + cc1101_access(dev, CC1101_MCSM0, &value, -1); + + dev->flags |= FLAGS_XOSCENABLED; } - else if (dev->flags & FLAGS_XOSCENABLED) { - - /* Disable XOSC in sleep mode */ - - int value = CC1101_MCSM0_VALUE; - cc1101_access(dev, CC1101_MCSM0, &value, -1); - - dev->flags &= ~FLAGS_XOSCENABLED; + else if (dev->flags & FLAGS_XOSCENABLED) + { + /* Disable XOSC in sleep mode */ + + int value = CC1101_MCSM0_VALUE; + cc1101_access(dev, CC1101_MCSM0, &value, -1); + + dev->flags &= ~FLAGS_XOSCENABLED; } - - return cc1101_access(dev, pin, &function, -1); -} + return cc1101_access(dev, pin, &function, -1); +} int cc1101_setrf(struct cc1101_dev_s * dev, const struct c1101_rfsettings_s *settings) { - ASSERT(dev); - ASSERT(settings); - - if (cc1101_access(dev, CC1101_FSCTRL1, &settings->FSCTRL1, -11) < 0) return ERROR; - if (cc1101_access(dev, CC1101_FOCCFG, &settings->FOCCFG, -5) < 0) return ERROR; - if (cc1101_access(dev, CC1101_FREND1, &settings->FREND1, -6) < 0) return ERROR; - - /* Load Power Table */ - - if (cc1101_access(dev, CC1101_PATABLE, settings->PA, -8) < 0) return ERROR; - - /* If channel is out of valid range, mark that. Limit power. - * We are not allowed to send any data, but are allowed to listen - * and receive. - */ + ASSERT(dev); + ASSERT(settings); + + if (cc1101_access(dev, CC1101_FSCTRL1, &settings->FSCTRL1, -11) < 0) + { + return ERROR; + } + + if (cc1101_access(dev, CC1101_FOCCFG, &settings->FOCCFG, -5) < 0) + { + return ERROR; + } + + if (cc1101_access(dev, CC1101_FREND1, &settings->FREND1, -6) < 0) + { + return ERROR; + } + + /* Load Power Table */ + + if (cc1101_access(dev, CC1101_PATABLE, settings->PA, -8) < 0) + { + return ERROR; + } + + /* If channel is out of valid range, mark that. Limit power. + * We are not allowed to send any data, but are allowed to listen + * and receive. + */ + + cc1101_setchannel(dev, dev->channel); + cc1101_setpower(dev, dev->power); - cc1101_setchannel(dev, dev->channel); - cc1101_setpower(dev, dev->power); - return OK; } - int cc1101_setchannel(struct cc1101_dev_s * dev, uint8_t channel) { - ASSERT(dev); - - /* Store localy in further checks */ - - dev->channel = channel; - - /* If channel is out of valid, we are allowed to listen and receive only */ - - if (channel < dev->rfsettings->CHMIN || channel > dev->rfsettings->CHMAX) - dev->flags |= FLAGS_RXONLY; - else dev->flags &= ~FLAGS_RXONLY; - - cc1101_access(dev, CC1101_CHANNR, &dev->channel, -1); - - return dev->flags & FLAGS_RXONLY; -} + ASSERT(dev); + + /* Store localy in further checks */ + + dev->channel = channel; + /* If channel is out of valid, we are allowed to listen and receive only */ + + if (channel < dev->rfsettings->CHMIN || channel > dev->rfsettings->CHMAX) + { + dev->flags |= FLAGS_RXONLY; + } + else + { + dev->flags &= ~FLAGS_RXONLY; + } + + cc1101_access(dev, CC1101_CHANNR, &dev->channel, -1); + return dev->flags & FLAGS_RXONLY; +} uint8_t cc1101_setpower(struct cc1101_dev_s * dev, uint8_t power) { - ASSERT(dev); - - if (power > dev->rfsettings->PAMAX) - power = dev->rfsettings->PAMAX; - - dev->power = power; - - if (power == 0) { - dev->flags |= FLAGS_RXONLY; - return 0; + ASSERT(dev); + + if (power > dev->rfsettings->PAMAX) + { + power = dev->rfsettings->PAMAX; + } + + dev->power = power; + + if (power == 0) + { + dev->flags |= FLAGS_RXONLY; + return 0; + } + else + { + dev->flags &= ~FLAGS_RXONLY; } - else dev->flags &= ~FLAGS_RXONLY; - - /* Add remaining part from RF table (to get rid of readback) */ - - power--; - power |= dev->rfsettings->FREND0; - - /* On error, report that as zero power */ - - if (cc1101_access(dev, CC1101_FREND0, &power, -1) < 0) - dev->power = 0; - + + /* Add remaining part from RF table (to get rid of readback) */ + + power--; + power |= dev->rfsettings->FREND0; + + /* On error, report that as zero power */ + + if (cc1101_access(dev, CC1101_FREND0, &power, -1) < 0) + { + dev->power = 0; + } + return dev->power; } - int cc1101_calcRSSIdBm(int rssi) { - if (rssi >= 128) rssi -= 256; - return (rssi >> 1) - 74; -} + if (rssi >= 128) + { + rssi -= 256; + } + return (rssi >> 1) - 74; +} int cc1101_receive(struct cc1101_dev_s * dev) { - ASSERT(dev); + ASSERT(dev); - /* \todo Wait for IDLE before going into another state? */ + /* \todo Wait for IDLE before going into another state? */ - cc1101_interrupt = 0; - - cc1101_strobe(dev, CC1101_SRX | CC1101_READ_SINGLE); - - return 0; -} + cc1101_interrupt = 0; + cc1101_strobe(dev, CC1101_SRX | CC1101_READ_SINGLE); + + return 0; +} int cc1101_read(struct cc1101_dev_s * dev, uint8_t * buf, size_t size) { - ASSERT(dev); - - if (buf==NULL) { - if (size==0) return 64; - // else received packet size - return 0; + ASSERT(dev); + + if (buf==NULL) + { + if (size==0) + { + return 64; + } + + /* else received packet size */ + + return 0; + } + + if (cc1101_interrupt == 0) + { + return 0; } - - if (cc1101_interrupt == 0) return 0; - - int status = cc1101_strobe(dev, CC1101_SNOP | CC1101_READ_SINGLE); - - if (status & CC1101_STATUS_FIFO_BYTES_AVAILABLE_BM && - (status & CC1101_STATE_MASK) == CC1101_STATE_IDLE) { - - uint8_t nbytes; - - cc1101_access(dev, CC1101_RXFIFO, &nbytes, 1); - - nbytes += 2; /* RSSI and LQI */ - - cc1101_access(dev, CC1101_RXFIFO, buf, (nbytes > size) ? size : nbytes); - - /* Flush remaining bytes, if there is no room to receive - * or if there is a BAD CRC - */ - - if (nbytes > size || (nbytes <= size && !(buf[nbytes-1]&0x80)) ) { - printf("Flushing RX FIFO\n"); - cc1101_strobe(dev, CC1101_SFRX); + + int status = cc1101_strobe(dev, CC1101_SNOP | CC1101_READ_SINGLE); + + if (status & CC1101_STATUS_FIFO_BYTES_AVAILABLE_BM && + (status & CC1101_STATE_MASK) == CC1101_STATE_IDLE) + { + uint8_t nbytes; + + cc1101_access(dev, CC1101_RXFIFO, &nbytes, 1); + + nbytes += 2; /* RSSI and LQI */ + + cc1101_access(dev, CC1101_RXFIFO, buf, (nbytes > size) ? size : nbytes); + + /* Flush remaining bytes, if there is no room to receive + * or if there is a BAD CRC + */ + + if (nbytes > size || (nbytes <= size && !(buf[nbytes-1]&0x80))) + { + printf("Flushing RX FIFO\n"); + cc1101_strobe(dev, CC1101_SFRX); } - - return nbytes; + + return nbytes; } - - return 0; -} + return 0; +} int cc1101_write(struct cc1101_dev_s * dev, const uint8_t * buf, size_t size) { - uint8_t packetlen; - - ASSERT(dev); - ASSERT(buf); - - if (dev->flags & FLAGS_RXONLY) return -EPERM; - - /* Present limit */ - if (size > CC1101_PACKET_MAXDATALEN) - packetlen = CC1101_PACKET_MAXDATALEN; - else packetlen = size; - - cc1101_access(dev, CC1101_TXFIFO, &packetlen, -1); - cc1101_access(dev, CC1101_TXFIFO, buf, -size); - - return 0; -} + uint8_t packetlen; + + ASSERT(dev); + ASSERT(buf); + + if (dev->flags & FLAGS_RXONLY) + { + return -EPERM; + } + /* Present limit */ + + if (size > CC1101_PACKET_MAXDATALEN) + { + packetlen = CC1101_PACKET_MAXDATALEN; + } + else + { + packetlen = size; + } + + cc1101_access(dev, CC1101_TXFIFO, &packetlen, -1); + cc1101_access(dev, CC1101_TXFIFO, buf, -size); + + return 0; +} int cc1101_send(struct cc1101_dev_s * dev) { - ASSERT(dev); - - if (dev->flags & FLAGS_RXONLY) return -EPERM; - - cc1101_interrupt = 0; - - cc1101_strobe(dev, CC1101_STX); - - /* wait until send, going to IDLE */ - - while( cc1101_interrupt == 0 ); - - return 0; -} + ASSERT(dev); + + if (dev->flags & FLAGS_RXONLY) + { + return -EPERM; + } + + cc1101_interrupt = 0; + cc1101_strobe(dev, CC1101_STX); + + /* wait until send, going to IDLE */ + + while (cc1101_interrupt == 0); + + return 0; +} int cc1101_idle(struct cc1101_dev_s * dev) { - ASSERT(dev); - cc1101_strobe(dev, CC1101_SIDLE); - return 0; + ASSERT(dev); + cc1101_strobe(dev, CC1101_SIDLE); + return 0; } diff --git a/nuttx/drivers/wireless/cc1101/ISM1_868MHzGFSK100kbps.c b/nuttx/drivers/wireless/cc1101/ISM1_868MHzGFSK100kbps.c deleted file mode 100644 index 5c4c58ab2..000000000 --- a/nuttx/drivers/wireless/cc1101/ISM1_868MHzGFSK100kbps.c +++ /dev/null @@ -1,113 +0,0 @@ -/**************************************************************************** - * drivers/wireless/cc1101/ISM1_868MHzGFSK100kbps.c - * - * Copyright (C) 2011 Uros Platise. All rights reserved. - * Copyright (C) 2011 Ales Verbic. All rights reserved. - * - * Authors: Uros Platise <uros.platise@isotel.eu> - * Ales Verbic <ales.verbic@isotel.eu> - * - * 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 <nuttx/wireless/cc1101.h> - -/** Settings for 868 MHz, GFSK at 100kbps - * - * ISM Region 1 (Europe) only, Band 868–870 MHz - * - * Frequency ERP Duty Cycle Bandwidth Remarks - * 868 – 868.6 MHz +14 dBm < 1% No limits - * 868.7 – 869.2 MHz +14 dBm < 0.1% No limits - * 869.3 – 869.4 MHz +10 dBm No limits < 25 kHz Appropriate access protocol required - * 869.4 – 869.65 MHz +27 dBm < 10% < 25 kHz Channels may be combined to one high speed channel - * 869.7 -870 MHz +7 dBm No limits No limits - * - * Deviation = 46.142578 - * Base frequency = 867.999985 - * Carrier frequency = 867.999985 - * Channel number = 0 - * Carrier frequency = 867.999985 - * Modulated = true - * Modulation format = GFSK - * Manchester enable = false - * Sync word qualifier mode = 30/32 sync word bits detected - * Preamble count = 4 - * Channel spacing = 199.813843 - * Carrier frequency = 867.999985 - * Data rate = 99.9069 - * RX filter BW = 210.937500 - * Data format = Normal mode - * Length config = Fixed packet length mode. Length configured in PKTLEN register - * CRC enable = true - * Packet length = 62 - * Device address = 00 - * Address config = NO Address check, no broadcast - * CRC autoflush = true - * PA ramping = false - * TX power = 0 - */ -const struct c1101_rfsettings_s cc1101_rfsettings_ISM1_868MHzGFSK100kbps = { - .FSCTRL1 = 0x08, // FSCTRL1 Frequency Synthesizer Control - .FSCTRL0 = 0x00, // FSCTRL0 Frequency Synthesizer Control - - .FREQ2 = 0x20, // FREQ2 Frequency Control Word, High Byte - .FREQ1 = 0x25, // FREQ1 Frequency Control Word, Middle Byte - .FREQ0 = 0xED, // FREQ0 Frequency Control Word, Low Byte - - .MDMCFG4 = 0x8B, // MDMCFG4 Modem Configuration - .MDMCFG3 = 0xE5, // MDMCFG3 Modem Configuration - .MDMCFG2 = 0x13, // MDMCFG2 Modem Configuration - .MDMCFG1 = 0x22, // MDMCFG1 Modem Configuration - .MDMCFG0 = 0xE5, // MDMCFG0 Modem Configuration - - .DEVIATN = 0x46, // DEVIATN Modem Deviation Setting - - .FOCCFG = 0x1D, // FOCCFG Frequency Offset Compensation Configuration - - .BSCFG = 0x1C, // BSCFG Bit Synchronization Configuration - - .AGCCTRL2= 0xC7, // AGCCTRL2 AGC Control - .AGCCTRL1= 0x00, // AGCCTRL1 AGC Control - .AGCCTRL0= 0xB2, // AGCCTRL0 AGC Control - - .FREND1 = 0xB6, // FREND1 Front End RX Configuration - .FREND0 = 0x10, // FREND0 Front End TX Configuration - - .FSCAL3 = 0xEA, // FSCAL3 Frequency Synthesizer Calibration - .FSCAL2 = 0x2A, // FSCAL2 Frequency Synthesizer Calibration - .FSCAL1 = 0x00, // FSCAL1 Frequency Synthesizer Calibration - .FSCAL0 = 0x1F, // FSCAL0 Frequency Synthesizer Calibration - - .CHMIN = 0, // Fix at 9th channel: 869.80 MHz +- 100 kHz RF Bandwidth - .CHMAX = 9, // single channel - - .PAMAX = 8, // 0 means power OFF, 8 represents PA[7] - .PA = {0x03, 0x0F, 0x1E, 0x27, 0x67, 0x50, 0x81, 0xC2} -}; diff --git a/nuttx/drivers/wireless/cc1101/ISM2_905MHzGFSK250kbps.c b/nuttx/drivers/wireless/cc1101/ISM2_905MHzGFSK250kbps.c deleted file mode 100644 index e5655bed6..000000000 --- a/nuttx/drivers/wireless/cc1101/ISM2_905MHzGFSK250kbps.c +++ /dev/null @@ -1,111 +0,0 @@ -/**************************************************************************** - * drivers/wireless/cc1101/ISM2_905MHzGFSK250kbps.c - * - * Copyright (C) 2011 Uros Platise. All rights reserved. - * Copyright (C) 2011 Ales Verbic. All rights reserved. - * - * Authors: Uros Platise <uros.platise@isotel.eu> - * Ales Verbic <ales.verbic@isotel.eu> - * - * 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 <nuttx/wireless/cc1101.h> - -/** Settings for 905 MHz, GFSK at 250kbps - * - * ISM Region 2 (America) only, Band 902–928 MHz - * - * Cordless phones 1 W - * Microwave ovens 750 W - * Industrial heaters 100 kW - * Military radar 1000 kW - * - * Deviation = 126.953125 - * Base frequency = 901.999969 - * Carrier frequency = 905.998993 - * Channel number = 20 - * Carrier frequency = 905.998993 - * Modulated = true - * Modulation format = GFSK - * Manchester enable = false - * Sync word qualifier mode = 30/32 sync word bits detected - * Preamble count = 4 - * Channel spacing = 199.951172 - * Carrier frequency = 905.998993 - * Data rate = 249.939 - * RX filter BW = 541.666667 - * Data format = Normal mode - * Length config = Variable packet length mode. Packet length configured by the first byte after sync word - * CRC enable = true - * Packet length = 61 - * Device address = 0 - * Address config = No address check - * CRC autoflush = false - * PA ramping = false - * TX power = 0 - */ -const struct c1101_rfsettings_s cc1101_rfsettings_ISM2_905MHzGFSK250kbps = { - .FSCTRL1 = 0x0C, // FSCTRL1 Frequency Synthesizer Control - .FSCTRL0 = 0x00, // FSCTRL0 Frequency Synthesizer Control - - .FREQ2 = 0x22, // FREQ2 Frequency Control Word, High Byte - .FREQ1 = 0xB1, // FREQ1 Frequency Control Word, Middle Byte - .FREQ0 = 0x3B, // FREQ0 Frequency Control Word, Low Byte - - .MDMCFG4 = 0x2D, // MDMCFG4 Modem Configuration - .MDMCFG3 = 0x3B, // MDMCFG3 Modem Configuration - .MDMCFG2 = 0x13, // MDMCFG2 Modem Configuration - .MDMCFG1 = 0x22, // MDMCFG1 Modem Configuration - .MDMCFG0 = 0xF8, // MDMCFG0 Modem Configuration - - .DEVIATN = 0x62, // DEVIATN Modem Deviation Setting - - .FOCCFG = 0x1D, // FOCCFG Frequency Offset Compensation Configuration - - .BSCFG = 0x1C, // BSCFG Bit Synchronization Configuration - - .AGCCTRL2= 0xC7, // AGCCTRL2 AGC Control - .AGCCTRL1= 0x00, // AGCCTRL1 AGC Control - .AGCCTRL0= 0xB0, // AGCCTRL0 AGC Control - - .FREND1 = 0xB6, // FREND1 Front End RX Configuration - .FREND0 = 0x10, // FREND0 Front End TX Configuration - - .FSCAL3 = 0xEA, // FSCAL3 Frequency Synthesizer Calibration - .FSCAL2 = 0x2A, // FSCAL2 Frequency Synthesizer Calibration - .FSCAL1 = 0x00, // FSCAL1 Frequency Synthesizer Calibration - .FSCAL0 = 0x1F, // FSCAL0 Frequency Synthesizer Calibration - - .CHMIN = 0, // VERIFY REGULATIONS! - .CHMAX = 0xFF, - - .PAMAX = 8, // 0 means power OFF, 8 represents PA[7] - .PA = {0x03, 0x0E, 0x1E, 0x27, 0x39, 0x8E, 0xCD, 0xC0} -}; diff --git a/nuttx/drivers/wireless/nrf24l01.c b/nuttx/drivers/wireless/nrf24l01.c new file mode 100644 index 000000000..abb71e725 --- /dev/null +++ b/nuttx/drivers/wireless/nrf24l01.c @@ -0,0 +1,1772 @@ +/**************************************************************************** + * drivers/wireless/nrf24l01/nrf24l01.c + * + * Copyright (C) 2013 Laurent Latil. All rights reserved. + * Authors: Laurent Latil <laurent@latil.nom.fr> + * + * 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. + * + ****************************************************************************/ + +/* Features: + * - Fixed length and dynamically sized payloads (1 - 32 bytes) + * - Management of the 6 receiver pipes + * - Configuration of each pipe: address, packet length, auto-acknowledge, etc. + * - Use a FIFO buffer to store the received packets + * + * Todo: + * - Add support for payloads in ACK packets (?) + * - Add compatibility with nRF24L01 (not +) hardware (?) + * + */ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include <nuttx/config.h> +#include <assert.h> +#include <stdlib.h> +#include <string.h> +#include <errno.h> +#include <stdio.h> +#include <unistd.h> +#include <semaphore.h> +#include <poll.h> +#include <debug.h> + +#include <nuttx/kmalloc.h> + +#ifdef CONFIG_WL_NRF24L01_RXSUPPORT +# include <nuttx/wqueue.h> +#endif + +#include <nuttx/wireless/nrf24l01.h> +#include "nrf24l01.h" + +/**************************************************************************** + * Pre-processor Definitions + ****************************************************************************/ + +#ifndef CONFIG_WL_NRF24L01_DFLT_ADDR_WIDTH +# define CONFIG_WL_NRF24L01_DFLT_ADDR_WIDTH 5 +#endif + +#ifndef CONFIG_WL_NRF24L01_RXFIFO_LEN +# define CONFIG_WL_NRF24L01_RXFIFO_LEN 128 +#endif + +#ifdef CONFIG_WL_NRF24L01_CHECK_PARAMS +# define CHECK_ARGS(cond) do { if (!(cond)) return -EINVAL; } while(0) +#else +# define CHECK_ARGS(cond) +#endif + +/* Default SPI bus frequency (in Hz) */ +#define NRF24L01_SPIFREQ 9000000 /* Can go up to 10 Mbs according to datasheet */ + +/* power-down -> standby transition timing (in us). Note: this value is probably larger than required. */ +#define NRF24L01_TPD2STBY_DELAY 4500 + +#define FIFO_PKTLEN_MASK 0x1F /* 5 ls bits used to store packet length */ +#define FIFO_PKTLEN_SHIFT 0 +#define FIFO_PIPENO_MASK 0xE0 /* 3 ms bits used to store pipe # */ +#define FIFO_PIPENO_SHIFT 4 + +#define FIFO_PKTLEN(dev) (((dev->rx_fifo[dev->nxt_read] & FIFO_PKTLEN_MASK) >> FIFO_PKTLEN_SHIFT) + 1) +#define FIFO_PIPENO(dev) (((dev->rx_fifo[dev->nxt_read] & FIFO_PIPENO_MASK) >> FIFO_PIPENO_SHIFT)) +#define FIFO_HEADER(pktlen,pipeno) ((pktlen - 1) | (pipeno << FIFO_PIPENO_SHIFT)) + +#define DEV_NAME "/dev/nrf24l01" + +/**************************************************************************** + * Private Data Types + ****************************************************************************/ + +typedef enum +{ + MODE_READ, + MODE_WRITE +} nrf24l01_access_mode_t; + +#define FL_AA_ENABLED (1 << 0) + +struct nrf24l01_dev_s +{ + FAR struct spi_dev_s *spi; /* Reference to SPI bus device */ + FAR struct nrf24l01_config_s *config; /* Board specific GPIO functions */ + + nrf24l01_state_t state; /* Current state of the nRF24L01 */ + + uint8_t en_aa; /* Cache EN_AA register value */ + uint8_t en_pipes; /* Cache EN_RXADDR register value */ + bool ce_enabled; /* Cache the value of CE pin */ + uint8_t lastxmitcount; /* Retransmit count of the last succeeded AA transmission */ + uint8_t addrlen; /* Address width (3-5) */ + uint8_t pipedatalen[NRF24L01_PIPE_COUNT]; + + uint8_t pipe0addr[NRF24L01_MAX_ADDR_LEN]; /* Configured address on pipe 0 */ + + uint8_t last_recvpipeno; + sem_t sem_tx; + +#ifdef CONFIG_WL_NRF24L01_RXSUPPORT + uint8_t *rx_fifo; /* Circular RX buffer. [pipe# / pkt_len] [packet data...] */ + uint16_t fifo_len; /* Number of bytes stored in fifo */ + uint16_t nxt_read; /* Next read index */ + uint16_t nxt_write; /* Next write index */ + sem_t sem_fifo; /* Protect access to rx fifo */ + sem_t sem_rx; /* Wait for availability of received data */ + + struct work_s irq_work; /* Interrupt handling "bottom half" */ +#endif + + uint8_t nopens; /* Number of times the device has been opened */ + sem_t devsem; /* Ensures exclusive access to this structure */ +#ifndef CONFIG_DISABLE_POLL + FAR struct pollfd *pfd; /* Polled file descr (or NULL if any) */ +#endif +}; + +/**************************************************************************** + * Private Function Prototypes + ****************************************************************************/ +/* Low-level SPI helpers */ + +#ifdef CONFIG_SPI_OWNBUS +static inline void nrf24l01_configspi(FAR struct spi_dev_s *spi); +# define nrf24l01_lock(spi) +# define nrf24l01_unlock(spi) +#else +# define nrf24l01_configspi(spi); +static void nrf24l01_lock(FAR struct spi_dev_s *spi); +static void nrf24l01_unlock(FAR struct spi_dev_s *spi); +#endif + +static uint8_t nrf24l01_access(FAR struct nrf24l01_dev_s *dev, + nrf24l01_access_mode_t mode, uint8_t cmd, uint8_t *buf, int length); + +static uint8_t nrf24l01_flush_rx(FAR struct nrf24l01_dev_s *dev); + +static uint8_t nrf24l01_flush_tx(FAR struct nrf24l01_dev_s *dev); + +/* Read register from nrf24 */ + +static uint8_t nrf24l01_readreg(FAR struct nrf24l01_dev_s *dev, uint8_t reg, + uint8_t *value, int len); + +/* Read single byte value from a register of nrf24 */ + +static uint8_t nrf24l01_readregbyte(FAR struct nrf24l01_dev_s *dev, + uint8_t reg); + +static void nrf24l01_writeregbyte(FAR struct nrf24l01_dev_s *dev, uint8_t reg, + uint8_t value); + +static uint8_t nrf24l01_setregbit(FAR struct nrf24l01_dev_s *dev, uint8_t reg, + uint8_t value, bool set); + +static void nrf24l01_tostate(FAR struct nrf24l01_dev_s *dev, nrf24l01_state_t state); + +static int nrf24l01_irqhandler(FAR int irq, FAR void *context); + +static inline int nrf24l01_attachirq(FAR struct nrf24l01_dev_s *dev, xcpt_t isr); + +static int dosend(FAR struct nrf24l01_dev_s *dev, FAR const uint8_t *data, size_t datalen); + +static int nrf24l01_unregister(FAR struct nrf24l01_dev_s *dev); + +#ifdef CONFIG_WL_NRF24L01_RXSUPPORT + +void fifoput(struct nrf24l01_dev_s *dev, uint8_t pipeno, uint8_t *buffer, uint8_t buflen); + +uint8_t fifoget(struct nrf24l01_dev_s *dev, uint8_t *buffer, uint8_t buflen, uint8_t *pipeno); + +static void nrf24l01_worker(FAR void *arg); + +#endif + +/* POSIX API */ + +static int nrf24l01_open(FAR struct file *filep); + +static int nrf24l01_close(FAR struct file *filep); + +static ssize_t nrf24l01_read(FAR struct file *filep, FAR char *buffer, size_t buflen); + +static ssize_t nrf24l01_write(FAR struct file *filep, FAR const char *buffer, size_t buflen); + +static int nrf24l01_ioctl(FAR struct file *filep, int cmd, unsigned long arg); + +static int nrf24l01_poll(FAR struct file *filep, FAR struct pollfd *fds, + bool setup); + +/**************************************************************************** + * Private Data + ****************************************************************************/ + +static FAR struct nrf24l01_dev_s *g_nrf24l01dev; + +static const struct file_operations nrf24l01_fops = +{ + .open = nrf24l01_open, /* open */ + .close = nrf24l01_close, /* close */ + .read = nrf24l01_read, /* read */ + .write = nrf24l01_write, /* write */ + .seek = NULL, /* seek */ + .ioctl = nrf24l01_ioctl, /* ioctl */ +#ifndef CONFIG_DISABLE_POLL + .poll = nrf24l01_poll /* poll */ +#endif +}; + +/**************************************************************************** + * Private Functions + ****************************************************************************/ + +#ifndef CONFIG_SPI_OWNBUS +static void nrf24l01_lock(FAR struct spi_dev_s *spi) +{ + /* Lock the SPI bus because there are multiple devices competing for the + * SPI bus + */ + + (void)SPI_LOCK(spi, true); + + /* We have the lock. Now make sure that the SPI bus is configured for the + * NRF24L01 (it might have gotten configured for a different device while + * unlocked) + */ + + SPI_SELECT(spi, SPIDEV_WIRELESS, true); + SPI_SETMODE(spi, SPIDEV_MODE0); + SPI_SETBITS(spi, 8); + SPI_SETFREQUENCY(spi, NRF24L01_SPIFREQ); + SPI_SELECT(spi, SPIDEV_WIRELESS, false); +} +#endif + +/**************************************************************************** + * Function: nrf24l01_unlock + * + * Description: + * If we are sharing the SPI bus with other devices (CONFIG_SPI_OWNBUS + * undefined) then we need to un-lock the SPI bus for each transfer, + * possibly losing the current configuration. + * + * Parameters: + * spi - Reference to the SPI driver structure + * + * Returned Value: + * None + * + * Assumptions: + * + ****************************************************************************/ + +#ifndef CONFIG_SPI_OWNBUS +static void nrf24l01_unlock(FAR struct spi_dev_s *spi) +{ + /* Relinquish the SPI bus. */ + + (void)SPI_LOCK(spi, false); +} +#endif + +/**************************************************************************** + * Function: nrf24l01_configspi + * + * Description: + * Configure the SPI for use with the NRF24L01. This function should be + * called once during touchscreen initialization to configure the SPI + * bus. Note that if CONFIG_SPI_OWNBUS is not defined, then this function + * does nothing. + * + * Parameters: + * spi - Reference to the SPI driver structure + * + * Returned Value: + * None + * + * Assumptions: + * + ****************************************************************************/ + +#ifdef CONFIG_SPI_OWNBUS +static inline void nrf24l01_configspi(FAR struct spi_dev_s *spi) +{ + /* Configure SPI for the NRF24L01 module. + * As we own the SPI bus this method is called just once. + */ + + SPI_SELECT(spi, SPIDEV_WIRELESS, true); // Useful ? + SPI_SETMODE(spi, SPIDEV_MODE0); + SPI_SETBITS(spi, 8); + SPI_SETFREQUENCY(spi, NRF24L01_SPIFREQ); + SPI_SELECT(spi, SPIDEV_WIRELESS, false); +} +#endif + +static inline void nrf24l01_select(struct nrf24l01_dev_s * dev) +{ + SPI_SELECT(dev->spi, SPIDEV_WIRELESS, true); +} + +static inline void nrf24l01_deselect(struct nrf24l01_dev_s * dev) +{ + SPI_SELECT(dev->spi, SPIDEV_WIRELESS, false); +} + +static uint8_t nrf24l01_access(FAR struct nrf24l01_dev_s *dev, + nrf24l01_access_mode_t mode, uint8_t cmd, FAR uint8_t *buf, int length) +{ + uint8_t status; + + /* Prepare SPI */ + + nrf24l01_select(dev); + + /* Transfer */ + + status = SPI_SEND(dev->spi, cmd); + + switch (mode) + { + case MODE_WRITE: + if (length > 0) + { + SPI_SNDBLOCK(dev->spi, buf, length); + } + break; + + case MODE_READ: + SPI_RECVBLOCK(dev->spi, buf, length); + break; + } + + nrf24l01_deselect(dev); + return status; +} + +static inline uint8_t nrf24l01_flush_rx(struct nrf24l01_dev_s *dev) +{ + return nrf24l01_access(dev, MODE_WRITE, NRF24L01_FLUSH_RX, NULL, 0); +} + +static inline uint8_t nrf24l01_flush_tx(struct nrf24l01_dev_s *dev) +{ + return nrf24l01_access(dev, MODE_WRITE, NRF24L01_FLUSH_TX, NULL, 0); +} + +/* Read register from nrf24l01 */ + +static inline uint8_t nrf24l01_readreg(struct nrf24l01_dev_s *dev, uint8_t reg, + uint8_t *value, int len) +{ + return nrf24l01_access(dev, MODE_READ, reg | NRF24L01_R_REGISTER, value, len); +} + +/* Read single byte value from a register of nrf24l01 */ + +static inline uint8_t nrf24l01_readregbyte(struct nrf24l01_dev_s *dev, + uint8_t reg) +{ + uint8_t val; + nrf24l01_readreg(dev, reg, &val, 1); + return val; +} + +/* Write value to a register of nrf24l01 */ + +static inline int nrf24l01_writereg(FAR struct nrf24l01_dev_s *dev, uint8_t reg, + FAR const uint8_t *value, int len) +{ + return nrf24l01_access(dev, MODE_WRITE, reg | NRF24L01_W_REGISTER, (FAR uint8_t *)value, len); +} + +/* Write single byte value to a register of nrf24l01 */ + +static inline void nrf24l01_writeregbyte(struct nrf24l01_dev_s *dev, uint8_t reg, + uint8_t value) +{ + nrf24l01_writereg(dev, reg, &value, 1); +} + +static uint8_t nrf24l01_setregbit(struct nrf24l01_dev_s *dev, uint8_t reg, + uint8_t value, bool set) +{ + uint8_t val; + + nrf24l01_readreg(dev, reg, &val, 1); + if (set) + { + val |= value; + } + else + { + val &= ~value; + } + + nrf24l01_writereg(dev, reg, &val, 1); + return val; +} + +#ifdef CONFIG_WL_NRF24L01_RXSUPPORT + +/* RX fifo mgt */ + +void fifoput(struct nrf24l01_dev_s *dev, uint8_t pipeno, uint8_t *buffer, uint8_t buflen) +{ + sem_wait(&dev->sem_fifo); + while (dev->fifo_len + buflen + 1 > CONFIG_WL_NRF24L01_RXFIFO_LEN) + { + /* TODO: Set fifo overrun flag ! */ + + int skiplen = FIFO_PKTLEN(dev) + 1; + + dev->nxt_read = (dev->nxt_read + skiplen) % CONFIG_WL_NRF24L01_RXFIFO_LEN; + dev->fifo_len -= skiplen; + } + + dev->rx_fifo[dev->nxt_write] = FIFO_HEADER(buflen, pipeno); + dev->nxt_write = (dev->nxt_write + 1) % CONFIG_WL_NRF24L01_RXFIFO_LEN; + + /* Adjust fifo bytes count */ + + dev->fifo_len += (buflen + 1); + while (buflen--) + { + dev->rx_fifo[dev->nxt_write] = *(buffer++); + dev->nxt_write = (dev->nxt_write + 1) % CONFIG_WL_NRF24L01_RXFIFO_LEN; + } + + sem_post(&dev->sem_fifo); +} + +uint8_t fifoget(struct nrf24l01_dev_s *dev, uint8_t *buffer, uint8_t buflen, uint8_t *pipeno) +{ + uint8_t pktlen; + uint8_t i; + + sem_wait(&dev->sem_fifo); + + ASSERT(dev->fifo_len > 0); + + pktlen = FIFO_PKTLEN(dev); + if (NULL != pipeno) + { + *pipeno = FIFO_PIPENO(dev); + } + + dev->nxt_read = (dev->nxt_read + 1) % CONFIG_WL_NRF24L01_RXFIFO_LEN; + + for (i = 0; i < pktlen && i < buflen; i++) + { + *(buffer++) = dev->rx_fifo[dev->nxt_read]; + dev->nxt_read = (dev->nxt_read + 1) % CONFIG_WL_NRF24L01_RXFIFO_LEN; + } + + if (i < pktlen) + { + dev->nxt_read = (dev->nxt_read + pktlen - i) % CONFIG_WL_NRF24L01_RXFIFO_LEN; + } + + /* Adjust fifo bytes count */ + + dev->fifo_len -= (pktlen + 1); + + sem_post(&dev->sem_fifo); + return pktlen; +} + +#endif + +static int nrf24l01_irqhandler(int irq, FAR void *context) +{ + FAR struct nrf24l01_dev_s *dev = g_nrf24l01dev; + + wllvdbg("*IRQ*"); + +#ifdef CONFIG_WL_NRF24L01_RXSUPPORT + + /* If RX is enabled we delegate the actual work to bottom-half handler */ + + work_queue(HPWORK, &g_nrf24l01dev->irq_work, nrf24l01_worker, dev, 0); +#else + + /* Otherwise we simply wake up the send function */ + + sem_post(&dev->sem_tx); /* Wake up the send function */ +#endif + + return OK; +} + +/* Configure IRQ pin (falling edge) */ + +static inline int nrf24l01_attachirq(FAR struct nrf24l01_dev_s *dev, xcpt_t isr) +{ + return dev->config->irqattach(isr); +} + +static inline bool nrf24l01_chipenable(FAR struct nrf24l01_dev_s *dev, bool enable) +{ + if (dev->ce_enabled != enable) + { + dev->config->chipenable(enable); + dev->ce_enabled = enable; + return !enable; + } + else + { + return enable; + } +} + +#ifdef CONFIG_WL_NRF24L01_RXSUPPORT + +static void nrf24l01_worker(FAR void *arg) +{ + FAR struct nrf24l01_dev_s *dev = (FAR struct nrf24l01_dev_s *) arg; + uint8_t status; + uint8_t fifo_status; + + nrf24l01_lock(dev->spi); + + status = nrf24l01_readregbyte(dev, NRF24L01_STATUS); + + if (status & NRF24L01_RX_DR) + { + /* put CE low */ + + bool ce = nrf24l01_chipenable(dev, false); + + wdbg("RX_DR is set!\n"); + + /* Read and store all received payloads */ + + do + { + uint8_t pipeno; + uint8_t pktlen; + uint8_t buf[NRF24L01_MAX_PAYLOAD_LEN]; + + /* For each packet: + * - Get pipe # + * - Get payload length (either static or dynamic) + * - Read payload content + */ + + pipeno = (status & NRF24L01_RX_P_NO_MASK) >> NRF24L01_RX_P_NO_SHIFT; + + pktlen = dev->pipedatalen[pipeno]; + if (NRF24L01_DYN_LENGTH == pktlen) + { + /* If dynamic length payload need to use R_RX_PL_WID command to get actual length */ + + nrf24l01_access(dev, MODE_READ, NRF24L01_R_RX_PL_WID, &pktlen, 1); + } + + /* Get payload content */ + + nrf24l01_access(dev, MODE_READ, NRF24L01_R_RX_PAYLOAD, buf, pktlen); + + fifoput(dev, pipeno, buf, pktlen); + sem_post(&dev->sem_rx); /* Wake-up any thread waiting in recv */ + + status = nrf24l01_readreg(dev, NRF24L01_FIFO_STATUS, &fifo_status, 1); + + wdbg("FIFO_STATUS=%02x\n", fifo_status); + wdbg("STATUS=%02x\n", status); + } + while (!(fifo_status | NRF24L01_RX_EMPTY)); + + /* Clear interrupt sources */ + + nrf24l01_writeregbyte(dev, NRF24L01_STATUS, NRF24L01_RX_DR); + + /* Restore CE */ + + nrf24l01_chipenable(dev, ce); + +#ifndef CONFIG_DISABLE_POLL + if (dev->pfd) + { + dev->pfd->revents |= POLLIN; /* Data available for input */ + + wvdbg("Wake up polled fd"); + sem_post(dev->pfd->sem); + } +#endif + } + + if (status & (NRF24L01_TX_DS | NRF24L01_MAX_RT)) + { + /* The actual work is done in the send function */ + + sem_post(&dev->sem_tx); + } + + if (dev->state == ST_RX) + { + /* re-enable CE (to go back to RX mode state) */ + + nrf24l01_chipenable(dev, true); + } + nrf24l01_unlock(dev->spi); +} + +#endif + +static void nrf24l01_tostate(struct nrf24l01_dev_s *dev, nrf24l01_state_t state) +{ + nrf24l01_state_t oldstate = dev->state; + + if (oldstate == state) + { + return; + } + + if (oldstate == ST_POWER_DOWN) + { + /* Leaving power down (note: new state cannot be power down here) */ + + nrf24l01_setregbit(dev, NRF24L01_CONFIG, NRF24L01_PWR_UP, true); + usleep(NRF24L01_TPD2STBY_DELAY); + } + + /* Entering new state */ + + switch(state) + { + case ST_UNKNOWN: + /* Power down the module here... */ + case ST_POWER_DOWN: + nrf24l01_chipenable(dev, false); + nrf24l01_setregbit(dev, NRF24L01_CONFIG, NRF24L01_PWR_UP, false); + break; + + case ST_STANDBY: + nrf24l01_chipenable(dev, false); + nrf24l01_setregbit(dev, NRF24L01_CONFIG, NRF24L01_PRIM_RX, false); + break; + +#ifdef CONFIG_WL_NRF24L01_RXSUPPORT + case ST_RX: + nrf24l01_setregbit(dev, NRF24L01_CONFIG, NRF24L01_PRIM_RX, true); + nrf24l01_chipenable(dev, true); + break; +#endif + } + + dev->state = state; +} + +static int dosend(FAR struct nrf24l01_dev_s *dev, FAR const uint8_t *data, size_t datalen) +{ + uint8_t status; + uint8_t obsvalue; + int result; + + /* Store the current lifecycle state in order to restore it after transmit done */ + + nrf24l01_state_t prevstate = dev->state; + + nrf24l01_tostate(dev, ST_STANDBY); + + /* Write payload */ + + nrf24l01_access(dev, MODE_WRITE, NRF24L01_W_TX_PAYLOAD, (FAR uint8_t *)data, datalen); + + /* Enable CE to start transmission */ + + nrf24l01_chipenable(dev, true); + + /* Free the SPI bus during the IRQ wait */ + + nrf24l01_unlock(dev->spi); + + /* Wait for IRQ (TX_DS or MAX_RT) */ + + while (sem_wait(&dev->sem_tx) != 0) + { + /* Note that we really need to wait here, as the interrupt source + * (either TX_DS in case of success, or MAX_RT for failure) needs to be cleared. + */ + + DEBUGASSERT(errno == EINTR); + } + + /* Re-acquire the SPI bus */ + + nrf24l01_lock(dev->spi); + + status = nrf24l01_readreg(dev, NRF24L01_OBSERVE_TX, &obsvalue, 1); + if (status & NRF24L01_TX_DS) + { + /* transmit OK */ + + result = OK; + dev->lastxmitcount = (obsvalue & NRF24L01_ARC_CNT_MASK) + >> NRF24L01_ARC_CNT_SHIFT; + + wvdbg("Transmission OK (lastxmitcount=%d)\n", dev->lastxmitcount); + } + else if (status & NRF24L01_MAX_RT) + { + wvdbg("MAX_RT!\n", dev->lastxmitcount); + result = -ECOMM; + dev->lastxmitcount = NRF24L01_XMIT_MAXRT; + + /* If no ACK packet is received the payload remains in TX fifo. We need to flush it. */ + + nrf24l01_flush_tx(dev); + } + else + { + /* Unexpected... */ + + wdbg("No TX_DS nor MAX_RT bit set in STATUS reg!\n"); + result = -EIO; + } + + /* Clear interrupt sources */ + + nrf24l01_writeregbyte(dev, NRF24L01_STATUS, NRF24L01_TX_DS | NRF24L01_MAX_RT); + + /* Restore state */ + + nrf24l01_tostate(dev, prevstate); + return result; +} + +/* POSIX API */ + +static int nrf24l01_open(FAR struct file *filep) +{ + FAR struct inode *inode; + FAR struct nrf24l01_dev_s *dev; + int result; + + wvdbg("Opening nRF24L01 dev\n"); + + DEBUGASSERT(filep); + inode = filep->f_inode; + + DEBUGASSERT(inode && inode->i_private); + dev = (FAR struct nrf24l01_dev_s *)inode->i_private; + + /* Get exclusive access to the driver data structure */ + + if (sem_wait(&dev->devsem) < 0) + { + /* This should only happen if the wait was canceled by an signal */ + + DEBUGASSERT(errno == EINTR); + return -EINTR; + } + + /* Check if device is not already used */ + + if (dev->nopens > 0) + { + result = -EBUSY; + goto errout; + } + + result = nrf24l01_init(dev); + if (!result) + { + dev->nopens++; + } + +errout: + sem_post(&dev->devsem); + return result; +} + +static int nrf24l01_close(FAR struct file *filep) +{ + FAR struct inode *inode; + FAR struct nrf24l01_dev_s *dev; + + wvdbg("Closing nRF24L01 dev\n"); + DEBUGASSERT(filep); + inode = filep->f_inode; + + DEBUGASSERT(inode && inode->i_private); + dev = (FAR struct nrf24l01_dev_s *)inode->i_private; + + /* Get exclusive access to the driver data structure */ + + if (sem_wait(&dev->devsem) < 0) + { + /* This should only happen if the wait was canceled by an signal */ + + DEBUGASSERT(errno == EINTR); + return -EINTR; + } + + nrf24l01_changestate(dev, ST_POWER_DOWN); + dev->nopens--; + + sem_post(&dev->devsem); + return OK; +} + +static ssize_t nrf24l01_read(FAR struct file *filep, FAR char *buffer, size_t buflen) +{ +#ifndef CONFIG_WL_NRF24L01_RXSUPPORT + return -ENOSYS; +#else + FAR struct nrf24l01_dev_s *dev; + FAR struct inode *inode; + int result; + + DEBUGASSERT(filep); + inode = filep->f_inode; + + DEBUGASSERT(inode && inode->i_private); + dev = (FAR struct nrf24l01_dev_s *)inode->i_private; + + if (sem_wait(&dev->devsem) < 0) + { + /* This should only happen if the wait was canceled by an signal */ + + DEBUGASSERT(errno == EINTR); + return -EINTR; + } + result = nrf24l01_recv(dev, (uint8_t *)buffer, buflen, &dev->last_recvpipeno); + + sem_post(&dev->devsem); + return result; +#endif +} + +static ssize_t nrf24l01_write(FAR struct file *filep, FAR const char *buffer, size_t buflen) +{ + FAR struct nrf24l01_dev_s *dev; + FAR struct inode *inode; + int result; + + DEBUGASSERT(filep); + inode = filep->f_inode; + + DEBUGASSERT(inode && inode->i_private); + dev = (FAR struct nrf24l01_dev_s *)inode->i_private; + + if (sem_wait(&dev->devsem) < 0) + { + /* This should only happen if the wait was canceled by an signal */ + + DEBUGASSERT(errno == EINTR); + return -EINTR; + } + + result = nrf24l01_send(dev, (const uint8_t *)buffer, buflen); + + sem_post(&dev->devsem); + return result; +} + +static int nrf24l01_ioctl(FAR struct file *filep, int cmd, unsigned long arg) +{ + FAR struct inode *inode; + FAR struct nrf24l01_dev_s *dev; + int result = OK; + + wvdbg("cmd: %d arg: %ld\n", cmd, arg); + DEBUGASSERT(filep); + inode = filep->f_inode; + + DEBUGASSERT(inode && inode->i_private); + dev = (FAR struct nrf24l01_dev_s *)inode->i_private; + + /* Get exclusive access to the driver data structure */ + + if (sem_wait(&dev->devsem) < 0) + { + /* This should only happen if the wait was canceled by an signal */ + + DEBUGASSERT(errno == EINTR); + return -EINTR; + } + + /* Process the IOCTL by command */ + + switch (cmd) + { + case WLIOC_SETRADIOFREQ: /* Set radio frequency. Arg: Pointer to uint32_t frequency value */ + { + FAR uint32_t *ptr = (FAR uint32_t *)((uintptr_t)arg); + DEBUGASSERT(ptr != NULL); + + nrf24l01_setradiofreq(dev, *ptr); + } + break; + + case WLIOC_GETRADIOFREQ: /* Get current radio frequency. arg: Pointer to uint32_t frequency value */ + { + FAR uint32_t *ptr = (FAR uint32_t *)((uintptr_t)arg); + DEBUGASSERT(ptr != NULL); + *ptr = nrf24l01_getradiofreq(dev); + } + break; + + case NRF24L01IOC_SETTXADDR: /* Set current TX addr. arg: Pointer to uint8_t array defining the address */ + { + FAR const uint8_t *addr = (FAR const uint8_t *)(arg); + DEBUGASSERT(addr != NULL); + nrf24l01_settxaddr(dev, addr); + } + break; + + case NRF24L01IOC_GETTXADDR: /* Get current TX addr. arg: Pointer to uint8_t array defining the address */ + { + FAR uint8_t *addr = (FAR uint8_t *)(arg); + DEBUGASSERT(addr != NULL); + nrf24l01_gettxaddr(dev, addr); + } + break; + + case WLIOC_SETTXPOWER: /* Set current radio frequency. arg: Pointer to int32_t, output power */ + { + FAR int32_t *ptr = (FAR int32_t *)(arg); + DEBUGASSERT(ptr != NULL); + nrf24l01_settxpower(dev, *ptr); + } + break; + + case WLIOC_GETTXPOWER: /* Get current radio frequency. arg: Pointer to int32_t, output power */ + { + FAR int32_t *ptr = (FAR int32_t *)(arg); + DEBUGASSERT(ptr != NULL); + *ptr = nrf24l01_gettxpower(dev); + } + break; + + case NRF24L01IOC_SETRETRCFG: /* Set retransmit params. arg: Pointer to nrf24l01_retrcfg_t */ + { + FAR nrf24l01_retrcfg_t *ptr = (FAR nrf24l01_retrcfg_t *)(arg); + DEBUGASSERT(ptr != NULL); + nrf24l01_setretransmit(dev, ptr->delay, ptr->count); + } + break; + + case NRF24L01IOC_GETRETRCFG: /* Get retransmit params. arg: Pointer to nrf24l01_retrcfg_t */ + result = -ENOSYS; /* TODO !*/ + break; + + case NRF24L01IOC_SETPIPESCFG: + { + int i; + FAR nrf24l01_pipecfg_t **cfg_array = (FAR nrf24l01_pipecfg_t **)(arg); + + DEBUGASSERT(cfg_array != NULL); + for (i = 0; i < NRF24L01_PIPE_COUNT; i++) + { + if (cfg_array[i]) + { + nrf24l01_setpipeconfig(dev, i, cfg_array[i]); + } + } + } + break; + + case NRF24L01IOC_GETPIPESCFG: + { + int i; + FAR nrf24l01_pipecfg_t **cfg_array = (FAR nrf24l01_pipecfg_t **)(arg); + + DEBUGASSERT(cfg_array != NULL); + for (i = 0; i < NRF24L01_PIPE_COUNT; i++) + { + if (cfg_array[i]) + { + nrf24l01_getpipeconfig(dev, i, cfg_array[i]); + } + } + } + break; + + case NRF24L01IOC_SETPIPESENABLED: + { + int i; + uint8_t en_pipes; + + FAR uint8_t *en_pipesp = (FAR uint8_t *)(arg); + + DEBUGASSERT(en_pipesp != NULL); + en_pipes = *en_pipesp; + for (i = 0; i < NRF24L01_PIPE_COUNT; i++) + { + if ((dev->en_pipes & (1 << i)) != (en_pipes & (1 << i))) + { + nrf24l01_enablepipe(dev, i, en_pipes & (1 << i)); + } + } + } + break; + + case NRF24L01IOC_GETPIPESENABLED: + { + FAR uint8_t *en_pipesp = (FAR uint8_t *)(arg); + + DEBUGASSERT(en_pipesp != NULL); + *en_pipesp = dev->en_pipes; + break; + } + + case NRF24L01IOC_SETDATARATE: + { + FAR nrf24l01_datarate_t *drp = (FAR nrf24l01_datarate_t *)(arg); + DEBUGASSERT(drp != NULL); + + nrf24l01_setdatarate(dev, *drp); + break; + } + + case NRF24L01IOC_GETDATARATE: + result = -ENOSYS; /* TODO !*/ + break; + + case NRF24L01IOC_SETADDRWIDTH: + { + FAR uint32_t *widthp = (FAR uint32_t *)(arg); + DEBUGASSERT(widthp != NULL); + + nrf24l01_setaddrwidth(dev, *widthp); + break; + } + + case NRF24L01IOC_GETADDRWIDTH: + { + FAR int *widthp = (FAR int *)(arg); + DEBUGASSERT(widthp != NULL); + + *widthp = (int)dev->addrlen; + break; + } + + case NRF24L01IOC_SETSTATE: + { + FAR nrf24l01_state_t *statep = (FAR nrf24l01_state_t *)(arg); + DEBUGASSERT(statep != NULL); + + nrf24l01_changestate(dev, *statep); + break; + } + + case NRF24L01IOC_GETSTATE: + { + FAR nrf24l01_state_t *statep = (FAR nrf24l01_state_t *)(arg); + DEBUGASSERT(statep != NULL); + + *statep = dev->state; + break; + } + + case NRF24L01IOC_GETLASTXMITCOUNT: + { + FAR uint32_t *xmitcntp = (FAR uint32_t *)(arg); + DEBUGASSERT(xmitcntp != NULL); + + *xmitcntp = dev->lastxmitcount; + break; + } + + case NRF24L01IOC_GETLASTPIPENO: + { + FAR uint32_t *lastpipep = (FAR uint32_t *)(arg); + DEBUGASSERT(lastpipep != NULL); + + *lastpipep = dev->last_recvpipeno; + break; + } + + default: + result = -ENOTTY; + break; + } + + sem_post(&dev->devsem); + return result; +} + +#ifndef CONFIG_DISABLE_POLL + +static int nrf24l01_poll(FAR struct file *filep, FAR struct pollfd *fds, + bool setup) +{ +#ifndef CONFIG_WL_NRF24L01_RXSUPPORT + /* Polling is currently implemented for data input only */ + return -ENOSYS; +#else + + FAR struct inode *inode; + FAR struct nrf24l01_dev_s *dev; + int result = OK; + + wvdbg("setup: %d\n", (int)setup); + DEBUGASSERT(filep && fds); + inode = filep->f_inode; + + DEBUGASSERT(inode && inode->i_private); + dev = (FAR struct nrf24l01_dev_s *)inode->i_private; + + /* Exclusive access */ + + if (sem_wait(&dev->devsem) < 0) + { + /* This should only happen if the wait was canceled by an signal */ + + DEBUGASSERT(errno == EINTR); + return -EINTR; + } + + /* Are we setting up the poll? Or tearing it down? */ + + if (setup) + { + /* Ignore waits that do not include POLLIN */ + + if ((fds->events & POLLIN) == 0) + { + result = -EDEADLK; + goto errout; + } + + /* Check if we can accept this poll. + * For now, only one thread can poll the device at any time (shorter / simpler code) + */ + + if (dev->pfd) + { + result = -EBUSY; + goto errout; + } + + dev->pfd = fds; + } + else /* Tear it down */ + { + dev->pfd = NULL; + } + +errout: + sem_post(&dev->devsem); + return result; +#endif +} + +#endif + +static int nrf24l01_unregister(FAR struct nrf24l01_dev_s *dev) +{ + CHECK_ARGS(dev); + + /* Release IRQ */ + + nrf24l01_attachirq(dev, NULL); + + g_nrf24l01dev = NULL; + + /* Free memory */ +#ifdef CONFIG_WL_NRF24L01_RXSUPPORT + kfree(dev->rx_fifo); +#endif + kfree(dev); + + return OK; +} + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +int nrf24l01_register(FAR struct spi_dev_s *spi, FAR struct nrf24l01_config_s *cfg) +{ + FAR struct nrf24l01_dev_s *dev; + int result = OK; + +#ifdef CONFIG_WL_NRF24L01_RXSUPPORT + uint8_t *rx_fifo; +#endif + + ASSERT((spi != NULL) & (cfg != NULL)); + + if ((dev = kmalloc(sizeof(struct nrf24l01_dev_s))) == NULL) + { + return -ENOMEM; + } + + dev->spi = spi; + dev->config = cfg; + + dev->state = ST_UNKNOWN; + dev->en_aa = 0; + dev->ce_enabled = false; + + sem_init(&(dev->devsem), 0, 1); + dev->nopens = 0; + +#ifndef CONFIG_DISABLE_POLL + dev->pfd = NULL; +#endif + + sem_init(&(dev->sem_tx), 0, 0); + +#ifdef CONFIG_WL_NRF24L01_RXSUPPORT + if ((rx_fifo = kmalloc(CONFIG_WL_NRF24L01_RXFIFO_LEN)) == NULL) + { + kfree(dev); + return -ENOMEM; + } + + dev->rx_fifo = rx_fifo; + dev->nxt_read = 0; + dev->nxt_write = 0; + dev->fifo_len = 0; + + sem_init(&(dev->sem_fifo), 0, 1); + sem_init(&(dev->sem_rx), 0, 0); +#endif + + /* Set the global reference */ + + g_nrf24l01dev = dev; + + /* Configure IRQ pin (falling edge) */ + + nrf24l01_attachirq(dev, nrf24l01_irqhandler); + + /* Register the device as an input device */ + + ivdbg("Registering " DEV_NAME "\n"); + + result = register_driver(DEV_NAME, &nrf24l01_fops, 0666, dev); + if (result < 0) + { + wdbg("register_driver() failed: %d\n", result); + nrf24l01_unregister(dev); + } + + return result; +} + +FAR struct nrf24l01_dev_s * nrf24l01_getinstance(void) +{ + return g_nrf24l01dev; +} + +/* (re)set the device in a default initial state */ + +int nrf24l01_init(FAR struct nrf24l01_dev_s *dev) +{ + int result = OK; + uint8_t features; + + CHECK_ARGS(dev); + nrf24l01_lock(dev->spi); + + /* Configure the SPI parameters now (if we own the bus) */ + + nrf24l01_configspi(dev->spi); + + /* Enable features. */ + + nrf24l01_writeregbyte(dev, NRF24L01_FEATURE, NRF24L01_EN_DPL); + features = nrf24l01_readregbyte(dev, NRF24L01_FEATURE); + if (0 == features) + { + /* The ACTIVATE instruction is not documented in the nRF24L01+ docs. + * However it is referenced / described by many sources on Internet, + * + * Is it for nRF24L01 (not +) hardware ? + */ + + uint8_t v = 0x73; + nrf24l01_access(dev, MODE_WRITE, NRF24L01_ACTIVATE, &v, 1); + + features = nrf24l01_readregbyte(dev, NRF24L01_FEATURE); + if (0 == features) + { + /* If FEATURES reg is still unset here, consider there is no actual hardware */ + + result = -ENODEV; + goto out; + } + } + + /* Set initial state */ + + nrf24l01_tostate(dev, ST_POWER_DOWN); + + /* Disable all pipes */ + + dev->en_pipes = 0; + nrf24l01_writeregbyte(dev, NRF24L01_EN_RXADDR, 0); + + /* Set addr width to default */ + + dev->addrlen = CONFIG_WL_NRF24L01_DFLT_ADDR_WIDTH; + nrf24l01_writeregbyte(dev, NRF24L01_SETUP_AW, CONFIG_WL_NRF24L01_DFLT_ADDR_WIDTH - 2); + + /* Get pipe #0 addr */ + + nrf24l01_readreg(dev, NRF24L01_RX_ADDR_P0, dev->pipe0addr, dev->addrlen); + + dev->en_aa = nrf24l01_readregbyte(dev, NRF24L01_EN_AA); + + /* Flush HW fifo */ + + nrf24l01_flush_rx(dev); + nrf24l01_flush_tx(dev); + + /* Clear interrupt sources (useful ?) */ + + nrf24l01_writeregbyte(dev, NRF24L01_STATUS, NRF24L01_RX_DR|NRF24L01_TX_DS|NRF24L01_MAX_RT); + +out: + nrf24l01_unlock(dev->spi); + return result; +} + +int nrf24l01_setpipeconfig(FAR struct nrf24l01_dev_s *dev, unsigned int pipeno, + FAR const nrf24l01_pipecfg_t *pipecfg) +{ + bool dynlength; + bool en_aa; + + CHECK_ARGS(dev && pipecfg && pipeno < NRF24L01_PIPE_COUNT); + + dynlength = (pipecfg->payload_length == NRF24L01_DYN_LENGTH); + + /* Need to enable AA to enable dynamic length payload */ + + en_aa = dynlength || pipecfg->en_aa; + + nrf24l01_lock(dev->spi); + + /* Set addr */ + + int addrlen = (pipeno <= 1) ? dev->addrlen : 1; /* Pipe 0 & 1 are the only ones to have a full length address */ + nrf24l01_writereg(dev, NRF24L01_RX_ADDR_P0 + pipeno, pipecfg->rx_addr, addrlen); + + /* Auto ack */ + + if (en_aa) + { + dev->en_aa |= 1 << pipeno; + } + else + { + dev->en_aa &= ~(1 << pipeno); + } + + nrf24l01_setregbit(dev, NRF24L01_EN_AA, 1 << pipeno, en_aa); + + /* Payload config */ + + nrf24l01_setregbit(dev, NRF24L01_DYNPD, 1 << pipeno, dynlength); + if (!dynlength) + { + nrf24l01_writeregbyte(dev, NRF24L01_RX_PW_P0 + pipeno, pipecfg->payload_length); + } + nrf24l01_unlock(dev->spi); + + dev->pipedatalen[pipeno] = pipecfg->payload_length; + return OK; +} + +int nrf24l01_getpipeconfig(FAR struct nrf24l01_dev_s *dev, unsigned int pipeno, + FAR nrf24l01_pipecfg_t *pipecfg) +{ + bool dynlength; + + CHECK_ARGS(dev && pipecfg && pipeno < NRF24L01_PIPE_COUNT); + + nrf24l01_lock(dev->spi); + + /* Get pipe address */ + + int addrlen = (pipeno <= 1) ? dev->addrlen : 1; /* Pipe 0 & 1 are the only ones to have a full length address */ + nrf24l01_readreg(dev, NRF24L01_RX_ADDR_P0 + pipeno, pipecfg->rx_addr, addrlen); + + /* Auto ack */ + + pipecfg->en_aa = ((nrf24l01_readregbyte(dev, NRF24L01_EN_AA) & (1 << pipeno)) != 0); + + /* Payload config */ + + dynlength = ((nrf24l01_readregbyte(dev, NRF24L01_DYNPD) & (1 << pipeno)) != 0); + + if (dynlength) + { + pipecfg->payload_length = NRF24L01_DYN_LENGTH; + } + else + { + pipecfg->payload_length = nrf24l01_readregbyte(dev, NRF24L01_RX_PW_P0 + pipeno); + } + + nrf24l01_unlock(dev->spi); + + return OK; +} + +int nrf24l01_enablepipe(FAR struct nrf24l01_dev_s *dev, unsigned int pipeno, bool enable) +{ + CHECK_ARGS(dev && pipeno < NRF24L01_PIPE_COUNT); + + uint8_t rxaddrval; + uint8_t pipemask = 1 << pipeno; + + nrf24l01_lock(dev->spi); + + /* Enable pipe on nRF24L01 */ + + rxaddrval = nrf24l01_readregbyte(dev, NRF24L01_EN_RXADDR); + + if (enable) + { + rxaddrval |= pipemask; + } + else + { + rxaddrval &= ~pipemask; + } + + nrf24l01_writeregbyte(dev, NRF24L01_EN_RXADDR, rxaddrval); + nrf24l01_unlock(dev->spi); + + /* Update cached value */ + + dev->en_pipes = rxaddrval; + + return OK; +} + +int nrf24l01_settxaddr(FAR struct nrf24l01_dev_s *dev, FAR const uint8_t *txaddr) +{ + CHECK_ARGS(dev && txaddr); + + nrf24l01_lock(dev->spi); + + nrf24l01_writereg(dev, NRF24L01_TX_ADDR, txaddr, dev->addrlen); + nrf24l01_unlock(dev->spi); + return OK; +} + +int nrf24l01_gettxaddr(FAR struct nrf24l01_dev_s *dev, FAR uint8_t *txaddr) +{ + CHECK_ARGS(dev && txaddr); + + nrf24l01_lock(dev->spi); + + nrf24l01_readreg(dev, NRF24L01_TX_ADDR, txaddr, dev->addrlen); + nrf24l01_unlock(dev->spi); + return OK; +} + +int nrf24l01_setretransmit(FAR struct nrf24l01_dev_s *dev, nrf24l01_retransmit_delay_t retrdelay, uint8_t retrcount) +{ + uint8_t val; + + CHECK_ARGS(dev && retrcount <= NRF24L01_MAX_XMIT_RETR); + + val = (retrdelay << NRF24L01_ARD_SHIFT) | (retrcount << NRF24L01_ARC_SHIFT); + + nrf24l01_lock(dev->spi); + + nrf24l01_writeregbyte(dev, NRF24L01_SETUP_RETR, val); + nrf24l01_unlock(dev->spi); + return OK; +} + +int nrf24l01_settxpower(FAR struct nrf24l01_dev_s *dev, int outpower) +{ + uint8_t value; + uint8_t hwpow; + + /** RF_PWR value <-> Output power in dBm + * + * '00' – -18dBm + * '01' – -12dBm + * '10' – -6dBm + * '11' – 0dBm + */ + + switch(outpower) + { + case 0: + hwpow = 3 << NRF24L01_RF_PWR_SHIFT; + break; + + case -6: + hwpow = 2 << NRF24L01_RF_PWR_SHIFT; + break; + + case -12: + hwpow = 1 << NRF24L01_RF_PWR_SHIFT; + break; + + case -18: + hwpow = 0; + break; + + default: + return -EINVAL; + } + + nrf24l01_lock(dev->spi); + + value = nrf24l01_readregbyte(dev, NRF24L01_RF_SETUP); + + value &= ~(NRF24L01_RF_PWR_MASK); + value |= hwpow; + + nrf24l01_writeregbyte(dev, NRF24L01_RF_SETUP, value); + nrf24l01_unlock(dev->spi); + return OK; +} + +int nrf24l01_gettxpower(FAR struct nrf24l01_dev_s *dev) +{ + uint8_t value; + int powers[] = { -18, -12, -6, 0}; + + nrf24l01_lock(dev->spi); + + value = nrf24l01_readregbyte(dev, NRF24L01_RF_SETUP); + nrf24l01_unlock(dev->spi); + + value = (value & NRF24L01_RF_PWR_MASK) >> NRF24L01_RF_PWR_SHIFT; + return powers[value]; +} + +int nrf24l01_setdatarate(FAR struct nrf24l01_dev_s *dev, nrf24l01_datarate_t datarate) +{ + uint8_t value; + + nrf24l01_lock(dev->spi); + + value = nrf24l01_readregbyte(dev, NRF24L01_RF_SETUP); + value &= ~(NRF24L01_RF_DR_HIGH | NRF24L01_RF_DR_LOW); + + switch (datarate) + { + case RATE_1Mbps: + break; + + case RATE_2Mbps: + value |= NRF24L01_RF_DR_HIGH; + break; + + case RATE_250kbps: + value |= NRF24L01_RF_DR_LOW; + break; + } + + nrf24l01_writeregbyte(dev, NRF24L01_RF_SETUP, value); + nrf24l01_unlock(dev->spi); + return OK; +} + +int nrf24l01_setradiofreq(FAR struct nrf24l01_dev_s *dev, uint32_t freq) +{ + uint8_t value; + + CHECK_ARGS(dev && freq >= NRF24L01_MIN_FREQ && freq <= NRF24L01_MAX_FREQ); + + value = NRF24L01_MIN_FREQ - freq; + nrf24l01_lock(dev->spi); + nrf24l01_writeregbyte(dev, NRF24L01_RF_CH, value); + nrf24l01_unlock(dev->spi); + return OK; +} + +uint32_t nrf24l01_getradiofreq(FAR struct nrf24l01_dev_s *dev) +{ + int rffreq; + + CHECK_ARGS(dev); + + nrf24l01_lock(dev->spi); + rffreq = (int)nrf24l01_readregbyte(dev, NRF24L01_RF_CH); + nrf24l01_unlock(dev->spi); + + return rffreq + NRF24L01_MIN_FREQ; +} + +int nrf24l01_setaddrwidth(FAR struct nrf24l01_dev_s *dev, uint32_t width) +{ + CHECK_ARGS(dev && width <= NRF24L01_MAX_ADDR_LEN && width >= NRF24L01_MIN_ADDR_LEN); + + nrf24l01_lock(dev->spi); + nrf24l01_writeregbyte(dev, NRF24L01_SETUP_AW, width-2); + nrf24l01_unlock(dev->spi); + dev->addrlen = width; + return OK; +} + +int nrf24l01_changestate(FAR struct nrf24l01_dev_s *dev, nrf24l01_state_t state) +{ + nrf24l01_lock(dev->spi); + nrf24l01_tostate(dev, state); + nrf24l01_unlock(dev->spi); + return OK; +} + +int nrf24l01_send(FAR struct nrf24l01_dev_s *dev, FAR const uint8_t *data, size_t datalen) +{ + int result; + + CHECK_ARGS(dev && data && datalen <= NRF24L01_MAX_PAYLOAD_LEN); + + nrf24l01_lock(dev->spi); + + result = dosend(dev, data, datalen); + + nrf24l01_unlock(dev->spi); + return result; +} + +int nrf24l01_sendto(FAR struct nrf24l01_dev_s *dev, FAR const uint8_t *data, + size_t datalen, FAR const uint8_t *destaddr) +{ + bool pipeaddrchg = false; + int result; + + nrf24l01_lock(dev->spi); + + /* If AA is enabled (pipe 0 is active and its AA flag is set) and the dest + * addr is not the current pipe 0 addr we need to change pipe 0 addr in + * order to receive the ACK packet. + */ + + if ((dev->en_aa & 1) && (memcmp(destaddr, dev->pipe0addr, dev->addrlen))) + { + wdbg("Change pipe #0 addr to dest addr\n"); + nrf24l01_writereg(dev, NRF24L01_RX_ADDR_P0, destaddr, NRF24L01_MAX_ADDR_LEN); + pipeaddrchg = true; + } + + result = dosend(dev, data, datalen); + + if (pipeaddrchg) + { + /* Restore pipe #0 addr */ + + nrf24l01_writereg(dev, NRF24L01_RX_ADDR_P0, dev->pipe0addr, NRF24L01_MAX_ADDR_LEN); + wdbg("Pipe #0 default addr restored\n"); + } + + nrf24l01_unlock(dev->spi); + return result; +} + +int nrf24l01_lastxmitcount(FAR struct nrf24l01_dev_s *dev) +{ + return dev->lastxmitcount; +} + +#ifdef CONFIG_WL_NRF24L01_RXSUPPORT + +ssize_t nrf24l01_recv(struct nrf24l01_dev_s *dev, uint8_t *buffer, + size_t buflen, uint8_t *recvpipe) +{ + if (sem_wait(&dev->sem_rx) != 0) + { + /* This should only happen if the wait was canceled by an signal */ + + DEBUGASSERT(errno == EINTR); + return -EINTR; + } + + return fifoget(dev, buffer, buflen, recvpipe); +} + +#endif + +#ifdef NRF24L01_DEBUG + +static void binarycvt(char *deststr, const uint8_t *srcbin, size_t srclen) +{ + int i = 0; + while(i < srclen) + { + sprintf(deststr + i*2, "%02x", srcbin[i]); + ++i; + } + + *(deststr + i*2) = '\0'; +} + +void nrf24l01_dumpregs(struct nrf24l01_dev_s *dev) +{ + uint8_t addr[NRF24L01_MAX_ADDR_LEN]; + char addrstr[NRF24L01_MAX_ADDR_LEN * 2 +1]; + + syslog("CONFIG: %02x\n", nrf24l01_readregbyte(dev, NRF24L01_CONFIG)); + syslog("EN_AA: %02x\n", nrf24l01_readregbyte(dev, NRF24L01_EN_AA)); + syslog("EN_RXADDR: %02x\n", nrf24l01_readregbyte(dev, NRF24L01_EN_RXADDR)); + syslog("SETUP_AW: %02x\n", nrf24l01_readregbyte(dev, NRF24L01_SETUP_AW)); + + syslog("SETUP_RETR:%02x\n", nrf24l01_readregbyte(dev, NRF24L01_SETUP_RETR)); + syslog("RF_CH: %02x\n", nrf24l01_readregbyte(dev, NRF24L01_RF_CH)); + syslog("RF_SETUP: %02x\n", nrf24l01_readregbyte(dev, NRF24L01_RF_SETUP)); + syslog("STATUS: %02x\n", nrf24l01_readregbyte(dev, NRF24L01_STATUS)); + syslog("OBS_TX: %02x\n", nrf24l01_readregbyte(dev, NRF24L01_OBSERVE_TX)); + + nrf24l01_readreg(dev, NRF24L01_TX_ADDR, addr, dev->addrlen); + binarycvt(addrstr, addr, dev->addrlen); + syslog("TX_ADDR: %s\n", addrstr); + + syslog("CD: %02x\n", nrf24l01_readregbyte(dev, NRF24L01_CD)); + syslog("RX_PW_P0: %02x\n", nrf24l01_readregbyte(dev, NRF24L01_RX_PW_P0)); + syslog("RX_PW_P1: %02x\n", nrf24l01_readregbyte(dev, NRF24L01_RX_PW_P1)); + syslog("RX_PW_P2: %02x\n", nrf24l01_readregbyte(dev, NRF24L01_RX_PW_P2)); + syslog("RX_PW_P3: %02x\n", nrf24l01_readregbyte(dev, NRF24L01_RX_PW_P3)); + syslog("RX_PW_P4: %02x\n", nrf24l01_readregbyte(dev, NRF24L01_RX_PW_P4)); + syslog("RX_PW_P5: %02x\n", nrf24l01_readregbyte(dev, NRF24L01_RX_PW_P5)); + + syslog("FIFO_STAT: %02x\n", nrf24l01_readregbyte(dev, NRF24L01_FIFO_STATUS)); + syslog("DYNPD: %02x\n", nrf24l01_readregbyte(dev, NRF24L01_DYNPD)); + syslog("FEATURE: %02x\n", nrf24l01_readregbyte(dev, NRF24L01_FEATURE)); +} + +#ifdef CONFIG_WL_NRF24L01_RXSUPPORT +void nrf24l01_dumprxfifo(struct nrf24l01_dev_s *dev) +{ + syslog("bytes count: %d\n", dev->fifo_len); + syslog("next read: %d, next write: %d\n", dev->nxt_read, dev-> nxt_write); +} +#endif + +#endif diff --git a/nuttx/drivers/wireless/nrf24l01.h b/nuttx/drivers/wireless/nrf24l01.h new file mode 100644 index 000000000..c5bddf0b8 --- /dev/null +++ b/nuttx/drivers/wireless/nrf24l01.h @@ -0,0 +1,183 @@ +/**************************************************************************** + * include/nuttx/drivers/wireless/nrf24l01.h + * + * Copyright (C) 2013 Laurent Latil + * Author: Laurent Latil <laurent@latil.nom.fr> + * + * 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 __DRIVERS_WIRELESS_NRF24L01_H +#define __DRIVERS_WIRELESS_NRF24L01_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include <nuttx/config.h> +#include <nuttx/spi.h> +#include <nuttx/irq.h> +#include <nuttx/wireless/wireless.h> + +#include <stdint.h> +#include <stdbool.h> + +/**************************************************************************** + * Pre-Processor Declarations + ****************************************************************************/ + +/* nRF24L01 hardware definitions */ + +/* Commands */ + +#define NRF24L01_R_REGISTER 0x00 +#define NRF24L01_W_REGISTER 0x20 +#define NRF24L01_R_RX_PAYLOAD 0x61 +#define NRF24L01_W_TX_PAYLOAD 0xA0 +#define NRF24L01_FLUSH_TX 0xE1 +#define NRF24L01_FLUSH_RX 0xE2 +#define NRF24L01_REUSE_TX_PL 0xE3 + +#define NRF24L01_ACTIVATE 0x50 +#define NRF24L01_R_RX_PL_WID 0x60 +#define NRF24L01_W_TX_PAYLOAD_NOACK 0xB0 +#define NRF24L01_W_ACK_PAYLOAD 0xA8 +#define NRF24L01_NOP 0xFF + +/* Registers */ + +#define NRF24L01_CONFIG 0x00 +#define NRF24L01_EN_AA 0x01 +#define NRF24L01_EN_RXADDR 0x02 +#define NRF24L01_SETUP_AW 0x03 +#define NRF24L01_SETUP_RETR 0x04 +#define NRF24L01_RF_CH 0x05 +#define NRF24L01_RF_SETUP 0x06 +#define NRF24L01_STATUS 0x07 +#define NRF24L01_OBSERVE_TX 0x08 +#define NRF24L01_CD 0x09 +#define NRF24L01_RX_ADDR_P0 0x0A +#define NRF24L01_RX_ADDR_P1 0x0B +#define NRF24L01_RX_ADDR_P2 0x0C +#define NRF24L01_RX_ADDR_P3 0x0D +#define NRF24L01_RX_ADDR_P4 0x0E +#define NRF24L01_RX_ADDR_P5 0x0F +#define NRF24L01_TX_ADDR 0x10 +#define NRF24L01_RX_PW_P0 0x11 +#define NRF24L01_RX_PW_P1 0x12 +#define NRF24L01_RX_PW_P2 0x13 +#define NRF24L01_RX_PW_P3 0x14 +#define NRF24L01_RX_PW_P4 0x15 +#define NRF24L01_RX_PW_P5 0x16 +#define NRF24L01_FIFO_STATUS 0x17 +#define NRF24L01_DYNPD 0x1C +#define NRF24L01_FEATURE 0x1D + +/* STATUS register definitions */ + +#define NRF24L01_RX_DR (1 << 6) +#define NRF24L01_TX_DS (1 << 5) +#define NRF24L01_MAX_RT (1 << 4) +#define NRF24L01_RX_P_NO_SHIFT 1 +#define NRF24L01_RX_P_NO_MASK (7 << NRF24L01_RX_P_NO_SHIFT) +#define NRF24L01_STAT_TX_FULL (1 << 0) + +/* CONFIG register definitions */ + +#define NRF24L01_MASK_RX_DR (1 << 6) +#define NRF24L01_MASK_TX_DS (1 << 5) +#define NRF24L01_MASK_MAX_RT (1 << 4) +#define NRF24L01_EN_CRC (1 << 3) +#define NRF24L01_CRCO (1 << 2) +#define NRF24L01_PWR_UP (1 << 1) +#define NRF24L01_PRIM_RX (1 << 0) + +/* RF_SETUP register definition */ + +#define NRF24L01_CONT_WAVE (1 << 7) +#define NRF24L01_RF_DR_LOW (1 << 5) +#define NRF24L01_PLL_LOCK (1 << 4) +#define NRF24L01_RF_DR_HIGH (1 << 3) + +#define NRF24L01_RF_PWR_SHIFT 1 +#define NRF24L01_RF_PWR_MASK (3 << NRF24L01_RF_PWR_SHIFT) + +/* FIFO STATUS register definitions */ + +#define NRF24L01_TX_REUSE (1 << 6) +#define NRF24L01_TX_FULL (1 << 5) +#define NRF24L01_TX_EMPTY (1 << 4) +#define NRF24L01_RX_FULL (1 << 1) +#define NRF24L01_RX_EMPTY (1 << 0) + +/* SETUP_RETR */ + +#define NRF24L01_ARC_SHIFT 0 +#define NRF24L01_ARC_MASK (0xF << NRF24L01_ARC_SHIFT) + +#define NRF24L01_ARD_SHIFT 4 +#define NRF24L01_ARD_MASK (0xF << NRF24L01_ARD_SHIFT) + +/* OBSERVE_TX register definitions */ +#define NRF24L01_PLOS_CNT_SHIFT 4 +#define NRF24L01_PLOS_CNT_MASK (0xF << NRF24L01_PLOS_CNT_SHIFT) +#define NRF24L01_ARC_CNT_SHIFT 0 +#define NRF24L01_ARC_CNT_MASK (0xF << NRF24L01_ARC_CNT_SHIFT) +#define NRF24L01_RX_P_NO_SHIFT 1 +#define NRF24L01_RX_P_NO_MASK (7 << NRF24L01_RX_P_NO_SHIFT) + +/* FEATURE register definitions */ + +#define NRF24L01_EN_DPL (1 << 2) +#define NRF24L01_EN_ACK_PAY (1 << 1) +#define NRF24L01_EN_DYN_ACK (1 << 0) + +/**************************************************************************** + * Public Data Types + ****************************************************************************/ + +#undef EXTERN +#if defined(__cplusplus) +# define EXTERN extern "C" +extern "C" + { +#else +# define EXTERN extern +#endif + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +#undef EXTERN +#if defined(__cplusplus) +} +#endif + +#endif /* __DRIVERS_WIRELESS_NRF24L01_H */ diff --git a/nuttx/fs/.gitignore b/nuttx/fs/.gitignore index 40145a92f..4b32ec6a3 100644 --- a/nuttx/fs/.gitignore +++ b/nuttx/fs/.gitignore @@ -1,13 +1,10 @@ -Make.dep -.depend -*.swp -*.asm -*.obj -*.rel -*.lst -*.sym -*.adb -*.lib -*.src - - +/Make.dep +/.depend +/*.asm +/*.obj +/*.rel +/*.lst +/*.sym +/*.adb +/*.lib +/*.src diff --git a/nuttx/graphics/.gitignore b/nuttx/graphics/.gitignore index 749b94927..4b32ec6a3 100644 --- a/nuttx/graphics/.gitignore +++ b/nuttx/graphics/.gitignore @@ -1,10 +1,10 @@ /Make.dep /.depend -*.asm -*.rel -*.lst -*.sym -*.adb -*.lib -*.src - +/*.asm +/*.obj +/*.rel +/*.lst +/*.sym +/*.adb +/*.lib +/*.src diff --git a/nuttx/include/nuttx/fs/ioctl.h b/nuttx/include/nuttx/fs/ioctl.h index c22ead682..8e8647a69 100644 --- a/nuttx/include/nuttx/fs/ioctl.h +++ b/nuttx/include/nuttx/fs/ioctl.h @@ -68,6 +68,7 @@ #define _QEIOCBASE (0x0f00) /* Quadrature encoder ioctl commands */ #define _AUDIOIOCBASE (0x1000) /* Audio ioctl commands */ #define _SLCDIOCBASE (0x1100) /* Segment LCD ioctl commands */ +#define _WLIOCBASE (0x1100) /* Wireless modules ioctl commands */ /* Macros used to manage ioctl commands */ @@ -246,6 +247,12 @@ #define _SLCDIOCVALID(c) (_IOC_TYPE(c)==_SLCDIOCBASE) #define _SLCDIOC(nr) _IOC(_SLCDIOCBASE,nr) +/* Wireless driver ioctl definitions ************************************/ +/* (see nuttx/include/wireless/wireless.h */ + +#define _WLIOCVALID(c) (_IOC_TYPE(c)==_WLIOCBASE) +#define _WLIOC(nr) _IOC(_WLIOCBASE,nr) + /**************************************************************************** * Public Type Definitions ****************************************************************************/ diff --git a/nuttx/include/nuttx/usb/cdcacm.h b/nuttx/include/nuttx/usb/cdcacm.h index 49dc4ee12..4e331b569 100644 --- a/nuttx/include/nuttx/usb/cdcacm.h +++ b/nuttx/include/nuttx/usb/cdcacm.h @@ -121,6 +121,10 @@ /* Endpoint number and size (in bytes) of the CDC device-to-host (IN) data * bulk endpoint. NOTE that difference sizes may be selected for full (FS) * or high speed (HS) modes. + * + * Ideally, the BULKOUT request size should *not* be the same size as the + * maxpacket size. That is because IN transfers of exactly the maxpacket + * size will be followed by a NULL packet. */ #ifndef CONFIG_CDCACM_EPBULKIN @@ -135,9 +139,16 @@ # define CONFIG_CDCACM_EPBULKIN_HSSIZE 512 #endif +#ifndef CONFIG_CDCACM_BULKIN_REQLEN +# define CONFIG_CDCACM_BULKIN_REQLEN 96 +#endif + /* Endpoint number and size (in bytes) of the CDC host-to-device (OUT) data * bulk endpoint. NOTE that difference sizes may be selected for full (FS) * or high speed (HS) modes. + * + * NOTE: The BULKOUT request buffer size is always the same as the + * maxpacket size. */ #ifndef CONFIG_CDCACM_EPBULKOUT diff --git a/nuttx/include/nuttx/wireless/cc1101.h b/nuttx/include/nuttx/wireless/cc1101.h index 9d6b2a673..80d3dbec3 100644 --- a/nuttx/include/nuttx/wireless/cc1101.h +++ b/nuttx/include/nuttx/wireless/cc1101.h @@ -2,7 +2,6 @@ * include/nuttx/wireless/cc1101.h * * Copyright (C) 2011 Uros Platise. All rights reserved. - * * Authors: Uros Platise <uros.platise@isotel.eu> * * Redistribution and use in source and binary forms, with or without @@ -34,14 +33,13 @@ * ****************************************************************************/ -/** \file - * \author Uros Platise - * \brief Chipcon CC1101 Device Driver - **/ - #ifndef __INCLUDE_NUTTX_WIRELESS_CC1101_H #define __INCLUDE_NUTTX_WIRELESS_CC1101_H +/**************************************************************************** + * Included Files + ****************************************************************************/ + #include <nuttx/config.h> #include <nuttx/spi.h> @@ -60,105 +58,142 @@ /* * General Purpose, Test Output Pin Options */ - + /* CC1101 General Purpose Pins */ #define CC1101_PIN_GDO0 2 #define CC1101_PIN_GDO1 1 #define CC1101_PIN_GDO2 0 - -/* Associated to the RX FIFO: Asserts when RX FIFO is filled at or above - * the RX FIFO threshold. De-asserts when RX FIFO is drained below the - * same threshold. */ + +/* Associated to the RX FIFO: Asserts when RX FIFO is filled at or above + * the RX FIFO threshold. De-asserts when RX FIFO is drained below the + * same threshold. + */ + #define CC1101_GDO_RXFIFO_THR 0x00 -/* Associated to the RX FIFO: Asserts when RX FIFO is filled at or above - * the RX FIFO threshold or the end of packet is reached. De-asserts when - * the RX FIFO is empty. */ -#define CC1101_GDO_RXFIFO_THREND 0x01 +/* Associated to the RX FIFO: Asserts when RX FIFO is filled at or above + * the RX FIFO threshold or the end of packet is reached. De-asserts when + * the RX FIFO is empty. + */ + +#define CC1101_GDO_RXFIFO_THREND 0x01 + +/* Associated to the TX FIFO: Asserts when the TX FIFO is filled at or + * above the TX FIFO threshold. De-asserts when the TX FIFO is below the + * same threshold. + */ -/* Associated to the TX FIFO: Asserts when the TX FIFO is filled at or - * above the TX FIFO threshold. De-asserts when the TX FIFO is below the - * same threshold. */ #define CC1101_GDO_TXFIFO_THR 0x02 /* Associated to the TX FIFO: Asserts when TX FIFO is full. De-asserts - * when the TX FIFO is drained below theTX FIFO threshold. */ + * when the TX FIFO is drained below theTX FIFO threshold. + */ + #define CC1101_GDO_TXFIFO_FULL 0x03 -/* Asserts when the RX FIFO has overflowed. De-asserts when the FIFO has - * been flushed. */ +/* Asserts when the RX FIFO has overflowed. De-asserts when the FIFO has + * been flushed. + */ + #define CC1101_GDO_RXFIFO_OVR 0x04 -/* Asserts when the TX FIFO has underflowed. De-asserts when the FIFO is - * flushed. */ +/* Asserts when the TX FIFO has underflowed. De-asserts when the FIFO is + * flushed. + */ + #define CC1101_GDO_TXFIFO_UNR 0x05 /* Asserts when sync word has been sent / received, and de-asserts at the - * end of the packet. In RX, the pin will de-assert when the optional - * address check fails or the RX FIFO overflows. In TX the pin will - * de-assert if the TX FIFO underflows. */ + * end of the packet. In RX, the pin will de-assert when the optional + * address check fails or the RX FIFO overflows. In TX the pin will + * de-assert if the TX FIFO underflows. + */ + #define CC1101_GDO_SYNC 0x06 -/* Asserts when a packet has been received with CRC OK. De-asserts when +/* Asserts when a packet has been received with CRC OK. De-asserts when * the first byte is read from the RX FIFO. */ #define CC1101_GDO_PKTRCV_CRCOK 0x07 -/* Preamble Quality Reached. Asserts when the PQI is above the programmed - * PQT value. */ +/* Preamble Quality Reached. Asserts when the PQI is above the programmed + * PQT value. + */ + #define CC1101_GDO_PREAMBLE 0x08 -/* Clear channel assessment. High when RSSI level is below threshold - * (dependent on the current CCA_MODE setting). */ +/* Clear channel assessment. High when RSSI level is below threshold + * (dependent on the current CCA_MODE setting). + */ + #define CC1101_GDO_CHCLEAR 0x09 -/* Lock detector output. The PLL is in lock if the lock detector output - * has a positive transition or is constantly logic high. To check for - * PLL lock the lock detector output should be used as an interrupt for - * the MCU. */ +/* Lock detector output. The PLL is in lock if the lock detector output + * has a positive transition or is constantly logic high. To check for + * PLL lock the lock detector output should be used as an interrupt for + * the MCU. + */ + #define CC1101_GDO_LOCK 0x0A /* Serial Clock. Synchronous to the data in synchronous serial mode. * In RX mode, data is set up on the falling edge by CC1101 when GDOx_INV=0. - * In TX mode, data is sampled by CC1101 on the rising edge of the serial - * clock when GDOx_INV=0. */ + * In TX mode, data is sampled by CC1101 on the rising edge of the serial + * clock when GDOx_INV=0. + */ + #define CC1101_GDO_SSCLK 0x0B /* Serial Synchronous Data Output. Used for synchronous serial mode. */ + #define CC1101_GDO_SSDO 0x0C /* Serial Data Output. Used for asynchronous serial mode. */ + #define CC1101_GDO_ASDO 0x0D /* Carrier sense. High if RSSI level is above threshold. */ + #define CC1101_GDO_CARRIER 0x0E -/* CRC_OK. The last CRC comparison matched. Cleared when entering or - * restarting RX mode. */ +/* CRC_OK. The last CRC comparison matched. Cleared when entering or + * restarting RX mode. + */ + #define CC1101_GDO_CRCOK 0x0F -/* RX_HARD_DATA[1]. Can be used together with RX_SYMBOL_TICK for - * alternative serial RX output. */ +/* RX_HARD_DATA[1]. Can be used together with RX_SYMBOL_TICK for + * alternative serial RX output. + */ + #define CC1101_GDO_RXOUT1 0x16 - -/* RX_HARD_DATA[0]. Can be used together with RX_SYMBOL_TICK for - * alternative serial RX output. */ + +/* RX_HARD_DATA[0]. Can be used together with RX_SYMBOL_TICK for + * alternative serial RX output. + */ + #define CC1101_GDO_RXOUT0 0x17 -/* PA_PD. Note: PA_PD will have the same signal level in SLEEP and TX - * states. To control an external PA or RX/TX switch in applications - * where the SLEEP state is used it is recommended to use GDOx_CFGx=0x2F - * instead. */ +/* PA_PD. Note: PA_PD will have the same signal level in SLEEP and TX + * states. To control an external PA or RX/TX switch in applications + * where the SLEEP state is used it is recommended to use GDOx_CFGx=0x2F + * instead. + */ + #define CC1101_GDO_PA_PD 0x1B -/* LNA_PD. Note: LNA_PD will have the same signal level in SLEEP and RX - * states. To control an external LNA or RX/TX switch in applications - * where the SLEEP state is used it is recommended to use GDOx_CFGx=0x2F - * instead. */ +/* LNA_PD. Note: LNA_PD will have the same signal level in SLEEP and RX + * states. To control an external LNA or RX/TX switch in applications + * where the SLEEP state is used it is recommended to use GDOx_CFGx=0x2F + * instead. + */ + #define CC1101_GDO_LNA_PD 0x1C -/* RX_SYMBOL_TICK. Can be used together with RX_HARD_DATA for alternative - * serial RX output. */ +/* RX_SYMBOL_TICK. Can be used together with RX_HARD_DATA for alternative + * serial RX output. + */ + #define CC1101_GDO_RXSYMTICK 0x1D #define CC1101_GDO_WOR_EVNT0 0x24 @@ -167,23 +202,30 @@ #define CC1101_GDO_CHIP_RDYn 0x29 #define CC1101_GDO_XOSC_STABLE 0x2B -/* GDO0_Z_EN_N. When this output is 0, GDO0 is configured as input - * (for serial TX data). */ +/* GDO0_Z_EN_N. When this output is 0, GDO0 is configured as input + * (for serial TX data). + */ + #define CC1101_GDO_GDO0_Z_EN_N 0x2D /* High impedance (3-state). */ + #define CC1101_GDO_HIZ 0x2E -/* HW to 0 (HW1 achieved by setting GDOx_INV=1). Can be used to control - * an external LNA/PA or RX/TX switch. */ +/* HW to 0 (HW1 achieved by setting GDOx_INV=1). Can be used to control + * an external LNA/PA or RX/TX switch. + */ + #define CC1101_GDO_HW 0x2F -/* There are 3 GDO pins, but only one CLK_XOSC/n can be selected as an - * output at any time. If CLK_XOSC/n is to be monitored on one of the - * GDO pins, the other two GDO pins must be configured to values less - * than 0x30. The GDO0 default value is CLK_XOSC/192. To optimize RF - * performance, these signals should not be used while the radio is - * in RX or TX mode. */ +/* There are 3 GDO pins, but only one CLK_XOSC/n can be selected as an + * output at any time. If CLK_XOSC/n is to be monitored on one of the + * GDO pins, the other two GDO pins must be configured to values less + * than 0x30. The GDO0 default value is CLK_XOSC/192. To optimize RF + * performance, these signals should not be used while the radio is + * in RX or TX mode. + */ + #define CC1101_GDO_CLK_XOSC1 0x30 #define CC1101_GDO_CLK_XOSC1_5 0x31 #define CC1101_GDO_CLK_XOSC2 0x32 @@ -201,9 +243,11 @@ #define CC1101_GDO_CLK_XOSC128 0x3E #define CC1101_GDO_CLK_XOSC192 0x3F +/**************************************************************************** + * Public Data Types + ****************************************************************************/ #ifndef __ASSEMBLY__ - #undef EXTERN #if defined(__cplusplus) #define EXTERN extern "C" @@ -212,78 +256,74 @@ extern "C" { #define EXTERN extern #endif -/**************************************************************************** - * Public Data Types - ****************************************************************************/ - struct cc1101_dev_s; -/** The RF Settings includes only those fields required to configure - * the RF radio. Other configuration fields depended on this driver - * are configured by the cc1101_init(). +/* The RF Settings includes only those fields required to configure + * the RF radio. Other configuration fields depended on this driver + * are configured by the cc1101_init(). */ -struct c1101_rfsettings_s { - uint8_t FSCTRL1; /* Frequency synthesizer control. */ - uint8_t FSCTRL0; /* Frequency synthesizer control. */ - - uint8_t FREQ2; /* Frequency control word, high byte. */ - uint8_t FREQ1; /* Frequency control word, middle byte. */ - uint8_t FREQ0; /* Frequency control word, low byte. */ - - uint8_t MDMCFG4; /* Modem configuration. */ - uint8_t MDMCFG3; /* Modem configuration. */ - uint8_t MDMCFG2; /* Modem configuration. */ - uint8_t MDMCFG1; /* Modem configuration. */ - uint8_t MDMCFG0; /* Modem configuration. */ - - uint8_t DEVIATN; /* Modem deviation setting (when FSK modulation is enabled). */ - - /* GAP */ - - uint8_t FOCCFG; /* Frequency Offset Compensation Configuration. */ - - uint8_t BSCFG; /* Bit synchronization Configuration. */ - - uint8_t AGCCTRL2; /* AGC control. */ - uint8_t AGCCTRL1; /* AGC control. */ - uint8_t AGCCTRL0; /* AGC control. */ - - /* GAP */ - - uint8_t FREND1; /* Front end RX configuration. */ - uint8_t FREND0; /* Front end RX configuration. */ - - uint8_t FSCAL3; /* Frequency synthesizer calibration. */ - uint8_t FSCAL2; /* Frequency synthesizer calibration. */ - uint8_t FSCAL1; /* Frequency synthesizer calibration. */ - uint8_t FSCAL0; /* Frequency synthesizer calibration. */ - - /* REGULATORY LIMITS */ - - uint8_t CHMIN; /* Channel Range defintion MIN .. */ - uint8_t CHMAX; /* .. and MAX */ - uint8_t PAMAX; /* at given maximum output power */ - - /* Power Table, for ramp-up/down and ASK modulation defined for - * output power values as: - * PA = {-30, -20, -15, -10, -5, 0, 5, 10} [dBm] - */ - uint8_t PA[8]; -}; +struct c1101_rfsettings_s +{ + uint8_t FSCTRL1; /* Frequency synthesizer control. */ + uint8_t FSCTRL0; /* Frequency synthesizer control. */ + + uint8_t FREQ2; /* Frequency control word, high byte. */ + uint8_t FREQ1; /* Frequency control word, middle byte. */ + uint8_t FREQ0; /* Frequency control word, low byte. */ + + uint8_t MDMCFG4; /* Modem configuration. */ + uint8_t MDMCFG3; /* Modem configuration. */ + uint8_t MDMCFG2; /* Modem configuration. */ + uint8_t MDMCFG1; /* Modem configuration. */ + uint8_t MDMCFG0; /* Modem configuration. */ + + uint8_t DEVIATN; /* Modem deviation setting (when FSK modulation is enabled). */ + + /* GAP */ + + uint8_t FOCCFG; /* Frequency Offset Compensation Configuration. */ + + uint8_t BSCFG; /* Bit synchronization Configuration. */ + + uint8_t AGCCTRL2; /* AGC control. */ + uint8_t AGCCTRL1; /* AGC control. */ + uint8_t AGCCTRL0; /* AGC control. */ + + /* GAP */ + + uint8_t FREND1; /* Front end RX configuration. */ + uint8_t FREND0; /* Front end RX configuration. */ + + uint8_t FSCAL3; /* Frequency synthesizer calibration. */ + uint8_t FSCAL2; /* Frequency synthesizer calibration. */ + uint8_t FSCAL1; /* Frequency synthesizer calibration. */ + uint8_t FSCAL0; /* Frequency synthesizer calibration. */ + + /* REGULATORY LIMITS */ + + uint8_t CHMIN; /* Channel Range defintion MIN .. */ + uint8_t CHMAX; /* .. and MAX */ + uint8_t PAMAX; /* at given maximum output power */ + + /* Power Table, for ramp-up/down and ASK modulation defined for + * output power values as: + * PA = {-30, -20, -15, -10, -5, 0, 5, 10} [dBm] + */ + + uint8_t PA[8]; +}; /**************************************************************************** * RF Configuration Database ****************************************************************************/ -EXTERN const struct c1101_rfsettings_s - // \todo Recalculate ERP in maximum power level /* 868 MHz, GFSK, 100 kbps, ISM Region 1 (Europe only) - * + * * ISM Region 1 (Europe) only, Band 868–870 MHz - * + * * Frequency bands for non-specific short range devices in Europe: * * Frequency ERP Duty Cycle Bandwidth Remarks @@ -292,9 +332,9 @@ EXTERN const struct c1101_rfsettings_s * 869.3 – 869.4 MHz +10 dBm No limits < 25 kHz Appropriate access protocol required * 869.4 – 869.65 MHz +27 dBm < 10% < 25 kHz Channels may be combined to one high speed channel * 869.7 -870 MHz +7 dBm No limits No limits - * + * * Frequency Band For License-Free Specific Applications in Europe - * + * * Frequency Application ERP Duty Cycle Bandwidth * 868.6 – 868.7 MHz Alarms +10 dBm < 0.1% 25 kHz(1) * 869.2 – 869.25 MHz Social Alarms +10 dBm < 0.1% 25 kHz @@ -302,30 +342,30 @@ EXTERN const struct c1101_rfsettings_s * 869.65 -869.7 MHz Alarms +14 dBm < 10% 25 kHz * 863 – 865 MHz Radio Microphones +10 dBm No limits 200 kHz * 863 -865 MHz Wireless Audio Applications +10 dBm No limits 300 kHz - * - * Duty Cycle Limit Total On Time Maximum On Time of Minimum Off Time of + * + * Duty Cycle Limit Total On Time Maximum On Time of Minimum Off Time of * Within One Hour One Transmission Two Transmission * < 0.1% 3.6 seconds 0.72 seconds 0.72 seconds * < 1% 36 seconds 3.6 seconds 1.8 seconds * < 10% 360 seconds 36 seconds 3.6 seconds - * + * * Reference: TI Application Report: swra048.pdf, May 2005 * ISM-Band and Short Range Device Regulatory Compliance Overview */ - cc1101_rfsettings_ISM1_868MHzGFSK100kbps, +EXTERN const struct c1101_rfsettings_s cc1101_rfsettings_ISM1_868MHzGFSK100kbps; /* 905 MHz, GFSK, 250 kbps, ISM Region 2 (America only) - * + * * ISM Region 2 (America) only, Band 902–928 MHz - * + * * Cordless phones 1 W * Microwave ovens 750 W * Industrial heaters 100 kW * Military radar 1000 kW */ - cc1101_rfsettings_ISM2_905MHzGFSK250kbps; +EXTERN const struct c1101_rfsettings_s cc1101_rfsettings_ISM2_905MHzGFSK250kbps; /**************************************************************************** * Public Function Prototypes @@ -334,131 +374,136 @@ EXTERN const struct c1101_rfsettings_s /** Initialize Chipcon CC1101 Chip. * After initialization CC1101 is ready to listen, receive and transmit * messages on the default channel 0 at given RF configuration. - * + * * \param spi SPI Device Structure * \param isrpin Select the CC1101_PIN_GDOx used to signal interrupts * \param rfsettings Pointer to default RF Settings loaded at boot time. * \return Pointer to newly allocated CC1101 structure or NULL on error with errno set. - * + * * Possible errno as set by this function on error: * - ENODEV: When device addressed is not compatible or it is not a CC1101 * - EFAULT: When there is no device * - ENOMEM: Out of kernel memory to allocate the device * - EBUSY: When device is already addressed by other device driver (not yet supported by low-level driver) **/ -EXTERN struct cc1101_dev_s * cc1101_init(struct spi_dev_s * spi, uint8_t isrpin, - uint32_t pinset, const struct c1101_rfsettings_s * rfsettings); +struct cc1101_dev_s * cc1101_init(struct spi_dev_s * spi, uint8_t isrpin, + uint32_t pinset, const struct c1101_rfsettings_s * rfsettings); /** Deinitialize Chipcon CC1101 Chip - * + * * \param dev Device to CC1101 device structure, as returned by the cc1101_init() * \return OK On success - * + * **/ -EXTERN int cc1101_deinit(struct cc1101_dev_s * dev); +int cc1101_deinit(struct cc1101_dev_s * dev); /** Power up device, start conversion. \return Zero on success. */ -EXTERN int cc1101_powerup(struct cc1101_dev_s * dev); + +int cc1101_powerup(struct cc1101_dev_s * dev); /** Power down device, stop conversion. \return Zero on success. */ -EXTERN int cc1101_powerdown(struct cc1101_dev_s * dev); + +int cc1101_powerdown(struct cc1101_dev_s * dev); /** Set Multi Purpose Output Function. \return Zero on success. */ -EXTERN int cc1101_setgdo(struct cc1101_dev_s * dev, uint8_t pin, uint8_t function); + +int cc1101_setgdo(struct cc1101_dev_s * dev, uint8_t pin, uint8_t function); /** Set RF settings. Use one from the database above. */ -EXTERN int cc1101_setrf(struct cc1101_dev_s * dev, const struct c1101_rfsettings_s *settings); -/** Set Channel. +int cc1101_setrf(struct cc1101_dev_s * dev, const struct c1101_rfsettings_s *settings); + +/** Set Channel. * Note that regulatory check is made and sending may be prohibited. - * + * * \retval 0 On success, sending and receiving is allowed. * \retval 1 Only receive mode is allowed. * \retval <0 On error. */ -EXTERN int cc1101_setchannel(struct cc1101_dev_s * dev, uint8_t channel); +int cc1101_setchannel(struct cc1101_dev_s * dev, uint8_t channel); /** Set Output Power - * + * * \param power Value from 0 - 8, where 0 means power off, and values * from 1 .. 8 denote the following output power in dBm: * {-30, -20, -15, -10, -5, 0, 5, 10} [dBm] - * + * * If power is above the regulatory limit (defined by the RF settings) * it is limited. - * + * * \return Actual output power in range from 0..8. */ -EXTERN uint8_t cc1101_setpower(struct cc1101_dev_s * dev, uint8_t power); +uint8_t cc1101_setpower(struct cc1101_dev_s * dev, uint8_t power); /** Convert RSSI as obtained from CC1101 to [dBm] */ -EXTERN int cc1101_calcRSSIdBm(int rssi); +int cc1101_calcRSSIdBm(int rssi); -/** Enter receive mode and wait for a packet. +/** Enter receive mode and wait for a packet. * If transmission is in progress, receive mode is entered upon its * completion. As long cc1101_idle() is not called, each transmission * returns to receive mode. - * + * * \param dev Device to CC1101 structure - * \return Zero on success. + * \return Zero on success. */ -EXTERN int cc1101_receive(struct cc1101_dev_s * dev); +int cc1101_receive(struct cc1101_dev_s * dev); -/** Read received packet - * +/** Read received packet + * * If size of buffer is too small then the remaining part of data can * be discarded by the driver. - * + * * Packet contains raw data, including the two bytes: - * - RSSI and - * - LQI + * - RSSI and + * - LQI * appended at the end of the message. - * + * * To inquery about the data pending size you the following: * - pass buf=NULL and size > 0, returns pending data packet size * - pass buf=NULL and size = 0, returns maximum data packet size - * + * * NOTE: messages length are typically defined by the MAC, transmit/ * receive windows at some rate. */ -EXTERN int cc1101_read(struct cc1101_dev_s * dev, uint8_t * buf, size_t size); +int cc1101_read(struct cc1101_dev_s * dev, uint8_t * buf, size_t size); /** Write data to be send, using the cc1101_send() - * + * * \param dev Device to CC1101 structure * \param buf Pointer to data. * \param size Size must be within limits, otherwise data is truncated. - * Present driver limitation supports a single cc1101_write() + * Present driver limitation supports a single cc1101_write() * prioer cc1101_send() is called. */ -EXTERN int cc1101_write(struct cc1101_dev_s * dev, const uint8_t * buf, size_t size); +int cc1101_write(struct cc1101_dev_s * dev, const uint8_t * buf, size_t size); /** Send data previously writtenusing cc1101_write() - * + * * \param dev Device to CC1101 structure - * \return Zero on success. + * \return Zero on success. */ -EXTERN int cc1101_send(struct cc1101_dev_s * dev); +int cc1101_send(struct cc1101_dev_s * dev); -/** Enter idle state (after reception and transmission completes). - * +/** Enter idle state (after reception and transmission completes). + * * \return Zero on success. */ -EXTERN int cc1101_idle(struct cc1101_dev_s * dev); +int cc1101_idle(struct cc1101_dev_s * dev); #undef EXTERN #if defined(__cplusplus) } #endif + #endif /* __ASSEMBLY__ */ #endif /* __INCLUDE_NUTTX_WIRELESS_CC1101_H */ diff --git a/nuttx/include/nuttx/wireless/nrf24l01.h b/nuttx/include/nuttx/wireless/nrf24l01.h new file mode 100644 index 000000000..d23aa3650 --- /dev/null +++ b/nuttx/include/nuttx/wireless/nrf24l01.h @@ -0,0 +1,444 @@ +/**************************************************************************** + * include/nuttx/wireless/nrf24l01.h + * + * Copyright (C) 2013 Laurent Latil + * Author: Laurent Latil <laurent@latil.nom.fr> + * + * 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_NRF24L01_H +#define __INCLUDE_NUTTX_NRF24L01_H + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include <nuttx/config.h> +#include <nuttx/spi.h> +#include <nuttx/irq.h> +#include <nuttx/wireless/wireless.h> + +#include <stdint.h> +#include <stdbool.h> + +/**************************************************************************** + * Pre-Processor Declarations + ****************************************************************************/ + +#define NRF24L01_MIN_ADDR_LEN 3 /* Minimal length (in bytes) of a pipe address */ +#define NRF24L01_MAX_ADDR_LEN 5 /* Maximum length (in bytes) of a pipe address */ +#define NRF24L01_MAX_PAYLOAD_LEN 32 /* Maximum length (in bytes) of a payload */ +#define NRF24L01_MAX_XMIT_RETR 15 /* Maximum auto retransmit count (for AA transmissions) */ +#define NRF24L01_PIPE_COUNT 6 /* Number of available pipes */ + +#define NRF24L01_MIN_FREQ 2400 /* Lower bound for RF frequency */ +#define NRF24L01_MAX_FREQ 2525 /* Upper bound for RF frequency */ + +#define NRF24L01_DYN_LENGTH 33 /* Specific length value to use to enable dynamic packet length */ +#define NRF24L01_XMIT_MAXRT 255 /* Specific value returned by Number of available pipes */ + +/* #define NRF24L01_DEBUG 1 */ + +/* IOCTL commands */ + +#define NRF24L01IOC_SETRETRCFG _WLIOC_USER(0x0001) /* arg: Pointer to nrf24l01_retrcfg_t structure */ +#define NRF24L01IOC_GETRETRCFG _WLIOC_USER(0x0002) /* arg: Pointer to nrf24l01_retrcfg_t structure */ +#define NRF24L01IOC_SETPIPESCFG _WLIOC_USER(0x0003) /* arg: Pointer to an array of nrf24l01_pipecfg_t pointers */ +#define NRF24L01IOC_GETPIPESCFG _WLIOC_USER(0x0004) /* arg: Pointer to an array of nrf24l01_pipecfg_t pointers */ +#define NRF24L01IOC_SETPIPESENABLED _WLIOC_USER(0x0005) /* arg: Pointer to a uint8_t value, bit field of enabled / disabled pipes */ +#define NRF24L01IOC_GETPIPESENABLED _WLIOC_USER(0x0006) /* arg: Pointer to a uint8_t value, bit field of enabled / disabled pipes */ +#define NRF24L01IOC_SETDATARATE _WLIOC_USER(0x0007) /* arg: Pointer to a nrf24l01_datarate_t value */ +#define NRF24L01IOC_GETDATARATE _WLIOC_USER(0x0008) /* arg: Pointer to a nrf24l01_datarate_t value */ +#define NRF24L01IOC_SETADDRWIDTH _WLIOC_USER(0x0009) /* arg: Pointer to an uint32_t value, width of the address */ +#define NRF24L01IOC_GETADDRWIDTH _WLIOC_USER(0x000A) /* arg: Pointer to an uint32_t value, width of the address */ +#define NRF24L01IOC_SETSTATE _WLIOC_USER(0x000B) /* arg: Pointer to a nrf24l01_state_t value */ +#define NRF24L01IOC_GETSTATE _WLIOC_USER(0x000C) /* arg: Pointer to a nrf24l01_state_t value */ +#define NRF24L01IOC_GETLASTXMITCOUNT _WLIOC_USER(0x000D) /* arg: Pointer to an uint32_t value, retransmission count of the last send operation (NRF24L01_XMIT_MAXRT if no ACK received)*/ +#define NRF24L01IOC_GETLASTPIPENO _WLIOC_USER(0x000E) /* arg: Pointer to an uint32_t value, pipe # of the last received packet */ + +/* Aliased name for these commands */ + +#define NRF24L01IOC_SETTXADDR WLIOC_SETADDR +#define NRF24L01IOC_GETTXADDR WLIOC_GETADDR + +/* NRF24L01 debug */ + +#ifdef NRF24L01_DEBUG +# define wdbg(format, arg...) dbg(format, ##arg) +# define wlldbg(format, arg...) lldbg(format, ##arg) +# define wvdbg(format, arg...) vdbg(format, ##arg) +# define wllvdbg(format, arg...) llvdbg(format, ##arg) +#else +# define wdbg(x...) +# define wlldbg(x...) +# define wvdbg(x...) +# define wllvdbg(x...) +#endif + +/**************************************************************************** + * Public Data Types + ****************************************************************************/ + +#undef EXTERN +#if defined(__cplusplus) +# define EXTERN extern "C" +extern "C" + { +#else +# define EXTERN extern +#endif + +/* Data rates available for transmission */ + +typedef enum +{ + RATE_1Mbps, + RATE_2Mbps, + RATE_250kbps +} nrf24l01_datarate_t; + +/* Definition of the different possible states of the module */ + +typedef enum +{ + ST_UNKNOWN, + ST_POWER_DOWN, + ST_STANDBY, +#ifdef CONFIG_WL_NRF24L01_RXSUPPORT + ST_RX +#endif +} nrf24l01_state_t; + +/* Re-transmission delay */ + +typedef enum +{ + DELAY_250us, + DELAY_500us, + DELAY_750us, + DELAY_1000us, + DELAY_1250us, + DELAY_1500us, + DELAY_1750us, + DELAY_2000us, + DELAY_2250us, + DELAY_2500us, + DELAY_2750us, + DELAY_3000us, + DELAY_3250us, + DELAY_3500us, + DELAY_3750us, + DELAY_4000us +} nrf24l01_retransmit_delay_t; + +/* Opaque definition of a nRF24L01 device */ + +struct nrf24l01_dev_s; + +/* Configuration info for a RX pipe */ + +struct nrf24l01_pipecfg_s +{ + bool en_aa; /* Enable auto-acknowledge */ + uint8_t rx_addr[NRF24L01_MAX_ADDR_LEN]; /* Receive address for the data pipe (LSB first) */ + uint8_t payload_length; /* Define packet size (NRF24L01_DYN_LENGTH : dynamic length payload ) */ +}; +typedef struct nrf24l01_pipecfg_s nrf24l01_pipecfg_t; + +/* Configuration of the retransmission parameters (used when AA is enabled) */ + +struct nrf24l01_retrcfg_s +{ + nrf24l01_retransmit_delay_t delay; /* Delay before retransmitting (when no ACK received) */ + uint8_t count; /* Retransmit retries count */ +}; +typedef struct nrf24l01_retrcfg_s nrf24l01_retrcfg_t; + +/* A reference to a structure of this type must be passed to the initialization + * method (nrf24l01_init() ). It provides some board-specific hooks used + * by driver to manage the GPIO lines (IRQ and CE). + * + * Memory for this structure is provided by the caller. It is not copied + * by the driver and is presumed to persist while the driver is active. + */ + +struct nrf24l01_config_s +{ + /* IRQ/GPIO access callbacks. These operations all hidden behind + * callbacks to isolate the ADS7843E driver from differences in GPIO + * interrupt handling by varying boards and MCUs. If possible, + * interrupts should be configured on both rising and falling edges + * so that contact and loss-of-contact events can be detected. + * + * irqattach - Attach the driver interrupt handler to the GPIO interrupt + * chipenable - Enable or disable the chip (CE line) + */ + + int (*irqattach)(xcpt_t isr); + void (*chipenable)(bool enable); +}; + +/************************************************************************************ + * Public Functions + ************************************************************************************/ + +/** Register the nRF24L01+ device. + * + * \param spi SPI Device structure + * \param cfg Board specific configuration info + * \return Pointer to newly allocated nrf24l01 device structure or NULL on error (errno is set accordingly in this case). + * + * Possible errors: + * - ENOMEM: Out of kernel memory to allocate the device + **/ + +int nrf24l01_register(FAR struct spi_dev_s *spi, FAR struct nrf24l01_config_s *cfg); + +/** Initialize the nRF24L01+ chip to a default initial state. + * + * \param dev Pointer to a registered nRF24L01 device structure + **/ + +int nrf24l01_init(FAR struct nrf24l01_dev_s *dev); + +/** Get a pointer to the registered device + */ + +FAR struct nrf24l01_dev_s * nrf24l01_getinstance(void); + +/** Set the default TX address. + * + * \param dev Pointer to an nRF24L01 device structure + * \param addr TX address (LSByte first) + * + * \return 0 + **/ + +int nrf24l01_settxaddr(FAR struct nrf24l01_dev_s *dev, FAR const uint8_t *addr); + +/** Get the default TX address. + * + * \param dev Pointer to an nRF24L01 device structure + * \param addr TX address (LSByte first) + * + * \return 0 + **/ + +int nrf24l01_gettxaddr(FAR struct nrf24l01_dev_s *dev, FAR uint8_t *addr); + +/** Configure auto-retransmit + * + * \param dev Pointer to an nRF24L01 device structure + * \param retrdelay Auto-retransmit delay + * \param retrcount Auto-retransmit count (0 - 15) + * \return 0 + **/ + +int nrf24l01_setretransmit(FAR struct nrf24l01_dev_s *dev, nrf24l01_retransmit_delay_t retrdelay, uint8_t retrcount); + +/** Configure a RX pipe. + * + * \param dev Pointer to an nRF24L01 device structure + * \param pipeno Pipe number to configure + * \param pipecfg Pointer to configuration data + * + * \return 0 + **/ + +int nrf24l01_setpipeconfig(FAR struct nrf24l01_dev_s *dev, unsigned int pipeno, + FAR const nrf24l01_pipecfg_t *pipecfg); + +/** Get pipe configuration. + * + * \param dev Pointer to an nRF24L01 device structure + * \param pipeno Pipe number to configure + * \param pipecfg Pointer to configuration data used to store the config + * + * \return 0 + **/ + +int nrf24l01_getpipeconfig(FAR struct nrf24l01_dev_s *dev, unsigned int pipeno, + FAR nrf24l01_pipecfg_t *pipecfg); + +/** Enable a RX pipe. + * + * \param dev Pointer to an nRF24L01 device structure + * \param pipeno Pipe number + * \param enable true to enable the pipe, false to disable it + * + * \return 0 + **/ + +int nrf24l01_enablepipe(FAR struct nrf24l01_dev_s *dev, unsigned int pipeno, bool enable); + +/** Configure RF. + * + * \param dev Pointer to an nRF24L01 device structure + * \param datarate Datarate + * \param outpower Output power + * + * \return 0 + **/ + +int nrf24l01_setuprf(FAR struct nrf24l01_dev_s *dev, nrf24l01_datarate_t datarate, + int outpower); + +/** Configure the TX output power. + * + * Note that hardware supports only -18, -12, -6 and 0 dBm values. + * + * \param dev Pointer to an nRF24L01 device structure + * \param outpower Output power (in dBm). + * + * \return 0 + **/ + +int nrf24l01_settxpower(FAR struct nrf24l01_dev_s *dev, int outpower); + +/** Get the current TX output power. + * + * Note that hardware supports only -18, -12, -6 and 0 dBm values. + * + * \param dev Pointer to an nRF24L01 device structure + * \return outpower Output power (in dBm) + **/ + +int nrf24l01_gettxpower(FAR struct nrf24l01_dev_s *dev); + +/** Set transmission data rate + + * \param dev Pointer to an nRF24L01 device structure + * \return datarate Data rate + **/ + +int nrf24l01_setdatarate(FAR struct nrf24l01_dev_s *dev, nrf24l01_datarate_t datarate); + +/** Set radio frequency. + * + * \param dev Pointer to an nRF24L01 device structure + * \param freq New frequency value (in Mhz: 2400 to 2525) + * + * \return OK + **/ + +int nrf24l01_setradiofreq(FAR struct nrf24l01_dev_s *dev, uint32_t freq); + +/** Get current radio frequency. + * + * \param dev Pointer to an nRF24L01 device structure + * + * \return Radio frequency (in Mhz) + **/ + +uint32_t nrf24l01_getradiofreq(FAR struct nrf24l01_dev_s *dev); + +/** Configure address length. + * + * \param dev Pointer to an nRF24L01 device structure + * \param width Address width to use (3-5) + * \return 0 + **/ + +int nrf24l01_setaddrwidth(FAR struct nrf24l01_dev_s *dev, uint32_t width); + +/** Change the current lifecycle state of the nRF24L01+ chip. + * + * \param dev Pointer to an nRF24L01 device structure + * \param state New state to put the nRF24L01 module into + **/ + +int nrf24l01_changestate(FAR struct nrf24l01_dev_s *dev, nrf24l01_state_t state); + +/** Send data to the default address. + * + * \param dev Pointer to an nRF24L01 device structure + * \param data Pointer on the data buffer + * \param datalen Length of the buffer (in bytes) + * + * \return + **/ + +int nrf24l01_send(FAR struct nrf24l01_dev_s *dev, FAR const uint8_t *data, size_t datalen); + +/** Send data to the specified address. + * + * \param dev Pointer to an nRF24L01 device structure + * \param data Pointer on the data buffer + * \param datalen Length of the buffer (in bytes) + * \param destaddr Destination address + * + * \return + **/ + +int nrf24l01_sendto(FAR struct nrf24l01_dev_s *dev, FAR const uint8_t *data, + size_t datalen, FAR const uint8_t *destaddr); + +/** Get the retransmits count of the last transmission. + * This value is meaningful only if auto-acknowledge is enabled. + * + * \param dev Pointer to an nRF24L01 device structure + * \return Retransmit count, or NRF24L01_XMIT_MAXRT if no ACK received (transmission failure) + */ + +int nrf24l01_xmitcount(FAR struct nrf24l01_dev_s *dev); + + +#ifdef CONFIG_WL_NRF24L01_RXSUPPORT + +/** Read the next received frame. + * + * \param dev Pointer to an nRF24L01 device structure + * \param buffer Pointer on buffer used to store the received frame bytes + * \param buflen Length of the buffer (in bytes) + * \param recvpipe Pointer to a byte value used to store the pipe number of the frame + * (use NULL if the pipe number info is not required) + * + * \return Length of the actual data + **/ + +ssize_t nrf24l01_recv(struct nrf24l01_dev_s *dev, uint8_t *buffer, + size_t buflen, uint8_t *recvpipe); + +#endif + +#ifdef NRF24L01_DEBUG + +void nrf24l01_dumpregs(FAR struct nrf24l01_dev_s *dev); + +void nrf24l01_dumprxfifo(FAR struct nrf24l01_dev_s *dev); + +#endif + +#undef EXTERN +#if defined(__cplusplus) +} +#endif + +#endif /* __INCLUDE_NUTTX_NRF24L01_H */ diff --git a/nuttx/include/nuttx/wireless/wireless.h b/nuttx/include/nuttx/wireless/wireless.h new file mode 100644 index 000000000..de1f097ec --- /dev/null +++ b/nuttx/include/nuttx/wireless/wireless.h @@ -0,0 +1,74 @@ +/************************************************************************************ + * include/nuttx/wireless/wireless.h + * + * Copyright (C) 2011-2013 Gregory Nutt. All rights reserved. + * Author: Laurent Latil <gnutt@nuttx.org> + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name NuttX nor the names of its contributors may be + * used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS + * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + ************************************************************************************/ + +/* This file includes common definitions to be used in all wireless drivers + * (when applicable). + */ + +#ifndef __INCLUDE_NUTTX_WIRELESS_H +#define __INCLUDE_NUTTX_WIRELESS_H + +/************************************************************************************ + * Included Files + ************************************************************************************/ + +#include <nuttx/config.h> +#include <nuttx/fs/ioctl.h> + +#ifdef CONFIG_WIRELESS + +/************************************************************************************ + * Pre-Processor Definitions + ************************************************************************************/ +/* IOCTL Commands *******************************************************************/ + +#define WLIOC_SETRADIOFREQ _WLIOC(0x0001) /* arg: Pointer to uint32_t, frequency value (in Mhz) */ +#define WLIOC_GETRADIOFREQ _WLIOC(0x0002) /* arg: Pointer to uint32_t, frequency value (in Mhz) */ +#define WLIOC_SETADDR _WLIOC(0x0003) /* arg: Pointer to address value, format of the address is driver specific */ +#define WLIOC_GETADDR _WLIOC(0x0004) /* arg: Pointer to address value, format of the address is driver specific */ +#define WLIOC_SETTXPOWER _WLIOC(0x0005) /* arg: Pointer to int32_t, output power (in dBm) */ +#define WLIOC_GETTXPOWER _WLIOC(0x0006) /* arg: Pointer to int32_t, output power (in dBm) */ + +/* Wireless drivers can provide additional, device specific ioctl + * commands, beginning with this value: + */ + +#define WLIOC_USER 0x0007 /* Lowest, unused WL ioctl command */ + +#define _WLIOC_USER(nr) _WLIOC(nr + WLIOC_USER) + +#endif + +#endif /* __INCLUDE_NUTTX_WIRELESS_H */ diff --git a/nuttx/libc/.gitignore b/nuttx/libc/.gitignore index 585270233..4b32ec6a3 100644 --- a/nuttx/libc/.gitignore +++ b/nuttx/libc/.gitignore @@ -1,10 +1,10 @@ /Make.dep /.depend -*.asm -*.obj -*.rel -*.lst -*.sym -*.adb -*.lib -*.src +/*.asm +/*.obj +/*.rel +/*.lst +/*.sym +/*.adb +/*.lib +/*.src diff --git a/nuttx/libxx/.gitignore b/nuttx/libxx/.gitignore index 205c547dd..cb4b35762 100644 --- a/nuttx/libxx/.gitignore +++ b/nuttx/libxx/.gitignore @@ -1,10 +1,11 @@ /Make.dep /.depend /uClibc++ -*.asm -*.rel -*.lst -*.sym -*.adb -*.lib -*.src +/*.asm +/*.obj +/*.rel +/*.lst +/*.sym +/*.adb +/*.lib +/*.src diff --git a/nuttx/mm/.gitignore b/nuttx/mm/.gitignore index e05702173..4b32ec6a3 100644 --- a/nuttx/mm/.gitignore +++ b/nuttx/mm/.gitignore @@ -1,10 +1,10 @@ /Make.dep /.depend -*.o1 -*.src -*.obj -*.asm -*.lst -*.sym -*.adb -*.lib +/*.asm +/*.obj +/*.rel +/*.lst +/*.sym +/*.adb +/*.lib +/*.src diff --git a/nuttx/net/.gitignore b/nuttx/net/.gitignore index 585270233..4b32ec6a3 100644 --- a/nuttx/net/.gitignore +++ b/nuttx/net/.gitignore @@ -1,10 +1,10 @@ /Make.dep /.depend -*.asm -*.obj -*.rel -*.lst -*.sym -*.adb -*.lib -*.src +/*.asm +/*.obj +/*.rel +/*.lst +/*.sym +/*.adb +/*.lib +/*.src diff --git a/nuttx/sched/.gitignore b/nuttx/sched/.gitignore index ac9b86edb..4b32ec6a3 100644 --- a/nuttx/sched/.gitignore +++ b/nuttx/sched/.gitignore @@ -1,6 +1,5 @@ /Make.dep /.depend -/*.src /*.asm /*.obj /*.rel @@ -8,3 +7,4 @@ /*.sym /*.adb /*.lib +/*.src diff --git a/nuttx/syscall/.gitignore b/nuttx/syscall/.gitignore index e291fcf5b..73decaa73 100644 --- a/nuttx/syscall/.gitignore +++ b/nuttx/syscall/.gitignore @@ -1,3 +1,11 @@ -/.context -/.depend /Make.dep +/.depend +/.context +/*.asm +/*.obj +/*.rel +/*.lst +/*.sym +/*.adb +/*.lib +/*.src diff --git a/nuttx/tools/.gitignore b/nuttx/tools/.gitignore index d72e3c723..a4f736d39 100644 --- a/nuttx/tools/.gitignore +++ b/nuttx/tools/.gitignore @@ -7,6 +7,7 @@ /mksyscall /mkversion /*.exe +/*.dSYM /.k2h-body.dat /.k2h-apndx.dat /*.dSYM diff --git a/nuttx/tools/pic32mx/.gitignore b/nuttx/tools/pic32mx/.gitignore index a3d367365..fe7aa6a26 100644 --- a/nuttx/tools/pic32mx/.gitignore +++ b/nuttx/tools/pic32mx/.gitignore @@ -1,2 +1,3 @@ /mkpichex /mkpichex.exe +/*.dSYM diff --git a/nuttx/tools/pic32mx/Makefile b/nuttx/tools/pic32mx/Makefile index 040cf58cc..1d6a2962c 100644 --- a/nuttx/tools/pic32mx/Makefile +++ b/nuttx/tools/pic32mx/Makefile @@ -47,5 +47,5 @@ mkconfig: mkpichex.c mkpichex.c @gcc $(CFLAGS) -o mkpichex mkpichex.c clean: - @rm -f *.o *.a *~ .*.swp + @rm -f *.o *.a *.dSYM *~ .*.swp @rm -f mkpichex mkpichex.exe |