550 596 02 |
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
DPI Program Channel
A Program Channel is a standard channel type according to the description in “Standardized General Purpose Channel Types” issued by the International P-NET User Organization. The function of such a channel is to provide a mechanism for downloading programs and to monitor and control the status and the memory type and location of each. A number of programs may be held and selected from a library.
A 600 series DPI has two Program Channels, channel 5 and channel 6. Channel 5 is called OpSysCh (Operating System Program Channel) and Channel 6 is called PPprogCh (Process-Pascal Program Channel).
The Operating System Program Channel provides the ability to download and run the operating system in the DPI. The operating system is split up into a boot system (named PROM) and a normal system (named FLASH). On delivery, the boot operating system will have already been downloaded to the DPI. A full (normal) operating system can be downloaded using this channel. During download of the full operating system, the boot operating system will be running. The boot operating system only provides the necessary functionality to download the normal operating system. It holds no Process-Pascal interpreter, so the DPI is unable to run a Process-Pascal program until the normal operating system is downloaded and running.
The Process-Pascal program channel provides the ability to download and run Process-Pascal programs in the DPI. The program can be downloaded to the FLASH memory. The FLASH operating system also holds a Process-Pascal program, containing the global variables needed for downloading.
If a Process-Pascal program causing a reset of the device is downloaded, it may be impossible to re-establish any contact with the device. To work around this problem, the following functionality applies: Following a MasterReset, the boot operating system is running, and the Process-Pascal is not running. After a normal reset, the device again uses the configuration selected.
Program channel structure
RegNo. 0: ProgramControlThis variable is a record having the following structure:
ProgramControl is used to set and change the state of the current program, which has been selected and invoked via the Program Channel. The selected program number is inserted and indicated as a part of ProgramControl. Commands can be sent to ProgramControl to stop, start or Reset the program.
Command is used to send a command to the Program Channel to change the state of the current program. A list of possible commands is given below. The commands and the corresponding numbers conform to the Request Instructions used by MMS.
The Program Channel automatically sets Command to 0 after writing to the variable. State is updated immediately to one of the corresponding temporary states, Starting, Stopping, Resuming or Resetting each time a command is sent to the Command variable. By the change in state, it is possible to read the variable ProgramStatus.State to check whether the Command was executed successfully or that the operation failed.
ProgramToSelect holds the library index for the program to select or the already selected program. ProgramToSelect is copied from ChConfig following a device Reset or power up. It can hold the values 1 for boot (PROM) or 2 for normal (normal).
ErrorStatus indicates each type of error in a program by means of a Boolean value. An error may be cleared in this register by writing False to the corresponding error bit. The ErrorStatus indicates run-time errors in the running operating system.
RegNo. 1: ProgramStatusThis variable is a record having the following structure:
ProgramStatus summarises the state and error condition of the selected program. The library index for the selected program is also indicated. State indicates the current state of the selected program, e.g. stopping, stopped, running, idle, non-selected etc. A state diagram and a list of possible states are given below. The states and the corresponding numbers conform to the states for Program Invocation Management used by MMS.
SelectedProgram holds the library index for the selected program. SelectedProgram is 0 if State is Non-selected.
ErrorStatus is identical to ProgramControl.ErrorStatus, but only read access is possible.
RegNo. 2: ProgramIDThis variable is a record having the following structure:
ProgramID is used to identify the selected program. The record includes a name for the program, version number, the required version number for the interpreter program and a name for the Softwarehouse that created the program. Compile time, compiler version and actual size for the program is also a part of ProgramID as well as SumCheck (two complement word addition without carry) and a code type identifier. The SumCheck value may be used for check sum calculations when the program is selected, i.e. following a SelectProgram command (38). CodeType must match CodeType found in ChType. The International P‑NET User Organization specifies the values and interpretation for CodeType. This description is available in a separate document, No. 590 003 and may be obtained on request.
RegNo. 7: MemoryInfoThis variable is a record having the following structure:
For each program segment, selected by LibraryControl.LibraryIndex, a corresponding memory information can be read. The memory information holds the actual size for the program, the max. size for the program segment and a code for the memory type in which the program is stored. Finally, MemoryInfo holds information of the available amount of RAM and FLASH memory for data.
ActualSizeincludes the size of the program code and the header with the ProgramID.
MaxSizeindicates the max size for the program segment and is the max size for a program to download within the memory area specified by MemoryType.
The International P‑NET User Organisation specifies the values and interpretation for MemoryType. This description is available in a separate document, No. 590 003 and may be obtained on request.
RAMSize indicates the amount of RAM available for the program. A Process-Pascal program needs RAM for as well global as local variables, stack and task information. If a program requiring more RAM than indicated by RAMSize is downloaded to a DPI, the program can’t run, and the state of the program will be “Unrunable”.
DataFlashSize indicates the amount of data FLASH available for the program. A Process-Pascal program needs data FLASH for global variables declared as placed in FLASH. If a program requiring more data FLASH than indicated by DataFlashSize is downloaded to a DPI, the program can’t run, and the state of the program will be “Unrunable”.
RegNo. 8: IDAndCode
This variable is used for download of programs to the Program Channel. When a program is downloaded to the Program Channel, the entire program and a header with the ProgramID and size indicator is stored in IDAndCode by means of a LongStore instruction.
The format for the data stored in the first part of IDAndCode exactly matches the format for ProgramID, and IDAndCode is interpreted as a record of the following type:
Before the program can be downloaded to the channel, the download program must ensure that: · The necessary memory is available, as well for the program itself, as for RAM and FLASH variables. · The code-type for the program code is in accordance with the code-type specified for the channel. · The interpreter program in the operating system is of the right version.
To download a program, the corresponding command must be sent to LibraryControl.Command register to initiate the sequence. The download program must wait for LibraryStatus.State = Loading before the download is executed. ActualSize for a program is given in LibraryProgramID.ActualSize after a complete download.
RegNo. 9: ChConfigThis variable is a record having the following structure:
The specification for how the selected program should operate after a Reset or power failure is held in ChConfig. This configuration includes a number specifying which program should be invoked after a Reset.
For OpSysCh, EnableBit is not used.
For PPprogCh, Enablebit[0] indicates how the selected program should operate after a power failure or device Reset. Enablebit[0] = True indicates that the selected program must perform an autostart, resulting in State = Running. This is the default behaviour. Enablebit[0] = False indicates that the selected program must not autostart, but must go to State = Idle. Enablebit[1] indicates how the selected program should operate after a device Reset caused by an error, such as Watchdog, Bus Error etc. Enablebit[1] = True indicates that the selected program must operate as selected by Enablebit[0]. Enablebit[1] = False indicates that the selected program should not autostart, although Enablebit[0] is True. This is the default behaviour.
Functions is not used.
For OpSysCh, Ref_A holds the selected program number, which should be invoked after a device Reset or power up. If Ref_A = 0, it is automatically changed to 1, selecting boot (PROM). Regardless of the value of Ref_A, the boot operating system is invoked after a master reset.
For PPprogCh, Ref_A holds the selected program number to be invoked following a device Reset or power up. If Ref_A = 0, 1 is automatically inserted, selecting PROM. Regardless of the value of Ref_A, no Process-Pascal program is invoked after a master reset. Ref_B is not used.
RegNo. 10: LibraryControlThis variable is a record having the following structure:
LibraryControl is used to set and change the state of a program in the library. The program in the library is chosen with LibraryIndex. Commands can be sent to LibraryControl to control a download sequence. Command is used to send a command to the Program Channel for changing the state of the program chosen by LibraryIndex. A list of possible commands is given below. The commands and the corresponding numbers conform to the Request Instructions for download used by (MMS).
The Program Channel automatically sets Command to 0 after writing to the variable. State is immediately updated to one of the corresponding temporary states, Complete or Incomplete each time a command is sent to the Command variable. By the change in state, it is possible to read the variable LibraryStatus.State, to check if the Command was executed successfully or the operation failed. LibraryIndex chooses one of the programs in the program library. When a program is chosen, all data concerning this program may be accessed. The data for the chosen program may be read in the variables LibraryProgramID, LibraryStatus and MemoryInfo. Upload and download of the complete program, including the program code, is performed via the IDAndCode variable. If LibraryIndex is equal to ProgramStatus.SelectedProgram, download is not possible. The value of LibraryIndex must be 1 or 2.
RegNo. 11: LibraryStatusThis variable is a record having the following structure:
LibraryStatus is used to read the current state for a program in the library. LibraryIndex indicates the chosen program in the library. MaxLibraryIndex states the max. number of programmes in the library. State indicates the current state for the program, e.g. loading, ready, nonexistent etc. A list of possible states is given below. The states and the corresponding numbers conform exactly to the states for download domain used by The Manufacturing Message Specification.
LibraryIndex is identical to LibraryControl.LibraryIndex. MaxLibraryIndex indicates the max. number of programs which can be, or are stored in the program channel. This value includes the number of programs and available program segments. The manufacturer determines how the program memory is managed when downloading and deleting programmes in the program library, and assessing what value MaxLibraryIndex is set to. The hardware in the programmable device and the Program Invocation Management defines the total number of programs to access and select. There are 2 types of memory - boot and normal, and 1 program for each memory type, giving MaxLibraryIndex = 2.
RegNo. 12: LibraryProgramIDLibraryProgramID corresponds completely with ProgramID, but is used to identify the program in the program library. A number, LibraryIndex, which is found in LibraryControl, chooses a program from the library. LibraryProgramID is a record of the same type as ProgramID.
RegNo. 13: MaintenanceThis variable is a record having the following structure:
The Maintenance variable is used for service management and maintenance purposes, and holds the last date of service and an indication of the type of service.
RegNo. 14: ChTypeThis variable is a record having the following structure:
For the Program Channel, ChType has the following values:
ChannelType = 11
Exist =
InterpreterVers indicates the version of the interpreter, and in PPprogCh, has the value 400 (version 4.00).
CodeType indicates which kind of program code can be executed in the Program Channel. For the OpSysChan, this will have the value of 6 (meaning Motorola Coldfire machine code). For the PPprogCh, this will have the value 4 (meaning Process-Pascal).
RegNo. 15: CHErrorThis variable is a record having the following structure:
ChError for Operating System Program Channel and Process-Pascal program Channel
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||