/* * Kernel C code entry point. * Initializes kernel subsystems, mounts filesystems, * and spawns init process. */ void Main(struct Boot_Info* bootInfo) { Init_BSS(); Init_Screen(); Init_Mem(bootInfo); Init_CRC32(); Init_TSS(); Init_Interrupts(); Init_Scheduler(); Init_Traps(); Init_Timer(); Init_Keyboard(); Init_DMA(); Init_Floppy(); Init_IDE(); Init_PFAT(); Mount_Root_Filesystem(); Set_Current_Attr(ATTRIB(BLACK, GREEN|BRIGHT)); Print("Welcome to GeekOS!\n"); Set_Current_Attr(ATTRIB(BLACK, GRAY)); Spawn_Init_Process(); /* Now this thread is done. */ Exit(0); }
/* * Kernel C code entry point. * Initializes kernel subsystems, mounts filesystems, * and spawns init process. */ void Main(struct Boot_Info* bootInfo) { Init_BSS(); Init_Screen(); Init_Mem(bootInfo); Init_CRC32(); Init_TSS(); Init_Interrupts(); Init_Scheduler(); Init_Traps(); Init_Timer(); Init_Keyboard(); Set_Current_Attr(ATTRIB(BLACK, GREEN|BRIGHT)); Print("Welcome to GeekOS!\n"); Set_Current_Attr(ATTRIB(BLACK, GRAY)); /* TODO("Start a kernel thread to echo pressed keys and print counts");*/ Start_Kernel_Thread(&funct_eigen, 0, PRIORITY_NORMAL, false); /* Now this thread is done. */ Exit(0); }
/****************************************************************************** ** Main Function main() ******************************************************************************/ int main (void) { /* SystemClockUpdate() updates the SystemFrequency variable */ SystemClockUpdate(); //SystemFrequency = 72000000 by default Systick_Init(); //10 ms de bir tick atacak sekilde Systick i baslat Gpio_Config(); //Beacon MCU da kullanilacak pinleri konfigure et ADF7021_CHIP_POWER_DOWN; //CE pini asagi cek Delay_ms(10); ADF7021_LOAD_REGISTER_DISABLE; //LE pinini yukari cek, load register disable olsun Delay_ms(10); ADF7021_CHIP_POWER_UP; //CE pinini yukari cek, ADF7012 enable olsun Delay_ms(10); SSP1Init(); // SSP1 portunda SPI konusalim*/ DACInit(); // 1.2kHz ve 2kHz sinus olusturmak icin DAC peripheral i baslatalim Delay_ms(10); Init_Adf7012(); //Adf7012 registerlarini istedigimiz konfigurasyonda yazalim Init_Timer(10); //10us intervalinde timer0 baslat Enable_Timer(); //Timer0 enable et while ( 1 ); //main de yapilacak is kalmadi bundan sonra isr lerle devam edecegiz return 0; }
//打印在显示器上 void sys_Timer(void) { rt_uint32_t key_value; while(1) { LCD_Clear(); LCD_SetXY(0,0); LCD_WriteString("======Timer======="); LCD_SetXY(0,1); LCD_WriteString("M_TIME:"); LCD_WriteDouble(M_TIME); LCD_SetXY(0,2); LCD_WriteString("S_TIME:"); LCD_WriteDouble(S_TIME); LCD_SetXY(0,6); LCD_WriteString("1.Init_Timer"); if(rt_mb_recv(&Mb_Key, &key_value, RT_WAITING_NO) == RT_EOK) { switch(key_value) { case key1: Init_Timer(); break; case keyback: return; } } Delay_ms(1); } }
int main(void) { My_Init(); Init_Timer(); Init_I2C(); Init_Sensors(); SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF); GPIOPinTypeGPIOOutput(GPIO_PORTF_BASE, GPIO_PIN_1); ///////////////////////////////// SysCtlPeripheralEnable(SYSCTL_PERIPH_UART0); SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA); GPIOPinConfigure(GPIO_PA0_U0RX); GPIOPinConfigure(GPIO_PA1_U0TX); GPIOPinTypeUART(GPIO_PORTA_BASE, GPIO_PIN_0 | GPIO_PIN_1); SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF); //enable GPIO port for LED GPIOPinTypeGPIOOutput(GPIO_PORTF_BASE, GPIO_PIN_2); //enable pin for LED PF2 UARTConfigSetExpClk(UART0_BASE, SysCtlClockGet(), 115200, (UART_CONFIG_WLEN_8 | UART_CONFIG_STOP_ONE | UART_CONFIG_PAR_NONE)); IntMasterEnable(); //enable processor interrupts IntEnable(INT_UART0); //enable the UART interrupt UARTIntEnable(UART0_BASE, UART_INT_RX | UART_INT_RT); //only enable RX and TX interrupts ///////////////////////////////// Kalman_Sim_initialize(); while(1) { Read_Accelerometer(); Calculate_Acc(); Read_Compass(); Compass_Heading(); Calculate_Compass(); Read_Gyro(); Calculate_Gyro(); fgyro[0] = sen_data.gyro_x; fgyro[1] = sen_data.gyro_y; fgyro[2] = sen_data.gyro_z; facc[0] = sen_data.accel_x; facc[1] = sen_data.accel_y; facc[2] = sen_data.accel_z; fmag[0] = sen_data.magnetom_x; fmag[1] = sen_data.magnetom_y; fmag[2] = sen_data.magnetom_z; Kalman_Sim_step(); data[0]=Out1[0]; data[1]=Out1[1]; data[2]=Out1[2]; Timer_CyRun(); } }
void Main(struct Boot_Info *bootInfo) { Init_BSS(); Init_Screen(); Init_Mem(bootInfo); Init_CRC32(); Init_TSS(); lockKernel(); Init_Interrupts(0); Init_SMP(); TODO_P(PROJECT_VIRTUAL_MEMORY_A, "initialize virtual memory page tables."); Init_Scheduler(0, (void *)KERN_STACK); Init_Traps(); Init_Local_APIC(0); Init_Timer(); Init_Keyboard(); Init_DMA(); /* Init_Floppy(); *//* floppy initialization hangs on virtualbox */ Init_IDE(); Init_PFAT(); Init_GFS2(); Init_GOSFS(); Init_CFS(); Init_Alarm(); Release_SMP(); /* Initialize Networking */ Init_Network_Devices(); Init_ARP_Protocol(); Init_IP(); Init_Routing(); Init_Sockets(); Init_RIP(); /* End networking subsystem init */ /* Initialize Sound */ Init_Sound_Devices(); /* End sound init */ Mount_Root_Filesystem(); TODO_P(PROJECT_VIRTUAL_MEMORY_A, "initialize page file."); Set_Current_Attr(ATTRIB(BLACK, GREEN | BRIGHT)); Print("Welcome to GeekOS!\n"); Set_Current_Attr(ATTRIB(BLACK, GRAY)); TODO_P(PROJECT_SOUND, "play startup sound"); Spawn_Init_Process(); /* it's time to shutdown the system */ Hardware_Shutdown(); /* we should not get here */ }
void InitIRQDevices() { //initial timer0 Init_Timer(); //initial uart UART0_Init(); }
bool AsgbaInit(AsgbaEvtHdlr hdlr, uint8_t *bios, uint8_t *rom, uint32_t romsz) { PhyMemInit(bios, rom, romsz); InitCpu(); Init_DMA(); Init_INTR(); Init_Display(); Init_Timer(); g_funcOutEvtHdlr = hdlr; return true; }
//------------------------------------------------------------------------------ // === Initialize Function === //------------------------------------------------------------------------------ void Init_Main(void) { Disable_ISR(); // 전체인터럽트 사용금지 Init_Timer(); // 초기화_타이머0/1/2/3 Init_Uart(0,1000000); // 초기화_시리얼통신0 Init_Uart(1,57600); // 초기화_시리얼통신1 Init_ADC(); //Lcd_Init(); //sbi(DDRE,4); Enable_ISR(); // 전체인터럽트 사용허가 }
int main(void) { // SysCtlClockSet(SYSCTL_SYSDIV_1 | SYSCTL_USE_OSC | SYSCTL_OSC_MAIN| SYSCTL_XTAL_8MHZ); SysCtlClockSet(SYSCTL_SYSDIV_10 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN | SYSCTL_XTAL_8MHZ); SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOG); GPIOPinTypeGPIOOutput(GPIO_PORTG_BASE, GPIO_PIN_0); Init_ADC(); Init_PWM(); Init_Timer(); Init_UART(); while (1) { } }
int main(void) { //SysCtlClockSet(SYSCTL_SYSDIV_1 | SYSCTL_USE_OSC | SYSCTL_OSC_MAIN| SYSCTL_XTAL_8MHZ); //8MHz SysCtlClockSet(SYSCTL_SYSDIV_10 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN | SYSCTL_XTAL_8MHZ); //20MHz //SysCtlClockSet(SYSCTL_SYSDIV_4 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN | SYSCTL_XTAL_8MHZ); //50Mhz Init_GPIO(); Init_PWM(); Init_UART(); Init_Timer(); Init_ADC(); while (1) { } }
void Main_Init(void) { Disable_ISR(); // 전체인터럽트 사용금지 Init_Ext_Interrupt(INT0); // 초기화_외부인터럽트0/1/2/3/4/5/6/7 Init_Ext_Interrupt(INT1); // 초기화_외부인터럽트0/1/2/3/4/5/6/7 Init_Uart(UART0,9600); // 초기화_시리얼통신0 Init_Uart(UART1,9600); // 초기화_시리얼통신1 Init_ADC(); // 초기화_ADC Init_Timer(); init_lcd(); Motor_Init(); Enable_ISR(); // 전체인터럽트 사용허가 }
/* * Kernel C code entry point. * Initializes kernel subsystems, mounts filesystems, * and spawns init process. */ void Main(struct Boot_Info *bootInfo) { Init_BSS(); Init_Screen(); Init_Mem(bootInfo); Init_CRC32(); Init_TSS(); Init_Interrupts(); Init_Scheduler(); Init_Traps(); Init_Timer(); Init_Keyboard(); Init_DMA(); Init_Floppy(); Init_IDE(); Init_PFAT(); Init_GFS2(); Init_GOSFS(); Init_Alarm(); /* Initialize Networking */ Init_Network_Devices(); Init_ARP_Protocol(); Init_IP(); Init_Routing(); Init_Sockets(); Init_RIP(); /* End networking subsystem init */ Mount_Root_Filesystem(); Set_Current_Attr(ATTRIB(BLACK, GREEN | BRIGHT)); Print("Welcome to GeekOS!\n"); Set_Current_Attr(ATTRIB(BLACK, GRAY)); Spawn_Init_Process(); /* Now this thread is done. */ Exit(0); }
//------------------------------------------------------------------------------ // === Initialize Function === //------------------------------------------------------------------------------ void Init_Main(void) { Disable_ISR(); // 전체인터럽트 사용금지 Init_Timer(); // 초기화_타이머0/1/2/3 Init_Uart(0,9600); // 초기화_시리얼통신0 Init_Uart(1,9600); // 초기화_시리얼통신1 sbi(DDRG,0); // 1st_step sbi(DDRG,1); // 1st_dir sbi(DDRG,3); // 2nd_step sbi(DDRG,4); // 2nd_dir cbi(DDRC,0); // 1st_hall sensor cbi(DDRC,1); // 2nd_hall sensor Init_packet((PARTNER_PACKET*)&pPacket, (UART_CONTEXT*)&pContext ); Enable_ISR(); // 전체인터럽트 사용허가 }
/* * Kernel C code entry point. * Initializes kernel subsystems, mounts filesystems, * and spawns init process. */ void Main(struct Boot_Info* bootInfo) { Init_BSS(); Init_Screen(); Init_Mem(bootInfo); Init_CRC32(); Init_TSS(); Init_Interrupts(); Init_Scheduler(); Init_Traps(); Init_Timer(); Init_Keyboard(); Set_Current_Attr(ATTRIB(BLACK, GREEN|BRIGHT)); Print("Welcome to GeekOS!\n"); Set_Current_Attr(ATTRIB(BLACK, GRAY)); Start_Kernel_Thread(Print_Key_Pressed, 0, PRIORITY_NORMAL, false); /* Now this thread is done. */ Exit(0); }
/* *@功能 主函数入口 *@参数 空 *@返回 空 */ int main(void) { /*测试变量部分*/ /*******************************************/ uint8_t t=' '; uint8_t usb_code[6]={0x55,0x7A,0xBB,0x01,0x00,0x01};//下位机反复的向上位机发送此命令,用以建立初始化连接 uint8_t p[6]={0x30,0x31,0x32,0x33,0x34,0x35}; uint8_t hanzi[11]; uint8_t *phz; uint32_t flash_data; uint8_t flash_temp[4]; uint8_t status; uint32_t addr; uint8_t nChar; // uint8_t char_buf[50]; // uint8_t count; uint32_t batt_test=0; /*********************************************/ //设置中断向量表的位置在 0x5000,即内部flash的前20K NVIC_SetVectorTable(NVIC_VectTab_FLASH, 0x5000); SystemTick_Init(); NVIC_Configuration(); //按键初始化 Init_Sw_Key_Io(); Exit_Line_Init(); EXTILine_Mask(EXTI_Line5); EXTILine_Mask(EXTI_Line8); EXTILine_Mask(EXTI_Line15); //长按开机,如果长按不够3m则继续保持关机状态,如果长按3m,则退出停机模式,开机 WKUP_Init(); EXTILine_Unmask(EXTI_Line5); EXTILine_Unmask(EXTI_Line8); EXTILine_Unmask(EXTI_Line15); //如果没有进入停机模式,则开启显示 OLED_WR_Byte(0xAF,OLED_CMD); //开启显示 longpress=0; stop_flag=0; SPI_FLASH_Init(); //正常运行后,显示logo OLED_Init(); SPI_FLASH_Init(); OLED_Clear(); OLED_DrawBMP(32,2,48,4,hui); OLED_ShowUnite(48,2,"合科技"); //delay_ms(800); USB_BIT_Init(); //为降低功耗的控制位 /****************************************/ bluetooth_control_Init(); max232_control_Init(); oled_control_Init(); OLED_ON; buzzer_control_Init(); BUZZER_OFF; coil_control_Init(); COIL_NO_ACTUATE; /****************************************/ Init_Timer(); //实时时钟初始化 RTC_init(); //初始化并启动看门狗 //iwdg_init(); //串口1 USB初始化及配置 Uart1_Init(); USART1_Configuration(); //串口2 RFID初始化及配置 Uart2_Init(); USART2_Configuration(); //串口3 bluetooth初始化及配置 Uart3_Init(); USART3_Configuration(); bluetooth_Configuration(); //蓝牙的EN和BRST配置 CLR_BT_EN; //开启蓝牙 ADC_GPIO_Configuration(); ADC_Configuration(); //flash区域指针初始化 //SPI_FLASH_WriteWord(INIT_FLAG,1); //此次下载清flash SPI_FLASH_WriteWord(INIT_FLAG,0); //此次下载不清flash if(SPI_FLASH_ReadWord(INIT_FLAG) ==0x01) //当初始化标志等于1,就初始化POINT和ROW { mykey_init(); //初始化钥匙操作的头指针 ---如何设定在什么情况下重新设置 } // OLED_ClearArea(0,4,128,6); // OLED_ShowUnite(24,4,"初始化蓝牙"); // mac_query_result=bluetooth_mac(); /*延时函数测试*/ /**********************************************/ // GPIO_Configuration(); // while(1) // { // GPIO_SetBits(GPIOB,GPIO_Pin_0); // delay_ms(1000); // GPIO_ResetBits(GPIOB,GPIO_Pin_0); // delay_ms(3000); // } /**********************************************/ /*OLED测试*/ /**********************************************/ // while(1) // { // OLED_Clear(); // OLED_ShowChinese(0,0,0); //中 // OLED_ShowChinese(18,0,1); //景 // OLED_ShowChinese(36,0,2); //园 // OLED_ShowChinese(54,0,3); //电 // OLED_ShowChinese(72,0,4); //子 // OLED_ShowChinese(90,0,5); //科 // OLED_ShowChinese(108,0,6);//技 // OLED_ShowString(0,3,"1.3' OLED TEST"); // //OLED_ShowString(8,2,"ZHONGJINGYUAN"); // //OLED_ShowString(20,4,"2014/05/01"); // OLED_ShowString(0,6,"ASCII:"); // OLED_ShowString(63,6,"CODE:"); // OLED_ShowChar(48,6,t);//显示ASCII字符 // t++; // if(t>'~') // t=' '; // OLED_ShowNum(103,6,t,3,16);//显示ASCII字符的码值 // // delay_ms(8000); // //OLED_Clear(); // // OLED_DrawBMP(0,0,128,8,BMP1); //图片显示(图片显示慎用,生成的字表较大,会占用较多空间,FLASH空间8K以下慎用) // delay_ms(800); // // //OLED_Display_On(); // //delay_ms(800); // // OLED_DrawBMP(0,0,128,8,BMP2); // delay_ms(800); // // //OLED_Display_Off(); // //delay_ms(800); // } /**********************************************/ /*OLED+字库测试*/ /**********************************************/ // phz="字库"; // hanzi[0]=*phz; // hanzi[1]=*(phz+1); // hanzi[2]=*(phz+2); // hanzi[3]=*(phz+3); // hanzi[4]=*(phz+4); // // // OLED_ShowChinese(0,0,"汉"); // OLED_ShowChinese(16,0,"字"); // // OLED_ShowUnite(0,2,"你很不错"); // OLED_ShowUnite(0,4,"ABCDEF"); // OLED_ShowUnite(0,6,"123456"); /**********************************************/ /* STM32F103C8串口有3个 串口1通过USB接充电器,与上位机PC通信 串口2通过串口读RFID的数据 串口3通过蓝牙与PDA通信 */ /*串口1 USB测试*/ /**********************************************/ // while(1) // { // UART1nSendChar(1,"12345",5); // delay_ms(1000); // } //UART1nSendChar(1,usb_code,6); //USB_Cheak_init(); //Test_Usb_Data(); // UART1SendwordHex(1, 0x123456); // UART1nSendChar(1,"汉字",5); // while(1); /**********************************************/ /*串口2 RFID测试*/ /**********************************************/ // while(1) // { // OLED_ShowUnite(32,2,"RFID"); // delay_ms(1000); // UART1nSendChar(1,"12345",5); // //OLED_Clear(); //清屏 // nChar =Read_RfidData(2,Rfid_Buff,0xff); // m_UB2; // if(nChar ==5) // { // if(Rfid_Buff[0]==0&&Rfid_Buff[1]==0&&Rfid_Buff[2]==0&&Rfid_Buff[3]==0) // ; // else //至少有一个不为零 // { // UART1nSendChar(1,Rfid_Buff,5); // OLED_ShowNumHex(32,4,Rfid_Buff[0],2,16); // OLED_ShowNumHex(48,4,Rfid_Buff[1],2,16); // OLED_ShowNumHex(64,4,Rfid_Buff[2],2,16); // OLED_ShowNumHex(80,4,Rfid_Buff[3],2,16); // delay_ms(1000); // break; // } // } // } // while(1); /**********************************************/ /*串口3 bluetooth测试*/ /**********************************************/ // CLR_BT_EN; // CLR_BT_BRTS; // // while(1) // { // UART3nSendChar(3,"012345",6); // delay_ms(1000); // } // while(1) // { // UART3nSendChar(3,"TTM:MAC-?",9); // count=UART3GetCount(3); // UART3nReadChar(3,char_buf,count); // // // // // UART1nSendChar(1,char_buf,count); // delay_ms(1000); // } /**********************************************/ /*flash测试*/ /**********************************************/ // SPI_FLASH_WriteWord(AUTHOR_ROW,0x456789); // // SPI_FLASH_BufferRead(flash_temp,AUTHOR_ROW,4); // // flash_data=SPI_FLASH_ReadWord(AUTHOR_ROW); // UART1nSendChar(1,flash_temp,4); // // OLED_ShowNum(0,6,flash_data,8,16); // // //SPI_FLASH_WriteEnable(); // status=SPI_FLASH_ReadStatusReg(); // OLED_ShowNum(112,6,status,1,16); // SPI_FLASH_BulkErase(); // SPI_FLASH_BufferWrite("98765",0x100002,6); // SPI_FLASH_BufferRead(p,0x100002,6); // SPI_FLASH_Write("98765",0x1f0005,6); // SPI_FLASH_Read(p,0x1f0005,6); // while(1) // { // UART1nSendChar(1,p,6); // delay_ms(1000); // } /**********************************************/ //菜单测试 /**********************************************/ //Main_Lcd_Show(); //主界面显示 //Main_Lcd_Show2(); // mode=1; // // OLED_ShowChar(0,0,'A'); // // OLED_ShowChinese(0,2,"我"); // // OLED_ShowUnite(0,4,"你很不错"); // // while(1); // // mode=0; // delay_ms(1000); //ShowMenu(HsMenu); // Choose_MenuOp1(); // Choose_MenuOp4(); // Choose_MenuOp4_1(); // Choose_MenuOp4_2(); // Choose_MenuOp4_22(); // Choose_MenuOp4_3(); // Choose_MenuOp4_4(); // Choose_MenuOp5(); // Choose_MenuOp5_1(); // Choose_MenuOp5_3(); // Choose_MenuOp5_4(); // while(1) // { // Main_Oled_Time(); // Main_Oled_Power(); // delay_ms(1000); // } // while(1); /**********************************************/ //蜂鸣器测试 /**********************************************/ // while(1) // { // BUZZER_OFF; // delay_ms(1000); // // BUZZER_ON; // delay_ms(1500); // } /**********************************************/ //协议测试 /**********************************************/ //OLED_Clear(); // OLED_ShowUnite(32,2,"通信中.."); // OLED_ShowUnite(0,4,"你很不错"); // delay_ms(1000); // addr=0xFFFF; // OLED_ShowNumHex(0,6,addr,8,16); //USB_Cheak_init(); //USB_transmit(); // bluetooth_uart_switch=1; // Test_Usb_Data(); // while(1); // SPI_FLASH_WriteWord(AUTHOR_POINT,AUTHOR_START); // addr= SPI_FLASH_ReadWord(AUTHOR_POINT); // OLED_ShowNum(0,0,addr,8,16); /**********************************************/ //ADC测试 /**********************************************/ // while(1) // { // OLED_Clear(); // batt_test=ADC_GetConversionValue(ADC1); // OLED_ShowNum(24,2,batt_test,8,16); // delay_ms(1000); // } // /**********************************************/ //定时器2测试 /**********************************************/ // GPIO_Configuration(); // GPIO_ResetBits(GPIOB,GPIO_Pin_6); // delay_ms(10); // GPIO_SetBits(GPIOB,GPIO_Pin_6); // g_WaitTimeOut = 0; // SetTimer(TIMER_TIMEOUT,1,Do_TimeOut,THREE_MIN); // while(g_WaitTimeOut == 0) // { // GPIO_ResetBits(GPIOB,GPIO_Pin_6); // } // KillTimer(TIMER_TIMEOUT); // GPIO_SetBits(GPIOB,GPIO_Pin_6); // g_WaitTimeOut = 0; // SetTimer(TIMER_TIMEOUT,10,Do_TimeOut,THREE_MIN); // while(g_WaitTimeOut == 0) // { // nChar =Read_RfidData(2,Rfid_Buff,0xff); // if(nChar ==5) // { // OLED_ShowUnite(32,80,Rfid_Buff); // ++rfidrow; // delay_ms(1000); // for(i=0;i<4;i++) // { // for(k =0;k<40;k++) // msDelay(500); // WritEDAta(CAIMA_START+8*rfidrow+4+i,Rfid_Buff[i]); // } // break; // } // } // KillTimer(TIMER_TIMEOUT); /**********************************************/ // OLED_ClearArea(0,4,128,6); // OLED_ShowUnite(24,4,"初始化完成"); // delay_ms(100); //bluetooth_uart_switch=0; // for(int iter=0;iter<3;iter++) // Power_Cheak(); //主循环测试 g_State=ST_IDLE; while(1) { switch (g_State) //g_State是一个全局函数 { case ST_IDLE: //#define ST_IDLE 0XFF ST_Idle(); //空闲时做状态检测,可改变g_State break; case ST_USB: //#define ST_USB 0XFD USB_transmit(); //USB传输 break; // case ST_KEY: // Key_Trismit(); //读钥匙的RFID,判断是否已经连接上 // break; case ST_LCDMENU: //#define ST_LCDMENU 0XFA 多选择菜单操作 Choose_MenuOp1(); break; default:break; } } }
void Main(struct Boot_Info *bootInfo) { Init_BSS(); Init_Screen(); Init_Mem(bootInfo); Init_CRC32(); TODO_P(PROJECT_PERCPU, "Initialize PERCPU"); Init_TSS(); /* by modifying begin_int_atomic to autolock if not locked when interrupts are disabled, this lockKernel() became duplicative */ /* lockKernel(); */ Init_Interrupts(0); Print("Init_SMP\n"); Init_SMP(); Print("/Init_SMP\n"); TODO_P(PROJECT_VIRTUAL_MEMORY_A, "initialize virtual memory page tables."); Init_Scheduler(0, (void *)KERN_STACK); Init_Traps(); Init_Local_APIC(0); Init_Timer(); Init_Keyboard(); Init_DMA(); /* Init_Floppy(); *//* floppy initialization hangs on virtualbox */ Init_IDE(); Init_PFAT(); if(Init_GFS2) Init_GFS2(); if(Init_GFS3) Init_GFS3(); Init_GOSFS(); Init_CFS(); Init_Alarm(); Init_Serial(); Print("the global lock is %sheld.\n", Kernel_Is_Locked()? "" : "not "); Release_SMP(); /* Initialize Networking */ /* Init_Network_Devices(); Init_ARP_Protocol(); Init_IP(); Init_Routing(); Init_Sockets(); Init_RIP(); */ /* End networking subsystem init */ /* Initialize Sound */ Init_Sound_Devices(); /* End sound init */ Mount_Root_Filesystem(); TODO_P(PROJECT_VIRTUAL_MEMORY_A, "initialize page file."); Set_Current_Attr(ATTRIB(BLACK, GREEN | BRIGHT)); Print("Welcome to GeekOS!\n"); Set_Current_Attr(ATTRIB(BLACK, GRAY)); TODO_P(PROJECT_SOUND, "play startup sound"); TODO_P(PROJECT_SERIAL, "Initialize the serial console and start the shell."); Spawn_Init_Process(); /* it's time to shutdown the system because Init exited. */ Hardware_Shutdown(); /* we should not get here */ }
//------------------------------------------------------------------------------ // L298을 사용하였다. // PORTB 0 : 모터LEFT - // PORTB 2 : 모터LEFT + // PORTB 1 : 모터RIGHT - // PORTB 3 : 모터RIGHT + // 0C1A : 모터LEFT 속도(타이머1사용 PWM0) // 0C1B : 모터LEFT 속도(타이머1사용 PWM1) //------------------------------------------------------------------------------ void Init_L298(void) { Init_Timer(); DDRB = 0xff; }