Version of easy-connect with the u-blox cellular platforms C027 and C030 added.
mcr20a-rf-driver/source/MCR20Drv.c@6:304d3ba87a01, 2017-11-03 (annotated)
- Committer:
- RobMeades
- Date:
- Fri Nov 03 13:01:23 2017 +0000
- Revision:
- 6:304d3ba87a01
- Parent:
- 0:19aa55d66228
Add comment concerning N2XX baud rate.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
group-ublox | 0:19aa55d66228 | 1 | /*! |
group-ublox | 0:19aa55d66228 | 2 | * Copyright (c) 2015, Freescale Semiconductor, Inc. |
group-ublox | 0:19aa55d66228 | 3 | * All rights reserved. |
group-ublox | 0:19aa55d66228 | 4 | * |
group-ublox | 0:19aa55d66228 | 5 | * \file MCR20Drv.c |
group-ublox | 0:19aa55d66228 | 6 | * |
group-ublox | 0:19aa55d66228 | 7 | * Redistribution and use in source and binary forms, with or without modification, |
group-ublox | 0:19aa55d66228 | 8 | * are permitted provided that the following conditions are met: |
group-ublox | 0:19aa55d66228 | 9 | * |
group-ublox | 0:19aa55d66228 | 10 | * o Redistributions of source code must retain the above copyright notice, this list |
group-ublox | 0:19aa55d66228 | 11 | * of conditions and the following disclaimer. |
group-ublox | 0:19aa55d66228 | 12 | * |
group-ublox | 0:19aa55d66228 | 13 | * o Redistributions in binary form must reproduce the above copyright notice, this |
group-ublox | 0:19aa55d66228 | 14 | * list of conditions and the following disclaimer in the documentation and/or |
group-ublox | 0:19aa55d66228 | 15 | * other materials provided with the distribution. |
group-ublox | 0:19aa55d66228 | 16 | * |
group-ublox | 0:19aa55d66228 | 17 | * o Neither the name of Freescale Semiconductor, Inc. nor the names of its |
group-ublox | 0:19aa55d66228 | 18 | * contributors may be used to endorse or promote products derived from this |
group-ublox | 0:19aa55d66228 | 19 | * software without specific prior written permission. |
group-ublox | 0:19aa55d66228 | 20 | * |
group-ublox | 0:19aa55d66228 | 21 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND |
group-ublox | 0:19aa55d66228 | 22 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
group-ublox | 0:19aa55d66228 | 23 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
group-ublox | 0:19aa55d66228 | 24 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR |
group-ublox | 0:19aa55d66228 | 25 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
group-ublox | 0:19aa55d66228 | 26 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
group-ublox | 0:19aa55d66228 | 27 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON |
group-ublox | 0:19aa55d66228 | 28 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
group-ublox | 0:19aa55d66228 | 29 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
group-ublox | 0:19aa55d66228 | 30 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
group-ublox | 0:19aa55d66228 | 31 | */ |
group-ublox | 0:19aa55d66228 | 32 | |
group-ublox | 0:19aa55d66228 | 33 | |
group-ublox | 0:19aa55d66228 | 34 | /***************************************************************************** |
group-ublox | 0:19aa55d66228 | 35 | * INCLUDED HEADERS * |
group-ublox | 0:19aa55d66228 | 36 | *---------------------------------------------------------------------------* |
group-ublox | 0:19aa55d66228 | 37 | * Add to this section all the headers that this module needs to include. * |
group-ublox | 0:19aa55d66228 | 38 | *---------------------------------------------------------------------------* |
group-ublox | 0:19aa55d66228 | 39 | *****************************************************************************/ |
group-ublox | 0:19aa55d66228 | 40 | |
group-ublox | 0:19aa55d66228 | 41 | #include "platform/arm_hal_interrupt.h" |
group-ublox | 0:19aa55d66228 | 42 | #include "MCR20Drv.h" |
group-ublox | 0:19aa55d66228 | 43 | #include "MCR20Reg.h" |
group-ublox | 0:19aa55d66228 | 44 | #include "XcvrSpi.h" |
group-ublox | 0:19aa55d66228 | 45 | |
group-ublox | 0:19aa55d66228 | 46 | |
group-ublox | 0:19aa55d66228 | 47 | /***************************************************************************** |
group-ublox | 0:19aa55d66228 | 48 | * PRIVATE VARIABLES * |
group-ublox | 0:19aa55d66228 | 49 | *---------------------------------------------------------------------------* |
group-ublox | 0:19aa55d66228 | 50 | * Add to this section all the variables and constants that have local * |
group-ublox | 0:19aa55d66228 | 51 | * (file) scope. * |
group-ublox | 0:19aa55d66228 | 52 | * Each of this declarations shall be preceded by the 'static' keyword. * |
group-ublox | 0:19aa55d66228 | 53 | * These variables / constants cannot be accessed outside this module. * |
group-ublox | 0:19aa55d66228 | 54 | *---------------------------------------------------------------------------* |
group-ublox | 0:19aa55d66228 | 55 | *****************************************************************************/ |
group-ublox | 0:19aa55d66228 | 56 | uint32_t mPhyIrqDisableCnt = 1; |
group-ublox | 0:19aa55d66228 | 57 | |
group-ublox | 0:19aa55d66228 | 58 | /***************************************************************************** |
group-ublox | 0:19aa55d66228 | 59 | * PUBLIC VARIABLES * |
group-ublox | 0:19aa55d66228 | 60 | *---------------------------------------------------------------------------* |
group-ublox | 0:19aa55d66228 | 61 | * Add to this section all the variables and constants that have global * |
group-ublox | 0:19aa55d66228 | 62 | * (project) scope. * |
group-ublox | 0:19aa55d66228 | 63 | * These variables / constants can be accessed outside this module. * |
group-ublox | 0:19aa55d66228 | 64 | * These variables / constants shall be preceded by the 'extern' keyword in * |
group-ublox | 0:19aa55d66228 | 65 | * the interface header. * |
group-ublox | 0:19aa55d66228 | 66 | *---------------------------------------------------------------------------* |
group-ublox | 0:19aa55d66228 | 67 | *****************************************************************************/ |
group-ublox | 0:19aa55d66228 | 68 | |
group-ublox | 0:19aa55d66228 | 69 | /***************************************************************************** |
group-ublox | 0:19aa55d66228 | 70 | * PRIVATE FUNCTIONS PROTOTYPES * |
group-ublox | 0:19aa55d66228 | 71 | *---------------------------------------------------------------------------* |
group-ublox | 0:19aa55d66228 | 72 | * Add to this section all the functions prototypes that have local (file) * |
group-ublox | 0:19aa55d66228 | 73 | * scope. * |
group-ublox | 0:19aa55d66228 | 74 | * These functions cannot be accessed outside this module. * |
group-ublox | 0:19aa55d66228 | 75 | * These declarations shall be preceded by the 'static' keyword. * |
group-ublox | 0:19aa55d66228 | 76 | *---------------------------------------------------------------------------* |
group-ublox | 0:19aa55d66228 | 77 | *****************************************************************************/ |
group-ublox | 0:19aa55d66228 | 78 | |
group-ublox | 0:19aa55d66228 | 79 | /***************************************************************************** |
group-ublox | 0:19aa55d66228 | 80 | * PRIVATE FUNCTIONS * |
group-ublox | 0:19aa55d66228 | 81 | *---------------------------------------------------------------------------* |
group-ublox | 0:19aa55d66228 | 82 | * Add to this section all the functions that have local (file) scope. * |
group-ublox | 0:19aa55d66228 | 83 | * These functions cannot be accessed outside this module. * |
group-ublox | 0:19aa55d66228 | 84 | * These definitions shall be preceded by the 'static' keyword. * |
group-ublox | 0:19aa55d66228 | 85 | *---------------------------------------------------------------------------* |
group-ublox | 0:19aa55d66228 | 86 | *****************************************************************************/ |
group-ublox | 0:19aa55d66228 | 87 | |
group-ublox | 0:19aa55d66228 | 88 | |
group-ublox | 0:19aa55d66228 | 89 | /***************************************************************************** |
group-ublox | 0:19aa55d66228 | 90 | * PUBLIC FUNCTIONS * |
group-ublox | 0:19aa55d66228 | 91 | *---------------------------------------------------------------------------* |
group-ublox | 0:19aa55d66228 | 92 | * Add to this section all the functions that have global (project) scope. * |
group-ublox | 0:19aa55d66228 | 93 | * These functions can be accessed outside this module. * |
group-ublox | 0:19aa55d66228 | 94 | * These functions shall have their declarations (prototypes) within the * |
group-ublox | 0:19aa55d66228 | 95 | * interface header file and shall be preceded by the 'extern' keyword. * |
group-ublox | 0:19aa55d66228 | 96 | *---------------------------------------------------------------------------* |
group-ublox | 0:19aa55d66228 | 97 | *****************************************************************************/ |
group-ublox | 0:19aa55d66228 | 98 | |
group-ublox | 0:19aa55d66228 | 99 | /*--------------------------------------------------------------------------- |
group-ublox | 0:19aa55d66228 | 100 | * Name: MCR20Drv_Init |
group-ublox | 0:19aa55d66228 | 101 | * Description: - |
group-ublox | 0:19aa55d66228 | 102 | * Parameters: - |
group-ublox | 0:19aa55d66228 | 103 | * Return: - |
group-ublox | 0:19aa55d66228 | 104 | *---------------------------------------------------------------------------*/ |
group-ublox | 0:19aa55d66228 | 105 | void MCR20Drv_Init |
group-ublox | 0:19aa55d66228 | 106 | ( |
group-ublox | 0:19aa55d66228 | 107 | void |
group-ublox | 0:19aa55d66228 | 108 | ) |
group-ublox | 0:19aa55d66228 | 109 | { |
group-ublox | 0:19aa55d66228 | 110 | xcvr_spi_init(gXcvrSpiInstance_c); |
group-ublox | 0:19aa55d66228 | 111 | xcvr_spi_configure_speed(gXcvrSpiInstance_c, 8000000); |
group-ublox | 0:19aa55d66228 | 112 | |
group-ublox | 0:19aa55d66228 | 113 | gXcvrDeassertCS_d(); |
group-ublox | 0:19aa55d66228 | 114 | #if !defined(TARGET_KW24D) |
group-ublox | 0:19aa55d66228 | 115 | MCR20Drv_RST_B_Deassert(); |
group-ublox | 0:19aa55d66228 | 116 | #endif |
group-ublox | 0:19aa55d66228 | 117 | RF_IRQ_Init(); |
group-ublox | 0:19aa55d66228 | 118 | RF_IRQ_Disable(); |
group-ublox | 0:19aa55d66228 | 119 | mPhyIrqDisableCnt = 1; |
group-ublox | 0:19aa55d66228 | 120 | } |
group-ublox | 0:19aa55d66228 | 121 | |
group-ublox | 0:19aa55d66228 | 122 | /*--------------------------------------------------------------------------- |
group-ublox | 0:19aa55d66228 | 123 | * Name: MCR20Drv_DirectAccessSPIWrite |
group-ublox | 0:19aa55d66228 | 124 | * Description: - |
group-ublox | 0:19aa55d66228 | 125 | * Parameters: - |
group-ublox | 0:19aa55d66228 | 126 | * Return: - |
group-ublox | 0:19aa55d66228 | 127 | *---------------------------------------------------------------------------*/ |
group-ublox | 0:19aa55d66228 | 128 | void MCR20Drv_DirectAccessSPIWrite |
group-ublox | 0:19aa55d66228 | 129 | ( |
group-ublox | 0:19aa55d66228 | 130 | uint8_t address, |
group-ublox | 0:19aa55d66228 | 131 | uint8_t value |
group-ublox | 0:19aa55d66228 | 132 | ) |
group-ublox | 0:19aa55d66228 | 133 | { |
group-ublox | 0:19aa55d66228 | 134 | uint16_t txData; |
group-ublox | 0:19aa55d66228 | 135 | |
group-ublox | 0:19aa55d66228 | 136 | ProtectFromMCR20Interrupt(); |
group-ublox | 0:19aa55d66228 | 137 | |
group-ublox | 0:19aa55d66228 | 138 | xcvr_spi_configure_speed(gXcvrSpiInstance_c, 16000000); |
group-ublox | 0:19aa55d66228 | 139 | |
group-ublox | 0:19aa55d66228 | 140 | gXcvrAssertCS_d(); |
group-ublox | 0:19aa55d66228 | 141 | |
group-ublox | 0:19aa55d66228 | 142 | txData = (address & TransceiverSPI_DirectRegisterAddressMask); |
group-ublox | 0:19aa55d66228 | 143 | txData |= value << 8; |
group-ublox | 0:19aa55d66228 | 144 | |
group-ublox | 0:19aa55d66228 | 145 | xcvr_spi_transfer(gXcvrSpiInstance_c, (uint8_t *)&txData, 0, sizeof(txData)); |
group-ublox | 0:19aa55d66228 | 146 | |
group-ublox | 0:19aa55d66228 | 147 | gXcvrDeassertCS_d(); |
group-ublox | 0:19aa55d66228 | 148 | UnprotectFromMCR20Interrupt(); |
group-ublox | 0:19aa55d66228 | 149 | } |
group-ublox | 0:19aa55d66228 | 150 | |
group-ublox | 0:19aa55d66228 | 151 | /*--------------------------------------------------------------------------- |
group-ublox | 0:19aa55d66228 | 152 | * Name: MCR20Drv_DirectAccessSPIMultiByteWrite |
group-ublox | 0:19aa55d66228 | 153 | * Description: - |
group-ublox | 0:19aa55d66228 | 154 | * Parameters: - |
group-ublox | 0:19aa55d66228 | 155 | * Return: - |
group-ublox | 0:19aa55d66228 | 156 | *---------------------------------------------------------------------------*/ |
group-ublox | 0:19aa55d66228 | 157 | void MCR20Drv_DirectAccessSPIMultiByteWrite |
group-ublox | 0:19aa55d66228 | 158 | ( |
group-ublox | 0:19aa55d66228 | 159 | uint8_t startAddress, |
group-ublox | 0:19aa55d66228 | 160 | uint8_t * byteArray, |
group-ublox | 0:19aa55d66228 | 161 | uint8_t numOfBytes |
group-ublox | 0:19aa55d66228 | 162 | ) |
group-ublox | 0:19aa55d66228 | 163 | { |
group-ublox | 0:19aa55d66228 | 164 | uint8_t txData; |
group-ublox | 0:19aa55d66228 | 165 | |
group-ublox | 0:19aa55d66228 | 166 | if( (numOfBytes == 0) || (byteArray == 0) ) |
group-ublox | 0:19aa55d66228 | 167 | { |
group-ublox | 0:19aa55d66228 | 168 | return; |
group-ublox | 0:19aa55d66228 | 169 | } |
group-ublox | 0:19aa55d66228 | 170 | |
group-ublox | 0:19aa55d66228 | 171 | ProtectFromMCR20Interrupt(); |
group-ublox | 0:19aa55d66228 | 172 | |
group-ublox | 0:19aa55d66228 | 173 | xcvr_spi_configure_speed(gXcvrSpiInstance_c, 16000000); |
group-ublox | 0:19aa55d66228 | 174 | |
group-ublox | 0:19aa55d66228 | 175 | gXcvrAssertCS_d(); |
group-ublox | 0:19aa55d66228 | 176 | |
group-ublox | 0:19aa55d66228 | 177 | txData = (startAddress & TransceiverSPI_DirectRegisterAddressMask); |
group-ublox | 0:19aa55d66228 | 178 | |
group-ublox | 0:19aa55d66228 | 179 | xcvr_spi_transfer(gXcvrSpiInstance_c, &txData, 0, sizeof(txData)); |
group-ublox | 0:19aa55d66228 | 180 | xcvr_spi_transfer(gXcvrSpiInstance_c, byteArray, 0, numOfBytes); |
group-ublox | 0:19aa55d66228 | 181 | |
group-ublox | 0:19aa55d66228 | 182 | gXcvrDeassertCS_d(); |
group-ublox | 0:19aa55d66228 | 183 | UnprotectFromMCR20Interrupt(); |
group-ublox | 0:19aa55d66228 | 184 | } |
group-ublox | 0:19aa55d66228 | 185 | |
group-ublox | 0:19aa55d66228 | 186 | /*--------------------------------------------------------------------------- |
group-ublox | 0:19aa55d66228 | 187 | * Name: MCR20Drv_PB_SPIByteWrite |
group-ublox | 0:19aa55d66228 | 188 | * Description: - |
group-ublox | 0:19aa55d66228 | 189 | * Parameters: - |
group-ublox | 0:19aa55d66228 | 190 | * Return: - |
group-ublox | 0:19aa55d66228 | 191 | *---------------------------------------------------------------------------*/ |
group-ublox | 0:19aa55d66228 | 192 | void MCR20Drv_PB_SPIByteWrite |
group-ublox | 0:19aa55d66228 | 193 | ( |
group-ublox | 0:19aa55d66228 | 194 | uint8_t address, |
group-ublox | 0:19aa55d66228 | 195 | uint8_t value |
group-ublox | 0:19aa55d66228 | 196 | ) |
group-ublox | 0:19aa55d66228 | 197 | { |
group-ublox | 0:19aa55d66228 | 198 | uint32_t txData; |
group-ublox | 0:19aa55d66228 | 199 | |
group-ublox | 0:19aa55d66228 | 200 | ProtectFromMCR20Interrupt(); |
group-ublox | 0:19aa55d66228 | 201 | |
group-ublox | 0:19aa55d66228 | 202 | xcvr_spi_configure_speed(gXcvrSpiInstance_c, 16000000); |
group-ublox | 0:19aa55d66228 | 203 | |
group-ublox | 0:19aa55d66228 | 204 | gXcvrAssertCS_d(); |
group-ublox | 0:19aa55d66228 | 205 | |
group-ublox | 0:19aa55d66228 | 206 | txData = TransceiverSPI_WriteSelect | |
group-ublox | 0:19aa55d66228 | 207 | TransceiverSPI_PacketBuffAccessSelect | |
group-ublox | 0:19aa55d66228 | 208 | TransceiverSPI_PacketBuffByteModeSelect; |
group-ublox | 0:19aa55d66228 | 209 | txData |= (address) << 8; |
group-ublox | 0:19aa55d66228 | 210 | txData |= (value) << 16; |
group-ublox | 0:19aa55d66228 | 211 | |
group-ublox | 0:19aa55d66228 | 212 | xcvr_spi_transfer(gXcvrSpiInstance_c, (uint8_t*)&txData, 0, 3); |
group-ublox | 0:19aa55d66228 | 213 | |
group-ublox | 0:19aa55d66228 | 214 | gXcvrDeassertCS_d(); |
group-ublox | 0:19aa55d66228 | 215 | UnprotectFromMCR20Interrupt(); |
group-ublox | 0:19aa55d66228 | 216 | } |
group-ublox | 0:19aa55d66228 | 217 | |
group-ublox | 0:19aa55d66228 | 218 | /*--------------------------------------------------------------------------- |
group-ublox | 0:19aa55d66228 | 219 | * Name: MCR20Drv_PB_SPIBurstWrite |
group-ublox | 0:19aa55d66228 | 220 | * Description: - |
group-ublox | 0:19aa55d66228 | 221 | * Parameters: - |
group-ublox | 0:19aa55d66228 | 222 | * Return: - |
group-ublox | 0:19aa55d66228 | 223 | *---------------------------------------------------------------------------*/ |
group-ublox | 0:19aa55d66228 | 224 | void MCR20Drv_PB_SPIBurstWrite |
group-ublox | 0:19aa55d66228 | 225 | ( |
group-ublox | 0:19aa55d66228 | 226 | uint8_t * byteArray, |
group-ublox | 0:19aa55d66228 | 227 | uint8_t numOfBytes |
group-ublox | 0:19aa55d66228 | 228 | ) |
group-ublox | 0:19aa55d66228 | 229 | { |
group-ublox | 0:19aa55d66228 | 230 | uint8_t txData; |
group-ublox | 0:19aa55d66228 | 231 | |
group-ublox | 0:19aa55d66228 | 232 | if( (numOfBytes == 0) || (byteArray == 0) ) |
group-ublox | 0:19aa55d66228 | 233 | { |
group-ublox | 0:19aa55d66228 | 234 | return; |
group-ublox | 0:19aa55d66228 | 235 | } |
group-ublox | 0:19aa55d66228 | 236 | |
group-ublox | 0:19aa55d66228 | 237 | ProtectFromMCR20Interrupt(); |
group-ublox | 0:19aa55d66228 | 238 | |
group-ublox | 0:19aa55d66228 | 239 | xcvr_spi_configure_speed(gXcvrSpiInstance_c, 16000000); |
group-ublox | 0:19aa55d66228 | 240 | |
group-ublox | 0:19aa55d66228 | 241 | gXcvrAssertCS_d(); |
group-ublox | 0:19aa55d66228 | 242 | |
group-ublox | 0:19aa55d66228 | 243 | txData = TransceiverSPI_WriteSelect | |
group-ublox | 0:19aa55d66228 | 244 | TransceiverSPI_PacketBuffAccessSelect | |
group-ublox | 0:19aa55d66228 | 245 | TransceiverSPI_PacketBuffBurstModeSelect; |
group-ublox | 0:19aa55d66228 | 246 | |
group-ublox | 0:19aa55d66228 | 247 | xcvr_spi_transfer(gXcvrSpiInstance_c, &txData, 0, 1); |
group-ublox | 0:19aa55d66228 | 248 | xcvr_spi_transfer(gXcvrSpiInstance_c, byteArray, 0, numOfBytes); |
group-ublox | 0:19aa55d66228 | 249 | |
group-ublox | 0:19aa55d66228 | 250 | gXcvrDeassertCS_d(); |
group-ublox | 0:19aa55d66228 | 251 | UnprotectFromMCR20Interrupt(); |
group-ublox | 0:19aa55d66228 | 252 | } |
group-ublox | 0:19aa55d66228 | 253 | |
group-ublox | 0:19aa55d66228 | 254 | /*--------------------------------------------------------------------------- |
group-ublox | 0:19aa55d66228 | 255 | * Name: MCR20Drv_DirectAccessSPIRead |
group-ublox | 0:19aa55d66228 | 256 | * Description: - |
group-ublox | 0:19aa55d66228 | 257 | * Parameters: - |
group-ublox | 0:19aa55d66228 | 258 | * Return: - |
group-ublox | 0:19aa55d66228 | 259 | *---------------------------------------------------------------------------*/ |
group-ublox | 0:19aa55d66228 | 260 | |
group-ublox | 0:19aa55d66228 | 261 | uint8_t MCR20Drv_DirectAccessSPIRead |
group-ublox | 0:19aa55d66228 | 262 | ( |
group-ublox | 0:19aa55d66228 | 263 | uint8_t address |
group-ublox | 0:19aa55d66228 | 264 | ) |
group-ublox | 0:19aa55d66228 | 265 | { |
group-ublox | 0:19aa55d66228 | 266 | uint8_t txData; |
group-ublox | 0:19aa55d66228 | 267 | uint8_t rxData; |
group-ublox | 0:19aa55d66228 | 268 | |
group-ublox | 0:19aa55d66228 | 269 | ProtectFromMCR20Interrupt(); |
group-ublox | 0:19aa55d66228 | 270 | |
group-ublox | 0:19aa55d66228 | 271 | xcvr_spi_configure_speed(gXcvrSpiInstance_c, 8000000); |
group-ublox | 0:19aa55d66228 | 272 | |
group-ublox | 0:19aa55d66228 | 273 | gXcvrAssertCS_d(); |
group-ublox | 0:19aa55d66228 | 274 | |
group-ublox | 0:19aa55d66228 | 275 | txData = (address & TransceiverSPI_DirectRegisterAddressMask) | |
group-ublox | 0:19aa55d66228 | 276 | TransceiverSPI_ReadSelect; |
group-ublox | 0:19aa55d66228 | 277 | |
group-ublox | 0:19aa55d66228 | 278 | xcvr_spi_transfer(gXcvrSpiInstance_c, &txData, 0, sizeof(txData)); |
group-ublox | 0:19aa55d66228 | 279 | xcvr_spi_transfer(gXcvrSpiInstance_c, 0, &rxData, sizeof(rxData)); |
group-ublox | 0:19aa55d66228 | 280 | |
group-ublox | 0:19aa55d66228 | 281 | gXcvrDeassertCS_d(); |
group-ublox | 0:19aa55d66228 | 282 | UnprotectFromMCR20Interrupt(); |
group-ublox | 0:19aa55d66228 | 283 | |
group-ublox | 0:19aa55d66228 | 284 | return rxData; |
group-ublox | 0:19aa55d66228 | 285 | |
group-ublox | 0:19aa55d66228 | 286 | } |
group-ublox | 0:19aa55d66228 | 287 | |
group-ublox | 0:19aa55d66228 | 288 | /*--------------------------------------------------------------------------- |
group-ublox | 0:19aa55d66228 | 289 | * Name: MCR20Drv_DirectAccessSPIMultyByteRead |
group-ublox | 0:19aa55d66228 | 290 | * Description: - |
group-ublox | 0:19aa55d66228 | 291 | * Parameters: - |
group-ublox | 0:19aa55d66228 | 292 | * Return: - |
group-ublox | 0:19aa55d66228 | 293 | *---------------------------------------------------------------------------*/ |
group-ublox | 0:19aa55d66228 | 294 | uint8_t MCR20Drv_DirectAccessSPIMultiByteRead |
group-ublox | 0:19aa55d66228 | 295 | ( |
group-ublox | 0:19aa55d66228 | 296 | uint8_t startAddress, |
group-ublox | 0:19aa55d66228 | 297 | uint8_t * byteArray, |
group-ublox | 0:19aa55d66228 | 298 | uint8_t numOfBytes |
group-ublox | 0:19aa55d66228 | 299 | ) |
group-ublox | 0:19aa55d66228 | 300 | { |
group-ublox | 0:19aa55d66228 | 301 | uint8_t txData; |
group-ublox | 0:19aa55d66228 | 302 | uint8_t phyIRQSTS1; |
group-ublox | 0:19aa55d66228 | 303 | |
group-ublox | 0:19aa55d66228 | 304 | if( (numOfBytes == 0) || (byteArray == 0) ) |
group-ublox | 0:19aa55d66228 | 305 | { |
group-ublox | 0:19aa55d66228 | 306 | return 0; |
group-ublox | 0:19aa55d66228 | 307 | } |
group-ublox | 0:19aa55d66228 | 308 | |
group-ublox | 0:19aa55d66228 | 309 | ProtectFromMCR20Interrupt(); |
group-ublox | 0:19aa55d66228 | 310 | |
group-ublox | 0:19aa55d66228 | 311 | xcvr_spi_configure_speed(gXcvrSpiInstance_c, 8000000); |
group-ublox | 0:19aa55d66228 | 312 | |
group-ublox | 0:19aa55d66228 | 313 | gXcvrAssertCS_d(); |
group-ublox | 0:19aa55d66228 | 314 | |
group-ublox | 0:19aa55d66228 | 315 | txData = (startAddress & TransceiverSPI_DirectRegisterAddressMask) | |
group-ublox | 0:19aa55d66228 | 316 | TransceiverSPI_ReadSelect; |
group-ublox | 0:19aa55d66228 | 317 | |
group-ublox | 0:19aa55d66228 | 318 | xcvr_spi_transfer(gXcvrSpiInstance_c, &txData, &phyIRQSTS1, sizeof(txData)); |
group-ublox | 0:19aa55d66228 | 319 | xcvr_spi_transfer(gXcvrSpiInstance_c, 0, byteArray, numOfBytes); |
group-ublox | 0:19aa55d66228 | 320 | |
group-ublox | 0:19aa55d66228 | 321 | gXcvrDeassertCS_d(); |
group-ublox | 0:19aa55d66228 | 322 | UnprotectFromMCR20Interrupt(); |
group-ublox | 0:19aa55d66228 | 323 | |
group-ublox | 0:19aa55d66228 | 324 | return phyIRQSTS1; |
group-ublox | 0:19aa55d66228 | 325 | } |
group-ublox | 0:19aa55d66228 | 326 | |
group-ublox | 0:19aa55d66228 | 327 | /*--------------------------------------------------------------------------- |
group-ublox | 0:19aa55d66228 | 328 | * Name: MCR20Drv_PB_SPIBurstRead |
group-ublox | 0:19aa55d66228 | 329 | * Description: - |
group-ublox | 0:19aa55d66228 | 330 | * Parameters: - |
group-ublox | 0:19aa55d66228 | 331 | * Return: - |
group-ublox | 0:19aa55d66228 | 332 | *---------------------------------------------------------------------------*/ |
group-ublox | 0:19aa55d66228 | 333 | uint8_t MCR20Drv_PB_SPIBurstRead |
group-ublox | 0:19aa55d66228 | 334 | ( |
group-ublox | 0:19aa55d66228 | 335 | uint8_t * byteArray, |
group-ublox | 0:19aa55d66228 | 336 | uint8_t numOfBytes |
group-ublox | 0:19aa55d66228 | 337 | ) |
group-ublox | 0:19aa55d66228 | 338 | { |
group-ublox | 0:19aa55d66228 | 339 | uint8_t txData; |
group-ublox | 0:19aa55d66228 | 340 | uint8_t phyIRQSTS1; |
group-ublox | 0:19aa55d66228 | 341 | |
group-ublox | 0:19aa55d66228 | 342 | if( (numOfBytes == 0) || (byteArray == 0) ) |
group-ublox | 0:19aa55d66228 | 343 | { |
group-ublox | 0:19aa55d66228 | 344 | return 0; |
group-ublox | 0:19aa55d66228 | 345 | } |
group-ublox | 0:19aa55d66228 | 346 | |
group-ublox | 0:19aa55d66228 | 347 | ProtectFromMCR20Interrupt(); |
group-ublox | 0:19aa55d66228 | 348 | |
group-ublox | 0:19aa55d66228 | 349 | xcvr_spi_configure_speed(gXcvrSpiInstance_c, 8000000); |
group-ublox | 0:19aa55d66228 | 350 | |
group-ublox | 0:19aa55d66228 | 351 | gXcvrAssertCS_d(); |
group-ublox | 0:19aa55d66228 | 352 | |
group-ublox | 0:19aa55d66228 | 353 | txData = TransceiverSPI_ReadSelect | |
group-ublox | 0:19aa55d66228 | 354 | TransceiverSPI_PacketBuffAccessSelect | |
group-ublox | 0:19aa55d66228 | 355 | TransceiverSPI_PacketBuffBurstModeSelect; |
group-ublox | 0:19aa55d66228 | 356 | |
group-ublox | 0:19aa55d66228 | 357 | xcvr_spi_transfer(gXcvrSpiInstance_c, &txData, &phyIRQSTS1, sizeof(txData)); |
group-ublox | 0:19aa55d66228 | 358 | xcvr_spi_transfer(gXcvrSpiInstance_c, 0, byteArray, numOfBytes); |
group-ublox | 0:19aa55d66228 | 359 | |
group-ublox | 0:19aa55d66228 | 360 | gXcvrDeassertCS_d(); |
group-ublox | 0:19aa55d66228 | 361 | UnprotectFromMCR20Interrupt(); |
group-ublox | 0:19aa55d66228 | 362 | |
group-ublox | 0:19aa55d66228 | 363 | return phyIRQSTS1; |
group-ublox | 0:19aa55d66228 | 364 | } |
group-ublox | 0:19aa55d66228 | 365 | |
group-ublox | 0:19aa55d66228 | 366 | /*--------------------------------------------------------------------------- |
group-ublox | 0:19aa55d66228 | 367 | * Name: MCR20Drv_IndirectAccessSPIWrite |
group-ublox | 0:19aa55d66228 | 368 | * Description: - |
group-ublox | 0:19aa55d66228 | 369 | * Parameters: - |
group-ublox | 0:19aa55d66228 | 370 | * Return: - |
group-ublox | 0:19aa55d66228 | 371 | *---------------------------------------------------------------------------*/ |
group-ublox | 0:19aa55d66228 | 372 | void MCR20Drv_IndirectAccessSPIWrite |
group-ublox | 0:19aa55d66228 | 373 | ( |
group-ublox | 0:19aa55d66228 | 374 | uint8_t address, |
group-ublox | 0:19aa55d66228 | 375 | uint8_t value |
group-ublox | 0:19aa55d66228 | 376 | ) |
group-ublox | 0:19aa55d66228 | 377 | { |
group-ublox | 0:19aa55d66228 | 378 | uint32_t txData; |
group-ublox | 0:19aa55d66228 | 379 | |
group-ublox | 0:19aa55d66228 | 380 | ProtectFromMCR20Interrupt(); |
group-ublox | 0:19aa55d66228 | 381 | |
group-ublox | 0:19aa55d66228 | 382 | xcvr_spi_configure_speed(gXcvrSpiInstance_c, 16000000); |
group-ublox | 0:19aa55d66228 | 383 | |
group-ublox | 0:19aa55d66228 | 384 | gXcvrAssertCS_d(); |
group-ublox | 0:19aa55d66228 | 385 | |
group-ublox | 0:19aa55d66228 | 386 | txData = TransceiverSPI_IARIndexReg; |
group-ublox | 0:19aa55d66228 | 387 | txData |= (address) << 8; |
group-ublox | 0:19aa55d66228 | 388 | txData |= (value) << 16; |
group-ublox | 0:19aa55d66228 | 389 | |
group-ublox | 0:19aa55d66228 | 390 | xcvr_spi_transfer(gXcvrSpiInstance_c, (uint8_t*)&txData, 0, 3); |
group-ublox | 0:19aa55d66228 | 391 | |
group-ublox | 0:19aa55d66228 | 392 | gXcvrDeassertCS_d(); |
group-ublox | 0:19aa55d66228 | 393 | UnprotectFromMCR20Interrupt(); |
group-ublox | 0:19aa55d66228 | 394 | } |
group-ublox | 0:19aa55d66228 | 395 | |
group-ublox | 0:19aa55d66228 | 396 | /*--------------------------------------------------------------------------- |
group-ublox | 0:19aa55d66228 | 397 | * Name: MCR20Drv_IndirectAccessSPIMultiByteWrite |
group-ublox | 0:19aa55d66228 | 398 | * Description: - |
group-ublox | 0:19aa55d66228 | 399 | * Parameters: - |
group-ublox | 0:19aa55d66228 | 400 | * Return: - |
group-ublox | 0:19aa55d66228 | 401 | *---------------------------------------------------------------------------*/ |
group-ublox | 0:19aa55d66228 | 402 | void MCR20Drv_IndirectAccessSPIMultiByteWrite |
group-ublox | 0:19aa55d66228 | 403 | ( |
group-ublox | 0:19aa55d66228 | 404 | uint8_t startAddress, |
group-ublox | 0:19aa55d66228 | 405 | uint8_t * byteArray, |
group-ublox | 0:19aa55d66228 | 406 | uint8_t numOfBytes |
group-ublox | 0:19aa55d66228 | 407 | ) |
group-ublox | 0:19aa55d66228 | 408 | { |
group-ublox | 0:19aa55d66228 | 409 | uint16_t txData; |
group-ublox | 0:19aa55d66228 | 410 | |
group-ublox | 0:19aa55d66228 | 411 | if( (numOfBytes == 0) || (byteArray == 0) ) |
group-ublox | 0:19aa55d66228 | 412 | { |
group-ublox | 0:19aa55d66228 | 413 | return; |
group-ublox | 0:19aa55d66228 | 414 | } |
group-ublox | 0:19aa55d66228 | 415 | |
group-ublox | 0:19aa55d66228 | 416 | ProtectFromMCR20Interrupt(); |
group-ublox | 0:19aa55d66228 | 417 | |
group-ublox | 0:19aa55d66228 | 418 | xcvr_spi_configure_speed(gXcvrSpiInstance_c, 16000000); |
group-ublox | 0:19aa55d66228 | 419 | |
group-ublox | 0:19aa55d66228 | 420 | gXcvrAssertCS_d(); |
group-ublox | 0:19aa55d66228 | 421 | |
group-ublox | 0:19aa55d66228 | 422 | txData = TransceiverSPI_IARIndexReg; |
group-ublox | 0:19aa55d66228 | 423 | txData |= (startAddress) << 8; |
group-ublox | 0:19aa55d66228 | 424 | |
group-ublox | 0:19aa55d66228 | 425 | xcvr_spi_transfer(gXcvrSpiInstance_c, (uint8_t*)&txData, 0, sizeof(txData)); |
group-ublox | 0:19aa55d66228 | 426 | xcvr_spi_transfer(gXcvrSpiInstance_c, (uint8_t*)byteArray, 0, numOfBytes); |
group-ublox | 0:19aa55d66228 | 427 | |
group-ublox | 0:19aa55d66228 | 428 | gXcvrDeassertCS_d(); |
group-ublox | 0:19aa55d66228 | 429 | UnprotectFromMCR20Interrupt(); |
group-ublox | 0:19aa55d66228 | 430 | } |
group-ublox | 0:19aa55d66228 | 431 | |
group-ublox | 0:19aa55d66228 | 432 | /*--------------------------------------------------------------------------- |
group-ublox | 0:19aa55d66228 | 433 | * Name: MCR20Drv_IndirectAccessSPIRead |
group-ublox | 0:19aa55d66228 | 434 | * Description: - |
group-ublox | 0:19aa55d66228 | 435 | * Parameters: - |
group-ublox | 0:19aa55d66228 | 436 | * Return: - |
group-ublox | 0:19aa55d66228 | 437 | *---------------------------------------------------------------------------*/ |
group-ublox | 0:19aa55d66228 | 438 | uint8_t MCR20Drv_IndirectAccessSPIRead |
group-ublox | 0:19aa55d66228 | 439 | ( |
group-ublox | 0:19aa55d66228 | 440 | uint8_t address |
group-ublox | 0:19aa55d66228 | 441 | ) |
group-ublox | 0:19aa55d66228 | 442 | { |
group-ublox | 0:19aa55d66228 | 443 | uint16_t txData; |
group-ublox | 0:19aa55d66228 | 444 | uint8_t rxData; |
group-ublox | 0:19aa55d66228 | 445 | |
group-ublox | 0:19aa55d66228 | 446 | ProtectFromMCR20Interrupt(); |
group-ublox | 0:19aa55d66228 | 447 | |
group-ublox | 0:19aa55d66228 | 448 | xcvr_spi_configure_speed(gXcvrSpiInstance_c, 8000000); |
group-ublox | 0:19aa55d66228 | 449 | |
group-ublox | 0:19aa55d66228 | 450 | gXcvrAssertCS_d(); |
group-ublox | 0:19aa55d66228 | 451 | |
group-ublox | 0:19aa55d66228 | 452 | txData = TransceiverSPI_IARIndexReg | TransceiverSPI_ReadSelect; |
group-ublox | 0:19aa55d66228 | 453 | txData |= (address) << 8; |
group-ublox | 0:19aa55d66228 | 454 | |
group-ublox | 0:19aa55d66228 | 455 | xcvr_spi_transfer(gXcvrSpiInstance_c, (uint8_t*)&txData, 0, sizeof(txData)); |
group-ublox | 0:19aa55d66228 | 456 | xcvr_spi_transfer(gXcvrSpiInstance_c, 0, &rxData, sizeof(rxData)); |
group-ublox | 0:19aa55d66228 | 457 | |
group-ublox | 0:19aa55d66228 | 458 | gXcvrDeassertCS_d(); |
group-ublox | 0:19aa55d66228 | 459 | UnprotectFromMCR20Interrupt(); |
group-ublox | 0:19aa55d66228 | 460 | |
group-ublox | 0:19aa55d66228 | 461 | return rxData; |
group-ublox | 0:19aa55d66228 | 462 | } |
group-ublox | 0:19aa55d66228 | 463 | |
group-ublox | 0:19aa55d66228 | 464 | /*--------------------------------------------------------------------------- |
group-ublox | 0:19aa55d66228 | 465 | * Name: MCR20Drv_IndirectAccessSPIMultiByteRead |
group-ublox | 0:19aa55d66228 | 466 | * Description: - |
group-ublox | 0:19aa55d66228 | 467 | * Parameters: - |
group-ublox | 0:19aa55d66228 | 468 | * Return: - |
group-ublox | 0:19aa55d66228 | 469 | *---------------------------------------------------------------------------*/ |
group-ublox | 0:19aa55d66228 | 470 | void MCR20Drv_IndirectAccessSPIMultiByteRead |
group-ublox | 0:19aa55d66228 | 471 | ( |
group-ublox | 0:19aa55d66228 | 472 | uint8_t startAddress, |
group-ublox | 0:19aa55d66228 | 473 | uint8_t * byteArray, |
group-ublox | 0:19aa55d66228 | 474 | uint8_t numOfBytes |
group-ublox | 0:19aa55d66228 | 475 | ) |
group-ublox | 0:19aa55d66228 | 476 | { |
group-ublox | 0:19aa55d66228 | 477 | uint16_t txData; |
group-ublox | 0:19aa55d66228 | 478 | |
group-ublox | 0:19aa55d66228 | 479 | if( (numOfBytes == 0) || (byteArray == 0) ) |
group-ublox | 0:19aa55d66228 | 480 | { |
group-ublox | 0:19aa55d66228 | 481 | return; |
group-ublox | 0:19aa55d66228 | 482 | } |
group-ublox | 0:19aa55d66228 | 483 | |
group-ublox | 0:19aa55d66228 | 484 | ProtectFromMCR20Interrupt(); |
group-ublox | 0:19aa55d66228 | 485 | |
group-ublox | 0:19aa55d66228 | 486 | xcvr_spi_configure_speed(gXcvrSpiInstance_c, 8000000); |
group-ublox | 0:19aa55d66228 | 487 | |
group-ublox | 0:19aa55d66228 | 488 | gXcvrAssertCS_d(); |
group-ublox | 0:19aa55d66228 | 489 | |
group-ublox | 0:19aa55d66228 | 490 | txData = (TransceiverSPI_IARIndexReg | TransceiverSPI_ReadSelect); |
group-ublox | 0:19aa55d66228 | 491 | txData |= (startAddress) << 8; |
group-ublox | 0:19aa55d66228 | 492 | |
group-ublox | 0:19aa55d66228 | 493 | xcvr_spi_transfer(gXcvrSpiInstance_c, (uint8_t*)&txData, 0, sizeof(txData)); |
group-ublox | 0:19aa55d66228 | 494 | xcvr_spi_transfer(gXcvrSpiInstance_c, 0, byteArray, numOfBytes); |
group-ublox | 0:19aa55d66228 | 495 | |
group-ublox | 0:19aa55d66228 | 496 | gXcvrDeassertCS_d(); |
group-ublox | 0:19aa55d66228 | 497 | UnprotectFromMCR20Interrupt(); |
group-ublox | 0:19aa55d66228 | 498 | } |
group-ublox | 0:19aa55d66228 | 499 | |
group-ublox | 0:19aa55d66228 | 500 | /*--------------------------------------------------------------------------- |
group-ublox | 0:19aa55d66228 | 501 | * Name: MCR20Drv_IsIrqPending |
group-ublox | 0:19aa55d66228 | 502 | * Description: - |
group-ublox | 0:19aa55d66228 | 503 | * Parameters: - |
group-ublox | 0:19aa55d66228 | 504 | * Return: - |
group-ublox | 0:19aa55d66228 | 505 | *---------------------------------------------------------------------------*/ |
group-ublox | 0:19aa55d66228 | 506 | uint32_t MCR20Drv_IsIrqPending |
group-ublox | 0:19aa55d66228 | 507 | ( |
group-ublox | 0:19aa55d66228 | 508 | void |
group-ublox | 0:19aa55d66228 | 509 | ) |
group-ublox | 0:19aa55d66228 | 510 | { |
group-ublox | 0:19aa55d66228 | 511 | return RF_isIRQ_Pending(); |
group-ublox | 0:19aa55d66228 | 512 | } |
group-ublox | 0:19aa55d66228 | 513 | |
group-ublox | 0:19aa55d66228 | 514 | /*--------------------------------------------------------------------------- |
group-ublox | 0:19aa55d66228 | 515 | * Name: MCR20Drv_IRQ_Disable |
group-ublox | 0:19aa55d66228 | 516 | * Description: - |
group-ublox | 0:19aa55d66228 | 517 | * Parameters: - |
group-ublox | 0:19aa55d66228 | 518 | * Return: - |
group-ublox | 0:19aa55d66228 | 519 | *---------------------------------------------------------------------------*/ |
group-ublox | 0:19aa55d66228 | 520 | void MCR20Drv_IRQ_Disable |
group-ublox | 0:19aa55d66228 | 521 | ( |
group-ublox | 0:19aa55d66228 | 522 | void |
group-ublox | 0:19aa55d66228 | 523 | ) |
group-ublox | 0:19aa55d66228 | 524 | { |
group-ublox | 0:19aa55d66228 | 525 | platform_enter_critical(); |
group-ublox | 0:19aa55d66228 | 526 | |
group-ublox | 0:19aa55d66228 | 527 | if( mPhyIrqDisableCnt == 0 ) |
group-ublox | 0:19aa55d66228 | 528 | { |
group-ublox | 0:19aa55d66228 | 529 | RF_IRQ_Disable(); |
group-ublox | 0:19aa55d66228 | 530 | } |
group-ublox | 0:19aa55d66228 | 531 | |
group-ublox | 0:19aa55d66228 | 532 | mPhyIrqDisableCnt++; |
group-ublox | 0:19aa55d66228 | 533 | |
group-ublox | 0:19aa55d66228 | 534 | platform_exit_critical(); |
group-ublox | 0:19aa55d66228 | 535 | } |
group-ublox | 0:19aa55d66228 | 536 | |
group-ublox | 0:19aa55d66228 | 537 | /*--------------------------------------------------------------------------- |
group-ublox | 0:19aa55d66228 | 538 | * Name: MCR20Drv_IRQ_Enable |
group-ublox | 0:19aa55d66228 | 539 | * Description: - |
group-ublox | 0:19aa55d66228 | 540 | * Parameters: - |
group-ublox | 0:19aa55d66228 | 541 | * Return: - |
group-ublox | 0:19aa55d66228 | 542 | *---------------------------------------------------------------------------*/ |
group-ublox | 0:19aa55d66228 | 543 | void MCR20Drv_IRQ_Enable |
group-ublox | 0:19aa55d66228 | 544 | ( |
group-ublox | 0:19aa55d66228 | 545 | void |
group-ublox | 0:19aa55d66228 | 546 | ) |
group-ublox | 0:19aa55d66228 | 547 | { |
group-ublox | 0:19aa55d66228 | 548 | platform_enter_critical(); |
group-ublox | 0:19aa55d66228 | 549 | |
group-ublox | 0:19aa55d66228 | 550 | if( mPhyIrqDisableCnt ) |
group-ublox | 0:19aa55d66228 | 551 | { |
group-ublox | 0:19aa55d66228 | 552 | mPhyIrqDisableCnt--; |
group-ublox | 0:19aa55d66228 | 553 | |
group-ublox | 0:19aa55d66228 | 554 | if( mPhyIrqDisableCnt == 0 ) |
group-ublox | 0:19aa55d66228 | 555 | { |
group-ublox | 0:19aa55d66228 | 556 | RF_IRQ_Enable(); |
group-ublox | 0:19aa55d66228 | 557 | } |
group-ublox | 0:19aa55d66228 | 558 | } |
group-ublox | 0:19aa55d66228 | 559 | |
group-ublox | 0:19aa55d66228 | 560 | platform_exit_critical(); |
group-ublox | 0:19aa55d66228 | 561 | } |
group-ublox | 0:19aa55d66228 | 562 | |
group-ublox | 0:19aa55d66228 | 563 | /*--------------------------------------------------------------------------- |
group-ublox | 0:19aa55d66228 | 564 | * Name: MCR20Drv_RST_Assert |
group-ublox | 0:19aa55d66228 | 565 | * Description: - |
group-ublox | 0:19aa55d66228 | 566 | * Parameters: - |
group-ublox | 0:19aa55d66228 | 567 | * Return: - |
group-ublox | 0:19aa55d66228 | 568 | *---------------------------------------------------------------------------*/ |
group-ublox | 0:19aa55d66228 | 569 | void MCR20Drv_RST_B_Assert |
group-ublox | 0:19aa55d66228 | 570 | ( |
group-ublox | 0:19aa55d66228 | 571 | void |
group-ublox | 0:19aa55d66228 | 572 | ) |
group-ublox | 0:19aa55d66228 | 573 | { |
group-ublox | 0:19aa55d66228 | 574 | RF_RST_Set(0); |
group-ublox | 0:19aa55d66228 | 575 | } |
group-ublox | 0:19aa55d66228 | 576 | |
group-ublox | 0:19aa55d66228 | 577 | /*--------------------------------------------------------------------------- |
group-ublox | 0:19aa55d66228 | 578 | * Name: MCR20Drv_RST_Deassert |
group-ublox | 0:19aa55d66228 | 579 | * Description: - |
group-ublox | 0:19aa55d66228 | 580 | * Parameters: - |
group-ublox | 0:19aa55d66228 | 581 | * Return: - |
group-ublox | 0:19aa55d66228 | 582 | *---------------------------------------------------------------------------*/ |
group-ublox | 0:19aa55d66228 | 583 | void MCR20Drv_RST_B_Deassert |
group-ublox | 0:19aa55d66228 | 584 | ( |
group-ublox | 0:19aa55d66228 | 585 | void |
group-ublox | 0:19aa55d66228 | 586 | ) |
group-ublox | 0:19aa55d66228 | 587 | { |
group-ublox | 0:19aa55d66228 | 588 | RF_RST_Set(1); |
group-ublox | 0:19aa55d66228 | 589 | } |
group-ublox | 0:19aa55d66228 | 590 | |
group-ublox | 0:19aa55d66228 | 591 | /*--------------------------------------------------------------------------- |
group-ublox | 0:19aa55d66228 | 592 | * Name: MCR20Drv_SoftRST_Assert |
group-ublox | 0:19aa55d66228 | 593 | * Description: - |
group-ublox | 0:19aa55d66228 | 594 | * Parameters: - |
group-ublox | 0:19aa55d66228 | 595 | * Return: - |
group-ublox | 0:19aa55d66228 | 596 | *---------------------------------------------------------------------------*/ |
group-ublox | 0:19aa55d66228 | 597 | void MCR20Drv_SoftRST_Assert |
group-ublox | 0:19aa55d66228 | 598 | ( |
group-ublox | 0:19aa55d66228 | 599 | void |
group-ublox | 0:19aa55d66228 | 600 | ) |
group-ublox | 0:19aa55d66228 | 601 | { |
group-ublox | 0:19aa55d66228 | 602 | MCR20Drv_IndirectAccessSPIWrite(SOFT_RESET, (0x80)); |
group-ublox | 0:19aa55d66228 | 603 | } |
group-ublox | 0:19aa55d66228 | 604 | |
group-ublox | 0:19aa55d66228 | 605 | /*--------------------------------------------------------------------------- |
group-ublox | 0:19aa55d66228 | 606 | * Name: MCR20Drv_SoftRST_Deassert |
group-ublox | 0:19aa55d66228 | 607 | * Description: - |
group-ublox | 0:19aa55d66228 | 608 | * Parameters: - |
group-ublox | 0:19aa55d66228 | 609 | * Return: - |
group-ublox | 0:19aa55d66228 | 610 | *---------------------------------------------------------------------------*/ |
group-ublox | 0:19aa55d66228 | 611 | void MCR20Drv_SoftRST_Deassert |
group-ublox | 0:19aa55d66228 | 612 | ( |
group-ublox | 0:19aa55d66228 | 613 | void |
group-ublox | 0:19aa55d66228 | 614 | ) |
group-ublox | 0:19aa55d66228 | 615 | { |
group-ublox | 0:19aa55d66228 | 616 | MCR20Drv_IndirectAccessSPIWrite(SOFT_RESET, (0x00)); |
group-ublox | 0:19aa55d66228 | 617 | } |
group-ublox | 0:19aa55d66228 | 618 | |
group-ublox | 0:19aa55d66228 | 619 | /*--------------------------------------------------------------------------- |
group-ublox | 0:19aa55d66228 | 620 | * Name: MCR20Drv_Soft_RESET |
group-ublox | 0:19aa55d66228 | 621 | * Description: - |
group-ublox | 0:19aa55d66228 | 622 | * Parameters: - |
group-ublox | 0:19aa55d66228 | 623 | * Return: - |
group-ublox | 0:19aa55d66228 | 624 | *---------------------------------------------------------------------------*/ |
group-ublox | 0:19aa55d66228 | 625 | void MCR20Drv_Soft_RESET |
group-ublox | 0:19aa55d66228 | 626 | ( |
group-ublox | 0:19aa55d66228 | 627 | void |
group-ublox | 0:19aa55d66228 | 628 | ) |
group-ublox | 0:19aa55d66228 | 629 | { |
group-ublox | 0:19aa55d66228 | 630 | //assert SOG_RST |
group-ublox | 0:19aa55d66228 | 631 | MCR20Drv_IndirectAccessSPIWrite(SOFT_RESET, (0x80)); |
group-ublox | 0:19aa55d66228 | 632 | |
group-ublox | 0:19aa55d66228 | 633 | //deassert SOG_RST |
group-ublox | 0:19aa55d66228 | 634 | MCR20Drv_IndirectAccessSPIWrite(SOFT_RESET, (0x00)); |
group-ublox | 0:19aa55d66228 | 635 | } |
group-ublox | 0:19aa55d66228 | 636 | |
group-ublox | 0:19aa55d66228 | 637 | /*--------------------------------------------------------------------------- |
group-ublox | 0:19aa55d66228 | 638 | * Name: MCR20Drv_RESET |
group-ublox | 0:19aa55d66228 | 639 | * Description: - |
group-ublox | 0:19aa55d66228 | 640 | * Parameters: - |
group-ublox | 0:19aa55d66228 | 641 | * Return: - |
group-ublox | 0:19aa55d66228 | 642 | *---------------------------------------------------------------------------*/ |
group-ublox | 0:19aa55d66228 | 643 | void MCR20Drv_RESET |
group-ublox | 0:19aa55d66228 | 644 | ( |
group-ublox | 0:19aa55d66228 | 645 | void |
group-ublox | 0:19aa55d66228 | 646 | ) |
group-ublox | 0:19aa55d66228 | 647 | { |
group-ublox | 0:19aa55d66228 | 648 | #if !defined(TARGET_KW24D) |
group-ublox | 0:19aa55d66228 | 649 | volatile uint32_t delay = 1000; |
group-ublox | 0:19aa55d66228 | 650 | //assert RST_B |
group-ublox | 0:19aa55d66228 | 651 | MCR20Drv_RST_B_Assert(); |
group-ublox | 0:19aa55d66228 | 652 | |
group-ublox | 0:19aa55d66228 | 653 | while(delay--); |
group-ublox | 0:19aa55d66228 | 654 | |
group-ublox | 0:19aa55d66228 | 655 | //deassert RST_B |
group-ublox | 0:19aa55d66228 | 656 | MCR20Drv_RST_B_Deassert(); |
group-ublox | 0:19aa55d66228 | 657 | #endif |
group-ublox | 0:19aa55d66228 | 658 | } |
group-ublox | 0:19aa55d66228 | 659 | |
group-ublox | 0:19aa55d66228 | 660 | /*--------------------------------------------------------------------------- |
group-ublox | 0:19aa55d66228 | 661 | * Name: MCR20Drv_Set_CLK_OUT_Freq |
group-ublox | 0:19aa55d66228 | 662 | * Description: - |
group-ublox | 0:19aa55d66228 | 663 | * Parameters: - |
group-ublox | 0:19aa55d66228 | 664 | * Return: - |
group-ublox | 0:19aa55d66228 | 665 | *---------------------------------------------------------------------------*/ |
group-ublox | 0:19aa55d66228 | 666 | void MCR20Drv_Set_CLK_OUT_Freq |
group-ublox | 0:19aa55d66228 | 667 | ( |
group-ublox | 0:19aa55d66228 | 668 | uint8_t freqDiv |
group-ublox | 0:19aa55d66228 | 669 | ) |
group-ublox | 0:19aa55d66228 | 670 | { |
group-ublox | 0:19aa55d66228 | 671 | uint8_t clkOutCtrlReg = (freqDiv & cCLK_OUT_DIV_Mask) | cCLK_OUT_EN | cCLK_OUT_EXTEND; |
group-ublox | 0:19aa55d66228 | 672 | |
group-ublox | 0:19aa55d66228 | 673 | if(freqDiv == gCLK_OUT_FREQ_DISABLE) |
group-ublox | 0:19aa55d66228 | 674 | { |
group-ublox | 0:19aa55d66228 | 675 | clkOutCtrlReg = (cCLK_OUT_EXTEND | gCLK_OUT_FREQ_4_MHz); //reset value with clock out disabled |
group-ublox | 0:19aa55d66228 | 676 | } |
group-ublox | 0:19aa55d66228 | 677 | |
group-ublox | 0:19aa55d66228 | 678 | MCR20Drv_DirectAccessSPIWrite((uint8_t) CLK_OUT_CTRL, clkOutCtrlReg); |
group-ublox | 0:19aa55d66228 | 679 | } |