/*
 * CIPCore_DataSync.h
 *
 *  Created on: Nov 15, 2025
 *      Author: tummalanr
 */

#ifndef CIPCORE_DATASYNC_H_
#define CIPCORE_DATASYNC_H_


/**
* MAX IPC Message in MSQ Queue for IPC RD / WR
*/
#define     MAXIPCRDWRMSGQLEN        50u

/**
 * Event Bits for IPC RD/WR Msg Received from remote Core.
 */
#define IPCMsgEventGrp_RD_BIT                (uint32_t)( 1u << 0u )             //BIT 0
#define IPCMsgEventGrp_WR_BIT                (uint32_t)( 1u << 1u )             //BIT 1


/**
* Variable used to indicate CIP is in synch with CAN core..
*/
uint8_t     CIP_Synch_Done = 0u;

/**
* System Status and Configuration IPC Client Id.
*/
uint16_t SysStatusConfig_IPC_ClientId = 3u;
/**
* IO Modules  IPC Client Id. for IO Modules 1 - 9
*/
uint16_t IOModules_IPC_ClientId = 4u;
/**
* Pressure Zone Modules  IPC Client Id. for STND VALVE(1 - 24 ) / ISEM DIAG / DIAGVAL/ INTR PROP/ Ext PROP)
*/
uint16_t PZxModules_IPC_ClientId = 5u;
/**
* MBN  Data IPC Client Id.
*/
uint16_t MBN_IPC_ClientId = 6u;
/**
* IPC Message Queue Handle used for Cyclic Data for Station control.
*/


/**
* IPC Message Queue Handle used for IPC WR request received from remote Core.
*/
QueueHandle_t   ipcmsgwrreqqueue;
/**
* IPC Message Queue Handle used for IPC RD request received from remote Core.
*/
QueueHandle_t   ipcmsgrdreqqueue;
/**
* Event Group used in IPC Message RD / WR requests from Remote core.
*/
EventGroupHandle_t xCreatedIPCMsgEventGroup;


/**
*  IPC message Process Task Priority / Stack size / Task Handle
*/
#define IPCMsgProcess_TASK_PRI  (configMAX_PRIORITIES-18)

#define IPCMsgProcess_TASK_SIZE ((16384U) /sizeof(configSTACK_DEPTH_TYPE))
StackType_t gIPCMsgProcessTaskStack[IPCMsgProcess_TASK_SIZE] __attribute__((aligned(32)));

StaticTask_t gIPCMsgProcessTaskObj;
TaskHandle_t gIPCMsgProcessTask;



//from calling functions to respective R/W Usdo req task
typedef struct    __attribute__((packed))
{
    uint32_t        remoteCoreId;
    uint16_t        localClientId;
    uint32_t        remotecoremsg;       //msg received form Remote core
}ipc_remotecoremsg;



#endif /* CIPCORE_DATASYNC_H_ */
