A N 3 7 0
50
Rev. 1.0
7.4.4. Custom Encoding
The users can provide their own byte encoding. The user will write a custom encoding function and pass a pointer
to that function when calling the vStl_EncodeSetup() function. The customer encoding function can encode an
input byte to up to 8 bytes of data to be transmitted to the channel if the user is using vStl_SingleTxLoop().
After the custom encoding function is incorporated into the system then the vStl_SingleTxLoop () function will call
the custom encoding function with proper pointer to the reserved 8 byte array.
The custom conversion function must have the following prototype:
BYTE
bEnc_CustomEncode
(
BYTE xdata *pboEncodedBytes, .. ptr to a result byte array
BYTE biByteToEncode .. byte to be encoded
);
Description of the custom encoding function functionality:
bEnc_CustomEncode
Description
: The function takes the input byte biByteToEncode and coverts it to an 8 byte
array of data (not all 8 output bytes need to be used) to be directly transmitted to the chan-
nel by passing the converted bytes directly to the ODS within the vStl_SingleTxLoop().
Not all bits in each byte in the converted array pointed at by pboEncodedBytes pointer
need to be used. The ODS serializer takes the encoded byte and starts transmitting pboEn-
codedBytes[0] byte, the bit 0 first, followed by bit 1, etc. The bits are therefore transmitted
in a little endian fashion.
When using custom encoding the user is responsible for calling the vOds_Setup() function
with the input structure tOds_Setup.bGroupWidth value corresponding to the number of
LSb bits to be transmitted from each converted output byte minus one. Value 0 corre-
sponds with transmitting 1 bit, value 7 corresponds with transmitting all 8 bits.
When calling the vOds_Setup the value of the group width must match the number of
valid LSb bits the custom encoding function is actually generating. Making connection in
between the encoding function and the encoded group width for the ODS is up to the user
in the main application by the vOds_Setup() call.
The custom encoding function is called by the vStl_EncodeByte() which is called from
vStl_SingleTxLoop() function.
pboEncodedBytes
: (pointer to BYTE in XDATA) Pointer to the head of the 8 byte
array which will contain the resulting encoded bytes. The value of the pointer will
be provided at runtime by the vStl_EncodeByte() function and the array is reserved
in the API reserved XDATA area.
biByteToEncode
: (BYTE) Input byte to be encoded