| /* |
| <:copyright-BRCM:2014:DUAL/GPL:standard |
| |
| Copyright (c) 2014 Broadcom Corporation |
| 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 _BCMOLT_IMAGE_TRANSFER_H_ |
| #define _BCMOLT_IMAGE_TRANSFER_H_ |
| |
| #include <bcmolt_model_types.h> |
| #include <bcmos_system.h> |
| |
| /* Returns a data block of given size of given image type at given offset. */ |
| typedef int (*bcmuser_mftp_image_read)(bcmolt_devid device, bcmolt_device_image_type image_type, |
| uint32_t offset, uint8_t *buf, uint32_t buf_size); |
| |
| /* Returns the size of data block which is used for the data transfer. */ |
| typedef uint32_t (*bcmuser_mftp_block_size_get)(void); |
| |
| /* Returns the CRC32 checksum of entire image. */ |
| typedef uint32_t (*bcmuser_mftp_crc_get)(bcmolt_devid device, |
| bcmolt_device_image_type image_type); |
| |
| /* Callback to notify the user of the completion of the image transfer. */ |
| typedef void (*bcmuser_mftp_notification_rx)(bcmolt_devid device, |
| bcmolt_device_image_type image_type, uint32_t block_num, bcmolt_image_transfer_status status); |
| |
| typedef enum |
| { |
| MFTP_STATUS_DISABLED, |
| MFTP_STATUS_WAITING_ACK, |
| MFTP_STATUS_WAITING_LAST_ACK |
| } mftp_status; |
| |
| typedef struct |
| { |
| /* runtime parameters */ |
| mftp_status status; |
| uint32_t block_num; /* block number sent. */ |
| bcmolt_device_image_type image_type; |
| |
| /* init-time parameters */ |
| uint32_t block_size; |
| uint8_t *buf; |
| char name[MAX_TIMER_NAME_SIZE]; |
| bcmos_task task; |
| bcmos_module_id module_id; |
| bcmos_timer timer; |
| dev_log_id log_id; |
| } mftp_context; |
| |
| |
| const char *bcmolt_user_mftp_status_to_str(bcmolt_image_transfer_status status); |
| |
| /** handler for the OPERATION device.image_transfer_start. */ |
| bcmos_errno bcmolt_user_mftp_start(bcmolt_devid device, bcmolt_device_image_type image_type); |
| |
| /** Initializes the MFTP parameters. */ |
| void bcmolt_user_mftp_init(void); |
| |
| #endif |
| |
| |