# Resource definitions

This topic provides examples of Resource[x].Definitions strings that use the DPFs echo.ln20_apt100 (software echo), dtmf.det_all, ptf.det_2f, and voice.rec_32. These examples specify which DPFs run on a specific DSP as well as which DPFs can run simultaneously and which cannot.

Note: The resource requirements for the DPFs specified in this topic are subject to change. To verify resource usage for specific DPFs, run f41info as described in f41info - Displaying DPF file resource usage.

In the DSP resource management examples that follow, the input slots requirements are calculated differently from other resource categories in a worst-case scenario.

## Input and output slots

In the following examples, the input and output slots columns show the number of timeslots required to move data to and from a DSP. Because all of the DPFs specified for a call have been allocated on the same DSP, the resource manager allocates only one input timeslot and one output timeslot to a call.

For example, the resource manager determines if all of the resources specified in the Resource[x].Definitions string can be allocated on a single DSP. It also determines if the DPFs specified in the Resource[x].Definitions string use DPF-to-DPF communication. Because all the DPFs specified for each port are allocated on a single DSP, the DPFs can use internal timeslots to move data between the DPFs. In this case, the on-board resource manager can efficiently allocate sufficient resources by assigning only one input timeslot per port.

If the resource manager is not able to allocate all DPFs for a port on one DSP, you receive an error message stating that there are not enough resources.

## Resource definition examples

The following examples describe the resource strings used to set up DPFs to run under the following DPF conditions:

- All DPFs running exclusively

- All DPFs running simultaneously

- Some DPFs running simultaneously

### Example: All DPFs running exclusively

In the following example, all of the DPFs specified in the resource definition string run exclusively (in other words, only one DPF can run at a time). The Resource[x].Definitions keyword string is set as follows:

Resource[1].Definitions = ( dtmf.det_all | ptf.det_2f | voice.rec_32)

The resources consumed by the DPFs in this resource string are shown in the following table, which lists the resources consumed by each function:

DPF | MIPS | Input slots | Output slots | Data memory (words) | Input Pkt queue | Output Pkt queue | DSP-to-coprocessor buffer size | Comments
--- | --- | --- | --- | --- | --- | --- | --- | ---
dtmf | 2.5 | 1 | 0 | 200 | 0 | 0 | - |
ptf | 1.3 | 1 | 0 | 100 | 0 | 0 | - |
voice | 3.3 | 1 | 1 | 300 | 0 | 1 | 40 | NMS Record 32 kbit/s
Port resource consumption | 3.3 | 1 | 1 | 300 | 0 | 1 | 40 |

Since the example specifies that only one DPF function can execute at a time, the worst case MIPS requirement is 3.3 MIPS, the worst case data memory requirement is 300 words, and the worst case output slots requirement is 1 (the highest resource usage in each category).

### Example: All DPFs running simultaneously

In the following example, all of the DPFs specified in the resource definition string can run at the same time. The Resource[x].Definitions keyword string is set as follows:

Resource[1].Definitions = ( echo.ln20_apt100 & dtmf.det_all & \
ptf.det_2f & voice.rec_32 )

DPF | MIPS | Input slots | Output slots | Data memory (words) | Input Pkt queue | Output Pkt queue | DSP-to-coprocessor buffer size | Comments
--- | --- | --- | --- | --- | --- | --- | --- | ---
echo | 4.0 | 2 | 1 | 800 | 0 | 0 | - | 20 ms length, 100% adapt rate
dtmf | 2.5 | 1 | 0 | 200 | 0 | 0 | - |
ptf | 1.3 | 1 | 0 | 100 | 0 | 0 | - |
voice | 3.3 | 1 | 0 | 300 | 0 | 1 | 40 | NMS Record 32 kbit/s
Port resource consumption | 11.1 | 1 | 1 | 1400 | 0 | 1 | 40 |

Since all of the MIPS are added together, the MIPS calculation for this string is 11.1 MIPS, while the data memory requirement is 1400 words (the cumulative total of adding up the requirements for each DPF).

However, when all of the DPFs reside on the same DSP core, the slots internal to the DSP core are used for DPF to DPF communication. Since they use internal timeslots, the input slot requirements are equal to 1.

### Example: Some DPFs running simultaneously

In the following example, only the echo and voice DPFs can execute at the same time. The Resource[x].Definitions keyword string is set as follows:

Resource[1].Definitions = ( ptf.det_2f | dtmf.det_all | \
( echo.ln20_apt100 & voice.rec_32 ) )

DPF | MIPS | Input slots | Output slots | Data memory (words) | Input Pkt queue | Output Pkt queue | DSP-to-coprocessor buffer Size | Comments
--- | --- | --- | --- | --- | --- | --- | --- | ---
echo | 4.0 | 2 | 1 | 800 | 0 | 0 | - | 20 ms length, 100% adapt rate
dtmf | 2.5 | 1 | 0 | 200 | 0 | 0 | - |
ptf | 1.3 | 1 | 0 | 100 | 0 | 0 | - |
voice | 3.3 | 1 | 0 | 300 | 0 | 1 | 40 | NMS Record 32 kbit/s
Port resource consumption | 7.3 | 1 | 1 | 1100 | 0 | 1 | 40 |

Parentheses are used to indicate groupings and order of operation. In the example, software echo and voice resources are added together with the AND operator before the comparisons with the OR operator occur.

The MIPS calculation for this example adds the MIPS requirements for the software echo and voice DPFs and compares the result to dtmf and then to ptf. The largest of the three is allocated to the MIPS resource.

In this case echo + voice is 7.3 MIPS, which is greater than the MIPS requirement for the dtmf and greater than the MIPS requirement for the ptf (2.5 and 1.3 MIPS respectively). Therefore, the maximum MIPS requirement is 7.3 MIPS. The sum of voice and software echo requirements for data memory is also larger than the dtmf and ptf requirements, so the maximum data memory requirement is 1100 words.

The output slots requirement is 1 and the input slots requirement is 1 because all DPFs are executing on one DSP. The resource manager uses these calculations to determine how many ports the board supports.