AlcapDAQ  1
Functions | Variables
floppy_ttl.cpp File Reference
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/io.h>
#include "midas.h"
#include "crate.h"
#include "diag.h"

Go to the source code of this file.

Functions

INT floppy_ttl_init ()
 
INT floppy_ttl_start_block ()
 
INT floppy_ttl_poll_live ()
 
INT floppy_ttl_poll_dead ()
 

Variables

struct readout_module floppy_ttl_module
 

Function Documentation

INT floppy_ttl_init ( )

Definition at line 36 of file floppy_ttl.cpp.

References diag_print(), status, and SUCCESS.

37 {
38  int status = iopl( 3 );
39 
40  if (status < 0) {
41  diag_print(0, "Unable to get permission to access I/O ports\n");
42  }
43 
44  // turn off output
45  outb(0x1d, 0x3f2);
46 
47  return SUCCESS;
48 }
INT floppy_ttl_poll_dead ( )

Definition at line 99 of file floppy_ttl.cpp.

References FE_NEED_START.

100 {
101  return FE_NEED_START;
102 }
INT floppy_ttl_poll_live ( )

Definition at line 87 of file floppy_ttl.cpp.

References FE_END_BLOCK, and SUCCESS.

88 {
89  int input = inb(0x3f7);
90 
91  // high bit of input: 1 = TTL LOW, 0 = TTL HIGH
92  if(!(input & 0x80)) {
93  return FE_END_BLOCK;
94  } else {
95  return SUCCESS;
96  }
97 }
INT floppy_ttl_start_block ( )

Definition at line 54 of file floppy_ttl.cpp.

References printf(), ready, and SUCCESS.

55 {
56  // Produce a quick pulse on the output
57  outb(0x0d, 0x3f2);
58  outb(0x1d, 0x3f2);
59 
60  bool ready = false;
61  DWORD start_waiting = ss_millitime();
62  while(!ready && ss_millitime() < start_waiting + 1000) {
63 // while(!ready) {
64  int input = inb(0x3f7);
65  if((input & 0x80)) {
66  ready = true;
67  }
68  }
69 
70  if(!ready) {
71  printf("\n\n\nNot ready, start times out\n");
72  }
73 
74  return SUCCESS;
75 }

Variable Documentation

struct readout_module floppy_ttl_module
Initial value:

Definition at line 17 of file floppy_ttl.cpp.