]> rtime.felk.cvut.cz Git - arc.git/commitdiff
Start of Fee module
authorpete <devnull@localhost>
Wed, 29 Sep 2010 08:19:00 +0000 (10:19 +0200)
committerpete <devnull@localhost>
Wed, 29 Sep 2010 08:19:00 +0000 (10:19 +0200)
boards/generic/Fee_Cfg.c [new file with mode: 0644]
boards/generic/Fee_Cfg.h
include/Fee.h
include/Fee_ConfigTypes.h [new file with mode: 0644]
include/NvM.h
memory/Fee/Fee.c [new file with mode: 0644]

diff --git a/boards/generic/Fee_Cfg.c b/boards/generic/Fee_Cfg.c
new file mode 100644 (file)
index 0000000..82bd428
--- /dev/null
@@ -0,0 +1,37 @@
+/* -------------------------------- Arctic Core ------------------------------\r
+ * Arctic Core - the open source AUTOSAR platform http://arccore.com\r
+ *\r
+ * Copyright (C) 2009  ArcCore AB <contact@arccore.com>\r
+ *\r
+ * This source code is free software; you can redistribute it and/or modify it\r
+ * under the terms of the GNU General Public License version 2 as published by the\r
+ * Free Software Foundation; See <http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt>.\r
+ *\r
+ * This program is distributed in the hope that it will be useful, but\r
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY\r
+ * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License\r
+ * for more details.\r
+ * -------------------------------- Arctic Core ------------------------------*/\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+#warning "This default file may only be used as an example!"\r
+\r
+#include "Fee_Cfg.h"\r
+\r
+/*********************\r
+ * Fee Configuration *\r
+ *********************/\r
+\r
+\r
+/*\r
+ * Fee's config\r
+ */\r
+const Fee_ConfigType Fee_Config = {\r
+};\r
+\r
index 9a7b4b8149689ac4ab19140ffc3bc9e84cee246b..d4a5e0517583f6e0090e3e82dc9f6ea4cbecad97 100644 (file)
 #ifndef FEE_CFG_H_\r
 #define FEE_CFG_H_\r
 \r
+#include "MemIf_Types.h"\r
+\r
+#define FEE_DEV_ERROR_DETECT                   STD_ON          // Activate/Deactivate Dev Error Detection and Notification.\r
+#define FEE_VERSION_INFO_API                   STD_ON          // Activate/Deactivate ver info API.\r
+#define FEE_POLLING_MODE                               STD_OFF         // OFF..ON\r
+\r
+#define FEE_INDEX                                                      0\r
+#define FEE_VIRTUAL_PAGE_SIZE                          4               // 0..65535\r
 #endif /*FEE_CFG_H_*/\r
index bd84b79702352135802222045e5e752d95ba0fb7..85e2d070d3cf83267df1cd41afd7621cca8b1a35 100644 (file)
@@ -23,7 +23,9 @@
 #ifndef FEE_H_\r
 #define FEE_H_\r
 \r
+#include "Std_Types.h"\r
 #include "Fee_Cfg.h"\r
+#include "Fls.h"\r
 \r
 \r
 #define FEE_MODULE_ID                  MODULE_ID_FEE\r
 #define FEE_AR_MINOR_VERSION   0\r
 #define FEE_AR_PATCH_VERSION   1\r
 \r
