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

📄 coordinator.c

📁 关于zigbee厂家jennic的zigbee通信模块JN5139的一些示例程序。
💻 C
字号:
/****************************************************************************/
/*!
 *\MODULE              Wireless UART with Flow Control
 *
 *\COMPONENT           $RCSfile: Coordinator.c,v $
 *
 *\VERSION             $Name:  $
 *
 *\REVISION            $Revision: 1.4 $
 *
 *\DATED               $Date: 2008/03/26 14:40:44 $
 *
 *\STATUS              $State: Exp $
 *
 *\AUTHOR              Martin Looker
 *
 *\DESCRIPTION         Coordinator - implementation.
 *
 * This file forms the basic Jenie application for the Coordinator
 * node type. This file contains the standard set of Jenie callback functions
 * that the Jenie stack calls. As the majority of the application code is the same
 * regardless of device type the functions in this file simply call the
 * equivalent functions in Network.c.
 */
/* CHANGE HISTORY
 *
 * $Log: Coordinator.c,v $
 * Revision 1.4  2008/03/26 14:40:44  mlook
 * Now scans channels
 *
 * Revision 1.3  2008/03/05 09:47:29  mlook
 * Added option for binding with buttons
 *
 * Revision 1.2  2008/03/05 09:33:17  mlook
 * Added option for binding with buttons
 *
 * Revision 1.1  2008/01/21 10:15:04  mlook
 * Initial checkin
 *
 *
 *
 * 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 2007. All rights reserved
 *
 ****************************************************************************/

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

#include "Network.h"

/****************************************************************************/
/***        Macro Definitions                                             ***/
/****************************************************************************/

/****************************************************************************/
/***        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 */
	vNetwork_ConfigureNetwork(E_JENIE_COORDINATOR, NETWORK_BUTTON_BIND ? NETWORK_MAX_CHILDREN : 1);
}

/****************************************************************************
 *
 * 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) u32JPI_Init();
    /* Initialise network */
	vNetwork_Init(bWarmStart, FALSE);
}

/****************************************************************************
 *
 * 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)
{
	/* Wake timer 1 event (every 100ms) ? */
	if (u32DeviceId  == E_JPI_DEVICE_SYSCTRL &&
	   (u32ItemBitmap & E_JPI_SYSCTRL_WK1_MASK) != 0)
	{
		/* Call the shared network hardware event function */
		vNetwork_HwEvent(u32DeviceId, u32ItemBitmap);
	}
}

/****************************************************************************
 *
 * NAME 		vDevice_Destination_Rx
 *
 *
 * DESCRIPTION	Receives data over the network for a destination service.
 *
 * RETURNS:
 * None
 *
 ****************************************************************************/
PUBLIC void vDevice_Destination_Rx	(
	uint64 u64Address, 		/**< Address data received from */
	uint8   u8Destination, 	/**< Service to receive data */
	uint16 u16Length, 		/**< Length of data */
	uint8 *pu8Data)			/**< Pointer to data */
{
	/* CAN HANDLE INCOMING DATA HERE - uncomment call in vNetwork_Service_Rx */
	;
}

/****************************************************************************
 *
 * NAME 		vDevice_Rx
 *
 *
 * DESCRIPTION	Receives data over the network directly.
 *
 * RETURNS:
 * None
 *
 ****************************************************************************/
PUBLIC void vDevice_Rx	(
	uint64 u64Address, 		/**< Address data received from */
	uint16 u16Length, 		/**< Length of data */
	uint8 *pu8Data)			/**< Pointer to data */
{
	/* CAN HANDLE INCOMING DATA HERE - uncomment call in vNetwork_Rx */
	;
}

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

⌨️ 快捷键说明

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