inline void Initialization_All(void) { init_outpin(); AdcInit(); GlobalTimerInit(); Button_Init(); init_meandr__gpio(); init_meandr_timer(); Init_Uart3(); //TIM3_IRQHandler(); NVIC_InitTypeDef NVIC_InitStructure_usart3; NVIC_InitStructure_usart3.NVIC_IRQChannel = USART3_IRQn; NVIC_InitStructure_usart3.NVIC_IRQChannelSubPriority = 1; NVIC_InitStructure_usart3.NVIC_IRQChannelPreemptionPriority = 1; NVIC_InitStructure_usart3.NVIC_IRQChannelCmd = ENABLE; NVIC_Init (&NVIC_InitStructure_usart3); USART_ITConfig(USART3, USART_IT_RXNE, ENABLE); //state_err=2; //USART_ITConfig(USART3, USART_IT_ERR, ENABLE); USART_ITConfig(USART3, USART_IT_TC, DISABLE); // NVIC_conf(); display.a.port = GPIOH; display.b.port = GPIOC; display.c.port = GPIOE; display.d.port = GPIOE; display.e.port = GPIOE; display.f.port = GPIOE; display.g.port = GPIOB; display.common[0].port = GPIOC; display.common[1].port = GPIOC; display.common[2].port = GPIOH; display.dot.port = GPIOB; display.a.pin = GPIO_Pin_0; display.b.pin = GPIO_Pin_14; display.c.pin = GPIO_Pin_6; display.d.pin = GPIO_Pin_4; display.e.pin = GPIO_Pin_2; display.f.pin = GPIO_Pin_0; display.g.pin = GPIO_Pin_8; display.common[0].pin = GPIO_Pin_13; display.common[1].pin = GPIO_Pin_15; display.common[2].pin = GPIO_Pin_1; display.dot.pin = GPIO_Pin_6; DI_Init(&display); }
int amigaInit(int *argc, char **argv[]) { int done = TRUE; #if !defined(__POWERUP__) && !defined(__amigaos4__) && !defined(__MORPHOS__) if (!MemInit()) return FALSE; #endif #ifdef __OS3PPC__ /* ** PPC */ /* Set the priority of the PPC 68k mirror main task */ #ifdef CHANGE_MIRROR_TASK_PRI Old68kMirrorPri = SetTaskPri(FindTask(NULL), 2); #endif #ifdef __POWERUP__ /* ** PowerUp */ /* Requires ppc.library 46.30 (or PPCLibEmu), due to timer/signal bugs */ #define PPCINFOTAG_EMULATION (TAG_USER + 0x1f0ff) if (PPCGetAttr(PPCINFOTAG_EMULATION) == 'WARP') { if (!((PPCVersion() == 46 && PPCRevision() >= 29) || PPCVersion() > 46)) { printf("Requires PPCLibEmu 0.8a or higher!\n"); done = FALSE; } } else { if (!((PPCVersion() == 46 && PPCRevision() >= 30) || PPCVersion() > 46)) { printf("Requires ppc.library 46.30 or higher!\n"); done = FALSE; } } if (done) { if (PPCGetTaskAttr(PPCTASKTAG_STACKSIZE) < 200000) { printf("Please increase stack size to at least 200000 bytes!\n"); done = FALSE; } } if (done) { done = ((PPCLibBase = OpenLibrary("ppc.library",46)) != NULL); } if (done) { struct TagItem tags[2] = { {PPCPORTTAG_NAME, (ULONG)"dnetc"}, {TAG_END,0} }; void *port; if (!(port = PPCObtainPort(tags))) { done = FALSE; if ((TriggerPort = PPCCreatePort(tags))) { done = TRUE; } } else { PPCReleasePort(port); } } #else /* ** WarpOs */ if (!FindPortPPC("dnetc")) { if ((TriggerPort = CreateMsgPortPPC())) { TriggerPort->mp_Port.mp_Node.ln_Name = "dnetc"; TriggerPort->mp_Port.mp_Node.ln_Pri = 0; AddPortPPC(TriggerPort); } else { done = FALSE; } } #endif #else /* ** 68K / OS4 / MorphOS */ struct MsgPort *portexists; Forbid(); portexists = FindPort("dnetc"); if (!portexists) { if ((TriggerPort = CreateMsgPort())) { TriggerPort->mp_Node.ln_Name = "dnetc"; TriggerPort->mp_Node.ln_Pri = 0; AddPort(TriggerPort); } else { done = FALSE; } } Permit(); #endif if (!TimerBase && done) done = GlobalTimerInit(); if (!done) amigaExit(); #ifndef NO_GUI /* Workbench startup */ if (done && *argc == 0) { struct WBStartup *wbs = (struct WBStartup *)*argv; struct WBArg *arg = wbs->sm_ArgList; static char *newargv[1]; newargv[0] = (char *)arg->wa_Name; *argc = 1; *argv = newargv; if (wbs->sm_NumArgs > 1) { /* Started via a project icon */ arg = &wbs->sm_ArgList[1]; } if (!(amigaGUIInit((char *)wbs->sm_ArgList->wa_Name,arg))) { if (!(amigaOpenNewConsole("CON://630/300/distributed.net client/CLOSE/WAIT"))) { done = FALSE; } } } #endif #if USE_RESETHANDLER if (done) { add_resethandler(); } #endif return(done); }