const correctness in coe functions (#620)

* add const in RxPDO and SDOwrite

* doc typo

* uniform indention in ethercatcoe.h

Co-authored-by: Lukas Beckmann <lukas.beckmann@yuanda-robotics.de>
This commit is contained in:
lbckmnn 2022-06-20 08:29:17 +02:00 committed by GitHub
parent 0b8f888f2c
commit 9183e3068a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 13 deletions

View File

@ -328,14 +328,14 @@ int ecx_SDOread(ecx_contextt *context, uint16 slave, uint16 index, uint8 subinde
* @return Workcounter from last slave response * @return Workcounter from last slave response
*/ */
int ecx_SDOwrite(ecx_contextt *context, uint16 Slave, uint16 Index, uint8 SubIndex, int ecx_SDOwrite(ecx_contextt *context, uint16 Slave, uint16 Index, uint8 SubIndex,
boolean CA, int psize, void *p, int Timeout) boolean CA, int psize, const void *p, int Timeout)
{ {
ec_SDOt *SDOp, *aSDOp; ec_SDOt *SDOp, *aSDOp;
int wkc, maxdata, framedatasize; int wkc, maxdata, framedatasize;
ec_mbxbuft MbxIn, MbxOut; ec_mbxbuft MbxIn, MbxOut;
uint8 cnt, toggle; uint8 cnt, toggle;
boolean NotLast; boolean NotLast;
uint8 *hp; const uint8 *hp;
ec_clearmbx(&MbxIn); ec_clearmbx(&MbxIn);
/* Empty slave out mailbox if something is in. Timeout set to 0 */ /* Empty slave out mailbox if something is in. Timeout set to 0 */
@ -548,7 +548,7 @@ int ecx_SDOwrite(ecx_contextt *context, uint16 Slave, uint16 Index, uint8 SubInd
* @param[out] p = Pointer to PDO buffer * @param[out] p = Pointer to PDO buffer
* @return Workcounter from last slave response * @return Workcounter from last slave response
*/ */
int ecx_RxPDO(ecx_contextt *context, uint16 Slave, uint16 RxPDOnumber, int psize, void *p) int ecx_RxPDO(ecx_contextt *context, uint16 Slave, uint16 RxPDOnumber, int psize, const void *p)
{ {
ec_SDOt *SDOp; ec_SDOt *SDOp;
int wkc, maxdata, framedatasize; int wkc, maxdata, framedatasize;
@ -584,7 +584,7 @@ int ecx_RxPDO(ecx_contextt *context, uint16 Slave, uint16 RxPDOnumber, int psize
/** CoE TxPDO read remote request, blocking. /** CoE TxPDO read remote request, blocking.
* *
* A RxPDO download request is issued. * A TxPDO download request is issued.
* *
* @param[in] context = context struct * @param[in] context = context struct
* @param[in] slave = Slave number * @param[in] slave = Slave number
@ -1365,7 +1365,7 @@ int ec_SDOread(uint16 slave, uint16 index, uint8 subindex,
* @see ecx_SDOwrite * @see ecx_SDOwrite
*/ */
int ec_SDOwrite(uint16 Slave, uint16 Index, uint8 SubIndex, int ec_SDOwrite(uint16 Slave, uint16 Index, uint8 SubIndex,
boolean CA, int psize, void *p, int Timeout) boolean CA, int psize, const void *p, int Timeout)
{ {
return ecx_SDOwrite(&ecx_context, Slave, Index, SubIndex, CA, psize, p, Timeout); return ecx_SDOwrite(&ecx_context, Slave, Index, SubIndex, CA, psize, p, Timeout);
} }
@ -1381,14 +1381,14 @@ int ec_SDOwrite(uint16 Slave, uint16 Index, uint8 SubIndex,
* @return Workcounter from last slave response * @return Workcounter from last slave response
* @see ecx_RxPDO * @see ecx_RxPDO
*/ */
int ec_RxPDO(uint16 Slave, uint16 RxPDOnumber, int psize, void *p) int ec_RxPDO(uint16 Slave, uint16 RxPDOnumber, int psize, const void *p)
{ {
return ecx_RxPDO(&ecx_context, Slave, RxPDOnumber, psize, p); return ecx_RxPDO(&ecx_context, Slave, RxPDOnumber, psize, p);
} }
/** CoE TxPDO read remote request, blocking. /** CoE TxPDO read remote request, blocking.
* *
* A RxPDO download request is issued. * A TxPDO download request is issued.
* *
* @param[in] slave = Slave number * @param[in] slave = Slave number
* @param[in] TxPDOnumber = Related TxPDO number * @param[in] TxPDOnumber = Related TxPDO number

View File

@ -61,10 +61,10 @@ typedef struct
#ifdef EC_VER1 #ifdef EC_VER1
void ec_SDOerror(uint16 Slave, uint16 Index, uint8 SubIdx, int32 AbortCode); void ec_SDOerror(uint16 Slave, uint16 Index, uint8 SubIdx, int32 AbortCode);
int ec_SDOread(uint16 slave, uint16 index, uint8 subindex, int ec_SDOread(uint16 slave, uint16 index, uint8 subindex,
boolean CA, int *psize, void *p, int timeout); boolean CA, int *psize, void *p, int timeout);
int ec_SDOwrite(uint16 Slave, uint16 Index, uint8 SubIndex, int ec_SDOwrite(uint16 Slave, uint16 Index, uint8 SubIndex,
boolean CA, int psize, void *p, int Timeout); boolean CA, int psize, const void *p, int Timeout);
int ec_RxPDO(uint16 Slave, uint16 RxPDOnumber , int psize, void *p); int ec_RxPDO(uint16 Slave, uint16 RxPDOnumber , int psize, const void *p);
int ec_TxPDO(uint16 slave, uint16 TxPDOnumber , int *psize, void *p, int timeout); int ec_TxPDO(uint16 slave, uint16 TxPDOnumber , int *psize, void *p, int timeout);
int ec_readPDOmap(uint16 Slave, uint32 *Osize, uint32 *Isize); int ec_readPDOmap(uint16 Slave, uint32 *Osize, uint32 *Isize);
int ec_readPDOmapCA(uint16 Slave, int Thread_n, uint32 *Osize, uint32 *Isize); int ec_readPDOmapCA(uint16 Slave, int Thread_n, uint32 *Osize, uint32 *Isize);
@ -76,10 +76,10 @@ int ec_readOE(uint16 Item, ec_ODlistt *pODlist, ec_OElistt *pOElist);
void ecx_SDOerror(ecx_contextt *context, uint16 Slave, uint16 Index, uint8 SubIdx, int32 AbortCode); void ecx_SDOerror(ecx_contextt *context, uint16 Slave, uint16 Index, uint8 SubIdx, int32 AbortCode);
int ecx_SDOread(ecx_contextt *context, uint16 slave, uint16 index, uint8 subindex, int ecx_SDOread(ecx_contextt *context, uint16 slave, uint16 index, uint8 subindex,
boolean CA, int *psize, void *p, int timeout); boolean CA, int *psize, void *p, int timeout);
int ecx_SDOwrite(ecx_contextt *context, uint16 Slave, uint16 Index, uint8 SubIndex, int ecx_SDOwrite(ecx_contextt *context, uint16 Slave, uint16 Index, uint8 SubIndex,
boolean CA, int psize, void *p, int Timeout); boolean CA, int psize, const void *p, int Timeout);
int ecx_RxPDO(ecx_contextt *context, uint16 Slave, uint16 RxPDOnumber , int psize, void *p); int ecx_RxPDO(ecx_contextt *context, uint16 Slave, uint16 RxPDOnumber , int psize, const void *p);
int ecx_TxPDO(ecx_contextt *context, uint16 slave, uint16 TxPDOnumber , int *psize, void *p, int timeout); int ecx_TxPDO(ecx_contextt *context, uint16 slave, uint16 TxPDOnumber , int *psize, void *p, int timeout);
int ecx_readPDOmap(ecx_contextt *context, uint16 Slave, uint32 *Osize, uint32 *Isize); int ecx_readPDOmap(ecx_contextt *context, uint16 Slave, uint32 *Osize, uint32 *Isize);
int ecx_readPDOmapCA(ecx_contextt *context, uint16 Slave, int Thread_n, uint32 *Osize, uint32 *Isize); int ecx_readPDOmapCA(ecx_contextt *context, uint16 Slave, int Thread_n, uint32 *Osize, uint32 *Isize);