summaryrefslogtreecommitdiff
path: root/rcc/rcc_enums.h.j2
blob: 569452591c00462153774e516a8741063264ba8d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// This file is auto-generated from a template!
// You should reconsider editing!
#pragma once

namespace rcc {
    {% for bus, devices in buses.items() %}
        enum {{ bus }}_dev {
            {% for name, num in devices.items() %}
                {{ name }} = 1 << {{ num }},
            {% endfor %}
        };

        template <typename T>
        void enable(const T& rcc, {{ bus }}_dev dev) {
            rcc->{{ bus.split('_')[0] }}ENR{{ bus.split('_')[1] if '_' in bus else '' }} |= dev;
        }

        template <typename T>
        void disable(const T& rcc, {{ bus }}_dev dev) {
            rcc->{{ bus.split('_')[0] }}ENR{{ bus.split('_')[1] if '_' in bus else '' }} &= ~(dev);
        }

    {% endfor %}
}