From fdfd85760dc82d2ba8c5cbb88475aad0e9e455b0 Mon Sep 17 00:00:00 2001 From: Martin Koegler Date: Mon, 24 Sep 2007 23:02:25 +0200 Subject: [PATCH] ARG_UINT8/16 Signed-off-by: Martin Koegler --- eibd/client/eibclient-int.h | 8 ++++++++ eibd/client/mcpropertyread.c | 19 ++----------------- eibd/client/mcpropertywrite.c | 20 ++------------------ eibd/client/mcread.c | 14 ++------------ eibd/client/mcwrite.c | 16 ++-------------- eibd/client/mcwriteplain.c | 16 ++-------------- 6 files changed, 18 insertions(+), 75 deletions(-) diff --git a/eibd/client/eibclient-int.h b/eibd/client/eibclient-int.h index f37e71b..1700214 100644 --- a/eibd/client/eibclient-int.h +++ b/eibd/client/eibclient-int.h @@ -270,12 +270,20 @@ int _EIB_GetRequest (EIBConnection * con); #define AGARG_NONE #define AGARG_BOOL(name, args) , int name AG##args +#define AGARG_UINT8(name, args) , uint8_t name AG##args +#define AGARG_UINT8a(name, args) , uint8_t name AG##args +#define AGARG_UINT8b(name, args) , uint8_t name AG##args +#define AGARG_UINT16(name, args) , uint16_t name AG##args #define AGARG_ADDR(name, args) , eibaddr_t name AG##args #define AGARG_INBUF(name, args) , int name##_len, const uint8_t *name AG##args #define AGARG_OUTBUF(name, args) , int name##_maxlen, uint8_t *name AG##args #define ALARG_NONE #define ALARG_BOOL(name, args) , name AL##args +#define ALARG_UINT8(name, args) , name AL##args +#define ALARG_UINT8a(name, args) , name AL##args +#define ALARG_UINT8b(name, args) , name AL##args +#define ALARG_UINT16(name, args) , name AL##args #define ALARG_ADDR(name, args) , name AL##args #define ALARG_INBUF(name, args) , name##_len, name AL##args #define ALARG_OUTBUF(name, args) , name##_maxlen, name AL##args diff --git a/eibd/client/mcpropertyread.c b/eibd/client/mcpropertyread.c index 2d2ffe5..42d136b 100644 --- a/eibd/client/mcpropertyread.c +++ b/eibd/client/mcpropertyread.c @@ -34,11 +34,7 @@ EIBC_COMPLETE (EIB_MC_PropertyRead, EIBC_RETURN_BUF (2) ) -int -EIB_MC_PropertyRead_async (EIBConnection * con, uint8_t obj, uint8_t property, - uint16_t start, uint8_t nr_of_elem, int buf_maxlen, - uint8_t * buf) -{ +EIBC_ASYNC (EIB_MC_PropertyRead, ARG_UINT8 (obj, ARG_UINT8a (property, ARG_UINT16 (start, ARG_UINT8b (nr_of_elem, ARG_OUTBUF (buf, ARG_NONE))))), EIBC_INIT_SEND (7) EIBC_READ_BUF (buf) EIBC_SETUINT8 (obj, 2) @@ -47,15 +43,4 @@ EIB_MC_PropertyRead_async (EIBConnection * con, uint8_t obj, uint8_t property, EIBC_SETUINT8 (nr_of_elem, 6) EIBC_SEND (EIB_MC_PROP_READ) EIBC_INIT_COMPLETE (EIB_MC_PropertyRead) -} - -int -EIB_MC_PropertyRead (EIBConnection * con, uint8_t obj, uint8_t property, - uint16_t start, uint8_t nr_of_elem, int max_len, - uint8_t * buf) -{ - if (EIB_MC_PropertyRead_async - (con, obj, property, start, nr_of_elem, max_len, buf) == -1) - return -1; - return EIBComplete (con); -} +) diff --git a/eibd/client/mcpropertywrite.c b/eibd/client/mcpropertywrite.c index 0878872..f0b15bf 100644 --- a/eibd/client/mcpropertywrite.c +++ b/eibd/client/mcpropertywrite.c @@ -34,12 +34,7 @@ EIBC_COMPLETE (EIB_MC_PropertyWrite, EIBC_RETURN_BUF (2) ) -int -EIB_MC_PropertyWrite_async (EIBConnection * con, uint8_t obj, - uint8_t property, uint16_t start, - uint8_t nr_of_elem, int buf_len, const uint8_t * buf, - int res_maxlen, uint8_t * res) -{ +EIBC_ASYNC (EIB_MC_PropertyWrite, ARG_UINT8 (obj, ARG_UINT8a (property, ARG_UINT16 (start, ARG_UINT8b (nr_of_elem, ARG_INBUF (buf, ARG_OUTBUF (res, ARG_NONE)))))), EIBC_INIT_SEND (7) EIBC_SETUINT8 (obj, 2) EIBC_SETUINT8 (property, 3) @@ -49,15 +44,4 @@ EIB_MC_PropertyWrite_async (EIBConnection * con, uint8_t obj, EIBC_READ_BUF (res) EIBC_SEND (EIB_MC_PROP_WRITE) EIBC_INIT_COMPLETE (EIB_MC_PropertyWrite) -} - -int -EIB_MC_PropertyWrite (EIBConnection * con, uint8_t obj, uint8_t property, - uint16_t start, uint8_t nr_of_elem, int len, - const uint8_t * buf, int max_len, uint8_t * res) -{ - if (EIB_MC_PropertyWrite_async - (con, obj, property, start, nr_of_elem, len, buf, max_len, res) == -1) - return -1; - return EIBComplete (con); -} +) diff --git a/eibd/client/mcread.c b/eibd/client/mcread.c index 816e1bb..bae20ee 100644 --- a/eibd/client/mcread.c +++ b/eibd/client/mcread.c @@ -34,21 +34,11 @@ EIBC_COMPLETE (EIB_MC_Read, EIBC_RETURN_BUF (2) ) -int -EIB_MC_Read_async (EIBConnection * con, uint16_t addr, int buf_maxlen, uint8_t * buf) -{ +EIBC_ASYNC (EIB_MC_Read, ARG_UINT16 (addr, ARG_OUTBUF (buf, ARG_NONE)), EIBC_INIT_SEND (6) EIBC_READ_BUF (buf) EIBC_SETUINT16 (addr, 2) EIBC_SETUINT16 (EIBC_READ_LEN (buf), 4) EIBC_SEND (EIB_MC_READ) EIBC_INIT_COMPLETE (EIB_MC_Read) -} - -int -EIB_MC_Read (EIBConnection * con, uint16_t addr, int len, uint8_t * buf) -{ - if (EIB_MC_Read_async (con, addr, len, buf) == -1) - return -1; - return EIBComplete (con); -} +) diff --git a/eibd/client/mcwrite.c b/eibd/client/mcwrite.c index 270efe3..cea2f30 100644 --- a/eibd/client/mcwrite.c +++ b/eibd/client/mcwrite.c @@ -35,23 +35,11 @@ EIBC_COMPLETE (EIB_MC_Write, EIBC_RETURN_LEN ) -int -EIB_MC_Write_async (EIBConnection * con, uint16_t addr, int buf_len, - const uint8_t * buf) -{ +EIBC_ASYNC (EIB_MC_Write, ARG_UINT16 (addr, ARG_INBUF (buf, ARG_NONE)), EIBC_INIT_SEND (6) EIBC_SETUINT16 (addr, 2) EIBC_SETUINT16 (EIBC_SEND_LEN (buf), 4) EIBC_SEND_BUF (buf) EIBC_SEND (EIB_MC_WRITE) EIBC_INIT_COMPLETE (EIB_MC_Write) -} - -int -EIB_MC_Write (EIBConnection * con, uint16_t addr, int len, - const uint8_t * buf) -{ - if (EIB_MC_Write_async (con, addr, len, buf) == -1) - return -1; - return EIBComplete (con); -} +) diff --git a/eibd/client/mcwriteplain.c b/eibd/client/mcwriteplain.c index d66b077..fbc2a2a 100644 --- a/eibd/client/mcwriteplain.c +++ b/eibd/client/mcwriteplain.c @@ -34,23 +34,11 @@ EIBC_COMPLETE (EIB_MC_Write_Plain, EIBC_RETURN_LEN ) -int -EIB_MC_Write_Plain_async (EIBConnection * con, uint16_t addr, int buf_len, - const uint8_t * buf) -{ +EIBC_ASYNC (EIB_MC_Write_Plain, ARG_UINT16 (addr, ARG_INBUF (buf, ARG_NONE)), EIBC_INIT_SEND (6) EIBC_SETUINT16 (addr, 2) EIBC_SETUINT16 (EIBC_SEND_LEN (buf), 4) EIBC_SEND_BUF (buf) EIBC_SEND (EIB_MC_WRITE_NOVERIFY) EIBC_INIT_COMPLETE (EIB_MC_Write_Plain) -} - -int -EIB_MC_Write_Plain (EIBConnection * con, uint16_t addr, int len, - const uint8_t * buf) -{ - if (EIB_MC_Write_Plain_async (con, addr, len, buf) == -1) - return -1; - return EIBComplete (con); -} +) -- 2.11.4.GIT