Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
proview
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Esteban Blanc
proview
Commits
265c9b23
Commit
265c9b23
authored
Nov 22, 2007
by
claes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Motion Control USB I/O added
parent
6c50d8d5
Changes
10
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
1187 additions
and
0 deletions
+1187
-0
otherio/exp/rt/src/os_linux/hw_x86/makefile
otherio/exp/rt/src/os_linux/hw_x86/makefile
+50
-0
otherio/exp/rt/src/os_linux/libusbio.h
otherio/exp/rt/src/os_linux/libusbio.h
+94
-0
otherio/lib/rt/src/os_linux/hw_x86/makefile
otherio/lib/rt/src/os_linux/hw_x86/makefile
+15
-0
otherio/lib/rt/src/os_linux/rt_io_m_motioncontrol_usb.c
otherio/lib/rt/src/os_linux/rt_io_m_motioncontrol_usb.c
+106
-0
otherio/lib/rt/src/os_linux/rt_io_m_motioncontrol_usb.h
otherio/lib/rt/src/os_linux/rt_io_m_motioncontrol_usb.h
+13
-0
otherio/lib/rt/src/os_linux/rt_io_m_motioncontrol_usbio.c
otherio/lib/rt/src/os_linux/rt_io_m_motioncontrol_usbio.c
+477
-0
otherio/lib/rt/src/rt_io_otherio.meth
otherio/lib/rt/src/rt_io_otherio.meth
+2
-0
otherio/mmi/mcomp/src/os_linux/hw_x86/makefile
otherio/mmi/mcomp/src/os_linux/hw_x86/makefile
+20
-0
otherio/wbl/mcomp/src/os_linux/hw_x86/makefile
otherio/wbl/mcomp/src/os_linux/hw_x86/makefile
+20
-0
otherio/wbl/mcomp/src/otherio.wb_load
otherio/wbl/mcomp/src/otherio.wb_load
+390
-0
No files found.
otherio/exp/rt/src/os_linux/hw_x86/makefile
0 → 100644
View file @
265c9b23
include
$(pwre_dir_symbols)
ifndef
variables_mk
-include
$(pwre_croot)/src/tools/bld/src/$(os_name)/$(hw_name)/variables.mk
endif
ifndef
variables_mk
include
$(pwre_croot)/src/tools/bld/src/$(os_name)/variables.mk
endif
ifndef
rules_mk
-include
$(pwre_croot)/src/tools/bld/src/$(os_name)/$(hw_name)/rules.mk
endif
ifndef
rules_mk
include
$(pwre_croot)/src/tools/bld/src/$(os_name)/rules.mk
endif
.PHONY
:
all init copy lib exe clean realclean
\
$(clean_c)
all
:
init copy lib
init
:
copy
:
$(lib_dir)/libusbio.a $(inc_dir)/libusbio.h
lib
:
exe
:
clean
:
realclean
:
clean $(clean_obj)
.SUFFIXES
:
$(lib_dir)/libusbio.a
:
../libusbio.a
@
echo
"Copying libusbio.a"
@
$(cp)
$(cpflags)
$(source)
$(target)
$(inc_dir)/libusbio.h
:
../libusbio.h
@
echo
"Copying libusbio.h"
@
$(cp)
$(cpflags)
$(source)
$(target)
otherio/exp/rt/src/os_linux/libusbio.h
0 → 100644
View file @
265c9b23
/*************************************************************
* *
* COPYRIGHT © 2007 Motion Control i Västerås AB, Sweden *
* *
* All rights including ownership and copyright to the *
* software herein are held by Motion Control i Västerås AB. *
* The software may be used and/ or copied only with the *
* written permission from Motion Control i Västerås AB or *
* in accordance with the terms and conditions stipulated *
* agreement/ contract under which the software has been *
* supplied. *
*------------------------------------------------------------*
* Programenhet : USBIO driver for Linux 2.6 *
* Filnamn : libusbio.h *
* Tillhörande libusbio.c *
* filer : *
*----------------------------------------------------------- *
* Beskrivning : Detta är H-filen för supportbiblioteket *
* till USB I/O enheten. *
*------------------------------------------------------------*
* Programhistoria : *
* Ver, Datum, Utförd av, *
* 1.0 07-01-29 Marcus Tönnäng *
* 1.2 07-02-06 Johan Zetterlund portad till Linux. *
* *
**************************************************************/
//Communication
int
USBIO_Open
(
int
*
Handle
);
// int USBIO_OpenBySerialNr(int *Handle, int Serial[]);
// int USBIO_OpenByIdNr(int *Handle, int IdNr);
int
USBIO_Close
(
int
*
Handle
);
int
USBIO_IsConnected
(
int
*
Handle
);
// int USBIO_SetTimeOut(int *Handle, unsigned int TimeOut);
// int USBIO_ListAll(int *Antal, int IdNr[]); //Ändra, mer info
//Read
int
USBIO_ReadDI
(
int
*
Handle
,
int
Port
,
int
*
Value
);
int
USBIO_ReadChannelDI
(
int
*
Handle
,
int
Port
,
int
Channel
,
int
*
Value
);
int
USBIO_ReadAI
(
int
*
Handle
,
int
Channel
,
float
*
Value
);
int
USBIO_ReadAllAI
(
int
*
Handle
,
float
AIValue
[]);
int
USBIO_ReadADVal
(
int
*
Handle
,
int
Channel
,
int
*
Value
);
int
USBIO_ReadAllADVal
(
int
*
Handle
,
int
ADValue
[]);
int
USBIO_ReadCounter
(
int
*
Handle
,
unsigned
int
*
Value
,
int
*
Overflow
);
int
USBIO_ReadUART
(
int
*
Handle
,
int
*
Nr
,
unsigned
char
Value
[],
int
*
Overflow
);
// int USBIO_ReadFreq( int *Handle, float *Value, float *Width);
//Write
int
USBIO_WriteDO
(
int
*
Handle
,
int
Port
,
int
Value
);
int
USBIO_WriteChannelDO
(
int
*
Handle
,
int
Port
,
int
Channel
,
int
Value
);
int
USBIO_WriteAO
(
int
*
Handle
,
int
Channel
,
float
Value
);
int
USBIO_WritePWM
(
int
*
Handle
,
int
Channel
,
int
Value
);
int
USBIO_WriteLowFreq
(
int
*
Handle
,
int
Freq
,
unsigned
char
PortA
,
unsigned
char
PortB
,
unsigned
char
PortC
);
int
USBIO_WriteUART
(
int
*
Handle
,
unsigned
char
Value
);
int
USBIO_WriteLED
(
int
*
Handle
,
int
Value
);
//Configure
int
USBIO_ConfigDIO
(
int
*
Handle
,
int
Port
,
int
Value
);
int
USBIO_ConfigAI
(
int
*
Handle
,
int
Value
);
int
USBIO_ConfigAO
(
int
*
Handle
,
int
Value
);
int
USBIO_ConfigPWM
(
int
*
Handle
,
int
Value
,
int
Freq
);
int
USBIO_ConfigCounter
(
int
*
Handle
,
int
Value
);
int
USBIO_ConfigUART
(
int
*
Handle
,
int
BaudRate
);
//int USBIO_Reset(int *Handle);
int
USBIO_SoftReset
(
int
*
Handle
);
int
USBIO_SetIdNr
(
int
*
Handle
,
int
IdNr
,
char
Description
[]);
int
USBIO_ConfigWatchdog
(
int
*
Handle
,
int
Active
,
int
TimeOut
,
int
Reset
,
unsigned
char
PortMask
[],
unsigned
char
Port
[],
int
AOfunction
);
int
USBIO_ResetWatchdog
(
int
*
Handle
);
//Status
int
USBIO_GetStatus
(
int
*
Handle
,
int
Value
[]);
int
USBIO_GetFirmwareVersion
(
int
*
Handle
,
char
*
Version
);
int
USBIO_GetHardwareVersion
(
int
*
Handle
,
char
*
Version
);
int
USBIO_GetSerialNr
(
int
*
Handle
,
unsigned
int
*
Serial
);
int
USBIO_GetLibVersion
(
char
*
Version
);
int
USBIO_GetIdNr
(
int
*
Handle
,
int
*
IdNr
,
char
*
Description
);
//Error
int
USBIO_GetErrorString
(
int
Error
,
char
*
ErrorMessage
,
int
*
StringLength
);
//Advanced functions
int
USBIO_WriteAndRead
(
int
*
Handle
,
unsigned
char
WriteBuffer
[],
unsigned
char
ReadBuffer
[]);
otherio/lib/rt/src/os_linux/hw_x86/makefile
0 → 100644
View file @
265c9b23
include
$(pwre_dir_symbols)
-include
$(pwre_kroot)/tools/bld/src/$(os_name)/$(hw_name)/$(type_name)_generic.mk
ifeq
($($(type_name)_generic_mk),)
-include
$(pwre_kroot)/tools/bld/src/$(os_name)/$(type_name)_generic.mk
endif
ifeq
($($(type_name)_generic_mk),)
include
$(pwre_kroot)/tools/bld/src/$(type_name)_generic.mk
endif
-include
../../special.mk
-include
../special.mk
-include
special.mk
otherio/lib/rt/src/os_linux/rt_io_m_motioncontrol_usb.c
0 → 100644
View file @
265c9b23
/*
* Proview $Id: rt_io_m_motioncontrol_usb.c,v 1.1 2007-11-22 13:28:59 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with the program, if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* rt_io_m_motioncontrol_usbio.c -- I/O methods for class MotionControl_USBIO. */
#include "pwr.h"
#include "pwr_basecomponentclasses.h"
#include "pwr_otherioclasses.h"
#include "rt_io_base.h"
#include "rt_io_rack_init.h"
#include "rt_io_rack_close.h"
#include "rt_io_msg.h"
#include "libusbio.h"
#include "rt_io_m_motioncontrol_usb.h"
static
pwr_tStatus
IoRackInit
(
io_tCtx
ctx
,
io_sAgent
*
ap
,
io_sRack
*
rp
)
{
io_sLocalUSB
*
local
;
int
status
;
int
i
;
unsigned
int
snum
;
int
found
;
io_sCard
*
cp
;
pwr_sClass_MotionControl_USB
*
op
=
(
pwr_sClass_MotionControl_USB
*
)
rp
->
op
;
local
=
(
io_sLocalUSB
*
)
calloc
(
1
,
sizeof
(
io_sLocalUSB
));
rp
->
Local
=
local
;
for
(
i
=
0
;
i
<
(
int
)
sizeof
(
local
->
USB_Handle
);
i
++
)
{
status
=
USBIO_Open
(
&
local
->
USB_Handle
[
i
]);
if
(
status
)
{
if
(
i
==
0
)
op
->
Status
=
status
;
break
;
}
/* Check is this card is configured */
status
=
USBIO_GetSerialNr
(
&
local
->
USB_Handle
[
i
],
&
snum
);
if
(
!
status
)
{
found
=
0
;
for
(
cp
=
rp
->
cardlist
;
cp
;
cp
=
cp
->
next
)
{
if
(
((
pwr_sClass_MotionControl_USBIO
*
)
cp
->
op
)
->
Super
.
Address
==
snum
)
{
local
->
snum
[
i
]
=
snum
;
found
=
1
;
break
;
}
}
if
(
!
found
)
{
errh_Info
(
"USBIO Serial number %d not configured"
,
snum
);
op
->
Status
=
USBIO_Close
(
&
local
->
USB_Handle
[
i
]);
i
--
;
continue
;
}
}
else
errh_Error
(
"USBIO Serial number error '%s'"
,
rp
->
Name
);
}
errh_Info
(
"Init of USBIO rack '%s'"
,
rp
->
Name
);
return
IO__SUCCESS
;
}
static
pwr_tStatus
IoRackClose
(
io_tCtx
ctx
,
io_sAgent
*
ap
,
io_sRack
*
rp
)
{
io_sLocalUSB
*
local
=
rp
->
Local
;
pwr_sClass_MotionControl_USB
*
op
=
(
pwr_sClass_MotionControl_USB
*
)
rp
->
op
;
int
i
;
for
(
i
=
0
;
i
<
(
int
)
sizeof
(
local
->
USB_Handle
);
i
++
)
{
if
(
local
->
USB_Handle
[
i
])
USBIO_Close
(
&
local
->
USB_Handle
[
i
]);
else
break
;
}
op
->
Status
=
0
;
return
IO__SUCCESS
;
}
/* Every method should be registred here. */
pwr_dExport
pwr_BindIoMethods
(
MotionControl_USB
)
=
{
pwr_BindIoMethod
(
IoRackInit
),
pwr_BindIoMethod
(
IoRackClose
),
pwr_NullMethod
};
otherio/lib/rt/src/os_linux/rt_io_m_motioncontrol_usb.h
0 → 100644
View file @
265c9b23
/* ra_io_m_motioncontrol_usb.h -- I/O methods for class MotionControl_USBIO. */
#ifndef ra_io_m_motioncontrol_usb_h
#define ra_io_m_motioncontrol_usb_h
#define USB_MAX_CARDS 50
typedef
struct
{
int
USB_Handle
[
USB_MAX_CARDS
];
unsigned
int
snum
[
USB_MAX_CARDS
];
}
io_sLocalUSB
;
#endif
otherio/lib/rt/src/os_linux/rt_io_m_motioncontrol_usbio.c
0 → 100644
View file @
265c9b23
This diff is collapsed.
Click to expand it.
otherio/lib/rt/src/rt_io_otherio.meth
0 → 100644
View file @
265c9b23
MotionControl_USB
MotionControl_USBIO
otherio/mmi/mcomp/src/os_linux/hw_x86/makefile
0 → 100644
View file @
265c9b23
include
$(pwre_dir_symbols)
-include
$(pwre_kroot)/tools/bld/src/$(os_name)/$(hw_name)/$(type_name)_generic.mk
ifeq
($($(type_name)_generic_mk),)
-include
$(pwre_kroot)/tools/bld/src/$(os_name)/$(type_name)_generic.mk
endif
ifeq
($($(type_name)_generic_mk),)
include
$(pwre_kroot)/tools/bld/src/$(type_name)_generic.mk
endif
-include
../../special.mk
-include
../special.mk
-include
special.mk
otherio/wbl/mcomp/src/os_linux/hw_x86/makefile
0 → 100644
View file @
265c9b23
include
$(pwre_dir_symbols)
-include
$(pwre_kroot)/tools/bld/src/$(os_name)/$(hw_name)/$(type_name)_generic.mk
ifeq
($($(type_name)_generic_mk),)
-include
$(pwre_kroot)/tools/bld/src/$(os_name)/$(type_name)_generic.mk
endif
ifeq
($($(type_name)_generic_mk),)
include
$(pwre_kroot)/tools/bld/src/$(type_name)_generic.mk
endif
-include
../../special.mk
-include
../special.mk
-include
special.mk
otherio/wbl/mcomp/src/otherio.wb_load
0 → 100644
View file @
265c9b23
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment