summaryrefslogtreecommitdiff
path: root/bus.h
blob: f62e931fa8f36912c4db0f703c6e6b42959ea0ba (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
/*
 * bus.h
 *
 *  Created on: 9 Aug 2012
 *      Author: daniel
 */

#ifndef BUS_H_
#define BUS_H_

#include <stdint.h>


// these are assigned pins in gpio_pins[] in bus.c
#define out_DATA_LINE 0         /* out data signaled on 0 output of decoder */
#define out_CLOCK_LINE 1        /* out clock signaled on 1 output of decoder */
#define out_STROBE_LINE 2       /* out latch strobe on 2 output of decoder */
#define O_GATE 3                /* gates output */
#define OUTPUT_RELAY 4          /* output enable/disable relay */
#define PW_ENABLE 5             /* TTL enable/disable output */
#define POWER_FAIL 6		/* pulled low if +24V OK, pulled high if power fails */
#define RST_GPIB 7		/* don't use SYS_RESETn for this purpose - unpredictable */

// A5, A6 used to select chips
#define Octal_DACportCS_low	0x00
#define Octal_DACportCS_high	0x20
#define TNT_Port		0x40


void bus_init(void); // call this before doing anything

int bus_getpin(int pin);
void bus_setpin(int pin, int value); // set the value of a pin

void bus_writebyte(uint8_t address, uint8_t data); // write a byte to the bus
uint8_t bus_readbyte(uint8_t address); // read a pin from the bus

void bus_shutdown(void); // shutdown the bus

#endif /* BUS_H_ */