Example #1
0
    def read(self, node):
        nodes = node.childNodes

        for node in nodes:
            if node.nodeType == xml.dom.Node.ELEMENT_NODE:
                if cmp(node.nodeName, 'count') == 0:
                    self.__count = node.childNodes[0].nodeValue
                    continue

                varNode = node.getElementsByTagName('varName')
                detNode = node.getElementsByTagName('debounce_time')
                polNode = node.getElementsByTagName('polarity')
                senNode = node.getElementsByTagName('sensitive_level')
                deeNode = node.getElementsByTagName('debounce_en')

                data = EintData()
                if len(varNode):
                    data.set_varName(varNode[0].childNodes[0].nodeValue)

                if len(detNode):
                    data.set_debounceTime(detNode[0].childNodes[0].nodeValue)

                if len(polNode):
                    data.set_polarity(polNode[0].childNodes[0].nodeValue)

                if len(senNode):
                    data.set_sensitiveLevel(senNode[0].childNodes[0].nodeValue)

                if len(deeNode):
                    data.set_debounceEnable(deeNode[0].childNodes[0].nodeValue)

                ModuleObj.set_data(self, node.nodeName, data)

        return True
Example #2
0
    def get_cfgInfo(self):
        cp = configparser.ConfigParser(allow_no_value=True)
        cp.read(ModuleObj.get_cmpPath())

        # get GPIO_FREQ section
        keys = cp.options('GPIO_FREQ')
        for key in keys:
            value = cp.get('GPIO_FREQ', key)
            GpioData._freqMap[key] = value

        # get GPIO_MODE section
        keys = cp.options('GPIO_MODE')
        for key in keys:
            value = cp.get('GPIO_MODE', key)
            GpioData._specMap[key] = value

        GpioData._mapList = cp.options('GPIO_VARIABLES_MAPPING')

        cp.read(ModuleObj.get_figPath())
        ops = cp.options('GPIO')
        for op in ops:
            value = cp.get('GPIO', op)
            list = re.split(r' +|\t+', value)
            tmp_list = list[0:len(list) - 2]
            temp = []
            for item in tmp_list:
                str = item[6:len(item) - 1]
                temp.append(str)
            GpioData._modeMap[op] = temp

            data = GpioData()
            data.set_smtNum(string.atoi(list[len(list) - 1]))
            ModuleObj.set_data(self, op.lower(), data)
Example #3
0
    def read(self, node):
        nodes = node.childNodes
        for node in nodes:
            if node.nodeType == xml.dom.Node.ELEMENT_NODE:
                if node.nodeName == 'count':
                    continue

                varNode = node.getElementsByTagName('varName')
                curNode = node.getElementsByTagName('current')

                key = re.findall(
                    r'\D+',
                    node.nodeName)[0].upper() + self.__suffix + '%s' % (
                        re.findall(r'\d+', node.nodeName)[0])

                if key not in ModuleObj.get_data(self):
                    continue

                data = ModuleObj.get_data(self)[key]

                if len(varNode):
                    data.set_varName(varNode[0].childNodes[0].nodeValue)

                if len(curNode):
                    data.set_current(curNode[0].childNodes[0].nodeValue)

                ModuleObj.set_data(self, key, data)

        return True
Example #4
0
    def read(self, node):
        nodes = node.childNodes
        for node in nodes:
            if node.nodeType == xml.dom.Node.ELEMENT_NODE:
                if node.nodeName == 'count':
                    continue

                varNode = node.getElementsByTagName('varName')

                data = PowerData()
                data.set_varName(varNode[0].childNodes[0].nodeValue)

                ModuleObj.set_data(self, node.nodeName, data)

        return True
    def read(self, node):
        nodes = node.childNodes
        try:
            for node in nodes:
                if node.nodeType == xml.dom.Node.ELEMENT_NODE:
                    if node.nodeName == 'count':
                        count = node.childNodes[0].nodeValue
                        continue
                    subNode = node.getElementsByTagName('varName')
                    if len(subNode):
                        ModuleObj.set_data(self, node.nodeName, subNode[0].childNodes[0].nodeValue)
        except:
            msg = 'read adc content fail!'
            log(LogLevel.error, msg)
            return False

        return True
