add flash/nor/core.[ch]

The newly moved flash TCL routines access the internals of the module
too much.  Fix the layering issues by adding new core NOR flash APIs:

<flash/nor/core.h>:
  - flash_driver_find_by_name() - self-descriptive

<flash/nor/imp.h>:
  - flash_bank_add()            - encapsulates adding banks to bank list
  - flash_bank_list()           - encapsulates retreiving bank list

This allows the externs in flash/nor/imp.h to be removed, and
these mechanisms may now be re-used by other flash module code.
This commit is contained in:
Zachary T Welch
2009-12-03 17:14:07 -08:00
parent 3cb0b56005
commit c65d94f7d0
5 changed files with 154 additions and 67 deletions

View File

@@ -19,9 +19,18 @@
#ifndef FLASH_NOR_IMP_H
#define FLASH_NOR_IMP_H
#include <flash/flash.h>
// this is an internal header
#include "core.h"
extern struct flash_driver *flash_drivers[];
extern struct flash_bank *flash_banks;
/**
* Adds a new NOR bank to the global list of banks.
* @params bank The bank that should be added.
*/
void flash_bank_add(struct flash_bank *bank);
/**
* @return The first bank in the global list.
*/
struct flash_bank *flash_bank_list(void);
#endif // FLASH_NOR_IMP_H