int main(void) { timer_init(); usart_init(BAUDRATE); /** * get function codes of all configured pins * - disable uart if pin is used */ getFuncCode(); I2C_MAIN_INFO("\n\rSystem_Ready\n\r"); I2C_MAIN_INFO("Compiliert_am_"__DATE__"_um_"__TIME__"\r\n"); I2C_MAIN_INFO("Compiliert_mit_GCC_Version_"__VERSION__"\r\n"); init(); printIOsstruct(); while (1) { // RoBue: // Uhrzeit bestimmen hh = (time/3600)%24; mm = (time/60)%60; ss = time%60; //get new pulse time from eeprom pulse_time = eeprom_read_byte(EEPROM_PULSE_TIME) << 8; pulse_time |= eeprom_read_byte(EEPROM_PULSE_TIME+1); update_tx(); handle_vio(); _delay_ms(1000); } //end.while while (1) ;; } //end.main
void process_call() { /* variables */ enum tcp_conn_status cur_status; /* current connection state */ /* get the current connection state */ cur_status = tcp_connection_status(); /* if the current connection state has changed, need to reset the */ /* the receive buffers, they may have old tone data in them */ if (cur_status != last_status) reset_tx_buffer(); /* always update the last status */ last_status = cur_status; /* now check the status of the connection */ switch (cur_status) { case CALL_RINGING: /* connection is ringing on the other end */ /* generate a buffer of ringing tone if */ /* there is room for it */ if (rcv_available()) { /* have a buffer, get and fill it */ ring_fill(get_rcv_buffer(), AUDIO_BUFLEN); } /* if there is a buffer to transmit, need */ /* to discard it */ if (xmit_available()) { /* have a buffer, dump it */ get_xmit_buffer(); } break; case CALL_BUSY: /* connection is busy on the other end */ /* generate a buffer of busy signal if */ /* there is room for it */ if (rcv_available()) { /* have a buffer, get and fill it */ busy_fill(get_rcv_buffer(), AUDIO_BUFLEN); } /* if there is a buffer to transmit, need */ /* to discard it */ if (xmit_available()) { /* have a buffer, dump it */ get_xmit_buffer(); } break; case CALL_CONNECTED: /* are talking on the connection */ /* check if there is a buffer to transmit */ if (xmit_available()) { /* buffer is available - try sending it */ if (tcp_connection_tx(get_xmit_next_ptr(), AUDIO_BUFLEN)) /* actually sent it, let buffer functions know */ get_xmit_buffer(); } /* check if have room for a received buffer */ if (rcv_available()) { /* have room - try to get a buffer */ if (tcp_connection_rx(get_rcv_next_ptr(), AUDIO_BUFLEN)) /* got the buffer, so allocate it */ get_rcv_buffer(); } break; default: /* some other status, must have aborted call */ /* if there is a buffer to transmit, need */ /* to discard it */ if (xmit_available()) { /* have a buffer, dump it */ get_xmit_buffer(); } break; } /* try to play and receive any buffers */ /* check if a receive buffer is available for recording into */ if (rx_available()) { /* have a receive buffer, see if update is ready */ if (update_rx(get_rx_next_ptr())) /* it wanted the buffer - actually allocate it */ get_rx_buffer(); } /* check if a transmit buffer is available for playing */ if (tx_available()) { /* have a transmit buffer, see if update is ready */ if (update_tx(get_tx_next_ptr())) /* it wanted the buffer - actually allocate it */ get_tx_buffer(); } /* all done processing the call for now - return */ return; }