33#ifndef __CCIOBOARDMANAGER_H__
34#define __CCIOBOARDMANAGER_H__
46#define CCIO_PINS_PER_BOARD 8
47#ifndef MAX_CCIO_DEVICES
50#define MAX_CCIO_DEVICES 8
54#define CCIO_PIN_CNT (CCIO_PINS_PER_BOARD * MAX_CCIO_DEVICES)
59#ifndef MAX_FLUSH_ATTEMPTS
60#define MAX_FLUSH_ATTEMPTS 4
66#define MAX_GLITCH_LIM 4
71#ifndef CCIO_OVERLOAD_TRIP_TICKS
72#define CCIO_OVERLOAD_TRIP_TICKS ((uint8_t)(2.4 * MS_TO_SAMPLES))
76#ifndef CCIO_OVERLOAD_FOLDBACK_TICKS
77#define CCIO_OVERLOAD_FOLDBACK_TICKS (100 * MS_TO_SAMPLES)
96#ifndef HIDE_FROM_DOXYGEN
160 uint32_t offTime, uint16_t pulseCount = 0,
161 bool blockUntilDone =
false);
195 return m_pulseActive;
219#ifndef HIDE_FROM_DOXYGEN
262 return m_ccioLinkBroken;
278 return m_ccioOverloaded;
306 return m_overloadSinceStartupAccum;
350 return m_filteredInputs;
364 return m_lastOutputs;
406 return (cnt > 1) ? (cnt >> 1) : 1;
411 struct __attribute__((packed)) {
414 uint64_t outputsSwapped;
422 buf64.writeMarker = 0;
424 buf64.outputsSwapped = 0;
425 buf64.readMarker = 0;
439 CcioDiscoverState m_discoverState;
442 SerialDriver *m_serPort;
446 uint8_t m_ccioRefreshRate;
448 uint8_t m_ccioRefreshDelay;
450 uint64_t m_throttledOutputs;
454 uint64_t m_currentInputs;
455 uint64_t m_filteredInputs;
456 uint64_t m_currentOutputs;
457 uint64_t m_outputMask;
458 uint64_t m_lastOutputsSwapped;
460 uint64_t m_lastOutputs;
461 uint64_t m_outputsWithThrottling;
465 uint64_t m_pulseActive;
466 uint64_t m_pulseValue;
467 uint64_t m_pulseStopPending;
469 uint16_t m_consGlitchCnt;
470 bool m_ccioLinkBroken;
471 uint64_t m_ccioOverloaded;
472 uint64_t m_ccioOverloadAccum;
473 uint64_t m_overloadSinceStartupAccum;
474 uint64_t m_inputRegRisen;
475 uint64_t m_inputRegFallen;
477 bool m_autoRediscover;
478 uint32_t m_lastDiscoverTime;
510 static void FillBuffer(uint8_t *buf, uint8_t len, uint8_t val) {
512 for (i = 0; i < len; i++) {
520 static bool AllEntriesEqual(
const uint8_t *buf, uint8_t len, uint8_t val) {
522 for (i = 0; i < len; i++) {
#define CCIO_PIN_CNT
Definition CcioBoardManager.h:54
#define MAX_CCIO_DEVICES
Definition CcioBoardManager.h:50
Connector class for an individual CCIO-8 pin.
ClearCorePins
ClearCore PIN definitions.
Definition SysConnectors.h:54
ClearCore timing profiling utility functions.
ClearCore I/O Expansion Board Manager Class.
Definition CcioBoardManager.h:91
void OutputPulsesStart(ClearCorePins pinNum, uint32_t onTime, uint32_t offTime, uint16_t pulseCount=0, bool blockUntilDone=false)
Start an output pulse.
volatile const uint64_t & OutputState()
Accessor for all the CCIO-8 pins' output states.
Definition CcioBoardManager.h:363
volatile const uint64_t & IoOverloadSinceStartupAccum()
Accessor for all the CCIO-8 pins' accumulated overload states.
Definition CcioBoardManager.h:305
void CcioRediscoverEnable(bool enable)
Enable or Disable the automatic rediscover function.
uint64_t InputsRisen(uint64_t mask=UINT64_MAX)
Clear on read accessor for rising input edges.
CcioPin * PinByIndex(ClearCorePins connectorIndex)
Accessor for the individual CCIO-8 pin connectors.
volatile const uint8_t & CcioCount()
Accessor for the number of CCIO-8 boards connected to the ClearCore.
Definition CcioBoardManager.h:246
volatile const uint64_t & InputState()
Accessor for all the CCIO-8 pins' filtered input states.
Definition CcioBoardManager.h:349
uint8_t CcioDiscover(SerialDriver *comInstance)
Polls for and discovers all CCIO-8 boards connected to the ClearCore.
void PinState(ClearCorePins pinNum, bool newState)
Write the digital state to the specified CCIO-8 pin.
uint64_t InputsFallen(uint64_t mask=UINT64_MAX)
Clear on read accessor for falling input edges.
void OutputPulsesStop(ClearCorePins pinNum, bool stopImmediately=true)
Stop an output pulse.
volatile const bool & LinkBroken()
Accessor for the CCIO-8 link status.
Definition CcioBoardManager.h:261
uint8_t RefreshRate()
Accessor for the CCIO-8 link refresh rate.
Definition CcioBoardManager.h:404
uint64_t IoOverloadAccum()
Accessor for all the CCIO-8 pins' accumulated overload states.
volatile const uint64_t & IoOverloadRT()
Accessor for all the CCIO-8 pins' overloaded states.
Definition CcioBoardManager.h:277
bool PinState(ClearCorePins pinNum)
Read the digital state of the specified CCIO-8 pin.
volatile const uint64_t & OutputPulsesActive()
Check the output pulse state.
Definition CcioBoardManager.h:194
Connector class for an individual CCIO-8 pin.
Definition CcioPin.h:53
ClearCore Serial UART/SPI Connector class.
Definition SerialDriver.h:55
ClearCore Board Supervisory System Manager.
Definition SysManager.h:58
Namespace to encompass the ClearCore board API.
Definition AdcManager.h:36