CMSIS2000
0.0.7
Main Page
Related Pages
Modules
Data Structures
Files
File List
Globals
All
Data Structures
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Groups
Pages
find_file.c
Go to the documentation of this file.
1
/*
2
* CMSIS2000
3
* CMSIS-like sources for LPC2xxx series MCUs
4
*
5
* (C) Copyright 2011-2012, Dmitriy Cherepanov, All Rights Reserved
6
*
7
* Version: 0.0.7
8
* Date of the Last Update: 2013-03-04
9
*
10
* Permission is hereby granted, free of charge, to any person obtaining a copy
11
* of this software and associated documentation files (the "Software"), to
12
* deal in the Software without restriction, including without limitation the
13
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
14
* sell copies of the Software, and to permit persons to whom the Software is
15
* furnished to do so, subject to the following conditions:
16
*
17
* The above copyright notice and this permission notice shall be included in
18
* all copies or substantial portions of the Software.
19
*
20
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
25
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
26
* IN THE SOFTWARE.
27
*
28
* Do not be lasy! For the latest version see http://irtos.sourceforge.net .
29
*
30
*
31
#*/
32
/*----------------------------------------------------------------------------*/
33
/**
34
\file uboot file load from fat fs
35
\author Cherepanov Dmitiy
36
*/
37
/*----------------------------------------------------------------------------*/
38
#include "
ff.h
"
39
#include "../uboot/uboot_load_file.h"
40
41
#include <
stdint.h
>
42
#include <string.h>
43
44
45
#define PRINT_Log(a,b)
46
#ifndef FILENAME_prog_bin
47
#define FILENAME_prog_bin "uboot_firmware.h"
48
#endif
49
50
extern
char
disk_initialize
(
char
) ;
//из драйверов - переменная показываюшая статус
51
FATFS
Fatfs
[
_VOLUMES
];
/* File system object for each logical drive */
52
/**
53
find and load uboot file at external flash or something else
54
and load to MCU after free_space_start adress
55
\par free_space_start
56
\return address of image placed or 0 if load is failed
57
*/
58
void
load_file_from_external_source_to
(
void
* free_area_adress)
59
{
60
FIL
fdw;
61
uint_fast8_t i,vol =
_VOLUMES
;
62
for
(i =0; i<
_VOLUMES
; i++){
/* for each local drive */
63
if
(
disk_initialize
(i) == 0){
64
f_mount
(i, &Fatfs[i]);
65
memset(&fdw,0,
sizeof
(fdw));
66
if
(
f_open
(&fdw,
FILENAME_prog_bin
,
FA_OPEN_EXISTING
|
FA_READ
) ==
FR_OK
)
67
{
68
free_area_adress =
load_uboot_file
(&fdw,free_area_adress);
69
f_close
(&fdw);
70
}
else
{
71
PRINT_Log
(
"Could not open load file %s\n"
,
FILENAME_prog_bin
);
72
return
;
73
}
74
f_mount
(i,(
void
*) 0);
// eqivalent to f_umount()
75
//f_umount(i, &Fatfs[i]);
76
//disk_ioctl CTRL_EJECT()
77
}
78
}
79
}
Utils
boot
iboot
find_file.c
Generated on Wed Mar 6 2013 01:06:13 for CMSIS2000 by
1.8.1.2