1 /* 2 * Copyright (c) 2026, Arm Limited. All rights reserved. 3 * 4 * SPDX-License-Identifier: BSD-3-Clause 5 * 6 */ 7 8 #ifndef __SFCP_PLATFORM_H__ 9 #define __SFCP_PLATFORM_H__ 10 11 #include <stddef.h> 12 13 #include <drivers/arm/sfcp_link_defs.h> 14 #include "sfcp_trusted_subnet.h" 15 16 #ifdef __cplusplus 17 extern "C" { 18 #endif 19 20 /** 21 * \enum sfcp_platform_device_type_t 22 * \brief Enumeration of supported RSE communication platform device types. 23 */ 24 enum sfcp_platform_device_type_t { 25 /** 26 * \brief Represents an MHUv2 device type. 27 */ 28 SFCP_PLATFORM_DEVICE_TYPE_MHUV2, 29 30 /** 31 * \brief Represents an MHUv3 device type. 32 */ 33 SFCP_PLATFORM_DEVICE_TYPE_MHUV3, 34 }; 35 36 /** 37 * \struct sfcp_platform_device_t 38 * \brief Represents a platform communication device with its type. 39 * 40 * This structure is used to abstract the underlying communication hardware. 41 * Platform implementations must populate this structure with appropriate values. 42 */ 43 struct sfcp_platform_device_t { 44 /** 45 * \brief Pointer to the underlying hardware device. 46 */ 47 const void *device; 48 49 /** 50 * \brief Type of the device, as defined in sfcp_platform_device_type_t. 51 */ 52 enum sfcp_platform_device_type_t type; 53 }; 54 55 /** 56 * \brief Retrieves the send device associated with a given communication link ID. 57 * 58 * This function must be implemented by each platform to return the appropriate 59 * hardware device used for sending data on the specified link. 60 * 61 * \param link_id The link ID identifying the communication channel. 62 * \return A platform device structure corresponding to the sending device for the 63 * specified link ID. 64 */ 65 struct sfcp_platform_device_t 66 sfcp_platform_get_send_device(sfcp_link_id_t link_id); 67 68 /** 69 * \brief Retrieves the receive device associated with a given communication link ID. 70 * 71 * This function must be implemented by each platform to return the appropriate 72 * hardware device used for receiving data on the specified link. 73 * 74 * \param link_id The link ID identifying the communication channel. 75 * \return A platform device structure corresponding to the receiving device for the 76 * specified link ID. 77 */ 78 struct sfcp_platform_device_t 79 sfcp_platform_get_receive_device(sfcp_link_id_t link_id); 80 81 /** 82 * \brief Retrieves the link ID associated with a given receiving platform device. 83 * 84 * This function must be implemented by each platform to map a receive device 85 * back to its corresponding communication link ID. 86 * 87 * \param device The receive device whose link ID is to be determined. 88 * \return The link ID corresponding to the provided receive device. 89 */ 90 sfcp_link_id_t 91 sfcp_platform_get_receive_link_id(struct sfcp_platform_device_t device); 92 93 /** 94 * \brief Returns the node identifier assigned to this platform instance. 95 * 96 * \return The platform node ID used for routing decisions. 97 */ 98 sfcp_node_id_t sfcp_platform_get_my_node_id(void); 99 100 /** 101 * \brief Retrieves the routing tables provided by the platform. 102 * 103 * The routing tables describe how messages are sent between nodes. 104 * 105 * \param routing_tables Output pointer that receives the base address of the 106 * routing table data. 107 * \param routing_tables_size Output pointer that receives the size of the 108 * routing table data in bytes. 109 */ 110 void sfcp_platform_get_routing_tables(const uint8_t **routing_tables, 111 size_t *routing_tables_size); 112 113 /** 114 * \brief Provides the list of trusted subnet configurations for the platform. 115 * 116 * This function exposes the statically defined trusted subnet table to the caller. 117 * This is unused unless the platform is making use of SFCP encryption. 118 * 119 * \param trusted_subnets Output pointer that receives the base address of the 120 * trusted subnet configuration array. 121 * \param num_trusted_subnets Output pointer that receives the number of 122 * entries in the trusted subnet configuration array. 123 */ 124 void sfcp_platform_get_trusted_subnets( 125 struct sfcp_trusted_subnet_config_t **trusted_subnets, 126 size_t *num_trusted_subnets); 127 128 #ifdef __cplusplus 129 } 130 #endif 131 132 #endif /* __SFCP_PLATFORM_H__ */ 133