static void power_on (void) { /* Enable MCI and GPDMA clock */ PCONP |= (3 << 28); /* Enable GPDMA controller with little-endian */ GPDMA_CH0_CFG &= 0xFFF80000; /* Disable DMA ch-0 */ GPDMA_CONFIG = 0x01; /* Select PCLK for MCI, CCLK/2 = 36MHz */ PCLKSEL1 = (PCLKSEL1 & 0xFCFFFFFF) | 0x02000000; /* Attach MCI unit to I/O pad */ PINSEL1 = (PINSEL1 & 0xFFFFC03F) | 0x00002A80; /* MCICLK, MCICMD, MCIDATA0, MCIPWR */ #if USE_4BIT PINSEL4 = (PINSEL4 & 0xF03FFFFF) | 0x0A800000; /* MCIDATA1-3 */ #endif MCI_MASK0 = 0; MCI_COMMAND = 0; MCI_DATA_CTRL = 0; /* Interrupt handler for MCI,DMA event */ RegisterVector(MCI_INT, Isr_MCI, PRI_LOWEST-1, CLASS_IRQ); RegisterVector(GPDMA_INT, Isr_GPDMA, PRI_LOWEST-1, CLASS_IRQ); /* Power-on (VCC is always tied to the socket in this board) */ MCI_POWER = 0x01; for (Timer[0] = 10; Timer[0]; ); MCI_POWER = 0x03; }
void CTyHMProxy::Register() { if (m_display==0) { RegisterImage(m_str1); RegisterImage(m_str2); } else if (m_display==1) { RegisterVector(m_str1); RegisterVector(m_str2); } }
void uart1_init (void) { U1IER = 0x00; RegisterVector(UART1_INT, Isr_UART1, PRI_LOWEST, CLASS_IRQ); /* Set PCLKSEL0 to divide by one: U0PCLK = 72MHz */ PCONP |= 0x10; /* Turn UART1 on */ PCLKSEL0 = (PCLKSEL0 & (~0x30)) | 0x100; /* Attach UART1 unit to I/O pad */ PINSEL0 |= 0x40000000; /* Enable TxD1 P0.15 */ PINSEL1 |= 0x00000001; /* Enable RxD1 P0.16 */ /* Initialize UART0 */ U1LCR = 0x83; /* Select divisor latch */ U1DLM = U1_DLVAL >> 8; /* Initialize BRG */ U1DLL = U1_DLVAL & 0xff; U1FDR = (MULVAL << 4) | DIVADDVAL; U1LCR = 0x03; /* Set serial format N81 and deselect divisor latch */ U1FCR = 0x87; /* Enable FIFO */ U1TER = 0x80; /* Enable Tansmission */ /* Clear Tx/Rx FIFOs */ TxFifo1.rptr = 0; TxFifo1.wptr = 0; TxFifo1.count = 0; RxFifo1.rptr = 0; RxFifo1.wptr = 0; RxFifo1.count = 0; /* Enable Tx/Rx/Error interrupts */ U1IER = 0x07; }
void uart0_init (void) { U0IER = 0x00; RegisterVector(UART0_INT, Isr_UART0, PRI_LOWEST, CLASS_IRQ); /* Set PCLKSEL0 to divide by one: U0PCLK = 72MHz */ PCONP |= 8; /* Turn UART0 on */ PCLKSEL0 = (PCLKSEL0 & (~0xc0)) | 0x40; /* Attach UART0 unit to I/O pad */ PINSEL0 = (PINSEL0 & (~0xf0)) | 0x50; /* Initialize UART0 */ U0LCR = 0x83; /* Select divisor latch */ U0DLM = U0_DLVAL >> 8; /* Initialize BRG */ U0DLL = U0_DLVAL & 0xff; U0FDR = (MULVAL << 4) | DIVADDVAL; U0LCR = 0x03; /* Set serial format N81 and deselect divisor latch */ U0FCR = 0x87; /* Enable FIFO */ U0TER = 0x80; /* Enable Tansmission */ /* Clear Tx/Rx FIFOs */ TxFifo0.rptr = 0; TxFifo0.wptr = 0; TxFifo0.count = 0; RxFifo0.rptr = 0; RxFifo0.wptr = 0; RxFifo0.count = 0; /* Enable Tx/Rx/Error interrupts */ U0IER = 0x07; }
void uart0_init (void) { U0IER = 0x00; RegisterVector(UART0_INT, Isr_UART0, PRI_LOWEST, CLASS_IRQ); /* Attach UART0 unit to I/O pad */ PINSEL0 = (PINSEL0 & 0xFFFFFFF0) | 0x05; /* Initialize UART0 */ /* for 115200bps @ PCLK=60MHz */ U0LCR = 0x83; /* Select divisor latch */ U0DLM = 0; /* Initialize BRG */ U0DLL = 24; /* values from lpc2000.uart.baudrate.calculator.xls */ U0FDR = (14 << 4) | 5; /* available from www.standardics.nxp.com */ U0LCR = 0x03; /* Set serial format 8N1 and deselect divisor latch */ U0FCR = 0x87; /* Enable FIFO */ U0TER = 0x80; /* Enable Transmission */ /* Clear Tx/Rx FIFOs */ TxFifo0.rptr = 0; TxFifo0.wptr = 0; TxFifo0.count = 0; RxFifo0.rptr = 0; RxFifo0.wptr = 0; RxFifo0.count = 0; /* Enable Tx/Rx/Error interrupts */ U0IER = 0x07; }
int main(int argc, char ** argv) { char * iDir = NULL; char * oDir = NULL; Option opt; RegisterVector(); for (int i = 1; i < argc; ++i) { if (EQUAL(argv[i], "-i")) { iDir = argv[++i]; } else if (EQUAL(argv[i], "-o")) { oDir = argv[++i]; } else if (EQUAL(argv[i], "-f")) { opt.format = argv[++i]; } else { Usage(); } } if ( iDir == NULL || oDir == NULL || strcmp(iDir, oDir) == 0) { Usage(); } CPLErr err = BatchTxt(iDir, oDir, opt); VectorClean(); return err; }
void RegisterAll() { RegisterVector(); RegisterRaster(); }
OGRSFDriver * GetVectorDriver( const char * pszFormat ) { RegisterVector(); return OGRSFDriverRegistrar::GetRegistrar()->GetDriverByName( pszFormat ); }
OGRDataSource * VectorOpen( const char * pszFilename, GDALAccess eAccess ) { RegisterVector(); return (OGRDataSource *)OGROpen(pszFilename, eAccess, NULL); }
/********************************************************** Initialize **********************************************************/ #define PLOCK 0x400 static void feed(void) { PLLFEED = 0xAA; PLLFEED = 0x55; } #ifdef LPC214x void Initialize(void) { // Setting the Phased Lock Loop (PLL) // ---------------------------------- // // Olimex LPC-P2148 has a 12.0000 mhz crystal // // We'd like the LPC2148 to run at 60 mhz (has to be an even multiple of crystal) // // According to the Philips LPC2148 manual: M = cclk / Fosc where: M = PLL multiplier (bits 0-4 of PLLCFG) // cclk = 60000000 hz // Fosc = 12000000 hz // // Solving: M = 60000000 / 12000000 = 5 // // Note: M - 1 must be entered into bits 0-4 of PLLCFG (assign 4 to these bits) // // // The Current Controlled Oscilator (CCO) must operate in the range 156 mhz to 320 mhz // // According to the Philips LPC2148 manual: Fcco = cclk * 2 * P where: Fcco = CCO frequency // cclk = 60000000 hz // P = PLL divisor (bits 5-6 of PLLCFG) // // Solving: Fcco = 60000000 * 2 * P // P = 2 (trial value) // Fcco = 60000000 * 2 * 2 // Fcc0 = 240000000 hz (good choice for P since it's within the 156 mhz to 320 mhz range) // // From Table 22 (page 34) of Philips LPC2148 manual P = 2, PLLCFG bits 5-6 = 1 (assign 1 to these bits) // // Finally: PLLCFG = 0 01 00100 = 0x24 // // Final note: to load PLLCFG register, we must use the 0xAA followed 0x55 write sequence to the PLLFEED register // this is done in the short function feed() below // // Setting Multiplier and Divider values PLLCFG = 0x24; feed(); // Enabling the PLL */ PLLCON = 0x1; feed(); // Wait for the PLL to lock to set frequency while(!(PLLSTAT & PLOCK)) ; // Connect the PLL as the clock source PLLCON = 0x3; feed(); // Enabling MAM and setting number of clocks used for Flash memory fetch MAMTIM = 0x3; MAMCR = 0x2; // Setting peripheral Clock (pclk) to System Clock (cclk) VPBDIV = 0x1; } #else #define PLL_N 2UL #define PLL_M 72UL #define CCLK_DIV 4 #define USBCLKDivValue 5UL /* Fosc is divides by USBCLKDivValue+1 to make48MHz */ void Initialize(void) { #if 0 MEMMAP = 0x1; /* remap to internal flash */ PCONP |= 0x80000000; /* Turn On USB PCLK */ #endif // Setting the Phased Lock Loop (PLL) // ---------------------------------- // // CQ-FRK-NXP LPC2388 has a 12.0000 mhz crystal // // We'd like the LPC2388 to run at 72 mhz (has to be an even multiple of crystal) // // According to the Philips LPC2148 manual: M = cclk / Fosc where: M = PLL multiplier (bits 0-4 of PLLCFG) // cclk = 60000000 hz // Fosc = 12000000 hz // // Solving: M = 60000000 / 12000000 = 5 // // Note: M - 1 must be entered into bits 0-4 of PLLCFG (assign 4 to these bits) // // // The Current Controlled Oscilator (CCO) must operate in the range 156 mhz to 320 mhz // // According to the Philips LPC2148 manual: Fcco = cclk * 2 * P where: Fcco = CCO frequency // cclk = 60000000 hz // P = PLL divisor (bits 5-6 of PLLCFG) // // Solving: Fcco = 60000000 * 2 * P // P = 2 (trial value) // Fcco = 60000000 * 2 * 2 // Fcc0 = 240000000 hz (good choice for P since it's within the 156 mhz to 320 mhz range) // // From Table 22 (page 34) of Philips LPC2148 manual P = 2, PLLCFG bits 5-6 = 1 (assign 1 to these bits) // // Finally: PLLCFG = 0 01 00100 = 0x24 // // Final note: to load PLLCFG register, we must use the 0xAA followed 0x55 write sequence to the PLLFEED register // this is done in the short function feed() below // if ( PLLSTAT & (1 << 25) ) { PLLCON = 1; /* Disconnect PLL output if PLL is in use */ PLLFEED = 0xAA; PLLFEED = 0x55; } // Setting Multiplier and Divider values PLLCFG = ((PLL_N - 1) << 16) | (PLL_M - 1); /* Re-configure PLL */ feed(); // Enabling the PLL */ PLLCON = 0x1; feed(); // Wait for the PLL to lock to set frequency while ((PLLSTAT & (1 << 26)) == 0); /* Wait for PLL locked */ // while(!(PLLSTAT & PLOCK)) ; CCLKCFG = CCLK_DIV-1; /* Select CCLK frequency (divide ratio of hclk) */ USBCLKCFG = USBCLKDivValue; /* usbclk = 48 MHz */ // Connect the PLL as the clock source PLLCON = 0x3; feed(); MAMCR = 0; /* Configure MAM for 72MHz operation */ // Enabling MAM and setting number of clocks used for Flash memory fetch MAMTIM = 0x3; MAMCR = 0x2; PCLKSEL0 = 0x00000000; /* Select peripheral clock */ PCLKSEL1 = 0x00000000; ClearVector(); SCS |= 1; /* Enable FIO0 and FIO1 */ FIO1PIN2 = 0x04; /* -|-|-|-|-|LED|-|- */ FIO1DIR2 = 0x04; PINMODE3 = 0x00000020; #if 0 /* Initialize Timer0 as 1kHz interval timer */ RegisterVector(TIMER0_INT, Isr_TIMER0, PRI_LOWEST, CLASS_IRQ); T0CTCR = 0; T0MR0 = 18000 - 1; /* 18M / 1k = 18000 */ T0MCR = 0x3; /* Clear TC and Interrupt on MR0 match */ T0TCR = 1; IrqEnable(); #endif // uart0_init(INIT_BAUDRATE); // Setting peripheral Clock (pclk) to System Clock (cclk) }
void CTyHMProxy::Ty_Save(CFile *file, BOOL Yn) { ASSERT_VALID(this); if(Yn) //如果是在进行保存 { file->Write((unsigned char *)&m_x0,sizeof(m_x0)); file->Write((unsigned char *)&m_y0,sizeof(m_y0)); file->Write((unsigned char *)&m_x1,sizeof(m_x1)); file->Write((unsigned char *)&m_y1,sizeof(m_y1)); file->Write((unsigned char *)m_hmname,sizeof(char)*33); file->Write((unsigned char *)&m_display,sizeof(m_display)); file->Write((unsigned char *)m_str1,sizeof(char)*33); file->Write((unsigned char *)m_str2,sizeof(char)*33); file->Write((unsigned char *)&m_color1,sizeof(m_color1)); file->Write((unsigned char *)&m_color2,sizeof(m_color2)); file->Write((unsigned char *)&m_bFlash,sizeof(m_bFlash)); file->Write((unsigned char *)&m_FangXiang,sizeof(m_FangXiang)); file->Write((unsigned char *)&m_TextHeight,sizeof(m_TextHeight)); file->Write((unsigned char *)&m_TextWidth,sizeof(m_TextWidth)); file->Write((unsigned char *)&m_JqWidth,sizeof(m_JqWidth)); file->Write((unsigned char *)m_TextFont,sizeof(char)*16); file->Write((unsigned char *)&m_bTranslate1,sizeof(m_bTranslate1)); file->Write((unsigned char *)&m_bTranslate2,sizeof(m_bTranslate2)); } else { file->Read((unsigned char *)&m_x0,sizeof(m_x0)); file->Read((unsigned char *)&m_y0,sizeof(m_y0)); file->Read((unsigned char *)&m_x1,sizeof(m_x1)); file->Read((unsigned char *)&m_y1,sizeof(m_y1)); file->Read((unsigned char *)m_hmname,sizeof(char)*33); file->Read((unsigned char *)&m_display,sizeof(m_display)); file->Read((unsigned char *)m_str1,sizeof(char)*33); file->Read((unsigned char *)m_str2,sizeof(char)*33); file->Read((unsigned char *)&m_color1,sizeof(m_color1)); file->Read((unsigned char *)&m_color2,sizeof(m_color2)); file->Read((unsigned char *)&m_bFlash,sizeof(m_bFlash)); file->Read((unsigned char *)&m_FangXiang,sizeof(m_FangXiang)); file->Read((unsigned char *)&m_TextHeight,sizeof(m_TextHeight)); file->Read((unsigned char *)&m_TextWidth,sizeof(m_TextWidth)); file->Read((unsigned char *)&m_JqWidth,sizeof(m_JqWidth)); file->Read((unsigned char *)m_TextFont,sizeof(char)*16); file->Read((unsigned char *)&m_bTranslate1,sizeof(m_bTranslate1)); file->Read((unsigned char *)&m_bTranslate2,sizeof(m_bTranslate2)); if (m_display==0) { RegisterImage(m_str1); RegisterImage(m_str2); } else if (m_display==1) { RegisterVector(m_str1); RegisterVector(m_str2); } } }