MMECode.c 17 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529
  1. /*====================================================================*
  2. *
  3. * Copyright (c) 2013 Qualcomm Atheros, Inc.
  4. *
  5. * All rights reserved.
  6. *
  7. * Redistribution and use in source and binary forms, with or
  8. * without modification, are permitted (subject to the limitations
  9. * in the disclaimer below) provided that the following conditions
  10. * are met:
  11. *
  12. * * Redistributions of source code must retain the above copyright
  13. * notice, this list of conditions and the following disclaimer.
  14. *
  15. * * Redistributions in binary form must reproduce the above
  16. * copyright notice, this list of conditions and the following
  17. * disclaimer in the documentation and/or other materials
  18. * provided with the distribution.
  19. *
  20. * * Neither the name of Qualcomm Atheros nor the names of
  21. * its contributors may be used to endorse or promote products
  22. * derived from this software without specific prior written
  23. * permission.
  24. *
  25. * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
  26. * GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE
  27. * COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
  28. * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  29. * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
  30. * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
  31. * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  32. * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
  33. * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  34. * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  35. * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
  36. * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
  37. * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  38. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  39. *
  40. *--------------------------------------------------------------------*/
  41. /*====================================================================*
  42. *
  43. * char const * MMECode (uint16_t MMTYPE, uint8_t MSTATUS)
  44. *
  45. * mme.h
  46. *
  47. * return text for a given message type and status code; search is
  48. * performed using two nested binary searches;
  49. *
  50. D
  51. * a given vendor specific status code may mean something different
  52. * for each message type; this table maps message types and codes to
  53. * strings; it is bulky but takes less space than many small tables;
  54. * define MMEPASSFAIL as 0 to suppress the table without disturbing
  55. * other code;
  56. *
  57. * the bootloader and firmware share some message types but return
  58. * different status codes for the same message type and error; two
  59. * MMEs in particular, VS_WR_MEM and VS_ST_MAC are normally used
  60. * only with the Bootloader and so we define SOFTLOADER as 1
  61. * causing Bootloader/Softloader codes to replace the firmware
  62. * codes;
  63. *
  64. *
  65. * Contributor(s):
  66. * Charles Maier
  67. *
  68. *--------------------------------------------------------------------*/
  69. #ifndef MMECODE_SOURCE
  70. #define MMECODE_SOURCE
  71. #include <stdio.h>
  72. #include <stdint.h>
  73. #include "../mme/mme.h"
  74. #include "../tools/symbol.h"
  75. #include "../tools/endian.h"
  76. #ifndef MMEPASSFAIL
  77. static struct mme_code
  78. {
  79. uint16_t type;
  80. uint8_t code;
  81. char const * text;
  82. }
  83. mme_codes [] =
  84. {
  85. {
  86. 0x8005,
  87. 0x01,
  88. "Read Stopped"
  89. },
  90. {
  91. 0x8005,
  92. 0x03,
  93. "Stopped with Valid Read"
  94. },
  95. {
  96. 0x8005,
  97. 0x05,
  98. "Reached End"
  99. },
  100. {
  101. 0x8005,
  102. 0x07,
  103. "Stopped, Valid Read, Reached End - All Done! Go Away!"
  104. },
  105. {
  106. 0x8005,
  107. 0x80,
  108. "Invalid Index"
  109. },
  110. {
  111. 0x8005,
  112. 0x81,
  113. "Invalid Word Count"
  114. },
  115. {
  116. 0x8005,
  117. 0x82,
  118. "No Stop Before Read"
  119. },
  120. {
  121. 0x8005,
  122. 0x83,
  123. "Invalid MME"
  124. },
  125. #ifdef SOFTLOADER
  126. {
  127. 0xA005,
  128. 0x14,
  129. "Bad Checksum"
  130. },
  131. {
  132. 0xA005,
  133. 0x1C,
  134. "Bad Length"
  135. },
  136. {
  137. 0xA005,
  138. 0x38,
  139. "Bad Address"
  140. },
  141. {
  142. 0xA005,
  143. 0x3C,
  144. "Bad Data Alignment"
  145. },
  146. #else
  147. {
  148. 0xA005,
  149. 0x10,
  150. "Bad Address"
  151. },
  152. {
  153. 0xA005,
  154. 0x14,
  155. "Bad Length"
  156. },
  157. #endif
  158. {
  159. 0xA009,
  160. 0x10,
  161. "Bad Offset"
  162. },
  163. {
  164. 0xA009,
  165. 0x14,
  166. "Bad Length"
  167. },
  168. {
  169. 0xA00D,
  170. 0x10,
  171. "Bad Module ID"
  172. },
  173. #ifdef SOFTLOADER
  174. {
  175. 0xA00D,
  176. 0x14,
  177. "Bad Image Checksum"
  178. },
  179. {
  180. 0xA00D,
  181. 0x1C,
  182. "Bad Image Length"
  183. },
  184. {
  185. 0xA00D,
  186. 0x38,
  187. "Bad Image Load Address"
  188. },
  189. {
  190. 0xA00D,
  191. 0x3C,
  192. "Bad Data Alignment"
  193. },
  194. {
  195. 0xA00D,
  196. 0x40,
  197. "Bad Start Address"
  198. },
  199. #else
  200. {
  201. 0xA00D,
  202. 0x38,
  203. "Bad Command"
  204. },
  205. {
  206. 0xA00D,
  207. 0x40,
  208. "Failed to Lock NVM"
  209. },
  210. #endif
  211. {
  212. 0xA011,
  213. 0x10,
  214. "No Flash Memory"
  215. },
  216. {
  217. 0xA01D,
  218. 0x01,
  219. "Device Failed to Reset"
  220. },
  221. {
  222. 0xA01D,
  223. 0x02,
  224. "Device is Busy"
  225. },
  226. {
  227. 0xA021,
  228. 0x10,
  229. "Bad Module"
  230. },
  231. {
  232. 0xA021,
  233. 0x12,
  234. "Bad Length"
  235. },
  236. {
  237. 0xA021,
  238. 0x14,
  239. "Bad Checksum"
  240. },
  241. {
  242. 0xA021,
  243. 0x20,
  244. "Bad Offset"
  245. },
  246. {
  247. 0xA021,
  248. 0x40,
  249. "Operation Blocked"
  250. },
  251. {
  252. 0xA021,
  253. 0x50,
  254. "Fail to lock NVM"
  255. },
  256. {
  257. 0xA025,
  258. 0x10,
  259. "Bad Module"
  260. },
  261. {
  262. 0xA025,
  263. 0x12,
  264. "Bad Length"
  265. },
  266. {
  267. 0xA025,
  268. 0x14,
  269. "Bad Checksum"
  270. },
  271. {
  272. 0xA025,
  273. 0x20,
  274. "Unexpected Offset"
  275. },
  276. {
  277. 0xA025,
  278. 0x50,
  279. "Fail to lock NVM"
  280. },
  281. {
  282. 0xA025,
  283. 0x58,
  284. "DAK Mismatch"
  285. },
  286. {
  287. 0xA029,
  288. 0x10,
  289. "Bad Module"
  290. },
  291. {
  292. 0xA029,
  293. 0x14,
  294. "No Flash Memory"
  295. },
  296. {
  297. 0xA029,
  298. 0x18,
  299. "Not enough NVRAM"
  300. },
  301. {
  302. 0xA029,
  303. 0x1C,
  304. "Bad Header Checksum"
  305. },
  306. {
  307. 0xA029,
  308. 0x20,
  309. "Bad Image Checksum"
  310. },
  311. {
  312. 0xA029,
  313. 0x24,
  314. "Bad PIB"
  315. },
  316. {
  317. 0xA029,
  318. 0x28,
  319. "Softloader Too Large"
  320. },
  321. {
  322. 0xA029,
  323. 0x2C,
  324. "Firmware Too Large"
  325. },
  326. {
  327. 0xA029,
  328. 0x42,
  329. "Firmware without PIB"
  330. },
  331. {
  332. 0xA029,
  333. 0x44,
  334. "Bad PIB Checksum"
  335. },
  336. {
  337. 0xA029,
  338. 0x46,
  339. "DAK Not Zero"
  340. },
  341. {
  342. 0xA029,
  343. 0x48,
  344. "MAC Mismatch"
  345. },
  346. {
  347. 0xA029,
  348. 0x50,
  349. "MFG HFID Mismatch"
  350. },
  351. {
  352. 0xA029,
  353. 0x52,
  354. "Bad Bind Factory Defaults"
  355. },
  356. {
  357. 0xA029,
  358. 0x54,
  359. "Bad Bind Template PIB"
  360. },
  361. {
  362. 0xA029,
  363. 0x56,
  364. "Bad Bind Working PIB"
  365. },
  366. {
  367. 0xA029,
  368. 0x58,
  369. "Error Computing PIB Checksum"
  370. },
  371. {
  372. 0xA029,
  373. 0x5A,
  374. "Bad Bind Scratch PIB"
  375. },
  376. {
  377. 0xA029,
  378. 0x5C,
  379. "No Firmware Version"
  380. },
  381. {
  382. 0xA029,
  383. 0x5E,
  384. "Version Mismatch"
  385. },
  386. {
  387. 0xA029,
  388. 0x60,
  389. "Bad 01PIB Checksum"
  390. },
  391. {
  392. 0xA029,
  393. 0x62,
  394. "Bad 02PIB Checksum"
  395. },
  396. {
  397. 0xA029,
  398. 0x64,
  399. "Bad WPIB Checksum"
  400. },
  401. {
  402. 0xA029,
  403. 0x66,
  404. "Illegal Firmware Revision"
  405. },
  406. {
  407. 0xA031,
  408. 0x01,
  409. "Bad Control"
  410. },
  411. {
  412. 0xA031,
  413. 0x02,
  414. "Bad Direction"
  415. },
  416. {
  417. 0xA031,
  418. 0x10,
  419. "Bad Link ID"
  420. },
  421. {
  422. 0xA031,
  423. 0x20,
  424. "Bad MAC Address"
  425. },
  426. {
  427. 0xA035,
  428. 0x10,
  429. "Bad Control"
  430. },
  431. {
  432. 0xA049,
  433. 0x20,
  434. "Invalid Duration"
  435. },
  436. {
  437. 0xA049,
  438. 0x12,
  439. "Invalid Length"
  440. },
  441. {
  442. 0xA049,
  443. 0x24,
  444. "Already Set"
  445. },
  446. {
  447. 0xA051,
  448. 0x10,
  449. "Bad PEKS"
  450. },
  451. {
  452. 0xA051,
  453. 0x11,
  454. "Bad PIB"
  455. },
  456. {
  457. 0xA051,
  458. 0x12,
  459. "Bad PEKS Encrypted Payload"
  460. },
  461. {
  462. 0xA051,
  463. 0x13,
  464. "Remote Failure"
  465. },
  466. {
  467. 0xA051,
  468. 0x14,
  469. "Bad Remote Response"
  470. },
  471. {
  472. 0xA051,
  473. 0x15,
  474. "Remote Decryption Failed"
  475. },
  476. {
  477. 0xA059,
  478. 0x10,
  479. "No Flash Memory"
  480. },
  481. {
  482. 0xA05D,
  483. 0x30,
  484. "Bad Checksum"
  485. },
  486. {
  487. 0xA05D,
  488. 0x34,
  489. "BIST Failed"
  490. },
  491. {
  492. 0xA065,
  493. 0x10,
  494. "No Flash Memory"
  495. },
  496. {
  497. 0xA069,
  498. 0x01,
  499. "Failed"
  500. },
  501. {
  502. 0xA069,
  503. 0x02,
  504. "Not Supported"
  505. },
  506. {
  507. 0xA06D,
  508. 0x01,
  509. "Bad Control"
  510. },
  511. {
  512. 0xA06D,
  513. 0x02,
  514. "Success Write"
  515. },
  516. {
  517. 0xA06D,
  518. 0x03,
  519. "Bad Write Parameter"
  520. },
  521. {
  522. 0xA071,
  523. 0x01,
  524. "Bad MAC Address"
  525. },
  526. {
  527. 0xA071,
  528. 0x02,
  529. "Bad TMSLOT"
  530. },
  531. {
  532. 0xA081,
  533. 0x10,
  534. "Bad Module ID"
  535. },
  536. {
  537. 0xA081,
  538. 0x14,
  539. "No Flash Memory"
  540. },
  541. {
  542. 0xA081,
  543. 0x18,
  544. "Not Enough Flash Memory"
  545. },
  546. {
  547. 0xA081,
  548. 0x1C,
  549. "Bad Image Header Checksum"
  550. },
  551. {
  552. 0xA081,
  553. 0x20,
  554. "Bad Image Checksum"
  555. },
  556. {
  557. 0xA081,
  558. 0x24,
  559. "Invalid PIB"
  560. },
  561. {
  562. 0xA081,
  563. 0x28,
  564. "Softloader Too Large"
  565. },
  566. {
  567. 0xA081,
  568. 0x2C,
  569. "Firmware File Too Large"
  570. },
  571. {
  572. 0xA081,
  573. 0x42,
  574. "Firmware without PIB"
  575. },
  576. {
  577. 0xA081,
  578. 0x44,
  579. "Bad PIB Checksum"
  580. },
  581. {
  582. 0xA081,
  583. 0x46,
  584. "DAK Not Zero"
  585. },
  586. {
  587. 0xA081,
  588. 0x48,
  589. "DAC Mismatch"
  590. },
  591. {
  592. 0xA081,
  593. 0x50,
  594. "MFG HFID Mismatch"
  595. },
  596. {
  597. 0xA081,
  598. 0x52,
  599. "Bad Bind Factory Defaults"
  600. },
  601. {
  602. 0xA081,
  603. 0x54,
  604. "Bad Bind Template PIB"
  605. },
  606. {
  607. 0xA081,
  608. 0x56,
  609. "Bad Bind Working PIB"
  610. },
  611. {
  612. 0xA081,
  613. 0x58,
  614. "DAK Mismatch"
  615. },
  616. {
  617. 0xA081,
  618. 0x5A,
  619. "Failed to Lock NVM"
  620. },
  621. {
  622. 0xA089,
  623. 0x01,
  624. "Bad Control"
  625. },
  626. {
  627. 0xA089,
  628. 0x02,
  629. "Bad Volatility"
  630. },
  631. {
  632. 0xA089,
  633. 0x03,
  634. "Bad Classifier"
  635. },
  636. {
  637. 0xA089,
  638. 0x04,
  639. "Classifier table full"
  640. },
  641. {
  642. 0xA089,
  643. 0x05,
  644. "Classifier exists with different action"
  645. },
  646. {
  647. 0xA089,
  648. 0x06,
  649. "Classifier not found"
  650. },
  651. {
  652. 0xA08D,
  653. 0x10,
  654. "Refused"
  655. },
  656. {
  657. 0xA08D,
  658. 0x11,
  659. "Refused"
  660. },
  661. {
  662. 0xA08F,
  663. 0x10,
  664. "Error"
  665. },
  666. {
  667. 0xA091,
  668. 0x01,
  669. "Unknown Peer Address"
  670. },
  671. {
  672. 0xA091,
  673. 0x02,
  674. "Unknown Slot Number"
  675. },
  676. {
  677. 0xA099,
  678. 0x01,
  679. "Destination Address Misaligned"
  680. },
  681. {
  682. 0xA099,
  683. 0x02,
  684. "Entry Point Misaligned"
  685. },
  686. {
  687. 0xA099,
  688. 0x04,
  689. "Entry Point Out-of-Bounds"
  690. },
  691. {
  692. 0xA099,
  693. 0x08,
  694. "Bad Checksum"
  695. },
  696. {
  697. 0xA099,
  698. 0x10,
  699. "Out of Memory"
  700. },
  701. {
  702. 0xA099,
  703. 0x20,
  704. "Offset or Length Mismatch"
  705. },
  706. {
  707. 0xA099,
  708. 0x40,
  709. "Memory not Operational"
  710. },
  711. {
  712. 0xA099,
  713. 0x80,
  714. "Bad Length"
  715. },
  716. {
  717. 0xA0B1,
  718. 0x10,
  719. "Invalid Number of Module Operations"
  720. },
  721. {
  722. 0xA0B1,
  723. 0x11,
  724. "Invalid Module Operation ID"
  725. },
  726. {
  727. 0xA0B1,
  728. 0x12,
  729. "Invalid Session ID"
  730. },
  731. {
  732. 0xA0B1,
  733. 0x13,
  734. "Invalid Num Module Operation Specific Data"
  735. },
  736. {
  737. 0xA0B1,
  738. 0x14,
  739. "Module ID not found"
  740. },
  741. {
  742. 0xA0B1,
  743. 0x15,
  744. "Invalid Module Length"
  745. },
  746. {
  747. 0xA0B1,
  748. 0x16,
  749. "Invalid Module Index"
  750. },
  751. {
  752. 0xA0B1,
  753. 0x17,
  754. "Invalid Data Length"
  755. },
  756. {
  757. 0xA0B1,
  758. 0x18,
  759. "Unexpected Offset"
  760. },
  761. {
  762. 0xA0B1,
  763. 0x19,
  764. "Invalid Commit Action Code"
  765. },
  766. {
  767. 0xA0B1,
  768. 0x1A,
  769. "Operation Block by previous Commit"
  770. },
  771. {
  772. 0xA0B1,
  773. 0x1B,
  774. "Duplicate ModuleID/SubID"
  775. },
  776. {
  777. 0xA0B1,
  778. 0x1C,
  779. "Invalid ModuleID/SubID"
  780. },
  781. {
  782. 0xA0B1,
  783. 0x20,
  784. "No Flash Memory"
  785. },
  786. {
  787. 0xA0B1,
  788. 0x21,
  789. "Not Enough Flash Memory"
  790. },
  791. {
  792. 0xA0B1,
  793. 0x22,
  794. "Unsupported Flash memory Type"
  795. },
  796. {
  797. 0xA0B1,
  798. 0x23,
  799. "Can't Lock Flash Memory"
  800. },
  801. {
  802. 0xA0B1,
  803. 0x24,
  804. "Can't Write Flash Memory"
  805. },
  806. {
  807. 0xA0B1,
  808. 0x30,
  809. "Bad Module Checksum"
  810. },
  811. {
  812. 0xA0B1,
  813. 0x31,
  814. "Individual Module Error"
  815. },
  816. {
  817. 0xA0B1,
  818. 0x32,
  819. "Module not available in NVM or Memory"
  820. },
  821. {
  822. 0xA0B1,
  823. 0x40,
  824. "Invalid Header Checksum"
  825. },
  826. {
  827. 0xA0B1,
  828. 0x41,
  829. "Invalid Firmware Image Checksum"
  830. },
  831. {
  832. 0xA0B1,
  833. 0x42,
  834. "Softloader Image is Too Large"
  835. },
  836. {
  837. 0xA0B1,
  838. 0x43,
  839. "Firmware Image is Too Large"
  840. },
  841. {
  842. 0xA0B1,
  843. 0x44,
  844. "Invalid PIB Checksum"
  845. },
  846. {
  847. 0xA0B1,
  848. 0x45,
  849. "No Firmware Version"
  850. },
  851. {
  852. 0xA0B1,
  853. 0x46,
  854. "FW Commit but no PIB"
  855. },
  856. {
  857. 0xA0B1,
  858. 0x47,
  859. "Major Version Mismatch"
  860. },
  861. {
  862. 0xA0B1,
  863. 0x48,
  864. "Minor Version Mismatch"
  865. },
  866. {
  867. 0xA0B1,
  868. 0x50,
  869. "Invalid PIB"
  870. },
  871. {
  872. 0xA0B1,
  873. 0x51,
  874. "DAK Not Zero"
  875. },
  876. {
  877. 0xA0B1,
  878. 0x52,
  879. "MAC Mismatch"
  880. },
  881. {
  882. 0xA0B1,
  883. 0x53,
  884. "DAK Mismatch"
  885. },
  886. {
  887. 0xA0B1,
  888. 0x54,
  889. "Manufacturer HFID Mismatch"
  890. },
  891. {
  892. 0xA0B1,
  893. 0x55,
  894. "Bad Bind to Factory Default PIB"
  895. },
  896. {
  897. 0xA0B1,
  898. 0x56,
  899. "Bad Bind to Template PIB"
  900. },
  901. {
  902. 0xA0B1,
  903. 0x57,
  904. "Bad Bind to Working PIB"
  905. },
  906. {
  907. 0xA0B1,
  908. 0x58,
  909. "Bad Bind Scratch PIB"
  910. },
  911. {
  912. 0xA0B1,
  913. 0x59,
  914. "Error Generating Checksum Scratch PIB"
  915. },
  916. {
  917. 0xA0B1,
  918. 0x5A,
  919. "Checksum Error O1 PIB"
  920. },
  921. {
  922. 0xA0B1,
  923. 0x5B,
  924. "Checksum Error O2 PIB"
  925. },
  926. {
  927. 0xA0B1,
  928. 0x5C,
  929. "Checksum Error Working PIB"
  930. },
  931. {
  932. 0xA0B1,
  933. 0x61,
  934. "Unexpected Module Operation"
  935. },
  936. {
  937. 0xA0B1,
  938. 0x62,
  939. "Not Enough Resources"
  940. },
  941. {
  942. 0xA0B1,
  943. 0x63,
  944. "Received Module Data Out of Order"
  945. },
  946. {
  947. 0xA0B1,
  948. 0x64,
  949. "No PIB Version"
  950. },
  951. {
  952. 0xA0B1,
  953. 0x70,
  954. "Module Length Mismatch with Module Info"
  955. },
  956. {
  957. 0xA0B1,
  958. 0x71,
  959. "No NVM Softloader Present in Flash Memory"
  960. },
  961. {
  962. 0xA0C1,
  963. 0x03,
  964. "Invalid Classifier"
  965. },
  966. {
  967. 0xA0C1,
  968. 0x04,
  969. "Already too many Classifiers"
  970. },
  971. {
  972. 0xA0C1,
  973. 0x05,
  974. "Classifier exists with different Classification Action"
  975. },
  976. {
  977. 0xA0C1,
  978. 0x07,
  979. "Link Already in Progress"
  980. },
  981. {
  982. 0xA0C1,
  983. 0x08,
  984. "Invalid Configuration"
  985. },
  986. {
  987. 0xA0C1,
  988. 0x10,
  989. "Invalid CSPEC Version"
  990. },
  991. {
  992. 0xA0C1,
  993. 0x11,
  994. "Invalid CSPEC"
  995. },
  996. {
  997. 0xA0C1,
  998. 0x20,
  999. "Out of Local Resources"
  1000. },
  1001. {
  1002. 0xA0C1,
  1003. 0x30,
  1004. "Invalid Peer"
  1005. },
  1006. {
  1007. 0xA0C1,
  1008. 0x31,
  1009. "Peer Confirm Timed out"
  1010. },
  1011. {
  1012. 0xA0C1,
  1013. 0x40,
  1014. "Peer rejection"
  1015. },
  1016. {
  1017. 0xA0C5,
  1018. 0x01,
  1019. "Invalid Modification Control"
  1020. },
  1021. {
  1022. 0xA0C5,
  1023. 0x06,
  1024. "CID Not Found"
  1025. },
  1026. {
  1027. 0xA0C5,
  1028. 0x07,
  1029. "Link Update in Progress, try again later"
  1030. },
  1031. {
  1032. 0xA0C9,
  1033. 0x06,
  1034. "CID Not Found"
  1035. },
  1036. {
  1037. 0xA0C9,
  1038. 0x07,
  1039. "Link Update in Progress. Try again later"
  1040. },
  1041. {
  1042. 0xA0C9,
  1043. 0x31,
  1044. "Peer Confirm Timed out"
  1045. },
  1046. {
  1047. 0xA0CD,
  1048. 0x01,
  1049. "Invalid Request Type"
  1050. },
  1051. {
  1052. 0xA0CD,
  1053. 0x04,
  1054. "Too Many Requests",
  1055. },
  1056. {
  1057. 0xA0CD,
  1058. 0x06,
  1059. "CID Not Found"
  1060. },
  1061. {
  1062. 0xA0CD,
  1063. 0x10,
  1064. "Invalid CSPEC Version"
  1065. },
  1066. {
  1067. 0xA0CD,
  1068. 0x31,
  1069. "Peer Confirm Timed out"
  1070. },
  1071. {
  1072. 0xA0D1,
  1073. 0x01,
  1074. "Unsupported"
  1075. },
  1076. {
  1077. 0xA0D1,
  1078. 0x02,
  1079. "Process Failed"
  1080. },
  1081. {
  1082. 0xA0D1,
  1083. 0x02,
  1084. "Process Failed"
  1085. },
  1086. {
  1087. 0xA0D9,
  1088. 0x01,
  1089. "Bad VersionID or InfoID"
  1090. },
  1091. {
  1092. 0xA0DD,
  1093. 0x01,
  1094. "No Enumeration Table"
  1095. },
  1096. {
  1097. 0xA0F5,
  1098. 0x01,
  1099. "Bad Request Type"
  1100. },
  1101. {
  1102. 0xA0F5,
  1103. 0x02,
  1104. "FMI Not Zero"
  1105. },
  1106. {
  1107. 0xA0F5,
  1108. 0x03,
  1109. "Invalid Command"
  1110. },
  1111. {
  1112. 0xA0F5,
  1113. 0x04,
  1114. "Bad Index"
  1115. },
  1116. {
  1117. 0xA0F5,
  1118. 0x05,
  1119. "Bad Value Count"
  1120. },
  1121. {
  1122. 0xA0F5,
  1123. 0x06,
  1124. "Capture Already Started"
  1125. },
  1126. {
  1127. 0xA0F5,
  1128. 0x07,
  1129. "Data Invalid"
  1130. },
  1131. {
  1132. 0xA0F5,
  1133. 0x08,
  1134. "Bad Gain Value"
  1135. },
  1136. {
  1137. 0xA0F5,
  1138. 0x10,
  1139. "Bad MAC Address"
  1140. },
  1141. {
  1142. 0xA0F5,
  1143. 0x11,
  1144. "Bad Tone Map Index"
  1145. },
  1146. {
  1147. 0xA0F5,
  1148. 0x12,
  1149. "Capture Failed"
  1150. },
  1151. {
  1152. 0xA0F5,
  1153. 0x13,
  1154. "No Data Available"
  1155. },
  1156. {
  1157. 0xA0F9,
  1158. 0x01,
  1159. "Get Property Failure"
  1160. },
  1161. {
  1162. 0xA0F9,
  1163. 0x02,
  1164. "Unsupported Property"
  1165. },
  1166. {
  1167. 0xA0F9,
  1168. 0x03,
  1169. "Unsupported Property Version"
  1170. },
  1171. {
  1172. 0xA101,
  1173. 0x01,
  1174. "Set Property Failure"
  1175. },
  1176. {
  1177. 0xA101,
  1178. 0x02,
  1179. "Unsupported Property"
  1180. },
  1181. {
  1182. 0xA101,
  1183. 0x03,
  1184. "Unsupported Property Version"
  1185. },
  1186. {
  1187. 0xA101,
  1188. 0x04,
  1189. "Property Not Persistent"
  1190. },
  1191. {
  1192. 0xA101,
  1193. 0x05,
  1194. "Flash Memory Failure"
  1195. },
  1196. {
  1197. 0xA101,
  1198. 0x06,
  1199. "Bad Option for Supported Property"
  1200. },
  1201. {
  1202. 0xA101,
  1203. 0x07,
  1204. "Invalid Property Data"
  1205. },
  1206. {
  1207. 0xA101,
  1208. 0x08,
  1209. "Bad Property Data Length"
  1210. },
  1211. {
  1212. 0xA105,
  1213. 0x01,
  1214. "Buffer Not Available"
  1215. },
  1216. {
  1217. 0xA109,
  1218. 0x01,
  1219. "No Flash Memory"
  1220. },
  1221. {
  1222. 0xA109,
  1223. 0x02,
  1224. "Invalid Flash Sector"
  1225. },
  1226. {
  1227. 0xA109,
  1228. 0x03,
  1229. "Current DAK Mismatch"
  1230. },
  1231. {
  1232. 0xA109,
  1233. 0x04,
  1234. "Flash is Busy"
  1235. },
  1236. {
  1237. 0xA109,
  1238. 0x05,
  1239. "No Access to Flash"
  1240. },
  1241. {
  1242. 0xA109,
  1243. 0x06,
  1244. "Unsupported Chip"
  1245. },
  1246. {
  1247. 0xA109,
  1248. 0x07,
  1249. "Unspecified Error"
  1250. },
  1251. {
  1252. 0xA10D,
  1253. 0x01,
  1254. "Option Not Supported"
  1255. },
  1256. {
  1257. 0xA10D,
  1258. 0x02,
  1259. "No Flash Memory"
  1260. },
  1261. {
  1262. 0xA10D,
  1263. 0x03,
  1264. "Pending Self Test"
  1265. },
  1266. {
  1267. 0xA10D,
  1268. 0x04,
  1269. "Flash Activity Conflict"
  1270. },
  1271. {
  1272. 0xA10D,
  1273. 0x05,
  1274. "Bad Parameter"
  1275. },
  1276. {
  1277. 0xA111,
  1278. 0x01,
  1279. "Option Not Supported"
  1280. },
  1281. {
  1282. 0xA111,
  1283. 0x02,
  1284. "Self Test Finished"
  1285. },
  1286. {
  1287. 0xA111,
  1288. 0x03,
  1289. "Self Test Pending"
  1290. },
  1291. {
  1292. 0xA111,
  1293. 0x04,
  1294. "Self Test In Progress"
  1295. },
  1296. {
  1297. 0xA111,
  1298. 0x05,
  1299. "Self Test No Result"
  1300. },
  1301. {
  1302. 0xA111,
  1303. 0x06,
  1304. "Self Test Aborted"
  1305. },
  1306. {
  1307. 0xA111,
  1308. 0x07,
  1309. "No Flash Memory"
  1310. },
  1311. {
  1312. 0xA115,
  1313. 0x01,
  1314. "Interface Not Supported"
  1315. },
  1316. {
  1317. 0xA115,
  1318. 0x02,
  1319. "Slave Not Found"
  1320. },
  1321. {
  1322. 0xA115,
  1323. 0x03,
  1324. "Wrong Parameter"
  1325. },
  1326. {
  1327. 0xA119,
  1328. 0x01,
  1329. "Bad Version"
  1330. },
  1331. {
  1332. 0xA119,
  1333. 0x02,
  1334. "Bad Argument"
  1335. },
  1336. {
  1337. 0xA119,
  1338. 0x03,
  1339. "Too Many Slaves"
  1340. },
  1341. {
  1342. 0xA119,
  1343. 0x04,
  1344. "Too Many VLAN IDs"
  1345. },
  1346. {
  1347. 0xA119,
  1348. 0x05,
  1349. "No Such Slave"
  1350. },
  1351. {
  1352. 0xA119,
  1353. 0x06,
  1354. "Flash Operation Blocked"
  1355. },
  1356. {
  1357. 0xA119,
  1358. 0x07,
  1359. "Unsupported Operation"
  1360. },
  1361. {
  1362. 0xA119,
  1363. 0x08,
  1364. "Flash Activity Conflict"
  1365. },
  1366. {
  1367. 0xA119,
  1368. 0x09,
  1369. "Table Busy"
  1370. },
  1371. {
  1372. 0xA119,
  1373. 0x0A,
  1374. "One Slave Has Duplicate VLAN ID"
  1375. },
  1376. {
  1377. 0xA119,
  1378. 0x0B,
  1379. "Multiple Slaves Have Same VLAN ID"
  1380. },
  1381. {
  1382. 0xA119,
  1383. 0x0C,
  1384. "Multiple Configurations for One Slave"
  1385. },
  1386. {
  1387. 0xA119,
  1388. 0x0D,
  1389. "Can't set VLAN ID for Local Station"
  1390. },
  1391. {
  1392. 0xA119,
  1393. 0x0E,
  1394. "Bad Data Offset"
  1395. },
  1396. {
  1397. 0xA119,
  1398. 0x0F,
  1399. "Bad Data Length"
  1400. },
  1401. {
  1402. 0xA119,
  1403. 0x10,
  1404. "VLAN ID Has Been Configured"
  1405. },
  1406. {
  1407. 0xA119,
  1408. 0x11,
  1409. "Bad MME Source"
  1410. },
  1411. {
  1412. 0xA119,
  1413. 0x12,
  1414. "VLAN ID out of range"
  1415. },
  1416. {
  1417. 0xA119,
  1418. 0x13,
  1419. "Cannot remove nonexistent VLAN ID"
  1420. },
  1421. {
  1422. 0xA149,
  1423. 0x1,
  1424. "Invalid Key Length"
  1425. },
  1426. {
  1427. 0xA149,
  1428. 0x2,
  1429. "Invalid Key"
  1430. },
  1431. {
  1432. 0xA149,
  1433. 0x3,
  1434. "Invalid Access Type"
  1435. },
  1436. {
  1437. 0xA149,
  1438. 0x4,
  1439. "Invalid Level Control"
  1440. }
  1441. };
  1442. #endif
  1443. char const * MMECode (uint16_t MMTYPE, uint8_t MSTATUS)
  1444. {
  1445. #ifndef MMEPASSFAIL
  1446. size_t lower = 0;
  1447. size_t upper = SIZEOF (mme_codes);
  1448. MMTYPE = LE16TOH (MMTYPE);
  1449. while (lower < upper)
  1450. {
  1451. size_t index = (lower + upper) >> 1;
  1452. signed order = MMTYPE - mme_codes [index].type;
  1453. if (order < 0)
  1454. {
  1455. upper = index - 0;
  1456. continue;
  1457. }
  1458. if (order > 0)
  1459. {
  1460. lower = index + 1;
  1461. continue;
  1462. }
  1463. for (lower = index; lower > 0; lower--)
  1464. {
  1465. if (mme_codes [lower - 1].type != mme_codes [index].type)
  1466. {
  1467. break;
  1468. }
  1469. }
  1470. for (upper = index; upper < SIZEOF (mme_codes); upper++)
  1471. {
  1472. if (mme_codes [upper + 0].type != mme_codes [index].type)
  1473. {
  1474. break;
  1475. }
  1476. }
  1477. while (lower < upper)
  1478. {
  1479. index = (lower + upper) >> 1;
  1480. order = MSTATUS - mme_codes [index].code;
  1481. if (order < 0)
  1482. {
  1483. upper = index - 0;
  1484. continue;
  1485. }
  1486. if (order > 0)
  1487. {
  1488. lower = index + 1;
  1489. continue;
  1490. }
  1491. return (mme_codes [index].text);
  1492. }
  1493. }
  1494. #endif
  1495. return ((MSTATUS)? ("Failure"):("Success"));
  1496. }
  1497. #endif