arm_sfa_cmdseq.c File Reference

#include <stdlib.h>
#include <stdio.h>
#include <stdint.h>
#include <errno.h>
#include <string.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <ctype.h>
#include <unistd.h>
#include "dbg_msg.h"
#include "jt_arm.h"
#include "jt_flash.h"
#include "arm_emu.h"
#include "arm_gdbstub.h"
#include "arm_memory_mmap.h"
#include "arm_sfa_cmdseq.h"

Defines

Functions

Variables


Detailed Description

Example layout

  ______________________
 | cmdSequenceContainer |
 +----------------------+
 | numberOfCmdSequences | =2
 +----------------------+
 | firstSequence        |
 +----------------------+
           |
           |
           |
  _________Y____________       ______________________ 
 |   cmdSequenceHead    |     |   cmdSequenceHead    |
 +----------------------+     +----------------------+
 |      nextHead        |---->|       nextHead       |--->(NULL)
 +----------------------+     +----------------------+
 |   numberOfEntrys     | =3  |   numberOfEntrys     | =0
 +----------------------+     +----------------------+ 
 |  firstSequenceEntry  |     |  firstSequenceEntry  |
 +----------------------+     +----------------------+
            |                            |
            |                            Y
            |                          (NULL)
            |
  __________Y__________      _________________      _________________
 |   cmdSequence      |    |   cmdSequence   |    |   cmdSequence   |
 +--------------------+    +-----------------+    +-----------------+
 |   nextSequence     |--->|   nextSequence  |--->|   nextSequence  |--->(NULL)
 +--------------------+    +-----------------+    +-----------------+
 

Define Documentation

#define BIND_BUF_LEN   256
#define CMDSEQ_STRING_BUF_LEN   100

Referenced by readStringCmdSequence().


Function Documentation

int AllocCmdDataStore ( struct cmdDataStoreHead sh,
uint32_t **  dataStart,
int  size 
)
  ____________________
 |  cmdDataStoreHead  |
 +--------------------+ 
 |   numberOfStores   | = 3
 +--------------------+
 |     firstStore     |
 +--------------------+
           |
  _________Y__________      ______________      ______________
 |    cmdDataStore    |    | cmdDataStore |    | cmdDataStore |
 +--------------------+    +--------------+    +--------------+
 |     nextStore      |--->| nextStore    |--->| nextStore    |--->(NULL)
 +--------------------+    +--------------+    +--------------+
 

Allocate a cmdDataStore and append it at our list.

Parameters:
sh pointer to head of the store
dataStart output pointer to return start addess of allocated data
size requested data size
Return values:
0 OK
EINVAL if no head given
ENOMEM if out of memory

References cmdDataStore::data, cmdDataStoreHead::firstStore, cmdDataStore::nextStore, cmdDataStoreHead::numberOfStores, and cmdDataStore::size.

Referenced by arm_sfa_ResetCPU(), arm_sfa_StartTarget(), arm_sfa_StopTarget(), armOsabiGetCurrentTid(), armOsabiGetMinimalThreadId(), armOsabiGetSavedRegSet(), armOsabiGetTLSAddr(), armOsabiMultiThreading(), armOsabiThreadAlive(), armOsabiThreadInfo(), and doCmdSequence().

void ReleaseAllCmdDataStores ( struct cmdDataStoreHead sh  ) 
int isAValidDataStoreAddress ( struct cmdDataStoreHead sh,
uint32_t  address 
)
int AllocCmdSeqences ( int  total_number_of_cmdSequences  ) 
  ______________________
 | cmdSequenceContainer |
 +----------------------+
 | numberOfCmdSequences | = 3
 +----------------------+
 | firstSequence        |
 +----------------------+
         |
  _______Y______________      ______________________      ______________________
 |   cmdSequenceHead    |    |   cmdSequenceHead    |    |   cmdSequenceHead    |
 +----------------------+    +----------------------+    +----------------------+
 |      nextHead        |--->|       nextHead       |--->|       nextHead       |--->(NULL)
 +----------------------+    +----------------------+    +----------------------+
 

Allocate one (or more or non) Command Sequence Head's and append it (or those) at our list.

Parameters:
total_number_of_cmdSequences request a maximum number of Command Sequence Head's
Return values:
0 on success
!=0 error number

References cmdSequenceContainer::firstSequence, cmdSequenceHead::nextHead, and cmdSequenceContainer::numberOfCmdSequences.

