python scripts bit wirte
#!/usr/bin/env python import sys, os, time import random import re import time import os from Crypto import Random def genRandomData(): tmp = random.randint(0,0xffffffff) print "0x%08x" %(tmp) return tmp c_die = 6 c_ca = 4 c_type = 3 list_c_die = [5, 11, 16, 18, 24, 30] list_c_ca = [3, 14, 19, 25] list_c_type = [8, 22, 27] #3 8 a 4 1 #3 5 9 a b 2 f #1 3 def wite_bit(input_data, bit_num, bit_val): print input_data return (input_data & ~(1<<bit_num)) | (bit_val << bit_num) if __name__ == '__main__': try: print sys.argv print len(sys.argv) data = genRandomData(); print "0x%08x" %(data) m_c_die = sys.argv[1] if m_c_die == "a": wite_bit elif m_c_die == "b": elif m_c_die == "c": elif m_c_die == "d": elif m_c_die == "e": elif m_c_die == "f": elif m_c_die == "g": elif m_c_die == "h": else: print "Not Support" m_c_ca = sys.argv[2] if m_c_ca == "a": elif m_c_ca == "b": elif m_c_ca == "c": elif m_c_ca == "d": elif m_c_ca == "e": elif m_c_ca == "f": elif m_c_ca == "g": elif m_c_ca == "h": else: print "Not Support" m_c_type = sys.argv[3] if m_c_type == "a": elif m_c_type == "b": elif m_c_type == "c": elif m_c_type == "d": else: print "Not Support" print data except: print("Error: run error.") pass