Ejemplo n.º 1
0
static ssize_t onda_pwm_store(struct device *dev,
                struct device_attribute *attr, const char *buf, size_t size)
{
	ssize_t status;
	l4_msgtag_t tag;
	l4_umword_t label;
	l4_cap_idx_t comm_cap;
	int value = 0;
	int ipc_error;

	mutex_lock(&sysfs_lock);
	
	comm_cap = l4re_get_env_cap("comm");

	/* Get a free capability slot for the comm capability */
	if (l4_is_invalid_cap(comm_cap)) {
		printk("Did not find an comm\n");
		mutex_unlock(&sysfs_lock);
		return 0;
    }

	/* To an L4 IPC call, i.e. send a message to thread2 and wait for a
	* reply from thread2. The '1' in the msgtag denotes that we want to
	* transfer one word of our message registers (i.e. MR0). No timeout. */
	if (sscanf(buf,"%d\n", &value) > 0) {
		l4_utcb_mr()->mr[0] = 0x67;
		l4_utcb_mr()->mr[1] = value;
		tag = l4_ipc_call(comm_cap, l4_utcb(), l4_msgtag(0x67, 2, 0, 0), L4_IPC_NEVER);
	}

	mutex_unlock(&sysfs_lock);
	return size;
}
Ejemplo n.º 2
0
static ssize_t onda_interval_show(struct device *dev,
                struct device_attribute *attr, char *buf)
{
	ssize_t status;
	l4_msgtag_t tag;
	l4_umword_t label;
	l4_cap_idx_t comm_cap;
	int value = 0;
	int ipc_error;

	mutex_lock(&sysfs_lock);
	
	comm_cap = l4re_get_env_cap("comm");

	/* Get a free capability slot for the comm capability */
	if (l4_is_invalid_cap(comm_cap)) {
		printk("Did not find an comm\n");
		mutex_unlock(&sysfs_lock);
		return 0;
    }

	/* To an L4 IPC call, i.e. send a message to thread2 and wait for a
	* reply from thread2. The '1' in the msgtag denotes that we want to
	* transfer one word of our message registers (i.e. MR0). No timeout. */
	l4_utcb_mr()->mr[0] = 0x56;
	tag = l4_ipc_call(comm_cap, l4_utcb(), l4_msgtag(0x56, 1, 0, 0), L4_IPC_NEVER);
	
	/* Check for IPC error, if yes, print out the IPC error code, if not,
	* print the received result. */
	ipc_error = l4_ipc_error(tag, l4_utcb());
	if (ipc_error) {
		printk("IPC error: %x\n", ipc_error);
		return 0;
		buf[0] = '\n';
		buf[1] = '\0';
		status = 1;
	} else {
		value = (int)(l4_utcb_mr()->mr[0]);
		status = sprintf(buf, "%d\n", value);
	}

	mutex_unlock(&sysfs_lock);

	return status;
}
Ejemplo n.º 3
0
static int __init l4vpci_init(void)
{
	struct pci_dev *dev = NULL;
#ifdef CONFIG_ARM
	struct pci_sys_data *sd;
#else
	struct pci_sysdata *sd;
#endif
	int err;
	L4XV_V(f);

	vbus = l4re_get_env_cap("vbus");
	if (l4_is_invalid_cap(vbus))
		return -ENOENT;

	L4XV_L(f);

	err = l4vbus_get_device_by_hid(vbus, 0, &root_bridge, "PNP0A03", 0, 0);
	if (err < 0) {
		printk(KERN_INFO "PCI: no root bridge found, no PCI\n");
		L4XV_U(f);
		return err;
	}

	L4XV_U(f);

	printk(KERN_INFO "PCI: L4 root bridge is device %lx\n", root_bridge);

	sd = kzalloc(sizeof(*sd), GFP_KERNEL);
	if (!sd)
		return -ENOMEM;

	pci_scan_bus(0, &l4vpci_ops, sd);

	printk(KERN_INFO "PCI: Using L4-IO for IRQ routing\n");

	for_each_pci_dev(dev)
		l4vpci_irq_enable(dev);

#ifdef CONFIG_X86
	pcibios_resource_survey();
#endif

	return 0;
}
Ejemplo n.º 4
0
static
int kp_init(void)
{
  vbus = l4re_get_env_cap("vbus");

  if (l4_is_invalid_cap(vbus))
    {
      printf("[KEYP] Failed to query vbus\n");
      return -1;
    }

  if (l4vbus_get_device_by_hid(vbus, 0, &i2c_handle, "i2c", 0, 0))
    {
      printf("[KEYP] ##### Cannot find I2C\n");
    }

  return init_keypad();
}
Ejemplo n.º 5
0
static int clcd_init_overo(void)
{
	vbus = l4re_get_env_cap("vbus");

	if (l4_is_invalid_cap(vbus))
	{
		printf("[LCD] Error: Could not query <vbus> capability\n");
		return -1;
	}

	if (l4vbus_get_device_by_hid(vbus, 0, &i2c_handle, "i2c", 0, 0))
	{
		printf("[LCD] Error: Could not find <i2c> vbus device\n");
		return -1;
	}

	if (l4vbus_get_device_by_hid(vbus, 0, &gpio_handle, "gpio", 0, 0))
	{
		printf("[LCD] Error: Could not find <gpio> vbus device\n");
		return -L4_ENODEV;
	}

	return 0;
}