For each valid CBUF write access, the write address is compared to the last read address for an overflow condition. If an overflow is detected, the corresponding CBUF overflow status bit in the STATUS_CBUF_OVERFLOW_MID or STATUS_CBUF_OVERFLOW_WRAP registers is set to 0x1 and an interrupt is generated. This interrupt condition exists until the corresponding overflow status bit is cleared.
There are two types of overflow conditions referred to as Cbuf_overflow_wrap and Cbuf_overflow_mid.
Cbuf_overflow_wrap occurs in case at least one of the following two:
- VBUF write address – VBUF frame start address < CBUF size
- VBUF write address – VBUF frame start address > VBUF last read address – Current VBUF start address
Cbuf_overflow_mid occurs in case at least one of the following two:
- VBUF write address – VBUF frame start address > CBUF size
- VBUF write address – VBUF last read address > CBUF size
If an overflow condition is detected on a CBUF write access, the OCM controller generates a CBUF overflow (Cbuf_overflow_wrap or Cbuf_overflow_mid) interrupt and enter an overflow error handling state. In this state, the OCM controller do the following in the default error handling configuration:
- When a Cbuf_Overflow_Wrap condition occurs (write buffer wraparound with read from previous frame still remaining), writes are disabled but reads are serviced normally. This mechanism preserves the back end of the previous frame and discards the new frame which is already showing signs of overflowing. Writes will be re-enabled automatically on write to the virtual frame start address which indicates the next frame after the overflowed frame has begun. The overflow (and underflow) check for this CBUF will be disabled until detection of write to/read from the virtual frame start address. The module which reads should not start reading the next frame (which is being discarded) or stop reading the frame if the read of this new frame has already started. This mechanism allows both write and read sides to re-synchronize on the next frame after one-frame drop.
- When a Cbuf_Overflow_Mid condition occurs, writes and reads are serviced normally allowing the read side to catch up to the write side. The overflow (and underflow) check will be disabled until first a write to the virtual frame start address and then a read from the virtual frame start address is detected. This mechanism allows the frame with a “momentary” overflow condition to be saved. The reader side has an option to stop reading and discarding the data by just resetting its CBUF read pointer at the next frame start, if the read side is too far back.
These steps are taken to minimize the frame loss due to an overflow condition. To support the previously described behavior but to allow software to override the default error handling behavior the following controls are available:
In addition, the overflow check can be enabled or disabled through the CFG_OCMC_CBUF_ERR_HANDLER[2] OVERFLOW_ERR_CHECK_EN bit.