1.1.2.4.14 DRV_G3_MACRT_PhySnifferCallbackRegister Function

C

void DRV_G3_MACRT_PhySnifferCallbackRegister (
    const DRV_HANDLE handle,
    const DRV_G3_MACRT_PHY_SNIFFER_CALLBACK callback, 
    uint8_t* pDataBuffer
);

Summary

Allows to enable G3-PLC PHY Sniffer capabilities and set the data buffer in which the content of the sniffer packet will be stored when a new PLC message is received.

Description

This function allows a client to register a G3-PLC PHY Sniffer event handling function for the driver to call back when either a data reception event or confirmation of the last transmission event occurs.

The content of the sniffer data is compliant with Microchip Hybrid Sniffer tool.

The callback once set, persists until the client closes the driver or sets another callback (which could be a NULL pointer to indicate no callback).

Precondition

DRV_G3_MACRT_Open must have been called to obtain a valid opened device handle.

Parameters

ParamDescription
handleA valid instance handle, returned from the driver's open routine
callbackPointer to the callback function
pDataBufferPointer to buffer where sniffer message is stored. Data buffer should be defined as sizeof(MAC_RT_PHY_SNIFFER_HEADER) + MAC_RT_PHY_DATA_MAX_SIZE to avoid memory overlaps.

Returns

None.

Example

void APP_G3_MAC_RT_Phy_Sniffer_callback(uint8_t *pData, uint16_t length)
{
    if (length)
    {
        // Phy Sniffer data handling here.
    }
}

// myAppObj is an application specific state data object.
MY_APP_OBJ myAppObj;

// Client registers a Phy sniffer callback with driver. This is done once
// 'myHandle', returned from DRV_G3_MACRT_Open previously called
DRV_G3_MACRT_PhySnifferCallbackRegister( myAppObj.myHandle, APP_G3_MAC_RT_Phy_Sniffer_callback, myAppObj.pPhySnfBuffer );

Remarks

None.