- Main Page
- Related Pages
- Data Structures
- Files

- File List
- Globals

# include/pm/pm_v2.h

Go to the documentation of this file.

    00001
    00041 #ifndef PM_PM_V2_H_INCLUDED
    00042 #define PM_PM_V2_H_INCLUDED
    00043
    00044 #include <assert.h>
    00045 #include <io.h>
    00046 #include <util.h>
    00047 #include <chip/clk.h>
    00048 #include <chip/memory-map.h>
    00049 #include <pm/pm_v2_regs.h>
    00050 #include <pm/pm_common.h>
    00051
    00052 #define PM_VERSION      PM_MKVERSION(2, 0, 0)
    00053
    00054 static inline int pm_enable_genclk(unsigned int id, enum pm_genclk_src source,
    00055                 unsigned int divider)
    00056 {
    00057         uint32_t        gcctrl;
    00058
    00059         assert(divider != 0);
    00060
    00061         gcctrl = PM_GCCTRL_OSCSEL(source);
    00062         assert(!(gcctrl & ~PM_GCCTRL_OSCSEL_MASK));
    00063         gcctrl |= PM_GCCTRL_CEN;
    00064
    00065         if (divider > 1)
    00066                 gcctrl |= (PM_GCCTRL_DIVEN
    00067                                 | PM_GCCTRL_DIV(div_ceil(divider, 2) - 1));
    00068         pm_write_reg(GCCTRL(id), gcctrl);
    00069
    00070         return 0;
    00071 }
    00072
    00073 #endif /* PM_PM_V2_H_INCLUDED */