Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: NNN50_CE_Test_UDP NNN50_linux_firmware NNN50_SoftAP_HelloWorld NNN50_BLEWIFISensor ... more
nmspi.h
00001 /** 00002 * 00003 * \file 00004 * 00005 * \brief This module contains NMC1000 SPI protocol 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 _NMSPI_H_ 00043 #define _NMSPI_H_ 00044 00045 #include "common/include/nm_common.h" 00046 00047 #ifdef __cplusplus 00048 extern "C" { 00049 #endif 00050 00051 /** 00052 * @fn nm_spi_init 00053 * @brief Initialize the SPI 00054 * @return ZERO in case of success and M2M_ERR_BUS_FAIL in case of failure 00055 */ 00056 sint8 nm_spi_init (void); 00057 /** 00058 * @fn nm_spi_reset 00059 * @brief reset the SPI 00060 * @return ZERO in case of success and M2M_ERR_BUS_FAIL in case of failure 00061 */ 00062 sint8 nm_spi_reset(void); 00063 00064 /** 00065 * @fn nm_spi_deinit 00066 * @brief DeInitialize the SPI 00067 * @return ZERO in case of success and M2M_ERR_BUS_FAIL in case of failure 00068 */ 00069 sint8 nm_spi_deinit(void); 00070 00071 /** 00072 * @fn nm_spi_read_reg 00073 * @brief Read register 00074 * @param [in] u32Addr 00075 * Register address 00076 * @return Register value 00077 */ 00078 uint32 nm_spi_read_reg(uint32 u32Addr); 00079 00080 /** 00081 * @fn nm_spi_read_reg_with_ret 00082 * @brief Read register with error code return 00083 * @param [in] u32Addr 00084 * Register address 00085 * @param [out] pu32RetVal 00086 * Pointer to u32 variable used to return the read value 00087 * @return ZERO in case of success and M2M_ERR_BUS_FAIL in case of failure 00088 */ 00089 sint8 nm_spi_read_reg_with_ret(uint32 u32Addr, uint32* pu32RetVal); 00090 00091 /** 00092 * @fn nm_spi_write_reg 00093 * @brief write register 00094 * @param [in] u32Addr 00095 * Register address 00096 * @param [in] u32Val 00097 * Value to be written to the register 00098 * @return ZERO in case of success and M2M_ERR_BUS_FAIL in case of failure 00099 */ 00100 sint8 nm_spi_write_reg(uint32 u32Addr, uint32 u32Val); 00101 00102 /** 00103 * @fn nm_spi_read_block 00104 * @brief Read block of data 00105 * @param [in] u32Addr 00106 * Start address 00107 * @param [out] puBuf 00108 * Pointer to a buffer used to return the read data 00109 * @param [in] u16Sz 00110 * Number of bytes to read. The buffer size must be >= u16Sz 00111 * @return ZERO in case of success and M2M_ERR_BUS_FAIL in case of failure 00112 */ 00113 sint8 nm_spi_read_block(uint32 u32Addr, uint8 *puBuf, uint16 u16Sz); 00114 00115 /** 00116 * @fn nm_spi_write_block 00117 * @brief Write block of data 00118 * @param [in] u32Addr 00119 * Start address 00120 * @param [in] puBuf 00121 * Pointer to the buffer holding the data to be written 00122 * @param [in] u16Sz 00123 * Number of bytes to write. The buffer size must be >= u16Sz 00124 * @return ZERO in case of success and M2M_ERR_BUS_FAIL in case of failure 00125 */ 00126 sint8 nm_spi_write_block(uint32 u32Addr, uint8 *puBuf, uint16 u16Sz); 00127 00128 #ifdef __cplusplus 00129 } 00130 #endif 00131 00132 #endif /* _NMSPI_H_ */ 00133
Generated on Wed Jul 13 2022 16:32:37 by
1.7.2