add defines for all io lines
This commit is contained in:
parent
6b8a6babb7
commit
6a8e8e4692
@ -3,11 +3,17 @@
|
|||||||
#include <avr/io.h>
|
#include <avr/io.h>
|
||||||
|
|
||||||
|
|
||||||
#define ROMSIZE 4
|
|
||||||
#define BLOCKS (ROMSIZE << 8)
|
|
||||||
#define MEMSIZE 0x80000
|
|
||||||
|
|
||||||
|
/* ---------------------------- PORT A ---------------------------- */
|
||||||
|
|
||||||
|
#define AVR_DATA_PORT PORTA
|
||||||
|
#define AVR_DATA_DIR DDRA
|
||||||
|
#define AVR_DATA_PIN PINA
|
||||||
|
|
||||||
|
#define avr_data_in() ((AVR_DATA_DIR = 0x00),\
|
||||||
|
(AVR_DATA_PORT = 0x00))
|
||||||
|
|
||||||
|
#define avr_data_out() (AVR_DATA_DIR = 0xff)
|
||||||
|
|
||||||
#define LED_PORT PORTC
|
#define LED_PORT PORTC
|
||||||
#define LED_DIR DDRC
|
#define LED_DIR DDRC
|
||||||
@ -17,21 +23,66 @@
|
|||||||
(LED_DIR &=~ (1 << LED_PIN)))
|
(LED_DIR &=~ (1 << LED_PIN)))
|
||||||
#define led_off() ((LED_PORT &=~ (1 << LED_PIN)),\
|
#define led_off() ((LED_PORT &=~ (1 << LED_PIN)),\
|
||||||
(LED_DIR |= (1 << LED_PIN)))
|
(LED_DIR |= (1 << LED_PIN)))
|
||||||
/* Port C*/
|
|
||||||
|
/* ---------------------------- PORT B ---------------------------- */
|
||||||
|
|
||||||
|
#define AVR_PORT PORTB
|
||||||
|
#define AVR_DIR DDRB
|
||||||
|
#define AVR_RD_PORT PORTB
|
||||||
|
#define AVR_RD_DIR DDRB
|
||||||
|
#define AVR_RD_PIN PB2
|
||||||
|
|
||||||
|
#define avr_rd_hi() (AVR_RD_PORT |= (1 << AVR_RD_PIN))
|
||||||
|
#define avr_rd_lo() (AVR_RD_PORT &= ~(1 << AVR_RD_PIN))
|
||||||
|
|
||||||
|
#define AVR_WR_PORT PORTB
|
||||||
|
#define AVR_WR_DIR DDRB
|
||||||
|
#define AVR_WR_PIN PB1
|
||||||
|
|
||||||
|
#define avr_wr_hi() (AVR_WR_PORT |= (1 << AVR_WR_PIN))
|
||||||
|
#define avr_wr_lo() (AVR_WR_PORT &= ~(1 << AVR_WR_PIN))
|
||||||
|
|
||||||
|
#define AVR_CS_PORT PORTB
|
||||||
|
#define AVR_CS_DIR DDRB
|
||||||
|
#define AVR_CS_PIN PB0
|
||||||
|
|
||||||
|
#define avr_cs_hi() (AVR_CS_PORT |= (1 << AVR_CS_PIN))
|
||||||
|
#define avr_cs_lo() (AVR_CS_PORT &= ~(1 << AVR_CS_PIN))
|
||||||
|
|
||||||
|
#define SNES_IRQ_PORT PORTB
|
||||||
|
#define SNES_IRQ_DIR DDRB
|
||||||
|
#define SNES_IRQ_PIN PB3
|
||||||
|
|
||||||
|
#define snes_irq_off() (SNES_IRQ_PORT |= (1 << SNES_IRQ_PIN))
|
||||||
|
#define snes_irq_on() (SNES_IRQ_PORT &= ~(1 << SNES_IRQ_PIN))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* ---------------------------- PORT C ---------------------------- */
|
||||||
|
|
||||||
#define AVR_ADDR_PORT PORTC
|
#define AVR_ADDR_PORT PORTC
|
||||||
#define AVR_ADDR_DIR DDRC
|
#define AVR_ADDR_DIR DDRC
|
||||||
#define AVR_ADDR_LATCH_PORT PORTC
|
#define AVR_ADDR_LATCH_PORT PORTC
|
||||||
#define AVR_ADDR_LATCH_DIR DDRC
|
#define AVR_ADDR_LATCH_DIR DDRC
|
||||||
#define AVR_ADDR_LATCH_PIN PC6
|
#define AVR_ADDR_LATCH_PIN PC6
|
||||||
|
|
||||||
|
#define avr_addr_latch_hi() (AVR_ADDR_LATCH_PORT |= (1 << AVR_ADDR_LATCH_PIN)))
|
||||||
|
#define avr_addr_latch_lo() (AVR_ADDR_LATCH_PORT &= ~(1 << AVR_ADDR_LATCH_PIN)))
|
||||||
|
|
||||||
#define AVR_ADDR_SCK_PORT PORTC
|
#define AVR_ADDR_SCK_PORT PORTC
|
||||||
#define AVR_ADDR_SCK_DIR DDRC
|
#define AVR_ADDR_SCK_DIR DDRC
|
||||||
#define AVR_ADDR_SCK_PIN PC5
|
#define AVR_ADDR_SCK_PIN PC5
|
||||||
|
|
||||||
|
#define avr_addr_sck_hi() (AVR_ADDR_SCK_PORT |= (1 << AVR_ADDR_SCK_PIN)))
|
||||||
|
#define avr_addr_sck_lo() (AVR_ADDR_SCK_PORT &= ~(1 << AVR_ADDR_SCK_PIN)))
|
||||||
|
|
||||||
#define AVR_ADDR_SER_PORT PORTC
|
#define AVR_ADDR_SER_PORT PORTC
|
||||||
#define AVR_ADDR_SER_DIR DDRC
|
#define AVR_ADDR_SER_DIR DDRC
|
||||||
#define AVR_ADDR_SER_PIN PC4
|
#define AVR_ADDR_SER_PIN PC4
|
||||||
|
|
||||||
|
#define avr_addr_ser_hi() (AVR_ADDR_SER_PORT |= (1 << AVR_ADDR_SER_PIN)))
|
||||||
|
#define avr_addr_ser_lo() (AVR_ADDR_SER_PORT &= ~(1 << AVR_ADDR_SER_PIN)))
|
||||||
|
|
||||||
#define AVR_ADDR_LOAD_PORT PORTC
|
#define AVR_ADDR_LOAD_PORT PORTC
|
||||||
#define AVR_ADDR_LOAD_DIR DDRC
|
#define AVR_ADDR_LOAD_DIR DDRC
|
||||||
#define AVR_ADDR_LOAD_PIN PC2
|
#define AVR_ADDR_LOAD_PIN PC2
|
||||||
@ -57,40 +108,7 @@
|
|||||||
#define SNES_WR_DIR DDRC
|
#define SNES_WR_DIR DDRC
|
||||||
#define SNES_WR_PIN PC3
|
#define SNES_WR_PIN PC3
|
||||||
|
|
||||||
/* Port B*/
|
/* ---------------------------- PORT D ---------------------------- */
|
||||||
#define AVR_PORT PORTB
|
|
||||||
#define AVR_DIR DDRB
|
|
||||||
#define AVR_RD_PORT PORTB
|
|
||||||
#define AVR_RD_DIR DDRB
|
|
||||||
#define AVR_RD_PIN PB2
|
|
||||||
|
|
||||||
#define AVR_WR_PORT PORTB
|
|
||||||
#define AVR_WR_DIR DDRB
|
|
||||||
#define AVR_WR_PIN PB1
|
|
||||||
|
|
||||||
#define AVR_CS_PORT PORTB
|
|
||||||
#define AVR_CS_DIR DDRB
|
|
||||||
#define AVR_CS_PIN PB0
|
|
||||||
|
|
||||||
#define SNES_IRQ_PORT PORTB
|
|
||||||
#define SNES_IRQ_DIR DDRB
|
|
||||||
#define SNES_IRQ_PIN PB3
|
|
||||||
|
|
||||||
#define snes_irq_off() (SNES_IRQ_PORT |= (1 << SNES_IRQ_PIN))
|
|
||||||
#define snes_irq_on() (SNES_IRQ_PORT &= ~(1 << SNES_IRQ_PIN))
|
|
||||||
|
|
||||||
|
|
||||||
/* Port A*/
|
|
||||||
#define AVR_DATA_PORT PORTA
|
|
||||||
#define AVR_DATA_DIR DDRA
|
|
||||||
#define AVR_DATA_PIN PINA
|
|
||||||
|
|
||||||
#define avr_data_in() ((AVR_DATA_DIR = 0x00),\
|
|
||||||
(AVR_DATA_PORT = 0x00))
|
|
||||||
|
|
||||||
#define avr_data_out() (AVR_DATA_DIR = 0xff)
|
|
||||||
|
|
||||||
/* Port D*/
|
|
||||||
|
|
||||||
#define AVR_SNES_PORT PORTD
|
#define AVR_SNES_PORT PORTD
|
||||||
#define AVR_SNES_DIR DDRD
|
#define AVR_SNES_DIR DDRD
|
||||||
@ -110,7 +128,6 @@
|
|||||||
#define snes_hirom() (HI_LOROM_SW_PORT &= ~(1 << HI_LOROM_SW_PIN))
|
#define snes_hirom() (HI_LOROM_SW_PORT &= ~(1 << HI_LOROM_SW_PIN))
|
||||||
#define snes_lorom() (HI_LOROM_SW_PORT |= (1 << HI_LOROM_SW_PIN))
|
#define snes_lorom() (HI_LOROM_SW_PORT |= (1 << HI_LOROM_SW_PIN))
|
||||||
|
|
||||||
|
|
||||||
#define SNES_WR_EN_PORT PORTD
|
#define SNES_WR_EN_PORT PORTD
|
||||||
#define SNES_WR_EN_DIR DDRD
|
#define SNES_WR_EN_DIR DDRD
|
||||||
#define SNES_WR_EN_PIN PD7
|
#define SNES_WR_EN_PIN PD7
|
||||||
@ -122,11 +139,8 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void system_init(void);
|
void system_init(void);
|
||||||
void sreg_set(uint32_t addr);
|
void sreg_set(uint32_t addr);
|
||||||
|
|
||||||
uint8_t sram_read(uint32_t addr);
|
uint8_t sram_read(uint32_t addr);
|
||||||
void sram_write(uint32_t addr, uint8_t data);
|
void sram_write(uint32_t addr, uint8_t data);
|
||||||
void sram_clear(uint32_t addr, uint32_t len);
|
void sram_clear(uint32_t addr, uint32_t len);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user