Referenced by gdb_monitor_Rcmd().

struct cmdSequenceHead* searchCmdSequenceHead ( int  num  )  [read]

collect cmdSequenceHead number num from list

Parameters:
num number of command sequence
Return values:
NULL command sequence dosn't exist
!=NULL pointer to cmdSequenceHead

References cmdSequenceContainer::firstSequence, cmdSequenceHead::nextHead, and cmdSequenceContainer::numberOfCmdSequences.

Referenced by doCmdSequence(), gdb_monitor_Rcmd(), readaddrCmdSequence(), readStringBindingCmdSequence(), readStringCmdSequence(), and readvalCmdSequence().

int AllocCmdSequenceEntrys ( struct cmdSequenceHead sh,
int  total_num 
)
  ____________________
 |  cmdSequenceHead   |
 +--------------------+ 
 |  numberOfEntrys    | = 3
 +--------------------+
 | firstSequenceEntry |
 +--------------------+
           |
  _________Y__________      _________________      _________________
 |   cmdSequence      |    |   cmdSequence   |    |   cmdSequence   |
 +--------------------+    +-----------------+    +-----------------+
 |   nextSequence     |--->|   nextSequence  |--->|   nextSequence  |--->(NULL)
 +--------------------+    +-----------------+    +-----------------+
 

Allocate one (or more or non) command sequence entries and append it (or those) at our list.

Parameters:
total_num request a maximum number of command sequence entries
sh pointer to head of command sequence
Return values:
0 OK
EINVAL if no head given
ENOMEM if out of memory

References cmdSequenceHead::firstSequenceEntry, cmdSequence::memMapNumber, cmdSequence::nextSequence, and cmdSequenceHead::numberOfEntrys.

Referenced by gdb_monitor_Rcmd().

struct cmdSequence* searchCmdSequenceEntry ( struct cmdSequenceHead sh,
int  num 
) [read]

collect command sequence entry number (num) of cmdSequenceHead (sh) from list

Parameters:
num entry number of command sequence
sh pointer to head of command sequence
Return values:
NULL sequence entry dosn't exist
!=NULL pointer to cmdSequence entry

References cmdSequenceHead::firstSequenceEntry, cmdSequence::nextSequence, and cmdSequenceHead::numberOfEntrys.

Referenced by doCmdSequence(), readaddrCmdSequence(), readStringCmdSequence(), readvalCmdSequence(), and updateCmdSequence().

int updateCmdSequence ( struct cmdSequenceHead sh,
int  num,
uint32_t  cmdSize,
uint32_t  addr,
uint32_t  val,
enum CmdSequenceFlag  flag 
)

Update a specific command sequence entry.

Parameters:
sh pointer to Head of command sequence
num entry number within the sequence list
cmdSize bus size (should be 8,16 or 32 Bit)
addr target address
val target value
flag CMDSEQUFLAG_WRITE CMDSEQUFLAG_READ CMDSEQUFLAG_FORCE
Return values:
0 OK
EINVAL Failure

References cmdSequence::addr, cmdSequence::cmdSize, cmdSequence::flag, cmdSequence::memMap, cmdSequence::memMapNumber, cmdSequence::mov_srcSequence, searchCmdSequenceEntry(), and cmdSequence::val.

Referenced by gdb_monitor_Rcmd().

uint32_t readvalCmdSequence ( int  num,
int  entryNum 
)

Read the previous saved value of command sequence.

Parameters:
num command sequence number
entryNum entry number within the sequence list
Returns:
32-bit saved value of sequence entry

References cmdSequenceHead::numberOfEntrys, searchCmdSequenceEntry(), searchCmdSequenceHead(), and cmdSequence::val.

Referenced by gdb_monitor_Rcmd().

uint32_t readaddrCmdSequence ( int  num,
int  entryNum 
)

Read the defined address of a command sequence.

Parameters:
num command sequence number
entryNum entry number within the sequence list
Returns:
32-bit address of sequence entry

References cmdSequence::addr, cmdSequenceHead::numberOfEntrys, searchCmdSequenceEntry(), and searchCmdSequenceHead().

Referenced by gdb_monitor_Rcmd().

char* readStringBindingCmdSequence ( int  num  ) 
char* readStringCmdSequence ( int  num,
int  entryNum 
)
int doCmdSequence ( int  num,
struct cmdCallStack callStack 
)

