In this article, we’ll discuss New-string-port, GetSourcePort(), and the Read-all-data return port. Whether or not you need this type of port is up to you. The following sections detail the differences between the three types. You’ll learn how to use them and why they’re useful in programming. The first three examples will demonstrate how to read and write data to the return port. After reading the following code samples, you should be able to create a custom return port for your needs.
New-string-port
This function returns the current input or output port. The returned line represents the contiguous bytes in the port’s stream. The return value is the string-input-port or string-output-port, depending on the argument. The corresponding thunk will return either #t or #f. This method is useful for reading a large text file. The name of the resulting port is optional.
New-memory-port
The return port is the address of the memory on a device. It should be non-NULL, as it is the name of the device. The return port is non-NULL if the allocation is successful. If the allocation is unsuccessful, it is NULL. Ports allocated with request_region will show up in /proc/ioports. Once allocated, they can’t be unallocated.
GetSourcePort()
The getSourcePort() method determines the port on the same node as the return port. This method does not naturally recurse through the node graph. If the output port and the input port are on separate nodes, an in-between connection is created. It also returns the port index within the node. Depending on the port name, it may return the label for the port or the name of the pages defined in the metadata.
Read-all-data return port
This command returns the SNP data from a specified measurement. If the parameter is a standard S-parameter, the data is valid only for that measurement. The read-all-data return port must cover all the ports in the SNP port list. The data must match the format of the return port. This command is useful for multiple-port test sets. This command is also useful for active measurements. You can format the data using several options.
End-of-file return port
The read-charset routine reads a character from a port and updates it to the terminating character or the end of the file. If the port is in blocking mode, read-charset returns a value smaller than the input port size, and the next() function returns the next character from the port. If read-charset encounters the end-of-file before reading the characters, the method returns the End-of-file object.
Synchronization results of a port
The synchronization results of a port are displayed in the Ports view on the Access Device list page. In addition, you can see whether the synchronization succeeded or failed by clicking the Details icon. A port with failed synchronization can be disabled. When using UAM, the port synchronization results must be in sync in order for it to be reflected in the port list. If it is not, you must manually adjust the timeout value.
Functions that manipulate a port
Programming a sensor or register requires the use of logical operations. Fortunately, this doesn’t have to be hard. Just grab a hold of a port’s name, press Ctrl, and drag the block into the list. It can then be renamed or removed. Port manipulation can also be done with multiple function elements using the same port. If a function element is not required, it can be left unused.