xdebug

next generation of mdebug (work in progress)
git clone http://frotz.net/git/xdebug.git
Log | Files | Refs | README

transport-private.h (1285B)


      1 // Copyright 2023, Brian Swetland <swetland@frotz.net>
      2 // Licensed under the Apache License, Version 2.0.
      3 
      4 #pragma once
      5 
      6 #include "xdebug.h"
      7 
      8 #include <stdint.h>
      9 
     10 #include "usb.h"
     11 
     12 struct debug_context {
     13 	usb_handle* usb;
     14 	unsigned status;
     15 	uint32_t flags;
     16 
     17 	volatile uint32_t attn;
     18 	void (*status_callback)(void *cookie, uint32_t status);
     19 	void *status_cookie;
     20 
     21 	// dap protocol info
     22 	uint32_t max_packet_count;
     23 	uint32_t max_packet_size;
     24 
     25 	// dap internal state cache
     26 	uint32_t cfg_idle;
     27 	uint32_t cfg_wait;
     28 	uint32_t cfg_match;
     29 	uint32_t cfg_mask;
     30 
     31 	// configured DP.SELECT register value
     32 	uint32_t dp_select;
     33 	// last known state of DP.SELECT on the target
     34 	uint32_t dp_select_cache;
     35 
     36 	// MAP cached state
     37 	uint32_t map_csw_keep;
     38 	uint32_t map_csw_cache;
     39 	uint32_t map_tar_cache;
     40 
     41 	// transfer queue state
     42 	uint8_t txbuf[1024];
     43 	uint32_t* rxptr[256];
     44 	uint8_t *txnext;
     45 	uint32_t** rxnext;
     46 	uint32_t txavail;
     47 	uint32_t rxavail;
     48 	int qerror;
     49 };
     50 
     51 typedef struct debug_context DC;
     52 
     53 #define INVALID 0xFFFFFFFFU
     54 
     55 
     56 #if 0
     57 static void dump(const char* str, const void* ptr, unsigned len) {
     58 	const uint8_t* x = ptr;
     59 	TRACE("%s", str);
     60 	while (len > 0) {
     61 		TRACE(" %02x", *x++);
     62 		len--;
     63 	}
     64 	TRACE("\n");
     65 }
     66 #else
     67 #define dump(...) do {} while (0)
     68 #endif
     69 
     70 uint32_t dc_get_attn_value(DC* dc);
     71