Delta / NNN50_WIFI_API

Dependents:   NNN50_CE_Test_UDP NNN50_linux_firmware NNN50_SoftAP_HelloWorld NNN50_BLEWIFISensor ... more

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers nmbus.h Source File

nmbus.h

Go to the documentation of this file.
00001 /**
00002  *
00003  * \file
00004  *
00005  * \brief This module contains NMC1000 bus APIs implementation.
00006  *
00007  * Copyright (c) 2016-2017 Atmel Corporation. All rights reserved.
00008  *
00009  * \asf_license_start
00010  *
00011  * \page License
00012  *
00013  * Redistribution and use in source and binary forms, with or without
00014  * modification, are permitted provided that the following conditions are met:
00015  *
00016  * 1. Redistributions of source code must retain the above copyright notice,
00017  *    this list of conditions and the following disclaimer.
00018  *
00019  * 2. Redistributions in binary form must reproduce the above copyright notice,
00020  *    this list of conditions and the following disclaimer in the documentation
00021  *    and/or other materials provided with the distribution.
00022  *
00023  * 3. The name of Atmel may not be used to endorse or promote products derived
00024  *    from this software without specific prior written permission.
00025  *
00026  * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED
00027  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
00028  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
00029  * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR
00030  * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
00031  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
00032  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
00033  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
00034  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
00035  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
00036  * POSSIBILITY OF SUCH DAMAGE.
00037  *
00038  * \asf_license_stop
00039  *
00040  */
00041 
00042 #ifndef _NMBUS_H_
00043 #define _NMBUS_H_
00044 
00045 #include "common/include/nm_common.h"
00046 #include "bus_wrapper/include/nm_bus_wrapper.h"
00047 
00048 
00049 
00050 #ifdef __cplusplus
00051 extern "C"{
00052 #endif
00053 /**
00054 *   @fn     nm_bus_iface_init
00055 *   @brief  Initialize bus interface
00056 *   @return M2M_SUCCESS in case of success and M2M_ERR_BUS_FAIL in case of failure
00057 */
00058 sint8 nm_bus_iface_init(void *);
00059 
00060 
00061 /**
00062 *   @fn     nm_bus_iface_deinit
00063 *   @brief  Deinitialize bus interface
00064 *   @return M2M_SUCCESS in case of success and M2M_ERR_BUS_FAIL in case of failure
00065 */
00066 sint8 nm_bus_iface_deinit(void);
00067 
00068 /**
00069 *   @fn     nm_bus_reset
00070 *   @brief  reset bus interface
00071 *   @return M2M_SUCCESS in case of success and M2M_ERR_BUS_FAIL in case of failure
00072 *   @version    1.0
00073 */
00074 sint8 nm_bus_reset(void);
00075 
00076 /**
00077 *   @fn     nm_bus_iface_reconfigure
00078 *   @brief  reconfigure bus interface
00079 *   @return M2M_SUCCESS in case of success and M2M_ERR_BUS_FAIL in case of failure
00080 */
00081 sint8 nm_bus_iface_reconfigure(void *ptr);
00082 
00083 /**
00084 *   @fn     nm_read_reg
00085 *   @brief  Read register
00086 *   @param [in] u32Addr
00087 *               Register address
00088 *   @return Register value
00089 */
00090 uint32 nm_read_reg(uint32 u32Addr);
00091 
00092 /**
00093 *   @fn     nm_read_reg_with_ret
00094 *   @brief  Read register with error code return
00095 *   @param [in] u32Addr
00096 *               Register address
00097 *   @param [out]    pu32RetVal
00098 *               Pointer to u32 variable used to return the read value
00099 *   @return ZERO in case of success and M2M_ERR_BUS_FAIL in case of failure
00100 */
00101 sint8 nm_read_reg_with_ret(uint32 u32Addr, uint32* pu32RetVal);
00102 
00103 /**
00104 *   @fn     nm_write_reg
00105 *   @brief  write register
00106 *   @param [in] u32Addr
00107 *               Register address
00108 *   @param [in] u32Val
00109 *               Value to be written to the register
00110 *   @return ZERO in case of success and M2M_ERR_BUS_FAIL in case of failure
00111 */
00112 sint8 nm_write_reg(uint32 u32Addr, uint32 u32Val);
00113 
00114 /**
00115 *   @fn     nm_read_block
00116 *   @brief  Read block of data
00117 *   @param [in] u32Addr
00118 *               Start address
00119 *   @param [out]    puBuf
00120 *               Pointer to a buffer used to return the read data
00121 *   @param [in] u32Sz
00122 *               Number of bytes to read. The buffer size must be >= u32Sz
00123 *   @return ZERO in case of success and M2M_ERR_BUS_FAIL in case of failure
00124 */ 
00125 sint8 nm_read_block(uint32 u32Addr, uint8 *puBuf, uint32 u32Sz);
00126 
00127 /**
00128 *   @fn     nm_write_block
00129 *   @brief  Write block of data
00130 *   @param [in] u32Addr
00131 *               Start address
00132 *   @param [in] puBuf
00133 *               Pointer to the buffer holding the data to be written
00134 *   @param [in] u32Sz
00135 *               Number of bytes to write. The buffer size must be >= u32Sz
00136 *   @return ZERO in case of success and M2M_ERR_BUS_FAIL in case of failure
00137 */ 
00138 sint8 nm_write_block(uint32 u32Addr, uint8 *puBuf, uint32 u32Sz);
00139 
00140 
00141 
00142 
00143 #ifdef __cplusplus
00144 }
00145 #endif
00146 
00147 #endif /* _NMBUS_H_ */
00148