Repostiory containing DAPLink source code with Reset Pin workaround for HANI_IOT board.
Upstream: https://github.com/ARMmbed/DAPLink
source/daplink/bootloader/main.h@0:01f31e923fe2, 2020-04-07 (annotated)
- Committer:
- Pawel Zarembski
- Date:
- Tue Apr 07 12:55:42 2020 +0200
- Revision:
- 0:01f31e923fe2
hani: DAPLink with reset workaround
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Pawel Zarembski |
0:01f31e923fe2 | 1 | /** |
Pawel Zarembski |
0:01f31e923fe2 | 2 | * @file main.h |
Pawel Zarembski |
0:01f31e923fe2 | 3 | * @brief |
Pawel Zarembski |
0:01f31e923fe2 | 4 | * |
Pawel Zarembski |
0:01f31e923fe2 | 5 | * DAPLink Interface Firmware |
Pawel Zarembski |
0:01f31e923fe2 | 6 | * Copyright (c) 2009-2019, ARM Limited, All Rights Reserved |
Pawel Zarembski |
0:01f31e923fe2 | 7 | * SPDX-License-Identifier: Apache-2.0 |
Pawel Zarembski |
0:01f31e923fe2 | 8 | * |
Pawel Zarembski |
0:01f31e923fe2 | 9 | * Licensed under the Apache License, Version 2.0 (the "License"); you may |
Pawel Zarembski |
0:01f31e923fe2 | 10 | * not use this file except in compliance with the License. |
Pawel Zarembski |
0:01f31e923fe2 | 11 | * You may obtain a copy of the License at |
Pawel Zarembski |
0:01f31e923fe2 | 12 | * |
Pawel Zarembski |
0:01f31e923fe2 | 13 | * http://www.apache.org/licenses/LICENSE-2.0 |
Pawel Zarembski |
0:01f31e923fe2 | 14 | * |
Pawel Zarembski |
0:01f31e923fe2 | 15 | * Unless required by applicable law or agreed to in writing, software |
Pawel Zarembski |
0:01f31e923fe2 | 16 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
Pawel Zarembski |
0:01f31e923fe2 | 17 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
Pawel Zarembski |
0:01f31e923fe2 | 18 | * See the License for the specific language governing permissions and |
Pawel Zarembski |
0:01f31e923fe2 | 19 | * limitations under the License. |
Pawel Zarembski |
0:01f31e923fe2 | 20 | */ |
Pawel Zarembski |
0:01f31e923fe2 | 21 | |
Pawel Zarembski |
0:01f31e923fe2 | 22 | #ifndef MAIN_H |
Pawel Zarembski |
0:01f31e923fe2 | 23 | #define MAIN_H |
Pawel Zarembski |
0:01f31e923fe2 | 24 | |
Pawel Zarembski |
0:01f31e923fe2 | 25 | #include <stdint.h> |
Pawel Zarembski |
0:01f31e923fe2 | 26 | |
Pawel Zarembski |
0:01f31e923fe2 | 27 | /** |
Pawel Zarembski |
0:01f31e923fe2 | 28 | * @enum main_usb_busy_t |
Pawel Zarembski |
0:01f31e923fe2 | 29 | * @brief Defines the filtered activity of the USB connection |
Pawel Zarembski |
0:01f31e923fe2 | 30 | */ |
Pawel Zarembski |
0:01f31e923fe2 | 31 | typedef enum { |
Pawel Zarembski |
0:01f31e923fe2 | 32 | MAIN_USB_IDLE, /*!< MAIN_USB_IDLE value means no bus activity */ |
Pawel Zarembski |
0:01f31e923fe2 | 33 | MAIN_USB_ACTIVE /*!< MAIN_USB_ACTIVE value means MSC transfers are occuring */ |
Pawel Zarembski |
0:01f31e923fe2 | 34 | } main_usb_busy_t; |
Pawel Zarembski |
0:01f31e923fe2 | 35 | |
Pawel Zarembski |
0:01f31e923fe2 | 36 | /** |
Pawel Zarembski |
0:01f31e923fe2 | 37 | * @enum main_usb_connect_t |
Pawel Zarembski |
0:01f31e923fe2 | 38 | * @brief State the USB connection can be in |
Pawel Zarembski |
0:01f31e923fe2 | 39 | */ |
Pawel Zarembski |
0:01f31e923fe2 | 40 | typedef enum { |
Pawel Zarembski |
0:01f31e923fe2 | 41 | MAIN_USB_DISCONNECTED, /*!< MAIN_USB_DISCONNECTED state for a USB */ |
Pawel Zarembski |
0:01f31e923fe2 | 42 | MAIN_USB_CONNECTING, /*!< MAIN_USB_CONNECTING state for a USB */ |
Pawel Zarembski |
0:01f31e923fe2 | 43 | MAIN_USB_CONNECTED, /*!< MAIN_USB_CONNECTED state for a USB */ |
Pawel Zarembski |
0:01f31e923fe2 | 44 | MAIN_USB_CHECK_CONNECTED, /*!< MAIN_USB_CHECK_CONNECTED state for a USB */ |
Pawel Zarembski |
0:01f31e923fe2 | 45 | MAIN_USB_DISCONNECTING /*!< MAIN_USB_DISCONNECTING state for a USB */ |
Pawel Zarembski |
0:01f31e923fe2 | 46 | } main_usb_connect_t; |
Pawel Zarembski |
0:01f31e923fe2 | 47 | |
Pawel Zarembski |
0:01f31e923fe2 | 48 | /** |
Pawel Zarembski |
0:01f31e923fe2 | 49 | * @enum main_led_state_t |
Pawel Zarembski |
0:01f31e923fe2 | 50 | * @brief Statest the USB connection can be in |
Pawel Zarembski |
0:01f31e923fe2 | 51 | */ |
Pawel Zarembski |
0:01f31e923fe2 | 52 | typedef enum { |
Pawel Zarembski |
0:01f31e923fe2 | 53 | MAIN_LED_DEF = 0, |
Pawel Zarembski |
0:01f31e923fe2 | 54 | MAIN_LED_FLASH, |
Pawel Zarembski |
0:01f31e923fe2 | 55 | MAIN_LED_FLASH_PERMANENT |
Pawel Zarembski |
0:01f31e923fe2 | 56 | } main_led_state_t; |
Pawel Zarembski |
0:01f31e923fe2 | 57 | |
Pawel Zarembski |
0:01f31e923fe2 | 58 | #ifdef __cplusplus |
Pawel Zarembski |
0:01f31e923fe2 | 59 | extern "C" { |
Pawel Zarembski |
0:01f31e923fe2 | 60 | #endif |
Pawel Zarembski |
0:01f31e923fe2 | 61 | |
Pawel Zarembski |
0:01f31e923fe2 | 62 | /** |
Pawel Zarembski |
0:01f31e923fe2 | 63 | * Allows other parts of the program to request the device to eject physical media |
Pawel Zarembski |
0:01f31e923fe2 | 64 | * @param none |
Pawel Zarembski |
0:01f31e923fe2 | 65 | * @return none |
Pawel Zarembski |
0:01f31e923fe2 | 66 | */ |
Pawel Zarembski |
0:01f31e923fe2 | 67 | void main_msc_disconnect_event(void); |
Pawel Zarembski |
0:01f31e923fe2 | 68 | |
Pawel Zarembski |
0:01f31e923fe2 | 69 | /** |
Pawel Zarembski |
0:01f31e923fe2 | 70 | * Delay the disconnect if there is one in progress |
Pawel Zarembski |
0:01f31e923fe2 | 71 | * @param none |
Pawel Zarembski |
0:01f31e923fe2 | 72 | * @return none |
Pawel Zarembski |
0:01f31e923fe2 | 73 | */ |
Pawel Zarembski |
0:01f31e923fe2 | 74 | void main_msc_delay_disconnect_event(void); |
Pawel Zarembski |
0:01f31e923fe2 | 75 | |
Pawel Zarembski |
0:01f31e923fe2 | 76 | /** |
Pawel Zarembski |
0:01f31e923fe2 | 77 | * Allows other parts of the program to request the device to immediately eject physical media |
Pawel Zarembski |
0:01f31e923fe2 | 78 | * @param none |
Pawel Zarembski |
0:01f31e923fe2 | 79 | * @return none |
Pawel Zarembski |
0:01f31e923fe2 | 80 | */ |
Pawel Zarembski |
0:01f31e923fe2 | 81 | void main_force_msc_disconnect_event(void); |
Pawel Zarembski |
0:01f31e923fe2 | 82 | |
Pawel Zarembski |
0:01f31e923fe2 | 83 | /** |
Pawel Zarembski |
0:01f31e923fe2 | 84 | * Allows other parts of the program to request a LED to toggle state |
Pawel Zarembski |
0:01f31e923fe2 | 85 | * @param permanent decides if the led should remain on or flash |
Pawel Zarembski |
0:01f31e923fe2 | 86 | * @return none |
Pawel Zarembski |
0:01f31e923fe2 | 87 | */ |
Pawel Zarembski |
0:01f31e923fe2 | 88 | void main_blink_msc_led(main_led_state_t permanent); |
Pawel Zarembski |
0:01f31e923fe2 | 89 | |
Pawel Zarembski |
0:01f31e923fe2 | 90 | #ifdef __cplusplus |
Pawel Zarembski |
0:01f31e923fe2 | 91 | } |
Pawel Zarembski |
0:01f31e923fe2 | 92 | #endif |
Pawel Zarembski |
0:01f31e923fe2 | 93 | |
Pawel Zarembski |
0:01f31e923fe2 | 94 | #endif |