You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by cc...@apache.org on 2016/09/13 03:42:34 UTC
[41/41] incubator-mynewt-core git commit: syscfg / sysinit
syscfg / sysinit
Project: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/commit/d98ddc1c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/d98ddc1c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/d98ddc1c
Branch: refs/heads/sterly_refactor
Commit: d98ddc1c5e877d18e5ac68b6d342cf39ba068b20
Parents: fdd134d
Author: Christopher Collins <cc...@apache.org>
Authored: Mon Sep 12 19:49:17 2016 -0700
Committer: Christopher Collins <cc...@apache.org>
Committed: Mon Sep 12 20:39:09 2016 -0700
----------------------------------------------------------------------
apps/blecent/pkg.yml | 4 +-
apps/blecent/src/main.c | 94 +-
apps/blehci/src/main.c | 52 +-
apps/bleprph/pkg.yml | 20 +-
apps/bleprph/src/bleprph.h | 2 +-
apps/bleprph/src/gatt_svr.c | 4 +-
apps/bleprph/src/main.c | 125 +-
apps/bletest/pkg.yml | 4 +
apps/bletest/src/bletest_hci.c | 6 +-
apps/bletest/src/bletest_priv.h | 2 +-
apps/bletest/src/main.c | 129 +-
apps/bletiny/pkg.yml | 12 +-
apps/bletiny/src/bletiny.h | 4 +-
apps/bletiny/src/cmd.c | 4 +-
apps/bletiny/src/gatt_svr.c | 4 +-
apps/bletiny/src/main.c | 123 +-
apps/bleuart/pkg.yml | 6 +-
apps/bleuart/src/main.c | 101 +-
apps/blinky/src/main.c | 114 +-
apps/boot/pkg.yml | 36 +-
apps/boot/src/boot.c | 16 +-
apps/ffs2native/src/main.c | 14 +-
apps/luatest/src/main.c | 55 +-
apps/sblinky/pkg.yml | 12 -
apps/sblinky/src/main.c | 72 +-
apps/slinky/pkg.yml | 10 +-
apps/slinky/src/main.c | 117 +-
apps/test/pkg.yml | 2 -
drivers/adc/adc_nrf51/pkg.yml | 7 +-
drivers/adc/adc_nrf52/pkg.yml | 7 +-
drivers/adc/pkg.yml | 4 -
drivers/uart/pkg.yml | 1 -
fs/fs/pkg.yml | 12 +-
fs/fs/src/fs_cli.c | 6 +-
fs/fs/src/fs_mount.c | 8 +-
fs/fs/src/fs_priv.h | 6 +-
fs/nffs/include/nffs/nffs.h | 3 +
fs/nffs/pkg.yml | 10 +-
fs/nffs/src/nffs.c | 54 +-
fs/nffs/src/nffs_misc.c | 70 +
fs/nffs/src/nffs_priv.h | 3 +
fs/nffs/src/nffs_restore.c | 2 +-
fs/nffs/src/test/arch/cortex_m4/nffs_test.c | 27 -
fs/nffs/src/test/arch/sim/nffs_test.c | 3250 ---------
fs/nffs/src/test/arch/sim/nffs_test_priv.h | 42 -
fs/nffs/src/test/arch/sim/nffs_test_system_01.c | 6537 ------------------
fs/nffs/test/pkg.yml | 30 +
fs/nffs/test/src/arch/cortex_m4/nffs_test.c | 27 +
fs/nffs/test/src/arch/sim/nffs_test.c | 3251 +++++++++
fs/nffs/test/src/arch/sim/nffs_test_priv.h | 42 +
fs/nffs/test/src/arch/sim/nffs_test_system_01.c | 6537 ++++++++++++++++++
hw/bsp/arduino_primo_nrf52/pkg.yml | 59 +-
hw/bsp/bmd300eval/pkg.yml | 57 +-
hw/bsp/native/pkg.yml | 3 +-
hw/bsp/native/src/hal_bsp.c | 75 -
hw/bsp/nrf51-arduino_101/pkg.yml | 55 +-
hw/bsp/nrf51-blenano/pkg.yml | 55 +-
hw/bsp/nrf51dk-16kbram/pkg.yml | 56 +-
hw/bsp/nrf51dk/pkg.yml | 52 +-
hw/bsp/nrf52dk/pkg.yml | 60 +-
hw/bsp/nrf52dk/src/os_bsp.c | 78 +-
hw/bsp/nrf52pdk/pkg.yml | 58 +-
hw/bsp/olimex_stm32-e407_devboard/pkg.yml | 45 +-
hw/hal/include/hal/flash_map.h | 5 +-
hw/hal/include/hal/hal_bsp.h | 1 +
hw/hal/pkg.yml | 3 -
hw/hal/src/flash_map.c | 76 +-
hw/hal/src/test/flash_map_test.c | 169 -
hw/hal/test/pkg.yml | 30 +
hw/hal/test/src/flash_map_test.c | 170 +
hw/mcu/native/include/mcu/mcu_hal.h | 2 -
hw/mcu/native/src/hal_adc.c | 4 +-
hw/mcu/native/src/hal_dac.c | 2 +
hw/mcu/native/src/hal_pwm.c | 3 +-
hw/mcu/nordic/nrf51xxx/pkg.yml | 3 -
hw/mcu/nordic/nrf52xxx/include/mcu/cortex_m4.h | 3 +-
hw/mcu/nordic/nrf52xxx/pkg.yml | 3 -
hw/mcu/nordic/nrf52xxx/src/hal_os_tick.c | 17 +-
hw/mcu/nordic/pkg.yml | 5 +-
libs/baselibc/pkg.yml | 4 -
libs/bleuart/include/bleuart/bleuart.h | 6 +-
libs/bleuart/pkg.yml | 8 +
libs/bleuart/src/bleuart.c | 29 +-
libs/boot_serial/pkg.yml | 2 +-
libs/boot_serial/src/test/boot_test.c | 230 -
libs/boot_serial/test/pkg.yml | 30 +
libs/boot_serial/test/src/boot_test.c | 231 +
libs/bootutil/pkg.yml | 25 +-
libs/bootutil/src/bootutil_misc.c | 20 +-
libs/bootutil/src/image_ec.c | 17 +-
libs/bootutil/src/image_rsa.c | 13 +-
libs/bootutil/src/image_validate.c | 27 +-
libs/bootutil/src/loader.c | 6 +
libs/bootutil/src/test/boot_test.c | 1169 ----
libs/bootutil/test/pkg.yml | 33 +
libs/bootutil/test/src/boot_serial_test.c | 1171 ++++
libs/bootutil/test/src/boot_test.c | 1170 ++++
libs/console/full/pkg.yml | 4 +-
libs/console/full/src/cons_fmt.c | 7 +-
libs/console/full/src/cons_tty.c | 17 +-
libs/crash_test/pkg.yml | 18 +-
libs/crash_test/src/crash_cli.c | 7 +-
libs/crash_test/src/crash_nmgr.c | 12 +-
libs/crash_test/src/crash_test.c | 18 +-
libs/crash_test/src/crash_test_priv.h | 4 +-
libs/elua/elua_base/include/elua_base/elua.h | 2 +-
libs/elua/elua_base/pkg.yml | 18 +-
libs/elua/elua_base/src/lmynewt.c | 23 +-
libs/imgmgr/include/imgmgr/imgmgr.h | 2 +-
libs/imgmgr/pkg.yml | 18 +-
libs/imgmgr/src/imgmgr.c | 24 +-
libs/imgmgr/src/imgmgr_coredump.c | 13 +-
libs/imgmgr/src/imgmgr_fs.c | 21 +-
libs/imgmgr/src/imgmgr_priv.h | 3 +-
libs/inet_def_service/pkg.yml | 3 -
libs/json/pkg.yml | 2 -
libs/json/src/test/test_json.c | 41 -
libs/json/src/test/test_json.h | 27 -
libs/json/src/test/test_json_simple.c | 360 -
libs/json/test/pkg.yml | 30 +
libs/json/test/src/test_json.c | 43 +
libs/json/test/src/test_json.h | 27 +
libs/json/test/src/test_json_simple.c | 360 +
libs/mbedtls/pkg.yml | 4 +-
libs/mbedtls/src/test/mbedtls_test.c | 228 -
libs/mbedtls/test/pkg.yml | 30 +
libs/mbedtls/test/src/mbedtls_test.c | 228 +
libs/newtmgr/include/newtmgr/newtmgr.h | 2 +-
libs/newtmgr/pkg.yml | 17 +-
libs/newtmgr/src/newtmgr.c | 32 +-
.../transport/ble/include/nmgrble/newtmgr_ble.h | 2 +-
libs/newtmgr/transport/ble/pkg.yml | 3 +
libs/newtmgr/transport/ble/src/newtmgr_ble.c | 25 +-
libs/os/include/os/os_mbuf.h | 3 +
libs/os/pkg.yml | 52 +-
libs/os/src/arch/cortex_m0/os_fault.c | 20 +-
libs/os/src/arch/cortex_m4/os_arch_arm.c | 3 -
libs/os/src/arch/cortex_m4/os_fault.c | 15 +-
libs/os/src/os.c | 14 +
libs/os/src/os_mbuf.c | 27 +
libs/os/src/os_msys_init.c | 147 +
libs/os/src/os_priv.h | 2 +
.../src/test/arch/cortex_m4/os_test_arch_arm.c | 27 -
libs/os/src/test/arch/sim/os_test_arch_sim.c | 52 -
libs/os/src/test/eventq_test.c | 416 --
libs/os/src/test/mbuf_test.c | 420 --
libs/os/src/test/mempool_test.c | 227 -
libs/os/src/test/mutex_test.c | 407 --
libs/os/src/test/os_test.c | 52 -
libs/os/src/test/os_test_priv.h | 32 -
libs/os/src/test/sem_test.c | 401 --
libs/os/test/pkg.yml | 30 +
.../test/src/arch/cortex_m4/os_test_arch_arm.c | 27 +
libs/os/test/src/arch/sim/os_test_arch_sim.c | 52 +
libs/os/test/src/eventq_test.c | 416 ++
libs/os/test/src/mbuf_test.c | 420 ++
libs/os/test/src/mempool_test.c | 227 +
libs/os/test/src/mutex_test.c | 407 ++
libs/os/test/src/os_test.c | 53 +
libs/os/test/src/os_test_priv.h | 32 +
libs/os/test/src/sem_test.c | 401 ++
libs/shell/include/shell/shell.h | 3 +-
libs/shell/pkg.yml | 17 +-
libs/shell/src/shell.c | 80 +-
libs/testutil/include/testutil/testutil.h | 4 +-
libs/testutil/pkg.yml | 2 -
libs/util/include/util/mem.h | 3 +
libs/util/pkg.yml | 1 -
libs/util/src/mem.c | 20 +
libs/util/src/test/cbmem_test.c | 176 -
libs/util/src/test/util_test.c | 45 -
libs/util/src/test/util_test_priv.h | 25 -
libs/util/test/pkg.yml | 30 +
libs/util/test/src/cbmem_test.c | 176 +
libs/util/test/src/util_test.c | 46 +
libs/util/test/src/util_test_priv.h | 25 +
libs/wifi_mgmt/pkg.yml | 13 +-
libs/wifi_mgmt/src/wifi.c | 2 +-
libs/wifi_mgmt/src/wifi_cli.c | 6 +-
libs/wifi_mgmt/src/wifi_priv.h | 4 +-
.../controller/include/controller/ble_ll.h | 5 +-
.../controller/include/controller/ble_ll_conn.h | 6 +-
net/nimble/controller/pkg.yml | 170 +-
net/nimble/controller/src/ble_ll.c | 68 +-
net/nimble/controller/src/ble_ll_adv.c | 21 +-
net/nimble/controller/src/ble_ll_conn.c | 71 +-
net/nimble/controller/src/ble_ll_conn_hci.c | 13 +-
net/nimble/controller/src/ble_ll_conn_priv.h | 2 +-
net/nimble/controller/src/ble_ll_ctrl.c | 27 +-
net/nimble/controller/src/ble_ll_hci.c | 21 +-
net/nimble/controller/src/ble_ll_hci_ev.c | 3 +-
net/nimble/controller/src/ble_ll_rand.c | 11 +-
net/nimble/controller/src/ble_ll_resolv.c | 11 +-
net/nimble/controller/src/ble_ll_rng.c | 2 +-
net/nimble/controller/src/ble_ll_scan.c | 25 +-
net/nimble/controller/src/ble_ll_supp_cmd.c | 4 +-
net/nimble/controller/src/ble_ll_whitelist.c | 5 +-
net/nimble/drivers/native/src/ble_hw.c | 3 +-
net/nimble/drivers/native/src/ble_phy.c | 5 +-
net/nimble/drivers/nrf51/src/ble_hw.c | 9 +-
net/nimble/drivers/nrf51/src/ble_phy.c | 39 +-
net/nimble/drivers/nrf52/src/ble_hw.c | 11 +-
net/nimble/drivers/nrf52/src/ble_phy.c | 31 +-
net/nimble/host/include/host/ble_gatt.h | 3 +-
net/nimble/host/include/host/ble_hs.h | 121 +-
net/nimble/host/include/host/ble_sm.h | 4 +-
net/nimble/host/pkg.yml | 206 +-
.../include/services/mandatory/ble_svc_gap.h | 2 +-
.../include/services/mandatory/ble_svc_gatt.h | 2 +-
net/nimble/host/services/mandatory/pkg.yml | 3 +
.../host/services/mandatory/src/ble_svc_gap.c | 4 +-
.../host/services/mandatory/src/ble_svc_gatt.c | 4 +-
.../services/mandatory/src/ble_svc_mandatory.c | 36 +
net/nimble/host/src/ble_att_clt.c | 48 +-
net/nimble/host/src/ble_att_priv.h | 2 +
net/nimble/host/src/ble_att_svr.c | 73 +-
net/nimble/host/src/ble_eddystone.c | 4 +-
net/nimble/host/src/ble_gap.c | 40 +-
net/nimble/host/src/ble_gattc.c | 101 +-
net/nimble/host/src/ble_gatts.c | 136 +-
net/nimble/host/src/ble_hs.c | 175 +-
net/nimble/host/src/ble_hs_adv.c | 4 +-
net/nimble/host/src/ble_hs_cfg.c | 69 +-
net/nimble/host/src/ble_hs_conn.c | 57 +-
net/nimble/host/src/ble_hs_dbg.c | 2 +-
net/nimble/host/src/ble_hs_hci.c | 6 +-
net/nimble/host/src/ble_hs_hci_priv.h | 2 +-
net/nimble/host/src/ble_hs_misc.c | 20 -
net/nimble/host/src/ble_hs_priv.h | 19 +-
net/nimble/host/src/ble_hs_pvcy.c | 2 +-
net/nimble/host/src/ble_l2cap.c | 39 +-
net/nimble/host/src/ble_l2cap_sig.c | 38 +-
net/nimble/host/src/ble_sm.c | 69 +-
net/nimble/host/src/ble_sm_alg.c | 134 +-
net/nimble/host/src/ble_sm_cmd.c | 2 +-
net/nimble/host/src/ble_sm_lgcy.c | 2 +-
net/nimble/host/src/ble_sm_priv.h | 9 +-
net/nimble/host/src/ble_sm_sc.c | 4 +-
net/nimble/host/src/test/ble_att_clt_test.c | 536 --
net/nimble/host/src/test/ble_att_svr_test.c | 2314 -------
net/nimble/host/src/test/ble_gap_test.c | 2578 -------
net/nimble/host/src/test/ble_gatt_conn_test.c | 533 --
net/nimble/host/src/test/ble_gatt_disc_c_test.c | 547 --
net/nimble/host/src/test/ble_gatt_disc_d_test.c | 363 -
net/nimble/host/src/test/ble_gatt_disc_s_test.c | 406 --
net/nimble/host/src/test/ble_gatt_find_s_test.c | 342 -
net/nimble/host/src/test/ble_gatt_read_test.c | 823 ---
net/nimble/host/src/test/ble_gatt_write_test.c | 639 --
.../host/src/test/ble_gatts_notify_test.c | 983 ---
net/nimble/host/src/test/ble_gatts_read_test.c | 261 -
net/nimble/host/src/test/ble_gatts_reg_test.c | 718 --
net/nimble/host/src/test/ble_hs_adv_test.c | 1486 ----
net/nimble/host/src/test/ble_hs_conn_test.c | 219 -
net/nimble/host/src/test/ble_hs_hci_test.c | 99 -
net/nimble/host/src/test/ble_hs_test.c | 60 -
net/nimble/host/src/test/ble_hs_test_util.c | 1438 ----
net/nimble/host/src/test/ble_hs_test_util.h | 176 -
.../host/src/test/ble_hs_test_util_store.c | 248 -
.../host/src/test/ble_hs_test_util_store.h | 36 -
net/nimble/host/src/test/ble_l2cap_test.c | 690 --
net/nimble/host/src/test/ble_os_test.c | 401 --
net/nimble/host/src/test/ble_sm_lgcy_test.c | 839 ---
net/nimble/host/src/test/ble_sm_sc_test.c | 4910 -------------
net/nimble/host/src/test/ble_sm_test.c | 678 --
net/nimble/host/src/test/ble_sm_test_util.c | 2404 -------
net/nimble/host/src/test/ble_sm_test_util.h | 119 -
net/nimble/host/src/test/ble_uuid_test.c | 93 -
net/nimble/host/test/pkg.yml | 41 +
net/nimble/host/test/src/ble_att_clt_test.c | 536 ++
net/nimble/host/test/src/ble_att_svr_test.c | 2314 +++++++
net/nimble/host/test/src/ble_gap_test.c | 2580 +++++++
net/nimble/host/test/src/ble_gatt_conn_test.c | 533 ++
net/nimble/host/test/src/ble_gatt_disc_c_test.c | 547 ++
net/nimble/host/test/src/ble_gatt_disc_d_test.c | 363 +
net/nimble/host/test/src/ble_gatt_disc_s_test.c | 406 ++
net/nimble/host/test/src/ble_gatt_find_s_test.c | 342 +
net/nimble/host/test/src/ble_gatt_read_test.c | 823 +++
net/nimble/host/test/src/ble_gatt_write_test.c | 639 ++
.../host/test/src/ble_gatts_notify_test.c | 983 +++
net/nimble/host/test/src/ble_gatts_read_test.c | 261 +
net/nimble/host/test/src/ble_gatts_reg_test.c | 718 ++
net/nimble/host/test/src/ble_hs_adv_test.c | 1486 ++++
net/nimble/host/test/src/ble_hs_conn_test.c | 219 +
net/nimble/host/test/src/ble_hs_hci_test.c | 99 +
net/nimble/host/test/src/ble_hs_test.c | 61 +
net/nimble/host/test/src/ble_hs_test_util.c | 1404 ++++
net/nimble/host/test/src/ble_hs_test_util.h | 177 +
.../host/test/src/ble_hs_test_util_store.c | 248 +
.../host/test/src/ble_hs_test_util_store.h | 36 +
net/nimble/host/test/src/ble_l2cap_test.c | 690 ++
net/nimble/host/test/src/ble_os_test.c | 401 ++
net/nimble/host/test/src/ble_sm_lgcy_test.c | 839 +++
net/nimble/host/test/src/ble_sm_sc_test.c | 4910 +++++++++++++
net/nimble/host/test/src/ble_sm_test.c | 678 ++
net/nimble/host/test/src/ble_sm_test_util.c | 2410 +++++++
net/nimble/host/test/src/ble_sm_test_util.h | 119 +
net/nimble/host/test/src/ble_uuid_test.c | 93 +
net/nimble/include/nimble/nimble_opt.h | 377 -
net/nimble/include/nimble/nimble_opt_auto.h | 104 +-
net/nimble/pkg.yml | 22 +
.../ram/include/transport/ram/ble_hci_ram.h | 24 +-
net/nimble/transport/ram/pkg.yml | 16 +
net/nimble/transport/ram/src/ble_hci_ram.c | 28 +-
.../uart/include/transport/uart/ble_hci_uart.h | 2 +-
net/nimble/transport/uart/pkg.yml | 32 +
net/nimble/transport/uart/src/ble_hci_uart.c | 63 +-
sys/config/include/config/config.h | 4 +-
sys/config/pkg.yml | 51 +-
sys/config/src/config.c | 31 +-
sys/config/src/config_cli.c | 3 +-
sys/config/src/config_fcb.c | 5 +-
sys/config/src/config_file.c | 4 +-
sys/config/src/config_init.c | 105 +
sys/config/src/config_json_line.c | 8 +-
sys/config/src/config_nmgr.c | 8 +-
sys/config/src/config_store.c | 8 +-
sys/config/src/test/conf_test.c | 953 ---
sys/config/src/test/conf_test.h | 25 -
sys/config/src/test/conf_test_suite.c | 39 -
sys/config/src/test/config_test.h | 24 -
sys/config/test/pkg.yml | 32 +
sys/config/test/src/conf_test.c | 953 +++
sys/config/test/src/conf_test.h | 25 +
sys/config/test/src/conf_test_suite.c | 40 +
sys/config/test/src/config_test.h | 24 +
sys/coredump/pkg.yml | 2 -
sys/fcb/pkg.yml | 3 -
sys/fcb/src/test/fcb_test.c | 671 --
sys/fcb/test/pkg.yml | 30 +
sys/fcb/test/src/fcb_test.c | 672 ++
sys/id/include/id/id.h | 2 +-
sys/id/pkg.yml | 13 +-
sys/id/src/id.c | 17 +-
sys/log/include/log/log.h | 20 +-
sys/log/pkg.yml | 36 +-
sys/log/src/log.c | 41 +-
sys/log/src/log_fcb.c | 12 +-
sys/log/src/log_nmgr.c | 8 +-
sys/log/src/log_shell.c | 20 +-
sys/log/src/test/log_test.c | 162 -
sys/log/test/pkg.yml | 33 +
sys/log/test/src/log_test.c | 163 +
sys/mn_socket/pkg.yml | 1 -
sys/mn_socket/src/test/mn_sock_test.c | 82 -
sys/mn_socket/test/pkg.yml | 30 +
sys/mn_socket/test/src/mn_sock_test.c | 83 +
sys/reboot/pkg.yml | 12 +-
sys/reboot/src/log_reboot.c | 42 +-
sys/stats/include/stats/stats.h | 18 +-
sys/stats/pkg.yml | 23 +-
sys/stats/src/stats.c | 60 +-
sys/stats/src/stats_nmgr.c | 10 +-
sys/stats/src/stats_shell.c | 17 +-
sys/sysinit/include/sysinit/sysinit.h | 42 +
sys/sysinit/pkg.yml | 34 +
targets/unittest/pkg.yml | 2 +
356 files changed, 46034 insertions(+), 44392 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/d98ddc1c/apps/blecent/pkg.yml
----------------------------------------------------------------------
diff --git a/apps/blecent/pkg.yml b/apps/blecent/pkg.yml
index 3798fee..3fd6796 100644
--- a/apps/blecent/pkg.yml
+++ b/apps/blecent/pkg.yml
@@ -33,6 +33,6 @@ pkg.deps:
- libs/console/full
- libs/baselibc
-pkg.cflags:
+pkg.syscfg_vals:
# DEBUG logging is a bit noisy; use INFO.
- - "-DLOG_LEVEL=1"
+ LOG_LEVEL: 1
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/d98ddc1c/apps/blecent/src/main.c
----------------------------------------------------------------------
diff --git a/apps/blecent/src/main.c b/apps/blecent/src/main.c
index 66a4e3f..1f9a424 100755
--- a/apps/blecent/src/main.c
+++ b/apps/blecent/src/main.c
@@ -19,19 +19,15 @@
#include <assert.h>
#include <string.h>
+#include "syscfg/syscfg.h"
#include "bsp/bsp.h"
#include "os/os.h"
-#include "hal/hal_cputime.h"
-#include "console/console.h"
/* BLE */
#include "nimble/ble.h"
#include "controller/ble_ll.h"
#include "host/ble_hs.h"
-/* RAM HCI transport. */
-#include "transport/ram/ble_hci_ram.h"
-
/* RAM persistence layer. */
#include "store/ram/ble_store_ram.h"
@@ -42,25 +38,10 @@
/* Application-specified header. */
#include "blecent.h"
-#define BSWAP16(x) ((uint16_t)(((x) << 8) | (((x) & 0xff00) >> 8)))
-
-/** Mbuf settings. */
-#define MBUF_NUM_MBUFS (12)
-#define MBUF_BUF_SIZE OS_ALIGN(BLE_MBUF_PAYLOAD_SIZE, 4)
-#define MBUF_MEMBLOCK_SIZE (MBUF_BUF_SIZE + BLE_MBUF_MEMBLOCK_OVERHEAD)
-#define MBUF_MEMPOOL_SIZE OS_MEMPOOL_SIZE(MBUF_NUM_MBUFS, MBUF_MEMBLOCK_SIZE)
-
-static os_membuf_t blecent_mbuf_mpool_data[MBUF_MEMPOOL_SIZE];
-struct os_mbuf_pool blecent_mbuf_pool;
-struct os_mempool blecent_mbuf_mpool;
-
/** Log data. */
static struct log_handler blecent_log_console_handler;
struct log blecent_log;
-/** Priority of the nimble host and controller tasks. */
-#define BLE_LL_TASK_PRI (OS_TASK_PRI_HIGHEST)
-
/** blecent task settings. */
#define BLECENT_TASK_PRIO 1
#define BLECENT_STACK_SIZE (OS_STACK_ALIGN(336))
@@ -508,47 +489,12 @@ blecent_task_handler(void *unused)
int
main(void)
{
- struct ble_hs_cfg cfg;
- uint32_t seed;
int rc;
- int i;
/* Initialize OS */
os_init();
- /* Set cputime to count at 1 usec increments */
- rc = cputime_init(1000000);
- assert(rc == 0);
-
- /* Seed random number generator with least significant bytes of device
- * address.
- */
- seed = 0;
- for (i = 0; i < 4; ++i) {
- seed |= g_dev_addr[i];
- seed <<= 8;
- }
- srand(seed);
-
- /* Initialize msys mbufs. */
- rc = os_mempool_init(&blecent_mbuf_mpool, MBUF_NUM_MBUFS,
- MBUF_MEMBLOCK_SIZE, blecent_mbuf_mpool_data,
- "blecent_mbuf_data");
- assert(rc == 0);
-
- rc = os_mbuf_pool_init(&blecent_mbuf_pool, &blecent_mbuf_mpool,
- MBUF_MEMBLOCK_SIZE, MBUF_NUM_MBUFS);
- assert(rc == 0);
-
- rc = os_msys_register(&blecent_mbuf_pool);
- assert(rc == 0);
-
- /* Initialize the console (for log output). */
- rc = console_init(NULL);
- assert(rc == 0);
-
- /* Initialize the logging system. */
- log_init();
+ /* Initialize the blecent log. */
log_console_handler_init(&blecent_log_console_handler);
log_register("blecent", &blecent_log, &blecent_log_console_handler);
@@ -562,39 +508,15 @@ main(void)
NULL, BLECENT_TASK_PRIO, OS_WAIT_FOREVER,
blecent_stack, BLECENT_STACK_SIZE);
- /* Initialize the BLE LL */
- rc = ble_ll_init(BLE_LL_TASK_PRI, MBUF_NUM_MBUFS, BLE_MBUF_PAYLOAD_SIZE);
- assert(rc == 0);
-
- /* Initialize the RAM HCI transport. */
- rc = ble_hci_ram_init(&ble_hci_ram_cfg_dflt);
- assert(rc == 0);
-
/* Configure the host. */
- cfg = ble_hs_cfg_dflt;
- cfg.max_hci_bufs = 3;
- cfg.max_gattc_procs = 5;
- cfg.sm_bonding = 1;
- cfg.sm_our_key_dist = BLE_SM_PAIR_KEY_DIST_ENC;
- cfg.sm_their_key_dist = BLE_SM_PAIR_KEY_DIST_ENC;
- cfg.reset_cb = blecent_on_reset;
- cfg.sync_cb = blecent_on_sync;
- cfg.store_read_cb = ble_store_ram_read;
- cfg.store_write_cb = ble_store_ram_write;
-
- /* Initialize GATT services. */
- rc = ble_svc_gap_init(&cfg);
- assert(rc == 0);
-
- rc = ble_svc_gatt_init(&cfg);
- assert(rc == 0);
-
- /* Initialize the BLE host. */
- rc = ble_hs_init(&blecent_evq, &cfg);
- assert(rc == 0);
+ ble_hs_cfg.parent_evq = &blecent_evq;
+ ble_hs_cfg.reset_cb = blecent_on_reset;
+ ble_hs_cfg.sync_cb = blecent_on_sync;
+ ble_hs_cfg.store_read_cb = ble_store_ram_read;
+ ble_hs_cfg.store_write_cb = ble_store_ram_write;
/* Initialize data structures to track connected peers. */
- rc = peer_init(cfg.max_connections, 64, 64, 64);
+ rc = peer_init(MYNEWT_VAL(BLE_MAX_CONNECTIONS), 64, 64, 64);
assert(rc == 0);
/* Set the default device name. */
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/d98ddc1c/apps/blehci/src/main.c
----------------------------------------------------------------------
diff --git a/apps/blehci/src/main.c b/apps/blehci/src/main.c
index 20fc4bc..5c3f7f4 100755
--- a/apps/blehci/src/main.c
+++ b/apps/blehci/src/main.c
@@ -18,67 +18,19 @@
*/
#include <assert.h>
#include "os/os.h"
-#include "hal/hal_cputime.h"
-#include "hal/hal_uart.h"
-
-/* BLE */
-#include "nimble/ble.h"
-#include "controller/ble_ll.h"
-#include "transport/uart/ble_hci_uart.h"
-
-/* Nimble task priorities */
-#define BLE_LL_TASK_PRI (OS_TASK_PRI_HIGHEST)
-
-/* Create a mbuf pool of BLE mbufs */
-#define MBUF_NUM_MBUFS (7)
-#define MBUF_BUF_SIZE OS_ALIGN(BLE_MBUF_PAYLOAD_SIZE, 4)
-#define MBUF_MEMBLOCK_SIZE (MBUF_BUF_SIZE + BLE_MBUF_MEMBLOCK_OVERHEAD)
-#define MBUF_MEMPOOL_SIZE OS_MEMPOOL_SIZE(MBUF_NUM_MBUFS, MBUF_MEMBLOCK_SIZE)
/* Our global device address (public) */
-uint8_t g_dev_addr[BLE_DEV_ADDR_LEN] = { 0 };
+uint8_t g_dev_addr[6] = { 0 };
/* Our random address (in case we need it) */
-uint8_t g_random_addr[BLE_DEV_ADDR_LEN] = { 0 };
-
-#define HCI_MAX_BUFS (5)
-
-os_membuf_t default_mbuf_mpool_data[MBUF_MEMPOOL_SIZE];
-
-struct os_mbuf_pool default_mbuf_pool;
-struct os_mempool default_mbuf_mpool;
+uint8_t g_random_addr[6] = { 0 };
int
main(void)
{
- int rc;
-
/* Initialize OS */
os_init();
- /* Set cputime to count at 1 usec increments */
- rc = cputime_init(1000000);
- assert(rc == 0);
-
- rc = os_mempool_init(&default_mbuf_mpool, MBUF_NUM_MBUFS,
- MBUF_MEMBLOCK_SIZE, default_mbuf_mpool_data,
- "default_mbuf_data");
- assert(rc == 0);
-
- rc = os_mbuf_pool_init(&default_mbuf_pool, &default_mbuf_mpool,
- MBUF_MEMBLOCK_SIZE, MBUF_NUM_MBUFS);
- assert(rc == 0);
-
- rc = os_msys_register(&default_mbuf_pool);
- assert(rc == 0);
-
- /* Initialize the BLE LL */
- rc = ble_ll_init(BLE_LL_TASK_PRI, MBUF_NUM_MBUFS, BLE_MBUF_PAYLOAD_SIZE);
- assert(rc == 0);
-
- rc = ble_hci_uart_init(&ble_hci_uart_cfg_dflt);
- assert(rc == 0);
-
/* Start the OS */
os_start();
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/d98ddc1c/apps/bleprph/pkg.yml
----------------------------------------------------------------------
diff --git a/apps/bleprph/pkg.yml b/apps/bleprph/pkg.yml
index 7c45ee2..42c89d0 100644
--- a/apps/bleprph/pkg.yml
+++ b/apps/bleprph/pkg.yml
@@ -34,14 +34,22 @@ pkg.deps:
- libs/baselibc
- libs/newtmgr
- libs/newtmgr/transport/ble
+ - sys/sysinit
-pkg.cflags:
+pkg.syscfg_vals:
# Use INFO log level to reduce code size. DEBUG is too large for nRF51.
- - "-DLOG_LEVEL=1"
+ LOG_LEVEL: 1
- # Disable unused roles; bleprph is a peripheral-only app.
- - "-DNIMBLE_OPT_ROLE_OBSERVER=0"
- - "-DNIMBLE_OPT_ROLE_CENTRAL=0"
+ BOOTUTIL_NFFS: 0
+ CONFIG_NFFS: 0
+
+ # Disable central and observer roles.
+ BLE_ROLE_BROADCASTER: 1
+ BLE_ROLE_CENTRAL: 0
+ BLE_ROLE_OBSERVER: 0
+ BLE_ROLE_PERIPHERAL: 1
# Disable unused eddystone feature.
- - "-DNIMBLE_OPT_EDDYSTONE=0"
+ BLE_EDDYSTONE: 0
+
+ BLE_SM: 0
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/d98ddc1c/apps/bleprph/src/bleprph.h
----------------------------------------------------------------------
diff --git a/apps/bleprph/src/bleprph.h b/apps/bleprph/src/bleprph.h
index 2e3c539..8db1dc7 100644
--- a/apps/bleprph/src/bleprph.h
+++ b/apps/bleprph/src/bleprph.h
@@ -42,7 +42,7 @@ extern struct log bleprph_log;
#define GATT_SVR_CHR_ALERT_NOT_CTRL_PT 0x2A44
void gatt_svr_register_cb(struct ble_gatt_register_ctxt *ctxt, void *arg);
-int gatt_svr_init(struct ble_hs_cfg *cfg);
+int gatt_svr_init(void);
/** Misc. */
void print_bytes(const uint8_t *bytes, int len);
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/d98ddc1c/apps/bleprph/src/gatt_svr.c
----------------------------------------------------------------------
diff --git a/apps/bleprph/src/gatt_svr.c b/apps/bleprph/src/gatt_svr.c
index 061db76..c71a43a 100644
--- a/apps/bleprph/src/gatt_svr.c
+++ b/apps/bleprph/src/gatt_svr.c
@@ -316,11 +316,11 @@ gatt_svr_register_cb(struct ble_gatt_register_ctxt *ctxt, void *arg)
}
int
-gatt_svr_init(struct ble_hs_cfg *cfg)
+gatt_svr_init(void)
{
int rc;
- rc = ble_gatts_count_cfg(gatt_svr_svcs, cfg);
+ rc = ble_gatts_count_cfg(gatt_svr_svcs);
if (rc != 0) {
return rc;
}
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/d98ddc1c/apps/bleprph/src/main.c
----------------------------------------------------------------------
diff --git a/apps/bleprph/src/main.c b/apps/bleprph/src/main.c
index 9d75a66..9af8006 100755
--- a/apps/bleprph/src/main.c
+++ b/apps/bleprph/src/main.c
@@ -32,67 +32,25 @@
/* BLE */
#include "nimble/ble.h"
#include "host/ble_hs.h"
-#include "host/ble_hs_adv.h"
-#include "host/ble_uuid.h"
-#include "host/ble_att.h"
-#include "host/ble_gap.h"
-#include "host/ble_gatt.h"
-#include "host/ble_l2cap.h"
-#include "host/ble_sm.h"
-#include "controller/ble_ll.h"
-
-/* RAM HCI transport. */
-#include "transport/ram/ble_hci_ram.h"
-
-/* RAM persistence layer. */
-#include "store/ram/ble_store_ram.h"
-
-/* Mandatory services. */
#include "services/mandatory/ble_svc_gap.h"
-#include "services/mandatory/ble_svc_gatt.h"
-
-/* Newtmgr include */
-#include "newtmgr/newtmgr.h"
-#include "nmgrble/newtmgr_ble.h"
/* Application-specified header. */
#include "bleprph.h"
-/** Mbuf settings. */
-#define MBUF_NUM_MBUFS (12)
-#define MBUF_BUF_SIZE OS_ALIGN(BLE_MBUF_PAYLOAD_SIZE, 4)
-#define MBUF_MEMBLOCK_SIZE (MBUF_BUF_SIZE + BLE_MBUF_MEMBLOCK_OVERHEAD)
-#define MBUF_MEMPOOL_SIZE OS_MEMPOOL_SIZE(MBUF_NUM_MBUFS, MBUF_MEMBLOCK_SIZE)
-
-static os_membuf_t bleprph_mbuf_mpool_data[MBUF_MEMPOOL_SIZE];
-struct os_mbuf_pool bleprph_mbuf_pool;
-struct os_mempool bleprph_mbuf_mpool;
+#include "nmgrble/newtmgr_ble.h"
/** Log data. */
static struct log_handler bleprph_log_console_handler;
struct log bleprph_log;
-/** Priority of the nimble host and controller tasks. */
-#define BLE_LL_TASK_PRI (OS_TASK_PRI_HIGHEST)
-
/** bleprph task settings. */
#define BLEPRPH_TASK_PRIO 1
#define BLEPRPH_STACK_SIZE (OS_STACK_ALIGN(336))
-#define NEWTMGR_TASK_PRIO (4)
-#define NEWTMGR_TASK_STACK_SIZE (OS_STACK_ALIGN(512))
-os_stack_t newtmgr_stack[NEWTMGR_TASK_STACK_SIZE];
-
struct os_eventq bleprph_evq;
struct os_task bleprph_task;
bssnz_t os_stack_t bleprph_stack[BLEPRPH_STACK_SIZE];
-/** Our global device address (public) */
-uint8_t g_dev_addr[BLE_DEV_ADDR_LEN] = {0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a};
-
-/** Our random address (in case we need it) */
-uint8_t g_random_addr[BLE_DEV_ADDR_LEN];
-
static int bleprph_gap_event(struct ble_gap_event *event, void *arg);
/**
@@ -332,47 +290,15 @@ bleprph_task_handler(void *unused)
int
main(void)
{
- struct ble_hs_cfg cfg;
- uint32_t seed;
int rc;
- int i;
+
+ /* Set initial BLE device address. */
+ memcpy(g_dev_addr, (uint8_t[6]){0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a}, 6);
/* Initialize OS */
os_init();
- /* Set cputime to count at 1 usec increments */
- rc = cputime_init(1000000);
- assert(rc == 0);
-
- /* Seed random number generator with least significant bytes of device
- * address.
- */
- seed = 0;
- for (i = 0; i < 4; ++i) {
- seed |= g_dev_addr[i];
- seed <<= 8;
- }
- srand(seed);
-
- /* Initialize msys mbufs. */
- rc = os_mempool_init(&bleprph_mbuf_mpool, MBUF_NUM_MBUFS,
- MBUF_MEMBLOCK_SIZE, bleprph_mbuf_mpool_data,
- "bleprph_mbuf_data");
- assert(rc == 0);
-
- rc = os_mbuf_pool_init(&bleprph_mbuf_pool, &bleprph_mbuf_mpool,
- MBUF_MEMBLOCK_SIZE, MBUF_NUM_MBUFS);
- assert(rc == 0);
-
- rc = os_msys_register(&bleprph_mbuf_pool);
- assert(rc == 0);
-
- /* Initialize the console (for log output). */
- rc = console_init(NULL);
- assert(rc == 0);
-
- /* Initialize the logging system. */
- log_init();
+ /* Initialize the bleprph log. */
log_console_handler_init(&bleprph_log_console_handler);
log_register("bleprph", &bleprph_log, &bleprph_log_console_handler);
@@ -386,46 +312,15 @@ main(void)
NULL, BLEPRPH_TASK_PRIO, OS_WAIT_FOREVER,
bleprph_stack, BLEPRPH_STACK_SIZE);
- /* Initialize the BLE LL */
- rc = ble_ll_init(BLE_LL_TASK_PRI, MBUF_NUM_MBUFS, BLE_MBUF_PAYLOAD_SIZE);
- assert(rc == 0);
-
- /* Initialize the RAM HCI transport. */
- rc = ble_hci_ram_init(&ble_hci_ram_cfg_dflt);
- assert(rc == 0);
-
/* Initialize the NimBLE host configuration. */
- cfg = ble_hs_cfg_dflt;
- cfg.max_gattc_procs = 2;
- cfg.sm_bonding = 1;
- cfg.sm_our_key_dist = BLE_SM_PAIR_KEY_DIST_ENC;
- cfg.sm_their_key_dist = BLE_SM_PAIR_KEY_DIST_ENC;
- cfg.reset_cb = bleprph_on_reset;
- cfg.sync_cb = bleprph_on_sync;
- cfg.store_read_cb = ble_store_ram_read;
- cfg.store_write_cb = ble_store_ram_write;
- cfg.gatts_register_cb = gatt_svr_register_cb;
-
- /* Initialize GATT services. */
- rc = ble_svc_gap_init(&cfg);
- assert(rc == 0);
-
- rc = ble_svc_gatt_init(&cfg);
- assert(rc == 0);
-
- rc = nmgr_ble_gatt_svr_init(&bleprph_evq, &cfg);
- assert(rc == 0);
-
- rc = gatt_svr_init(&cfg);
- assert(rc == 0);
+ ble_hs_cfg.parent_evq = &bleprph_evq;
+ ble_hs_cfg.reset_cb = bleprph_on_reset;
+ ble_hs_cfg.sync_cb = bleprph_on_sync;
+ ble_hs_cfg.gatts_register_cb = gatt_svr_register_cb;
- /* Initialize NimBLE host. */
- rc = ble_hs_init(&bleprph_evq, &cfg);
+ rc = gatt_svr_init();
assert(rc == 0);
- nmgr_task_init(NEWTMGR_TASK_PRIO, newtmgr_stack, NEWTMGR_TASK_STACK_SIZE);
- imgmgr_module_init();
-
/* Set the default device name. */
rc = ble_svc_gap_device_name_set("nimble-bleprph");
assert(rc == 0);
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/d98ddc1c/apps/bletest/pkg.yml
----------------------------------------------------------------------
diff --git a/apps/bletest/pkg.yml b/apps/bletest/pkg.yml
index 3e94ede..c435194 100644
--- a/apps/bletest/pkg.yml
+++ b/apps/bletest/pkg.yml
@@ -38,3 +38,7 @@ pkg.deps:
- sys/log
- sys/stats
pkg.cflags: -DBLETEST
+
+pkg.syscfg_vals:
+ MSYS_1_BLOCK_COUNT: 16
+ MSYS_1_BLOCK_SIZE: 260
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/d98ddc1c/apps/bletest/src/bletest_hci.c
----------------------------------------------------------------------
diff --git a/apps/bletest/src/bletest_hci.c b/apps/bletest/src/bletest_hci.c
index 64d0270..7c8bb08 100755
--- a/apps/bletest/src/bletest_hci.c
+++ b/apps/bletest/src/bletest_hci.c
@@ -59,7 +59,7 @@ bletest_send_conn_update(uint16_t handle)
assert(rc == 0);
}
-#if (BLE_LL_CFG_FEAT_LE_ENCRYPTION == 1)
+#if (MYNEWT_VAL(BLE_LL_CFG_FEAT_LE_ENCRYPTION) == 1)
void
bletest_ltk_req_reply(uint16_t handle)
{
@@ -153,7 +153,7 @@ bletest_hci_rd_bd_addr(void)
return rc;
}
-#if (BLE_LL_CFG_FEAT_LE_ENCRYPTION == 1)
+#if (MYNEWT_VAL(BLE_LL_CFG_FEAT_LE_ENCRYPTION) == 1)
int
bletest_hci_le_encrypt(uint8_t *key, uint8_t *pt)
{
@@ -372,7 +372,7 @@ bletest_hci_le_set_adv_data(uint8_t *data, uint8_t len)
return ble_hs_hci_cmd_tx_empty_ack(buf);
}
-#if (BLE_LL_CFG_FEAT_LE_ENCRYPTION == 1)
+#if (MYNEWT_VAL(BLE_LL_CFG_FEAT_LE_ENCRYPTION) == 1)
int
bletest_hci_le_start_encrypt(struct hci_start_encrypt *cmd)
{
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/d98ddc1c/apps/bletest/src/bletest_priv.h
----------------------------------------------------------------------
diff --git a/apps/bletest/src/bletest_priv.h b/apps/bletest/src/bletest_priv.h
index 28f3074..05d03d1 100644
--- a/apps/bletest/src/bletest_priv.h
+++ b/apps/bletest/src/bletest_priv.h
@@ -22,7 +22,7 @@
void bletest_send_conn_update(uint16_t handle);
-#if (BLE_LL_CFG_FEAT_LE_ENCRYPTION == 1)
+#if (MYNEWT_VAL(BLE_LL_CFG_FEAT_LE_ENCRYPTION) == 1)
void bletest_ltk_req_reply(uint16_t handle);
int bletest_send_ltk_req_neg_reply(uint16_t handle);
int bletest_send_ltk_req_reply(uint16_t handle);
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/d98ddc1c/apps/bletest/src/main.c
----------------------------------------------------------------------
diff --git a/apps/bletest/src/main.c b/apps/bletest/src/main.c
index c2635dd..70b68dd 100755
--- a/apps/bletest/src/main.c
+++ b/apps/bletest/src/main.c
@@ -54,23 +54,7 @@
#include "../src/ble_hs_priv.h"
#include "bletest_priv.h"
-/* Task priorities */
-#define BLE_LL_TASK_PRI (OS_TASK_PRI_HIGHEST)
-#define HOST_TASK_PRIO (OS_TASK_PRI_HIGHEST + 1)
-#define BLETEST_TASK_PRIO (HOST_TASK_PRIO + 1)
-#define SHELL_TASK_PRIO (BLETEST_TASK_PRIO + 1)
-#define NEWTMGR_TASK_PRIO (SHELL_TASK_PRIO + 1)
-
-/* Shell task stack */
-#define SHELL_TASK_STACK_SIZE (OS_STACK_ALIGN(256))
-os_stack_t shell_stack[SHELL_TASK_STACK_SIZE];
-
-/* Newt manager task stack */
-#define NEWTMGR_TASK_STACK_SIZE (OS_STACK_ALIGN(448))
-os_stack_t newtmgr_stack[NEWTMGR_TASK_STACK_SIZE];
-
-/* Shell maximum input line length */
-#define SHELL_MAX_INPUT_LEN (256)
+#define BLETEST_TASK_PRIO 5
/* For LED toggling */
int g_led_pin;
@@ -85,16 +69,6 @@ uint8_t g_random_addr[BLE_DEV_ADDR_LEN];
uint8_t g_host_adv_data[BLE_HCI_MAX_ADV_DATA_LEN];
uint8_t g_host_adv_len;
-/* Create a mbuf pool of BLE mbufs */
-#define MBUF_NUM_MBUFS (16)
-#define MBUF_BUF_SIZE OS_ALIGN(BLE_MBUF_PAYLOAD_SIZE, 4)
-#define MBUF_MEMBLOCK_SIZE (MBUF_BUF_SIZE + BLE_MBUF_MEMBLOCK_OVERHEAD)
-#define MBUF_MEMPOOL_SIZE OS_MEMPOOL_SIZE(MBUF_NUM_MBUFS, MBUF_MEMBLOCK_SIZE)
-
-struct os_mbuf_pool g_mbuf_pool;
-struct os_mempool g_mbuf_mempool;
-os_membuf_t g_mbuf_buffer[MBUF_MEMPOOL_SIZE];
-
/* Some application configurations */
#define BLETEST_ROLE_ADVERTISER (0)
#define BLETEST_ROLE_SCANNER (1)
@@ -190,7 +164,7 @@ const uint8_t g_ble_ll_encrypt_test_encrypted_data[16] =
0x05, 0x8e, 0x3b, 0x8e, 0x27, 0xc2, 0xc6, 0x66
};
-#if (BLE_LL_CFG_FEAT_LL_PRIVACY == 1)
+#if (MYNEWT_VAL(BLE_LL_CFG_FEAT_LL_PRIVACY) == 1)
uint8_t g_bletest_adv_irk[16] = {
0xec, 0x02, 0x34, 0xa3, 0x57, 0xc8, 0xad, 0x05,
0x34, 0x10, 0x10, 0xa6, 0x0a, 0x39, 0x7d, 0x9b
@@ -202,7 +176,7 @@ uint8_t g_bletest_init_irk[16] = {
};
#endif
-#if (BLE_LL_CFG_FEAT_LE_ENCRYPTION == 1)
+#if (MYNEWT_VAL(BLE_LL_CFG_FEAT_LE_ENCRYPTION) == 1)
/* LTK 0x4C68384139F574D836BCF34E9DFB01BF */
const uint8_t g_bletest_LTK[16] =
{
@@ -386,7 +360,7 @@ bletest_init_advertising(void)
rc = bletest_hci_le_set_adv_params(&adv);
assert(rc == 0);
-#if (BLE_LL_CFG_FEAT_LL_PRIVACY == 1)
+#if (MYNEWT_VAL(BLE_LL_CFG_FEAT_LL_PRIVACY) == 1)
if ((adv.own_addr_type > BLE_HCI_ADV_OWN_ADDR_RANDOM) ||
(BLETEST_CFG_ADV_ADDR_RES_EN == 1)) {
rc = bletest_hci_le_add_resolv_list(g_bletest_adv_irk,
@@ -432,7 +406,7 @@ bletest_init_scanner(void)
rc = ble_hs_hci_cmd_tx_empty_ack(buf);
if (rc == 0) {
add_whitelist = BLETEST_CFG_SCAN_FILT_POLICY;
-#if (BLE_LL_CFG_FEAT_LL_PRIVACY == 1)
+#if (MYNEWT_VAL(BLE_LL_CFG_FEAT_LL_PRIVACY) == 1)
if (own_addr_type > BLE_HCI_ADV_OWN_ADDR_RANDOM) {
rc = bletest_hci_le_add_resolv_list(g_bletest_init_irk,
g_bletest_adv_irk,
@@ -512,7 +486,7 @@ bletest_init_initiator(void)
assert(rc == 0);
}
-#if (BLE_LL_CFG_FEAT_LL_PRIVACY == 1)
+#if (MYNEWT_VAL(BLE_LL_CFG_FEAT_LL_PRIVACY) == 1)
if ((hcc->peer_addr_type > BLE_HCI_CONN_PEER_ADDR_RANDOM) ||
(hcc->own_addr_type > BLE_HCI_ADV_OWN_ADDR_RANDOM)) {
rc = bletest_hci_le_add_resolv_list(g_bletest_init_irk,
@@ -587,7 +561,7 @@ bletest_execute_initiator(void)
new_chan_map[4] = 0;
bletest_hci_le_set_host_chan_class(new_chan_map);
} else if (g_bletest_state == 4) {
-#if (BLE_LL_CFG_FEAT_LE_ENCRYPTION == 1)
+#if (MYNEWT_VAL(BLE_LL_CFG_FEAT_LE_ENCRYPTION) == 1)
struct hci_start_encrypt hsle;
for (i = 0; i < g_bletest_current_conns; ++i) {
if (ble_ll_conn_find_active_conn(i + 1)) {
@@ -601,7 +575,7 @@ bletest_execute_initiator(void)
}
#endif
} else if (g_bletest_state == 8) {
-#if (BLE_LL_CFG_FEAT_LE_ENCRYPTION == 1)
+#if (MYNEWT_VAL(BLE_LL_CFG_FEAT_LE_ENCRYPTION) == 1)
struct hci_start_encrypt hsle;
for (i = 0; i < g_bletest_current_conns; ++i) {
if (ble_ll_conn_find_active_conn(i + 1)) {
@@ -725,7 +699,7 @@ bletest_execute_advertiser(void)
#if (BLETEST_CONCURRENT_CONN_TEST == 1)
/* See if it is time to hand a data packet to the connection */
if ((int32_t)(os_time_get() - g_next_os_time) >= 0) {
-#if (BLE_LL_CFG_FEAT_LE_ENCRYPTION == 1)
+#if (MYNEWT_VAL(BLE_LL_CFG_FEAT_LE_ENCRYPTION) == 1)
/* Do we need to send a LTK reply? */
if (g_bletest_ltk_reply_handle) {
//bletest_send_ltk_req_neg_reply(g_bletest_ltk_reply_handle);
@@ -965,7 +939,7 @@ bletest_task_handler(void *arg)
rc = bletest_hci_le_rd_max_datalen();
assert(rc == 0);
-#if (BLE_LL_CFG_FEAT_DATA_LEN_EXT == 1)
+#if (MYNEWT_VAL(BLE_LL_CFG_FEAT_DATA_LEN_EXT) == 1)
/* Read suggested data length */
rc = bletest_hci_le_rd_sugg_datalen();
assert(rc == 0);
@@ -986,7 +960,7 @@ bletest_task_handler(void *arg)
#endif
/* Encrypt a block */
-#if (BLE_LL_CFG_FEAT_LE_ENCRYPTION == 1)
+#if (MYNEWT_VAL(BLE_LL_CFG_FEAT_LE_ENCRYPTION) == 1)
rc = bletest_hci_le_encrypt((uint8_t *)g_ble_ll_encrypt_test_key,
(uint8_t *)g_ble_ll_encrypt_test_plain_text);
assert(rc == 0);
@@ -1037,32 +1011,11 @@ bletest_task_handler(void *arg)
int
main(void)
{
- int i;
int rc;
- uint32_t seed;
-#if 0
- int cnt;
- struct nffs_area_desc descs[NFFS_AREA_MAX];
-#endif
/* Initialize OS */
os_init();
- /* Set cputime to count at 1 usec increments */
- rc = cputime_init(1000000);
- assert(rc == 0);
-
- rc = os_mempool_init(&g_mbuf_mempool, MBUF_NUM_MBUFS,
- MBUF_MEMBLOCK_SIZE, &g_mbuf_buffer[0], "mbuf_pool");
- assert(rc == 0);
-
- rc = os_mbuf_pool_init(&g_mbuf_pool, &g_mbuf_mempool, MBUF_MEMBLOCK_SIZE,
- MBUF_NUM_MBUFS);
- assert(rc == 0);
-
- rc = os_msys_register(&g_mbuf_pool);
- assert(rc == 0);
-
/* Dummy device address */
#if BLETEST_CFG_ROLE == BLETEST_ROLE_ADVERTISER
g_dev_addr[0] = 0x00;
@@ -1094,72 +1047,16 @@ main(void)
g_bletest_cur_peer_addr[5] = 0x08;
#endif
- /*
- * Seed random number generator with least significant bytes of device
- * address.
- */
- seed = 0;
- for (i = 0; i < 4; ++i) {
- seed |= g_dev_addr[i];
- seed <<= 8;
- }
- srand(seed);
+ /* Set the NimBLE host's parent event queue. */
+ ble_hs_cfg.parent_evq = &g_bletest_evq;
/* Set the led pin as an output */
g_led_pin = LED_BLINK_PIN;
hal_gpio_init_out(g_led_pin, 1);
-#if 0
- rc = hal_flash_init();
- assert(rc == 0);
-
- nffs_config.nc_num_inodes = 32;
- nffs_config.nc_num_blocks = 64;
- nffs_config.nc_num_files = 2;
- nffs_config.nc_num_dirs = 2;
- rc = nffs_init();
- assert(rc == 0);
-
- cnt = NFFS_AREA_MAX;
- rc = flash_area_to_nffs_desc(FLASH_AREA_NFFS, &cnt, descs);
- assert(rc == 0);
- if (nffs_detect(descs) == FS_ECORRUPT) {
- rc = nffs_format(descs);
- assert(rc == 0);
- }
-#endif
-
- rc = shell_task_init(SHELL_TASK_PRIO, shell_stack, SHELL_TASK_STACK_SIZE,
- SHELL_MAX_INPUT_LEN);
- assert(rc == 0);
-
- rc = nmgr_task_init(NEWTMGR_TASK_PRIO, newtmgr_stack,
- NEWTMGR_TASK_STACK_SIZE);
- assert(rc == 0);
-
-#if 0
- imgmgr_module_init();
-#endif
-
- /* Init statistics module */
- rc = stats_module_init();
- assert(rc == 0);
-
/* Initialize eventq for bletest task */
os_eventq_init(&g_bletest_evq);
- /* Initialize the BLE LL */
- rc = ble_ll_init(BLE_LL_TASK_PRI, MBUF_NUM_MBUFS, BLE_MBUF_PAYLOAD_SIZE);
- assert(rc == 0);
-
- /* Initialize host */
- rc = ble_hs_init(&g_bletest_evq, NULL);
- assert(rc == 0);
-
- /* Initialize the RAM HCI transport. */
- rc = ble_hci_ram_init(&ble_hci_ram_cfg_dflt);
- assert(rc == 0);
-
rc = os_task_init(&bletest_task, "bletest", bletest_task_handler, NULL,
BLETEST_TASK_PRIO, OS_WAIT_FOREVER, bletest_stack,
BLETEST_STACK_SIZE);
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/d98ddc1c/apps/bletiny/pkg.yml
----------------------------------------------------------------------
diff --git a/apps/bletiny/pkg.yml b/apps/bletiny/pkg.yml
index 625adc6..2eb4998 100644
--- a/apps/bletiny/pkg.yml
+++ b/apps/bletiny/pkg.yml
@@ -33,14 +33,14 @@ pkg.deps:
- libs/console/full
- libs/shell
-pkg.cflags:
- ### Disable some features to make bletiny small enough to fit on the nRF51.
- ### These features can be re-enabled in the target definition.
+### Disable some features to make bletiny small enough to fit on the nRF51.
+### These features can be re-enabled in the target definition.
+pkg.syscfg_vals:
# Set log level to info (disable debug logging).
- - "-DLOG_LEVEL=1"
+ LOG_LEVEL: 1
# Disable security manager (pairing and bonding).
- - "-DNIMBLE_OPT_SM=0"
+ BLE_SM: 0
# Disable eddystone beacons.
- - "-DNIMBLE_OPT_EDDYSTONE=0"
+ BLE_EDDYSTONE: 0
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/d98ddc1c/apps/bletiny/src/bletiny.h
----------------------------------------------------------------------
diff --git a/apps/bletiny/src/bletiny.h b/apps/bletiny/src/bletiny.h
index e24f0f0..af75bfa 100644
--- a/apps/bletiny/src/bletiny.h
+++ b/apps/bletiny/src/bletiny.h
@@ -78,7 +78,7 @@ struct bletiny_conn {
struct bletiny_svc_list svcs;
};
-extern struct bletiny_conn bletiny_conns[NIMBLE_OPT(MAX_CONNECTIONS)];
+extern struct bletiny_conn bletiny_conns[MYNEWT_VAL(BLE_MAX_CONNECTIONS)];
extern int bletiny_num_conns;
extern uint16_t nm_attr_val_handle;
@@ -190,7 +190,7 @@ int bletiny_rssi(uint16_t conn_handle, int8_t *out_rssi);
#define GATT_SVR_CHR_ALERT_NOT_CTRL_PT 0x2A44
void gatt_svr_register_cb(struct ble_gatt_register_ctxt *ctxt, void *arg);
-int gatt_svr_init(struct ble_hs_cfg *cfg);
+int gatt_svr_init(void);
/** Misc. */
void print_bytes(const uint8_t *bytes, int len);
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/d98ddc1c/apps/bletiny/src/cmd.c
----------------------------------------------------------------------
diff --git a/apps/bletiny/src/cmd.c b/apps/bletiny/src/cmd.c
index e50d6b0..7c6889a 100644
--- a/apps/bletiny/src/cmd.c
+++ b/apps/bletiny/src/cmd.c
@@ -1821,7 +1821,7 @@ cmd_wl(int argc, char **argv)
static int
cmd_write(int argc, char **argv)
{
- struct ble_gatt_attr attrs[NIMBLE_OPT(GATT_WRITE_MAX_ATTRS)] = { { 0 } };
+ struct ble_gatt_attr attrs[MYNEWT_VAL(BLE_GATT_WRITE_MAX_ATTRS)] = { { 0 } };
uint16_t attr_handle;
uint16_t conn_handle;
int total_attr_len;
@@ -2162,7 +2162,7 @@ cmd_keystore(int argc, char **argv)
static int
cmd_passkey(int argc, char **argv)
{
-#if !NIMBLE_OPT(SM)
+#if !NIMBLE_BLE_SM
return BLE_HS_ENOTSUP;
#endif
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/d98ddc1c/apps/bletiny/src/gatt_svr.c
----------------------------------------------------------------------
diff --git a/apps/bletiny/src/gatt_svr.c b/apps/bletiny/src/gatt_svr.c
index ca920e2..1a128b9 100644
--- a/apps/bletiny/src/gatt_svr.c
+++ b/apps/bletiny/src/gatt_svr.c
@@ -326,11 +326,11 @@ gatt_svr_register(void)
}
int
-gatt_svr_init(struct ble_hs_cfg *cfg)
+gatt_svr_init(void)
{
int rc;
- rc = ble_gatts_count_cfg(gatt_svr_svcs, cfg);
+ rc = ble_gatts_count_cfg(gatt_svr_svcs);
if (rc != 0) {
return rc;
}
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/d98ddc1c/apps/bletiny/src/main.c
----------------------------------------------------------------------
diff --git a/apps/bletiny/src/main.c b/apps/bletiny/src/main.c
index dbb340b..76ec1c6 100755
--- a/apps/bletiny/src/main.c
+++ b/apps/bletiny/src/main.c
@@ -21,6 +21,7 @@
#include <string.h>
#include <stdio.h>
#include <errno.h>
+#include "syscfg/syscfg.h"
#include "bsp/bsp.h"
#include "log/log.h"
#include "stats/stats.h"
@@ -63,16 +64,8 @@
#include "../src/ble_hs_atomic_priv.h"
#include "../src/ble_hs_hci_priv.h"
-/* Nimble task priorities */
-#define BLE_LL_TASK_PRI (OS_TASK_PRI_HIGHEST)
-
-#define SHELL_TASK_PRIO (3)
-#define SHELL_MAX_INPUT_LEN (256)
-#define SHELL_TASK_STACK_SIZE (OS_STACK_ALIGN(512))
-static bssnz_t os_stack_t shell_stack[SHELL_TASK_STACK_SIZE];
-
/* Our global device address (public) */
-uint8_t g_dev_addr[BLE_DEV_ADDR_LEN];
+uint8_t g_dev_addr[BLE_DEV_ADDR_LEN] = {0x0f, 0x0e, 0x0d, 0x0c, 0x0b, 0x0a};
/* Our random address (in case we need it) */
uint8_t g_random_addr[BLE_DEV_ADDR_LEN];
@@ -80,25 +73,11 @@ uint8_t g_random_addr[BLE_DEV_ADDR_LEN];
/* A buffer for host advertising data */
uint8_t g_host_adv_len;
-/** Our public address. Note: this is in reverse byte order. */
-static uint8_t bletiny_addr[6] = {0x0f, 0x0e, 0x0d, 0x0c, 0x0b, 0x0a};
-
-/* Create a mbuf pool of BLE mbufs */
-#define MBUF_NUM_MBUFS (16)
-#define MBUF_BUF_SIZE OS_ALIGN(BLE_MBUF_PAYLOAD_SIZE, 4)
-#define MBUF_MEMBLOCK_SIZE (MBUF_BUF_SIZE + BLE_MBUF_MEMBLOCK_OVERHEAD)
-#define MBUF_MEMPOOL_SIZE OS_MEMPOOL_SIZE(MBUF_NUM_MBUFS, MBUF_MEMBLOCK_SIZE)
-
-os_membuf_t default_mbuf_mpool_data[MBUF_MEMPOOL_SIZE];
-
-struct os_mbuf_pool default_mbuf_pool;
-struct os_mempool default_mbuf_mpool;
-
/* BLETINY variables */
#define BLETINY_STACK_SIZE (OS_STACK_ALIGN(512))
#define BLETINY_TASK_PRIO 1
-#if NIMBLE_OPT(ROLE_CENTRAL)
+#if MYNEWT_VAL(BLE_ROLE_CENTRAL)
#define BLETINY_MAX_SVCS 32
#define BLETINY_MAX_CHRS 64
#define BLETINY_MAX_DSCS 64
@@ -115,7 +94,7 @@ bssnz_t os_stack_t bletiny_stack[BLETINY_STACK_SIZE];
static struct log_handler bletiny_log_console_handler;
struct log bletiny_log;
-bssnz_t struct bletiny_conn bletiny_conns[NIMBLE_OPT(MAX_CONNECTIONS)];
+bssnz_t struct bletiny_conn bletiny_conns[MYNEWT_VAL(BLE_MAX_CONNECTIONS)];
int bletiny_num_conns;
static void *bletiny_svc_mem;
@@ -631,7 +610,7 @@ bletiny_conn_add(struct ble_gap_conn_desc *desc)
{
struct bletiny_conn *conn;
- assert(bletiny_num_conns < NIMBLE_OPT(MAX_CONNECTIONS));
+ assert(bletiny_num_conns < MYNEWT_VAL(BLE_MAX_CONNECTIONS));
conn = bletiny_conns + bletiny_num_conns;
bletiny_num_conns++;
@@ -659,7 +638,7 @@ bletiny_conn_delete_idx(int idx)
/* This '#if' is not strictly necessary. It is here to prevent a spurious
* warning from being reported.
*/
-#if NIMBLE_OPT(MAX_CONNECTIONS) > 1
+#if MYNEWT_VAL(BLE_MAX_CONNECTIONS) > 1
int i;
for (i = idx + 1; i < bletiny_num_conns; i++) {
bletiny_conns[i - 1] = bletiny_conns[i];
@@ -1056,8 +1035,9 @@ bletiny_tx_timer_cb(void *arg)
}
len = bletiny_tx_data.tx_len;
+
om = NULL;
- if (default_mbuf_mpool.mp_num_free >= 4) {
+ if (os_msys_num_free() >= 4) {
om = os_msys_get_pkthdr(len + 4, sizeof(struct ble_mbuf_hdr));
}
@@ -1428,7 +1408,7 @@ bletiny_l2cap_update(uint16_t conn_handle,
int
bletiny_sec_pair(uint16_t conn_handle)
{
-#if !NIMBLE_OPT(SM)
+#if !NIMBLE_BLE_SM
return BLE_HS_ENOTSUP;
#endif
@@ -1441,7 +1421,7 @@ bletiny_sec_pair(uint16_t conn_handle)
int
bletiny_sec_start(uint16_t conn_handle)
{
-#if !NIMBLE_OPT(SM)
+#if !NIMBLE_BLE_SM
return BLE_HS_ENOTSUP;
#endif
@@ -1458,7 +1438,7 @@ bletiny_sec_restart(uint16_t conn_handle,
uint64_t rand_val,
int auth)
{
-#if !NIMBLE_OPT(SM)
+#if !NIMBLE_BLE_SM
return BLE_HS_ENOTSUP;
#endif
@@ -1527,7 +1507,7 @@ bletiny_tx_start(uint16_t handle, uint16_t len, uint16_t rate, uint16_t num)
}
/* XXX: for now, must have contiguous mbuf space */
- if ((len + 4) > MBUF_BUF_SIZE) {
+ if ((len + 4) > MYNEWT_VAL_MSYS_1_BLOCK_SIZE) {
return -2;
}
@@ -1602,33 +1582,11 @@ bletiny_task_handler(void *arg)
int
main(void)
{
- struct ble_hci_ram_cfg hci_cfg;
- struct ble_hs_cfg cfg;
- uint32_t seed;
int rc;
- int i;
/* Initialize OS */
os_init();
- /* Set cputime to count at 1 usec increments */
- rc = cputime_init(1000000);
- assert(rc == 0);
-
- /* Dummy device address */
- memcpy(g_dev_addr, bletiny_addr, 6);
-
- /*
- * Seed random number generator with least significant bytes of device
- * address.
- */
- seed = 0;
- for (i = 0; i < 4; ++i) {
- seed |= g_dev_addr[i];
- seed <<= 8;
- }
- srand(seed);
-
/* Allocate some application specific memory pools. */
bletiny_svc_mem = malloc(
OS_MEMPOOL_BYTES(BLETINY_MAX_SVCS, sizeof (struct bletiny_svc)));
@@ -1657,26 +1615,7 @@ main(void)
"bletiny_dsc_pool");
assert(rc == 0);
- /* Initialize msys mbufs. */
- rc = os_mempool_init(&default_mbuf_mpool, MBUF_NUM_MBUFS,
- MBUF_MEMBLOCK_SIZE, default_mbuf_mpool_data,
- "default_mbuf_data");
- assert(rc == 0);
-
- rc = os_mbuf_pool_init(&default_mbuf_pool, &default_mbuf_mpool,
- MBUF_MEMBLOCK_SIZE, MBUF_NUM_MBUFS);
- assert(rc == 0);
-
- rc = os_msys_register(&default_mbuf_pool);
- assert(rc == 0);
-
- /* Create the shell task. */
- rc = shell_task_init(SHELL_TASK_PRIO, shell_stack, SHELL_TASK_STACK_SIZE,
- SHELL_MAX_INPUT_LEN);
- assert(rc == 0);
-
- /* Initialize the logging system. */
- log_init();
+ /* Initialize the bletiny system. */
log_console_handler_init(&bletiny_log_console_handler);
log_register("bletiny", &bletiny_log, &bletiny_log_console_handler);
@@ -1690,38 +1629,14 @@ main(void)
NULL, BLETINY_TASK_PRIO, OS_WAIT_FOREVER,
bletiny_stack, BLETINY_STACK_SIZE);
- rc = stats_module_init();
- assert(rc == 0);
-
- /* Initialize the BLE LL */
- rc = ble_ll_init(BLE_LL_TASK_PRI, MBUF_NUM_MBUFS, BLE_MBUF_PAYLOAD_SIZE);
- assert(rc == 0);
-
- /* Initialize the RAM HCI transport. */
- hci_cfg = ble_hci_ram_cfg_dflt;
- rc = ble_hci_ram_init(&hci_cfg);
- assert(rc == 0);
-
/* Initialize the NimBLE host configuration. */
- cfg = ble_hs_cfg_dflt;
- cfg.max_gattc_procs = 2;
- cfg.reset_cb = bletiny_on_reset;
- cfg.store_read_cb = ble_store_ram_read;
- cfg.store_write_cb = ble_store_ram_write;
- cfg.gatts_register_cb = gatt_svr_register_cb;
-
- /* Initialize GATT services. */
- rc = ble_svc_gap_init(&cfg);
- assert(rc == 0);
-
- rc = ble_svc_gatt_init(&cfg);
- assert(rc == 0);
-
- rc = gatt_svr_init(&cfg);
- assert(rc == 0);
+ ble_hs_cfg.parent_evq = &bletiny_evq;
+ ble_hs_cfg.reset_cb = bletiny_on_reset;
+ ble_hs_cfg.store_read_cb = ble_store_ram_read;
+ ble_hs_cfg.store_write_cb = ble_store_ram_write;
+ ble_hs_cfg.gatts_register_cb = gatt_svr_register_cb;
- /* Initialize NimBLE host. */
- rc = ble_hs_init(&bletiny_evq, &cfg);
+ rc = gatt_svr_init();
assert(rc == 0);
rc = cmd_init();
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/d98ddc1c/apps/bleuart/pkg.yml
----------------------------------------------------------------------
diff --git a/apps/bleuart/pkg.yml b/apps/bleuart/pkg.yml
index c93011b..3f51860 100644
--- a/apps/bleuart/pkg.yml
+++ b/apps/bleuart/pkg.yml
@@ -36,7 +36,7 @@ pkg.deps:
- libs/newtmgr/transport/ble
- libs/bleuart
-pkg.cflags:
+pkg.syscfg_vals:
# Disable unused roles; bleuart is a peripheral-only app.
- - "-DNIMBLE_OPT_ROLE_OBSERVER=0"
- - "-DNIMBLE_OPT_ROLE_CENTRAL=0"
+ BLE_ROLE_OBSERVER: 0
+ BLE_ROLE_CENTRAL: 0
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/d98ddc1c/apps/bleuart/src/main.c
----------------------------------------------------------------------
diff --git a/apps/bleuart/src/main.c b/apps/bleuart/src/main.c
index a530195..94c4fcd 100755
--- a/apps/bleuart/src/main.c
+++ b/apps/bleuart/src/main.c
@@ -55,28 +55,10 @@
#include "nmgrble/newtmgr_ble.h"
#include "bleuart/bleuart.h"
-/** Mbuf settings. */
-#define MBUF_NUM_MBUFS (12)
-#define MBUF_BUF_SIZE OS_ALIGN(BLE_MBUF_PAYLOAD_SIZE, 4)
-#define MBUF_MEMBLOCK_SIZE (MBUF_BUF_SIZE + BLE_MBUF_MEMBLOCK_OVERHEAD)
-#define MBUF_MEMPOOL_SIZE OS_MEMPOOL_SIZE(MBUF_NUM_MBUFS, MBUF_MEMBLOCK_SIZE)
-
-#define MAX_CONSOLE_INPUT 120
-static os_membuf_t bleuart_mbuf_mpool_data[MBUF_MEMPOOL_SIZE];
-struct os_mbuf_pool bleuart_mbuf_pool;
-struct os_mempool bleuart_mbuf_mpool;
-
-/** Priority of the nimble host and controller tasks. */
-#define BLE_LL_TASK_PRI (OS_TASK_PRI_HIGHEST)
-
/** bleuart task settings. */
#define bleuart_TASK_PRIO 1
#define bleuart_STACK_SIZE (OS_STACK_ALIGN(336))
-#define NEWTMGR_TASK_PRIO (4)
-#define NEWTMGR_TASK_STACK_SIZE (OS_STACK_ALIGN(512))
-os_stack_t newtmgr_stack[NEWTMGR_TASK_STACK_SIZE];
-
struct os_eventq bleuart_evq;
struct os_task bleuart_task;
bssnz_t os_stack_t bleuart_stack[bleuart_STACK_SIZE];
@@ -253,100 +235,27 @@ bleuart_task_handler(void *unused)
int
main(void)
{
- struct ble_hs_cfg cfg;
- uint32_t seed;
int rc;
- int i;
/* Initialize OS */
os_init();
- /* Set cputime to count at 1 usec increments */
- rc = cputime_init(1000000);
- assert(rc == 0);
-
- /* Seed random number generator with least significant bytes of device
- * address.
- */
- seed = 0;
- for (i = 0; i < 4; ++i) {
- seed |= g_dev_addr[i];
- seed <<= 8;
- }
- srand(seed);
-
- /* Initialize msys mbufs. */
- rc = os_mempool_init(&bleuart_mbuf_mpool, MBUF_NUM_MBUFS,
- MBUF_MEMBLOCK_SIZE, bleuart_mbuf_mpool_data,
- "bleuart_mbuf_data");
- assert(rc == 0);
-
- rc = os_mbuf_pool_init(&bleuart_mbuf_pool, &bleuart_mbuf_mpool,
- MBUF_MEMBLOCK_SIZE, MBUF_NUM_MBUFS);
- assert(rc == 0);
-
- rc = os_msys_register(&bleuart_mbuf_pool);
- assert(rc == 0);
-
os_task_init(&bleuart_task, "bleuart", bleuart_task_handler,
NULL, bleuart_TASK_PRIO, OS_WAIT_FOREVER,
bleuart_stack, bleuart_STACK_SIZE);
- /* Initialize the BLE LL */
- rc = ble_ll_init(BLE_LL_TASK_PRI, MBUF_NUM_MBUFS, BLE_MBUF_PAYLOAD_SIZE);
- assert(rc == 0);
-
- /* Initialize the RAM HCI transport. */
- rc = ble_hci_ram_init(&ble_hci_ram_cfg_dflt);
- assert(rc == 0);
-
/* Initialize the BLE host. */
- cfg = ble_hs_cfg_dflt;
- cfg.max_connections = 1;
- cfg.max_gattc_procs = 2;
- cfg.max_l2cap_chans = 3;
- cfg.max_l2cap_sig_procs = 1;
- cfg.sm_bonding = 1;
- cfg.sm_our_key_dist = BLE_SM_PAIR_KEY_DIST_ENC;
- cfg.sm_their_key_dist = BLE_SM_PAIR_KEY_DIST_ENC;
- cfg.sync_cb = bleuart_on_sync;
- cfg.store_read_cb = ble_store_ram_read;
- cfg.store_write_cb = ble_store_ram_write;
-
- /* Populate config with the required GATT server settings. */
- cfg.max_attrs = 0;
- cfg.max_services = 0;
- cfg.max_client_configs = 0;
-
- rc = ble_svc_gap_init(&cfg);
- assert(rc == 0);
+ ble_hs_cfg.parent_evq = &bleuart_evq;
+ ble_hs_cfg.sync_cb = bleuart_on_sync;
+ ble_hs_cfg.store_read_cb = ble_store_ram_read;
+ ble_hs_cfg.store_write_cb = ble_store_ram_write;
- rc = ble_svc_gatt_init(&cfg);
- assert(rc == 0);
-
- rc = bleuart_gatt_svr_init(&cfg);
+ rc = bleuart_gatt_svr_init();
assert(rc == 0);
/* Initialize eventq */
os_eventq_init(&bleuart_evq);
- /* Nmgr ble GATT server initialization */
- rc = nmgr_ble_gatt_svr_init(&bleuart_evq, &cfg);
- assert(rc == 0);
-
-
- rc = ble_hs_init(&bleuart_evq, &cfg);
- assert(rc == 0);
-
- bleuart_init(MAX_CONSOLE_INPUT);
-
- nmgr_task_init(NEWTMGR_TASK_PRIO, newtmgr_stack, NEWTMGR_TASK_STACK_SIZE);
- imgmgr_module_init();
-
- /* Register GATT attributes (services, characteristics, and
- * descriptors).
- */
-
/* Set the default device name. */
rc = ble_svc_gap_device_name_set("Mynewt_BLEuart");
assert(rc == 0);
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/d98ddc1c/apps/blinky/src/main.c
----------------------------------------------------------------------
diff --git a/apps/blinky/src/main.c b/apps/blinky/src/main.c
index 8d96fd0..e7736c9 100755
--- a/apps/blinky/src/main.c
+++ b/apps/blinky/src/main.c
@@ -29,15 +29,6 @@
#ifdef ARCH_sim
#include <mcu/mcu_sim.h>
#endif
-#if 0
-#include "nrf.h"
-#include "nrf_drv_saadc.h"
-#include "app_error.h"
-#endif
-
-/* Init all tasks */
-volatile int tasks_initialized;
-int init_tasks(void);
/* Task 1 */
#define TASK1_PRIO (1)
@@ -52,11 +43,6 @@ static volatile int g_task1_loops;
struct os_task task2;
os_stack_t stack2[TASK2_STACK_SIZE];
-#define SHELL_TASK_PRIO (3)
-#define SHELL_MAX_INPUT_LEN (256)
-#define SHELL_TASK_STACK_SIZE (OS_STACK_ALIGN(1024))
-os_stack_t shell_stack[SHELL_TASK_STACK_SIZE];
-
struct log_handler log_console_handler;
struct log my_log;
@@ -68,51 +54,6 @@ struct os_sem g_test_sem;
/* For LED toggling */
int g_led_pin;
-#define DEFAULT_MBUF_MPOOL_BUF_LEN (256)
-#define DEFAULT_MBUF_MPOOL_NBUFS (5)
-
-uint8_t default_mbuf_mpool_data[DEFAULT_MBUF_MPOOL_BUF_LEN *
- DEFAULT_MBUF_MPOOL_NBUFS];
-
-struct os_mbuf_pool default_mbuf_pool;
-struct os_mempool default_mbuf_mpool;
-
-#if 0
-#define SAADC_SAMPLES_IN_BUFFER (4)
-static nrf_saadc_value_t m_buffer_pool[2][SAADC_SAMPLES_IN_BUFFER];
-
-int event_finished;
-int total_events;
-
-static void
-saadc_cb(const nrf_drv_saadc_evt_t *event)
-{
- if (event->type == NRF_DRV_SAADC_EVT_DONE) {
- ++event_finished;
- }
- ++total_events;
-}
-
-void
-saadc_test(void)
-{
- ret_code_t rc;
- nrf_saadc_channel_config_t cc =
- NRF_DRV_SAADC_DEFAULT_CHANNEL_CONFIG_SE(NRF_SAADC_INPUT_AIN0);
-
- rc = nrf_drv_saadc_init(NULL, saadc_cb);
- APP_ERROR_CHECK(rc);
- rc = nrf_drv_saadc_channel_init(0, &cc);
- APP_ERROR_CHECK(rc);
-
- rc = nrf_drv_saadc_buffer_convert(m_buffer_pool[0], SAADC_SAMPLES_IN_BUFFER);
- APP_ERROR_CHECK(rc);
-
- rc = nrf_drv_saadc_buffer_convert(m_buffer_pool[1], SAADC_SAMPLES_IN_BUFFER);
- APP_ERROR_CHECK(rc);
-}
-#endif
-
void
task1_handler(void *arg)
{
@@ -136,12 +77,7 @@ task1_handler(void *arg)
/* Release semaphore to task 2 */
os_sem_release(&g_test_sem);
-
-#if 0
- nrf_drv_saadc_sample();
-#endif
}
-
}
void
@@ -163,30 +99,6 @@ task2_handler(void *arg)
}
/**
- * init_tasks
- *
- * Called by main.c after os_init(). This function performs initializations
- * that are required before tasks are running.
- *
- * @return int 0 success; error otherwise.
- */
-int
-init_tasks(void)
-{
- /* Initialize global test semaphore */
- os_sem_init(&g_test_sem, 0);
-
- os_task_init(&task1, "task1", task1_handler, NULL,
- TASK1_PRIO, OS_WAIT_FOREVER, stack1, TASK1_STACK_SIZE);
-
- os_task_init(&task2, "task2", task2_handler, NULL,
- TASK2_PRIO, OS_WAIT_FOREVER, stack2, TASK2_STACK_SIZE);
-
- tasks_initialized = 1;
- return 0;
-}
-
-/**
* main
*
* The main function for the project. This function initializes the os, calls
@@ -204,36 +116,24 @@ main(int argc, char **argv)
mcu_sim_parse_args(argc, argv);
#endif
- conf_init();
-
os_init();
- rc = os_mempool_init(&default_mbuf_mpool, DEFAULT_MBUF_MPOOL_NBUFS,
- DEFAULT_MBUF_MPOOL_BUF_LEN, default_mbuf_mpool_data,
- "default_mbuf_data");
+ /* Initialize global test semaphore */
+ rc = os_sem_init(&g_test_sem, 0);
assert(rc == 0);
- rc = os_mbuf_pool_init(&default_mbuf_pool, &default_mbuf_mpool,
- DEFAULT_MBUF_MPOOL_BUF_LEN, DEFAULT_MBUF_MPOOL_NBUFS);
+ rc = os_task_init(&task1, "task1", task1_handler, NULL,
+ TASK1_PRIO, OS_WAIT_FOREVER, stack1, TASK1_STACK_SIZE);
assert(rc == 0);
- rc = os_msys_register(&default_mbuf_pool);
+ rc = os_task_init(&task2, "task2", task2_handler, NULL,
+ TASK2_PRIO, OS_WAIT_FOREVER, stack2, TASK2_STACK_SIZE);
assert(rc == 0);
- shell_task_init(SHELL_TASK_PRIO, shell_stack, SHELL_TASK_STACK_SIZE,
- SHELL_MAX_INPUT_LEN);
-
- stats_module_init();
-
-#if 0
- saadc_test();
-#endif
- rc = init_tasks();
os_start();
/* os start should never return. If it does, this should be an error */
assert(0);
- return rc;
+ return 0;
}
-
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/d98ddc1c/apps/boot/pkg.yml
----------------------------------------------------------------------
diff --git a/apps/boot/pkg.yml b/apps/boot/pkg.yml
index 10ec482..31e2018 100644
--- a/apps/boot/pkg.yml
+++ b/apps/boot/pkg.yml
@@ -25,29 +25,37 @@ pkg.homepage: "http://mynewt.apache.org/"
pkg.keywords:
- loader
-pkg.features: bootloader
-
pkg.deps:
- sys/config
- - fs/nffs
- libs/bootutil
- libs/mbedtls
- libs/os
- libs/util
- libs/console/stub
-pkg.cflags: -DLOG_LEVEL=255
-pkg.cflags.NFFS:
- - -DNFFS_PRESENT
-pkg.cflags.FCB:
- - -DFCB_PRESENT
+pkg.deps.BOOT_NFFS:
+ - fs/nffs
+
+pkg.deps.BOOT_FCB:
+ - sys/fcb
-#
-# Define BOOT_SERIAL in target features to include serial downloader.
-# And uncomment 'libs/console/stub' from pkg.deps.
-#
pkg.deps.BOOT_SERIAL.OVERWRITE:
- libs/console/full
- libs/boot_serial
-pkg.cflags.BOOT_SERIAL:
- - -DBOOT_SERIAL
+
+pkg.syscfg_vals:
+ LOG_LEVEL: 255
+
+pkg.syscfg_defs:
+ BOOT_LOADER:
+ description: 'TBD'
+ value: 1
+ BOOT_NFFS:
+ description: 'TBD'
+ value: 1
+ BOOT_FCB:
+ description: 'TBD'
+ value: 0
+ BOOT_SERIAL:
+ description: 'TBD'
+ value: 0
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/d98ddc1c/apps/boot/src/boot.c
----------------------------------------------------------------------
diff --git a/apps/boot/src/boot.c b/apps/boot/src/boot.c
index 97a9b32..1fb70a4 100755
--- a/apps/boot/src/boot.c
+++ b/apps/boot/src/boot.c
@@ -27,16 +27,16 @@
#include <hal/hal_flash.h>
#include <config/config.h>
#include <config/config_file.h>
-#ifdef NFFS_PRESENT
+#if MYNEWT_VAL(BOOT_NFFS)
#include <fs/fs.h>
#include <nffs/nffs.h>
-#elif FCB_PRESENT
+#elif MYNEWT_VAL(BOOT_FCB)
#include <fcb/fcb.h>
#include <config/config_fcb.h>
#else
#error "Need NFFS or FCB for config storage"
#endif
-#ifdef BOOT_SERIAL
+#ifdef MYNEWT_VAL(BOOT_SERIAL)
#include <hal/hal_gpio.h>
#include <boot_serial/boot_serial.h>
#endif
@@ -58,7 +58,7 @@ static struct os_task boot_ser_task;
static os_stack_t boot_ser_stack[BOOT_SER_STACK_SZ];
#endif
-#ifdef NFFS_PRESENT
+#if MYNEWT_VAL(BOOT_NFFS)
#define MY_CONFIG_FILE "/cfg/run"
static struct conf_file my_conf = {
@@ -78,7 +78,7 @@ setup_for_nffs(void)
* be readable.
*/
cnt = NFFS_AREA_MAX;
- rc = flash_area_to_nffs_desc(FLASH_AREA_NFFS, &cnt, nffs_descs);
+ rc = nffs_misc_desc_from_flash_area(FLASH_AREA_NFFS, &cnt, nffs_descs);
assert(rc == 0);
/*
@@ -167,14 +167,14 @@ main(void)
conf_init();
-#ifdef NFFS_PRESENT
+#if MYNEWT_VAL(BOOT_NFFS)
setup_for_nffs();
-#elif FCB_PRESENT
+#elif MYNEWT_VAL(BOOT_FCB)
setup_for_fcb();
#endif
bootutil_cfg_register();
-#ifdef BOOT_SERIAL
+#if MYNEWT_VAL(BOOT_SERIAL)
/*
* Configure a GPIO as input, and compare it against expected value.
* If it matches, await for download commands from serial.
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/d98ddc1c/apps/ffs2native/src/main.c
----------------------------------------------------------------------
diff --git a/apps/ffs2native/src/main.c b/apps/ffs2native/src/main.c
index 98493b0..90bb3fb 100644
--- a/apps/ffs2native/src/main.c
+++ b/apps/ffs2native/src/main.c
@@ -666,18 +666,7 @@ main(int argc, char **argv)
}
os_init();
- if (standalone == 0) {
- rc = flash_area_to_nffs_desc(FLASH_AREA_NFFS, &cnt, area_descs);
- assert(rc == 0);
- }
-
- rc = hal_flash_init();
- assert(rc == 0);
- rc = nffs_init();
- assert(rc == 0);
-
- log_init();
log_console_handler_init(&nffs_log_console_handler);
log_register("nffs-log", &nffs_log, &nffs_log_console_handler);
@@ -698,6 +687,9 @@ main(int argc, char **argv)
return 0;
}
+ rc = nffs_misc_desc_from_flash_area(FLASH_AREA_NFFS, &cnt, area_descs);
+ assert(rc == 0);
+
if (copy_in_dir) {
/*
* Build filesystem from contents of directory
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/d98ddc1c/apps/luatest/src/main.c
----------------------------------------------------------------------
diff --git a/apps/luatest/src/main.c b/apps/luatest/src/main.c
index 9cd3d5a..f71cbe3 100755
--- a/apps/luatest/src/main.c
+++ b/apps/luatest/src/main.c
@@ -19,28 +19,14 @@
#include <assert.h>
#include <string.h>
-#include <os/os.h>
-#include <bsp/bsp.h>
-#include <hal/hal_flash.h>
-#include <console/console.h>
-#include <shell/shell.h>
-#include <elua_base/elua.h>
-#include <fs/fs.h>
-#include <nffs/nffs.h>
-#include <hal/flash_map.h>
+#include "os/os.h"
+#include "bsp/bsp.h"
+#include "elua_base/elua.h"
+#include "fs/fs.h"
#ifdef ARCH_sim
-#include <mcu/mcu_sim.h>
+#include "mcu/mcu_sim.h"
#endif
-/* Init all tasks */
-int init_tasks(void);
-
-/* Shell */
-#define SHELL_TASK_PRIO (8)
-#define SHELL_MAX_INPUT_LEN (256)
-#define SHELL_TASK_STACK_SIZE (OS_STACK_ALIGN(2048))
-static os_stack_t shell_stack[SHELL_TASK_STACK_SIZE];
-
static void
create_script_file(void)
{
@@ -62,45 +48,21 @@ create_script_file(void)
/**
* main
*
- * The main function for the project. This function initializes the os, calls
- * init_tasks to initialize tasks (and possibly other objects), then starts the
- * OS. We should not return from os start.
+ * The main function for the project. This function initializes and starts the
+ * OS. We should not return from os start.
*
* @return int NOTE: this function should never return!
*/
int
main(int argc, char **argv)
{
- int rc;
- struct nffs_area_desc descs[NFFS_AREA_MAX];
- int cnt;
-
#ifdef ARCH_sim
mcu_sim_parse_args(argc, argv);
#endif
- rc = hal_flash_init();
- assert(rc == 0);
-
/* Initialize OS */
os_init();
- /* Init tasks */
- shell_task_init(SHELL_TASK_PRIO, shell_stack, SHELL_TASK_STACK_SIZE,
- SHELL_MAX_INPUT_LEN);
-
- nffs_init();
-
- cnt = NFFS_AREA_MAX;
- rc = flash_area_to_nffs_desc(FLASH_AREA_NFFS, &cnt, descs);
- assert(rc == 0);
-
- if (nffs_detect(descs) == FS_ECORRUPT) {
- rc = nffs_format(descs);
- assert(rc == 0);
- }
-
- lua_init();
create_script_file();
/* Start the OS */
@@ -109,6 +71,5 @@ main(int argc, char **argv)
/* os start should never return. If it does, this should be an error */
assert(0);
- return rc;
+ return 0;
}
-
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/d98ddc1c/apps/sblinky/pkg.yml
----------------------------------------------------------------------
diff --git a/apps/sblinky/pkg.yml b/apps/sblinky/pkg.yml
index c45b5b4..45dfbac 100644
--- a/apps/sblinky/pkg.yml
+++ b/apps/sblinky/pkg.yml
@@ -27,18 +27,6 @@ pkg.keywords:
pkg.req_apis:
- ADC_HW_IMPL
-pkg.feature_blacklist:
- ".*": SHELL
-
-pkg.feature_whitelist:
- ".*newtmgr.*": SHELL
-
-pkg.deps.ADC_NRF51:
- - drivers/adc/adc_nrf51
-
-pkg.deps.ADC_NRF52:
- - drivers/adc/adc_nrf52
-
pkg.deps:
- libs/newtmgr
- hw/mcu/nordic
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/d98ddc1c/apps/sblinky/src/main.c
----------------------------------------------------------------------
diff --git a/apps/sblinky/src/main.c b/apps/sblinky/src/main.c
index aff72eb..f9799be 100755
--- a/apps/sblinky/src/main.c
+++ b/apps/sblinky/src/main.c
@@ -82,11 +82,6 @@ static volatile int g_task1_loops;
struct os_task task2;
os_stack_t stack2[TASK2_STACK_SIZE];
-#define SHELL_TASK_PRIO (3)
-#define SHELL_MAX_INPUT_LEN (256)
-#define SHELL_TASK_STACK_SIZE (OS_STACK_ALIGN(1024))
-os_stack_t shell_stack[SHELL_TASK_STACK_SIZE];
-
struct log_handler log_console_handler;
struct log my_log;
@@ -98,16 +93,7 @@ struct os_sem g_test_sem;
/* For LED toggling */
int g_led_pin;
-#define DEFAULT_MBUF_MPOOL_BUF_LEN (256)
-#define DEFAULT_MBUF_MPOOL_NBUFS (5)
-
-uint8_t default_mbuf_mpool_data[DEFAULT_MBUF_MPOOL_BUF_LEN *
- DEFAULT_MBUF_MPOOL_NBUFS];
-
-struct os_mbuf_pool default_mbuf_pool;
-struct os_mempool default_mbuf_mpool;
-
-#ifdef BSP_CFG_SPI_MASTER
+#if MYNEWT_VAL(SPI_MASTER)
uint8_t g_spi_tx_buf[32];
uint8_t g_spi_rx_buf[32];
@@ -145,7 +131,7 @@ sblinky_spi_tx_vals(int spi_num, uint8_t *buf, int len)
#endif
#endif
-#ifdef BSP_CFG_SPI_SLAVE
+#if MYNEWT_VAL(SPI_SLAVE)
uint8_t g_spi_tx_buf[32];
uint8_t g_spi_rx_buf[32];
@@ -179,7 +165,7 @@ sblinky_spi_cfg(int spi_num)
int spi_id;
struct hal_spi_settings my_spi;
-#ifdef BSP_CFG_SPI_MASTER
+#if MYNEWT_VAL(SPI_MASTER)
my_spi.spi_type = HAL_SPI_TYPE_MASTER;
my_spi.data_order = HAL_SPI_MSB_FIRST;
my_spi.data_mode = HAL_SPI_MODE0;
@@ -190,7 +176,7 @@ sblinky_spi_cfg(int spi_num)
spi_id = 0;
#endif
-#ifdef BSP_CFG_SPI_SLAVE
+#if MYNEWT_VAL(SPI_SLAVE)
my_spi.spi_type = HAL_SPI_TYPE_SLAVE;
my_spi.data_order = HAL_SPI_MSB_FIRST;
my_spi.data_mode = HAL_SPI_MODE0;
@@ -279,7 +265,7 @@ task1_handler(void *arg)
int rc;
struct os_task *t;
struct adc_dev *adc;
-#ifdef BSP_CFG_SPI_MASTER
+#if MYNEWT_VAL(SPI_MASTER)
int i;
uint8_t last_val;
#endif
@@ -305,7 +291,7 @@ task1_handler(void *arg)
adc_chan_config(adc, 0, &cc);
#endif
-#ifdef BSP_CFG_SPI_MASTER
+#if MYNEWT_VAL(SPI_MASTER)
/* Use SS pin for testing */
hal_gpio_init_out(SPI0_CONFIG_CSN_PIN, 1);
sblinky_spi_cfg(0);
@@ -349,7 +335,7 @@ task1_handler(void *arg)
hal_spi_enable(0);
#endif
-#ifdef BSP_CFG_SPI_SLAVE
+#if MYNEWT_VAL(SPI_SLAVE)
sblinky_spi_cfg(SPI_SLAVE_ID);
hal_spi_enable(SPI_SLAVE_ID);
@@ -387,7 +373,7 @@ task1_handler(void *arg)
++g_task1_loops;
-#ifdef BSP_CFG_SPI_MASTER
+#if MYNEWT_VAL(SPI_MASTER)
/*
* Send a spi buffer using non-blocking callbacks.
* Every other transfer should use a NULL rxbuf
@@ -410,6 +396,8 @@ task1_handler(void *arg)
#if 0
nrf_drv_saadc_sample();
#endif
+ /* Release semaphore to task 2 */
+ os_sem_release(&g_test_sem);
}
os_dev_close((struct os_dev *) adc);
@@ -418,7 +406,7 @@ task1_handler(void *arg)
void
task2_handler(void *arg)
{
-#ifdef BSP_CFG_SPI_SLAVE
+#if MYNEWT_VAL(SPI_SLAVE)
int rc;
#endif
struct os_task *t;
@@ -434,7 +422,7 @@ task2_handler(void *arg)
/* Wait for semaphore from ISR */
os_sem_pend(&g_test_sem, OS_TIMEOUT_NEVER);
-#ifdef BSP_CFG_SPI_SLAVE
+#if MYNEWT_VAL(SPI_SLAVE)
/* transmit back what we just received */
memcpy(g_spi_tx_buf, g_spi_rx_buf, 32);
rc = hal_spi_txrx(SPI_SLAVE_ID, g_spi_tx_buf, g_spi_rx_buf, 32);
@@ -485,41 +473,11 @@ main(int argc, char **argv)
mcu_sim_parse_args(argc, argv);
#endif
- conf_init();
-
os_init();
- rc = os_mempool_init(&default_mbuf_mpool, DEFAULT_MBUF_MPOOL_NBUFS,
- DEFAULT_MBUF_MPOOL_BUF_LEN, default_mbuf_mpool_data,
- "default_mbuf_data");
- assert(rc == 0);
-
- rc = os_mbuf_pool_init(&default_mbuf_pool, &default_mbuf_mpool,
- DEFAULT_MBUF_MPOOL_BUF_LEN, DEFAULT_MBUF_MPOOL_NBUFS);
- assert(rc == 0);
-
- rc = os_msys_register(&default_mbuf_pool);
- assert(rc == 0);
-
- shell_task_init(SHELL_TASK_PRIO, shell_stack, SHELL_TASK_STACK_SIZE,
- SHELL_MAX_INPUT_LEN);
-
- (void) console_init(shell_console_rx_cb);
-
- stats_module_init();
-
-#ifdef NRF52
- rc = os_dev_create((struct os_dev *) &my_dev, "adc0",
- OS_DEV_INIT_KERNEL, OS_DEV_INIT_PRIO_DEFAULT,
- nrf52_adc_dev_init, &adc_config);
- assert(rc == 0);
-#endif
-#ifdef NRF51
- rc = os_dev_create((struct os_dev *) &my_dev, "adc0",
- OS_DEV_INIT_KERNEL, OS_DEV_INIT_PRIO_DEFAULT,
- nrf51_adc_dev_init, &adc_config);
- assert(rc == 0);
-#endif
+ /* Initialize the sblinky log. */
+ log_console_handler_init(&log_console_handler);
+ log_register("sblinky", &my_log, &log_console_handler);
#if 0
saadc_test();
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/d98ddc1c/apps/slinky/pkg.yml
----------------------------------------------------------------------
diff --git a/apps/slinky/pkg.yml b/apps/slinky/pkg.yml
index 3219caa..381305f 100644
--- a/apps/slinky/pkg.yml
+++ b/apps/slinky/pkg.yml
@@ -38,11 +38,5 @@ pkg.deps:
- sys/log
- sys/stats
-pkg.cflags:
- - "-DSTATS_NAME_ENABLE=1"
-
-pkg.cflags.NFFS:
- - "-DNFFS_PRESENT"
-
-pkg.cflags.FCB:
- - "-DFCB_PRESENT"
+pkg.syscfg_vals:
+ STATS_NAMES: 1
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/d98ddc1c/apps/slinky/src/main.c
----------------------------------------------------------------------
diff --git a/apps/slinky/src/main.c b/apps/slinky/src/main.c
index 7f724e6..257a43e 100755
--- a/apps/slinky/src/main.c
+++ b/apps/slinky/src/main.c
@@ -16,6 +16,8 @@
* specific language governing permissions and limitations
* under the License.
*/
+
+#include "syscfg/syscfg.h"
#include <os/os.h>
#include <bsp/bsp.h>
#include <hal/hal_gpio.h>
@@ -27,11 +29,11 @@
#include <config/config.h>
#include <hal/flash_map.h>
#include <hal/hal_system.h>
-#ifdef NFFS_PRESENT
+#if MYNEWT_PKG_FS_FS
#include <fs/fs.h>
#include <nffs/nffs.h>
#include <config/config_file.h>
-#elif FCB_PRESENT
+#elif MYNEWT_PKG_SYS_FCB
#include <fcb/fcb.h>
#include <config/config_fcb.h>
#else
@@ -71,15 +73,6 @@ static volatile int g_task1_loops;
struct os_task task2;
os_stack_t stack2[TASK2_STACK_SIZE];
-#define SHELL_TASK_PRIO (3)
-#define SHELL_MAX_INPUT_LEN (256)
-#define SHELL_TASK_STACK_SIZE (OS_STACK_ALIGN(384))
-os_stack_t shell_stack[SHELL_TASK_STACK_SIZE];
-
-#define NEWTMGR_TASK_PRIO (4)
-#define NEWTMGR_TASK_STACK_SIZE (OS_STACK_ALIGN(896))
-os_stack_t newtmgr_stack[NEWTMGR_TASK_STACK_SIZE];
-
struct log_handler log_cbmem_handler;
struct log my_log;
@@ -101,34 +94,6 @@ STATS_NAME_START(gpio_stats)
STATS_NAME(gpio_stats, toggles)
STATS_NAME_END(gpio_stats)
-#ifdef NFFS_PRESENT
-/* configuration file */
-#define MY_CONFIG_DIR "/cfg"
-#define MY_CONFIG_FILE "/cfg/run"
-#define MY_CONFIG_MAX_LINES 32
-
-static struct conf_file my_conf = {
- .cf_name = MY_CONFIG_FILE,
- .cf_maxlines = MY_CONFIG_MAX_LINES
-};
-#elif FCB_PRESENT
-struct flash_area conf_fcb_area[NFFS_AREA_MAX + 1];
-
-static struct conf_fcb my_conf = {
- .cf_fcb.f_magic = 0xc09f6e5e,
- .cf_fcb.f_sectors = conf_fcb_area
-};
-#endif
-
-#define DEFAULT_MBUF_MPOOL_BUF_LEN (256)
-#define DEFAULT_MBUF_MPOOL_NBUFS (10)
-
-uint8_t default_mbuf_mpool_data[DEFAULT_MBUF_MPOOL_BUF_LEN *
- DEFAULT_MBUF_MPOOL_NBUFS];
-
-struct os_mbuf_pool default_mbuf_pool;
-struct os_mempool default_mbuf_mpool;
-
static char *test_conf_get(int argc, char **argv, char *val, int max_len);
static int test_conf_set(int argc, char **argv, char *val);
static int test_conf_commit(void);
@@ -276,41 +241,7 @@ init_tasks(void)
return 0;
}
-#ifdef NFFS_PRESENT
-static void
-setup_for_nffs(void)
-{
- /* NFFS_AREA_MAX is defined in the BSP-specified bsp.h header file. */
- struct nffs_area_desc descs[NFFS_AREA_MAX + 1];
- int cnt;
- int rc;
-
- /* Initialize nffs's internal state. */
- rc = nffs_init();
- assert(rc == 0);
-
- /* Convert the set of flash blocks we intend to use for nffs into an array
- * of nffs area descriptors.
- */
- cnt = NFFS_AREA_MAX;
- rc = flash_area_to_nffs_desc(FLASH_AREA_NFFS, &cnt, descs);
- assert(rc == 0);
-
- /* Attempt to restore an existing nffs file system from flash. */
- if (nffs_detect(descs) == FS_ECORRUPT) {
- /* No valid nffs instance detected; format a new one. */
- rc = nffs_format(descs);
- assert(rc == 0);
- }
-
- fs_mkdir(MY_CONFIG_DIR);
- rc = conf_file_src(&my_conf);
- assert(rc == 0);
- rc = conf_file_dst(&my_conf);
- assert(rc == 0);
-}
-
-#elif FCB_PRESENT
+#if !MYNEWT_VAL(CONFIG_NFFS)
static void
setup_for_fcb(void)
@@ -358,49 +289,19 @@ main(int argc, char **argv)
mcu_sim_parse_args(argc, argv);
#endif
- conf_init();
+ os_init();
+
rc = conf_register(&test_conf_handler);
assert(rc == 0);
- log_init();
cbmem_init(&cbmem, cbmem_buf, MAX_CBMEM_BUF);
log_cbmem_handler_init(&log_cbmem_handler, &cbmem);
log_register("log", &my_log, &log_cbmem_handler);
- os_init();
-
- rc = os_mempool_init(&default_mbuf_mpool, DEFAULT_MBUF_MPOOL_NBUFS,
- DEFAULT_MBUF_MPOOL_BUF_LEN, default_mbuf_mpool_data,
- "default_mbuf_data");
- assert(rc == 0);
-
- rc = os_mbuf_pool_init(&default_mbuf_pool, &default_mbuf_mpool,
- DEFAULT_MBUF_MPOOL_BUF_LEN, DEFAULT_MBUF_MPOOL_NBUFS);
- assert(rc == 0);
-
- rc = os_msys_register(&default_mbuf_pool);
- assert(rc == 0);
-
- rc = hal_flash_init();
- assert(rc == 0);
-
-#ifdef NFFS_PRESENT
- setup_for_nffs();
-#elif FCB_PRESENT
+#if !MYNEWT_VAL(CONFIG_NFFS)
setup_for_fcb();
#endif
- id_init();
-
- shell_task_init(SHELL_TASK_PRIO, shell_stack, SHELL_TASK_STACK_SIZE,
- SHELL_MAX_INPUT_LEN);
-
- nmgr_task_init(NEWTMGR_TASK_PRIO, newtmgr_stack, NEWTMGR_TASK_STACK_SIZE);
- imgmgr_module_init();
- bootutil_cfg_register();
-
- stats_module_init();
-
stats_init(STATS_HDR(g_stats_gpio_toggle),
STATS_SIZE_INIT_PARMS(g_stats_gpio_toggle, STATS_SIZE_32),
STATS_NAME_INIT_PARMS(gpio_stats));
@@ -409,8 +310,6 @@ main(int argc, char **argv)
flash_test_init();
- reboot_init_handler(LOG_TYPE_STORAGE, 10);
-
conf_load();
log_reboot(HARD_REBOOT);
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/d98ddc1c/apps/test/pkg.yml
----------------------------------------------------------------------
diff --git a/apps/test/pkg.yml b/apps/test/pkg.yml
index 7e05e28..5dc353a 100644
--- a/apps/test/pkg.yml
+++ b/apps/test/pkg.yml
@@ -24,8 +24,6 @@ pkg.author: "Apache Mynewt <de...@mynewt.incubator.apache.org>"
pkg.homepage: "http://mynewt.apache.org/"
pkg.keywords:
-pkg.features:
- - TEST
pkg.deps:
- fs/nffs
- libs/bootutil
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/d98ddc1c/drivers/adc/adc_nrf51/pkg.yml
----------------------------------------------------------------------
diff --git a/drivers/adc/adc_nrf51/pkg.yml b/drivers/adc/adc_nrf51/pkg.yml
index 93ee635..2f604ed 100644
--- a/drivers/adc/adc_nrf51/pkg.yml
+++ b/drivers/adc/adc_nrf51/pkg.yml
@@ -22,12 +22,7 @@ pkg.description: ADC driver for the NRF51
pkg.author: "Apache Mynewt <de...@mynewt.incubator.apache.org>"
pkg.homepage: "http://mynewt.apache.org/"
pkg.keywords:
-pkg.features:
- - ADC_NRF51
pkg.apis:
- ADC_HW_IMPL
-pkg.deps.TEST:
- - hw/hal
- - hw/mcu/nordic
+pkg.deps:
- drivers/adc
- - libs/testutil
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/d98ddc1c/drivers/adc/adc_nrf52/pkg.yml
----------------------------------------------------------------------
diff --git a/drivers/adc/adc_nrf52/pkg.yml b/drivers/adc/adc_nrf52/pkg.yml
index bf978ab..fa2eb70 100644
--- a/drivers/adc/adc_nrf52/pkg.yml
+++ b/drivers/adc/adc_nrf52/pkg.yml
@@ -22,12 +22,7 @@ pkg.description: ADC driver for the NRF52
pkg.author: "Apache Mynewt <de...@mynewt.incubator.apache.org>"
pkg.homepage: "http://mynewt.apache.org/"
pkg.keywords:
-pkg.features:
- - ADC_NRF52
pkg.apis:
- ADC_HW_IMPL
-pkg.deps.TEST:
- - hw/hal
- - hw/mcu/nordic
+pkg.deps:
- drivers/adc
- - libs/testutil
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/d98ddc1c/drivers/adc/pkg.yml
----------------------------------------------------------------------
diff --git a/drivers/adc/pkg.yml b/drivers/adc/pkg.yml
index 8b4a968..94469bc 100644
--- a/drivers/adc/pkg.yml
+++ b/drivers/adc/pkg.yml
@@ -24,7 +24,3 @@ pkg.homepage: "http://mynewt.apache.org/"
pkg.keywords:
pkg.req_apis:
- ADC_HW_IMPL
-
-pkg.deps.TEST:
- - hw/hal
- - libs/testutil
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/d98ddc1c/drivers/uart/pkg.yml
----------------------------------------------------------------------
diff --git a/drivers/uart/pkg.yml b/drivers/uart/pkg.yml
index ce6eb6a..5b95e32 100644
--- a/drivers/uart/pkg.yml
+++ b/drivers/uart/pkg.yml
@@ -25,4 +25,3 @@ pkg.keywords:
pkg.deps:
pkg.req_apis:
- UART_HW_IMPL
-
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/d98ddc1c/fs/fs/pkg.yml
----------------------------------------------------------------------
diff --git a/fs/fs/pkg.yml b/fs/fs/pkg.yml
index 64909cb..f965d43 100644
--- a/fs/fs/pkg.yml
+++ b/fs/fs/pkg.yml
@@ -26,10 +26,10 @@ pkg.keywords:
- filesystem
- ffs
-pkg.deps.SHELL:
+pkg.deps.FS_CLI:
- libs/shell
-pkg.req_apis.SHELL:
- - console
-pkg.cflags.SHELL: -DSHELL_PRESENT
-pkg.features:
- - FS
+
+pkg.syscfg_defs:
+ FS_CLI:
+ description: 'TBD'
+ value: 'MYNEWT_PKG_LIBS_SHELL'