Skip to content

Commit 7e737d7

Browse files
committed
First version for uC setup.
Signed-off-by: Naresh Nayak <Naresh.Nayak@de.bosch.com>
1 parent 41c8083 commit 7e737d7

File tree

14 files changed

+78
-14
lines changed

14 files changed

+78
-14
lines changed

examples/aaf/aaf-listener.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@
6969
#include <unistd.h>
7070
#include <inttypes.h>
7171

72-
#include "avtp.h"
7372
#include "avtp/aaf/PcmStream.h"
7473
#include "common.h"
7574
#include "avtp/CommonHeader.h"

examples/aaf/aaf-talker.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@
6464
#include <string.h>
6565
#include <unistd.h>
6666

67-
#include "avtp.h"
6867
#include "avtp/aaf/PcmStream.h"
6968
#include "common.h"
7069
#include "avtp/CommonHeader.h"

examples/crf/crf-listener.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,6 @@
9999
#include <math.h>
100100
#include <inttypes.h>
101101

102-
#include "avtp.h"
103102
#include "avtp/Crf.h"
104103
#include "avtp/aaf/PcmStream.h"
105104
#include "common.h"

examples/crf/crf-talker.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@
6262
#include <unistd.h>
6363
#include <math.h>
6464

65-
#include "avtp.h"
6665
#include "avtp/Crf.h"
6766
#include "common.h"
6867
#include "avtp/CommonHeader.h"

examples/cvf/cvf-listener.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@
7272
#include <unistd.h>
7373
#include <inttypes.h>
7474

75-
#include "avtp.h"
7675
#include "avtp/cvf/Cvf.h"
7776
#include "avtp/cvf/H264.h"
7877
#include "avtp/CommonHeader.h"

examples/cvf/cvf-talker.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@
7575
#include <string.h>
7676
#include <unistd.h>
7777

78-
#include "avtp.h"
7978
#include "avtp/cvf/Cvf.h"
8079
#include "avtp/cvf/H264.h"
8180
#include "common.h"

include/avtp/CommonHeader.h