+#if (FEE_DEV_ERROR_DETECT == STD_ON)\r
+// Error codes reported by this module defined by AUTOSAR\r
+#define FEE_INVALID_BLOCK_ID                           0x02\r
+\r
+\r
+// Other error codes reported by this module\r
+#define FEE_PARAM_OUT_OF_RANGE                         0x40\r
+#define FEE_UNEXPECTED_STATE                           0x41\r
+#define FEE_E_WRONG_CONFIG                                     0xfd\r
+#define FEE_E_UNEXPECTED_EXECUTION                     0xfe\r
+#define FEE_E_NOT_IMPLEMENTED_YET                      0xff\r
+\r
+// Service ID in this module\r
+#define FEE_INIT                                                               0x00\r
+#define FEE_SET_MODE_ID                                                        0x01\r
+#define FEE_READ_ID                                                            0x02\r
+#define FEE_WRITE_ID                                                   0x03\r
+#define FEE_CANCEL_ID                                                  0x04\r
+#define FEE_GET_STATUS_ID                                              0x05\r
+#define FEE_GET_JOB_RESULT_ID                                  0x06\r
+#define FEE_INVALIDATE_BLOCK_ID                                        0x07\r
+#define FEE_GET_VERSION_INFO_ID                                        0x08\r
+#define FEE_ERASE_IMMEDIATE_ID                                 0x09\r
+#define FEE_JOB_END_NOTIFICTION_ID                             0x10\r
+#define FEE_JOB_ERROR_NOTIFICTION_ID                   0x11\r
+#define FEE_MAIN_FUNCTION_ID                                   0x12\r
+\r
+#define FEE_GLOBAL_ID                                                  0xff\r
+\r
+#endif\r
+\r
+\r
 #if ( FEE_VERSION_INFO_API == STD_ON )\r
 #define Fee_GetVersionInfo(_vi) STD_GET_VERSION_INFO(_vi, FEE) /** @req FEE093 */\r
 #endif /* FEE_VERSION_INFO_API */\r
diff --git a/include/Fee_ConfigTypes.h b/include/Fee_ConfigTypes.h
new file mode 100644 (file)
index 0000000..e6eb36f
--- /dev/null
@@ -0,0 +1,64 @@
+/* -------------------------------- Arctic Core ------------------------------\r
+ * Arctic Core - the open source AUTOSAR platform http://arccore.com\r
+ *\r
+ * Copyright (C) 2009  ArcCore AB <contact@arccore.com>\r
+ *\r
+ * This source code is free software; you can redistribute it and/or modify it\r
+ * under the terms of the GNU General Public License version 2 as published by the\r
+ * Free Software Foundation; See <http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt>.\r
+ *\r
+ * This program is distributed in the hope that it will be useful, but\r
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY\r
+ * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License\r
+ * for more details.\r
+ * -------------------------------- Arctic Core ------------------------------*/\r
+\r
+\r
+\r
+#ifndef FEE_CONFIG_TYPES_H_\r
+#define FEE_CONFIG_TYPES_H_\r
+\r
+#include "Fee_Types.h"\r
+\r
+\r
+/*\r
+ * Callback function prototypes\r
+ */\r
+\r
+typedef void (*Fee_JobEndCallbackFunctionType)(void);  /** @req FEE098 */\r
+typedef void (*Fee_JobErrorCallbackFunctionType)(void);        /** @req FEE099 */\r
+\r
+/*\r
+ * Containers and configuration parameters
+ */\r
+\r
+typedef struct {\r
+       Fee_JobEndCallbackFunctionType          NvmJobEndCallbackNotificationCallback;\r
+       Fee_JobErrorCallbackFunctionType        NvmJobErrorCallbackNotificationCallback;\r
+       // The rest of the parameters is realized in Fee_Cfg.h\r
+} Fee_GeneralType;     /** @req FEE039 */\r
+\r
+typedef struct {\r
+       uint8   DeviceIndex;                    /** @req FEE106 */      // Needed by NvM and MemIf\r
+       uint16  BlockNumber;                    /** @req FEE107 */\r
+       uint16  BlockSize;                              /** @req FEE108 */\r
+       boolean ImmediateData;                  /** @req FEE109 */\r
+       uint32  NumberOfWriteCycles;    /** @req FEE110 */\r
+\r
+} Fee_BlockConfigType;                         /** @req FEE040 */\r
+\r
+typedef struct {\r
+       // Containers\r
+       Fee_GeneralType                                 General;                        // 1\r
+       const Fee_BlockConfigType               *BlockConfig;           // 1..*\r
+} NvM_ConfigType;\r
+\r
+/*\r
+ * Make the Fee_Config visible for others.\r
+ */\r
+extern const Fee_ConfigType Fee_Config;\r
+\r
+\r
+\r
+\r
+#endif /*FEE_CONFIG_TYPES_H_*/\r
index 9eef5a916e3bdd45d5eebe562a6a386e9ef173bb..d5a5aa7508d95a0df357a48857ab3de670ea2be0 100644 (file)
@@ -62,7 +62,7 @@
 #define NVM_E_NOT_IMPLEMENTED_YET                      0xff\r
 \r
 // Service ID in this module\r
