Beispiel #1
0
int flink_core_open(flink_dev* fdev,struct flink_bus_ops* bus_channel) {
	//fdev = flink_device_alloc();
	flink_set_bus(bus_channel);
	flink_device_init(fdev, bus_channel); // TODO: Use other bus_ops for other channel
	flink_device_add(fdev);	// creates device nodes
	return 0;
}
int flink_core_open(flink_dev* fdev) {
	//fdev = flink_device_alloc();
	flink_set_bus(&avalon_bus_ops);
	flink_device_init(fdev, &avalon_bus_ops); // TODO: Use other bus_ops for other channel
	flink_device_add(fdev);	// creates device nodes
	return 0;
}
Beispiel #3
0
// ############ Device handling ############
static struct flink_device* create_flink_pci_device(struct flink_bus_ops* bus_ops, struct pci_dev* pci_device, void __iomem* base_ptr, unsigned long length) {
	struct flink_pci_data* pci_data = kmalloc(sizeof(struct flink_pci_data), GFP_KERNEL);
	struct flink_device* fdev = flink_device_alloc();
	
	if(pci_data != NULL && fdev != NULL) {
		pci_data->pci_device = pci_device;
		pci_data->base_addr = base_ptr + BASE_OFFSET;
		pci_data->mem_size = length;
		
		flink_device_init(fdev, bus_ops, THIS_MODULE);
		fdev->bus_data = pci_data;
		return fdev;
	}
	return NULL;
}