1 /**************************************************************************/ 2 /* */ 3 /* Copyright (c) Microsoft Corporation. All rights reserved. */ 4 /* */ 5 /* This software is licensed under the Microsoft Software License */ 6 /* Terms for Microsoft Azure RTOS. Full text of the license can be */ 7 /* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ 8 /* and in the root directory of this software. */ 9 /* */ 10 /**************************************************************************/ 11 12 13 /**************************************************************************/ 14 /**************************************************************************/ 15 /** */ 16 /** NetX Component */ 17 /** */ 18 /** Internet Protocol (IP) */ 19 /** */ 20 /**************************************************************************/ 21 /**************************************************************************/ 22 23 #define NX_SOURCE_CODE 24 25 26 /* Include necessary system files. */ 27 28 #include "nx_api.h" 29 #include "nx_ip.h" 30 31 32 /**************************************************************************/ 33 /* */ 34 /* FUNCTION RELEASE */ 35 /* */ 36 /* _nx_ip_driver_deferred_enable PORTABLE C */ 37 /* 6.1 */ 38 /* AUTHOR */ 39 /* */ 40 /* Yuxin Zhou, Microsoft Corporation */ 41 /* */ 42 /* DESCRIPTION */ 43 /* */ 44 /* This function enabled the deferred driver packet processing */ 45 /* in NetX. The supplied driver packet handler is called from the */ 46 /* IP helper thread to fully process a received driver packet. The */ 47 /* driver's receive packet processing only makes a call to the */ 48 /* _nx_ip_driver_deferred_receive processing from the ISR. */ 49 /* */ 50 /* INPUT */ 51 /* */ 52 /* ip_ptr Pointer to IP control block */ 53 /* driver_deferred_packet_handler Function pointer to driver's */ 54 /* deferred packet handling */ 55 /* routine */ 56 /* */ 57 /* OUTPUT */ 58 /* */ 59 /* None */ 60 /* */ 61 /* CALLS */ 62 /* */ 63 /* None */ 64 /* */ 65 /* CALLED BY */ 66 /* */ 67 /* Application Driver Initialization */ 68 /* */ 69 /* RELEASE HISTORY */ 70 /* */ 71 /* DATE NAME DESCRIPTION */ 72 /* */ 73 /* 05-19-2020 Yuxin Zhou Initial Version 6.0 */ 74 /* 09-30-2020 Yuxin Zhou Modified comment(s), */ 75 /* resulting in version 6.1 */ 76 /* */ 77 /**************************************************************************/ _nx_ip_driver_deferred_enable(NX_IP * ip_ptr,VOID (* driver_deferred_packet_handler)(NX_IP * ip_ptr,NX_PACKET * packet_ptr))78VOID _nx_ip_driver_deferred_enable(NX_IP *ip_ptr, VOID (*driver_deferred_packet_handler)(NX_IP *ip_ptr, NX_PACKET *packet_ptr)) 79 { 80 81 #ifdef NX_DRIVER_DEFERRED_PROCESSING 82 TX_INTERRUPT_SAVE_AREA 83 84 /* Disable interrupts. */ 85 TX_DISABLE 86 87 /* Initialize the deferred packet queue to be empty */ 88 ip_ptr -> nx_ip_driver_deferred_packet_head = NX_NULL; 89 ip_ptr -> nx_ip_driver_deferred_packet_tail = NX_NULL; 90 91 /* Setup the driver's deferred packet processing routine */ 92 ip_ptr -> nx_ip_driver_deferred_packet_handler = driver_deferred_packet_handler; 93 94 TX_RESTORE 95 #else 96 NX_PARAMETER_NOT_USED(ip_ptr); 97 NX_PARAMETER_NOT_USED(driver_deferred_packet_handler); 98 #endif 99 } 100 101