📄 nullnode.c
字号:
/****************************************************************************
*
* MODULE: Null Node
* COMPONENT: $RCSfile: NullNode.c,v $
*
* VERSION: $Name: $
*
* REVISION: $Revision: 1.7 $
*
* DATED: $Date: 2006/10/09 11:27:53 $
*
* STATUS: $State: Exp $
*
* AUTHOR: GPfef
*
* DESCRIPTION:
*
*
* LAST MODIFIED BY: $Author: gpfef $
* $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. All rights reserved
*
****************************************************************************/
/****************************************************************************/
/*** Include files ***/
/****************************************************************************/
#include "jendefs.h"
#include <AppHardwareApi.h>
#include <string.h>
#include "gdb.h"
#include "JZ_Api.h"
#include "af.h"
#include "aps.h"
#include "af_profile.h"
/****************************************************************************/
/*** Macro Definitions ***/
/****************************************************************************/
/* DIO lines used to drive LEDs */
#define LED_OUTPUTS_MASK 0x0000C000UL
#define LED1_MASK 0x00004000UL
#define LED2_MASK 0x00008000UL
/****************************************************************************/
/*** Type Definitions ***/
/****************************************************************************/
/****************************************************************************/
/*** Local Function Prototypes ***/
/****************************************************************************/
PRIVATE void NullDeviceInit(void);
/****************************************************************************/
/*** Exported Variables ***/
/****************************************************************************/
/****************************************************************************/
/*** Local Variables ***/
/****************************************************************************/
/****************************************************************************/
/*** Exported Functions ***/
/****************************************************************************/
/****************************************************************************
*
* NAME: AppColdStart
*
* DESCRIPTION:
* Entry point for application from boot loader. Initialises system.
*
* RETURNS:
* Never returns.
*
****************************************************************************/
PUBLIC void AppColdStart(void)
{
/* Debug hooks: include these regardless of whether debugging or not */
HAL_GDB_INIT();
HAL_BREAKPOINT();
/* General initialisation: reset hardware, set some values in PIB */
JZS_sConfig.u32Channel = 0x11;
JZS_sConfig.u16PanId = 0x1aab;
/* General initialisation */
NullDeviceInit();
/* No return from the above function call */
}
/****************************************************************************
*
* NAME: AppWarmStart
*
* DESCRIPTION:
* Entry point for application from boot loader. Simply jumps to AppColdStart
* as, in this instance, application will never warm start.
*
* RETURNS:
* Never returns.
*
****************************************************************************/
PUBLIC void AppWarmStart(void)
{
AppColdStart();
}
/****************************************************************************
*
* NAME: JZA_boAppStart
*
* DESCRIPTION:
* Would be used for instance to add simple descriptors for endpoints prior
* starting as a coordinator/router/end device as defined in the make file
*
* RETURNS:
*
*
****************************************************************************/
BOOL JZA_boAppStart(void)
{
JZS_vStartStack();
return TRUE;
}
/****************************************************************************
*
* NAME: JZA_vAppEventHandler
*
* DESCRIPTION:
* Main user routine. This is called by the Basic Operating System (BOS)
* at regular intervals.
*
* RETURNS:
*
*
****************************************************************************/
void JZA_vAppEventHandler(void)
{
if (JZS_eStackState <= JZS_STATE_JOINING)
{
return;
}
/* indicate network successfully started/joined by turning LED 1 off */
vAHI_DioSetOutput(LED1_MASK, 0);
}
/****************************************************************************
*
* NAME: JZA_vPeripheralEvent
*
* DESCRIPTION:
* Adds events to the hardware event queue.
*
* PARAMETERS: Name RW Usage
* u32Device R Peripheral responsible for interrupt e.g DIO
* u32ItemBitmap R Source of interrupt e.g. DIO bit map
*
* RETURNS:
* void
*
****************************************************************************/
PUBLIC void JZA_vPeripheralEvent(uint32 u32Device, uint32 u32ItemBitmap)
{
}
/****************************************************************************
*
* NAME: JZA_vAppDefineTasks
*
* DESCRIPTION:
* Can be used to add additional tasks.
*
* RETURNS:
* void
*
****************************************************************************/
PUBLIC void JZA_vAppDefineTasks(void)
{
}
/****************************************************************************
*
* NAME: JZA_eAfKvpObject
*
* DESCRIPTION:
* Receives incoming KVP data frames
*
* PARAMETERS: Name RW Usage
* afSrcAddr R Source address of KVP frame
* u8DstEndpoint R Destination endpoint for frame
* *pu8ClusterId R Pointer to Cluster ID for KVP frame
* eCommandTypeId R Command type specified by the frame
* u16AttributeId R Target Attribute ID of Cluster
* *pu8AfduLength R Pointer to length of data portion of frame
* *pu8Afdu R Pointer to data portion of frame
*
* RETURNS:
* Application framework error code
*
****************************************************************************/
AF_ERROR_CODE JZA_eAfKvpObject(AF_ADDRTYPE afSrcAddr,
uint8 u8DstEndpoint,
uint8 u8SequenceNum,
uint8 *pu8ClusterId,
AF_COMMAND_TYPE_ID eCommandTypeId,
uint16 u16AttributeId,
uint8 *pu8AfduLength,
uint8 *pu8Afdu)
{
return KVP_INVALID_ENDPOINT;
}
/****************************************************************************
*
* NAME: JZA_vAfKvpResponse
*
* DESCRIPTION:
* Used to send response to incoming KVP frame
*
* PARAMETERS: Name RW Usage
* srcAddressMod R Address of responding node
* transactionSequenceNum R Sequence number of frame
* commandTypeIdentifier R Type of command sent
* dstEndPoint R Endpoint which response is sent to
* clusterID R ID of target cluster
* attributeIdentifier R Attibute ID of target cluster
* errorCode R Success or otherwise of request
* afduLength R Length of data portion
* *pAfdu R Pointer to data portion of frame
*
* RETURNS:
* void
*
****************************************************************************/
void JZA_vAfKvpResponse(AF_ADDRTYPE srcAddressMod,
UINT8 transactionSequenceNum,
AF_COMMAND_TYPE_ID commandTypeIdentifier,
UINT8 dstEndPoint,
UINT8 clusterID,
UINT16 attributeIdentifier,
UINT8 errorCode,
UINT8 afduLength,
UINT8 *pAfdu )
{
}
/****************************************************************************
*
* NAME: JZA_pu8AfMsgObject
*
* DESCRIPTION:
* Receives incoming MSG data frames.
*
* PARAMETERS: Name RW Usage
* afSrcAddr R Source address of message frame
* dstEndPoint R Destination Endpoint of message
* *clusterID R Pointer to Cluster ID for frame
* *afduLength R Pointer to length of data portion
* *pAfdu R Pointer to data portion
* RETURNS:
*
*
****************************************************************************/
UINT8 *JZA_pu8AfMsgObject( AF_ADDRTYPE afSrcAddr,
UINT8 dstEndPoint,
UINT8 *clusterID,
UINT8 *afduLength,
UINT8 *pAfdu)
{
return NULL;
}
/****************************************************************************
*
* NAME: JZA_vZdpResponse
*
* DESCRIPTION:
* Receives responses to Binding or MatchDescriptor requests
*
* PARAMETERS: Name RW Usage
* u8Type R Type of response
* *pu8Payload R Pointer to response
* u8PayloadLen R Length of response
*
* RETURNS:
* void
*
****************************************************************************/
PUBLIC void JZA_vZdpResponse(uint8 u8Type, uint8 *pu8Payload, uint8 u8PayloadLen)
{
}
/****************************************************************************
*
* NAME: JZA_vStackEvent
*
* DESCRIPTION:
* Used to receive additional stack events such as Data Request confirm
*
* PARAMETERS: Name RW Usage
* eEventId R ID number of stack event
* *puStackEvent R Pointer to union containing
* stack event data
*
* RETURNS:
* void
*
****************************************************************************/
PUBLIC void JZA_vStackEvent(teJZS_EventIdentifier eEventId,
tuJZS_StackEvent *puStackEvent)
{
}
/****************************************************************************/
/*** Local Functions ***/
/****************************************************************************/
/****************************************************************************
*
* NAME: NullDeviceInit
*
* DESCRIPTION:
* Initialises stack and hardware.
*
* RETURNS:
* void
*
****************************************************************************/
PRIVATE void NullDeviceInit(void)
{
JZS_u32InitSystem();
/* Set LED IO's to outputs */
vAHI_DioSetDirection(0, LED_OUTPUTS_MASK);
vAHI_DioSetOutput(0, LED1_MASK);
vAHI_DioSetOutput(LED2_MASK, 0);
/* Start BOS */
BOSRun();
}
/****************************************************************************/
/*** END OF FILE ***/
/****************************************************************************/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -