1 /* Copyright 2013-2014 IBM Corp. 2 * 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 12 * implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 /** 17 * @file config.H 18 * 19 * @brief Definitions for EC configuration values. 20 * 21 */ 22 23 #ifndef __EC_CONFIG_H_ 24 #define __EC_CONFIG_H_ 25 26 #include <stdint.h> 27 28 #define EC_RTC_PORT_BASE (0x70) // RTC/CMOS LPC base address 29 #define EC_RTC_BLOCK_SIZE (512) // Size of addressable data in RTC 30 #define EC_RTC_CENTURY (1) // 1 if century format is enabled 31 #if EC_RTC_CENTURY 32 #define EC_RTC_BBRAM_OFFSET (0x33) // Offset of NV data (= size of calendar) 33 #else 34 #define EC_RTC_BBRAM_OFFSET (0x0E) // Offset of NV data (= size of calendar) 35 #endif // #if EC_RTC_CENTURY 36 37 #define EC_RTCDD_READ_TRIES (2) // Times to try the RTC if updating 38 #define EC_RTCDD_RETRY_DELAY (300000) // Delay between RTC read retries in ns 39 // based on update time of 244 + 30.5 µs 40 41 #define EC_GPIO_INDEX 0x200 42 #define EC_GPIO_DATA 0x201 43 #define EC_GPIO_NUM_PORTS 17 44 #define EC_GPIO_PORT_SKIP 4 45 46 #define EC_GPIO_DATA_OFFSET 0x0 47 #define EC_GPIO_DDR_OFFSET 0x1 48 #define EC_GPIO_PIN_OFFSET 0x2 49 #define EC_GPIO_PUP_OFFSET 0x3 50 51 typedef enum EcGpioPort { 52 EC_GPIO_PORT_A = 0, 53 EC_GPIO_PORT_B = 1, 54 EC_GPIO_PORT_C = 2, 55 EC_GPIO_PORT_D = 3, 56 EC_GPIO_PORT_E = 4, 57 EC_GPIO_PORT_F = 5, 58 EC_GPIO_PORT_G = 6, 59 EC_GPIO_PORT_H = 7, 60 // skip port I 61 EC_GPIO_PORT_J = 8, 62 EC_GPIO_PORT_K = 9, 63 EC_GPIO_PORT_L = 10, 64 EC_GPIO_PORT_M = 11, 65 EC_GPIO_PORT_N = 12, 66 // skip port O 67 EC_GPIO_PORT_P = 13, 68 EC_GPIO_PORT_Q = 14, 69 EC_GPIO_PORT_R = 15, 70 EC_GPIO_PORT_S = 16, 71 } EcGpioPort; 72 73 #ifdef __cplusplus 74 extern "C" { 75 #endif 76 void ec_outb(uint16_t, uint8_t); 77 uint8_t ec_inb(uint16_t); 78 #ifdef __cplusplus 79 } 80 #endif 81 82 #endif // __EC_CONFIG_H_ 83