A Atmel RF2xx Radio Library for Mbed
Dependents: xBedRadio MxSniffer
MxRadio_trx_rf230_sram.cpp
00001 /* Copyright (c) 2007 Axel Wachtler 00002 All rights reserved. 00003 00004 Redistribution and use in source and binary forms, with or without 00005 modification, are permitted provided that the following conditions 00006 are met: 00007 00008 * Redistributions of source code must retain the above copyright 00009 notice, this list of conditions and the following disclaimer. 00010 * Redistributions in binary form must reproduce the above copyright 00011 notice, this list of conditions and the following disclaimer in the 00012 documentation and/or other materials provided with the distribution. 00013 * Neither the name of the authors nor the names of its contributors 00014 may be used to endorse or promote products derived from this software 00015 without specific prior written permission. 00016 00017 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 00018 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 00019 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 00020 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 00021 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 00022 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 00023 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 00024 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 00025 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 00026 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 00027 POSSIBILITY OF SUCH DAMAGE. */ 00028 00029 /* 00030 * =========================================================================== 00031 * This file is a copy of the file hif_rf230.c, which is part of 00032 * Atmels software package "IEEE 802.15.4 MAC for AVR Z-Link" 00033 * =========================================================================== 00034 */ 00035 /* 00036 * Copyright (c) 2006, Atmel Corporation All rights reserved. 00037 * 00038 * Redistribution and use in source and binary forms, with or without 00039 * modification, are permitted provided that the following conditions are met: 00040 * 00041 * 1. Redistributions of source code must retain the above copyright notice, 00042 * this list of conditions and the following disclaimer. 00043 * 00044 * 2. Redistributions in binary form must reproduce the above copyright notice, 00045 * this list of conditions and the following disclaimer in the documentation 00046 * and/or other materials provided with the distribution. 00047 * 00048 * 3. The name of ATMEL may not be used to endorse or promote products derived 00049 * from this software without specific prior written permission. 00050 * 00051 * THIS SOFTWARE IS PROVIDED BY ATMEL ``AS IS'' AND ANY EXPRESS OR IMPLIED 00052 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 00053 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE EXPRESSLY AND 00054 * SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, 00055 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 00056 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 00057 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 00058 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 00059 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 00060 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00061 */ 00062 00063 00064 /* $Id$ */ 00065 /** 00066 * @file 00067 * @brief SRAM access functionds for AT86RF230. 00068 * 00069 * This functions are moved to this module, in order to 00070 * make librf230 more scaleable. 00071 * 00072 * 00073 */ 00074 00075 00076 /* === Includes ============================================================ */ 00077 #include <MxRadio.h> 00078 00079 void cMxRadio::trx_sram_write(trx_ramaddr_t addr, uint8_t length, uint8_t *data) 00080 { 00081 00082 // Select transceiver 00083 m_cs=0;//SPI_SELN_LOW(); 00084 00085 m_spi.write(TRX_CMD_SW);//SPI_DATA_REG = TRX_CMD_SW; 00086 //SPI_WAITFOR(); 00087 m_spi.write(addr);//SPI_DATA_REG = addr; 00088 //SPI_WAITFOR(); 00089 do 00090 { 00091 m_spi.write(*data++);//SPI_DATA_REG = *data++; 00092 //SPI_WAITFOR(); 00093 } 00094 while (--length > 0); 00095 00096 // Deselect Slave 00097 m_cs=1;//SPI_SELN_HIGH(); 00098 } 00099 00100 00101 void cMxRadio::trx_sram_read(trx_ramaddr_t addr, uint8_t length, uint8_t *data) 00102 { 00103 00104 // Select transceiver 00105 m_cs=0;//SPI_SELN_LOW(); 00106 00107 m_spi.write(TRX_CMD_SR);//SPI_DATA_REG = TRX_CMD_SR; 00108 //SPI_WAITFOR(); 00109 m_spi.write(addr);//SPI_DATA_REG = addr; 00110 //SPI_WAITFOR(); 00111 do 00112 { 00113 //SPI_DATA_REG = 0; /* dummy out */ 00114 //SPI_WAITFOR(); 00115 *data++ = m_spi.write(0);//SPI_DATA_REG; 00116 } 00117 while (--length > 0); 00118 00119 // Deselect Slave 00120 m_cs=1;//SPI_SELN_HIGH(); 00121 } 00122 00123 /* EOF */
Generated on Thu Jul 14 2022 01:09:40 by
1.7.2