summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: ad05bd9)
raw | patch | inline | side by side (parent: ad05bd9)
author | Michal Princ (NXA17570) <michal.princ@nxp.com> | |
Wed, 17 Feb 2016 09:47:38 +0000 (10:47 +0100) | ||
committer | Wendy Liang <jliang@xilinx.com> | |
Thu, 18 Feb 2016 19:42:22 +0000 (11:42 -0800) |
- unsigned char data[1] removed from rpmsg_hdr structure
Signed-off-by: Michal Princ (NXA17570) <michal.princ@nxp.com>
Signed-off-by: Wendy Liang <jliang@xilinx.com>
Signed-off-by: Michal Princ (NXA17570) <michal.princ@nxp.com>
Signed-off-by: Wendy Liang <jliang@xilinx.com>
lib/include/openamp/rpmsg.h | patch | blob | history | |
lib/rpmsg/rpmsg.c | patch | blob | history | |
lib/rpmsg/rpmsg_core.c | patch | blob | history |
index 02fce0b8a77a6691daeff197d9fa8d497341f123..84ac7fceafc9dbe9d7dc2090fd1163b853e43442 100644 (file)
* Copyright (C) 2011 Texas Instruments, Inc.
* Copyright (C) 2011 Google, Inc.
* All rights reserved.
+ * Copyright (c) 2016 NXP, Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
#define VIRTIO_RPMSG_F_NS 0 /* RP supports name service notifications */
#define RPMSG_NAME_SIZE 32
+#define RPMSG_LOCATE_DATA(p) ((unsigned char *) p + sizeof (struct rpmsg_hdr))
+
/**
* struct rpmsg_hdr - common header for all rpmsg messages
* @src: source address
* @reserved: reserved for future use
* @len: length of payload (in bytes)
* @flags: message flags
- * @data: @len bytes of message payload data
*
* Every message sent(/received) on the rpmsg bus begins with this header.
*/
unsigned long reserved;
unsigned short len;
unsigned short flags;
- unsigned char data[0];
} OPENAMP_PACKED_END;
/**
diff --git a/lib/rpmsg/rpmsg.c b/lib/rpmsg/rpmsg.c
index 7ca5f0b0905102018f4ad41ae3a0435c3fdf514c..4fff6312439544b0bd78e11642dd6d6f3a6fbf0b 100644 (file)
--- a/lib/rpmsg/rpmsg.c
+++ b/lib/rpmsg/rpmsg.c
/*
* Copyright (c) 2014, Mentor Graphics Corporation
* All rights reserved.
+ * Copyright (c) 2016 NXP, Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
rp_hdr->len = size;
/* Copy data to rpmsg buffer. */
- env_memcpy(rp_hdr->data, data, size);
+ env_memcpy((void*)RPMSG_LOCATE_DATA(rp_hdr), data, size);
env_lock_mutex(rdev->lock);
/* Enqueue buffer on virtqueue. */
diff --git a/lib/rpmsg/rpmsg_core.c b/lib/rpmsg/rpmsg_core.c
index ccb09ca1207f444eb37c953757af0aa030deb928..baeea82aea45ef798ff7b02e4e2d3d208350159b 100644 (file)
--- a/lib/rpmsg/rpmsg_core.c
+++ b/lib/rpmsg/rpmsg_core.c
/* Fill out name service data. */
rp_hdr->dst = RPMSG_NS_EPT_ADDR;
rp_hdr->len = sizeof(struct rpmsg_ns_msg);
- ns_msg = (struct rpmsg_ns_msg *)rp_hdr->data;
+ ns_msg = (struct rpmsg_ns_msg *) RPMSG_LOCATE_DATA(rp_hdr);
env_strncpy(ns_msg->name, rp_chnl->name, sizeof(rp_chnl->name));
ns_msg->flags = flags;
ns_msg->addr = rp_chnl->src;
rdev->channel_created(rp_chnl);
}
} else {
- rp_ept->cb(rp_chnl, rp_hdr->data, rp_hdr->len,
+ rp_ept->cb(rp_chnl, (void *)RPMSG_LOCATE_DATA(rp_hdr), rp_hdr->len,
rp_ept->priv, rp_hdr->src);
}