Skip to content

Commit

Permalink
fix(BLE): Backwards compatibility for HCI Vendor-Specific opcodes (an…
Browse files Browse the repository at this point in the history
  • Loading branch information
AbbyWolf-ADI authored Oct 3, 2024
1 parent bb1f929 commit f4649e2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 47 deletions.
36 changes: 0 additions & 36 deletions Libraries/Cordio/controller/sources/ble/lhci/lhci_cmd_vs.c
Original file line number Diff line number Diff line change
Expand Up @@ -233,33 +233,6 @@ bool_t lhciCommonVsStdDecodeCmdPkt(LhciHdr_t *pHdr, uint8_t *pBuf)
evtParamLen += sizeof(BbBlePduFiltStats_t);
break;

case LHCI_OPCODE_VS_REG_WRITE: {
uint8_t len;
uint32_t addr;
uint32_t *addrP;

BSTREAM_TO_UINT8(len, pBuf);
BSTREAM_TO_UINT32(addr, pBuf);
addrP = (uint32_t *)addr;

LL_TRACE_INFO2("### LlVsRegWrite ### 0x%08X %d bytes", addr, len);

memcpy(addrP, pBuf, len);
break;
}

case LHCI_OPCODE_VS_REG_READ: {
uint8_t len;

BSTREAM_TO_UINT8(len, pBuf);
BSTREAM_TO_UINT32(regReadAddr, pBuf);

LL_TRACE_INFO2("### LlVsRegRead ### 0x%08X %d bytes", regReadAddr, len);

evtParamLen += len;
break;
}

case LHCI_OPCODE_VS_TX_TEST: {
uint16_t numPackets = pBuf[4] | (pBuf[5] << 8);

Expand Down Expand Up @@ -374,7 +347,6 @@ bool_t lhciCommonVsStdDecodeCmdPkt(LhciHdr_t *pHdr, uint8_t *pBuf)
case LHCI_OPCODE_VS_GET_RAND_ADDR:
case LHCI_OPCODE_VS_SET_TX_TEST_ERR_PATT:
case LHCI_OPCODE_VS_SET_SNIFFER_ENABLE:
case LHCI_OPCODE_VS_REG_WRITE:
case LHCI_OPCODE_VS_RX_TEST:
case LHCI_OPCODE_VS_TX_TEST:
case LHCI_OPCODE_VS_RESET_ADV_STATS:
Expand Down Expand Up @@ -514,14 +486,6 @@ bool_t lhciCommonVsStdDecodeCmdPkt(LhciHdr_t *pHdr, uint8_t *pBuf)
break;
}

case LHCI_OPCODE_VS_REG_READ: {
if (regReadAddr != 0) {
uint32_t *regReadP = (uint32_t *)regReadAddr;
memcpy(pBuf, regReadP, (evtParamLen - 1));
}
break;
}

/* --- default --- */

default:
Expand Down
20 changes: 9 additions & 11 deletions Libraries/Cordio/controller/sources/ble/lhci/lhci_int.h
Original file line number Diff line number Diff line change
Expand Up @@ -360,31 +360,29 @@ extern "C" {
#define LHCI_OPCODE_VS_SET_CONN_PHY_TX_PWR \
HCI_OPCODE(HCI_OGF_VENDOR_SPEC, 0x3DD) /*!< Set Connection Phy Tx Power opcode. */

#define LHCI_OPCODE_VS_REG_WRITE HCI_OPCODE(HCI_OGF_VENDOR_SPEC, 0x300) /*!< Write data to MCU register or memory space. */
#define LHCI_OPCODE_VS_REG_READ HCI_OPCODE(HCI_OGF_VENDOR_SPEC, 0x301) /*!< Read data from MCU register or memory space. */
#define LHCI_OPCODE_VS_RESET_CONN_STATS \
HCI_OPCODE(HCI_OGF_VENDOR_SPEC, 0x302) /*!< Reset connection stats. */
HCI_OPCODE(HCI_OGF_VENDOR_SPEC, 0x300) /*!< Reset connection stats. */
#define LHCI_OPCODE_VS_TX_TEST \
HCI_OPCODE(HCI_OGF_VENDOR_SPEC, 0x303) /*!< Vendor specific TX test that takes numPkt param. */
HCI_OPCODE(HCI_OGF_VENDOR_SPEC, 0x301) /*!< Vendor specific TX test that takes numPkt param. */
#define LHCI_OPCODE_VS_RESET_TEST_STATS \
HCI_OPCODE(HCI_OGF_VENDOR_SPEC, \
0x304) /*!<Vendor specific End Test Returning More than RX Packets*/
0x302) /*!<Vendor specific End Test Returning More than RX Packets*/
#define LHCI_OPCODE_VS_RX_TEST \
HCI_OPCODE(HCI_OGF_VENDOR_SPEC, \
0x305) /*!<Vendor specific RX Test*/
0x303) /*!<Vendor specific RX Test*/
#define LHCI_OPCODE_VS_GET_RSSI \
HCI_OPCODE(HCI_OGF_VENDOR_SPEC, \
0x306) /*!<Vendor specific Get RSSI*/
0x304) /*!<Vendor specific Get RSSI*/
#define LHCI_OPCODE_VS_RESET_ADV_STATS \
HCI_OPCODE(HCI_OGF_VENDOR_SPEC, \
0x307) /*!<Vendor specific reset adv stats*/
0x305) /*!<Vendor specific Reset Advertising Stats */
#define LHCI_OPCODE_VS_RESET_SCAN_STATS \
HCI_OPCODE(HCI_OGF_VENDOR_SPEC, \
0x308) /*!<Vendor specific reset scan stats*/
0x306) /*!<Vendor specific Reset Scan Stats */
#define LHCI_OPCODE_VS_FGEN \
HCI_OPCODE(HCI_OGF_VENDOR_SPEC, \
0x309) /*!<Vendor specific frequency generator*/
0x307) /*!<Vendor specific Function Generation */

/* Vendor specific event masks. */
#define LHCI_VS_EVT_MASK_SCAN_REPORT_EVT 0x01 /*!< (Byte 0) VS event bit, scan report. */
#define LHCI_VS_EVT_MASK_DIAG_TRACE_EVT 0x02 /*!< (Byte 0) VS event bit, diagnostic tracing. */
Expand Down

0 comments on commit f4649e2

Please sign in to comment.