--- /dev/null
+#ifndef _UL_UTSUBST_H
+#define _UL_UTSUBST_H
+
+#ifndef _SIZE_T_DEFINED
+#define _SIZE_T_DEFINED
+ typedef unsigned int size_t;
+#endif
+
+#ifndef UL_OFFSETOF
+/* offset of structure field */
+#define UL_OFFSETOF(_type,_member) \
+ ((size_t)&(((_type*)0)->_member))
+#endif /*UL_OFFSET*/
+
+#ifndef UL_CONTAINEROF
+#ifdef __GNUC__
+#define UL_CONTAINEROF(_ptr, _type, _member) ({ \
+ const typeof( ((_type *)0)->_member ) *__mptr = (_ptr); \
+ (_type *)( (char *)__mptr - UL_OFFSETOF(_type,_member) );})
+#else /*!__GNUC__*/
+#define UL_CONTAINEROF(_ptr, _type, _member) \
+ ((_type *)( (char *)_ptr - UL_OFFSETOF(_type,_member)))
+#endif /*__GNUC__*/
+#endif /*UL_CONTAINEROF*/
+
+/* GNUC neat features */
+
+#ifdef __GNUC__
+#ifndef UL_ATTR_UNUSED
+#define UL_ATTR_PRINTF( format_idx, arg_idx ) \
+ __attribute__((format (printf, format_idx, arg_idx)))
+#define UL_ATTR_SCANF( format_idx, arg_idx ) \
+ __attribute__((format (scanf, format_idx, arg_idx)))
+#define UL_ATTR_FORMAT( arg_idx ) \
+ __attribute__((format_arg (arg_idx)))
+#define UL_ATTR_NORETURN \
+ __attribute__((noreturn))
+#define UL_ATTR_CONST \
+ __attribute__((const))
+#define UL_ATTR_UNUSED \
+ __attribute__((unused))
+#endif /*UL_ATTR_UNUSED*/
+#else /* !__GNUC__ */
+#ifndef UL_ATTR_UNUSED
+#define UL_ATTR_PRINTF( format_idx, arg_idx )
+#define UL_ATTR_SCANF( format_idx, arg_idx )
+#define UL_ATTR_FORMAT( arg_idx )
+#define UL_ATTR_NORETURN
+#define UL_ATTR_CONST
+#define UL_ATTR_UNUSED
+#endif /*UL_ATTR_UNUSED*/
+#endif /* !__GNUC__ */
+
+#endif /*_UL_UTSUBST_H*/
/*extern "C" {*/
#endif
+#include <ul_lib/ul_utsubst.h>
+
#ifndef uchar
#define uchar unsigned char
#endif
#define ULOI_ERRCLR 31 /* clear error status */
typedef struct uloi_coninfo_t {
+ uchar error; /* error condition occurred */
+ uchar state; /* internal state */
+ int array_idx;/* array index */
+} uloi_coninfo_t;
+
+typedef struct uloi_con_ulan_t {
+ uloi_coninfo_t con;
uchar adr; /* address of target module */
uchar cmd; /* service/cmd number for uLOI on target */
uchar bcmd; /* service/cmd number for returned messages */
uchar sn; /* sequence counter */
uchar bsn; /* sequence counter of target module */
uchar outflg; /* flags used for outgoing messages */
- ul_fd_t ul_fd;/* handle for ul_drv */
- ul_fd_t ul_fd1;/* the auxiliary handle for ULOI direct reply */
+ ul_fd_t rdfd;/* handle for ul_drv */
+ ul_fd_t wrfd;/* the auxiliary handle for ULOI direct reply */
int timeout; /* timeout */
- uchar error; /* error condition occurred */
- uchar state; /* internal state */
- int array_idx;/* array index */
-} uloi_coninfo_t;
+} uloi_con_ulan_t;
+
+int uloi_con_ulan_set_cmd_fd(uloi_coninfo_t *coninfo, int cmd,
+ ul_fd_t rdfd, ul_fd_t wrfd);
/* definitions of basic uLan OI functions */