From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from forward20m.cmail.yandex.net ([5.255.216.151]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Z5yTS-0000fH-Ta for barebox@lists.infradead.org; Fri, 19 Jun 2015 15:45:01 +0000 Received: from smtp4m.mail.yandex.net (smtp4m.mail.yandex.net [IPv6:2a02:6b8:0:2519::126]) by forward20m.cmail.yandex.net (Yandex) with ESMTP id BFC5D21115 for ; Fri, 19 Jun 2015 18:44:32 +0300 (MSK) From: Alexander Smirnov Date: Fri, 19 Jun 2015 18:46:02 +0300 Message-Id: <1434728762-32567-1-git-send-email-alllecs@yandex.ru> MIME-Version: 1.0 List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: base64 Sender: "barebox" Errors-To: barebox-bounces+u.kleine-koenig=pengutronix.de@lists.infradead.org Subject: [RFC] add decode command (SPD EEPROM data decoder) To: barebox@lists.infradead.org Cc: Alexander Smirnov ZGVjb2RlLWRpbW1zIHBlcmwgc2NyaXB0IGlzIHVzZWQgYXMgcHJvdG90eXBlCihzZWUgaHR0cHM6 Ly9naXRodWIuY29tL2dyb2Vjay9pMmMtdG9vbHMvYmxvYi9tYXN0ZXIvZWVwcm9tL2RlY29kZS1k aW1tcykuCgpIZXJlIGlzIGEgc2FtcGxlIGRlY29kZSBvdXRwdXQ6CgpiYXJlYm94QGJhcmVib3gg c2FuZGJveDovIGRlY29kZSBlbnYvY3J1Y2lhbF9wYzItNjQwMF9kZHIyCkRlY29kaW5nIEVFUFJP TTogZW52L2NydWNpYWxfcGMyLTY0MDBfZGRyMgoKLS0tPT09IFNQRCBFRVBST00gSW5mb3JtYXRp b24gPT09LS0tCkVFUFJPTSBDaGVja3N1bSBvZiBieXRlcyAwLTYyCQkJIE9LICgweENBKQpUb3Rh bCBudW1iZXIgb2YgYnl0ZXMgaW4gRUVQUk9NCQkJIDI1N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gICAgICAgICAgcmV0dXJuIDA7CisgICAgICAgICBpZiAo ISh4ICYgMHhmZmZmMDAwMHUpKSB7CisgICAgICAgICAgICAgICAgeCA8PD0gMTY7CisgICAgICAg ICAgICAgICAgciAtPSAxNjsKKyAgICAgICAgfQorICAgICAgICBpZiAoISh4ICYgMHhmZjAwMDAw MHUpKSB7CisgICAgICAgICAgICAgICAgeCA8PD0gODsKKyAgICAgICAgICAgICAgICByIC09IDg7 CisgICAgICAgIH0KKyAgICAgICAgaWYgKCEoeCAmIDB4ZjAwMDAwMDB1KSkgeworICAgICAgICAg ICAgICAgIHggPDw9IDQ7CisgICAgICAgICAgICAgICAgciAtPSA0OworICAgICAgICB9CisgICAg ICAgIGlmICghKHggJiAweGMwMDAwMDAwdSkpIHsKKyAgICAgICAgICAgICAgICB4IDw8PSAyOwor ICAgICAgICAgICAgICAgIHIgLT0gMjsKKyAgICAgICAgfQorICAgICAgICBpZiAoISh4ICYgMHg4 MDAwMDAwMHUpKSB7CisgICAgICAgICAgICAgICAgeCA8PD0gMTsKKyAgICAgICAgICAgICAgICBy IC09IDE7CisgICAgICAgIH0KKyAgICAgICAgcmV0dXJuIHI7Cit9CisjZW5kaWYKKworY2hhciAq aGVpZ2h0c1tdID0geworCSI8MjUuNCIsCisJIjI1LjQiLAorCSIyNS40IC0gMzAuMCIsCisJIjMw LjAiLAorCSIzMC41IiwKKwkiPiAzMC41IgorfTsKKworY2hhciAqc2RyYW1fdm9sdGFnZV9pbnRl cmZhY2VfbGV2ZWxbXSA9IHsKKwkiVFRMICg1ViB0b2xlcmFudCkiLAorCSJMVlRUTCAobm90IDVW IHRvbGVyYW50KSIsCisJIkhTVEwgMS41ViIsCisJIlNTVEwgMy4zViIsCisJIlNTVEwgMi41ViIs CisJIlNTVEwgMS44ViIKK307CisKK2NoYXIgKmRkcjJfbW9kdWxlX3R5cGVzW10gPSB7CisJIlJE SU1NICgxMzMuMzUgbW0pIiwKKwkiVURJTU0gKDEzMy4yNSBtbSkiLAorCSJTTy1ESU1NICg2Ny42 IG1tKSIsCisJIk1pY3JvLURJTU0gKDQ1LjUgbW0pIiwKKwkiTWluaS1SRElNTSAoODIuMCBtbSki LAorCSJNaW5pLVVESU1NICg4Mi4wIG1tKSIKK307CisKK2NoYXIgKnJlZnJlc2hbXSA9IHsKKwki MTUuNjI1IiwKKwkiMy45IiwKKwkiNy44IiwKKwkiMzEuMyIsCisJIjYyLjUiLAorCSIxMjUiCit9 OworCitjaGFyICp0eXBlX2xpc3RbXSA9IHsKKwkiUmVzZXJ2ZWQiLAorCSJGUE0gRFJBTSIsCisJ IkVETyIsCisJIlBpcGVsaW5lZCBOaWJibGUiLAorCSJTRFIgU0RSQU0iLAorCSJNdWx0aXBsZXhl ZCBST00iLAorCSJERFIgU0dSQU0iLAorCSJERFIgU0RSQU0iLAorCSJERFIyIFNEUkFNIiwKKwki RkItRElNTSIsCisJIkZCLURJTU0gUHJvYmUiLAorCSJERFIzIFNEUkFNIgorfTsKKworaW50IGZ1 bmN0KHVpbnQ4X3QgYWRkcikKK3sKKwlpbnQgdDsKKworCXQgPSAoKGFkZHIgPj4gNCkgKiAxMCAr IChhZGRyICYgMHhmKSk7CisKKwlyZXR1cm4gdDsKK30KKworaW50IGRkcjJfc2RyYW1fYXRpbWUo dWludDhfdCBhZGRyKQoreworCWludCB0OworCisvLwl0ID0gKChhZGRyID4+IDQpICogMC4xICsg KGFkZHIgJiAweGYpICogMC4wMSk7CisJdCA9ICgoYWRkciA+PiA0KSArIChhZGRyICYgMHhmKSk7 CisKKwlyZXR1cm4gdDsKK30KKwordm9pZCBkdW1wKHVpbnQ4X3QgKmFkZHIsIGludCBsZW4pCit7 CisJaW50IGk7CisKKwlwcmludGYoIlx0IDAwIDAxIDAyIDAzIDA0IDA1IDA2IDA3IDA4IDA5IDBh IDBiIDBjIDBkIDBlIDBmXG5cbiIpOworCisJZm9yIChpID0gMDsgaSA8IGxlbjsgaSsrKSB7CisJ CWlmICgoaSAlIDB4MTApID09IDB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