diff options
author | Flavio Santes <flavio.santes@intel.com> | 2016-11-24 13:58:25 -0600 |
---|---|---|
committer | Anas Nashif <nashif@linux.intel.com> | 2016-11-25 16:50:19 +0000 |
commit | c7fe8f2193e47ef5d183ef459bda3c4f8c98c17b (patch) | |
tree | 91ee8092dce1105e15829409c1761c942fd5de30 /samples/nfc | |
parent | 516e79c8da269005d496a4c9321e6cd84957adb0 (diff) |
samples/nfc: Remove x86 asm code
This commit replaces the x86 asm line:
__asm__ __volatile__ ("bswap %0" : "=r" (x) : "0" (x));
by the sys_cpu_to_be32 macro.
By removing the x86 asm instruction, the nfc_hello sample app
can run on other platforms.
Jira: ZEP-1348
Change-Id: I440e96cd06e70a88552d179a2288c9918e6ca0b0
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
Diffstat (limited to 'samples/nfc')
-rw-r--r-- | samples/nfc/nfc_hello/src/main.c | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/samples/nfc/nfc_hello/src/main.c b/samples/nfc/nfc_hello/src/main.c index 42815e9d9..c462be1f9 100644 --- a/samples/nfc/nfc_hello/src/main.c +++ b/samples/nfc/nfc_hello/src/main.c @@ -22,6 +22,8 @@ #include <board.h> #include <uart.h> +#include <misc/byteorder.h> /* for sys_cpu_to_be32 */ + #define BUF_MAXSIZE 256 struct device *uart1_dev; @@ -35,13 +37,6 @@ do { \ static uint8_t buf[BUF_MAXSIZE]; static uint8_t nci_reset[] = { 0x20, 0x00, 0x01, 0x00 }; - -static inline const uint32_t htonl(uint32_t x) -{ - __asm__ __volatile__ ("bswap %0" : "=r" (x) : "0" (x)); - return x; -} - static void msg_dump(const char *s, uint8_t *data, unsigned len) { unsigned i; @@ -76,11 +71,13 @@ void main(void) uint8_t *pdu = buf; uint32_t *len = (void *) pdu; + printf("Sample app running on: %s\n", CONFIG_ARCH); + nano_timer_init(&t, &t_data); uart1_init(); - *len = htonl(sizeof(nci_reset)); + *len = sys_cpu_to_be32(sizeof(nci_reset)); memcpy(pdu + sizeof(*len), nci_reset, sizeof(nci_reset)); |