Kinetis Bootloader Host
2.0.0
Host Tools for Kinetis devices
Introduction
Related Pages
Modules
serial.h
1
/*
2
* This file is part of the Bus Pirate project (http://code.google.com/p/the-bus-pirate/).
3
*
4
* Written and maintained by the Bus Pirate project and http://dangerousprototypes.com
5
*
6
* To the extent possible under law, the project has
7
* waived all copyright and related or neighboring rights to Bus Pirate. This
8
* work is published from United States.
9
*
10
* For details see: http://creativecommons.org/publicdomain/zero/1.0/.
11
*
12
* This program is distributed in the hope that it will be useful,
13
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
15
*/
16
/*
17
* OS independent serial interface
18
*
19
* Heavily based on Pirate-Loader:
20
* http://the-bus-pirate.googlecode.com/svn/trunk/bootloader-v4/pirate-loader/source/pirate-loader.c
21
*
22
*/
23
#ifndef MYSERIAL_H_
24
#define MYSERIAL_H_
25
26
#ifdef MACOSX
27
#include <IOKit/serial/ioss.h>
28
#include <sys/ioctl.h>
29
30
#define B1500000 1500000
31
#define B1000000 1000000
32
#define B921600 921600
33
#endif
34
35
#include <stdint.h>
36
37
#ifdef WIN32
38
#include <windows.h>
39
#include <time.h>
40
41
#define B115200 115200
42
#define B921600 921600
43
44
typedef
long
speed_t;
45
#else
46
47
#include <unistd.h>
48
#include <termios.h>
49
#include <sys/select.h>
50
#include <sys/types.h>
51
#include <sys/time.h>
52
53
#endif
54
55
#if __cplusplus
56
extern
"C"
{
57
#endif
58
59
int
serial_setup(
int
fd, speed_t speed);
60
int
serial_set_read_timeout(
int
fd, uint32_t timeoutMs);
61
int
serial_write(
int
fd,
char
*buf,
int
size);
62
int
serial_read(
int
fd,
char
*buf,
int
size);
63
int
serial_open(
char
*port);
64
int
serial_close(
int
fd);
65
66
#if __cplusplus
67
}
68
#endif
69
70
#endif
src
blfwk
serial.h
Generated on Mon Mar 7 2016 16:49:50 for Kinetis Bootloader Host by
1.8.11