KM3NeT CLB  2.0
KM3NeT CLB v2 Embedded Software
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
shell_soc.c
1 /*
2  * KM3NeT CLB v2 Firmware
3  * ----------------------
4  *
5  * Copyright 2013 KM3NeT Collaboration
6  *
7  * All Rights Reserved.
8  *
9  *
10  * File : shell_tests.c
11  * Created : 14 mrt. 2013
12  * Author : Vincent van Beveren
13  */
14 
15 #include <stdbool.h>
16 #include <stdio.h>
17 
18 #include <stdlib.h>
19 #include <string.h>
20 
21 #include "dbg/show.h"
22 
23 #include "util/convert.h"
24 #include "util/func.h"
25 
26 #include "lm32soc/dev_soc.h"
27 #include "lm32soc/lm32.h"
28 
29 #include "drv/wb/gpio.h"
30 #include "drv/wb/i2c.h"
31 #include "drv/wb/acou.h"
32 #include "drv/wb/sdb.h"
33 #include "drv/wb/mboot.h"
34 #include "drv/wb/wrx.h"
35 #include "drv/wb/watchdog.h"
36 #include "drv/spi/sflash.h"
37 #include "drv/i2c/ahrs.h"
38 #include "drv/i2c/sht21.h"
39 
40 #include "kernel/tm.h"
41 #include "kernel/timer.h"
42 #include "kernel/scheduler.h"
43 #include "kernel/err.h"
44 #include "kernel/update.h"
45 #include "kernel/loghist.h"
46 
47 #include "modules/power.h"
48 #include "runtime.h"
49 
50 
51 const char cmd_gpio_help[] = "GPIO test: gpio set|clear <led no>";
52 
53 bool cmd_gpio_exec(int argc, const char *args[])
54 {
55  if (argc < 2) return false;
56  int v = (args[1][0]) - '0';
57  gpioPinSet(v, strcmp(args[0], "set") == 0);
58  return true;
59 }
60 
61 const char cmd_bus_help[] = "Various bus operations (read/write) 'bus help' for help";
62 
63 bool cmd_bus_exec(int argc, const char *args[])
64 {
65 
66  uint32_t addr;
67  uint32_t val;
68  CnvParams cnvHex = CNV_DEFAULT_HEX;
69 
70  if (argc >= 2) {
71 
72  if (cnvParseU(args[1], &addr, cnvHex) <= 0) return false;
73 
74  volatile uint32_t * ptr = ((volatile uint32_t *)addr);
75  printf("&%08x: %08x\n", addr, *ptr);
76  if (argc == 2 && strcmp(args[0], "peek") == 0) {
77  return true;
78  } else if (argc == 3 && strcmp(args[0], "poke") == 0) {
79  if (cnvParseU(args[2], &val, cnvHex) <= 0) return false;
80  printf("-> Setting value %08lx (%lu)\n", val, val);
81  *ptr = val;
82  } else if (argc == 3 && strcmp(args[0], "set") == 0) {
83  int bit = atoi(args[2]);
84  printf("-> Setting bit %d\n", bit);
85  *ptr = *ptr | (1 << bit);
86  } else if (argc == 3 && strcmp(args[0], "clr") == 0) {
87  int bit = atoi(args[2]);
88  printf("-> Clearing bit %d\n", bit);
89  *ptr = *ptr & ~(1 << bit);
90  } else {
91  return false;
92  }
93  printf("&%08x: %08x (after)\n", addr, *ptr);
94 
95  } else if (argc == 1 && strcmp(args[0], "help") == 0) {
96  puts("bus [option] [arguments]");
97  puts("where 'option' may be:");
98  puts(" help - This text");
99  puts(" peek [addr] - Read memory location");
100  puts(" poke [addr] [val] - Write value to address");
101  puts(" set [addr] [bit] - Set a bit");
102  puts(" clr [addr] [bit] - Clears a bit");
103  puts("");
104  puts(" [addr] and [val] are in hex, [bit] is an integer value ranging from 0 to 31");
105  puts(" all values are 32 bits, addresses must be 32 bit aligned");
106  } else {
107  return false;
108  }
109 
110 
111 
112  return true;
113 }
114 
115 
116 
117 const char cmd_reset_help[] = "Resets the LM32 CPU";
118 
119 bool cmd_reset_exec(int argc, const char *args[])
120 {
121  reboot();
122  return true;
123 }
124 
125 
126 const char cmd_load_help[] = "Shows the system load";
127 
128 bool cmd_load_exec(int argc, const char *args[])
129 {
130 
131 
132 
133  uint32_t * t = timerValues();
134 
135  uint32_t idle = ( 100 * ( t[TIMER_SECT_IDLE] >> 8 )) / (TIMER_MAX_COUNT >> 8);
136  uint32_t task = ( 100 * ( t[TIMER_SECT_TASK] >> 8 )) / (TIMER_MAX_COUNT >> 8);
137  uint32_t irq = ( 100 * ( t[TIMER_SECT_IRQ] >> 8 )) / (TIMER_MAX_COUNT >> 8);
138 
139 
140  printf("Tasks: %u%%, Interrupts: %u%%, Idle: %u%%\n", task, irq, idle);
141 
142 #ifdef SCHD_TRACE_LOAD
143  if (argc == 1 && strcmp(args[0], "reset") == 0) {
144  schdResetTraces();
145  } else {
146  schdShowTraces();
147  }
148 #endif
149 
150  return true;
151 }
152 
153 
154 const char cmd_sdb_help[] = "Iterate self-describing bus";
155 
156 bool cmd_sdb_exec(int argc, const char *args[])
157 {
158  sdbDisplay();
159  return true;
160 }
161 
162 
163 const char cmd_delay_help[] = "Delay test: delay <ms>";
164 
165 bool cmd_delay_exec(int argc, const char *args[])
166 {
167  if (argc != 1) return false;
168  uint32_t v = atoi(args[0]);
169 
170  timeDelay(v);
171  return true;
172 }
173 
174 const char cmd_wdog_help[] = "Watchdog functions";
175 
176 bool cmd_wdog_exec(int argc, const char *args[])
177 {
178  if (argc == 1 && strcmp(args[0], "reboot") == 0) {
179  wdogReboot();
180  } else {
181  puts("wdog [cmd] - currently the onyl cmd is just 'reboot'");
182  return false;
183  }
184 
185  return true;
186 }
187 
188 
189 
190 const char cmd_crash_help[] = "Crash the node";
191 
192 bool cmd_crash_exec(int argc, const char *args[])
193 {
194  while (1) {};
195  return true;
196 }
197 
198 const char cmd_mboot_help[] = "Multiboot commands";
199 
200 
201 bool cmd_mboot_exec(int argc, const char *args[])
202 {
203  if (argc == 0 || (argc == 1 && strcmp(args[0],"help") == 0))
204  {
205  puts("mboot # - execute image 0-3");
206  puts("mboot info - Read icap information");
207  puts("mboot wdog start [to] - Start dog, timeout in approx seconds");
208  puts("mboot wdog feed - Feed the watchdog");
209  puts("mboot wdog stop - Stop the watchdog");
210  return true;
211  } else if (argc == 1) {
212 
213  if (strcmp(args[0], "info") == 0)
214  {
215  printf("IDCODE : %08lx\n", mbootIDCode());
216  printf("Boot status: current=%02x, previous=%02x\n",
217  mbootBootStatus(false), mbootBootStatus(true));
218  printf("TIMER : %08lx\n", MBOOT->WTIMER);
219  return true;
220  } else {
221  uint32_t v = atoi(args[0]);
222  printf("Booting new image at %08x, bye!", v * FLASH_SPACING);
223  mbootLoad(v);
224  puts("err... you should never see this message");
225  }
226  } else if (argc >= 2 && strcmp(args[0], "wdog") == 0) {
227  if (strcmp(args[1], "feed") == 0) {
228  mbootWDogFeed();
229  return true;
230  } else if (strcmp(args[1], "stop") == 0) {
231  mbootWDogStop();
232  return true;
233  } else if (strcmp(args[1], "start") == 0 && argc == 3) {
234  int v = atoi(args[2]) * MBOOT_WATCHDOG_FREQ;
235  mbootWDogStart(v, false);
236  return true;
237  }
238  }
239  return false;
240 }
241 
242 
243 const char cmd_flash_help[] = "Execute flash commands";
244 
245 bool cmd_flash_exec(int argc, const char *args[])
246 {
247  uint8_t buf[256];
248 
249  if (argc == 0 || (argc == 1 && strcmp(args[0],"help") == 0))
250  {
251  puts("flash [option] [params...]");
252  puts("option:");
253  puts(" info Displays information");
254  puts(" reset Resets the flash");
255  puts(" erase #<sector> Erases a sector in flash");
256  puts(" read #<page> Reads bytes from a page");
257  puts(" prog #<page> <text> Writes bytes of text to flash page");
258  puts(" quad [on/off] Turn quad data mode on or off");
259 /* puts(" unlock Unlock golden image");
260  puts(" lock Lock golden image");
261  puts(" unprotect Unprotects all protected areas");
262  puts(" protect Protects golden image area");*/
263  puts(" diag Prints diagnostic information");
264 
265  } else if (argc == 1 && streq(args[0], "reset")) {
266  puts("resetting flash");
267  sfReset();
268  } else if (argc == 1 && streq(args[0], "diag")) {
269  sfSpDiag();
270  } else if (argc == 1 && streq(args[0], "unlock")) {
271  puts("unlocking golden image");
272  return updUnlock();
273  } else if (argc == 1 && streq(args[0], "lock")) {
274  puts("locking");
275  return updLock();
276  } else if (argc == 1 && streq(args[0], "unprotect")) {
277  puts("Unprotecting");
278  return sfUnProtect();
279  } else if (argc == 1 && streq(args[0], "protect")) {
280  uint32_t addr;
281  for (addr = 0; addr < FLASH_SPACING; addr += sfInfo.sectorSize)
282  {
283  if (!sfProtect(addr)) return false;
284  }
285  } else if (argc == 1 && strcmp(args[0],"info") == 0)
286  {
287  puts("Serial Flash info:");
288  printf("Manufacturer: %x\n", sfInfo.mfId);
289  printf("Device : %x\n", sfInfo.devId);
290  printf("Capacity ID : %x\n", sfInfo.devCap);
291  if (sfInfo.flashSize == 0) {
292  puts("Unsupported device, no further information.");
293  } else {
294  printf("Size : %d KB\n", sfInfo.flashSize >> 10);
295  printf("Sector Size : %d KB (%d sectors on device)\n", sfInfo.sectorSize / 1024,
297  printf("Page Size : %d bytes (%d pages / sector, %d pages total)\n",
300  printf("Flash status: %02x (device specific)\n", sfInfo._status);
301  }
302  } else if (argc == 2 && strcmp(args[0], "erase") == 0)
303  {
304  if (sfInfo.flashSize == 0) return errSet(ERROR(E_NOTSUPPORTED));
305  uint32_t a = atoi(args[1]);
306  return sfErase(a * sfInfo.sectorSize);
307  } else if (argc == 2 && strcmp(args[0], "read") == 0)
308  {
309  if (sfInfo.flashSize == 0) return errSet(ERROR(E_NOTSUPPORTED));
310  uint32_t a = atoi(args[1]);
311  if (!sfRead(a * sfInfo.pageSize, buf, sizeof(buf))) return false;
312  showHex8("HEX: ", buf, sizeof(buf));
313  buf[15] = '\0';
314  printf("ASCII: %s\n", buf);
315 
316  } else if (argc == 2 && strcmp(args[0], "quad") == 0)
317  {
318  return sfQuadEnable(strcmp(args[1], "on") == 0);
319  } else if (argc == 3 && strcmp(args[0], "prog") == 0)
320  {
321  if (sfInfo.flashSize == 0) return errSet(ERROR(E_NOTSUPPORTED));
322  uint32_t a = atoi(args[1]);
323  if (!sfProg(a * sfInfo.pageSize, (uint8_t *)args[2], strlen(args[2]) + 1)) return false;
324  } else return false;
325 
326  return true;
327 }
328 
329 
330 const char cmd_img_help[] = "Execute image commands";
331 
332 bool cmd_img_exec(int argc, const char *args[])
333 {
334  if (argc == 0 || (argc == 1 && strcmp(args[0],"help") == 0))
335  {
336  puts("flash [option] [params...]");
337  puts("option:");
338  puts(" list Lists all flash images");
339  } else if (argc == 1 && streq(args[0], "list")) {
340  UpdImgInfo info;
341 
342  const char* imgTypes[] = {
343  "Golden", "Runtime", "Base", "Calibration"
344  };
345 
346  for (int i = 0; i < FLASH_MAX_IMAGES; i++) {
347  printf("Pos %d: ", i);
348  if (!updImgInfo(i, &info)) return false;
349  if (info.imgType == UPD_IMGTYPE_NONE) {
350  puts("Empty");
351  } else if (info.imgType == UPD_IMGTYPE_UNKNOWN) {
352  puts("Unknown / old");
353  } else if (info.imgType >= UPD_IMGTYPE_GOLDEN && info.imgType <= UPD_IMGTYPE_CALIB) {
354  printf("%s Fw=%08x Sw=%08x\n", imgTypes[info.imgType - 1], info.fwRev, info.swRev);
355  } else {
356  printf("Error! Type=%d\n", info.imgType);
357  }
358 
359  }
360 
361  } else return false;
362 
363  return true;
364 }
365 
366 
367 
368 const char cmd_pwr_help[] = "Execute power board commands";
369 
370 bool cmd_pwr_exec(int argc, const char *args[])
371 {
372  if (argc == 0 || (argc == 1 && strcmp(args[0],"help") == 0))
373  {
374  puts("pwr [option] [params...]");
375  puts("option:");
376  puts(" help Displays this help");
377  puts(" led <mV> Sets the LED DAC for the Nano beacon");
378  puts(" meas Measure all the values, and display");
379  return true;
380  } else if (argc == 1 && streq(args[0], "meas")) {
381  uint16_t vals[POWER_COUNT];
382 
383 
384  if (!pwrMeasureAll(vals)) return false;
385 
386  puts("Powerboard read-out");
387  printf(" 1.0V : %5d mV %5d mA\n", vals[POWER_1V_LVL], vals[POWER_1V_CUR]);
388  printf(" 1.8V : %5d mV %5d mA\n", vals[POWER_1V8_LVL], vals[POWER_1V8_CUR]);
389  printf(" 2.5V : %5d mV %5d mA\n", vals[POWER_2V5_LVL], vals[POWER_2V5_CUR]);
390  printf(" 3.3V : %5d mV %5d mA\n", vals[POWER_3V3_LVL], vals[POWER_3V3_CUR]);
391  printf(" 3.3V PMT: %5d mV %5d mA\n", vals[POWER_3V3PMT_LVL], vals[POWER_3V3PMT_CUR]);
392  printf(" 5.0V : %5d mV %5d mA\n", vals[POWER_5V_LVL], vals[POWER_5V_CUR]);
393  printf("12.0V : %5d mV %5d mA\n", vals[POWER_12V_LVL], vals[POWER_12V_CUR]);
394  printf("VLED : %5d mV %5d mA\n", vals[POWER_VLED_LVL], vals[POWER_VLED_CUR]);
395  printf("Temp. : %5d mC\n"
396  "DAC CTRL : %5d mV\n", vals[POWER_TEMP_LVL], vals[POWER_DACCTL_LVL]);
397 
398  return true;
399  } else if (argc == 2 && streq(args[0], "led")) {
400  int v = atoi(args[1]);
401  return pwrSetLED(v);
402  }
403 
404 
405  return false;
406 }
407 
408 const char cmd_i2c_help[] = "I2C debugging commands";
409 
410 bool cmd_i2c_exec(int argc, const char *args[])
411 {
412  if (argc != 2) {
413  puts("i2c <dev> <command> [<options>]");
414  puts("device must be 1 to 3");
415  puts("where command may be");
416  puts(" scan - do a complete scan of the I2C bus, listing all addresses");
417  } else {
418  int devIdx = atoi(args[0]);
419  I2C_Device * dev;
420  bool canRead, canWrite;
421  int found;
422 
423  switch (devIdx) {
424  case 1: dev = I2C1; break;
425  case 2: dev = I2C2; break;
426  case 3: dev = I2C3; break;
427  default:
428  puts("Incorrect I2C device number, must be 1-3");
429  return false;
430  }
431 
432  if (streq(args[1], "scan"))
433  {
434  puts("I2C Bus scan");
435  puts("===============================");
436  found = 0;
437  for (i2cAddr addr = 0; addr < 0x7F; addr++) {
438  if (!i2cExists(dev, addr, &canRead, &canWrite)) {
439  printf("Error at %02x:\n", addr);
440  errPrint(true);
441  } else if (canRead || canWrite) {
442  printf("Device at %02x:%s%s\n", addr,
443  canRead ? " Readable" : "",
444  canWrite ? " Writable" : "");
445  found ++;
446  }
447  }
448  printf("%d device(s) found\n", found);
449 
450  }
451  }
452  return true;
453 }
454 
455 
456 
457 
458 const char cmd_wrx_help[] = "Dump WhiteRabbit eXchange data";
459 
460 bool cmd_wrx_exec(int argc, const char *args[])
461 {
462  if (!wrxUp()) {
463  puts("WRX not up");
464  return true;
465  }
466 
467  if (argc == 2 && strcmp(args[0], "test") == 0) {
468 
469  int c = atoi(args[1]);
470 
471  volatile WrxInfo * info = wrxInfo();
472 
473  uint8_t mac_cpy[6];
474  uint8_t mac_tst[6];
475  memcpy(mac_cpy, (const void *)&info->macAddr[0], 6);
476  int err = 0;
477  for (int i = 0; i < c; ++i) {
478  mac_tst[0] = wrxInfo()->macAddr[0];
479  mac_tst[1] = wrxInfo()->macAddr[1];
480  mac_tst[2] = wrxInfo()->macAddr[2];
481  mac_tst[3] = wrxInfo()->macAddr[3];
482  mac_tst[4] = wrxInfo()->macAddr[4];
483  mac_tst[5] = wrxInfo()->macAddr[5];
484 
485  if (memcmp(mac_tst, mac_cpy, 6) != 0) {
486  err++;
487  memcpy(mac_cpy, mac_tst, 6);
488  }
489  }
490 
491  printf("Run: %d, Errors: %d, rate: %d%%\n", c, err, ( err * 100 ) / c);
492 
493 
494  } else {
495  volatile WrxInfo * info = wrxInfo();
496  printf("Status: %08x\n", info->status);
497  printf("MAC : %02x:%02x:%02x:%02x:%02x:%02x\n", info->macAddr[0], info->macAddr[1],
498  info->macAddr[2], info->macAddr[3], info->macAddr[4], info->macAddr[5]);
499  printf("Temp : %d.%d\n", info->brdTemp, info->brdTempFrac);
500  printf("Time : %llu\n",info->utcTime);
501  }
502  return true;
503 }
504 
505 
506 const char cmd_log_help[] = "log [#] - Read the last # log-lines from flash. When ommited read all";
507 
508 bool cmd_log_exec(int argc, const char *args[])
509 {
510  int count;
511  if (argc == 1) count = atoi(args[0]);
512  else count = 0;
513 
514  if (!lhFlashItStart(count)) return false;
515 
516  char buf[128];
517 
518  while (lhFlashItNext(buf, sizeof(buf))) {
519  puts(buf);
520  }
521 
522  return true;
523 }
524 
525 
526 const char cmd_rt_help[] = "set/get the runtime configuration";
527 
528 bool cmd_rt_exec(int argc, const char *args[])
529 {
530  if (argc == 0)
531  {
532  printf("runtime image to load no: %d\n", rtImage());
533  return true;
534  } else if (argc == 1 && strcmp("help", args[0]) == 0) {
535  puts("rt help - show this help");
536  puts("rt - list current runtime settings");
537  puts("rt image <#> - sets the runtime image number. This image is");
538  puts(" loaded after the golden image.");
539  } else if (argc == 2) {
540  if (strcmp(args[0], "image") == 0)
541  {
542  return rtSetImage(atoi(args[1]));
543  } else {
544  return false;
545  }
546  } else {
547  return false;
548  }
549 
550 
551  return true;
552 }
553 
554 
555 
556 const char cmd_cdc_help[] = "Core dump clear";
557 
558 bool cmd_cdc_exec(int argc, const char *args[])
559 {
560  coreDumpClear();
561  puts("Core-dump cleared");
562  return true;
563 }
#define TIMER_SECT_IRQ
time spend in IRQs
Definition: timer.h:35
bool sfQuadEnable(bool enable)
Quad enable,.
Definition: sflash.c:442
Implements search functionality for the self-describing bus.
static void mbootWDogFeed()
Feed the watchdog.
Definition: mboot.h:91
This module provides access to the peripherals on the power board.
This driver is to read and configure the AHRS I2C sensor.
void coreDumpClear()
Clears core dump information.
Definition: sys.c:156
int rtImage()
Returns the image loaded for runtime.
Definition: runtime.c:59
bool i2cExists(I2C_Device *dev, i2cAddr addr, bool *canRead, bool *canWrite)
Checks whether or not an I2C address is present on the bus.
Definition: i2c.c:326
uint32_t flashSize
flash size in bytes
Definition: sflash.h:63
static int mbootBootStatus(bool previous)
Returns the boot status.
Definition: mboot.h:62
void mbootLoad(int imgNo)
Boots a specific image.
Definition: mboot.c:38
static bool streq(const char *one, char *other)
Simple compares two strings for equality.
Definition: func.h:58
bool updUnlock()
Unlocks the golden image for writing.
Definition: update.c:225
GPIO Driver.
Provides access to the runtime image booting.
int cnvParseU(const char *input, uint32_t *output, CnvParams params)
Parse an unsigned integer.
Definition: convert.c:61
Low level routines for LM32, including interrupt handling.
bool updImgInfo(uint32_t imgNo, UpdImgInfo *imgInfo)
Retrieve image information for the specified location.
Definition: update.c:193
#define UPD_IMGTYPE_NONE
There is no image at the specified location.
Definition: update.h:134
uint8_t mfId
Manufacturer ID.
Definition: sflash.h:65
bool lhFlashItNext(char *bufPtr, int bufSize)
Get the next element.
Definition: loghist.c:250
uint8_t _status
Hardware status register value.
Definition: sflash.h:70
Structure defines OpenCores I2C Device.
Definition: dev_i2c.h:55
#define TIMER_SECT_IDLE
time spend being idle
Definition: timer.h:33
Watchdog driver.
int8_t imgType
Image type.
Definition: update.h:145
Simple task scheduler for tasks.
static void mbootWDogStop()
Stop the watchdog.
Definition: mboot.h:99
#define MBOOT
Multiboot base pointer.
Definition: dev_soc.h:60
SfInfo sfInfo
Flash info, only valid after successful initialization.
Definition: sflash.c:161
uint16_t pageSize
Page size in bytes.
Definition: sflash.h:64
void timeDelay(uint32_t msec)
Simple busy-wait delay.
Definition: tm.c:18
#define I2C3
Virtual OpenCores I2C.
Definition: dev_soc.h:66
uint32_t sectorSize
Sector size in bytes.
Definition: sflash.h:62
Multiboot Driver, exposes one function, mbootLoad.
static void wdogReboot()
Reboot the FPGA (hard)
Definition: watchdog.h:40
#define I2C2
Virtual OpenCores I2C.
Definition: dev_soc.h:65
uint8_t i2cAddr
I2C address type.
Definition: i2c.h:93
bool updLock()
Locks the golden image for writing.
Definition: update.c:230
void gpioPinSet(int pin, bool high)
Sets the pin state.
Definition: gpio.c:35
bool pwrMeasureAll(uint16_t *results)
Initiates a conversion for the given channel.
Definition: power.c:73
void mbootWDogStart(uint32_t timer, bool config)
Configures and starts the ICAPE2 watchdog.
uint32_t * timerValues()
Returns.
Definition: timer.c:71
#define MBOOT_WATCHDOG_FREQ
Worse case watchdog speed.
Definition: dev_mboot.h:35
bool sfReset()
Resets the flash.
Definition: sflash.c:320
Manages the global system error.
bool sfErase(uint32_t address)
Erase a sector in flash.
Definition: sflash.c:564
void errPrint(bool clear)
Prints the last error.
Definition: err.c:79
This structure provides information about formatting and parsing.
Definition: convert.h:37
uint32_t swRev
Software revision.
Definition: update.h:144
Stores logging history.
#define UPD_IMGTYPE_UNKNOWN
There is an image, but it has no meta-data.
Definition: update.h:135
uint8_t devId
Device ID.
Definition: sflash.h:66
uint32_t fwRev
Firmware revision.
Definition: update.h:143
Simple timer functions.
bool sfProtect(uint32_t address)
Protects a specific sector from being erased or programmed.
Definition: sflash.c:672
bool wrxUp()
Returns whether or not the WhiteRabbit interface is up and running.
Definition: wrx.c:58
volatile WrxInfo * wrxInfo()
Returns the whiteRabbit information structure if available, else NULL.
Definition: wrx.c:63
#define UPD_IMGTYPE_CALIB
Calibration image.
Definition: update.h:139
Various useful functions.
void reboot()
Soft reboot the LM32.
Definition: lm32.c:112
void sdbDisplay()
Dumps the contents of the SDB records to standard out.
Definition: sdb.c:323
uint8_t devCap
Device capacity ID.
Definition: sflash.h:67
This driver is to read the SHT21 I2C temperature and humidity sensor.
#define I2C1
Virtual OpenCores I2C.
Definition: dev_soc.h:64
bool lhFlashItStart(int count)
Start the iteration through the flash entries.
Definition: loghist.c:230
static uint32_t mbootIDCode()
Returns the ID-code.
Definition: mboot.h:50
bool sfRead(uint32_t address, uint8_t *data, uint32_t count)
Read from a specific address in flash.
Definition: sflash.c:491
This file assigns all device structures to memory mapped structures.
bool errSet(uint32_t code, const char *error, const char *name)
Sets an error.
#define ERROR(CODE,...)
Expands an error code to an error code with a description (if ERROR_W_DESCR is declared).
This driver implements access to the Serial Flash.
bool rtSetImage(int imgNo)
Sets the runtime boot image number.
Definition: runtime.c:66
#define TIMER_SECT_TASK
time spend executing a task
Definition: timer.h:34
bool pwrSetLED(uint32_t mv)
Set the LED output in millivolts.
Definition: power.c:91
#define UPD_IMGTYPE_GOLDEN
Golden image.
Definition: update.h:136
WhiteRabbit exchange exchanges information between the 2nd LM32 and WhiteRabbit though a small client...
This module implements parsing and formating of strings and integers.
bool sfProg(uint32_t address, uint8_t *data, uint32_t count)
Program an page in flash.
Definition: sflash.c:519
void sfSpDiag()
Shows diagnostic state of Spansion Flash.
Definition: sflash.c:627
#define E_NOTSUPPORTED
Generic error: not supported.
Definition: errorcode.h:115
Acoustic Driver.
bool sfUnProtect()
Unprotects the entire flash array.
Definition: sflash.c:690
Facilitates the update process.
OpenCores I2C device driver.