1 extern buffers, 2 relative buffers, Extern buffers – Avago Technologies LSI53C1010 User Manual

Page 174: Relative buffers

Advertising
background image

7-8

Integrating SCRIPTS Programs into “C” Language Drivers

The

patch_value

is usually either a buffer physical address or a byte

count, but could be anything that modifies the part of the SCRIPTS
program.

The remainder of this section contains patching techniques for various
instructions and buffer types that require modification at run time. Please
note that this chapter only describes the most common types of patches.
Other types of patching can generally be used to modify any part of a
SCRIPTS instruction by using the ENTRY point patching method
described in this section.

7.2.1 EXTERN Buffers

This section of the chapter describes the procedure for setting up
EXTERN buffers.

1.

Create a buffer in ‘C’ statically or dynamically if necessary as shown
in the example below.

UCHAR msgin_buf[4];

2.

Patch the SCRIPT wherever this buffer is used, with the patch array
generated by NASM shown in the example below.

SCRIPT[E_ex_buf1_Used[1]] = VirttoPhys(msgin_buf);

See

Chapter 5, “The NASM Output File,”

for more information on the

_Used

patch array.

7.2.2 RELATIVE Buffers

RELATIVE buffers are essentially the same as External buffers. The
SCRIPTS output file contains some additional information to aid in
patching the SCRIPTS instructions. The individual relative buffer offset is
encoded into the SCRIPTS instruction. There are two methods for
establishing RELATIVE buffers.

7.2.2.1 Procedure 1

1.

Create a buffer to hold all the individual relative buffers.

UCHAR rel_buffer[8]

2.

Patch the SCRIPTS array using the Patch array generated by NASM.

SCRIPT[R_rel_buf2_Used[0]] += VirttoPhys(rel_buffer)

Advertising
This manual is related to the following products: