]> rtime.felk.cvut.cz Git - arc.git/blob - boards/mpc5606b_xpc560b/config/Eep_Lcfg.c
added 5606b support(5607b should be mostly the exact same so added that for linkfile...
[arc.git] / boards / mpc5606b_xpc560b / config / Eep_Lcfg.c
1 /* -------------------------------- Arctic Core ------------------------------
2  * Arctic Core - the open source AUTOSAR platform http://arccore.com
3  *
4  * Copyright (C) 2009  ArcCore AB <contact@arccore.com>
5  *
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>.
9  *
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
13  * for more details.
14  * -------------------------------- Arctic Core ------------------------------*/
15
16
17 /* Configured for:
18  *   Microchip 25LC160B (32 bytes pages)
19  */
20
21
22 #include "Eep.h"
23 #include "Spi.h"
24 #include "debug.h"
25
26 #define E2_M9525                1
27 #define E2_25LC160B             2
28
29 #define E2_CHIP  E2_25LC160B
30
31
32 static void _JobEndNotify(){
33         DEBUG(DEBUG_LOW,"EEP JOB END NOTIFICATION\n");
34 }
35 static void _JobErrorNotify(){
36         DEBUG(DEBUG_LOW,"EEP JOB ERROR NOTIFICATION\n");
37 }
38
39 /*
40  * TODO: probably better to
41  */
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
46
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
51
52
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,
59
60         // Jobs may be left out..
61
62         // Channels used
63         .EepCmdChannel  = SPI_CH_EEP_CMD,
64         .EepAddrChannel = SPI_CH_EEP_ADDR,
65         .EepWrenChannel = SPI_CH_EEP_WREN,
66         .EepDataChannel = SPI_CH_EEP_DATA,
67 };
68
69
70
71 const Eep_ConfigType EepConfigData[] = {
72     {
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.
76     .EepBaseAddress =  0,
77
78     // This parameter is the default EEPROM device mode after initialization.
79     .EepDefaultMode = MEMIF_MODE_FAST,
80
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,
89 #endif
90     // This parameter is a reference to a callback function for positive job result
91     .Eep_JobEndNotification = &_JobEndNotify,
92
93     // This parameter is a reference to a callback function for negative job result
94     .Eep_JobErrorNotification = &_JobErrorNotify,
95
96     .EepNormalReadBlockSize = 4,
97
98     // Number of bytes written within one job processing cycle in normal mode.
99     .EepNormalWriteBlockSize = 1,
100
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 */
107 #endif
108
109     .externalDriver =  &EepExternalDriver,
110     }
111 };