You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by we...@apache.org on 2016/02/02 18:13:32 UTC
[1/2] incubator-mynewt-larva git commit: consolidate flags in
connection state machine to save a little space. Lower number of mbufs and
connections.
Repository: incubator-mynewt-larva
Updated Branches:
refs/heads/master 2c5ec0425 -> e6194a938
consolidate flags in connection state machine to save a little space. Lower number of mbufs and connections.
Project: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/commit/5917f1db
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/tree/5917f1db
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/diff/5917f1db
Branch: refs/heads/master
Commit: 5917f1dbe2d4f651a4aa1f44407ebf17b776939b
Parents: 2c5ec04
Author: wes3 <wi...@micosa.io>
Authored: Mon Feb 1 23:20:46 2016 -0800
Committer: wes3 <wi...@micosa.io>
Committed: Mon Feb 1 23:21:07 2016 -0800
----------------------------------------------------------------------
.../controller/include/controller/ble_ll_conn.h | 35 +++++++----
net/nimble/controller/src/ble_ll_conn.c | 66 +++++++++-----------
net/nimble/controller/src/ble_ll_conn_hci.c | 10 +--
net/nimble/controller/src/ble_ll_ctrl.c | 21 ++++---
project/bletest/src/main.c | 10 +--
5 files changed, 74 insertions(+), 68 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/blob/5917f1db/net/nimble/controller/include/controller/ble_ll_conn.h
----------------------------------------------------------------------
diff --git a/net/nimble/controller/include/controller/ble_ll_conn.h b/net/nimble/controller/include/controller/ble_ll_conn.h
index 0076e7d..9de8d32 100644
--- a/net/nimble/controller/include/controller/ble_ll_conn.h
+++ b/net/nimble/controller/include/controller/ble_ll_conn.h
@@ -55,9 +55,32 @@
*/
#define BLE_LL_EMPTY_PDU_MBUF_SIZE (BLE_MBUF_PKT_OVERHEAD / 4)
+/* Connection state machine flags. */
+union ble_ll_conn_sm_flags {
+ struct {
+ uint16_t pdu_txd:1;
+ uint16_t pkt_rxd:1;
+ uint16_t terminate_ind_txd:1;
+ uint16_t terminate_ind_rxd:1;
+ uint16_t allow_slave_latency:1;
+ uint16_t slave_set_last_anchor:1;
+ uint16_t awaiting_host_reply:1;
+ uint16_t send_conn_upd_event:1;
+ uint16_t conn_update_scheduled:1;
+ uint16_t host_expects_upd_event:1;
+ uint16_t version_ind_sent:1;
+ uint16_t rxd_version_ind:1;
+ uint16_t reserved:4;
+ } cfbit;
+ uint16_t conn_flags;
+} __attribute__((packed));
+
/* Connection state machine */
struct ble_ll_conn_sm
{
+ /* Connection state machine flags */
+ union ble_ll_conn_sm_flags csmflags;
+
/* Current connection state and role */
uint8_t conn_state;
uint8_t conn_role; /* Can possibly be 1 bit */
@@ -94,18 +117,6 @@ struct ble_ll_conn_sm
only use the MD bit now */
/* connection event mgmt */
- uint8_t pdu_txd; /* note: can be 1 bit */
- uint8_t pkt_rxd; /* note: can be 1 bit */
- uint8_t terminate_ind_txd; /* note: can be 1 bit */
- uint8_t terminate_ind_rxd; /* note: can be 1 bit */
- uint8_t allow_slave_latency; /* note: can be 1 bit */
- uint8_t slave_set_last_anchor; /* note: can be 1 bit */
- uint8_t awaiting_host_reply; /* note: can be 1 bit */
- uint8_t send_conn_upd_event; /* note: can be 1 bit */
- uint8_t conn_update_scheduled; /* note: can be 1 bit */
- uint8_t host_expects_upd_event; /* note: can be 1 bit */
- uint8_t version_ind_sent; /* note: can be 1 bit */
- uint8_t rxd_version_ind; /* not can be 1 bit */
uint8_t reject_reason;
uint8_t host_reply_opcode;
uint8_t master_sca;
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/blob/5917f1db/net/nimble/controller/src/ble_ll_conn.c
----------------------------------------------------------------------
diff --git a/net/nimble/controller/src/ble_ll_conn.c b/net/nimble/controller/src/ble_ll_conn.c
index 8039201..5eb0aa3 100644
--- a/net/nimble/controller/src/ble_ll_conn.c
+++ b/net/nimble/controller/src/ble_ll_conn.c
@@ -103,7 +103,7 @@ extern int ble_hs_rx_data(struct os_mbuf *om);
#define BLE_LL_CFG_CONN_TX_WIN_SIZE (1)
#define BLE_LL_CFG_CONN_TX_WIN_OFF (0)
#define BLE_LL_CFG_CONN_MASTER_SCA (BLE_MASTER_SCA_51_75_PPM << 5)
-#define BLE_LL_CFG_CONN_MAX_CONNS (32)
+#define BLE_LL_CFG_CONN_MAX_CONNS (4)
#define BLE_LL_CFG_CONN_OUR_SCA (60) /* in ppm */
#define BLE_LL_CFG_CONN_INIT_SLOTS (4)
@@ -142,7 +142,7 @@ struct ble_ll_conn_sm *g_ble_ll_conn_create_sm;
struct ble_ll_conn_sm *g_ble_ll_conn_cur_sm;
/* Connection state machine array */
-sec_bss_nz_core struct ble_ll_conn_sm g_ble_ll_conn_sm[BLE_LL_CFG_CONN_MAX_CONNS];
+bssnz_t struct ble_ll_conn_sm g_ble_ll_conn_sm[BLE_LL_CFG_CONN_MAX_CONNS];
/* List of active connections */
struct ble_ll_conn_active_list g_ble_ll_conn_active_list;
@@ -633,7 +633,7 @@ ble_ll_conn_tx_data_pdu(struct ble_ll_conn_sm *connsm, int beg_transition)
if ((nextpkthdr ||
((ble_hdr->txinfo.offset + cur_txlen) < pkthdr->omp_len)) &&
- !connsm->terminate_ind_rxd) {
+ !connsm->csmflags.cfbit.terminate_ind_rxd) {
md = 1;
if (connsm->conn_role == BLE_LL_CONN_ROLE_MASTER) {
/*
@@ -695,7 +695,7 @@ ble_ll_conn_tx_data_pdu(struct ble_ll_conn_sm *connsm, int beg_transition)
* received a valid frame with the more data bit set to 0 and we dont
* have more data.
*/
- if ((connsm->terminate_ind_rxd) ||
+ if ((connsm->csmflags.cfbit.terminate_ind_rxd) ||
((connsm->conn_role == BLE_LL_CONN_ROLE_SLAVE) && (md == 0) &&
(connsm->cons_rxd_bad_crc == 0) &&
((connsm->last_rxd_hdr_byte & BLE_LL_DATA_HDR_MD_MASK) == 0) &&
@@ -721,7 +721,7 @@ ble_ll_conn_tx_data_pdu(struct ble_ll_conn_sm *connsm, int beg_transition)
(uint32_t)m);
/* Set flag denoting we transmitted a pdu */
- connsm->pdu_txd = 1;
+ connsm->csmflags.cfbit.pdu_txd = 1;
/* Set last transmitted MD bit */
connsm->last_txd_md = md;
@@ -796,7 +796,7 @@ ble_ll_conn_event_start_cb(struct ble_ll_sched_item *sch)
* Set flag that tells slave to set last anchor point if a packet
* has been received.
*/
- connsm->slave_set_last_anchor = 1;
+ connsm->csmflags.cfbit.slave_set_last_anchor = 1;
/*
* Set the wait for response time. The anchor point is when we
@@ -976,22 +976,14 @@ ble_ll_conn_sm_new(struct ble_ll_conn_sm *connsm)
struct ble_ll_conn_global_params *conn_params;
/* Reset following elements */
+ connsm->csmflags.conn_flags = 0;
connsm->event_cntr = 0;
connsm->conn_state = BLE_LL_CONN_STATE_IDLE;
- connsm->allow_slave_latency = 0;
connsm->disconnect_reason = 0;
- connsm->terminate_ind_txd = 0;
- connsm->terminate_ind_rxd = 0;
- connsm->awaiting_host_reply = 0;
- connsm->send_conn_upd_event = 0;
- connsm->conn_update_scheduled = 0;
- connsm->host_expects_upd_event = 0;
- connsm->version_ind_sent = 0;
connsm->common_features = 0;
connsm->vers_nr = 0;
connsm->comp_id = 0;
connsm->sub_vers_nr = 0;
- connsm->rxd_version_ind = 0;
connsm->reject_reason = BLE_ERR_SUCCESS;
/* Reset current control procedure */
@@ -1204,7 +1196,7 @@ ble_ll_conn_next_event(struct ble_ll_conn_sm *connsm)
* has passed the instant.
* 2) We successfully sent the reject reason.
*/
- if (connsm->host_expects_upd_event) {
+ if (connsm->csmflags.cfbit.host_expects_upd_event) {
update_status = BLE_ERR_SUCCESS;
if (IS_PENDING_CTRL_PROC(connsm, BLE_LL_CTRL_PROC_CONN_UPDATE)) {
ble_ll_ctrl_proc_stop(connsm, BLE_LL_CTRL_PROC_CONN_UPDATE);
@@ -1215,7 +1207,7 @@ ble_ll_conn_next_event(struct ble_ll_conn_sm *connsm)
}
}
ble_ll_hci_ev_conn_update(connsm, update_status);
- connsm->host_expects_upd_event = 0;
+ connsm->csmflags.cfbit.host_expects_upd_event = 0;
}
/*
@@ -1228,8 +1220,9 @@ ble_ll_conn_next_event(struct ble_ll_conn_sm *connsm)
/* Set event counter to the next connection event that we will tx/rx in */
itvl = connsm->conn_itvl * BLE_LL_CONN_ITVL_USECS;
latency = 1;
- if (connsm->allow_slave_latency && !connsm->conn_update_scheduled) {
- if (connsm->pkt_rxd) {
+ if (connsm->csmflags.cfbit.allow_slave_latency &&
+ !connsm->csmflags.cfbit.conn_update_scheduled) {
+ if (connsm->csmflags.cfbit.pkt_rxd) {
latency += connsm->slave_latency;
itvl = itvl * latency;
}
@@ -1245,7 +1238,7 @@ ble_ll_conn_next_event(struct ble_ll_conn_sm *connsm)
* connection by the the transmit window offset. We also copy in the
* update parameters as they now should take effect.
*/
- if (connsm->conn_update_scheduled &&
+ if (connsm->csmflags.cfbit.conn_update_scheduled &&
(connsm->event_cntr == connsm->conn_update_req.instant)) {
/* Set flag so we send connection update event */
@@ -1254,7 +1247,7 @@ ble_ll_conn_next_event(struct ble_ll_conn_sm *connsm)
(connsm->conn_itvl != upd->interval) ||
(connsm->slave_latency != upd->latency) ||
(connsm->supervision_tmo != upd->timeout)) {
- connsm->host_expects_upd_event = 1;
+ connsm->csmflags.cfbit.host_expects_upd_event = 1;
}
connsm->conn_itvl = upd->interval;
@@ -1275,7 +1268,7 @@ ble_ll_conn_next_event(struct ble_ll_conn_sm *connsm)
cputime_timer_start(&connsm->conn_spvn_timer, connsm->anchor_point+tmo);
/* Reset update scheduled flag */
- connsm->conn_update_scheduled = 0;
+ connsm->csmflags.cfbit.conn_update_scheduled = 0;
}
/* Calculate data channel index of next connection event */
@@ -1347,7 +1340,7 @@ ble_ll_conn_created(struct ble_ll_conn_sm *connsm, uint32_t endtime)
cputime_timer_relative(&connsm->conn_spvn_timer, usecs);
/* Clear packet received flag */
- connsm->pkt_rxd = 0;
+ connsm->csmflags.cfbit.pkt_rxd = 0;
/* Consider time created the last scheduled time */
connsm->last_scheduled = cputime_get32();
@@ -1427,8 +1420,9 @@ ble_ll_conn_event_end(void *arg)
connsm->ce_end_time);
/* If we have transmitted the terminate IND successfully, we are done */
- if ((connsm->terminate_ind_txd) || (connsm->terminate_ind_rxd)) {
- if (connsm->terminate_ind_txd) {
+ if ((connsm->csmflags.cfbit.terminate_ind_txd) ||
+ (connsm->csmflags.cfbit.terminate_ind_rxd)) {
+ if (connsm->csmflags.cfbit.terminate_ind_txd) {
ble_err = BLE_ERR_CONN_TERM_LOCAL;
} else {
/* Make sure the disconnect reason is valid! */
@@ -1448,7 +1442,7 @@ ble_ll_conn_event_end(void *arg)
* If we have received a packet, we can set the current transmit window
* usecs to 0 since we dont need to listen in the transmit window.
*/
- if (connsm->pkt_rxd) {
+ if (connsm->csmflags.cfbit.pkt_rxd) {
connsm->slave_cur_tx_win_usecs = 0;
}
@@ -1460,7 +1454,7 @@ ble_ll_conn_event_end(void *arg)
/* Reset "per connection event" variables */
connsm->cons_rxd_bad_crc = 0;
- connsm->pkt_rxd = 0;
+ connsm->csmflags.cfbit.pkt_rxd = 0;
/* See if we need to start any control procedures */
ble_ll_ctrl_chk_proc_start(connsm);
@@ -1587,7 +1581,7 @@ ble_ll_conn_event_halt(void)
{
ble_ll_state_set(BLE_LL_STATE_STANDBY);
if (g_ble_ll_conn_cur_sm) {
- g_ble_ll_conn_cur_sm->pkt_rxd = 0;
+ g_ble_ll_conn_cur_sm->csmflags.cfbit.pkt_rxd = 0;
ble_ll_event_send(&g_ble_ll_conn_cur_sm->conn_ev_end);
g_ble_ll_conn_cur_sm = NULL;
}
@@ -1822,7 +1816,7 @@ ble_ll_conn_rx_isr_start(void)
ble_ll_wfr_disable();
connsm = g_ble_ll_conn_cur_sm;
if (connsm) {
- connsm->pkt_rxd = 1;
+ connsm->csmflags.cfbit.pkt_rxd = 1;
}
}
@@ -1877,7 +1871,7 @@ ble_ll_conn_rx_data_pdu(struct os_mbuf *rxpdu, struct ble_mbuf_hdr *hdr)
*/
if (connsm->conn_role == BLE_LL_CONN_ROLE_SLAVE) {
if (hdr_byte & BLE_LL_DATA_HDR_NESN_MASK) {
- connsm->allow_slave_latency = 1;
+ connsm->csmflags.cfbit.allow_slave_latency = 1;
}
}
@@ -2031,7 +2025,7 @@ ble_ll_conn_rx_isr_end(struct os_mbuf *rxpdu, uint32_t aa)
* Check NESN bit from header. If same as tx seq num, the transmission
* is acknowledged. Otherwise we need to resend this PDU.
*/
- if (connsm->pdu_txd) {
+ if (connsm->csmflags.cfbit.pdu_txd) {
hdr_nesn = hdr_byte & BLE_LL_DATA_HDR_NESN_MASK;
conn_sn = connsm->tx_seqnum;
if ((hdr_nesn && conn_sn) || (!hdr_nesn && !conn_sn)) {
@@ -2054,7 +2048,7 @@ ble_ll_conn_rx_isr_end(struct os_mbuf *rxpdu, uint32_t aa)
/* Did we transmit a TERMINATE_IND? If so, we are done */
if (ble_ll_ctrl_is_terminate_ind(txhdr->txinfo.hdr_byte,
txpdu->om_data[0])) {
- connsm->terminate_ind_txd = 1;
+ connsm->csmflags.cfbit.terminate_ind_txd = 1;
STAILQ_REMOVE_HEAD(&connsm->conn_txq, omp_next);
os_mbuf_free(txpdu);
rc = -1;
@@ -2070,7 +2064,7 @@ ble_ll_conn_rx_isr_end(struct os_mbuf *rxpdu, uint32_t aa)
if (connsm->cur_ctrl_proc ==
BLE_LL_CTRL_PROC_CONN_PARAM_REQ) {
connsm->reject_reason = txpdu->om_data[2];
- connsm->host_expects_upd_event = 1;
+ connsm->csmflags.cfbit.host_expects_upd_event = 1;
}
}
@@ -2098,7 +2092,7 @@ ble_ll_conn_rx_isr_end(struct os_mbuf *rxpdu, uint32_t aa)
/* Should we continue connection event? */
/* If this is a TERMINATE_IND, we have to reply */
if (ble_ll_ctrl_is_terminate_ind(rxpdu->om_data[0],rxpdu->om_data[2])) {
- connsm->terminate_ind_rxd = 1;
+ connsm->csmflags.cfbit.terminate_ind_rxd = 1;
connsm->rxd_disconnect_reason = rxpdu->om_data[3];
reply = 1;
} else if (connsm->conn_role == BLE_LL_CONN_ROLE_MASTER) {
@@ -2132,8 +2126,8 @@ ble_ll_conn_rx_isr_end(struct os_mbuf *rxpdu, uint32_t aa)
conn_rx_pdu_end:
/* Set anchor point (and last) if 1st received frame in connection event */
- if (connsm->slave_set_last_anchor) {
- connsm->slave_set_last_anchor = 0;
+ if (connsm->csmflags.cfbit.slave_set_last_anchor) {
+ connsm->csmflags.cfbit.slave_set_last_anchor = 0;
connsm->last_anchor_point = rxhdr->end_cputime -
cputime_usecs_to_ticks(BLE_TX_DUR_USECS_M(rxpdu->om_data[1]));
connsm->anchor_point = connsm->last_anchor_point;
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/blob/5917f1db/net/nimble/controller/src/ble_ll_conn_hci.c
----------------------------------------------------------------------
diff --git a/net/nimble/controller/src/ble_ll_conn_hci.c b/net/nimble/controller/src/ble_ll_conn_hci.c
index 2764bbb..5f7e802 100644
--- a/net/nimble/controller/src/ble_ll_conn_hci.c
+++ b/net/nimble/controller/src/ble_ll_conn_hci.c
@@ -505,11 +505,11 @@ ble_ll_conn_hci_update(uint8_t *cmdbuf)
* slave has initiated the procedure, we need to send a reject to the
* slave.
*/
- if (connsm->awaiting_host_reply) {
+ if (connsm->csmflags.cfbit.awaiting_host_reply) {
if (connsm->conn_role == BLE_LL_CONN_ROLE_SLAVE) {
return BLE_ERR_LMP_COLLISION;
} else {
- connsm->awaiting_host_reply = 0;
+ connsm->csmflags.cfbit.awaiting_host_reply = 0;
/* XXX: If this fails no reject ind will be sent! */
ble_ll_ctrl_reject_ind_ext_send(connsm,
@@ -581,7 +581,7 @@ ble_ll_conn_hci_param_reply(uint8_t *cmdbuf, int positive_reply)
}
/* The connection should be awaiting a reply. If not, just discard */
- if (connsm->awaiting_host_reply) {
+ if (connsm->csmflags.cfbit.awaiting_host_reply) {
/* Get a control packet buffer */
if (positive_reply && (rc == BLE_ERR_SUCCESS)) {
om = os_mbuf_get_pkthdr(&g_mbuf_pool, sizeof(struct ble_mbuf_hdr));
@@ -599,7 +599,7 @@ ble_ll_conn_hci_param_reply(uint8_t *cmdbuf, int positive_reply)
connsm->host_reply_opcode,
ble_err);
}
- connsm->awaiting_host_reply = 0;
+ connsm->csmflags.cfbit.awaiting_host_reply = 0;
/* XXX: if we cant get a buffer, what do we do? We need to remember
* reason if it was a negative reply. We also would need to have
@@ -740,7 +740,7 @@ ble_ll_conn_hci_rd_rem_ver_cmd(uint8_t *cmdbuf)
* NOTE: we cant just send the event here. That would cause the event to
* be queued before the command status.
*/
- if (!connsm->version_ind_sent) {
+ if (!connsm->csmflags.cfbit.version_ind_sent) {
ble_ll_ctrl_proc_start(connsm, BLE_LL_CTRL_PROC_VERSION_XCHG);
} else {
connsm->pending_ctrl_procs |= (1 << BLE_LL_CTRL_PROC_VERSION_XCHG);
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/blob/5917f1db/net/nimble/controller/src/ble_ll_ctrl.c
----------------------------------------------------------------------
diff --git a/net/nimble/controller/src/ble_ll_ctrl.c b/net/nimble/controller/src/ble_ll_ctrl.c
index 1e8ba74..43238d4 100644
--- a/net/nimble/controller/src/ble_ll_ctrl.c
+++ b/net/nimble/controller/src/ble_ll_ctrl.c
@@ -245,7 +245,7 @@ conn_parm_req_do_indicate:
/* XXX: what about masked out event? */
ble_ll_hci_ev_rem_conn_parm_req(connsm, req);
connsm->host_reply_opcode = opcode;
- connsm->awaiting_host_reply = 1;
+ connsm->csmflags.cfbit.awaiting_host_reply = 1;
rsp_opcode = 255;
} else {
/* Create reply to connection request */
@@ -386,7 +386,7 @@ static void
ble_ll_ctrl_version_ind_make(struct ble_ll_conn_sm *connsm, uint8_t *pyld)
{
/* Set flag to denote we have sent/received this */
- connsm->version_ind_sent = 1;
+ connsm->csmflags.cfbit.version_ind_sent = 1;
/* Fill out response */
pyld[0] = BLE_HCI_VER_BCS_4_2;
@@ -476,7 +476,7 @@ ble_ll_ctrl_conn_upd_make(struct ble_ll_conn_sm *connsm, uint8_t *pyld,
htole16(pyld + 9, instant);
/* Set flag in state machine to denote we have scheduled an update */
- connsm->conn_update_scheduled = 1;
+ connsm->csmflags.cfbit.conn_update_scheduled = 1;
}
/**
@@ -548,7 +548,7 @@ ble_ll_ctrl_rx_conn_update(struct ble_ll_conn_sm *connsm, uint8_t *dptr,
ble_ll_conn_timeout(connsm, BLE_ERR_INSTANT_PASSED);
rsp_opcode = BLE_ERR_MAX;
} else {
- connsm->conn_update_scheduled = 1;
+ connsm->csmflags.cfbit.conn_update_scheduled = 1;
}
return rsp_opcode;
@@ -607,7 +607,7 @@ ble_ll_ctrl_rx_conn_param_req(struct ble_ll_conn_sm *connsm, uint8_t *dptr,
* well. This is not expected to happen anyway. A return of BLE_ERR_MAX
* means that we will simply discard the connection parameter request
*/
- if (connsm->awaiting_host_reply) {
+ if (connsm->csmflags.cfbit.awaiting_host_reply) {
return BLE_ERR_MAX;
}
@@ -665,8 +665,8 @@ ble_ll_ctrl_rx_conn_param_rsp(struct ble_ll_conn_sm *connsm, uint8_t *dptr,
* state just clear the awaiting reply. The slave will hopefully stop its
* procedure when we reply.
*/
- if (connsm->awaiting_host_reply) {
- connsm->awaiting_host_reply = 0;
+ if (connsm->csmflags.cfbit.awaiting_host_reply) {
+ connsm->csmflags.cfbit.awaiting_host_reply = 0;
}
/* If we receive a response and no procedure is pending, just leave */
@@ -701,10 +701,10 @@ ble_ll_ctrl_rx_version_ind(struct ble_ll_conn_sm *connsm, uint8_t *dptr,
connsm->vers_nr = dptr[0];
connsm->comp_id = le16toh(dptr + 1);
connsm->sub_vers_nr = le16toh(dptr + 3);
- connsm->rxd_version_ind = 1;
+ connsm->csmflags.cfbit.rxd_version_ind = 1;
rsp_opcode = BLE_ERR_MAX;
- if (!connsm->version_ind_sent) {
+ if (!connsm->csmflags.cfbit.version_ind_sent) {
rsp_opcode = BLE_LL_CTRL_VERSION_IND;
ble_ll_ctrl_version_ind_make(connsm, rspbuf);
}
@@ -971,7 +971,8 @@ ble_ll_ctrl_chk_proc_start(struct ble_ll_conn_sm *connsm)
* The version exchange is a special case. If we have already
* received the information dont start it.
*/
- if ((i == BLE_LL_CTRL_PROC_VERSION_XCHG) && (connsm->rxd_version_ind)) {
+ if ((i == BLE_LL_CTRL_PROC_VERSION_XCHG) &&
+ (connsm->csmflags.cfbit.rxd_version_ind)) {
ble_ll_hci_ev_rd_rem_ver(connsm, BLE_ERR_SUCCESS);
CLR_PENDING_CTRL_PROC(connsm, i);
} else {
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/blob/5917f1db/project/bletest/src/main.c
----------------------------------------------------------------------
diff --git a/project/bletest/src/main.c b/project/bletest/src/main.c
index cce96ad..febb2a1 100755
--- a/project/bletest/src/main.c
+++ b/project/bletest/src/main.c
@@ -51,7 +51,7 @@ 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 (40)
+#define MBUF_NUM_MBUFS (8)
#define MBUF_BUF_SIZE \
((BLE_LL_CFG_ACL_DATA_PKT_LEN + sizeof(struct hci_data_hdr) + 3) & 0xFFFC)
#define MBUF_MEMBLOCK_SIZE (MBUF_BUF_SIZE + BLE_MBUF_PKT_OVERHEAD)
@@ -66,8 +66,8 @@ os_membuf_t g_mbuf_buffer[MBUF_MEMPOOL_SIZE];
#define BLETEST_ROLE_ADVERTISER (0)
#define BLETEST_ROLE_SCANNER (1)
#define BLETEST_ROLE_INITIATOR (2)
-#define BLETEST_CFG_ROLE (BLETEST_ROLE_INITIATOR)
-//#define BLETEST_CFG_ROLE (BLETEST_ROLE_ADVERTISER)
+//#define BLETEST_CFG_ROLE (BLETEST_ROLE_INITIATOR)
+#define BLETEST_CFG_ROLE (BLETEST_ROLE_ADVERTISER)
#define BLETEST_CFG_FILT_DUP_ADV (0)
#define BLETEST_CFG_ADV_ITVL (60000 / BLE_HCI_ADV_ITVL)
#define BLETEST_CFG_ADV_TYPE BLE_HCI_ADV_TYPE_ADV_IND
@@ -94,7 +94,7 @@ int g_bletest_state;
struct os_eventq g_bletest_evq;
struct os_callout_func g_bletest_timer;
struct os_task bletest_task;
-sec_bss_nz_core os_stack_t bletest_stack[BLETEST_STACK_SIZE];
+bssnz_t os_stack_t bletest_stack[BLETEST_STACK_SIZE];
uint32_t g_bletest_conn_end;
int g_bletest_start_update;
uint32_t g_bletest_conn_upd_time;
@@ -387,7 +387,7 @@ bletest_execute(void)
g_next_os_time += OS_TICKS_PER_SEC * 5;
} else {
if (g_next_os_time != 0xffffffff) {
-#if 1
+#if 0
if ((int32_t)(os_time_get() - g_next_os_time) >= 0) {
bletest_send_conn_update(1);
g_next_os_time = 0xffffffff;
[2/2] incubator-mynewt-larva git commit: Reduce exception stacks to
384 bytes on nrf52 and nrf51. Looks like stack use was over 200 bytes so I
added more for stacked exception
Posted by we...@apache.org.
Reduce exception stacks to 384 bytes on nrf52 and nrf51. Looks like stack use was over 200 bytes so I added more for stacked exception
Project: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/commit/e6194a93
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/tree/e6194a93
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/diff/e6194a93
Branch: refs/heads/master
Commit: e6194a9385ffb96e7a406883c452255612acc6ab
Parents: 5917f1d
Author: wes3 <wi...@micosa.io>
Authored: Tue Feb 2 09:13:19 2016 -0800
Committer: wes3 <wi...@micosa.io>
Committed: Tue Feb 2 09:13:19 2016 -0800
----------------------------------------------------------------------
hw/bsp/nrf51dk/src/arch/cortex_m0/gcc_startup_nrf51.s | 6 +-----
hw/bsp/nrf52pdk/src/arch/cortex_m4/gcc_startup_nrf52.s | 8 ++------
2 files changed, 3 insertions(+), 11 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/blob/e6194a93/hw/bsp/nrf51dk/src/arch/cortex_m0/gcc_startup_nrf51.s
----------------------------------------------------------------------
diff --git a/hw/bsp/nrf51dk/src/arch/cortex_m0/gcc_startup_nrf51.s b/hw/bsp/nrf51dk/src/arch/cortex_m0/gcc_startup_nrf51.s
index 1a9c5f5..d400fab 100755
--- a/hw/bsp/nrf51dk/src/arch/cortex_m0/gcc_startup_nrf51.s
+++ b/hw/bsp/nrf51dk/src/arch/cortex_m0/gcc_startup_nrf51.s
@@ -54,11 +54,7 @@ expected to be copied into the application project folder prior to its use!
.section .stack
.align 3
-#ifdef __STACK_SIZE
- .equ Stack_Size, __STACK_SIZE
-#else
- .equ Stack_Size, 512
-#endif
+ .equ Stack_Size, 384
.globl __StackTop
.globl __StackLimit
__StackLimit:
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-larva/blob/e6194a93/hw/bsp/nrf52pdk/src/arch/cortex_m4/gcc_startup_nrf52.s
----------------------------------------------------------------------
diff --git a/hw/bsp/nrf52pdk/src/arch/cortex_m4/gcc_startup_nrf52.s b/hw/bsp/nrf52pdk/src/arch/cortex_m4/gcc_startup_nrf52.s
index 54fb2af..9983efa 100755
--- a/hw/bsp/nrf52pdk/src/arch/cortex_m4/gcc_startup_nrf52.s
+++ b/hw/bsp/nrf52pdk/src/arch/cortex_m4/gcc_startup_nrf52.s
@@ -54,11 +54,7 @@ expected to be copied into the application project folder prior to its use!
.section .stack
.align 3
-#ifdef __STACK_SIZE
- .equ Stack_Size, __STACK_SIZE
-#else
- .equ Stack_Size, 2048
-#endif
+ .equ Stack_Size, 384
.globl __StackTop
.globl __StackLimit
__StackLimit:
@@ -179,7 +175,7 @@ Reset_Handler:
str r0, [r2,r3]
bgt .LC1
.LC0:
-
+
LDR R0, =SystemInit
BLX R0
LDR R0, =_start