diff options
author | Johan Hedberg <johan.hedberg@intel.com> | 2016-07-15 14:56:36 +0300 |
---|---|---|
committer | Johan Hedberg <johan.hedberg@intel.com> | 2016-07-19 11:13:08 +0300 |
commit | 1de77488ae543b119524cbc14344020c9f2eb43f (patch) | |
tree | 7244b1b5f7c284a33ec00052f93f7f28dde6e147 /net | |
parent | 10411ed2f950f18f53b827ca3e176d41368c3dd6 (diff) |
net: buf: Add net_buf_add_be32 helper
Add helper to add 32-bit big endian data to net_buf and
net_buf_simple.
Change-Id: Ib6359558abcbed824365928327277ad69aa51e99
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Diffstat (limited to 'net')
-rw-r--r-- | net/buf.c | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -241,6 +241,14 @@ void net_buf_simple_add_le32(struct net_buf_simple *buf, uint32_t val) memcpy(net_buf_simple_add(buf, sizeof(val)), &val, sizeof(val)); } +void net_buf_simple_add_be32(struct net_buf_simple *buf, uint32_t val) +{ + NET_BUF_DBG("buf %p val %u\n", buf, val); + + val = sys_cpu_to_be32(val); + memcpy(net_buf_simple_add(buf, sizeof(val)), &val, sizeof(val)); +} + void *net_buf_simple_push(struct net_buf_simple *buf, size_t len) { NET_BUF_DBG("buf %p len %u\n", buf, len); |