Lines changed: 48 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ typedef struct {
5151
* Enumeration over all IEEE 1722 header fields. The naming convention used is
5252
* AVTP_<MSG_TYPE>_FIELD_<FIEL_NAME>.
5353
*/
54-
typedef enum {
54+
typedef enum Avtp_CommonHeaderField{
5555
/* Common AVTP header fields */
5656
AVTP_COMMON_HEADER_FIELD_SUBTYPE = 0,
5757
AVTP_COMMON_HEADER_FIELD_H,
@@ -104,4 +104,50 @@ int Avtp_CommonHeader_GetField(Avtp_CommonHeader_t* avtp_pdu, Avtp_CommonHeaderF
104104
* @returns This function returns 0 if the data field was successfully set in
105105
* the 1722 AVTP PDU.
106106
*/
107-
int Avtp_CommonHeader_SetField(Avtp_CommonHeader_t* avtp_pdu, Avtp_CommonHeaderField_t field, uint64_t value);
107+
int Avtp_CommonHeader_SetField(Avtp_CommonHeader_t* avtp_pdu, Avtp_CommonHeaderField_t field, uint64_t value);
108+
109+
/******************************************************************************
110+
* Legacy API (deprecated)
111+
*****************************************************************************/
112+
113+
struct avtp_common_pdu {
114+
uint32_t subtype_data;
115+
uint8_t pdu_specific[0];
116+
} __attribute__ ((__packed__));
117+
118+
struct avtp_stream_pdu {
119+
uint32_t subtype_data;
120+
uint64_t stream_id;
121+
uint32_t avtp_time;
122+
uint32_t format_specific;
123+
uint32_t packet_info;
124+
uint8_t avtp_payload[0];
125+
} __attribute__ ((__packed__));
126+
127+
#define AVTP_FIELD_SUBTYPE (AVTP_COMMON_HEADER_FIELD_SUBTYPE)
128+
#define AVTP_FIELD_VERSION (AVTP_COMMON_HEADER_FIELD_VERSION)
129+
#define AVTP_FIELD_MAX (AVTP_COMMON_HEADER_FIELD_MAX)
130+
131+
/* Get value from Common AVTPDU field.
132+
* @pdu: Pointer to PDU struct.
133+
* @field: PDU field to be retrieved.
134+
* @val: Pointer to variable which the retrieved value should be saved.
135+
*
136+
* Returns:
137+
* 0: Success.
138+
* -EINVAL: If any argument is invalid.
139+
*/
140+
int avtp_pdu_get(const struct avtp_common_pdu *pdu, Avtp_CommonHeaderField_t field,
141+
uint32_t *val);
142+
143+
/* Set value from Common AVTPDU field.
144+
* @pdu: Pointer to PDU struct.
145+
* @field: PDU field to be set.
146+
* @val: Value to be set.
147+
*
148+
* Returns:
149+
* 0: Success.
150+
* -EINVAL: If any argument is invalid.
151+
*/
152+
int avtp_pdu_set(struct avtp_common_pdu *pdu, Avtp_CommonHeaderField_t field,
153+
uint32_t val);

meson.build

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ project(
99
avtp_lib = library(
1010
'open1722',
1111
[
12-
'src/avtp.c',
1312
'src/avtp/Utils.c',
1413
'src/avtp/acf/Ntscf.c',
1514
'src/avtp/acf/Tscf.c',

src/avtp/CommonHeader.c

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,3 +52,24 @@ int Avtp_CommonHeader_SetField(Avtp_CommonHeader_t* avtp_pdu, Avtp_CommonHeaderF
5252
{
5353
return Avtp_SetField(Avtp_CommonHeaderFieldDesc, AVTP_COMMON_HEADER_FIELD_MAX, (uint8_t*)avtp_pdu, (uint8_t)field, value);
5454
}
55+
56+
/******************************************************************************
57+
* Legacy API
58+
*****************************************************************************/
59+
int avtp_pdu_get(const struct avtp_common_pdu *pdu, Avtp_CommonHeaderField_t field,
60+
uint32_t *val)
61+
{
62+
uint64_t temp;
63+
int ret;
64+
ret = Avtp_CommonHeader_GetField((Avtp_CommonHeader_t*) pdu, field, &temp);
65+
if (val == NULL) return -EINVAL;
66+
67+
*val = (uint32_t)temp;
68+
return ret;
69+
}
70+
71+
int avtp_pdu_set(struct avtp_common_pdu *pdu, Avtp_CommonHeaderField_t field,
72+
uint32_t value)
73+
{
74+
return Avtp_CommonHeader_SetField((Avtp_CommonHeader_t*) pdu, field, value);
75+
}

unit/test-aaf.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,9 @@
3030
#include <setjmp.h>
3131
#include <cmocka.h>
3232
#include <arpa/inet.h>
33+
#include <errno.h>
3334

34-
#include "avtp.h"
35+
#include "avtp/CommonHeader.h"
3536
#include "avtp/aaf/PcmStream.h"
3637

3738
static void aaf_get_field_null_pdu(void **state)

unit/test-avtp.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@
3030
#include <setjmp.h>
3131
#include <cmocka.h>
3232
#include <arpa/inet.h>
33+
#include <errno.h>
3334

34-
#include "avtp.h"
3535
#include "avtp/CommonHeader.h"
3636

3737
static void get_field_null_pdu(void **state)

unit/test-crf.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,9 @@
3131
#include <cmocka.h>
3232
#include <arpa/inet.h>
3333
#include <stdio.h>
34+
#include <errno.h>
3435

35-
#include "avtp.h"
36+
#include "avtp/CommonHeader.h"
3637
#include "avtp/Crf.h"
3738

3839
static void crf_get_field_null_pdu(void **state)

unit/test-cvf.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,9 @@
3333
#include <setjmp.h>
3434
#include <cmocka.h>
3535
#include <arpa/inet.h>
36+
#include <errno.h>
3637

37-
#include "avtp.h"
38+
#include "avtp/CommonHeader.h"
3839
#include "avtp/cvf/Cvf.h"
3940
#include "avtp/cvf/H264.h"
4041

unit/test-rvf.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,9 @@
3434
#include <cmocka.h>
3535
#include <arpa/inet.h>
3636
#include <stdio.h>
37+
#include <errno.h>
3738

38-
#include "avtp.h"
39+
#include "avtp/CommonHeader.h"
3940
#include "avtp/Rvf.h"
4041

4142
static void rvf_get_field_null_pdu(void **state)

0 commit comments

Comments
 (0)