takashi kadono / Mbed OS Nucleo_446

Dependencies:   ssd1331

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers MCR20Drv.c Source File

MCR20Drv.c

Go to the documentation of this file.
00001 /*!
00002 * Copyright (c) 2015, Freescale Semiconductor, Inc.
00003 * All rights reserved.
00004 *
00005 * \file MCR20Drv.c
00006 *
00007 * Redistribution and use in source and binary forms, with or without modification,
00008 * are permitted provided that the following conditions are met:
00009 *
00010 * o Redistributions of source code must retain the above copyright notice, this list
00011 *   of conditions and the following disclaimer.
00012 *
00013 * o Redistributions in binary form must reproduce the above copyright notice, this
00014 *   list of conditions and the following disclaimer in the documentation and/or
00015 *   other materials provided with the distribution.
00016 *
00017 * o Neither the name of Freescale Semiconductor, Inc. nor the names of its
00018 *   contributors may be used to endorse or promote products derived from this
00019 *   software without specific prior written permission.
00020 *
00021 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
00022 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
00023 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
00024 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
00025 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
00026 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
00027 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
00028 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00029 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
00030 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00031 */
00032 
00033 
00034 /*****************************************************************************
00035 *                               INCLUDED HEADERS                            *
00036 *---------------------------------------------------------------------------*
00037 * Add to this section all the headers that this module needs to include.    *
00038 *---------------------------------------------------------------------------*
00039 *****************************************************************************/
00040 
00041 #include "MCR20Drv.h "
00042 #include "MCR20Reg.h"
00043 #include "XcvrSpi.h "
00044 
00045 #if defined(MBED_CONF_NANOSTACK_CONFIGURATION) && DEVICE_SPI
00046 
00047 #include "platform/mbed_critical.h"
00048 
00049 /*****************************************************************************
00050 *                               PRIVATE VARIABLES                           *
00051 *---------------------------------------------------------------------------*
00052 * Add to this section all the variables and constants that have local       *
00053 * (file) scope.                                                             *
00054 * Each of this declarations shall be preceded by the 'static' keyword.      *
00055 * These variables / constants cannot be accessed outside this module.       *
00056 *---------------------------------------------------------------------------*
00057 *****************************************************************************/
00058 uint32_t mPhyIrqDisableCnt = 1;
00059 
00060 /*****************************************************************************
00061 *                               PUBLIC VARIABLES                            *
00062 *---------------------------------------------------------------------------*
00063 * Add to this section all the variables and constants that have global      *
00064 * (project) scope.                                                          *
00065 * These variables / constants can be accessed outside this module.          *
00066 * These variables / constants shall be preceded by the 'extern' keyword in  *
00067 * the interface header.                                                     *
00068 *---------------------------------------------------------------------------*
00069 *****************************************************************************/
00070 
00071 /*****************************************************************************
00072 *                           PRIVATE FUNCTIONS PROTOTYPES                    *
00073 *---------------------------------------------------------------------------*
00074 * Add to this section all the functions prototypes that have local (file)   *
00075 * scope.                                                                    *
00076 * These functions cannot be accessed outside this module.                   *
00077 * These declarations shall be preceded by the 'static' keyword.             *
00078 *---------------------------------------------------------------------------*
00079 *****************************************************************************/
00080 
00081 /*****************************************************************************
00082 *                                PRIVATE FUNCTIONS                          *
00083 *---------------------------------------------------------------------------*
00084 * Add to this section all the functions that have local (file) scope.       *
00085 * These functions cannot be accessed outside this module.                   *
00086 * These definitions shall be preceded by the 'static' keyword.              *
00087 *---------------------------------------------------------------------------*
00088 *****************************************************************************/
00089 
00090 
00091 /*****************************************************************************
00092 *                             PUBLIC FUNCTIONS                              *
00093 *---------------------------------------------------------------------------*
00094 * Add to this section all the functions that have global (project) scope.   *
00095 * These functions can be accessed outside this module.                      *
00096 * These functions shall have their declarations (prototypes) within the     *
00097 * interface header file and shall be preceded by the 'extern' keyword.      *
00098 *---------------------------------------------------------------------------*
00099 *****************************************************************************/
00100 
00101 /*---------------------------------------------------------------------------
00102 * Name: MCR20Drv_Init
00103 * Description: -
00104 * Parameters: -
00105 * Return: -
00106 *---------------------------------------------------------------------------*/
00107 void MCR20Drv_Init
00108 (
00109 void
00110 )
00111 {
00112     xcvr_spi_init(gXcvrSpiInstance_c);
00113     xcvr_spi_configure_speed(gXcvrSpiInstance_c, 8000000);
00114 
00115     gXcvrDeassertCS_d();
00116     #if !defined(TARGET_KW24D)
00117       MCR20Drv_RST_B_Deassert();
00118     #endif
00119     RF_IRQ_Init();
00120     RF_IRQ_Disable();
00121     mPhyIrqDisableCnt = 1;
00122 }
00123 
00124 /*---------------------------------------------------------------------------
00125 * Name: MCR20Drv_DirectAccessSPIWrite
00126 * Description: -
00127 * Parameters: -
00128 * Return: -
00129 *---------------------------------------------------------------------------*/
00130 void MCR20Drv_DirectAccessSPIWrite
00131 (
00132 uint8_t address,
00133 uint8_t value
00134 )
00135 {
00136     uint16_t txData;
00137 
00138     ProtectFromMCR20Interrupt();
00139 
00140     xcvr_spi_configure_speed(gXcvrSpiInstance_c, 16000000);
00141 
00142     gXcvrAssertCS_d();
00143 
00144     txData = (address & TransceiverSPI_DirectRegisterAddressMask);
00145     txData |= value << 8;
00146 
00147     xcvr_spi_transfer(gXcvrSpiInstance_c, (uint8_t *)&txData, 0, sizeof(txData));
00148 
00149     gXcvrDeassertCS_d();
00150     UnprotectFromMCR20Interrupt();
00151 }
00152 
00153 /*---------------------------------------------------------------------------
00154 * Name: MCR20Drv_DirectAccessSPIMultiByteWrite
00155 * Description: -
00156 * Parameters: -
00157 * Return: -
00158 *---------------------------------------------------------------------------*/
00159 void MCR20Drv_DirectAccessSPIMultiByteWrite
00160 (
00161 uint8_t startAddress,
00162 uint8_t * byteArray,
00163 uint8_t numOfBytes
00164 )
00165 {
00166     uint8_t txData;
00167 
00168     if( (numOfBytes == 0) || (byteArray == 0) )
00169     {
00170         return;
00171     }
00172 
00173     ProtectFromMCR20Interrupt();
00174 
00175     xcvr_spi_configure_speed(gXcvrSpiInstance_c, 16000000);
00176 
00177     gXcvrAssertCS_d();
00178 
00179     txData = (startAddress & TransceiverSPI_DirectRegisterAddressMask);
00180 
00181     xcvr_spi_transfer(gXcvrSpiInstance_c, &txData, 0, sizeof(txData));
00182     xcvr_spi_transfer(gXcvrSpiInstance_c, byteArray, 0, numOfBytes);
00183 
00184     gXcvrDeassertCS_d();
00185     UnprotectFromMCR20Interrupt();
00186 }
00187 
00188 /*---------------------------------------------------------------------------
00189 * Name: MCR20Drv_PB_SPIByteWrite
00190 * Description: -
00191 * Parameters: -
00192 * Return: -
00193 *---------------------------------------------------------------------------*/
00194 void MCR20Drv_PB_SPIByteWrite
00195 (
00196 uint8_t address,
00197 uint8_t value
00198 )
00199 {
00200     uint32_t txData;
00201 
00202     ProtectFromMCR20Interrupt();
00203 
00204     xcvr_spi_configure_speed(gXcvrSpiInstance_c, 16000000);
00205 
00206     gXcvrAssertCS_d();
00207 
00208     txData  = TransceiverSPI_WriteSelect            |
00209         TransceiverSPI_PacketBuffAccessSelect |
00210             TransceiverSPI_PacketBuffByteModeSelect;
00211     txData |= (address) << 8;
00212     txData |= (value)   << 16;
00213 
00214     xcvr_spi_transfer(gXcvrSpiInstance_c, (uint8_t*)&txData, 0, 3);
00215 
00216     gXcvrDeassertCS_d();
00217     UnprotectFromMCR20Interrupt();
00218 }
00219 
00220 /*---------------------------------------------------------------------------
00221 * Name: MCR20Drv_PB_SPIBurstWrite
00222 * Description: -
00223 * Parameters: -
00224 * Return: -
00225 *---------------------------------------------------------------------------*/
00226 void MCR20Drv_PB_SPIBurstWrite
00227 (
00228 uint8_t * byteArray,
00229 uint8_t numOfBytes
00230 )
00231 {
00232     uint8_t txData;
00233 
00234     if( (numOfBytes == 0) || (byteArray == 0) )
00235     {
00236         return;
00237     }
00238 
00239     ProtectFromMCR20Interrupt();
00240 
00241     xcvr_spi_configure_speed(gXcvrSpiInstance_c, 16000000);
00242 
00243     gXcvrAssertCS_d();
00244 
00245     txData = TransceiverSPI_WriteSelect            |
00246         TransceiverSPI_PacketBuffAccessSelect |
00247             TransceiverSPI_PacketBuffBurstModeSelect;
00248 
00249     xcvr_spi_transfer(gXcvrSpiInstance_c, &txData, 0, 1);
00250     xcvr_spi_transfer(gXcvrSpiInstance_c, byteArray, 0, numOfBytes);
00251 
00252     gXcvrDeassertCS_d();
00253     UnprotectFromMCR20Interrupt();
00254 }
00255 
00256 /*---------------------------------------------------------------------------
00257 * Name: MCR20Drv_DirectAccessSPIRead
00258 * Description: -
00259 * Parameters: -
00260 * Return: -
00261 *---------------------------------------------------------------------------*/
00262 
00263 uint8_t MCR20Drv_DirectAccessSPIRead
00264 (
00265 uint8_t address
00266 )
00267 {
00268     uint8_t txData;
00269     uint8_t rxData;
00270 
00271     ProtectFromMCR20Interrupt();
00272 
00273     xcvr_spi_configure_speed(gXcvrSpiInstance_c, 8000000);
00274 
00275     gXcvrAssertCS_d();
00276 
00277     txData = (address & TransceiverSPI_DirectRegisterAddressMask) |
00278         TransceiverSPI_ReadSelect;
00279 
00280     xcvr_spi_transfer(gXcvrSpiInstance_c, &txData, 0, sizeof(txData));
00281     xcvr_spi_transfer(gXcvrSpiInstance_c, 0, &rxData, sizeof(rxData));
00282 
00283     gXcvrDeassertCS_d();
00284     UnprotectFromMCR20Interrupt();
00285 
00286     return rxData;
00287 
00288 }
00289 
00290 /*---------------------------------------------------------------------------
00291 * Name: MCR20Drv_DirectAccessSPIMultyByteRead
00292 * Description: -
00293 * Parameters: -
00294 * Return: -
00295 *---------------------------------------------------------------------------*/
00296 uint8_t MCR20Drv_DirectAccessSPIMultiByteRead
00297 (
00298 uint8_t startAddress,
00299 uint8_t * byteArray,
00300 uint8_t numOfBytes
00301 )
00302 {
00303     uint8_t  txData;
00304     uint8_t  phyIRQSTS1;
00305 
00306     if( (numOfBytes == 0) || (byteArray == 0) )
00307     {
00308         return 0;
00309     }
00310 
00311     ProtectFromMCR20Interrupt();
00312 
00313     xcvr_spi_configure_speed(gXcvrSpiInstance_c, 8000000);
00314 
00315     gXcvrAssertCS_d();
00316 
00317     txData = (startAddress & TransceiverSPI_DirectRegisterAddressMask) |
00318         TransceiverSPI_ReadSelect;
00319 
00320     xcvr_spi_transfer(gXcvrSpiInstance_c, &txData, &phyIRQSTS1, sizeof(txData));
00321     xcvr_spi_transfer(gXcvrSpiInstance_c, 0, byteArray, numOfBytes);
00322 
00323     gXcvrDeassertCS_d();
00324     UnprotectFromMCR20Interrupt();
00325 
00326     return phyIRQSTS1;
00327 }
00328 
00329 /*---------------------------------------------------------------------------
00330 * Name: MCR20Drv_PB_SPIBurstRead
00331 * Description: -
00332 * Parameters: -
00333 * Return: -
00334 *---------------------------------------------------------------------------*/
00335 uint8_t MCR20Drv_PB_SPIBurstRead
00336 (
00337 uint8_t * byteArray,
00338 uint8_t numOfBytes
00339 )
00340 {
00341     uint8_t  txData;
00342     uint8_t  phyIRQSTS1;
00343 
00344     if( (numOfBytes == 0) || (byteArray == 0) )
00345     {
00346         return 0;
00347     }
00348 
00349     ProtectFromMCR20Interrupt();
00350 
00351     xcvr_spi_configure_speed(gXcvrSpiInstance_c, 8000000);
00352 
00353     gXcvrAssertCS_d();
00354 
00355     txData = TransceiverSPI_ReadSelect |
00356         TransceiverSPI_PacketBuffAccessSelect |
00357             TransceiverSPI_PacketBuffBurstModeSelect;
00358 
00359     xcvr_spi_transfer(gXcvrSpiInstance_c, &txData, &phyIRQSTS1, sizeof(txData));
00360     xcvr_spi_transfer(gXcvrSpiInstance_c, 0, byteArray, numOfBytes);
00361 
00362     gXcvrDeassertCS_d();
00363     UnprotectFromMCR20Interrupt();
00364 
00365     return phyIRQSTS1;
00366 }
00367 
00368 /*---------------------------------------------------------------------------
00369 * Name: MCR20Drv_IndirectAccessSPIWrite
00370 * Description: -
00371 * Parameters: -
00372 * Return: -
00373 *---------------------------------------------------------------------------*/
00374 void MCR20Drv_IndirectAccessSPIWrite
00375 (
00376 uint8_t address,
00377 uint8_t value
00378 )
00379 {
00380     uint32_t  txData;
00381 
00382     ProtectFromMCR20Interrupt();
00383 
00384     xcvr_spi_configure_speed(gXcvrSpiInstance_c, 16000000);
00385 
00386     gXcvrAssertCS_d();
00387 
00388     txData = TransceiverSPI_IARIndexReg;
00389     txData |= (address) << 8;
00390     txData |= (value)   << 16;
00391 
00392     xcvr_spi_transfer(gXcvrSpiInstance_c, (uint8_t*)&txData, 0, 3);
00393 
00394     gXcvrDeassertCS_d();
00395     UnprotectFromMCR20Interrupt();
00396 }
00397 
00398 /*---------------------------------------------------------------------------
00399 * Name: MCR20Drv_IndirectAccessSPIMultiByteWrite
00400 * Description: -
00401 * Parameters: -
00402 * Return: -
00403 *---------------------------------------------------------------------------*/
00404 void MCR20Drv_IndirectAccessSPIMultiByteWrite
00405 (
00406 uint8_t startAddress,
00407 uint8_t * byteArray,
00408 uint8_t numOfBytes
00409 )
00410 {
00411     uint16_t  txData;
00412 
00413     if( (numOfBytes == 0) || (byteArray == 0) )
00414     {
00415         return;
00416     }
00417 
00418     ProtectFromMCR20Interrupt();
00419 
00420     xcvr_spi_configure_speed(gXcvrSpiInstance_c, 16000000);
00421 
00422     gXcvrAssertCS_d();
00423 
00424     txData = TransceiverSPI_IARIndexReg;
00425     txData |= (startAddress)  << 8;
00426 
00427     xcvr_spi_transfer(gXcvrSpiInstance_c, (uint8_t*)&txData, 0, sizeof(txData));
00428     xcvr_spi_transfer(gXcvrSpiInstance_c, (uint8_t*)byteArray, 0, numOfBytes);
00429 
00430     gXcvrDeassertCS_d();
00431     UnprotectFromMCR20Interrupt();
00432 }
00433 
00434 /*---------------------------------------------------------------------------
00435 * Name: MCR20Drv_IndirectAccessSPIRead
00436 * Description: -
00437 * Parameters: -
00438 * Return: -
00439 *---------------------------------------------------------------------------*/
00440 uint8_t MCR20Drv_IndirectAccessSPIRead
00441 (
00442 uint8_t address
00443 )
00444 {
00445     uint16_t  txData;
00446     uint8_t   rxData;
00447 
00448     ProtectFromMCR20Interrupt();
00449 
00450     xcvr_spi_configure_speed(gXcvrSpiInstance_c, 8000000);
00451 
00452     gXcvrAssertCS_d();
00453 
00454     txData = TransceiverSPI_IARIndexReg | TransceiverSPI_ReadSelect;
00455     txData |= (address) << 8;
00456 
00457     xcvr_spi_transfer(gXcvrSpiInstance_c, (uint8_t*)&txData, 0, sizeof(txData));
00458     xcvr_spi_transfer(gXcvrSpiInstance_c, 0, &rxData, sizeof(rxData));
00459 
00460     gXcvrDeassertCS_d();
00461     UnprotectFromMCR20Interrupt();
00462 
00463     return rxData;
00464 }
00465 
00466 /*---------------------------------------------------------------------------
00467 * Name: MCR20Drv_IndirectAccessSPIMultiByteRead
00468 * Description: -
00469 * Parameters: -
00470 * Return: -
00471 *---------------------------------------------------------------------------*/
00472 void MCR20Drv_IndirectAccessSPIMultiByteRead
00473 (
00474 uint8_t startAddress,
00475 uint8_t * byteArray,
00476 uint8_t numOfBytes
00477 )
00478 {
00479     uint16_t  txData;
00480 
00481     if( (numOfBytes == 0) || (byteArray == 0) )
00482     {
00483         return;
00484     }
00485 
00486     ProtectFromMCR20Interrupt();
00487 
00488     xcvr_spi_configure_speed(gXcvrSpiInstance_c, 8000000);
00489 
00490     gXcvrAssertCS_d();
00491 
00492     txData = (TransceiverSPI_IARIndexReg | TransceiverSPI_ReadSelect);
00493     txData |= (startAddress) << 8;
00494 
00495     xcvr_spi_transfer(gXcvrSpiInstance_c, (uint8_t*)&txData, 0, sizeof(txData));
00496     xcvr_spi_transfer(gXcvrSpiInstance_c, 0, byteArray, numOfBytes);
00497 
00498     gXcvrDeassertCS_d();
00499     UnprotectFromMCR20Interrupt();
00500 }
00501 
00502 /*---------------------------------------------------------------------------
00503 * Name: MCR20Drv_IsIrqPending
00504 * Description: -
00505 * Parameters: -
00506 * Return: -
00507 *---------------------------------------------------------------------------*/
00508 uint32_t  MCR20Drv_IsIrqPending
00509 (
00510 void
00511 )
00512 {
00513     return RF_isIRQ_Pending();
00514 }
00515 
00516 /*---------------------------------------------------------------------------
00517 * Name: MCR20Drv_IRQ_Disable
00518 * Description: -
00519 * Parameters: -
00520 * Return: -
00521 *---------------------------------------------------------------------------*/
00522 void MCR20Drv_IRQ_Disable
00523 (
00524 void
00525 )
00526 {
00527     core_util_critical_section_enter();
00528 
00529     if( mPhyIrqDisableCnt == 0 )
00530     {
00531         RF_IRQ_Disable();
00532     }
00533 
00534     mPhyIrqDisableCnt++;
00535 
00536     core_util_critical_section_exit();
00537 }
00538 
00539 /*---------------------------------------------------------------------------
00540 * Name: MCR20Drv_IRQ_Enable
00541 * Description: -
00542 * Parameters: -
00543 * Return: -
00544 *---------------------------------------------------------------------------*/
00545 void MCR20Drv_IRQ_Enable
00546 (
00547 void
00548 )
00549 {
00550     core_util_critical_section_enter();
00551 
00552     if( mPhyIrqDisableCnt )
00553     {
00554         mPhyIrqDisableCnt--;
00555 
00556         if( mPhyIrqDisableCnt == 0 )
00557         {
00558             RF_IRQ_Enable();
00559         }
00560     }
00561 
00562     core_util_critical_section_exit();
00563 }
00564 
00565 /*---------------------------------------------------------------------------
00566 * Name: MCR20Drv_RST_Assert
00567 * Description: -
00568 * Parameters: -
00569 * Return: -
00570 *---------------------------------------------------------------------------*/
00571 void MCR20Drv_RST_B_Assert
00572 (
00573 void
00574 )
00575 {
00576     RF_RST_Set(0);
00577 }
00578 
00579 /*---------------------------------------------------------------------------
00580 * Name: MCR20Drv_RST_Deassert
00581 * Description: -
00582 * Parameters: -
00583 * Return: -
00584 *---------------------------------------------------------------------------*/
00585 void MCR20Drv_RST_B_Deassert
00586 (
00587 void
00588 )
00589 {
00590     RF_RST_Set(1);
00591 }
00592 
00593 /*---------------------------------------------------------------------------
00594 * Name: MCR20Drv_SoftRST_Assert
00595 * Description: -
00596 * Parameters: -
00597 * Return: -
00598 *---------------------------------------------------------------------------*/
00599 void MCR20Drv_SoftRST_Assert
00600 (
00601 void
00602 )
00603 {
00604     MCR20Drv_IndirectAccessSPIWrite(SOFT_RESET, (0x80));
00605 }
00606 
00607 /*---------------------------------------------------------------------------
00608 * Name: MCR20Drv_SoftRST_Deassert
00609 * Description: -
00610 * Parameters: -
00611 * Return: -
00612 *---------------------------------------------------------------------------*/
00613 void MCR20Drv_SoftRST_Deassert
00614 (
00615 void
00616 )
00617 {
00618     MCR20Drv_IndirectAccessSPIWrite(SOFT_RESET, (0x00));
00619 }
00620 
00621 /*---------------------------------------------------------------------------
00622 * Name: MCR20Drv_Soft_RESET
00623 * Description: -
00624 * Parameters: -
00625 * Return: -
00626 *---------------------------------------------------------------------------*/
00627 void MCR20Drv_Soft_RESET
00628 (
00629 void
00630 )
00631 {
00632     //assert SOG_RST
00633     MCR20Drv_IndirectAccessSPIWrite(SOFT_RESET, (0x80));
00634 
00635     //deassert SOG_RST
00636     MCR20Drv_IndirectAccessSPIWrite(SOFT_RESET, (0x00));
00637 }
00638 
00639 /*---------------------------------------------------------------------------
00640 * Name: MCR20Drv_RESET
00641 * Description: -
00642 * Parameters: -
00643 * Return: -
00644 *---------------------------------------------------------------------------*/
00645 void MCR20Drv_RESET
00646 (
00647 void
00648 )
00649 {
00650   #if !defined(TARGET_KW24D)
00651     volatile uint32_t delay = 1000;
00652     //assert RST_B
00653     MCR20Drv_RST_B_Assert();
00654 
00655     while(delay--);
00656 
00657     //deassert RST_B
00658     MCR20Drv_RST_B_Deassert();
00659   #endif
00660 }
00661 
00662 /*---------------------------------------------------------------------------
00663 * Name: MCR20Drv_Set_CLK_OUT_Freq
00664 * Description: -
00665 * Parameters: -
00666 * Return: -
00667 *---------------------------------------------------------------------------*/
00668 void MCR20Drv_Set_CLK_OUT_Freq
00669 (
00670 uint8_t freqDiv
00671 )
00672 {
00673     uint8_t clkOutCtrlReg = (freqDiv & cCLK_OUT_DIV_Mask) | cCLK_OUT_EN | cCLK_OUT_EXTEND;
00674 
00675     if(freqDiv == gCLK_OUT_FREQ_DISABLE)
00676     {
00677         clkOutCtrlReg = (cCLK_OUT_EXTEND | gCLK_OUT_FREQ_4_MHz); //reset value with clock out disabled
00678     }
00679 
00680     MCR20Drv_DirectAccessSPIWrite((uint8_t) CLK_OUT_CTRL, clkOutCtrlReg);
00681 }
00682 
00683 #endif /* MBED_CONF_NANOSTACK_CONFIGURATION */