Example #6
0
    def read(self, node):
        nodes = node.childNodes
        try:
            for node in nodes:
                if node.nodeType == xml.dom.Node.ELEMENT_NODE:
                    if cmp(node.nodeName, 'count') == 0:
                        self.__count = node.childNodes[0].nodeValue
                        continue

                    varNode = node.getElementsByTagName('varName')
                    detNode = node.getElementsByTagName('debounce_time')
                    polNode = node.getElementsByTagName('polarity')
                    senNode = node.getElementsByTagName('sensitive_level')
                    deeNode = node.getElementsByTagName('debounce_en')
                    dedNode = node.getElementsByTagName('dedicated_en')
                    srcNode = node.getElementsByTagName('srcPin')
                    sktNode = node.getElementsByTagName('socketType')

                    data = Md1EintData()
                    if len(varNode):
                        data.set_varName(varNode[0].childNodes[0].nodeValue)
                    if len(detNode):
                        data.set_debounceTime(detNode[0].childNodes[0].nodeValue)
                    if len(polNode):
                        data.set_polarity(polNode[0].childNodes[0].nodeValue)
                    if len(senNode):
                        data.set_sensitiveLevel(senNode[0].childNodes[0].nodeValue)
                    if len(deeNode):
                        data.set_debounceEnable(deeNode[0].childNodes[0].nodeValue)
                    if len(dedNode):
                        data.set_dedicatedEn(dedNode[0].childNodes[0].nodeValue)
                    if len(srcNode) and len(srcNode[0].childNodes):
                        data.set_srcPin(srcNode[0].childNodes[0].nodeValue)
                    if len(sktNode) and len(sktNode[0].childNodes):
                        data.set_socketType(sktNode[0].childNodes[0].nodeValue)

                    ModuleObj.set_data(self, node.nodeName, data)
        except:
            msg = 'read md1_eint content fail!'
            util.log(LogLevel.error, msg)
            return False

        return True
Example #7
0
    def read(self, node):
        nodes = node.childNodes
        for node in nodes:
            if node.nodeType == xml.dom.Node.ELEMENT_NODE:
                if cmp(node.nodeName, 'chip') == 0:
                    if len(node.childNodes) == 0:
                        break
                    self.__chipName = node.childNodes[0].nodeValue
                    continue
                if cmp(node.nodeName, 'count') == 0:
                    continue
                ldoNode = node.getElementsByTagName('ldoVar')
                defNode = node.getElementsByTagName('defEn')

                data = PmicData()
                if len(ldoNode):
                    data.set_ldoName(ldoNode[0].childNodes[0].nodeValue)

                if len(defNode):
                    number = -1
                    if cmp(defNode[0].childNodes[0].nodeValue, 'SKIP') == 0:
                        number = 0
                    elif cmp(defNode[0].childNodes[0].nodeValue, 'OFF') == 0:
                        number = 1
                    else:
                        number = 2
                    data.set_defEnable(number)

                name_list = []
                for i in range(0, 6):
                    key = 'varName%d' % (i)
                    nameNode = node.getElementsByTagName(key)
                    if len(nameNode):
                        name_list.append(nameNode[0].childNodes[0].nodeValue)

                data.set_nameList(name_list)

                ModuleObj.set_data(self, node.nodeName, data)

        return True
Example #8
0
    def get_cfgInfo(self):
        cp = configparser.ConfigParser(allow_no_value=True)
        cp.read(ModuleObj.get_figPath())

        count = string.atoi(cp.get('CLK_BUF', 'CLK_BUF_COUNT'))
        self.__count = count

        ops = cp.options('CLK_BUF')
        for op in ops:
            if op == 'clk_buf_count':
                self.__count = string.atoi(cp.get('CLK_BUF', op))
                ClkData._count = string.atoi(cp.get('CLK_BUF', op))
                continue

            value = cp.get('CLK_BUF', op)
            var_list = value.split(':')

            data = ClkData()
            data.set_curList(var_list[2:])
            data.set_defVarName(string.atoi(var_list[0]))
            data.set_defCurrent(string.atoi(var_list[1]))

            key = op[16:].upper()
            ModuleObj.set_data(self, key, data)
Example #9
0
    def read(self, node):
        nodes = node.childNodes
        for node in nodes:
            if node.nodeType == xml.dom.minidom.Node.ELEMENT_NODE:
                if cmp(node.nodeName, 'count') == 0:
                    self.__count = node.childNodes[0].nodeValue
                    continue
                if node.nodeName.find('bus') != -1:
                    speedNode = node.getElementsByTagName('speed_kbps')
                    enableNode = node.getElementsByTagName('pullPushEn')

                    data = BusData()
                    if len(speedNode):
                        data.set_speed(speedNode[0].childNodes[0].nodeValue)
                    if len(enableNode):
                        data.set_enable(enableNode[0].childNodes[0].nodeValue)

                    self._busList.append(data)
                    #I2cData._busList.append(data)
                elif node.nodeName.find('device') != -1:
                    nameNode = node.getElementsByTagName('varName')
                    channelNode = node.getElementsByTagName('channel')
                    addrNode = node.getElementsByTagName('address')

                    data = I2cData()
                    if len(nameNode):
                        data.set_varName(nameNode[0].childNodes[0].nodeValue)
                    if len(channelNode):
                        data.set_channel(
                            channelNode[0].childNodes[0].nodeValue)
                    if len(addrNode):
                        data.set_address(addrNode[0].childNodes[0].nodeValue)

                    ModuleObj.set_data(self, node.nodeName, data)

        return True
