1 | /** |
---|
2 | * @file |
---|
3 | * |
---|
4 | * @ingroup lpc32xx_boot |
---|
5 | * |
---|
6 | * @brief Boot support implementation. |
---|
7 | */ |
---|
8 | |
---|
9 | /* |
---|
10 | * Copyright (c) 2010 |
---|
11 | * embedded brains GmbH |
---|
12 | * Obere Lagerstr. 30 |
---|
13 | * D-82178 Puchheim |
---|
14 | * Germany |
---|
15 | * <rtems@embedded-brains.de> |
---|
16 | * |
---|
17 | * The license and distribution terms for this file may be |
---|
18 | * found in the file LICENSE in this distribution or at |
---|
19 | * http://www.rtems.org/license/LICENSE. |
---|
20 | */ |
---|
21 | |
---|
22 | #include <string.h> |
---|
23 | |
---|
24 | #include <bsp/boot.h> |
---|
25 | |
---|
26 | void lpc32xx_setup_boot_block( |
---|
27 | lpc32xx_boot_block *boot_block, |
---|
28 | uint8_t icr, |
---|
29 | uint8_t page_count |
---|
30 | ) |
---|
31 | { |
---|
32 | memset(boot_block, 0, sizeof(*boot_block)); |
---|
33 | |
---|
34 | ++page_count; |
---|
35 | |
---|
36 | boot_block->field.d0 = icr; |
---|
37 | boot_block->field.d2 = icr; |
---|
38 | boot_block->field.d4 = page_count; |
---|
39 | boot_block->field.d6 = page_count; |
---|
40 | boot_block->field.d8 = page_count; |
---|
41 | boot_block->field.d10 = page_count; |
---|
42 | |
---|
43 | icr = (uint8_t) ~((unsigned) icr); |
---|
44 | page_count = (uint8_t) ~((unsigned) page_count); |
---|
45 | |
---|
46 | boot_block->field.d1 = icr; |
---|
47 | boot_block->field.d3 = icr; |
---|
48 | boot_block->field.d5 = page_count; |
---|
49 | boot_block->field.d7 = page_count; |
---|
50 | boot_block->field.d9 = page_count; |
---|
51 | boot_block->field.d11 = page_count; |
---|
52 | |
---|
53 | boot_block->field.d12 = 0xaa; |
---|
54 | } |
---|
55 | |
---|
56 | void lpc32xx_set_boot_block_bad( |
---|
57 | lpc32xx_boot_block *boot_block |
---|
58 | ) |
---|
59 | { |
---|
60 | boot_block->field.d12 = 0; |
---|
61 | } |
---|