📄 main.c
字号:
/************************************************************************************
* Main file for PTC (Test). Includes Main routine.
*
*
* (c) Copyright 2006, Freescale Semiconductor, Inc. All rights reserved.
*
* Freescale Confidential Proprietary
*
* 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.
************************************************************************************/
#include "EmbeddedTypes.h"
#include "AppToMacPhyConfig.h" // For inclusion of gAspCapability_d
#include "AppToPlatformConfig.h"
#include "PlatformInit.h"
#include "IrqControlLib.h"
#if !defined( INCLUDE_802_15_4 )
#include "TestParser.h"
#include "TestParserNwkMac.h"
#endif //!INCLUDE_802_15_4
#if gAspCapability_d
extern void PTC_APPASP_AppMainLoop(void);
extern void PTC_APPASP_AppInit(void);
#else
#define PTC_APPASP_AppMainLoop()
#define PTC_APPASP_AppInit()
#endif // gAspCapability_d
/************************************************************************************
*************************************************************************************
* Version for embedded debugging via UART or BDM interface
*************************************************************************************
************************************************************************************/
#if !defined( INCLUDE_802_15_4 )
#include "TestUart.h"
#endif // ! INCLUDE_802_15_4
#if !defined( INCLUDE_802_15_4 )
/************************************************************************************
* Main function for stand-alone system.
* If the code is build as a stand-alone application, this function is
* included as the main entry point.
* If the code is build as libs, this function is not defined.
* Instead the application is responsible for supplying the main.
* This way no PTC or other test facilities are included if building as libs.
*
* Interface assumptions:
*
* Return value:
* NONE
*
* Revision history:
*
* Date Author Comments
* ------ ------ --------
* 030505 JT Created
*
************************************************************************************/
void main(void) {
Init_802_15_4(); // Init platform and stack
PTC_InitSystem(); // Init PTC module
PTC_NWKMAC_NwkInit(); // Make sure queue is initialized
PTC_APPASP_AppInit(); // Make sure queue is initialized
IrqControlLib_EnableAllIrqs(); /* enable interrupts */
/* include your code here */
for(;;) {
#ifdef I_AM_A_SNIFFER
poll_data_from_PHY();
#endif I_AM_A_SNIFFER
#ifdef FTDI_USB
poll_ftdi_rx();
poll_ftdi_tx();
#endif
PTC_NWKMAC_NwkMainLoop(); // Do NWK-similar polling
PTC_APPASP_AppMainLoop(); // Do APP-similar polling
(void)PTC_TestInterfaceCheckRx(); // return value ignored - always stays in mainloop
} /* loop forever */
}
#endif /* INCLUDE_802_15_4 */
/**********************************************************************/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -