You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
48 lines
1.6 KiB
C
48 lines
1.6 KiB
C
3 years ago
|
/* See the end of this file for copyright, license, and warranty information. */
|
||
4 years ago
|
|
||
|
#pragma once
|
||
|
|
||
3 years ago
|
#include <ardix/dma.h>
|
||
4 years ago
|
#include <ardix/serial.h>
|
||
|
|
||
3 years ago
|
int arch_serial_init(struct serial_device *dev);
|
||
|
void arch_serial_exit(struct serial_device *dev);
|
||
4 years ago
|
|
||
3 years ago
|
/**
|
||
|
* Copy `buf` to a hardware buffer in the TX queue.
|
||
|
* The transmission is performed asynchronously.
|
||
|
*
|
||
3 years ago
|
* @param dev: serial device to enqueue the buffer for
|
||
3 years ago
|
* @param buf: raw buffer data
|
||
|
* @param len: length of `buf`
|
||
|
* @returns actual amount of bytes enqueued, or a negative error code on failure
|
||
|
*/
|
||
3 years ago
|
ssize_t arch_serial_write(struct serial_device *dev, const void *buf, size_t len);
|
||
3 years ago
|
|
||
3 years ago
|
/**
|
||
|
* Directly enqueue a DMA buffer to a serial device, resulting in a zero-copy
|
||
|
* write. This will increment the buffer's refcount and decrement it again when
|
||
|
* it has been written out completely, so the caller is responsible for calling
|
||
|
* `dmabuf_put` as well in order to prevent a memory leak.
|
||
|
*
|
||
|
* @param dev: serial device to write to
|
||
|
* @param buf: raw DMA buffer to append
|
||
|
* @returns actual bytes that will be written, or a negative error code
|
||
|
*/
|
||
|
ssize_t serial_write_dma(struct serial_device *dev, struct dmabuf *buf);
|
||
|
|
||
3 years ago
|
#include <arch/serial.h>
|
||
4 years ago
|
|
||
|
/*
|
||
3 years ago
|
* This file is part of Ardix.
|
||
|
* Copyright (c) 2020, 2021 Felix Kopp <owo@fef.moe>.
|
||
4 years ago
|
*
|
||
3 years ago
|
* Ardix is non-violent software: you may only use, redistribute,
|
||
|
* and/or modify it under the terms of the CNPLv6+ as found in
|
||
|
* the LICENSE file in the source code root directory or at
|
||
|
* <https://git.pixie.town/thufie/CNPL>.
|
||
4 years ago
|
*
|
||
3 years ago
|
* Ardix comes with ABSOLUTELY NO WARRANTY, to the extent
|
||
|
* permitted by applicable law. See the CNPLv6+ for details.
|
||
4 years ago
|
*/
|