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

📄 coordinator.c

📁 通过5120芯片实现无线UART进行数据的传输
💻 C
字号:
/****************************************************************************
 *
 * MODULE              Jenie Wireless UART
 *
 * COMPONENT           $RCSfile: Coordinator.c,v $
 *
 * VERSION             $Name:  $
 *
 * REVISION            $Revision: 1.1 $
 *
 * DATED               $Date: 2007/11/02 12:32:41 $
 *
 * STATUS              $State: Exp $
 *
 * AUTHOR              Martin Looker
 *
 * DESCRIPTION         Jenie Wireless UART - Coordinator.
 *
 * CHANGE HISTORY
 *
 * $Log: Coordinator.c,v $
 * Revision 1.1  2007/11/02 12:32:41  mlook
 * Adding new application notes
 *
 *
 *
 * LAST MODIFIED BY    $Author: mlook $
 *                     $Modtime: $
 *
 ****************************************************************************
 *
 * This software is owned by Jennic and/or its supplier and is protected
 * under applicable copyright laws. All rights are reserved. We grant You,
 * and any third parties, a license to use this software solely and
 * exclusively on Jennic products. You, and any third parties must reproduce
 * the copyright and warranty notice and any other legend of ownership on each
 * copy or partial copy of the software.
 *
 * THIS SOFTWARE IS PROVIDED "AS IS". JENNIC MAKES NO WARRANTIES, WHETHER
 * EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE,
 * ACCURACY OR LACK OF NEGLIGENCE. JENNIC SHALL NOT, IN ANY CIRCUMSTANCES,
 * BE LIABLE FOR ANY DAMAGES, INCLUDING, BUT NOT LIMITED TO, SPECIAL,
 * INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR ANY REASON WHATSOEVER.
 *
 * Copyright Jennic Ltd 2005, 2006, 2007. All rights reserved
 *
 ****************************************************************************/

/****************************************************************************/
/***        Include files                                                 ***/
/****************************************************************************/
#include <jendefs.h>
#include <jenie.h>
#include <AppHardwareApi.h>
#include <gdb.h>

#include "Wuart.h"
#include "Network.h"
#include "Serial.h"
#include "SerialQ.h"
#include "Uart.h"

/****************************************************************************/
/***        Macro Definitions                                             ***/
/****************************************************************************/
#define HIGH_POWER			FALSE				/**< High power module */

/****************************************************************************/
/***        Type Definitions                                              ***/
/****************************************************************************/

/****************************************************************************/
/***        Local Function Prototypes                                     ***/
/****************************************************************************/

/****************************************************************************/
/***        Exported Variables                                            ***/
/****************************************************************************/

/****************************************************************************/
/***        Local Variables                                               ***/
/****************************************************************************/

/****************************************************************************/
/***        Local Constants                                               ***/
/****************************************************************************/

/****************************************************************************/
/***        Jenie Callback Functions                                      ***/
/****************************************************************************/

/****************************************************************************
 *
 * NAME: vJenie_CbConfigureNetwork
 *
 * DESCRIPTION:
 * Set stack parameters prior to stack initialisation.
 *
 * RETURNS:
 * None
 *
 ****************************************************************************/
PUBLIC void vJenie_CbConfigureNetwork (void)
{
	/*  Configure the network - one child */
	vNetwork_ConfigureNetwork(E_JENIE_COORDINATOR, 1);
	/* Configure services */
	vNetwork_Service_Register(WUART_SERVICE);
	vNetwork_Service_Request (WUART_SERVICE);
}

/****************************************************************************
 *
 * NAME: vJenie_CbInit
 *
 * DESCRIPTION:
 * Perform application initialisation after stack has initialised.
 * Start running the stack.
 *
 * RETURNS:
 * None
 *
 ****************************************************************************/
PUBLIC void vJenie_CbInit (bool_t bWarmStart)
{
	/* Initialise integrated peripherals */
	(void) u32AHI_Init();

	/* Set high power module */
	#if HIGH_POWER
		vAHI_HighPowerModuleEnable(HIGH_POWER, HIGH_POWER);
	#endif

	/* Initialise the application */
	vWuart_Init();

    /* Initialise network */
	vNetwork_Init(bWarmStart, FALSE);
    /* Call the shared network start function */
	vNetwork_Start();
}

/****************************************************************************
 *
 * NAME: vJenie_CbMain
 *
 * DESCRIPTION:
 * Main application task, called repeatedly by the stack.
 * This function should be non-blocking.
 *
 * RETURNS:
 * None
 *
 ****************************************************************************/
PUBLIC void vJenie_CbMain (void)
{
	/* Call the shared network main function */
	vNetwork_Main();
}

/****************************************************************************
 *
 * NAME: vJenie_CbStackMgmtEvent
 *
 * DESCRIPTION:
 * Called when stack management event has occurred.
 *
 * RETURNS:
 * None
 *
 ****************************************************************************/
PUBLIC void vJenie_CbStackMgmtEvent (teEventType   eEventType,
								   void        *pvEventPrim)
{
	/* Call the shared network stack management event function */
	vNetwork_StackMgmtEvent(eEventType, pvEventPrim);
}

/****************************************************************************
 *
 * NAME: vJenie_CbStackDataEvent
 *
 * DESCRIPTION:
 * Called when data event has occurred.
 *
 * RETURNS:
 * None
 *
 ****************************************************************************/
PUBLIC void vJenie_CbStackDataEvent (teEventType   eEventType,
								   void             *pvEventPrim)
{
	/* Call the shared network stack data event function */
	vNetwork_StackDataEvent(eEventType, pvEventPrim);
}

/****************************************************************************
 *
 * NAME: vJenie_CbHwEvent
 *
 * DESCRIPTION:
 *
 *
 * RETURNS:
 * None
 *
 ****************************************************************************/
PUBLIC void vJenie_CbHwEvent (uint32 u32DeviceId,
							uint32 u32ItemBitmap)
{
	/* Tick timer event ? */
	if (u32DeviceId == E_AHI_DEVICE_TIMER0)
	{
		/* Call the shared network hardware event function */
		vNetwork_HwEvent(u32DeviceId, u32ItemBitmap);
	}
}

/****************************************************************************/
/***        END OF FILE                                                   ***/
/****************************************************************************/

⌨️ 快捷键说明

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