root/branches/follower/wiz810mj/src/lib/types.h

Revision 47, 4.8 KB (checked in by follower, 14 months ago)

Conditional exclusion of boolean type Arduino chokes on.

Line 
1/*
2*
3@file       type.h
4*
5*/
6
7#ifndef _TYPE_H_
8#define _TYPE_H_
9
10
11/***************************************************
12 * attribute for mcu ( types, ... )
13 ***************************************************/
14//#include "mcu_define.h"
15#define __ARDUINO__  1
16#define __MCU_AVR__ 1
17#define __MCU_TYPE__    __MCU_AVR__
18
19// TODO: We should really specify the Chip Select pin based on
20// the MCU rather than the platform.
21#ifdef __ARDUINO__
22#define CS_PIN (1 << PB2)
23#endif
24
25//---- Refer "Rom File Maker Manual Vx.x.pdf"
26#include <avr/pgmspace.h>
27
28#define _ENDIAN_LITTLE_ 0   /**<  This must be defined if system is little-endian alignment */
29#define _ENDIAN_BIG_        1
30#define     SYSTEM_ENDIAN       _ENDIAN_LITTLE_
31
32#define MAX_SOCK_NUM        4   /**< Maxmium number of socket  */
33#define CLK_CPU         8000000     /**< 8Mhz(for serial) */
34
35/* ## __DEF_IINCHIP_xxx__ : define option for iinchip driver *****************/
36#ifndef __ARDUINO__
37#define __DEF_IINCHIP_DBG__ /* involve debug code in driver (socket.c) */
38#define __DEF_IINCHIP_INT__ /**< involve interrupt service routine (socket.c) */
39#define __DEF_IINCHIP_PPP__ /* involve pppoe routine (socket.c) */
40                            /* If it is defined, the source files (md5.h,md5.c) must
41                               be included in your project.
42                               Otherwise, the source files must be removed from your
43                               project. */
44#endif
45
46#define __DEF_IINCHIP_DIRECT_MODE__ 1
47#define __DEF_IINCHIP_INDIRECT_MODE__ 2
48#define __DEF_IINCHIP_SPI_MODE__ 3
49//#define __DEF_IINCHIP_BUS__ __DEF_IINCHIP_DIRECT_MODE__
50//#define __DEF_IINCHIP_BUS__ __DEF_IINCHIP_INDIRECT_MODE__
51#define __DEF_IINCHIP_BUS__ __DEF_IINCHIP_SPI_MODE__ /*Enable SPI_mode*/
52
53
54/**
55@brief   __DEF_IINCHIP_MAP_xxx__ : define memory map for iinchip
56*/
57#define __DEF_IINCHIP_MAP_BASE__ 0x8000
58#if (__DEF_IINCHIP_BUS__ == __DEF_IINCHIP_DIRECT_MODE__)
59 #define COMMON_BASE __DEF_IINCHIP_MAP_BASE__
60#else
61 #define COMMON_BASE 0x0000
62#endif
63#define __DEF_IINCHIP_MAP_TXBUF__ (COMMON_BASE + 0x4000) /* Internal Tx buffer address of the iinchip */
64#define __DEF_IINCHIP_MAP_RXBUF__ (COMMON_BASE + 0x6000) /* Internal Rx buffer address of the iinchip */
65
66
67#if (__MCU_TYPE__ == __MCU_AVR__)
68   #ifdef __DEF_IINCHIP_INT__
69      // iinchip use external interrupt 4
70      #define IINCHIP_ISR_DISABLE() (EIMSK &= ~(0x10))
71      #define IINCHIP_ISR_ENABLE()  (EIMSK |= 0x10)
72      #define IINCHIP_ISR_GET(X)        (X = EIMSK)
73      #define IINCHIP_ISR_SET(X)        (EIMSK = X)
74   #else
75      #define IINCHIP_ISR_DISABLE()
76      #define IINCHIP_ISR_ENABLE() 
77      #define IINCHIP_ISR_GET(X)
78      #define IINCHIP_ISR_SET(X)
79   #endif
80#else
81#error "unknown MCU type"
82#endif
83
84
85/* gcc version */
86/* WinAVR-20050214-install.exe */
87#define __WINAVR_20050214__ 0
88#define __WINAVR_20060125__ 1
89#define __WINAVR_20060421__ 2
90
91/* #define __COMPILER_VERSION__ __WINAVR_20060421__ // <- move makefile*/
92
93#if (__COMPILER_VERSION__ == __WINAVR_20050214__)
94#ifndef __STDIO_FDEVOPEN_COMPAT_12
95#define __STDIO_FDEVOPEN_COMPAT_12
96#endif
97#endif
98
99#ifndef NULL
100#define NULL        ((void *) 0)
101#endif
102
103#ifndef __ARDUINO__
104typedef enum { false, true } bool;
105#endif
106
107#ifndef _SIZE_T
108#define _SIZE_T
109typedef unsigned int size_t;
110#endif
111
112/**
113 * The 8-bit signed data type.
114 */
115typedef char int8;
116/**
117 * The volatile 8-bit signed data type.
118 */
119typedef volatile char vint8;
120/**
121 * The 8-bit unsigned data type.
122 */
123typedef unsigned char uint8;
124/**
125 * The volatile 8-bit unsigned data type.
126 */
127typedef volatile unsigned char vuint8;
128
129/**
130 * The 16-bit signed data type.
131 */
132typedef int int16;
133/**
134 * The volatile 16-bit signed data type.
135 */
136typedef volatile int vint16;
137/**
138 * The 16-bit unsigned data type.
139 */
140typedef unsigned int uint16;
141/**
142 * The volatile 16-bit unsigned data type.
143 */
144typedef volatile unsigned int vuint16;
145/**
146 * The 32-bit signed data type.
147 */
148typedef long int32;
149/**
150 * The volatile 32-bit signed data type.
151 */
152typedef volatile long vint32;
153/**
154 * The 32-bit unsigned data type.
155 */
156typedef unsigned long uint32;
157/**
158 * The volatile 32-bit unsigned data type.
159 */
160typedef volatile unsigned long vuint32;
161
162/* bsd */
163typedef uint8           u_char;     /**< 8-bit value */
164typedef uint8           SOCKET;
165typedef uint16          u_short;    /**< 16-bit value */
166typedef uint16          u_int;      /**< 16-bit value */
167typedef uint32          u_long;     /**< 32-bit value */
168
169typedef union _un_l2cval {
170    u_long  lVal;
171    u_char  cVal[4];
172}un_l2cval;
173
174typedef union _un_i2cval {
175    u_int   iVal;
176    u_char  cVal[2];
177}un_i2cval;
178
179
180/** global define */
181#define FW_VERSION      0x01000001  /**< System F/W Version(test) : 0.0.0.1 */
182#define HW_PM_VERSION   "0.1"
183#define HW_NM_VERSION   "0.1"
184#define HW_MB_VERSION   "0.1"
185
186
187#define TX_RX_MAX_BUF_SIZE  2048
188#define TX_BUF  0x1100
189#define RX_BUF  (TX_BUF+TX_RX_MAX_BUF_SIZE)
190
191#define UART_DEVICE_CNT     1   /**< UART device number */
192/* #define SUPPORT_UART_ONE */
193
194#endif      /* _TYPE_H_ */
Note: See TracBrowser for help on using the browser.