@@ -2,11 +2,11 @@ def CreateDriverStuff(inputParams):
2
2
functionString = "/****************************************************\n "
3
3
functionString += "Generated in CreateDriverStuff\n "
4
4
functionString += "****************************************************/\n "
5
- devName = inputParams .deviceName
5
+ devName = inputParams .device_name
6
6
functionString += CreateDevStruct (inputParams )
7
7
functionString += "typedef struct fe_" + devName + "_dev fe_" + devName + "_dev_t;\n "
8
8
functionString += CreateIDMatchingStruct (inputParams )
9
- if inputParams .deviceType == 1 : # if I2C device it needs the next thing
9
+ if inputParams .device_type == 1 : # if I2C device it needs the next thing
10
10
functionString += CreateI2CDriverStructs (inputParams )
11
11
functionString += "MODULE_DEVICE_TABLE(of, fe_" + devName + "_dt_ids);\n "
12
12
functionString += CreatePlatformDriverStruct (inputParams )
@@ -17,25 +17,25 @@ def CreateDriverStuff(inputParams):
17
17
18
18
def CreateDevStruct (inputParams ):
19
19
functionString = "\n /* Device struct */\n "
20
- functionString += "struct fe_" + inputParams .deviceName + "_dev {\n "
20
+ functionString += "struct fe_" + inputParams .device_name + "_dev {\n "
21
21
functionString += " struct cdev cdev;\n "
22
22
functionString += " char *name;\n "
23
23
functionString += " void __iomem *regs;\n "
24
- for i in range ( len ( inputParams .deviceAttributes )) :
24
+ for attr in inputParams .device_attributes :
25
25
try : # try to get the type of the attribute from input params, otherwise just assume its int;
26
- functionString += " " + inputParams . attributeType [ i ]
26
+ functionString += " " + attr . data_type . name
27
27
except :
28
28
functionString += " int"
29
- functionString += " " + inputParams .deviceAttributes [ i ] + ";\n "
29
+ functionString += " " + inputParams .device_attributes . name + ";\n "
30
30
functionString += "};\n \n "
31
31
return functionString
32
32
33
33
34
34
def CreateIDMatchingStruct (inputParams ):
35
35
functionString = "/* ID Matching struct */\n "
36
- functionString += "static struct of_device_id fe_" + inputParams .deviceName + "_dt_ids[] = {\n "
36
+ functionString += "static struct of_device_id fe_" + inputParams .device_name + "_dt_ids[] = {\n "
37
37
functionString += " {\n "
38
- functionString += " .compatible = \" " + inputParams .compatibleFlag + "\" \n "
38
+ functionString += " .compatible = \" " + inputParams .compatible_flag + "\" \n "
39
39
functionString += " },\n "
40
40
functionString += " { }\n "
41
41
functionString += "};\n \n "
@@ -44,41 +44,41 @@ def CreateIDMatchingStruct(inputParams):
44
44
45
45
def CreatePlatformDriverStruct (inputParams ):
46
46
functionString = "/* Platform driver struct */\n "
47
- functionString += "static struct platform_driver " + inputParams .deviceName + "_platform = {\n "
48
- functionString += " .probe = " + inputParams .deviceName + "_probe,\n "
49
- functionString += " .remove = " + inputParams .deviceName + "_remove,\n "
47
+ functionString += "static struct platform_driver " + inputParams .device_name + "_platform = {\n "
48
+ functionString += " .probe = " + inputParams .device_name + "_probe,\n "
49
+ functionString += " .remove = " + inputParams .device_name + "_remove,\n "
50
50
functionString += " .driver = {\n "
51
- functionString += " .name = \" Flat Earth " + inputParams .deviceName + " Driver\" ,\n "
51
+ functionString += " .name = \" Flat Earth " + inputParams .device_name + " Driver\" ,\n "
52
52
functionString += " .owner = THIS_MODULE,\n "
53
- functionString += " .of_match_table = fe_" + inputParams .deviceName + "_dt_ids\n "
53
+ functionString += " .of_match_table = fe_" + inputParams .device_name + "_dt_ids\n "
54
54
functionString += " }\n "
55
55
functionString += "};\n \n "
56
56
return functionString
57
57
58
58
59
59
def CreateFileOpsStruct (inputParams ):
60
60
functionString = "/* File ops struct */\n "
61
- functionString += "static const struct file_operations fe_" + inputParams .deviceName + "_fops = {\n "
61
+ functionString += "static const struct file_operations fe_" + inputParams .device_name + "_fops = {\n "
62
62
functionString += " .owner = THIS_MODULE,\n "
63
- functionString += " .read = " + inputParams .deviceName + "_read,\n "
64
- functionString += " .write = " + inputParams .deviceName + "_write,\n "
65
- functionString += " .open = " + inputParams .deviceName + "_open,\n "
66
- functionString += " .release = " + inputParams .deviceName + "_release,\n "
63
+ functionString += " .read = " + inputParams .device_name + "_read,\n "
64
+ functionString += " .write = " + inputParams .device_name + "_write,\n "
65
+ functionString += " .open = " + inputParams .device_name + "_open,\n "
66
+ functionString += " .release = " + inputParams .device_name + "_release,\n "
67
67
functionString += "};\n \n "
68
68
return functionString
69
69
70
70
71
71
def CreateI2CDriverStructs (inputParams ):
72
- devNameAbbrev = inputParams .deviceNameAbbrev
72
+ devNameAbbrev = inputParams .device_name_abbrev
73
73
functionString = "/* I2C Driver stuff */\n "
74
74
functionString += "static struct i2c_device_id " + devNameAbbrev + "_id[] = {\n "
75
75
functionString += " {\n "
76
- functionString += " \" " + devNameAbbrev + "_i2c\" ," + inputParams .deviceID + "\n "
76
+ functionString += " \" " + devNameAbbrev + "_i2c\" ," + inputParams .device_i2c_address + "\n "
77
77
functionString += " },\n "
78
78
functionString += " { }\n "
79
79
functionString += "};\n \n "
80
80
functionString += "static struct i2c_board_info " + devNameAbbrev + "_i2c_info = {\n "
81
- functionString += " I2C_BOARD_INFO(\" " + devNameAbbrev + "_i2c\" ," + inputParams .deviceID + "),\n "
81
+ functionString += " I2C_BOARD_INFO(\" " + devNameAbbrev + "_i2c\" ," + inputParams .device_i2c_address + "),\n "
82
82
functionString += "};\n \n "
83
83
functionString += "static int " + devNameAbbrev + "_i2c_probe(struct i2c_client *client, const struct i2c_device_id *id) {\n "
84
84
functionString += " return 0;\n "
0 commit comments