Execute command sequence number "num" .

   cmd[0] 

Run through all entries of the command sequence list "cmdSequence" and if the CmdSequenceFlag of the entry is set to CMDSEQUFLAG_WRITE then write each value to its address, or read out the value and keep it in an entry variable.
The address should be inside of a SFA-MemMap.
If the flag CMDSEQUFLAG_FORCE is set all kind of defined MemMap's (except MMAP_T_UNUSED, MMAP_T_UNREAL or MMAP_T_CACHE) can be used.

Parameters:
num command sequence number
callStack pointer to context of caller
Return values:
0 OK
!= 0 Failure ->EINVAL,ENOTSUP,EOVERFLOW,EFAULT,EACCES

References cmdSequence::addr, AllocCmdDataStore(), cmdCallStack::arg, arm_emu_add(), arm_emu_lsl(), arm_emu_lsr(), arm_emu_ror(), arm_emu_sub(), arm_recalculate_flags_Z_N(), CMDSEQUFLAG_ACCESS_FLAG, CMDSEQUFLAG_ADD, CMDSEQUFLAG_ADDRREF, CMDSEQUFLAG_ALIVE, CMDSEQUFLAG_ALLOC, CMDSEQUFLAG_AND, CMDSEQUFLAG_CALL, CMDSEQUFLAG_CALL_FLAG, CMDSEQUFLAG_CALLWVAR, CMDSEQUFLAG_DIV, CMDSEQUFLAG_DUPARG, CMDSEQUFLAG_DUPRETVAL, CMDSEQUFLAG_DUPVAR, CMDSEQUFLAG_EXPORT_DATA_STORE, CMDSEQUFLAG_FORCE, CMDSEQUFLAG_INTERNAL, CMDSEQUFLAG_JMP_COND_MSK, CMDSEQUFLAG_JMP_FLAG, CMDSEQUFLAG_LSL, CMDSEQUFLAG_LSR, CMDSEQUFLAG_MOV, CMDSEQUFLAG_MUL, CMDSEQUFLAG_NOT, CMDSEQUFLAG_OR, CMDSEQUFLAG_RDWR_MSK, CMDSEQUFLAG_RETURN, CMDSEQUFLAG_ROR, CMDSEQUFLAG_SETVAR, CMDSEQUFLAG_SUB, CMDSEQUFLAG_SUBREV, CMDSEQUFLAG_VALREF, CMDSEQUFLAG_WRITE, CMDSEQUFLAG_XOR, cmdSequence::cmdSize, DBG_LEVEL_GDB_ARM_INFO, DBG_LEVEL_GDB_ARM_WARN, dbgPrintf(), cmdSequence::entryNum, findMemMapOfAddr(), cmdSequenceHead::firstSequenceEntry, cmdSequence::flag, gdb_rcmd_console_output(), isAValidDataStoreAddress(), jt_arm_condition_check(), jtag_arm_ReadByte(), jtag_arm_ReadHalfword(), jtag_arm_ReadWord(), jtag_arm_WriteByte(), jtag_arm_WriteHalfword(), jtag_arm_WriteWord(), cmdSequence::memMap, cmdSequence::memMapNumber, MMAP_T_CACHE, MMAP_T_SFA, MMAP_T_UNREAL, MMAP_T_UNUSED, cmdSequence::mov_dstSequence, cmdSequence::mov_srcSequence, cmdSequence::nextSequence, cmdSequenceHead::numberOfEntrys, cmdSequence::pre_jmpSequence, ReleaseAllCmdDataStores(), cmdCallStack::retVal, searchCmdSequenceEntry(), searchCmdSequenceHead(), cmdCallStack::store, memMap::type, and cmdSequence::val.

Referenced by arm_sfa_ResetCPU(), arm_sfa_StartTarget(), arm_sfa_StopTarget(), armOsabiGetCurrentTid(), armOsabiGetMinimalThreadId(), armOsabiGetSavedRegSet(), armOsabiGetTLSAddr(), armOsabiMultiThreading(), armOsabiThreadAlive(), armOsabiThreadInfo(), and gdb_monitor_Rcmd().

void arm_sfa_StartTarget ( void   ) 
void arm_sfa_StopTarget ( void   ) 
void arm_sfa_ResetCPU ( void   ) 

Variable Documentation

struct cmdDataStoreHead globalStore = {0, NULL}

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.