The packet filter must be initialized in order for it to operate as specified. A typical order in which the module can be initialized is shown below:
- Initialize the firmware by programming the internal memory and verify it (SPF_INSTR_W2, SPF_INSTR_W1, SPF_INSTR_W0, SPF_INSTR_CTL)
- Allocate memory for logs written by SPF and initialized the log space parameters (SPF_LOG_BEGIN, SPF_LOG_END, SPF_SW_PTR)
- Program the log map registers to associate drop codes with the log thresholds. (SPF_LOG_MAP0, SPF_LOG_MAP1)
- Program log thresholds (SPF_LOG_THRESHk, where k = 0 to 8)
- Program constant registers if required by the firmware (SPF_CONSTj, where j = 0 to 7)
- Program clock prescale counters and rate limit registers if required by the firmware (SPF_PRESCALE, SPF_RATELIMi , where i = 0 to 3)
- Program the interrupt frequency control register and interrupt mask register to setup interrupts (SPF_INTCNT, SPF_MASK_SET)
- Program the control registers to enable SPF filter and logger (SPF_CONTROL).