add flash/nor/drivers.c

Encapsulates access to the flash_drivers array, providing a base
of operations for future dynamic driver module loading features.
This commit is contained in:
Zachary T Welch
2009-12-04 04:10:42 -08:00
parent 04ee41de52
commit c90702eaa7
4 changed files with 79 additions and 55 deletions

View File

@@ -25,19 +25,8 @@
#include <target/image.h>
// in flash.c, to be moved here
extern struct flash_driver *flash_drivers[];
extern struct flash_bank *flash_banks;
struct flash_driver *flash_driver_find_by_name(const char *name)
{
for (unsigned i = 0; flash_drivers[i]; i++)
{
if (strcmp(name, flash_drivers[i]->name) == 0)
return flash_drivers[i];
}
return NULL;
}
int flash_driver_erase(struct flash_bank *bank, int first, int last)
{
int retval;