mirror of https://github.com/ARMmbed/mbed-os.git
Squashed 'connectivity/drivers/802.15.4_RF/mcr20a-rf-driver/' content from commit b78cc04d67
git-subtree-dir: connectivity/drivers/802.15.4_RF/mcr20a-rf-driver git-subtree-split: b78cc04d67028dc8946966e55825a69eaab578c7pull/13473/head
commit
162ffeb55d
|
@ -0,0 +1,2 @@
|
|||
Unless specifically indicated otherwise in a file, files are licensed
|
||||
under the Apache 2.0 license, as can be found in: apache-2.0.txt
|
|
@ -0,0 +1,6 @@
|
|||
# Example RF driver for Freescale 802.15.4 transceivers #
|
||||
|
||||
Support for:
|
||||
* MCR20A
|
||||
|
||||
This driver is used with 6LoWPAN stack.
|
|
@ -0,0 +1,56 @@
|
|||
|
||||
|
||||
Apache License
|
||||
|
||||
Version 2.0, January 2004
|
||||
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
|
||||
|
||||
You must give any other recipients of the Work or Derivative Works a copy of this License; and
|
||||
You must cause any modified files to carry prominent notices stating that You changed the files; and
|
||||
You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
|
||||
If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
|
@ -0,0 +1,9 @@
|
|||
{
|
||||
"name": "mcr20a",
|
||||
"config": {
|
||||
"provide-default": {
|
||||
"help": "Provide default NanostackRfpy. [true/false]",
|
||||
"value": false
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,73 @@
|
|||
/*
|
||||
* Copyright (c) 2014-2015 ARM Limited. All rights reserved.
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
* Licensed under the Apache License, Version 2.0 (the License); you may
|
||||
* not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an AS IS BASIS, WITHOUT
|
||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef NANOSTACK_PHY_MCR20A_H_
|
||||
#define NANOSTACK_PHY_MCR20A_H_
|
||||
|
||||
#if defined(MBED_CONF_NANOSTACK_CONFIGURATION) && DEVICE_SPI && DEVICE_INTERRUPTIN && defined(MBED_CONF_RTOS_PRESENT)
|
||||
#include "inttypes.h"
|
||||
#include "NanostackRfPhy.h"
|
||||
#include "DigitalIn.h"
|
||||
#include "DigitalOut.h"
|
||||
#include "InterruptIn.h"
|
||||
#include "SPI.h"
|
||||
#include "rtos.h"
|
||||
|
||||
// Arduino pin defaults for convenience
|
||||
#if !defined(MCR20A_SPI_MOSI)
|
||||
#define MCR20A_SPI_MOSI D11
|
||||
#endif
|
||||
#if !defined(MCR20A_SPI_MISO)
|
||||
#define MCR20A_SPI_MISO D12
|
||||
#endif
|
||||
#if !defined(MCR20A_SPI_SCLK)
|
||||
#define MCR20A_SPI_SCLK D13
|
||||
#endif
|
||||
#if !defined(MCR20A_SPI_CS)
|
||||
#define MCR20A_SPI_CS D10
|
||||
#endif
|
||||
#if !defined(MCR20A_SPI_RST)
|
||||
#define MCR20A_SPI_RST D5
|
||||
#endif
|
||||
#if !defined(MCR20A_SPI_IRQ)
|
||||
#define MCR20A_SPI_IRQ D2
|
||||
#endif
|
||||
|
||||
class NanostackRfPhyMcr20a : public NanostackRfPhy {
|
||||
public:
|
||||
NanostackRfPhyMcr20a(PinName spi_mosi, PinName spi_miso,
|
||||
PinName spi_sclk, PinName spi_cs, PinName spi_rst,
|
||||
PinName spi_irq);
|
||||
virtual ~NanostackRfPhyMcr20a();
|
||||
virtual int8_t rf_register();
|
||||
virtual void rf_unregister();
|
||||
virtual void get_mac_address(uint8_t *mac);
|
||||
virtual void set_mac_address(uint8_t *mac);
|
||||
|
||||
private:
|
||||
mbed::SPI _spi;
|
||||
mbed::DigitalOut _rf_cs;
|
||||
mbed::DigitalOut _rf_rst;
|
||||
mbed::InterruptIn _rf_irq;
|
||||
mbed::DigitalIn _rf_irq_pin;
|
||||
rtos::Thread _irq_thread;
|
||||
|
||||
void _pins_set();
|
||||
void _pins_clear();
|
||||
};
|
||||
|
||||
#endif /* MBED_CONF_NANOSTACK_CONFIGURATION */
|
||||
#endif /* NANOSTACK_PHY_MCR20A_H_ */
|
|
@ -0,0 +1,671 @@
|
|||
/*!
|
||||
* Copyright (c) 2015, Freescale Semiconductor, Inc.
|
||||
* All rights reserved.
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*
|
||||
* \file MCR20Drv.c
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* o Redistributions of source code must retain the above copyright notice, this list
|
||||
* of conditions and the following disclaimer.
|
||||
*
|
||||
* o 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.
|
||||
*
|
||||
* o Neither the name of Freescale Semiconductor, Inc. nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from this
|
||||
* software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS 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.
|
||||
*/
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
* INCLUDED HEADERS *
|
||||
*---------------------------------------------------------------------------*
|
||||
* Add to this section all the headers that this module needs to include. *
|
||||
*---------------------------------------------------------------------------*
|
||||
*****************************************************************************/
|
||||
|
||||
#include "MCR20Drv.h"
|
||||
#include "MCR20Reg.h"
|
||||
#include "XcvrSpi.h"
|
||||
|
||||
#if defined(MBED_CONF_NANOSTACK_CONFIGURATION) && DEVICE_SPI && DEVICE_INTERRUPTIN && defined(MBED_CONF_RTOS_PRESENT)
|
||||
|
||||
#include "platform/mbed_critical.h"
|
||||
#include <string.h>
|
||||
|
||||
/*****************************************************************************
|
||||
* PRIVATE VARIABLES *
|
||||
*---------------------------------------------------------------------------*
|
||||
* Add to this section all the variables and constants that have local *
|
||||
* (file) scope. *
|
||||
* Each of this declarations shall be preceded by the 'static' keyword. *
|
||||
* These variables / constants cannot be accessed outside this module. *
|
||||
*---------------------------------------------------------------------------*
|
||||
*****************************************************************************/
|
||||
uint32_t mPhyIrqDisableCnt = 1;
|
||||
|
||||
/*****************************************************************************
|
||||
* PUBLIC VARIABLES *
|
||||
*---------------------------------------------------------------------------*
|
||||
* Add to this section all the variables and constants that have global *
|
||||
* (project) scope. *
|
||||
* These variables / constants can be accessed outside this module. *
|
||||
* These variables / constants shall be preceded by the 'extern' keyword in *
|
||||
* the interface header. *
|
||||
*---------------------------------------------------------------------------*
|
||||
*****************************************************************************/
|
||||
|
||||
/*****************************************************************************
|
||||
* PRIVATE FUNCTIONS PROTOTYPES *
|
||||
*---------------------------------------------------------------------------*
|
||||
* Add to this section all the functions prototypes that have local (file) *
|
||||
* scope. *
|
||||
* These functions cannot be accessed outside this module. *
|
||||
* These declarations shall be preceded by the 'static' keyword. *
|
||||
*---------------------------------------------------------------------------*
|
||||
*****************************************************************************/
|
||||
|
||||
/*****************************************************************************
|
||||
* PRIVATE FUNCTIONS *
|
||||
*---------------------------------------------------------------------------*
|
||||
* Add to this section all the functions that have local (file) scope. *
|
||||
* These functions cannot be accessed outside this module. *
|
||||
* These definitions shall be preceded by the 'static' keyword. *
|
||||
*---------------------------------------------------------------------------*
|
||||
*****************************************************************************/
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
* PUBLIC FUNCTIONS *
|
||||
*---------------------------------------------------------------------------*
|
||||
* Add to this section all the functions that have global (project) scope. *
|
||||
* These functions can be accessed outside this module. *
|
||||
* These functions shall have their declarations (prototypes) within the *
|
||||
* interface header file and shall be preceded by the 'extern' keyword. *
|
||||
*---------------------------------------------------------------------------*
|
||||
*****************************************************************************/
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
* Name: MCR20Drv_Init
|
||||
* Description: -
|
||||
* Parameters: -
|
||||
* Return: -
|
||||
*---------------------------------------------------------------------------*/
|
||||
void MCR20Drv_Init
|
||||
(
|
||||
void
|
||||
)
|
||||
{
|
||||
xcvr_spi_init(gXcvrSpiInstance_c);
|
||||
xcvr_spi_configure_speed(gXcvrSpiInstance_c, 8000000);
|
||||
|
||||
gXcvrDeassertCS_d();
|
||||
MCR20Drv_RST_B_Deassert();
|
||||
RF_IRQ_Init();
|
||||
RF_IRQ_Disable();
|
||||
mPhyIrqDisableCnt = 1;
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
* Name: MCR20Drv_DirectAccessSPIWrite
|
||||
* Description: -
|
||||
* Parameters: -
|
||||
* Return: -
|
||||
*---------------------------------------------------------------------------*/
|
||||
void MCR20Drv_DirectAccessSPIWrite
|
||||
(
|
||||
uint8_t address,
|
||||
uint8_t value
|
||||
)
|
||||
{
|
||||
uint16_t txData;
|
||||
|
||||
ProtectFromMCR20Interrupt();
|
||||
|
||||
xcvr_spi_configure_speed(gXcvrSpiInstance_c, 16000000);
|
||||
|
||||
gXcvrAssertCS_d();
|
||||
|
||||
txData = (address & TransceiverSPI_DirectRegisterAddressMask);
|
||||
txData |= value << 8;
|
||||
|
||||
xcvr_spi_transfer(gXcvrSpiInstance_c, (uint8_t *)&txData, 0, sizeof(txData));
|
||||
|
||||
gXcvrDeassertCS_d();
|
||||
UnprotectFromMCR20Interrupt();
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
* Name: MCR20Drv_DirectAccessSPIMultiByteWrite
|
||||
* Description: -
|
||||
* Parameters: -
|
||||
* Return: -
|
||||
*---------------------------------------------------------------------------*/
|
||||
void MCR20Drv_DirectAccessSPIMultiByteWrite
|
||||
(
|
||||
uint8_t startAddress,
|
||||
uint8_t *byteArray,
|
||||
uint8_t numOfBytes
|
||||
)
|
||||
{
|
||||
uint8_t txData;
|
||||
|
||||
if ((numOfBytes == 0) || (byteArray == NULL)) {
|
||||
return;
|
||||
}
|
||||
|
||||
ProtectFromMCR20Interrupt();
|
||||
|
||||
xcvr_spi_configure_speed(gXcvrSpiInstance_c, 16000000);
|
||||
|
||||
gXcvrAssertCS_d();
|
||||
|
||||
txData = (startAddress & TransceiverSPI_DirectRegisterAddressMask);
|
||||
|
||||
xcvr_spi_transfer(gXcvrSpiInstance_c, &txData, 0, sizeof(txData));
|
||||
xcvr_spi_transfer(gXcvrSpiInstance_c, byteArray, 0, numOfBytes);
|
||||
|
||||
gXcvrDeassertCS_d();
|
||||
UnprotectFromMCR20Interrupt();
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
* Name: MCR20Drv_PB_SPIByteWrite
|
||||
* Description: -
|
||||
* Parameters: -
|
||||
* Return: -
|
||||
*---------------------------------------------------------------------------*/
|
||||
void MCR20Drv_PB_SPIByteWrite
|
||||
(
|
||||
uint8_t address,
|
||||
uint8_t value
|
||||
)
|
||||
{
|
||||
uint32_t txData;
|
||||
|
||||
ProtectFromMCR20Interrupt();
|
||||
|
||||
xcvr_spi_configure_speed(gXcvrSpiInstance_c, 16000000);
|
||||
|
||||
gXcvrAssertCS_d();
|
||||
|
||||
txData = TransceiverSPI_WriteSelect |
|
||||
TransceiverSPI_PacketBuffAccessSelect |
|
||||
TransceiverSPI_PacketBuffByteModeSelect;
|
||||
txData |= (address) << 8;
|
||||
txData |= (value) << 16;
|
||||
|
||||
xcvr_spi_transfer(gXcvrSpiInstance_c, (uint8_t *)&txData, 0, 3);
|
||||
|
||||
gXcvrDeassertCS_d();
|
||||
UnprotectFromMCR20Interrupt();
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
* Name: MCR20Drv_PB_SPIBurstWrite
|
||||
* Description: -
|
||||
* Parameters: -
|
||||
* Return: -
|
||||
*---------------------------------------------------------------------------*/
|
||||
void MCR20Drv_PB_SPIBurstWrite
|
||||
(
|
||||
uint8_t *byteArray,
|
||||
uint8_t numOfBytes
|
||||
)
|
||||
{
|
||||
uint8_t txData;
|
||||
|
||||
if ((numOfBytes == 0) || (byteArray == NULL)) {
|
||||
return;
|
||||
}
|
||||
|
||||
ProtectFromMCR20Interrupt();
|
||||
|
||||
xcvr_spi_configure_speed(gXcvrSpiInstance_c, 16000000);
|
||||
|
||||
gXcvrAssertCS_d();
|
||||
|
||||
txData = TransceiverSPI_WriteSelect |
|
||||
TransceiverSPI_PacketBuffAccessSelect |
|
||||
TransceiverSPI_PacketBuffBurstModeSelect;
|
||||
|
||||
xcvr_spi_transfer(gXcvrSpiInstance_c, &txData, 0, 1);
|
||||
xcvr_spi_transfer(gXcvrSpiInstance_c, byteArray, 0, numOfBytes);
|
||||
|
||||
gXcvrDeassertCS_d();
|
||||
UnprotectFromMCR20Interrupt();
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
* Name: MCR20Drv_DirectAccessSPIRead
|
||||
* Description: -
|
||||
* Parameters: -
|
||||
* Return: -
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
uint8_t MCR20Drv_DirectAccessSPIRead
|
||||
(
|
||||
uint8_t address
|
||||
)
|
||||
{
|
||||
uint8_t txData;
|
||||
uint8_t rxData;
|
||||
|
||||
ProtectFromMCR20Interrupt();
|
||||
|
||||
xcvr_spi_configure_speed(gXcvrSpiInstance_c, 8000000);
|
||||
|
||||
gXcvrAssertCS_d();
|
||||
|
||||
txData = (address & TransceiverSPI_DirectRegisterAddressMask) |
|
||||
TransceiverSPI_ReadSelect;
|
||||
|
||||
xcvr_spi_transfer(gXcvrSpiInstance_c, &txData, 0, sizeof(txData));
|
||||
xcvr_spi_transfer(gXcvrSpiInstance_c, 0, &rxData, sizeof(rxData));
|
||||
|
||||
gXcvrDeassertCS_d();
|
||||
UnprotectFromMCR20Interrupt();
|
||||
|
||||
return rxData;
|
||||
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
* Name: MCR20Drv_DirectAccessSPIMultyByteRead
|
||||
* Description: -
|
||||
* Parameters: -
|
||||
* Return: -
|
||||
*---------------------------------------------------------------------------*/
|
||||
uint8_t MCR20Drv_DirectAccessSPIMultiByteRead
|
||||
(
|
||||
uint8_t startAddress,
|
||||
uint8_t *byteArray,
|
||||
uint8_t numOfBytes
|
||||
)
|
||||
{
|
||||
uint8_t txData;
|
||||
uint8_t phyIRQSTS1;
|
||||
|
||||
if ((numOfBytes == 0) || (byteArray == NULL)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
ProtectFromMCR20Interrupt();
|
||||
|
||||
xcvr_spi_configure_speed(gXcvrSpiInstance_c, 8000000);
|
||||
|
||||
gXcvrAssertCS_d();
|
||||
|
||||
txData = (startAddress & TransceiverSPI_DirectRegisterAddressMask) |
|
||||
TransceiverSPI_ReadSelect;
|
||||
|
||||
xcvr_spi_transfer(gXcvrSpiInstance_c, &txData, &phyIRQSTS1, sizeof(txData));
|
||||
xcvr_spi_transfer(gXcvrSpiInstance_c, 0, byteArray, numOfBytes);
|
||||
|
||||
gXcvrDeassertCS_d();
|
||||
UnprotectFromMCR20Interrupt();
|
||||
|
||||
return phyIRQSTS1;
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
* Name: MCR20Drv_PB_SPIBurstRead
|
||||
* Description: -
|
||||
* Parameters: -
|
||||
* Return: -
|
||||
*---------------------------------------------------------------------------*/
|
||||
uint8_t MCR20Drv_PB_SPIBurstRead
|
||||
(
|
||||
uint8_t *byteArray,
|
||||
uint8_t numOfBytes
|
||||
)
|
||||
{
|
||||
uint8_t txData;
|
||||
uint8_t phyIRQSTS1;
|
||||
|
||||
if ((numOfBytes == 0) || (byteArray == NULL)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
ProtectFromMCR20Interrupt();
|
||||
|
||||
xcvr_spi_configure_speed(gXcvrSpiInstance_c, 8000000);
|
||||
|
||||
gXcvrAssertCS_d();
|
||||
|
||||
txData = TransceiverSPI_ReadSelect |
|
||||
TransceiverSPI_PacketBuffAccessSelect |
|
||||
TransceiverSPI_PacketBuffBurstModeSelect;
|
||||
|
||||
xcvr_spi_transfer(gXcvrSpiInstance_c, &txData, &phyIRQSTS1, sizeof(txData));
|
||||
xcvr_spi_transfer(gXcvrSpiInstance_c, 0, byteArray, numOfBytes);
|
||||
|
||||
gXcvrDeassertCS_d();
|
||||
UnprotectFromMCR20Interrupt();
|
||||
|
||||
return phyIRQSTS1;
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
* Name: MCR20Drv_IndirectAccessSPIWrite
|
||||
* Description: -
|
||||
* Parameters: -
|
||||
* Return: -
|
||||
*---------------------------------------------------------------------------*/
|
||||
void MCR20Drv_IndirectAccessSPIWrite
|
||||
(
|
||||
uint8_t address,
|
||||
uint8_t value
|
||||
)
|
||||
{
|
||||
uint32_t txData;
|
||||
|
||||
ProtectFromMCR20Interrupt();
|
||||
|
||||
xcvr_spi_configure_speed(gXcvrSpiInstance_c, 16000000);
|
||||
|
||||
gXcvrAssertCS_d();
|
||||
|
||||
txData = TransceiverSPI_IARIndexReg;
|
||||
txData |= (address) << 8;
|
||||
txData |= (value) << 16;
|
||||
|
||||
xcvr_spi_transfer(gXcvrSpiInstance_c, (uint8_t *)&txData, 0, 3);
|
||||
|
||||
gXcvrDeassertCS_d();
|
||||
UnprotectFromMCR20Interrupt();
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
* Name: MCR20Drv_IndirectAccessSPIMultiByteWrite
|
||||
* Description: -
|
||||
* Parameters: -
|
||||
* Return: -
|
||||
*---------------------------------------------------------------------------*/
|
||||
void MCR20Drv_IndirectAccessSPIMultiByteWrite
|
||||
(
|
||||
uint8_t startAddress,
|
||||
uint8_t *byteArray,
|
||||
uint8_t numOfBytes
|
||||
)
|
||||
{
|
||||
uint16_t txData;
|
||||
|
||||
if ((numOfBytes == 0) || (byteArray == NULL)) {
|
||||
return;
|
||||
}
|
||||
|
||||
ProtectFromMCR20Interrupt();
|
||||
|
||||
xcvr_spi_configure_speed(gXcvrSpiInstance_c, 16000000);
|
||||
|
||||
gXcvrAssertCS_d();
|
||||
|
||||
txData = TransceiverSPI_IARIndexReg;
|
||||
txData |= (startAddress) << 8;
|
||||
|
||||
xcvr_spi_transfer(gXcvrSpiInstance_c, (uint8_t *)&txData, 0, sizeof(txData));
|
||||
xcvr_spi_transfer(gXcvrSpiInstance_c, (uint8_t *)byteArray, 0, numOfBytes);
|
||||
|
||||
gXcvrDeassertCS_d();
|
||||
UnprotectFromMCR20Interrupt();
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
* Name: MCR20Drv_IndirectAccessSPIRead
|
||||
* Description: -
|
||||
* Parameters: -
|
||||
* Return: -
|
||||
*---------------------------------------------------------------------------*/
|
||||
uint8_t MCR20Drv_IndirectAccessSPIRead
|
||||
(
|
||||
uint8_t address
|
||||
)
|
||||
{
|
||||
uint16_t txData;
|
||||
uint8_t rxData;
|
||||
|
||||
ProtectFromMCR20Interrupt();
|
||||
|
||||
xcvr_spi_configure_speed(gXcvrSpiInstance_c, 8000000);
|
||||
|
||||
gXcvrAssertCS_d();
|
||||
|
||||
txData = TransceiverSPI_IARIndexReg | TransceiverSPI_ReadSelect;
|
||||
txData |= (address) << 8;
|
||||
|
||||
xcvr_spi_transfer(gXcvrSpiInstance_c, (uint8_t *)&txData, 0, sizeof(txData));
|
||||
xcvr_spi_transfer(gXcvrSpiInstance_c, 0, &rxData, sizeof(rxData));
|
||||
|
||||
gXcvrDeassertCS_d();
|
||||
UnprotectFromMCR20Interrupt();
|
||||
|
||||
return rxData;
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
* Name: MCR20Drv_IndirectAccessSPIMultiByteRead
|
||||
* Description: -
|
||||
* Parameters: -
|
||||
* Return: -
|
||||
*---------------------------------------------------------------------------*/
|
||||
void MCR20Drv_IndirectAccessSPIMultiByteRead
|
||||
(
|
||||
uint8_t startAddress,
|
||||
uint8_t *byteArray,
|
||||
uint8_t numOfBytes
|
||||
)
|
||||
{
|
||||
uint16_t txData;
|
||||
|
||||
if ((numOfBytes == 0) || (byteArray == NULL)) {
|
||||
return;
|
||||
}
|
||||
|
||||
ProtectFromMCR20Interrupt();
|
||||
|
||||
xcvr_spi_configure_speed(gXcvrSpiInstance_c, 8000000);
|
||||
|
||||
gXcvrAssertCS_d();
|
||||
|
||||
txData = (TransceiverSPI_IARIndexReg | TransceiverSPI_ReadSelect);
|
||||
txData |= (startAddress) << 8;
|
||||
|
||||
xcvr_spi_transfer(gXcvrSpiInstance_c, (uint8_t *)&txData, 0, sizeof(txData));
|
||||
xcvr_spi_transfer(gXcvrSpiInstance_c, 0, byteArray, numOfBytes);
|
||||
|
||||
gXcvrDeassertCS_d();
|
||||
UnprotectFromMCR20Interrupt();
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
* Name: MCR20Drv_IsIrqPending
|
||||
* Description: -
|
||||
* Parameters: -
|
||||
* Return: -
|
||||
*---------------------------------------------------------------------------*/
|
||||
uint32_t MCR20Drv_IsIrqPending
|
||||
(
|
||||
void
|
||||
)
|
||||
{
|
||||
return RF_isIRQ_Pending();
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
* Name: MCR20Drv_IRQ_Disable
|
||||
* Description: -
|
||||
* Parameters: -
|
||||
* Return: -
|
||||
*---------------------------------------------------------------------------*/
|
||||
void MCR20Drv_IRQ_Disable
|
||||
(
|
||||
void
|
||||
)
|
||||
{
|
||||
core_util_critical_section_enter();
|
||||
|
||||
if (mPhyIrqDisableCnt == 0) {
|
||||
RF_IRQ_Disable();
|
||||
}
|
||||
|
||||
mPhyIrqDisableCnt++;
|
||||
|
||||
core_util_critical_section_exit();
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
* Name: MCR20Drv_IRQ_Enable
|
||||
* Description: -
|
||||
* Parameters: -
|
||||
* Return: -
|
||||
*---------------------------------------------------------------------------*/
|
||||
void MCR20Drv_IRQ_Enable
|
||||
(
|
||||
void
|
||||
)
|
||||
{
|
||||
core_util_critical_section_enter();
|
||||
|
||||
if (mPhyIrqDisableCnt) {
|
||||
mPhyIrqDisableCnt--;
|
||||
|
||||
if (mPhyIrqDisableCnt == 0) {
|
||||
RF_IRQ_Enable();
|
||||
}
|
||||
}
|
||||
|
||||
core_util_critical_section_exit();
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
* Name: MCR20Drv_RST_Assert
|
||||
* Description: -
|
||||
* Parameters: -
|
||||
* Return: -
|
||||
*---------------------------------------------------------------------------*/
|
||||
void MCR20Drv_RST_B_Assert
|
||||
(
|
||||
void
|
||||
)
|
||||
{
|
||||
RF_RST_Set(0);
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
* Name: MCR20Drv_RST_Deassert
|
||||
* Description: -
|
||||
* Parameters: -
|
||||
* Return: -
|
||||
*---------------------------------------------------------------------------*/
|
||||
void MCR20Drv_RST_B_Deassert
|
||||
(
|
||||
void
|
||||
)
|
||||
{
|
||||
RF_RST_Set(1);
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
* Name: MCR20Drv_SoftRST_Assert
|
||||
* Description: -
|
||||
* Parameters: -
|
||||
* Return: -
|
||||
*---------------------------------------------------------------------------*/
|
||||
void MCR20Drv_SoftRST_Assert
|
||||
(
|
||||
void
|
||||
)
|
||||
{
|
||||
MCR20Drv_IndirectAccessSPIWrite(SOFT_RESET, (0x80));
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
* Name: MCR20Drv_SoftRST_Deassert
|
||||
* Description: -
|
||||
* Parameters: -
|
||||
* Return: -
|
||||
*---------------------------------------------------------------------------*/
|
||||
void MCR20Drv_SoftRST_Deassert
|
||||
(
|
||||
void
|
||||
)
|
||||
{
|
||||
MCR20Drv_IndirectAccessSPIWrite(SOFT_RESET, (0x00));
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
* Name: MCR20Drv_Soft_RESET
|
||||
* Description: -
|
||||
* Parameters: -
|
||||
* Return: -
|
||||
*---------------------------------------------------------------------------*/
|
||||
void MCR20Drv_Soft_RESET
|
||||
(
|
||||
void
|
||||
)
|
||||
{
|
||||
//assert SOG_RST
|
||||
MCR20Drv_IndirectAccessSPIWrite(SOFT_RESET, (0x80));
|
||||
|
||||
//deassert SOG_RST
|
||||
MCR20Drv_IndirectAccessSPIWrite(SOFT_RESET, (0x00));
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
* Name: MCR20Drv_RESET
|
||||
* Description: -
|
||||
* Parameters: -
|
||||
* Return: -
|
||||
*---------------------------------------------------------------------------*/
|
||||
void MCR20Drv_RESET
|
||||
(
|
||||
void
|
||||
)
|
||||
{
|
||||
volatile uint32_t delay = 1000;
|
||||
//assert RST_B
|
||||
MCR20Drv_RST_B_Assert();
|
||||
|
||||
while (delay--);
|
||||
|
||||
//deassert RST_B
|
||||
MCR20Drv_RST_B_Deassert();
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
* Name: MCR20Drv_Set_CLK_OUT_Freq
|
||||
* Description: -
|
||||
* Parameters: -
|
||||
* Return: -
|
||||
*---------------------------------------------------------------------------*/
|
||||
void MCR20Drv_Set_CLK_OUT_Freq
|
||||
(
|
||||
uint8_t freqDiv
|
||||
)
|
||||
{
|
||||
uint8_t clkOutCtrlReg = (freqDiv & cCLK_OUT_DIV_Mask) | cCLK_OUT_EN | cCLK_OUT_EXTEND;
|
||||
|
||||
if (freqDiv == gCLK_OUT_FREQ_DISABLE) {
|
||||
clkOutCtrlReg = (cCLK_OUT_EXTEND | gCLK_OUT_FREQ_4_MHz); //reset value with clock out disabled
|
||||
}
|
||||
|
||||
MCR20Drv_DirectAccessSPIWrite((uint8_t) CLK_OUT_CTRL, clkOutCtrlReg);
|
||||
}
|
||||
|
||||
#endif /* MBED_CONF_NANOSTACK_CONFIGURATION */
|
|
@ -0,0 +1,374 @@
|
|||
/*!
|
||||
* Copyright (c) 2015, Freescale Semiconductor, Inc.
|
||||
* All rights reserved.
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*
|
||||
* \file MCR20Drv.h
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* o Redistributions of source code must retain the above copyright notice, this list
|
||||
* of conditions and the following disclaimer.
|
||||
*
|
||||
* o 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.
|
||||
*
|
||||
* o Neither the name of Freescale Semiconductor, Inc. nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from this
|
||||
* software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS 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.
|
||||
*/
|
||||
|
||||
#ifndef __MCR20_DRV_H__
|
||||
#define __MCR20_DRV_H__
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
/*****************************************************************************
|
||||
* INCLUDED HEADERS *
|
||||
*---------------------------------------------------------------------------*
|
||||
* Add to this section all the headers that this module needs to include. *
|
||||
* Note that it is not a good practice to include header files into header *
|
||||
* files, so use this section only if there is no other better solution. *
|
||||
*---------------------------------------------------------------------------*
|
||||
*****************************************************************************/
|
||||
|
||||
/*****************************************************************************
|
||||
* PRIVATE MACROS *
|
||||
*---------------------------------------------------------------------------*
|
||||
* Add to this section all the access macros, registers mappings, bit access *
|
||||
* macros, masks, flags etc ...
|
||||
*---------------------------------------------------------------------------*
|
||||
*****************************************************************************/
|
||||
|
||||
/* Disable XCVR clock output by default, to reduce power consumption */
|
||||
#ifndef gMCR20_ClkOutFreq_d
|
||||
#define gMCR20_ClkOutFreq_d gCLK_OUT_FREQ_DISABLE
|
||||
#endif
|
||||
|
||||
/*****************************************************************************
|
||||
* PUBLIC FUNCTIONS *
|
||||
*---------------------------------------------------------------------------*
|
||||
* Add to this section all the global functions prototype preceded (as a *
|
||||
* good practice) by the keyword 'extern' *
|
||||
*---------------------------------------------------------------------------*
|
||||
*****************************************************************************/
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
* Name: MCR20Drv_Init
|
||||
* Description: -
|
||||
* Parameters: -
|
||||
* Return: -
|
||||
*---------------------------------------------------------------------------*/
|
||||
extern void MCR20Drv_Init
|
||||
(
|
||||
void
|
||||
);
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
* Name: MCR20Drv_SPI_DMA_Init
|
||||
* Description: -
|
||||
* Parameters: -
|
||||
* Return: -
|
||||
*---------------------------------------------------------------------------*/
|
||||
void MCR20Drv_SPI_DMA_Init
|
||||
(
|
||||
void
|
||||
);
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
* Name: MCR20Drv_Start_PB_DMA_SPI_Write
|
||||
* Description: -
|
||||
* Parameters: -
|
||||
* Return: -
|
||||
*---------------------------------------------------------------------------*/
|
||||
void MCR20Drv_Start_PB_DMA_SPI_Write
|
||||
(
|
||||
uint8_t *srcAddress,
|
||||
uint8_t numOfBytes
|
||||
);
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
* Name: MCR20Drv_Start_PB_DMA_SPI_Read
|
||||
* Description: -
|
||||
* Parameters: -
|
||||
* Return: -
|
||||
*---------------------------------------------------------------------------*/
|
||||
void MCR20Drv_Start_PB_DMA_SPI_Read
|
||||
(
|
||||
uint8_t *dstAddress,
|
||||
uint8_t numOfBytes
|
||||
);
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
* Name: MCR20Drv_DirectAccessSPIWrite
|
||||
* Description: -
|
||||
* Parameters: -
|
||||
* Return: -
|
||||
*---------------------------------------------------------------------------*/
|
||||
void MCR20Drv_DirectAccessSPIWrite
|
||||
(
|
||||
uint8_t address,
|
||||
uint8_t value
|
||||
);
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
* Name: MCR20Drv_DirectAccessSPIMultiByteWrite
|
||||
* Description: -
|
||||
* Parameters: -
|
||||
* Return: -
|
||||
*---------------------------------------------------------------------------*/
|
||||
void MCR20Drv_DirectAccessSPIMultiByteWrite
|
||||
(
|
||||
uint8_t startAddress,
|
||||
uint8_t *byteArray,
|
||||
uint8_t numOfBytes
|
||||
);
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
* Name: MCR20Drv_PB_SPIBurstWrite
|
||||
* Description: -
|
||||
* Parameters: -
|
||||
* Return: -
|
||||
*---------------------------------------------------------------------------*/
|
||||
void MCR20Drv_PB_SPIBurstWrite
|
||||
(
|
||||
uint8_t *byteArray,
|
||||
uint8_t numOfBytes
|
||||
);
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
* Name: MCR20Drv_DirectAccessSPIRead
|
||||
* Description: -
|
||||
* Parameters: -
|
||||
* Return: -
|
||||
*---------------------------------------------------------------------------*/
|
||||
uint8_t MCR20Drv_DirectAccessSPIRead
|
||||
(
|
||||
uint8_t address
|
||||
);
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
* Name: MCR20Drv_DirectAccessSPIMultyByteRead
|
||||
* Description: -
|
||||
* Parameters: -
|
||||
* Return: -
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
uint8_t MCR20Drv_DirectAccessSPIMultiByteRead
|
||||
(
|
||||
uint8_t startAddress,
|
||||
uint8_t *byteArray,
|
||||
uint8_t numOfBytes
|
||||
);
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
* Name: MCR20Drv_PB_SPIByteWrite
|
||||
* Description: -
|
||||
* Parameters: -
|
||||
* Return: -
|
||||
*---------------------------------------------------------------------------*/
|
||||
void MCR20Drv_PB_SPIByteWrite
|
||||
(
|
||||
uint8_t address,
|
||||
uint8_t value
|
||||
);
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
* Name: MCR20Drv_PB_SPIBurstRead
|
||||
* Description: -
|
||||
* Parameters: -
|
||||
* Return: -
|
||||
*---------------------------------------------------------------------------*/
|
||||
uint8_t MCR20Drv_PB_SPIBurstRead
|
||||
(
|
||||
uint8_t *byteArray,
|
||||
uint8_t numOfBytes
|
||||
);
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
* Name: MCR20Drv_IndirectAccessSPIWrite
|
||||
* Description: -
|
||||
* Parameters: -
|
||||
* Return: -
|
||||
*---------------------------------------------------------------------------*/
|
||||
void MCR20Drv_IndirectAccessSPIWrite
|
||||
(
|
||||
uint8_t address,
|
||||
uint8_t value
|
||||
);
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
* Name: MCR20Drv_IndirectAccessSPIMultiByteWrite
|
||||
* Description: -
|
||||
* Parameters: -
|
||||
* Return: -
|
||||
*---------------------------------------------------------------------------*/
|
||||
void MCR20Drv_IndirectAccessSPIMultiByteWrite
|
||||
(
|
||||
uint8_t startAddress,
|
||||
uint8_t *byteArray,
|
||||
uint8_t numOfBytes
|
||||
);
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
* Name: MCR20Drv_IndirectAccessSPIRead
|
||||
* Description: -
|
||||
* Parameters: -
|
||||
* Return: -
|
||||
*---------------------------------------------------------------------------*/
|
||||
uint8_t MCR20Drv_IndirectAccessSPIRead
|
||||
(
|
||||
uint8_t address
|
||||
);
|
||||
/*---------------------------------------------------------------------------
|
||||
* Name: MCR20Drv_IndirectAccessSPIMultiByteRead
|
||||
* Description: -
|
||||
* Parameters: -
|
||||
* Return: -
|
||||
*---------------------------------------------------------------------------*/
|
||||
void MCR20Drv_IndirectAccessSPIMultiByteRead
|
||||
(
|
||||
uint8_t startAddress,
|
||||
uint8_t *byteArray,
|
||||
uint8_t numOfBytes
|
||||
);
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
* Name: MCR20Drv_IsIrqPending
|
||||
* Description: -
|
||||
* Parameters: -
|
||||
* Return: -
|
||||
*---------------------------------------------------------------------------*/
|
||||
uint32_t MCR20Drv_IsIrqPending
|
||||
(
|
||||
void
|
||||
);
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
* Name: MCR20Drv_IRQ_Disable
|
||||
* Description: -
|
||||
* Parameters: -
|
||||
* Return: -
|
||||
*---------------------------------------------------------------------------*/
|
||||
void MCR20Drv_IRQ_Disable
|
||||
(
|
||||
void
|
||||
);
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
* Name: MCR20Drv_IRQ_Enable
|
||||
* Description: -
|
||||
* Parameters: -
|
||||
* Return: -
|
||||
*---------------------------------------------------------------------------*/
|
||||
void MCR20Drv_IRQ_Enable
|
||||
(
|
||||
void
|
||||
);
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
* Name: MCR20Drv_RST_PortConfig
|
||||
* Description: -
|
||||
* Parameters: -
|
||||
* Return: -
|
||||
*---------------------------------------------------------------------------*/
|
||||
void MCR20Drv_RST_B_PortConfig
|
||||
(
|
||||
void
|
||||
);
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
* Name: MCR20Drv_RST_Assert
|
||||
* Description: -
|
||||
* Parameters: -
|
||||
* Return: -
|
||||
*---------------------------------------------------------------------------*/
|
||||
void MCR20Drv_RST_B_Assert
|
||||
(
|
||||
void
|
||||
);
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
* Name: MCR20Drv_RST_Deassert
|
||||
* Description: -
|
||||
* Parameters: -
|
||||
* Return: -
|
||||
*---------------------------------------------------------------------------*/
|
||||
void MCR20Drv_RST_B_Deassert
|
||||
(
|
||||
void
|
||||
);
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
* Name: MCR20Drv_SoftRST_Assert
|
||||
* Description: -
|
||||
* Parameters: -
|
||||
* Return: -
|
||||
*---------------------------------------------------------------------------*/
|
||||
void MCR20Drv_SoftRST_Assert
|
||||
(
|
||||
void
|
||||
);
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
* Name: MCR20Drv_SoftRST_Deassert
|
||||
* Description: -
|
||||
* Parameters: -
|
||||
* Return: -
|
||||
*---------------------------------------------------------------------------*/
|
||||
void MCR20Drv_SoftRST_Deassert
|
||||
(
|
||||
void
|
||||
);
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
* Name: MCR20Drv_RESET
|
||||
* Description: -
|
||||
* Parameters: -
|
||||
* Return: -
|
||||
*---------------------------------------------------------------------------*/
|
||||
void MCR20Drv_RESET
|
||||
(
|
||||
void
|
||||
);
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
* Name: MCR20Drv_Soft_RESET
|
||||
* Description: -
|
||||
* Parameters: -
|
||||
* Return: -
|
||||
*---------------------------------------------------------------------------*/
|
||||
void MCR20Drv_Soft_RESET
|
||||
(
|
||||
void
|
||||
);
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
* Name: MCR20Drv_Set_CLK_OUT_Freq
|
||||
* Description: -
|
||||
* Parameters: -
|
||||
* Return: -
|
||||
*---------------------------------------------------------------------------*/
|
||||
void MCR20Drv_Set_CLK_OUT_Freq
|
||||
(
|
||||
uint8_t freqDiv
|
||||
);
|
||||
|
||||
#define ProtectFromMCR20Interrupt() MCR20Drv_IRQ_Disable()
|
||||
#define UnprotectFromMCR20Interrupt() MCR20Drv_IRQ_Enable()
|
||||
|
||||
#endif /* __MCR20_DRV_H__ */
|
|
@ -0,0 +1,310 @@
|
|||
/*!
|
||||
* Copyright (c) 2015, Freescale Semiconductor, Inc.
|
||||
* All rights reserved.
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*
|
||||
* \file MCR20Overwrites.h
|
||||
* Description: Overwrites header file for MCR20 Register values
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* o Redistributions of source code must retain the above copyright notice, this list
|
||||
* of conditions and the following disclaimer.
|
||||
*
|
||||
* o 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.
|
||||
*
|
||||
* o Neither the name of Freescale Semiconductor, Inc. nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from this
|
||||
* software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS 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.
|
||||
*/
|
||||
|
||||
#ifndef OVERWRITES_H_
|
||||
#define OVERWRITES_H_
|
||||
|
||||
typedef struct overwrites_tag {
|
||||
char address;
|
||||
char data;
|
||||
} overwrites_t;
|
||||
|
||||
|
||||
/*****************************************************************************************************************/
|
||||
// This file is created exclusively for use with the transceiver 2.0 silicon
|
||||
// and is provided for the world to use. It contains a list of all
|
||||
// known overwrite values. Overwrite values are non-default register
|
||||
// values that configure the transceiver device to a more optimally performing
|
||||
// posture. It is expected that low level software (i.e. PHY) will
|
||||
// consume this file as a #include, and transfer the contents to the
|
||||
// the indicated addresses in the transceiver's memory space. This file has
|
||||
// at least one required entry, that being its own version current version
|
||||
// number, to be stored at transceiver's location 0x3B the
|
||||
// OVERWRITES_VERSION_NUMBER register. The RAM register is provided in
|
||||
// the transceiver address space to assist in future debug efforts. The
|
||||
// analyst may read this location (once device has been booted with
|
||||
// mysterious software) and have a good indication of what register
|
||||
// overwrites were performed (with all versions of the overwrites.h file
|
||||
// being archived forever at the Compass location shown above.
|
||||
//
|
||||
// The transceiver has an indirect register (IAR) space. Write access to this space
|
||||
// requires 3 or more writes:
|
||||
// 1st) the first write is an index value to the indirect (write Bit7=0, register access Bit 6=0) + 0x3E
|
||||
// 2nd) IAR Register #0x00 - 0xFF.
|
||||
// 3rd) The data to write
|
||||
// nth) Burst mode additional data if required.
|
||||
//
|
||||
// Write access to direct space requires only a single address, data pair.
|
||||
|
||||
overwrites_t const overwrites_direct[] = {
|
||||
{0x3B, 0x0C}, //version 0C: new value for ACKDELAY targeting 198us (23 May, 2013, Larry Roshak)
|
||||
{0x23, 0x17} //PA_PWR new default Power Step is "23"
|
||||
};
|
||||
|
||||
overwrites_t const overwrites_indirect[] = {
|
||||
{0x31, 0x02}, //clear MISO_HIZ_EN (for single SPI master/slave pair) and SPI_PUL_EN (minimize HIB currents)
|
||||
{0x91, 0xB3}, //VCO_CTRL1 override VCOALC_REF_TX to 3
|
||||
{0x92, 0x07}, //VCO_CTRL2 override VCOALC_REF_RX to 3, keep VCO_BUF_BOOST = 1
|
||||
{0x8A, 0x71}, //PA_TUNING override PA_COILTUNING to 001 (27 Nov 2012, D. Brown, on behalf of S. Eid)
|
||||
{0x79, 0x2F}, //CHF_IBUF Adjust the gm-C filter gain (+/- 6dB) (21 Dec, 2012, on behalf of S. Soca)
|
||||
{0x7A, 0x2F}, //CHF_QBUF Adjust the gm-C filter gain (+/- 6dB) (21 Dec, 2012, on behalf of S. Soca)
|
||||
{0x7B, 0x24}, //CHF_IRIN Adjust the filter bandwidth (+/- 0.5MHz) (21 Dec, 2012, on behalf of S. Soca)
|
||||
{0x7C, 0x24}, //CHF_QRIN Adjust the filter bandwidth (+/- 0.5MHz) (21 Dec, 2012, on behalf of S. Soca)
|
||||
{0x7D, 0x24}, //CHF_IL Adjust the filter bandwidth (+/- 0.5MHz) (21 Dec, 2012, on behalf of S. Soca)
|
||||
{0x7E, 0x24}, //CHF_QL Adjust the filter bandwidth (+/- 0.5MHz) (21 Dec, 2012, on behalf of S. Soca)
|
||||
{0x7F, 0x32}, //CHF_CC1 Adjust the filter center frequency (+/- 1MHz) (21 Dec, 2012, on behalf of S. Soca)
|
||||
{0x80, 0x1D}, //CHF_CCL Adjust the filter center frequency (+/- 1MHz) (21 Dec, 2012, on behalf of S. Soca)
|
||||
{0x81, 0x2D}, //CHF_CC2 Adjust the filter center frequency (+/- 1MHz) (21 Dec, 2012, on behalf of S. Soca)
|
||||
{0x82, 0x24}, //CHF_IROUT Adjust the filter bandwidth (+/- 0.5MHz) (21 Dec, 2012, on behalf of S. Soca)
|
||||
{0x83, 0x24}, //CHF_QROUT Adjust the filter bandwidth (+/- 0.5MHz) (21 Dec, 2012, on behalf of S. Soca)
|
||||
{0x64, 0x28}, //PA_CAL_DIS=1 Disabled PA calibration
|
||||
{0x52, 0x55}, //AGC_THR1 RSSI tune up
|
||||
{0x53, 0x2D}, //AGC_THR2 RSSI tune up
|
||||
{0x66, 0x5F}, //ATT_RSSI1 tune up
|
||||
{0x67, 0x8F}, //ATT_RSSI2 tune up
|
||||
{0x68, 0x61}, //RSSI_OFFSET
|
||||
{0x78, 0x03}, //CHF_PMAGAIN
|
||||
{0x22, 0x50}, //CCA1_THRESH
|
||||
{0x4D, 0x13}, //CORR_NVAL moved from 0x14 to 0x13 for 0.5 dB improved Rx Sensitivity
|
||||
{0x39, 0x3D} //ACKDELAY new value targeting a delay of 198us (23 May, 2013, Larry Roshak)
|
||||
};
|
||||
|
||||
|
||||
/* begin of deprecated versions
|
||||
|
||||
==VERSION 1==
|
||||
(version 1 is empty)
|
||||
|
||||
==VERSION 2==
|
||||
overwrites_t const overwrites_indirect[] ={
|
||||
{0x31, 0x02} //clear MISO_HIZ_EN (for single SPI master/slave pair) and SPI_PUL_EN (minimize HIB currents)
|
||||
};
|
||||
|
||||
==VERSION 3==
|
||||
overwrites_t const overwrites_indirect[] ={
|
||||
{0x31, 0x02}, //clear MISO_HIZ_EN (for single SPI master/slave pair) and SPI_PUL_EN (minimize HIB currents)
|
||||
{0x91, 0xB3}, //VCO_CTRL1: override VCOALC_REF_TX to 3
|
||||
{0x92, 0x07} //VCO_CTRL2: override VCOALC_REF_RX to 3, keep VCO_BUF_BOOST = 1
|
||||
};
|
||||
|
||||
==VERSION 4==
|
||||
overwrites_t const overwrites_direct[] ={
|
||||
{0x3B, 0x04} //version 04 is the current version: update PA_COILTUNING default
|
||||
};
|
||||
|
||||
overwrites_t const overwrites_indirect[] ={
|
||||
{0x31, 0x02}, //clear MISO_HIZ_EN (for single SPI master/slave pair) and SPI_PUL_EN (minimize HIB currents)
|
||||
{0x91, 0xB3}, //VCO_CTRL1: override VCOALC_REF_TX to 3
|
||||
{0x92, 0x07} //VCO_CTRL2: override VCOALC_REF_RX to 3, keep VCO_BUF_BOOST = 1
|
||||
{0x8A, 0x71} //PA_TUNING: override PA_COILTUNING to 001 (27 Nov 2012, D. Brown, on behalf of S. Eid)
|
||||
};
|
||||
|
||||
==VERSION 5==
|
||||
overwrites_t const overwrites_direct[] ={
|
||||
{0x3B, 0x05} //version 05: updates Channel Filter Register set (21 Dec 2012, on behalf of S. Soca)
|
||||
};
|
||||
|
||||
overwrites_t const overwrites_indirect[] ={
|
||||
{0x31, 0x02}, //clear MISO_HIZ_EN (for single SPI master/slave pair) and SPI_PUL_EN (minimize HIB currents)
|
||||
{0x91, 0xB3}, //VCO_CTRL1 override VCOALC_REF_TX to 3
|
||||
{0x92, 0x07} //VCO_CTRL2 override VCOALC_REF_RX to 3, keep VCO_BUF_BOOST = 1
|
||||
{0x8A, 0x71} //PA_TUNING override PA_COILTUNING to 001 (27 Nov 2012, D. Brown, on behalf of S. Eid)
|
||||
{0x79, 0x2F} //CHF_IBUF Adjust the gm-C filter gain (+/- 6dB) (21 Dec, 2012, on behalf of S. Soca)
|
||||
{0x7A, 0x2F} //CHF_QBUF Adjust the gm-C filter gain (+/- 6dB) (21 Dec, 2012, on behalf of S. Soca)
|
||||
{0x7B, 0x24} //CHF_IRIN Adjust the filter bandwidth (+/- 0.5MHz) (21 Dec, 2012, on behalf of S. Soca)
|
||||
{0x7C, 0x24} //CHF_QRIN Adjust the filter bandwidth (+/- 0.5MHz) (21 Dec, 2012, on behalf of S. Soca)
|
||||
{0x7D, 0x24} //CHF_IL Adjust the filter bandwidth (+/- 0.5MHz) (21 Dec, 2012, on behalf of S. Soca)
|
||||
{0x7E, 0x24} //CHF_QL Adjust the filter bandwidth (+/- 0.5MHz) (21 Dec, 2012, on behalf of S. Soca)
|
||||
{0x82, 0x24} //CHF_IROUT Adjust the filter bandwidth (+/- 0.5MHz) (21 Dec, 2012, on behalf of S. Soca)
|
||||
{0x83, 0x24} //CHF_QROUT Adjust the filter bandwidth (+/- 0.5MHz) (21 Dec, 2012, on behalf of S. Soca)
|
||||
{0x7F, 0x32} //CHF_CC1 Adjust the filter center frequency (+/- 1MHz) (21 Dec, 2012, on behalf of S. Soca)
|
||||
{0x80, 0x1D} //CHF_CCL Adjust the filter center frequency (+/- 1MHz) (21 Dec, 2012, on behalf of S. Soca)
|
||||
{0x81, 0x2D} //CHF_CC2 Adjust the filter center frequency (+/- 1MHz) (21 Dec, 2012, on behalf of S. Soca)
|
||||
};
|
||||
|
||||
==VERSION 6==
|
||||
overwrites_t const overwrites_direct[] ={
|
||||
{0x3B, 0x06} //version 06: disable PA calibration
|
||||
};
|
||||
|
||||
overwrites_t const overwrites_indirect[] ={
|
||||
{0x31, 0x02}, //clear MISO_HIZ_EN (for single SPI master/slave pair) and SPI_PUL_EN (minimize HIB currents)
|
||||
{0x91, 0xB3}, //VCO_CTRL1 override VCOALC_REF_TX to 3
|
||||
{0x92, 0x07} //VCO_CTRL2 override VCOALC_REF_RX to 3, keep VCO_BUF_BOOST = 1
|
||||
{0x8A, 0x71} //PA_TUNING override PA_COILTUNING to 001 (27 Nov 2012, D. Brown, on behalf of S. Eid)
|
||||
{0x79, 0x2F} //CHF_IBUF Adjust the gm-C filter gain (+/- 6dB) (21 Dec, 2012, on behalf of S. Soca)
|
||||
{0x7A, 0x2F} //CHF_QBUF Adjust the gm-C filter gain (+/- 6dB) (21 Dec, 2012, on behalf of S. Soca)
|
||||
{0x7B, 0x24} //CHF_IRIN Adjust the filter bandwidth (+/- 0.5MHz) (21 Dec, 2012, on behalf of S. Soca)
|
||||
{0x7C, 0x24} //CHF_QRIN Adjust the filter bandwidth (+/- 0.5MHz) (21 Dec, 2012, on behalf of S. Soca)
|
||||
{0x7D, 0x24} //CHF_IL Adjust the filter bandwidth (+/- 0.5MHz) (21 Dec, 2012, on behalf of S. Soca)
|
||||
{0x7E, 0x24} //CHF_QL Adjust the filter bandwidth (+/- 0.5MHz) (21 Dec, 2012, on behalf of S. Soca)
|
||||
{0x82, 0x24} //CHF_IROUT Adjust the filter bandwidth (+/- 0.5MHz) (21 Dec, 2012, on behalf of S. Soca)
|
||||
{0x83, 0x24} //CHF_QROUT Adjust the filter bandwidth (+/- 0.5MHz) (21 Dec, 2012, on behalf of S. Soca)
|
||||
{0x7F, 0x32} //CHF_CC1 Adjust the filter center frequency (+/- 1MHz) (21 Dec, 2012, on behalf of S. Soca)
|
||||
{0x80, 0x1D} //CHF_CCL Adjust the filter center frequency (+/- 1MHz) (21 Dec, 2012, on behalf of S. Soca)
|
||||
{0x81, 0x2D} //CHF_CC2 Adjust the filter center frequency (+/- 1MHz) (21 Dec, 2012, on behalf of S. Soca)
|
||||
{0x64, 0x28} //PA_CAL_DIS=1 Disabled PA calibration
|
||||
};
|
||||
|
||||
==VERSION 7==
|
||||
overwrites_t const overwrites_direct[] ={
|
||||
{0x3B, 0x07} //version 07: updated registers for ED/RSSI
|
||||
};
|
||||
|
||||
overwrites_t const overwrites_indirect[] ={
|
||||
{0x31, 0x02}, //clear MISO_HIZ_EN (for single SPI master/slave pair) and SPI_PUL_EN (minimize HIB currents)
|
||||
{0x91, 0xB3}, //VCO_CTRL1 override VCOALC_REF_TX to 3
|
||||
{0x92, 0x07}, //VCO_CTRL2 override VCOALC_REF_RX to 3, keep VCO_BUF_BOOST = 1
|
||||
{0x8A, 0x71}, //PA_TUNING override PA_COILTUNING to 001 (27 Nov 2012, D. Brown, on behalf of S. Eid)
|
||||
{0x79, 0x2F}, //CHF_IBUF Adjust the gm-C filter gain (+/- 6dB) (21 Dec, 2012, on behalf of S. Soca)
|
||||
{0x7A, 0x2F}, //CHF_QBUF Adjust the gm-C filter gain (+/- 6dB) (21 Dec, 2012, on behalf of S. Soca)
|
||||
{0x7B, 0x24}, //CHF_IRIN Adjust the filter bandwidth (+/- 0.5MHz) (21 Dec, 2012, on behalf of S. Soca)
|
||||
{0x7C, 0x24}, //CHF_QRIN Adjust the filter bandwidth (+/- 0.5MHz) (21 Dec, 2012, on behalf of S. Soca)
|
||||
{0x7D, 0x24}, //CHF_IL Adjust the filter bandwidth (+/- 0.5MHz) (21 Dec, 2012, on behalf of S. Soca)
|
||||
{0x7E, 0x24}, //CHF_QL Adjust the filter bandwidth (+/- 0.5MHz) (21 Dec, 2012, on behalf of S. Soca)
|
||||
{0x82, 0x24}, //CHF_IROUT Adjust the filter bandwidth (+/- 0.5MHz) (21 Dec, 2012, on behalf of S. Soca)
|
||||
{0x83, 0x24}, //CHF_QROUT Adjust the filter bandwidth (+/- 0.5MHz) (21 Dec, 2012, on behalf of S. Soca)
|
||||
{0x7F, 0x32}, //CHF_CC1 Adjust the filter center frequency (+/- 1MHz) (21 Dec, 2012, on behalf of S. Soca)
|
||||
{0x80, 0x1D}, //CHF_CCL Adjust the filter center frequency (+/- 1MHz) (21 Dec, 2012, on behalf of S. Soca)
|
||||
{0x81, 0x2D}, //CHF_CC2 Adjust the filter center frequency (+/- 1MHz) (21 Dec, 2012, on behalf of S. Soca)
|
||||
{0x64, 0x28}, //PA_CAL_DIS=1 Disabled PA calibration
|
||||
{0x52, 0x73}, //AGC_THR1 RSSI tune up
|
||||
{0x53, 0x2D}, //AGC_THR2 RSSI tune up
|
||||
{0x66, 0x5F}, //ATT_RSSI1 tune up
|
||||
{0x67, 0x8F}, //ATT_RSSI2 tune up
|
||||
{0x68, 0x60}, //RSSI_OFFSET
|
||||
{0x69, 0x65} //RSSI_SLOPE
|
||||
};
|
||||
|
||||
|
||||
==VERSION 8==
|
||||
overwrites_t const overwrites_direct[] ={
|
||||
{0x3B, 0x08} //version 08: updated registers for ED/RSSI
|
||||
};
|
||||
|
||||
overwrites_t const overwrites_indirect[] ={
|
||||
{0x31, 0x02}, //clear MISO_HIZ_EN (for single SPI master/slave pair) and SPI_PUL_EN (minimize HIB currents)
|
||||
{0x91, 0xB3}, //VCO_CTRL1 override VCOALC_REF_TX to 3
|
||||
{0x92, 0x07}, //VCO_CTRL2 override VCOALC_REF_RX to 3, keep VCO_BUF_BOOST = 1
|
||||
{0x8A, 0x71}, //PA_TUNING override PA_COILTUNING to 001 (27 Nov 2012, D. Brown, on behalf of S. Eid)
|
||||
{0x79, 0x2F}, //CHF_IBUF Adjust the gm-C filter gain (+/- 6dB) (21 Dec, 2012, on behalf of S. Soca)
|
||||
{0x7A, 0x2F}, //CHF_QBUF Adjust the gm-C filter gain (+/- 6dB) (21 Dec, 2012, on behalf of S. Soca)
|
||||
{0x7B, 0x24}, //CHF_IRIN Adjust the filter bandwidth (+/- 0.5MHz) (21 Dec, 2012, on behalf of S. Soca)
|
||||
{0x7C, 0x24}, //CHF_QRIN Adjust the filter bandwidth (+/- 0.5MHz) (21 Dec, 2012, on behalf of S. Soca)
|
||||
{0x7D, 0x24}, //CHF_IL Adjust the filter bandwidth (+/- 0.5MHz) (21 Dec, 2012, on behalf of S. Soca)
|
||||
{0x7E, 0x24}, //CHF_QL Adjust the filter bandwidth (+/- 0.5MHz) (21 Dec, 2012, on behalf of S. Soca)
|
||||
{0x82, 0x24}, //CHF_IROUT Adjust the filter bandwidth (+/- 0.5MHz) (21 Dec, 2012, on behalf of S. Soca)
|
||||
{0x83, 0x24}, //CHF_QROUT Adjust the filter bandwidth (+/- 0.5MHz) (21 Dec, 2012, on behalf of S. Soca)
|
||||
{0x7F, 0x32}, //CHF_CC1 Adjust the filter center frequency (+/- 1MHz) (21 Dec, 2012, on behalf of S. Soca)
|
||||
{0x80, 0x1D}, //CHF_CCL Adjust the filter center frequency (+/- 1MHz) (21 Dec, 2012, on behalf of S. Soca)
|
||||
{0x81, 0x2D}, //CHF_CC2 Adjust the filter center frequency (+/- 1MHz) (21 Dec, 2012, on behalf of S. Soca)
|
||||
{0x64, 0x28}, //PA_CAL_DIS=1 Disabled PA calibration
|
||||
{0x52, 0x73}, //AGC_THR1 RSSI tune up
|
||||
{0x53, 0x2D}, //AGC_THR2 RSSI tune up
|
||||
{0x66, 0x5F}, //ATT_RSSI1 tune up
|
||||
{0x67, 0x8F}, //ATT_RSSI2 tune up
|
||||
{0x69, 0x65} //RSSI_SLOPE
|
||||
{0x68, 0x61}, //RSSI_OFFSET
|
||||
{0x78, 0x03} //CHF_PMAGAIN
|
||||
};
|
||||
|
||||
|
||||
==VERSION 9==
|
||||
overwrites_t const overwrites_direct[] ={
|
||||
{0x3B, 0x09} //version 09: updated registers for ED/RSSI and PowerStep
|
||||
{0x23, 0x17} //PA_PWR new default value
|
||||
};
|
||||
|
||||
overwrites_t const overwrites_indirect[] ={
|
||||
{0x31, 0x02}, //clear MISO_HIZ_EN (for single SPI master/slave pair) and SPI_PUL_EN (minimize HIB currents)
|
||||
{0x91, 0xB3}, //VCO_CTRL1 override VCOALC_REF_TX to 3
|
||||
{0x92, 0x07}, //VCO_CTRL2 override VCOALC_REF_RX to 3, keep VCO_BUF_BOOST = 1
|
||||
{0x8A, 0x71}, //PA_TUNING override PA_COILTUNING to 001 (27 Nov 2012, D. Brown, on behalf of S. Eid)
|
||||
{0x79, 0x2F}, //CHF_IBUF Adjust the gm-C filter gain (+/- 6dB) (21 Dec, 2012, on behalf of S. Soca)
|
||||
{0x7A, 0x2F}, //CHF_QBUF Adjust the gm-C filter gain (+/- 6dB) (21 Dec, 2012, on behalf of S. Soca)
|
||||
{0x7B, 0x24}, //CHF_IRIN Adjust the filter bandwidth (+/- 0.5MHz) (21 Dec, 2012, on behalf of S. Soca)
|
||||
{0x7C, 0x24}, //CHF_QRIN Adjust the filter bandwidth (+/- 0.5MHz) (21 Dec, 2012, on behalf of S. Soca)
|
||||
{0x7D, 0x24}, //CHF_IL Adjust the filter bandwidth (+/- 0.5MHz) (21 Dec, 2012, on behalf of S. Soca)
|
||||
{0x7E, 0x24}, //CHF_QL Adjust the filter bandwidth (+/- 0.5MHz) (21 Dec, 2012, on behalf of S. Soca)
|
||||
{0x7F, 0x32}, //CHF_CC1 Adjust the filter center frequency (+/- 1MHz) (21 Dec, 2012, on behalf of S. Soca)
|
||||
{0x80, 0x1D}, //CHF_CCL Adjust the filter center frequency (+/- 1MHz) (21 Dec, 2012, on behalf of S. Soca)
|
||||
{0x81, 0x2D}, //CHF_CC2 Adjust the filter center frequency (+/- 1MHz) (21 Dec, 2012, on behalf of S. Soca)
|
||||
{0x82, 0x24}, //CHF_IROUT Adjust the filter bandwidth (+/- 0.5MHz) (21 Dec, 2012, on behalf of S. Soca)
|
||||
{0x83, 0x24}, //CHF_QROUT Adjust the filter bandwidth (+/- 0.5MHz) (21 Dec, 2012, on behalf of S. Soca)
|
||||
{0x64, 0x28}, //PA_CAL_DIS=1 Disabled PA calibration
|
||||
{0x52, 0x55}, //AGC_THR1 RSSI tune up
|
||||
{0x53, 0x2D}, //AGC_THR2 RSSI tune up
|
||||
{0x66, 0x5F}, //ATT_RSSI1 tune up
|
||||
{0x67, 0x8F}, //ATT_RSSI2 tune up
|
||||
{0x68, 0x61}, //RSSI_OFFSET
|
||||
{0x78, 0x03} //CHF_PMAGAIN
|
||||
};
|
||||
|
||||
==VERSION A==
|
||||
overwrites_t const overwrites_direct[] ={
|
||||
{0x3B, 0x0A} //version 0A: updated registers for CCA
|
||||
{0x23, 0x17} //PA_PWR new default Power Step is "23"
|
||||
};
|
||||
|
||||
overwrites_t const overwrites_indirect[] ={
|
||||
{0x31, 0x02}, //clear MISO_HIZ_EN (for single SPI master/slave pair) and SPI_PUL_EN (minimize HIB currents)
|
||||
{0x91, 0xB3}, //VCO_CTRL1 override VCOALC_REF_TX to 3
|
||||
{0x92, 0x07}, //VCO_CTRL2 override VCOALC_REF_RX to 3, keep VCO_BUF_BOOST = 1
|
||||
{0x8A, 0x71}, //PA_TUNING override PA_COILTUNING to 001 (27 Nov 2012, D. Brown, on behalf of S. Eid)
|
||||
{0x79, 0x2F}, //CHF_IBUF Adjust the gm-C filter gain (+/- 6dB) (21 Dec, 2012, on behalf of S. Soca)
|
||||
{0x7A, 0x2F}, //CHF_QBUF Adjust the gm-C filter gain (+/- 6dB) (21 Dec, 2012, on behalf of S. Soca)
|
||||
{0x7B, 0x24}, //CHF_IRIN Adjust the filter bandwidth (+/- 0.5MHz) (21 Dec, 2012, on behalf of S. Soca)
|
||||
{0x7C, 0x24}, //CHF_QRIN Adjust the filter bandwidth (+/- 0.5MHz) (21 Dec, 2012, on behalf of S. Soca)
|
||||
{0x7D, 0x24}, //CHF_IL Adjust the filter bandwidth (+/- 0.5MHz) (21 Dec, 2012, on behalf of S. Soca)
|
||||
{0x7E, 0x24}, //CHF_QL Adjust the filter bandwidth (+/- 0.5MHz) (21 Dec, 2012, on behalf of S. Soca)
|
||||
{0x7F, 0x32}, //CHF_CC1 Adjust the filter center frequency (+/- 1MHz) (21 Dec, 2012, on behalf of S. Soca)
|
||||
{0x80, 0x1D}, //CHF_CCL Adjust the filter center frequency (+/- 1MHz) (21 Dec, 2012, on behalf of S. Soca)
|
||||
{0x81, 0x2D}, //CHF_CC2 Adjust the filter center frequency (+/- 1MHz) (21 Dec, 2012, on behalf of S. Soca)
|
||||
{0x82, 0x24}, //CHF_IROUT Adjust the filter bandwidth (+/- 0.5MHz) (21 Dec, 2012, on behalf of S. Soca)
|
||||
{0x83, 0x24}, //CHF_QROUT Adjust the filter bandwidth (+/- 0.5MHz) (21 Dec, 2012, on behalf of S. Soca)
|
||||
{0x64, 0x28}, //PA_CAL_DIS=1 Disabled PA calibration
|
||||
{0x52, 0x55}, //AGC_THR1 RSSI tune up
|
||||
{0x53, 0x2D}, //AGC_THR2 RSSI tune up
|
||||
{0x66, 0x5F}, //ATT_RSSI1 tune up
|
||||
{0x67, 0x8F}, //ATT_RSSI2 tune up
|
||||
{0x68, 0x61}, //RSSI_OFFSET
|
||||
{0x78, 0x03} //CHF_PMAGAIN
|
||||
{0x22, 0x50} //CCA1_THRESH
|
||||
};
|
||||
|
||||
end of deprecated versions */
|
||||
|
||||
|
||||
#endif //OVERWRITES_H_
|
||||
|
|
@ -0,0 +1,731 @@
|
|||
/*!
|
||||
* Copyright (c) 2015, Freescale Semiconductor, Inc.
|
||||
* All rights reserved.
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*
|
||||
* \file MCR20reg.h
|
||||
* MCR20 Registers
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* o Redistributions of source code must retain the above copyright notice, this list
|
||||
* of conditions and the following disclaimer.
|
||||
*
|
||||
* o 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.
|
||||
*
|
||||
* o Neither the name of Freescale Semiconductor, Inc. nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from this
|
||||
* software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS 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.
|
||||
*/
|
||||
|
||||
#ifndef __MCR20_REG_H__
|
||||
#define __MCR20_REG_H__
|
||||
/*****************************************************************************
|
||||
* INCLUDED HEADERS *
|
||||
*---------------------------------------------------------------------------*
|
||||
* Add to this section all the headers that this module needs to include. *
|
||||
* Note that it is not a good practice to include header files into header *
|
||||
* files, so use this section only if there is no other better solution. *
|
||||
*---------------------------------------------------------------------------*
|
||||
*****************************************************************************/
|
||||
|
||||
/****************************************************************************/
|
||||
/* Transceiver SPI Registers */
|
||||
/****************************************************************************/
|
||||
|
||||
#define TransceiverSPI_IARIndexReg (0x3E)
|
||||
|
||||
#define TransceiverSPI_ReadSelect (1<<7)
|
||||
#define TransceiverSPI_WriteSelect (0<<7)
|
||||
#define TransceiverSPI_RegisterAccessSelect (0<<6)
|
||||
#define TransceiverSPI_PacketBuffAccessSelect (1<<6)
|
||||
#define TransceiverSPI_PacketBuffBurstModeSelect (0<<5)
|
||||
#define TransceiverSPI_PacketBuffByteModeSelect (1<<5)
|
||||
|
||||
#define TransceiverSPI_DirectRegisterAddressMask (0x3F)
|
||||
|
||||
#define IRQSTS1 0x00
|
||||
#define IRQSTS2 0x01
|
||||
#define IRQSTS3 0x02
|
||||
#define PHY_CTRL1 0x03
|
||||
#define PHY_CTRL2 0x04
|
||||
#define PHY_CTRL3 0x05
|
||||
#define RX_FRM_LEN 0x06
|
||||
#define PHY_CTRL4 0x07
|
||||
#define SRC_CTRL 0x08
|
||||
#define SRC_ADDRS_SUM_LSB 0x09
|
||||
#define SRC_ADDRS_SUM_MSB 0x0A
|
||||
#define CCA1_ED_FNL 0x0B
|
||||
#define EVENT_TMR_LSB 0x0C
|
||||
#define EVENT_TMR_MSB 0x0D
|
||||
#define EVENT_TMR_USB 0x0E
|
||||
#define TIMESTAMP_LSB 0x0F
|
||||
#define TIMESTAMP_MSB 0x10
|
||||
#define TIMESTAMP_USB 0x11
|
||||
#define T3CMP_LSB 0x12
|
||||
#define T3CMP_MSB 0x13
|
||||
#define T3CMP_USB 0x14
|
||||
#define T2PRIMECMP_LSB 0x15
|
||||
#define T2PRIMECMP_MSB 0x16
|
||||
#define T1CMP_LSB 0x17
|
||||
#define T1CMP_MSB 0x18
|
||||
#define T1CMP_USB 0x19
|
||||
#define T2CMP_LSB 0x1A
|
||||
#define T2CMP_MSB 0x1B
|
||||
#define T2CMP_USB 0x1C
|
||||
#define T4CMP_LSB 0x1D
|
||||
#define T4CMP_MSB 0x1E
|
||||
#define T4CMP_USB 0x1F
|
||||
#define PLL_INT0 0x20
|
||||
#define PLL_FRAC0_LSB 0x21
|
||||
#define PLL_FRAC0_MSB 0x22
|
||||
#define PA_PWR 0x23
|
||||
#define SEQ_STATE 0x24
|
||||
#define LQI_VALUE 0x25
|
||||
#define RSSI_CCA_CONT 0x26
|
||||
//-------------- 0x27
|
||||
#define ASM_CTRL1 0x28
|
||||
#define ASM_CTRL2 0x29
|
||||
#define ASM_DATA_0 0x2A
|
||||
#define ASM_DATA_1 0x2B
|
||||
#define ASM_DATA_2 0x2C
|
||||
#define ASM_DATA_3 0x2D
|
||||
#define ASM_DATA_4 0x2E
|
||||
#define ASM_DATA_5 0x2F
|
||||
#define ASM_DATA_6 0x30
|
||||
#define ASM_DATA_7 0x31
|
||||
#define ASM_DATA_8 0x32
|
||||
#define ASM_DATA_9 0x33
|
||||
#define ASM_DATA_A 0x34
|
||||
#define ASM_DATA_B 0x35
|
||||
#define ASM_DATA_C 0x36
|
||||
#define ASM_DATA_D 0x37
|
||||
#define ASM_DATA_E 0x38
|
||||
#define ASM_DATA_F 0x39
|
||||
//------------------- 0x3A
|
||||
#define OVERWRITE_VER 0x3B
|
||||
#define CLK_OUT_CTRL 0x3C
|
||||
#define PWR_MODES 0x3D
|
||||
#define IAR_INDEX 0x3E
|
||||
#define IAR_DATA 0x3F
|
||||
|
||||
|
||||
#define PART_ID 0x00
|
||||
#define XTAL_TRIM 0x01
|
||||
#define PMC_LP_TRIM 0x02
|
||||
#define MACPANID0_LSB 0x03
|
||||
#define MACPANID0_MSB 0x04
|
||||
#define MACSHORTADDRS0_LSB 0x05
|
||||
#define MACSHORTADDRS0_MSB 0x06
|
||||
#define MACLONGADDRS0_0 0x07
|
||||
#define MACLONGADDRS0_8 0x08
|
||||
#define MACLONGADDRS0_16 0x09
|
||||
#define MACLONGADDRS0_24 0x0A
|
||||
#define MACLONGADDRS0_32 0x0B
|
||||
#define MACLONGADDRS0_40 0x0C
|
||||
#define MACLONGADDRS0_48 0x0D
|
||||
#define MACLONGADDRS0_56 0x0E
|
||||
#define RX_FRAME_FILTER 0x0F
|
||||
#define PLL_INT1 0x10
|
||||
#define PLL_FRAC1_LSB 0x11
|
||||
#define PLL_FRAC1_MSB 0x12
|
||||
#define MACPANID1_LSB 0x13
|
||||
#define MACPANID1_MSB 0x14
|
||||
#define MACSHORTADDRS1_LSB 0x15
|
||||
#define MACSHORTADDRS1_MSB 0x16
|
||||
#define MACLONGADDRS1_0 0x17
|
||||
#define MACLONGADDRS1_8 0x18
|
||||
#define MACLONGADDRS1_16 0x19
|
||||
#define MACLONGADDRS1_24 0x1A
|
||||
#define MACLONGADDRS1_32 0x1B
|
||||
#define MACLONGADDRS1_40 0x1C
|
||||
#define MACLONGADDRS1_48 0x1D
|
||||
#define MACLONGADDRS1_56 0x1E
|
||||
#define DUAL_PAN_CTRL 0x1F
|
||||
#define DUAL_PAN_DWELL 0x20
|
||||
#define DUAL_PAN_STS 0x21
|
||||
#define CCA1_THRESH 0x22
|
||||
#define CCA1_ED_OFFSET_COMP 0x23
|
||||
#define LQI_OFFSET_COMP 0x24
|
||||
#define CCA_CTRL 0x25
|
||||
#define CCA2_CORR_PEAKS 0x26
|
||||
#define CCA2_CORR_THRESH 0x27
|
||||
#define TMR_PRESCALE 0x28
|
||||
//---------------- 0x29
|
||||
#define GPIO_DATA 0x2A
|
||||
#define GPIO_DIR 0x2B
|
||||
#define GPIO_PUL_EN 0x2C
|
||||
#define GPIO_PUL_SEL 0x2D
|
||||
#define GPIO_DS 0x2E
|
||||
//-------------- 0x2F
|
||||
#define ANT_PAD_CTRL 0x30
|
||||
#define MISC_PAD_CTRL 0x31
|
||||
#define BSM_CTRL 0x32
|
||||
//--------------- 0x33
|
||||
#define _RNG 0x34
|
||||
#define RX_BYTE_COUNT 0x35
|
||||
#define RX_WTR_MARK 0x36
|
||||
#define SOFT_RESET 0x37
|
||||
#define TXDELAY 0x38
|
||||
#define ACKDELAY 0x39
|
||||
#define SEQ_MGR_CTRL 0x3A
|
||||
#define SEQ_MGR_STS 0x3B
|
||||
#define SEQ_T_STS 0x3C
|
||||
#define ABORT_STS 0x3D
|
||||
#define CCCA_BUSY_CNT 0x3E
|
||||
#define SRC_ADDR_CHECKSUM1 0x3F
|
||||
#define SRC_ADDR_CHECKSUM2 0x40
|
||||
#define SRC_TBL_VALID1 0x41
|
||||
#define SRC_TBL_VALID2 0x42
|
||||
#define FILTERFAIL_CODE1 0x43
|
||||
#define FILTERFAIL_CODE2 0x44
|
||||
#define SLOT_PRELOAD 0x45
|
||||
//---------------- 0x46
|
||||
#define CORR_VT 0x47
|
||||
#define SYNC_CTRL 0x48
|
||||
#define PN_LSB_0 0x49
|
||||
#define PN_LSB_1 0x4A
|
||||
#define PN_MSB_0 0x4B
|
||||
#define PN_MSB_1 0x4C
|
||||
#define CORR_NVAL 0x4D
|
||||
#define TX_MODE_CTRL 0x4E
|
||||
#define SNF_THR 0x4F
|
||||
#define FAD_THR 0x50
|
||||
#define ANT_AGC_CTRL 0x51
|
||||
#define AGC_THR1 0x52
|
||||
#define AGC_THR2 0x53
|
||||
#define AGC_HYS 0x54
|
||||
#define AFC 0x55
|
||||
//--------------- 0x56
|
||||
//--------------- 0x57
|
||||
#define PHY_STS 0x58
|
||||
#define RX_MAX_CORR 0x59
|
||||
#define RX_MAX_PREAMBLE 0x5A
|
||||
#define RSSI 0x5B
|
||||
//--------------- 0x5C
|
||||
//--------------- 0x5D
|
||||
#define PLL_DIG_CTRL 0x5E
|
||||
#define VCO_CAL 0x5F
|
||||
#define VCO_BEST_DIFF 0x60
|
||||
#define VCO_BIAS 0x61
|
||||
#define KMOD_CTRL 0x62
|
||||
#define KMOD_CAL 0x63
|
||||
#define PA_CAL 0x64
|
||||
#define PA_PWRCAL 0x65
|
||||
#define ATT_RSSI1 0x66
|
||||
#define ATT_RSSI2 0x67
|
||||
#define RSSI_OFFSET 0x68
|
||||
#define RSSI_SLOPE 0x69
|
||||
#define RSSI_CAL1 0x6A
|
||||
#define RSSI_CAL2 0x6B
|
||||
//--------------- 0x6C
|
||||
//--------------- 0x6D
|
||||
#define XTAL_CTRL 0x6E
|
||||
#define XTAL_COMP_MIN 0x6F
|
||||
#define XTAL_COMP_MAX 0x70
|
||||
#define XTAL_GM 0x71
|
||||
//--------------- 0x72
|
||||
//--------------- 0x73
|
||||
#define LNA_TUNE 0x74
|
||||
#define LNA_AGCGAIN 0x75
|
||||
//--------------- 0x76
|
||||
//--------------- 0x77
|
||||
#define CHF_PMA_GAIN 0x78
|
||||
#define CHF_IBUF 0x79
|
||||
#define CHF_QBUF 0x7A
|
||||
#define CHF_IRIN 0x7B
|
||||
#define CHF_QRIN 0x7C
|
||||
#define CHF_IL 0x7D
|
||||
#define CHF_QL 0x7E
|
||||
#define CHF_CC1 0x7F
|
||||
#define CHF_CCL 0x80
|
||||
#define CHF_CC2 0x81
|
||||
#define CHF_IROUT 0x82
|
||||
#define CHF_QROUT 0x83
|
||||
//--------------- 0x84
|
||||
//--------------- 0x85
|
||||
#define RSSI_CTRL 0x86
|
||||
//--------------- 0x87
|
||||
//--------------- 0x88
|
||||
#define PA_BIAS 0x89
|
||||
#define PA_TUNING 0x8A
|
||||
//--------------- 0x8B
|
||||
//--------------- 0x8C
|
||||
#define PMC_HP_TRIM 0x8D
|
||||
#define VREGA_TRIM 0x8E
|
||||
//--------------- 0x8F
|
||||
//--------------- 0x90
|
||||
#define VCO_CTRL1 0x91
|
||||
#define VCO_CTRL2 0x92
|
||||
//--------------- 0x93
|
||||
//--------------- 0x94
|
||||
#define ANA_SPARE_OUT1 0x95
|
||||
#define ANA_SPARE_OUT2 0x96
|
||||
#define ANA_SPARE_IN 0x97
|
||||
#define MISCELLANEOUS 0x98
|
||||
//--------------- 0x99
|
||||
#define SEQ_MGR_OVRD0 0x9A
|
||||
#define SEQ_MGR_OVRD1 0x9B
|
||||
#define SEQ_MGR_OVRD2 0x9C
|
||||
#define SEQ_MGR_OVRD3 0x9D
|
||||
#define SEQ_MGR_OVRD4 0x9E
|
||||
#define SEQ_MGR_OVRD5 0x9F
|
||||
#define SEQ_MGR_OVRD6 0xA0
|
||||
#define SEQ_MGR_OVRD7 0xA1
|
||||
//--------------- 0xA2
|
||||
#define TESTMODE_CTRL 0xA3
|
||||
#define DTM_CTRL1 0xA4
|
||||
#define DTM_CTRL2 0xA5
|
||||
#define ATM_CTRL1 0xA6
|
||||
#define ATM_CTRL2 0xA7
|
||||
#define ATM_CTRL3 0xA8
|
||||
//--------------- 0xA9
|
||||
#define LIM_FE_TEST_CTRL 0xAA
|
||||
#define CHF_TEST_CTRL 0xAB
|
||||
#define VCO_TEST_CTRL 0xAC
|
||||
#define PLL_TEST_CTRL 0xAD
|
||||
#define PA_TEST_CTRL 0xAE
|
||||
#define PMC_TEST_CTRL 0xAF
|
||||
#define SCAN_DTM_PROTECT_1 0xFE
|
||||
#define SCAN_DTM_PROTECT_0 0xFF
|
||||
|
||||
// IRQSTS1 bits
|
||||
#define cIRQSTS1_RX_FRM_PEND (1<<7)
|
||||
#define cIRQSTS1_PLL_UNLOCK_IRQ (1<<6)
|
||||
#define cIRQSTS1_FILTERFAIL_IRQ (1<<5)
|
||||
#define cIRQSTS1_RXWTRMRKIRQ (1<<4)
|
||||
#define cIRQSTS1_CCAIRQ (1<<3)
|
||||
#define cIRQSTS1_RXIRQ (1<<2)
|
||||
#define cIRQSTS1_TXIRQ (1<<1)
|
||||
#define cIRQSTS1_SEQIRQ (1<<0)
|
||||
|
||||
typedef union regIRQSTS1_tag {
|
||||
uint8_t byte;
|
||||
struct {
|
||||
uint8_t SEQIRQ: 1;
|
||||
uint8_t TXIRQ: 1;
|
||||
uint8_t RXIRQ: 1;
|
||||
uint8_t CCAIRQ: 1;
|
||||
uint8_t RXWTRMRKIRQ: 1;
|
||||
uint8_t FILTERFAIL_IRQ: 1;
|
||||
uint8_t PLL_UNLOCK_IRQ: 1;
|
||||
uint8_t RX_FRM_PEND: 1;
|
||||
} bit;
|
||||
} regIRQSTS1_t;
|
||||
|
||||
// IRQSTS2 bits
|
||||
#define cIRQSTS2_CRCVALID (1<<7)
|
||||
#define cIRQSTS2_CCA (1<<6)
|
||||
#define cIRQSTS2_SRCADDR (1<<5)
|
||||
#define cIRQSTS2_PI (1<<4)
|
||||
#define cIRQSTS2_TMRSTATUS (1<<3)
|
||||
#define cIRQSTS2_ASM_IRQ (1<<2)
|
||||
#define cIRQSTS2_PB_ERR_IRQ (1<<1)
|
||||
#define cIRQSTS2_WAKE_IRQ (1<<0)
|
||||
|
||||
typedef union regIRQSTS2_tag {
|
||||
uint8_t byte;
|
||||
struct {
|
||||
uint8_t WAKE_IRQ: 1;
|
||||
uint8_t PB_ERR_IRQ: 1;
|
||||
uint8_t ASM_IRQ: 1;
|
||||
uint8_t TMRSTATUS: 1;
|
||||
uint8_t PI_: 1;
|
||||
uint8_t SRCADDR: 1;
|
||||
uint8_t CCA: 1;
|
||||
uint8_t CRCVALID: 1;
|
||||
} bit;
|
||||
} regIRQSTS2_t;
|
||||
|
||||
// IRQSTS3 bits
|
||||
#define cIRQSTS3_TMR4MSK (1<<7)
|
||||
#define cIRQSTS3_TMR3MSK (1<<6)
|
||||
#define cIRQSTS3_TMR2MSK (1<<5)
|
||||
#define cIRQSTS3_TMR1MSK (1<<4)
|
||||
#define cIRQSTS3_TMR4IRQ (1<<3)
|
||||
#define cIRQSTS3_TMR3IRQ (1<<2)
|
||||
#define cIRQSTS3_TMR2IRQ (1<<1)
|
||||
#define cIRQSTS3_TMR1IRQ (1<<0)
|
||||
|
||||
typedef union regIRQSTS3_tag {
|
||||
uint8_t byte;
|
||||
struct {
|
||||
uint8_t TMR1IRQ: 1;
|
||||
uint8_t TMR2IRQ: 1;
|
||||
uint8_t TMR3IRQ: 1;
|
||||
uint8_t TMR4IRQ: 1;
|
||||
uint8_t TMR1MSK: 1;
|
||||
uint8_t TMR2MSK: 1;
|
||||
uint8_t TMR3MSK: 1;
|
||||
uint8_t TMR4MSK: 1;
|
||||
} bit;
|
||||
} regIRQSTS3_t;
|
||||
|
||||
// PHY_CTRL1 bits
|
||||
#define cPHY_CTRL1_TMRTRIGEN (1<<7)
|
||||
#define cPHY_CTRL1_SLOTTED (1<<6)
|
||||
#define cPHY_CTRL1_CCABFRTX (1<<5)
|
||||
#define cPHY_CTRL1_RXACKRQD (1<<4)
|
||||
#define cPHY_CTRL1_AUTOACK (1<<3)
|
||||
#define cPHY_CTRL1_XCVSEQ (7<<0)
|
||||
|
||||
typedef union regPHY_CTRL1_tag {
|
||||
uint8_t byte;
|
||||
struct {
|
||||
uint8_t XCVSEQ: 3;
|
||||
uint8_t AUTOACK: 1;
|
||||
uint8_t RXACKRQD: 1;
|
||||
uint8_t CCABFRTX: 1;
|
||||
uint8_t SLOTTED: 1;
|
||||
uint8_t TMRTRIGEN: 1;
|
||||
} bit;
|
||||
} regPHY_CTRL1_t;
|
||||
|
||||
// PHY_CTRL2 bits
|
||||
#define cPHY_CTRL2_CRC_MSK (1<<7)
|
||||
#define cPHY_CTRL2_PLL_UNLOCK_MSK (1<<6)
|
||||
#define cPHY_CTRL2_FILTERFAIL_MSK (1<<5)
|
||||
#define cPHY_CTRL2_RX_WMRK_MSK (1<<4)
|
||||
#define cPHY_CTRL2_CCAMSK (1<<3)
|
||||
#define cPHY_CTRL2_RXMSK (1<<2)
|
||||
#define cPHY_CTRL2_TXMSK (1<<1)
|
||||
#define cPHY_CTRL2_SEQMSK (1<<0)
|
||||
|
||||
typedef union regPHY_CTRL2_tag {
|
||||
uint8_t byte;
|
||||
struct {
|
||||
uint8_t SEQMSK: 1;
|
||||
uint8_t TXMSK: 1;
|
||||
uint8_t RXMSK: 1;
|
||||
uint8_t CCAMSK: 1;
|
||||
uint8_t RX_WMRK_MSK: 1;
|
||||
uint8_t FILTERFAIL_MSK: 1;
|
||||
uint8_t PLL_UNLOCK_MSK: 1;
|
||||
uint8_t CRC_MSK: 1;
|
||||
} bit;
|
||||
} regPHY_CTRL2_t;
|
||||
|
||||
// PHY_CTRL3 bits
|
||||
#define cPHY_CTRL3_TMR4CMP_EN (1<<7)
|
||||
#define cPHY_CTRL3_TMR3CMP_EN (1<<6)
|
||||
#define cPHY_CTRL3_TMR2CMP_EN (1<<5)
|
||||
#define cPHY_CTRL3_TMR1CMP_EN (1<<4)
|
||||
#define cPHY_CTRL3_ASM_MSK (1<<2)
|
||||
#define cPHY_CTRL3_PB_ERR_MSK (1<<1)
|
||||
#define cPHY_CTRL3_WAKE_MSK (1<<0)
|
||||
|
||||
typedef union regPHY_CTRL3_tag {
|
||||
uint8_t byte;
|
||||
struct {
|
||||
uint8_t WAKE_MSK: 1;
|
||||
uint8_t PB_ERR_MSK: 1;
|
||||
uint8_t ASM_MSK: 1;
|
||||
uint8_t RESERVED: 1;
|
||||
uint8_t TMR1CMP_EN: 1;
|
||||
uint8_t TMR2CMP_EN: 1;
|
||||
uint8_t TMR3CMP_EN: 1;
|
||||
uint8_t TMR4CMP_EN: 1;
|
||||
} bit;
|
||||
} regPHY_CTRL3_t;
|
||||
|
||||
// RX_FRM_LEN bits
|
||||
#define cRX_FRAME_LENGTH (0x7F)
|
||||
|
||||
// PHY_CTRL4 bits
|
||||
#define cPHY_CTRL4_TRCV_MSK (1<<7)
|
||||
#define cPHY_CTRL4_TC3TMOUT (1<<6)
|
||||
#define cPHY_CTRL4_PANCORDNTR0 (1<<5)
|
||||
#define cPHY_CTRL4_CCATYPE (3<<0)
|
||||
#define cPHY_CTRL4_CCATYPE_Shift_c (3)
|
||||
#define cPHY_CTRL4_TMRLOAD (1<<2)
|
||||
#define cPHY_CTRL4_PROMISCUOUS (1<<1)
|
||||
#define cPHY_CTRL4_TC2PRIME_EN (1<<0)
|
||||
|
||||
typedef union regPHY_CTRL4_tag {
|
||||
uint8_t byte;
|
||||
struct {
|
||||
uint8_t TC2PRIME_EN: 1;
|
||||
uint8_t PROMISCUOUS: 1;
|
||||
uint8_t TMRLOAD: 1;
|
||||
uint8_t CCATYPE: 2;
|
||||
uint8_t PANCORDNTR0: 1;
|
||||
uint8_t TC3TMOUT: 1;
|
||||
uint8_t TRCV_MSK: 1;
|
||||
} bit;
|
||||
} regPHY_CTRL4_t;
|
||||
|
||||
// SRC_CTRL bits
|
||||
#define cSRC_CTRL_INDEX (0x0F)
|
||||
#define cSRC_CTRL_INDEX_Shift_c (4)
|
||||
#define cSRC_CTRL_ACK_FRM_PND (1<<3)
|
||||
#define cSRC_CTRL_SRCADDR_EN (1<<2)
|
||||
#define cSRC_CTRL_INDEX_EN (1<<1)
|
||||
#define cSRC_CTRL_INDEX_DISABLE (1<<0)
|
||||
|
||||
typedef union regSRC_CTRL_tag {
|
||||
uint8_t byte;
|
||||
struct {
|
||||
uint8_t INDEX_DISABLE: 1;
|
||||
uint8_t INDEX_EN: 1;
|
||||
uint8_t SRCADDR_EN: 1;
|
||||
uint8_t ACK_FRM_PND: 1;
|
||||
uint8_t INDEX: 4;
|
||||
} bit;
|
||||
} regSRC_CTRL_t;
|
||||
|
||||
// ASM_CTRL1 bits
|
||||
#define cASM_CTRL1_CLEAR (1<<7)
|
||||
#define cASM_CTRL1_START (1<<6)
|
||||
#define cASM_CTRL1_SELFTST (1<<5)
|
||||
#define cASM_CTRL1_CTR (1<<4)
|
||||
#define cASM_CTRL1_CBC (1<<3)
|
||||
#define cASM_CTRL1_AES (1<<2)
|
||||
#define cASM_CTRL1_LOAD_MAC (1<<1)
|
||||
|
||||
// ASM_CTRL2 bits
|
||||
#define cASM_CTRL2_DATA_REG_TYPE_SEL (7)
|
||||
#define cASM_CTRL2_DATA_REG_TYPE_SEL_Shift_c (5)
|
||||
#define cASM_CTRL2_TSTPAS (1<<1)
|
||||
|
||||
// CLK_OUT_CTRL bits
|
||||
#define cCLK_OUT_CTRL_EXTEND (1<<7)
|
||||
#define cCLK_OUT_CTRL_HIZ (1<<6)
|
||||
#define cCLK_OUT_CTRL_SR (1<<5)
|
||||
#define cCLK_OUT_CTRL_DS (1<<4)
|
||||
#define cCLK_OUT_CTRL_EN (1<<3)
|
||||
#define cCLK_OUT_CTRL_DIV (7)
|
||||
|
||||
// PWR_MODES bits
|
||||
#define cPWR_MODES_XTAL_READY (1<<5)
|
||||
#define cPWR_MODES_XTALEN (1<<4)
|
||||
#define cPWR_MODES_ASM_CLK_EN (1<<3)
|
||||
#define cPWR_MODES_AUTODOZE (1<<1)
|
||||
#define cPWR_MODES_PMC_MODE (1<<0)
|
||||
|
||||
// RX_FRAME_FILTER bits
|
||||
#define cRX_FRAME_FLT_FRM_VER (0xC0)
|
||||
#define cRX_FRAME_FLT_FRM_VER_Shift_c (6)
|
||||
#define cRX_FRAME_FLT_ACTIVE_PROMISCUOUS (1<<5)
|
||||
#define cRX_FRAME_FLT_NS_FT (1<<4)
|
||||
#define cRX_FRAME_FLT_CMD_FT (1<<3)
|
||||
#define cRX_FRAME_FLT_ACK_FT (1<<2)
|
||||
#define cRX_FRAME_FLT_DATA_FT (1<<1)
|
||||
#define cRX_FRAME_FLT_BEACON_FT (1<<0)
|
||||
|
||||
typedef union regRX_FRAME_FILTER_tag {
|
||||
uint8_t byte;
|
||||
struct {
|
||||
uint8_t FRAME_FLT_BEACON_FT: 1;
|
||||
uint8_t FRAME_FLT_DATA_FT: 1;
|
||||
uint8_t FRAME_FLT_ACK_FT: 1;
|
||||
uint8_t FRAME_FLT_CMD_FT: 1;
|
||||
uint8_t FRAME_FLT_NS_FT: 1;
|
||||
uint8_t FRAME_FLT_ACTIVE_PROMISCUOUS: 1;
|
||||
uint8_t FRAME_FLT_FRM_VER: 2;
|
||||
} bit;
|
||||
} regRX_FRAME_FILTER_t;
|
||||
|
||||
// DUAL_PAN_CTRL bits
|
||||
#define cDUAL_PAN_CTRL_DUAL_PAN_SAM_LVL_MSK (0xF0)
|
||||
#define cDUAL_PAN_CTRL_DUAL_PAN_SAM_LVL_Shift_c (4)
|
||||
#define cDUAL_PAN_CTRL_CURRENT_NETWORK (1<<3)
|
||||
#define cDUAL_PAN_CTRL_PANCORDNTR1 (1<<2)
|
||||
#define cDUAL_PAN_CTRL_DUAL_PAN_AUTO (1<<1)
|
||||
#define cDUAL_PAN_CTRL_ACTIVE_NETWORK (1<<0)
|
||||
|
||||
// DUAL_PAN_STS bits
|
||||
#define cDUAL_PAN_STS_RECD_ON_PAN1 (1<<7)
|
||||
#define cDUAL_PAN_STS_RECD_ON_PAN0 (1<<6)
|
||||
#define cDUAL_PAN_STS_DUAL_PAN_REMAIN (0x3F)
|
||||
|
||||
// CCA_CTRL bits
|
||||
#define cCCA_CTRL_AGC_FRZ_EN (1<<6)
|
||||
#define cCCA_CTRL_CONT_RSSI_EN (1<<5)
|
||||
#define cCCA_CTRL_LQI_RSSI_NOT_CORR (1<<4)
|
||||
#define cCCA_CTRL_CCA3_AND_NOT_OR (1<<3)
|
||||
#define cCCA_CTRL_POWER_COMP_EN_LQI (1<<2)
|
||||
#define cCCA_CTRL_POWER_COMP_EN_ED (1<<1)
|
||||
#define cCCA_CTRL_POWER_COMP_EN_CCA1 (1<<0)
|
||||
|
||||
// GPIO_DATA bits
|
||||
#define cGPIO_DATA_7 (1<<7)
|
||||
#define cGPIO_DATA_6 (1<<6)
|
||||
#define cGPIO_DATA_5 (1<<5)
|
||||
#define cGPIO_DATA_4 (1<<4)
|
||||
#define cGPIO_DATA_3 (1<<3)
|
||||
#define cGPIO_DATA_2 (1<<2)
|
||||
#define cGPIO_DATA_1 (1<<1)
|
||||
#define cGPIO_DATA_0 (1<<0)
|
||||
|
||||
// GPIO_DIR bits
|
||||
#define cGPIO_DIR_7 (1<<7)
|
||||
#define cGPIO_DIR_6 (1<<6)
|
||||
#define cGPIO_DIR_5 (1<<5)
|
||||
#define cGPIO_DIR_4 (1<<4)
|
||||
#define cGPIO_DIR_3 (1<<3)
|
||||
#define cGPIO_DIR_2 (1<<2)
|
||||
#define cGPIO_DIR_1 (1<<1)
|
||||
#define cGPIO_DIR_0 (1<<0)
|
||||
|
||||
// GPIO_PUL_EN bits
|
||||
#define cGPIO_PUL_EN_7 (1<<7)
|
||||
#define cGPIO_PUL_EN_6 (1<<6)
|
||||
#define cGPIO_PUL_EN_5 (1<<5)
|
||||
#define cGPIO_PUL_EN_4 (1<<4)
|
||||
#define cGPIO_PUL_EN_3 (1<<3)
|
||||
#define cGPIO_PUL_EN_2 (1<<2)
|
||||
#define cGPIO_PUL_EN_1 (1<<1)
|
||||
#define cGPIO_PUL_EN_0 (1<<0)
|
||||
|
||||
// GPIO_PUL_SEL bits
|
||||
#define cGPIO_PUL_SEL_7 (1<<7)
|
||||
#define cGPIO_PUL_SEL_6 (1<<6)
|
||||
#define cGPIO_PUL_SEL_5 (1<<5)
|
||||
#define cGPIO_PUL_SEL_4 (1<<4)
|
||||
#define cGPIO_PUL_SEL_3 (1<<3)
|
||||
#define cGPIO_PUL_SEL_2 (1<<2)
|
||||
#define cGPIO_PUL_SEL_1 (1<<1)
|
||||
#define cGPIO_PUL_SEL_0 (1<<0)
|
||||
|
||||
// GPIO_DS bits
|
||||
#define cGPIO_DS_7 (1<<7)
|
||||
#define cGPIO_DS_6 (1<<6)
|
||||
#define cGPIO_DS_5 (1<<5)
|
||||
#define cGPIO_DS_4 (1<<4)
|
||||
#define cGPIO_DS_3 (1<<3)
|
||||
#define cGPIO_DS_2 (1<<2)
|
||||
#define cGPIO_DS_1 (1<<1)
|
||||
#define cGPIO_DS_0 (1<<0)
|
||||
|
||||
// SPI_CTRL bits
|
||||
//#define cSPI_CTRL_MISO_HIZ_EN (1<<1)
|
||||
//#define cSPI_CTRL_PB_PROTECT (1<<0)
|
||||
|
||||
// ANT_PAD_CTRL bits
|
||||
#define cANT_PAD_CTRL_ANTX_POL (0x0F)
|
||||
#define cANT_PAD_CTRL_ANTX_POL_Shift_c (4)
|
||||
#define cANT_PAD_CTRL_ANTX_CTRLMODE (1<<3)
|
||||
#define cANT_PAD_CTRL_ANTX_HZ (1<<2)
|
||||
#define cANT_PAD_CTRL_ANTX_EN (3)
|
||||
|
||||
// MISC_PAD_CTRL bits
|
||||
#define cMISC_PAD_CTRL_MISO_HIZ_EN (1<<3)
|
||||
#define cMISC_PAD_CTRL_IRQ_B_OD (1<<2)
|
||||
#define cMISC_PAD_CTRL_NON_GPIO_DS (1<<1)
|
||||
#define cMISC_PAD_CTRL_ANTX_CURR (1<<0)
|
||||
|
||||
// ANT_AGC_CTRL bits
|
||||
#define cANT_AGC_CTRL_FAD_EN_Shift_c (0)
|
||||
#define cANT_AGC_CTRL_FAD_EN_Mask_c (1<<cANT_AGC_CTRL_FAD_EN_Shift_c)
|
||||
#define cANT_AGC_CTRL_ANTX_Shift_c (1)
|
||||
#define cANT_AGC_CTRL_ANTX_Mask_c (1<<cANT_AGC_CTRL_ANTX_Shift_c)
|
||||
|
||||
// BSM_CTRL bits
|
||||
#define cBSM_CTRL_BSM_EN (1<<0)
|
||||
|
||||
// SOFT_RESET bits
|
||||
#define cSOFT_RESET_SOG_RST (1<<7)
|
||||
#define cSOFT_RESET_REGS_RST (1<<4)
|
||||
#define cSOFT_RESET_PLL_RST (1<<3)
|
||||
#define cSOFT_RESET_TX_RST (1<<2)
|
||||
#define cSOFT_RESET_RX_RST (1<<1)
|
||||
#define cSOFT_RESET_SEQ_MGR_RST (1<<0)
|
||||
|
||||
// SEQ_MGR_CTRL bits
|
||||
#define cSEQ_MGR_CTRL_SEQ_STATE_CTRL (3)
|
||||
#define cSEQ_MGR_CTRL_SEQ_STATE_CTRL_Shift_c (6)
|
||||
#define cSEQ_MGR_CTRL_NO_RX_RECYCLE (1<<5)
|
||||
#define cSEQ_MGR_CTRL_LATCH_PREAMBLE (1<<4)
|
||||
#define cSEQ_MGR_CTRL_EVENT_TMR_DO_NOT_LATCH (1<<3)
|
||||
#define cSEQ_MGR_CTRL_CLR_NEW_SEQ_INHIBIT (1<<2)
|
||||
#define cSEQ_MGR_CTRL_PSM_LOCK_DIS (1<<1)
|
||||
#define cSEQ_MGR_CTRL_PLL_ABORT_OVRD (1<<0)
|
||||
|
||||
// SEQ_MGR_STS bits
|
||||
#define cSEQ_MGR_STS_TMR2_SEQ_TRIG_ARMED (1<<7)
|
||||
#define cSEQ_MGR_STS_RX_MODE (1<<6)
|
||||
#define cSEQ_MGR_STS_RX_TIMEOUT_PENDING (1<<5)
|
||||
#define cSEQ_MGR_STS_NEW_SEQ_INHIBIT (1<<4)
|
||||
#define cSEQ_MGR_STS_SEQ_IDLE (1<<3)
|
||||
#define cSEQ_MGR_STS_XCVSEQ_ACTUAL (7)
|
||||
|
||||
// ABORT_STS bits
|
||||
#define cABORT_STS_PLL_ABORTED (1<<2)
|
||||
#define cABORT_STS_TC3_ABORTED (1<<1)
|
||||
#define cABORT_STS_SW_ABORTED (1<<0)
|
||||
|
||||
// FILTERFAIL_CODE2 bits
|
||||
#define cFILTERFAIL_CODE2_PAN_SEL (1<<7)
|
||||
#define cFILTERFAIL_CODE2_9_8 (3)
|
||||
|
||||
// PHY_STS bits
|
||||
#define cPHY_STS_PLL_UNLOCK (1<<7)
|
||||
#define cPHY_STS_PLL_LOCK_ERR (1<<6)
|
||||
#define cPHY_STS_PLL_LOCK (1<<5)
|
||||
#define cPHY_STS_CRCVALID (1<<3)
|
||||
#define cPHY_STS_FILTERFAIL_FLAG_SEL (1<<2)
|
||||
#define cPHY_STS_SFD_DET (1<<1)
|
||||
#define cPHY_STS_PREAMBLE_DET (1<<0)
|
||||
|
||||
// TESTMODE_CTRL bits
|
||||
#define cTEST_MODE_CTRL_HOT_ANT (1<<4)
|
||||
#define cTEST_MODE_CTRL_IDEAL_RSSI_EN (1<<3)
|
||||
#define cTEST_MODE_CTRL_IDEAL_PFC_EN (1<<2)
|
||||
#define cTEST_MODE_CTRL_CONTINUOUS_EN (1<<1)
|
||||
#define cTEST_MODE_CTRL_FPGA_EN (1<<0)
|
||||
|
||||
// DTM_CTRL1 bits
|
||||
#define cDTM_CTRL1_ATM_LOCKED (1<<7)
|
||||
#define cDTM_CTRL1_DTM_EN (1<<6)
|
||||
#define cDTM_CTRL1_PAGE5 (1<<5)
|
||||
#define cDTM_CTRL1_PAGE4 (1<<4)
|
||||
#define cDTM_CTRL1_PAGE3 (1<<3)
|
||||
#define cDTM_CTRL1_PAGE2 (1<<2)
|
||||
#define cDTM_CTRL1_PAGE1 (1<<1)
|
||||
#define cDTM_CTRL1_PAGE0 (1<<0)
|
||||
|
||||
// TX_MODE_CTRL
|
||||
#define cTX_MODE_CTRL_TX_INV (1<<4)
|
||||
#define cTX_MODE_CTRL_BT_EN (1<<3)
|
||||
#define cTX_MODE_CTRL_DTS2 (1<<2)
|
||||
#define cTX_MODE_CTRL_DTS1 (1<<1)
|
||||
#define cTX_MODE_CTRL_DTS0 (1<<0)
|
||||
|
||||
#define cTX_MODE_CTRL_DTS_MASK (7)
|
||||
|
||||
// CLK_OUT_CTRL bits
|
||||
#define cCLK_OUT_EXTEND (1<<7)
|
||||
#define cCLK_OUT_HIZ (1<<6)
|
||||
#define cCLK_OUT_SR (1<<5)
|
||||
#define cCLK_OUT_DS (1<<4)
|
||||
#define cCLK_OUT_EN (1<<3)
|
||||
#define cCLK_OUT_DIV_Mask (7<<0)
|
||||
|
||||
#define gCLK_OUT_FREQ_32_MHz (0)
|
||||
#define gCLK_OUT_FREQ_16_MHz (1)
|
||||
#define gCLK_OUT_FREQ_8_MHz (2)
|
||||
#define gCLK_OUT_FREQ_4_MHz (3)
|
||||
#define gCLK_OUT_FREQ_1_MHz (4)
|
||||
#define gCLK_OUT_FREQ_250_KHz (5)
|
||||
#define gCLK_OUT_FREQ_62_5_KHz (6)
|
||||
#define gCLK_OUT_FREQ_32_78_KHz (7)
|
||||
#define gCLK_OUT_FREQ_DISABLE (8)
|
||||
|
||||
|
||||
|
||||
|
||||
#endif /* __MCR20_REG_H__ */
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,90 @@
|
|||
/*!
|
||||
* Copyright (c) 2015, Freescale Semiconductor, Inc.
|
||||
* All rights reserved.
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*
|
||||
* \file XcvrSpi.h
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
*
|
||||
* o Redistributions of source code must retain the above copyright notice, this list
|
||||
* of conditions and the following disclaimer.
|
||||
*
|
||||
* o 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.
|
||||
*
|
||||
* o Neither the name of Freescale Semiconductor, Inc. nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from this
|
||||
* software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS 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.
|
||||
*/
|
||||
|
||||
#ifndef __XCVR_SPI_H__
|
||||
#define __XCVR_SPI_H__
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
* INCLUDED HEADERS *
|
||||
*---------------------------------------------------------------------------*
|
||||
* Add to this section all the headers that this module needs to include. *
|
||||
* Note that it is not a good practice to include header files into header *
|
||||
* files, so use this section only if there is no other better solution. *
|
||||
*---------------------------------------------------------------------------*
|
||||
*****************************************************************************/
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
* PUBLIC MACROS *
|
||||
*---------------------------------------------------------------------------*
|
||||
* Add to this section all the access macros, registers mappings, bit access *
|
||||
* macros, masks, flags etc ...
|
||||
*---------------------------------------------------------------------------*
|
||||
*****************************************************************************/
|
||||
#define gXcvrSpiInstance_c 0
|
||||
|
||||
/*****************************************************************************
|
||||
* PUBLIC FUNCTIONS *
|
||||
*---------------------------------------------------------------------------*
|
||||
* Add to this section all the global functions prototype preceded (as a *
|
||||
* good practice) by the keyword 'extern' *
|
||||
*---------------------------------------------------------------------------*
|
||||
*****************************************************************************/
|
||||
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
void RF_RST_Set(int state);
|
||||
void RF_CS_Set(int state);
|
||||
void RF_IRQ_Init(void);
|
||||
void RF_IRQ_Disable(void);
|
||||
void RF_IRQ_Enable(void);
|
||||
uint8_t RF_isIRQ_Pending(void);
|
||||
|
||||
void gXcvrAssertCS_d(void);
|
||||
void gXcvrDeassertCS_d(void);
|
||||
|
||||
void xcvr_spi_init(uint32_t instance);
|
||||
void xcvr_spi_configure_speed(uint32_t instance, uint32_t freq);
|
||||
void xcvr_spi_transfer(uint32_t instance,
|
||||
uint8_t *sendBuffer,
|
||||
uint8_t *receiveBuffer,
|
||||
uint32_t transferByteCount);
|
||||
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* __XCVR_SPI_H__ */
|
Loading…
Reference in New Issue