1 |
145 |
olivier.gi |
/*===========================================================================*/
|
2 |
|
|
/* Copyright (C) 2001 Authors */
|
3 |
|
|
/* */
|
4 |
|
|
/* This source file may be used and distributed without restriction provided */
|
5 |
|
|
/* that this copyright statement is not removed from the file and that any */
|
6 |
|
|
/* derivative work contains the original copyright notice and the associated */
|
7 |
|
|
/* disclaimer. */
|
8 |
|
|
/* */
|
9 |
|
|
/* This source file is free software; you can redistribute it and/or modify */
|
10 |
|
|
/* it under the terms of the GNU Lesser General Public License as published */
|
11 |
|
|
/* by the Free Software Foundation; either version 2.1 of the License, or */
|
12 |
|
|
/* (at your option) any later version. */
|
13 |
|
|
/* */
|
14 |
|
|
/* This source is distributed in the hope that it will be useful, but WITHOUT*/
|
15 |
|
|
/* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or */
|
16 |
|
|
/* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public */
|
17 |
|
|
/* License for more details. */
|
18 |
|
|
/* */
|
19 |
|
|
/* You should have received a copy of the GNU Lesser General Public License */
|
20 |
|
|
/* along with this source; if not, write to the Free Software Foundation, */
|
21 |
|
|
/* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */
|
22 |
|
|
/* */
|
23 |
|
|
/*===========================================================================*/
|
24 |
|
|
/* OMSP_FUNC HEADER FILE */
|
25 |
|
|
/*---------------------------------------------------------------------------*/
|
26 |
|
|
/* */
|
27 |
|
|
/* Author(s): */
|
28 |
|
|
/* - Olivier Girard, olgirard@gmail.com */
|
29 |
|
|
/* */
|
30 |
|
|
/*---------------------------------------------------------------------------*/
|
31 |
|
|
/* $Rev: 19 $ */
|
32 |
|
|
/* $LastChangedBy: olivier.girard $ */
|
33 |
|
|
/* $LastChangedDate: 2009-08-04 23:47:15 +0200 (Tue, 04 Aug 2009) $ */
|
34 |
|
|
/*===========================================================================*/
|
35 |
|
|
|
36 |
|
|
//=============================================================================
|
37 |
|
|
// PERIPHERALS REGISTER DEFINITIONS
|
38 |
|
|
//=============================================================================
|
39 |
|
|
|
40 |
|
|
//----------------------------------------------------------
|
41 |
|
|
// SPECIAL FUNCTION REGISTERS
|
42 |
|
|
//----------------------------------------------------------
|
43 |
|
|
#define IE1 (*(volatile unsigned char *) 0x0000)
|
44 |
|
|
#define IFG1 (*(volatile unsigned char *) 0x0002)
|
45 |
|
|
|
46 |
|
|
#define CPU_ID_LO (*(volatile unsigned char *) 0x0004)
|
47 |
|
|
#define CPU_ID_HI (*(volatile unsigned char *) 0x0006)
|
48 |
|
|
|
49 |
|
|
|
50 |
|
|
//----------------------------------------------------------
|
51 |
|
|
// GPIOs
|
52 |
|
|
//----------------------------------------------------------
|
53 |
|
|
#define P1IN (*(volatile unsigned char *) 0x0020)
|
54 |
|
|
#define P1OUT (*(volatile unsigned char *) 0x0021)
|
55 |
|
|
#define P1DIR (*(volatile unsigned char *) 0x0022)
|
56 |
|
|
#define P1IFG (*(volatile unsigned char *) 0x0023)
|
57 |
|
|
#define P1IES (*(volatile unsigned char *) 0x0024)
|
58 |
|
|
#define P1IE (*(volatile unsigned char *) 0x0025)
|
59 |
|
|
#define P1SEL (*(volatile unsigned char *) 0x0026)
|
60 |
|
|
|
61 |
|
|
#define P2IN (*(volatile unsigned char *) 0x0028)
|
62 |
|
|
#define P2OUT (*(volatile unsigned char *) 0x0029)
|
63 |
|
|
#define P2DIR (*(volatile unsigned char *) 0x002A)
|
64 |
|
|
#define P2IFG (*(volatile unsigned char *) 0x002B)
|
65 |
|
|
#define P2IES (*(volatile unsigned char *) 0x002C)
|
66 |
|
|
#define P2IE (*(volatile unsigned char *) 0x002D)
|
67 |
|
|
#define P2SEL (*(volatile unsigned char *) 0x002E)
|
68 |
|
|
|
69 |
|
|
#define P3IN (*(volatile unsigned char *) 0x0018)
|
70 |
|
|
#define P3OUT (*(volatile unsigned char *) 0x0019)
|
71 |
|
|
#define P3DIR (*(volatile unsigned char *) 0x001A)
|
72 |
|
|
#define P3SEL (*(volatile unsigned char *) 0x001B)
|
73 |
|
|
|
74 |
|
|
#define P4IN (*(volatile unsigned char *) 0x001C)
|
75 |
|
|
#define P4OUT (*(volatile unsigned char *) 0x001D)
|
76 |
|
|
#define P4DIR (*(volatile unsigned char *) 0x001E)
|
77 |
|
|
#define P4SEL (*(volatile unsigned char *) 0x001F)
|
78 |
|
|
|
79 |
|
|
#define P5IN (*(volatile unsigned char *) 0x0030)
|
80 |
|
|
#define P5OUT (*(volatile unsigned char *) 0x0031)
|
81 |
|
|
#define P5DIR (*(volatile unsigned char *) 0x0032)
|
82 |
|
|
#define P5SEL (*(volatile unsigned char *) 0x0033)
|
83 |
|
|
|
84 |
|
|
#define P6IN (*(volatile unsigned char *) 0x0034)
|
85 |
|
|
#define P6OUT (*(volatile unsigned char *) 0x0035)
|
86 |
|
|
#define P6DIR (*(volatile unsigned char *) 0x0036)
|
87 |
|
|
#define P6SEL (*(volatile unsigned char *) 0x0037)
|
88 |
|
|
|
89 |
|
|
|
90 |
|
|
//----------------------------------------------------------
|
91 |
|
|
// WATCHDOG TIMER
|
92 |
|
|
//----------------------------------------------------------
|
93 |
|
|
|
94 |
|
|
// Addresses
|
95 |
|
|
#define WDTCTL (*(volatile unsigned int *) 0x0120)
|
96 |
|
|
|
97 |
|
|
// Bit masks
|
98 |
|
|
#define WDTIS0 (0x0001)
|
99 |
|
|
#define WDTIS1 (0x0002)
|
100 |
|
|
#define WDTSSEL (0x0004)
|
101 |
|
|
#define WDTCNTCL (0x0008)
|
102 |
|
|
#define WDTTMSEL (0x0010)
|
103 |
|
|
#define WDTNMI (0x0020)
|
104 |
|
|
#define WDTNMIES (0x0040)
|
105 |
|
|
#define WDTHOLD (0x0080)
|
106 |
|
|
#define WDTPW (0x5A00)
|
107 |
|
|
|
108 |
|
|
|
109 |
|
|
//=============================================================================
|
110 |
|
|
// MACROS
|
111 |
|
|
//=============================================================================
|
112 |
|
|
|
113 |
|
|
#define STOP_WATCHDOG WDTCTL = WDTPW | WDTHOLD
|
114 |
|
|
|
115 |
|
|
#define START_TIMER P2OUT |= 0x02
|
116 |
|
|
#define STOP_TIMER P2OUT &= 0xFD
|
117 |
|
|
|
118 |
|
|
#define COREMARK_DONE P2OUT |= 0x80
|
119 |
|
|
|
120 |
|
|
|
121 |
|
|
//=============================================================================
|
122 |
|
|
// FUNCTIONS
|
123 |
|
|
//=============================================================================
|
124 |
|
|
|
125 |
|
|
int putchar (int txdata);
|
126 |
|
|
unsigned long read_verilog_time ();
|