[mynewt-core] branch master updated: adding 380kbps to nrf52840_bitfields.c for twi and twim
This is an automated email from the ASF dual-hosted git repository. ccollins pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/mynewt-core.git The following commit(s) were added to refs/heads/master by this push: new 53a34eb adding 380kbps to nrf52840_bitfields.c for twi and twim 53a34eb is described below commit 53a34eb4344f47685e469f69f1a5e4ff2382ced2 Author: JustineKH AuthorDate: Tue Nov 20 12:30:07 2018 -0800 adding 380kbps to nrf52840_bitfields.c for twi and twim --- hw/mcu/nordic/src/ext/nrfx/mdk/nrf52840_bitfields.h | 2 ++ hw/mcu/nordic/src/ext/nrfx/mdk/nrf52_bitfields.h| 1 + 2 files changed, 3 insertions(+) diff --git a/hw/mcu/nordic/src/ext/nrfx/mdk/nrf52840_bitfields.h b/hw/mcu/nordic/src/ext/nrfx/mdk/nrf52840_bitfields.h index 99cce73..fc724c5 100644 --- a/hw/mcu/nordic/src/ext/nrfx/mdk/nrf52840_bitfields.h +++ b/hw/mcu/nordic/src/ext/nrfx/mdk/nrf52840_bitfields.h @@ -13959,6 +13959,7 @@ POSSIBILITY OF SUCH DAMAGE. #define TWI_FREQUENCY_FREQUENCY_Msk (0xUL << TWI_FREQUENCY_FREQUENCY_Pos) /*!< Bit mask of FREQUENCY field. */ #define TWI_FREQUENCY_FREQUENCY_K100 (0x0198UL) /*!< 100 kbps */ #define TWI_FREQUENCY_FREQUENCY_K250 (0x0400UL) /*!< 250 kbps */ +#define TWI_FREQUENCY_FREQUENCY_K380 (0x06147ae9UL) /*!< 380 kbps */ #define TWI_FREQUENCY_FREQUENCY_K400 (0x0668UL) /*!< 400 kbps (actual rate 410.256 kbps) */ /* Register: TWI_ADDRESS */ @@ -14335,6 +14336,7 @@ POSSIBILITY OF SUCH DAMAGE. #define TWIM_FREQUENCY_FREQUENCY_Msk (0xUL << TWIM_FREQUENCY_FREQUENCY_Pos) /*!< Bit mask of FREQUENCY field. */ #define TWIM_FREQUENCY_FREQUENCY_K100 (0x0198UL) /*!< 100 kbps */ #define TWIM_FREQUENCY_FREQUENCY_K250 (0x0400UL) /*!< 250 kbps */ +#define TWIM_FREQUENCY_FREQUENCY_K380 (0x06147ae9UL) /*!< 380 kbps */ #define TWIM_FREQUENCY_FREQUENCY_K400 (0x0640UL) /*!< 400 kbps */ /* Register: TWIM_RXD_PTR */ diff --git a/hw/mcu/nordic/src/ext/nrfx/mdk/nrf52_bitfields.h b/hw/mcu/nordic/src/ext/nrfx/mdk/nrf52_bitfields.h index 2b4aa81..4211919 100644 --- a/hw/mcu/nordic/src/ext/nrfx/mdk/nrf52_bitfields.h +++ b/hw/mcu/nordic/src/ext/nrfx/mdk/nrf52_bitfields.h @@ -11428,6 +11428,7 @@ POSSIBILITY OF SUCH DAMAGE. #define TWIM_FREQUENCY_FREQUENCY_Msk (0xUL << TWIM_FREQUENCY_FREQUENCY_Pos) /*!< Bit mask of FREQUENCY field. */ #define TWIM_FREQUENCY_FREQUENCY_K100 (0x0198UL) /*!< 100 kbps */ #define TWIM_FREQUENCY_FREQUENCY_K250 (0x0400UL) /*!< 250 kbps */ +#define TWIM_FREQUENCY_FREQUENCY_K380 (0x06147ae9UL) /*!< 380 kbps */ #define TWIM_FREQUENCY_FREQUENCY_K400 (0x0640UL) /*!< 400 kbps */ /* Register: TWIM_RXD_PTR */
[GitHub] [mynewt-core] ccollins476ad merged pull request #1854: nrfx: add 380kbps to nrf52840_bitfields.c for twi and twim
ccollins476ad merged pull request #1854: nrfx: add 380kbps to nrf52840_bitfields.c for twi and twim URL: https://github.com/apache/mynewt-core/pull/1854 This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [mynewt-core] alvarop opened a new pull request #1855: Trying to add NRF52811 support
alvarop opened a new pull request #1855: Trying to add NRF52811 support URL: https://github.com/apache/mynewt-core/pull/1855 Removed STATIC_ASSERT() since C99 doesn't define it Updated TWI definitions to use new struct. Added various NRF52811 specific defines (and sometimes NRF52810!) This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [mynewt-core] mlaz commented on issue #1854: nrfx: add 380kbps to nrf52840_bitfields.c for twi and twim
mlaz commented on issue #1854: nrfx: add 380kbps to nrf52840_bitfields.c for twi and twim URL: https://github.com/apache/mynewt-core/pull/1854#issuecomment-497894428 LGTM This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [mynewt-core] mlaz removed a comment on issue #1854: nrfx: add 380kbps to nrf52840_bitfields.c for twi and twim
mlaz removed a comment on issue #1854: nrfx: add 380kbps to nrf52840_bitfields.c for twi and twim URL: https://github.com/apache/mynewt-core/pull/1854#issuecomment-497894428 LGTM This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [mynewt-core] ccollins476ad opened a new pull request #1854: nrfx: add 380kbps to nrf52840_bitfields.c for twi and twim
ccollins476ad opened a new pull request #1854: nrfx: add 380kbps to nrf52840_bitfields.c for twi and twim URL: https://github.com/apache/mynewt-core/pull/1854 nrfx used to be customized with this change - support for TWI/TWIM 380kbps. This change was lost when nrfx was recently upgraded. This PR adds the change back to nrfx. We should find a better long term solution, but for now, let's just get the change back in. This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [mynewt-core] ccollins476ad merged pull request #1853: Fix some CI test failures
ccollins476ad merged pull request #1853: Fix some CI test failures URL: https://github.com/apache/mynewt-core/pull/1853 This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[mynewt-core] branch master updated: Fix some CI test failures
This is an automated email from the ASF dual-hosted git repository. ccollins pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/mynewt-core.git The following commit(s) were added to refs/heads/master by this push: new ee31457 Fix some CI test failures ee31457 is described below commit ee31457b25eb04574ffb83ebd12d248e1567fa80 Author: Christopher Collins AuthorDate: Fri May 31 13:27:09 2019 -0700 Fix some CI test failures `newt test all` in a project containing the nimble repo fails with the following errors: va_start(ap, fmt); Failed tests: [nimble/host/test] ^~~~ os_start repos/apache-mynewt-core/util/streamer/src/streamer.c:42:5: error: implicit declaration of function ‘va_end’; did you mean ‘rand’? [-Werror=implicit-function-declaration] va_end(ap); ^~ rand repos/apache-mynewt-core/util/streamer/src/streamer.c:40:5: error: ‘ap’ is used uninitialized in this function [-Werror=uninitialized] va_start(ap, fmt); ^ --- sys/console/stub/include/console/console.h | 1 + util/streamer/src/streamer.c | 1 + 2 files changed, 2 insertions(+) diff --git a/sys/console/stub/include/console/console.h b/sys/console/stub/include/console/console.h index 7d08fe8..d98b4de 100644 --- a/sys/console/stub/include/console/console.h +++ b/sys/console/stub/include/console/console.h @@ -21,6 +21,7 @@ #include #include +#include #ifdef __cplusplus extern "C" { diff --git a/util/streamer/src/streamer.c b/util/streamer/src/streamer.c index a33072b..7528f22 100644 --- a/util/streamer/src/streamer.c +++ b/util/streamer/src/streamer.c @@ -17,6 +17,7 @@ * under the License. */ +#include #include "streamer/streamer.h" int
[GitHub] [mynewt-core] ccollins476ad opened a new pull request #1853: Fix some CI test failures
ccollins476ad opened a new pull request #1853: Fix some CI test failures URL: https://github.com/apache/mynewt-core/pull/1853 `newt test all` in a project containing the nimble repo fails with the following errors: ``` va_start(ap, fmt); Failed tests: [nimble/host/test] ^~~~ os_start repos/apache-mynewt-core/util/streamer/src/streamer.c:42:5: error: implicit declaration of function ‘va_end’; did you mean ‘rand’? [-Werror=implicit-function-declaration] va_end(ap); ^~ rand repos/apache-mynewt-core/util/streamer/src/streamer.c:40:5: error: ‘ap’ is used uninitialized in this function [-Werror=uninitialized] va_start(ap, fmt); ^ ``` This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[mynewt-core] 03/10: sys/console: console_vprintf
This is an automated email from the ASF dual-hosted git repository. ccollins pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/mynewt-core.git commit 385e381d9783ae430bcdf4580df44c87d15d97e9 Author: Christopher Collins AuthorDate: Fri May 10 12:54:21 2019 -0700 sys/console: console_vprintf --- sys/console/full/include/console/console.h| 1 + sys/console/full/src/console_fmt.c| 54 +-- sys/console/minimal/include/console/console.h | 6 +++ sys/console/stub/include/console/console.h| 6 +++ 4 files changed, 39 insertions(+), 28 deletions(-) diff --git a/sys/console/full/include/console/console.h b/sys/console/full/include/console/console.h index 08f166f..ac15e5b 100644 --- a/sys/console/full/include/console/console.h +++ b/sys/console/full/include/console/console.h @@ -63,6 +63,7 @@ void console_blocking_mode(void); void console_non_blocking_mode(void); void console_echo(int on); +int console_vprintf(const char *fmt, va_list ap); int console_printf(const char *fmt, ...) __attribute__ ((format (printf, 1, 2)));; diff --git a/sys/console/full/src/console_fmt.c b/sys/console/full/src/console_fmt.c index 89c624d..8b16e7c 100644 --- a/sys/console/full/src/console_fmt.c +++ b/sys/console/full/src/console_fmt.c @@ -24,21 +24,11 @@ #define CONS_OUTPUT_MAX_LINE128 - #if MYNEWT_VAL(BASELIBC_PRESENT) -/** - * Prints the specified format string to the console. - * - * @return The number of characters that would have been - * printed if the console buffer were - * unlimited. This return value is analogous - * to that of snprintf. - */ int -console_printf(const char *fmt, ...) +console_vprintf(const char *fmt, va_list ap) { -va_list args; int num_chars; num_chars = 0; @@ -50,28 +40,16 @@ console_printf(const char *fmt, ...) } } -va_start(args, fmt); -num_chars += vprintf(fmt, args); -va_end(args); +num_chars += vprintf(fmt, ap); return num_chars; } - #else -/** - * Prints the specified format string to the console. - * - * @return The number of characters that would have been - * printed if the console buffer were - * unlimited. This return value is analogous - * to that of snprintf. - */ int -console_printf(const char *fmt, ...) +console_vprintf(const char *fmt, va_list ap) { -va_list args; char buf[CONS_OUTPUT_MAX_LINE]; int num_chars; int len; @@ -88,15 +66,35 @@ console_printf(const char *fmt, ...) } } -va_start(args, fmt); -len = vsnprintf(buf, sizeof(buf), fmt, args); +len = vsnprintf(buf, sizeof(buf), fmt, ap); num_chars += len; if (len >= sizeof(buf)) { len = sizeof(buf) - 1; } console_write(buf, len); -va_end(args); return num_chars; } + #endif + +/** + * Prints the specified format string to the console. + * + * @return The number of characters that would have been + * printed if the console buffer were + * unlimited. This return value is analogous + * to that of snprintf. + */ +int +console_printf(const char *fmt, ...) +{ +va_list args; +int num_chars; + +va_start(args, fmt); +num_chars = console_vprintf(fmt, args); +va_end(args); + +return num_chars; +} diff --git a/sys/console/minimal/include/console/console.h b/sys/console/minimal/include/console/console.h index b05bebd..df1d2da 100644 --- a/sys/console/minimal/include/console/console.h +++ b/sys/console/minimal/include/console/console.h @@ -47,6 +47,12 @@ void console_blocking_mode(void); void console_non_blocking_mode(void); void console_echo(int on); +static int inline +console_vprintf(const char *fmt, va_list ap) +{ +return 0; +} + static int console_printf(const char *fmt, ...) __attribute__ ((format (printf, 1, 2)));; static int inline diff --git a/sys/console/stub/include/console/console.h b/sys/console/stub/include/console/console.h index b1b6f48..7d08fe8 100644 --- a/sys/console/stub/include/console/console.h +++ b/sys/console/stub/include/console/console.h @@ -86,6 +86,12 @@ console_echo(int on) { } +static int inline +console_vprintf(const char *fmt, va_list ap) +{ +return 0; +} + static int inline console_printf(const char *fmt, ...) __attribute__ ((format (printf, 1, 2)));
[mynewt-core] 04/10: util/streamer: generic data streaming interface
This is an automated email from the ASF dual-hosted git repository. ccollins pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/mynewt-core.git commit 15d991048f905d7c4595cdd29bdd3189f923b675 Author: Christopher Collins AuthorDate: Fri May 10 10:04:19 2019 -0700 util/streamer: generic data streaming interface This package defines a generic data streaming interface. Supported operations are: * write flat buf * write printf-formatted text There are two built-in implementations: * console * mbuf chain --- util/streamer/include/streamer/streamer.h | 108 ++ util/streamer/pkg.yml | 28 util/streamer/src/streamer.c | 45 + util/streamer/src/streamer_console.c | 50 ++ util/streamer/src/streamer_mbuf.c | 99 +++ util/streamer/syscfg.yml | 23 +++ 6 files changed, 353 insertions(+) diff --git a/util/streamer/include/streamer/streamer.h b/util/streamer/include/streamer/streamer.h new file mode 100644 index 000..87ea802 --- /dev/null +++ b/util/streamer/include/streamer/streamer.h @@ -0,0 +1,108 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +#ifndef H_STREAMER_ +#define H_STREAMER_ + +#include "os/mynewt.h" + +struct streamer; + +typedef int streamer_write_fn(struct streamer *streamer, + const void *src, size_t len); + +typedef int streamer_vprintf_fn(struct streamer *streamer, +const char *fmt, va_list ap); + +struct streamer_cfg { +streamer_write_fn *write_cb; +streamer_vprintf_fn *vprintf_cb; +}; + +/** + * @brief Provides a generic data streaming interface. + */ +struct streamer { +const struct streamer_cfg *cfg; +}; + +/** + * @brief Streams data to an mbuf chain. + */ +struct streamer_mbuf { +struct streamer streamer; /* Must be first member. */ +struct os_mbuf *om; +}; + +/** + * @brief Writes the given flat buffer to a streamer. + * + * @param streamer The streamer to write to. + * @param src The flat buffer to write. + * @param len The number of bytes to write. + * + * @return 0 on success; SYS_E[...] on failure. + */ +int streamer_write(struct streamer *streamer, const void *src, size_t len); + +/** + * @brief Writes printf-formatted text to a streamer. + * + * A null-terminator does *not* get written. + * + * @param streamer The streamer to write to. + * @param src The flat buffer to write. + * @param len The number of bytes to write. + * + * @return Number of bytes written on success; + * SYS_E[...] on failure. + */ +int streamer_vprintf(struct streamer *streamer, const char *fmt, va_list ap); + +/** + * @brief Writes printf-formatted text to a streamer. + */ +int streamer_printf(struct streamer *streamer, const char *fmt, ...); + +/** + * @brief Acquires the singleton console streamer. + */ +struct streamer *streamer_console_get(void); + +/** + * Constructs an mbuf streamer. + * + * @param smThe mbuf streamer object to populate. + * @param omThe mbuf chain to write to. This may already + * contain data. + * + * @return 0 on success; SYS_E[...] on failure. + */ +int streamer_mbuf_new(struct streamer_mbuf *sm, struct os_mbuf *om); + +/** + * Constructs an mbuf streamer that uses mbufs acquired from msys. + * + * @param smThe mbuf streamer object to populate. + * + * @return 0 on success; SYS_E[...] on failure. + */ +int streamer_msys_new(struct streamer_mbuf *sm); + +#endif diff --git a/util/streamer/pkg.yml b/util/streamer/pkg.yml new file mode 100644 index 000..77cf34a --- /dev/null +++ b/util/streamer/pkg.yml @@ -0,0 +1,28 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional
[mynewt-core] branch master updated (02ff200 -> e4c46a7)
This is an automated email from the ASF dual-hosted git repository. ccollins pushed a change to branch master in repository https://gitbox.apache.org/repos/asf/mynewt-core.git. from 02ff200 [Feature]: Main Task OS Sanity Check (#1838) new 31f54a1 kernel/os: Fn to convert OS_ codes to SYS_E codes new b9e9544 encoding/tinycbor: encode indefinite text strings new 385e381 sys/console: console_vprintf new 15d9910 util/streamer: generic data streaming interface new e178c3d sys/shell: Use the util/streamer interface new f6f145b hw/battery: Fix shell command definitions new 4d37e68 sys/shell: shell-newtmgr bridge new 65c4723 sys/shell: Change the OS cmds to extended new 84faab7 sys/stats: Change the stats shell cmds to extended new e4c46a7 flash_test: Change shell cmds to extended The 10 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference. Summary of changes: encoding/tinycbor/include/tinycbor/cbor.h | 1 + encoding/tinycbor/src/cborencoder.c| 14 ++ hw/battery/src/battery_shell.c | 12 +- kernel/os/include/os/os_error.h| 10 + kernel/os/{include/os/mynewt.h => src/os_error.c} | 30 +-- mgmt/mgmt/include/mgmt/mgmt.h | 1 + sys/console/full/include/console/console.h | 1 + sys/console/full/src/console_fmt.c | 54 +++-- sys/console/minimal/include/console/console.h | 6 + sys/console/stub/include/console/console.h | 6 + sys/shell/include/shell/shell.h| 66 +- sys/shell/pkg.yml | 4 + sys/shell/src/shell.c | 226 + sys/shell/src/shell_bridge.c | 109 ++ sys/shell/src/shell_bridge_streamer.c | 81 sys/shell/src/shell_os.c | 95 - sys/shell/src/shell_priv.h | 18 ++ sys/shell/src/shell_prompt.c | 2 +- sys/shell/syscfg.yml | 16 ++ sys/stats/full/src/stats_shell.c | 44 ++-- test/flash_test/src/flash_test.c | 94 + util/streamer/include/streamer/streamer.h | 108 ++ util/{taskpool => streamer}/pkg.yml| 8 +- .../hal_flash.c => util/streamer/src/streamer.c| 32 +-- .../streamer/src/streamer_console.c| 37 ++-- util/streamer/src/streamer_mbuf.c | 99 + {fs/fatfs => util/streamer}/syscfg.yml | 11 +- 27 files changed, 888 insertions(+), 297 deletions(-) copy kernel/os/{include/os/mynewt.h => src/os_error.c} (61%) create mode 100644 sys/shell/src/shell_bridge.c create mode 100644 sys/shell/src/shell_bridge_streamer.c create mode 100644 util/streamer/include/streamer/streamer.h copy util/{taskpool => streamer}/pkg.yml (90%) copy hw/mcu/stm/stm32f0xx/src/hal_flash.c => util/streamer/src/streamer.c (63%) copy sys/console/full/src/ticks.c => util/streamer/src/streamer_console.c (57%) create mode 100644 util/streamer/src/streamer_mbuf.c copy {fs/fatfs => util/streamer}/syscfg.yml (83%)
[mynewt-core] 01/10: kernel/os: Fn to convert OS_ codes to SYS_E codes
This is an automated email from the ASF dual-hosted git repository. ccollins pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/mynewt-core.git commit 31f54a1e4449ec7afc1b471bc81efd713568cfb1 Author: Christopher Collins AuthorDate: Thu May 30 14:05:39 2019 -0700 kernel/os: Fn to convert OS_ codes to SYS_E codes /** * @brief Converts an OS error code (`OS_[...]`) to an equivalent system * error code (`SYS_E[...]`). * * @param os_error The OS error code to convert. * * @return The equivalent system error code. */ int os_error_to_sys(os_error_t os_error); --- kernel/os/include/os/os_error.h| 10 + .../os/{include/os/os_error.h => src/os_error.c} | 46 +++--- 2 files changed, 25 insertions(+), 31 deletions(-) diff --git a/kernel/os/include/os/os_error.h b/kernel/os/include/os/os_error.h index 01df389..ec26699 100644 --- a/kernel/os/include/os/os_error.h +++ b/kernel/os/include/os/os_error.h @@ -45,6 +45,16 @@ enum os_error { typedef enum os_error os_error_t; +/** + * @brief Converts an OS error code (`OS_[...]`) to an equivalent system error + * code (`SYS_E[...]`). + * + * @param os_error The OS error code to convert. + * + * @return The equivalent system error code. + */ +int os_error_to_sys(os_error_t os_error); + #ifdef __cplusplus } #endif diff --git a/kernel/os/include/os/os_error.h b/kernel/os/src/os_error.c similarity index 52% copy from kernel/os/include/os/os_error.h copy to kernel/os/src/os_error.c index 01df389..713ffa4 100644 --- a/kernel/os/include/os/os_error.h +++ b/kernel/os/src/os_error.c @@ -17,36 +17,20 @@ * under the License. */ -#ifndef H_OS_ERROR_ -#define H_OS_ERROR_ +#include "defs/error.h" +#include "os/os_error.h" -#include "syscfg/syscfg.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/* OS error enumerations */ -enum os_error { -OS_OK = 0, -OS_ENOMEM = 1, -OS_EINVAL = 2, -OS_INVALID_PARM = 3, -OS_MEM_NOT_ALIGNED = 4, -OS_BAD_MUTEX = 5, -OS_TIMEOUT = 6, -OS_ERR_IN_ISR = 7, /* Function cannot be called from ISR */ -OS_ERR_PRIV = 8,/* Privileged access error */ -OS_NOT_STARTED = 9, /* OS must be started to call this function, but isn't */ -OS_ENOENT = 10, /* No such thing */ -OS_EBUSY = 11, /* Resource busy */ -OS_ERROR = 12, /* Generic Error */ -}; - -typedef enum os_error os_error_t; - -#ifdef __cplusplus +int +os_error_to_sys(os_error_t os_error) +{ +switch (os_error) { +case OS_OK: return SYS_EOK; +case OS_ENOMEM: return SYS_ENOMEM; +case OS_EINVAL: return SYS_EINVAL; +case OS_INVALID_PARM: return SYS_EINVAL; +case OS_TIMEOUT:return SYS_ETIMEOUT; +case OS_ENOENT: return SYS_ENOENT; +case OS_EBUSY: return SYS_EBUSY; +default:return SYS_EUNKNOWN; +} } -#endif - -#endif
[mynewt-core] 10/10: flash_test: Change shell cmds to extended
This is an automated email from the ASF dual-hosted git repository. ccollins pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/mynewt-core.git commit e4c46a7eaee5cc55ae786ed8b94d670b392c8211 Author: Christopher Collins AuthorDate: Thu May 30 17:51:27 2019 -0700 flash_test: Change shell cmds to extended This allows the flash_test shell commands to be executed via newtmgr. --- test/flash_test/src/flash_test.c | 94 +--- 1 file changed, 50 insertions(+), 44 deletions(-) diff --git a/test/flash_test/src/flash_test.c b/test/flash_test/src/flash_test.c index e394b69..4758e84 100644 --- a/test/flash_test/src/flash_test.c +++ b/test/flash_test/src/flash_test.c @@ -27,14 +27,20 @@ #include #include -static int flash_cli_cmd(int argc, char **argv); -static struct shell_cmd flash_cmd_struct = { -.sc_cmd = "flash", -.sc_cmd_func = flash_cli_cmd -}; +static int flash_cli_cmd(const struct shell_cmd *cmd, int argc, char **argv, + struct streamer *streamer); +static int flash_speed_test_cli(const struct shell_cmd *cmd, int argc, +char **argv, struct streamer *streamer); + +static struct shell_cmd flash_cmd_struct = +SHELL_CMD_EXT("flash", flash_cli_cmd, NULL); + +static struct shell_cmd flash_speed_cli_struct = +SHELL_CMD_EXT("flash_speed", flash_speed_test_cli, NULL); static int -flash_cli_cmd(int argc, char **argv) +flash_cli_cmd(const struct shell_cmd *cmd, int argc, char **argv, + struct streamer *streamer) { const struct hal_flash *hf; uint32_t off = 0; @@ -48,11 +54,11 @@ flash_cli_cmd(int argc, char **argv) char pr_str[80]; if (argc > 1 && (!strcmp(argv[1], "?") || !strcmp(argv[1], "help"))) { -console_printf("Commands Available\n"); -console_printf("flash [flash-id] -- dumps sector map \n"); -console_printf("flash read -- reads bytes from flash \n"); -console_printf("flash write -- writes incrementing data pattern 0-8 to flash \n"); -console_printf("flash erase -- erases flash \n"); +streamer_printf(streamer, "Commands Available\n"); +streamer_printf(streamer, "flash [flash-id] -- dumps sector map \n"); +streamer_printf(streamer, "flash read -- reads bytes from flash \n"); +streamer_printf(streamer, "flash write -- writes incrementing data pattern 0-8 to flash \n"); +streamer_printf(streamer, "flash erase -- erases flash \n"); return 0; } @@ -61,7 +67,7 @@ flash_cli_cmd(int argc, char **argv) if (argc == 2) { devid = strtoul(argv[1], , 0); if (*eptr != 0) { -console_printf("Invalid flash id %s\n", argv[1]); +streamer_printf(streamer, "Invalid flash id %s\n", argv[1]); return 0; } } @@ -69,12 +75,12 @@ flash_cli_cmd(int argc, char **argv) hf = hal_bsp_flash_dev(devid); if (!hf) { if (argc == 2) { -console_printf("Flash device not present\n"); +streamer_printf(streamer, "Flash device not present\n"); } return 0; } -console_printf("Flash %d at 0x%lx size 0x%lx with %d sectors," - " alignment req %d bytes\n", +streamer_printf(streamer, "Flash %d at 0x%lx size 0x%lx with %d " + "sectors, alignment req %d bytes\n", devid, (long unsigned int) hf->hf_base_addr, (long unsigned int) hf->hf_size, @@ -85,11 +91,12 @@ flash_cli_cmd(int argc, char **argv) sec_cnt = 32; } for (i = 0; i < sec_cnt; i++) { -console_printf(" %d: %lx\n", i, +streamer_printf(streamer, " %d: %lx\n", i, (long unsigned int) hal_flash_sector_size(hf, i)); } if (sec_cnt != hf->hf_sector_cnt) { -console_printf("... %d: %lx\n", hf->hf_sector_cnt - 1, +streamer_printf(streamer, "... %d: %lx\n", + hf->hf_sector_cnt - 1, (long unsigned int) hal_flash_sector_size(hf, hf->hf_sector_cnt - 1)); } ++devid; @@ -101,40 +108,40 @@ flash_cli_cmd(int argc, char **argv) if (argc > 1) { devid = strtoul(argv[1], , 0); if (*eptr != 0) { -console_printf("Invalid flash id %s\n", argv[1]); +streamer_printf(streamer, "Invalid flash id %s\n", argv[1]); goto err; } } if (argc > 3) { off = strtoul(argv[3], , 0); if (*eptr != '\0') { -console_printf("Invalid offset %s\n", argv[2]); +streamer_printf(streamer, "Invalid offset %s\n", argv[2]);
[mynewt-core] 07/10: sys/shell: shell-newtmgr bridge
This is an automated email from the ASF dual-hosted git repository. ccollins pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/mynewt-core.git commit 4d37e68313f9dbae9f5abd6cc695372b57f58fdc Author: Christopher Collins AuthorDate: Fri May 10 18:59:39 2019 -0700 sys/shell: shell-newtmgr bridge Implement a new newtmgr command: `shell exec`. This command allows shell commands to be executed via newtmgr. --- mgmt/mgmt/include/mgmt/mgmt.h | 1 + sys/shell/pkg.yml | 3 + sys/shell/src/shell_bridge.c | 109 ++ sys/shell/src/shell_bridge_streamer.c | 81 + sys/shell/syscfg.yml | 16 + 5 files changed, 210 insertions(+) diff --git a/mgmt/mgmt/include/mgmt/mgmt.h b/mgmt/mgmt/include/mgmt/mgmt.h index 427be1d..179d67f 100644 --- a/mgmt/mgmt/include/mgmt/mgmt.h +++ b/mgmt/mgmt/include/mgmt/mgmt.h @@ -58,6 +58,7 @@ extern "C" { #define MGMT_GROUP_ID_SPLIT (6) #define MGMT_GROUP_ID_RUN (7) #define MGMT_GROUP_ID_FS(8) +#define MGMT_GROUP_ID_SHELL (9) #define MGMT_GROUP_ID_PERUSER (64) /** diff --git a/sys/shell/pkg.yml b/sys/shell/pkg.yml index cf009a8..dee374f 100644 --- a/sys/shell/pkg.yml +++ b/sys/shell/pkg.yml @@ -33,6 +33,9 @@ pkg.deps.SHELL_NEWTMGR: - "@apache-mynewt-core/encoding/base64" - "@apache-mynewt-core/util/crc" +pkg.deps.SHELL_BRIDGE: +- "@apache-mynewt-core/encoding/tinycbor" + pkg.req_apis: - console diff --git a/sys/shell/src/shell_bridge.c b/sys/shell/src/shell_bridge.c new file mode 100644 index 000..f1ca335 --- /dev/null +++ b/sys/shell/src/shell_bridge.c @@ -0,0 +1,109 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +#include "os/mynewt.h" + +#if MYNEWT_VAL(SHELL_BRIDGE) + +#include "mgmt/mgmt.h" +#include "cborattr/cborattr.h" +#include "streamer/streamer.h" +#include "tinycbor/cbor_mbuf_writer.h" +#include "shell_priv.h" + +static struct mgmt_group shell_bridge_group; + +static int shell_bridge_exec(struct mgmt_cbuf *cb); + +static struct mgmt_handler shell_bridge_group_handlers[] = { +[SHELL_NMGR_OP_EXEC] = { NULL, shell_bridge_exec }, +}; + +/** + * Handler for the `shell exec` newtmgr command. + */ +static int +shell_bridge_exec(struct mgmt_cbuf *cb) +{ +char line[MYNEWT_VAL(SHELL_BRIDGE_MAX_IN_LEN)]; +char *argv[MYNEWT_VAL(SHELL_CMD_ARGC_MAX)]; +struct shell_bridge_streamer sbs; +CborEncoder str_encoder; +CborError err; +int argc; +int rc; + +const struct cbor_attr_t attrs[] = { +{ +.attribute = "argv", +.type = CborAttrArrayType, +.addr.array = { +.element_type = CborAttrTextStringType, +.arr.strings.ptrs = argv, +.arr.strings.store = line, +.arr.strings.storelen = sizeof line, +.count = , +.maxlen = sizeof argv / sizeof argv[0], +}, +}, +{ 0 }, +}; + +err = cbor_read_object(>it, attrs); +if (err != 0) { +return MGMT_ERR_EINVAL; +} + +/* Key="o"; value= */ +err |= cbor_encode_text_stringz(>encoder, "o"); +err |= cbor_encoder_create_indef_text_string(>encoder, _encoder); + +shell_bridge_streamer_new(, _encoder); +rc = shell_exec(argc, argv, ); + +err |= cbor_encoder_close_container(>encoder, _encoder); + +/* Key="rc"; value= */ +err |= cbor_encode_text_stringz(>encoder, "rc"); +err |= cbor_encode_int(>encoder, rc); + +if (err != 0) { +return MGMT_ERR_ENOMEM; +} + +return 0; +} + +int +shell_bridge_init(void) +{ +int rc; + +MGMT_GROUP_SET_HANDLERS(_bridge_group, shell_bridge_group_handlers); +shell_bridge_group.mg_group_id = MGMT_GROUP_ID_SHELL; + +rc = mgmt_group_register(_bridge_group); +if (rc) { +return rc; +} + +return 0; +} + +#endif diff --git a/sys/shell/src/shell_bridge_streamer.c b/sys/shell/src/shell_bridge_streamer.c new file mode 100644 index 000..d9df4dd --- /dev/null +++ b/sys/shell/src/shell_bridge_streamer.c @@ -0,0 +1,81 @@ +/* + * Licensed to the Apache
[mynewt-core] 06/10: hw/battery: Fix shell command definitions
This is an automated email from the ASF dual-hosted git repository. ccollins pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/mynewt-core.git commit f6f145b5d20a0f7af454c8a3e2ce3e386ad24020 Author: Christopher Collins AuthorDate: Fri May 10 18:59:30 2019 -0700 hw/battery: Fix shell command definitions A recent change to the `struct shell_cmd` type is incompatible with how `hw/battery` defines its shell command. Some extra fields were added to this struct, and the battery shell command was defined with positional values. --- hw/battery/src/battery_shell.c | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/hw/battery/src/battery_shell.c b/hw/battery/src/battery_shell.c index c5b6db8..33243d6 100644 --- a/hw/battery/src/battery_shell.c +++ b/hw/battery/src/battery_shell.c @@ -476,12 +476,12 @@ err: static const struct shell_cmd bat_cli_commands[] = { -{ "read", cmd_bat_read, HELP(bat_read_help) }, -{ "write", cmd_bat_write, HELP(bat_write_help) }, -{ "list", cmd_bat_list, HELP(bat_list_help) }, -{ "pollrate", cmd_bat_poll_rate, HELP(bat_poll_rate_help) }, -{ "monitor", cmd_bat_monitor, HELP(bat_monitor_help) }, -{ NULL, NULL, NULL } +SHELL_CMD("read", cmd_bat_read, _read_help), +SHELL_CMD("write", cmd_bat_write, _write_help), +SHELL_CMD("list", cmd_bat_list, _list_help), +SHELL_CMD("pollrate", cmd_bat_poll_rate, _poll_rate_help), +SHELL_CMD("monitor", cmd_bat_monitor, _monitor_help), +{ 0 }, }; /**
[mynewt-core] 05/10: sys/shell: Use the util/streamer interface
This is an automated email from the ASF dual-hosted git repository. ccollins pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/mynewt-core.git commit e178c3d79cf526fbc146bce25f3a1e15b15a51b8 Author: Christopher Collins AuthorDate: Fri May 10 18:51:50 2019 -0700 sys/shell: Use the util/streamer interface This change allows shell commands to send the output somewhere other than the console. This is in preparation for the ability to invoke shell commands via newtmgr. --- sys/shell/include/shell/shell.h | 66 +++- sys/shell/pkg.yml | 1 + sys/shell/src/shell.c | 226 sys/shell/src/shell_priv.h | 18 sys/shell/src/shell_prompt.c| 2 +- 5 files changed, 223 insertions(+), 90 deletions(-) diff --git a/sys/shell/include/shell/shell.h b/sys/shell/include/shell/shell.h index 859b9fa..8eecbf5 100644 --- a/sys/shell/include/shell/shell.h +++ b/sys/shell/include/shell/shell.h @@ -25,8 +25,14 @@ extern "C" { #endif #include "os/mynewt.h" +#include "streamer/streamer.h" struct os_eventq; +struct streamer; +struct shell_cmd; + +/** Command IDs in the "shell" newtmgr group. */ +#define SHELL_NMGR_OP_EXEC 0 /** @brief Callback called when command is entered. * @@ -37,6 +43,21 @@ struct os_eventq; */ typedef int (*shell_cmd_func_t)(int argc, char *argv[]); +/** + * @brief Callback for "extended" shell commands. + * + * @param cmd The shell command being executed. + * @param argc Number of arguments passed. + * @param argv Array of option strings. First option is always + * command name. + * @param streamer The streamer to write shell output to. + * + * @return 0 on success; SYS_E[...] on failure. + */ +typedef int (*shell_cmd_ext_func_t)(const struct shell_cmd *cmd, +int argc, char *argv[], +struct streamer *streamer); + struct shell_param { const char *param_name; const char *help; @@ -49,8 +70,13 @@ struct shell_cmd_help { }; struct shell_cmd { +uint8_t sc_ext : 1; /* 1 if this is an extended shell comand. */ +union { +shell_cmd_func_t sc_cmd_func; +shell_cmd_ext_func_t sc_cmd_ext_func; +}; + const char *sc_cmd; -shell_cmd_func_t sc_cmd_func; const struct shell_cmd_help *help; }; @@ -59,6 +85,32 @@ struct shell_module { const struct shell_cmd *commands; }; +#if MYNEWT_VAL(SHELL_CMD_HELP) +#define SHELL_HELP_(help_) (help_) +#else +#define SHELL_HELP_(help_) +#endif + +/** + * @brief constructs a legacy shell command. + */ +#define SHELL_CMD(cmd_, func_, help_) { \ +.sc_ext = 0,\ +.sc_cmd_func = func_, \ +.sc_cmd = cmd_, \ +.help = SHELL_HELP_(help_), \ +} + +/** + * @brief constructs an extended shell command. + */ +#define SHELL_CMD_EXT(cmd_, func_, help_) { \ +.sc_ext = 1,\ +.sc_cmd_ext_func = func_, \ +.sc_cmd = cmd_, \ +.help = SHELL_HELP_(help_), \ +} + /** @brief Register a shell_module object * * @param shell_name Module name to be entered in shell console. @@ -101,6 +153,18 @@ void shell_register_default_module(const char *name); */ void shell_evq_set(struct os_eventq *evq); +/** + * @brief Processes a set of arguments and executes their corresponding shell + * command. + * + * @param argc The argument count (including command name). + * @param argv The argument list ([0] is command name). + * @param streamer The streamer to send output to. + * + * @return 0 on success; SYS_E[...] on failure. + */ +int shell_exec(int argc, char **argv, struct streamer *streamer); + #if MYNEWT_VAL(SHELL_NEWTMGR) struct os_mbuf; typedef int (*shell_nlip_input_func_t)(struct os_mbuf *, void *arg); diff --git a/sys/shell/pkg.yml b/sys/shell/pkg.yml index 6c6f6cf..cf009a8 100644 --- a/sys/shell/pkg.yml +++ b/sys/shell/pkg.yml @@ -26,6 +26,7 @@ pkg.keywords: pkg.deps: - "@apache-mynewt-core/kernel/os" - "@apache-mynewt-core/time/datetime" +- "@apache-mynewt-core/util/streamer" pkg.deps.SHELL_NEWTMGR: - "@apache-mynewt-core/mgmt/mgmt" diff --git a/sys/shell/src/shell.c b/sys/shell/src/shell.c index 335564e..b63fe94 100644 --- a/sys/shell/src/shell.c +++ b/sys/shell/src/shell.c @@ -23,6 +23,8 @@ #include "os/mynewt.h" #include "console/console.h" +#include "streamer/streamer.h" +#include "modlog/modlog.h" #include "shell/shell.h" #include "shell_priv.h" @@ -34,7 +36,7 @@ static size_t num_of_shell_entities; static const char *prompt; static int default_module = -1;
[mynewt-core] 09/10: sys/stats: Change the stats shell cmds to extended
This is an automated email from the ASF dual-hosted git repository. ccollins pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/mynewt-core.git commit 84faab7679d12f50b791d1aa2c0483f7b5a91ac3 Author: Christopher Collins AuthorDate: Fri May 10 18:40:46 2019 -0700 sys/stats: Change the stats shell cmds to extended This allows the stats shell commands to be executed via newtmgr. --- sys/stats/full/src/stats_shell.c | 44 +--- 1 file changed, 28 insertions(+), 16 deletions(-) diff --git a/sys/stats/full/src/stats_shell.c b/sys/stats/full/src/stats_shell.c index 983d9ae..b9cf8c5 100644 --- a/sys/stats/full/src/stats_shell.c +++ b/sys/stats/full/src/stats_shell.c @@ -26,35 +26,43 @@ #include #include "shell/shell.h" -#include "console/console.h" +#include "streamer/streamer.h" #include "stats/stats.h" -static int shell_stats_display(int argc, char **argv); -static struct shell_cmd shell_stats_cmd = { -.sc_cmd = "stat", -.sc_cmd_func = shell_stats_display -}; +static int shell_stats_display(const struct shell_cmd *cmd, + int argc, char **argv, + struct streamer *streamer); + +static struct shell_cmd shell_stats_cmd = +SHELL_CMD_EXT("stat", shell_stats_display, NULL); + uint8_t stats_shell_registered; static int stats_shell_display_entry(struct stats_hdr *hdr, void *arg, char *name, uint16_t stat_off) { +struct streamer *streamer; void *stat_val; +streamer = arg; + stat_val = (uint8_t *)hdr + stat_off; switch (hdr->s_size) { case sizeof(uint16_t): -console_printf("%s: %u\n", name, *(uint16_t *) stat_val); +streamer_printf(streamer, "%s: %u\n", name, +*(uint16_t *) stat_val); break; case sizeof(uint32_t): -console_printf("%s: %lu\n", name, *(unsigned long *) stat_val); +streamer_printf(streamer, "%s: %lu\n", name, +*(unsigned long *) stat_val); break; case sizeof(uint64_t): -console_printf("%s: %llu\n", name, *(uint64_t *) stat_val); +streamer_printf(streamer, "%s: %llu\n", name, +*(uint64_t *) stat_val); break; default: -console_printf("Unknown stat size for %s %u\n", name, +streamer_printf(streamer, "Unknown stat size for %s %u\n", name, hdr->s_size); break; } @@ -65,12 +73,16 @@ stats_shell_display_entry(struct stats_hdr *hdr, void *arg, char *name, static int stats_shell_display_group(struct stats_hdr *hdr, void *arg) { -console_printf("\t%s\n", hdr->s_name); +struct streamer *streamer; + +streamer = arg; +streamer_printf(streamer, "\t%s\n", hdr->s_name); return (0); } static int -shell_stats_display(int argc, char **argv) +shell_stats_display(const struct shell_cmd *cmd, int argc, char **argv, +struct streamer *streamer) { struct stats_hdr *hdr; char *name; @@ -78,21 +90,21 @@ shell_stats_display(int argc, char **argv) name = argv[1]; if (name == NULL || !strcmp(name, "")) { -console_printf("Must specify a statistic name to dump, " +streamer_printf(streamer, "Must specify a statistic name to dump, " "possible names are:\n"); -stats_group_walk(stats_shell_display_group, NULL); +stats_group_walk(stats_shell_display_group, streamer); rc = OS_EINVAL; goto err; } hdr = stats_group_find(name); if (!hdr) { -console_printf("Could not find statistic group %s\n", name); +streamer_printf(streamer, "Could not find statistic group %s\n", name); rc = OS_EINVAL; goto err; } -rc = stats_walk(hdr, stats_shell_display_entry, NULL); +rc = stats_walk(hdr, stats_shell_display_entry, streamer); if (rc != 0) { goto err; }
[GitHub] [mynewt-core] ccollins476ad merged pull request #1809: Shell newtmgr bridge
ccollins476ad merged pull request #1809: Shell newtmgr bridge URL: https://github.com/apache/mynewt-core/pull/1809 This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [mynewt-nimble] mlaz commented on a change in pull request #444: Adding System ID characteristic to DIS.
mlaz commented on a change in pull request #444: Adding System ID characteristic to DIS. URL: https://github.com/apache/mynewt-nimble/pull/444#discussion_r289521177 ## File path: nimble/host/services/dis/syscfg.yml ## @@ -92,6 +92,17 @@ syscfg.defs: Defines a default value for "Manufacturer name" if not set with 'ble_svc_dis_manufacturer_name_set'. value: NULL +BLE_SVC_DIS_SYSTEM_ID_READ_PERM: +description: > +Defines permissions for reading "System ID" characteristics. +Can be set to MYNEWT_VAL_BLE_SVC_DIS_DEFAULT_READ_PERM or use +the possible values defined in BLE_SVC_DIS_DEFAULT_READ_PERM. +value: MYNEWT_VAL_BLE_SVC_DIS_DEFAULT_READ_PERM Review comment: Just changed it. This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[mynewt-core] branch master updated: [Feature]: Main Task OS Sanity Check (#1838)
This is an automated email from the ASF dual-hosted git repository. wes3 pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/mynewt-core.git The following commit(s) were added to refs/heads/master by this push: new 02ff200 [Feature]: Main Task OS Sanity Check (#1838) 02ff200 is described below commit 02ff200534f54a42cbf91b091543dedfe28671dd Author: brolan-juul <33846322+brolan-j...@users.noreply.github.com> AuthorDate: Fri May 31 11:22:40 2019 -0700 [Feature]: Main Task OS Sanity Check (#1838) * Adding os_sanity check to main_task. * Fixed stylistic issue. --- kernel/os/src/os.c | 18 +- kernel/os/syscfg.yml | 5 + 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/kernel/os/src/os.c b/kernel/os/src/os.c index 5cc9fa4..6ccd95b 100644 --- a/kernel/os/src/os.c +++ b/kernel/os/src/os.c @@ -45,8 +45,14 @@ OS_TASK_STACK_DEFINE(g_idle_task_stack, OS_IDLE_STACK_SIZE); uint32_t g_os_idle_ctr; -static struct os_task os_main_task; -OS_TASK_STACK_DEFINE(os_main_stack, OS_MAIN_STACK_SIZE); +struct os_task g_os_main_task; +OS_TASK_STACK_DEFINE(g_os_main_stack, OS_MAIN_STACK_SIZE); + +/* + * Double the interval timer to allow proper timer check-in. + */ +#define OS_MAIN_TASK_TIMER_TICKS \ +os_time_ms_to_ticks32(MYNEWT_VAL(OS_MAIN_TASK_SANITY_ITVL_MS)) * 2 #if MYNEWT_VAL(OS_WATCHDOG_MONITOR) @@ -227,11 +233,13 @@ os_init(int (*main_fn)(int argc, char **arg)) assert(err == OS_OK); if (main_fn) { -err = os_task_init(_main_task, "main", os_main, main_fn, - OS_MAIN_TASK_PRIO, OS_WAIT_FOREVER, os_main_stack, - OS_STACK_ALIGN(OS_MAIN_STACK_SIZE)); +err = os_task_init(_os_main_task, "main", os_main, main_fn, + OS_MAIN_TASK_PRIO, + (OS_MAIN_TASK_TIMER_TICKS == 0) ? OS_WAIT_FOREVER : OS_MAIN_TASK_TIMER_TICKS, + g_os_main_stack, OS_STACK_ALIGN(OS_MAIN_STACK_SIZE)); assert(err == 0); } + /* Call bsp related OS initializations */ hal_bsp_init(); diff --git a/kernel/os/syscfg.yml b/kernel/os/syscfg.yml index d9cc89e..746acb0 100644 --- a/kernel/os/syscfg.yml +++ b/kernel/os/syscfg.yml @@ -175,6 +175,11 @@ syscfg.defs: description: > If set, assert callback gets called inside __assert_func() value: 0 +OS_MAIN_TASK_SANITY_ITVL_MS: +description: > +Interval for sanity check on main task. Setting a 0 will disable +sanity check on main task. Value is in milliseconds. +value: 0 syscfg.vals.OS_DEBUG_MODE: OS_CRASH_STACKTRACE: 1
[GitHub] [mynewt-core] wes3 merged pull request #1838: [Feature]: Main Task OS Sanity Check
wes3 merged pull request #1838: [Feature]: Main Task OS Sanity Check URL: https://github.com/apache/mynewt-core/pull/1838 This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [mynewt-core] utzig closed issue #1829: Wrong SystemCoreClock value in b-l072z-lrwan1 bsp
utzig closed issue #1829: Wrong SystemCoreClock value in b-l072z-lrwan1 bsp URL: https://github.com/apache/mynewt-core/issues/1829 This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [mynewt-core] utzig merged pull request #1842: STM32L0 Cube 1.11.2
utzig merged pull request #1842: STM32L0 Cube 1.11.2 URL: https://github.com/apache/mynewt-core/pull/1842 This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[mynewt-core] 02/02: Update B-L072Z-LRWAN1 startup
This is an automated email from the ASF dual-hosted git repository. utzig pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/mynewt-core.git commit 97338b0e28dd649116c3070e6322134c6956f13b Author: Fabio Utzig AuthorDate: Fri May 24 09:24:05 2019 -0300 Update B-L072Z-LRWAN1 startup --- hw/bsp/b-l072z-lrwan1/src/system_stm32l0xx.c | 104 +-- 1 file changed, 49 insertions(+), 55 deletions(-) diff --git a/hw/bsp/b-l072z-lrwan1/src/system_stm32l0xx.c b/hw/bsp/b-l072z-lrwan1/src/system_stm32l0xx.c index b848154..140fa11 100644 --- a/hw/bsp/b-l072z-lrwan1/src/system_stm32l0xx.c +++ b/hw/bsp/b-l072z-lrwan1/src/system_stm32l0xx.c @@ -22,29 +22,13 @@ ** * @attention * - * COPYRIGHT(c) 2016 STMicroelectronics + * Copyright(c) 2016 STMicroelectronics. + * All rights reserved. * - * 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 of STMicroelectronics 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 HOLDER 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 software component is licensed by ST under BSD 3-Clause license, + * the "License"; You may not use this file except in compliance with the + * License. You may obtain a copy of the License at: + *opensource.org/licenses/BSD-3-Clause * ** */ @@ -65,15 +49,15 @@ #include "mcu/cmsis_nvic.h" #if !defined (HSE_VALUE) - #define HSE_VALUE((uint32_t)800) /*!< Value of the External oscillator in Hz */ + #define HSE_VALUE((uint32_t)800U) /*!< Value of the External oscillator in Hz */ #endif /* HSE_VALUE */ #if !defined (MSI_VALUE) - #define MSI_VALUE((uint32_t)200) /*!< Value of the Internal oscillator in Hz*/ + #define MSI_VALUE((uint32_t)2097152U) /*!< Value of the Internal oscillator in Hz*/ #endif /* MSI_VALUE */ #if !defined (HSI_VALUE) - #define HSI_VALUE((uint32_t)1600) /*!< Value of the Internal oscillator in Hz*/ + #define HSI_VALUE((uint32_t)1600U) /*!< Value of the Internal oscillator in Hz*/ #endif /* HSI_VALUE */ @@ -97,8 +81,8 @@ /*!< Uncomment the following line if you need to relocate your vector Table in Internal SRAM. */ /* #define VECT_TAB_SRAM */ -#define VECT_TAB_OFFSET 0x00 /*!< Vector Table base offset field. - This value must be a multiple of 0x200. */ +#define VECT_TAB_OFFSET 0x00U /*!< Vector Table base offset field. + This value must be a multiple of 0x100. */ /**/ /** * @} @@ -123,10 +107,10 @@ is no need to call the 2 first functions listed above, since SystemCoreClock variable is updated automatically. */ - uint32_t SystemCoreClock = 200; - const uint8_t AHBPrescTable[16] = {0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 6, 7, 8, 9}; - const uint8_t APBPrescTable[8] = {0, 0, 0, 0, 1, 2, 3, 4}; - const uint8_t PLLMulTable[9] = {3, 4, 6, 8, 12, 16, 24, 32, 48}; + uint32_t SystemCoreClock = 2097152U; /* 32.768 kHz * 2^6 */ + const uint8_t AHBPrescTable[16] = {0U, 0U, 0U, 0U, 0U, 0U, 0U, 0U, 1U, 2U, 3U, 4U, 6U, 7U, 8U, 9U}; + const uint8_t APBPrescTable[8] = {0U, 0U, 0U, 0U, 1U, 2U, 3U, 4U}; + const uint8_t PLLMulTable[9] = {3U, 4U, 6U, 8U, 12U, 16U, 24U, 32U, 48U}; /** * @} @@ -152,25 +136,25 @@ void SystemInit (void) { /*!< Set
[mynewt-core] branch master updated (d92e012 -> 97338b0)
This is an automated email from the ASF dual-hosted git repository. utzig pushed a change to branch master in repository https://gitbox.apache.org/repos/asf/mynewt-core.git. from d92e012 Merge pull request #1841 from alvarop/nrfx_1.7.1 new 771dfb7 Update STM32L0 Cube to 1.11.2 new 97338b0 Update B-L072Z-LRWAN1 startup The 2 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference. Summary of changes: hw/bsp/b-l072z-lrwan1/src/system_stm32l0xx.c | 104 +- .../Device/ST/STM32L0xx/Include/stm32l010x4.h | 5803 +++ .../Device/ST/STM32L0xx/Include/stm32l010x6.h | 5860 +++ .../Device/ST/STM32L0xx/Include/stm32l010x8.h | 5856 +++ .../Device/ST/STM32L0xx/Include/stm32l010xb.h | 5932 +++ .../Device/ST/STM32L0xx/Include/stm32l011xx.h | 11900 +++--- .../Device/ST/STM32L0xx/Include/stm32l021xx.h | 12180 +++--- .../Device/ST/STM32L0xx/Include/stm32l031xx.h | 12184 +++--- .../Device/ST/STM32L0xx/Include/stm32l041xx.h | 12464 --- .../Device/ST/STM32L0xx/Include/stm32l051xx.h | 12535 --- .../Device/ST/STM32L0xx/Include/stm32l052xx.h | 14695 - .../Device/ST/STM32L0xx/Include/stm32l053xx.h | 15015 - .../Device/ST/STM32L0xx/Include/stm32l061xx.h | 12815 --- .../Device/ST/STM32L0xx/Include/stm32l062xx.h | 14975 - .../Device/ST/STM32L0xx/Include/stm32l063xx.h | 15295 +- .../Device/ST/STM32L0xx/Include/stm32l071xx.h | 13000 --- .../Device/ST/STM32L0xx/Include/stm32l072xx.h | 15364 +- .../Device/ST/STM32L0xx/Include/stm32l073xx.h | 15688 +- .../Device/ST/STM32L0xx/Include/stm32l081xx.h | 13280 --- .../Device/ST/STM32L0xx/Include/stm32l082xx.h | 15644 +- .../Device/ST/STM32L0xx/Include/stm32l083xx.h | 15968 ++- .../CMSIS/Device/ST/STM32L0xx/Include/stm32l0xx.h | 479 +- .../Device/ST/STM32L0xx/Include/system_stm32l0xx.h | 234 +- ...startup_stm32l011xx.s => startup_stm32l010x4.s} | 577 +- ...startup_stm32l011xx.s => startup_stm32l010x6.s} | 577 +- ...startup_stm32l011xx.s => startup_stm32l010x8.s} | 577 +- ...startup_stm32l011xx.s => startup_stm32l010xb.s} | 580 +- .../Source/Templates/gcc/startup_stm32l011xx.s | 580 +- .../Source/Templates/gcc/startup_stm32l021xx.s | 580 +- .../Source/Templates/gcc/startup_stm32l031xx.s | 546 +- .../Source/Templates/gcc/startup_stm32l041xx.s | 546 +- .../Source/Templates/gcc/startup_stm32l051xx.s | 568 +- .../Source/Templates/gcc/startup_stm32l052xx.s | 580 +- .../Source/Templates/gcc/startup_stm32l053xx.s | 586 +- .../Source/Templates/gcc/startup_stm32l061xx.s | 568 +- .../Source/Templates/gcc/startup_stm32l062xx.s | 580 +- .../Source/Templates/gcc/startup_stm32l063xx.s | 586 +- .../Source/Templates/gcc/startup_stm32l071xx.s | 592 +- .../Source/Templates/gcc/startup_stm32l072xx.s | 604 +- .../Source/Templates/gcc/startup_stm32l073xx.s | 610 +- .../Source/Templates/gcc/startup_stm32l081xx.s | 594 +- .../Source/Templates/gcc/startup_stm32l082xx.s | 604 +- .../Source/Templates/gcc/startup_stm32l083xx.s | 610 +- .../STM32L0xx/Source/Templates/system_stm32l0xx.c | 564 +- .../Inc/Legacy/stm32_hal_legacy.h | 6639 .../Inc/stm32_assert_template.h| 130 +- .../STM32L0xx_HAL_Driver/Inc/stm32l0xx_hal.h | 896 +- .../STM32L0xx_HAL_Driver/Inc/stm32l0xx_hal_adc.h | 2329 +-- .../Inc/stm32l0xx_hal_adc_ex.h | 445 +- .../STM32L0xx_HAL_Driver/Inc/stm32l0xx_hal_comp.h | 1410 +- .../Inc/stm32l0xx_hal_comp_ex.h| 165 +- .../Inc/stm32l0xx_hal_conf_template.h | 652 +- .../Inc/stm32l0xx_hal_cortex.h | 781 +- .../STM32L0xx_HAL_Driver/Inc/stm32l0xx_hal_crc.h | 726 +- .../Inc/stm32l0xx_hal_crc_ex.h | 327 +- .../STM32L0xx_HAL_Driver/Inc/stm32l0xx_hal_cryp.h | 838 +- .../Inc/stm32l0xx_hal_cryp_ex.h| 178 +- .../STM32L0xx_HAL_Driver/Inc/stm32l0xx_hal_dac.h | 927 +- .../Inc/stm32l0xx_hal_dac_ex.h | 350 +- .../STM32L0xx_HAL_Driver/Inc/stm32l0xx_hal_def.h | 396 +- .../STM32L0xx_HAL_Driver/Inc/stm32l0xx_hal_dma.h | 1369 +- .../Inc/stm32l0xx_hal_firewall.h | 752 +- .../STM32L0xx_HAL_Driver/Inc/stm32l0xx_hal_flash.h | 764 +- .../Inc/stm32l0xx_hal_flash_ex.h | 1638 +- .../Inc/stm32l0xx_hal_flash_ramfunc.h | 232 +- .../STM32L0xx_HAL_Driver/Inc/stm32l0xx_hal_gpio.h |
[GitHub] [mynewt-core] mlaz merged pull request #1841: Updating to NRFX 1.7.1
mlaz merged pull request #1841: Updating to NRFX 1.7.1 URL: https://github.com/apache/mynewt-core/pull/1841 This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [mynewt-core] mlaz commented on issue #1841: Updating to NRFX 1.7.1
mlaz commented on issue #1841: Updating to NRFX 1.7.1 URL: https://github.com/apache/mynewt-core/pull/1841#issuecomment-497774196 I talked with @alvarop on slack and we agreed to have nrf52811 support coming in on a separate PR. This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[mynewt-nimble] branch master updated (aceb946 -> 9bc2304)
This is an automated email from the ASF dual-hosted git repository. naraj pushed a change to branch master in repository https://gitbox.apache.org/repos/asf/mynewt-nimble.git. from aceb946 apps/bttester: Add configurable Limited Advertising timeout add 9bc2304 apps/bttester: Fix l2cap set data to use updated API No new revisions were added by this update. Summary of changes: apps/bttester/src/l2cap.c | 39 +++ 1 file changed, 31 insertions(+), 8 deletions(-)
[GitHub] [mynewt-nimble] michal-narajowski merged pull request #455: apps/bttester: Fix l2cap set data to use updated API
michal-narajowski merged pull request #455: apps/bttester: Fix l2cap set data to use updated API URL: https://github.com/apache/mynewt-nimble/pull/455 This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [mynewt-nimble] michal-narajowski merged pull request #452: nimble/sm: Fix storing encryption key size in legacy mode
michal-narajowski merged pull request #452: nimble/sm: Fix storing encryption key size in legacy mode URL: https://github.com/apache/mynewt-nimble/pull/452 This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [mynewt-nimble] michal-narajowski merged pull request #453: apps/bttester: Add configurable Limited Advertising timeout
michal-narajowski merged pull request #453: apps/bttester: Add configurable Limited Advertising timeout URL: https://github.com/apache/mynewt-nimble/pull/453 This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [mynewt-nimble] rymanluk opened a new pull request #456: nimble/host: Change host-stop procedure
rymanluk opened a new pull request #456: nimble/host: Change host-stop procedure URL: https://github.com/apache/mynewt-nimble/pull/456 With this PR host is sending in the raw Disconnect Command to all the active connections and then start graceful disconnect timeout 2s. Host notifies that is stopped when a) all the disconnection complete events arrived within 2s b) disconnect timeout fires btmon logs for a) scenario: < HCI Command: Disconnect (0x01|0x0006) plen 3 #1191 110.578000 Handle: 3 Reason: Remote User Terminated Connection (0x13) > HCI Event: Command Status (0x0f) plen 4 #1192 110.578000 Disconnect (0x01|0x0006) ncmd 1 Status: Success (0x00) < HCI Command: Disconnect (0x01|0x0006) plen 3 #1193 110.601500 Handle: 2 Reason: Remote User Terminated Connection (0x13) > HCI Event: Command Status (0x0f) plen 4 #1194 110.601500 Disconnect (0x01|0x0006) ncmd 1 Status: Success (0x00) < HCI Command: Disconnect (0x01|0x0006) plen 3 #1195 110.624900 Handle: 1 Reason: Remote User Terminated Connection (0x13) > HCI Event: Command Status (0x0f) plen 4 #1196 110.624900 Disconnect (0x01|0x0006) ncmd 1 Status: Success (0x00) > HCI Event: Number of Completed Packets (0x13) plen 5 #1197 110.632700 Num handles: 1 Handle: 2 Count: 0 > HCI Event: Disconnect Complete (0x05) plen 4 #1198 110.632700 Status: Success (0x00) Handle: 3 Reason: Connection Terminated By Local Host (0x16) > HCI Event: Disconnect Complete (0x05) plen 4 #1201 110.695200 Status: Success (0x00) Handle: 1 Reason: Connection Terminated By Local Host (0x16) > HCI Event: Disconnect Complete (0x05) plen 4 #1202 110.765500 Status: Success (0x00) Handle: 2 Reason: Connection Terminated By Local Host (0x16) This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [mynewt-nimble] michal-narajowski opened a new pull request #455: apps/bttester: Fix l2cap set data to use updated API
michal-narajowski opened a new pull request #455: apps/bttester: Fix l2cap set data to use updated API URL: https://github.com/apache/mynewt-nimble/pull/455 This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [mynewt-core] kasjer merged pull request #1781: da1469x charger
kasjer merged pull request #1781: da1469x charger URL: https://github.com/apache/mynewt-core/pull/1781 This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[mynewt-core] 02/03: da1469x_charger: Add charger for DA1469x
This is an automated email from the ASF dual-hosted git repository. jerzy pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/mynewt-core.git commit 49a09e53045c7aa74c75d5bd8ccecccea602c493 Author: Jerzy Kasenberg AuthorDate: Thu Apr 25 16:08:38 2019 +0200 da1469x_charger: Add charger for DA1469x This adds basic charger functionality. Shell command is also added. --- .../include/da1469x_charger/da1469x_charger.h | 269 + hw/drivers/chg_ctrl/da1469x_charger/pkg.yml| 30 + .../chg_ctrl/da1469x_charger/src/da1469x_charger.c | 508 + .../da1469x_charger/src/da1469x_charger_shell.c| 1202 hw/drivers/chg_ctrl/da1469x_charger/syscfg.yml | 76 ++ 5 files changed, 2085 insertions(+) diff --git a/hw/drivers/chg_ctrl/da1469x_charger/include/da1469x_charger/da1469x_charger.h b/hw/drivers/chg_ctrl/da1469x_charger/include/da1469x_charger/da1469x_charger.h new file mode 100644 index 000..7fbd8a2 --- /dev/null +++ b/hw/drivers/chg_ctrl/da1469x_charger/include/da1469x_charger/da1469x_charger.h @@ -0,0 +1,269 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +#ifndef _DA1469X_CHARGER_H +#define _DA1469X_CHARGER_H + +#include +#include "os/os_dev.h" +#include "syscfg/syscfg.h" +#include "os/os_time.h" +#if MYNEWT_VAL(DA1469X_CHARGER_USE_CHARGE_CONTROL) +#include "charge-control/charge_control.h" +#endif + +struct da1469x_charger_config { +uint32_t ctrl_valid:1; +uint32_t voltage_param_valid:1; +uint32_t current_param_valid:1; +uint32_t tempset_param_valid:1; +uint32_t pre_charge_timer_valid:1; +uint32_t cc_charge_timer_valid:1; +uint32_t cv_charge_timer_valid:1; +uint32_t total_charge_timer_valid:1; +uint32_t jeita_v_charge_valid:1; +uint32_t jeita_v_precharge_valid:1; +uint32_t jeita_v_replenish_valid:1; +uint32_t jeita_v_ovp_valid:1; +uint32_t jeita_current_valid:1; +uint32_t vbat_comp_timer_valid:1; +uint32_t vovp_comp_timer_valid:1; +uint32_t tdie_comp_timer_valid:1; +uint32_t tbat_mon_timer_valid:1; +uint32_t tbat_comp_timer_valid:1; +uint32_t thot_comp_timer_valid:1; +uint32_t pwr_up_timer_valid:1; + +uint32_t ctrl; +uint32_t voltage_param; +uint32_t current_param; +uint32_t tempset_param; +uint16_t pre_charge_timer; +uint16_t cc_charge_timer; +uint16_t cv_charge_timer; +uint16_t total_charge_timer; +uint16_t jeita_v_charge; +uint16_t jeita_v_precharge; +uint16_t jeita_v_replenish; +uint16_t jeita_v_ovp; +uint32_t jeita_current; +uint16_t vbat_comp_timer; +uint16_t vovp_comp_timer; +uint16_t tdie_comp_timer; +uint16_t tbat_mon_timer; +uint16_t tbat_comp_timer; +uint16_t thot_comp_timer; +uint16_t pwr_up_timer; +}; + +struct da1469x_charger_dev { +struct os_dev dev; +#if MYNEWT_VAL(DA1469X_CHARGER_USE_CHARGE_CONTROL) +struct charge_control chg_ctrl; +#endif +}; + +#define DA1469X_ENCODE_V(v) \ +(((v) < 3800) ? (((v) - 2800) / 50) : \ +(((v) < 4600) ? ((v) - 3800) / 20 + 20 : \ +((v) - 4600) / 100 + 60)) + +#define DA1469X_ENCODE_CHG_I(i) \ +(uint16_t)(((i) < 85) ? ((i) / 5) - 1 : \ + ((i) < 250 ? ((i) / 10) - 8 + 15 : \ + ((i) / 20) - 12 + 31)) + +#define DA1469X_ENCODE_PRECHG_I(i) \ +((uint16_t)((i) < 9 ? (i) * 2 - 1 : \ +(i) < 25 ? (i) - 8 + 15 : \ + (i) / 2 - 12 + 31) << \ +CHARGER_CHARGER_CURRENT_PARAM_REG_I_PRECHARGE_Pos) + +#define DA1469X_ENCODE_EOC_I(i) \ +((uint16_t)((i) <= 10 ? ((i) - 4) * 2 / 3 : \ +(i) < 18 ? 4 + ((i) - 10) / 2 : \ +i) - 12) / 4) + 8)) << \ +CHARGER_CHARGER_CURRENT_PARAM_REG_I_END_OF_CHARGE_Pos) + +typedef enum { +DA1469X_CHARGER_STATE_POWER_UP, +DA1469X_CHARGER_STATE_INIT, +DA1469X_CHARGER_STATE_DISABLED, +DA1469X_CHARGER_STATE_PRE_CHARGE, +DA1469X_CHARGER_STATE_CC_CHARGE, +DA1469X_CHARGER_STATE_CV_CHARGE, +DA1469X_CHARGER_STATE_END_OF_CHARGE, +DA1469X_CHARGER_STATE_TDIE_PROT, +
[mynewt-core] 03/03: hw/mcu/da1469x: Add charger to MCU
This is an automated email from the ASF dual-hosted git repository. jerzy pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/mynewt-core.git commit 6b62430c7939371309d4a96e93198a31cef0d906 Author: Jerzy Kasenberg AuthorDate: Thu Apr 25 16:13:47 2019 +0200 hw/mcu/da1469x: Add charger to MCU da1469x_periph_create() now can create charger device. --- hw/mcu/dialog/da1469x/pkg.yml | 3 ++ hw/mcu/dialog/da1469x/src/da1469x_periph.c | 53 ++ hw/mcu/dialog/da1469x/syscfg.yml | 4 +++ 3 files changed, 60 insertions(+) diff --git a/hw/mcu/dialog/da1469x/pkg.yml b/hw/mcu/dialog/da1469x/pkg.yml index 5bec5be..4501a85 100644 --- a/hw/mcu/dialog/da1469x/pkg.yml +++ b/hw/mcu/dialog/da1469x/pkg.yml @@ -30,6 +30,9 @@ pkg.deps: - "@apache-mynewt-core/hw/cmsis-core" - hw/mcu/dialog +pkg.deps.CHARGER: +- hw/drivers/chg_ctrl/da1469x_charger + pkg.deps.TRNG: - "hw/drivers/trng/trng_da1469x" diff --git a/hw/mcu/dialog/da1469x/src/da1469x_periph.c b/hw/mcu/dialog/da1469x/src/da1469x_periph.c index 295c743..e2d8ef8 100644 --- a/hw/mcu/dialog/da1469x/src/da1469x_periph.c +++ b/hw/mcu/dialog/da1469x/src/da1469x_periph.c @@ -23,6 +23,7 @@ #include "os/os_cputime.h" #include "mcu/da1469x_hal.h" #include "mcu/da1469x_dma.h" +#include "bsp/bsp.h" #if MYNEWT_VAL(UART_0) || MYNEWT_VAL(UART_1) || MYNEWT_VAL(UART_2) #include "uart/uart.h" @@ -70,6 +71,10 @@ static struct trng_dev os_bsp_trng; #include #endif +#if MYNEWT_VAL(CHARGER) +#include "da1469x_charger/da1469x_charger.h" +#endif + #if MYNEWT_VAL(UART_0) static struct uart_dev os_bsp_uart0; static const struct da1469x_uart_cfg os_bsp_uart0_cfg = { @@ -204,6 +209,10 @@ static struct pwm_dev os_bsp_pwm1; static struct pwm_dev os_bsp_pwm2; #endif +#if MYNEWT_VAL(CHARGER) +struct da1469x_charger_dev da1469x_charger_dev; +#endif + static void da1469x_periph_create_timers(void) { @@ -391,6 +400,49 @@ da1469x_periph_create_spi(void) #endif } +#if MYNEWT_VAL(CHARGER) +struct da1469x_charger_config cfg = { +.ctrl = 63U << CHARGER_CHARGER_CTRL_REG_EOC_INTERVAL_CHECK_THRES_Pos | +1U << CHARGER_CHARGER_CTRL_REG_PRE_CHARGE_MODE_Pos | +1U << CHARGER_CHARGER_CTRL_REG_CHARGE_LOOP_HOLD_Pos | +(MYNEWT_VAL(DA1469X_CHARGER_TBAT_MONITOR_MODE)) << +CHARGER_CHARGER_CTRL_REG_TBAT_MONITOR_MODE_Pos | +1U << CHARGER_CHARGER_CTRL_REG_CHARGE_TIMERS_HALT_ENABLE_Pos | +(MYNEWT_VAL(DA1469X_CHARGER_NTC_ENABLE)) << +CHARGER_CHARGER_CTRL_REG_TBAT_PROT_ENABLE_Pos | +1U << CHARGER_CHARGER_CTRL_REG_TDIE_PROT_ENABLE_Pos | +1U << CHARGER_CHARGER_CTRL_REG_CHARGER_RESUME_Pos, +.ctrl_valid = 1, +.voltage_param = +DA1469X_ENCODE_V(MYNEWT_VAL(DA1469X_CHARGER_V_OVP)) << +CHARGER_CHARGER_VOLTAGE_PARAM_REG_V_OVP_Pos | +DA1469X_ENCODE_V(MYNEWT_VAL(DA1469X_CHARGER_V_REPLENISH)) << +CHARGER_CHARGER_VOLTAGE_PARAM_REG_V_REPLENISH_Pos | +DA1469X_ENCODE_V(MYNEWT_VAL(DA1469X_CHARGER_V_PRECHARGE)) << +CHARGER_CHARGER_VOLTAGE_PARAM_REG_V_PRECHARGE_Pos | +DA1469X_ENCODE_V(MYNEWT_VAL(DA1469X_CHARGER_V_CHARGE)) << +CHARGER_CHARGER_VOLTAGE_PARAM_REG_V_CHARGE_Pos, +.voltage_param_valid = 1, +.current_param = +DA1469X_ENCODE_PRECHG_I(MYNEWT_VAL(DA1469X_CHARGER_I_PRECHARGE)) | +DA1469X_ENCODE_CHG_I(MYNEWT_VAL(DA1469X_CHARGER_I_CHARGE)) | +DA1469X_ENCODE_EOC_I(MYNEWT_VAL(DA1469X_CHARGER_I_END_OF_CHARGE)), +.current_param_valid = 1, +}; +#endif + +void +da1469x_periph_create_charger(void) +{ +#if MYNEWT_VAL(CHARGER) +int rc; + +rc = da1469x_charger_create(_charger_dev, "charger", ); + +assert(rc == 0); +#endif +} + void da1469x_periph_create(void) { @@ -403,4 +455,5 @@ da1469x_periph_create(void) da1469x_periph_create_uart(); da1469x_periph_create_i2c(); da1469x_periph_create_spi(); +da1469x_periph_create_charger(); } diff --git a/hw/mcu/dialog/da1469x/syscfg.yml b/hw/mcu/dialog/da1469x/syscfg.yml index bce3120..22ce0c4 100644 --- a/hw/mcu/dialog/da1469x/syscfg.yml +++ b/hw/mcu/dialog/da1469x/syscfg.yml @@ -272,6 +272,10 @@ syscfg.defs: restrictions: - '!TIMER_2' +CHARGER: +description: 'Enable DA1469x charger' +value: 0 + GPADC: description: 'Enable DA1469x general purpose ADC' value: 0
[mynewt-core] branch master updated (e3bbcc0 -> 6b62430)
This is an automated email from the ASF dual-hosted git repository. jerzy pushed a change to branch master in repository https://gitbox.apache.org/repos/asf/mynewt-core.git. from e3bbcc0 Added null device check in os_dev_close (#1850) new 712aea0 hw/drivers/adc: Add battery reading channel new 49a09e5 da1469x_charger: Add charger for DA1469x new 6b62430 hw/mcu/da1469x: Add charger to MCU The 3 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference. Summary of changes: .../include/gpadc_da1469x/gpadc_da1469x.h |7 + hw/drivers/adc/gpadc_da1469x/src/gpadc_da1469x.c | 27 + .../include/sdadc_da1469x/sdadc_da1469x.h |7 + hw/drivers/adc/sdadc_da1469x/src/sdadc_da1469x.c | 25 + .../include/da1469x_charger/da1469x_charger.h | 269 + .../chg_ctrl/{bq24040 => da1469x_charger}/pkg.yml |7 +- .../chg_ctrl/da1469x_charger/src/da1469x_charger.c | 508 + .../da1469x_charger/src/da1469x_charger_shell.c| 1202 hw/drivers/chg_ctrl/da1469x_charger/syscfg.yml | 76 ++ hw/mcu/dialog/da1469x/pkg.yml |3 + hw/mcu/dialog/da1469x/src/da1469x_periph.c | 53 + hw/mcu/dialog/da1469x/syscfg.yml | 16 + 12 files changed, 2197 insertions(+), 3 deletions(-) create mode 100644 hw/drivers/chg_ctrl/da1469x_charger/include/da1469x_charger/da1469x_charger.h copy hw/drivers/chg_ctrl/{bq24040 => da1469x_charger}/pkg.yml (86%) create mode 100644 hw/drivers/chg_ctrl/da1469x_charger/src/da1469x_charger.c create mode 100644 hw/drivers/chg_ctrl/da1469x_charger/src/da1469x_charger_shell.c create mode 100644 hw/drivers/chg_ctrl/da1469x_charger/syscfg.yml
[mynewt-core] 01/03: hw/drivers/adc: Add battery reading channel
This is an automated email from the ASF dual-hosted git repository. jerzy pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/mynewt-core.git commit 712aea0f27d1bc5b0c7b5bb017e08bf39208f8e0 Author: Jerzy Kasenberg AuthorDate: Tue Apr 23 14:51:13 2019 +0200 hw/drivers/adc: Add battery reading channel When application wants to use ADC (GP or SD) for battery reading it may enable it with GPADC_BATTERY or SDADC_BATTERY open device BATTERY_ADC_DEV_NAME and read value from ADC. adc = (struct adc_dev *)da1469x_open_battery_adc(BATTERY_ADC_DEV_NAME, 1); adc_read_channel(adc, BATTERY_ADC_CHANNEL, _val); os_dev_close(>ad_dev); --- .../include/gpadc_da1469x/gpadc_da1469x.h | 7 ++ hw/drivers/adc/gpadc_da1469x/src/gpadc_da1469x.c | 27 ++ .../include/sdadc_da1469x/sdadc_da1469x.h | 7 ++ hw/drivers/adc/sdadc_da1469x/src/sdadc_da1469x.c | 25 hw/mcu/dialog/da1469x/syscfg.yml | 12 ++ 5 files changed, 78 insertions(+) diff --git a/hw/drivers/adc/gpadc_da1469x/include/gpadc_da1469x/gpadc_da1469x.h b/hw/drivers/adc/gpadc_da1469x/include/gpadc_da1469x/gpadc_da1469x.h index c8bf3e3..01b9b27 100644 --- a/hw/drivers/adc/gpadc_da1469x/include/gpadc_da1469x/gpadc_da1469x.h +++ b/hw/drivers/adc/gpadc_da1469x/include/gpadc_da1469x/gpadc_da1469x.h @@ -66,6 +66,13 @@ struct da1469x_gpadc_chan_cfg { */ int da1469x_gpadc_init(struct os_dev *, void *); +#if MYNEWT_VAL(GPADC_BATTERY) + +#define BATTERY_ADC_DEV_NAME"gpadc" + +struct os_dev *da1469x_open_battery_adc(const char *dev_name, uint32_t wait); +#endif + #ifdef __cplusplus } #endif diff --git a/hw/drivers/adc/gpadc_da1469x/src/gpadc_da1469x.c b/hw/drivers/adc/gpadc_da1469x/src/gpadc_da1469x.c index 28b5031..0a7faea 100644 --- a/hw/drivers/adc/gpadc_da1469x/src/gpadc_da1469x.c +++ b/hw/drivers/adc/gpadc_da1469x/src/gpadc_da1469x.c @@ -662,3 +662,30 @@ da1469x_gpadc_init(struct os_dev *odev, void *arg) return 0; } + +#if MYNEWT_VAL(GPADC_BATTERY) + +static struct da1469x_gpadc_dev_cfg os_bsp_gpadc_battery_cfg = { +.dgdc_gpadc_ctrl = (1U << GPADC_GP_ADC_CTRL_REG_GP_ADC_SE_Pos) | + (8U << GPADC_GP_ADC_CTRL_REG_GP_ADC_SEL_Pos), +.dgdc_gpadc_ctrl2 = 0, +.dgdc_gpadc_ctrl3 = 0, +.dgdc_gpadc_set_offp = 0, +.dgdc_gpadc_set_offn = 0, +.dgdc_gpadc_offp = 0, +.dgdc_gpadc_offn = 0, +}; + +struct os_dev * +da1469x_open_battery_adc(const char *dev_name, uint32_t wait) +{ +struct os_dev *adc = os_dev_open(dev_name, wait, _bsp_gpadc_battery_cfg); +if (adc) { +/* call adc_chan_config to setup correct multiplier so read returns + * value in mV */ +adc_chan_config((struct adc_dev *)adc, 0, NULL); +} +return adc; +} + +#endif diff --git a/hw/drivers/adc/sdadc_da1469x/include/sdadc_da1469x/sdadc_da1469x.h b/hw/drivers/adc/sdadc_da1469x/include/sdadc_da1469x/sdadc_da1469x.h index 81b8ce6..7244315 100644 --- a/hw/drivers/adc/sdadc_da1469x/include/sdadc_da1469x/sdadc_da1469x.h +++ b/hw/drivers/adc/sdadc_da1469x/include/sdadc_da1469x/sdadc_da1469x.h @@ -63,6 +63,13 @@ struct da1469x_sdadc_chan_cfg { */ int da1469x_sdadc_init(struct os_dev *, void *); +#if MYNEWT_VAL(SDADC_BATTERY) + +#define BATTERY_ADC_DEV_NAME"sdadc" + +struct os_dev *da1469x_open_battery_adc(const char *dev_name, uint32_t wait); +#endif + #ifdef __cplusplus } #endif diff --git a/hw/drivers/adc/sdadc_da1469x/src/sdadc_da1469x.c b/hw/drivers/adc/sdadc_da1469x/src/sdadc_da1469x.c index dab155f..baef543 100644 --- a/hw/drivers/adc/sdadc_da1469x/src/sdadc_da1469x.c +++ b/hw/drivers/adc/sdadc_da1469x/src/sdadc_da1469x.c @@ -453,3 +453,28 @@ da1469x_sdadc_init(struct os_dev *odev, void *arg) return 0; } + +#if MYNEWT_VAL(SDADC_BATTERY) + +static struct da1469x_sdadc_dev_cfg os_bsp_adc_battery_cfg = { +.dsdc_sdadc_ctrl = (1U << SDADC_SDADC_CTRL_REG_SDADC_SE_Pos) | + (8U << SDADC_SDADC_CTRL_REG_SDADC_INP_SEL_Pos), +.dsdc_sdadc_gain_corr = 0, +.dsdc_sdadc_offs_corr = 0, +.dsdc_sdadc_set_gain_corr = 0, +.dsdc_sdadc_set_offs_corr = 0, +}; + +struct os_dev * +da1469x_open_battery_adc(const char *dev_name, uint32_t wait) +{ +struct os_dev *adc = os_dev_open(dev_name, wait, _bsp_adc_battery_cfg); +if (adc) { +/* call adc_chan_config to setup correct multiplier so read returns + * value in mV */ +adc_chan_config((struct adc_dev *)adc, 0, NULL); +} +return adc; +} + +#endif diff --git a/hw/mcu/dialog/da1469x/syscfg.yml b/hw/mcu/dialog/da1469x/syscfg.yml index 58fc080..bce3120 100644 --- a/hw/mcu/dialog/da1469x/syscfg.yml +++ b/hw/mcu/dialog/da1469x/syscfg.yml @@ -286,6 +286,12 @@ syscfg.defs: description: > 'DMA priority for GPADC, 0-7' value: 0 +GPADC_BATTERY: +description: > + Enable battery measurement on GPADC +
[GitHub] [mynewt-nimble] michal-narajowski opened a new pull request #454: apps/bttester: Add support for Read by UUID
michal-narajowski opened a new pull request #454: apps/bttester: Add support for Read by UUID URL: https://github.com/apache/mynewt-nimble/pull/454 This can be used to pass GAP/IDLE/NAMP/BV-01-C. This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [mynewt-nimble] michal-narajowski opened a new pull request #453: apps/bttester: Add configurable Limited Advertising timeout
michal-narajowski opened a new pull request #453: apps/bttester: Add configurable Limited Advertising timeout URL: https://github.com/apache/mynewt-nimble/pull/453 This is required to pass some GAP/DISC/LIMM/BV-03-C and GAP/DISC/LIMM/BV-04-C testcases. This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [mynewt-core] andrzej-kaczmarek opened a new pull request #1852: hw/sensor/creator: Fix line endings
andrzej-kaczmarek opened a new pull request #1852: hw/sensor/creator: Fix line endings URL: https://github.com/apache/mynewt-core/pull/1852 This was broken by https://github.com/apache/mynewt-core/pull/1801. This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] [mynewt-core] asmitajha opened a new issue #1851: Mynewt install error
asmitajha opened a new issue #1851: Mynewt install error URL: https://github.com/apache/mynewt-core/issues/1851 Hello, I recently started with Mynewt OS. I went through the step by documentation for its installation. I have successfully installed newt on my Windows10 PC. I am following the steps as given on your website to create my first project. Unfortunately, I am getting following erroe o : Admin@ZWPL-COM2 MINGW64 ~/dev/myproj $ newt install Error: project.yml file specifies nonexistent repo versions: apache-mynewt-core,==1.6.0 I tried to change vers in project.yml file but still getting the same error. and When I am trying to change vers to 0-dev I am getting error as Error: cannot normalize version "0-dev" for repo "apache-mynewt-core"; no mapping to numeric version Kindly help me out to resolve this issue. Hope to hear from you soon. This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services