#ifndef XC_PTRACE_ #define XC_PTRACE_ #define X86_CR0_PE 0x00000001 /* Enable Protected Mode (RW) */ #define X86_CR0_PG 0x80000000 /* Paging (RW) */ #define BSD_PAGE_MASK (PAGE_SIZE-1) #define PSL_T 0x00000100 /* trace enable bit */ #ifdef __x86_64__ struct gdb_regs { unsigned long r15; unsigned long r14; unsigned long r13; unsigned long r12; unsigned long rbp; unsigned long rbx; unsigned long r11; unsigned long r10; unsigned long r9; unsigned long r8; unsigned long rax; unsigned long rcx; unsigned long rdx; unsigned long rsi; unsigned long rdi; unsigned long orig_rax; unsigned long rip; unsigned long xcs; unsigned long rflags; unsigned long rsp; unsigned long xss; unsigned long fs_base; unsigned long gs_base; unsigned long xds; unsigned long xes; unsigned long xfs; unsigned long xgs; }; #define SET_PT_REGS(pt, xc) \ { \ pt.r8 = xc.r8; \ pt.r9 = xc.r9; \ pt.r10 = xc.r10; \ pt.r11 = xc.r11; \ pt.r12 = xc.r12; \ pt.r13 = xc.r13; \ pt.r14 = xc.r14; \ pt.r15 = xc.r15; \ pt.rbx = xc.rbx; \ pt.rcx = xc.rcx; \ pt.rdx = xc.rdx; \ pt.rsi = xc.rsi; \ pt.rdi = xc.rdi; \ pt.rbp = xc.rbp; \ pt.rax = xc.rax; \ pt.rip = xc.rip; \ pt.xcs = xc.cs; \ pt.rflags = xc.rflags; \ pt.rsp = xc.rsp; \ pt.xss = xc.ss; \ pt.xes = xc.es; \ pt.xds = xc.ds; \ pt.xfs = xc.fs; \ pt.xgs = xc.gs; \ } #define SET_XC_REGS(pt, xc) \ { \ xc.r8 = pt->r8; \ xc.r9 = pt->r9; \ xc.r10 = pt->r10; \ xc.r11 = pt->r11; \ xc.r12 = pt->r12; \ xc.r13 = pt->r13; \ xc.r14 = pt->r14; \ xc.r15 = pt->r15; \ xc.rbx = pt->rbx; \ xc.rcx = pt->rcx; \ xc.rdx = pt->rdx; \ xc.rsi = pt->rsi; \ xc.rdi = pt->rdi; \ xc.rbp = pt->rbp; \ xc.rax = pt->rax; \ xc.rip = pt->rip; \ xc.cs = pt->xcs; \ xc.rflags = pt->rflags & 0xffffffff; \ xc.rsp = pt->rsp; \ xc.ss = pt->xss; \ xc.es = pt->xes; \ xc.ds = pt->xds; \ xc.fs = pt->xfs; \ xc.gs = pt->xgs; \ } #elif __i386__ struct gdb_regs { long ebx; /* 0 */ long ecx; /* 4 */ long edx; /* 8 */ long esi; /* 12 */ long edi; /* 16 */ long ebp; /* 20 */ long eax; /* 24 */ int xds; /* 28 */ int xes; /* 32 */ int xfs; /* 36 */ int xgs; /* 40 */ long orig_eax; /* 44 */ long eip; /* 48 */ int xcs; /* 52 */ long eflags; /* 56 */ long esp; /* 60 */ int xss; /* 64 */ }; #define SET_PT_REGS(pt, xc) \ { \ pt.ebx = xc.ebx; \ pt.ecx = xc.ecx; \ pt.edx = xc.edx; \ pt.esi = xc.esi; \ pt.edi = xc.edi; \ pt.ebp = xc.ebp; \ pt.eax = xc.eax; \ pt.eip = xc.eip; \ pt.xcs = xc.cs; \ pt.eflags = xc.eflags; \ pt.esp = xc.esp; \ pt.xss = xc.ss; \ pt.xes = xc.es; \ pt.xds = xc.ds; \ pt.xfs = xc.fs; \ pt.xgs = xc.gs; \ } #define SET_XC_REGS(pt, xc) \ { \ xc.ebx = pt->ebx; \ xc.ecx = pt->ecx; \ xc.edx = pt->edx; \ xc.esi = pt->esi; \ xc.edi = pt->edi; \ xc.ebp = pt->ebp; \ xc.eax = pt->eax; \ xc.eip = pt->eip; \ xc.cs = pt->xcs; \ xc.eflags = pt->eflags; \ xc.esp = pt->esp; \ xc.ss = pt->xss; \ xc.es = pt->xes; \ xc.ds = pt->xds; \ xc.fs = pt->xfs; \ xc.gs = pt->xgs; \ } #endif #endif /* XC_PTRACE */ > 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111
/*
LUFA Library
Copyright (C) Dean Camera, 2017.
dean [at] fourwalledcubicle [dot] com
www.lufa-lib.org
*/
/*
Copyright 2017 Dean Camera (dean [at] fourwalledcubicle [dot] com)
Copyright 2012 Simon Foster (simon.foster [at] inbox [dot] com)
Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
permission notice and warranty disclaimer appear in supporting
documentation, and that the name of the author not be used in
advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaims all warranties with regard to this
software, including all implied warranties of merchantability
and fitness. In no event shall the author be liable for any
special, indirect or consequential damages or any damages
whatsoever resulting from loss of use, data or profits, whether
in an action of contract, negligence or other tortious action,
arising out of or in connection with the use or performance of
this software.
*/
/** \file
*
* Header file for Descriptors.c.
*/
#ifndef _DESCRIPTORS_H_
#define _DESCRIPTORS_H_
/* Includes: */
#include <avr/pgmspace.h>
#include <LUFA/Drivers/USB/USB.h>
/* Macros: */
/** Endpoint address of the CDC device-to-host notification IN endpoint. */
#define CDC_NOTIFICATION_EPADDR (ENDPOINT_DIR_IN | 2)
/** Endpoint address of the CDC device-to-host data IN endpoint. */
#define CDC_TX_EPADDR (ENDPOINT_DIR_IN | 3)
/** Endpoint address of the CDC host-to-device data OUT endpoint. */
#define CDC_RX_EPADDR (ENDPOINT_DIR_OUT | 4)
/** Size in bytes of the CDC device-to-host notification IN endpoint. */
#define CDC_NOTIFICATION_EPSIZE 8
/** Size in bytes of the CDC data IN and OUT endpoints. */
#define CDC_TXRX_EPSIZE 16
/* Type Defines: */
/** Type define for the device configuration descriptor structure. This must be defined in the
* application code, as the configuration descriptor contains several sub-descriptors which
* vary between devices, and which describe the device's usage to the host.
*/
typedef struct
{
USB_Descriptor_Configuration_Header_t Config;
// CDC Command Interface
USB_Descriptor_Interface_t CDC_CCI_Interface;
USB_CDC_Descriptor_FunctionalHeader_t CDC_Functional_Header;
USB_CDC_Descriptor_FunctionalACM_t CDC_Functional_ACM;
USB_CDC_Descriptor_FunctionalUnion_t CDC_Functional_Union;
USB_Descriptor_Endpoint_t CDC_NotificationEndpoint;
// CDC Data Interface
USB_Descriptor_Interface_t CDC_DCI_Interface;
USB_Descriptor_Endpoint_t CDC_DataOutEndpoint;
USB_Descriptor_Endpoint_t CDC_DataInEndpoint;
} USB_Descriptor_Configuration_t;
/** Enum for the device interface descriptor IDs within the device. Each interface descriptor
* should have a unique ID index associated with it, which can be used to refer to the
* interface from other descriptors.
*/
enum InterfaceDescriptors_t
{
INTERFACE_ID_CDC_CCI = 0, /**< CDC CCI interface descriptor ID */
INTERFACE_ID_CDC_DCI = 1, /**< CDC DCI interface descriptor ID */
};
/** Enum for the device string descriptor IDs within the device. Each string descriptor should
* have a unique ID index associated with it, which can be used to refer to the string from
* other descriptors.
*/
enum StringDescriptors_t
{
STRING_ID_Language = 0, /**< Supported Languages string descriptor ID (must be zero) */
STRING_ID_Manufacturer = 1, /**< Manufacturer string ID */
STRING_ID_Product = 2, /**< Product string ID */
};
/* Function Prototypes: */
uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue,
const uint16_t wIndex,
const void** const DescriptorAddress)
ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3);
#endif