| /* |
| <:copyright-BRCM:2016:DUAL/GPL:standard |
| |
| Broadcom Proprietary and Confidential.(c) 2016 Broadcom |
| All Rights Reserved |
| |
| Unless you and Broadcom execute a separate written software license |
| agreement governing use of this software, this software is licensed |
| to you under the terms of the GNU General Public License version 2 |
| (the "GPL"), available at http://www.broadcom.com/licenses/GPLv2.php, |
| with the following added to such license: |
| |
| As a special exception, the copyright holders of this software give |
| you permission to link this software with independent modules, and |
| to copy and distribute the resulting executable under terms of your |
| choice, provided that you also meet, for each linked independent |
| module, the terms and conditions of the license of that module. |
| An independent module is a module which is not derived from this |
| software. The special exception does not apply to any modifications |
| of the software. |
| |
| Not withstanding the above, under no circumstances may you combine |
| this software in any way with any other Broadcom software provided |
| under a license other than the GPL, without Broadcom's express prior |
| written consent. |
| |
| :> |
| */ |
| |
| #ifndef BCM_KEEP_ALIVE_H_ |
| #define BCM_KEEP_ALIVE_H_ |
| |
| #include <bcmos_system.h> |
| #include <bcmolt_conv.h> |
| |
| /* Message originator : device or host */ |
| typedef enum |
| { |
| BCM_KEEP_ALIVE_MSG_ORIG_DEVICE, |
| BCM_KEEP_ALIVE_MSG_ORIG_HOST, |
| } keep_alive_msg_orig; |
| |
| typedef struct |
| { |
| char name[MAX_TIMER_NAME_SIZE]; |
| bcmos_timer timer; |
| } keep_alive_timer; |
| |
| typedef bcmos_errno (*F_bcmos_keep_alive_send_handler)(bcmolt_devid device, bcmolt_msg *msg); |
| typedef bcmos_errno (*F_bcmos_keep_alive_disconnect_handler)(bcmolt_devid device); |
| |
| typedef struct |
| { |
| uint32_t last_sent_ka_seq; |
| uint32_t last_recv_ka_seq; |
| uint32_t last_recv_ka_timestamp; |
| uint32_t ka_process_start_ts; |
| uint32_t ka_interval; |
| uint32_t ka_tolerance; |
| keep_alive_msg_orig orig; |
| bcmolt_devid device; |
| keep_alive_timer ka_timer; |
| F_bcmos_keep_alive_disconnect_handler disconnect_handler; |
| F_bcmos_keep_alive_send_handler send_handler; |
| } bcmos_keep_alive_info; |
| |
| typedef union |
| { |
| bcmolt_device_device_keep_alive device; /**< Keep alive message originated at the Device */ |
| bcmolt_device_host_keep_alive host; /**< Keep alive message originated at the Host */ |
| } bcmos_keep_alive_msg; |
| |
| typedef union |
| { |
| bcmolt_device_device_keep_alive_data device; /**< Keep alive message originated at the Device */ |
| bcmolt_device_host_keep_alive_data host; /**< Keep alive message originated at the Host */ |
| } bcmos_keep_alive_data_msg; |
| |
| BCMOLT_TYPE2STR(keep_alive_msg_orig, extern) |
| |
| void keep_alive_rx_handler(const bcmos_keep_alive_data_msg *ka_data_msg, bcmos_keep_alive_info *ka_info); |
| bcmos_errno create_keep_alive_timer(bcmos_keep_alive_info *ka_info,bcmos_module_id module_id); |
| void start_keep_alive_process(bcmos_keep_alive_info *ka_info); |
| void stop_keep_alive_process(bcmos_keep_alive_info *ka_info); |
| |
| #endif /* BCM_KEEP_ALIVE_H_ */ |