flexPTP 1.0
An IEEE 1588 PTP implementation designed for microcontrollers
Loading...
Searching...
No Matches
ptp_profile_presets.c File Reference
#include "ptp_profile_presets.h"
#include "ptp_types.h"
#include "ptp_defs.h"
#include <stdint.h>
#include <string.h>

Go to the source code of this file.

Data Structures

struct  PtpProfilePreset
 PTP profile preset structure. More...
 
struct  PtpTlvPreset
 PTP TLV presets. More...
 

Enumerations

enum  PtpProfileEnum { PTP_PROFILE_DEFAULT , PTP_PROFILE_GPTP , PTP_PROFILE_DEF_P2P , PTP_PROFILE_N }
 Enumeration type for predefined profiles. More...
 
enum  PtpTlvPresetEnum { PTP_TLVP_GPTP_ORG , PTP_TLVP_N }
 

Functions

struct __attribute__ ((packed))
 
const PtpProfileptp_profile_preset_get (const char *pName)
 
const PtpProfileTlvElementptp_tlv_chain_preset_get (const char *pName)
 
size_t ptp_profile_preset_cnt ()
 
size_t ptp_tlv_chain_preset_cnt ()
 
const char * ptp_profile_preset_get_name (size_t i)
 
const char * ptp_tlv_chain_preset_get_name (size_t i)
 

Variables

 PtpGPtpOrganizationTlv
 
static const PtpGPtpOrganizationTlv gPtp_OrgTlv
 
static const PtpProfileTlvElement gPtp_TlvSet
 
static PtpTlvPreset sTlvPresets [PTP_TLVP_N]
 
static PtpProfilePreset sPtpProfiles [PTP_PROFILE_N]
 

Enumeration Type Documentation

◆ PtpProfileEnum

Enumeration type for predefined profiles.

Enumerator
PTP_PROFILE_DEFAULT 
PTP_PROFILE_GPTP 
PTP_PROFILE_DEF_P2P 
PTP_PROFILE_N 

Definition at line 11 of file ptp_profile_presets.c.

◆ PtpTlvPresetEnum

Enumerator
PTP_TLVP_GPTP_ORG 
PTP_TLVP_N 

Definition at line 18 of file ptp_profile_presets.c.

Function Documentation

◆ __attribute__()

struct __attribute__ ( (packed)  )

< Type of the TLV

< Length of this TLV

Definition at line 1 of file ptp_profile_presets.c.

◆ ptp_profile_preset_cnt()

size_t ptp_profile_preset_cnt ( )

Get number of predefined profiles.

Returns
number of profiles

Definition at line 152 of file ptp_profile_presets.c.

◆ ptp_profile_preset_get()

const PtpProfile * ptp_profile_preset_get ( const char *  pName)

Get profile by name.

Parameters
pNamename of the desired profile
Returns
const pointer to the profile or NULL if not found

Definition at line 128 of file ptp_profile_presets.c.

◆ ptp_profile_preset_get_name()

const char * ptp_profile_preset_get_name ( size_t  i)

Get profile name by index.

Parameters
iprofile index
Returns
const pointer to the profile that's associated the ith index or NULL

Definition at line 160 of file ptp_profile_presets.c.

◆ ptp_tlv_chain_preset_cnt()

size_t ptp_tlv_chain_preset_cnt ( )

Get number of predefined TLV chains.

Returns
number of TLV chains

Definition at line 156 of file ptp_profile_presets.c.

◆ ptp_tlv_chain_preset_get()

const PtpProfileTlvElement * ptp_tlv_chain_preset_get ( const char *  pName)

Get TLV chain by name.

Parameters
pNamename of the desired TLV chain
Returns
const pointer to the chain or NULL if not found

Definition at line 140 of file ptp_profile_presets.c.

◆ ptp_tlv_chain_preset_get_name()

const char * ptp_tlv_chain_preset_get_name ( size_t  i)

Get TLV chain by index.

Parameters
iTLV chain index
Returns
const pointer to the TLV chain that's associated the ith index or NULL

Definition at line 168 of file ptp_profile_presets.c.

Variable Documentation

◆ gPtp_OrgTlv

const PtpGPtpOrganizationTlv gPtp_OrgTlv
static
Initial value:
= {
.type = (((( ( PTP_TLV_ORGANIZATION_EXTENSION ) ) >> 8) & 0x00ff) | ((( ( PTP_TLV_ORGANIZATION_EXTENSION ) ) << 8) & 0xff00)),
.length = (((( ( 28 ) ) >> 8) & 0x00ff) | ((( ( 28 ) ) << 8) & 0xff00)),
.organizationId = {0x00, 0x80, 0xC2},
.organizationSubType = {0x00, 0x00, 0x01},
.cumulativeScaleRateOffset = (((( ( 0 ) ) >> 24) & 0x000000ff) | ((( ( 0 ) ) >> 8) & 0x0000ff00) | ((( ( 0 ) ) << 8) & 0x00ff0000) | ((( ( 0 ) ) << 24) & 0xff000000)),
.gmTimeBaseIndicator = (((( ( 0 ) ) >> 8) & 0x00ff) | ((( ( 0 ) ) << 8) & 0xff00)),
.lastGmPhaseChange = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
.scaledLastGmFreqChange = (((( ( 0 ) ) >> 24) & 0x000000ff) | ((( ( 0 ) ) >> 8) & 0x0000ff00) | ((( ( 0 ) ) << 8) & 0x00ff0000) | ((( ( 0 ) ) << 24) & 0xff000000))}
@ PTP_TLV_ORGANIZATION_EXTENSION
Organization extension.
Definition: ptp_types.h:350

Definition at line 35 of file ptp_profile_presets.c.

◆ gPtp_TlvSet

const PtpProfileTlvElement gPtp_TlvSet
static
Initial value:
= {
.data = &gPtp_OrgTlv,
.size = sizeof(PtpGPtpOrganizationTlv),
.msgType = PTP_MT_Follow_Up,
NULL}
PtpGPtpOrganizationTlv
static const PtpGPtpOrganizationTlv gPtp_OrgTlv
@ PTP_MT_Follow_Up
Follow Up.
Definition: ptp_types.h:34

Definition at line 45 of file ptp_profile_presets.c.

◆ PtpGPtpOrganizationTlv

PtpGPtpOrganizationTlv

Definition at line 33 of file ptp_profile_presets.c.

◆ sPtpProfiles

PtpProfilePreset sPtpProfiles[PTP_PROFILE_N]
static

Predefined profiles.

Definition at line 84 of file ptp_profile_presets.c.

◆ sTlvPresets

PtpTlvPreset sTlvPresets[PTP_TLVP_N]
static
Initial value:
= {
{
"gptp",
}
}
static const PtpProfileTlvElement gPtp_TlvSet

Predefined TLV chains.

Definition at line 74 of file ptp_profile_presets.c.