wsf buffer transfers owenrship to controller

pull/10666/head
paul-szczepanek-arm 2019-03-12 16:30:37 +00:00 committed by Martin Kojtal
parent 0de3510d1c
commit 96040be349
4 changed files with 9 additions and 7 deletions

View File

@ -55,7 +55,7 @@ public:
* packet, ACL packet or EVT packet. Depending on the type of transport
* it can prefix the packet itself.
* @param len Number of bytes to transmit.
* @param pData pointer to the data to transmit.
* @param pData Pointer to the data to transmit. This is an WSF buffer and we receive ownership.
*
* @return The number of bytes which have been transmited.
*/

View File

@ -80,7 +80,7 @@ void hciTrSendAclData(void *pContext, uint8_t *pData)
*
* \brief Send a complete HCI command to the transport.
*
* \param pData WSF msg buffer containing an HCI command.
* \param pData WSF msg buffer containing an HCI command. WSF buffer ownership is released by this function.
*
* \return None.
*/
@ -95,12 +95,13 @@ void hciTrSendCmd(uint8_t *pData)
/* dump event for protocol analysis */
HCI_PDUMP_CMD(len, pData);
/* transmit ACL header and data */
if (hciDrvWrite(HCI_CMD_TYPE, len, pData) == len)
/* transmit ACL header and data (releases the ownership of the WSF buffer containing pData) */
if (hciDrvWrite(HCI_CMD_TYPE, len, pData) != len)
{
/* free buffer */
WsfMsgFree(pData);
/* transport failure */
WSF_ASSERT(0);
}
/* pData is not freed as the hciDrvWrite took ownership of the WSF buffer */
}

View File

@ -46,6 +46,7 @@ void NRFCordioHCITransportDriver::terminate()
uint16_t NRFCordioHCITransportDriver::write(uint8_t hci_type, uint16_t len, uint8_t *pData)
{
/* ownership of the WSF buffer is transferred to the controller (zero copy HCI) */
return FakeChciTrRead(CHCI_TR_PROT_BLE, hci_type, len, pData);
}

View File

@ -51,7 +51,7 @@ public:
* packet, ACL packet or EVT packet. Depending on the type of transport
* it can prefix the packet itself.
* @param len Number of bytes to transmit.
* @param pData pointer to the data to transmit.
* @param pData Pointer to the data to transmit. This is an WSF buffer and we receive ownership.
*
* @return The number of bytes which have been transmited.
*/