/*
** linux/atarihw.h -- This header defines some macros and pointers for
**                    the various Atari custom hardware registers.
**
** Copyright 1994 by Bj”rn Brauel
**
** This file is subject to the terms and conditions of the GNU General Public
** License.  See the file README.legal in the main directory of this archive
** for more details.
**
*/

#ifndef _LINUX_ATARIHW_H_
#define _LINUX_ATARIHW_H_


/* 
** Shifter  
 */

#define SHF_BAS (0xff8201)    
struct SHIFTER 
 {
  u_char bas_hi;
  u_char char_dummy1;
  u_char bas_md;
  u_char char_dummy2;
 };
# define shifter ((*(volatile struct SHIFTER *)SHF_BAS))

#define SHF_FBAS (0xff820e)
struct SHIFTER_F030
 {
  u_int off_next;
  u_int scn_width;
 };                             
# define shifter_f030 ((*(volatile struct SHIFTER_F030 *)SHF_FBAS))

/*
** Falcon030 VIDEL Video Controller
** for description see File 'linux\tools\atari\hardware.txt
 */

#define VDL_SPSHIFT (0xff8266)   /* int */

#define VDL_HBAS (0xff8282)
struct VIDEL_HOR
 {
  u_int HHT;
  u_int HBB;
  u_int HBE;
  u_int HDB;
  u_int HDE;
  u_int HSS;
  u_int HFS;
  u_int HEE;
 };
# define videl_hor ((*(volatile struct VIDEL_HOR *)VDL_HBAS))

#define VDL_VBAS (0xff82a2)
struct VIDEL_VER
 {
  u_int VFT;
  u_int VBB;
  u_int VBE;
  u_int VDB;
  u_int VDE;
  u_int VSS;
  u_int VCO;
 };
# define videl_ver ((*(volatile struct VIDEL_VER *)VDL_VBAS))


/*
** DMA/WD1772 Disk Controller
 */                          
 
#define FWD_BAS (0xff8604)  
struct DMA_WD
 {
  u_short fdc_acces_seccount;
  u_short dma_mode_status;
  u_char char_dummy1;
  u_char dma_hi;
  u_char char_dummy2;
  u_char dma_md;
  u_char char_dummy3;
  u_char dma_lo;
 };
# define dma_wd ((*(volatile struct DMA_WD *)FWD_BAS))
 

/*
** YM2149 Sound Chip
** access in bytes
 */

#define YM_BAS (0xff8800)
struct SOUND_YM
 {
  u_char rd_data_reg_sel;
  u_char char_dummy1;
  u_char wd_data;
 };
#define sound_ym ((*(volatile struct SOUND_YM *)YM_BAS))

 

/* 
** Falcon DMA Sound Subsystem
** not implemented yet
 */     

/*
** Falcon Blitter
*/

#define BLT_BAS (0xff8a00)

struct BLITTER
 {
  u_int halftone[16];
  u_int src_x_inc;
  u_int src_y_inc;
  u_long src_address;
  u_int endmask1;  
  u_int endmask2;  
  u_int endmask3;
  u_int dst_x_inc;
  u_int dst_y_inc;
  u_long dst_adress;
  u_int wd_per_line;
  u_int ln_per_bb;
  u_int hlf_op_reg;
  u_int log_op_reg;
  u_int lin_nm_reg;
  u_int skew_reg;  
 };
# define blitter ((*(volatile struct BLITTER *)BLT_BAS))


/*
** SCC Z8530
 */
 
#define SCC_BAS (0xff8c81)
struct SCC
 {
  u_char cha_a_ctrl;
  u_char char_dummy1;
  u_char cha_a_data;
  u_char char_dummy2;
  u_char cha_b_ctrl;
  u_char char_dummy3;
  u_char cha_b_data;
 };
# define scc ((*(volatile struct SCC*)SCC_BAS))
  

/*
** VIDEL Palette Register 
 */

#define FPL_BAS (0xff9800)
struct VIDEL_PALETTE
 {
  u_long reg[256];
 };
# define videl_palette ((*(volatile struct VIDEL_PALETTE*)FPL_BAS))


/*
** Falcon DSP Host Interface
** not implemented yet
 */
 
/*
** MFP 68901
 */
 
#define MFP_BAS (0xfffa01)
struct MFP
 {
  u_char par_dt_reg;
  u_char char_dummy1;
  u_char active_edge;
  u_char char_dummy2;
  u_char data_dir;
  u_char char_dummy3;
  u_char int_en_a;
  u_char char_dummy4;
  u_char int_en_b;
  u_char char_dummy5;
  u_char int_pn_a;
  u_char char_dummy6;
  u_char int_pn_b;
  u_char char_dummy7;
  u_char int_sv_a;
  u_char char_dummy8;
  u_char int_sv_b;
  u_char char_dummy9;
  u_char int_mk_a;
  u_char char_dummy10;
  u_char int_mk_b;
  u_char char_dummy11;
  u_char vec_adr;
  u_char char_dummy12;
  u_char tim_ct_a;
  u_char char_dummy13;
  u_char tim_ct_b;
  u_char char_dummy14;
  u_char tim_ct_cd;
  u_char char_dummy15;
  u_char tim_dt_a;
  u_char char_dummy16;
  u_char tim_dt_b;
  u_char char_dummy17;
  u_char tim_dt_c;
  u_char char_dummy18;
  u_char tim_dt_d;
  u_char char_dummy19;
  u_char sync_char;
  u_char char_dummy20;
  u_char usart_ctr;
  u_char char_dummy21;
  u_char rcv_stat;
  u_char char_dummy22;
  u_char trn_stat;
  u_char char_dummy23;
  u_char usart_dta;
 };
# define mfp ((*(volatile struct MFP*)MFP_BAS))


/*
** ACIA 6850
 */

#define ACIA_BAS (0xfffc00)
struct ACIA 
 {
  u_char key_ctrl;
  u_char char_dummy1;
  u_char key_data;
  u_char char_dummy2;
  u_char mid_ctrl;
  u_char char_dummy3;
  u_char mid_data;
 };
# define acia ((*(volatile struct ACIA*)ACIA_BAS))
 
 
#endif /* linux/atarihw.h */

