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

Subversion Repositories or1k_soc_on_altera_embedded_dev_kit

[/] [or1k_soc_on_altera_embedded_dev_kit/] [trunk/] [soc/] [sw/] [adv_jtag_bridge/] [errcodes.c] - Blame information for rev 21

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 12 xianfeng
/* errcodes.c - Error code to plaintext translator for the advanced JTAG bridge
2 21 xianfeng
   Copyright(C) 2008 - 2010 Nathan Yawn <nyawn@opencores.org>
3 12 xianfeng
 
4
   This program is free software; you can redistribute it and/or modify
5
   it under the terms of the GNU General Public License as published by
6
   the Free Software Foundation; either version 2 of the License, or
7
   (at your option) any later version.
8
 
9
   This program is distributed in the hope that it will be useful,
10
   but WITHOUT ANY WARRANTY; without even the implied warranty of
11
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
   GNU General Public License for more details.
13
 
14
   You should have received a copy of the GNU General Public License
15
   along with this program; if not, write to the Free Software
16
   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17
*/
18
 
19
#include <string.h>
20
#include "errcodes.h"
21
 
22
// We can declare the error string with a fixed size, because it can't
23
// have more than ALL of the error strings in it.  Be sure to expand it
24
// as more errors are added.  Also, put a space at the end of each
25
// error string, as there may be multiple errors.
26
char errstr[256];
27
char *get_err_string(int err)
28
{
29
  errstr[0] = '\0';
30
 
31
  if(err & APP_ERR_COMM)
32
    strcat(errstr, "\'JTAG comm error\' ");
33
  if(err & APP_ERR_MALLOC)
34
    strcat(errstr, "\'malloc failed\' ");
35
  if(err & APP_ERR_MAX_RETRY)
36
    strcat(errstr, "\'max retries\' ");
37
  if(err & APP_ERR_CRC)
38
    strcat(errstr, "\'CRC mismatch\' ");
39
  if(err & APP_ERR_MAX_BUS_ERR)
40
    strcat(errstr, "\'max WishBone bus errors\' ");
41
  if(err & APP_ERR_CABLE_INVALID)
42
    strcat(errstr, "\'Invalid cable\' ");
43
  if(err & APP_ERR_INIT_FAILED)
44
    strcat(errstr, "\'init failed\' ");
45
  if(err & APP_ERR_BAD_PARAM)
46
    strcat(errstr, "\'bad command line parameter\' ");
47
  if(err & APP_ERR_CONNECT)
48
    strcat(errstr, "\'connection failed\' ");
49
  if(err & APP_ERR_USB)
50
    strcat(errstr, "\'USB\' ");
51
  if(err & APP_ERR_CABLENOTFOUND)
52
    strcat(errstr, "\'cable not found\' ");
53
  return errstr;
54
}

powered by: WebSVN 2.1.0

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