2010-05-14 15:12 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/include/hbapicom.h
* minor modification in defined names
* harbour/src/rtl/hbcom.c
+ added some very seldom (in practice only on Linux kernels >= 2.4
and not by all hardware drivers) supported termios extensions
* harbour/include/hbatomic.h
! fixed typo in non x86 and non MinGW GCC>=4.1 builds reported
on SF bug tracker
This commit is contained in:
@@ -17,6 +17,18 @@
|
||||
past entries belonging to author(s): Viktor Szakats.
|
||||
*/
|
||||
|
||||
2010-05-14 15:12 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
|
||||
* harbour/include/hbapicom.h
|
||||
* minor modification in defined names
|
||||
|
||||
* harbour/src/rtl/hbcom.c
|
||||
+ added some very seldom (in practice only on Linux kernels >= 2.4
|
||||
and not by all hardware drivers) supported termios extensions
|
||||
|
||||
* harbour/include/hbatomic.h
|
||||
! fixed typo in non x86 and non MinGW GCC>=4.1 builds reported
|
||||
on SF bug tracker
|
||||
|
||||
2010-05-14 10:09 UTC+0200 Viktor Szakats (harbour.01 syenar.hu)
|
||||
* INSTALL
|
||||
* Clarification to HB_BUILD_IMPLIB usage.
|
||||
|
||||
@@ -70,9 +70,9 @@
|
||||
|
||||
#define HB_COM_MCR_DTR 0x01 /* Data terminal ready (DTR) TIOCM_DTR */
|
||||
#define HB_COM_MCR_RTS 0x02 /* Request to send (RTS) TIOCM_RTS */
|
||||
#define HB_COM_MCR_OUT_1 0x04 /* OUT 1 */
|
||||
#define HB_COM_MCR_OUT_2 0x08 /* OUT 2 */
|
||||
#define HB_COM_MCR_LOOP 0x10 /* LOOP */
|
||||
#define HB_COM_MCR_OUT1 0x04 /* OUT 1 TIOCM_OUT1 */
|
||||
#define HB_COM_MCR_OUT2 0x08 /* OUT 2 TIOCM_OUT2 */
|
||||
#define HB_COM_MCR_LOOP 0x10 /* LOOP TIOCM_LOOP */
|
||||
|
||||
#define HB_COM_MSR_DELTA_CTS 0x01 /* DELTA ready to send (DCTS) */
|
||||
#define HB_COM_MSR_DELTA_DSR 0x02 /* DELTA data terminal ready (DDSR) */
|
||||
|
||||
@@ -210,7 +210,7 @@ HB_EXTERN_BEGIN
|
||||
|
||||
# define HB_SPINLOCK_T int
|
||||
# define HB_SPINLOCK_INIT 0
|
||||
# define HB_SPINLOCK_TRY(l) (__sync_lock_test_and_set(l. 1)==0)
|
||||
# define HB_SPINLOCK_TRY(l) (__sync_lock_test_and_set(l, 1)==0)
|
||||
# define HB_SPINLOCK_RELEASE(l) __sync_lock_release(l)
|
||||
# define HB_SPINLOCK_ACQUIRE(l) hb_spinlock_acquire(l)
|
||||
|
||||
|
||||
@@ -445,19 +445,37 @@ int hb_comFlush( int iPort, int iType )
|
||||
}
|
||||
|
||||
/*
|
||||
TIOCM_LE DSR (data set ready/line enable)
|
||||
TIOCM_DTR DTR (data terminal ready)
|
||||
TIOCM_RTS RTS (request to send)
|
||||
TIOCM_ST Secondary TXD (transmit)
|
||||
TIOCM_SR Secondary RXD (receive)
|
||||
TIOCM_CTS CTS (clear to send)
|
||||
TIOCM_CAR DCD (data carrier detect)
|
||||
TIOCM_CD see TIOCM_CAR
|
||||
TIOCM_RNG RNG (ring)
|
||||
TIOCM_RI see TIOCM_RNG
|
||||
TIOCM_DSR DSR (data set ready)
|
||||
TIOCM_LE DSR (data set ready/line enable)
|
||||
TIOCM_DTR DTR (data terminal ready)
|
||||
TIOCM_RTS RTS (request to send)
|
||||
TIOCM_ST Secondary TXD (transmit)
|
||||
TIOCM_SR Secondary RXD (receive)
|
||||
TIOCM_CTS CTS (clear to send)
|
||||
TIOCM_CAR DCD (data carrier detect)
|
||||
TIOCM_CD see TIOCM_CAR
|
||||
TIOCM_RNG RNG (ring)
|
||||
TIOCM_RI see TIOCM_RNG
|
||||
TIOCM_DSR DSR (data set ready)
|
||||
|
||||
supported only by few platforms (i.e. newer Linux kernels >= 2.4)
|
||||
TIOCM_OUT1 OUT 1 (auxiliary user-designated output 2)
|
||||
TIOCM_OUT2 OUT 2 (auxiliary user-designated output 1)
|
||||
TIOCM_LOOP LOOP (loopback mode)
|
||||
*/
|
||||
|
||||
#ifdef HB_OS_LINUX
|
||||
/* hack for missing defintions in standard header files */
|
||||
# ifndef TIOCM_OUT1
|
||||
# define TIOCM_OUT1 0x2000
|
||||
# endif
|
||||
# ifndef TIOCM_OUT2
|
||||
# define TIOCM_OUT2 0x4000
|
||||
# endif
|
||||
# ifndef TIOCM_LOOP
|
||||
# define TIOCM_LOOP 0x8000
|
||||
# endif
|
||||
#endif
|
||||
|
||||
int hb_comMCR( int iPort, int * piValue, int iClr, int iSet )
|
||||
{
|
||||
PHB_COM pCom = hb_comGetPort( iPort, HB_COM_OPEN );
|
||||
@@ -475,6 +493,18 @@ int hb_comMCR( int iPort, int * piValue, int iClr, int iSet )
|
||||
iValue |= HB_COM_MCR_DTR;
|
||||
if( iRawVal & TIOCM_RTS )
|
||||
iValue |= HB_COM_MCR_RTS;
|
||||
#ifdef TIOCM_OUT1
|
||||
if( iRawVal & TIOCM_OUT1 )
|
||||
iValue |= HB_COM_MCR_OUT1;
|
||||
#endif
|
||||
#ifdef TIOCM_OUT2
|
||||
if( iRawVal & TIOCM_OUT2 )
|
||||
iValue |= HB_COM_MCR_OUT2;
|
||||
#endif
|
||||
#ifdef TIOCM_LOOP
|
||||
if( iRawVal & TIOCM_LOOP )
|
||||
iValue |= HB_COM_MCR_LOOP;
|
||||
#endif
|
||||
|
||||
iOldVal = iRawVal;
|
||||
|
||||
@@ -488,6 +518,25 @@ int hb_comMCR( int iPort, int * piValue, int iClr, int iSet )
|
||||
else if( iClr & HB_COM_MCR_RTS )
|
||||
iRawVal &= ~TIOCM_RTS;
|
||||
|
||||
#ifdef TIOCM_OUT1
|
||||
if( iSet & HB_COM_MCR_OUT1 )
|
||||
iRawVal |= TIOCM_OUT1;
|
||||
else if( iClr & HB_COM_MCR_OUT1 )
|
||||
iRawVal &= ~TIOCM_OUT1;
|
||||
#endif
|
||||
#ifdef TIOCM_OUT2
|
||||
if( iSet & HB_COM_MCR_OUT2 )
|
||||
iRawVal |= TIOCM_OUT2;
|
||||
else if( iClr & HB_COM_MCR_OUT2 )
|
||||
iRawVal &= ~TIOCM_OUT2;
|
||||
#endif
|
||||
#ifdef TIOCM_LOOP
|
||||
if( iSet & HB_COM_MCR_LOOP )
|
||||
iRawVal |= TIOCM_LOOP;
|
||||
else if( iClr & HB_COM_MCR_LOOP )
|
||||
iRawVal &= ~TIOCM_LOOP;
|
||||
#endif
|
||||
|
||||
if( iRawVal != iOldVal )
|
||||
iResult = ioctl( pCom->fd, TIOCMSET, &iRawVal );
|
||||
}
|
||||
@@ -548,9 +597,15 @@ int hb_comLSR( int iPort, int * piValue )
|
||||
|
||||
if( pCom )
|
||||
{
|
||||
/* NOTE: there is no support to read the Line Status Register (LSR)
|
||||
#ifdef TIOCSERGETLSR
|
||||
iResult = ioctl( pCom->fd, TIOCSERGETLSR, &iValue );
|
||||
hb_comSetOsError( pCom, iResult == -1 );
|
||||
#else
|
||||
/* NOTE: most of systems do not give access to the
|
||||
* Line Status Register (LSR)
|
||||
*/
|
||||
hb_comSetError( pCom, HB_COM_ERR_NOSUPPORT );
|
||||
#endif
|
||||
}
|
||||
|
||||
if( piValue )
|
||||
@@ -1266,7 +1321,7 @@ int hb_comMCR( int iPort, int * piValue, int iClr, int iSet )
|
||||
else if( iClr & HB_COM_MCR_RTS )
|
||||
fResult = EscapeCommFunction( pCom->hComm, CLRRTS );
|
||||
|
||||
/* MCR_OUT_1, MCR_OUT_2, MCR_LOOP and reading current state
|
||||
/* MCR_OUT1, MCR_OUT2, MCR_LOOP and reading current state
|
||||
* is unsupported
|
||||
*/
|
||||
hb_comSetOsError( pCom, !fResult );
|
||||
@@ -1991,7 +2046,7 @@ int hb_comMCR( int iPort, int * piValue, int iClr, int iSet )
|
||||
{
|
||||
MODEMSTATUS ms;
|
||||
|
||||
/* MCR_OUT_1, MCR_OUT_2, MCR_LOOP are unsupported
|
||||
/* MCR_OUT1, MCR_OUT2, MCR_LOOP are unsupported
|
||||
*/
|
||||
|
||||
if( mcos & DTR_ON )
|
||||
|
||||
Reference in New Issue
Block a user