mirror of
https://github.com/logicog/RTLPlayground.git
synced 2026-11-01 18:04:12 +08:00
lldp_tick counted main-loop passes, so the 6000 meant for 30 s at SYS_TICK_HZ ran at whatever rate the loop happened to have, and the interval moved with httpd and SFP load. Step once per second from the tick counter like the STP timers do, count seconds to the interval and derive the TTL from it with the 802.1AB hold multiplier of 4.
37 lines
966 B
C
37 lines
966 B
C
#ifndef _LLDP_H_
|
|
#define _LLDP_H_
|
|
|
|
#include <stdint.h>
|
|
|
|
#define LLDP_MIN_ETHERNET_PAYLOAD_LENGTH 46
|
|
#define LLDP_ETHERTYPE 0x88cc
|
|
#define LLDP_ETHERTYPE_LENGTH 2
|
|
#define LLDP_MAX_FRAME 256
|
|
#define LLDP_TX_INTERVAL_S 30
|
|
#define LLDP_HOLD_MULTIPLIER 4
|
|
|
|
#define LLDP_PORT_ID_TLV_TYPE 2
|
|
#define LLDP_PORT_ID_TLV_LENGTH 0x02
|
|
#define LLDP_PORT_ID_TLV_SUBTYPE 0x07
|
|
|
|
#define LLDP_TTL_TLV_TYPE 3
|
|
#define LLDP_TTL_TLV_LENGTH 2
|
|
#define LLDP_TTL_TTL_SECONDS (LLDP_HOLD_MULTIPLIER * LLDP_TX_INTERVAL_S)
|
|
|
|
#define LLDP_CHASSIS_ID_TLV_TYPE 1
|
|
#define LLDP_CHASSIS_ID_TLV_LENGTH 7
|
|
#define LLDP_CHASSIS_ID_TLV_SUBTYPE 4
|
|
|
|
#define LLDP_SYSNAME_TLV_TYPE 5
|
|
#define LLDP_SYSDESC_TLV_TYPE 6
|
|
|
|
void lldp_init(void) __banked;
|
|
void lldp_tick(void) __banked;
|
|
void lldp_send(void) __banked;
|
|
void lldp_set_addresses(void) __banked;
|
|
void lldp_set_rtl_wrapper(void) __banked;
|
|
uint8_t lldp_sysname(__xdata uint8_t *p) __banked;
|
|
uint8_t lldp_sysdesc(__xdata uint8_t *p) __banked;
|
|
|
|
#endif
|