30 lines
		
	
	
		
			665 B
		
	
	
	
		
			C
		
	
	
	
	
	
			
		
		
	
	
			30 lines
		
	
	
		
			665 B
		
	
	
	
		
			C
		
	
	
	
	
	
/* See LICENSE of license details. */
 | 
						|
 | 
						|
#include <errno.h>
 | 
						|
#include <stdint.h>
 | 
						|
#include <sys/types.h>
 | 
						|
#include <unistd.h>
 | 
						|
 | 
						|
#include <string.h>
 | 
						|
 | 
						|
extern volatile uint32_t tohost;
 | 
						|
 | 
						|
__attribute__((optimize("O0"))) ssize_t _bsp_write(int fd, const void *ptr,
 | 
						|
                                                   size_t len) {
 | 
						|
 | 
						|
  if (isatty(fd)) {
 | 
						|
    uint64_t payload[4] = {64, 0, (uintptr_t)((uint32_t *)ptr), len};
 | 
						|
    tohost = (uint32_t)payload;
 | 
						|
    /*
 | 
						|
    // accoring to my understading this part is used fot uart wrrite for later
 | 
						|
        for (size_t jj = 0; jj < len; jj++) {
 | 
						|
    *((uint32_t *)0xFFFF0000) = current[jj];
 | 
						|
  }
 | 
						|
    */
 | 
						|
 | 
						|
    return len;
 | 
						|
  }
 | 
						|
 | 
						|
  return 1;
 | 
						|
}
 |