KM3NeT CLB  2.0
KM3NeT CLB v2 Embedded Software
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
mboot.c
1 /*
2  * KM3NeT CLB v2 Firmware
3  * ----------------------
4  *
5  * Copyright 2012-2014 KM3NeT Collaboration
6  *
7  * All Rights Reserved.
8  *
9  *
10  * File : mboot.c
11  * Created : 20 okt. 2014
12  * Author : Vincent van Beveren
13  */
14 #include "drv/wb/mboot.h"
15 
16 #include <stdio.h>
17 #include "util/log.h"
18 
19 LOG_DEF(MBoot)
20 
21 void mbootWDogStart(uint32_t timer, bool config)
22 {
23  uint32_t val = timer & MBOOT_TIMER_VALUE_MASK;
24  if (config) val |= MBOOT_TIMER_CFG_MON;
25  else val |= MBOOT_TIMER_USR_MON;
26 
27  MBOOT->WTIMER = val;
28 }
29 
30 
31 
32 
33 /**
34  * Boots a specific image.
35  *
36  * @param imgNo The image to boot
37  */
38 void mbootLoad(int imgNo)
39 {
40  logInfo("Booting image %d", imgNo);
42  /*
43  http://forums.xilinx.com/t5/Embedded-Development-Tools/
44  Promgen-multiboot-image-creation-not-working/td-p/338397
45  "<CASE:1031719> Multiboot in Kintex-7"
46  */
47  MBOOT->WBSTAR = imgNo * FLASH_SPACING;
48  } else {
49  MBOOT->WBSTAR = ( imgNo * FLASH_SPACING ) >> MBOOT_WBSTAR_32BIT_ADDR_SHIFT;
50  }
51 
52 
53  MBOOT->CMD = MBOOT_CMD_IPROG;
54 
55  while (true) {};
56 }
#define MBOOT_TIMER_CFG_MON
Configuration watchdog.
Definition: dev_mboot.h:58
void mbootLoad(int imgNo)
Boots a specific image.
Definition: mboot.c:38
#define MBOOT
Multiboot base pointer.
Definition: dev_soc.h:60
#define MBOOT_TIMER_USR_MON
User watchdog.
Definition: dev_mboot.h:57
Multiboot Driver, exposes one function, mbootLoad.
#define MBOOT_CMD_IPROG
Trigger reconfiguration.
Definition: dev_mboot.h:32
#define MBOOT_BSPI_SPI_24BIT_MASK
If set, its a 24 bit read command.
Definition: dev_mboot.h:64
void mbootWDogStart(uint32_t timer, bool config)
Configures and starts the ICAPE2 watchdog.
#define MBOOT_TIMER_VALUE_MASK
Mask for timer.
Definition: dev_mboot.h:56
#define LOG_DEF(NAME,...)
Define a logger for a module.
Definition: log.h:129
#define MBOOT_WBSTAR_32BIT_ADDR_SHIFT
Bit-shift required for 32-bit addresses.
Definition: dev_mboot.h:38
Implements a generic logger facility.
#define logInfo(MSG,...)
Write a log message with formatting on info level.
Definition: log.h:202