[2/2] incubator-mynewt-core git commit: CM0 fault handler; print newline at the end of last line of output.
CM0 fault handler; print newline at the end of last line of output. 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/f0556b18 Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/f0556b18 Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/f0556b18 Branch: refs/heads/develop Commit: f0556b1887ab8e1797f4ef4ee56d0c631b69e6da Parents: 2770501 Author: Marko KiiskilaAuthored: Thu Apr 21 15:25:17 2016 -0700 Committer: Marko Kiiskila Committed: Thu Apr 21 15:37:16 2016 -0700 -- libs/os/src/arch/cortex_m0/os_fault.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/f0556b18/libs/os/src/arch/cortex_m0/os_fault.c -- diff --git a/libs/os/src/arch/cortex_m0/os_fault.c b/libs/os/src/arch/cortex_m0/os_fault.c index 4c67f6c..c46f8a8 100644 --- a/libs/os/src/arch/cortex_m0/os_fault.c +++ b/libs/os/src/arch/cortex_m0/os_fault.c @@ -81,7 +81,7 @@ os_default_irq(struct trap_frame *tf) tf->r8, tf->r9, tf->r10, tf->r11); console_printf("r12:0x%08lx lr:0x%08lx pc:0x%08lx psr:0x%08lx\n", tf->ef->r12, tf->ef->lr, tf->ef->pc, tf->ef->psr); -console_printf("ICSR:0x%08lx ",SCB->ICSR); +console_printf("ICSR:0x%08lx\n", SCB->ICSR); system_reset(); }
incubator-mynewt-core git commit: MYNEWT-284: fix nrf51 radio state errors
Repository: incubator-mynewt-core Updated Branches: refs/heads/develop 88356a0df -> 27705013e MYNEWT-284: fix nrf51 radio state errors 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/27705013 Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/27705013 Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/27705013 Branch: refs/heads/develop Commit: 27705013e505dc6b90a7a946e7ce7f8e064ef0f4 Parents: 88356a0 Author: William San FilippoAuthored: Thu Apr 21 14:46:17 2016 -0700 Committer: William San Filippo Committed: Thu Apr 21 14:46:24 2016 -0700 -- net/nimble/drivers/nrf51/src/ble_phy.c | 272 +--- net/nimble/drivers/nrf52/src/ble_phy.c | 272 +--- 2 files changed, 249 insertions(+), 295 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/27705013/net/nimble/drivers/nrf51/src/ble_phy.c -- diff --git a/net/nimble/drivers/nrf51/src/ble_phy.c b/net/nimble/drivers/nrf51/src/ble_phy.c index bc4a258..d95329a 100644 --- a/net/nimble/drivers/nrf51/src/ble_phy.c +++ b/net/nimble/drivers/nrf51/src/ble_phy.c @@ -202,6 +202,11 @@ ble_phy_rxpdu_get(void) return m; } +/** + * Called when we want to wait if the radio is in either the rx or tx + * disable states. We want to wait until that state is over before doing + * anything to the radio + */ static void nrf_wait_disabled(void) { @@ -220,112 +225,135 @@ nrf_wait_disabled(void) } } +/** + * Setup transceiver for receive. + */ static void -ble_phy_isr(void) +ble_phy_rx_xcvr_setup(void) { -int rc; -uint8_t transition; -uint8_t crcok; -uint32_t irq_en; -uint32_t state; -uint32_t wfr_time; #ifdef BLE_LL_CFG_FEAT_LE_ENCRYPTION -uint8_t *dptr; +if (g_ble_phy_data.phy_encrypted) { +NRF_RADIO->PACKETPTR = (uint32_t)_ble_phy_enc_buf[0]; +NRF_CCM->INPTR = (uint32_t)_ble_phy_enc_buf[0]; +NRF_CCM->OUTPTR = (uint32_t)g_ble_phy_data.rxpdu->om_data; +NRF_CCM->SCRATCHPTR = (uint32_t)_nrf_encrypt_scratchpad[0]; +NRF_CCM->MODE = CCM_MODE_MODE_Decryption; +NRF_CCM->CNFPTR = (uint32_t)_nrf_ccm_data; +NRF_CCM->SHORTS = 0; +NRF_CCM->EVENTS_ERROR = 0; +NRF_CCM->EVENTS_ENDCRYPT = 0; +NRF_PPI->CHENSET = PPI_CHEN_CH24_Msk | PPI_CHEN_CH25_Msk; +} else { +NRF_RADIO->PACKETPTR = (uint32_t)g_ble_phy_data.rxpdu->om_data; +} +#else +NRF_RADIO->PACKETPTR = (uint32_t)g_ble_phy_data.rxpdu->om_data; #endif -struct os_mbuf *rxpdu; -struct ble_mbuf_hdr *ble_hdr; -/* Read irq register to determine which interrupts are enabled */ -irq_en = NRF_RADIO->INTENCLR; +/* Reset the rx started flag. Used for the wait for response */ +g_ble_phy_data.phy_rx_started = 0; +g_ble_phy_data.phy_state = BLE_PHY_STATE_RX; -/* Check for disabled event. This only happens for transmits now */ -if ((irq_en & RADIO_INTENCLR_DISABLED_Msk) && NRF_RADIO->EVENTS_DISABLED) { -/* Better be in TX state! */ -assert(g_ble_phy_data.phy_state == BLE_PHY_STATE_TX); +/* I want to know when 1st byte received (after address) */ +NRF_RADIO->BCC = 8; /* in bits */ +NRF_RADIO->EVENTS_ADDRESS = 0; +NRF_RADIO->EVENTS_DEVMATCH = 0; +NRF_RADIO->EVENTS_BCMATCH = 0; +NRF_RADIO->EVENTS_RSSIEND = 0; +NRF_RADIO->SHORTS = RADIO_SHORTS_END_DISABLE_Msk | +RADIO_SHORTS_READY_START_Msk | +RADIO_SHORTS_DISABLED_TXEN_Msk | +RADIO_SHORTS_ADDRESS_BCSTART_Msk | +RADIO_SHORTS_ADDRESS_RSSISTART_Msk | +RADIO_SHORTS_DISABLED_RSSISTOP_Msk; -ble_ll_log(BLE_LL_LOG_ID_PHY_TXEND, (g_ble_phy_txrx_buf[0] >> 8) & 0xFF, - g_ble_phy_data.phy_encrypted, NRF_TIMER0->CC[2]); +NRF_RADIO->INTENSET = RADIO_INTENSET_ADDRESS_Msk; +} -/* Clear events and clear interrupt on disabled event */ -NRF_RADIO->EVENTS_DISABLED = 0; -NRF_RADIO->INTENCLR = RADIO_INTENCLR_DISABLED_Msk; -NRF_RADIO->EVENTS_END = 0; -state = NRF_RADIO->SHORTS; +/** + * Called from interrupt context when the transmit ends + * + */ +static void +ble_phy_tx_end_isr(void) +{ +uint8_t transition; +uint32_t wfr_time; + +/* Better be in TX state! */ +assert(g_ble_phy_data.phy_state == BLE_PHY_STATE_TX); + +/* Log the event */ +ble_ll_log(BLE_LL_LOG_ID_PHY_TXEND, (g_ble_phy_txrx_buf[0] >> 8) & 0xFF, + g_ble_phy_data.phy_encrypted, NRF_TIMER0->CC[2]); + +/* Clear events and clear interrupt on
incubator-mynewt-core git commit: console; instead of poking libs/os var g_os_started, use the provided API call.
Repository: incubator-mynewt-core Updated Branches: refs/heads/develop 75d322055 -> 88356a0df console; instead of poking libs/os var g_os_started, use the provided API call. 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/88356a0d Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/88356a0d Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/88356a0d Branch: refs/heads/develop Commit: 88356a0df1811e5905588116f6c7cab62764e6ad Parents: 75d3220 Author: Marko KiiskilaAuthored: Thu Apr 21 12:58:16 2016 -0700 Committer: Marko Kiiskila Committed: Thu Apr 21 12:58:16 2016 -0700 -- libs/console/full/src/cons_tty.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/88356a0d/libs/console/full/src/cons_tty.c -- diff --git a/libs/console/full/src/cons_tty.c b/libs/console/full/src/cons_tty.c index b7320be..e7057a1 100644 --- a/libs/console/full/src/cons_tty.c +++ b/libs/console/full/src/cons_tty.c @@ -102,7 +102,7 @@ console_queue_char(char ch) /* TX needs to drain */ hal_uart_start_tx(CONSOLE_UART); OS_EXIT_CRITICAL(sr); - if (g_os_started) { + if (os_started()) { os_time_delay(1); } OS_ENTER_CRITICAL(sr);
incubator-mynewt-core git commit: console; don't call os_time_delay() when OS is not running. This was asserting when there was a lot of output to console before OS starts.
Repository: incubator-mynewt-core Updated Branches: refs/heads/develop 0892fd98e -> 75d322055 console; don't call os_time_delay() when OS is not running. This was asserting when there was a lot of output to console before OS starts. 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/75d32205 Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/75d32205 Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/75d32205 Branch: refs/heads/develop Commit: 75d32205598f9e10037f6ce3feacdcf3e9a91c42 Parents: 0892fd9 Author: Marko KiiskilaAuthored: Thu Apr 21 11:04:53 2016 -0700 Committer: Marko Kiiskila Committed: Thu Apr 21 11:04:53 2016 -0700 -- libs/console/full/src/cons_tty.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/75d32205/libs/console/full/src/cons_tty.c -- diff --git a/libs/console/full/src/cons_tty.c b/libs/console/full/src/cons_tty.c index d43f4b9..b7320be 100644 --- a/libs/console/full/src/cons_tty.c +++ b/libs/console/full/src/cons_tty.c @@ -102,7 +102,9 @@ console_queue_char(char ch) /* TX needs to drain */ hal_uart_start_tx(CONSOLE_UART); OS_EXIT_CRITICAL(sr); -os_time_delay(1); + if (g_os_started) { +os_time_delay(1); + } OS_ENTER_CRITICAL(sr); } console_add_char(>ct_tx, ch);
incubator-mynewt-core git commit: changes to support APi review by Greg. Also changed the start/stop API to begin/end to differentiate from the i2c bus start/stop conditions
Repository: incubator-mynewt-core Updated Branches: refs/heads/develop 4d0a38707 -> 0892fd98e changes to support APi review by Greg. Also changed the start/stop API to begin/end to differentiate from the i2c bus start/stop conditions 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/0892fd98 Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/0892fd98 Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/0892fd98 Branch: refs/heads/develop Commit: 0892fd98e40a9cdf295fa99b1041822cc9a89519 Parents: 4d0a387 Author: Paul DietrichAuthored: Thu Apr 21 10:30:31 2016 -0700 Committer: Paul Dietrich Committed: Thu Apr 21 10:32:32 2016 -0700 -- hw/hal/include/hal/hal_i2c.h | 86 ++- hw/hal/src/hal_i2c.c | 5 +-- 2 files changed, 59 insertions(+), 32 deletions(-) -- http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/0892fd98/hw/hal/include/hal/hal_i2c.h -- diff --git a/hw/hal/include/hal/hal_i2c.h b/hw/hal/include/hal/hal_i2c.h index 82546d4..20b697d 100644 --- a/hw/hal/include/hal/hal_i2c.h +++ b/hw/hal/include/hal/hal_i2c.h @@ -20,64 +20,92 @@ #ifndef HAL_I2C_H #define HAL_I2C_H +#include +#include + #ifdef __cplusplus extern "C" { #endif -#include -#include - -/* This is the API for an i2c bus. I tried to make this a simple API */ +/* This is the API for an i2c bus. Currently, this is a master API + * allowing the mynewt device to function as an I2C master. + * + * A slave API is pending for future release + * + * Typical usage of this API is as follows: + * + * Initialize an i2c device with + * hal_i2c_init() + * + * When you with to perform an i2c transaction, issue + * hal_i2c_master_begin()l + * followed by the transaction. For example, in an I2C memory access access + * you might write and address and then read back data + * hal_i2c_write(); -- write amemory ddress to device + * hal_i2c_read(); --- read back data + * then end the transaction + * hal_i2c_end(); + */ struct hal_i2c; /* when sending a packet, use this structure to pass the arguments */ struct hal_i2c_master_data { uint8_t address; /* destination address */ -/* NOTE: Write addresses are even and read addresses are odd - * but in this API, you must enter a single address that is the - * write address divide by 2. For example, for address - * 80, you would enter a 40 */ +/* a I2C address has 7 bits. In the protocol these + * 7 bits are combined with a 1 bit R/W bit to specify read + * or write operation in an 8-bit address field sent to + * the remote device . This API accepts the 7-bit + * address as its argument in the 7 LSBs of the + * address field above. For example if I2C was + * writing a 0x81 in its protocol, you would pass + * only the top 7-bits to this function as 0x40 */ +uint16_t len; /* number of buffer bytes to transmit or receive */ uint8_t *buffer;/* buffer space to hold the transmit or receive */ -uint16_t len; /* length of buffer to transmit or receive */ }; /* Initialize a new i2c device with the given system id. - * Returns negative on error, 0 on success. */ + * Returns a pointer to the i2c device or NULL on error */ struct hal_i2c* hal_i2c_init(enum system_device_id sysid); -/* Sends bytes of data on the i2c. This API assumes that you - * issued a successful start condition. It will fail if you - * have not. This API does NOT issue a stop condition. You must stop the - * bus after successful or unsuccessful write attempts. Returns 0 on - * success, negative on failure */ +/* Sends a start condition and writes bytes of data on the i2c. + * This API assumes that you have already called hal_i2c_master_begin + * It will fail if you have not. This API does NOT issue a stop condition. + * You must stop the bus after successful or unsuccessful write attempts. + * This API is blocking until an error or NaK occurs. Timeout is platform + * dependent + * Returns 0 on success, negative on failure */ int hal_i2c_master_write(struct hal_i2c*, struct hal_i2c_master_data *pdata); -/* Reads bytes of data on the i2c. This API assumes that you - * issued a successful start condition. It will fail if you - * have not. This API does NOT issue a stop condition. You must stop the - * bus after successful or unsuccessful write attempts. Returns 0 on - * success, negative on failure */ +/* Sends a start condition and