residual code errors fixed
This commit is contained in:
		
							parent
							
								
									ac63947fe1
								
							
						
					
					
						commit
						cc86923abd
					
				@ -32,3 +32,29 @@ void ptp_create_clock_identity()
 | 
			
		||||
    ptp_print_clock_identity(S.hwoptions.clockIdentity);
 | 
			
		||||
    MSG("\n");
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// convert string clock id to 64-bit number
 | 
			
		||||
uint64_t hextoclkid(const char *str)
 | 
			
		||||
{
 | 
			
		||||
    size_t len = strlen(str);
 | 
			
		||||
    uint64_t clkid = 0;
 | 
			
		||||
    for (size_t i = 0; i < len; i++) {
 | 
			
		||||
        char digit = tolower(str[i]);
 | 
			
		||||
        if (digit >= '0' && digit <= '9') {
 | 
			
		||||
            digit = digit - '0';
 | 
			
		||||
        } else if (digit >= 'a' && digit <= 'f') {
 | 
			
		||||
            digit = digit - 'a' + 10;
 | 
			
		||||
        } else {
 | 
			
		||||
            break;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        clkid += (uint64_t) digit *((uint64_t) 1 << (4 * i));
 | 
			
		||||
    }
 | 
			
		||||
    uint8_t *p = NULL;
 | 
			
		||||
    for (size_t i = 0; i < 8; i++) {
 | 
			
		||||
        p = ((uint8_t *) & clkid) + i;
 | 
			
		||||
        *p = ((*p & 0x0F) << 4) | ((*p & 0xF0) >> 4);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    return clkid;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -4,6 +4,7 @@
 | 
			
		||||
#include <stdint.h>
 | 
			
		||||
 | 
			
		||||
void ptp_print_clock_identity(uint64_t clockID);        // print clock identity
 | 
			
		||||
uint64_t hextoclkid(const char *str);   // convert hexadecimal string to 64-bit clock id
 | 
			
		||||
 | 
			
		||||
void ptp_create_clock_identity();       // create clock identity based on MAC address
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -85,10 +85,10 @@ void ptp_delete_timers()
 | 
			
		||||
// initialize Delay_Req header
 | 
			
		||||
void ptp_init_delay_req_header()
 | 
			
		||||
{
 | 
			
		||||
    sDelayReqHeader.messageType = S.profile.delayMechanism == PTP_DM_E2E ? PTP_MT_Delay_Req : PTP_MT_PDelay_Req;
 | 
			
		||||
    sDelayReqHeader.messageType = PTP_MT_Delay_Req;
 | 
			
		||||
    sDelayReqHeader.transportSpecific = (uint8_t) S.profile.transportSpecific;
 | 
			
		||||
    sDelayReqHeader.versionPTP = 2;     // PTPv2
 | 
			
		||||
    sDelayReqHeader.messageLength = PTP_HEADER_LENGTH + PTP_TIMESTAMP_LENGTH + (S.profile.delayMechanism == PTP_DM_P2P ? PTP_TIMESTAMP_LENGTH : 0);
 | 
			
		||||
    sDelayReqHeader.messageLength = PTP_HEADER_LENGTH + PTP_TIMESTAMP_LENGTH;
 | 
			
		||||
    sDelayReqHeader.domainNumber = S.profile.domainNumber;
 | 
			
		||||
    ptp_clear_flags(&(sDelayReqHeader.flags));  // no flags
 | 
			
		||||
    sDelayReqHeader.correction_ns = 0;
 | 
			
		||||
@ -98,7 +98,7 @@ void ptp_init_delay_req_header()
 | 
			
		||||
 | 
			
		||||
    sDelayReqHeader.sourcePortID = 1;   // TODO? No more ports...
 | 
			
		||||
    sDelayReqHeader.sequenceID = 0;     // will change in every sync cycle
 | 
			
		||||
    sDelayReqHeader.control = S.profile.delayMechanism == PTP_DM_E2E ? PTP_CON_Delay_Req : PTP_CON_Other;
 | 
			
		||||
    sDelayReqHeader.control = PTP_CON_Delay_Req;
 | 
			
		||||
    sDelayReqHeader.logMessagePeriod = 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -18,9 +18,9 @@ static struct {
 | 
			
		||||
 | 
			
		||||
static const uint16_t sPortLut[2] = { PTP_PORT_EVENT, PTP_PORT_GENERAL };
 | 
			
		||||
static ip4_addr_t sIpLut[2] = { 0 };
 | 
			
		||||
static const uint8_t *sEthLut[2] = { PTP_ETHERNET_PRIMARY, PTP_ETHERNET_PEER_DELAY };
 | 
			
		||||
static const uint8_t *sEthLut[2] = { PTP_ETHERNET_PRIMARY };
 | 
			
		||||
 | 
			
		||||
void ptp_transmit_init(struct udp_pcb *pPriE, struct udp_pcb *pPriG,)
 | 
			
		||||
void ptp_transmit_init(struct udp_pcb *pPriE, struct udp_pcb *pPriG)
 | 
			
		||||
{
 | 
			
		||||
    sPcbLut.pPri_Ev = pPriE;
 | 
			
		||||
    sPcbLut.pPri_Gen = pPriG;
 | 
			
		||||
 | 
			
		||||
@ -3,7 +3,7 @@
 | 
			
		||||
 | 
			
		||||
#include "ptp_types.h"
 | 
			
		||||
 | 
			
		||||
void ptp_transmit_init(struct udp_pcb *pPriE, struct udp_pcb *pPriG,);  // initialize PTP transmitter
 | 
			
		||||
void ptp_transmit_init(struct udp_pcb *pPriE, struct udp_pcb *pPriG);   // initialize PTP transmitter
 | 
			
		||||
void ptp_transmit_msg(RawPtpMessage * pMsg);    // transmit PTP message
 | 
			
		||||
bool ptp_transmit_enqueue(const RawPtpMessage * pMsg);  // enqueue message TODO: refactor...
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -58,6 +58,11 @@ uint32_t ptp_get_addend()
 | 
			
		||||
    return S.hwclock.addend;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
PtpTransportType ptp_get_transport_type()
 | 
			
		||||
{
 | 
			
		||||
    return S.profile.transportType;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void ptp_time(TimestampU * pT)
 | 
			
		||||
{
 | 
			
		||||
    PTP_HW_GET_TIME(pT);
 | 
			
		||||
 | 
			
		||||
@ -15,6 +15,7 @@ void ptp_set_domain(uint8_t domain);    // set PTP domain
 | 
			
		||||
uint8_t ptp_get_domain();       // get PTP domain
 | 
			
		||||
void ptp_set_addend(uint32_t addend);   // set hardware clock addend (frequency tuning!)
 | 
			
		||||
uint32_t ptp_get_addend();      // get hardware clock addend
 | 
			
		||||
PtpTransportType ptp_get_transport_type();      // get PTP transport type
 | 
			
		||||
 | 
			
		||||
void ptp_time(TimestampU * pT); // get time
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -126,7 +126,7 @@ void reg_task_ptp()
 | 
			
		||||
    join_ptp_igmp_groups();     // enter PTP IGMP groups
 | 
			
		||||
    create_ptp_listeners();     // create listeners
 | 
			
		||||
#ifndef SIMULATION
 | 
			
		||||
    ptp_transmit_init(spPTP_PRIMARY_EVENT_pcb, spPTP_PRIMARY_GENERAL_pcb,);     // initialize transmit function*/
 | 
			
		||||
    ptp_transmit_init(spPTP_PRIMARY_EVENT_pcb, spPTP_PRIMARY_GENERAL_pcb);      // initialize transmit function*/
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
    // create task
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user