sys_chan_open & sys_chan_close

Added sys_chan_open and sys_chan_close system calls. More documentation.
This commit is contained in:
Peter Weingartner 2021-11-09 20:53:05 -05:00
parent 84caea4740
commit 98ba08dfe2
10 changed files with 8396 additions and 8321 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

File diff suppressed because it is too large Load diff

View file

@ -44,7 +44,10 @@
#define KFN_CHAN_STATUS 0x17 /* Get the status of a channel */
#define KFN_CHAN_IOCTRL 0x18 /* Send a command to a channel (channel dependent functionality) */
#define KFN_CHAN_REGISTER 0x19 /* Register a channel device driver */
#define KFN_TEXT_SETSIZES 0x1A /* Adjusts the screen size based on the current graphics mode */
#define KFN_CHAN_OPEN 0x1A /* Open a channel device */
#define KFN_CHAN_CLOSE 0x1B /* Close an open channel (not for files) */
#define KFN_TEXT_SETSIZES 0x1C /* Adjusts the screen size based on the current graphics mode */
/* Block device system calls */
@ -283,6 +286,30 @@ extern short sys_chan_seek(short channel, long position, short base);
*/
extern short sys_chan_ioctrl(short channel, short command, uint8_t * buffer, short size);
/*
* Open a channel
*
* Inputs:
* dev = the device number to have a channel opened
* path = a "path" describing how the device is to be open
* mode = is the device to be read, written, both? (0x01 = READ flag, 0x02 = WRITE flag, 0x03 = READ and WRITE)
*
* Returns:
* the number of the channel opened, negative number on error
*/
extern short sys_chan_open(short dev, uint8_t * path, short mode);
/*
* Close a channel
*
* Inputs:
* chan = the number of the channel to close
*
* Returns:
* nothing useful
*/
extern short sys_chan_close(short chan);
/***
*** Block device system calls
***/

View file

@ -95,6 +95,12 @@ unsigned long syscall_dispatch(int32_t function, int32_t param0, int32_t param1,
case KFN_CHAN_IOCTRL:
return chan_ioctrl((short)param0, (short)param1, (unsigned char *)param2, (short)param3);
case KFN_CHAN_OPEN:
return chan_open((short)param0, (const char *)param1, (short)param2);
case KFN_CHAN_CLOSE:
return chan_close((short)param0);
case KFN_CHAN_REGISTER:
return cdev_register((p_dev_chan)param0);

10972
src/mapfile

File diff suppressed because it is too large Load diff

View file

@ -226,6 +226,34 @@ short sys_chan_ioctrl(short channel, short command, uint8_t * buffer, short size
return syscall(KFN_CHAN_IOCTRL, channel, command, buffer, size);
}
/*
* Open a channel
*
* Inputs:
* dev = the device number to have a channel opened
* path = a "path" describing how the device is to be open
* mode = is the device to be read, written, both? (0x01 = READ flag, 0x02 = WRITE flag, 0x03 = READ and WRITE)
*
* Returns:
* the number of the channel opened, negative number on error
*/
short sys_chan_open(short dev, uint8_t * path, short mode) {
return syscall(KFN_CHAN_OPEN, path, mode);
}
/*
* Close a channel
*
* Inputs:
* chan = the number of the channel to close
*
* Returns:
* nothing useful
*/
short sys_chan_close(short chan) {
return syscall(KFN_CHAN_CLOSE, chan);
}
/***
*** Block device system calls
***/