mdriver_entry

Updated: April 19, 2023

Minidriver system page entry

Synopsis:

struct mdriver_entry
{
   uint32_t    intr;
   int         (*handler)(int state, void *data);
   void        *data;
   paddr32_t   data_paddr;
   uint32_t    data_size;
   uint32_t    name;
   uint32_t    internal;
   uint32_t    spare[1];
};

Description:

When you call mdriver_add(), it adds an entry for your minidriver to the system page. The members of the mdriver_entry structure include:

intr
The interrupt that the minidriver is attached to.
handler
A pointer to the minidriver handler function.
data, data_paddr
The virtual and physical addresses of the minidriver's data area, respectively.
data_size
The size of the minidriver's data area, in bytes.
name
The offset into the system page's strings section where the minidriver's name is stored.

In order for a full (process-time) driver to find a minidriver and gain access to its data area, it must access the entry in the system page by using the SYSPAGE_ENTRY() macro:

SYSPAGE_ENTRY(mdriver)[i].data_paddr

where i is the index into the minidriver section. You can use the name field to locate a specific minidriver if there are multiple ones running in the system, possibly attached to the same interrupt. Here's some sample code that accesses this information:

int i, num_drivers = 0;
struct mdriver_entry    *mdriver;

mdriver = (struct mdriver_entry *) SYSPAGE_ENTRY(mdriver);
num_drivers = _syspage_ptr->mdriver.entry_size/sizeof(*mdriver);
printf("Number of Installed minidrivers = %d\n\n", num_drivers);

for (i = 0; i < num_drivers; i++)
{
    printf("Minidriver entry .. %d\n", i);
    printf("Name .............. %s\n",
       SYSPAGE_ENTRY(strings)->data + mdriver[i].name);
    printf("Interrupt ......... 0x%X\n", mdriver[i].intr);
    printf("Data size ......... %d\n", mdriver[i].data_size);
    printf("\n");
}

Classification:

QNX Neutrino