1832f6ec8c6188c9035670fccedbea2a7c5d488a
[bertos.git] / bertos / hw / hw_dataflash.c
1 /**
2  * \file
3  * <!--
4  * Copyright 2008 Develer S.r.l. (http://www.develer.com/)
5  * All Rights Reserved.
6  * -->
7  *
8  * \brief Dataflash HW control routines.
9  *
10  * \version $Id$
11  * \author Francesco Sacchi <batt@develer.com>
12  */
13
14 #include "hw_dataflash.h"
15
16 #include <cfg/compiler.h>
17 #include <cfg/module.h>
18 #include <cfg/macros.h>
19
20 #include <io/arm.h>
21
22
23 MOD_DEFINE(hw_dataflash);
24
25 /**
26  * Data flash init function.
27  *
28  * This function provide to initialize all that
29  * needs to drive a dataflash memory.
30  * Generaly needs to init pins to drive a CS line
31  * and reset line.
32  */
33 void dataflash_hw_init(void)
34 {
35     //Disable CS line (remove if not needed)
36         dataflash_hw_setCS(false);
37
38         /*
39          * Put here your code!
40          *
41          * Note:
42          * - if you drive manualy CS line, here init a CS pin
43          * - if you use a dedicated reset line, here init a reset pin
44          */
45
46         MOD_INIT(hw_dataflash);
47 }
48
49 /**
50  * Chip Select drive.
51  *
52  * This function enable or disable a CS line.
53  * You must implement this function comply to a dataflash
54  * memory datasheet to allow the drive to enable a memory
55  * when \p enable flag is true, and disable it when is false.
56  */
57 void dataflash_hw_setCS(bool enable)
58 {
59         if (enable)
60         {
61                 /*
62                  * Put here your code to enable
63                  * dataflash memory
64                  */
65         }
66         else
67         {
68                 /*
69                  * Put here your code to disable
70                  * dataflash memory
71                  */
72         }
73 }
74
75 /**
76  * Reset data flash memory.
77  *
78  * This function provide to send reset signal to
79  * dataflash memory. You must impement it comly to a dataflash
80  * memory datasheet to allow the drive to set a reset pin
81  * when \p enable flag is true, and disable it when is false.
82  *
83  */
84 void dataflash_hw_setReset(bool enable)
85 {
86         if (enable)
87         {
88                 /*
89                  * Put here your code to set reset of
90                  * dataflash memory
91                  */
92         }
93         else
94         {
95                 /*
96                  * Put here your code to clear reset of
97                  * dataflash memory
98                  */
99         }
100 }
101