| 1 |
63 |
julius |
// ----------------------------------------------------------------------------
|
| 2 |
|
|
|
| 3 |
|
|
// GDB Server Utilties: definition
|
| 4 |
|
|
|
| 5 |
|
|
// Copyright (C) 2008 Embecosm Limited <info@embecosm.com>
|
| 6 |
|
|
|
| 7 |
|
|
// Contributor Jeremy Bennett <jeremy.bennett@embecosm.com>
|
| 8 |
|
|
|
| 9 |
|
|
// This file is part of the cycle accurate model of the OpenRISC 1000 based
|
| 10 |
|
|
// system-on-chip, ORPSoC, built using Verilator.
|
| 11 |
|
|
|
| 12 |
|
|
// This program is free software: you can redistribute it and/or modify it
|
| 13 |
|
|
// under the terms of the GNU Lesser General Public License as published by
|
| 14 |
|
|
// the Free Software Foundation, either version 3 of the License, or (at your
|
| 15 |
|
|
// option) any later version.
|
| 16 |
|
|
|
| 17 |
|
|
// This program is distributed in the hope that it will be useful, but WITHOUT
|
| 18 |
|
|
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
| 19 |
|
|
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
|
| 20 |
|
|
// License for more details.
|
| 21 |
|
|
|
| 22 |
|
|
// You should have received a copy of the GNU Lesser General Public License
|
| 23 |
|
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
| 24 |
|
|
|
| 25 |
|
|
// ----------------------------------------------------------------------------
|
| 26 |
|
|
|
| 27 |
|
|
// $Id: Utils.h 324 2009-03-07 09:42:52Z jeremy $
|
| 28 |
|
|
|
| 29 |
|
|
#ifndef UTILS_H
|
| 30 |
|
|
#define UTILS_H
|
| 31 |
|
|
|
| 32 |
|
|
#include <stdint.h>
|
| 33 |
|
|
|
| 34 |
|
|
//-----------------------------------------------------------------------------
|
| 35 |
|
|
//! A class offering a number of convenience utilities for the GDB Server.
|
| 36 |
|
|
|
| 37 |
|
|
//! All static functions. This class is not intended to be instantiated.
|
| 38 |
|
|
//-----------------------------------------------------------------------------
|
| 39 |
462 |
julius |
class Utils {
|
| 40 |
63 |
julius |
public:
|
| 41 |
|
|
|
| 42 |
462 |
julius |
static uint8_t char2Hex(int c);
|
| 43 |
|
|
static const char hex2Char(uint8_t d);
|
| 44 |
|
|
static void reg2Hex(uint32_t val, char *buf);
|
| 45 |
|
|
static uint32_t hex2Reg(char *buf);
|
| 46 |
|
|
static void ascii2Hex(char *dest, char *src);
|
| 47 |
|
|
static void hex2Ascii(char *dest, char *src);
|
| 48 |
|
|
static int rspUnescape(char *buf, int len);
|
| 49 |
|
|
static uint32_t htotl(uint32_t hostVal);
|
| 50 |
|
|
static uint32_t ttohl(uint32_t targetVal);
|
| 51 |
63 |
julius |
|
| 52 |
|
|
private:
|
| 53 |
|
|
|
| 54 |
462 |
julius |
// Private constructor cannot be instantiated
|
| 55 |
|
|
Utils() {
|
| 56 |
|
|
};
|
| 57 |
63 |
julius |
|
| 58 |
462 |
julius |
}; // class Utils
|
| 59 |
63 |
julius |
|
| 60 |
462 |
julius |
#endif // UTILS_H
|