versadac
1
versadac - Scalable Recorder Firmware
Main Page
Classes
Files
File List
File Members
core
io_spi
do_f_ssm.h
1
/*******************************************************************************
2
FILE : do_f_ssm.h
3
VERSION : $Id: do_f_ssm.h 5305 2006-10-27 12:09:59Z martinto $
4
AUTHOR : Richard Hine
5
SYSTEM : Diab C for PowerPC under vxWorks
6
DESCRIPTION : Scheduled message class for driving any of the upgraded 2500 4 chan digital
7
output modules in a fast mode with error recovery. DO4 and RELAY 4.
8
Note: this is NOT the code which drives the new DO8
9
*******************************************************************************/
10
#ifndef __DO_F_SSM_H
11
#define __DO_F_SSM_H
12
#include "spismsg.h"
13
#include "msg_try.h"
14
15
#define EIO_DO_FAST_MODULE_STATUS_GOOD 0x20
16
17
#define EIO_FAST_MESSAGES_GOOD true
18
#define EIO_FAST_MESSAGES_BAD false
19
20
#define EIO_DO_FAST_MODULE_NUMBER_OF_CHANNELS 4
21
22
/*
23
When enabled this feature provides -
24
1. Outputs 'c' whenever a corrupt reply to a fast update message is received
25
2. Provides ioDoTestCorrupt(module, cycles) which introduces a fixed number of errors
26
into the update message
27
*/
28
//#define CORRUPTION_TEST_FEATURE_ENABLED
29
30
/*
31
When defined DO_CORRUPT enables corruption of messages to the modules of specific types / timing
32
The define must also be set in the do_s_ssm.h file
33
34
The debug is triggered by setting g_corrupt in the Tornado shell to the following values -
35
1 Inverts the inverted data bits in the next fast update message.
36
2 Inverts the non-inverted data bits in the next fast update message.
37
3+10c Inverts all the data bits of channel c but not the message type bits and truncates message after that channels data for the next message only.
38
4+10c As above but inverts / truncates the next TPO min on time or set fast mode message only.
39
5+10c As above but forces a watchdog after truncation.
40
6+10c Inverts all the data bits of channel c for one message cycle. Checksum is not corrected to match.
41
7+10c As above but inverts the next TPO min on time or set fast mode message only.
42
8+10c As 3+10c but forces a watchdog after truncation.
43
*/
44
//#define DO_CORRUPT
45
46
class
DigitalOutputFastSpiScheduledMessage
:
public
SpiScheduledMessage
47
{
48
public
:
49
DigitalOutputFastSpiScheduledMessage
(
unsigned
char
device,
unsigned
char
* data,
MsgRetryCounter
* z_retry_p);
50
virtual
~
DigitalOutputFastSpiScheduledMessage
();
51
void
SetLastExpectedReplyPtr(
unsigned
char
*z_last_expected_reply_p) {last_expected_reply_p = z_last_expected_reply_p;};
52
void
setOnOffState(
int
z_channel,
bool
on);
53
54
virtual
void
sent();
// called every time a message has been sent
55
56
private
:
57
bool
wasCommandOk() {
return
(*getRxPtr() == *last_expected_reply_p);}
58
static
unsigned
short
moduleToDevice(
unsigned
char
module);
59
MsgRetryCounter
* retry_p;
// pointer to the retries count
60
unsigned
char
*last_expected_reply_p;
61
};
62
63
64
#endif
/*__DO_F_SSM_H */
65
DigitalOutputFastSpiScheduledMessage
Definition:
do_f_ssm.h:46
MsgRetryCounter
Definition:
msg_try.h:21
Generated on Wed Aug 19 2020 10:33:41 for versadac by
1.8.9.1