Changeset ae8d7b0 in mainline for boot/arch/riscv64/src/ucb.c
- Timestamp:
- 2017-08-21T18:23:39Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- c58441d
- Parents:
- fdc29300
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
boot/arch/riscv64/src/ucb.c
rfdc29300 rae8d7b0 31 31 #include <macros.h> 32 32 33 volatile uint64_t tohost __attribute__((section(".htif"))); 34 volatile uint64_t fromhost __attribute__((section(".htif"))); 35 36 static void poll_fromhost() 37 { 38 uint64_t val = fromhost; 39 if (!val) 40 return; 41 42 fromhost = 0; 43 } 44 33 45 void htif_cmd(uint8_t device, uint8_t cmd, uint64_t payload) 34 46 { … … 36 48 (((uint64_t) cmd) << 48) | 37 49 (payload & UINT64_C(0xffffffffffff)); 38 uint64_t retval;39 50 40 do { 41 asm volatile ( 42 "csrrw %[retval], " STRING(CSR_MTOHOST) ", %[val]\n" 43 : [retval] "=r" (retval) 44 : [val] "r" (val) 45 ); 46 } while (retval != 0); 51 while (tohost) 52 poll_fromhost(); 53 54 tohost = val; 47 55 }
Note:
See TracChangeset
for help on using the changeset viewer.