@@ -2231,6 +2231,158 @@ uint32_t FreeRTOS_GetIPAddress( void )
22312231}
22322232/*-----------------------------------------------------------*/
22332233
2234+ #if defined( ipconfigIPv4_BACKWARD_COMPATIBLE ) && ( ipconfigIPv4_BACKWARD_COMPATIBLE == 1 )
2235+
2236+ /*
2237+ * The helper functions here below assume that there is a single
2238+ * interface and a single end-point (ipconfigIPv4_BACKWARD_COMPATIBLE)
2239+ */
2240+
2241+ /**
2242+ * @brief Sets the IP address of the NIC.
2243+ *
2244+ * @param[in] ulIPAddress: IP address of the NIC to be set.
2245+ */
2246+ void FreeRTOS_SetIPAddress ( uint32_t ulIPAddress )
2247+ {
2248+ /* Sets the IP address of the NIC. */
2249+ NetworkEndPoint_t * pxEndPoint = FreeRTOS_FirstEndPoint ( NULL );
2250+
2251+ if ( pxEndPoint != NULL )
2252+ {
2253+ pxEndPoint -> ipv4_settings .ulIPAddress = ulIPAddress ;
2254+ }
2255+ }
2256+ /*-----------------------------------------------------------*/
2257+
2258+ /**
2259+ * @brief Get the gateway address of the subnet.
2260+ *
2261+ * @return The IP-address of the gateway, zero if a gateway is
2262+ * not used/defined.
2263+ */
2264+ uint32_t FreeRTOS_GetGatewayAddress ( void )
2265+ {
2266+ uint32_t ulIPAddress = 0U ;
2267+ NetworkEndPoint_t * pxEndPoint = FreeRTOS_FirstEndPoint ( NULL );
2268+
2269+ if ( pxEndPoint != NULL )
2270+ {
2271+ ulIPAddress = pxEndPoint -> ipv4_settings .ulGatewayAddress ;
2272+ }
2273+
2274+ return ulIPAddress ;
2275+ }
2276+ /*-----------------------------------------------------------*/
2277+
2278+ /**
2279+ * @brief Get the DNS server address.
2280+ *
2281+ * @return The IP address of the DNS server.
2282+ */
2283+ uint32_t FreeRTOS_GetDNSServerAddress ( void )
2284+ {
2285+ uint32_t ulIPAddress = 0U ;
2286+ NetworkEndPoint_t * pxEndPoint = FreeRTOS_FirstEndPoint ( NULL );
2287+
2288+ if ( pxEndPoint != NULL )
2289+ {
2290+ ulIPAddress = pxEndPoint -> ipv4_settings .ulDNSServerAddresses [ 0 ];
2291+ }
2292+
2293+ return ulIPAddress ;
2294+ }
2295+ /*-----------------------------------------------------------*/
2296+
2297+ /**
2298+ * @brief Get the netmask for the subnet.
2299+ *
2300+ * @return The 32 bit netmask for the subnet.
2301+ */
2302+ uint32_t FreeRTOS_GetNetmask ( void )
2303+ {
2304+ uint32_t ulIPAddress = 0U ;
2305+ NetworkEndPoint_t * pxEndPoint = FreeRTOS_FirstEndPoint ( NULL );
2306+
2307+ if ( pxEndPoint != NULL )
2308+ {
2309+ ulIPAddress = pxEndPoint -> ipv4_settings .ulNetMask ;
2310+ }
2311+
2312+ return ulIPAddress ;
2313+ }
2314+ /*-----------------------------------------------------------*/
2315+
2316+ /**
2317+ * @brief Update the MAC address.
2318+ *
2319+ * @param[in] ucMACAddress: the MAC address to be set.
2320+ */
2321+ void FreeRTOS_UpdateMACAddress ( const uint8_t ucMACAddress [ ipMAC_ADDRESS_LENGTH_BYTES ] )
2322+ {
2323+ NetworkEndPoint_t * pxEndPoint = FreeRTOS_FirstEndPoint ( NULL );
2324+
2325+ if ( pxEndPoint != NULL )
2326+ {
2327+ /* Copy the MAC address at the start of the default packet header fragment. */
2328+ ( void ) memcpy ( pxEndPoint -> xMACAddress .ucBytes , ( const void * ) ucMACAddress , ( size_t ) ipMAC_ADDRESS_LENGTH_BYTES );
2329+ }
2330+ }
2331+ /*-----------------------------------------------------------*/
2332+
2333+ /**
2334+ * @brief Get the MAC address.
2335+ *
2336+ * @return The pointer to MAC address.
2337+ */
2338+ const uint8_t * FreeRTOS_GetMACAddress ( void )
2339+ {
2340+ const uint8_t * pucReturn = NULL ;
2341+ NetworkEndPoint_t * pxEndPoint = FreeRTOS_FirstEndPoint ( NULL );
2342+
2343+ if ( pxEndPoint != NULL )
2344+ {
2345+ /* Copy the MAC address at the start of the default packet header fragment. */
2346+ pucReturn = pxEndPoint -> xMACAddress .ucBytes ;
2347+ }
2348+
2349+ return pucReturn ;
2350+ }
2351+ /*-----------------------------------------------------------*/
2352+
2353+ /**
2354+ * @brief Set the netmask for the subnet.
2355+ *
2356+ * @param[in] ulNetmask: The 32 bit netmask of the subnet.
2357+ */
2358+ void FreeRTOS_SetNetmask ( uint32_t ulNetmask )
2359+ {
2360+ NetworkEndPoint_t * pxEndPoint = FreeRTOS_FirstEndPoint ( NULL );
2361+
2362+ if ( pxEndPoint != NULL )
2363+ {
2364+ pxEndPoint -> ipv4_settings .ulNetMask = ulNetmask ;
2365+ }
2366+ }
2367+ /*-----------------------------------------------------------*/
2368+
2369+ /**
2370+ * @brief Set the gateway address.
2371+ *
2372+ * @param[in] ulGatewayAddress: The gateway address.
2373+ */
2374+ void FreeRTOS_SetGatewayAddress ( uint32_t ulGatewayAddress )
2375+ {
2376+ NetworkEndPoint_t * pxEndPoint = FreeRTOS_FirstEndPoint ( NULL );
2377+
2378+ if ( pxEndPoint != NULL )
2379+ {
2380+ pxEndPoint -> ipv4_settings .ulGatewayAddress = ulGatewayAddress ;
2381+ }
2382+ }
2383+ /*-----------------------------------------------------------*/
2384+ #endif /* ( ipconfigIPv4_BACKWARD_COMPATIBLE != 0 ) */
2385+
22342386/**
22352387 * @brief Returns whether the IP task is ready.
22362388 *
0 commit comments