GCC Code Coverage Report


Directory: ./
File: Drv/LinuxGpioDriver/LinuxGpioDriverCommon.cpp
Date: 2026-09-03 21:13:48
Exec Total Coverage
Lines: 0 35 0.0%
Functions: 0 6 0.0%
Branches: 0 24 0.0%

Line Branch Exec Source
1 // ======================================================================
2 // \title LinuxGpioDriverImpl.cpp
3 // \author tcanham
4 // \brief cpp file for LinuxGpioDriver component implementation class
5 //
6 // \copyright
7 // Copyright 2009-2015, by the California Institute of Technology.
8 // ALL RIGHTS RESERVED. United States Government Sponsorship
9 // acknowledged.
10 //
11 // ======================================================================
12
13 #include <Drv/LinuxGpioDriver/LinuxGpioDriver.hpp>
14 #include <Fw/FPrimeBasicTypes.hpp>
15
16 namespace Drv {
17
18 // ----------------------------------------------------------------------
19 // Construction, initialization, and destruction
20 // ----------------------------------------------------------------------
21
22 LinuxGpioDriver ::LinuxGpioDriver(const char* const compName) : LinuxGpioDriverComponentBase(compName) {}
23
24 Drv::GpioStatus LinuxGpioDriver ::start(const FwTaskPriorityType priority,
25 const FwSizeType stackSize,
26 const FwSizeType cpuAffinity,
27 const FwTaskIdType identifier) {
28 Drv::GpioStatus status = Drv::GpioStatus::INVALID_MODE;
29 if (this->m_configuration < GpioConfiguration::MAX_GPIO_CONFIGURATION &&
30 this->m_configuration >= GpioConfiguration::GPIO_INTERRUPT_RISING_EDGE) {
31 status = Drv::GpioStatus::OP_OK;
32 {
33 Os::ScopeLock lock(m_lock);
34 this->m_running = true;
35 }
36 Fw::String name;
37 (void)name.format("%s.interrupt", FW_OPTIONAL_NAME(this->getObjName())); // task name may safely truncate
38 Os::Task::Arguments arguments(name, &this->interruptFunction, this, priority, stackSize, cpuAffinity,
39 identifier);
40 Os::Task::Status taskStatus = this->m_poller.start(arguments);
41 if (taskStatus != Os::Task::Status::OP_OK) {
42 status = Drv::GpioStatus::UNKNOWN_ERROR;
43 }
44 }
45 return status;
46 }
47
48 void LinuxGpioDriver ::stop() {
49 Os::ScopeLock lock(m_lock);
50 this->m_running = false;
51 }
52
53 void LinuxGpioDriver ::join() {
54 (void)this->m_poller.join(); // best-effort join on shutdown
55 }
56
57 void LinuxGpioDriver ::interruptFunction(void* self) {
58 FW_ASSERT(self != nullptr);
59 LinuxGpioDriver* component = reinterpret_cast<LinuxGpioDriver*>(self);
60 component->pollLoop();
61 }
62
63 bool LinuxGpioDriver ::getRunning() {
64 Os::ScopeLock lock(m_lock);
65 return this->m_running;
66 }
67
68 } // end namespace Drv
69