1 |
595 |
jeremybenn |
/**************************************************************************//**
|
2 |
|
|
* @file
|
3 |
|
|
* @brief DVK Board Support, master header file
|
4 |
|
|
* @author Energy Micro AS
|
5 |
|
|
* @version 1.0.1
|
6 |
|
|
******************************************************************************
|
7 |
|
|
* @section License
|
8 |
|
|
* <b>(C) Copyright 2009 Energy Micro AS, http://www.energymicro.com</b>
|
9 |
|
|
******************************************************************************
|
10 |
|
|
*
|
11 |
|
|
* This source code is the property of Energy Micro AS. The source and compiled
|
12 |
|
|
* code may only be used on Energy Micro "EFM32" microcontrollers.
|
13 |
|
|
*
|
14 |
|
|
* This copyright notice may not be removed from the source code nor changed.
|
15 |
|
|
*
|
16 |
|
|
* DISCLAIMER OF WARRANTY/LIMITATION OF REMEDIES: Energy Micro AS has no
|
17 |
|
|
* obligation to support this Software. Energy Micro AS is providing the
|
18 |
|
|
* Software "AS IS", with no express or implied warranties of any kind,
|
19 |
|
|
* including, but not limited to, any implied warranties of merchantability
|
20 |
|
|
* or fitness for any particular purpose or warranties against infringement
|
21 |
|
|
* of any proprietary rights of a third party.
|
22 |
|
|
*
|
23 |
|
|
* Energy Micro AS will not be liable for any consequential, incidental, or
|
24 |
|
|
* special damages, or any other relief, or for any claim by any third party,
|
25 |
|
|
* arising from your use of this Software.
|
26 |
|
|
*
|
27 |
|
|
*****************************************************************************/
|
28 |
|
|
|
29 |
|
|
#ifndef __DVK_H
|
30 |
|
|
#define __DVK_H
|
31 |
|
|
|
32 |
|
|
#include <stdint.h>
|
33 |
|
|
#include "dvk_boardcontrol.h"
|
34 |
|
|
#include "dvk_bcregisters.h"
|
35 |
|
|
|
36 |
|
|
/* IF not user overrides default, try to decide DVK access interface based on
|
37 |
|
|
* part number */
|
38 |
|
|
#ifndef DVK_SPI_CONTROL
|
39 |
|
|
#ifndef DVK_EBI_CONTROL
|
40 |
|
|
|
41 |
|
|
#if defined(EFM32G200F16)
|
42 |
|
|
#define DVK_SPI_CONTROL
|
43 |
|
|
#elif defined(EFM32G200F32)
|
44 |
|
|
#define DVK_SPI_CONTROL
|
45 |
|
|
#elif defined(EFM32G200F64)
|
46 |
|
|
#define DVK_SPI_CONTROL
|
47 |
|
|
#elif defined(EFM32G210F128)
|
48 |
|
|
#define DVK_SPI_CONTROL
|
49 |
|
|
#elif defined(EFM32G230F128)
|
50 |
|
|
#define DVK_SPI_CONTROL
|
51 |
|
|
#elif defined(EFM32G230F32)
|
52 |
|
|
#define DVK_SPI_CONTROL
|
53 |
|
|
#elif defined(EFM32G230F64)
|
54 |
|
|
#define DVK_SPI_CONTROL
|
55 |
|
|
#elif defined(EFM32G280F128)
|
56 |
|
|
#define DVK_EBI_CONTROL
|
57 |
|
|
#elif defined(EFM32G280F32)
|
58 |
|
|
#define DVK_EBI_CONTROL
|
59 |
|
|
#elif defined(EFM32G280F64)
|
60 |
|
|
#define DVK_EBI_CONTROL
|
61 |
|
|
#elif defined(EFM32G290F128)
|
62 |
|
|
#define DVK_EBI_CONTROL
|
63 |
|
|
#elif defined(EFM32G290F32)
|
64 |
|
|
#define DVK_EBI_CONTROL
|
65 |
|
|
#elif defined(EFM32G290F64)
|
66 |
|
|
#define DVK_EBI_CONTROL
|
67 |
|
|
#elif defined(EFM32G840F128)
|
68 |
|
|
#define DVK_SPI_CONTROL
|
69 |
|
|
#elif defined(EFM32G840F32)
|
70 |
|
|
#define DVK_SPI_CONTROL
|
71 |
|
|
#elif defined(EFM32G840F64)
|
72 |
|
|
#define DVK_SPI_CONTROL
|
73 |
|
|
#elif defined(EFM32G880F128)
|
74 |
|
|
#define DVK_SPI_CONTROL
|
75 |
|
|
#elif defined(EFM32G880F32)
|
76 |
|
|
#define DVK_SPI_CONTROL
|
77 |
|
|
#elif defined(EFM32G880F64)
|
78 |
|
|
#define DVK_SPI_CONTROL
|
79 |
|
|
#elif defined(EFM32G890F128)
|
80 |
|
|
#define DVK_SPI_CONTROL
|
81 |
|
|
#elif defined(EFM32G890F32)
|
82 |
|
|
#define DVK_SPI_CONTROL
|
83 |
|
|
#elif defined(EFM32G890F64)
|
84 |
|
|
#define DVK_SPI_CONTROL
|
85 |
|
|
#else
|
86 |
|
|
#define DVK_SPI_CONTROL
|
87 |
|
|
#endif
|
88 |
|
|
|
89 |
|
|
#endif
|
90 |
|
|
#endif
|
91 |
|
|
|
92 |
|
|
/* EBI access */
|
93 |
|
|
void DVK_EBI_init(void);
|
94 |
|
|
void DVK_EBI_disable(void);
|
95 |
|
|
|
96 |
|
|
void DVK_EBI_writeRegister(volatile uint16_t *addr, uint16_t data);
|
97 |
|
|
uint16_t DVK_EBI_readRegister(volatile uint16_t *addr);
|
98 |
|
|
|
99 |
|
|
/* SPI access */
|
100 |
|
|
void DVK_SPI_init(void);
|
101 |
|
|
void DVK_SPI_disable(void);
|
102 |
|
|
|
103 |
|
|
void DVK_SPI_writeRegister(volatile uint16_t *addr, uint16_t data);
|
104 |
|
|
uint16_t DVK_SPI_readRegister(volatile uint16_t *addr);
|
105 |
|
|
|
106 |
|
|
|
107 |
|
|
/* Accodring to configuration, use either SPI or EBI */
|
108 |
|
|
#ifdef DVK_EBI_CONTROL
|
109 |
|
|
#define DVK_writeRegister(A, B) DVK_EBI_writeRegister(A, B)
|
110 |
|
|
#define DVK_readRegister(A) DVK_EBI_readRegister(A)
|
111 |
|
|
#endif
|
112 |
|
|
|
113 |
|
|
#ifdef DVK_SPI_CONTROL
|
114 |
|
|
#define DVK_writeRegister(A, B) DVK_SPI_writeRegister(A, B)
|
115 |
|
|
#define DVK_readRegister(A) DVK_SPI_readRegister(A)
|
116 |
|
|
#endif
|
117 |
|
|
|
118 |
|
|
/* General initialization routines */
|
119 |
|
|
void DVK_init(void);
|
120 |
|
|
void DVK_disable(void);
|
121 |
|
|
|
122 |
|
|
#endif
|