1 /** 2 * 3 * \file 4 * 5 * \brief This module contains NMC1500 M2M driver APIs declarations. 6 * 7 * Copyright (c) 2016-2017 Atmel Corporation. All rights reserved. 8 * 9 * \asf_license_start 10 * 11 * \page License 12 * 13 * Redistribution and use in source and binary forms, with or without 14 * modification, are permitted provided that the following conditions are met: 15 * 16 * 1. Redistributions of source code must retain the above copyright notice, 17 * this list of conditions and the following disclaimer. 18 * 19 * 2. Redistributions in binary form must reproduce the above copyright notice, 20 * this list of conditions and the following disclaimer in the documentation 21 * and/or other materials provided with the distribution. 22 * 23 * 3. The name of Atmel may not be used to endorse or promote products derived 24 * from this software without specific prior written permission. 25 * 26 * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED 27 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 28 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE 29 * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR 30 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 31 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 32 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 33 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 34 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 35 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 36 * POSSIBILITY OF SUCH DAMAGE. 37 * 38 * \asf_license_stop 39 * 40 */ 41 42 #ifndef _NMDRV_H_ 43 #define _NMDRV_H_ 44 45 #include "common/include/nm_common.h" 46 47 /** 48 * @struct tstrM2mRev 49 * @brief Structure holding firmware version parameters and build date/time 50 */ 51 typedef struct { 52 uint32 u32Chipid; /* HW revision which will be basically the chip ID */ 53 uint8 u8FirmwareMajor; /* Version Major Number which represents the official release base */ 54 uint8 u8FirmwareMinor; /* Version Minor Number which represents the engineering release base */ 55 uint8 u8FirmwarePatch; /* Version pathc Number which represents the pathces release base */ 56 uint8 u8DriverMajor; /* Version Major Number which represents the official release base */ 57 uint8 u8DriverMinor; /* Version Minor Number which represents the engineering release base */ 58 uint8 u8DriverPatch; /* Version Patch Number which represents the pathces release base */ 59 uint8 BuildDate[sizeof(__DATE__)]; 60 uint8 BuildTime[sizeof(__TIME__)]; 61 uint8 _PAD8_; 62 uint16 u16FirmwareSvnNum; 63 uint16 _PAD16_[2]; 64 } tstrM2mRev; 65 66 /** 67 * @struct tstrM2mBinaryHeader 68 * @brief Structure holding compatibility version info for firmware binaries 69 */ 70 typedef struct { 71 tstrM2mRev binVerInfo; 72 uint32 flashOffset; 73 uint32 payloadSize; 74 } tstrM2mBinaryHeader; 75 76 #ifdef __cplusplus 77 extern "C" { 78 #endif 79 /** 80 * @fn nm_get_firmware_info(tstrM2mRev* M2mRev) 81 * @brief Get Firmware version info 82 * @param [out] M2mRev 83 * pointer holds address of structure "tstrM2mRev" that contains the firmware version parameters 84 * @version 1.0 85 */ 86 sint8 nm_get_firmware_info(tstrM2mRev* M2mRev); 87 /** 88 * @fn nm_get_firmware_full_info(tstrM2mRev* pstrRev) 89 * @brief Get Firmware version info 90 * @param [out] M2mRev 91 * pointer holds address of structure "tstrM2mRev" that contains the firmware version parameters 92 * @version 1.0 93 */ 94 sint8 nm_get_firmware_full_info(tstrM2mRev* pstrRev); 95 /** 96 * @fn nm_get_ota_firmware_info(tstrM2mRev* pstrRev) 97 * @brief Get Firmware version info 98 * @param [out] M2mRev 99 * pointer holds address of structure "tstrM2mRev" that contains the firmware version parameters 100 101 * @version 1.0 102 */ 103 sint8 nm_get_ota_firmware_info(tstrM2mRev* pstrRev); 104 /* 105 * @fn nm_drv_init 106 * @brief Initialize NMC1000 driver 107 * @return ZERO in case of success and Negative error code in case of failure 108 */ 109 sint8 nm_drv_init_download_mode(void); 110 111 /* 112 * @fn nm_drv_init 113 * @brief Initialize NMC1000 driver 114 * @return M2M_SUCCESS in case of success and Negative error code in case of failure 115 * @param [in] arg 116 * Generic argument TBD 117 * @return ZERO in case of success and Negative error code in case of failure 118 119 */ 120 sint8 nm_drv_init(void * arg); 121 122 /** 123 * @fn nm_drv_deinit 124 * @brief Deinitialize NMC1000 driver 125 * @author M. Abdelmawla 126 * @param [in] arg 127 * Generic argument TBD 128 * @return ZERO in case of success and Negative error code in case of failure 129 */ 130 sint8 nm_drv_deinit(void * arg); 131 132 #ifdef __cplusplus 133 } 134 #endif 135 136 #endif /*_NMDRV_H_*/ 137 138 139