- C51 Processor Access
Accessing a C51 Processor unit for control and data transfer operations
requires accessing the Unix device and initializing a PCI_MOD structure.
This is handled by the dm4c51_open function.
PCI_MOD *
dm4c51_open(devname)
char *devname - name of PCI device and C51 DSP
The devname argument specifies the name of the V6M6 board,
the module location and the C51 DSP on the module.
The format of the name is pciNMD.
N specifies the V6M6 board number.
M specifies the module location (a letter from 'a' to 'f')
D specifies the DSP on the module (number from 0 to 3).
The PCI_MOD pointer returned by dm4c51_open is used to pass
information about the module and DSP to other library functions.
The dm4c51_init function is used to initialize the C51 DSP
referenced by the pci pointer.
Note that because a given DM4C51 module is accessed through a single Unix
device, the four C51 DSP cannot be accessed by different host programs.
int
dm4c51_init(pci)
PCI_MOD *pci - pointer to an open DM4C51
- Host Data Transfers:
Most data transfers are handled using the general purpose V6M6 data
transfer functions:
pci_dl_i8b pci_up_i8b pci_dl_a8b pci_up_a8b
pci_dl_i16b pci_up_i16b pci_dl_a16b pci_up_a16b
Due to the way the compiler for the C51 arranges long integers in memory,
the standard transfer functions for 32-bit values and arrays will not work.
The library includes the following functions for 32-bit data transfers:
dm4c51_dl_i32b downloads a 32-bit value to memory of the C51
referenced by pci.
int
dm4c51_dl_i32b(pci, pciadr, value)
PCI_MOD *pci - pointer to an open DM4C51
u_long pciadr - PCI memory address on the DM4C51,
must be modulo-2 aligned
u_long value - Data value to be downloaded
dm4c51_up_i32b uploads a 32-bit value from memory of the C51
referenced by pci.
The value returned is the data read from the C51's memory.
long
dm4c51_up_i32b(pci, pciadr)
PCI_MOD *pci - pointer to an open DM4C51
u_long pciadr - PCI memory address on the DM4C51,
must be modulo-2 aligned
dm4c51_dl_a32b and dm4c51_up_a32b
download and upload arrays of 32-bit values between the
host and the C51 DSP referenced by pci.
int
dm4c51_dl_a32b (pci, pciadr, nlwords, buf)
int
dm4c51_up_a32b (pci, pciadr, nlwords, buf)
PCI_MOD *pci - pointer to an open DM4C51
u_long pciadr - DM4C51 PCI memory address,
must be modulo-2 aligned
u_long nlwords - number of 32-bit words to transfer
u_long *buf - pointer to source data
- Loading and executing C51 Programs:
C51 executable code is loaded in C51 memory on a DM4C51 using the
pci_load_code function.
When pci_load_code returns a 0 value, it indicates an error
reading the file or downloading the program data.
For example:
char *prog_name = "c51program";
if (!pci_load_code(pci, prog_name, MM_COFF))
{
perror(prog_name);
exit(1);
}
The dm4c51_run and dm4c51_halt functions are used to control
execution of programs in a C51 DSP.
int
dm4c51_run(pci)
int
dm4c51_halt(pci)
PCI_MOD *pci - pointer to an open DM4C51
- DM4C51 TDM Interface:
The C51 DSPs communicate with the V6M6 TDM subsystem through
an SC4000 SCSA interface.
Each C51 DSP is allocated 32 time slots on the DM4C51 side of the SC4000.
The 32 time slots may be mapped to any TDM time slot and TDM bus on
the TDM subsystem side of the SC4000.
The C51 DSPs read and write TDM data in their local memory using
double buffers.
Data is transferred between the TDM data memory and the SC4000 by a
common DMA controller on the DM4C51 module.
The TDM data buffers are fixed at 32 bytes in size and are
at fixed locations in the DSP's memory:
DSP mem addr Buffer Use
------------ ----------
0x1ff80 TDM Out Buffer 1 (to TDM)
0x1ffa0 TDM Out Buffer 2 (to TDM)
0x1ffc0 TDM In Buffer 1 (from TDM)
0x1ffe0 TDM In Buffer 2 (from TDM)
A register bit for each C51 DSP
indicating which incoming TDM buffer has data available.
The same flag indicates which outgoing TDM buffer may be written to
by the C51 DSP.
The standard TDM mapping functions,
pci_tdm_src_add, pci_tdm_dst_add, etc.
are not used for the DM4C51.
Instead, use the functions described below
to establish TDM connectivity for the DM4C51.
Note that these functions assume the TDM subsystem is configured
to use 8-bit TDM slots.
The dm4c51_sc4000_init function resets and initializes the SC4000
and disables its DMA controller.
The tdmframe argument specifies the number of 8-bit TDM time slots
per TDM frame.
In cases where the TDM time slots are larger than 8 bits, this value
should specify the equivalent number of 8-bit slots.
int
dm4c51_sc4000_init(pci, tdmframe)
PCI_MOD *pci - pointer to an open DM4C51
int tdmframe - slots per TDM frame:
32, 64 or 128
For adding TDM source and destination connections use the
dm4c51_tdm_src_add and dm4c51_tdm_dst_add functions.
These functions configure the next available SC4000 slot of the
SC4000 to source the TDM bus or receive from the TDM bus
during the specified TDM time slot.
They also enable the TDM data DMA controller and configure the DMA data count.
int
dm4c51_tdm_src_add(pci, TDMslot, TDMbus)
int
dm4c51_tdm_dst_add(pci, TDMslot, TDMbus)
PCI_MOD *pci - pointer to an open DM4C51
u_int TDMbus - TDM bus: TDM_BUSA, TDM_BUSB,
TDM_BUSC or TDM_BUSD
u_int TDMslot - time slot number (1 - 128).
TDM connections are deleted using the
dm4c51_tdm_src_del and dm4c51_tdm_dst_del functions.
These functions modify the SC4000 configuration to stop driving the TDM bus
or stop receiving from the TDM bus during the specified TDM time slot.
int
dm4c51_tdm_src_del(pci, TDMslot, TDMbus)
int
dm4c51_tdm_dst_del(pci, TDMslot, TDMbus)
PCI_MOD *pci - pointer to an open DM4C51
u_int TDMbus - TDM bus: TDM_BUSA, TDM_BUSB,
TDM_BUSC or TDM_BUSD
u_int TDMslot - time slot number (1 - 128).