CC2538: Add CONF parameters to select boot loader backdoor pin and logic level.

This commit is contained in:
Ian Martin 2014-04-15 17:36:55 -04:00
parent d3b9954342
commit 1a63c47cf9
3 changed files with 23 additions and 3 deletions

View file

@ -58,6 +58,7 @@
#define FLASH_CCA_BOOTLDR_CFG_ACTIVE_HIGH 0x08000000 /**< Selected pin on pad A active high */
#define FLASH_CCA_BOOTLDR_CFG_PORT_A_PIN_M 0x07000000 /**< Selected pin on pad A mask */
#define FLASH_CCA_BOOTLDR_CFG_PORT_A_PIN_S 24 /**< Selected pin on pad A shift */
#define FLASH_CCA_BOOTLDR_CFG_PORT_A_LEVEL_S 27 /**< Pin level shift */
/** @} */
/*---------------------------------------------------------------------------*/
/** \name Image valid definitions

View file

@ -48,7 +48,16 @@ typedef uint32_t rtimer_clock_t;
#ifndef FLASH_CCA_CONF_BOOTLDR_BACKDOOR
#define FLASH_CCA_CONF_BOOTLDR_BACKDOOR 1 /**<Enable the boot loader backdoor */
#endif
#ifndef FLASH_CCA_CONF_BOOTLDR_BACKDOOR_PIN
#define FLASH_CCA_CONF_BOOTLDR_BACKDOOR_PIN 3 /**< Pin PA_3 (Select button) activates the boot loader */
#endif
#ifndef FLASH_CCA_CONF_BOOTLDR_BACKDOOR_LEVEL
#define FLASH_CCA_CONF_BOOTLDR_BACKDOOR_LEVEL 0 /**< A logic low level activates the boot loader */
#endif
/** @} */
/*---------------------------------------------------------------------------*/
/**
* \name USB 'core' configuration

View file

@ -65,9 +65,19 @@ void udma_err_isr(void);
/* Boot Loader Backdoor selection */
#if FLASH_CCA_CONF_BOOTLDR_BACKDOOR
/* Backdoor enabled, on PA_3 (Select button) */
#define FLASH_CCA_BOOTLDR_CFG (FLASH_CCA_BOOTLDR_CFG_ENABLE \
| ((3 << FLASH_CCA_BOOTLDR_CFG_PORT_A_PIN_S) & FLASH_CCA_BOOTLDR_CFG_PORT_A_PIN_M))
/* Backdoor enabled */
#if ( (FLASH_CCA_CONF_BOOTLDR_BACKDOOR_LEVEL < 0) || (FLASH_CCA_CONF_BOOTLDR_BACKDOOR_LEVEL > 1) )
#error Invalid boot loader backdoor pin level. Please set FLASH_CCA_CONF_BOOTLDR_BACKDOOR_LEVEL to 0 (logic low) or 1 (logic high).
#endif
#if ( (FLASH_CCA_CONF_BOOTLDR_BACKDOOR_PIN < 0) || (FLASH_CCA_CONF_BOOTLDR_BACKDOOR_PIN > 7) )
#error Invalid boot loader backdoor pin. Please set FLASH_CCA_CONF_BOOTLDR_BACKDOOR_PIN between 0 and 7 (indicating PA0 - PA7).
#endif
#define FLASH_CCA_BOOTLDR_CFG ( FLASH_CCA_BOOTLDR_CFG_ENABLE \
| (FLASH_CCA_CONF_BOOTLDR_BACKDOOR_LEVEL << FLASH_CCA_BOOTLDR_CFG_PORT_A_LEVEL_S) \
| (FLASH_CCA_CONF_BOOTLDR_BACKDOOR_PIN << FLASH_CCA_BOOTLDR_CFG_PORT_A_PIN_S) )
#else
#define FLASH_CCA_BOOTLDR_CFG FLASH_CCA_BOOTLDR_CFG_DISABLE
#endif