1993-2011 General Motors Company, GM Customer Care & Aftersales. All Rights Reserved.
Page
37
C1 Op-Code: Download Routine to RAM and Execute using Mode 16
Supported By:
UART Interpreter 0
Description:
This Op-Code is an ALDL mode 16 with three byte addressing. It is used to send
routines with a prolog to
RAM of the device being reprogrammed.
Note
: AC1 Op-Code should always follow a Mode 5 (Op-Code 05) message.
Action Fields:
AC0:
Section Number of Routine
AC1:
Use value as high byte of prolog
AC2:
Use value as low byte of prolog
AC3:
Device ID
Pseudo Code:
XX C1 AC0 AC1 AC2 AC3 G0-G1 G2-G3 G4-G5 G6-G7 G8-G9
Use UART Return Type Processing of Two.
Build Mode 16 Download Request as indicated in the table below. Contents of the XX locations is detailed in
pseudo code following the table
Request
Byte
Value
Byte Description
1
AC3
Device ID
2
4 + N
Message length
3
10
Message mode
4
XX
High byte of load
address
5
XX
Middle byte of load address
6
XX
Low byte of load address
7
XX
Data byte 1
The pseudo code below explains how the data portion of this
request is filled
7 + N
XX
Data byte N (N <= maximum as defined in pseudo code)
8 + N
CS
1 byte request checksum
For failures or last packets expect a 15 in response byte 4 and a return code in response byte 5
and Expect a
06 return code for success (set return type processing to 2)
Check response byte 3 for message mode (set return code position to 2)
Retrieve section AC0 and assign to routine
Set maximum packet to 60
If
Routine Length is Greater than Maximum Packet
# Of packets = routine length / (maximum packet - prolog length)
Last message length = remainder of routine length / (maximum packet - prolog length)
If
remainder of the routine length is 0
Reduce the number of messages sent with a prolog by one
Endif
remainder of the routine length is 0
Addresses are calculated from high to low memory so last packet can be executed
once downloaded
Copy AC1 into next data byte of data area, this is high byte of prolog
Copy AC2 into next data byte of data area,
this is low byte of prolog
Do while
More Packets
If
This is the Last Packet
Change message length to last message length+4
CameraLoops.com
1993-2011 General Motors Company, GM Customer Care & Aftersales. All Rights Reserved.
Page
38
(continued)
Set three byte message address to the low three bytes of the four byte address in the routine
Copy the last message from the routine overlaying the prolog (no prolog in last packet)
Else
Calculate appropriate two byte packet address for next
data packet
Copy calculated packet address into message buffer
Copy a piece of the routine into message buffer
Endif
this is the last packet
Send the message
and expect a response
Goto UART Return Type Processing
If
Message Response was SUCCESS (10 in position 3)
Loop and continue sending packets
Else
Indicate FAIL
Endif
message response was SUCCESS
End do while
more packets
Else
Routine Length is Not Greater than Maximum Packet
Copy routine into message buffer, no prolog in message
Send the message and expect a response
Goto UART Return Type Processing
Endif
routine length is greater than maximum packet
Look for response byte 3
in Goto fields
If
Response byte 3 is Found
Goto appropriate step
Else
Goto step indicated by FF goto field
Endif
response byte 3 is found
Do'stlaringiz bilan baham: