David Brown | 5153bd6 | 2017-01-06 11:16:53 -0700 | [diff] [blame^] | 1 | /* |
| 2 | * Licensed to the Apache Software Foundation (ASF) under one |
| 3 | * or more contributor license agreements. See the NOTICE file |
| 4 | * distributed with this work for additional information |
| 5 | * regarding copyright ownership. The ASF licenses this file |
| 6 | * to you under the Apache License, Version 2.0 (the |
| 7 | * "License"); you may not use this file except in compliance |
| 8 | * with the License. You may obtain a copy of the License at |
| 9 | * |
| 10 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | * |
| 12 | * Unless required by applicable law or agreed to in writing, |
| 13 | * software distributed under the License is distributed on an |
| 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 15 | * KIND, either express or implied. See the License for the |
| 16 | * specific language governing permissions and limitations |
| 17 | * under the License. |
| 18 | */ |
| 19 | |
| 20 | #ifndef __HAL_BSP_H_ |
| 21 | #define __HAL_BSP_H_ |
| 22 | |
| 23 | #ifdef __cplusplus |
| 24 | extern "C" { |
| 25 | #endif |
| 26 | |
| 27 | #include <inttypes.h> |
| 28 | |
| 29 | /* |
| 30 | * Initializes BSP; registers flash_map with the system. |
| 31 | */ |
| 32 | void hal_bsp_init(void); |
| 33 | |
| 34 | /* |
| 35 | * Return pointer to flash device structure, given BSP specific |
| 36 | * flash id. |
| 37 | */ |
| 38 | struct hal_flash; |
| 39 | const struct hal_flash *hal_bsp_flash_dev(uint8_t flash_id); |
| 40 | |
| 41 | /* |
| 42 | * Grows heap by given amount. XXX giving space back not implemented. |
| 43 | */ |
| 44 | void *_sbrk(int incr); |
| 45 | |
| 46 | /* |
| 47 | * Report which memory areas should be included inside a coredump. |
| 48 | */ |
| 49 | struct hal_bsp_mem_dump { |
| 50 | void *hbmd_start; |
| 51 | uint32_t hbmd_size; |
| 52 | }; |
| 53 | |
| 54 | const struct hal_bsp_mem_dump *hal_bsp_core_dump(int *area_cnt); |
| 55 | |
| 56 | /* |
| 57 | * Get unique HW identifier/serial number for platform. |
| 58 | * Returns the number of bytes filled in. |
| 59 | */ |
| 60 | #define HAL_BSP_MAX_ID_LEN 32 |
| 61 | int hal_bsp_hw_id(uint8_t *id, int max_len); |
| 62 | |
| 63 | #define HAL_BSP_POWER_ON (1) |
| 64 | #define HAL_BSP_POWER_WFI (2) |
| 65 | #define HAL_BSP_POWER_SLEEP (3) |
| 66 | #define HAL_BSP_POWER_DEEP_SLEEP (4) |
| 67 | #define HAL_BSP_POWER_OFF (5) |
| 68 | #define HAL_BSP_POWER_PERUSER (128) |
| 69 | |
| 70 | int hal_bsp_power_state(int state); |
| 71 | |
| 72 | /* Returns priority of given interrupt number */ |
| 73 | uint32_t hal_bsp_get_nvic_priority(int irq_num, uint32_t pri); |
| 74 | |
| 75 | #ifdef __cplusplus |
| 76 | } |
| 77 | #endif |
| 78 | |
| 79 | #endif |