Open Model Railroad Network (OpenMRN)
Loading...
Searching...
No Matches
TivaRailcomDriver< HW > Class Template Reference

Railcom driver for TI Tiva-class microcontrollers using the TivaWare peripheral library. More...

#include <Railcom.hxx>

Inheritance diagram for TivaRailcomDriver< HW >:
RailcomDriverBase< HW > RailcomDriverBase< HW > Node RailcomDriver Node RailcomDriver Node RailcomDriver Node RailcomDriver

Public Member Functions

 TivaRailcomDriver (const char *path)
 Constructor.
 
 TivaRailcomDriver (const char *path)
 Constructor.
 
- Public Member Functions inherited from RailcomDriverBase< HW >
 RailcomDriverBase (const char *name)
 Constructor.
 
void os_interrupt_handler ()
 Implementation of the interrupt handler running at the kernel interrupt priority.
 
 RailcomDriverBase (const char *name)
 Constructor.
 
void os_interrupt_handler ()
 Implementation of the interrupt handler running at the kernel interrupt priority.
 
- Public Member Functions inherited from RailcomDriver
virtual void send_ch1 (const DCCFeedback *ch1_pkt)
 Specifies what packet should be sent for the channel1 cutout.
 
virtual void send_ch2 (const DCCFeedback *ch2_pkt)
 Specifies what packet should be sent for the channel2 cutout.
 

Private Member Functions

void enable () OVERRIDE
 This will be called once when reference-count goes from 0 to positive.
 
void disable () OVERRIDE
 This will be called when reference count goes from non-zero to 0.
 
void feedback_sample () OVERRIDE
 Call to the driver for sampling the current sensors.
 
void start_cutout () OVERRIDE
 Instructs the driver that the railcom cutout is starting now.
 
void middle_cutout () OVERRIDE
 Notifies the driver that the railcom cutout has reached the middle point, i.e., the first window is passed and the second window is starting.
 
void end_cutout () OVERRIDE
 Instructs the driver that the railcom cutout is over now.
 
void no_cutout () OVERRIDE
 Called instead of start/mid/end-cutout at the end of the current packet if there was no cutout requested.
 
void int_set_pending (unsigned int_nr) override
 Sets a given software interrupt pending.
 
void enable () OVERRIDE
 This will be called once when reference-count goes from 0 to positive.
 
void disable () OVERRIDE
 This will be called when reference count goes from non-zero to 0.
 
void feedback_sample () OVERRIDE
 Call to the driver for sampling the current sensors.
 
void start_cutout () OVERRIDE
 Instructs the driver that the railcom cutout is starting now.
 
void middle_cutout () OVERRIDE
 Notifies the driver that the railcom cutout has reached the middle point, i.e., the first window is passed and the second window is starting.
 
void end_cutout () OVERRIDE
 Instructs the driver that the railcom cutout is over now.
 
void no_cutout () OVERRIDE
 Called instead of start/mid/end-cutout at the end of the current packet if there was no cutout requested.
 

Private Attributes

bool inCutout_ = false
 True when we are currently within a cutout.
 

Additional Inherited Members

- Protected Member Functions inherited from RailcomDriverBase< HW >
dcc::Feedbackalloc_new_packet (uint8_t channel)
 Takes a new empty packet at the front of the queue, fills in feedback key and channel information.
 
void add_sample (int sample)
 Adds a sample for a preamble bit.
 
dcc::Feedbackalloc_new_packet (uint8_t channel)
 Takes a new empty packet at the front of the queue, fills in feedback key and channel information.
 
void add_sample (int sample)
 Adds a sample for a preamble bit.
 
- Protected Attributes inherited from RailcomDriverBase< HW >
NotifiablereadableNotifiable_
 Notify this when we have data in our buffers.
 
FixedQueue< dcc::Feedback, HW::Q_SIZE > feedbackQueue_
 The packets we have read so far.
 
uint32_t feedbackKey_
 Stores the key for the next packets to read.
 
dcc::FeedbackreturnedPackets_ [HW::CHANNEL_COUNT]
 Stores pointers to packets we are filling right now, one for each channel.
 

Detailed Description

template<class HW>
class TivaRailcomDriver< HW >

Railcom driver for TI Tiva-class microcontrollers using the TivaWare peripheral library.

This railcom driver supports parallel polling of multiple UART channels for the railcom data.

Definition at line 293 of file Railcom.hxx.

Constructor & Destructor Documentation

◆ TivaRailcomDriver() [1/2]

template<class HW >
TivaRailcomDriver< HW >::TivaRailcomDriver ( const char *  path)
inline

Constructor.

Parameters
pathis the device node path (e.g. "/dev/railcom0").

Definition at line 297 of file Railcom.hxx.

◆ TivaRailcomDriver() [2/2]

template<class HW >
TivaRailcomDriver< HW >::TivaRailcomDriver ( const char *  path)
inline

Constructor.

Parameters
pathis the device node path (e.g. "/dev/railcom0").

Definition at line 133 of file TivaRailcom.hxx.

◆ ~TivaRailcomDriver()

template<class HW >
TivaRailcomDriver< HW >::~TivaRailcomDriver ( )
inline

Definition at line 140 of file TivaRailcom.hxx.

