X25AM Programming Manual

PTP Applications
X25AM Programming Manual527201-001
3-24
PTP Application Programming
When the WRITEREAD completes, the actual amount of data held by PTP (indicating
the size of the application buffer) is returned in the MCW of your application buffer, as
shown in Tabl e 3-10.
Your application must then post a READ using this value plus two bytes for the MCW
as the READ COUNT to retrieve the data.
PTP Application Programming
This description of the programming task is divided into three subsections.
The first subsection is organized by task to help you understand what needs to be
coded in your application.
The second subsection is organized in alphabetical order by procedure to provide
you with a more convenient method for referring to the procedures.
The third subsection contains programming examples, including two complete
sample programs for PTP mode 0. The first is written in Application Language
(TAL), and the second in standard C language.
PTP Programming Tasks
Programming your application usually involves coding some or all of the following
tasks.
Opening a subdevice file
A subdevice (SU) must be opened before any other file access can take place. When
the OPEN procedure completes, a file number is returned to the application process.
The file number identifies the subdevice file in subsequent file-system calls. The OPEN
flags are always assumed to be READ/WRITE regardless of how they are coded.
Table 3-9. Two-Step Read Parameters
Mode
READ
COUNT
WRITE
COUNT MCW
12 1 8000
22 1 8000
3 2 2 Bits <0:2> = %B100
Bits <3:15> = 2 + maximum read length
Table 3-10. Two-Step Read MCW Returned from WRITEREAD
Bit Number Meaning
<0:2> Value = %B100
<3:15> Amount of data held by PTP