main() { handle sbcr_hdl, pbddr_hdl, pbdr_hdl; pbddr_hdl = _sys_open(_SYS_OPEN_INTERFACE, PBDDR); _sys_write(pbddr_hdl, 0x8); _sys_close(pbddr_hdl); pbdr_hdl = _sys_open(_SYS_OPEN_INTERFACE, PBDR); while(1) { _sys_write(pbdr_hdl, 0x0); _sys_write(pbdr_hdl, 0x8); } }
extern "C" int _write(int file, char *ptr, int len) { int BytesNotWritten; /* Open stdin/stdout/stderr if needed */ if (MRI_SEMIHOST_STDIO && file < 3) { return __mriNewlib_SemihostWrite(file, ptr, len); } else if (!g_StandardHandlesOpened && file < 3) { __GCC4MBEDOpenStandardHandles(); } /* Call the function in mbed.ar and let it handle the writes */ BytesNotWritten = _sys_write(file, (const unsigned char*)ptr, len, 0); /* The mbed version of the function returns bytes not written and newlib wants byte written count */ if (BytesNotWritten >= 0) { return len - BytesNotWritten; } else { /* In this case it did return an error */ return BytesNotWritten; } }
void console_outbyte_polled( int port, char ch ) { _sys_write( 1, &ch, 1 ); }
int write (int fd, const char *buf, int sz) { int nwritten; int r = _sys_write (fd, buf, sz, &nwritten); if (r != 0) { errno = r; return -1; } return nwritten; }
ssize_t write(int d, const void *buf, size_t nbytes) { ssize_t retval; pthread_t self; self = pthread__self(); TESTCANCEL(self); retval = _sys_write(d, buf, nbytes); TESTCANCEL(self); return retval; }