⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 getset.c

📁 This network protcol stack,it is very strong and powerful!
💻 C
字号:
/************************************************************************************
* Get and Set PIB attribute values in physical layer.
*
* Author(s): Jesper Thomsen, Thomas Otvald Jensen
*
* (c) Copyright 2004, Freescale, Inc.  All rights reserved.
*
* Freescale Confidential Proprietary
* Digianswer Confidential
*
* No part of this document must be reproduced in any form - including copied,
* transcribed, printed or by any electronic means - without specific written
* permission from Freescale.
*
* Last Inspected:
* Last Tested:
************************************************************************************/

#include "DigiType.h"
#include "Phy.h"
#include "PhyMacMsg.h"

/************************************************************************************
*************************************************************************************
* Private macros
*************************************************************************************
************************************************************************************/

/************************************************************************************
*************************************************************************************
* Private prototypes
*************************************************************************************
************************************************************************************/

/************************************************************************************
*************************************************************************************
* Private type definitions
*************************************************************************************
************************************************************************************/

/************************************************************************************
*************************************************************************************
* Public memory declarations
*************************************************************************************
************************************************************************************/

/************************************************************************************
*************************************************************************************
* Private memory declarations
*************************************************************************************
************************************************************************************/

/************************************************************************************
*************************************************************************************
* Public functions
*************************************************************************************
************************************************************************************/

/************************************************************************************
* Configure frequency dividers in Abel from PHY layer channel. 
*
* Channels 11-26
* Abel divider pseudo table
*  0x95, 0x95, 0x95, 0x96,
*  0x96, 0x96, 0x97, 0x97,
*  0x97, 0x98, 0x98, 0x98,
*  0x99, 0x99, 0x99, 0x9a
*
* Abel numerator pseudo table
*  0x5000, 0xa000, 0xf000, 0x4000,
*  0x9000, 0xe000, 0x3000, 0x8000,
*  0xd000, 0x2000, 0x7000, 0xc000,
*  0x1000, 0x6000, 0xb000, 0x0000
*
* Conversion pseudo function:
*
*   channel   = (channel - 10)*5;
*   divider   = 0x95 + channel>>4;
*   numerator = channel << 12;
*   
* Interface assumptions:
*   Channels range from 11-26 - no range check!
*
* Return value:
*   NONE
*
* Revision history:
*
*    Date    Author    Comments
*   ------   ------    --------
*   010903   TOJ       Created
*   111004    JT       Changed to only setting the channel not PhyPib
*
************************************************************************************/
void PhyPlmeSetCurrentChannelRequest(uint8_t channel)
{
  uint16_t iDiv, Num;
    // Convert from channel into divider values in Abel
  channel = channel - 10;
  channel=channel*5;
  ABEL_READ_INT(ABEL_LO1DIV_REG, iDiv);
    // Set lowest 8 bit, which are iDiv
  iDiv = (iDiv & ~cIDIV8mask);
  iDiv = (iDiv | (uint8_t)(0x95+(channel>>4)));
  ABEL_WRITE_INT(ABEL_LO1DIV_REG, iDiv);

  channel = channel << 4;   // Shift by 4 for optimal asm 
  Num = channel << 8;
  ABEL_WRITE_INT(ABEL_LO1NUM_REG, Num);
}

/************************************************************************************
*************************************************************************************
* Private functions
*************************************************************************************
************************************************************************************/

/************************************************************************************
*************************************************************************************
* Module debug stuff
*************************************************************************************
************************************************************************************/

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -