[7a66986] | 1 | /** |
---|
| 2 | * @file |
---|
| 3 | * |
---|
| 4 | * @ingroup beagle_boot |
---|
| 5 | * |
---|
| 6 | * @brief Boot support implementation. |
---|
| 7 | */ |
---|
| 8 | |
---|
| 9 | /* |
---|
| 10 | * Copyright (c) 2012 Claas Ziemke. All rights reserved. |
---|
| 11 | * |
---|
| 12 | * Claas Ziemke |
---|
| 13 | * Kernerstrasse 11 |
---|
| 14 | * 70182 Stuttgart |
---|
| 15 | * Germany |
---|
| 16 | * <claas.ziemke@gmx.net> |
---|
| 17 | * |
---|
| 18 | * The license and distribution terms for this file may be |
---|
| 19 | * found in the file LICENSE in this distribution or at |
---|
| 20 | * http://www.rtems.com/license/LICENSE. |
---|
| 21 | */ |
---|
| 22 | |
---|
| 23 | #include <string.h> |
---|
| 24 | |
---|
| 25 | #include <bsp/boot.h> |
---|
| 26 | |
---|
| 27 | void beagle_setup_boot_block( |
---|
| 28 | beagle_boot_block *boot_block, |
---|
| 29 | uint8_t icr, |
---|
| 30 | uint8_t page_count |
---|
| 31 | ) |
---|
| 32 | { |
---|
| 33 | memset(boot_block, 0, sizeof(*boot_block)); |
---|
| 34 | |
---|
| 35 | ++page_count; |
---|
| 36 | |
---|
| 37 | boot_block->field.d0 = icr; |
---|
| 38 | boot_block->field.d2 = icr; |
---|
| 39 | boot_block->field.d4 = page_count; |
---|
| 40 | boot_block->field.d6 = page_count; |
---|
| 41 | boot_block->field.d8 = page_count; |
---|
| 42 | boot_block->field.d10 = page_count; |
---|
| 43 | |
---|
| 44 | icr = (uint8_t) ~((unsigned) icr); |
---|
| 45 | page_count = (uint8_t) ~((unsigned) page_count); |
---|
| 46 | |
---|
| 47 | boot_block->field.d1 = icr; |
---|
| 48 | boot_block->field.d3 = icr; |
---|
| 49 | boot_block->field.d5 = page_count; |
---|
| 50 | boot_block->field.d7 = page_count; |
---|
| 51 | boot_block->field.d9 = page_count; |
---|
| 52 | boot_block->field.d11 = page_count; |
---|
| 53 | |
---|
| 54 | boot_block->field.d12 = 0xaa; |
---|
| 55 | } |
---|
| 56 | |
---|
| 57 | void beagle_set_boot_block_bad( |
---|
| 58 | beagle_boot_block *boot_block |
---|
| 59 | ) |
---|
| 60 | { |
---|
| 61 | boot_block->field.d12 = 0; |
---|
| 62 | } |
---|