1 /*************************************************************************** 2 * Copyright (c) 2024 Microsoft Corporation 3 * 4 * This program and the accompanying materials are made available under the 5 * terms of the MIT License which is available at 6 * https://opensource.org/licenses/MIT. 7 * 8 * SPDX-License-Identifier: MIT 9 **************************************************************************/ 10 11 /**************************************************************************/ 12 /**************************************************************************/ 13 /** */ 14 /** NetX SRP Component */ 15 /** */ 16 /** Stream Reservation Protocol (SRP) */ 17 /** */ 18 /**************************************************************************/ 19 /**************************************************************************/ 20 #ifndef NX_SRP_H 21 #define NX_SRP_H 22 23 #include "nx_api.h" 24 25 #include "nx_mrp.h" 26 #include "nx_mvrp.h" 27 #include "nx_msrp.h" 28 #include "nx_shaper.h" 29 /* Define the structure of SRP Service */ 30 #define NX_SRP_PARAMETER_NULL (1) 31 32 typedef UINT (*NX_SRP_EVENT_CALLBACK)(NX_MRP_PARTICIPANT *participant, NX_MRP_ATTRIBUTE *attribute, UCHAR event, VOID *callback_data); 33 34 #ifndef NX_SRP_TALKER_NUM 35 #define NX_SRP_TALKER_NUM (NX_MAX_PHYSICAL_INTERFACES) 36 #endif 37 38 #define NX_SRP_CLASS_A_INTERVAL (125) /* us */ 39 #define NX_SRP_CLASS_B_INTERVAL (250) /* us */ 40 41 #define NX_SRP_SR_CLASS_A (6) 42 #define NX_SRP_SR_CLASS_B (5) 43 44 /* Define the structure of SRP talker. */ 45 typedef struct NX_SRP_TALKER_STRUCT 46 { 47 UCHAR stream_id[8]; 48 UCHAR in_used; 49 UCHAR class_id; 50 UCHAR class_priority; 51 USHORT class_vid; 52 UINT interval; 53 UINT max_interval_frames; 54 UINT max_frame_size; 55 56 ULONG physical_address_msw; 57 ULONG physical_address_lsw; 58 59 UINT vlan_interface_index; 60 61 NX_SHAPER_CBS_PARAMETER cbs_parameters; 62 } NX_SRP_TALKER; 63 64 /* Define the structure of SRP Service. */ 65 typedef struct NX_SRP_STRUCT 66 { 67 NX_MRP nx_mrp; 68 69 NX_MSRP nx_msrp; 70 71 NX_MVRP nx_mvrp; 72 73 NX_SRP_TALKER talker[NX_SRP_TALKER_NUM]; 74 } NX_SRP; 75 76 /* Define APIs. */ 77 UINT nx_srp_init(NX_SRP *srp_ptr, NX_IP *ip_ptr, UINT interface_index, NX_PACKET_POOL *pkt_pool_ptr, 78 VOID *stack_ptr, ULONG stack_size, UINT priority); 79 UINT nx_srp_talker_start(NX_SRP *srp_ptr, NX_MSRP_DOMAIN *srp_domain, UCHAR *stream_id, UCHAR *dest_addr, 80 UINT max_frame_size, UINT max_interval_frames, NX_MRP_EVENT_CALLBACK event_callback); 81 UINT nx_srp_talker_stop(NX_SRP *srp_ptr, UCHAR *stream_id, NX_MSRP_DOMAIN *domain); 82 UINT nx_srp_listener_start(NX_SRP *srp_ptr, NX_MRP_EVENT_CALLBACK event_callback, UCHAR *wait_stream_id); 83 UINT nx_srp_listener_stop(NX_SRP *srp_ptr, UCHAR *stream_id, NX_MSRP_DOMAIN *domain); 84 85 /* Define internal functions */ 86 UINT nx_srp_cbs_config_get(UINT sr_class, INT port_rate, UINT interval, UINT frames_per_interval, UINT max_frame_size, UINT non_sr_frame_size, INT idle_slope_a, UINT max_frame_size_a, NX_SHAPER_CBS_PARAMETER *cbs_param); 87 UINT nx_srp_talker_cbs_set(NX_SRP *srp_ptr, UINT index); 88 #endif 89 90