Microchip® Advanced Software Framework

mimac_at86rf.c File Reference

MAC Layer Abstraction for AT86RFx implementation.

Copyright (c) 2018 - 2022 Microchip Technology Inc. and its subsidiaries.

#include <string.h>
#include <stdbool.h>
#include <trx_access.h>
#include "miwi_config.h"
#include "miwi_config_p2p.h"
#include "delay.h"
#include "sal.h"
#include "phy.h"
#include "mimac_at86rf.h"
#include "pdsDataServer.h"

Functions

bool DataDecrypt (uint8_t *Payload, uint8_t *PayloadLen, uint8_t *SourceIEEEAddress, API_UINT32_UNION FrameCounter, uint8_t FrameControl)
 
bool DataEncrypt (uint8_t *Payloadinfo, uint8_t *Payload_len, API_UINT32_UNION FrameCounter, uint8_t FrameControl)
 
void mic_generator (uint8_t *Payloadinfo, uint8_t len, uint8_t frame_control, API_UINT32_UNION FrameCounter, uint8_t *SourceIEEEAddress)
 
uint8_t MiMAC_ChannelAssessment (uint8_t AssessmentMode)
 
void MiMAC_DiscardPacket (void)
 
uint32_t MiMAC_GetPHYChannelInfo (void)
 
bool MiMAC_Init (MACINIT_PARAM initValue)
 
bool MiMAC_PowerState (INPUT uint8_t PowerState)
 
bool MiMAC_ReceivedPacket (void)
 
bool MiMAC_SendPacket (MAC_TRANS_PARAM transParam, uint8_t *MACPayload, uint8_t MACPayloadLen, uint8_t msghandle, DataConf_callback_t ConfCallback)
 
bool MiMAC_Set (mac_set_params_t id, uint8_t *value)
 
bool MiMAC_SetAltAddress (uint8_t *Address, uint8_t *PanId)
 
uint32_t MiMAC_SymbolToTicks (uint32_t symbols)
 
void MiMAC_Task (void)
 
void PHY_DataConf (uint8_t status)
 
bool validate_mic (void)
 

Variables

uint8_t addr [8] = {0xda , 0x98 , 0x22 , 0xfe , 0xff , 0xa3 , 0x04 , 0x00}
 
uint8_t BankIndex = 0xFF
 
uint8_t calculated_mic_values [AES_BLOCKSIZE/4]
 
uint8_t CBC_mic [16]
 
uint8_t CTR_mic [16]
 
bool dataConfAvailable = 0
 
DataConf_callback_t dataConfCallback = NULL
 
uint8_t dataHandle = 0
 
uint8_t * dataPointer = NULL
 
miwi_status_t dataStatus
 
uint8_t final_mic_value [16]
 
uint8_t IEEESeqNum
 
uint8_t InitVect_in [16]
 
API_UINT16_UNION MAC_PANID
 
uint8_t MACCurrentChannel
 
MACINIT_PARAM MACInitParams
 
const uint8_t myKeySequenceNumber = KEY_SEQUENCE_NUMBER
 
API_UINT16_UNION myNetworkAddress
 
const char mySecurityKey [16]
 
API_UINT32_UNION OutgoingFrameCounter
 
uint8_t packet [128]
 
uint8_t received_mic_values [AES_BLOCKSIZE/4]
 

bool DataDecrypt ( uint8_t *  Payload,
uint8_t *  PayloadLen,
uint8_t *  SourceIEEEAddress,
API_UINT32_UNION  FrameCounter,
uint8_t  FrameControl 
)
bool DataEncrypt ( uint8_t *  Payloadinfo,
uint8_t *  Payload_len,
API_UINT32_UNION  FrameCounter,
uint8_t  FrameControl 
)
void mic_generator ( uint8_t *  Payloadinfo,
uint8_t  len,
uint8_t  frame_control,
API_UINT32_UNION  FrameCounter,
uint8_t *  SourceIEEEAddress 
)
uint8_t MiMAC_ChannelAssessment ( uint8_t  AssessmentMode)
void MiMAC_DiscardPacket ( void  )
uint32_t MiMAC_GetPHYChannelInfo ( void  )

