void __libcobalt_init(void) { struct sigaction sa; low_init(); sa.sa_sigaction = cobalt_sigdebug_handler; sigemptyset(&sa.sa_mask); sa.sa_flags = SA_SIGINFO; sigaction(SIGDEBUG, &sa, &__cobalt_orig_sigdebug); /* * NOTE: a placeholder for pthread_atfork() may return an * error status with uClibc, so we don't check the return * value on purpose. */ pthread_atfork(NULL, NULL, cobalt_fork_handler); if (sizeof(struct cobalt_mutex_shadow) > sizeof(pthread_mutex_t)) { report_error("sizeof(pthread_mutex_t): %d <" " sizeof(cobalt_mutex_shadow): %d!", (int) sizeof(pthread_mutex_t), (int) sizeof(struct cobalt_mutex_shadow)); exit(EXIT_FAILURE); } if (sizeof(struct cobalt_cond_shadow) > sizeof(pthread_cond_t)) { report_error("sizeof(pthread_cond_t): %d <" " sizeof(cobalt_cond_shadow): %d!", (int) sizeof(pthread_cond_t), (int) sizeof(struct cobalt_cond_shadow)); exit(EXIT_FAILURE); } if (sizeof(struct cobalt_sem_shadow) > sizeof(sem_t)) { report_error("sizeof(sem_t): %d <" " sizeof(cobalt_sem_shadow): %d!", (int) sizeof(sem_t), (int) sizeof(struct cobalt_sem_shadow)); exit(EXIT_FAILURE); } cobalt_thread_init(); cobalt_print_init(); boilerplate_init(); }
int main() { uint8_t i,j; #if (__AVR_ATmega128__) message_arch_byte[0]=MCUCSR; #endif #if (__AVR_ATmega1281__) message_arch_byte[0]=MCUCR; #endif message_arch_byte_cpy[0]=0xff; #if (__AVR_ATmega128__) MCUCSR&=~0x1f; #endif #if (__AVR_ATmega1281__) MCUCR&=~0x1f; #endif DDRA = 0xff; DDRB = 0x00; DDRC = 0x03; DDRD = 0x00; DDRE = 0x10; DDRF = 0x00; DDRG = 0x00; PORTA = 0xff; PORTB = 0x00; PORTC = 0x00; PORTD = 0x00; PORTE = 0x00; PORTF = 0x00; PORTG = 0x00; DDRD|=(1<<PD7)|(1<<PD6)|(1<<PD5)|(1<<PD4); //DDRA=0xff; PORTD=0xff; PORTD&=~((1<<PD4));//|(1<<PD6)); DDRC=(1<<PC0)|(1<<PC1)|(1<<PC2)|(1<<PC3); PORTC|=(1<<PC3); //PORTC&=~_BV(PC1); //DDRE|=(1<<PE4);//живлення для регістрів ввода/вивода //PORTE&=~(1<<PE4); RAMPZ=0; KEY[0]=0x00; KEY[1]=0x00; lcd_data.head.size=sizeof(LCD_OUTPUT_STRUCT); lcd_data.head.adr=0x20; lcd_data.head.cmd='S'; key_data.head.size=sizeof(LCD_INPUT_STRUCT); key_data.head.adr=0x20; key_data.head.cmd='d'; ////////////////////////////////////////////////////////////////////////////////////////////////////// //slaveN: N=NUM_OF_SCAF!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! /* data_for_slave1.head.size=sizeof(NET_OUTPUT_STRUCT1); data_for_slave1.head.adr=0x50; data_for_slave1.head.cmd='d'; data_from_slave1.head.size=sizeof(NET_INPUT_STRUCT1); data_from_slave1.head.adr=0x50; data_from_slave1.head.cmd='d'; */ data_for_slave1.head.size=sizeof(NET_INPUT_STRUCT1); data_for_slave1.head.adr=SCAFE_ADRESS; data_for_slave1.head.cmd='d'; data_from_slave1.head.size=sizeof(NET_OUTPUT_STRUCT1); data_from_slave1.head.adr=SCAFE_ADRESS; data_from_slave1.head.cmd='d'; data_for_slave2.head.size=sizeof(NET_INPUT_STRUCT2); data_for_slave2.head.adr=0x51; data_for_slave2.head.cmd='d'; data_from_slave2.head.size=sizeof(NET_OUTPUT_STRUCT2); data_from_slave2.head.adr=0x51; data_from_slave2.head.cmd='d'; bfpp_in.head.size=sizeof(NET_BFPP_INPUT_STRUCT); bfpp_in.head.adr=0xb0; bfpp_in.head.cmd='d'; bfpp_out.head.size=sizeof(NET_BFPP_OUTPUT_STRUCT); bfpp_out.head.adr=0xb0; bfpp_out.head.cmd='d'; /* data_for_slave3.head.size=sizeof(NET_OUTPUT_STRUCT3); data_for_slave3.head.adr=0x52; data_for_slave3.head.cmd='d'; data_from_slave3.head.size=sizeof(NET_INPUT_STRUCT3); data_from_slave3.head.adr=0x52; data_from_slave3.head.cmd='d'; */ ////////////////////////////////////////////////////////////////////////////////////////////////////// for(i=0;i<NUM_OF_MNEMO;i++) { mnemo[i].head.size=sizeof(MNEMO_OUTPUT_STRUCT); mnemo[i].head.adr=0x30+i; mnemo[i].head.cmd='d'; } /////!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!колво строчек=колву мнемосхем!!!!!!!!!!!!!!!!!//////////////// for(j=0;j<NUM_OF_MNEMO;j++) { for(i=0;i<80;i++) { mnemo[j].rg_led[i+1]=0xff; LED_FIELD[i+80*j]=0xff; } mnemo[j].rg_led[j]=0x00; } low_init(); Init_iic(); check_iic_status(); Work_init(); Dev_init(); // Etaz_init(); Menu_init(); Pdz_init(); Message_init(); OS::Run(); }