1 /* -------------------------------- Arctic Core ------------------------------
2 * Arctic Core - the open source AUTOSAR platform http://arccore.com
4 * Copyright (C) 2009 ArcCore AB <contact@arccore.com>
6 * This source code is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License version 2 as published by the
8 * Free Software Foundation; See <http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt>.
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * -------------------------------- Arctic Core ------------------------------*/
18 * Microchip 25LC160B (32 bytes pages)
29 #define E2_CHIP E2_25LC160B
32 static void _JobEndNotify(){
33 DEBUG(DEBUG_LOW,"EEP JOB END NOTIFICATION\n");
35 static void _JobErrorNotify(){
36 DEBUG(DEBUG_LOW,"EEP JOB ERROR NOTIFICATION\n");
40 * TODO: probably better to
42 #define SPI_SEQ_EEP_CMD SPI_SEQ_CMD
43 #define SPI_SEQ_EEP_CMD2 SPI_SEQ_CMD2
44 #define SPI_SEQ_EEP_READ SPI_SEQ_READ
45 #define SPI_SEQ_EEP_WRITE SPI_SEQ_WRITE
47 #define SPI_CH_EEP_CMD SPI_CH_CMD
48 #define SPI_CH_EEP_ADDR SPI_CH_ADDR
49 #define SPI_CH_EEP_WREN SPI_CH_WREN
50 #define SPI_CH_EEP_DATA SPI_CH_DATA
53 const Eep_ExternalDriverType EepExternalDriver = {
54 // READ and WRITE sequences and ID's defined in Spi_Cfg.h
55 .EepCmdSequence = SPI_SEQ_EEP_CMD,
56 .EepCmd2Sequence = SPI_SEQ_EEP_CMD2,
57 .EepReadSequence = SPI_SEQ_EEP_READ,
58 .EepWriteSequence = SPI_SEQ_EEP_WRITE,
60 // Jobs may be left out..
63 .EepCmdChannel = SPI_CH_EEP_CMD,
64 .EepAddrChannel = SPI_CH_EEP_ADDR,
65 .EepWrenChannel = SPI_CH_EEP_WREN,
66 .EepDataChannel = SPI_CH_EEP_DATA,
71 const Eep_ConfigType EepConfigData[] = {
73 // call cycle of the job processing function during write/erase operations. Unit: [s]
74 // .EepJobCallCycle = 0.2,
75 // This parameter is the EEPROM device base address.
78 // This parameter is the default EEPROM device mode after initialization.
79 .EepDefaultMode = MEMIF_MODE_FAST,
81 #if (E2_CHIP == E2_25LC160B)
82 // This parameter is the number of bytes read within one job processing cycle in fast mode
83 .EepFastReadBlockSize = 32,
84 // This parameter is the number of bytes written within one job processing cycle in fast mode
85 .EepFastWriteBlockSize = 32,
86 #elif (E2_CHIP == E2_M9525)
87 .EepFastReadBlockSize = 64,
88 .EepFastWriteBlockSize = 64,
90 // This parameter is a reference to a callback function for positive job result
91 .Eep_JobEndNotification = &_JobEndNotify,
93 // This parameter is a reference to a callback function for negative job result
94 .Eep_JobErrorNotification = &_JobErrorNotify,
96 .EepNormalReadBlockSize = 4,
98 // Number of bytes written within one job processing cycle in normal mode.
99 .EepNormalWriteBlockSize = 1,
101 // This parameter is the used size of EEPROM device in bytes.
102 .EepSize = 0x1000, /* 32K bit for M9525, 16K bit 25LC160B*/
103 #if (E2_CHIP == E2_25LC160B)
104 .EepPageSize = 32, /* 64 for M9525, 32 for 25LC160B, 16 for 25LC160A */
105 #elif (E2_CHIP == E2_M9525)
106 .EepPageSize = 64, /* 64 for M9525, 32 for 25LC160B, 16 for 25LC160A */
109 .externalDriver = &EepExternalDriver,