DLL(CommandLine) *CommandLine :: GetEntryPoint (char *names, uint16 *posptr, logical recursive ) { char name[64]; CommandLine *cmdline; CLEntryPoint *clep; DLL(CommandLine) *cmdlist; BEGINSEQ if ( !entry_points ) ERROR gvtxstb(name,names,sizeof(name)); *posptr = USHORTMAX; if ( clep = entry_points->GetEntry(name) ) { *posptr = clep->get_cmd_pos(); cmdlist = clep->get_cmd_list(); } else if ( recursive ) { DLL(CommandLine) cursor(*cmd_list); cursor.GoTop(); while ( cmdline = cursor.GetNext() ) if ( cmdlist = cmdline->GetEntryPoint(names,posptr,recursive) ) break; } RECOVER cmdlist = NULL; ENDSEQ return(cmdlist); }
/** * \brief ターゲットのシリアル初期化 * \param siopid SIOのポートID * \details * siopidで指定されるターゲットのSIOペリフェラルを初期化する。初期化するのは、ストップビットやビット数といった * プロトコルのほか、ボーレートも含む。この館数は、target_initialize() 関数からも呼び出され、バナー出力用の * ポート初期化に使用される。 * * ボーレートの設定にはUARTへ供給されるクロック周波数の設定が必要であるが、これは全UARTで共通であると * 仮定して決めうちしている。周波数はSIO_UART_CLOCKで指定する。単位はHzである。また、ボーレートは * * SIO_BAUD_RATE_DEFAULTに設定されるが、上書きしたければSIOx_BAUD_RATEを宣言する。単位はBAUDである。 */ void target_uart_init(ID siopid) { uint32_t reg = sioreg_table[SIOPID2INDEX(siopid)]; /* 使用するUARTのベースアドレスを取得 */ /* UARTの無効化 */ uart_write( reg, UART_LCR, 0 ); /* DLAB モードをいったんクリアする */ uart_write( reg, UART_FCR, 0 ); /* FIFO クリア*/ uart_write( reg, UART_IER, 0 ); /* 割り込みをディセーブルにする */ /* ボーレートの設定 */ uart_write( reg, UART_LCR, LCR_DLAB ); /* ディバイザ設定モードに移行 */ switch (siopid) { case 1: #if defined(SIO_BAUD_RATE_PORT1) uart_write( reg, UART_DLL, DLL((SIO_UART_CLOCK/SIO_BAUD_RATE_PORT1/16)) ); uart_write( reg, UART_DLM, DLM((SIO_UART_CLOCK/SIO_BAUD_RATE_PORT1/16)) ); #else uart_write( reg, UART_DLL, DLL((SIO_UART_CLOCK/SIO_BAUD_RATE_DEFAULT/16)) ); uart_write( reg, UART_DLM, DLM((SIO_UART_CLOCK/SIO_BAUD_RATE_DEFAULT/16)) ); #endif break; case 2: #if defined(SIO_BAUD_RATE_PORT2) uart_write( reg, UART_DLL, DLL((SIO_UART_CLOCK/SIO_BAUD_RATE_PORT2/16)) ); uart_write( reg, UART_DLM, DLM((SIO_UART_CLOCK/SIO_BAUD_RATE_PORT2/16)) ); #else uart_write( reg, UART_DLL, DLL((SIO_UART_CLOCK/SIO_BAUD_RATE_DEFAULT/16)) ); uart_write( reg, UART_DLM, DLM((SIO_UART_CLOCK/SIO_BAUD_RATE_DEFAULT/16)) ); #endif break; case 3: #if defined(SIO_BAUD_RATE_PORT3) uart_write( reg, UART_DLL, DLL((SIO_UART_CLOCK/SIO_BAUD_RATE_PORT3/16)) ); uart_write( reg, UART_DLM, DLM((SIO_UART_CLOCK/SIO_BAUD_RATE_PORT3/16)) ); #else uart_write( reg, UART_DLL, DLL((SIO_UART_CLOCK/SIO_BAUD_RATE_DEFAULT/16)) ); uart_write( reg, UART_DLM, DLM((SIO_UART_CLOCK/SIO_BAUD_RATE_DEFAULT/16)) ); #endif break; case 4: #if defined(SIO_BAUD_RATE_PORT4) uart_write( reg, UART_DLL, DLL((SIO_UART_CLOCK/SIO_BAUD_RATE_PORT4/16)) ); uart_write( reg, UART_DLM, DLM((SIO_UART_CLOCK/SIO_BAUD_RATE_PORT4/16)) ); #else uart_write( reg, UART_DLL, DLL((SIO_UART_CLOCK/SIO_BAUD_RATE_DEFAULT/16)) ); uart_write( reg, UART_DLM, DLM((SIO_UART_CLOCK/SIO_BAUD_RATE_DEFAULT/16)) ); #endif break; } /* デバイザ設定モードから、通常モードに戻す */ uart_write( reg, UART_LCR, 0 ); /* 通常モードに移行 */ /* プロトコルを設定。8bit, 1stop bit, parityなし */ uart_write( reg, UART_LCR, LCR_NP_8_1 ); /* 通常モードに移行 */ }
void serial_setbrg (void) { unsigned int quot = 0; int uart = CONFIG_SYS_IXP425_CONSOLE; if ((gd->baudrate <= SERIAL_CLOCK) && (SERIAL_CLOCK % gd->baudrate == 0)) quot = SERIAL_CLOCK / gd->baudrate; else hang (); IER(uart) = 0; /* Disable for now */ FCR(uart) = 0; /* No fifos enabled */ /* set baud rate */ LCR(uart) = LCR_WLS0 | LCR_WLS1 | LCR_DLAB; DLL(uart) = quot & 0xff; DLH(uart) = quot >> 8; LCR(uart) = LCR_WLS0 | LCR_WLS1; #ifdef CONFIG_SERIAL_RTS_ACTIVE MCR(uart) = MCR_RTS; /* set RTS active */ #else MCR(uart) = 0; /* set RTS inactive */ #endif IER(uart) = IER_UUE; }
static void uart_init_line(int port, unsigned long baud) { int i, baudconst; switch (baud) { case 115200: baudconst = 1; break; case 57600: baudconst = 2; break; case 38400: baudconst = 3; break; case 19200: baudconst = 6; break; case 9600: default: baudconst = 12; break; } outb(0x87, LCR(port)); outb(0x00, DLM(port)); outb(baudconst, DLL(port)); outb(0x07, LCR(port)); outb(0x0f, MCR(port)); for (i = 10; i > 0; i--) { if (inb(LSR(port)) == (unsigned int) 0) break; inb(RBR(port)); } }
logical CACObject :: CloseObject ( ) { logical term = YES; #ifndef IF_Class // client version DLL(CNode) *nodelist; CNode *cnodeptr; ACObject *objptr; if ( IsValid() ) { ACObject::CloseObject(); if ( nodelist = topnode_list ) { topnode_list = NULL; while ( cnodeptr = nodelist->RemoveTail() ) { cnodeptr->Switch(AUTO); delete cnodeptr; } delete nodelist; } while ( objptr = object_list->GetTail() ) delete objptr; if ( (ACObject *)db_handle != (ACObject *)this && GetServerObject() ) { LockSendParms().Fill(); CConnection()->SendCSMessage(this,S_CACObject,SF_CACObject_CloseObject_ci); UnlockSendParms(); UninitHandle(); } } return(term); #else // server version ((SC_DBObject *)cso_ptr)->SetClientObject(0); ((SC_DBObject *)cso_ptr)->Remove(); result->Fill(); return(NO); #endif }
static void fpga_reset(int iobase) { outb(0, IER(iobase)); outb(LCR_DLAB | LCR_BIT5, LCR(iobase)); outb(1, DLL(iobase)); outb(0, DLM(iobase)); outb(LCR_BIT5, LCR(iobase)); inb(LSR(iobase)); inb(MSR(iobase)); /* turn off FPGA supply voltage */ outb(MCR_OUT1 | MCR_OUT2, MCR(iobase)); delay(100); /* turn on FPGA supply voltage again */ outb(MCR_DTR | MCR_RTS | MCR_OUT1 | MCR_OUT2, MCR(iobase)); delay(100); }
static inline void ser12_set_divisor(struct net_device *dev, unsigned char divisor) { outb(0x81, LCR(dev->base_addr)); /* DLAB = 1 */ outb(divisor, DLL(dev->base_addr)); outb(0, DLM(dev->base_addr)); outb(0x01, LCR(dev->base_addr)); /* word length = 6 */ /* * make sure the next interrupt is generated; * 0 must be used to power the modem; the modem draws its * power from the TxD line */ outb(0x00, THR(dev->base_addr)); /* * it is important not to set the divider while transmitting; * this reportedly makes some UARTs generating interrupts * in the hundredthousands per second region * Reported by: [email protected] (Ignacio Arenaza Nuno) */ }
static void yam_set_uart(struct net_device *dev) { struct yam_port *yp = netdev_priv(dev); int divisor = 115200 / yp->baudrate; outb(0, IER(dev->base_addr)); outb(LCR_DLAB | LCR_BIT8, LCR(dev->base_addr)); outb(divisor, DLL(dev->base_addr)); outb(0, DLM(dev->base_addr)); outb(LCR_BIT8, LCR(dev->base_addr)); outb(PTT_OFF, MCR(dev->base_addr)); outb(0x00, FCR(dev->base_addr)); /* Flush pending irq */ inb(RBR(dev->base_addr)); inb(MSR(dev->base_addr)); /* Enable rx irq */ outb(ENABLE_RTXINT, IER(dev->base_addr)); }
\param bcOWindow \param bcODataSourceHaving \param subApplications \param subApplicationsRead \param sobject \param ilanguage \param odatabase */ /******************************************************************************/ #undef MOD_ID #define MOD_ID "OApplication" OApplication :: OApplication (OWindow bcOWindow, ODataSourceHaving bcODataSourceHaving, DLL(OApplication) subApplications, logical subApplicationsRead, char *sobject, int ilanguage, ODB_Definition odatabase ) : OWindow(bcOWindow) ,ODataSourceHaving(bcODataSourceHaving) ,subApplications(subApplications) ,subApplicationsRead(subApplicationsRead) ,object(NULL) // strdup ,language(ilanguage) ,database(odatabase) { if (sobject) object = strdup(sobject); /* OApplication (" + ADK_Window::Generate() + ", " + data_source.Generate() + ", " + subApplications + "
/** \brief i01 \param bcOEventAction_intern \param iEAType \param pOField \param pOEventActions \param pOSubEventActions */ /******************************************************************************/ #undef MOD_ID #define MOD_ID "OEventActionControl" OEventActionControl :: OEventActionControl (OEventAction_intern bcOEventAction_intern, int16 iEAType, OField *pOField, DLL(OEventAction) *pOEventActions, DLL(OEventAction) *pOSubEventActions ) : OEventAction_intern(bcOEventAction_intern) ,type((EventActionType)iEAType) ,action_field(pOField) ,group_actions(pOEventActions) ,sub_actions(pOSubEventActions) { /* "OEventActionControl(" + ADK_EventAction_intern::Generate() + ", " + type + ", " + action_field.GenerateList() + ", " + sub_actions.GenerateList() + ", " + group_actions.GenerateList() + ")"; */
/******************************************************************************/ /** \brief ResetActions - \param action_list - */ /******************************************************************************/ #undef MOD_ID #define MOD_ID "ResetActions" void OElementStyle :: ResetActions (DLL(OEventAction) *action_list ) { OEventAction *action; if ( action_list ) while ( action = action_list->RemoveTail() ) action->Release(); } /******************************************************************************/ /** \brief SetStyle -
/******************************************************************************/ /** \brief i01 \param children_list \param delete_on_destroy \param component_state \param component_owner */ /******************************************************************************/ #undef MOD_ID #define MOD_ID "TBaseComponent" TBaseComponent :: TBaseComponent (DLL(TBaseComponent) children_list, logical delete_on_destroy, int component_state, TBaseComponent *component_owner ) : deleteOnDestroy(delete_on_destroy), componentState(component_state) { /* ?? "TBaseComponent(" + " children_list" + ", " + "NO" + ", 0" + ", NULL" + ")"; */ }
int main(int argc, char *argv[]) { unsigned i; const char * InFile, * BaseName; if(argc != 2 || !strcmp(argv[1], "-h") || !strcmp(argv[1], "--help")) { printf("Usage: rtti-reader infile\n" "Extract class information from an EXE or DLL using MSVC RTTI.\n" "\n" "Report bugs to <*****@*****.**>.\n" "rtti-reader is maintained by the Niotso project.\n" "Home page: <http://www.niotso.org/>\n"); return 0; } InFile = argv[1]; int slash; for(i=0, slash=-1; InFile[i]; i++) if(InFile[i] == '/' || InFile[i] == '\\') slash = i; BaseName = InFile + slash + 1; PEFile DLL(InFile); if(DLL.read16() != 0x5A4D) //"MZ" Shutdown_M("Not a valid Windows PE file"); DLL.seek(60); DLL.seek(DLL.read32(), 6); unsigned SegmentCount = DLL.read16(); DLL.skip(12); unsigned OptionalHeaderSize = DLL.read16(); DLL.skip(30); unsigned ImageBase = DLL.read32(); DLL.skip(OptionalHeaderSize, -32); for(i=0; i<SegmentCount; i++) { if(!DLL.strcmp(".rdata")) { DLL.skip(16); DLL.rdata.size = DLL.read32(); DLL.rdata.offset = DLL.read32(); DLL.skip(16); } else if(!DLL.strcmp(".data")) { DLL.skip(16); DLL.data.size = DLL.read32(); DLL.data.offset = DLL.read32(); DLL.skip(16); } else DLL.skip(40); } if(DLL.rdata.size == 0) Shutdown_M("Missing .rdata segment"); else if(DLL.data.size == 0) Shutdown_M("Missing .data segment"); else if(DLL.rdata.size > UINT_MAX-DLL.rdata.offset || DLL.rdata.size+DLL.rdata.offset > DLL.brc.end) Shutdown_M(".rdata segment is invalid"); else if(DLL.data.size > UINT_MAX-DLL.data.offset || DLL.data.size+DLL.data.offset > DLL.brc.end) Shutdown_M(".data segment is invalid"); printf("\n****\n** [ 1 of 2] RTTI Report for %s\n****\n", BaseName); RTTIVector<RTTIClass> RCL; RCL.init(); DLL.lookat(DLL.data); unsigned TotalClassCount = 0; while(DLL.skip(8) && DLL.memfind(".?AV", 4, PEFile::Parse_QuestionMark)) { TotalClassCount++; size_t length = DLL.strlen(); if(length == (unsigned)-1) Shutdown_M("Unexpectedly reached end of binary"); size_t TDAddress = DLL.brc.position + ImageBase - 8, datapos = DLL.brc.position + length + 1; DLL.lookat(DLL.rdata); RTTIClass * RCPointer = NULL; for(size_t rdatapos = DLL.brc.position + 12; DLL.seek(rdatapos) && DLL.find32(TDAddress); rdatapos += 4, DLL.lookat(DLL.rdata)) { //Find all complete object locators that belong to this class rdatapos = DLL.brc.position; if(!DLL.skip(4)) continue; size_t CDAddress = DLL.read32() - ImageBase; if(CDAddress < DLL.brc.start || CDAddress > DLL.brc.end-4) continue; //This was a base class descriptor //Add this COL to our respective RTTIClass bool newclass = false; if(RCPointer == NULL) { //This is a new class; add it to the RCL newclass = true; RTTIClass& RC = RCL.add(); RCPointer = &RC; RC.init(); } RTTIClass& RC = *RCPointer; RTTICompleteObjectLocator& COL = RC.COLL.add(); DLL.seek(rdatapos,-12); size_t COLAddress = DLL.brc.position + ImageBase; if(!DLL.Fill(COL)) Shutdown_M("Unexpectedly reached end of binary"); DLL.lookat(DLL.rdata); COL.VTableAddress = (DLL.find32(COLAddress)) ? DLL.brc.position + ImageBase + 4 : (uint32_t)-1; if(newclass) { if(!DLL.seek(COL.Fields.ClassDescriptorAddress - ImageBase)) Shutdown_M("Unexpectedly reached end of binary"); RTTIClassHierarchyDescriptor& CHD = RC.CHD; if(!DLL.Fill(CHD)) Shutdown_M("Unexpectedly reached end of binary"); if(!DLL.seek(CHD.Fields.BaseClassListAddress - ImageBase)) Shutdown_M("Unexpectedly reached end of binary"); size_t bcdlpos; for(i=0, bcdlpos = DLL.brc.position; i<CHD.Fields.BaseClassCount; i++, bcdlpos+=4) { DLL.lookat(DLL.rdata); if(!DLL.seek(bcdlpos)) Shutdown_M("Unexpectedly reached end of binary"); uint32_t BCDAddress = DLL.read32(); if(!DLL.seek(BCDAddress - ImageBase)) Shutdown_M("Unexpectedly reached end of binary"); RTTIBaseClassDescriptor& BCD = CHD.BCDL.add(); if(!DLL.Fill(BCD)) Shutdown_M("Unexpectedly reached end of binary"); DLL.lookat(DLL.data); if(!DLL.seek(BCD.Fields.TypeDescriptorAddress - ImageBase)) Shutdown_M("Unexpectedly reached end of binary"); if(!DLL.Fill(BCD.TD)) Shutdown_M("Unexpectedly reached end of binary"); length = DLL.strlen(); if(length == (unsigned)-1) Shutdown_M("Unexpectedly reached end of binary"); BCD.TD.Name = (char*) malloc(length+1); BCD.TD.UnmangledName = (char*) malloc(length+1-6); if(!BCD.TD.Name || !BCD.TD.UnmangledName) Shutdown_M("Failed to allocate memory"); DLL.strcpy(BCD.TD.Name); for(size_t j=0; j<length-6; j++) { char c = BCD.TD.Name[j+4]; BCD.TD.UnmangledName[j] = ( (c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z') || (c >= '0' && c <= '9') || c == '_') ? c : ' '; } BCD.TD.UnmangledName[length-6] = '\0'; if(newclass) { newclass = false; memcpy(&RC.TD, &BCD.TD, sizeof(RTTITypeDescriptor)); } } } } DLL.lookat(DLL.data); DLL.seek(datapos); } for (i=0; i<RCL.Count; i++) { RTTIClass& RC = RCL.Buffer[i]; RTTIClassHierarchyDescriptor& CHD = RC.CHD; printf("\nClass %s (mangled: %s)\n", RC.TD.UnmangledName, RC.TD.Name); printf(" * Class Hierarchy Descriptor: (Address %08X)\n", CHD.Fields.Address + ImageBase); printf(" * Reserved: %u\n", CHD.Fields.Reserved); printf(" * Attributes: %u\n", CHD.Fields.Attributes); printf(" * Base class count: %u\n", CHD.Fields.BaseClassCount); printf(" * Base class list address: %08X\n", CHD.Fields.BaseClassListAddress); for(uint32_t j=0; j<CHD.Fields.BaseClassCount; j++) { RTTIBaseClassDescriptor& BCD = CHD.BCDL.Buffer[j]; printf(" * Base class descriptor #%u: (Address %08X)\n", j, BCD.Fields.Address + ImageBase); printf(" * Base class count: %u\n", BCD.Fields.BaseClassCount); printf(" * Member offset: %d\n", BCD.Fields.MemberOffset); printf(" * COL address offset: %d\n", BCD.Fields.COLAddressOffset); printf(" * v-table offset: %d\n", BCD.Fields.VTableOffset); printf(" * Attributes: %u\n", BCD.Fields.Attributes); printf(" * Type descriptor: (Address %08X)\n", BCD.Fields.TypeDescriptorAddress); printf(" * v-table address: %08X\n", BCD.TD.Fields.VTableAddress); printf(" * Reserved: %u\n", BCD.TD.Fields.Reserved); printf(" * Name: %s (mangled: %s)\n", BCD.TD.UnmangledName, BCD.TD.Name); } for(uint32_t j=0; j<RC.COLL.Count; j++) { RTTICompleteObjectLocator& COL = RC.COLL.Buffer[j]; printf(" * Complete object locator #%u: (Address %08X)\n", j, COL.Fields.Address + ImageBase); printf(" * Reserved: %u\n", COL.Fields.Reserved); printf(" * Offset: %d\n", COL.Fields.Offset); printf(" * CD Offset: %d\n", COL.Fields.CDOffset); printf(" * Type descriptor address: %08X\n", COL.Fields.TypeDescriptorAddress); printf(" * Class descriptor address: %08X\n", COL.Fields.ClassDescriptorAddress); printf(" * v-table address: %08X\n", COL.VTableAddress); } } printf("\n****\n** [ 2 of 2 ] Class Hierarchy for %s\n****\n", BaseName); qsort(RCL.Buffer, RCL.Count, sizeof(RTTIClass), RTTIClass::Compare); for(i=0; i<RCL.Count; i++) { RTTIClass& RC = RCL.Buffer[i]; printf("\nclass %s", RC.TD.UnmangledName); if(RC.CHD.BCDL.Count > 1) { //The first BCD always refers to the class itself, e.g. class A "depends on class A". printf(" : %s", RC.CHD.BCDL.Buffer[1].TD.UnmangledName); for(uint32_t j=2; j<RC.CHD.BCDL.Count; j++) printf(", %s", RC.CHD.BCDL.Buffer[j].TD.UnmangledName); } printf(";"); } printf("\n\nCompleted RTTI report.\nDependencies provided for %u of %u classes.\n", (unsigned)RCL.Count, TotalClassCount); return 0; }
#error "If you don't use UART, please remove this file from your make file" #endif #if TNUM_SIOP_UART > 3 #error "Only TNUM_SIOP_UART < 4 is supported" #endif /* TNUM_SIOP_UART >= 2 */ /* ディバイザ計算マクロ */ #define DLM(divisor) (divisor/256) #define DLL(divisor) (divisor%256) SIOPINIB siopinib_table[TNUM_SIOP_UART] = { /*----------------------------------------------------------------- * PDICが管理する最初のUARTの初期化パラメータ */ {UART0_ADDRESS, DLM(UART0_DIVISOR), DLL(UART0_DIVISOR), #ifdef UART0_BLACKFIN_UCEN 1 /* マクロUART0_BLACKFIN_UCENが定義されていたら、GCTLのUCENを1にしてクロックを動かす */ #else 0 #endif } /*----------------------------------------------------------------- * PDICが管理する2番目のUARTの初期化パラメータ */ #if TNUM_SIOP_UART > 1 ,{UART1_ADDRESS, DLM(UART1_DIVISOR), DLL(UART1_DIVISOR), #ifdef UART1_BLACKFIN_UCEN 1 /* マクロUART1_BLACKFIN_UCENが定義されていたら、GCTLのUCENを1にしてクロックを動かす */