/** * \brief Steuerung initialisieren. */ void cntrl_open( void ) { cntrl_cnt = 0; cntrl_TaskFlag_cnt = 0; cntrl_Heartbeat = 0x00; cntrl_Stoerungslampe = 0x00; Debug = 0; KBUSOPEN(); KBUSUPDATE(); sleep(1); MUTEX_lock { io_Init(); err_Init( &cntrl_err ); cntrl_err.i.common_errcnt += param_Init(); zeit_Init( &cntrl_zeit_absenkung, &cntrl_zeit_event ); if( io_Normal != io_ReadT( &io_ALL_Tau_MW ) ) cntrl_err.i.tempsens_errcnt --; task_Init( &cntrl_tau, io_ALL_Tau_MW.messwert ); sol_Init( &cntrl_sol ); fb_Init( &cntrl_fb ); hk_Init( &cntrl_hk ); ww_Init( &cntrl_ww, io_get_WW_WZ_MW() ); kes_Init( &cntrl_kes ); /*----- Module aktivieren ----*/ cntrl_mdl_aktiv.sol_aktiv = SET; cntrl_mdl_aktiv.fb_aktiv = SET; cntrl_mdl_aktiv.hk_aktiv = SET; cntrl_mdl_aktiv.ww_aktiv = SET; cntrl_mdl_aktiv.kes_aktiv = SET; cntrl_mdl_aktiv.err_aktiv = RESET; /* Default erst einmal AUS! */ cntrl_mdl_aktiv.inp_sol_aktiv = SET; cntrl_mdl_aktiv.inp_fb_aktiv = SET; cntrl_mdl_aktiv.inp_hk_aktiv = SET; cntrl_mdl_aktiv.inp_ww_aktiv = SET; cntrl_mdl_aktiv.inp_kes_aktiv = SET; cntrl_mdl_aktiv.inp_err_aktiv = SET; } MUTEX_unlock(); KBUSUPDATE(); sleep(1); }
int main() { if (fb_Init() == -1) { printf("Initialize Framebuffer LCD failed.\n"); exit(1); } int fanshu=124; int fanxingshu=5; int xiabiao[5]={5,7,13,17,19}; output(fanshu,fanxingshu,xiabiao); return 0; }
int vcfb_init(void) { unsigned int fb_width, fb_height, fb_depth, fb_pitch; unsigned int count; volatile unsigned int *vcmb_msg = (unsigned int *)BOOTMEMADDR(bm_mboxmsg); scr_Type = SCR_UNKNOWN; /* query the display dimensions */ { vcmb_msg[0] = 8 * 4; vcmb_msg[1] = VCTAG_REQ; vcmb_msg[2] = VCTAG_GETRES; vcmb_msg[3] = 8; vcmb_msg[4] = 0; vcmb_msg[5] = 0; vcmb_msg[6] = 0; vcmb_msg[7] = 0; // terminate tag vcmb_write((void *)VCMB_BASE, VCMB_PROPCHAN, (void *)vcmb_msg); vcmb_msg = vcmb_read((void *)VCMB_BASE, VCMB_PROPCHAN); if (!vcmb_msg || (vcmb_msg[1] != VCTAG_RESP)) return 0; if (((fb_width = vcmb_msg[5]) == 0) || ((fb_height = vcmb_msg[6]) == 0)) { fb_width = 1024; fb_height = 768; } } /* fill in our framebuffer configuration/allocation request */ { unsigned int c = 1; vcmb_msg[c++] = VCTAG_REQ; vcmb_msg[c++] = VCTAG_SETRES; vcmb_msg[c++] = 8; vcmb_msg[c++] = 8; vcmb_msg[c++] = fb_width; vcmb_msg[c++] = fb_height; vcmb_msg[c++] = VCTAG_SETVRES; // duplicate physical size... vcmb_msg[c++] = 8; vcmb_msg[c++] = 8; vcmb_msg[c++] = fb_width; vcmb_msg[c++] = fb_height; vcmb_msg[c++] = VCTAG_SETDEPTH; vcmb_msg[c++] = 4; vcmb_msg[c++] = 4; fb_depth = 16; vcmb_msg[c++] = fb_depth; vcmb_msg[c++] = VCTAG_FBALLOC; vcmb_msg[c++] = 8; vcmb_msg[c++] = 4; vcmb_msg[c++] = 16; vcmb_msg[c++] = 0; vcmb_msg[c++] = 0; // terminate tags vcmb_msg[0] = (c << 2); // fill in request size vcmb_write((void *)VCMB_BASE, VCMB_PROPCHAN, (void *)vcmb_msg); vcmb_msg = vcmb_read((void *)VCMB_BASE, VCMB_PROPCHAN); if (!vcmb_msg || (vcmb_msg[1] != VCTAG_RESP)) return 0; count = 2; // locate the allocation request while((vcmb_msg[count])) { if (vcmb_msg[count] == VCTAG_FBALLOC) break; count += 3 + (vcmb_msg[count + 1] >> 2); if (count > c) return 0; } if (vcmb_msg[count + 2] != (VCTAG_RESP + 8)) return 0; if (((scr_FrameBuffer = (void *)vcmb_msg[count + 3]) == 0) || (vcmb_msg[count + 4] == 0)) return 0; } /* query the framebuffer pitch */ { vcmb_msg[0] = 7 * 4; vcmb_msg[1] = VCTAG_REQ; vcmb_msg[2] = VCTAG_GETPITCH; vcmb_msg[3] = 4; vcmb_msg[4] = 0; vcmb_msg[5] = 0; vcmb_msg[6] = 0; // terminate tag vcmb_write((void *)VCMB_BASE, VCMB_PROPCHAN, (void *)vcmb_msg); vcmb_msg = vcmb_read((void *)VCMB_BASE, VCMB_PROPCHAN); if (!vcmb_msg || (vcmb_msg[4] != (VCTAG_RESP + 4))) return 0; if ((fb_pitch = vcmb_msg[5]) == 0) return 0; } scr_Type = SCR_GFX; fb_Init(fb_width, fb_height, fb_depth, fb_pitch); return 1; }