Example #1
0
static ErlDrvSSizeT uart_drv_ctl(ErlDrvData d, 
				 unsigned int cmd, char* buf, ErlDrvSizeT len,
				 char** rbuf, ErlDrvSizeT rsize)
{
    drv_ctx_t* ctx = (drv_ctx_t*) d;
    char ref_buf[sizeof(uint32_t)];

    DEBUGF("uart_drv: ctl: cmd=%u(%s), len=%d", cmd, format_command(cmd), len);

    ctx->self.caller = driver_caller(ctx->self.port);
    dthread_control(ctx->other, &ctx->self, cmd, buf, len);
    
    put_uint32((unsigned char*)ref_buf, (uint32_t) ctx->self.ref);
    return ctl_reply(UART_OK, ref_buf, sizeof(ref_buf), rbuf, rsize);
}
Example #2
0
int dthread_output(dthread_t* thr, dthread_t* source,
		   char* buf, int len)
{
    return dthread_control(thr, source, DTHREAD_OUTPUT, buf, len);
}