Skip to content

Commit

Permalink
Merge commit '77818568c6d9389ef1eb82e40ebfbbf26626c9d3' into mbedos511
Browse files Browse the repository at this point in the history
* commit '77818568c6d9389ef1eb82e40ebfbbf26626c9d3':
  Squashed 'features/nanostack/sal-stack-nanostack/' changes from ccd30a3..513a38e
  • Loading branch information
Arto Kinnunen committed Nov 10, 2018
2 parents 923ce13 + 7781856 commit d879422
Show file tree
Hide file tree
Showing 211 changed files with 4,852 additions and 4,760 deletions.
6 changes: 3 additions & 3 deletions features/nanostack/sal-stack-nanostack/nanostack/ccmLIB.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,9 @@ typedef struct {
uint16_t data_len; /**< Length of data IN. */
const uint8_t *adata_ptr; /**< Pointer to authentication data. */
uint16_t adata_len; /**< Length of authentication data. */
unsigned ccm_encode_mode:1; /**< Encryption modeAES_CCM_ENCRYPT or AES_CCM_DECRYPT. */
unsigned ccm_sec_level:3; /**< Encryption operation security level 0-7. */
unsigned ccm_l_param:4; /**< Can be 2 or 3. 2 when NONCE length is 13 and 3 when 12*/
unsigned ccm_encode_mode: 1; /**< Encryption modeAES_CCM_ENCRYPT or AES_CCM_DECRYPT. */
unsigned ccm_sec_level: 3; /**< Encryption operation security level 0-7. */
unsigned ccm_l_param: 4; /**< Can be 2 or 3. 2 when NONCE length is 13 and 3 when 12*/
uint8_t mic_len; /**< ccm_sec_init() sets here the length of MIC. */
uint8_t *mic; /**< Encrypt process writes MIC. Decrypt reads it and compares it with the MIC obtained from data. */
const uint8_t *key_ptr; /**< Encyption key pointer to 128-bit key. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,7 @@
* /enum dhcp_instance_type
* /brief DHCP instance types.
*/
typedef enum dhcp_instance_type
{
typedef enum dhcp_instance_type {
DHCP_INSTANCE_CLIENT,
DHCP_INSTANCE_SERVER,
DHCP_INTANCE_RELAY_AGENT
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ typedef struct eth_mac_api_s eth_mac_api_t;
typedef struct eth_data_conf_s {
uint8_t msduHandle; /**< Handle associated with MSDU */
uint8_t status; /**< Status of the last transaction */
}eth_data_conf_t;
} eth_data_conf_t;

/**
* \brief Struct eth_data_req_s defines arguments for data request message
Expand All @@ -67,7 +67,7 @@ typedef struct eth_data_ind_s {
uint16_t etehernet_type; /**< Ethernet type */
uint8_t link_quality; /**< Link quality */
int8_t dbm; /**< measured dBm */
}eth_data_ind_t;
} eth_data_ind_t;

/**
* @brief Creates ethernet MAC API instance which will use driver given
Expand All @@ -91,37 +91,37 @@ extern int8_t ethernet_mac_destroy(eth_mac_api_t *mac_api);
* @param api API to handle the request
* @param data Data containing request parameters
*/
typedef void eth_mac_data_request(const eth_mac_api_t* api, const eth_data_req_t *data);
typedef void eth_mac_data_request(const eth_mac_api_t *api, const eth_data_req_t *data);

/**
* @brief data_confirm confirm is called as a response to data_request
* @param api The API which handled the request
* @param data Data containing confirm parameters
*/
typedef void eth_mac_data_confirm(const eth_mac_api_t* api, const eth_data_conf_t *data );
typedef void eth_mac_data_confirm(const eth_mac_api_t *api, const eth_data_conf_t *data);

/**
* @brief data_indication Data indication is called when MAC layer has received data
* @param api The API which handled the response
* @param data Data containing indication parameters
*/
typedef void eth_mac_data_indication(const eth_mac_api_t* api, const eth_data_ind_t *data );
typedef void eth_mac_data_indication(const eth_mac_api_t *api, const eth_data_ind_t *data);

/**
* @brief Set 48 bit address from MAC
* @param api API to handle the request
* @param mac48 Pointer having mac address to be set
* @return 0 if successful, -1 otherwise
*/
typedef int8_t eth_mac_mac48_address_set(const eth_mac_api_t* api, const uint8_t *mac48);
typedef int8_t eth_mac_mac48_address_set(const eth_mac_api_t *api, const uint8_t *mac48);

