Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bonescript/bone.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ exports.bone =
P8_26: { name: "GPIO1_29", gpio: gpio1+29, mux: "gpmc_csn0", eeprom: 162 },
P8_27: { name: "GPIO2_22", gpio: gpio2+22, mux: "lcd_vsync", eeprom: 202 },
P8_28: { name: "GPIO2_24", gpio: gpio2+24, mux: "lcd_pclk", eeprom: 206 },
P8_29: { name: "GPIO2_23", gpio: gpio2+23, mux: "lcd_hclk", eeprom: 204 },
P8_29: { name: "GPIO2_23", gpio: gpio2+23, mux: "lcd_vsync", eeprom: 204 },
P8_30: { name: "GPIO2_25", gpio: gpio2+25, mux: "lcd_ac_bias_en", eeprom: 208 },
P8_31: { name: "UART5_CTSN", gpio: gpio0+10, mux: "lcd_data14", eeprom: 102 },
P8_32: { name: "UART5_RTSN", gpio: gpio0+11, mux: "lcd_data15", eeprom: 104 },
Expand Down
20 changes: 17 additions & 3 deletions bonescript/eeprom.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
var fs = require('fs');
var path = require('path');
var buffer = require('buffer');
var util = require('util');
bone = require('./bone').bone;
Expand Down Expand Up @@ -122,14 +123,27 @@ var parseCapeEeprom = function(x) {
var pinOffset = bone[pin].eeprom;
var pinData = x.readUint16BE(pinOffset);
var pinObject = {};
pinObject.used = (pinData & 0x8000) >> 15;
pinObject.used = (pinData & 0x8000) >> 15 ? 'used' : 'available';
if(pinData) {
pinObject.direction = ((pinData & 0x4000) >> 14) ? 'in' : 'out';
pinObject.pullup = (pinData & 0x3000) >> 12;
pinObject.pullup = (pinData & 0x3000) >> 12 ? 'pullup' : 'pulldown';
pinObject.mode = (pinData & 0x0007);

pinObject.function = {};
if(pinObject.used == "used") {
try {
// read mux from debugfs
muxReadout= fs.readFileSync("/sys/kernel/debug/omap_mux/" + bone[pin].mux, 'utf8');
pinObject.function = muxReadout.split("\n")[2].split("|")[pinObject.mode].replace('signals:', '').trim();
} catch(ex) {
//default mux
pinObject.function = bone[pin].name;
}
}

pinObject.data = x.hexSlice(pinOffset, pinOffset+2);
data.eeprom[bone[pin].name] = pinObject;
}
data.eeprom[pin] = pinObject;
}
}
return(data);
Expand Down