Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: FaultInjector.h
- Revision:
- 0:ef0a1a6d4a40
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/FaultInjector.h Sat Sep 14 22:58:28 2013 +0000
@@ -0,0 +1,43 @@
+/*
+ * File: FaultsInjector.h
+ * Author: Kleber Kruger
+ *
+ * Created on 11 de Junho de 2013, 09:20
+ */
+
+#ifndef FAULTINJECTOR_H
+#define FAULTINJECTOR_H
+
+#include "Utils.h"
+
+typedef struct {
+ char name[32];
+ unsigned int startAddr;
+ unsigned int endAddr;
+ unsigned int size;
+} MemoryRegion;
+
+class FaultInjector {
+public:
+
+ static const int DEFAULT_CHANGED_BYTES = 1; // Quantidade de bytes alterados em cada injeção de falha.
+ static const int DEFAULT_CHANGED_BITS = 0; // Quantidade de bits alterados dentro do byte. (1 - 8); 0 = Aleatório.
+
+ FaultInjector();
+ virtual ~FaultInjector();
+
+ void injectFaults(unsigned int changedBytes, unsigned int changedBits);
+
+private:
+
+ unsigned int memorySize;
+
+ static MemoryRegion memoryRegions[];
+
+ unsigned int getByteMemory(unsigned int startAddr, unsigned int endAddr);
+
+ void injectFaults(unsigned int addrStart, unsigned int addrEnd,
+ unsigned int changedBytes, unsigned int changedBits);
+};
+
+#endif /* FAULTSINJECTOR_H */