Initial Commit
This commit is contained in:
234
include/sys/flash_sk_io.h
Normal file
234
include/sys/flash_sk_io.h
Normal file
@@ -0,0 +1,234 @@
|
||||
#pragma Off (List)
|
||||
/*******************************************************************************
|
||||
* FILE NAME: Flash_SK_IO.ch
|
||||
*
|
||||
* TITLE: This function prototypes and data type definitions.
|
||||
*
|
||||
* DATA_RIGHTS: Western Design Center and R & C Services Proprietary
|
||||
* Copyright(C) 1980-2004
|
||||
* All rights reserved. Reproduction in any manner,
|
||||
* in whole or in part, is strictly prohibited without
|
||||
* the prior written approval of R & C Services or
|
||||
* Western Design Center.
|
||||
*
|
||||
* DESCRIPTION: This file describes function prototypes and data type
|
||||
* definitions used for .
|
||||
*
|
||||
*
|
||||
* SPECIAL CONSIDERATIONS:
|
||||
* <None>
|
||||
*
|
||||
* AUTHOR: R. Greenthal
|
||||
*
|
||||
*
|
||||
* CREATION DATE: Feb 05,2004
|
||||
*
|
||||
* REVISION HISTORY
|
||||
* Name Date Description
|
||||
* ------------ ---------- ----------------------------------------------
|
||||
* R. Greenthal 02/05/2004 Initial
|
||||
*
|
||||
*******************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef Flash_SK_IO_H
|
||||
#define Flash_SK_IO_H
|
||||
|
||||
/*
|
||||
*=========================== CONSTANTS & MACROS ===============================
|
||||
*/
|
||||
|
||||
/* None */
|
||||
|
||||
/*
|
||||
*================================== TYPES =====================================
|
||||
*/
|
||||
|
||||
/* None */
|
||||
|
||||
/*
|
||||
*============================= FUNCTION PROTOTYPES ============================
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#define CLI asm{cli;} /* enable interrupt response */
|
||||
#define SEI asm{sei;} /* disable it */
|
||||
|
||||
#define BRK(n) asm{ brk n;} /* 65C02/65c816-BRK */
|
||||
|
||||
#define COP(n) asm{ cop n;} /* 65c816-COP */
|
||||
|
||||
|
||||
//#define EnableIRQ(n)\
|
||||
// asm(" lda #$80\n"\
|
||||
// " tsb $fd01+"#n"*4\n") /* enable interrupt of timer n */
|
||||
|
||||
//#define DisableIRQ(n)\
|
||||
// asm(" lda #$80\n"\
|
||||
// " trb $fd01+"#n"*4\n") /* disable it */
|
||||
|
||||
|
||||
struct _VIA1{
|
||||
uchar ORB_IRB; /* Input/Output Reg 'B' */
|
||||
uchar ORA_IRA; /* Input/Output Reg 'A' */
|
||||
uchar DDRB; /* Data Direction Reg 'B' */
|
||||
uchar DDRA; /* Data Direction Reg 'A' */
|
||||
uchar T1CLO; /* Timer #1 Counter Low */
|
||||
uchar T1CHI; /* Timer #1 Counter High */
|
||||
uchar T1LLO; /* Timer #1 Latch Low */
|
||||
uchar T1LHI; /* Timer #1 Latch High */
|
||||
uchar T2CLO; /* Timer #2 Counter Low */
|
||||
uchar T2CHI; /* Timer #2 Counter High */
|
||||
uchar SR; /* Shift Reg */
|
||||
uchar ACR; /* Auxiliary Control Reg */
|
||||
uchar PCR; /* Peripheral Control Reg */
|
||||
uchar IFR; /* Interrupt Flag Reg */
|
||||
uchar IER; /* Interrupt Enable Reg */
|
||||
uchar ORANH_IRANH; /* Input Reg 'A' No Handshake */
|
||||
};
|
||||
|
||||
|
||||
struct _VIA2{
|
||||
uchar ORB_IRB; /* Input/Output Reg 'B' */
|
||||
uchar ORA_IRA; /* Input/Output Reg 'A' */
|
||||
uchar DDRB; /* Data Direction Reg 'B' */
|
||||
uchar DDRA; /* Data Direction Reg 'A' */
|
||||
uchar T1CLO; /* Timer #1 Counter Low */
|
||||
uchar T1CHI; /* Timer #1 Counter High */
|
||||
uchar T1LLO; /* Timer #1 Latch Low */
|
||||
uchar T1LHI; /* Timer #1 Latch High */
|
||||
uchar T2CLO; /* Timer #2 Counter Low */
|
||||
uchar T2CHI; /* Timer #2 Counter High */
|
||||
uchar SR; /* Shift Reg */
|
||||
uchar ACR; /* Auxiliary Control Reg */
|
||||
uchar PCR; /* Peripheral Control Reg */
|
||||
uchar IFR; /* Interrupt Flag Reg */
|
||||
uchar IER; /* Interrupt Enable Reg */
|
||||
uchar ORANH_IRANH; /* Input Reg 'A' No Handshake */
|
||||
};
|
||||
|
||||
|
||||
|
||||
struct _UART16c450{
|
||||
uchar RHR_THR; /* Transmit/Receive Holding Register */
|
||||
uchar IER; /* Interrupt Enable Register */
|
||||
uchar FCR_ISR; /* FIFO control Register/Interrupt Status Register */
|
||||
uchar LCR; /* Interrupt Status Register */
|
||||
uchar MCR; /* Modem Control Register */
|
||||
uchar LSR; /* Line Status Register */
|
||||
uchar MSR; /* Modem Status Register */
|
||||
uchar SCR; /* Scratch pad Register */
|
||||
};
|
||||
|
||||
#define clock 1.84320E+06
|
||||
//#define clock 3.686400e6
|
||||
//#define clock 6.144000e6
|
||||
//#define clock 7.372800e6
|
||||
//#define clock 1.4743600e7
|
||||
|
||||
// UART 16c450 Type Baud Rates
|
||||
#define _COM_300_ (clock/(16 * 300))-1
|
||||
#define _COM_1200_ (clock/(16 * 1200))-1
|
||||
#define _COM_2400_ (clock/(16 * 2400))-1
|
||||
#define _COM_9600_ (clock/(16 * 9600))-1
|
||||
#define _COM_19K_ (clock/(16 * 19200))-1
|
||||
#define _COM_38K_ (clock/(16 * 38400))-1
|
||||
#define _COM_56K_ (clock/(16 * 57600))-1
|
||||
#define _COM_115K_ (clock/(16 * 115200))-1
|
||||
|
||||
//* Parity
|
||||
#define _COM_NOPARITY_ 0
|
||||
#define _COM_ODDPARITY_ 1
|
||||
#define _COM_EVENPARITY_ 2
|
||||
|
||||
//* Stopbits
|
||||
#define _COM_STOP1_ 0
|
||||
#define _COM_STOP2_ 1
|
||||
#define _COM_STOP1_5_ 1
|
||||
|
||||
//* word length
|
||||
#define _COM_CHR5_ 0
|
||||
#define _COM_CHR6_ 1
|
||||
#define _COM_CHR7_ 2
|
||||
#define _COM_CHR8_ 3
|
||||
|
||||
//* word Buffer length
|
||||
#define _COM_FIFO1_ 0
|
||||
#define _COM_FIFO4_ 1
|
||||
#define _COM_FIFO8_ 2
|
||||
#define _COM_FIFO14_ 3
|
||||
|
||||
|
||||
|
||||
|
||||
struct _UART51{
|
||||
uchar rxd_txd; /* Receiver register */
|
||||
uchar serial_status; /* xmit & receive status reg */
|
||||
uchar serial_command; /* command register */
|
||||
uchar serial_control; /* rate & size control */
|
||||
};
|
||||
|
||||
#define RXD_READY 0x08 /* receiver ready bit mask */
|
||||
#define TXD_READY 0x10 /* transmitter ready bit mask */
|
||||
#define RXD_INT_ENABLE 0x02 /* receiver interrupt enable bit mask */
|
||||
#define TXD_INT_ENABLE 0x04 /* transmitter interrupt enable bit mask */
|
||||
#define RXD_ERROR 0x07 /* frame, overrun & parity error flags */
|
||||
|
||||
#define clock51 1.84320E+06
|
||||
//#define clock51 3.686400e6
|
||||
//#define clock51 6.144000e6
|
||||
//#define clock51 7.372800e6
|
||||
//#define clock51 1.4743600e7
|
||||
|
||||
// UART W65c51 Type Baud Rates
|
||||
#define _COM51_300_ (clock51/(16 * 300))
|
||||
#define _COM51_1200_ (clock51/(16 * 1200))
|
||||
#define _COM51_2400_ (clock51/(16 * 2400))
|
||||
#define _COM51_9600_ (clock51/(16 * 9600))
|
||||
#define _COM51_19K_ (clock51/(16 * 19200))
|
||||
#define _COM51_38K_ (clock51/(16 * 38400))
|
||||
#define _COM51_56K_ (clock51/(16 * 57600))
|
||||
#define _COM51_115K_ (clock51/(16 * 115200))
|
||||
|
||||
|
||||
|
||||
struct _134_TOD_Clock{
|
||||
uchar tenthsec;
|
||||
uchar sec;
|
||||
uchar min;
|
||||
uchar hr;
|
||||
uchar day;
|
||||
uchar month;
|
||||
uchar yr;
|
||||
uchar daywk:3;
|
||||
uchar nu1:5;
|
||||
uchar daylit:1;
|
||||
uchar nu2:7;
|
||||
};
|
||||
|
||||
struct _Maxim_TOD_Clock{
|
||||
uchar sec;
|
||||
uchar min;
|
||||
uchar hr;
|
||||
uchar day;
|
||||
uchar month;
|
||||
uchar yr;
|
||||
};
|
||||
|
||||
|
||||
|
||||
struct _I2C{ /* One byte of the VIA */
|
||||
uchar clock:1;
|
||||
uchar sin:1;
|
||||
uchar sout:1;
|
||||
uchar nu:5;
|
||||
};
|
||||
|
||||
#endif /* Flash_SK_IO_H */
|
||||
#pragma Pop (List)
|
||||
|
||||
|
||||
105
include/sys/sk_io.h
Normal file
105
include/sys/sk_io.h
Normal file
@@ -0,0 +1,105 @@
|
||||
#pragma Off (List)
|
||||
/*******************************************************************************
|
||||
* FILE NAME: SK_IO.ch
|
||||
*
|
||||
* TITLE: This function prototypes and data type definitions.
|
||||
*
|
||||
* DATA_RIGHTS: Western Design Center and R & C Services Proprietary
|
||||
* Copyright(C) 1980-2004
|
||||
* All rights reserved. Reproduction in any manner,
|
||||
* in whole or in part, is strictly prohibited without
|
||||
* the prior written approval of R & C Services or
|
||||
* Western Design Center.
|
||||
*
|
||||
* DESCRIPTION: This file describes function prototypes and data type
|
||||
* definitions used for .
|
||||
*
|
||||
*
|
||||
* SPECIAL CONSIDERATIONS:
|
||||
* <None>
|
||||
*
|
||||
* AUTHOR: R. Greenthal
|
||||
*
|
||||
*
|
||||
* CREATION DATE: Feb 05,2004
|
||||
*
|
||||
* REVISION HISTORY
|
||||
* Name Date Description
|
||||
* ------------ ---------- ----------------------------------------------
|
||||
* R. Greenthal 02/05/2004 Initial
|
||||
*
|
||||
*******************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef SK_IO_H
|
||||
#define SK_IO_H
|
||||
|
||||
/*
|
||||
*=========================== CONSTANTS & MACROS ===============================
|
||||
*/
|
||||
|
||||
/* None */
|
||||
|
||||
/*
|
||||
*================================== TYPES =====================================
|
||||
*/
|
||||
|
||||
/* None */
|
||||
|
||||
/*
|
||||
*============================= FUNCTION PROTOTYPES ============================
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#define CLI asm{cli;} /* enable interrupt response */
|
||||
#define SEI asm{sei;} /* disable it */
|
||||
|
||||
#define BRK(n) asm{ brk n;} /* 65C02/65c816-BRK */
|
||||
|
||||
#define COP(n) asm{ cop n;} /* 65c816-COP */
|
||||
|
||||
|
||||
//#define EnableIRQ(n)\
|
||||
// asm(" lda #$80\n"\
|
||||
// " tsb $fd01+"#n"*4\n") /* enable interrupt of timer n */
|
||||
|
||||
//#define DisableIRQ(n)\
|
||||
// asm(" lda #$80\n"\
|
||||
// " trb $fd01+"#n"*4\n") /* disable it */
|
||||
|
||||
|
||||
struct _VIA1{
|
||||
uchar ORB_IRB; /* Input/Output Reg 'B' */
|
||||
uchar ORA_IRA; /* Input/Output Reg 'A' */
|
||||
uchar DDRB; /* Data Direction Reg 'B' */
|
||||
uchar DDRA; /* Data Direction Reg 'A' */
|
||||
uchar T1CLO; /* Timer #1 Counter Low */
|
||||
uchar T1CHI; /* Timer #1 Counter High */
|
||||
uchar T1LLO; /* Timer #1 Latch Low */
|
||||
uchar T1LHI; /* Timer #1 Latch High */
|
||||
uchar T2CLO; /* Timer #2 Counter Low */
|
||||
uchar T2CHI; /* Timer #2 Counter High */
|
||||
uchar SR; /* Shift Reg */
|
||||
uchar ACR; /* Auxiliary Control Reg */
|
||||
uchar PCR; /* Peripheral Control Reg */
|
||||
uchar IFR; /* Interrupt Flag Reg */
|
||||
uchar IER; /* Interrupt Enable Reg */
|
||||
uchar ORANH_IRANH; /* Input Reg 'A' No Handshake */
|
||||
};
|
||||
|
||||
|
||||
struct _I2C{ /* One byte of the VIA */
|
||||
uchar clock:1;
|
||||
uchar sin:1;
|
||||
uchar sout:1;
|
||||
uchar nu:5;
|
||||
};
|
||||
|
||||
#endif /* SK_IO_H */
|
||||
#pragma Pop (List)
|
||||
|
||||
|
||||
170
include/sys/types.h
Normal file
170
include/sys/types.h
Normal file
@@ -0,0 +1,170 @@
|
||||
/*******************************************************************************
|
||||
* FILE NAME: sys\types.h
|
||||
*
|
||||
* TITLE: This function prototypes and data type definitions for the General Functions.
|
||||
*
|
||||
* DATA_RIGHTS: Western Design Center and R & C Services Proprietary
|
||||
* Copyright(C) 1980-2004
|
||||
* All rights reserved. Reproduction in any manner,
|
||||
* in whole or in part, is strictly prohibited without
|
||||
* the prior written approval of R & C Services or
|
||||
* Western Design Center.
|
||||
*
|
||||
* DESCRIPTION: This file describes function prototypes and data type
|
||||
* definitions used for General purpose functions.
|
||||
* The <sys\types.h> header contains important data type definitions.
|
||||
* It is considered good programming practice to use these definitions,
|
||||
* instead of the underlying base type. By convention, all type names end
|
||||
* with _t.
|
||||
|
||||
*
|
||||
*
|
||||
* SPECIAL CONSIDERATIONS:
|
||||
* <None>
|
||||
*
|
||||
* AUTHOR: R. Greenthal
|
||||
*
|
||||
*
|
||||
* CREATION DATE: March 27,2004
|
||||
*
|
||||
* REVISION HISTORY
|
||||
* Name Date Description
|
||||
* ------------ ---------- ----------------------------------------------
|
||||
* R. Greenthal 03/27/2004 Initial
|
||||
* 0x/xx/2004 Added
|
||||
* 0x/xx/2004 Added
|
||||
*
|
||||
*******************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef _TYPES_H
|
||||
#define _TYPES_H
|
||||
|
||||
|
||||
/* The type size_t holds all results of the sizeof operator. At first glance,
|
||||
* it seems obvious that it should be an unsigned int, but this is not always
|
||||
* the case. For example, MINIX-ST (68000) has 32-bit pointers and 16-bit
|
||||
* integers. When one asks for the size of a 70K struct or array, the result
|
||||
* requires 17 bits to express, so size_t must be a long type. The type
|
||||
* ssize_t is the signed version of size_t.
|
||||
*/
|
||||
|
||||
#ifndef _SIZE_T
|
||||
#define _SIZE_T
|
||||
typedef unsigned int size_t;
|
||||
#endif
|
||||
|
||||
#ifndef _SSIZE_T
|
||||
#define _SSIZE_T
|
||||
typedef int ssize_t;
|
||||
#endif
|
||||
|
||||
#ifndef _TIME_T
|
||||
#define _TIME_T
|
||||
typedef long time_t; /* time in sec since 1 Jan 1970 0000 GMT */
|
||||
#endif
|
||||
|
||||
#ifndef _CLOCK_T
|
||||
#define _CLOCK_T
|
||||
typedef long clock_t; /* unit for system accounting */
|
||||
#endif
|
||||
|
||||
#ifndef _SIGSET_T
|
||||
#define _SIGSET_T
|
||||
typedef unsigned long sigset_t;
|
||||
#endif
|
||||
|
||||
/* Types used in disk, inode, etc. data structures. */
|
||||
typedef short dev_t; /* holds (major|minor) device pair */
|
||||
typedef char gid_t; /* group id */
|
||||
typedef unsigned short ino_t; /* i-node number */
|
||||
typedef unsigned short mode_t; /* file type and permissions bits */
|
||||
typedef char nlink_t; /* number of links to a file */
|
||||
typedef unsigned long off_t; /* offset within a file */
|
||||
typedef int pid_t; /* process id (must be signed) */
|
||||
typedef short uid_t; /* user id */
|
||||
typedef unsigned long zone_t; /* zone number */
|
||||
typedef unsigned long block_t; /* block number */
|
||||
typedef unsigned long bit_t; /* bit number in a bit map */
|
||||
typedef unsigned short zone1_t; /* zone number for V1 file systems */
|
||||
typedef unsigned short bitchunk_t; /* collection of bits in a bitmap */
|
||||
|
||||
typedef unsigned char u8_t; /* 8 bit type */
|
||||
typedef unsigned short u16_t; /* 16 bit type */
|
||||
typedef unsigned long u32_t; /* 32 bit type */
|
||||
//typedef unsigned long long u64_t; /* 64 bit type */
|
||||
|
||||
typedef unsigned char uchar; /* 8 bit type */
|
||||
typedef unsigned short uint; /* 16 bit type */
|
||||
typedef unsigned long ulong; /* 32 bit type */
|
||||
//typedef unsigned long long ull; /* 64 bit type */
|
||||
|
||||
//typedef unsigned char UCHAR; /* 8 bit type */
|
||||
//typedef unsigned short UINT; /* 16 bit type */
|
||||
//typedef unsigned long ULONG; /* 32 bit type */
|
||||
//typedef unsigned long long ULL; /* 64 bit type */
|
||||
|
||||
typedef char i8_t; /* 8 bit signed type */
|
||||
typedef short i16_t; /* 16 bit signed type */
|
||||
typedef long i32_t; /* 32 bit signed type */
|
||||
//typedef long long i64_t; /* 64 bit signed type */
|
||||
|
||||
#ifndef _FLOAT_T
|
||||
#define _FLOAT_T
|
||||
typedef float float_t;
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef _DOUBLE_T
|
||||
#define _DOUBLE_T
|
||||
typedef double double_t;
|
||||
#endif
|
||||
|
||||
|
||||
/* Signal handler type, e.g. SIG_IGN */
|
||||
#if defined(_ANSI)
|
||||
typedef void (*sighandler_t) (int);
|
||||
#else
|
||||
typedef void (*sighandler_t)();
|
||||
#endif
|
||||
|
||||
//*****************************
|
||||
//*****************************
|
||||
// Special
|
||||
//*****************************
|
||||
//*****************************
|
||||
|
||||
#define TRUE 1
|
||||
#define FALSE 0
|
||||
|
||||
#define true 1
|
||||
#define false 0
|
||||
|
||||
#define bool int
|
||||
#define BOOL int
|
||||
#define _Bool int // 1999 C
|
||||
|
||||
#define EQ ==
|
||||
#define GE >=
|
||||
#define GT >
|
||||
#define LE <=
|
||||
#define LT <
|
||||
#define NE !=
|
||||
|
||||
/*
|
||||
** Macros to manipulate bits in an array of char.
|
||||
** These macros assume CHAR_BIT is one of either 8, 16, or 32.
|
||||
*/
|
||||
|
||||
#define MASK CHAR_BIT-1
|
||||
#define SHIFT ((CHAR_BIT==8)?3:(CHAR_BIT==16)?4:8)
|
||||
|
||||
#define BitOff(a,x) ((void)((a)[(x)>>SHIFT] &= ~(1 << ((x)&MASK))))
|
||||
#define BitOn(a,x) ((void)((a)[(x)>>SHIFT] |= (1 << ((x)&MASK))))
|
||||
#define BitFlip(a,x) ((void)((a)[(x)>>SHIFT] ^= (1 << ((x)&MASK))))
|
||||
#define IsBit(a,x) ((a)[(x)>>SHIFT] & (1 << ((x)&MASK)))
|
||||
|
||||
|
||||
#endif /* _TYPES_H */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user