/* SPDX-License-Identifier: GPL-2.0-or-later *//*************************************************************************** * Copyright (C) 2009 by Simon Qian <SimonQian@SimonQian.com> * ***************************************************************************//* ... */#ifndefOPENOCD_JTAG_DRIVERS_VERSALOON_VERSALOON_INCLUDE_H#defineOPENOCD_JTAG_DRIVERS_VERSALOON_VERSALOON_INCLUDE_H#include"helper/system.h"/* This file is used to include different header and macros *//* according to different platform */#include<jtag/interface.h>#include<jtag/commands.h>#definePARAM_CHECK1#definesleep_ms(ms)jtag_sleep((ms)*1000)#defineTO_STR(name)#name#defineRESULTint#defineLOG_BUGLOG_ERROR/* Common error messages */#defineERRMSG_NOT_ENOUGH_MEMORY"Lack of memory."#defineERRCODE_NOT_ENOUGH_MEMORYERROR_FAIL#defineERRMSG_INVALID_VALUE"%d is invalid for %s."#defineERRMSG_INVALID_INDEX"Index %d is invalid for %s."#defineERRMSG_INVALID_USAGE"Invalid usage of %s"#defineERRMSG_INVALID_TARGET"Invalid %s"#defineERRMSG_INVALID_PARAMETER"Invalid parameter of %s."#defineERRMSG_INVALID_INTERFACE_NUM"invalid interface %d"#defineERRMSG_INVALID_BUFFER"Buffer %s is not valid."#defineERRCODE_INVALID_BUFFERERROR_FAIL#defineERRCODE_INVALID_PARAMETERERROR_FAIL#defineERRMSG_NOT_SUPPORT_BY"%s is not supported by %s."#defineERRMSG_FAILURE_OPERATION"Fail to %s."#defineERRMSG_FAILURE_OPERATION_MESSAGE"Fail to %s, %s"#defineERRCODE_FAILURE_OPERATIONERROR_FAIL#defineGET_U16_MSBFIRST(p)(((*((uint8_t*)(p)+0))<<8)|\((*((uint8_t*)(p)+1))<<0))...#defineGET_U32_MSBFIRST(p)(((*((uint8_t*)(p)+0))<<24)|\((*((uint8_t*)(p)+1))<<16)|\((*((uint8_t*)(p)+2))<<8)|\((*((uint8_t*)(p)+3))<<0))...#defineGET_U16_LSBFIRST(p)(((*((uint8_t*)(p)+0))<<0)|\((*((uint8_t*)(p)+1))<<8))...#defineGET_U32_LSBFIRST(p)(((*((uint8_t*)(p)+0))<<0)|\((*((uint8_t*)(p)+1))<<8)|\((*((uint8_t*)(p)+2))<<16)|\((*((uint8_t*)(p)+3))<<24))...#defineSET_U16_MSBFIRST(p,v)\do{\*((uint8_t*)(p)+0)=(((uint16_t)(v))>>8)&0xFF;\*((uint8_t*)(p)+1)=(((uint16_t)(v))>>0)&0xFF;\...}while(0)...#defineSET_U32_MSBFIRST(p,v)\do{\*((uint8_t*)(p)+0)=(((uint32_t)(v))>>24)&0xFF;\*((uint8_t*)(p)+1)=(((uint32_t)(v))>>16)&0xFF;\*((uint8_t*)(p)+2)=(((uint32_t)(v))>>8)&0xFF;\*((uint8_t*)(p)+3)=(((uint32_t)(v))>>0)&0xFF;\...}while(0)...#defineSET_U16_LSBFIRST(p,v)\do{\*((uint8_t*)(p)+0)=(((uint16_t)(v))>>0)&0xFF;\*((uint8_t*)(p)+1)=(((uint16_t)(v))>>8)&0xFF;\...}while(0)...#defineSET_U32_LSBFIRST(p,v)\do{\*((uint8_t*)(p)+0)=(((uint32_t)(v))>>0)&0xFF;\*((uint8_t*)(p)+1)=(((uint32_t)(v))>>8)&0xFF;\*((uint8_t*)(p)+2)=(((uint32_t)(v))>>16)&0xFF;\*((uint8_t*)(p)+3)=(((uint32_t)(v))>>24)&0xFF;\...}while(0)...#defineGET_LE_U16(p)GET_U16_LSBFIRST(p)#defineGET_LE_U32(p)GET_U32_LSBFIRST(p)#defineGET_BE_U16(p)GET_U16_MSBFIRST(p)#defineGET_BE_U32(p)GET_U32_MSBFIRST(p)#defineSET_LE_U16(p,v)SET_U16_LSBFIRST(p,v)#defineSET_LE_U32(p,v)SET_U32_LSBFIRST(p,v)#defineSET_BE_U16(p,v)SET_U16_MSBFIRST(p,v)#defineSET_BE_U32(p,v)SET_U32_MSBFIRST(p,v)36 defines/* ... */#endif/* OPENOCD_JTAG_DRIVERS_VERSALOON_VERSALOON_INCLUDE_H */