|
Next: Pbus Defines Template, pbusdefn-template.h
Up: Firmware Library, dacslib
Previous: Pbus Driver Header File,
  Contents
The code that implements the Pbus driver is presented below.
/*****************************************************************************
* DACS : Distributed Audio Control System
*============================================================================
* File: pbus.c
* Author: Stephen S. Richardson
* Date Created: 04.14.97
* Environment: ICC11 v4.0, 68HC11 target
* Build: library, not standalone
*============================================================================
* The code, executables, documentation, firmware images, and all related
* material of DACS are
* Copyright (C) 1997 Stephen S. Richardson - ALL RIGHTS RESERVED
*****************************************************************************
* Source code control:
*
* $Id: pbus.c,v 1.1 1997/07/23 21:30:10 prefect Exp prefect $
*
*****************************************************************************/
#include <hc11.h>
#include "pbus.h"
#include "pbusdefn.h"
/*****************************************************************************
* pbus_init
*
* initializes pBUS controller, appropriate bits, etc.
*****************************************************************************/
void pbus_init (void)
{
PBC_PX=PBC_OX; /* pBUS in output mode */
PBC_PA=0; /* pBUS data bus = 0 */
PBC_PB=0; /* pBUS addx bus = 0 */
PBC_PC|=PB_N_LATCH|PB_N_CLOCK; /* pBUS latch- and clock- inactive */
}
/*****************************************************************************
* pbus_lwrite
*
* does a standard pBUS latch write operation; writes data to pBUS addx.
*****************************************************************************/
void pbus_lwrite (unsigned char addx, unsigned char data)
{
PBC_PX=PBC_OX; /* pBUS in output mode */
PBC_PC|=PB_N_LATCH|PB_N_CLOCK; /* pBUS latch- and clock- inactive */
PBC_PA=data; /* data on pBUS */
PBC_PB=addx|PB_N_RD_WR; /* addx on pBUS, write mode */
PBC_PC&=~PB_N_LATCH; /* pBUS latch- active */
PBC_PC|=PB_N_LATCH; /* pBUS latch- inactive */
}
/*****************************************************************************
* pbus_lread
*
* does a standard pBUS latch read operation; returns pBUS data from addx
*****************************************************************************/
unsigned char pbus_lread (unsigned char addx)
{
unsigned char c;
PBC_PX=PBC_IX; /* pBUS in input mode */
PBC_PC|=PB_N_LATCH|PB_N_CLOCK; /* pBUS latch- and clock- inactive */
PBC_PB=addx&~PB_N_RD_WR; /* addx on pBUS, read mode */
PBC_PC&=~PB_N_LATCH; /* pBUS latch- active */
c=PBC_PA; /* data from pBUS */
PBC_PC|=PB_N_LATCH; /* pBUS latch- inactive */
return (c);
}
Steve Richardson
2000-07-06
|
Table of Contents
[Whole document in PDF 1.9MB]
[more photos and information]
|