/**
* @brief Read 48 bit address from MAC
* @param api API to handle the request
* @param mac48_buf Pointer where mac address can be written
* @return 0 if successful, -1 otherwise
*/
typedef int8_t eth_mac_mac48_address_get(const eth_mac_api_t* api, uint8_t *mac48_buf);
typedef int8_t eth_mac_mac48_address_get(const eth_mac_api_t *api, uint8_t *mac48_buf);

/**
* @brief Upper layer will call this function, when MAC is taken into use
Expand All @@ -132,7 +132,7 @@ typedef int8_t eth_mac_mac48_address_get(const eth_mac_api_t* api, uint8_t *mac4
* @return 0 if success; -1 if api is NULL or not found
*/
typedef int8_t eth_mac_api_initialize(eth_mac_api_t *api, eth_mac_data_confirm *conf_cb,
eth_mac_data_indication *ind_cb, uint8_t parent_id);
eth_mac_data_indication *ind_cb, uint8_t parent_id);

/**
* \brief Struct eth_mac_api_s defines functions for two-way communications between ethernet MAC and Upper layer.
Expand Down
3 changes: 1 addition & 2 deletions features/nanostack/sal-stack-nanostack/nanostack/fhss_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,7 @@ typedef struct fhss_callback fhss_callback_t;
/**
* @brief FHSS states.
*/
typedef enum
{
typedef enum {
FHSS_UNSYNCHRONIZED,
FHSS_SYNCHRONIZED,
} fhss_states;
Expand Down
21 changes: 7 additions & 14 deletions features/nanostack/sal-stack-nanostack/nanostack/fhss_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@ extern "C" {
/**
* @brief WS channel functions.
*/
typedef enum
{
typedef enum {
/** Fixed channel. */
WS_FIXED_CHANNEL,
/** TR51 channel function. */
Expand All @@ -49,8 +48,7 @@ typedef enum
* \brief Struct fhss_tuning_parameter defines FHSS tuning parameters.
* All delays are given in microseconds.
*/
typedef struct fhss_tuning_parameter
{
typedef struct fhss_tuning_parameter {
/** Delay between data pushed to PHY TX function and TX started (Contains CSMA-CA maximum random period). */
uint32_t tx_processing_delay;

Expand All @@ -64,8 +62,7 @@ typedef struct fhss_tuning_parameter
/**
* \brief Struct fhss_configuration defines basic configuration of FHSS.
*/
typedef struct fhss_configuration
{
typedef struct fhss_configuration {
/** Tuning parameters can be used to enhance synchronization accuracy*/
fhss_tuning_parameter_t fhss_tuning_parameters;

Expand Down Expand Up @@ -94,8 +91,7 @@ typedef int32_t fhss_vendor_defined_cf(const fhss_api_t *api, uint16_t slot, uin
/**
* \brief Struct fhss_ws_configuration defines configuration of WS FHSS.
*/
typedef struct fhss_ws_configuration
{
typedef struct fhss_ws_configuration {
/** WS unicast channel function. */
fhss_ws_channel_functions ws_uc_channel_function;

Expand Down Expand Up @@ -132,8 +128,7 @@ typedef struct fhss_ws_configuration
* \brief Struct fhss_timer defines interface between FHSS and FHSS platform timer.
* Application must implement FHSS timer driver which is then used by FHSS with this interface.
*/
typedef struct fhss_timer
{
typedef struct fhss_timer {
/** Start timeout (1us). Timer must support multiple simultaneous timeouts */
int (*fhss_timer_start)(uint32_t, void (*fhss_timer_callback)(const fhss_api_t *fhss_api, uint16_t), const fhss_api_t *fhss_api);

Expand All @@ -154,8 +149,7 @@ typedef struct fhss_timer
* \brief Struct fhss_synch_configuration defines the synchronization time configurations.
* Border router application must define and set these configuration for FHSS network.
*/
typedef struct fhss_synch_configuration
{
typedef struct fhss_synch_configuration {
/** Number of broadcast channels. */
uint8_t fhss_number_of_bc_channels;

Expand All @@ -174,8 +168,7 @@ typedef struct fhss_synch_configuration
/**
* \brief Struct fhss_statistics defines the available FHSS statistics.
*/
typedef struct fhss_statistics
{
typedef struct fhss_statistics {
/** FHSS synchronization drift compensation (us/channel). */
int16_t fhss_drift_compensation;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ extern "C" {
* @brief unicast_timing_info Unicast timing/hopping schedule information structure.
*/
typedef struct unicast_timing_info {
unsigned unicast_channel_function:3; /**< Unicast schedule channel function */
unsigned unicast_channel_function: 3; /**< Unicast schedule channel function */
uint8_t unicast_dwell_interval; /**< Unicast dwell interval */
uint16_t unicast_number_of_channels; /**< Unicast number of channels */
uint16_t fixed_channel; /**< Unicast fixed channel*/
Expand All @@ -46,7 +46,7 @@ typedef struct unicast_timing_info {
* @brief broadcast_timing_info Broadcast timing/hopping schedule information structure.
*/
typedef struct broadcast_timing_info {
unsigned broadcast_channel_function:3; /**< Broadcast schedule channel function */
unsigned broadcast_channel_function: 3; /**< Broadcast schedule channel function */
uint8_t broadcast_dwell_interval; /**< Broadcast dwell interval */
uint16_t fixed_channel; /**< Broadcast fixed channel*/
uint16_t broadcast_slot; /**< Broadcast slot number */
Expand Down
32 changes: 16 additions & 16 deletions features/nanostack/sal-stack-nanostack/nanostack/mac_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ typedef struct mac_description_storage_size_s {
typedef enum mac_extended_address_type {
MAC_EXTENDED_READ_ONLY, /** EUID64 which is unique */
MAC_EXTENDED_DYNAMIC /** Configured MAC 64-bit address to RAM and Radio */
}mac_extended_address_type;
} mac_extended_address_type;
//External MAC functions

/**
Expand All @@ -113,14 +113,14 @@ typedef enum mac_extended_address_type {
* @param id The identifier of the MLME primitive
* @param data Primitive specific data (\see mlme.h)
*/
typedef void mlme_request(const mac_api_t* api, mlme_primitive id, const void *data);
typedef void mlme_request(const mac_api_t *api, mlme_primitive id, const void *data);

/**
* @brief mcps_request MCPS_DATA request call
* @param api API to handle the request
* @param data MCPS-DATA.request specific values
*/
typedef void mcps_data_request(const mac_api_t* api, const mcps_data_req_t *data);
typedef void mcps_data_request(const mac_api_t *api, const mcps_data_req_t *data);

/**
* @brief mcps_request MCPS_DATA with IE extions request call
Expand All @@ -131,15 +131,15 @@ typedef void mcps_data_request(const mac_api_t* api, const mcps_data_req_t *data
*
* Asynch data request is mac standard extension. asynch_channel_list include channel mask which channel message is requested to send.
*/
typedef void mcps_data_request_ext(const mac_api_t* api, const mcps_data_req_t *data, const mcps_data_req_ie_list_t *ie_ext, const struct channel_list_s *asynch_channel_list);
typedef void mcps_data_request_ext(const mac_api_t *api, const mcps_data_req_t *data, const mcps_data_req_ie_list_t *ie_ext, const struct channel_list_s *asynch_channel_list);

/**
* @brief mcps_purge_request MCPS_PURGE request call
* @param api API to handle the request
* @param data MCPS-PURGE.request specific values
* @return 0 in case of success, non-zero otherwise
*/
typedef uint8_t mcps_purge_request(const mac_api_t* api, const mcps_purge_t *data);
typedef uint8_t mcps_purge_request(const mac_api_t *api, const mcps_purge_t *data);

//Upper layer specific callback functions (will also be set by Upper layer after mac_api_t has been created and given to it)

Expand All @@ -148,30 +148,30 @@ typedef uint8_t mcps_purge_request(const mac_api_t* api, const mcps_purge_t *dat
* @param api The API which handled the response
* @param data MCPS-DATA.confirm specific values
*/
typedef void mcps_data_confirm(const mac_api_t* api, const mcps_data_conf_t *data);
typedef void mcps_data_confirm(const mac_api_t *api, const mcps_data_conf_t *data);

/**
* @brief mcps_data_confirm_ext MCPS-DATA confirm with Enhanced ACK payload is called as a response to MCPS-DATA request
* @param api The API which handled the response
* @param data MCPS-DATA.confirm specific values
* @param conf_data Possible Confirmation Data
*/
typedef void mcps_data_confirm_ext(const mac_api_t* api, const mcps_data_conf_t *data, const mcps_data_conf_payload_t *conf_data);
typedef void mcps_data_confirm_ext(const mac_api_t *api, const mcps_data_conf_t *data, const mcps_data_conf_payload_t *conf_data);

/**
* @brief mcps_data_indication MCPS-DATA indication is called when MAC layer has received data
* @param api The API which handled the response
* @param data MCPS-DATA.indication specific values
*/
typedef void mcps_data_indication(const mac_api_t* api, const mcps_data_ind_t *data);
typedef void mcps_data_indication(const mac_api_t *api, const mcps_data_ind_t *data);

/**
* @brief mcps_data_indication MCPS-DATA indication is called when MAC layer has received data
* @param api The API which handled the response
* @param data MCPS-DATA.indication specific values
* @param ie_ext Information element list
*/
typedef void mcps_data_indication_ext(const mac_api_t* api, const mcps_data_ind_t *data, const mcps_data_ie_list_t *ie_ext);
typedef void mcps_data_indication_ext(const mac_api_t *api, const mcps_data_ind_t *data, const mcps_data_ie_list_t *ie_ext);

/**
* @brief mcps_ack_data_req_ext Callback for request IE elements and payload to enhanced ACK
Expand All @@ -180,52 +180,52 @@ typedef void mcps_data_indication_ext(const mac_api_t* api, const mcps_data_ind_
* @param rssi Signal strength for received packet
* @param lqi Link quality to neighbor
*/
typedef void mcps_ack_data_req_ext(const mac_api_t* api, mcps_ack_data_payload_t *data, int8_t rssi, uint8_t lqi);
typedef void mcps_ack_data_req_ext(const mac_api_t *api, mcps_ack_data_payload_t *data, int8_t rssi, uint8_t lqi);


/**
* @brief mcps_purge_confirm MCPS-PURGE confirm is called as a response to MCPS-PURGE request
* @param api The API which handled the request
* @param data MCPS-PURGE.confirm specific values
*/
typedef void mcps_purge_confirm( const mac_api_t* api, mcps_purge_conf_t *data );
typedef void mcps_purge_confirm(const mac_api_t *api, mcps_purge_conf_t *data);

/**
* @brief mlme_confirm One of the MLME primitive confirm callbacks
* @param api API which handled the response
* @param id The identifier of the MLME primitive
* @param data Primitive specific data (\see mlme.h)
*/
typedef void mlme_confirm(const mac_api_t* api, mlme_primitive id, const void *data);
typedef void mlme_confirm(const mac_api_t *api, mlme_primitive id, const void *data);

/**
* @brief mlme_indication One of the
* @param api API which handled the response
* @param id The identifier of the MLME primitive
* @param data Primitive specific data (\see mlme.h)
*/
typedef void mlme_indication(const mac_api_t* api, mlme_primitive id, const void *data);
typedef void mlme_indication(const mac_api_t *api, mlme_primitive id, const void *data);

/**
* @brief Set extended address from MAC
* @param api API to handle the request
* @param mac64 pointer
*/
typedef int8_t mac_ext_mac64_address_set(const mac_api_t* api, const uint8_t *mac64);
typedef int8_t mac_ext_mac64_address_set(const mac_api_t *api, const uint8_t *mac64);

/**
* @brief Read extended address from MAC
* @param api API to handle the request
* @param mac64_buf Pointer where mac extended address can be written
*/
typedef int8_t mac_ext_mac64_address_get(const mac_api_t* api, mac_extended_address_type type, uint8_t *mac64_buf);
typedef int8_t mac_ext_mac64_address_get(const mac_api_t *api, mac_extended_address_type type, uint8_t *mac64_buf);

/**
* @brief Read MAC security description storage sizes from MAC
* @param api API to handle the request
* @param buffer Pointer where supported sizes can be written
*/
typedef int8_t mac_storage_decription_sizes_get(const mac_api_t* api, mac_description_storage_size_t *buffer);
typedef int8_t mac_storage_decription_sizes_get(const mac_api_t *api, mac_description_storage_size_t *buffer);

/**
* @brief mac_api_initialize Initialises MAC layer into use, callbacks must be non-NULL.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@
* See IEEE standard 802.15.4-2006 (e.g end of table 41) for more details
*/
typedef struct mlme_security_s {
unsigned SecurityLevel:3; /**< Security level */
unsigned KeyIdMode:2; /**< 2-bit value which define key source and ID use case */
unsigned SecurityLevel: 3; /**< Security level */
unsigned KeyIdMode: 2; /**< 2-bit value which define key source and ID use case */
uint8_t KeyIndex; /**< Key index */
uint8_t Keysource[8]; /**< Key source */
} mlme_security_t;
Expand All @@ -79,7 +79,7 @@ typedef struct mlme_security_s {
*/
typedef struct mac_header_IE_s {
uint8_t *content_ptr; /**< Content data */
unsigned length:7; /**< Element length 0- 127 */
unsigned length: 7; /**< Element length 0- 127 */
uint8_t id; /**< Element ID */
} mac_header_IE_t;

Expand All @@ -95,8 +95,8 @@ typedef struct mac_header_IE_s {
*/
typedef struct mac_payload_IE_s {
uint8_t *content_ptr; /**< Content data */
unsigned length:11; /**< Element length 0- 2047 */
unsigned id:4; /**< Group ID */
unsigned length: 11; /**< Element length 0- 2047 */
unsigned id: 4; /**< Group ID */
} mac_payload_IE_t;

#endif /* MAC_COMMON_DEFINES_H_ */
14 changes: 7 additions & 7 deletions features/nanostack/sal-stack-nanostack/nanostack/mac_mcps.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,18 +32,18 @@
* See IEEE standard 802.15.4-2006 (table 41) for more details
*/
typedef struct mcps_data_req_s {
unsigned SrcAddrMode:2; /**< Source address mode */
unsigned DstAddrMode:2; /**< Destination address mode */
unsigned SrcAddrMode: 2; /**< Source address mode */
unsigned DstAddrMode: 2; /**< Destination address mode */
uint16_t DstPANId; /**< Destination PAN ID */
uint8_t DstAddr[8]; /**< Destination address */
uint16_t msduLength; /**< Service data unit length */
uint8_t *msdu; /**< Service data unit */
uint8_t msduHandle; /**< Handle associated with MSDU */
bool TxAckReq: 1; /**< Specifies whether ACK is needed or not */
bool InDirectTx:1; /**< Specifies whether indirect or direct transmission is used */
bool InDirectTx: 1; /**< Specifies whether indirect or direct transmission is used */
bool PendingBit: 1; /**< Specifies whether more fragments are to be sent or not */
bool SeqNumSuppressed:1; /**< True suppress sequence number from frame. This will be only checked when 2015 extension is enabled */
bool PanIdSuppressed:1; /**< True suppress PAN-id is done when possible from frame. This will be only checked when 2015 extension is enabled */
bool SeqNumSuppressed: 1; /**< True suppress sequence number from frame. This will be only checked when 2015 extension is enabled */
bool PanIdSuppressed: 1; /**< True suppress PAN-id is done when possible from frame. This will be only checked when 2015 extension is enabled */
mlme_security_t Key; /**< Security key */
} mcps_data_req_t;

Expand Down Expand Up @@ -82,10 +82,10 @@ typedef struct mcps_data_conf_payload_s {
* See IEEE standard 802.15.4-2006 (table 43) for more details
*/
typedef struct mcps_data_ind_s {
unsigned SrcAddrMode:2; /**< 0x00 = no address 0x01 = reserved 0x02 = 16-bit short address 0x03 = 64-bit extended address */
unsigned SrcAddrMode: 2; /**< 0x00 = no address 0x01 = reserved 0x02 = 16-bit short address 0x03 = 64-bit extended address */
uint16_t SrcPANId; /**< Source PAN ID */
uint8_t SrcAddr[8]; /**< Source address */
unsigned DstAddrMode:2; /**< Destination address mode */
unsigned DstAddrMode: 2; /**< Destination address mode */
uint16_t DstPANId; /**< Destination PAN ID */
uint8_t DstAddr[8]; /**< Destination address */
uint8_t mpduLinkQuality; /**< LQI value measured during reception of the MPDU */
Expand Down
Loading

0 comments on commit d879422

Please sign in to comment.