blob: 36c913cabbf1fce7652424817fa3ec547af260be (
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
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
|
/* Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
* Main routine for Chrome EC
*/
#include "adc.h"
#include "charger.h"
#include "chip_temp_sensor.h"
#include "clock.h"
#include "config.h"
#include "console.h"
#include "eeprom.h"
#include "flash.h"
#include "flash_commands.h"
#include "gpio.h"
#include "i2c.h"
#include "jtag.h"
#include "keyboard.h"
#include "keyboard_scan.h"
#include "lpc.h"
#include "memory_commands.h"
#include "peci.h"
#include "port80.h"
#include "power_button.h"
#include "powerdemo.h"
#include "pwm.h"
#include "pwm_commands.h"
#include "system.h"
#include "task.h"
#include "temp_sensor.h"
#include "timer.h"
#include "uart.h"
#include "usb_charge.h"
#include "vboot.h"
#include "watchdog.h"
int main(void)
{
/* Configure the pin multiplexers */
configure_board();
jtag_pre_init();
/* Initialize the system module. This enables the hibernate clock
* source we need to calibrate the internal oscillator. */
system_pre_init();
/* Set the CPU clocks / PLLs */
clock_init();
/* Do system, gpio, and vboot pre-initialization so we can jump to
* another image if necessary. This must be done as early as
* possible, so that the minimum number of components get
* re-initialized if we jump to another image. */
gpio_pre_init();
vboot_pre_init();
task_init();
#ifdef CONFIG_TASK_WATCHDOG
watchdog_init(1100);
#endif
timer_init();
uart_init();
system_init();
#ifdef CONFIG_TASK_KEYSCAN
keyboard_scan_init();
#endif
#ifdef CONFIG_FLASH
flash_init();
#endif
eeprom_init();
#ifdef CONFIG_LPC
port_80_init();
lpc_init();
#endif
#ifdef CONFIG_PWM
pwm_init();
#endif
i2c_init();
#ifdef CONFIG_TEMP_SENSOR
temp_sensor_init();
chip_temp_sensor_init();
#endif
power_button_init();
adc_init();
usb_charge_init();
#ifdef CONFIG_CHARGER
charger_init();
#endif
#ifdef CONFIG_PECI
peci_init();
#endif
/* Print the reset cause */
uart_printf("\n\n--- Chrome EC initialized! ---\n");
uart_printf("(image: %s, version: %s, last reset: %s)\n",
system_get_image_copy_string(),
system_get_version(SYSTEM_IMAGE_UNKNOWN),
system_get_reset_cause_string());
/* Launch task scheduling (never returns) */
return task_start();
}
|