x1000: Add INIT_ATTR to various target specific functions
Add INIT_ATTR to some low-hanging fruit in the X1000 code: GPIO init, GPIO initial state tables, clock init, and DMA init. Change-Id: Ia02b20945da1bbed103e2e01eaf60553eb5f72d4
This commit is contained in:
parent
a980d5f869
commit
484a79fcc0
6 changed files with 19 additions and 20 deletions
|
@ -22,8 +22,9 @@
|
|||
#ifndef __CLK_X1000_H__
|
||||
#define __CLK_X1000_H__
|
||||
|
||||
#include <stdint.h>
|
||||
#include "config.h"
|
||||
#include "x1000/cpm.h"
|
||||
#include <stdint.h>
|
||||
|
||||
/* Used as arguments to clk_set_ccr_mux() */
|
||||
#define CLKMUX_SCLK_A(x) jz_orf(CPM_CCR, SEL_SRC_V(x))
|
||||
|
@ -67,17 +68,17 @@ extern uint32_t clk_get(x1000_clk_t clk);
|
|||
extern const char* clk_get_name(x1000_clk_t clk);
|
||||
|
||||
/* Clock initialization */
|
||||
extern void clk_init_early(void);
|
||||
extern void clk_init(void);
|
||||
extern void clk_init_early(void) INIT_ATTR;
|
||||
extern void clk_init(void) INIT_ATTR;
|
||||
|
||||
/* Sets system clock multiplexers */
|
||||
extern void clk_set_ccr_mux(uint32_t muxbits);
|
||||
extern void clk_set_ccr_mux(uint32_t muxbits) INIT_ATTR;
|
||||
|
||||
/* Sets system clock dividers */
|
||||
extern void clk_set_ccr_div(uint32_t divbits);
|
||||
extern void clk_set_ccr_div(uint32_t divbits) INIT_ATTR;
|
||||
|
||||
/* Sets DDR clock source and divider */
|
||||
extern void clk_set_ddr(x1000_clk_t src, uint32_t div);
|
||||
extern void clk_set_ddr(x1000_clk_t src, uint32_t div) INIT_ATTR;
|
||||
|
||||
/* Returns the smallest n such that infreq/n <= outfreq */
|
||||
static inline uint32_t clk_calc_div(uint32_t infreq, uint32_t outfreq)
|
||||
|
|
|
@ -64,7 +64,7 @@ typedef struct dma_desc dma_desc;
|
|||
|
||||
typedef void(*dma_cb_func)(int event);
|
||||
|
||||
extern void dma_init(void);
|
||||
extern void dma_init(void) INIT_ATTR;
|
||||
extern void dma_set_callback(int chn, dma_cb_func cb);
|
||||
|
||||
#endif /* __DMA_X1000_H__ */
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
#include "gpio-x1000.h"
|
||||
|
||||
const struct gpio_setting gpio_settings[PIN_COUNT] = {
|
||||
static const struct gpio_setting gpio_settings[PIN_COUNT] INITDATA_ATTR = {
|
||||
#define DEFINE_GPIO(_name, _gpio, _func) \
|
||||
{.gpio = _gpio, .func = _func},
|
||||
#define DEFINE_PINGROUP(...)
|
||||
|
@ -30,7 +30,7 @@ const struct gpio_setting gpio_settings[PIN_COUNT] = {
|
|||
#undef DEFINE_PINGROUP
|
||||
};
|
||||
|
||||
const struct pingroup_setting pingroup_settings[PINGROUP_COUNT] = {
|
||||
static const struct pingroup_setting pingroup_settings[PINGROUP_COUNT] INITDATA_ATTR = {
|
||||
#define DEFINE_GPIO(...)
|
||||
#define DEFINE_PINGROUP(_name, _port, _pins, _func) \
|
||||
{.port = _port, .pins = _pins, .func = _func},
|
||||
|
@ -39,7 +39,8 @@ const struct pingroup_setting pingroup_settings[PINGROUP_COUNT] = {
|
|||
#undef DEFINE_PINGROUP
|
||||
};
|
||||
|
||||
const char* const gpio_names[PIN_COUNT] = {
|
||||
#if 0 /* not needed for the time being */
|
||||
static const char* const gpio_names[PIN_COUNT] = {
|
||||
#define DEFINE_GPIO(_name, ...) #_name,
|
||||
#define DEFINE_PINGROUP(...)
|
||||
#include "gpio-target.h"
|
||||
|
@ -47,13 +48,14 @@ const char* const gpio_names[PIN_COUNT] = {
|
|||
#undef DEFINE_PINGROUP
|
||||
};
|
||||
|
||||
const char* const pingroup_names[PINGROUP_COUNT] = {
|
||||
static const char* const pingroup_names[PINGROUP_COUNT] = {
|
||||
#define DEFINE_GPIO(...)
|
||||
#define DEFINE_PINGROUP(_name, ...) #_name,
|
||||
#include "gpio-target.h"
|
||||
#undef DEFINE_GPIO
|
||||
#undef DEFINE_PINGROUP
|
||||
};
|
||||
#endif
|
||||
|
||||
void gpio_init(void)
|
||||
{
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
#define __GPIO_X1000_H__
|
||||
|
||||
#include "x1000/gpio.h"
|
||||
#include "config.h"
|
||||
|
||||
/* GPIO port numbers */
|
||||
#define GPIO_A 0
|
||||
|
@ -103,16 +104,8 @@ enum {
|
|||
PINGROUP_COUNT,
|
||||
};
|
||||
|
||||
/* arrays which define the target's GPIO settings */
|
||||
extern const struct gpio_setting gpio_settings[PIN_COUNT];
|
||||
extern const struct pingroup_setting pingroup_settings[PINGROUP_COUNT];
|
||||
|
||||
/* stringified names for use in debug menus */
|
||||
extern const char* const gpio_names[PIN_COUNT];
|
||||
extern const char* const pingroup_names[PINGROUP_COUNT];
|
||||
|
||||
/* called at early init to set up GPIOs */
|
||||
extern void gpio_init(void);
|
||||
extern void gpio_init(void) INIT_ATTR;
|
||||
|
||||
/* Use GPIO Z to reconfigure several pins atomically */
|
||||
extern void gpioz_configure(int port, uint32_t pins, int func);
|
||||
|
|
|
@ -97,6 +97,8 @@ extern irq_handler_t system_set_irq_handler(int irq, irq_handler_t handler);
|
|||
extern void system_enable_irq(int irq);
|
||||
extern void system_disable_irq(int irq);
|
||||
|
||||
extern void system_early_init(void) INIT_ATTR;
|
||||
|
||||
/* Simple delay API */
|
||||
#define OST_FREQUENCY (X1000_EXCLK_FREQ / 4)
|
||||
#define OST_TICKS_PER_US (OST_FREQUENCY / 1000000)
|
||||
|
|
|
@ -44,6 +44,7 @@ uint32_t __cpu_idle_reftick = 0;
|
|||
#endif
|
||||
|
||||
/* Prepare the CPU to process interrupts, but don't enable them yet */
|
||||
static void system_init_irq(void) INIT_ATTR;
|
||||
static void system_init_irq(void)
|
||||
{
|
||||
/* Mask all interrupts */
|
||||
|
|
Loading…
Reference in a new issue