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

📄 hwdrv_hcs08.c

📁 This network protcol stack,it is very strong and powerful!
💻 C
字号:
/************************************************************************************
* This file contains Platform specific implentations of BTA functions.
* For the Windows Simulator Platform.
*
* Author(s): Thomas O. 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:
************************************************************************************/
typedef enum ePhyEnums_t phyTxRxState_t;

/************************************************************************************
* Includes
************************************************************************************/
#include "DigiType.h"
//#include "phy_spi.h"
//#include "AbelReg.h"
#include "gb60_io.h"
#include "MacPhy.h"
#include "Crt0.h"
#include "ICG.h"
//#include "NV_Data.h"
//#include "PhyMacMsg.h"
//#include "Debug.h"
#include "Embedded_Bootloader.h"
#include "App_Target.h"


// Prototypes to be used by phy
//void IrqCcaComplete(bool_t channelInUse);
//void RxEof(bool_t crcValid);
//void TxEof(void);
//extern void DoFastRxEof(void);
//extern void DoFastTxEof(void);
//void RxTimeout(void);
//extern uint16_t gIsrMask;
//extern bool_t gSeqInErrorState;
//extern void SeqIsrCompletedInErrorState(void);
//extern void ReStartRx(void);
//extern void SeqGenerateWakeInd(void);
//extern uint8_t gIsrEntryCounter;
//#pragma PLACE_DATA_SEG(SLEEP_VARIABLE)
//extern uint8_t gSeqPowerSaveMode;
//#pragma RESTORE_DATA_SEG
//extern phyTxRxState_t mPhyTxRxState;

//extern void GenerateTc2SyncLossIndication(void);
//#define GenerateSyncLoss GenerateTc2SyncLossIndication

extern void PHY_HW_Setup(void);
extern void AbelRegisterSetup(void);

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

/************************************************************************************
* All the complete systems I/O port definitions are described here                  *
************************************************************************************/
void InitAPPIO(void)
{
#ifdef I_AM_A_SNIFFER
  TPM1SC = 0x0c; // Use BUSCLK and prescale with factor 16 (to get 1 us)
  TPM1C1SC = 0x04; // Disable interrupt, Input capture, Capture on rising edge
#endif I_AM_A_SNIFFER

// Causion must be taken when changing ports already used by the PHY layer!!!
  // Setup port A
  mAPP_SETUP_PORT_A

  // Setup Port B
  mAPP_SETUP_PORT_B

  // Setup port C
  mAPP_SETUP_PORT_C

  // Setup port D
  mAPP_SETUP_PORT_D

  // Setup port E
  mAPP_SETUP_PORT_E
  
  // Setup port F
  mAPP_SETUP_PORT_F
}

/************************************************************************************
*************************************************************************************
* Public function(s)
*************************************************************************************
************************************************************************************/

/*******************************************************************
* Setup everything                                                 *
*******************************************************************/
void HwSetup(void)
{
  PHY_HW_Setup(); // Initializes PHY port settings and must be called before any application port setup.
  InitAPPIO(); // Must only be called after PHY_HW_Setup() because it can be used to re-initialize port settings.

  
#if defined BOOTLOADER_ENABLED && !defined FOR_BOOTLOADER_ONLY
	// Call version in bootloader
	FL_ICG_Setup();
#else
	ICG_Setup(); // Reuse code in function to reduce code size
#endif defined BOOTLOADER_ENABLED && !defined FOR_BOOTLOADER_ONLY
  
  AbelRegisterSetup();
}

// **************************************************************************

__interrupt void FLL_Lost_Lock_ISR(void)
{
	// Setup ICG module again to prevent that system hangs forever.
	
	ICGS1 |= 0x01; // Clear FLL lost lock interrupt

#if defined BOOTLOADER_ENABLED && !defined FOR_BOOTLOADER_ONLY
	// Call version in bootloader
	FL_ICG_Setup();
#else
	ICG_Setup(); // Reuse code in function to reduce code size
#endif defined BOOTLOADER_ENABLED && !defined FOR_BOOTLOADER_ONLY
}

// **************************************************************************

#if !defined(BOOTLOADER_ENABLED) || defined(FOR_BOOTLOADER_ONLY)

#pragma DISABLE_WARNING(Unreferenced_c)

/*******************************************************************************
* Dummy function if not using NV_RAM. ASP need                                 *
* this in order to link w/o boot loader.                                       *
*******************************************************************************/
uint8_t Update_NV_RAM(uint8_t *dest, uint8_t *src, uint8_t size)
{
   return FALSE; // Simulate that Update_NV_RAM() failed
}

#pragma RESTORE_WARNING(Unreferenced_c)

#endif

⌨️ 快捷键说明

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