| /* |
| <: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_USER_H_ |
| #define _BCMOLT_IMAGE_TRANSFER_USER_H_ |
| |
| #include <bcmolt_model_types.h> |
| #include <bcmos_system.h> |
| |
| #define MFTP_DATA_BLOCK_SIZE 512 |
| |
| #define MFTP_ACK_TIMEOUT_US (2 * 1000000) |
| |
| #define MFTP_MAX_PATH_NAME_LEN 256 |
| |
| /** Get the device file name. |
| * |
| * \param[in] image_type Image type. defined in the object model. |
| * |
| * \return string Device image name, including the path. |
| */ |
| const char *bcmuser_device_image_name_get(bcmolt_device_image_type image_type); |
| |
| /** Get the size of the file. |
| * |
| * \param[in] device Device ID |
| * \param[in] image_type Image type. defined in the object model. |
| * \param[out] fsize File size |
| * |
| * \return bcmos_errno |
| */ |
| bcmos_errno bcmuser_image_transfer_file_size_get(bcmolt_devid device, |
| bcmolt_device_image_type image_type, uint32_t *fsize); |
| |
| /** Read data from given offset. |
| * |
| * \param[in] device Device ID |
| * \param[in] image_type Image type. defined in the object model. |
| * \param[in] offset File position indicator |
| * \param[out] buf Buffer to store the data |
| * \param[in] buf_size Buffer size |
| * |
| * \return Bytes read |
| */ |
| int bcmuser_image_transfer_read_data(bcmolt_devid device, bcmolt_device_image_type image_type, |
| uint32_t offset, uint8_t *buf, uint32_t buf_size); |
| |
| /** Get the unit size of the transfer data block. |
| * |
| * \return Size of the block in bytes. |
| */ |
| uint32_t bcmuser_image_transfer_block_size_get(void); |
| |
| /** Returns the CRC32 checksum of entire image. |
| * |
| * \param[in] device Device ID |
| * \param[in] image_type Image type. defined in the object model. |
| * |
| * \return CRC32 checksum |
| */ |
| uint32_t bcmuser_image_transfer_crc_get(bcmolt_devid device, bcmolt_device_image_type image_type); |
| |
| /** Process the notification from the image transfer module. |
| * |
| * \param[in] device Device ID |
| * \param[in] image_type Image type. defined in the object model. |
| * \param[in] block_num last block number |
| * \param[in] status Image transfer status |
| */ |
| void bcmuser_image_transfer_notification_rx(bcmolt_devid device, |
| bcmolt_device_image_type image_type, uint32_t block_num, bcmolt_image_transfer_status status); |
| |
| #endif |
| |