/// <summary>
        /// The public constructor for the DM637x device AIS generator.
        /// The constructor is where the device differentiation is defined.
        /// </summary>
        public AISGen_OMAP_L138()
            : base()
        {
            // Define the device name - used for default file names
              devNameShort = "OMAP-L138";
              devNameLong = "OMAPL138";

              // Define OMAP-L138 ROM boot loader functions
              ROMFunc = new AisROMFunction[13];
              ROMFunc[0].funcName = ROMFunctionNames.PLL0Config;
              ROMFunc[0].iniSectionName = "PLL0CONFIG";
              ROMFunc[0].numParams = 2;
              ROMFunc[0].paramNames = new String[2] { "PLL0CFG0", "PLL0CFG1" };

              ROMFunc[1].funcName = ROMFunctionNames.PLL1Config;
              ROMFunc[1].iniSectionName = "PLL1CONFIG";
              ROMFunc[1].numParams = 2;
              ROMFunc[1].paramNames = new String[2] { "PLL1CFG0", "PLL1CFG1" };

              ROMFunc[2].funcName = ROMFunctionNames.PeriphClockConfig;
              ROMFunc[2].iniSectionName = "PERIPHCLKCFG";
              ROMFunc[2].numParams = 1;
              ROMFunc[2].paramNames = new String[1] { "PERIPHCLKCFG" };

              ROMFunc[3].funcName = ROMFunctionNames.EMIF3AConfigDDR;
              ROMFunc[3].iniSectionName = "EMIF3DDR";
              ROMFunc[3].numParams = 8;
              ROMFunc[3].paramNames = new String[8] { "PLL1CFG0", "PLL1CFG1", "DDRPHYC1R", "SDCR", "SDTIMR", "SDTIMR2", "SDRCR", "CLK2XSRC" };

              ROMFunc[4].funcName = ROMFunctionNames.EMIF25ConfigSDRAM;
              ROMFunc[4].iniSectionName = "EMIF25SDRAM";
              ROMFunc[4].numParams = 5;
              ROMFunc[4].paramNames = new String[5] { "SDBCR", "SDTIMR", "SDRSRPDEXIT", "SDRCR", "DIV4p5_CLK_ENABLE" };

              ROMFunc[5].funcName = ROMFunctionNames.EMIF25ConfigAsync;
              ROMFunc[5].iniSectionName = "EMIF25ASYNC";
              ROMFunc[5].numParams = 5;
              ROMFunc[5].paramNames = new String[5] { "A1CR", "A2CR", "A3CR", "A4CR", "NANDFCR" };

              ROMFunc[6].funcName = ROMFunctionNames.PLLandClockConfig;
              ROMFunc[6].iniSectionName = "PLLANDCLOCKCONFIG";
              ROMFunc[6].numParams = 3;
              ROMFunc[6].paramNames = new String[3] { "PLL0CFG0", "PLL0CFG1", "PERIPHCLKCFG" };

              ROMFunc[7].funcName = ROMFunctionNames.PSCConfig;
              ROMFunc[7].iniSectionName = "PSCCONFIG";
              ROMFunc[7].numParams = 1;
              ROMFunc[7].paramNames = new String[1] { "LPSCCFG" };

              ROMFunc[8].funcName = ROMFunctionNames.PINMUXConfig;
              ROMFunc[8].iniSectionName = "PINMUX";
              ROMFunc[8].numParams = 3;
              ROMFunc[8].paramNames = new String[3] { "REGNUM", "MASK", "VALUE" };

              ROMFunc[9].funcName = ROMFunctionNames.FastBoot;
              ROMFunc[9].iniSectionName = "FASTBOOT";
              ROMFunc[9].numParams = 0;
              ROMFunc[9].paramNames = null;

              ROMFunc[10].funcName = ROMFunctionNames.IOPUConfig;
              ROMFunc[10].iniSectionName = "IOPUCONFIG";
              ROMFunc[10].numParams = 2;
              ROMFunc[10].paramNames = new String[2] { "IOPUSELECT", "MPPAVALUE" };

              ROMFunc[11].funcName = ROMFunctionNames.MPUConfig;
              ROMFunc[11].iniSectionName = "MPUCONFIG";
              ROMFunc[11].numParams = 4;
              ROMFunc[11].paramNames = new String[4] { "MPUSELECT", "STARTADDR" ,"ENDADDR" ,"MPPAVALUE" };

              ROMFunc[12].funcName = ROMFunctionNames.TAPSConfig;
              ROMFunc[12].iniSectionName = "TAPSCONFIG";
              ROMFunc[12].numParams = 1;
              ROMFunc[12].paramNames = new String[1] { "TAPSCFG" };

              AISExtraFunc = new AisExtraFunction[2];
              AISExtraFunc[0].funcName = "PatchDDRConfig";
              AISExtraFunc[0].aisExtraFileName = "ARM_AISExtra_"+devNameShort+".out";
              AISExtraFunc[0].iniSectionName = "ARM_EMIF3DDR_PATCHFXN";
              AISExtraFunc[0].numParams = 6;
              AISExtraFunc[0].paramNames = new String[6] { "DDRPHYC1R", "SDCR", "SDTIMR", "SDTIMR2", "SDRCR", "CLK2XSRC" };
              AISExtraFunc[0].isInitFunc = false;

              AISExtraFunc[1].funcName = "PatchDDRConfig";
              AISExtraFunc[1].aisExtraFileName = "DSP_AISExtra_"+devNameShort+".out";
              AISExtraFunc[1].iniSectionName = "DSP_EMIF3DDR_PATCHFXN";
              AISExtraFunc[1].numParams = 6;
              AISExtraFunc[1].paramNames = new String[6] { "DDRPHYC1R", "SDCR", "SDTIMR", "SDTIMR2", "SDRCR", "CLK2XSRC" };
              AISExtraFunc[1].isInitFunc = false;

              // OMAP-L138 is little endian
              devEndian = Endian.LittleEndian;

              // OMAP-L138 AIS data is little endian;
              devAISEndian = Endian.LittleEndian;

              // Create default CRC object for this device
              devCRC = new CRC32(0x04C11DB7, 0xFFFFFFFF, 0xFFFFFFFF, true, 1, CRCType.INCREMENTAL, CRCCalcMethod.LUT);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Function to Transmit the UBL via the device ROM Serial boot
        /// </summary>
        private static void TransmitUBL(Byte[] imageData,UARTBOOT_Header ackHeader)
        {
            // Local Variables for building up output
              StringBuilder UBLsb;
              CRC32 MyCRC;
              ProgressBar progressBar;
              Int32 blockCnt;

              UBLsb = new StringBuilder(imageData.Length * 2);

              // Read the data from the UBL file into the appropriate structures
              for (int i=0; i<imageData.Length; i+=sizeof(UInt32))
              {
            UBLsb.AppendFormat("{0:X8}", System.BitConverter.ToUInt32(imageData,i));
              }

              // Create CRC object and use it to calculate the UBL file's CRC
              // Note that this CRC is not quite the standard CRC-32 algorithm
              // commonly in use since the final register value is not XOR'd
              // with 0xFFFFFFFF.  As a result the CRC value returned here
              // will be the bitwise inverse of the standard CRC-32 value.
              MyCRC = new CRC32(0x04C11DB7, 0xFFFFFFFF, 0x00000000, true, 1, CRCType.ONESHOT, CRCCalcMethod.LUT);
              ackHeader.crcVal = MyCRC.CalculateCRC(imageData);
              ackHeader.byteCnt = (UInt32) imageData.Length;

              try
              {
              BOOTMESEQ:
            Console.WriteLine("\nWaiting for the "+devString+"...");

            // Wait for the device to send the ^BOOTME/0 sequence
            if (SerialIO.waitForSequence(" BOOTME\0", " BOOTME\0", MySP, cmdParams.verbose))
            Console.WriteLine("BOOTME commmand received. Returning ACK and header...");
            else
            goto BOOTMESEQ;

            // Output 28 Bytes for the ACK sequence and header
            // 8 bytes acknowledge sequence = "    ACK\0"
            MySP.Write("    ACK\0");

            // 8 bytes of CRC data = ASCII string of 8 hex characters
            MySP.Write(ackHeader.crcVal.ToString("X8"));

            // 4 bytes of UBL data size = ASCII string of 4 hex characters (3800h = 14336d)
            MySP.Write(ackHeader.byteCnt.ToString("X4"));

            // 4 bytes of start address = ASCII string of 4 hex characters (>=0100h)
            MySP.Write(ackHeader.startAddr.ToString("X4"));

            // 4 bytes of constant zeros = "0000"
            MySP.Write("0000");
            Console.WriteLine("ACK command sent. Waiting for BEGIN command... ");

            // Wait for the BEGIN sequence
            if (SerialIO.waitForSequence("  BEGIN\0", " BOOTME\0", MySP,true))
            {
              Console.WriteLine("BEGIN commmand received. Sending CRC table...");
            }
            else
            {
              goto BOOTMESEQ;
            }

            // Send the 1024 byte (256 word) CRC table
            progressBar = new ProgressBar();
            progressBar.Update(0.0,"Sending CRC table...");
            for (int i = 0; i < MyCRC.Length; i++)
            {
              MySP.Write(MyCRC[i].ToString("x8"));
              progressBar.Percent = (((Double)(i+1))/MyCRC.Length);
            }
            progressBar.Update(100.0,"CRC table sent.");
            Console.WriteLine("Waiting for DONE...");

            // Wait for the first DONE sequence
            if (SerialIO.waitForSequence("   DONE\0", " BOOTME\0", MySP, cmdParams.verbose))
            {
              Console.WriteLine("DONE received.  Sending the UBL...");
            }
            else
            {
              goto BOOTMESEQ;
            }

            // Send the contents of the UBL file (as hex text)
            progressBar = new ProgressBar();
            progressBar.Update(0.0,"Sending UBL...");
            blockCnt = UBLsb.Length/128;
            for (int i = 0; i < (blockCnt*128); i+=128)
            {
              MySP.Write(UBLsb.ToString(i,128));
              progressBar.Percent = (((Double)(i+1))/UBLsb.Length);
            }
            // Write last (possibly partial) block
            MySP.Write(UBLsb.ToString(blockCnt*128,UBLsb.Length - (blockCnt*128) ));
            progressBar.Update(100.0,"UBL sent.");

            // Wait for the second DONE sequence
            if (SerialIO.waitForSequence("   DONE\0", " BOOTME\0", MySP, cmdParams.verbose))
            {
              Console.WriteLine("DONE received.  UBL was accepted.");
            }
            else
            {
              goto BOOTMESEQ;
            }

              }
              catch (ObjectDisposedException e)
              {
            Console.WriteLine(e.StackTrace);
            throw e;
              }
        }