2014-04-25 02:20:48 +04:00
|
|
|
/**
|
|
|
|
* WinPR: Windows Portable Runtime
|
|
|
|
* Serial Communication API
|
|
|
|
*
|
|
|
|
* Copyright 2011 O.S. Systems Software Ltda.
|
|
|
|
* Copyright 2011 Eduardo Fiss Beloni <beloni@ossystems.com.br>
|
|
|
|
* Copyright 2014 Marc-Andre Moreau <marcandre.moreau@gmail.com>
|
|
|
|
* Copyright 2014 Hewlett-Packard Development Company, L.P.
|
|
|
|
*
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
|
|
|
*/
|
|
|
|
|
2014-04-28 21:57:17 +04:00
|
|
|
#ifndef _WIN32
|
|
|
|
|
2014-05-06 18:45:05 +04:00
|
|
|
#include "comm_serial_sys.h"
|
2014-04-28 21:57:17 +04:00
|
|
|
#include "comm_sercx_sys.h"
|
2014-04-25 02:20:48 +04:00
|
|
|
|
|
|
|
#include "comm_sercx2_sys.h"
|
|
|
|
|
|
|
|
|
2014-04-29 06:04:09 +04:00
|
|
|
/* http://msdn.microsoft.com/en-us/library/dn265347%28v=vs.85%29.aspx
|
|
|
|
*
|
|
|
|
* SerCx2 does not support special characters. SerCx2 always completes
|
|
|
|
* an IOCTL_SERIAL_SET_CHARS request with a STATUS_SUCCESS status
|
|
|
|
* code, but does not set any special characters or perform any other
|
|
|
|
* operation in response to this request. For an
|
|
|
|
* IOCTL_SERIAL_GET_CHARS request, SerCx2 sets all the character
|
|
|
|
* values in the SERIAL_CHARS structure to null, and completes the
|
|
|
|
* request with a STATUS_SUCCESS status code.
|
|
|
|
*/
|
|
|
|
|
|
|
|
static BOOL _set_serial_chars(WINPR_COMM* pComm, const SERIAL_CHARS* pSerialChars)
|
|
|
|
{
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static BOOL _get_serial_chars(WINPR_COMM* pComm, SERIAL_CHARS* pSerialChars)
|
|
|
|
{
|
|
|
|
ZeroMemory(pSerialChars, sizeof(SERIAL_CHARS));
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2014-04-25 02:20:48 +04:00
|
|
|
/* specific functions only */
|
|
|
|
static REMOTE_SERIAL_DRIVER _SerCx2Sys =
|
2014-04-28 21:57:17 +04:00
|
|
|
{
|
2014-04-29 06:04:09 +04:00
|
|
|
.id = RemoteSerialDriverSerCx2Sys,
|
|
|
|
.name = _T("SerCx2.sys"),
|
|
|
|
.set_baud_rate = NULL,
|
|
|
|
.get_baud_rate = NULL,
|
|
|
|
.get_properties = NULL,
|
|
|
|
.set_serial_chars = _set_serial_chars,
|
|
|
|
.get_serial_chars = _get_serial_chars,
|
2014-04-30 00:25:07 +04:00
|
|
|
.set_line_control = NULL,
|
|
|
|
.get_line_control = NULL,
|
2014-05-06 18:08:58 +04:00
|
|
|
.set_handflow = NULL,
|
|
|
|
.get_handflow = NULL,
|
2014-05-12 19:33:56 +04:00
|
|
|
.set_timeouts = NULL,
|
|
|
|
.get_timeouts = NULL,
|
2014-05-12 22:16:13 +04:00
|
|
|
.set_dtr = NULL,
|
|
|
|
.clear_dtr = NULL,
|
2014-05-12 22:33:33 +04:00
|
|
|
.set_rts = NULL,
|
|
|
|
.clear_rts = NULL,
|
2014-05-13 19:27:51 +04:00
|
|
|
.get_modemstatus = NULL,
|
2014-04-25 02:20:48 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2014-04-28 21:57:17 +04:00
|
|
|
REMOTE_SERIAL_DRIVER* SerCx2Sys_s()
|
2014-04-25 02:20:48 +04:00
|
|
|
{
|
2014-04-30 00:25:07 +04:00
|
|
|
/* _SerCx2Sys completed with inherited functions from SerialSys or SerCxSys */
|
2014-05-06 18:08:58 +04:00
|
|
|
REMOTE_SERIAL_DRIVER* pSerialSys = SerialSys_s();
|
2014-04-28 21:57:17 +04:00
|
|
|
REMOTE_SERIAL_DRIVER* pSerCxSys = SerCxSys_s();
|
2014-04-25 02:20:48 +04:00
|
|
|
|
2014-04-29 06:04:09 +04:00
|
|
|
_SerCx2Sys.set_baud_rate = pSerCxSys->set_baud_rate;
|
|
|
|
_SerCx2Sys.get_baud_rate = pSerCxSys->get_baud_rate;
|
2014-05-06 18:08:58 +04:00
|
|
|
|
2014-04-29 06:04:09 +04:00
|
|
|
_SerCx2Sys.get_properties = pSerCxSys->get_properties;
|
2014-04-25 02:20:48 +04:00
|
|
|
|
2014-04-30 00:25:07 +04:00
|
|
|
_SerCx2Sys.set_line_control = pSerCxSys->set_line_control;
|
|
|
|
_SerCx2Sys.get_line_control = pSerCxSys->get_line_control;
|
|
|
|
|
2014-05-06 18:08:58 +04:00
|
|
|
/* Only SERIAL_CTS_HANDSHAKE, SERIAL_RTS_CONTROL and SERIAL_RTS_HANDSHAKE flags are really required by SerCx2.sys
|
|
|
|
* http://msdn.microsoft.com/en-us/library/jj680685%28v=vs.85%29.aspx
|
|
|
|
*/
|
|
|
|
_SerCx2Sys.set_handflow = pSerialSys->set_handflow;
|
|
|
|
_SerCx2Sys.get_handflow = pSerialSys->get_handflow;
|
|
|
|
|
2014-05-12 19:33:56 +04:00
|
|
|
_SerCx2Sys.set_timeouts = pSerialSys->set_timeouts;
|
|
|
|
_SerCx2Sys.get_timeouts = pSerialSys->get_timeouts;
|
|
|
|
|
2014-05-12 22:16:13 +04:00
|
|
|
_SerCx2Sys.set_dtr = pSerialSys->set_dtr;
|
|
|
|
_SerCx2Sys.clear_dtr = pSerialSys->clear_dtr;
|
|
|
|
|
2014-05-12 22:33:33 +04:00
|
|
|
_SerCx2Sys.set_rts = pSerialSys->set_rts;
|
|
|
|
_SerCx2Sys.clear_rts = pSerialSys->clear_rts;
|
|
|
|
|
2014-05-13 19:27:51 +04:00
|
|
|
_SerCx2Sys.get_modemstatus = pSerialSys->get_modemstatus;
|
|
|
|
|
2014-04-25 02:20:48 +04:00
|
|
|
return &_SerCx2Sys;
|
|
|
|
}
|
2014-04-28 21:57:17 +04:00
|
|
|
|
|
|
|
#endif /* _WIN32 */
|