arm_gdbstub_callback.c File Reference

#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
#include <stdint.h>
#include <errno.h>
#include <unistd.h>
#include "dbg_msg.h"
#include "jt_arm.h"
#include "jt_flash.h"
#include "arm_gdbstub.h"
#include "arm_gdbstub_callback.h"
#include "arm_memory_mmap.h"

Functions

Variables


Detailed Description


Function Documentation

struct cmdCallbackEntry* allocateCmdCallbackEntry ( int  byteSizeOfExtraContext  )  [read]
  __________________
 | cmdCallbackEntry |
 +------------------+      +----------------+
 | context          | ---> | context buffer |
 +------------------+      +----------------+
 (we are using callback stuff instead of multi threading)
 Allocate memory at HEAP Space for new callback entry.
 Also allocate space for its context (if required).
 
Parameters:
byteSizeOfExtraContext size for additional context (in bytes)
Returns:
pointer to new memory

References cmdCallbackEntry::context.

Referenced by activateMemCleanUp(), checkFlashCB_read_sector(), eraseFlashCB_sector(), ftdiBlink(), ftdiBlinkStopCB(), gdb_flash_auto_programming(), gdb_monitor_Rcmd(), memCleanUpCB(), printmemMapCB_info(), programFlashCB_write_sector(), and verifyFlashCB_read_sector().

void freeCmdCallbackEntry ( struct cmdCallbackEntry cb  ) 

Free previous allocated callback entry and its context buffer.

Parameters:
cb pointer to callback entry.
Returns:
-

References cmdCallbackEntry::context.

Referenced by doCallback(), and removeAllCallbacks().

void inQueueCmdCallbackEntry ( struct cmdCallbackEntry entry,
int(*)(int arg, int cnt, struct context *context)  fntCB,
int  argSrc,
int  cntSrc,
struct context *  contextSrc,
int  contextSize 
)

Append a callback entry at the end of a list.
Also update a copy of all entry elements needed for later callback.
(if a context exist, then allocate a new buffer and copy all elements to it)

Parameters:
entry pointer to callback entry
fntCB function that should be called
argSrc first functions argument
cntSrc second functions argument
contextSrc last functions argument (pointer to more data)
contextSize size of additional context data
Returns:
-

References cmdCallbackEntry::arg, cmdCallbackEntry::cnt, cmdCallbackEntry::context, cmdCallbackEntry::fntCB, cmdCallbackEntry::nextCBentry, and cmdCallbackEntry::prevCBentry.

Referenced by activateMemCleanUp(), checkFlashCB_read_sector(), eraseFlashCB_sector(), ftdiBlink(), ftdiBlinkStopCB(), gdb_flash_auto_programming(), gdb_monitor_Rcmd(), memCleanUpCB(), printmemMapCB_info(), programFlashCB_write_sector(), and verifyFlashCB_read_sector().

struct cmdCallbackEntry* deQueueCmdCallbackEntry ( void   )  [read]

collect first entry from list and remove it from the list.

Parameters:
- 
Returns:
pointer to first callback entry (or NULL)

References cmdCallbackEntry::nextCBentry, and cmdCallbackEntry::prevCBentry.

Referenced by doCallback(), and removeAllCallbacks().

int doCallback ( void   ) 

Call the oldest function with its arguments from the callback list.
(free also unneeded memory space)

Parameters:
- 
Return values:
0 OK
>=0 function return value
<0 ERROR

References cmdCallbackEntry::arg, cmdCallbackEntry::cnt, cmdCallbackEntry::context, deQueueCmdCallbackEntry(), cmdCallbackEntry::fntCB, and freeCmdCallbackEntry().

Referenced by gdb_main_loop(), gdb_write_data_to_console(), getDebugChar(), jtag_test(), putDebugChar(), and putpacket().

void removeAllCallbacks ( void   ) 

remove all existing callback entries

Parameters:
- 
Returns:
-

References deQueueCmdCallbackEntry(), and freeCmdCallbackEntry().

Referenced by gdb_handle_exception(), and gdb_write_data_to_console().

struct gdbSprintfBuf* allocateGdbSprintfBuf ( int  size_of_string  )  [read]
  _______________
 | gdbSprintfBuf |
 +---------------+      +---------------+
 | string        | ---> | string buffer |
 +---------------+      +---------------+
 Allocate string message buffer space.
 
Parameters:
size_of_string 
Returns:
pointer to gdbSprintfBuf message entry

References BUFMAX, gdbSprintfBuf::len, gdbSprintfBuf::next, and gdbSprintfBuf::string.

Referenced by checkActionNext(), checkFlashCB_read_sector(), eraseFlashCB_sector(), gdb_flash_auto_programming(), gdb_handle_console_io(), gdb_main_loop(), InsertBreakpoint(), printmemMapCB_info(), programFlashCB_write_sector(), and verifyFlashCB_read_sector().

void freeGdbSprintfBuf ( struct gdbSprintfBuf buf  ) 

free gdbSprintfBuf entry and its string buffer.

Parameters:
buf pointer to gdbSprintfBuf message entry
Returns:
-

References gdbSprintfBuf::string.

Referenced by gdb_write_data_to_console(), and packGdbSprintBuf().

void inQueueGdbSprintfBuf ( struct gdbSprintfBuf buf  ) 
struct gdbSprintfBuf* deQueueGdbSprintfBuf ( void   )  [read]

collect head of queue and remove head from queue

Returns:
head

References gdbSprintfBufContainer::first, gdbSprintfBufContainer::last, and gdbSprintfBuf::next.

Referenced by gdb_write_data_to_console().

void packGdbSprintBuf ( void   ) 
void gdbPrintf ( int  set_pending_action,
int  doInQueue,
struct gdbSprintfBuf msg_buf,
const char *  format,
  ... 
)

Printf wrapper

  • append a printf alike formatted string to the message buffer entry
  • update pending_action (only if not equal CB_ACTION_NON)
  • update stopTime but only if pending_action equal CB_ACTION_TERMINATE
  • if doInQueue != 0 also inQueue the message entry
Parameters:
set_pending_action side effect set memMapContainer.memStat.pending
doInQueue !=0 inQueue; ==0 don't inQueue
msg_buf pointer to gdbSprintfBuf message entry
format,... printf alike format
Returns:
-

References BUFMAX, CB_ACTION_NON, CB_ACTION_TERMINATE, DBG_LEVEL_GDB_ARM_INFO, IF_DBG, inQueueGdbSprintfBuf(), gdbSprintfBuf::len, and gdbSprintfBuf::string.

Referenced by checkActionNext(), checkFlashCB_read_sector(), eraseFlashCB_sector(), gdb_flash_auto_programming(), gdb_handle_console_io(), gdb_main_loop(), InsertBreakpoint(), printmemMapCB_info(), programFlashCB_write_sector(), and verifyFlashCB_read_sector().


Variable Documentation


This file is part of the documentation for JTAG-GDB Server for ARM .

Generated on Mon Feb 15 21:23:21 2010 by doxygen 1.6.2.