TMCreateProgramJob Overview Group

The TMCreateProgramJob API call starts a program job with the current EPROM device. This function must be called immediately before any TMEX function that writes to an EPROM device. The writes in the TMEX function are not actually done, they are just logged in the program job data space. After the TMEX function has been completed successfully, then another specialty function TMDoProgramJob must be called to carry out the EPROM programming. EPROMs are treated differently by TMEX because any write to an EPROM is destructive, meaning it uses up device memory. In NV-RAM devices, if an operation is unsuccessful then the function could then be just called again with no ill effects. If EPROMs were regarded in this way then some or all of the memory space could be lost. The second specialty API call ,TMDoProgramJob, is called again and again by the application program until all of the jobs are completed. This puts the onus on the application programmer to make sure that the EPROM device does not go away in mid write and waste memory space. For instance if after doing a TMCreateProgramJob and TMWriteFile successfully, the TMDoProgramJob comes back saying that the device has left the 1-Wire network then the application should put up some message saying that the device needs to come back and call TMDoProgramJob again. The data space needed to write EPROMs is located at the end of the status buffer provided in the functions. There can be only one program job at a time. If after TMCreateProgramJob is called, the internal ROM buffer is changed then the program job is invalidated. See the TMEX APPLICATION DESIGN GUIDE for more discussion of TMCreateProgramJob.


short far pascal TMCreateProgramJob(

long session_handle,        // session handle for the desired 1-Wire network
void far *state_buffer,     // state buffer provided for the 1-Wire network session
);

For a description of the above types, see the TMEX Type Descriptions.

Parameters

session_handle

Specifies the session handle returned from the API function TMExtendedStartSession that specifies the desired 1-Wire network port. This parameter is required by most TMEX API functions.

state_buffer

Specifies a pointer to a memory location that TMEX keeps all of the state information for the 1-Wire networks. This parameter is required by most TMEX API functions.

Return Value

1 => Program Job is ready

<0 => TMEX File Operations Error Return Code

Code Example

See Also

TMDoProgramJob