/*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*\

File: OCTVC1_MAIN_EVT.h
Copyright (c) 2014 Octasic Inc. All rights reserved.

Description: Contains the event definition of the MAIN API.

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU Affero General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.

Octasic_Release: OCTSDR-2G-01.08.05-B29-ALPHA (2014/08/14)

$Octasic_Revision: $

\*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*/

#ifndef __OCTVC1_MAIN_EVT_H__
#define __OCTVC1_MAIN_EVT_H__


/*****************************  INCLUDE FILES  *******************************/

#include "octvc1_main_api.h"

/************************  COMMON DEFINITIONS  *******************************/

/*-------------------------------------------------------------------------------------
	tOCTVC1_MAIN_EVT_PHY_MASK : 	Phy Events.
-------------------------------------------------------------------------------------*/
#define tOCTVC1_MAIN_EVT_PHY_MASK							tOCT_UINT32

#define cOCTVC1_MAIN_EVT_PHY_MASK_UP						((tOCT_UINT32)(1<<0) )	
#define cOCTVC1_MAIN_EVT_PHY_MASK_DOWN						((tOCT_UINT32)(1<<1) )	

/*****************************  NOTIFICATIONS  **********************************/
/*-------------------------------------------------------------------------------------
	tOCTVC1_MAIN_MSG_MODULE_TRACING_BUFFER_FULL_EVT

 Members:
	Header
	BufferId
-------------------------------------------------------------------------------------*/
typedef struct
{
	tOCTVC1_EVENT_HEADER	Header;
	tOCTVC1_HANDLE_OBJECT	BufferId;

} tOCTVC1_MAIN_MSG_MODULE_TRACING_BUFFER_FULL_EVT;

/*-------------------------------------------------------------------------------------
	tOCTVC1_MAIN_MSG_MODULE_TRACING_STOP_EVT

 Members:
	Header
-------------------------------------------------------------------------------------*/
typedef struct
{
	tOCTVC1_EVENT_HEADER	Header;

} tOCTVC1_MAIN_MSG_MODULE_TRACING_STOP_EVT;

/*-------------------------------------------------------------------------------------
	tOCTVC1_MAIN_MSG_DEVICE_OPUS_CORE_EXEC_REPORT_EVT

 Members:
	Header
	ulCoreUseMask
 		One-hot vector indicating which cores are used.
	ulCoreHaltMask
 		One-hot vector indicating which cores are halted.
-------------------------------------------------------------------------------------*/
typedef struct
{
	tOCTVC1_EVENT_HEADER		Header;
	tOCTVC1_MAIN_OPUS_CORE_MASK	ulCoreUseMask;
	tOCTVC1_MAIN_OPUS_CORE_MASK	ulCoreHaltMask;

} tOCTVC1_MAIN_MSG_DEVICE_OPUS_CORE_EXEC_REPORT_EVT;

/*-------------------------------------------------------------------------------------
	tOCTVC1_MAIN_MSG_GPIO_BANK_CHANGE_EVT

 Members:
	Header
	ulBank
 		GPIO bank on which the change was detected.
	ulPortValue
 		Current value of each GPIO pin (including output and non-monitored pins ).
-------------------------------------------------------------------------------------*/
typedef struct
{
	tOCTVC1_EVENT_HEADER	Header;
	tOCT_UINT32				ulBank;
	tOCT_UINT32				ulPortValue;

} tOCTVC1_MAIN_MSG_GPIO_BANK_CHANGE_EVT;

/*-------------------------------------------------------------------------------------
	tOCTVC1_MAIN_MSG_MDIO_PHY_CHANGE_EVT

 Members:
	Header
	ulPhyAddress
 		Address, on the MDIO bus, of the monitored PHY for which a
 		status change was detected.
	ulEvents
 		Bit mask of the events reported.
-------------------------------------------------------------------------------------*/
typedef struct
{
	tOCTVC1_EVENT_HEADER		Header;
	tOCT_UINT32					ulPhyAddress;
	tOCTVC1_MAIN_EVT_PHY_MASK	ulEvents;

} tOCTVC1_MAIN_MSG_MDIO_PHY_CHANGE_EVT;

/*-------------------------------------------------------------------------------------
	tOCTVC1_MAIN_MSG_PROCESS_CPU_USAGE_REPORT_EVT

 Members:
	Header
	hProcess
	ulProcessImageType
 		Process Type identifier. Value INVALID means no process running on this core.
	ulProcessCpuUsagePercent
	ulNumThread
-------------------------------------------------------------------------------------*/
typedef struct
{
	tOCTVC1_EVENT_HEADER			Header;
	tOCT_UINT32						hProcess;
	tOCTVC1_MAIN_PROCESS_TYPE_ENUM	ulProcessImageType;
	tOCT_UINT32						ulProcessCpuUsagePercent;
	tOCT_UINT32						ulNumThread;

} tOCTVC1_MAIN_MSG_PROCESS_CPU_USAGE_REPORT_EVT;

/*-------------------------------------------------------------------------------------
	tOCTVC1_MAIN_MSG_REDUNDANCY_SERVER_MGW_FAILOVER_DONE_EVT

 Members:
	Header
	hMgw
 		Redundant MGW identifier and control FIFO identifier used to reach the
 		redundant MGW.
	ulDurationMs
 		Failover duration in milliseconds.
	FailoverStatus
 		Status of the failover.
	ulFailoverReturnCode
 		First cOCTVC1_RC that occured while executing the failover.
-------------------------------------------------------------------------------------*/
typedef struct
{
	tOCTVC1_EVENT_HEADER									Header;
	tOCTVC1_HANDLE_OBJECT									hMgw;
	tOCT_UINT32												ulDurationMs;
	tOCTVC1_MAIN_REDUNDANCY_SERVER_FAILOVER_MGW_STATUS_ENUM	FailoverStatus;
	tOCT_UINT32												ulFailoverReturnCode;

} tOCTVC1_MAIN_MSG_REDUNDANCY_SERVER_MGW_FAILOVER_DONE_EVT;


#endif /* __OCTVC1_MAIN_EVT_H__ */

