/**
 *
 * \file
 *
 * \brief This module contains NMC1500 M2M driver APIs declarations.
 *
 * Copyright (c) 2015 - 2017 Atmel Corporation. All rights reserved.
 *
 * \asf_license_start
 *
 * \page License
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *
 * 1. Redistributions of source code must retain the above copyright notice,
 *    this list of conditions and the following disclaimer.
 *
 * 2. Redistributions in binary form must reproduce the above copyright notice,
 *    this list of conditions and the following disclaimer in the documentation
 *    and/or other materials provided with the distribution.
 *
 * 3. The name of Atmel may not be used to endorse or promote products derived
 *    from this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED
 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
 * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR
 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
 *
 * \asf_license_stop
 *
 */

#ifndef _NMDRV_H_
#define _NMDRV_H_

#include "common/include/nm_common.h"

/**
 *  @struct		tstrM2mRev
 *  @brief		Structure holding firmware version parameters and build date/time
 */
typedef struct {
	uint32 u32Chipid;       /* HW revision which will be basically the chip ID */
	uint8  u8FirmwareMajor; /* Version Major Number which represents the official release base */
	uint8  u8FirmwareMinor; /* Version Minor Number which represents the engineering release base */
	uint8  u8FirmwarePatch; /* Version pathc Number which represents the pathces release base */
	uint8  u8DriverMajor;   /* Version Major Number which represents the official release base */
	uint8  u8DriverMinor;   /* Version Minor Number which represents the engineering release base */
	uint8  u8DriverPatch;   /* Version Patch Number which represents the pathces release base */
	uint8  BuildDate[sizeof(__DATE__)];
	uint8  BuildTime[sizeof(__TIME__)];
	uint8  _PAD8_;
	uint16 u16FirmwareSvnNum;
	uint16 _PAD16_[2];
} tstrM2mRev;

/**
 *  @struct		tstrM2mBinaryHeader
 *  @brief		Structure holding compatibility version info for firmware binaries
 */
typedef struct {
	tstrM2mRev binVerInfo;
	uint32     flashOffset;
	uint32     payloadSize;
} tstrM2mBinaryHeader;

#ifdef __cplusplus
extern "C" {
#endif
/**
 *	@fn		nm_get_firmware_info(tstrM2mRev* M2mRev)
 *	@brief	Get Firmware version info
 *	@param [out]	M2mRev
 *			    pointer holds address of structure "tstrM2mRev" that contains the firmware version parameters
 *	@version	1.0
 */
sint8 nm_get_firmware_info(tstrM2mRev *M2mRev);
/**
 *	@fn		nm_get_firmware_full_info(tstrM2mRev* pstrRev)
 *	@brief	Get Firmware version info
 *	@param [out]	M2mRev
 *			    pointer holds address of structure "tstrM2mRev" that contains the firmware version parameters
 *	@version	1.0
 */
sint8 nm_get_firmware_full_info(tstrM2mRev *pstrRev);
/**
*	@fn		nm_get_ota_firmware_info(tstrM2mRev* pstrRev)
*	@brief	Get Firmware version info
*	@param [out]	M2mRev
*			    pointer holds address of structure "tstrM2mRev" that contains the firmware version parameters

*	@version	1.0
*/
sint8 nm_get_ota_firmware_info(tstrM2mRev *pstrRev);
/*
 *	@fn		nm_drv_init
 *	@brief	Initialize NMC1000 driver
 *	@return	ZERO in case of success and Negative error code in case of failure
 */
sint8 nm_drv_init_download_mode(void);

/*
*	@fn		nm_drv_init
*	@brief	Initialize NMC1000 driver
*	@return	M2M_SUCCESS in case of success and Negative error code in case of failure
*   @param [in]	arg
*				Generic argument TBD
*	@return	ZERO in case of success and Negative error code in case of failure

*/
sint8 nm_drv_init(void *arg);

/**
 *	@fn		nm_drv_deinit
 *	@brief	Deinitialize NMC1000 driver
 *	@author	M. Abdelmawla
 *   @param [in]	arg
 *				Generic argument TBD
 *	@return	ZERO in case of success and Negative error code in case of failure
 */
sint8 nm_drv_deinit(void *arg);

#ifdef __cplusplus
}
#endif

#endif /*_NMDRV_H_*/
