Application Program Interface for MiWi Protocols.
Copyright (c) 2018 - 2022 Microchip Technology Inc. and its subsidiaries.
#include "compiler.h"
#include "miwi_config.h"
#include "miwi_config_p2p.h"
#include "miwi_mesh_app.h"
Data Structures | |
struct | __CONNECTION_ENTRY |
union | __CONNECTION_STATUS |
struct | __defaultParametersRamOnly |
struct | __defaultParametersRomOrRam |
struct | __END_DEVICES_Unique_Short_Address |
struct | __CONNECTION_STATUS::_CONNECTION_STAUTS_bits |
struct | _CoordHopCount_t |
struct | _CoordRouteTable_t |
struct | _RouteEntry_t |
struct | ACTIVE_SCAN_RESULT |
union | API_UINT16_UNION |
union | API_UINT32_UNION |
union | API_UINT64_UNION |
struct | beaconDescriptor_t |
union | CapabilityInfo |
struct | CommDeviceTable_t |
struct | coordinatorTable_ |
struct | deviceTable_ |
struct | DuplicateRejectionTable_ |
union | JoinWish |
struct | RebroadcastTable_ |
struct | RECEIVED_MESH_MESSAGE |
struct | RECEIVED_MESSAGE |
struct | searchConf_t |
struct | SleepDeviceTable_ |
Enumerations | |
enum | _deviceRole { PAN_COORD = 0x01, END_DEVICE } |
enum | miwi_params { CHANNEL = 0x00, PANID = 0x01, SHORT_ADDRESS = 0x02, PARENT_SHORT_ADDRESS = 0x03, DEVICE_TIMEOUT = 0x04, CHANNELMAP = 0x05, CAPABILITYINFO = 0x06, BLOOM_AUTO_JOIN = 0x80, ROUTE_TEST_MODE = 0x81 } |
enum | miwi_status { SUCCESS = 0, FAILURE, CHANNEL_ACCESS_FAILURE, NO_ACK, TIMER_EXPIRED, TRANSACTION_EXPIRED = 5, ALREADY_EXISTS, NO_ROUTE, SCAN_NO_BEACON, SCAN_MAX_REACHED, MEMORY_UNAVAILABLE = 10, ERR_TX_FAIL, ERR_TRX_FAIL, ERR_INVALID_INPUT, RECONNECTION_IN_PROGRESS, RECONNECTED, ADDR_NOT_FOUND_IN_SCANNED_LIST, ENTRY_NOT_EXIST = 0xF0, NOT_ENOUGH_SPACE = 0xF1, NOT_SAME_PAN = 0xF2, NOT_PERMITTED = 0xF3, ACTIVE_SCAN = 0xF4 } |
#define BLOOM_FILTER_SIZE 8 |
#define BROADCAST_TO_ALL 0x01 |
#define CALC_SEC_PAYLOAD_SIZE | ( | x | ) | (x) |
#define CONN_MODE_DIRECT 0x00 |
#define CONN_MODE_INDIRECT 0x01 |
#define COORDINATOR_ADDRESS_MASK 0xFF00 |
#define DISABLE_ALL_CONN 0x03 |
#define ENABLE_ACTIVE_SCAN_RSP 0x02 |
Referenced by frameParse().
#define ENABLE_ALL_CONN 0x00 |
Referenced by Initialize_Demo(), main(), and MiApp_EstablishConnection().
#define ENABLE_PREV_CONN 0x01 |
Referenced by frameParse().
#define ENDEVICE_ADDRESS_MASK 0x00FF |
#define HOP_TABLE_COUNT |
#define INPUT |
#define IOPUT |
#define LONG_ADDR_LEN 8 |
#define MESH_BROADCAST_TO_ALL (0xFFFF) |
Referenced by otauDataSend().
#define MESH_BROADCAST_TO_COORDINATORS (0xFFFD) |
#define MESH_BROADCAST_TO_FFDS (0xFFFE) |
#define MiApp_CB_AllowConnection | ( | handleInConnectionTable | ) | true |
Referenced by frameParse().
#define MiApp_CB_RFDAcknowledgement | ( | SourceShortAddress, | |
AcknowledgementSeqNum | |||
) |
#define MIWI_MAJOR_VERSION '6' |
#define MIWI_MINOR_VERSION '7' |
#define MULTICAST_TO_COORDINATORS 0x02 |
#define MULTICAST_TO_FFDS 0x03 |
#define NOISE_DETECT_CS 0x01 |
#define NOISE_DETECT_ENERGY 0x00 |
Referenced by MiApp_StartConnection().
#define OUTPUT |
#define POWER_STATE_SLEEP 0x00 |
#define POWER_STATE_WAKEUP 0x01 |
#define POWER_STATE_WAKEUP_DR 0x02 |
#define RXON_ENDEVICE_ADDRESS_MASK 0x0080 |
Referenced by appSendData().
#define SECURITY_KEY_SIZE 16 |
#define SHORT_ADDR_LEN 2 |
Referenced by addDataHandleTableEntry(), appCmdDataRequest(), configure_frame_sending(), configure_pkt_stream_frames(), configure_range_test_frame_sending(), frameTransmit(), getAddressFromDataHandleTable(), mac_extract_mhr_addr_info(), otauDataSend(), per_mode_receptor_rx_cb(), run_p2p_demo(), run_star_demo(), and transmit_frame().
#define START_CONN_CS_SCN 0x02 |
Referenced by MiApp_StartConnection().
#define START_CONN_DIRECT 0x00 |
Referenced by APP_TaskHandler(), Connection_Confirm(), main(), and MiApp_StartConnection().
#define START_CONN_ENERGY_SCN 0x01 |
Referenced by MiApp_StartConnection().
typedef union CapabilityInfo CapabilityInfo_t |
typedef struct __CONNECTION_ENTRY CONNECTION_ENTRY |
typedef union __CONNECTION_STATUS CONNECTION_STATUS |
typedef void(* connectionConf_callback_t)(miwi_status_t status) |
typedef struct _CoordHopCount_t CoordHopCount_t |
typedef struct coordinatorTable_ CoordinatorTable_t |
typedef struct _CoordRouteTable_t CoordRouteTable_t |
typedef void(* DataConf_callback_t)(uint8_t msgConfHandle, miwi_status_t status, uint8_t *msgPointer) |
typedef struct __defaultParametersRamOnly defaultParametersRamOnly_t |
typedef struct __defaultParametersRomOrRam defaultParametersRomOrRam_t |
typedef enum _deviceRole DeviceRole_t |
typedef struct deviceTable_ DeviceTable_t |
typedef struct DuplicateRejectionTable_ DuplicateRejectionTable_t |
typedef union JoinWish JoinWish_t |
typedef void(* LinkFailureCallback_t)(void) |
typedef enum miwi_params miwi_params_t |
typedef enum miwi_status miwi_status_t |
typedef void(* PacketIndCallback_t)(RECEIVED_MESH_MESSAGE *ind) |
typedef struct RebroadcastTable_ RebroadcastTable_t |
typedef void(* ReconnectionCallback_t)(miwi_status_t status) |
typedef void(* resyncConnection_callback_t)(uint8_t channel, miwi_status_t status) |
typedef void(* roleUpgrade_callback_t)(uint16_t newShortAddress) |
typedef struct _RouteEntry_t RouteEntry_t |
typedef void(* SearchConnectionConf_callback_t)(uint8_t foundScanResults, void *ScanResults) |
typedef struct SleepDeviceTable_ SleepDeviceTable_t |
enum _deviceRole |
enum miwi_params |
enum miwi_status |
void DumpConnection | ( | INPUT uint8_t | index | ) |
References ADDITIONAL_NODE_ID_SIZE, CONNECTION_SIZE, currentChannel, i, MY_ADDRESS_LENGTH, myLongAddress, and API_UINT16_UNION::v.
Referenced by Connection_Confirm(), and main().
void MeshTasks | ( | void | ) |
Referenced by wsndemo_task().
void MiApp_ConnectionMode | ( | uint8_t | Mode | ) |
Referenced by Initialize_Demo(), and main().
uint8_t MiApp_EstablishConnection | ( | uint8_t | Channel, |
uint8_t | addr_len, | ||
uint8_t * | addr, | ||
uint8_t | Capability_info, | ||
connectionConf_callback_t | ConfCallback | ||
) |
References _gEstConnection::address, _gEstConnection::addrLen, _gEstConnection::backupState, CHANNEL, _gEstConnection::confCallback, CONNECTION_RETRY_TIMES, _gEstConnection::connectionRetries, ConnMode, ENABLE_ALL_CONN, ESTABLISHING_NETWORK, INITIAL_STATE, MiApp_Set(), p2pStarCurrentState, SCAN_NO_BEACON, sendConnectionRequest(), and _gEstConnection::status.
Referenced by appLinkFailureCallback(), Initialize_Demo(), and main().
bool MiApp_Get | ( | miwi_params_t | id, |
uint8_t * | value | ||
) |
References CHANNEL, currentChannel, PANID, and API_UINT16_UNION::Val.
Referenced by appSendData(), fillGeneralInformation(), otauDataSend(), and otauTask().
bool MiApp_InitChannelHopping | ( | uint32_t | ChannelMap | ) |
bool MiApp_IsConnected | ( | void | ) |
Referenced by otauTask().
bool MiApp_ManuSpecSendData | ( | uint8_t | addr_len, |
uint8_t * | addr, | ||
uint8_t | msglen, | ||
uint8_t * | msgpointer, | ||
uint8_t | msghandle, | ||
bool | ackReq, | ||
DataConf_callback_t | ConfCallback | ||
) |
Referenced by otauDataSend().
uint16_t MiApp_MeshGetNextHopAddr | ( | uint16_t | destAddress | ) |
Referenced by appSendData(), and otauClientSendNotify().
uint8_t MiApp_NoiseDetection | ( | uint32_t | ChannelMap, |
uint8_t | ScanDuration, | ||
uint8_t | DetectionMode, | ||
OUTPUT uint8_t * | NoiseLevel | ||
) |
Referenced by MiApp_StartConnection().
miwi_status_t MiApp_ProtocolInit | ( | defaultParametersRomOrRam_t * | defaultRomOrRamParams, |
defaultParametersRamOnly_t * | defaultRamOnlyParams | ||
) |
References MACINIT_PARAM::actionFlags, MACINIT_PARAM::bits, CHANNEL, CONNECTION_SIZE, ConnMode, currentChannel, i, IN_NETWORK_STATE, INIT_STATE, LONG_ADDR_LEN, MiApp_Set(), MiMAC_Init(), MiMAC_SetAltAddress(), miQueueInit(), MIWI_ALL_MEMORY_MEM_ID, MY_ADDRESS_LENGTH, MY_PAN_ID, myLongAddress, NULL, P2PCapacityInfo, p2pStarCurrentState, MACINIT_PARAM::PAddress, PAN_COORD, PDS_InitItems(), PDS_IsAbleToRestore(), PDS_Restore(), protocolTimerInit(), RECONNECTED, reconnectionCallback, RFD_WAKEUP_INTERVAL, role, startCompleteProcedure(), startLinkStatusTimer(), SUCCESS, API_UINT32_UNION::Val, API_UINT16_UNION::Val, and P2P_STATUS::Val.
Referenced by Initialize_Demo(), main(), and wsndemo_init().
bool MiApp_ReadyToSleep | ( | uint32_t * | sleepTime | ) |
Referenced by APP_TaskHandler(), run_p2p_demo(), and run_star_demo().
void MiApp_RemoveConnection | ( | uint8_t | ConnectionIndex | ) |
bool MiApp_ResetToFactoryNew | ( | void | ) |
References PDS_DeleteAll().
Referenced by APP_TaskHandler().
bool MiApp_ResyncConnection | ( | uint8_t | ConnectionIndex, |
uint32_t | ChannelMap, | ||
resyncConnection_callback_t | callback | ||
) |
bool MiApp_RoleUpgradeNotification_Subscribe | ( | roleUpgrade_callback_t | callback | ) |
uint8_t MiApp_SearchConnection | ( | uint8_t | ScanDuration, |
uint32_t | ChannelMap, | ||
SearchConnectionConf_callback_t | ConfCallback | ||
) |
Referenced by APP_TaskHandler().
bool MiApp_SendData | ( | uint8_t | addr_len, |
uint8_t * | addr, | ||
uint8_t | msglen, | ||
uint8_t * | msgpointer, | ||
uint8_t | msghandle, | ||
bool | ackReq, | ||
bool | secEnabled, | ||
DataConf_callback_t | ConfCallback | ||
) |
References _DataFrame_t::ackReq, appAckWaitDataCallback(), P2P_STATUS::bits, _DataFrame_t::broadcast, CMD_FORWRD_PACKET, _DataFrame_t::confCallback, CONNECTION_SIZE, _P2PStarDataFrame_t::dataFrame, _DataFrame_t::destAddress, END_DEVICE, P2P_STATUS::Enhanced_DR_SecEn, frameTransmit(), i, IN_NETWORK_STATE, INDIRECT_MESSAGE_TIMEOUT, isSameAddress(), macAckOnlyDataCallback(), MAX_PAYLOAD, MiMem_Alloc(), MiMem_PercentageOfFreeBuffers(), miQueueAppend(), _DataFrame_t::msg, _DataFrame_t::msghandle, _DataFrame_t::msgLength, MY_ADDRESS_LENGTH, NULL, p2pStarCurrentState, role, _DataFrame_t::secEnabled, P2P_STATUS::Sleeping, SW_ACK_TIMEOUT, SYS_TimerStart(), and _DataFrame_t::timeout.
Referenced by appCmdDataRequest(), appSendData(), run_p2p_demo(), run_star_demo(), and TransmitMessage().
bool MiApp_Set | ( | miwi_params_t | id, |
uint8_t * | value | ||
) |
References CHANNEL, currentChannel, MAC_CHANNEL, MiMAC_Set(), and PDS_Store().
Referenced by Initialize_Demo(), main(), MiApp_EstablishConnection(), MiApp_ProtocolInit(), MiApp_StartConnection(), and updateGeneralInfoSet().
bool MiApp_StartConnection | ( | uint8_t | Mode, |
uint8_t | ScanDuration, | ||
uint32_t | ChannelMap, | ||
connectionConf_callback_t | ConfCallback | ||
) |
References CHANNEL, FAILURE, INIT_STATE, MiApp_NoiseDetection(), MiApp_Set(), MiMAC_SetAltAddress(), MY_PAN_ID, NOISE_DETECT_ENERGY, p2pStarCurrentState, PHY_RandomReq(), SEARCH_COMPLETE, START_CONN_CS_SCN, START_CONN_DIRECT, START_CONN_ENERGY_SCN, startCompleteProcedure(), STARTING_NETWORK, SUCCESS, and API_UINT16_UNION::Val.
Referenced by APP_TaskHandler(), Connection_Confirm(), and main().
bool MiApp_SubscribeDataIndicationCallback | ( | PacketIndCallback_t | callback | ) |
References callback, NULL, and pktRxcallback.
Referenced by appInit(), Initialize_Demo(), and main().
bool MiApp_SubscribeLinkFailureCallback | ( | LinkFailureCallback_t | callback | ) |
References callback, linkFailureCallback, and NULL.
Referenced by appInit(), and Initialize_Demo().
bool MiApp_SubscribeManuSpecDataIndicationCallback | ( | PacketIndCallback_t | callback | ) |
Referenced by otauInit().
bool MiApp_SubscribeReConnectionCallback | ( | ReconnectionCallback_t | callback | ) |
References callback, NULL, and reconnectionCallback.
Referenced by wsndemo_init().
uint8_t MiApp_TransceiverPowerState | ( | uint8_t | Mode | ) |
void P2PTasks | ( | void | ) |
References aMaxSIFSFrameSize, aTurnaroundTime, aUnitBackoffPeriod, P2P_STATUS::bits, P2P_STATUS::DataRequesting, _TxFrameEntry_t::frame, _TxFrameEntry_t::frameHandle, _TxFrameEntry_t::frameLength, _TxFrameEntry_t::frameParam, frameParse(), frameTxCallback(), IN_NETWORK_STATE, MAC_OVERHEAD, macMinLIFSPeriod_def, macMinSIFSPeriod_def, MiMAC_DiscardPacket(), MiMAC_PowerState(), MiMAC_ReceivedPacket(), MiMAC_SendPacket(), MiMAC_SymbolToTicks(), MiMAC_Task(), miQueueRemove(), MiWi_TickGet(), MiWi_TickGetDiff(), NULL, p2pStarCurrentState, PHY_OVERHEAD, POWER_STATE_DEEP_SLEEP, P2P_STATUS::RxHasUserData, MiQueue::size, SYS_TimerTaskHandler(), transaction_duration_us, txCallbackReceived, _TxFrame_t::txFrameEntry, and _MIWI_TICK::Val.
Referenced by main(), Run_Demo(), run_p2p_demo(), and run_star_demo().
uint8_t Total_Connections | ( | void | ) |
References CONNECTION_SIZE, and i.
Referenced by run_p2p_demo(), and run_star_demo().
uint8_t conn_size |
Referenced by Find_Index(), MiApp_BroadcastConnectionTable(), run_p2p_demo(), and run_star_demo().
uint8_t currentChannel |
Referenced by Connection_Confirm(), DumpConnection(), frameParse(), Initialize_Demo(), MiApp_Get(), MiApp_ProtocolInit(), MiApp_Set(), and sendConnectionRequest().
defaultParametersRamOnly_t defaultParamsRamOnly |
Referenced by fillGeneralInformation(), updateGeneralInfoSet(), and wsndemo_init().
defaultParametersRomOrRam_t defaultParamsRomOrRam |
Referenced by MiMAC_ReceivedPacket(), and wsndemo_init().
END_DEVICES_Unique_Short_Address END_DEVICES_Short_Address[CONNECTION_SIZE] |
Referenced by run_star_demo().
uint8_t end_nodes |
Referenced by frameParse(), handleLostConnection(), and run_star_demo().
bool lost_connection |
API_UINT32_UNION meshOutgoingFrameCounter |
uint8_t myConnectionIndex_in_PanCo |
Referenced by frameParse(), and run_star_demo().
uint8_t MyindexinPC |
Referenced by frameParse().
uint8_t myLongAddress[MY_ADDRESS_LENGTH] |
DeviceRole_t role |
RECEIVED_MESSAGE rxMessage |
Referenced by DemoOutput_HandleMessage(), and ReceivedDataIndication().