Contiki 3.x
config-board.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2014, Eistec AB.
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  * 1. Redistributions of source code must retain the above copyright
9  * notice, this list of conditions and the following disclaimer.
10  * 2. Redistributions in binary form must reproduce the above copyright
11  * notice, this list of conditions and the following disclaimer in the
12  * documentation and/or other materials provided with the distribution.
13  * 3. Neither the name of the copyright holder nor the names of its contributors
14  * may be used to endorse or promote products derived from this software
15  * without specific prior written permission.
16  *
17  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
18  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
21  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27  * POSSIBILITY OF SUCH DAMAGE.
28  *
29  * This file is part of the Mulle platform port of the Contiki operating system.
30  *
31  */
32 
33 /**
34  * \file
35  * Board configuration defines for Mulle platform.
36  * \author
37  * Joakim Gebart <joakim.gebart@eistec.se>
38  */
39 
40 #ifndef MULLE_CONFIG_BOARD_H_
41 #define MULLE_CONFIG_BOARD_H_
42 
43 #include "adc.h"
44 
45 #ifdef __cplusplus
46 extern "C" {
47 #endif
48 
49 /** Disable hardware watchdog, for debugging purposes, don't use this on production builds. */
50 #define DISABLE_WDOG 1
51 
52 /**
53  * CPU silicon revision (some registers are moved or added between revisions 1 and 2)
54  */
55 #if !defined(MULLE_BOARD_SERIAL_NUMBER)
56 /* Default to revision 2 unless the serial number is specified in the build. */
57 #define K60_CPU_REV 2
58 #elif defined(MULLE_BOARD_SERIAL_NUMBER) && \
59  (MULLE_BOARD_SERIAL_NUMBER >= 200) && \
60  (MULLE_BOARD_SERIAL_NUMBER <= 219)
61 /* Only Mulles with serial numbers 200 through 219 have revision 1.x silicon
62  * (revision 1.4, 4N30D mask set), see the sticker on the CPU top on the Mulle */
63 #define K60_CPU_REV 1
64 #else
65 /* Newer boards have the revision 2 silicon */
66 #define K60_CPU_REV 2
67 #endif
68 
69 /**
70  * Voltage reference high for ADC computations (millivolts).
71  */
72 #define MULLE_ADC_VREFH_MILLIVOLTS 3300u
73 
74 /**
75  * Voltage reference low for ADC computations (millivolts).
76  */
77 #define MULLE_ADC_VREFL_MILLIVOLTS 0u
78 
79 /**
80  * Total span of ADC measurement (millivolts).
81  */
82 #define MULLE_ADC_VREFHL_SCALE_MILLIVOLTS ((MULLE_ADC_VREFH_MILLIVOLTS) - (MULLE_ADC_VREFL_MILLIVOLTS))
83 
84 /**
85  * Which channel should perform Vbat measurements
86  */
87 #define MULLE_ADC_VBAT_ADC_NUM 1
88 
89 #define MULLE_ADC_VBAT_CHANNEL ADC_CH_DAD0
90 
91 #define MULLE_ADC_VCHR_ADC_NUM 1
92 
93 #define MULLE_ADC_VCHR_CHANNEL ADC_CH_AD19
94 
95 /**
96  * UART module used for debug printf.
97  */
98 #define BOARD_DEBUG_UART_NUM 1
99 
100 /**
101  * Baud rate of debug UART.
102  */
103 #define BOARD_DEBUG_UART_BAUD 115200
104 
105 /**
106  * PORT module containing the TX pin of the debug UART.
107  */
108 #define BOARD_DEBUG_UART_TX_PIN_PORT PORTC
109 
110 /**
111  * PORT module containing the RX pin of the debug UART.
112  */
113 #define BOARD_DEBUG_UART_RX_PIN_PORT PORTC
114 
115 /**
116  * Pin number within the PORT module of the TX pin of the debug UART.
117  */
118 #define BOARD_DEBUG_UART_TX_PIN_NUMBER 4
119 
120 /**
121  * Pin number within the PORT module of the RX pin of the debug UART.
122  */
123 #define BOARD_DEBUG_UART_RX_PIN_NUMBER 3
124 
125 /**
126  * Function number in the PORT mux for the TX pin of the debug UART.
127  */
128 #define BOARD_DEBUG_UART_TX_PIN_MUX 3
129 
130 /**
131  * Function number in the PORT mux for the RX pin of the debug UART.
132  */
133 #define BOARD_DEBUG_UART_RX_PIN_MUX 3
134 
135 /**
136  * Number of UART modules in CPU.
137  */
138 #define NUM_UARTS 5
139 
140 /**
141  * UART module used for SLIP communications.
142  *
143  * This string is passed to open() during slip_init_arch().
144  * This is usually the module name within double-quotes e.g. "UART0"
145  */
146 #define BOARD_SLIP_UART_NAME "UART1"
147 
148 /**
149  * UART module used for SLIP communications.
150  */
151 #define BOARD_SLIP_UART_NUM 1
152 
153 /**
154  * RTC crystal load capacitance configuration bits.
155  */
156 /* enable 12pF load capacitance, might need adjusting.. */
157 #define BOARD_RTC_LOAD_CAP_BITS (RTC_CR_SC8P_MASK | RTC_CR_SC4P_MASK)
158 
159 #ifdef __cplusplus
160 } /* extern "C" */
161 #endif
162 
163 #endif /* !defined(MULLE_CONFIG_BOARD_H_) */