| 1 |
4 |
DFC |
/***************************************************************************
|
| 2 |
|
|
*
|
| 3 |
|
|
* (C) Copyright 2017 DFC Design, s.r.o., Brno, Czech Republic
|
| 4 |
|
|
* Author: Marek Kvas (m.kvas@dspfpga.com)
|
| 5 |
|
|
*
|
| 6 |
|
|
***************************************************************************
|
| 7 |
|
|
*
|
| 8 |
|
|
* This file is part of Xenia Ethernet Example project.
|
| 9 |
|
|
*
|
| 10 |
|
|
* Xenia Ethernet Example project is free software: you can
|
| 11 |
|
|
* redistribute it and/or modify it under the terms of
|
| 12 |
|
|
* the GNU Lesser General Public License as published by the Free
|
| 13 |
|
|
* Software Foundation, either version 3 of the License, or
|
| 14 |
|
|
* (at your option) any later version.
|
| 15 |
|
|
*
|
| 16 |
|
|
* Xenia Ethernet Example project is distributed in the hope that
|
| 17 |
|
|
* it will be useful, but WITHOUT ANY WARRANTY; without even
|
| 18 |
|
|
* the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
| 19 |
|
|
* PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
| 20 |
|
|
* for more details.
|
| 21 |
|
|
*
|
| 22 |
|
|
* You should have received a copy of the GNU Lesser General Public
|
| 23 |
|
|
* License along with Xenia Ethernet Example project. If not,
|
| 24 |
|
|
* see <http://www.gnu.org/licenses/>.
|
| 25 |
|
|
*
|
| 26 |
|
|
***************************************************************************
|
| 27 |
|
|
*/
|
| 28 |
|
|
#ifndef __FW_H__
|
| 29 |
|
|
#define __FW_H__
|
| 30 |
|
|
|
| 31 |
|
|
#include "spansion_flash.h"
|
| 32 |
|
|
|
| 33 |
|
|
/*
|
| 34 |
|
|
* This structure describes FW header as
|
| 35 |
|
|
* written in flash.
|
| 36 |
|
|
*/
|
| 37 |
|
|
struct fw_hdr {
|
| 38 |
|
|
char magic[4]; /* Should be "MVFW" */
|
| 39 |
|
|
unsigned int fw_offset; /* related to header start */
|
| 40 |
|
|
unsigned int fw_length;
|
| 41 |
|
|
};
|
| 42 |
|
|
|
| 43 |
|
|
/*
|
| 44 |
|
|
* This structure contains all information
|
| 45 |
|
|
* for FW manipulation including pointer to
|
| 46 |
|
|
* buffer containing FW is it has been already
|
| 47 |
|
|
* read to memory.
|
| 48 |
|
|
*/
|
| 49 |
|
|
struct fw_hdr_ext {
|
| 50 |
|
|
u32 fw_hdr_flash_off;
|
| 51 |
|
|
struct fw_hdr fw_hdr;
|
| 52 |
|
|
u8 *fw_meta_ptr; /*Always 1 byte larger than orig. meta-data to easy string handling*/
|
| 53 |
|
|
u8 *fw_data_ptr;
|
| 54 |
|
|
};
|
| 55 |
|
|
|
| 56 |
|
|
|
| 57 |
|
|
void fw_free_hdr_ext_ptr(struct fw_hdr_ext **s);
|
| 58 |
|
|
int fw_find_in_flash(struct spansion_flash *sf, uint32_t fw_hdr_flash_offset, struct fw_hdr_ext **fw_hdr_ext_ptr);
|
| 59 |
|
|
void fw_print_info(struct fw_hdr_ext *fhe);
|
| 60 |
|
|
int fw_read_from_flash(struct spansion_flash *sf, struct fw_hdr_ext *fw_hdr_ext_ptr);
|
| 61 |
|
|
|
| 62 |
|
|
#endif /* __FW_H__ */
|