-#define NVM_INIT                                                               0x00\r
+#define NVM_INIT_ID                                                            0x00\r
 #define NVM_SET_DATA_INDEX_ID                                  0x01\r
 #define NVM_GET_DATA_INDEX_ID                                  0x02\r
 #define NVM_SET_BLOCK_PROTECTION_ID                            0x03\r
@@ -81,7 +81,7 @@
 \r
 #define NVM_LOC_READ_BLOCK_ID                                  0x40\r
 #define NVM_LOC_WRITE_BLOCK_ID                                 0x41\r
-#define DEM_GLOBAL_ID                                                  0xff\r
+#define NVM_GLOBAL_ID                                                  0xff\r
 \r
 #endif\r
 \r
diff --git a/memory/Fee/Fee.c b/memory/Fee/Fee.c
new file mode 100644 (file)
index 0000000..c498a96
--- /dev/null
@@ -0,0 +1,83 @@
+/* -------------------------------- Arctic Core ------------------------------\r
+ * Arctic Core - the open source AUTOSAR platform http://arccore.com\r
+ *\r
+ * Copyright (C) 2009  ArcCore AB <contact@arccore.com>\r
+ *\r
+ * This source code is free software; you can redistribute it and/or modify it\r
+ * under the terms of the GNU General Public License version 2 as published by the\r
+ * Free Software Foundation; See <http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt>.\r
+ *\r
+ * This program is distributed in the hope that it will be useful, but\r
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY\r
+ * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License\r
+ * for more details.\r
+ * -------------------------------- Arctic Core ------------------------------*/\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+\r
+#include "Fee.h"\r
+#include "Fee_Cbk.h"\r
+#include "Rte.h" // ???\r
+#if defined(USE_DEM)\r
+#include "Dem.h"\r
+#endif\r
+//#include "SchM_NvM.h"\r
+#include "MemMap.h"\r
+\r
+/*\r
+ * Local definitions
+ */\r
+#if  ( FEE_DEV_ERROR_DETECT == STD_ON )\r
+#include "Det.h"\r
+#define VALIDATE(_exp,_api,_err ) \\r
+        if( !(_exp) ) { \\r
+          Det_ReportError(MODULE_ID_FEE, 0, _api, _err); \\r
+        }\r
+\r
+#define VALIDATE_RV(_exp,_api,_err,_rv ) \\r
+        if( !(_exp) ) { \\r
+          Det_ReportError(MODULE_ID_FEE, 0, _api, _err); \\r
+          return _rv; \\r
+        }\r
+\r
+#define VALIDATE_NO_RV(_exp,_api,_err ) \\r
+  if( !(_exp) ) { \\r
+          Det_ReportError(MODULE_ID_FEE, 0, _api, _err); \\r
+          return; \\r
+        }\r
+#define DET_REPORTERROR(_module,_instance,_api,_err) Det_ReportError(_module,_instance,_api,_err)\r
+\r
+#else\r
+#define VALIDATE(_exp,_api,_err )\r
+#define VALIDATE_RV(_exp,_api,_err,_rv )\r
+#define VALIDATE_NO_RV(_exp,_api,_err )\r
+#define DET_REPORTERROR(_module,_instance,_api,_err)\r
+#endif\r
+\r
+// State variable\r
+typedef enum {\r
+  FEE_UNINITIALIZED = 0,\r
+  FEE_IDLE,\r
+} FeeStateType;\r
+\r
+static FeeStateType feeState = FEE_UNINITIALIZED;\r
+\r
+\r
+void Fee_Init(void)\r
+{\r
+\r
+       // Set status to initialized\r
+       feeState = FEE_IDLE;\r
+}\r
+\r
+\r
+void Fee_MainFunction(void)\r
+{\r
+}\r
+\r