add flash/nor/drivers.c
[fw/openocd] / src / flash / nor / drivers.c
1 /***************************************************************************
2  *   Copyright (C) 2009 Zachary T Welch <zw@superlucidity.net>             *
3  *                                                                         *
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                         *
16  *   Free Software Foundation, Inc.,                                       *
17  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
18  ***************************************************************************/
19 #ifdef HAVE_CONFIG_H
20 #include "config.h"
21 #endif
22 #include <flash/nor/core.h>
23
24 extern struct flash_driver lpc2000_flash;
25 extern struct flash_driver lpc288x_flash;
26 extern struct flash_driver lpc2900_flash;
27 extern struct flash_driver cfi_flash;
28 extern struct flash_driver at91sam3_flash;
29 extern struct flash_driver at91sam7_flash;
30 extern struct flash_driver str7x_flash;
31 extern struct flash_driver str9x_flash;
32 extern struct flash_driver aduc702x_flash;
33 extern struct flash_driver stellaris_flash;
34 extern struct flash_driver str9xpec_flash;
35 extern struct flash_driver stm32x_flash;
36 extern struct flash_driver tms470_flash;
37 extern struct flash_driver ecosflash_flash;
38 extern struct flash_driver ocl_flash;
39 extern struct flash_driver pic32mx_flash;
40 extern struct flash_driver avr_flash;
41 extern struct flash_driver faux_flash;
42
43 /**
44  * The list of built-in flash drivers.
45  * @todo Make this dynamically extendable with loadable modules.
46  */
47 struct flash_driver *flash_drivers[] = {
48         &lpc2000_flash,
49         &lpc288x_flash,
50         &lpc2900_flash,
51         &cfi_flash,
52         &at91sam7_flash,
53         &at91sam3_flash,
54         &str7x_flash,
55         &str9x_flash,
56         &aduc702x_flash,
57         &stellaris_flash,
58         &str9xpec_flash,
59         &stm32x_flash,
60         &tms470_flash,
61         &ecosflash_flash,
62         &ocl_flash,
63         &pic32mx_flash,
64         &avr_flash,
65         &faux_flash,
66         NULL,
67 };
68
69 struct flash_driver *flash_driver_find_by_name(const char *name)
70 {
71         for (unsigned i = 0; flash_drivers[i]; i++)
72         {
73                 if (strcmp(name, flash_drivers[i]->name) == 0)
74                         return flash_drivers[i];
75         }
76         return NULL;
77 }