int VerifSuite_CppAssertComp_1_t::clock ( dat_t<1> reset ) {
  uint32_t min = ((uint32_t)1<<31)-1;
  if (clk_cnt < min) min = clk_cnt;
  clk_cnt-=min;
  if (clk_cnt == 0) clock_lo( reset );
  if (clk_cnt == 0) clock_hi( reset );
  if (clk_cnt == 0) clk_cnt = clk;
  return min;
}
Esempio n. 2
0
int WB_Led_Dev_t::clock ( dat_t<1> reset ) {
  uint32_t min = ((uint32_t)1<<31)-1;
  if (clk_cnt < min) min = clk_cnt;
  clk_cnt-=min;
  if (clk_cnt == 0) clock_hi( reset );
  if (clk_cnt == 0) clock_lo( reset );
  if (clk_cnt == 0) clk_cnt = clk;
  return min;
}
Esempio n. 3
0
int DelaySuite_ROMModule_1_t::clock ( dat_t<1> reset ) {
    uint32_t min = ((uint32_t)1<<31)-1;
    if (clk_cnt < min) min = clk_cnt;
    clk_cnt-=min;
    if (clk_cnt == 0) clock_hi( reset );
    if (clk_cnt == 0) clock_lo( reset );
    if (clk_cnt == 0) clk_cnt = clk;
    return min;
}
Esempio n. 4
0
// TODO: send using interrupt if available
uint8_t ps2_host_send(uint8_t data)
{
    uint8_t res = 0;
    bool parity = true;
    ps2_error = PS2_ERR_NONE;
#ifdef PS2_USE_INT
    PS2_INT_OFF();
#endif
    /* terminate a transmission if we have */
    inhibit();
    _delay_us(200); // at least 100us

    /* start bit [1] */
    data_lo();
    clock_hi();
    WAIT(clock_lo, 20000, 10);   // may take 15ms at most until device starts clocking
    /* data [2-9] */
    for (uint8_t i = 0; i < 8; i++) {
        _delay_us(15);
        if (data&(1<<i)) {
            parity = !parity;
            data_hi();
        } else {
            data_lo();
        }
        WAIT(clock_hi, 50, 2);
        WAIT(clock_lo, 50, 3);
    }
    /* parity [10] */
    _delay_us(15);
    if (parity) { data_hi(); } else { data_lo(); }
    WAIT(clock_hi, 50, 4);
    WAIT(clock_lo, 50, 5);
    /* stop bit [11] */
    _delay_us(15);
    data_hi();
    /* ack [12] */
    WAIT(data_lo, 50, 6);
    WAIT(clock_lo, 50, 7);

    /* wait for idle state */
    WAIT(clock_hi, 50, 8);
    WAIT(data_hi, 50, 9);

#ifdef PS2_USE_INT
    PS2_INT_ON();
#endif
    res = ps2_host_recv_response();
ERROR:
#ifdef PS2_USE_INT
    PS2_INT_ON();
    idle();
#else
    inhibit();
#endif
    return res;
}
Esempio n. 5
0
uint8_t ps2_host_send(uint8_t data)
{
    bool parity = true;
    ps2_error = PS2_ERR_NONE;

    PS2_USART_OFF();

    /* terminate a transmission if we have */
    inhibit();
    _delay_us(100); // [4]p.13

    /* 'Request to Send' and Start bit */
    data_lo();
    clock_hi();
    WAIT(clock_lo, 10000, 10);   // 10ms [5]p.50

    /* Data bit[2-9] */
    for (uint8_t i = 0; i < 8; i++) {
        _delay_us(15);
        if (data&(1<<i)) {
            parity = !parity;
            data_hi();
        } else {
            data_lo();
        }
        WAIT(clock_hi, 50, 2);
        WAIT(clock_lo, 50, 3);
    }

    /* Parity bit */
    _delay_us(15);
    if (parity) { data_hi(); } else { data_lo(); }
    WAIT(clock_hi, 50, 4);
    WAIT(clock_lo, 50, 5);

    /* Stop bit */
    _delay_us(15);
    data_hi();

    /* Ack */
    WAIT(data_lo, 50, 6);
    WAIT(clock_lo, 50, 7);

    /* wait for idle state */
    WAIT(clock_hi, 50, 8);
    WAIT(data_hi, 50, 9);

    idle();
    PS2_USART_INIT();
    PS2_USART_RX_INT_ON();
    return ps2_host_recv_response();
ERROR:
    idle();
    PS2_USART_INIT();
    PS2_USART_RX_INT_ON();
    return 0;
}
Esempio n. 6
0
int NameSuite_DebugComp_1_t::clock ( dat_t<1> reset ) {
  uint32_t min = ((uint32_t)1<<31)-1;
  if (clk.cnt < min) min = clk.cnt;
  clk.cnt-=min;
  if (clk.cnt == 0) clock_lo( reset );
  if (clk.cnt == 0) clock_hi( reset );
  if (clk.cnt == 0) clk.cnt = clk.len;
  return min;
}
Esempio n. 7
0
int Regsiter_File_t::clock ( dat_t<1> reset ) {
    uint32_t min = ((uint32_t)1<<31)-1;
    if (clk_cnt < min) min = clk_cnt;
    clk_cnt-=min;
    if (clk_cnt == 0) clock_hi( reset );
    if (clk_cnt == 0) clock_lo( reset );
    if (clk_cnt == 0) clk_cnt = clk;
    return min;
}
int WhenSuite_SwitchClassComp_1_t::clock ( dat_t<1> reset ) {
  uint32_t min = ((uint32_t)1<<31)-1;
  if (clk_cnt < min) min = clk_cnt;
  clk_cnt-=min;
  if (clk_cnt == 0) clock_lo( reset );
  if (clk_cnt == 0) clock_hi( reset );
  if (clk_cnt == 0) clk_cnt = clk;
  return min;
}
int VerifSuite_CppPrintfComp_1_t::clock ( dat_t<1> reset ) {
  uint32_t min = ((uint32_t)1<<31)-1;
  if (clk.cnt < min) min = clk.cnt;
  clk.cnt-=min;
  if (clk.cnt == 0) clock_lo( reset );
  if (!reset.to_bool()) print( std::cerr );
  if (clk.cnt == 0) clock_hi( reset );
  if (clk.cnt == 0) clk.cnt = clk.len;
  return min;
}
int NameSuite_DebugComp_1_t::clock ( dat_t<1> reset ) {
  uint32_t min = ((uint32_t)1<<31)-1;
  if (clk.cnt < min) min = clk.cnt;
  clk.cnt-=min;
  if (clk.cnt == 0) clock_lo( reset );
  if (!reset.to_bool()) print( std::cerr );
  mod_t::dump( reset );
  if (clk.cnt == 0) clock_hi( reset );
  if (clk.cnt == 0) clk.cnt = clk.len;
  return min;
}
Esempio n. 11
0
static inline void request(void)
{
    clock_hi();
    data_lo();
}
Esempio n. 12
0
static inline void idle(void)
{
    clock_hi();
    data_hi();
}