Example #10
0
    def read(self, node):
        nodes = node.childNodes
        for node in nodes:
            if node.nodeType == xml.dom.Node.ELEMENT_NODE:
                if cmp(node.nodeName, 'count') == 0:
                    GpioData._count = string.atoi(node.childNodes[0].nodeValue)
                    continue

                eintNode = node.getElementsByTagName('eint_mode')
                defmNode = node.getElementsByTagName('def_mode')
                modsNode = node.getElementsByTagName('mode_arr')
                inpeNode = node.getElementsByTagName('inpull_en')
                inpsNode = node.getElementsByTagName('inpull_selhigh')
                defdNode = node.getElementsByTagName('def_dir')
                diriNode = node.getElementsByTagName('in')
                diroNode = node.getElementsByTagName('out')
                outhNode = node.getElementsByTagName('out_high')
                var0Node = node.getElementsByTagName('varName0')
                var1Node = node.getElementsByTagName('varName1')
                var2Node = node.getElementsByTagName('varName2')
                smtNode = node.getElementsByTagName('smt')
                iesNode = node.getElementsByTagName('ies')
                drvCurNode = node.getElementsByTagName('drv_cur')

                num = string.atoi(node.nodeName[4:])
                if num >= len(ModuleObj.get_data(self)):
                    break
                data = ModuleObj.get_data(self)[node.nodeName]

                if len(eintNode):
                    flag = False
                    if cmp(eintNode[0].childNodes[0].nodeValue, 'true') == 0:
                        flag = True
                    data.set_eintMode(flag)

                if len(defmNode):
                    data.set_defMode(
                        string.atoi(defmNode[0].childNodes[0].nodeValue))

                if len(modsNode):
                    str = modsNode[0].childNodes[0].nodeValue
                    temp_list = []
                    for i in range(0, len(str)):
                        temp_list.append(str[i])
                    data.set_modeVec(temp_list)

                if len(inpeNode):
                    flag = False
                    if cmp(inpeNode[0].childNodes[0].nodeValue, 'true') == 0:
                        flag = True
                    data.set_inpullEn(flag)

                if len(inpsNode):
                    flag = False
                    if cmp(inpsNode[0].childNodes[0].nodeValue, 'true') == 0:
                        flag = True
                    data.set_inpullSelHigh(flag)

                if len(defdNode):
                    data.set_defDir(defdNode[0].childNodes[0].nodeValue)

                if len(diriNode):
                    flag = False
                    if cmp(diriNode[0].childNodes[0].nodeValue, 'true') == 0:
                        flag = True
                    data.set_inEn(flag)

                if len(diroNode):
                    flag = False
                    if cmp(diroNode[0].childNodes[0].nodeValue, 'true') == 0:
                        flag = True
                    data.set_outEn(flag)

                if len(outhNode):
                    flag = False
                    if cmp(outhNode[0].childNodes[0].nodeValue, 'true') == 0:
                        flag = True
                    data.set_outHigh(flag)

                temp_list = []

                if len(var0Node) != 0 and len(var0Node[0].childNodes) != 0:
                    temp_list.append(var0Node[0].childNodes[0].nodeValue)
                if len(var1Node) != 0 and len(var1Node[0].childNodes) != 0:
                    temp_list.append(var1Node[0].childNodes[0].nodeValue)
                if len(var2Node) != 0 and len(var2Node[0].childNodes) != 0:
                    temp_list.append(var2Node[0].childNodes[0].nodeValue)
                data.set_varNames(temp_list)

                if len(smtNode):
                    flag = False
                    if cmp(smtNode[0].childNodes[0].nodeValue, 'true') == 0:
                        flag = True
                    data.set_smtEn(flag)

                if len(iesNode):
                    flag = False
                    if cmp(iesNode[0].childNodes[0].nodeValue, 'true') == 0:
                        flag = True
                    data.set_iesEn(flag)

                if len(drvCurNode) != 0 and len(drvCurNode[0].childNodes) != 0:
                    self.__drvCur = True
                    data.set_drvCur(drvCurNode[0].childNodes[0].nodeValue)

                ModuleObj.set_data(self, node.nodeName, data)

        return True