From 32840db66bee99ae07c0f0585c68a28371b803fc Mon Sep 17 00:00:00 2001 From: George Oikonomou Date: Mon, 20 Apr 2015 07:52:46 +0100 Subject: [PATCH 01/14] Update driverlib version macros --- platform/srf06-cc26xx/contiki-main.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/platform/srf06-cc26xx/contiki-main.c b/platform/srf06-cc26xx/contiki-main.c index 9df0aac7b..5cc5d83fa 100644 --- a/platform/srf06-cc26xx/contiki-main.c +++ b/platform/srf06-cc26xx/contiki-main.c @@ -62,7 +62,7 @@ #include "dev/serial-line.h" #include "net/mac/frame802154.h" -#include "driverlib/driverlib_ver.h" +#include "driverlib/driverlib_release.h" #include /*---------------------------------------------------------------------------*/ @@ -174,8 +174,8 @@ main(void) serial_line_init(); printf("Starting " CONTIKI_VERSION_STRING "\n"); - printf("With DriverLib v%u.%02u.%02u.%u\n", DRIVERLIB_MAJOR_VER, - DRIVERLIB_MINOR_VER, DRIVERLIB_PATCH_VER, DRIVERLIB_BUILD_ID); + printf("With DriverLib v%u.%u\n", DRIVERLIB_RELEASE_GROUP, + DRIVERLIB_RELEASE_BUILD); printf(BOARD_STRING " using CC%u\n", CC26XX_MODEL_CPU_VARIANT); process_start(&etimer_process, NULL); From 5f4154a0e3a95ad2af7650da1410af00af0f06f7 Mon Sep 17 00:00:00 2001 From: George Oikonomou Date: Mon, 20 Apr 2015 08:03:08 +0100 Subject: [PATCH 02/14] Adjust AON BatMon usage --- cpu/cc26xx/dev/batmon-sensor.c | 12 ++++-------- cpu/cc26xx/ti-lib.h | 7 +------ examples/cc26xx/cc26xx-demo.c | 3 +-- examples/cc26xx/cc26xx-web-demo/cc26xx-web-demo.c | 3 +-- 4 files changed, 7 insertions(+), 18 deletions(-) diff --git a/cpu/cc26xx/dev/batmon-sensor.c b/cpu/cc26xx/dev/batmon-sensor.c index 8131307a0..3af7a578a 100644 --- a/cpu/cc26xx/dev/batmon-sensor.c +++ b/cpu/cc26xx/dev/batmon-sensor.c @@ -61,28 +61,25 @@ static int enabled = SENSOR_STATUS_DISABLED; * \brief Returns a reading from the sensor * \param type BATMON_SENSOR_TYPE_TEMP or BATMON_SENSOR_TYPE_VOLT * - * \return The raw sensor reading, not converted to human-readable form + * \return The value as returned by the respective CC26xxware function */ static int value(int type) { - uint32_t tmp_value; - if(enabled == SENSOR_STATUS_DISABLED) { PRINTF("Sensor Disabled\n"); return 0; } if(type == BATMON_SENSOR_TYPE_TEMP) { - tmp_value = ti_lib_aon_batmon_temperature_get(); + return (int)ti_lib_aon_batmon_temperature_get_deg_c(); } else if(type == BATMON_SENSOR_TYPE_VOLT) { - tmp_value = ti_lib_aon_batmon_battery_voltage_get(); + return (int)ti_lib_aon_batmon_battery_voltage_get(); } else { PRINTF("Invalid type\n"); - return 0; } - return (int)tmp_value; + return 0; } /*---------------------------------------------------------------------------*/ /** @@ -101,7 +98,6 @@ configure(int type, int enable) switch(type) { case SENSORS_HW_INIT: ti_lib_aon_batmon_enable(); - ti_lib_aon_batmon_measurement_cycle_set(AON_BATMON_CYCLE_32); enabled = SENSOR_STATUS_ENABLED; break; case SENSORS_ACTIVE: diff --git a/cpu/cc26xx/ti-lib.h b/cpu/cc26xx/ti-lib.h index 61ad146fe..567f4f396 100644 --- a/cpu/cc26xx/ti-lib.h +++ b/cpu/cc26xx/ti-lib.h @@ -57,12 +57,7 @@ #define ti_lib_aon_batmon_enable(...) AONBatMonEnable(__VA_ARGS__) #define ti_lib_aon_batmon_disable(...) AONBatMonDisable(__VA_ARGS__) -#define ti_lib_aon_batmon_measurement_cycle_set(...) AONBatMonMeasurementCycleSet(__VA_ARGS__) -#define ti_lib_aon_batmon_measurement_cycle_get(...) AONBatMonMeasurementCycleGet(__VA_ARGS__) -#define ti_lib_aon_batmon_battery_trim_set(...) AONBatMonBatteryTrimSet(__VA_ARGS__) -#define ti_lib_aon_batmon_temperature_trim_set(...) AONBatMonTemperatureTrimSet(__VA_ARGS__) -#define ti_lib_aon_batmon_temperature_get(...) AONBatMonTemperatureGet(__VA_ARGS__) -#define ti_lib_aon_batmon_temp_get_deg(...) AON_BatmonTempGetDegC(__VA_ARGS__) +#define ti_lib_aon_batmon_temperature_get_deg_c(...) AONBatMonTemperatureGetDegC(__VA_ARGS__) #define ti_lib_aon_batmon_battery_voltage_get(...) AONBatMonBatteryVoltageGet(__VA_ARGS__) #define ti_lib_aon_batmon_new_battery_measure_ready(...) AONBatMonNewBatteryMeasureReady(__VA_ARGS__) #define ti_lib_aon_batmon_new_temp_measure_ready(...) AONBatMonNewTempMeasureReady(__VA_ARGS__) diff --git a/examples/cc26xx/cc26xx-demo.c b/examples/cc26xx/cc26xx-demo.c index b7bf56132..1426bb983 100644 --- a/examples/cc26xx/cc26xx-demo.c +++ b/examples/cc26xx/cc26xx-demo.c @@ -329,8 +329,7 @@ get_sync_sensor_readings(void) printf("-----------------------------------------\n"); value = batmon_sensor.value(BATMON_SENSOR_TYPE_TEMP); - printf("Bat: Temp=%d.%02d C (%08x)\n", value >> 2, - (value & 0x00000003) * 25, value); + printf("Bat: Temp=%d C\n", value); value = batmon_sensor.value(BATMON_SENSOR_TYPE_VOLT); printf("Bat: Volt=%d mV\n", (value * 125) >> 5); diff --git a/examples/cc26xx/cc26xx-web-demo/cc26xx-web-demo.c b/examples/cc26xx/cc26xx-web-demo/cc26xx-web-demo.c index d2c2bf77b..4d8c9ca86 100644 --- a/examples/cc26xx/cc26xx-web-demo/cc26xx-web-demo.c +++ b/examples/cc26xx/cc26xx-web-demo/cc26xx-web-demo.c @@ -392,8 +392,7 @@ get_batmon_reading(void *data) buf = batmon_temp_reading.converted; memset(buf, 0, CC26XX_WEB_DEMO_CONVERTED_LEN); - snprintf(buf, CC26XX_WEB_DEMO_CONVERTED_LEN, "%d.%02d", value >> 2, - (value & 0x00000003) * 25); + snprintf(buf, CC26XX_WEB_DEMO_CONVERTED_LEN, "%d", value); } } From 09a8c54eb1bca7273a54e96a9b756cdb3f7de1ae Mon Sep 17 00:00:00 2001 From: George Oikonomou Date: Mon, 20 Apr 2015 08:04:41 +0100 Subject: [PATCH 03/14] Update CC26xxware glue macros * Remove references to removed functions * Add macros to new functions * Rename macros to renamed functions * Add macros for the HAPI --- cpu/cc26xx/ti-lib.h | 52 ++++++++++++++++++++++++++++----------------- 1 file changed, 32 insertions(+), 20 deletions(-) diff --git a/cpu/cc26xx/ti-lib.h b/cpu/cc26xx/ti-lib.h index 567f4f396..bd25c54de 100644 --- a/cpu/cc26xx/ti-lib.h +++ b/cpu/cc26xx/ti-lib.h @@ -118,10 +118,8 @@ #define ti_lib_aon_wuc_mcu_power_down_config(...) AONWUCMcuPowerDownConfig(__VA_ARGS__) #define ti_lib_aon_wuc_mcu_power_off_config(...) AONWUCMcuPowerOffConfig(__VA_ARGS__) #define ti_lib_aon_wuc_mcu_sram_config(...) AONWUCMcuSRamConfig(__VA_ARGS__) -#define ti_lib_aon_wuc_aux_clock_config_set(...) AONWUCAuxClockConfigSet(__VA_ARGS__) #define ti_lib_aon_wuc_aux_clock_config_get(...) AONWUCAuxClockConfigGet(__VA_ARGS__) #define ti_lib_aon_wuc_aux_power_down_config(...) AONWUCAuxPowerDownConfig(__VA_ARGS__) -#define ti_lib_aon_wuc_aux_power_off_config(...) AONWUCAuxPowerOffConfig(__VA_ARGS__) #define ti_lib_aon_wuc_aux_wake_up_config(...) AONWUCAuxWakeUpConfig(__VA_ARGS__) #define ti_lib_aon_wuc_aux_sram_config(...) AONWUCAuxSRamConfig(__VA_ARGS__) #define ti_lib_aon_wuc_aux_wakeup_event(...) AONWUCAuxWakeupEvent(__VA_ARGS__) @@ -168,10 +166,6 @@ #define ti_lib_aux_adi_ddi_safe_write(...) AuxAdiDdiSafeWrite(__VA_ARGS__) #define ti_lib_aux_adi_ddi_safe_read(...) AuxAdiDdiSafeRead(__VA_ARGS__) -#define ti_lib_ddi_status_get(...) DDIStatusGet(__VA_ARGS__) -#define ti_lib_ddi_config_set(...) DDIConfigSet(__VA_ARGS__) -#define ti_lib_ddi_sync(...) DDISync(__VA_ARGS__) -#define ti_lib_ddi_protect(...) DDIProtect(__VA_ARGS__) #define ti_lib_ddi_32_reg_write(...) DDI32RegWrite(__VA_ARGS__) #define ti_lib_ddi_32_reg_read(...) DDI32RegRead(__VA_ARGS__) #define ti_lib_ddi_32_bits_set(...) DDI32BitsSet(__VA_ARGS__) @@ -251,7 +245,6 @@ #define ti_lib_ioc_port_configure_set(...) IOCPortConfigureSet(__VA_ARGS__) #define ti_lib_ioc_port_configure_get(...) IOCPortConfigureGet(__VA_ARGS__) #define ti_lib_ioc_io_shutdown_set(...) IOCIOShutdownSet(__VA_ARGS__) -#define ti_lib_ioc_io_jtag_set(...) IOCIOJTagSet(__VA_ARGS__) #define ti_lib_ioc_io_mode_set(...) IOCIOModeSet(__VA_ARGS__) #define ti_lib_ioc_io_port_pull_set(...) IOCIOPortPullSet(__VA_ARGS__) #define ti_lib_ioc_io_hyst_set(...) IOCIOHystSet(__VA_ARGS__) @@ -298,8 +291,6 @@ #define ti_lib_prcm_mcu_power_off(...) PRCMMcuPowerOff(__VA_ARGS__) #define ti_lib_prcm_mcu_power_off_cancel(...) PRCMMcuPowerOffCancel(__VA_ARGS__) #define ti_lib_prcm_mcu_uldo_configure(...) PRCMMcuUldoConfigure(__VA_ARGS__) -#define ti_lib_prcm_clock_configure_set(...) PRCMClockConfigureSet(__VA_ARGS__) -#define ti_lib_prcm_clock_configure_get(...) PRCMClockConfigureGet(__VA_ARGS__) #define ti_lib_prcm_audio_clock_enable(...) PRCMAudioClockEnable(__VA_ARGS__) #define ti_lib_prcm_audio_clock_disable(...) PRCMAudioClockDisable(__VA_ARGS__) #define ti_lib_prcm_audio_clock_config_set(...) PRCMAudioClockConfigSet(__VA_ARGS__) @@ -321,8 +312,8 @@ #define ti_lib_prcm_wdt_reset_status(...) PRCMWdtResetStatus(__VA_ARGS__) #define ti_lib_prcm_sleep(...) PRCMSleep(__VA_ARGS__) #define ti_lib_prcm_deep_sleep(...) PRCMDeepSleep(__VA_ARGS__) -#define ti_lib_prcm_retention_enable(...) PRCMRetentionEnable(__VA_ARGS__) -#define ti_lib_prcm_retention_disable(...) PRCMRetentionDisable(__VA_ARGS__) +#define ti_lib_prcm_cache_retention_enable(...) PRCMCacheRetentionEnable(__VA_ARGS__) +#define ti_lib_prcm_cache_retention_disable(...) PRCMCacheRetentionDisable(__VA_ARGS__) /*---------------------------------------------------------------------------*/ /* sys_ctrl.h */ #include "driverlib/pwr_ctrl.h" @@ -330,7 +321,6 @@ #define ti_lib_pwr_ctrl_state_set(...) PowerCtrlStateSet(__VA_ARGS__) #define ti_lib_pwr_ctrl_source_set(...) PowerCtrlSourceSet(__VA_ARGS__) #define ti_lib_pwr_ctrl_source_get(...) PowerCtrlSourceGet(__VA_ARGS__) -#define ti_lib_pwr_ctrl_io_config_set(...) PowerCtrlIoConfigSet(__VA_ARGS__) #define ti_lib_pwr_ctrl_reset_source_get(...) PowerCtrlResetSourceGet(__VA_ARGS__) #define ti_lib_pwr_ctrl_reset_source_clear(...) PowerCtrlResetSourceClear(__VA_ARGS__) #define ti_lib_pwr_ctrl_io_freeze_enable(...) PowerCtrlIOFreezeEnable(__VA_ARGS__) @@ -366,7 +356,6 @@ #define ti_lib_rom_aon_rtc_current_compare_value_get ROM_AONRTCCurrentCompareValueGet /* AON_WUC API */ -#define ti_lib_rom_aon_wuc_aux_clock_config_set ROM_AONWUCAuxClockConfigSet #define ti_lib_rom_aon_wuc_aux_s_ram_config ROM_AONWUCAuxSRamConfig #define ti_lib_rom_aon_wuc_aux_wakeup_event ROM_AONWUCAuxWakeupEvent #define ti_lib_rom_aon_wuc_aux_reset ROM_AONWUCAuxReset @@ -444,8 +433,6 @@ /* PRCM API */ #define ti_lib_rom_prcm_inf_clock_configure_set ROM_PRCMInfClockConfigureSet #define ti_lib_rom_prcm_inf_clock_configure_get ROM_PRCMInfClockConfigureGet -#define ti_lib_rom_prcm_clock_configure_set ROM_PRCMClockConfigureSet -#define ti_lib_rom_prcm_clock_configure_get ROM_PRCMClockConfigureGet #define ti_lib_rom_prcm_audio_clock_config_set ROM_PRCMAudioClockConfigSet #define ti_lib_rom_prcm_power_domain_on ROM_PRCMPowerDomainOn #define ti_lib_rom_prcm_power_domain_off ROM_PRCMPowerDomainOff @@ -457,8 +444,6 @@ #define ti_lib_rom_prcm_peripheral_deep_sleep_disable ROM_PRCMPeripheralDeepSleepDisable #define ti_lib_rom_prcm_power_domain_status ROM_PRCMPowerDomainStatus #define ti_lib_rom_prcm_deep_sleep ROM_PRCMDeepSleep -#define ti_lib_rom_prcm_retention_enable ROM_PRCMRetentionEnable -#define ti_lib_rom_prcm_retention_disable ROM_PRCMRetentionDisable /* SMPH API */ #define ti_lib_rom_smph_acquire ROM_SMPHAcquire @@ -512,6 +497,29 @@ #define ti_lib_rom_vims_configure ROM_VIMSConfigure #define ti_lib_rom_vims_mode_set ROM_VIMSModeSet #define ti_lib_rom_vims_mode_get ROM_VIMSModeGet + +/* HAPI */ +#define ti_lib_hapi_crc32(a, b, c) HapiCrc32(a, b, c) +#define ti_lib_hapi_get_chip_id() HapiGetChipId() +#define ti_lib_hapi_reset_device() HapiResetDevice() +#define ti_lib_hapi_fletcher32(a, b, c) HapiFletcher32(a, b, c) +#define ti_lib_hapi_min_value(a, b) HapiMinValue(a,b) +#define ti_lib_hapi_max_value(a, b) HapiMaxValue(a,b) +#define ti_lib_hapi_mean_value(a, b) HapiMeanValue(a,b) +#define ti_lib_hapi_stand_deviation_value(a, b) HapiStandDeviationValue(a,b) +#define ti_lib_hapi_reset_peripheral(a) HapiResetPeripheral(a) +#define ti_lib_hapi_reset_domain(a) HapiResetDomain(a) +#define ti_lib_hapi_hf_source_safe_switch() HapiHFSourceSafeSwitch() +#define ti_lib_hapi_select_comp_a_input(a) HapiSelectCompAInput(a) +#define ti_lib_hapi_select_comp_a_ref(a) HapiSelectCompARef(a) +#define ti_lib_hapi_select_adc_comp_b_input(a) HapiSelectADCCompBInput(a) +#define ti_lib_hapi_select_comp_b_ref(a) HapiSelectCompBRef(a) +#define ti_lib_hapi_get_flash_size() HapiGetFlashSize() +#define ti_lib_hapi_sector_erase(a) HapiSectorErase(a) +#define ti_lib_hapi_program_flash(a, b, c) HapiProgramFlash(a, b, c) +#define ti_lib_hapi_get_flash_size() HapiGetFlashSize() +#define ti_lib_hapi_sector_erase(a) HapiSectorErase(a) +#define ti_lib_hapi_program_flash(a, b, c) HapiProgramFlash(a, b, c) /*---------------------------------------------------------------------------*/ /* sys_ctrl.h */ #include "driverlib/sys_ctrl.h" @@ -521,13 +529,13 @@ #define ti_lib_sys_ctrl_standby(...) SysCtrlStandby(__VA_ARGS__) #define ti_lib_sys_ctrl_shutdown(...) SysCtrlShutdown(__VA_ARGS__) #define ti_lib_sys_ctrl_clock_get(...) SysCtrlClockGet(__VA_ARGS__) -#define ti_lib_sys_ctrl_peripheral_clock_get(...) SysCtrlPeripheralClockGet(__VA_ARGS__) #define ti_lib_sys_ctrl_aon_sync(...) SysCtrlAonSync(__VA_ARGS__) #define ti_lib_sys_ctrl_aon_update(...) SysCtrlAonUpdate(__VA_ARGS__) #define ti_lib_sys_ctrl_set_recharge_before_power_down(...) SysCtrlSetRechargeBeforePowerDown(__VA_ARGS__) #define ti_lib_sys_ctrl_adjust_recharge_after_power_down(...) SysCtrlAdjustRechargeAfterPowerDown(__VA_ARGS__) #define ti_lib_sys_ctrl_dcdc_voltage_conditional_control(...) SysCtrl_DCDC_VoltageConditionalControl(__VA_ARGS__) #define ti_lib_sys_ctrl_reset_source_get(...) SysCtrlResetSourceGet(__VA_ARGS__) +#define ti_lib_sys_ctrl_system_reset(...) SysCtrlSystemReset(__VA_ARGS__) /*---------------------------------------------------------------------------*/ /* ssi.h */ #include "driverlib/ssi.h" @@ -592,6 +600,10 @@ #define ti_lib_timer_int_status(...) TimerIntStatus(__VA_ARGS__) #define ti_lib_timer_int_clear(...) TimerIntClear(__VA_ARGS__) #define ti_lib_timer_synchronize(...) TimerSynchronize(__VA_ARGS__) +#define ti_lib_timer_ccp_combine_enable(...) TimerCcpCombineEnable(__VA_ARGS__) +#define ti_lib_timer_ccp_combine_disable(...) TimerCcpCombineDisable(__VA_ARGS__) +#define ti_lib_timer_match_update_mode(...) TimerMatchUpdateMode(__VA_ARGS__) +#define ti_lib_timer_interval_load_mode(...) TimerIntervalLoadMode(__VA_ARGS__) /*---------------------------------------------------------------------------*/ /* uart.h */ #include "driverlib/uart.h" @@ -624,8 +636,8 @@ #define ti_lib_uart_dma_disable(...) UARTDMADisable(__VA_ARGS__) #define ti_lib_uart_rx_error_get(...) UARTRxErrorGet(__VA_ARGS__) #define ti_lib_uart_rx_error_clear(...) UARTRxErrorClear(__VA_ARGS__) -#define ti_lib_uart_tx_int_mode_set(...) UARTTxIntModeSet(__VA_ARGS__) -#define ti_lib_uart_tx_int_mode_get(...) UARTTxIntModeGet(__VA_ARGS__) +#define ti_lib_uart_hw_flow_control_en(...) UARTHwFlowControlEnable(__VA_ARGS__) +#define ti_lib_uart_hw_flow_control_dis(...) UARTHwFlowControlDisable(__VA_ARGS__) /*---------------------------------------------------------------------------*/ /* vims.h */ #include "driverlib/vims.h" From 7a5b670f76494ee9ba8461590d1947e87f929217 Mon Sep 17 00:00:00 2001 From: George Oikonomou Date: Mon, 20 Apr 2015 08:31:38 +0100 Subject: [PATCH 04/14] Remove references to IOC_JTAG_DISABLE --- platform/srf06-cc26xx/sensortag/button-sensor.c | 3 +-- platform/srf06-cc26xx/sensortag/reed-relay.c | 3 +-- platform/srf06-cc26xx/srf06/button-sensor.c | 3 +-- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/platform/srf06-cc26xx/sensortag/button-sensor.c b/platform/srf06-cc26xx/sensortag/button-sensor.c index d0bd14f9c..06a2d2eaa 100644 --- a/platform/srf06-cc26xx/sensortag/button-sensor.c +++ b/platform/srf06-cc26xx/sensortag/button-sensor.c @@ -57,8 +57,7 @@ IOC_IOPULL_UP | IOC_SLEW_DISABLE | \ IOC_HYST_ENABLE | IOC_BOTH_EDGES | \ IOC_INT_ENABLE | IOC_IOMODE_NORMAL | \ - IOC_NO_WAKE_UP | IOC_INPUT_ENABLE | \ - IOC_JTAG_DISABLE) + IOC_NO_WAKE_UP | IOC_INPUT_ENABLE) /*---------------------------------------------------------------------------*/ #define DEBOUNCE_DURATION (CLOCK_SECOND >> 5) diff --git a/platform/srf06-cc26xx/sensortag/reed-relay.c b/platform/srf06-cc26xx/sensortag/reed-relay.c index 612163b12..9be161b48 100644 --- a/platform/srf06-cc26xx/sensortag/reed-relay.c +++ b/platform/srf06-cc26xx/sensortag/reed-relay.c @@ -54,8 +54,7 @@ static struct timer debouncetimer; IOC_IOPULL_DOWN | IOC_SLEW_DISABLE | \ IOC_HYST_DISABLE | IOC_BOTH_EDGES | \ IOC_INT_DISABLE | IOC_IOMODE_NORMAL | \ - IOC_NO_WAKE_UP | IOC_INPUT_ENABLE | \ - IOC_JTAG_DISABLE) + IOC_NO_WAKE_UP | IOC_INPUT_ENABLE) /*---------------------------------------------------------------------------*/ /** * \brief Handler for Sensortag-CC26XX reed interrupts diff --git a/platform/srf06-cc26xx/srf06/button-sensor.c b/platform/srf06-cc26xx/srf06/button-sensor.c index f1f9a05cf..5cd541e6c 100644 --- a/platform/srf06-cc26xx/srf06/button-sensor.c +++ b/platform/srf06-cc26xx/srf06/button-sensor.c @@ -57,8 +57,7 @@ IOC_IOPULL_UP | IOC_SLEW_DISABLE | \ IOC_HYST_ENABLE | IOC_BOTH_EDGES | \ IOC_INT_ENABLE | IOC_IOMODE_NORMAL | \ - IOC_NO_WAKE_UP | IOC_INPUT_ENABLE | \ - IOC_JTAG_DISABLE) + IOC_NO_WAKE_UP | IOC_INPUT_ENABLE) /*---------------------------------------------------------------------------*/ #define DEBOUNCE_DURATION (CLOCK_SECOND >> 5) From 8673bbdd555e8fdbae3386b85eccf96f54c8c330 Mon Sep 17 00:00:00 2001 From: George Oikonomou Date: Mon, 20 Apr 2015 08:32:05 +0100 Subject: [PATCH 05/14] Update linker script to accommodate for larger CCFG size --- cpu/cc26xx/cc26xx.ld | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cpu/cc26xx/cc26xx.ld b/cpu/cc26xx/cc26xx.ld index 27c39c6c5..5902161c3 100644 --- a/cpu/cc26xx/cc26xx.ld +++ b/cpu/cc26xx/cc26xx.ld @@ -35,14 +35,14 @@ ENTRY(ResetISR) MEMORY { - /* Flash Size 128 KB minus the CCA area below (76 bytes) */ - FLASH (RX) : ORIGIN = 0x00000000, LENGTH = 0x0001FFAC + /* Flash Size 128 KB minus the CCA area below (88 bytes) */ + FLASH (RX) : ORIGIN = 0x00000000, LENGTH = 0x0001FFA8 /* * Customer Configuration Area and Bootloader Backdoor configuration - * in flash, up to 80 bytes + * in flash, up to 88 bytes */ - FLASH_CCFG (RX) : ORIGIN = 0x0001FFAC, LENGTH = 84 + FLASH_CCFG (RX) : ORIGIN = 0x0001FFA8, LENGTH = 88 /* RAM Size 20KB (PG2.1) */ SRAM (RWX) : ORIGIN = 0x20000000, LENGTH = 0x00005000 From 8b1f2ef33c5eb42705df4542b81c8d935f4d2b17 Mon Sep 17 00:00:00 2001 From: George Oikonomou Date: Mon, 20 Apr 2015 08:32:30 +0100 Subject: [PATCH 06/14] Reset I2C with HAPI call instead of register access --- platform/srf06-cc26xx/sensortag/board-i2c.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/srf06-cc26xx/sensortag/board-i2c.c b/platform/srf06-cc26xx/sensortag/board-i2c.c index da17c4139..509f2707e 100644 --- a/platform/srf06-cc26xx/sensortag/board-i2c.c +++ b/platform/srf06-cc26xx/sensortag/board-i2c.c @@ -80,7 +80,7 @@ board_i2c_wakeup() while(!ti_lib_prcm_load_get()); /* Reset the I2C controller */ - HWREG(PRCM_BASE + PRCM_O_RESETI2C) = PRCM_RESETI2C_I2C; + ti_lib_hapi_reset_peripheral(PRCM_PERIPH_I2C0); /* Enable and initialize the I2C master module */ ti_lib_i2c_master_init_exp_clk(I2C0_BASE, From b38d32b2810fda8302dabb4f8922293ac2e520d8 Mon Sep 17 00:00:00 2001 From: George Oikonomou Date: Mon, 20 Apr 2015 08:42:23 +0100 Subject: [PATCH 07/14] Rename AON WUC power status macros --- cpu/cc26xx/lpm.c | 4 ++-- cpu/cc26xx/ti-lib.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/cpu/cc26xx/lpm.c b/cpu/cc26xx/lpm.c index f9d309f74..b887c65ba 100644 --- a/cpu/cc26xx/lpm.c +++ b/cpu/cc26xx/lpm.c @@ -160,7 +160,7 @@ lpm_shutdown(uint32_t wakeup_pin, uint32_t io_pull, uint32_t wake_on) /* Turn off AUX */ ti_lib_aux_wuc_power_ctrl(AUX_WUC_POWER_OFF); ti_lib_aon_wuc_domain_power_down_enable(); - while(ti_lib_aon_wuc_power_status() & AONWUC_AUX_POWER_ON); + while(ti_lib_aon_wuc_power_status_get() & AONWUC_AUX_POWER_ON); /* * Request MCU VD power off. @@ -362,7 +362,7 @@ lpm_drop() /* Turn off AUX */ ti_lib_aux_wuc_power_ctrl(AUX_WUC_POWER_OFF); ti_lib_aon_wuc_domain_power_down_enable(); - while(ti_lib_aon_wuc_power_status() & AONWUC_AUX_POWER_ON); + while(ti_lib_aon_wuc_power_status_get() & AONWUC_AUX_POWER_ON); /* Configure the recharge controller */ ti_lib_sys_ctrl_set_recharge_before_power_down(false); diff --git a/cpu/cc26xx/ti-lib.h b/cpu/cc26xx/ti-lib.h index bd25c54de..ff707cfae 100644 --- a/cpu/cc26xx/ti-lib.h +++ b/cpu/cc26xx/ti-lib.h @@ -126,11 +126,11 @@ #define ti_lib_aon_wuc_aux_image_valid(...) AONWUCAuxImageValid(__VA_ARGS__) #define ti_lib_aon_wuc_aux_image_invalid(...) AONWUCAuxImageInvalid(__VA_ARGS__) #define ti_lib_aon_wuc_aux_reset(...) AONWUCAuxReset(__VA_ARGS__) -#define ti_lib_aon_wuc_power_status(...) AONWUCPowerStatus(__VA_ARGS__) +#define ti_lib_aon_wuc_power_status_get(...) AONWUCPowerStatusGet(__VA_ARGS__) #define ti_lib_aon_wuc_shut_down_enable(...) AONWUCShutDownEnable(__VA_ARGS__) #define ti_lib_aon_wuc_domain_power_down_enable(...) AONWUCDomainPowerDownEnable(__VA_ARGS__) #define ti_lib_aon_wuc_domain_power_down_disable(...) AONWUCDomainPowerDownDisable(__VA_ARGS__) -#define ti_lib_aon_wuc_mcu_reset_status(...) AONWUCMcuResetStatus(__VA_ARGS__) +#define ti_lib_aon_wuc_mcu_reset_status_get(...) AONWUCMcuResetStatusGet(__VA_ARGS__) #define ti_lib_aon_wuc_mcu_reset_clear(...) AONWUCMcuResetClear(__VA_ARGS__) #define ti_lib_aon_wuc_recharge_ctrl_config_set(...) AONWUCRechargeCtrlConfigSet(__VA_ARGS__) #define ti_lib_aon_wuc_recharge_ctrl_config_get(...) AONWUCRechargeCtrlConfigGet(__VA_ARGS__) From ab4249a7092491bd260de4bd470b4a9cf673680e Mon Sep 17 00:00:00 2001 From: George Oikonomou Date: Mon, 20 Apr 2015 15:26:56 +0100 Subject: [PATCH 08/14] Adjust retention calls * Rename VIMS-related calls * Remove obsolete ones --- cpu/cc26xx/lpm.c | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/cpu/cc26xx/lpm.c b/cpu/cc26xx/lpm.c index b887c65ba..a0d633472 100644 --- a/cpu/cc26xx/lpm.c +++ b/cpu/cc26xx/lpm.c @@ -141,11 +141,9 @@ lpm_shutdown(uint32_t wakeup_pin, uint32_t io_pull, uint32_t wake_on) ti_lib_aon_wuc_mcu_power_down_config(AONWUC_NO_CLOCK); ti_lib_aon_wuc_aux_power_down_config(AONWUC_NO_CLOCK); - /* Disable retentions: SRAM, CPU, AUX, RFCORE - possibly not required */ + /* Disable SRAM and AUX retentions */ ti_lib_aon_wuc_mcu_sram_config(0); - ti_lib_prcm_retention_disable(PRCM_DOMAIN_CPU); ti_lib_aon_wuc_aux_sram_config(false); - ti_lib_prcm_retention_disable(PRCM_DOMAIN_RFCORE); /* * Request CPU, SYSBYS and VIMS PD off. @@ -176,7 +174,7 @@ lpm_shutdown(uint32_t wakeup_pin, uint32_t io_pull, uint32_t wake_on) ti_lib_pwr_ctrl_io_freeze_enable(); /* Turn off VIMS cache, CRAM and TRAM - possibly not required */ - ti_lib_prcm_retention_disable(PRCM_DOMAIN_VIMS); + ti_lib_prcm_cache_retention_disable(); ti_lib_vims_mode_set(VIMS_BASE, VIMS_MODE_OFF); /* Enable shutdown and sync AON */ @@ -216,7 +214,7 @@ wake_up(void) /* Turn on cache again */ ti_lib_vims_mode_set(VIMS_BASE, VIMS_MODE_ENABLED); - ti_lib_prcm_retention_enable(PRCM_DOMAIN_VIMS); + ti_lib_prcm_cache_retention_enable(); ti_lib_aon_ioc_freeze_disable(); ti_lib_sys_ctrl_aon_sync(); @@ -340,15 +338,9 @@ lpm_drop() ti_lib_aon_wuc_mcu_sram_config(MCU_RAM0_RETENTION | MCU_RAM1_RETENTION | MCU_RAM2_RETENTION | MCU_RAM3_RETENTION); - /* Enable retention on the CPU domain */ - ti_lib_prcm_retention_enable(PRCM_DOMAIN_CPU); - /* Disable retention of AUX RAM */ ti_lib_aon_wuc_aux_sram_config(false); - /* Disable retention in the RFCORE RAM */ - ti_lib_prcm_retention_disable(PRCM_DOMAIN_RFCORE); - /* * Always turn off RFCORE, CPU, SYSBUS and VIMS. RFCORE should be off * already @@ -389,7 +381,7 @@ lpm_drop() * until right before deep sleep to be able to use the cache for as long * as possible. */ - ti_lib_prcm_retention_disable(PRCM_DOMAIN_VIMS); + ti_lib_prcm_cache_retention_disable(); ti_lib_vims_mode_set(VIMS_BASE, VIMS_MODE_OFF); /* Deep Sleep */ From b4067560ba8f621ce4aa4728b75bcacc447a4bae Mon Sep 17 00:00:00 2001 From: George Oikonomou Date: Mon, 20 Apr 2015 15:37:39 +0100 Subject: [PATCH 09/14] Remove references to obsolete peripheral clock scaling functions --- cpu/cc26xx/dev/cc26xx-uart.c | 5 +---- platform/srf06-cc26xx/sensortag/board-i2c.c | 8 ++------ platform/srf06-cc26xx/sensortag/board.c | 7 ------- platform/srf06-cc26xx/srf06/board.c | 5 ----- 4 files changed, 3 insertions(+), 22 deletions(-) diff --git a/cpu/cc26xx/dev/cc26xx-uart.c b/cpu/cc26xx/dev/cc26xx-uart.c index 6773b9836..5d6c5403d 100644 --- a/cpu/cc26xx/dev/cc26xx-uart.c +++ b/cpu/cc26xx/dev/cc26xx-uart.c @@ -154,10 +154,7 @@ configure(void) BOARD_IOID_UART_CTS, BOARD_IOID_UART_RTS); /* Configure the UART for 115,200, 8-N-1 operation. */ - ti_lib_uart_config_set_exp_clk(UART0_BASE, - ti_lib_sys_ctrl_peripheral_clock_get( - PRCM_PERIPH_UART0, - SYSCTRL_SYSBUS_ON), + ti_lib_uart_config_set_exp_clk(UART0_BASE, ti_lib_sys_ctrl_clock_get(), CC26XX_UART_CONF_BAUD_RATE, (UART_CONFIG_WLEN_8 | UART_CONFIG_STOP_ONE | UART_CONFIG_PAR_NONE)); diff --git a/platform/srf06-cc26xx/sensortag/board-i2c.c b/platform/srf06-cc26xx/sensortag/board-i2c.c index 509f2707e..a2b0ba5d2 100644 --- a/platform/srf06-cc26xx/sensortag/board-i2c.c +++ b/platform/srf06-cc26xx/sensortag/board-i2c.c @@ -83,9 +83,7 @@ board_i2c_wakeup() ti_lib_hapi_reset_peripheral(PRCM_PERIPH_I2C0); /* Enable and initialize the I2C master module */ - ti_lib_i2c_master_init_exp_clk(I2C0_BASE, - ti_lib_sys_ctrl_peripheral_clock_get( - PRCM_PERIPH_I2C0, SYSCTRL_SYSBUS_ON), + ti_lib_i2c_master_init_exp_clk(I2C0_BASE, ti_lib_sys_ctrl_clock_get(), true); } /*---------------------------------------------------------------------------*/ @@ -331,9 +329,7 @@ board_i2c_select(uint8_t new_interface, uint8_t address) } /* Enable and initialize the I2C master module */ - ti_lib_i2c_master_init_exp_clk(I2C0_BASE, - ti_lib_sys_ctrl_peripheral_clock_get( - PRCM_PERIPH_I2C0, SYSCTRL_SYSBUS_ON), + ti_lib_i2c_master_init_exp_clk(I2C0_BASE, ti_lib_sys_ctrl_clock_get(), true); } } diff --git a/platform/srf06-cc26xx/sensortag/board.c b/platform/srf06-cc26xx/sensortag/board.c index c060ee58f..f06545170 100644 --- a/platform/srf06-cc26xx/sensortag/board.c +++ b/platform/srf06-cc26xx/sensortag/board.c @@ -133,13 +133,6 @@ board_init() power_domains_on(); - /* Configure all clock domains to run at full speed */ - ti_lib_prcm_clock_configure_set(PRCM_DOMAIN_SYSBUS, PRCM_CLOCK_DIV_1); - ti_lib_prcm_clock_configure_set(PRCM_DOMAIN_CPU, PRCM_CLOCK_DIV_1); - ti_lib_prcm_clock_configure_set(PRCM_DOMAIN_TIMER, PRCM_CLOCK_DIV_1); - ti_lib_prcm_clock_configure_set(PRCM_DOMAIN_SERIAL, PRCM_CLOCK_DIV_1); - ti_lib_prcm_clock_configure_set(PRCM_DOMAIN_PERIPH, PRCM_CLOCK_DIV_1); - /* Enable GPIO peripheral */ ti_lib_prcm_peripheral_run_enable(PRCM_PERIPH_GPIO); diff --git a/platform/srf06-cc26xx/srf06/board.c b/platform/srf06-cc26xx/srf06/board.c index 62122cdd0..1d98d4e0d 100644 --- a/platform/srf06-cc26xx/srf06/board.c +++ b/platform/srf06-cc26xx/srf06/board.c @@ -88,11 +88,6 @@ board_init() /* Turn on relevant PDs */ wakeup_handler(); - /* Configure all clock domains to run at full speed */ - ti_lib_prcm_clock_configure_set(PRCM_DOMAIN_SYSBUS | PRCM_DOMAIN_CPU | - PRCM_DOMAIN_TIMER | PRCM_DOMAIN_SERIAL | - PRCM_DOMAIN_PERIPH, PRCM_CLOCK_DIV_1); - /* Enable GPIO peripheral */ ti_lib_prcm_peripheral_run_enable(PRCM_PERIPH_GPIO); From 40e82395c4b9f95d5cd528d01a195dd846f526b4 Mon Sep 17 00:00:00 2001 From: George Oikonomou Date: Thu, 14 May 2015 14:01:27 +0100 Subject: [PATCH 10/14] Pull CC26xxware as a submodule --- .gitmodules | 3 +++ cpu/cc26xx/lib/cc26xxware | 1 + 2 files changed, 4 insertions(+) create mode 160000 cpu/cc26xx/lib/cc26xxware diff --git a/.gitmodules b/.gitmodules index 7391a785b..48be5ceaa 100644 --- a/.gitmodules +++ b/.gitmodules @@ -4,3 +4,6 @@ [submodule "tools/cc2538-bsl"] path = tools/cc2538-bsl url = https://github.com/JelmerT/cc2538-bsl.git +[submodule "cpu/cc26xx/lib/cc26xxware"] + path = cpu/cc26xx/lib/cc26xxware + url = https://github.com/g-oikonomou/cc26xxware.git diff --git a/cpu/cc26xx/lib/cc26xxware b/cpu/cc26xx/lib/cc26xxware new file mode 160000 index 000000000..420ae3682 --- /dev/null +++ b/cpu/cc26xx/lib/cc26xxware @@ -0,0 +1 @@ +Subproject commit 420ae3682c11619c1340697632b2dc49f7e53037 From 5d20e763460755249a9fd32a40fc3c671541d061 Mon Sep 17 00:00:00 2001 From: George Oikonomou Date: Thu, 14 May 2015 14:52:16 +0100 Subject: [PATCH 11/14] Adjust the build system to use CC26xxware as a sub-module --- cpu/cc26xx/Makefile.cc26xx | 29 ++++++++++------------------- 1 file changed, 10 insertions(+), 19 deletions(-) diff --git a/cpu/cc26xx/Makefile.cc26xx b/cpu/cc26xx/Makefile.cc26xx index bff19e7bf..7c09c75ee 100644 --- a/cpu/cc26xx/Makefile.cc26xx +++ b/cpu/cc26xx/Makefile.cc26xx @@ -8,33 +8,24 @@ NM = arm-none-eabi-nm SIZE = arm-none-eabi-size SREC_CAT = srec_cat -### TI CC26xxware out-of-tree -### TI_CC26XXWARE is the home directory of the cc26xxware -### It MUST be provided as a path relative to $(CONTIKI) -### For example, if -### CONTIKI = /home/user/contiki -### and TI_CC26XXWARE is stored in -### /home/user/cc26xxware -### then set -### TI_CC26XXWARE = ../cc26xxware -ifndef TI_CC26XXWARE - $(error TI_CC26XXWARE not defined. Please see the README) -endif +CPU_ABS_PATH = cpu/cc26xx +TI_CC26XXWARE_PATH = lib/cc26xxware +TI_CC26XXWARE = $(CONTIKI_CPU)/$(TI_CC26XXWARE_PATH) -### cc26xxware sources will be added to the MODULES list -TI_CC26XXWARE_SRC = $(TI_CC26XXWARE)/driverlib +### cc26xxware sources under driverlib will be added to the MODULES list +TI_CC26XXWARE_SRC = $(CPU_ABS_PATH)/$(TI_CC26XXWARE_PATH)/driverlib ### The directory with startup sources will be added to the CONTIKI_CPU_DIRS ### and the sources therein are added to the sources list explicitly. They are ### also listed explicitly in the linker command (through TARGET_STARTFILES), ### to make sure they always get linked in the image -TI_CC26XXWARE_STARTUP = ../../$(TI_CC26XXWARE)/startup_files +TI_CC26XXWARE_STARTUP_DIR = $(TI_CC26XXWARE_PATH)/startup_files TI_CC26XXWARE_STARTUP_SRCS = ccfg.c startup_gcc.c -### MODULES will add some of these to the include pach, but we need to add +### MODULES will add some of these to the include path, but we need to add ### them earlier to prevent filename clashes with Contiki core files -CFLAGS += -I$(CONTIKI)/$(TI_CC26XXWARE) -I$(CONTIKI)/$(TI_CC26XXWARE_SRC) -CFLAGS += -I$(CONTIKI)/$(TI_CC26XXWARE)/inc +CFLAGS += -I$(TI_CC26XXWARE) -I$(CONTIKI)/$(TI_CC26XXWARE_SRC) +CFLAGS += -I$(TI_CC26XXWARE)/inc MODULES += $(TI_CC26XXWARE_SRC) LDSCRIPT = $(CONTIKI_CPU)/cc26xx.ld @@ -71,7 +62,7 @@ endif CLEAN += symbols.c symbols.h *.d *.elf *.hex ### CPU-dependent directories -CONTIKI_CPU_DIRS = . dev dev/rfc-api $(TI_CC26XXWARE_STARTUP) +CONTIKI_CPU_DIRS = . dev dev/rfc-api $(TI_CC26XXWARE_STARTUP_DIR) ### Use the existing debug I/O in cpu/arm/common CONTIKI_CPU_DIRS += ../arm/common/dbg-io From f680d5dcc5a07230c753908d204089c64ffd0c92 Mon Sep 17 00:00:00 2001 From: George Oikonomou Date: Fri, 8 May 2015 12:15:02 +0100 Subject: [PATCH 12/14] Do not fetch CC26xxware manually for travis tests --- .travis.yml | 7 ------- 1 file changed, 7 deletions(-) diff --git a/.travis.yml b/.travis.yml index 95c670a89..80b3529cc 100644 --- a/.travis.yml +++ b/.travis.yml @@ -49,13 +49,6 @@ before_script: arm-none-eabi-gcc --version ; fi - ## Download and extract cc26xxware - - if [ ${BUILD_ARCH:-0} = arm-aapcs ] ; then - wget http://www.ti.com/lit/sw/swrc296/swrc296.zip && - unzip swrc296.zip && - export TI_CC26XXWARE=cc26xxware_2_20_06_14829 ; - fi - ## Install RL78 GCC toolchain - sudo apt-get install libncurses5:i386 zlib1g:i386 - $WGET http://adamdunkels.github.io/contiki-fork/gnurl78-v13.02-elf_1-2_i386.deb && From 541688235c7e654e85118d6cf9bf6881ef5aeb6b Mon Sep 17 00:00:00 2001 From: George Oikonomou Date: Thu, 14 May 2015 14:52:50 +0100 Subject: [PATCH 13/14] Update the CC26xx README in terms of CC26xxware --- platform/srf06-cc26xx/README.md | 36 +++------------------------------ 1 file changed, 3 insertions(+), 33 deletions(-) diff --git a/platform/srf06-cc26xx/README.md b/platform/srf06-cc26xx/README.md index 811fc473f..4188c59fb 100644 --- a/platform/srf06-cc26xx/README.md +++ b/platform/srf06-cc26xx/README.md @@ -59,7 +59,8 @@ Requirements ============ To use the port you need: -* TI's CC26xxware sources (more below) +* TI's CC26xxware sources. The correct version will be installed automatically + as a submodule when you clone Contiki. * Software to program the nodes. Use TI's SmartRF Flash Programmer * A toolchain to build firmware: The port has been developed and tested with GNU Tools for ARM Embedded Processors . @@ -74,44 +75,13 @@ To use the port you need: operating system and so that you can use the chip's UART for I/O. Please read the section ["Drivers" in the CC2538DK readme](https://github.com/contiki-os/contiki/tree/master/platform/cc2538dk#drivers). -Environment -=========== -To use this port, you will need to download and extract CC26xxware sources. We -currently use CC26xxware version 2.20.06.14829. The download link can be found -here: http://processors.wiki.ti.com/index.php/CC26xxware - -Once you have done this, you will need to configure the Contiki build system so -that it can locate and compile them as part of the build process. - -To do this, you will need to set the following environment variable: - -* `TI_CC26XXWARE` - - Stores the path to a directory containing the following: - - * cc26xxware sources under `$(TI_CC26XXWARE)/driverlib` - * cc26xxware includes under `$(TI_CC26XXWARE)/inc` - * Startup files under `$(TI_CC26XXWARE)/startup_files` - -This _must_ be a path relative to the Contiki source directory. For -example, if Contiki is in `/home/user/contiki-2.x` and the CC26xxware is in -`/home/user/cc26xxware`, then `TI_CC26XXWARE` must be set to `../cc26xxware` - -The variable can be set within the example's Makefile, by adding this: - - TI_CC26XXWARE=../cc26xxware - -or you can use an environment variable, like so: - - export TI_CC26XXWARE=../cc26xxware - Filename conflicts between Contiki and CC26xxware ================================================= There is a file called `timer.c` both in Contiki as well as in CC26xxware. The way things are configured now, we don't use the latter. However, if you need to start using it at some point, you will need to rename it: -From `$(TI_CC26XXWARE)/driverlib/cc26xx/source/timer.c` to `driverlib-timer.c` +From `cpu/cc26xx/lib/cc26xxware/driverlib/timer.c` to `driverlib-timer.c` Sensortag vs Srf06 ================== From b861b8f2771e94e66d8eb880d5b8c025cf987782 Mon Sep 17 00:00:00 2001 From: George Oikonomou Date: Fri, 15 May 2015 12:16:20 +0100 Subject: [PATCH 14/14] Do not try to build cc26xxware documentation --- doc/Doxyfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/Doxyfile b/doc/Doxyfile index 7379f5c06..a9c714d73 100644 --- a/doc/Doxyfile +++ b/doc/Doxyfile @@ -807,7 +807,7 @@ EXCLUDE_SYMLINKS = NO # Note that the wildcards are matched against the file with absolute path, so to # exclude all test directories for example use the pattern */test/* -EXCLUDE_PATTERNS = +EXCLUDE_PATTERNS = */cpu/cc26xx/lib/* # The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names # (namespaces, classes, functions, etc.) that should be excluded from the