From cce93220ece0d90d0a97debb583768257b4b0cf3 Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Wed, 15 Jul 1998 23:54:08 +0000 Subject: Added default mc68681 register access routines. --- c/src/lib/libchip/serial/mc68681.h | 24 ++++++------- c/src/lib/libchip/serial/mc68681_reg.c | 61 +++++++++++++++++++++++++++++++++ c/src/lib/libchip/serial/mc68681_reg2.c | 23 +++++++++++++ c/src/lib/libchip/serial/mc68681_reg4.c | 23 +++++++++++++ c/src/lib/libchip/serial/mc68681_reg8.c | 23 +++++++++++++ c/src/libchip/serial/mc68681.h | 24 ++++++------- c/src/libchip/serial/mc68681_reg.c | 61 +++++++++++++++++++++++++++++++++ c/src/libchip/serial/mc68681_reg2.c | 23 +++++++++++++ c/src/libchip/serial/mc68681_reg4.c | 23 +++++++++++++ c/src/libchip/serial/mc68681_reg8.c | 23 +++++++++++++ 10 files changed, 284 insertions(+), 24 deletions(-) create mode 100644 c/src/lib/libchip/serial/mc68681_reg.c create mode 100644 c/src/lib/libchip/serial/mc68681_reg2.c create mode 100644 c/src/lib/libchip/serial/mc68681_reg4.c create mode 100644 c/src/lib/libchip/serial/mc68681_reg8.c create mode 100644 c/src/libchip/serial/mc68681_reg.c create mode 100644 c/src/libchip/serial/mc68681_reg2.c create mode 100644 c/src/libchip/serial/mc68681_reg4.c create mode 100644 c/src/libchip/serial/mc68681_reg8.c diff --git a/c/src/lib/libchip/serial/mc68681.h b/c/src/lib/libchip/serial/mc68681.h index 87917ff159..8549ca2896 100644 --- a/c/src/lib/libchip/serial/mc68681.h +++ b/c/src/lib/libchip/serial/mc68681.h @@ -67,45 +67,45 @@ extern console_fns mc68681_fns_polled; * Default register access routines */ -unsigned8 mc68681_default_read_register( - unsigned32 ulCtrlPort, +unsigned8 mc68681_get_register( /* registers are at 1 byte boundaries */ + unsigned32 ulCtrlPort, /* and accessed as bytes */ unsigned8 ucRegNum ); -void mc68681_default_write_register( +void mc68681_set_register( unsigned32 ulCtrlPort, unsigned8 ucRegNum, unsigned8 ucData ); -unsigned8 mc68681_default_read_register_with_multiplier_2( - unsigned32 ulCtrlPort, +unsigned8 mc68681_get_register_2( /* registers are at 2 byte boundaries */ + unsigned32 ulCtrlPort, /* and accessed as bytes */ unsigned8 ucRegNum ); -void mc68681_default_write_register_with_multiplier_2( +void mc68681_set_register_2( unsigned32 ulCtrlPort, unsigned8 ucRegNum, unsigned8 ucData ); -unsigned8 mc68681_default_read_register_with_multiplier_4( - unsigned32 ulCtrlPort, +unsigned8 mc68681_get_register_4( /* registers are at 4 byte boundaries */ + unsigned32 ulCtrlPort, /* and accessed as bytes */ unsigned8 ucRegNum ); -void mc68681_default_write_register_with_multiplier_4( +void mc68681_set_register_4( unsigned32 ulCtrlPort, unsigned8 ucRegNum, unsigned8 ucData ); -unsigned8 mc68681_default_read_register_with_multiplier_8( - unsigned32 ulCtrlPort, +unsigned8 mc68681_get_register_8( /* registers are at 8 byte boundaries */ + unsigned32 ulCtrlPort, /* and accessed as bytes */ unsigned8 ucRegNum ); -void mc68681_default_write_register_with_multiplier_8( +void mc68681_set_register_8( unsigned32 ulCtrlPort, unsigned8 ucRegNum, unsigned8 ucData diff --git a/c/src/lib/libchip/serial/mc68681_reg.c b/c/src/lib/libchip/serial/mc68681_reg.c new file mode 100644 index 0000000000..c9a16db130 --- /dev/null +++ b/c/src/lib/libchip/serial/mc68681_reg.c @@ -0,0 +1,61 @@ +/* + * This file contains a typical set of register access routines which may be + * used with the mc68681 chip if accesses to the chip are as follows: + * + * + registers are accessed as bytes + * + registers are only byte-aligned (no address gaps) + * + * COPYRIGHT (c) 1989-1997. + * On-Line Applications Research Corporation (OAR). + * Copyright assigned to U.S. Government, 1994. + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#include + +#ifndef _MC68681_MULTIPLIER +#define _MC68681_MULTIPLIER 1 +#define _MC68681_NAME(_X) _X +#define _MC68681_TYPE unsigned8 +#endif + +#define CALCULATE_REGISTER_ADDRESS( _base, _reg ) \ + (_MC68681_TYPE *)((_base) + ((_reg) * _MC68681_MULTIPLIER )) + +/* + * MC68681 Get Register Routine + */ + +unsigned8 _MC68681_NAME(mc68681_get_register)( + unsigned32 ulCtrlPort, + unsigned8 ucRegNum +) +{ + _Z85C30_TYPE *port; + + port = CALCULATE_REGISTER_ADDRESS( ulCtrlPort, ucRegNum ); + + return *port; +} + +/* + * MC68681 Set Register Routine + */ + +void _MC68681_NAME(mc68681_set_register)( + unsigned32 ulCtrlPort, + unsigned8 ucRegNum, + unsigned8 ucData +) +{ + _Z85C30_TYPE *port; + + port = CALCULATE_REGISTER_ADDRESS( ulCtrlPort, ucRegNum ); + + *port = ucData; +} diff --git a/c/src/lib/libchip/serial/mc68681_reg2.c b/c/src/lib/libchip/serial/mc68681_reg2.c new file mode 100644 index 0000000000..17576383df --- /dev/null +++ b/c/src/lib/libchip/serial/mc68681_reg2.c @@ -0,0 +1,23 @@ +/* + * This file contains a typical set of register access routines which may be + * used with the mc68681 chip if accesses to the chip are as follows: + * + * + registers are accessed as bytes + * + registers are on 16-bit boundaries + * + * COPYRIGHT (c) 1989-1997. + * On-Line Applications Research Corporation (OAR). + * Copyright assigned to U.S. Government, 1994. + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#define _MC68681_MULTIPLIER 2 +#define _MC68681_NAME(_X) _X##_2 + +#include "mc68681_reg.c" + diff --git a/c/src/lib/libchip/serial/mc68681_reg4.c b/c/src/lib/libchip/serial/mc68681_reg4.c new file mode 100644 index 0000000000..fb85bf4aa0 --- /dev/null +++ b/c/src/lib/libchip/serial/mc68681_reg4.c @@ -0,0 +1,23 @@ +/* + * This file contains a typical set of register access routines which may be + * used with the mc68681 chip if accesses to the chip are as follows: + * + * + registers are accessed as bytes + * + registers are on 64-bit boundaries + * + * COPYRIGHT (c) 1989-1997. + * On-Line Applications Research Corporation (OAR). + * Copyright assigned to U.S. Government, 1994. + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#define _MC68681_MULTIPLIER 4 +#define _MC68681_NAME(_X) _X##_4 + +#include "mc68681_reg.c" + diff --git a/c/src/lib/libchip/serial/mc68681_reg8.c b/c/src/lib/libchip/serial/mc68681_reg8.c new file mode 100644 index 0000000000..98753236b6 --- /dev/null +++ b/c/src/lib/libchip/serial/mc68681_reg8.c @@ -0,0 +1,23 @@ +/* + * This file contains a typical set of register access routines which may be + * used with the mc68681 chip if accesses to the chip are as follows: + * + * + registers are accessed as bytes + * + registers are on 32-bit boundaries + * + * COPYRIGHT (c) 1989-1997. + * On-Line Applications Research Corporation (OAR). + * Copyright assigned to U.S. Government, 1994. + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#define _MC68681_MULTIPLIER 8 +#define _MC68681_NAME(_X) _X##_8 + +#include "mc68681_reg.c" + diff --git a/c/src/libchip/serial/mc68681.h b/c/src/libchip/serial/mc68681.h index 87917ff159..8549ca2896 100644 --- a/c/src/libchip/serial/mc68681.h +++ b/c/src/libchip/serial/mc68681.h @@ -67,45 +67,45 @@ extern console_fns mc68681_fns_polled; * Default register access routines */ -unsigned8 mc68681_default_read_register( - unsigned32 ulCtrlPort, +unsigned8 mc68681_get_register( /* registers are at 1 byte boundaries */ + unsigned32 ulCtrlPort, /* and accessed as bytes */ unsigned8 ucRegNum ); -void mc68681_default_write_register( +void mc68681_set_register( unsigned32 ulCtrlPort, unsigned8 ucRegNum, unsigned8 ucData ); -unsigned8 mc68681_default_read_register_with_multiplier_2( - unsigned32 ulCtrlPort, +unsigned8 mc68681_get_register_2( /* registers are at 2 byte boundaries */ + unsigned32 ulCtrlPort, /* and accessed as bytes */ unsigned8 ucRegNum ); -void mc68681_default_write_register_with_multiplier_2( +void mc68681_set_register_2( unsigned32 ulCtrlPort, unsigned8 ucRegNum, unsigned8 ucData ); -unsigned8 mc68681_default_read_register_with_multiplier_4( - unsigned32 ulCtrlPort, +unsigned8 mc68681_get_register_4( /* registers are at 4 byte boundaries */ + unsigned32 ulCtrlPort, /* and accessed as bytes */ unsigned8 ucRegNum ); -void mc68681_default_write_register_with_multiplier_4( +void mc68681_set_register_4( unsigned32 ulCtrlPort, unsigned8 ucRegNum, unsigned8 ucData ); -unsigned8 mc68681_default_read_register_with_multiplier_8( - unsigned32 ulCtrlPort, +unsigned8 mc68681_get_register_8( /* registers are at 8 byte boundaries */ + unsigned32 ulCtrlPort, /* and accessed as bytes */ unsigned8 ucRegNum ); -void mc68681_default_write_register_with_multiplier_8( +void mc68681_set_register_8( unsigned32 ulCtrlPort, unsigned8 ucRegNum, unsigned8 ucData diff --git a/c/src/libchip/serial/mc68681_reg.c b/c/src/libchip/serial/mc68681_reg.c new file mode 100644 index 0000000000..c9a16db130 --- /dev/null +++ b/c/src/libchip/serial/mc68681_reg.c @@ -0,0 +1,61 @@ +/* + * This file contains a typical set of register access routines which may be + * used with the mc68681 chip if accesses to the chip are as follows: + * + * + registers are accessed as bytes + * + registers are only byte-aligned (no address gaps) + * + * COPYRIGHT (c) 1989-1997. + * On-Line Applications Research Corporation (OAR). + * Copyright assigned to U.S. Government, 1994. + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#include + +#ifndef _MC68681_MULTIPLIER +#define _MC68681_MULTIPLIER 1 +#define _MC68681_NAME(_X) _X +#define _MC68681_TYPE unsigned8 +#endif + +#define CALCULATE_REGISTER_ADDRESS( _base, _reg ) \ + (_MC68681_TYPE *)((_base) + ((_reg) * _MC68681_MULTIPLIER )) + +/* + * MC68681 Get Register Routine + */ + +unsigned8 _MC68681_NAME(mc68681_get_register)( + unsigned32 ulCtrlPort, + unsigned8 ucRegNum +) +{ + _Z85C30_TYPE *port; + + port = CALCULATE_REGISTER_ADDRESS( ulCtrlPort, ucRegNum ); + + return *port; +} + +/* + * MC68681 Set Register Routine + */ + +void _MC68681_NAME(mc68681_set_register)( + unsigned32 ulCtrlPort, + unsigned8 ucRegNum, + unsigned8 ucData +) +{ + _Z85C30_TYPE *port; + + port = CALCULATE_REGISTER_ADDRESS( ulCtrlPort, ucRegNum ); + + *port = ucData; +} diff --git a/c/src/libchip/serial/mc68681_reg2.c b/c/src/libchip/serial/mc68681_reg2.c new file mode 100644 index 0000000000..17576383df --- /dev/null +++ b/c/src/libchip/serial/mc68681_reg2.c @@ -0,0 +1,23 @@ +/* + * This file contains a typical set of register access routines which may be + * used with the mc68681 chip if accesses to the chip are as follows: + * + * + registers are accessed as bytes + * + registers are on 16-bit boundaries + * + * COPYRIGHT (c) 1989-1997. + * On-Line Applications Research Corporation (OAR). + * Copyright assigned to U.S. Government, 1994. + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#define _MC68681_MULTIPLIER 2 +#define _MC68681_NAME(_X) _X##_2 + +#include "mc68681_reg.c" + diff --git a/c/src/libchip/serial/mc68681_reg4.c b/c/src/libchip/serial/mc68681_reg4.c new file mode 100644 index 0000000000..fb85bf4aa0 --- /dev/null +++ b/c/src/libchip/serial/mc68681_reg4.c @@ -0,0 +1,23 @@ +/* + * This file contains a typical set of register access routines which may be + * used with the mc68681 chip if accesses to the chip are as follows: + * + * + registers are accessed as bytes + * + registers are on 64-bit boundaries + * + * COPYRIGHT (c) 1989-1997. + * On-Line Applications Research Corporation (OAR). + * Copyright assigned to U.S. Government, 1994. + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#define _MC68681_MULTIPLIER 4 +#define _MC68681_NAME(_X) _X##_4 + +#include "mc68681_reg.c" + diff --git a/c/src/libchip/serial/mc68681_reg8.c b/c/src/libchip/serial/mc68681_reg8.c new file mode 100644 index 0000000000..98753236b6 --- /dev/null +++ b/c/src/libchip/serial/mc68681_reg8.c @@ -0,0 +1,23 @@ +/* + * This file contains a typical set of register access routines which may be + * used with the mc68681 chip if accesses to the chip are as follows: + * + * + registers are accessed as bytes + * + registers are on 32-bit boundaries + * + * COPYRIGHT (c) 1989-1997. + * On-Line Applications Research Corporation (OAR). + * Copyright assigned to U.S. Government, 1994. + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.OARcorp.com/rtems/license.html. + * + * $Id$ + */ + +#define _MC68681_MULTIPLIER 8 +#define _MC68681_NAME(_X) _X##_8 + +#include "mc68681_reg.c" + -- cgit v1.2.3