Add low level template module for dataflash drive.
[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                  * Put here your code to enable
62                  * dataflash memory
63                  */
64         else
65                 /*
66                  * Put here your code to disable
67                  * dataflash memory
68                  */
69 }
70
71 /**
72  * Reset data flash memory.
73  *
74  * This function provide to send reset signal to
75  * dataflash memory. You must impement it comly to a dataflash
76  * memory datasheet that describe a reset procedure for select
77  * device.
78  *
79  */
80 void dataflash_hw_reset(void)
81 {
82     /*
83      * Put here your code to reset
84      * data flash memory
85      */
86
87 }
88