/** @file
Transfer protocol defintions used by debug agent and host. It is only
intended to be used by Debug related module implementation.
Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#ifndef __TRANSFER_PROTOCOL_H__
#define __TRANSFER_PROTOCOL_H__
#include "ProcessorContext.h"
#include "SoftDebuggerDefinitions.h"
//
// Definitions for break command.
//
//
// Definition for starting symbol of a normal debug packet. Choose a non-ASCII to avoid conflict with other serial output.
//
#pragma pack(1)
//
// Definition for common header for normal debug packets (not including break command)
//
typedef struct {
//
// Structure to facilitate debug packet header parsing or construction
//
typedef struct {
//
// Definition for Command field for debug packets
//
//
// The below are target side initiated commands.
//
//
// The below 2 commands are used when transferring big data (like > ~250 bytes). The sequence is:
// Host Macine Target Macine
// Request =>
// <= IN_PROGRESS with part of the data
// CONTINUE =>
// (could have multiple IN_PROGRESS and CONTINUE interactions)
// <= OK with the last part of data
// OK (no data as ACK) =>
//
#define DEBUG_COMMAND_CONTINUE (DEBUG_COMMAND_RESPONSE | 4) // Used when trying to transfer big data (like > ~250 bytes)
//
// The below 2 commands are used to support deferred halt. HALT_DEFERRED will be returned when a halt request received while target is already in inter-active mode.
// HALT_PROCESSED will be return as a possible return value for GO command, if target has a pending halt request.
//
//
// Definition for data field for debug packets
//
#define DEBUG_DATA_UPPER_LIMIT 0xff // This is the upper limit for the data size, by the limit of the packet header definition.
//
// Response data for DEBUG_COMMAND_BREAK_CAUSE
//
typedef struct {
//
// Break type defintions for DEBUG_DATA_BREAK_CAUSE
//
#define DEBUG_DATA_BREAK_CAUSE_UNKNOWN 0
//
// Response data for DEBUG_COMMAND_ARCH_MODE, defined as SOFT_DEBUGGER_PROCESSOR_...
//
typedef struct {
//
// Cpu architecture defintions for DEBUG_DATA_RESPONSE_ARCH_MODE
//
#define DEBUG_DATA_BREAK_CPU_ARCH_IA16 0
//
// Command and response data for DEBUG_COMMAND_XX_YY_BREAKPOINT
//
typedef struct {
//
// Command data for DEBUG_COMMAND_SET_HW_BREAKPOINT
//
typedef struct {
//
// Command data for DEBUG_COMMAND_CLEAR_HW_BREAKPOINT
//
typedef struct {
//
// Command data for DEBUG_COMMAND_SET_SW_BREAKPOINT
//
typedef struct {
//
// Response data for DEBUG_COMMAND_SET_SW_BREAKPOINT
//
typedef struct {
//
// Command data for DEBUG_COMMAND_CLEAR_SW_BREAKPOINT
//
//
// Command data for DEBUG_COMMAND_READ_MEMORY_XX
//
typedef struct {
//
// Command data for DEBUG_COMMAND_WRITE_MEMORY_XX
//
typedef struct {
//
// Command data for DEBUG_COMMAND_READ_IO
//
typedef struct {
//
// Response data for DEBUG_COMMAND_READ_IO
//
typedef struct {
//
// Command data for DEBUG_COMMAND_WRITE_IO
//
typedef struct {
//
// Command data for DEBUG_COMMAND_READ_REGISTER
//
typedef struct {
//
// Command data for DEBUG_COMMAND_WRITE_REGISTER
//
typedef struct {
//
// Command data for DEBUG_COMMAND_READ_MSR
//
typedef struct {
//
// Response data for DEBUG_COMMAND_READ_MSR
//
typedef struct {
//
// Command data for DEBUG_COMMAND_WRITE_MSR
//
typedef struct {
//
// Command data for DEBUG_COMMAND_READ_REGISTER_GROUP
//
typedef struct {
// For possible values, refer to the definition for DEBUG_DEFINITION_REGISTER_GROUP_XXX (in another .h file as it is architecture specific)
//
// Response data for DEBUG_COMMAND_GET_REVISION
//
typedef struct {
//
// Response data for DEBUG_COMMAND_GET_EXCEPTION
//
typedef struct {
typedef struct {
//
// Command data for DEBUG_COMMAND_SET_DEBUG_FLAG
//
typedef struct {
//
// Command data for DEBUG_COMMAND_SET_VIEWPOINT
// If viewpoint is changed successfully, DEBUG_COMMAND_OK will be returned.
// If viewpoint is not availabe, DEBUG_COMMAND_NOT_SUPPORTED will be returned.
//
typedef struct {
//
// Response data for DEBUG_COMMAND_GET_VIEWPOINT
//
typedef struct {
#pragma pack()
#define DEBUG_PACKET_CONSTRUCTOR_WITH_DATA(DebugPacket,ShortCommandType, DebugPacketDataPointer, PacketLength) \
*DebugPacketDataPointer = (DEBUG_DATA_##ShortCommandType *)((DEBUG_COMMAND_HEADER *)DebugPacket+1); \
#endif