MMECode.c 22 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012
  1. /*====================================================================*
  2. *
  3. * Copyright (c) 2013 Qualcomm Atheros, Inc.
  4. *
  5. * All rights reserved.
  6. *
  7. *====================================================================*/
  8. #ifndef MMECODE_SOURCE
  9. #define MMECODE_SOURCE
  10. #include <stdio.h>
  11. #include <stdint.h>
  12. #include "../mme/mme.h"
  13. #include "../tools/symbol.h"
  14. #include "../tools/endian.h"
  15. #include "../tools/error.h"
  16. #ifndef MMEPASSFAIL
  17. static struct mme_code
  18. {
  19. uint16_t type;
  20. uint8_t code;
  21. char const * text;
  22. }
  23. mme_codes [] =
  24. {
  25. {
  26. 0x8001,
  27. 0x01,
  28. "Request Failed"
  29. },
  30. {
  31. 0x8005,
  32. 0x01,
  33. "Read Stopped"
  34. },
  35. {
  36. 0x8005,
  37. 0x03,
  38. "Stopped with Valid Read"
  39. },
  40. {
  41. 0x8005,
  42. 0x05,
  43. "Reached End"
  44. },
  45. {
  46. 0x8005,
  47. 0x07,
  48. "Stopped, Valid Read, Reached End - All Done! Go Away!"
  49. },
  50. {
  51. 0x8005,
  52. 0x80,
  53. "Bad Index"
  54. },
  55. {
  56. 0x8005,
  57. 0x81,
  58. "Bad Word Count"
  59. },
  60. {
  61. 0x8005,
  62. 0x82,
  63. "No Stop Before Read"
  64. },
  65. {
  66. 0x8005,
  67. 0x83,
  68. "Bad MME"
  69. },
  70. #ifdef SOFTLOADER
  71. {
  72. 0xA005,
  73. 0x14,
  74. "Bad Checksum"
  75. },
  76. {
  77. 0xA005,
  78. 0x1C,
  79. "Bad Length"
  80. },
  81. {
  82. 0xA005,
  83. 0x38,
  84. "Bad Address"
  85. },
  86. {
  87. 0xA005,
  88. 0x3C,
  89. "Bad Data Alignment"
  90. },
  91. #else
  92. {
  93. 0xA005,
  94. 0x10,
  95. "Bad Offset"
  96. },
  97. {
  98. 0xA005,
  99. 0x14,
  100. "Bad Length"
  101. },
  102. #endif
  103. {
  104. 0xA009,
  105. 0x10,
  106. "Bad Offset"
  107. },
  108. {
  109. 0xA009,
  110. 0x14,
  111. "Bad Length"
  112. },
  113. {
  114. 0xA00D,
  115. 0x10,
  116. "Bad Module ID"
  117. },
  118. #ifdef SOFTLOADER
  119. {
  120. 0xA00D,
  121. 0x14,
  122. "Bad Image Checksum"
  123. },
  124. {
  125. 0xA00D,
  126. 0x1C,
  127. "Bad Image Length"
  128. },
  129. {
  130. 0xA00D,
  131. 0x38,
  132. "Bad Image Load Address"
  133. },
  134. {
  135. 0xA00D,
  136. 0x3C,
  137. "Bad Data Alignment"
  138. },
  139. {
  140. 0xA00D,
  141. 0x40,
  142. "Bad Start Address"
  143. },
  144. #else
  145. {
  146. 0xA00D,
  147. 0x38,
  148. "Bad Checksum"
  149. },
  150. {
  151. 0xA00D,
  152. 0x40,
  153. "Failed to Lock NVM"
  154. },
  155. #endif
  156. {
  157. 0xA011,
  158. 0x10,
  159. "No Flash Memory"
  160. },
  161. {
  162. 0xA01D,
  163. 0x01,
  164. "Device Failed to Reset"
  165. },
  166. {
  167. 0xA01D,
  168. 0x02,
  169. "Device is Busy"
  170. },
  171. {
  172. 0xA021,
  173. 0x10,
  174. "Bad Module"
  175. },
  176. {
  177. 0xA021,
  178. 0x12,
  179. "Bad Length"
  180. },
  181. {
  182. 0xA021,
  183. 0x14,
  184. "Bad Checksum"
  185. },
  186. {
  187. 0xA021,
  188. 0x20,
  189. "Bad Offset"
  190. },
  191. {
  192. 0xA021,
  193. 0x40,
  194. "Operation Blocked"
  195. },
  196. {
  197. 0xA021,
  198. 0x50,
  199. "Fail to lock NVM"
  200. },
  201. {
  202. 0xA025,
  203. 0x10,
  204. "Bad Module"
  205. },
  206. {
  207. 0xA025,
  208. 0x12,
  209. "Bad Length"
  210. },
  211. {
  212. 0xA025,
  213. 0x14,
  214. "Bad Checksum"
  215. },
  216. {
  217. 0xA025,
  218. 0x20,
  219. "Bad Offset"
  220. },
  221. {
  222. 0xA025,
  223. 0x50,
  224. "Fail to lock NVM"
  225. },
  226. {
  227. 0xA025,
  228. 0x58,
  229. "DAK Mismatch"
  230. },
  231. {
  232. 0xA029,
  233. 0x10,
  234. "Bad Module"
  235. },
  236. {
  237. 0xA029,
  238. 0x14,
  239. "No Flash Memory"
  240. },
  241. {
  242. 0xA029,
  243. 0x18,
  244. "Not enough NVRAM"
  245. },
  246. {
  247. 0xA029,
  248. 0x1C,
  249. "Bad Header Checksum"
  250. },
  251. {
  252. 0xA029,
  253. 0x20,
  254. "Bad Image Checksum"
  255. },
  256. {
  257. 0xA029,
  258. 0x24,
  259. "Bad PIB"
  260. },
  261. {
  262. 0xA029,
  263. 0x28,
  264. "Softloader Too Large"
  265. },
  266. {
  267. 0xA029,
  268. 0x2C,
  269. "Firmware Too Large"
  270. },
  271. {
  272. 0xA029,
  273. 0x42,
  274. "Firmware without PIB"
  275. },
  276. {
  277. 0xA029,
  278. 0x44,
  279. "Bad PIB Checksum"
  280. },
  281. {
  282. 0xA029,
  283. 0x46,
  284. "DAK Not Zero"
  285. },
  286. {
  287. 0xA029,
  288. 0x48,
  289. "MAC Mismatch"
  290. },
  291. {
  292. 0xA029,
  293. 0x50,
  294. "MFG HFID Mismatch"
  295. },
  296. {
  297. 0xA029,
  298. 0x52,
  299. "Bad Bind Factory Defaults"
  300. },
  301. {
  302. 0xA029,
  303. 0x54,
  304. "Bad Bind Template PIB"
  305. },
  306. {
  307. 0xA029,
  308. 0x56,
  309. "Bad Bind Working PIB"
  310. },
  311. {
  312. 0xA029,
  313. 0x58,
  314. "Error Computing PIB Checksum"
  315. },
  316. {
  317. 0xA029,
  318. 0x5A,
  319. "Bad Bind Scratch PIB"
  320. },
  321. {
  322. 0xA029,
  323. 0x5C,
  324. "No Firmware Version"
  325. },
  326. {
  327. 0xA029,
  328. 0x5E,
  329. "Version Mismatch"
  330. },
  331. {
  332. 0xA029,
  333. 0x60,
  334. "Bad 01PIB Checksum"
  335. },
  336. {
  337. 0xA029,
  338. 0x62,
  339. "Bad 02PIB Checksum"
  340. },
  341. {
  342. 0xA029,
  343. 0x64,
  344. "Bad WPIB Checksum"
  345. },
  346. {
  347. 0xA029,
  348. 0x66,
  349. "Bad Firmware Revision"
  350. },
  351. {
  352. 0xA029,
  353. 0x68,
  354. "Unssupported Firmware"
  355. },
  356. #if 1
  357. /*
  358. * [CFM] What are these?
  359. */
  360. {
  361. 0xA029,
  362. 0x70,
  363. "No Bound Parameter Block"
  364. },
  365. {
  366. 0xA029,
  367. 0x72,
  368. "No Network Management Data Slot"
  369. },
  370. #endif
  371. {
  372. 0xA02D,
  373. 0x01,
  374. "Read Failed"
  375. },
  376. {
  377. 0xA031,
  378. 0x01,
  379. "Bad Control"
  380. },
  381. {
  382. 0xA031,
  383. 0x02,
  384. "Bad Direction"
  385. },
  386. {
  387. 0xA031,
  388. 0x10,
  389. "Bad Link ID"
  390. },
  391. {
  392. 0xA031,
  393. 0x20,
  394. "Bad MAC Address"
  395. },
  396. {
  397. 0xA035,
  398. 0x10,
  399. "Bad Control"
  400. },
  401. {
  402. 0xA041,
  403. 0x01,
  404. "Read Failed"
  405. },
  406. {
  407. 0xA049,
  408. 0x01,
  409. "Loopback Failed"
  410. },
  411. {
  412. 0xA049,
  413. 0x12,
  414. "Bad Message Length"
  415. },
  416. {
  417. 0xA049,
  418. 0x20,
  419. "Bad Transmit Duration"
  420. },
  421. {
  422. 0xA049,
  423. 0x24,
  424. "Already Set"
  425. },
  426. {
  427. 0xA04D,
  428. 0x01,
  429. "Read Failed"
  430. },
  431. {
  432. 0xA051,
  433. 0x10,
  434. "Bad EKS"
  435. },
  436. {
  437. 0xA051,
  438. 0x11,
  439. "Bad PEKS"
  440. },
  441. {
  442. 0xA051,
  443. 0x12,
  444. "Bad PEKS Encrypted Payload"
  445. },
  446. {
  447. 0xA051,
  448. 0x13,
  449. "Remote Failure"
  450. },
  451. {
  452. 0xA051,
  453. 0x14,
  454. "Bad Remote Answer"
  455. },
  456. {
  457. 0xA051,
  458. 0x15,
  459. "Remote Decryption Failed"
  460. },
  461. {
  462. 0xA055,
  463. 0x01,
  464. "Read Failed"
  465. },
  466. {
  467. 0xA059,
  468. 0x10,
  469. "No Flash Memory"
  470. },
  471. {
  472. 0xA05D,
  473. 0x30,
  474. "Bad Checksum"
  475. },
  476. {
  477. 0xA05D,
  478. 0x34,
  479. "BIST Failed"
  480. },
  481. {
  482. 0xA065,
  483. 0x10,
  484. "No Flash Memory"
  485. },
  486. {
  487. 0xA069,
  488. 0x01,
  489. "Read Failed"
  490. },
  491. {
  492. 0xA069,
  493. 0x02,
  494. "Not Supported"
  495. },
  496. {
  497. 0xA06D,
  498. 0x01,
  499. "Bad Control"
  500. },
  501. {
  502. 0xA06D,
  503. 0x02,
  504. "Success Write"
  505. },
  506. {
  507. 0xA06D,
  508. 0x03,
  509. "Bad Write Parameter"
  510. },
  511. {
  512. 0xA06D,
  513. 0x04,
  514. "Bad Port Index"
  515. },
  516. {
  517. 0xA071,
  518. 0x01,
  519. "Bad MAC Address"
  520. },
  521. {
  522. 0xA071,
  523. 0x02,
  524. "Bad Time Slot"
  525. },
  526. {
  527. 0xA079,
  528. 0x01,
  529. "Request Failed"
  530. },
  531. {
  532. 0xA07D,
  533. 0x01,
  534. "Reset Failed"
  535. },
  536. {
  537. 0xA07D,
  538. 0x02,
  539. "Failed to Lock NVM"
  540. },
  541. {
  542. 0xA081,
  543. 0x10,
  544. "Bad Module ID"
  545. },
  546. {
  547. 0xA081,
  548. 0x14,
  549. "No Flash Memory"
  550. },
  551. {
  552. 0xA081,
  553. 0x18,
  554. "Not Enough Flash Memory"
  555. },
  556. {
  557. 0xA081,
  558. 0x1C,
  559. "Bad Image Header Checksum"
  560. },
  561. {
  562. 0xA081,
  563. 0x20,
  564. "Bad Image Checksum"
  565. },
  566. {
  567. 0xA081,
  568. 0x24,
  569. "Bad PIB"
  570. },
  571. {
  572. 0xA081,
  573. 0x28,
  574. "Softloader Too Large"
  575. },
  576. {
  577. 0xA081,
  578. 0x2C,
  579. "Firmware File Too Large"
  580. },
  581. {
  582. 0xA081,
  583. 0x42,
  584. "Firmware without PIB"
  585. },
  586. {
  587. 0xA081,
  588. 0x44,
  589. "Bad PIB Checksum"
  590. },
  591. {
  592. 0xA081,
  593. 0x46,
  594. "DAK Not Zero"
  595. },
  596. {
  597. 0xA081,
  598. 0x48,
  599. "DAC Mismatch"
  600. },
  601. {
  602. 0xA081,
  603. 0x50,
  604. "MFG HFID Mismatch"
  605. },
  606. {
  607. 0xA081,
  608. 0x52,
  609. "Bad Bind Factory Defaults"
  610. },
  611. {
  612. 0xA081,
  613. 0x54,
  614. "Bad Bind Template PIB"
  615. },
  616. {
  617. 0xA081,
  618. 0x56,
  619. "Bad Bind Working PIB"
  620. },
  621. {
  622. 0xA081,
  623. 0x58,
  624. "DAK Mismatch"
  625. },
  626. {
  627. 0xA081,
  628. 0x5A,
  629. "Failed to Lock NVM"
  630. },
  631. {
  632. 0xA085,
  633. 0x01,
  634. "Bad Request Type"
  635. },
  636. {
  637. 0xA085,
  638. 0x02,
  639. "Bad Address Type"
  640. },
  641. {
  642. 0xA085,
  643. 0x03,
  644. "No Such Address"
  645. },
  646. {
  647. 0xA085,
  648. 0x04,
  649. "Table Overflow"
  650. },
  651. {
  652. 0xA085,
  653. 0x05,
  654. "Bad Group Memberhip Info"
  655. },
  656. {
  657. 0xA085,
  658. 0x06,
  659. "Flash Save Error"
  660. },
  661. {
  662. 0xA085,
  663. 0x07,
  664. "Table Not Available"
  665. },
  666. {
  667. 0xA089,
  668. 0x01,
  669. "Bad Control"
  670. },
  671. {
  672. 0xA089,
  673. 0x02,
  674. "Bad Volatility"
  675. },
  676. {
  677. 0xA089,
  678. 0x03,
  679. "Bad Classifier"
  680. },
  681. {
  682. 0xA089,
  683. 0x04,
  684. "Too Many Classifiers"
  685. },
  686. {
  687. 0xA089,
  688. 0x05,
  689. "Duplicate Classifier"
  690. },
  691. {
  692. 0xA089,
  693. 0x06,
  694. "Classifier Not Found"
  695. },
  696. {
  697. 0xA089,
  698. 0x07,
  699. "Link Update In Progress"
  700. },
  701. {
  702. 0xA089,
  703. 0x08,
  704. "Bad Configuration"
  705. },
  706. {
  707. 0xA089,
  708. 0x10,
  709. "Invalid CSPEC Version"
  710. },
  711. {
  712. 0xA089,
  713. 0x11,
  714. "Invalid CSPEC"
  715. },
  716. {
  717. 0xA089,
  718. 0x1F,
  719. "Invalid CSPEC - Proposed *"
  720. },
  721. {
  722. 0xA08D,
  723. 0x10,
  724. "Refused Host Connetcion *"
  725. },
  726. {
  727. 0xA08D,
  728. 0x11,
  729. "Refused AVLN Size *"
  730. },
  731. {
  732. 0xA08F,
  733. 0x10,
  734. "Error"
  735. },
  736. {
  737. 0xA091,
  738. 0x01,
  739. "Unknown Peer Address"
  740. },
  741. {
  742. 0xA091,
  743. 0x02,
  744. "Unknown Slot Number"
  745. },
  746. {
  747. 0xA095,
  748. 0x01,
  749. "Request Failed"
  750. },
  751. {
  752. 0xA099,
  753. 0x01,
  754. "Destination Address Misaligned"
  755. },
  756. {
  757. 0xA099,
  758. 0x02,
  759. "Entry Point Misaligned"
  760. },
  761. {
  762. 0xA099,
  763. 0x04,
  764. "Entry Point Out-of-Bounds"
  765. },
  766. {
  767. 0xA099,
  768. 0x08,
  769. "Bad Checksum"
  770. },
  771. {
  772. 0xA099,
  773. 0x10,
  774. "Out of Memory"
  775. },
  776. {
  777. 0xA099,
  778. 0x20,
  779. "Offset or Length Mismatch"
  780. },
  781. {
  782. 0xA099,
  783. 0x40,
  784. "Memory not Operational"
  785. },
  786. {
  787. 0xA099,
  788. 0x80,
  789. "Bad Length"
  790. },
  791. #if 1
  792. /*
  793. * [MPM] Not sure if this should be included
  794. */
  795. {
  796. 0xA09D,
  797. 0x00,
  798. "Can't Read *"
  799. },
  800. #endif
  801. {
  802. 0xA09D,
  803. 0x01,
  804. "Can't Write *"
  805. },
  806. {
  807. 0xA09D,
  808. 0x02,
  809. "Can't Read Switch *"
  810. },
  811. {
  812. 0xA09D,
  813. 0x03,
  814. "Can't Write Switch *"
  815. },
  816. {
  817. 0xA0A1,
  818. 0x01,
  819. "Request Failed"
  820. },
  821. {
  822. 0xA0A5,
  823. 0x01,
  824. "Request Failed"
  825. },
  826. {
  827. 0xA0A9,
  828. 0x01,
  829. "Request Failed"
  830. },
  831. {
  832. 0xA0AD,
  833. 0x01,
  834. "Request Failed"
  835. },
  836. {
  837. 0xA0B1,
  838. 0x10,
  839. "Bad Number of Module Operations"
  840. },
  841. {
  842. 0xA0B1,
  843. 0x11,
  844. "Bad Module Operation ID"
  845. },
  846. {
  847. 0xA0B1,
  848. 0x12,
  849. "Bad Session ID"
  850. },
  851. {
  852. 0xA0B1,
  853. 0x13,
  854. "Bad Num Module Operation Specific Data"
  855. },
  856. {
  857. 0xA0B1,
  858. 0x14,
  859. "Module ID not found"
  860. },
  861. {
  862. 0xA0B1,
  863. 0x15,
  864. "Bad Module Length"
  865. },
  866. {
  867. 0xA0B1,
  868. 0x16,
  869. "Bad Module Index"
  870. },
  871. {
  872. 0xA0B1,
  873. 0x17,
  874. "Bad Data Length"
  875. },
  876. {
  877. 0xA0B1,
  878. 0x18,
  879. "Unexpected Offset"
  880. },
  881. {
  882. 0xA0B1,
  883. 0x19,
  884. "Bad Commit Action Code"
  885. },
  886. {
  887. 0xA0B1,
  888. 0x1A,
  889. "Operation Block by previous Commit"
  890. },
  891. {
  892. 0xA0B1,
  893. 0x1B,
  894. "Duplicate ModuleID/SubID"
  895. },
  896. {
  897. 0xA0B1,
  898. 0x1C,
  899. "Bad ModuleID/SubID"
  900. },
  901. {
  902. 0xA0B1,
  903. 0x20,
  904. "No Flash Memory"
  905. },
  906. {
  907. 0xA0B1,
  908. 0x21,
  909. "Not Enough Flash Memory"
  910. },
  911. {
  912. 0xA0B1,
  913. 0x22,
  914. "Unsupported Flash memory Type"
  915. },
  916. {
  917. 0xA0B1,
  918. 0x23,
  919. "Can't Lock Flash Memory"
  920. },
  921. {
  922. 0xA0B1,
  923. 0x24,
  924. "Can't Write Flash Memory"
  925. },
  926. {
  927. 0xA0B1,
  928. 0x30,
  929. "Bad Module Checksum"
  930. },
  931. {
  932. 0xA0B1,
  933. 0x31,
  934. "Individual Module Error"
  935. },
  936. {
  937. 0xA0B1,
  938. 0x32,
  939. "Module not available in NVM or Memory"
  940. },
  941. {
  942. 0xA0B1,
  943. 0x40,
  944. "Bad Header Checksum"
  945. },
  946. {
  947. 0xA0B1,
  948. 0x41,
  949. "Bad Firmware Image Checksum"
  950. },
  951. {
  952. 0xA0B1,
  953. 0x42,
  954. "Softloader Image is Too Large"
  955. },
  956. {
  957. 0xA0B1,
  958. 0x43,
  959. "Firmware Image is Too Large"
  960. },
  961. {
  962. 0xA0B1,
  963. 0x44,
  964. "Bad PIB Checksum"
  965. },
  966. {
  967. 0xA0B1,
  968. 0x45,
  969. "No Firmware Version"
  970. },
  971. {
  972. 0xA0B1,
  973. 0x46,
  974. "FW Commit but no PIB"
  975. },
  976. {
  977. 0xA0B1,
  978. 0x47,
  979. "Major Version Mismatch"
  980. },
  981. {
  982. 0xA0B1,
  983. 0x48,
  984. "Minor Version Mismatch"
  985. },
  986. {
  987. 0xA0B1,
  988. 0x50,
  989. "Bad PIB"
  990. },
  991. {
  992. 0xA0B1,
  993. 0x51,
  994. "DAK Not Zero"
  995. },
  996. {
  997. 0xA0B1,
  998. 0x52,
  999. "MAC Mismatch"
  1000. },
  1001. {
  1002. 0xA0B1,
  1003. 0x53,
  1004. "DAK Mismatch"
  1005. },
  1006. {
  1007. 0xA0B1,
  1008. 0x54,
  1009. "Manufacturer HFID Mismatch"
  1010. },
  1011. {
  1012. 0xA0B1,
  1013. 0x55,
  1014. "Bad Bind to Factory Default PIB"
  1015. },
  1016. {
  1017. 0xA0B1,
  1018. 0x56,
  1019. "Bad Bind to Template PIB"
  1020. },
  1021. {
  1022. 0xA0B1,
  1023. 0x57,
  1024. "Bad Bind to Working PIB"
  1025. },
  1026. {
  1027. 0xA0B1,
  1028. 0x58,
  1029. "Bad Bind Scratch PIB"
  1030. },
  1031. {
  1032. 0xA0B1,
  1033. 0x59,
  1034. "Error Generating Checksum Scratch PIB"
  1035. },
  1036. {
  1037. 0xA0B1,
  1038. 0x5A,
  1039. "Checksum Error O1 PIB"
  1040. },
  1041. {
  1042. 0xA0B1,
  1043. 0x5B,
  1044. "Checksum Error O2 PIB"
  1045. },
  1046. {
  1047. 0xA0B1,
  1048. 0x5C,
  1049. "Checksum Error Working PIB"
  1050. },
  1051. {
  1052. 0xA0B1,
  1053. 0x61,
  1054. "Unexpected Module Operation"
  1055. },
  1056. {
  1057. 0xA0B1,
  1058. 0x62,
  1059. "Not Enough Resources"
  1060. },
  1061. {
  1062. 0xA0B1,
  1063. 0x63,
  1064. "Received Module Data Out of Order"
  1065. },
  1066. {
  1067. 0xA0B1,
  1068. 0x64,
  1069. "No PIB Version"
  1070. },
  1071. {
  1072. 0xA0B1,
  1073. 0x70,
  1074. "Module Length Mismatch with Module Info"
  1075. },
  1076. {
  1077. 0xA0B1,
  1078. 0x71,
  1079. "No NVM Softloader Present in Flash Memory"
  1080. },
  1081. {
  1082. 0xA0B1,
  1083. 0x72,
  1084. "Cookie Mismatch"
  1085. },
  1086. {
  1087. 0xA0B1,
  1088. 0x73,
  1089. "Blocked Previous Read"
  1090. },
  1091. {
  1092. 0xA0B1,
  1093. 0xFF,
  1094. "Unknown Error"
  1095. },
  1096. {
  1097. 0xA0B9,
  1098. 0x01,
  1099. "Request Failed *"
  1100. },
  1101. {
  1102. 0xA0BD,
  1103. 0x01,
  1104. "Bad Control"
  1105. },
  1106. {
  1107. 0xA0BD,
  1108. 0x10,
  1109. "Bad Output GPIO Index"
  1110. },
  1111. {
  1112. 0xA0BD,
  1113. 0x20,
  1114. "Pattern Number Not Found"
  1115. },
  1116. {
  1117. 0xA0C1,
  1118. 0x01,
  1119. "Bad Control"
  1120. },
  1121. {
  1122. 0xA0C1,
  1123. 0x02,
  1124. "Bad Volatility"
  1125. },
  1126. {
  1127. 0xA0C1,
  1128. 0x03,
  1129. "Bad Classifier"
  1130. },
  1131. {
  1132. 0xA0C1,
  1133. 0x04,
  1134. "Already too many Classifiers"
  1135. },
  1136. {
  1137. 0xA0C1,
  1138. 0x05,
  1139. "Classifier exists with different Classification Action"
  1140. },
  1141. {
  1142. 0xA0C1,
  1143. 0x06,
  1144. "Not Found"
  1145. },
  1146. {
  1147. 0xA0C1,
  1148. 0x07,
  1149. "Link Already in Progress"
  1150. },
  1151. {
  1152. 0xA0C1,
  1153. 0x08,
  1154. "Bad Configuration"
  1155. },
  1156. {
  1157. 0xA0C1,
  1158. 0x10,
  1159. "Bad CSPEC Version"
  1160. },
  1161. {
  1162. 0xA0C1,
  1163. 0x11,
  1164. "Bad CSPEC"
  1165. },
  1166. {
  1167. 0xA0C1,
  1168. 0x1F,
  1169. "Bad CSPEC_PropCSPEC"
  1170. },
  1171. {
  1172. 0xA0C1,
  1173. 0x20,
  1174. "Out of Local Resources"
  1175. },
  1176. {
  1177. 0xA0C1,
  1178. 0x2F,
  1179. "No Local Resource_PropCSPEC"
  1180. },
  1181. {
  1182. 0xA0C1,
  1183. 0x30,
  1184. "Bad Peer"
  1185. },
  1186. {
  1187. 0xA0C1,
  1188. 0x31,
  1189. "Peer Confirm Timed out"
  1190. },
  1191. {
  1192. 0xA0C1,
  1193. 0x40,
  1194. "Peer rejection"
  1195. },
  1196. {
  1197. 0XA0C1,
  1198. 0x4F,
  1199. "Peer Rejection_PropCSPEC"
  1200. },
  1201. {
  1202. 0xA0C5,
  1203. 0x01,
  1204. "Bad Control"
  1205. },
  1206. {
  1207. 0xA0C5,
  1208. 0x02,
  1209. "Bad Volatility"
  1210. },
  1211. {
  1212. 0xA0C5,
  1213. 0x03,
  1214. "Bad Classifier"
  1215. },
  1216. {
  1217. 0xA0C5,
  1218. 0x04,
  1219. "Already too many Classifiers"
  1220. },
  1221. {
  1222. 0xA0C5,
  1223. 0x05,
  1224. "Classifier exists with different Classification Action"
  1225. },
  1226. {
  1227. 0xA0C5,
  1228. 0x06,
  1229. "Not Found"
  1230. },
  1231. {
  1232. 0xA0C5,
  1233. 0x07,
  1234. "Link Already in Progress"
  1235. },
  1236. {
  1237. 0xA0C5,
  1238. 0x08,
  1239. "Bad Configuration"
  1240. },
  1241. {
  1242. 0xA0C5,
  1243. 0x10,
  1244. "Bad CSPEC Version"
  1245. },
  1246. {
  1247. 0xA0C5,
  1248. 0x11,
  1249. "Bad CSPEC"
  1250. },
  1251. {
  1252. 0xA0C5,
  1253. 0x1F,
  1254. "Bad CSPEC_PropCSPEC"
  1255. },
  1256. {
  1257. 0xA0C5,
  1258. 0x20,
  1259. "Out of Local Resources"
  1260. },
  1261. {
  1262. 0xA0C5,
  1263. 0x2F,
  1264. "No Local Resource_PropCSPEC"
  1265. },
  1266. {
  1267. 0xA0C5,
  1268. 0x30,
  1269. "Bad Peer"
  1270. },
  1271. {
  1272. 0xA0C5,
  1273. 0x31,
  1274. "Peer Confirm Timed out"
  1275. },
  1276. {
  1277. 0xA0C5,
  1278. 0x40,
  1279. "Peer rejection"
  1280. },
  1281. {
  1282. 0xA0C5,
  1283. 0x4F,
  1284. "Peer Rejection_PropCSPEC"
  1285. },
  1286. {
  1287. 0xA0C9,
  1288. 0x06,
  1289. "CID Not Found"
  1290. },
  1291. {
  1292. 0xA0C9,
  1293. 0x07,
  1294. "Link Update in Progress. Try again later"
  1295. },
  1296. {
  1297. 0xA0C9,
  1298. 0x31,
  1299. "Peer Confirm Timed out"
  1300. },
  1301. {
  1302. 0xA0CD,
  1303. 0x01,
  1304. "Bad Request Type"
  1305. },
  1306. {
  1307. 0xA0CD,
  1308. 0x04,
  1309. "Too Many Requests",
  1310. },
  1311. {
  1312. 0xA0CD,
  1313. 0x06,
  1314. "CID Not Found"
  1315. },
  1316. {
  1317. 0xA0CD,
  1318. 0x10,
  1319. "Bad CSPEC Version"
  1320. },
  1321. {
  1322. 0xA0CD,
  1323. 0x31,
  1324. "Peer Confirm Timed out"
  1325. },
  1326. {
  1327. 0xA0D1,
  1328. 0x01,
  1329. "Unsupported"
  1330. },
  1331. {
  1332. 0xA0D1,
  1333. 0x02,
  1334. "Process Failed"
  1335. },
  1336. {
  1337. 0xA0D9,
  1338. 0x01,
  1339. "Bad VersionID or InfoID"
  1340. },
  1341. {
  1342. 0xA0D9,
  1343. 0x02,
  1344. "Unknown Error"
  1345. },
  1346. {
  1347. 0xA0DD,
  1348. 0x01,
  1349. "No Enumeration Table"
  1350. },
  1351. {
  1352. 0xA0E1,
  1353. 0x01,
  1354. "Abort Standby Mode"
  1355. },
  1356. {
  1357. 0xA0E1,
  1358. 0x02,
  1359. "Wait and Try Again"
  1360. },
  1361. {
  1362. 0xA0E1,
  1363. 0x03,
  1364. "Feature Disabled"
  1365. },
  1366. {
  1367. 0xA0E1,
  1368. 0x04,
  1369. "Bad Operation ID"
  1370. },
  1371. {
  1372. 0xA0E1,
  1373. 0x05,
  1374. "Bad Sleep Schedule"
  1375. },
  1376. {
  1377. 0xA0E1,
  1378. 0x06,
  1379. "Bad Scan Time"
  1380. },
  1381. {
  1382. 0xA0E5,
  1383. 0x01,
  1384. "Feature Disabled"
  1385. },
  1386. /*
  1387. * [MPM] 0xA0F1 was missing
  1388. */
  1389. {
  1390. 0xA0F1,
  1391. 0x01,
  1392. "Request Failed"
  1393. },
  1394. {
  1395. 0xA0F1,
  1396. 0x02,
  1397. "Microcontroller Busy"
  1398. },
  1399. {
  1400. 0xA0F1,
  1401. 0x03,
  1402. "Feature Disabled"
  1403. },
  1404. {
  1405. 0xA0F1,
  1406. 0x04,
  1407. "Bad Parameter"
  1408. },
  1409. {
  1410. 0xA0F5,
  1411. 0x01,
  1412. "Bad Request Type"
  1413. },
  1414. {
  1415. 0xA0F5,
  1416. 0x02,
  1417. "FMI Not Zero"
  1418. },
  1419. {
  1420. 0xA0F5,
  1421. 0x03,
  1422. "Bad Command"
  1423. },
  1424. {
  1425. 0xA0F5,
  1426. 0x04,
  1427. "Bad Index"
  1428. },
  1429. {
  1430. 0xA0F5,
  1431. 0x05,
  1432. "Bad Value Count"
  1433. },
  1434. {
  1435. 0xA0F5,
  1436. 0x06,
  1437. "Capture Already Started"
  1438. },
  1439. {
  1440. 0xA0F5,
  1441. 0x07,
  1442. "Data Invalid"
  1443. },
  1444. {
  1445. 0xA0F5,
  1446. 0x08,
  1447. "Bad Gain Value"
  1448. },
  1449. {
  1450. 0xA0F5,
  1451. 0x09,
  1452. "Bad Coupling"
  1453. },
  1454. {
  1455. 0xA0F5,
  1456. 0x10,
  1457. "Bad MAC Address"
  1458. },
  1459. {
  1460. 0xA0F5,
  1461. 0x11,
  1462. "Bad Tone Map Index"
  1463. },
  1464. {
  1465. 0xA0F5,
  1466. 0x12,
  1467. "Capture Failed"
  1468. },
  1469. {
  1470. 0xA0F5,
  1471. 0x13,
  1472. "No Data Available"
  1473. },
  1474. {
  1475. 0xA0F9,
  1476. 0x01,
  1477. "Get Property Failure"
  1478. },
  1479. {
  1480. 0xA0F9,
  1481. 0x02,
  1482. "Unsupported Property"
  1483. },
  1484. {
  1485. 0xA0F9,
  1486. 0x03,
  1487. "Unsupported Property Version"
  1488. },
  1489. {
  1490. 0xA101,
  1491. 0x01,
  1492. "Set Property Failure"
  1493. },
  1494. {
  1495. 0xA101,
  1496. 0x02,
  1497. "Unsupported Property"
  1498. },
  1499. {
  1500. 0xA101,
  1501. 0x03,
  1502. "Unsupported Property Version"
  1503. },
  1504. {
  1505. 0xA101,
  1506. 0x04,
  1507. "Property Not Persistent"
  1508. },
  1509. {
  1510. 0xA101,
  1511. 0x05,
  1512. "Flash Memory Failure"
  1513. },
  1514. {
  1515. 0xA101,
  1516. 0x06,
  1517. "Bad Option for Supported Property"
  1518. },
  1519. {
  1520. 0xA101,
  1521. 0x07,
  1522. "Bad Property Data"
  1523. },
  1524. {
  1525. 0xA101,
  1526. 0x08,
  1527. "Bad Property Data Length"
  1528. },
  1529. {
  1530. 0xA105,
  1531. 0x01,
  1532. "Buffer Not Available"
  1533. },
  1534. {
  1535. 0xA109,
  1536. 0x01,
  1537. "No Flash Memory"
  1538. },
  1539. {
  1540. 0xA109,
  1541. 0x02,
  1542. "Bad Flash Sector"
  1543. },
  1544. {
  1545. 0xA109,
  1546. 0x03,
  1547. "Current DAK Mismatch"
  1548. },
  1549. {
  1550. 0xA109,
  1551. 0x04,
  1552. "Flash is Busy"
  1553. },
  1554. {
  1555. 0xA109,
  1556. 0x05,
  1557. "No Access to Flash"
  1558. },
  1559. {
  1560. 0xA109,
  1561. 0x06,
  1562. "Unsupported Chip"
  1563. },
  1564. {
  1565. 0xA109,
  1566. 0x07,
  1567. "Unspecified Error"
  1568. },
  1569. {
  1570. 0xA10D,
  1571. 0x01,
  1572. "Option Not Supported"
  1573. },
  1574. {
  1575. 0xA10D,
  1576. 0x02,
  1577. "No Flash Memory"
  1578. },
  1579. {
  1580. 0xA10D,
  1581. 0x03,
  1582. "Pending Self Test"
  1583. },
  1584. {
  1585. 0xA10D,
  1586. 0x04,
  1587. "Flash Activity Conflict"
  1588. },
  1589. {
  1590. 0xA10D,
  1591. 0x05,
  1592. "Bad Parameter"
  1593. },
  1594. {
  1595. 0xA111,
  1596. 0x01,
  1597. "Option Not Supported"
  1598. },
  1599. {
  1600. 0xA111,
  1601. 0x02,
  1602. "Self Test Finished"
  1603. },
  1604. {
  1605. 0xA111,
  1606. 0x03,
  1607. "Self Test Pending"
  1608. },
  1609. {
  1610. 0xA111,
  1611. 0x04,
  1612. "Self Test In Progress"
  1613. },
  1614. {
  1615. 0xA111,
  1616. 0x05,
  1617. "Self Test No Result"
  1618. },
  1619. {
  1620. 0xA111,
  1621. 0x06,
  1622. "Self Test Aborted"
  1623. },
  1624. {
  1625. 0xA111,
  1626. 0x07,
  1627. "No Flash Memory"
  1628. },
  1629. {
  1630. 0xA115,
  1631. 0x01,
  1632. "Interface Not Supported"
  1633. },
  1634. {
  1635. 0xA115,
  1636. 0x02,
  1637. "Slave Not Found"
  1638. },
  1639. {
  1640. 0xA115,
  1641. 0x03,
  1642. "Wrong Parameter"
  1643. },
  1644. {
  1645. 0xA119,
  1646. 0x01,
  1647. "Bad Version"
  1648. },
  1649. {
  1650. 0xA119,
  1651. 0x02,
  1652. "Bad Argument"
  1653. },
  1654. {
  1655. 0xA119,
  1656. 0x03,
  1657. "Too Many Slaves"
  1658. },
  1659. {
  1660. 0xA119,
  1661. 0x04,
  1662. "Too Many VLAN IDs"
  1663. },
  1664. {
  1665. 0xA119,
  1666. 0x05,
  1667. "No Such Slave"
  1668. },
  1669. {
  1670. 0xA119,
  1671. 0x06,
  1672. "Flash Operation Blocked"
  1673. },
  1674. {
  1675. 0xA119,
  1676. 0x07,
  1677. "Unsupported Operation"
  1678. },
  1679. {
  1680. 0xA119,
  1681. 0x08,
  1682. "Flash Activity Conflict"
  1683. },
  1684. {
  1685. 0xA119,
  1686. 0x09,
  1687. "Table Busy"
  1688. },
  1689. {
  1690. 0xA119,
  1691. 0x0A,
  1692. "One Slave Has Duplicate VLAN ID"
  1693. },
  1694. {
  1695. 0xA119,
  1696. 0x0B,
  1697. "Multiple Slaves Have Same VLAN ID"
  1698. },
  1699. {
  1700. 0xA119,
  1701. 0x0C,
  1702. "Multiple Configurations for One Slave"
  1703. },
  1704. {
  1705. 0xA119,
  1706. 0x0D,
  1707. "Can't set VLAN ID for Local Station"
  1708. },
  1709. {
  1710. 0xA119,
  1711. 0x0E,
  1712. "Bad Data Offset"
  1713. },
  1714. {
  1715. 0xA119,
  1716. 0x0F,
  1717. "Bad Data Length"
  1718. },
  1719. {
  1720. 0xA119,
  1721. 0x10,
  1722. "VLAN ID Has Been Configured"
  1723. },
  1724. {
  1725. 0xA119,
  1726. 0x11,
  1727. "Bad MME Source"
  1728. },
  1729. {
  1730. 0xA119,
  1731. 0x12,
  1732. "VLAN ID out of range"
  1733. },
  1734. {
  1735. 0xA119,
  1736. 0x13,
  1737. "Cannot remove nonexistent VLAN ID"
  1738. },
  1739. {
  1740. 0xA149,
  1741. 0x1,
  1742. "Bad Key Length"
  1743. },
  1744. {
  1745. 0xA149,
  1746. 0x2,
  1747. "Bad Key"
  1748. },
  1749. {
  1750. 0xA149,
  1751. 0x3,
  1752. "Bad Access Type"
  1753. },
  1754. {
  1755. 0xA149,
  1756. 0x4,
  1757. "Bad Level Control"
  1758. },
  1759. {
  1760. 0xA151,
  1761. 0x01,
  1762. "Bad DA"
  1763. },
  1764. {
  1765. 0xA151,
  1766. 0x02,
  1767. "Wire Tap Enabled By Another Host"
  1768. },
  1769. {
  1770. 0xA151,
  1771. 0x03,
  1772. "Configuration Security Is Level 1 or Higher"
  1773. },
  1774. {
  1775. 0xA151,
  1776. 0x04,
  1777. "Bad Time Period"
  1778. },
  1779. {
  1780. 0xA151,
  1781. 0x05,
  1782. "Bad Settings"
  1783. },
  1784. {
  1785. 0xA151,
  1786. 0x06,
  1787. "MME Buffer Allocation Failed"
  1788. },
  1789. {
  1790. 0xA151,
  1791. 0x07,
  1792. "WireTap Feature Turned OFF in PIB" /*
  1793. *[MPM] Check for Error Code 0xA155
  1794. */
  1795. },
  1796. {
  1797. 0xA155,
  1798. 0x02,
  1799. "RBAT Is Full"
  1800. },
  1801. {
  1802. 0xA155,
  1803. 0x04,
  1804. "LBAT Is Full"
  1805. },
  1806. {
  1807. 0xA155,
  1808. 0x08,
  1809. "Bad DA MAC"
  1810. },
  1811. {
  1812. 0xA155,
  1813. 0x10,
  1814. "Bad PLC MAc"
  1815. },
  1816. {
  1817. 0xA155,
  1818. 0x20,
  1819. "Bad Interface ID"
  1820. },
  1821. {
  1822. 0xA155,
  1823. 0x40,
  1824. "Bad Operation"
  1825. },
  1826. {
  1827. 0xA15B,
  1828. 0x01,
  1829. "Request Failed"
  1830. },
  1831. {
  1832. 0xA15B,
  1833. 0x02,
  1834. "Abort"
  1835. },
  1836. {
  1837. 0xA201,
  1838. 0x01,
  1839. "Bad Request Type"
  1840. },
  1841. {
  1842. 0xA201,
  1843. 0x02,
  1844. "Data Collection Disabled"
  1845. }
  1846. };
  1847. #endif
  1848. /*====================================================================*
  1849. *
  1850. * void MMETest ();
  1851. *
  1852. * mme.h
  1853. *
  1854. * check the order of the MME type and code fields;
  1855. *
  1856. *--------------------------------------------------------------------*/
  1857. void MMETest ()
  1858. {
  1859. unsigned mme;
  1860. for (mme = 1; mme < SIZEOF (mme_codes); mme++)
  1861. {
  1862. if (mme_codes [mme].type > mme_codes [mme - 1].type)
  1863. {
  1864. continue;
  1865. }
  1866. if (mme_codes [mme].type < mme_codes [mme - 1].type)
  1867. {
  1868. error (0, 0, "TYPE 0x%04X CODE 0x%02X is out of order.", mme_codes [mme].type, mme_codes [mme].code);
  1869. continue;
  1870. }
  1871. if (mme_codes [mme].code > mme_codes [mme - 1].code)
  1872. {
  1873. continue;
  1874. }
  1875. if (mme_codes [mme].code < mme_codes [mme - 1].code)
  1876. {
  1877. error (0, 0, "TYPE 0x%04X CODE 0x%02X is out of order.", mme_codes [mme].type, mme_codes [mme].code);
  1878. continue;
  1879. }
  1880. error (0, 0, "TYPE 0x%04X CODE 0x%02X is a duplcate.", mme_codes [mme].type, mme_codes [mme].code);
  1881. }
  1882. return;
  1883. }
  1884. /*====================================================================*
  1885. *
  1886. * char const * MMECode (uint16_t MMTYPE, uint8_t MSTATUS)
  1887. *
  1888. * mme.h
  1889. *
  1890. * return text for a given message type and status code; search is
  1891. * performed using two nested binary searches;
  1892. *
  1893. * D
  1894. * a given vendor specific status code may mean something different
  1895. * for each message type; this table maps message types and codes to
  1896. * strings; it is bulky but takes less space than many small tables;
  1897. * define MMEPASSFAIL as 0 to suppress the table without disturbing
  1898. * other code;
  1899. *
  1900. * the bootloader and firmware share some message types but return
  1901. * different status codes for the same message type and error; two
  1902. * MMEs in particular, VS_WR_MEM and VS_ST_MAC are normally used
  1903. * only with the Bootloader and so we define SOFTLOADER as 1
  1904. * causing Bootloader/Softloader codes to replace the firmware
  1905. * codes;
  1906. *
  1907. * Contributor(s):
  1908. * Charles Maier <cmaier@qca.qualcomm.com>
  1909. *
  1910. *--------------------------------------------------------------------*/
  1911. char const * MMECode (uint16_t MMTYPE, uint8_t MSTATUS)
  1912. {
  1913. #ifndef MMEPASSFAIL
  1914. size_t lower = 0;
  1915. size_t upper = SIZEOF (mme_codes);
  1916. MMTYPE = LE16TOH (MMTYPE);
  1917. while (lower < upper)
  1918. {
  1919. size_t index = (lower + upper) >> 1;
  1920. signed order = MMTYPE - mme_codes [index].type;
  1921. if (order < 0)
  1922. {
  1923. upper = index - 0;
  1924. continue;
  1925. }
  1926. if (order > 0)
  1927. {
  1928. lower = index + 1;
  1929. continue;
  1930. }
  1931. for (lower = index; lower > 0; lower--)
  1932. {
  1933. if (mme_codes [lower - 1].type != mme_codes [index].type)
  1934. {
  1935. break;
  1936. }
  1937. }
  1938. for (upper = index; upper < SIZEOF (mme_codes); upper++)
  1939. {
  1940. if (mme_codes [upper + 0].type != mme_codes [index].type)
  1941. {
  1942. break;
  1943. }
  1944. }
  1945. while (lower < upper)
  1946. {
  1947. index = (lower + upper) >> 1;
  1948. order = MSTATUS - mme_codes [index].code;
  1949. if (order < 0)
  1950. {
  1951. upper = index - 0;
  1952. continue;
  1953. }
  1954. if (order > 0)
  1955. {
  1956. lower = index + 1;
  1957. continue;
  1958. }
  1959. return (mme_codes [index].text);
  1960. }
  1961. }
  1962. #endif
  1963. return ((MSTATUS)? ("Failure"): ("Success"));
  1964. }
  1965. #endif