Package com.loomcom.symon.devices

Examples of com.loomcom.symon.devices.Acia


    private final static int CMD_STAT_REG = 0;
    private final static int DATA_REG = 1;
   
   
    private Acia newAcia() throws Exception {
        Acia acia = new Acia6850(0x0000);
        // by default rate is limited, have it unlimited for testing
        acia.setBaudRate(0);
        return acia;
    }
View Full Code Here


    @Test
    public void shouldTriggerInterruptOnRxFullIfRxIrqEnabled() throws Exception {
        Bus mockBus = mock(Bus.class);

        Acia acia = newAcia();
        acia.setBus(mockBus);

        // Disable TX IRQ, Enable RX IRQ
        acia.write(CMD_STAT_REG, 0x80);

        acia.rxWrite('a');

        verify(mockBus, atLeastOnce()).assertIrq();
    }
View Full Code Here

    @Test
    public void shouldNotTriggerInterruptOnRxFullIfRxIrqNotEnabled() throws Exception {
        Bus mockBus = mock(Bus.class);

        Acia acia = newAcia();
        acia.setBus(mockBus);

        // Disable TX IRQ, Disable RX IRQ
        acia.write(CMD_STAT_REG, 0x00);

        acia.rxWrite('a');

        verify(mockBus, never()).assertIrq();
    }
View Full Code Here

    @Test
    public void shouldTriggerInterruptOnTxEmptyIfTxIrqEnabled() throws Exception {
        Bus mockBus = mock(Bus.class);

        Acia acia = newAcia();
        acia.setBus(mockBus);

        // Enable TX IRQ, Disable RX IRQ
        acia.write(CMD_STAT_REG, 0x20);

        // Write data
        acia.write(1, 'a');

        verify(mockBus, never()).assertIrq();

        // Transmission should cause IRQ
        acia.txRead();

        verify(mockBus, atLeastOnce()).assertIrq();
    }
View Full Code Here

    @Test
    public void shouldNotTriggerInterruptOnTxEmptyIfTxIrqNotEnabled() throws Exception {
        Bus mockBus = mock(Bus.class);

        Acia acia = newAcia();
        acia.setBus(mockBus);

        // Disable TX IRQ, Disable RX IRQ
        acia.write(CMD_STAT_REG, 0x02);

        // Write data
        acia.write(DATA_REG, 'a');

        // Transmission should cause IRQ
        acia.txRead();

        verify(mockBus, never()).assertIrq();
    }
View Full Code Here

        verify(mockBus, never()).assertIrq();
    }

    @Test
    public void newAciaShouldHaveTxEmptyStatus() throws Exception {
        Acia acia = newAcia();

        assertEquals(0x02, acia.read(CMD_STAT_REG) & 0x02);
    }
View Full Code Here

        assertEquals(0x02, acia.read(CMD_STAT_REG) & 0x02);
    }

    @Test
    public void aciaShouldHaveTxEmptyStatusOffIfTxHasData() throws Exception {
        Acia acia = newAcia();

        acia.txWrite('a');
        assertEquals(0x00, acia.read(CMD_STAT_REG) & 0x02);
    }
View Full Code Here

        assertEquals(0x00, acia.read(CMD_STAT_REG) & 0x02);
    }

    @Test
    public void aciaShouldHaveRxFullStatusOnIfRxHasData() throws Exception {
        Acia acia = newAcia();

        acia.rxWrite('a');
      
        assertEquals(0x01, acia.read(CMD_STAT_REG) & 0x01);
    }
View Full Code Here

    }

    @Test
    public void aciaShouldHaveTxEmptyAndRxFullStatusOffIfRxAndTxHaveData()
            throws Exception {
        Acia acia = newAcia();
      
        acia.rxWrite('a');
        acia.txWrite('b');

        assertEquals(0x01, acia.read(CMD_STAT_REG) & 0x03);
    }
View Full Code Here

   
    @Test
    public void aciaShouldOverrunAndReadShouldReset()
            throws Exception {
       
        Acia acia = newAcia();
       
        // overrun ACIA
        acia.rxWrite('a');
        acia.rxWrite('b');
       
        assertEquals(0x20, acia.read(CMD_STAT_REG) & 0x20);
       
        // read should reset
        acia.rxRead();
        assertEquals(0x00, acia.read(CMD_STAT_REG) & 0x20);
       
    }
View Full Code Here

TOP

Related Classes of com.loomcom.symon.devices.Acia

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.