/*
*
*/
/*
*
*/
#ifdef CFG_ENABLE_ADBG_LOADER
#ifdef CFG_ENABLE_AUDIT_CMD
#ifndef CFG_ENABLE_WRITEBITS_CMD
#ifdef CFG_ENABLE_WRITEBITS_CMD
/* Command / ( / ) */
case COMMAND(FALSE, , ):
{
Status = (Session, );
}
break;
/* Response to / ( / ) */
case COMMAND(TRUE, , ):
{
ResponseStatus = (ErrorCode_e)get_uint32_le(&Data_p);
Status = (Session, ResponseStatus, );
}
break;
#endif
#endif
#endif
#endif
/* $Copyright$ */
/* NOTE: This is an automatically generated file. DO NOT EDIT! */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "t_command_protocol.h"
#include "r_debug.h"
#include "r_communication_service.h"
#include "commands.h"
#include "custom_commands.h"
#include "command_ids.h"
#include "commands_impl.h"
#include "error_codes.h"
#include "r_serialization.h"
#include "r_command_protocol.h"
#ifdef CFG_ENABLE_ADBG_LOADER
#include "r_adbg_applications.h"
#endif
#ifdef CFG_ENABLE_AUDIT_CMD
#include "audit.h"
#endif
#ifdef CFG_ENABLE_ADBG_LOADER
#include "r_adbg_command.h"
#endif
#define COMMAND(response, group, id) ((((int)(response)) << 30) | (((int)(group)) << 16) | ((int)(id)))
#define COMMANDDATA(TypeP,ApplicationP,CommandP,SessionP,SizeP)\
memset((uint8*)&CmdData, 0x00, sizeof(CommandData_t));\
CmdData.Type = TypeP;\
CmdData.ApplicationNr = ApplicationP;\
CmdData.CommandNr = CommandP;\
CmdData.SessionNr = SessionP;\
CmdData.Payload.Size = SizeP;\
CmdData.Payload.Data_p = NULL;\
CmdData.Payload.Data_p = (uint8*)malloc(SizeP);\
if (NULL == CmdData.Payload.Data_p)\
{\
A_(printf("command_marshal.c (%d): ** memory allocation failed! **\n",__LINE__);)\
return E_ALLOCATE_FAILED;\
}\
#define COMMANDDATAOUT(TypeP,ApplicationP,CommandP,SizeP)\
memset((uint8*)&CmdData, 0x00, sizeof(CommandData_t));\
CmdData.Type = TypeP;\
CmdData.ApplicationNr = ApplicationP;\
CmdData.CommandNr = CommandP;\
CmdData.SessionNr = 0;\
CmdData.Payload.Size = SizeP;\
CmdData.Payload.Data_p = NULL;\
if (0 != SizeP)\
{\
CmdData.Payload.Data_p = (uint8 *)malloc( SizeP);\
if (NULL == CmdData.Payload.Data_p)\
{\
A_(printf("command_marshal.c (%d): ** memory allocation failed! **\n",__LINE__);)\
return E_ALLOCATE_FAILED;\
}\
}
//static uint16 Session;
void disable_interrupt(void)
{
#ifndef WIN32
/* todo implement this */
//#warning This is disable_interrupt
#endif
}
void enable_interrupt(void)
{
#ifndef WIN32
/* todo implement this */
//#warning This is enable_interrupt
#endif
}
ErrorCode_e Do_CEH_Call(void *Object_p, CommandData_t *CmdData_p)
{
ErrorCode_e Status = E_GENERAL_FATAL_ERROR;
// uint32 PL_GRSize = 0;
ErrorCode_e ResponseStatus = E_GENERAL_FATAL_ERROR;
boolean response = FALSE;
// CommandPermissionList_t* CmdPermission_p;
void *Data_p = CmdData_p->Payload.Data_p;
uint16 Session = CmdData_p->SessionNr;
if (CmdData_p->Type == GENERAL_RESPONSE_PACKAGE)
{
response = TRUE;
// PL_GRSize = CmdData_p->Payload.Size;
// ResponseStatus = (ErrorCode_e)get_uint16(&Data_p);
}
#ifdef CFG_ENABLE_AUDIT_CMD
if(COMMAND_TYPE == CmdData_p->Type)
{
ErrorCode_e AuditResponse = CommandAudit(CmdData_p);
CommandData_t CmdData = {0};
uint32 PLSize = sizeof(ErrorCode_e);
if (E_SUCCESS != AuditResponse)
{
memset((uint8*)&CmdData, 0x00, sizeof(CommandData_t));
CmdData.Type = GENERAL_RESPONSE;
CmdData.CommandNr = CmdData_p->CommandNr;
CmdData.ApplicationNr = CmdData_p->ApplicationNr;
CmdData.SessionNr = CmdData_p->SessionNr;
CmdData.Payload.Size = PLSize;
CmdData.Payload.Data_p = NULL;
CmdData.Payload.Data_p = (uint8*)malloc(PLSize);
if (NULL == CmdData.Payload.Data_p)
{
A_(printf("command_marshal.c (%d): ** memory allocation failed! **\n",__LINE__);)
return E_ALLOCATE_FAILED;
}
Data_p = CmdData.Payload.Data_p;
put_uint32(&Data_p, AuditResponse);
Status = Do_R15_Command_Send(GlobalCommunication_p, &CmdData);
if (NULL != CmdData.Payload.Data_p)
{
free(CmdData.Payload.Data_p);
}
if (E_SUCCESS != Status)
{
return Status;
}
if (E_UNSUPPORTED_CMD == AuditResponse)
{
Status = Do_System_ShutDownImpl(CmdData.SessionNr);
}
return Status;
}
}
#endif
switch(COMMAND(response, CmdData_p->ApplicationNr, CmdData_p->CommandNr))
{
default:
{
Status = Do_CustomCEH_Call(CmdData_p);
if (E_SUCCESS != Status)
{
Status = Do_System_ShutDownImpl(Session);
}
}
break;
}
return Status;
}
#ifdef CFG_ENABLE_ADBG_LOADER
ErrorCode_e (void)
{
ErrorCode_e Answer;
CommandData_t CmdData;
void *Data_p;
uint32 PLSize =0;
COMMANDDATAOUT(COMMAND_TYPE, , , PLSize);
Data_p = CmdData.Payload.Data_p;
(void)(Data_p); //XVSZOAN Temporary solution!
Answer = Do_R15_Command_Send(GlobalCommunication_p, &CmdData);
if(NULL != CmdData.Payload.Data_p)
free(CmdData.Payload.Data_p);
return Answer;
}
ErrorCode_e (uint16 Session, ErrorCode_e Status, )
{
ErrorCode_e Answer;
CommandData_t CmdData;
void *Data_p;
uint32 PLSize =0;
PLSize += sizeof(ErrorCode_e);
COMMANDDATA(GENERAL_RESPONSE, , , Session, PLSize);
Data_p = CmdData.Payload.Data_p;
put_uint32(&Data_p, Status);
#ifdef CFG_ENABLE_ADBG_LOADER
Answer = ReleaseADbg_AppFunc(Status);
Answer = E_SUCCESS;
#else
Answer = Do_R15_Command_Send(GlobalCommunication_p, &CmdData);
#endif
if(NULL != CmdData.Payload.Data_p)
free(CmdData.Payload.Data_p);
return Answer;
}
#endif