OpenCores
URL https://opencores.org/ocsvn/adv_debug_sys/adv_debug_sys/trunk

Subversion Repositories adv_debug_sys

[/] [adv_debug_sys/] [tags/] [ADS_RELEASE_1_1_0/] [Software/] [adv_jtag_bridge/] [errcodes.c] - Diff between revs 8 and 19

Only display areas with differences | Details | Blame | View Log

Rev 8 Rev 19
/* errcodes.c - Error code to plaintext translator for the advanced JTAG bridge
/* errcodes.c - Error code to plaintext translator for the advanced JTAG bridge
   Copyright(C) 2008 Nathan Yawn
   Copyright(C) 2008 Nathan Yawn
 
 
   This program is free software; you can redistribute it and/or modify
   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation; either version 2 of the License, or
   the Free Software Foundation; either version 2 of the License, or
   (at your option) any later version.
   (at your option) any later version.
 
 
   This program is distributed in the hope that it will be useful,
   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.
   GNU General Public License for more details.
 
 
   You should have received a copy of the GNU General Public License
   You should have received a copy of the GNU General Public License
   along with this program; if not, write to the Free Software
   along with this program; if not, write to the Free Software
   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
*/
 
 
#include <string.h>
#include <string.h>
#include "errcodes.h"
#include "errcodes.h"
 
 
// We can declare the error string with a fixed size, because it can't
// We can declare the error string with a fixed size, because it can't
// have more than ALL of the error strings in it.  Be sure to expand it
// have more than ALL of the error strings in it.  Be sure to expand it
// as more errors are added.  Also, put a space at the end of each
// as more errors are added.  Also, put a space at the end of each
// error string, as there may be multiple errors.
// error string, as there may be multiple errors.
char errstr[256];
char errstr[256];
char *get_err_string(int err)
char *get_err_string(int err)
{
{
  errstr[0] = '\0';
  errstr[0] = '\0';
 
 
  if(err & APP_ERR_COMM)
  if(err & APP_ERR_COMM)
    strcat(errstr, "\'JTAG comm error\' ");
    strcat(errstr, "\'JTAG comm error\' ");
  if(err & APP_ERR_MALLOC)
  if(err & APP_ERR_MALLOC)
    strcat(errstr, "\'malloc failed\' ");
    strcat(errstr, "\'malloc failed\' ");
  if(err & APP_ERR_MAX_RETRY)
  if(err & APP_ERR_MAX_RETRY)
    strcat(errstr, "\'max retries\' ");
    strcat(errstr, "\'max retries\' ");
  if(err & APP_ERR_CRC)
  if(err & APP_ERR_CRC)
    strcat(errstr, "\'CRC mismatch\' ");
    strcat(errstr, "\'CRC mismatch\' ");
  if(err & APP_ERR_MAX_BUS_ERR)
  if(err & APP_ERR_MAX_BUS_ERR)
    strcat(errstr, "\'max WishBone bus errors\' ");
    strcat(errstr, "\'max WishBone bus errors\' ");
  if(err & APP_ERR_CABLE_INVALID)
  if(err & APP_ERR_CABLE_INVALID)
    strcat(errstr, "\'Invalid cable\' ");
    strcat(errstr, "\'Invalid cable\' ");
  if(err & APP_ERR_INIT_FAILED)
  if(err & APP_ERR_INIT_FAILED)
    strcat(errstr, "\'init failed\' ");
    strcat(errstr, "\'init failed\' ");
  if(err & APP_ERR_BAD_PARAM)
  if(err & APP_ERR_BAD_PARAM)
    strcat(errstr, "\'bad command line parameter\' ");
    strcat(errstr, "\'bad command line parameter\' ");
  if(err & APP_ERR_CONNECT)
  if(err & APP_ERR_CONNECT)
    strcat(errstr, "\'connection failed\' ");
    strcat(errstr, "\'connection failed\' ");
  if(err & APP_ERR_USB)
  if(err & APP_ERR_USB)
    strcat(errstr, "\'USB\' ");
    strcat(errstr, "\'USB\' ");
  if(err & APP_ERR_CABLENOTFOUND)
  if(err & APP_ERR_CABLENOTFOUND)
    strcat(errstr, "\'cable not found\' ");
    strcat(errstr, "\'cable not found\' ");
  return errstr;
  return errstr;
}
}
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.