navtree.js 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558
  1. var NAVTREE =
  2. [
  3. [ "CMSIS-Core (Cortex-M)", "index.html", [
  4. [ "Overview", "index.html", [
  5. [ "Processor Support", "index.html#ref_v6-v8M", [
  6. [ "Cortex-M Reference Manuals", "index.html#ref_man_sec", null ],
  7. [ "Armv8-M Architecture", "index.html#ARMv8M", null ]
  8. ] ],
  9. [ "Tested and Verified Toolchains", "index.html#tested_tools_sec", null ]
  10. ] ],
  11. [ "Revision History of CMSIS-Core (Cortex-M)", "core_revisionHistory.html", null ],
  12. [ "Using CMSIS in Embedded Applications", "using_pg.html", "using_pg" ],
  13. [ "Using TrustZone for Armv8-M", "using_TrustZone_pg.html", [
  14. [ "Simplified Use Case with TrustZone", "using_TrustZone_pg.html#useCase_TrustZone", [
  15. [ "Program Examples", "using_TrustZone_pg.html#Example_TrustZone", null ]
  16. ] ],
  17. [ "Programmers Model with TrustZone", "using_TrustZone_pg.html#Model_TrustZone", null ],
  18. [ "CMSIS Files for TrustZone", "using_TrustZone_pg.html#CMSIS_Files_TrustZone", [
  19. [ "RTOS Thread Context Management", "using_TrustZone_pg.html#RTOS_TrustZone", null ]
  20. ] ]
  21. ] ],
  22. [ "CMSIS-Core Device Templates", "templates_pg.html", "templates_pg" ],
  23. [ "MISRA-C Deviations", "coreMISRA_Exceptions_pg.html", null ],
  24. [ "Register Mapping", "regMap_pg.html", null ],
  25. [ "Deprecated List", "deprecated.html", null ],
  26. [ "Reference", "modules.html", "modules" ],
  27. [ "Data Structures", "annotated.html", "annotated" ],
  28. [ "Data Fields", "functions.html", [
  29. [ "All", "functions.html", null ],
  30. [ "Variables", "functions_vars.html", null ]
  31. ] ]
  32. ] ]
  33. ];
  34. var NAVTREEINDEX =
  35. [
  36. "annotated.html",
  37. "group__mpu__defines.html#gab23596306119e7831847bd9683de3934",
  38. "unionxPSR__Type.html#af14df16ea0690070c45b95f2116b7a0a"
  39. ];
  40. var SYNCONMSG = 'click to disable panel synchronisation';
  41. var SYNCOFFMSG = 'click to enable panel synchronisation';
  42. var SYNCONMSG = 'click to disable panel synchronisation';
  43. var SYNCOFFMSG = 'click to enable panel synchronisation';
  44. var navTreeSubIndices = new Array();
  45. function getData(varName)
  46. {
  47. var i = varName.lastIndexOf('/');
  48. var n = i>=0 ? varName.substring(i+1) : varName;
  49. return eval(n.replace(/\-/g,'_'));
  50. }
  51. function stripPath(uri)
  52. {
  53. return uri.substring(uri.lastIndexOf('/')+1);
  54. }
  55. function stripPath2(uri)
  56. {
  57. var i = uri.lastIndexOf('/');
  58. var s = uri.substring(i+1);
  59. var m = uri.substring(0,i+1).match(/\/d\w\/d\w\w\/$/);
  60. return m ? uri.substring(i-6) : s;
  61. }
  62. function localStorageSupported()
  63. {
  64. try {
  65. return 'localStorage' in window && window['localStorage'] !== null && window.localStorage.getItem;
  66. }
  67. catch(e) {
  68. return false;
  69. }
  70. }
  71. function storeLink(link)
  72. {
  73. if (!$("#nav-sync").hasClass('sync') && localStorageSupported()) {
  74. window.localStorage.setItem('navpath',link);
  75. }
  76. }
  77. function deleteLink()
  78. {
  79. if (localStorageSupported()) {
  80. window.localStorage.setItem('navpath','');
  81. }
  82. }
  83. function cachedLink()
  84. {
  85. if (localStorageSupported()) {
  86. return window.localStorage.getItem('navpath');
  87. } else {
  88. return '';
  89. }
  90. }
  91. function getScript(scriptName,func,show)
  92. {
  93. var head = document.getElementsByTagName("head")[0];
  94. var script = document.createElement('script');
  95. script.id = scriptName;
  96. script.type = 'text/javascript';
  97. script.onload = func;
  98. script.src = scriptName+'.js';
  99. if ($.browser.msie && $.browser.version<=8) {
  100. // script.onload does not work with older versions of IE
  101. script.onreadystatechange = function() {
  102. if (script.readyState=='complete' || script.readyState=='loaded') {
  103. func(); if (show) showRoot();
  104. }
  105. }
  106. }
  107. head.appendChild(script);
  108. }
  109. function createIndent(o,domNode,node,level)
  110. {
  111. var level=-1;
  112. var n = node;
  113. while (n.parentNode) { level++; n=n.parentNode; }
  114. if (node.childrenData) {
  115. var imgNode = document.createElement("img");
  116. imgNode.style.paddingLeft=(16*level).toString()+'px';
  117. imgNode.width = 16;
  118. imgNode.height = 22;
  119. imgNode.border = 0;
  120. node.plus_img = imgNode;
  121. node.expandToggle = document.createElement("a");
  122. node.expandToggle.href = "javascript:void(0)";
  123. node.expandToggle.onclick = function() {
  124. if (node.expanded) {
  125. $(node.getChildrenUL()).slideUp("fast");
  126. node.plus_img.src = node.relpath+"ftv2pnode.png";
  127. node.expanded = false;
  128. } else {
  129. expandNode(o, node, false, false);
  130. }
  131. }
  132. node.expandToggle.appendChild(imgNode);
  133. domNode.appendChild(node.expandToggle);
  134. imgNode.src = node.relpath+"ftv2pnode.png";
  135. } else {
  136. var span = document.createElement("span");
  137. span.style.display = 'inline-block';
  138. span.style.width = 16*(level+1)+'px';
  139. span.style.height = '22px';
  140. span.innerHTML = '&#160;';
  141. domNode.appendChild(span);
  142. }
  143. }
  144. var animationInProgress = false;
  145. function gotoAnchor(anchor,aname,updateLocation)
  146. {
  147. var pos, docContent = $('#doc-content');
  148. if (anchor.parent().attr('class')=='memItemLeft' ||
  149. anchor.parent().attr('class')=='fieldtype' ||
  150. anchor.parent().is(':header'))
  151. {
  152. pos = anchor.parent().position().top;
  153. } else if (anchor.position()) {
  154. pos = anchor.position().top;
  155. }
  156. if (pos) {
  157. var dist = Math.abs(Math.min(
  158. pos-docContent.offset().top,
  159. docContent[0].scrollHeight-
  160. docContent.height()-docContent.scrollTop()));
  161. animationInProgress=true;
  162. docContent.animate({
  163. scrollTop: pos + docContent.scrollTop() - docContent.offset().top
  164. },Math.max(50,Math.min(500,dist)),function(){
  165. if (updateLocation) window.location.href=aname;
  166. animationInProgress=false;
  167. });
  168. }
  169. }
  170. function newNode(o, po, text, link, childrenData, lastNode)
  171. {
  172. var node = new Object();
  173. node.children = Array();
  174. node.childrenData = childrenData;
  175. node.depth = po.depth + 1;
  176. node.relpath = po.relpath;
  177. node.isLast = lastNode;
  178. node.li = document.createElement("li");
  179. po.getChildrenUL().appendChild(node.li);
  180. node.parentNode = po;
  181. node.itemDiv = document.createElement("div");
  182. node.itemDiv.className = "item";
  183. node.labelSpan = document.createElement("span");
  184. node.labelSpan.className = "label";
  185. createIndent(o,node.itemDiv,node,0);
  186. node.itemDiv.appendChild(node.labelSpan);
  187. node.li.appendChild(node.itemDiv);
  188. var a = document.createElement("a");
  189. node.labelSpan.appendChild(a);
  190. node.label = document.createTextNode(text);
  191. node.expanded = false;
  192. a.appendChild(node.label);
  193. if (link) {
  194. var url;
  195. if (link.substring(0,1)=='^') {
  196. url = link.substring(1);
  197. link = url;
  198. } else {
  199. url = node.relpath+link;
  200. }
  201. a.className = stripPath(link.replace('#',':'));
  202. if (link.indexOf('#')!=-1) {
  203. var aname = '#'+link.split('#')[1];
  204. var srcPage = stripPath($(location).attr('pathname'));
  205. var targetPage = stripPath(link.split('#')[0]);
  206. a.href = srcPage!=targetPage ? url : "javascript:void(0)";
  207. a.onclick = function(){
  208. storeLink(link);
  209. if (!$(a).parent().parent().hasClass('selected'))
  210. {
  211. $('.item').removeClass('selected');
  212. $('.item').removeAttr('id');
  213. $(a).parent().parent().addClass('selected');
  214. $(a).parent().parent().attr('id','selected');
  215. }
  216. var anchor = $(aname);
  217. gotoAnchor(anchor,aname,true);
  218. };
  219. } else {
  220. a.href = url;
  221. a.onclick = function() { storeLink(link); }
  222. }
  223. } else {
  224. if (childrenData != null)
  225. {
  226. a.className = "nolink";
  227. a.href = "javascript:void(0)";
  228. a.onclick = node.expandToggle.onclick;
  229. }
  230. }
  231. node.childrenUL = null;
  232. node.getChildrenUL = function() {
  233. if (!node.childrenUL) {
  234. node.childrenUL = document.createElement("ul");
  235. node.childrenUL.className = "children_ul";
  236. node.childrenUL.style.display = "none";
  237. node.li.appendChild(node.childrenUL);
  238. }
  239. return node.childrenUL;
  240. };
  241. return node;
  242. }
  243. function showRoot()
  244. {
  245. var headerHeight = $("#top").height();
  246. var footerHeight = $("#nav-path").height();
  247. var windowHeight = $(window).height() - headerHeight - footerHeight;
  248. (function (){ // retry until we can scroll to the selected item
  249. try {
  250. var navtree=$('#nav-tree');
  251. navtree.scrollTo('#selected',0,{offset:-windowHeight/2});
  252. } catch (err) {
  253. setTimeout(arguments.callee, 0);
  254. }
  255. })();
  256. }
  257. function expandNode(o, node, imm, showRoot)
  258. {
  259. if (node.childrenData && !node.expanded) {
  260. if (typeof(node.childrenData)==='string') {
  261. var varName = node.childrenData;
  262. getScript(node.relpath+varName,function(){
  263. node.childrenData = getData(varName);
  264. expandNode(o, node, imm, showRoot);
  265. }, showRoot);
  266. } else {
  267. if (!node.childrenVisited) {
  268. getNode(o, node);
  269. } if (imm || ($.browser.msie && $.browser.version>8)) {
  270. // somehow slideDown jumps to the start of tree for IE9 :-(
  271. $(node.getChildrenUL()).show();
  272. } else {
  273. $(node.getChildrenUL()).slideDown("fast");
  274. }
  275. if (node.isLast) {
  276. node.plus_img.src = node.relpath+"ftv2mlastnode.png";
  277. } else {
  278. node.plus_img.src = node.relpath+"ftv2mnode.png";
  279. }
  280. node.expanded = true;
  281. }
  282. }
  283. }
  284. function glowEffect(n,duration)
  285. {
  286. n.addClass('glow').delay(duration).queue(function(next){
  287. $(this).removeClass('glow');next();
  288. });
  289. }
  290. function highlightAnchor()
  291. {
  292. var aname = $(location).attr('hash');
  293. var anchor = $(aname);
  294. if (anchor.parent().attr('class')=='memItemLeft'){
  295. var rows = $('.memberdecls tr[class$="'+
  296. window.location.hash.substring(1)+'"]');
  297. glowEffect(rows.children(),300); // member without details
  298. } else if (anchor.parents().slice(2).prop('tagName')=='TR') {
  299. glowEffect(anchor.parents('div.memitem'),1000); // enum value
  300. } else if (anchor.parent().attr('class')=='fieldtype'){
  301. glowEffect(anchor.parent().parent(),1000); // struct field
  302. } else if (anchor.parent().is(":header")) {
  303. glowEffect(anchor.parent(),1000); // section header
  304. } else {
  305. glowEffect(anchor.next(),1000); // normal member
  306. }
  307. gotoAnchor(anchor,aname,false);
  308. }
  309. function selectAndHighlight(hash,n)
  310. {
  311. var a;
  312. if (hash) {
  313. var link=stripPath($(location).attr('pathname'))+':'+hash.substring(1);
  314. a=$('.item a[class$="'+link+'"]');
  315. }
  316. if (a && a.length) {
  317. a.parent().parent().addClass('selected');
  318. a.parent().parent().attr('id','selected');
  319. highlightAnchor();
  320. } else if (n) {
  321. $(n.itemDiv).addClass('selected');
  322. $(n.itemDiv).attr('id','selected');
  323. }
  324. if ($('#nav-tree-contents .item:first').hasClass('selected')) {
  325. $('#nav-sync').css('top','30px');
  326. } else {
  327. $('#nav-sync').css('top','5px');
  328. }
  329. showRoot();
  330. }
  331. function showNode(o, node, index, hash)
  332. {
  333. if (node && node.childrenData) {
  334. if (typeof(node.childrenData)==='string') {
  335. var varName = node.childrenData;
  336. getScript(node.relpath+varName,function(){
  337. node.childrenData = getData(varName);
  338. showNode(o,node,index,hash);
  339. },true);
  340. } else {
  341. if (!node.childrenVisited) {
  342. getNode(o, node);
  343. }
  344. $(node.getChildrenUL()).css({'display':'block'});
  345. if (node.isLast) {
  346. node.plus_img.src = node.relpath+"ftv2mlastnode.png";
  347. } else {
  348. node.plus_img.src = node.relpath+"ftv2mnode.png";
  349. }
  350. node.expanded = true;
  351. var n = node.children[o.breadcrumbs[index]];
  352. if (index+1<o.breadcrumbs.length) {
  353. showNode(o,n,index+1,hash);
  354. } else {
  355. if (typeof(n.childrenData)==='string') {
  356. var varName = n.childrenData;
  357. getScript(n.relpath+varName,function(){
  358. n.childrenData = getData(varName);
  359. node.expanded=false;
  360. showNode(o,node,index,hash); // retry with child node expanded
  361. },true);
  362. } else {
  363. var rootBase = stripPath(o.toroot.replace(/\..+$/, ''));
  364. if (rootBase=="index" || rootBase=="pages" || rootBase=="search") {
  365. expandNode(o, n, true, true);
  366. }
  367. selectAndHighlight(hash,n);
  368. }
  369. }
  370. }
  371. } else {
  372. selectAndHighlight(hash);
  373. }
  374. }
  375. function removeToInsertLater(element) {
  376. var parentNode = element.parentNode;
  377. var nextSibling = element.nextSibling;
  378. parentNode.removeChild(element);
  379. return function() {
  380. if (nextSibling) {
  381. parentNode.insertBefore(element, nextSibling);
  382. } else {
  383. parentNode.appendChild(element);
  384. }
  385. };
  386. }
  387. function getNode(o, po)
  388. {
  389. var insertFunction = removeToInsertLater(po.li);
  390. po.childrenVisited = true;
  391. var l = po.childrenData.length-1;
  392. for (var i in po.childrenData) {
  393. var nodeData = po.childrenData[i];
  394. po.children[i] = newNode(o, po, nodeData[0], nodeData[1], nodeData[2],
  395. i==l);
  396. }
  397. insertFunction();
  398. }
  399. function gotoNode(o,subIndex,root,hash,relpath)
  400. {
  401. var nti = navTreeSubIndices[subIndex][root+hash];
  402. o.breadcrumbs = $.extend(true, [], nti ? nti : navTreeSubIndices[subIndex][root]);
  403. if (!o.breadcrumbs && root!=NAVTREE[0][1]) { // fallback: show index
  404. navTo(o,NAVTREE[0][1],"",relpath);
  405. $('.item').removeClass('selected');
  406. $('.item').removeAttr('id');
  407. }
  408. if (o.breadcrumbs) {
  409. o.breadcrumbs.unshift(0); // add 0 for root node
  410. showNode(o, o.node, 0, hash);
  411. }
  412. }
  413. function navTo(o,root,hash,relpath)
  414. {
  415. var link = cachedLink();
  416. if (link) {
  417. var parts = link.split('#');
  418. root = parts[0];
  419. if (parts.length>1) hash = '#'+parts[1];
  420. else hash='';
  421. }
  422. if (hash.match(/^#l\d+$/)) {
  423. var anchor=$('a[name='+hash.substring(1)+']');
  424. glowEffect(anchor.parent(),1000); // line number
  425. hash=''; // strip line number anchors
  426. //root=root.replace(/_source\./,'.'); // source link to doc link
  427. }
  428. var url=root+hash;
  429. var i=-1;
  430. while (NAVTREEINDEX[i+1]<=url) i++;
  431. if (i==-1) { i=0; root=NAVTREE[0][1]; } // fallback: show index
  432. if (navTreeSubIndices[i]) {
  433. gotoNode(o,i,root,hash,relpath)
  434. } else {
  435. getScript(relpath+'navtreeindex'+i,function(){
  436. navTreeSubIndices[i] = eval('NAVTREEINDEX'+i);
  437. if (navTreeSubIndices[i]) {
  438. gotoNode(o,i,root,hash,relpath);
  439. }
  440. },true);
  441. }
  442. }
  443. function showSyncOff(n,relpath)
  444. {
  445. n.html('<img src="'+relpath+'sync_off.png" title="'+SYNCOFFMSG+'"/>');
  446. }
  447. function showSyncOn(n,relpath)
  448. {
  449. n.html('<img src="'+relpath+'sync_on.png" title="'+SYNCONMSG+'"/>');
  450. }
  451. function toggleSyncButton(relpath)
  452. {
  453. var navSync = $('#nav-sync');
  454. if (navSync.hasClass('sync')) {
  455. navSync.removeClass('sync');
  456. showSyncOff(navSync,relpath);
  457. storeLink(stripPath2($(location).attr('pathname'))+$(location).attr('hash'));
  458. } else {
  459. navSync.addClass('sync');
  460. showSyncOn(navSync,relpath);
  461. deleteLink();
  462. }
  463. }
  464. function initNavTree(toroot,relpath)
  465. {
  466. var o = new Object();
  467. o.toroot = toroot;
  468. o.node = new Object();
  469. o.node.li = document.getElementById("nav-tree-contents");
  470. o.node.childrenData = NAVTREE;
  471. o.node.children = new Array();
  472. o.node.childrenUL = document.createElement("ul");
  473. o.node.getChildrenUL = function() { return o.node.childrenUL; };
  474. o.node.li.appendChild(o.node.childrenUL);
  475. o.node.depth = 0;
  476. o.node.relpath = relpath;
  477. o.node.expanded = false;
  478. o.node.isLast = true;
  479. o.node.plus_img = document.createElement("img");
  480. o.node.plus_img.src = relpath+"ftv2pnode.png";
  481. o.node.plus_img.width = 16;
  482. o.node.plus_img.height = 22;
  483. if (localStorageSupported()) {
  484. var navSync = $('#nav-sync');
  485. if (cachedLink()) {
  486. showSyncOff(navSync,relpath);
  487. navSync.removeClass('sync');
  488. } else {
  489. showSyncOn(navSync,relpath);
  490. }
  491. navSync.click(function(){ toggleSyncButton(relpath); });
  492. }
  493. $(window).load(function(){
  494. navTo(o,toroot,window.location.hash,relpath);
  495. showRoot();
  496. });
  497. $(window).bind('hashchange', function(){
  498. if (window.location.hash && window.location.hash.length>1){
  499. var a;
  500. if ($(location).attr('hash')){
  501. var clslink=stripPath($(location).attr('pathname'))+':'+
  502. $(location).attr('hash').substring(1);
  503. a=$('.item a[class$="'+clslink+'"]');
  504. }
  505. if (a==null || !$(a).parent().parent().hasClass('selected')){
  506. $('.item').removeClass('selected');
  507. $('.item').removeAttr('id');
  508. }
  509. var link=stripPath2($(location).attr('pathname'));
  510. navTo(o,link,$(location).attr('hash'),relpath);
  511. } else if (!animationInProgress) {
  512. $('#doc-content').scrollTop(0);
  513. $('.item').removeClass('selected');
  514. $('.item').removeAttr('id');
  515. navTo(o,toroot,window.location.hash,relpath);
  516. }
  517. })
  518. }