1%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2% Copyright (c) 2016, ETH Zurich.
3% All rights reserved.
4%
5% This file is distributed under the terms in the attached LICENSE file.
6% If you do not find this file, copies can be found by writing to:
7% ETH Zurich D-INFK, Haldeneggsteig 4, CH-8092 Zurich. Attn: Systems Group.
8%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9
10:- local struct(dn_cpu_driver(
11    binary,
12    supported_cores,
13    kernel_memory,
14    kernel_devices,
15    platforms
16)).
17
18:- local struct(dn_monitor(
19    binary,
20    supported_cores,
21    platforms
22)).
23
24:- local struct(dn_driver(
25    module,            % Name of driver module
26    supported_devices, % Supported devices
27    device_regions,    % Device regions the driver needs access to
28    device_interrupts,    % Device interrupts the driver needs access to
29    driver_deps,       % Dependencies on other drivers
30    start_on_discovery,% Whether to start this driver eagerly or only if dependency
31    platforms          % Supported platforms
32)).
33
34% Decoding net related stuff
35decoding_net("sockeyefacts/omap44xx").
36decoding_net_meta("sockeyefacts/omap44xx_meta").
37decoding_net_irq("sockeyefacts/omap44xx-int").
38decoding_net_irq_meta("sockeyefacts/omap44xx-int_meta").
39
40% Drivers
41dn_cpu_driver{
42    binary: "/armv7/sbin/cpu_omap44xx",
43    supported_cores: ['CORTEXA9_1', 'CORTEXA9_2'],
44    kernel_memory: ['SDRAM'],
45    kernel_devices: ['UART3','SCU','GIC_PROC','GIC_DIST','Global_Timer','Private_Timers','CKGEN_PRM','CKGEN_CM1','Spinlock'],
46    platforms: ['omap44xx']
47}.
48
49dn_monitor{
50    binary: "/armv7/sbin/monitor",
51    supported_cores: ['CORTEXA9_1', 'CORTEXA9_2'],
52    platforms: ['omap44xx']
53}.
54
55dn_driver{
56    module: "fdif",
57    supported_devices: ['FDIF'],
58    device_regions: ['CAM_CM2', 'DEVICE_PRM', 'CAM_PRM', 'FDIF'],
59    device_interrupts: ['FDIF_1', 'FDIF_3'],
60    driver_deps: [],
61    start_on_discovery: 1,
62    platforms: ['omap44xx']
63}.
64
65dn_driver{
66    module: "sdma",
67    supported_devices: ['SDMA'],
68    device_regions: ['SDMA'],
69    device_interrupts: ['SDMA'],
70    driver_deps: [],
71    start_on_discovery: 1,
72    platforms: ['omap44xx']
73}.
74
75dn_driver{
76    module: "mmchs",
77    supported_devices: ['HSMMC1'],
78    device_regions: ['SYSCTRL_PADCONF_CORE', 'HSMMC1'],
79    driver_deps: ['L3INIT_CM2', 'I2C1'],
80    start_on_discovery: 0,
81    platforms: ['omap44xx']
82}.
83
84dn_driver{
85    module: "cm2",
86    supported_devices: ['L3INIT_CM2'],
87    device_regions: ['L3INIT_CM2'],
88    driver_deps: [],
89    start_on_discovery: 0,
90    platforms: ['omap44xx']
91}.
92
93dn_driver{
94    module: "twl6030",
95    supported_devices: ['I2C1'],
96    device_regions: ['I2C1'],
97    driver_deps: [],
98    start_on_discovery: 0,
99    platforms: ['omap44xx']
100}.
101
102find_dn_cpu_driver(CoreID, DriverInfo) :-
103    meta{
104        name:Core,
105        key:hw_id,
106        value:CoreID
107    },
108    dn_cpu_driver{
109        binary: Binary,
110        supported_cores: Cores
111    },
112    member(Core, Cores),
113    DriverInfo = driver(Binary).
114
115find_dn_monitor(CoreID, MonitorInfo) :-
116    meta{
117        name:Core,
118        key:hw_id,
119        value:CoreID
120    },
121    dn_monitor{
122        binary: Binary,
123        supported_cores: Cores
124    },
125    member(Core, Cores),
126    MonitorInfo = monitor(Binary).
127
128find_dn_driver(Device, DriverInfo) :-
129    dn_driver{
130        module: Module,
131        supported_devices: Devices,
132        driver_deps: Deps,
133        start_on_discovery: Mode
134    },
135    member(Device, Devices),
136    findall(drv_dep(Dep),member(Dep,Deps),DepInfo),
137    DriverInfo = driver(Module, Mode, DepInfo).
138
139