![]() |
F´ Flight Software - C/C++ Documentation
A framework for building embedded system applications to NASA flight quality standards.
|
#include <Drv/LinuxGpioDriver/LinuxGpioDriver.hpp>
Public Types | |
| enum | GpioConfiguration { GPIO_OUTPUT , GPIO_INPUT , GPIO_INTERRUPT_RISING_EDGE , GPIO_INTERRUPT_FALLING_EDGE , GPIO_INTERRUPT_BOTH_RISING_AND_FALLING_EDGES , MAX_GPIO_CONFIGURATION } |
| configure the GPIO pin More... | |
Public Member Functions | |
| LinuxGpioDriver (const char *const compName) | |
| ~LinuxGpioDriver () | |
| Os::File::Status | open (const char *device, const U32 gpio, const GpioConfiguration &configuration, const Fw::Logic &default_state=Fw::Logic::LOW) |
| open a GPIO pin for use in the system | |
| Drv::GpioStatus | start (const FwSizeType priority=Os::Task::TASK_DEFAULT, const FwSizeType stackSize=Os::Task::TASK_DEFAULT, const FwSizeType cpuAffinity=Os::Task::TASK_DEFAULT, const PlatformUIntType identifier=static_cast< PlatformUIntType >(Os::Task::TASK_DEFAULT)) |
| start interrupt detection thread | |
| void | stop () |
| stop interrupt detection thread | |
| void | join () |
| join interrupt detection thread | |
Public Member Functions inherited from Drv::LinuxGpioDriverComponentBase | |
| void | init (FwEnumStoreType instance=0) |
| Initialize LinuxGpioDriverComponentBase object. | |
| Drv::InputGpioReadPort * | get_gpioRead_InputPort (FwIndexType portNum) |
| Drv::InputGpioWritePort * | get_gpioWrite_InputPort (FwIndexType portNum) |
| void | set_Log_OutputPort (FwIndexType portNum, Fw::InputLogPort *port) |
| Connect port to Log[portNum]. | |
| void | set_Time_OutputPort (FwIndexType portNum, Fw::InputTimePort *port) |
| Connect port to Time[portNum]. | |
| void | set_gpioInterrupt_OutputPort (FwIndexType portNum, Svc::InputCyclePort *port) |
| Connect port to gpioInterrupt[portNum]. | |
Public Member Functions inherited from Fw::PassiveComponentBase | |
| void | setIdBase (const U32) |
| Set the ID base. | |
| U32 | getIdBase () const |
Static Public Attributes | |
| static constexpr FwSizeType | GPIO_POLL_TIMEOUT = 500 |
Additional Inherited Members | |
Protected Types inherited from Drv::LinuxGpioDriverComponentBase | |
| enum | { NUM_GPIOREAD_INPUT_PORTS = 1 , NUM_GPIOWRITE_INPUT_PORTS = 1 } |
| Enumerations for numbers of typed input ports. More... | |
| enum | { NUM_LOG_OUTPUT_PORTS = 1 , NUM_LOGTEXT_OUTPUT_PORTS = 1 , NUM_TIME_OUTPUT_PORTS = 1 } |
| Enumerations for numbers of special output ports. More... | |
| enum | { NUM_GPIOINTERRUPT_OUTPUT_PORTS = 1 } |
| Enumerations for numbers of typed output ports. More... | |
| enum | { EVENTID_OPENCHIP = 0x0 , EVENTID_OPENCHIPERROR = 0x1 , EVENTID_OPENPINERROR = 0x2 , EVENTID_INTERRUPTREADERROR = 0x3 , EVENTID_POLLINGERROR = 0x4 } |
| Event IDs. More... | |
Protected Member Functions inherited from Drv::LinuxGpioDriverComponentBase | |
| LinuxGpioDriverComponentBase (const char *compName="") | |
| Construct LinuxGpioDriverComponentBase object. | |
| virtual | ~LinuxGpioDriverComponentBase () |
| Destroy LinuxGpioDriverComponentBase object. | |
| FwIndexType | getNum_gpioRead_InputPorts () const |
| FwIndexType | getNum_gpioWrite_InputPorts () const |
| FwIndexType | getNum_Log_OutputPorts () const |
| FwIndexType | getNum_Time_OutputPorts () const |
| FwIndexType | getNum_gpioInterrupt_OutputPorts () const |
| bool | isConnected_Log_OutputPort (FwIndexType portNum) |
| bool | isConnected_Time_OutputPort (FwIndexType portNum) |
| bool | isConnected_gpioInterrupt_OutputPort (FwIndexType portNum) |
| Drv::GpioStatus | gpioRead_handlerBase (FwIndexType portNum, Fw::Logic &state) |
| Handler base-class function for input port gpioRead. | |
| Drv::GpioStatus | gpioWrite_handlerBase (FwIndexType portNum, const Fw::Logic &state) |
| Handler base-class function for input port gpioWrite. | |
| void | gpioInterrupt_out (FwIndexType portNum, Os::RawTime &cycleStart) |
| Invoke output port gpioInterrupt. | |
| void | log_DIAGNOSTIC_OpenChip (const Fw::StringBase &chip, const Fw::StringBase &chipLabel, U32 pin, const Fw::StringBase &pinMessage) const |
| Log event OpenChip. | |
| void | log_WARNING_HI_OpenChipError (const Fw::StringBase &chip, Os::FileStatus status) const |
| Log event OpenChipError. | |
| void | log_WARNING_HI_OpenPinError (const Fw::StringBase &chip, U32 pin, const Fw::StringBase &pinMessage, Os::FileStatus status) const |
| Log event OpenPinError. | |
| void | log_WARNING_HI_InterruptReadError (U32 expected, U32 got) const |
| Log event InterruptReadError. | |
| void | log_WARNING_HI_PollingError (I32 error_number) const |
| Log event PollingError. | |
| Fw::Time | getTime () |
Protected Member Functions inherited from Fw::PassiveComponentBase | |
| PassiveComponentBase (const char *name) | |
| Named constructor. | |
| virtual | ~PassiveComponentBase () |
| Destructor. | |
| void | init (NATIVE_INT_TYPE instance) |
| Initialization function. | |
| NATIVE_INT_TYPE | getInstance () const |
Protected Member Functions inherited from Fw::ObjBase | |
| ObjBase (const char *name) | |
| ObjBase constructor. | |
| virtual | ~ObjBase () |
| Destructor. | |
| void | init () |
| Object initializer. | |
Definition at line 23 of file LinuxGpioDriver.hpp.
configure the GPIO pin
Configure the GPIO pin for use in this driver. Only one mode may be selected as a time.
Definition at line 42 of file LinuxGpioDriver.hpp.
| Drv::LinuxGpioDriver::LinuxGpioDriver | ( | const char *const | compName | ) |
Construct object LinuxGpioDriver
| compName | The component name |
Definition at line 22 of file LinuxGpioDriverCommon.cpp.
| Drv::LinuxGpioDriver::~LinuxGpioDriver | ( | ) |
Destroy object LinuxGpioDriver
Definition at line 125 of file LinuxGpioDriver.cpp.
| void Drv::LinuxGpioDriver::join | ( | ) |
join interrupt detection thread
Definition at line 50 of file LinuxGpioDriverCommon.cpp.
| Os::File::Status Drv::LinuxGpioDriver::open | ( | const char * | device, |
| const U32 | gpio, | ||
| const GpioConfiguration & | configuration, | ||
| const Fw::Logic & | default_state = Fw::Logic::LOW |
||
| ) |
open a GPIO pin for use in the system
This function opens and configures a GPIO pin. User must supply the device path and the gpio pin registered to that device. Pin configuration is also accepted and supports: input, output, and interrupts on either edge.
If the user selects output, a default state can be set with the default_state flag.
| device | /dev/gpiochip* path for this pin's bank |
| gpio | pin or line number on the above chip |
| configuration | pin configuration |
| default_state | default state when using output configuration |
Definition at line 184 of file LinuxGpioDriver.cpp.
| Drv::GpioStatus Drv::LinuxGpioDriver::start | ( | const FwSizeType | priority = Os::Task::TASK_DEFAULT, |
| const FwSizeType | stackSize = Os::Task::TASK_DEFAULT, |
||
| const FwSizeType | cpuAffinity = Os::Task::TASK_DEFAULT, |
||
| const PlatformUIntType | identifier = static_cast<PlatformUIntType>(Os::Task::TASK_DEFAULT) |
||
| ) |
start interrupt detection thread
Definition at line 24 of file LinuxGpioDriverCommon.cpp.
| void Drv::LinuxGpioDriver::stop | ( | ) |
stop interrupt detection thread
Definition at line 45 of file LinuxGpioDriverCommon.cpp.
|
staticconstexpr |
Definition at line 25 of file LinuxGpioDriver.hpp.