[6319] | 1 | /** @file wlan_exp_user.c |
---|
| 2 | * @brief Experiment Framework (User) |
---|
| 3 | * |
---|
| 4 | * @copyright Copyright 2013-2019, Mango Communications. All rights reserved. |
---|
| 5 | * Distributed under the Mango Communications Reference Design License |
---|
| 6 | * See LICENSE.txt included in the design archive or |
---|
| 7 | * at http://mangocomm.com/802.11/license |
---|
| 8 | * |
---|
| 9 | * This file is part of the Mango 802.11 Reference Design (https://mangocomm.com/802.11) |
---|
| 10 | */ |
---|
| 11 | |
---|
| 12 | #include "wlan_mac_high_sw_config.h" |
---|
| 13 | |
---|
| 14 | #if WLAN_SW_CONFIG_ENABLE_WLAN_EXP |
---|
| 15 | |
---|
| 16 | // Xilinx / Standard library includes |
---|
| 17 | #include <xparameters.h> |
---|
| 18 | #include <xil_io.h> |
---|
| 19 | #include <stdlib.h> |
---|
| 20 | #include <stdio.h> |
---|
| 21 | #include <string.h> |
---|
| 22 | |
---|
| 23 | // WLAN Exp includes |
---|
| 24 | #include "wlan_exp_common.h" |
---|
| 25 | #include "wlan_exp_node.h" |
---|
| 26 | #include "wlan_exp_user.h" |
---|
| 27 | #include "wlan_mac_queue.h" |
---|
| 28 | |
---|
| 29 | extern function_ptr_t wlan_exp_process_user_cmd_callback; |
---|
| 30 | |
---|
| 31 | /*****************************************************************************/ |
---|
| 32 | /** |
---|
| 33 | * @brief Process User Commands |
---|
| 34 | * |
---|
| 35 | * Process commands from a host meant for the user group |
---|
| 36 | * |
---|
| 37 | * @param cmd_hdr - pointer to the command header |
---|
| 38 | * @param eth_tx_queue_buffer - pointer to a Ethernet queue buffer that should be |
---|
| 39 | * filled in with response arguments |
---|
| 40 | * |
---|
| 41 | * @return int - NO_RESP_SENT or RESP_SENT |
---|
| 42 | * |
---|
| 43 | *****************************************************************************/ |
---|
| 44 | int process_user_cmd(cmd_resp_hdr_t* cmd_hdr, eth_tx_queue_buffer_t* eth_tx_queue_buffer) { |
---|
| 45 | |
---|
| 46 | // |
---|
| 47 | // IMPORTANT ENDIAN NOTES: |
---|
| 48 | // - command |
---|
| 49 | // - header - Already endian swapped by the framework (safe to access directly) |
---|
| 50 | // - args - Must be endian swapped as necessary by code (framework does not know the contents of the command) |
---|
| 51 | // - response |
---|
| 52 | // - header - Will be endian swapped by the framework (safe to write directly) |
---|
| 53 | // - args - Must be endian swapped as necessary by code (framework does not know the contents of the response) |
---|
| 54 | // |
---|
| 55 | |
---|
| 56 | // Standard variables |
---|
| 57 | // |
---|
| 58 | // Used for accessing command arguments and constructing the command response header/payload |
---|
| 59 | // |
---|
| 60 | // NOTE: Some of the standard variables below have been commented out. This was to remove |
---|
| 61 | // compiler warnings for "unused variables" since the default implementation is empty. As |
---|
| 62 | // you add commands, you should un-comment the standard variables. |
---|
| 63 | // |
---|
| 64 | u32 resp_sent = NO_RESP_SENT; |
---|
| 65 | u32 cmd_id = CMD_TO_CMDID(cmd_hdr->cmd); |
---|
| 66 | |
---|
| 67 | // Process the command |
---|
| 68 | switch(cmd_id){ |
---|
| 69 | |
---|
| 70 | //----------------------------------------------------------------------------- |
---|
| 71 | // Child Commands (Callback is implemented in each child project, eg. AP, STA, IBSS) |
---|
| 72 | //----------------------------------------------------------------------------- |
---|
| 73 | |
---|
| 74 | //--------------------------------------------------------------------- |
---|
| 75 | default: { |
---|
| 76 | // Call standard function in child class to parse parameters implemented there |
---|
| 77 | resp_sent = wlan_exp_process_user_cmd_callback(cmd_hdr, eth_tx_queue_buffer); |
---|
| 78 | } |
---|
| 79 | break; |
---|
| 80 | } |
---|
| 81 | |
---|
| 82 | return resp_sent; |
---|
| 83 | } |
---|
| 84 | |
---|
| 85 | |
---|
| 86 | #endif // End WLAN_SW_CONFIG_ENABLE_WLAN_EXP |
---|