1 /***************************************************************************
2 * Copyright (C) 2009 Zachary T Welch <zw@superlucidity.net> *
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. *
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. *
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 ***************************************************************************/
23 #include <flash/flash.h>
24 #include <flash/nor/imp.h>
26 // in flash.c, to be moved here
27 extern struct flash_driver *flash_drivers[];
28 extern struct flash_bank *flash_banks;
30 struct flash_driver *flash_driver_find_by_name(const char *name)
32 for (unsigned i = 0; flash_drivers[i]; i++)
34 if (strcmp(name, flash_drivers[i]->name) == 0)
35 return flash_drivers[i];
40 void flash_bank_add(struct flash_bank *bank)
42 /* put flash bank in linked list */
43 unsigned bank_num = 0;
46 /* find last flash bank */
47 struct flash_bank *p = flash_banks;
48 while (NULL != p->next)
59 bank->bank_number = bank_num;
62 struct flash_bank *flash_bank_list(void)