armapi  v1.0
bĂȘta
armport.h
Go to the documentation of this file.
1 // ---------------------------------------------------------------------
2 // Created date: 17.11.2015
3 // ---------------------------------------------------------------------
4 
5 /***********************************************************************
6 
7  Copyright (c) 2016 ATIM
8 
9 
10  Permission is hereby granted, free of charge, to any person obtaining a copy
11  of this software and associated documentation files (the "Software"), to deal
12  in the Software without restriction, including without limitation the rights
13  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14  copies of the Software, and to permit persons to whom the Software is
15  furnished to do so, subject to the following conditions:
16 
17 
18  The above copyright notice and this permission notice shall be included in
19  all copies or substantial portions of the Software.
20 
21 
22  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
23  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
25  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
26  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
27  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
28  THE SOFTWARE.
29 
30 ***********************************************************************/
31 
32 #ifndef ARMPORT_H
33 #define ARMPORT_H
34 
35 // ---------------------------------------------------------------------
36 // Include
37 // ---------------------------------------------------------------------
38 
39 #include <stdint.h>
40 #include <stddef.h>
41 #include <stdbool.h>
42 #include "armconfig.h"
43 
44 #ifdef __cplusplus
45 extern "C"
46 {
47 #endif
48 
49 #ifndef __DOXYGEN__
50 //Memories functions at to define by port
51 extern void bzero(void *s, size_t n);
52 extern void *memmem(const void *haystack, size_t haystacklen, const void *needle, size_t needlelen);
53 #endif
54 
55 // ---------------------------------------------------------------------
56 // Enum
57 // ---------------------------------------------------------------------
58 
63 typedef enum
64 {
76 
81 typedef enum
82 {
86 
91 typedef enum
92 {
97 
102 typedef enum
103 {
107 
108 // ---------------------------------------------------------------------
109 // struct
110 // ---------------------------------------------------------------------
111 
112 #if defined ARMPORT_WITH_nSLEEP || defined ARMPORT_WITH_nBOOT || defined ARMPORT_WITH_nRESET || __DOXYGEN__
113 
117 typedef enum armPortPin_e
118 {
119  #if defined ARMPORT_WITH_nSLEEP || __DOXYGEN__
121  #endif
122  #if defined ARMPORT_WITH_nBOOT || __DOXYGEN__
124  #endif
125  #if defined ARMPORT_WITH_nRESET || __DOXYGEN__
127  #endif
128 }armPortPin_t;
129 #endif
130 
131 // ---------------------------------------------------------------------
132 // Prototypes functions
133 // ---------------------------------------------------------------------
134 
139 int armPortOpen(void** port);
140 
145 int armPortConfig(void* port, armPortBaudrate_t baudrate,
146  armPortDatabits_t databits,
147  armPortParity_t parity,
148  armPortStopbit_t stopbit);
149 int armPortClose(void* port);
150 
155 int armPortWrite(void* port, const void* buf, size_t nbyte);
156 
161 int armPortRead(void* port, void* buf, size_t nbyte, unsigned int timeout);
162 
167 void armPortDelay(unsigned int ms);
168 
169 #if defined ARMPORT_WITH_nSLEEP || defined ARMPORT_WITH_nBOOT || defined ARMPORT_WITH_nRESET || __DOXYGEN__
170 
174 void armPortGpioSet(void* port, armPortPin_t pin, bool val);
175 #endif
176 
177 
178 #ifdef __cplusplus
179 }
180 #endif
181 
182 #endif //ARMPORT_H
armPortParity_t
Constant to define the parity type.
Definition: armport.h:91
1200 bps.
Definition: armport.h:66
nBOOT pin
Definition: armport.h:123
int armPortClose(void *port)
data of 8 bits.
Definition: armport.h:84
armPortPin_e
Constant to define the pins.
Definition: armport.h:117
int armPortRead(void *port, void *buf, size_t nbyte, unsigned int timeout)
int armPortConfig(void *port, armPortBaudrate_t baudrate, armPortDatabits_t databits, armPortParity_t parity, armPortStopbit_t stopbit)
38400 bps.
Definition: armport.h:71
9600 bps.
Definition: armport.h:69
2 stop bit.
Definition: armport.h:105
ODD parity.
Definition: armport.h:94
enum armPortPin_e armPortPin_t
Constant to define the pins.
nRESET pin.
Definition: armport.h:126
void armPortGpioSet(void *port, armPortPin_t pin, bool val)
void armPortDelay(unsigned int ms)
armPortDatabits_t
Constant to define the data bits value.
Definition: armport.h:81
armPortBaudrate_t
Constant to define the baudrate value.
Definition: armport.h:63
4800 bps.
Definition: armport.h:68
19200 bps.
Definition: armport.h:70
57600 bps.
Definition: armport.h:72
armPortStopbit_t
Constant to define the number stop bits.
Definition: armport.h:102
nSLEEP pin.
Definition: armport.h:120
2400 bps.
Definition: armport.h:67
No parity.
Definition: armport.h:93
1 stop bit.
Definition: armport.h:104
int armPortOpen(void **port)
int armPortWrite(void *port, const void *buf, size_t nbyte)
Even parity.
Definition: armport.h:95
230400 bps.
Definition: armport.h:74
data of 7 bits.
Definition: armport.h:83
115200 bps.
Definition: armport.h:73
That is probably a error.
Definition: armport.h:65