Skip to content

Commit

Permalink
Moved SW-DP logic out of SWDInterface to a separate ARMSWDDebugPort c…
Browse files Browse the repository at this point in the history
…lass
  • Loading branch information
azonenberg committed Sep 10, 2018
1 parent bd10056 commit 34f7f09
Show file tree
Hide file tree
Showing 3 changed files with 84 additions and 7 deletions.
46 changes: 46 additions & 0 deletions ARMSWDDebugPort.h
@@ -0,0 +1,46 @@
/***********************************************************************************************************************
* *
* ANTIKERNEL v0.1 *
* *
* Copyright (c) 2012-2018 Andrew D. Zonenberg *
* All rights reserved. *
* *
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the *
* following conditions are met: *
* *
* * Redistributions of source code must retain the above copyright notice, this list of conditions, and the *
* following disclaimer. *
* *
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the *
* following disclaimer in the documentation and/or other materials provided with the distribution. *
* *
* * Neither the name of the author nor the names of any contributors may be used to endorse or promote products *
* derived from this software without specific prior written permission. *
* *
* THIS SOFTWARE IS PROVIDED BY THE AUTHORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED *
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL *
* THE AUTHORS BE HELD LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES *
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR *
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE *
* POSSIBILITY OF SUCH DAMAGE. *
* *
***********************************************************************************************************************/

/**
@file
@author Andrew D. Zonenberg
@brief Declaration of ARMSWDDebugPort.h
*/
#ifndef ARMSWDDebugPort.h
#define ARMSWDDebugPort.h

/**
@brief An ARM debug port connected over SWD. May be either a SW-DP or SWJ-DP.
*/
class ARMSWDDebugPort : public ARMDebugPort
{
public:
};

#endif
18 changes: 15 additions & 3 deletions SWDInterface.cpp
Expand Up @@ -45,7 +45,7 @@ SWDInterface::SWDInterface()
SWDInterface::~SWDInterface()
{
}

/*
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// AP/DP register access
Expand All @@ -71,10 +71,22 @@ void SWDInterface::APRegisterWrite(uint8_t ap, ApReg addr, uint32_t wdata)
WriteWord(addr*4, true, wdata); //convert from register ID to actual address offset
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Memory access etc
uint32_t SWDInterface::ReadMemory(uint32_t address)
{
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Autodetection
*/
void SWDInterface::InitializeChain(bool /*quiet*/)
{

void SWDInterface::InitializeDevice()
}

void SWDInterface::PrintStatusRegister()
{
//Read the

}
27 changes: 23 additions & 4 deletions SWDInterface.h
Expand Up @@ -55,8 +55,7 @@
\li GetUserID()
\li GetFrequency()
*/
class SWDInterface : public ARMDebugPort
, public TestInterface
class SWDInterface : public TestInterface
{
public:
SWDInterface();
Expand All @@ -66,18 +65,38 @@ class SWDInterface : public ARMDebugPort

//Setup stuff
public:
virtual void PrintStatusRegister();

/**
@brief Reset the bus interface upon connecting to the target
*/
virtual void ResetInterface() =0;

//Debug interface
public:
/*
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Memory access via AHB
///Read a single 32-bit word of memory (TODO support smaller sizes)
virtual uint32_t ReadMemory(uint32_t address);
///Writes a single 32-bit word of memory (TODO support smaller sizes)
virtual void WriteMemory(uint32_t address, uint32_t value);
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Debug register access via APB
virtual uint32_t ReadDebugRegister(uint32_t address);
virtual void WriteDebugRegister(uint32_t address, uint32_t value);
*/
//Raw SWD read/write
protected:
/*
virtual uint32_t DPRegisterRead(DpReg addr);
virtual void DPRegisterWrite(DpReg addr, uint32_t wdata);
virtual uint32_t APRegisterRead(uint8_t ap, ApReg addr);
virtual void APRegisterWrite(uint8_t ap, ApReg addr, uint32_t wdata);
virtual void APRegisterWrite(uint8_t ap, ApReg addr, uint32_t wdata);*/

/**
@brief Performs a SW-DP write transaction
Expand All @@ -97,7 +116,7 @@ class SWDInterface : public ARMDebugPort
/**
@brief Connects to the interface and figures out what we have attached to us
*/
virtual void InitializeDevice();
virtual void InitializeChain(bool quiet = false);
};

#endif

0 comments on commit 34f7f09

Please sign in to comment.