Example #1
0
static PyObject* python_get_unit_name(PyObject* self, PyObject* args) {
	int arg_u;
	if(PyArg_ParseTuple(args, "i", &arg_u) == 0) return NULL;

	const char* retval = get_unit_name((struct unit*)arg_u);
	return Py_BuildValue("s", retval);
}
Example #2
0
static int tolua_get_unit_name(lua_State* tolua_S)
{
  unit* self = (unit*)  tolua_tousertype(tolua_S,1,0);
#ifndef TOLUA_RELEASE
  if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable 'unit_name'",NULL);
#endif
  tolua_pushstring(tolua_S,(const char*)get_unit_name(self));
 return 1;
}
Example #3
0
File: dev.c Project: HarryR/sanos
static int units_proc(struct proc_file *pf, void *arg) {
  struct unit *unit;
  struct resource *res;
  int bustype;
  int busno;

  unit = units;
  while (unit) {
    if (unit->bus) {
      bustype = unit->bus->bustype;
      busno = unit->bus->busno;
    } else {
      bustype = BUSTYPE_HOST;
      busno = 0;
    }
    
    pprintf(pf, "%s unit %d.%d class %08X code %08X %s:\n", busnames[bustype], busno, unit->unitno,unit->classcode, unit->unitcode, get_unit_name(unit));

    if (unit->subunitcode != 0 || unit ->revision != 0) {
      pprintf(pf, "  subunitcode: %08X revision %d\n", unit->subunitcode, unit->revision);
    }

    res = unit->resources;
    while (res) {
      switch (res->type) {
        case RESOURCE_IO: 
          if (res->len == 1) { 
            pprintf(pf, "  io: 0x%03x", res->start);
          } else {
            pprintf(pf, "  io: 0x%03x-0x%03x", res->start, res->start + res->len - 1);
          }
          break;

        case RESOURCE_MEM:
          if (res->len == 1) {
            pprintf(pf, "  mem: 0x%08x", res->start);
          } else {
            pprintf(pf, "  mem: 0x%08x-0x%08x", res->start, res->start + res->len - 1);
          }
          break;

        case RESOURCE_IRQ:
          if (res->len == 1) {
            pprintf(pf, "  irq: %d", res->start);
          } else {
            pprintf(pf, "  irq: %d-%d", res->start, res->start + res->len - 1);
          }
          break;

        case RESOURCE_DMA:
          if (res->len == 1) {
            pprintf(pf, "  dma: %d", res->start);
          } else {
            pprintf(pf, "  dma: %d-%d", res->start, res->start + res->len - 1);
          }
          break;
      }

      pprintf(pf, "\n");

      res = res->next;
    }

    unit = unit->next;
  }

  return 0;
}
Example #4
0
File: dev.c Project: HarryR/sanos
static void install_driver(struct unit *unit, struct binding *bind) {
  int rc;

  rc = initialize_driver(unit, bind->module);
  if (rc < 0) {
    kprintf(KERN_ERR "dev: driver '%s' failed with error %d for unit %08X '%s'\n", bind->module, rc, unit->unitcode, get_unit_name(unit));
  }
}