forked from COVESA/Open1722
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request COVESA#26 from boschglobal/feat/more-acf-formats
Add FlexRay, Lin, Most ACF formats
- Loading branch information
Showing
9 changed files
with
528 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
/* | ||
* Copyright (c) 2024, COVESA | ||
* | ||
* Redistribution and use in source and binary forms, with or without | ||
* modification, are permitted provided that the following conditions are met: | ||
* | ||
* * Redistributions of source code must retain the above copyright notice, | ||
* this list of conditions and the following disclaimer. | ||
* * Redistributions in binary form must reproduce the above copyright | ||
* notice, this list of conditions and the following disclaimer in the | ||
* documentation and/or other materials provided with the distribution. | ||
* * Neither the name of COVESA nor the names of its contributors may be | ||
* used to endorse or promote products derived from this software without | ||
* specific prior written permission. | ||
* | ||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE | ||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | ||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | ||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | ||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
* | ||
* SPDX-License-Identifier: BSD-3-Clause | ||
*/ | ||
|
||
/** | ||
* @file This files contains functions for de-/serialization of IEEE1722's ACF | ||
* FlexRay PDU formats. For details see IEEE Std. 1722-2016, chapter 9.4.2. | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include <stdint.h> | ||
|
||
#include "avtp/Defines.h" | ||
#include "avtp/acf/Common.h" | ||
|
||
/** Length of ACF FlexRay header. */ | ||
#define AVTP_FLEXRAY_HEADER_LEN (4 * AVTP_QUADLET_SIZE) | ||
|
||
/** ACF FlexRay PDU. */ | ||
typedef struct { | ||
uint8_t header[AVTP_FLEXRAY_HEADER_LEN]; | ||
uint8_t payload[0]; | ||
} Avtp_FlexRay_t; | ||
|
||
/** Fields of ACF FlexRay PDU. */ | ||
typedef enum { | ||
/* ACF common header fields */ | ||
AVTP_FLEXRAY_FIELD_ACF_MSG_TYPE = 0, | ||
AVTP_FLEXRAY_FIELD_ACF_MSG_LENGTH, | ||
/* ACF FlexRay header fields */ | ||
AVTP_FLEXRAY_FIELD_PAD, | ||
AVTP_FLEXRAY_FIELD_MTV, | ||
AVTP_FLEXRAY_FIELD_FR_BUS_ID, | ||
AVTP_FLEXRAY_FIELD_RESERVED, | ||
AVTP_FLEXRAY_FIELD_CHAN, | ||
AVTP_FLEXRAY_FIELD_STR, | ||
AVTP_FLEXRAY_FIELD_SYN, | ||
AVTP_FLEXRAY_FIELD_PRE, | ||
AVTP_FLEXRAY_FIELD_NFI, | ||
AVTP_FLEXRAY_FIELD_MESSAGE_TIMESTAMP, | ||
AVTP_FLEXRAY_FIELD_FR_FRAME_ID, | ||
AVTP_FLEXRAY_FIELD_RESERVED_2, | ||
AVTP_FLEXRAY_FIELD_CYCLE, | ||
/* Count number of fields for bound checks */ | ||
AVTP_FLEXRAY_FIELD_MAX | ||
} Avtp_FlexRayFields_t; | ||
|
||
/** | ||
* Initializes an ACF FlexRay PDU. | ||
* | ||
* @param pdu Pointer to the first bit of a 1722 ACF FlexRay PDU. | ||
*/ | ||
int Avtp_FlexRay_Init(Avtp_FlexRay_t* pdu); | ||
|
||
/** | ||
* Returns the value of an ACF FlexRay PDU field. | ||
* | ||
* @param pdu Pointer to the first bit of an 1722 ACF FlexRay PDU. | ||
* @param field Data field to be read | ||
* @param value Pointer to location to store the value. | ||
* @returns Returns 0 if the data field was successfully read. | ||
*/ | ||
int Avtp_FlexRay_GetField(Avtp_FlexRay_t* pdu, Avtp_FlexRayFields_t field, uint64_t* value); | ||
|
||
/** | ||
* Sets the value of an ACF FlexRay PDU field. | ||
* | ||
* @param pdu Pointer to the first bit of an 1722 ACF FlexRay PDU. | ||
* @param field Specifies the position of the data field to be read | ||
* @param value Pointer to location to store the value. | ||
* @returns Returns 0 if the data field was successfully set. | ||
*/ | ||
int Avtp_FlexRay_SetField(Avtp_FlexRay_t* pdu, Avtp_FlexRayFields_t field, uint64_t value); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
/* | ||
* Copyright (c) 2024, COVESA | ||
* | ||
* Redistribution and use in source and binary forms, with or without | ||
* modification, are permitted provided that the following conditions are met: | ||
* | ||
* * Redistributions of source code must retain the above copyright notice, | ||
* this list of conditions and the following disclaimer. | ||
* * Redistributions in binary form must reproduce the above copyright | ||
* notice, this list of conditions and the following disclaimer in the | ||
* documentation and/or other materials provided with the distribution. | ||
* * Neither the name of COVESA nor the names of its contributors may be | ||
* used to endorse or promote products derived from this software without | ||
* specific prior written permission. | ||
* | ||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE | ||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | ||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | ||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | ||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
* | ||
* SPDX-License-Identifier: BSD-3-Clause | ||
*/ | ||
|
||
/** | ||
* @file This files contains functions for de-/serialization of IEEE1722's ACF | ||
* Lin PDU formats. For details see IEEE Std. 1722-2016, chapter 9.4.5. | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include <stdint.h> | ||
|
||
#include "avtp/Defines.h" | ||
#include "avtp/acf/Common.h" | ||
|
||
/** Length of ACF Lin header. */ | ||
#define AVTP_LIN_HEADER_LEN (3 * AVTP_QUADLET_SIZE) | ||
|
||
/** ACF Lin PDU. */ | ||
typedef struct { | ||
uint8_t header[AVTP_LIN_HEADER_LEN]; | ||
uint8_t payload[0]; | ||
} Avtp_Lin_t; | ||
|
||
|
||
/** Fields of ACF Lin PDU. */ | ||
typedef enum { | ||
/* ACF common header fields */ | ||
AVTP_LIN_FIELD_ACF_MSG_TYPE = 0, | ||
AVTP_LIN_FIELD_ACF_MSG_LENGTH, | ||
/* ACF Lin header fields */ | ||
AVTP_LIN_FIELD_PAD, | ||
AVTP_LIN_FIELD_MTV, | ||
AVTP_LIN_FIELD_LIN_BUS_ID, | ||
AVTP_LIN_FIELD_LIN_IDENTIFIER, | ||
AVTP_LIN_FIELD_MESSAGE_TIMESTAMP, | ||
/* Count number of fields for bound checks */ | ||
AVTP_LIN_FIELD_MAX | ||
} Avtp_LinFields_t; | ||
|
||
/** | ||
* Initializes an ACF Lin PDU. | ||
* | ||
* @param pdu Pointer to the first bit of a 1722 ACF Lin PDU. | ||
*/ | ||
int Avtp_Lin_Init(Avtp_Lin_t* pdu); | ||
|
||
/** | ||
* Returns the value of an ACF Lin PDU field. | ||
* | ||
* @param pdu Pointer to the first bit of an 1722 ACF Lin PDU. | ||
* @param field Data field to be read | ||
* @param value Pointer to location to store the value. | ||
* @returns Returns 0 if the data field was successfully read. | ||
*/ | ||
int Avtp_Lin_GetField(Avtp_Lin_t* pdu, Avtp_LinFields_t field, uint64_t* value); | ||
|
||
/** | ||
* Sets the value of an ACF Lin PDU field. | ||
* | ||
* @param pdu Pointer to the first bit of an 1722 ACF Lin PDU. | ||
* @param field Specifies the position of the data field to be read | ||
* @param value Pointer to location to store the value. | ||
* @returns Returns 0 if the data field was successfully set. | ||
*/ | ||
int Avtp_Lin_SetField(Avtp_Lin_t* pdu, Avtp_LinFields_t field, uint64_t value); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
/* | ||
* Copyright (c) 2024, COVESA | ||
* | ||
* Redistribution and use in source and binary forms, with or without | ||
* modification, are permitted provided that the following conditions are met: | ||
* | ||
* * Redistributions of source code must retain the above copyright notice, | ||
* this list of conditions and the following disclaimer. | ||
* * Redistributions in binary form must reproduce the above copyright | ||
* notice, this list of conditions and the following disclaimer in the | ||
* documentation and/or other materials provided with the distribution. | ||
* * Neither the name of COVESA nor the names of its contributors may be | ||
* used to endorse or promote products derived from this software without | ||
* specific prior written permission. | ||
* | ||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE | ||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | ||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | ||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | ||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
* | ||
* SPDX-License-Identifier: BSD-3-Clause | ||
*/ | ||
|
||
/** | ||
* @file This files contains functions for de-/serialization of IEEE1722's ACF | ||
* Most PDU formats. For details see IEEE Std. 1722-2016, chapter 9.4.6. | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include <stdint.h> | ||
|
||
#include "avtp/Defines.h" | ||
#include "avtp/acf/Common.h" | ||
|
||
/** Length of ACF Most header. */ | ||
#define AVTP_MOST_HEADER_LEN (4 * AVTP_QUADLET_SIZE) | ||
|
||
/** ACF Most PDU. */ | ||
typedef struct { | ||
uint8_t header[AVTP_MOST_HEADER_LEN]; | ||
uint8_t payload[0]; | ||
} Avtp_Most_t; | ||
|
||
/** Fields of ACF Most PDU. */ | ||
typedef enum { | ||
/* ACF common header fields */ | ||
AVTP_MOST_FIELD_ACF_MSG_TYPE = 0, | ||
AVTP_MOST_FIELD_ACF_MSG_LENGTH, | ||
/* ACF Most header fields */ | ||
AVTP_MOST_FIELD_PAD, | ||
AVTP_MOST_FIELD_MTV, | ||
AVTP_MOST_FIELD_MOST_NET_ID, | ||
AVTP_MOST_FIELD_RESERVED, | ||
AVTP_MOST_FIELD_MESSAGE_TIMESTAMP, | ||
AVTP_MOST_FIELD_DEVICE_ID, | ||
AVTP_MOST_FIELD_FBLOCK_ID, | ||
AVTP_MOST_FIELD_INST_ID, | ||
AVTP_MOST_FIELD_FUNC_ID, | ||
AVTP_MOST_FIELD_OP_TYPE, | ||
AVTP_MOST_FIELD_RESERVED_2, | ||
/* Count number of fields for bound checks */ | ||
AVTP_MOST_FIELD_MAX | ||
} Avtp_MostFields_t; | ||
|
||
/** | ||
* Initializes an ACF Most PDU. | ||
* | ||
* @param pdu Pointer to the first bit of a 1722 ACF Most PDU. | ||
*/ | ||
int Avtp_Most_Init(Avtp_Most_t* pdu); | ||
|
||
/** | ||
* Returns the value of an ACF Most PDU field. | ||
* | ||
* @param pdu Pointer to the first bit of an 1722 ACF Most PDU. | ||
* @param field Data field to be read | ||
* @param value Pointer to location to store the value. | ||
* @returns Returns 0 if the data field was successfully read. | ||
*/ | ||
int Avtp_Most_GetField(Avtp_Most_t* pdu, Avtp_MostFields_t field, uint64_t* value); | ||
|
||
/** | ||
* Sets the value of an ACF Most PDU field. | ||
* | ||
* @param pdu Pointer to the first bit of an 1722 ACF Most PDU. | ||
* @param field Specifies the position of the data field to be read | ||
* @param value Pointer to location to store the value. | ||
* @returns Returns 0 if the data field was successfully set. | ||
*/ | ||
int Avtp_Most_SetField(Avtp_Most_t* pdu, Avtp_MostFields_t field, uint64_t value); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.