diff options
author | Mark Meserve <mark.meserve@ni.com> | 2019-04-11 15:14:37 -0500 |
---|---|---|
committer | michael-west <michael.west@ettus.com> | 2019-05-21 16:08:43 -0700 |
commit | 4f57ecab13e37f132c99ec797d412def3f1e2a66 (patch) | |
tree | 4789bce38abf657f52a4ebd1dabce720e1e62f68 /firmware/fx3/b200/bootloader/main.c | |
parent | 914206e04182d2446de14be29ef886ae7c013641 (diff) | |
download | uhd-4f57ecab13e37f132c99ec797d412def3f1e2a66.tar.gz uhd-4f57ecab13e37f132c99ec797d412def3f1e2a66.tar.bz2 uhd-4f57ecab13e37f132c99ec797d412def3f1e2a66.zip |
b200: add custom bootloader
- Adds custom bootloader code
- Refactor common functions in firmware and bootloader
Diffstat (limited to 'firmware/fx3/b200/bootloader/main.c')
-rw-r--r-- | firmware/fx3/b200/bootloader/main.c | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/firmware/fx3/b200/bootloader/main.c b/firmware/fx3/b200/bootloader/main.c new file mode 100644 index 000000000..f46690813 --- /dev/null +++ b/firmware/fx3/b200/bootloader/main.c @@ -0,0 +1,55 @@ +// +// Copyright 2011-2012 Cypress Semiconductor Corporation +// Copyright 2019 Ettus Research, a National Instruments Brand +// +// SPDX-License-Identifier: GPL-3.0-or-later +// + +#include "cyfx3usb.h" +#include "cyfx3device.h" + +extern void usbBoot (void); +extern uint8_t glCheckForDisconnect; +extern uint8_t glInCompliance; + +int main (void) +{ + CyFx3BootErrorCode_t status; + CyFx3BootIoMatrixConfig_t ioCfg = { + .isDQ32Bit = CyFalse, + .useUart = CyFalse, + .useI2C = CyTrue, + .useI2S = CyFalse, + .useSpi = CyFalse, + .gpioSimpleEn[0] = 0, + .gpioSimpleEn[1] = 0 + }; + + CyFx3BootDeviceInit(CyTrue); + + status = CyFx3BootDeviceConfigureIOMatrix(&ioCfg); + + if (status != CY_FX3_BOOT_SUCCESS) + { + return status; + } + + usbBoot(); + + while (1) + { + if (glCheckForDisconnect) + { + CyFx3BootUsbCheckUsb3Disconnect(); + glCheckForDisconnect = 0; + } + + if (glInCompliance) + { + CyFx3BootUsbSendCompliancePatterns(); + glInCompliance = 0; + } + } + return 0; +} + |