Documentation  |   Table of Contents   |  < Previous   |  Next >   |  Index

19    Cyclic Redundancy Check

System Management

Exploring Palm OS®

This chapter provides reference material for the CRC (Cyclic Redundancy Check) functions. It is divided into the following sections:

CRC Functions and Macros

The header file Crc.h declares the API that this chapter describes.

CRC Functions and Macros ^TOP^

Crc16CalcBigBlock Function ^TOP^

Purpose

Calculate the 16-bit CRC (Cyclic Redundancy Check) of a large data block (> 64K bytes) using the table lookup method. A CRC is one of many mathematical ways of checking data for corruption, similar to a checksum but mathematically more complex.

Declared In

Crc.h

Prototype

uint16_t Crc16CalcBigBlock (
   void *bufP,
   uint32_t count,
   uint16_t crc
)

Parameters

bufP
Pointer to the data buffer.
count
Number of bytes in the buffer.
crc
Seed CRC value.

Returns

A 16-bit CRC for the data buffer.

See Also

Crc16CalcBlock, Crc32CalcBlock

Crc16CalcBlock Function ^TOP^

Purpose

Calculate the 16-bit CRC (Cyclic Redundancy Check) of a data block using the table lookup method. A CRC is one of many mathematical ways of checking data for corruption, similar to a checksum but mathematically more complex.

Declared In

Declared In

Crc.h

Prototype

uint16_t Crc16CalcBlock (
   const void *bufP,
   uint16_t count,
   uint16_t crc
)

Parameters

bufP
Pointer to the data buffer.
count
Number of bytes in the buffer.
crc
Seed CRC value.

Returns

A 16-bit CRC for the data buffer.

Comments

The data block must be less than or equal to 64K bytes in length. For larger data blocks, use Crc16CalcBigBlock. To obtain a 32-bit CRC value, use Crc32CalcBlock.

Crc32CalcBlock Function ^TOP^

Purpose

Calculate the 32-bit CRC (Cyclic Redundancy Check) of a data block using the table lookup method. A CRC is one of many mathematical ways of checking data for corruption, similar to a checksum but mathematically more complex.

Declared In

Crc.h

Prototype

uint32_t Crc32CalcBlock (
   const void *bufP,
   uint16_t count,
   uint32_t crc
)

Parameters

bufP
Pointer to the data buffer.
count
Number of bytes in the buffer.
crc
Seed CRC value.

Returns

A 32-bit CRC for the data buffer.

Comments

The data block must be less than or equal to 64K bytes in length.

See Also

Crc16CalcBigBlock, Crc16CalcBlock