ioLibrary for Cortex M series
Main Page
Related Pages
Modules
Classes
Files
File List
File Members
ioLibrary
host
wizplatform.h
Go to the documentation of this file.
1
12
#ifndef _WIZPLATFORM_H
13
#define _WIZPLATFORM_H
14
20
typedef
enum
{
21
WIZ_USART1
,
22
WIZ_USART2
,
23
//WIZ_USART3 //< Indicate the 3rd USART
24
}
wizpf_usart
;
25
27
typedef
enum
usart_baudrate_t
{
28
UBR_110
= 110,
29
UBR_300
= 300,
30
UBR_600
= 600,
31
UBR_1200
= 1200,
32
UBR_2400
= 2400,
33
UBR_4800
= 4800,
34
UBR_9600
= 9600,
35
UBR_14400
= 14400,
36
UBR_19200
= 19200,
37
UBR_38400
= 38400,
38
UBR_57600
= 57600,
39
UBR_115200
= 115200,
40
UBR_230400
= 230400,
41
UBR_460800
= 460800,
42
UBR_921600
= 921600
43
}
usart_baudrate
;
44
46
typedef
enum
usart_wordlen_t
{
47
UWL_8
= 0,
48
UWL_9
= 1
49
}
usart_wordlen
;
50
52
typedef
enum
usart_stopbit_t
{
53
UST_0d5
= 0 ,
54
UST_1
= 1 ,
55
UST_1d5
= 2 ,
56
UST_2
= 3
57
}
usart_stopbit
;
58
60
typedef
enum
usart_parity_t
{
61
UPB_NO
= 0,
62
UPB_EVEN
= 1,
63
UPB_ODD
= 2
64
}
usart_parity
;
65
67
typedef
enum
usart_flowcon_t
{
68
UFC_NO
= 0 ,
69
UFC_HW
= 1
70
//UFC_SW , //< Xon/Xoff Flow Control
71
}
usart_flowcon
;
72
74
typedef
struct
usart_param_t
{
75
uint32_t
baudrate
;
76
usart_wordlen
wordlen
;
77
usart_stopbit
stopbit
;
78
usart_parity
parity
;
79
usart_flowcon
flowcon
;
80
}
usart_param
;
81
/* @} */
82
87
typedef
enum
{
88
WIZ_SPI1
= 0,
89
WIZ_SPI2
= 1,
90
WIZ_SPI3
= 2
91
}
wizpf_spi
;
92
97
typedef
enum
{
98
WIZ_LED1
,
99
WIZ_LED2
,
100
WIZ_LED3
,
101
WIZ_LED4
102
}
wizpf_led
;
103
108
typedef
enum
{
109
GMOD_IN_FLOAT
,
110
GMOD_IN_PULLUP
,
111
GMOD_IN_PULLDOWN
,
112
GMOD_OUT_PUSHPULL
,
113
GMOD_OUT_OPENDRAIN
,
114
GMOD_AF_PUSHPULL
,
115
GMOD_AF_OPENDRAIN
116
}
gpio_mode
;
117
129
#define WIZPF_USART_SET_PARAM(param_p, br_e, wl_e, sb_e, pb_e, fc_e) do { \
130
(param_p)->baudrate = br_e; \
131
(param_p)->wordlen = wl_e; \
132
(param_p)->stopbit = sb_e; \
133
(param_p)->parity = pb_e; \
134
(param_p)->flowcon = fc_e; \
135
} while(0)
136
144
#define wizpf_led_flicker(led_v, interval_v) do { \
145
static uint32_t tick = 0; \
146
if(wizpf_tick_elapse(tick) > interval_v) { \
147
wizpf_led_set(led_v, VAL_TOG); \
148
tick = wizpf_get_systick(); \
149
} \
150
} while(0)
151
152
int8_t
platform_init
(
usart_param
*up);
153
int8_t
wizpf_spi_init
(
wizpf_spi
spi);
154
155
uint32_t
wizpf_get_systick
(
void
);
156
uint32_t
wizpf_tick_conv
(uint8_t istick2sec, uint32_t tickorsec);
157
int32_t
wizpf_tick_elapse
(uint32_t tick);
158
void
Delay_us
(uint8_t time_us);
159
void
Delay_ms
(uint16_t time_ms);
160
void
Delay_tick
(uint32_t tick);
161
162
int8_t
wizpf_led_set
(
wizpf_led
led, uint8_t action);
163
int8_t
wizpf_led_get
(
wizpf_led
led);
164
void
wizpf_led_trap
(uint8_t repeat);
165
166
int32_t
wizpf_putchar
(int32_t ch,
wizpf_usart
usart);
167
int32_t
wizpf_getchar
(
wizpf_usart
usart);
168
int32_t
wizpf_getcharNB
(
wizpf_usart
usart);
169
170
void
wizchip_HW_reset
(
void
);
171
//call back function for WIZCHIP
172
void
wizpf_wizchip_cris_enter
();
173
void
wizpf_wizchip_cris_exit
();
174
void
wizpf_wizchip_select
();
175
void
wizpf_wizchip_deselect
();
176
void
wizpf_wizchip_spi_writebyte
(uint8_t wb );
177
uint8_t
wizpf_wizchip_spi_readbyte
();
178
179
#endif //_WIZPLATFORM_H
180
181
182
Generated on Tue Sep 3 2013 15:36:42 for ioLibrary for Cortex M series by
1.8.4