Member Function Documentation

◆ disable() [1/2]

template<class HW >
void TivaRailcomDriver< HW >::disable ( )
inlineprivatevirtual

This will be called when reference count goes from non-zero to 0.

Called with lock_ held.

Implements Node.

Definition at line 325 of file Railcom.hxx.

◆ disable() [2/2]

template<class HW >
void TivaRailcomDriver< HW >::disable ( )
inlineprivatevirtual

This will be called when reference count goes from non-zero to 0.

Called with lock_ held.

Implements Node.

Definition at line 177 of file TivaRailcom.hxx.

◆ enable() [1/2]

template<class HW >
void TivaRailcomDriver< HW >::enable ( )
inlineprivatevirtual

This will be called once when reference-count goes from 0 to positive.

Called with lock_ held.

Implements Node.

Definition at line 307 of file Railcom.hxx.

◆ enable() [2/2]

template<class HW >
void TivaRailcomDriver< HW >::enable ( )
inlineprivatevirtual

This will be called once when reference-count goes from 0 to positive.

Called with lock_ held.

Implements Node.

Definition at line 159 of file TivaRailcom.hxx.

◆ end_cutout() [1/2]

template<class HW >
void TivaRailcomDriver< HW >::end_cutout ( )
inlineprivatevirtual

Instructs the driver that the railcom cutout is over now.

The driver will use this information to disable the UART receiver.

Implements RailcomDriver.

Definition at line 401 of file Railcom.hxx.

◆ end_cutout() [2/2]

template<class HW >
void TivaRailcomDriver< HW >::end_cutout ( )
inlineprivatevirtual

Instructs the driver that the railcom cutout is over now.

The driver will use this information to disable the UART receiver.

Implements RailcomDriver.

Definition at line 253 of file TivaRailcom.hxx.

◆ feedback_sample() [1/2]

template<class HW >
void TivaRailcomDriver< HW >::feedback_sample ( )
inlineprivatevirtual

Call to the driver for sampling the current sensors.

This call is performed repeatedly, in a configurable interval, on the next positive edge.

Implements RailcomDriver.

Definition at line 334 of file Railcom.hxx.

◆ feedback_sample() [2/2]

template<class HW >
void TivaRailcomDriver< HW >::feedback_sample ( )
inlineprivatevirtual

Call to the driver for sampling the current sensors.

This call is performed repeatedly, in a configurable interval, on the next positive edge.

Implements RailcomDriver.

Definition at line 186 of file TivaRailcom.hxx.

◆ int_set_pending()

template<class HW >
void TivaRailcomDriver< HW >::int_set_pending ( unsigned  int_nr)
inlineoverrideprivatevirtual

Sets a given software interrupt pending.

Parameters
int_nrinterrupt number (will be HW::OS_INTERRUPT)

Implements RailcomDriverBase< HW >.

Definition at line 153 of file TivaRailcom.hxx.

◆ middle_cutout() [1/2]

template<class HW >
void TivaRailcomDriver< HW >::middle_cutout ( )
inlineprivatevirtual

Notifies the driver that the railcom cutout has reached the middle point, i.e., the first window is passed and the second window is starting.

The driver will use this information to separate channel 1 nd channel 2 data.

Implements RailcomDriver.

Definition at line 361 of file Railcom.hxx.

◆ middle_cutout() [2/2]

template<class HW >
void TivaRailcomDriver< HW >::middle_cutout ( )
inlineprivatevirtual

Notifies the driver that the railcom cutout has reached the middle point, i.e., the first window is passed and the second window is starting.

The driver will use this information to separate channel 1 nd channel 2 data.

Implements RailcomDriver.

Definition at line 213 of file TivaRailcom.hxx.

◆ no_cutout() [1/2]

template<class HW >
void TivaRailcomDriver< HW >::no_cutout ( )
inlineprivatevirtual

Called instead of start/mid/end-cutout at the end of the current packet if there was no cutout requested.

Implements RailcomDriver.

Definition at line 458 of file Railcom.hxx.

◆ no_cutout() [2/2]

template<class HW >
void TivaRailcomDriver< HW >::no_cutout ( )
inlineprivatevirtual

Called instead of start/mid/end-cutout at the end of the current packet if there was no cutout requested.

Implements RailcomDriver.

Definition at line 310 of file TivaRailcom.hxx.

◆ start_cutout() [1/2]

template<class HW >
void TivaRailcomDriver< HW >::start_cutout ( )
inlineprivatevirtual

Instructs the driver that the railcom cutout is starting now.

The driver will use this information to enable the UART receiver.

Implements RailcomDriver.

Definition at line 340 of file Railcom.hxx.

◆ start_cutout() [2/2]

template<class HW >
void TivaRailcomDriver< HW >::start_cutout ( )
inlineprivatevirtual

Instructs the driver that the railcom cutout is starting now.

The driver will use this information to enable the UART receiver.

Implements RailcomDriver.

Definition at line 192 of file TivaRailcom.hxx.

Member Data Documentation

◆ inCutout_

template<class HW >
bool TivaRailcomDriver< HW >::inCutout_ = false
private

True when we are currently within a cutout.

Definition at line 303 of file Railcom.hxx.


The documentation for this class was generated from the following files: