MCPcopy Create free account
hub / github.com/RT-Thread/rt-thread / rt_pci_pme_init

Function rt_pci_pme_init

components/drivers/pci/pme.c:38–65  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

36 */
37
38void rt_pci_pme_init(struct rt_pci_device *pdev)
39{
40 rt_uint16_t pmc;
41
42 if (!pdev || !(pdev->pme_cap = rt_pci_find_capability(pdev, PCIY_PMG)))
43 {
44 return;
45 }
46
47 rt_pci_read_config_u16(pdev, pdev->pme_cap + PCIR_POWER_CAP, &pmc);
48
49 if ((pmc & PCIM_PCAP_SPEC) > 3)
50 {
51 LOG_E("%s: Unsupported PME CAP regs spec %u",
52 rt_dm_dev_get_name(&pdev->parent), pmc & PCIM_PCAP_SPEC);
53
54 return;
55 }
56
57 pmc &= PCIM_PCAP_PMEMASK;
58
59 if (pmc)
60 {
61 pdev->pme_support = RT_FIELD_GET(PCIM_PCAP_PMEMASK, pmc);
62
63 rt_pci_pme_active(pdev, RT_FALSE);
64 }
65}
66
67rt_err_t rt_pci_enable_wake(struct rt_pci_device *pdev,
68 enum rt_pci_power state, rt_bool_t enable)

Callers 1

pci_init_capabilitiesFunction · 0.85

Calls 4

rt_pci_find_capabilityFunction · 0.85
rt_pci_read_config_u16Function · 0.85
rt_dm_dev_get_nameFunction · 0.85
rt_pci_pme_activeFunction · 0.85

Tested by

no test coverage detected