-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
serial: define an interface for user programs
The interface is implemented on the Zeal 8-bit computer. It mainly allows changing the mode attribute, to switch to RAW mode (no LR -> CRLF conversion)
- Loading branch information
Showing
4 changed files
with
163 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/* SPDX-FileCopyrightText: 2023 Zeal 8-bit Computer <contact@zeal8bit.com> | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
#pragma once | ||
|
||
/** | ||
* This file represents the Serial interface. | ||
* THIS INTERFACE IS SUBJECT TO CHANGE. | ||
*/ | ||
|
||
|
||
/** | ||
* IOCTL commands for the serial device. | ||
*/ | ||
typedef enum { | ||
SERIAL_CMD_GET_ATTR = 0x80, | ||
SERIAL_CMD_SET_ATTR, | ||
|
||
SERIAL_CMD_GET_BAUDRATE, | ||
SERIAL_CMD_SET_BAUDRATE, | ||
|
||
SERIAL_GET_TIMEOUT, | ||
SERIAL_SET_TIMEOUT, | ||
|
||
SERIAL_GET_BLOCKING, | ||
SERIAL_SET_BLOCKING, | ||
|
||
SERIAL_CMD_LAST | ||
} ser_cmd_t; | ||
|
||
|
||
/** | ||
* Attributes bitmap to use with SERIAL_CMD_GET_ATTR/SERIAL_CMD_SET_ATTR commands | ||
*/ | ||
#define SERIAL_ATTR_MODE_RAW (1 << 0) | ||
#define SERIAL_ATTR_RSVD1 (1 << 1) | ||
#define SERIAL_ATTR_RSVD2 (1 << 2) | ||
#define SERIAL_ATTR_RSVD3 (1 << 3) | ||
#define SERIAL_ATTR_RSVD4 (1 << 4) | ||
#define SERIAL_ATTR_RSVD5 (1 << 5) | ||
#define SERIAL_ATTR_RSVD6 (1 << 6) | ||
#define SERIAL_ATTR_RSVD7 (1 << 7) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
|
||
; SPDX-FileCopyrightText: 2023 Zeal 8-bit Computer <contact@zeal8bit.com> | ||
; | ||
; SPDX-License-Identifier: Apache-2.0 | ||
|
||
IFNDEF ZOS_SERIAL_H | ||
DEFINE ZOS_SERIAL_H | ||
|
||
; This file represents the minimal interface for a serial driver. | ||
; If any command below is not supported, the driver should return | ||
; ERR_NOT_SUPPORTED. | ||
|
||
; IOCTL commands the driver should implement | ||
DEFGROUP { | ||
; Get the serial driver attributes. | ||
; Parameter: | ||
; DE - Address to fill with the 16-bit attribute | ||
SERIAL_CMD_GET_ATTR = 0x80, ; See attribute group below | ||
|
||
; Set the serial driver attributes. | ||
; Parameter: | ||
; DE - 16-bit attributes to set (NOT AN ADDRESS/POINTER) | ||
SERIAL_CMD_SET_ATTR, | ||
|
||
|
||
SERIAL_CMD_GET_BAUDRATE, | ||
SERIAL_CMD_SET_BAUDRATE, | ||
|
||
|
||
SERIAL_GET_TIMEOUT, | ||
SERIAL_SET_TIMEOUT, | ||
|
||
|
||
SERIAL_GET_BLOCKING, | ||
SERIAL_SET_BLOCKING, | ||
|
||
; Number of commands above | ||
SERIAL_CMD_COUNT | ||
} | ||
|
||
; Serial driver attribute bitmap to use with SERIAL_CMD_GET_ATTR command | ||
DEFGROUP { | ||
SERIAL_ATTR_MODE_RAW = 1 << 0, | ||
SERIAL_ATTR_RSVD1 = 1 << 1, | ||
SERIAL_ATTR_RSVD2 = 1 << 2, | ||
SERIAL_ATTR_RSVD3 = 1 << 3, | ||
SERIAL_ATTR_RSVD4 = 1 << 4, | ||
SERIAL_ATTR_RSVD5 = 1 << 5, | ||
SERIAL_ATTR_RSVD6 = 1 << 6, | ||
SERIAL_ATTR_RSVD7 = 1 << 7 | ||
} | ||
|
||
ENDIF ; ZOS_SERIAL_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters