CMSIS2000  0.0.7
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
uboot_file.c File Reference
#include "uboot_file.h"
#include <string.h>
#include "uboot_image_format_adapted.h"
#include "Utils/CRC/crc32.h"
Include dependency graph for uboot_file.c:

Go to the source code of this file.

Macros

#define END_SEARCH   0
#define IMAGE_STEP   0x100

Functions

flash_addr_t find_uboot_file (flash_addr_t search_start_address, flash_addr_t search_end_address)
 Search uboot image in MCU bus address space and check CRC.
int image_check_dcrc (const image_header_t *hdr)
int image_check_hcrc (const image_header_t *const hdr)
static unsigned char * memmem_magic_number (unsigned char *src, size_t size)
static void * round_down_pointer (void *ptr)
unsigned int uboot_check_image_at_addr (const void *const addr, char only_header)
static flash_addr_t uboot_check_image_not_aligned (flash_addr_t search_start_address, flash_addr_t search_end_address)
 search not aligned image
flash_addr_t uboot_file_get_load_addr (flash_addr_t src_address)
 get load uboot image address at RAM
flash_addr_t uboot_file_load (flash_addr_t src_address)
 load uboot image to RAM on MCU bus (memcpy)

Macro Definition Documentation

#define END_SEARCH   0

Definition at line 223 of file uboot_file.c.

Referenced by memmem_magic_number(), and uboot_check_image_not_aligned().

#define IMAGE_STEP   0x100

Definition at line 41 of file uboot_file.c.

Referenced by find_uboot_file().

Function Documentation

flash_addr_t find_uboot_file ( flash_addr_t  search_start_address,
flash_addr_t  search_end_address 
)

Search uboot image in MCU bus address space and check CRC.

Returns
(-1) if not found

Definition at line 48 of file uboot_file.c.

References flash_addr_t, HAS_FULL_IMAGE, IMAGE_STEP, uboot_check_image_at_addr(), and uboot_check_image_not_aligned().

Referenced by main().

Here is the call graph for this function:

Here is the caller graph for this function:

int image_check_dcrc ( const image_header_t hdr)

Definition at line 187 of file uboot_file.c.

References crc32(), image_get_data(), and image_get_data_size().

Here is the call graph for this function:

int image_check_hcrc ( const image_header_t *const  hdr)

Definition at line 164 of file uboot_file.c.

References crc32_end, crc32_no_comp(), image_header::ih_hcrc, image_header::ih_magic, and image_get_header_size().

Referenced by uboot_check_image_at_addr().

Here is the call graph for this function:

Here is the caller graph for this function:

static unsigned char* memmem_magic_number ( unsigned char *  src,
size_t  size 
)
static

Definition at line 224 of file uboot_file.c.

References be32_to_cpu, END_SEARCH, and IH_MAGIC.

Referenced by uboot_check_image_not_aligned().

Here is the caller graph for this function:

static void* round_down_pointer ( void *  ptr)
inlinestatic

Definition at line 131 of file uboot_file.c.

Referenced by uboot_file_load().

Here is the caller graph for this function:

unsigned int uboot_check_image_at_addr ( const void *const  addr,
char  only_header 
)

Definition at line 77 of file uboot_file.c.

References endif(), IH_ARCH_DEFAULT, image_check_arch(), image_check_hcrc(), and image_check_magic().

Referenced by check_size_and_header(), find_uboot_file(), and uboot_check_image_not_aligned().

Here is the call graph for this function:

Here is the caller graph for this function:

static flash_addr_t uboot_check_image_not_aligned ( flash_addr_t  search_start_address,
flash_addr_t  search_end_address 
)
static

search not aligned image

Definition at line 239 of file uboot_file.c.

References END_SEARCH, flash_addr_t, HAS_FULL_IMAGE, memmem_magic_number(), and uboot_check_image_at_addr().

Referenced by find_uboot_file().

Here is the call graph for this function:

Here is the caller graph for this function:

flash_addr_t uboot_file_get_load_addr ( flash_addr_t  src_address)

get load uboot image address at RAM

Returns
destination address of load image in RAM

Definition at line 156 of file uboot_file.c.

Referenced by main().

Here is the caller graph for this function:

flash_addr_t uboot_file_load ( flash_addr_t  src_address)

load uboot image to RAM on MCU bus (memcpy)

Returns
address of run point or -1 if something goes wrong

Definition at line 136 of file uboot_file.c.

References flash_addr_t, IH_COMP_LZO, IH_COMP_NONE, image_get_data(), image_get_data_size(), and round_down_pointer().

Referenced by main().

Here is the call graph for this function:

Here is the caller graph for this function: