[WIP] Add comprehensive German-language documentation for PTP Grandmaster module - #5
Merged
zabooh merged 1 commit intoApr 3, 2026
Conversation
zabooh
marked this pull request as ready for review
April 3, 2026 14:25
Copilot stopped work on behalf of
zabooh due to an error
April 3, 2026 14:25
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Original prompt
Objective
Create a comprehensive German-language documentation file
README_GM.mdthat thoroughly documents the PTP Grandmaster module (ptp_gm_task.c).Required Content Sections
1. Call Tree (Aufrufbaum)
Document the complete call tree from
main()toPTP_GM_Service()including:SYS_Initialize()→APP_Initialize()GM_TimerCallback()is invoked every 1msPTP_MASTERmodePTP_GM_Service()2. State Machine Flow (Zustandsmaschine Ablauf)
Provide an exhaustive explanation of the state machine including:
GM_STATE_IDLE- initial/disabled stateGM_STATE_WAIT_PERIOD- periodic sync timingGM_STATE_SEND_SYNC- frame preparationGM_STATE_WRITE_TXMCTL/GM_STATE_WAIT_WRITE_TXMCTL- TX Match controlGM_STATE_WAIT_SYNC_TX_DONE- transmission confirmationGM_STATE_WAIT_STATUS0- timestamp capture pollingGM_STATE_READ_TTSCA_H/GM_STATE_WAIT_TTSCA_H- seconds register readGM_STATE_READ_TTSCA_L/GM_STATE_WAIT_TTSCA_L- nanoseconds register readGM_STATE_WRITE_CLEAR/GM_STATE_WAIT_CLEAR- W1C status clearGM_STATE_SEND_FOLLOWUP/GM_STATE_WAIT_FOLLOWUP_TX_DONE- Follow-Up transmissionGM_STATE_INIT_WRITE/GM_STATE_WAIT_INIT_WRITE- initialization sequenceGM_STATE_DEINIT_WRITE/GM_STATE_WAIT_DEINIT_WRITE- deinitialization sequenceGM_STATE_READ_TXMCTL,GM_STATE_WAIT_TXMCTL,GM_STATE_READ_STATUS03. Static Variables (Statische Variablen)
Document all module-level static variables with purpose and usage:
gm_state- current state machine stategm_op_done,gm_op_val- register operation synchronizationgm_tx_busy- frame transmission flaggm_status0,gm_ts_sec,gm_ts_nsec- timestamp capturegm_tick_ms,gm_period_start- timing countersgm_seq_id,gm_sync_cnt- sequence trackinggm_retry_cnt,gm_wait_ticks- retry/timeout managementgm_sync_interval_ms- configurable sync periodgm_src_mac- source MAC addressgm_dst_mode- destination mode (multicast/broadcast)gm_seq_step- init/deinit sequence step countergm_sync_buf,gm_followup_buf,gm_noip_bufgm_init_addrs/vals,gm_deinit_addrs/vals4. Function Documentation (Funktionsdokumentation)
For each public and internal function, document:
PTP_GM_Init()- initialization and async register write kickoffPTP_GM_Service()- main 1ms tick state machinePTP_GM_Deinit()- cleanup and disarm sequencePTP_GM_GetStatus()- status queryPTP_GM_SetSyncInterval()- interval configurationPTP_GM_SetDstMode()/PTP_GM_GetDstMode()- destination modePTP_GM_RequestRegDump()- diagnostic register dumpgm_op_cb()- register read/write callbackgm_tx_cb()- frame TX done callbackgm_read_register(),gm_write_register()- register access wrappersgm_send_raw_eth_frame()- raw frame transmissiongm_get_and_clear_ts_capture()- timestamp retrievalbuild_eth_header()- Ethernet header constructionfill_clock_identity()- EUI-64 clock ID generationbuild_sync()- PTP Sync message builderbuild_followup()- PTP Follow-Up message builderbuild_noip_test_frame()- test frame buildergm_set_state()/gm_state_to_str()- state management5. Non-Blocking Architecture (Nicht-Blockierende Architektur)
Critical focus area - explain in detail:
DRV_LAN865X_ReadRegister()/WriteRegister()calls useuseCallbackProtectedMode=truegm_op_doneflag and stores result ingm_op_valgm_op_donein WAIT statesgm_wait_tickscounter (typically 200ms)DRV_LAN865X_SendRawEthFrame()returns immediatelygm_tx_cb()clearsgm_tx_busyflag when hardware completes TXgm_seq_steptracks progress thr...This pull request was created from Copilot chat.