Sample SPI drivers for a number of the Adesto Technologies flash devices.
user_config.h
Go to the documentation of this file.
1 /*
2  * The Clear BSD License
3  * Copyright (c) 2018 Adesto Technologies Corporation, Inc
4  * All rights reserved.
5  *
6  * Redistribution and use in source and binary forms, with or without modification,
7  * are permitted (subject to the limitations in the disclaimer below) provided
8  * that the following conditions are met:
9  *
10  * o Redistributions of source code must retain the above copyright notice, this list
11  * of conditions and the following disclaimer.
12  *
13  * o Redistributions in binary form must reproduce the above copyright notice, this
14  * list of conditions and the following disclaimer in the documentation and/or
15  * other materials provided with the distribution.
16  *
17  * o Neither the name of the copyright holder nor the names of its
18  * contributors may be used to endorse or promote products derived from this
19  * software without specific prior written permission.
20  *
21  * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY THIS LICENSE.
22  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
23  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
24  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
25  * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
26  * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
27  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
28  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
29  * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
31  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32  */
33 
41 #ifndef USER_CONFIG_H_
42 #define USER_CONFIG_H_
43 
44 
45 /* \=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\
46  * @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
47  * ----------------- USER DEFINED PORTION ----------------
48  * @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
49  * /=/=/=/=/=/=/=/=/=/=/=/=/=/=/=/=/=/=/=/=/=/=/=/=/=/=/=/
50  */
51 
52 /*
53  *
54  * This portion of the code contains the various user definitions
55  * and functions. These include the following:
56  *
57  * 1. MCU specific include files
58  * 2. Part number
59  * 3. SPI ports and pins
60  * 3. User defined function calls to clear/set/init pins
61  * 4. Board initialization function
62  */
63 
64 /*
65  * @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
66  * ----------------- MCU Specific Includes ---------------
67  * @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
68  */
69 
70 // Included for board initialization (see USER_CONFIG_BoardInit()).
71 // #include "board.h" <- NXP
72 // Included for board initialization (see USER_CONFIG_BoardInit()).
73 // #include "peripherals.h"
74 // Included for board initialization (see USER_CONFIG_BoardInit()).
75 // #include "pin_mux.h" <- NXP
76 // Included for GPIO library function calls (see USER_CONFIG_BoardInit()).
77 // #include "fsl_gpio.h" <- NXP
78 
79 /*
80  * @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
81  * --------------------- Part Number ---------------------
82  * @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
83  */
84 
86 #define PARTNO ATxxxx /* <- Replace with the device being used. */
87 #define ALL 1 /* <- Replace with 0 if selecting a part above. */
88 
89 /*
90  * List of supported parts:
91  * RM331x
92  * AT25XE512C
93  * AT25XE011
94  * AT25XE021A
95  * AT25XE041B
96  * AT25DN256
97  * AT25DN512C
98  * AT25DN011
99  * AT25DF256
100  * AT25DF512C
101  * AT25DF011
102  * AT25DF021A
103  * AT25DF041B
104  * AT25XV021A
105  * AT25XV041B
106  * AT45DB021E
107  * AT45DB041E
108  * AT45DB081E
109  * AT45DB161E
110  * AT45DB321E
111  * AT45DB641E
112  * AT45DQ161
113  * AT45DQ321
114  * AT25PE20
115  * AT25PE40
116  * AT25PE80
117  * AT25PE16
118  * AT25SF041
119  * AT25SF081
120  * AT25SF161
121  * AT25SF321
122  * AT25SF641
123  * AT25SL321
124  * AT25SL641
125  * AT25SL128A
126  * AT25DL081
127  * AT25DL161
128  * AT25DF081A
129  * AT25DF321A
130  * AT25DF641A
131  * AT25QL321
132  * AT25QL641
133  * AT25QL128A
134  * AT25QF641
135  */
136 
137 /*
138  * @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
139  * -------------------- Ports and Pins -------------------
140  * @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
141  */
142 
146 #define USER_CONFIG_CSB_PORT GPIO3_BASE
147 
150 #define USER_CONFIG_TRIGGER_PORT GPIO3_BASE
151 
154 #define USER_CONFIG_SCK_PORT GPIO3_BASE
155 
158 #define USER_CONFIG_MOSI_PORT GPIO3_BASE
159 
162 #define USER_CONFIG_MISO_PORT GPIO3_BASE
163 
166 #define USER_CONFIG_IO2_PORT GPIO3_BASE
167 
170 #define USER_CONFIG_IO3_PORT GPIO3_BASE
171 
177 #define USER_CONFIG_CSB_PIN 6U
178 #define USER_CONFIG_TRIGGER_PIN 2U
180 #define USER_CONFIG_SCK_PIN 7U
182 #define USER_CONFIG_MOSI_PIN 8U
184 #define USER_CONFIG_MISO_PIN 9U
186 #define USER_CONFIG_IO2_PIN 10U
188 #define USER_CONFIG_IO3_PIN 11U
190 #define DELAY 5U
192 
193 
194 /*
195  * @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
196  * ---------------- Read, Write, Init Port/Pins --------------
197  * @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
198  */
199 
206 
217 void USER_CONFIG_PinInit(uint32_t port, uint32_t pin, enum directionIO direction);
218 
227 void USER_CONFIG_PinClear(uint32_t port, uint32_t pin);
228 
237 void USER_CONFIG_PinSet(uint32_t port, uint32_t pin);
238 
247 uint8_t USER_CONFIG_PinRead(uint32_t port, uint32_t pin);
248 
249 
250 /*
251  * @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
252  * ---------------------- Board Init ---------------------
253  * @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
254  */
255 
262 void USER_CONFIG_BoardInit();
263 
264 #endif
void USER_CONFIG_BoardInit()
Configures the board for program usage. Initializes the requisite ports/pins for use as GPIOs...
Definition: user_config.c:82
directionIO
Enumeration used when initializing pins as inputs or outputs. OUTPUT = 0, INPUT = 1...
Definition: user_config.h:205
void USER_CONFIG_PinSet(uint32_t port, uint32_t pin)
Sets a given pin on a port to HIGH.
Definition: user_config.c:70
void USER_CONFIG_PinClear(uint32_t port, uint32_t pin)
Clears a given pin on a port to LOW.
Definition: user_config.c:64
uint8_t USER_CONFIG_PinRead(uint32_t port, uint32_t pin)
Reads the voltage on a given pin.
Definition: user_config.c:76
void USER_CONFIG_PinInit(uint32_t port, uint32_t pin, enum directionIO direction)
Initializes a given pin as either an input or output. When porting, this function must be redefined...
Definition: user_config.c:44