References FULL_CHANNEL_MAP.

bool MiMAC_PowerState ( INPUT uint8_t  PowerState)
bool MiMAC_Set ( mac_set_params_t  id,
uint8_t *  value 
)

References MAC_CHANNEL, MACCurrentChannel, and PHY_SetChannel().

Referenced by MiApp_Set().

bool MiMAC_SetAltAddress ( uint8_t *  Address,
uint8_t *  PanId 
)
uint32_t MiMAC_SymbolToTicks ( uint32_t  symbols)

References SYMBOLS_TO_TICKS.

Referenced by P2PTasks().

void MiMAC_Task ( void  )
void PHY_DataConf ( uint8_t  status)

References dataConfAvailable, and dataStatus.

Referenced by MiMAC_SendPacket().

bool validate_mic ( void  )

References final_mic_value, and received_mic_values.

Referenced by DataDecrypt().

uint8_t addr[8] = {0xda , 0x98 , 0x22 , 0xfe , 0xff , 0xa3 , 0x04 , 0x00}

Referenced by _spi_check_config().

uint8_t BankIndex = 0xFF
uint8_t calculated_mic_values[AES_BLOCKSIZE/4]
uint8_t CBC_mic[16]
uint8_t CTR_mic[16]

Referenced by DataDecrypt().

bool dataConfAvailable = 0

Referenced by MiMAC_Task(), and PHY_DataConf().

DataConf_callback_t dataConfCallback = NULL

Referenced by MiMAC_SendPacket(), and MiMAC_Task().

uint8_t dataHandle = 0

Referenced by MiMAC_SendPacket(), and MiMAC_Task().

uint8_t* dataPointer = NULL

Referenced by MiMAC_SendPacket(), and MiMAC_Task().

miwi_status_t dataStatus

Referenced by MiMAC_Task(), and PHY_DataConf().

uint8_t final_mic_value[16]
uint8_t IEEESeqNum

Referenced by MiMAC_Init(), and MiMAC_SendPacket().

uint8_t InitVect_in[16]

Referenced by mic_generator().

API_UINT16_UNION MAC_PANID
uint8_t MACCurrentChannel

Referenced by MiMAC_Set().

MACINIT_PARAM MACInitParams
const uint8_t myKeySequenceNumber = KEY_SEQUENCE_NUMBER

Referenced by MiMAC_SendPacket().

API_UINT16_UNION myNetworkAddress
const char mySecurityKey[16]
Initial value:
#define SECURITY_KEY_02
Definition: phy.h:69
#define SECURITY_KEY_01
Definition: phy.h:68
#define SECURITY_KEY_09
Definition: phy.h:76
#define SECURITY_KEY_06
Definition: phy.h:73
#define SECURITY_KEY_13
Definition: phy.h:80
#define SECURITY_KEY_11
Definition: phy.h:78
#define SECURITY_KEY_05
Definition: phy.h:72
#define SECURITY_KEY_12
Definition: phy.h:79
#define SECURITY_KEY_00
Definition: phy.h:67
#define SECURITY_KEY_04
Definition: phy.h:71
#define SECURITY_KEY_14
Definition: phy.h:81
#define SECURITY_KEY_07
Definition: phy.h:74
#define SECURITY_KEY_03
Definition: phy.h:70
#define SECURITY_KEY_10
Definition: phy.h:77
#define SECURITY_KEY_08
Definition: phy.h:75
#define SECURITY_KEY_15
Definition: phy.h:82

Referenced by DataDecrypt(), DataEncrypt(), and mic_generator().

API_UINT32_UNION OutgoingFrameCounter
uint8_t packet[128]

Referenced by MiMAC_SendPacket().

uint8_t received_mic_values[AES_BLOCKSIZE/4]