make code style consistent with the rest of the lib.

git-svn-id: http://svn.openzap.org/svn/openzap/trunk@201 a93c3328-9c30-0410-af19-c9cd2b2d52af
This commit is contained in:
Michael Jerris 2007-06-03 03:07:08 +00:00
parent 34d002aaa4
commit 2a79a09b8f
2 changed files with 36 additions and 49 deletions

View File

@ -63,7 +63,7 @@ void dsp_uart_attr_init (dsp_uart_attr_t *attr)
bytehandler_func_t dsp_uart_attr_get_bytehandler(dsp_uart_attr_t *attr, void **bytehandler_arg) bytehandler_func_t dsp_uart_attr_get_bytehandler(dsp_uart_attr_t *attr, void **bytehandler_arg)
{ {
*bytehandler_arg = attr->bytehandler_arg; *bytehandler_arg = attr->bytehandler_arg;
return (attr -> bytehandler); return attr->bytehandler;
} }
void dsp_uart_attr_set_bytehandler(dsp_uart_attr_t *attr, bytehandler_func_t bytehandler, void *bytehandler_arg) void dsp_uart_attr_set_bytehandler(dsp_uart_attr_t *attr, bytehandler_func_t bytehandler, void *bytehandler_arg)
@ -77,15 +77,13 @@ dsp_uart_handle_t *dsp_uart_create (dsp_uart_attr_t *attr)
dsp_uart_handle_t *handle; dsp_uart_handle_t *handle;
handle = malloc(sizeof (*handle)); handle = malloc(sizeof (*handle));
if (handle == NULL) { if (handle) {
return (handle);
}
memset(handle, 0, sizeof (handle)); memset(handle, 0, sizeof (handle));
/* fill the attributes member */ /* fill the attributes member */
memcpy(&handle->attr, attr, sizeof (*attr)); memcpy(&handle->attr, attr, sizeof (*attr));
}
return (handle); return handle;
} }
void dsp_uart_destroy(dsp_uart_handle_t **handle) void dsp_uart_destroy(dsp_uart_handle_t **handle)
@ -116,22 +114,11 @@ void dsp_uart_bit_handler (void *x, int bit)
handle->nbits++; handle->nbits++;
if (handle->nbits == 8) { if (handle->nbits == 8) {
(*handle -> attr.bytehandler) (handle -> attr.bytehandler_arg, handle -> data); handle->attr.bytehandler(handle->attr.bytehandler_arg, handle->data);
handle->nbits = 0; handle->nbits = 0;
handle->data = 0; handle->data = 0;
handle->have_start = 0; handle->have_start = 0;
}
/* might consider handling errors in the future... */ /* might consider handling errors in the future... */
#if 0
} else if (handle -> nbits > 8) {
if (!bit) {
/* framing error; expected stop bit (mark, 1) */
printf ("FRAME"); fflush (stdout);
} else {
handle -> have_start = 0;
handle -> nbits = 0;
}
#endif
}
} }