Contiki-NG
Toggle main menu visibility
Loading...
Searching...
No Matches
msp430-def.h
1
/*
2
* Copyright (c) 2007, Swedish Institute of Computer Science
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 Institute 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 INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
18
* 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 INSTITUTE OR CONTRIBUTORS BE LIABLE
21
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27
* SUCH DAMAGE.
28
*/
29
30
#ifndef MSP430_DEF_H_
31
#define MSP430_DEF_H_
32
33
#ifdef __IAR_SYSTEMS_ICC__
34
#include <intrinsics.h>
35
#include <in430.h>
36
#include <msp430.h>
37
#define dint() __disable_interrupt()
38
#define eint() __enable_interrupt()
39
#define __MSP430__ 1
40
41
#else
/* __IAR_SYSTEMS_ICC__ */
42
43
#if defined(__GNUC__) && (__GNUC__ >= 9)
44
#include <msp430.h>
45
#define nop() _no_operation()
46
#define eint() __eint()
47
#define dint() __dint()
48
#elif defined(__MSPGCC__)
49
#include <msp430.h>
50
#include <legacymsp430.h>
51
#else
/* __MSPGCC__ */
52
#include <io.h>
53
#include <signal.h>
54
#if !defined(MSP430_MEMCPY_WORKAROUND) && (__GNUC__ < 4)
55
#define MSP430_MEMCPY_WORKAROUND 1
56
#endif
57
#endif
/* __MSPGCC__ */
58
59
#endif
/* __IAR_SYSTEMS_ICC__ */
60
61
/* Master interrupt state representation data type */
62
#define INT_MASTER_CONF_STATUS_DATATYPE __istate_t
63
64
#ifndef BV
65
#define BV(x) (1 << x)
66
#endif
67
68
#include <stdint.h>
69
70
/* Platform typedefs. */
71
typedef
unsigned
short
uip_stats_t;
72
typedef
long
off_t;
73
74
/* Make clock_time_t smaller than default for size reasons. */
75
#define CLOCK_CONF_SIZE 4
76
/* Our clock resolution, this is the same as Unix HZ. */
77
#define CLOCK_CONF_SECOND 128UL
78
79
/* Use 16-bit rtimer (default in Contiki-NG is 32) */
80
#define RTIMER_CONF_CLOCK_SIZE 2
81
82
typedef
int
spl_t;
83
spl_t
splhigh_
(
void
);
84
85
#define splhigh() splhigh_()
86
#ifdef __IAR_SYSTEMS_ICC__
87
#define splx(sr) __bis_SR_register(sr)
88
#else
89
#define splx(sr) __asm__ __volatile__("bis %0, r2" : : "r" (sr))
90
#endif
91
92
/* Workaround for bug in msp430-gcc compiler */
93
#if defined(__MSP430__) && defined(__GNUC__) && MSP430_MEMCPY_WORKAROUND
94
#ifndef memcpy
95
#include <string.h>
96
97
void
*w_memcpy(
void
*out,
const
void
*in,
size_t
n);
98
#define memcpy(dest, src, count) w_memcpy(dest, src, count)
99
100
void
*w_memset(
void
*out,
int
value
,
size_t
n);
101
#define memset(dest, value, count) w_memset(dest, value, count)
102
103
#endif
/* memcpy */
104
#endif
/* __GNUC__ && __MSP430__ && MSP430_MEMCPY_WORKAROUND */
105
106
#define memory_barrier() asm volatile("" : : : "memory")
107
108
#define MSP430_REQUIRE_CPUON 0
109
#define MSP430_REQUIRE_LPM1 1
110
#define MSP430_REQUIRE_LPM2 2
111
#define MSP430_REQUIRE_LPM3 3
112
113
/* Platform-specific checksum implementation */
114
#define UIP_ARCH_IPCHKSUM 1
115
116
#define BAUD2UBR(baud) ((F_CPU/baud))
117
118
void
msp430_add_lpm_req(
int
req);
119
void
msp430_remove_lpm_req(
int
req);
120
void
msp430_cpu_init(
void
);
/* Rename to cpu_init() later! */
121
void
msp430_sync_dco
(
void
);
122
#define cpu_init() msp430_cpu_init()
123
void
*sbrk(
int
);
124
125
#endif
/* MSP430_DEF_H_ */
value
static int value(int type)
Definition
cc2538-temp-sensor.c:49
splhigh_
int splhigh_(void)
Mask all interrupts that can be masked.
Definition
msp430.c:166
msp430_sync_dco
void msp430_sync_dco(void)
Synchronize DCO (no-op for FR5969, DCO is automatically calibrated).
Definition
msp430.c:157
arch
cpu
msp430
msp430-def.h
Generated on
for Contiki-NG by
1.17.0