1*d2201f2fSdrahn /* bfd back-end for TMS320C[34]x support
2*d2201f2fSdrahn Copyright 1996, 1997, 2002, 2003 Free Software Foundation, Inc.
3*d2201f2fSdrahn
4*d2201f2fSdrahn Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz)
5*d2201f2fSdrahn
6*d2201f2fSdrahn This file is part of BFD, the Binary File Descriptor library.
7*d2201f2fSdrahn
8*d2201f2fSdrahn This program is free software; you can redistribute it and/or modify
9*d2201f2fSdrahn it under the terms of the GNU General Public License as published by
10*d2201f2fSdrahn the Free Software Foundation; either version 2 of the License, or
11*d2201f2fSdrahn (at your option) any later version.
12*d2201f2fSdrahn
13*d2201f2fSdrahn This program is distributed in the hope that it will be useful,
14*d2201f2fSdrahn but WITHOUT ANY WARRANTY; without even the implied warranty of
15*d2201f2fSdrahn MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16*d2201f2fSdrahn GNU General Public License for more details.
17*d2201f2fSdrahn
18*d2201f2fSdrahn You should have received a copy of the GNU General Public License
19*d2201f2fSdrahn along with this program; if not, write to the Free Software
20*d2201f2fSdrahn Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
21*d2201f2fSdrahn
22*d2201f2fSdrahn #include "bfd.h"
23*d2201f2fSdrahn #include "sysdep.h"
24*d2201f2fSdrahn #include "libbfd.h"
25*d2201f2fSdrahn
26*d2201f2fSdrahn static bfd_boolean tic4x_scan
27*d2201f2fSdrahn PARAMS ((const struct bfd_arch_info *, const char * ));
28*d2201f2fSdrahn
29*d2201f2fSdrahn
30*d2201f2fSdrahn static bfd_boolean
tic4x_scan(info,string)31*d2201f2fSdrahn tic4x_scan (info, string)
32*d2201f2fSdrahn const struct bfd_arch_info *info;
33*d2201f2fSdrahn const char *string;
34*d2201f2fSdrahn {
35*d2201f2fSdrahn /* Allow strings of form [ti][Cc][34][0-9], let's not be too picky
36*d2201f2fSdrahn about strange numbered machines in C3x or C4x series. */
37*d2201f2fSdrahn if (string[0] == 't' && string[1] == 'i')
38*d2201f2fSdrahn string += 2;
39*d2201f2fSdrahn if (*string == 'C' || *string == 'c')
40*d2201f2fSdrahn string++;
41*d2201f2fSdrahn if (string[1] < '0' && string[1] > '9')
42*d2201f2fSdrahn return FALSE;
43*d2201f2fSdrahn
44*d2201f2fSdrahn if (*string == '3')
45*d2201f2fSdrahn return (info->mach == bfd_mach_tic3x);
46*d2201f2fSdrahn else if (*string == '4')
47*d2201f2fSdrahn return info->mach == bfd_mach_tic4x;
48*d2201f2fSdrahn
49*d2201f2fSdrahn return FALSE;
50*d2201f2fSdrahn }
51*d2201f2fSdrahn
52*d2201f2fSdrahn
53*d2201f2fSdrahn const bfd_arch_info_type bfd_tic3x_arch =
54*d2201f2fSdrahn {
55*d2201f2fSdrahn 32, /* 32 bits in a word. */
56*d2201f2fSdrahn 32, /* 32 bits in an address. */
57*d2201f2fSdrahn 32, /* 32 bits in a byte. */
58*d2201f2fSdrahn bfd_arch_tic4x,
59*d2201f2fSdrahn bfd_mach_tic3x, /* Machine number. */
60*d2201f2fSdrahn "tic3x", /* Architecture name. */
61*d2201f2fSdrahn "tms320c3x", /* Printable name. */
62*d2201f2fSdrahn 0, /* Alignment power. */
63*d2201f2fSdrahn FALSE, /* Not the default architecture. */
64*d2201f2fSdrahn bfd_default_compatible,
65*d2201f2fSdrahn tic4x_scan,
66*d2201f2fSdrahn 0
67*d2201f2fSdrahn };
68*d2201f2fSdrahn
69*d2201f2fSdrahn const bfd_arch_info_type bfd_tic4x_arch =
70*d2201f2fSdrahn {
71*d2201f2fSdrahn 32, /* 32 bits in a word. */
72*d2201f2fSdrahn 32, /* 32 bits in an address. */
73*d2201f2fSdrahn 32, /* 32 bits in a byte. */
74*d2201f2fSdrahn bfd_arch_tic4x,
75*d2201f2fSdrahn bfd_mach_tic4x, /* Machine number. */
76*d2201f2fSdrahn "tic4x", /* Architecture name. */
77*d2201f2fSdrahn "tms320c4x", /* Printable name. */
78*d2201f2fSdrahn 0, /* Alignment power. */
79*d2201f2fSdrahn TRUE, /* The default architecture. */
80*d2201f2fSdrahn bfd_default_compatible,
81*d2201f2fSdrahn tic4x_scan,
82*d2201f2fSdrahn &bfd_tic3x_arch,
83*d2201f2fSdrahn };
84*d2201f2fSdrahn
85*d2201f2fSdrahn
86