mirror of https://github.com/ARMmbed/mbed-os.git
Fixed issues raised in the feedback from ARM for the ADuCM4050 platform.
parent
00b1e72e49
commit
ce580dde74
|
@ -65,18 +65,6 @@ const uint32_t SECTION_PLACE(blank_checksum[],".checksum") =
|
|||
BLANKX60,BLANKX600
|
||||
};
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
A relocated IVT is requested. Provision for IVT relocation
|
||||
to RAM during startup. This allows for dynamic interrupt
|
||||
vector patching required by RTOS. Places the relocated IVT
|
||||
at the start of RAM. We need (72 + 15 + 1)*4 = 352 bytes,
|
||||
which address 0x20000000.
|
||||
*----------------------------------------------------------------------------*/
|
||||
#ifdef __ICCARM__
|
||||
void (*__Relocated___Vectors[NVIC_NUM_VECTORS])(void) @(NVIC_RAM_VECTOR_ADDRESS);
|
||||
#else
|
||||
void (*__Relocated___Vectors[NVIC_NUM_VECTORS])(void) __attribute__((at(NVIC_RAM_VECTOR_ADDRESS)));
|
||||
#endif /* __ICCARM__ */
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
External function Declaration
|
||||
|
|
|
@ -47,10 +47,6 @@
|
|||
#include "pinmap.h"
|
||||
#include "PeripheralPins.h"
|
||||
|
||||
/** Analogin hal structure. analogin_s is declared in the target's hal
|
||||
*/
|
||||
typedef struct analogin_s analogin_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
@ -99,21 +95,21 @@ void analogin_init(analogin_t *obj, PinName pin)
|
|||
obj->UserBuffer.nChannels = channel;
|
||||
|
||||
/* Open the ADC device */
|
||||
adi_adc_Open(ADC_DEV_NUM, DeviceMemory, sizeof(DeviceMemory),&hDevice);
|
||||
adi_adc_Open(ADC_DEV_NUM, DeviceMemory, sizeof(DeviceMemory), &hDevice);
|
||||
obj->hDevice = hDevice;
|
||||
|
||||
/* Power up ADC */
|
||||
adi_adc_PowerUp (hDevice, true);
|
||||
|
||||
/* Set ADC reference */
|
||||
adi_adc_SetVrefSource (hDevice, ADI_ADC_VREF_SRC_INT_2_50_V);
|
||||
adi_adc_SetVrefSource(hDevice, ADI_ADC_VREF_SRC_INT_2_50_V);
|
||||
|
||||
/* Enable ADC sub system */
|
||||
adi_adc_EnableADCSubSystem (hDevice, true);
|
||||
adi_adc_EnableADCSubSystem(hDevice, true);
|
||||
|
||||
/* Wait untilthe ADC is ready for sampling */
|
||||
while(bReady == false) {
|
||||
adi_adc_IsReady (hDevice, &bReady);
|
||||
adi_adc_IsReady(hDevice, &bReady);
|
||||
}
|
||||
|
||||
/* Start calibration */
|
||||
|
@ -121,14 +117,14 @@ void analogin_init(analogin_t *obj, PinName pin)
|
|||
|
||||
/* Wait until calibration is done */
|
||||
while (!bCalibrationDone) {
|
||||
adi_adc_IsCalibrationDone (hDevice, &bCalibrationDone);
|
||||
adi_adc_IsCalibrationDone(hDevice, &bCalibrationDone);
|
||||
}
|
||||
|
||||
/* Set the delay time */
|
||||
adi_adc_SetDelayTime ( hDevice, obj->DelayCycles);
|
||||
adi_adc_SetDelayTime(hDevice, obj->DelayCycles);
|
||||
|
||||
/* Set the acquisition time. (Application need to change it based on the impedence) */
|
||||
adi_adc_SetAcquisitionTime ( hDevice, obj->SampleCycles);
|
||||
adi_adc_SetAcquisitionTime(hDevice, obj->SampleCycles);
|
||||
|
||||
}
|
||||
|
||||
|
@ -155,15 +151,15 @@ uint16_t analogin_read_u16(analogin_t *obj)
|
|||
ADI_ADC_BUFFER *pAdcBuffer;
|
||||
|
||||
/* Submit the buffer to the driver */
|
||||
adi_adc_SubmitBuffer (hDevice, &obj->UserBuffer);
|
||||
adi_adc_SubmitBuffer(hDevice, &obj->UserBuffer);
|
||||
|
||||
/* Enable the ADC */
|
||||
adi_adc_Enable (hDevice, true);
|
||||
adi_adc_Enable(hDevice, true);
|
||||
|
||||
adi_adc_GetBuffer (hDevice, &pAdcBuffer);
|
||||
adi_adc_GetBuffer(hDevice, &pAdcBuffer);
|
||||
MBED_ASSERT(pAdcBuffer == &obj->UserBuffer);
|
||||
|
||||
return( (uint16_t) ( ((uint16_t *)pAdcBuffer->pDataBuffer)[(pAdcBuffer->nNumConversionPasses) - 1]) );
|
||||
return( (uint16_t)( ((uint16_t *)pAdcBuffer->pDataBuffer)[(pAdcBuffer->nNumConversionPasses) - 1]) );
|
||||
}
|
||||
|
||||
/* Retrieve te active channel correspondoing to the input pin */
|
||||
|
|
|
@ -171,23 +171,23 @@ static void calc_event_counts(uint32_t timestamp)
|
|||
uint64_t aa;
|
||||
|
||||
calc_time = get_current_time();
|
||||
offset = timestamp - calc_time; // offset in useconds
|
||||
offset = timestamp - calc_time; // offset in useconds
|
||||
|
||||
if (offset > 0xf0000000u) // if offset is a really big number, assume that timer has already expired (i.e. negative)
|
||||
if (offset > 0xf0000000u) // if offset is a really big number, assume that timer has already expired (i.e. negative)
|
||||
offset = 0u;
|
||||
|
||||
if (offset > 10u) { // it takes 10us to user timer routine after interrupt. Offset timer to account for that.
|
||||
if (offset > 10u) { // it takes 10us to user timer routine after interrupt. Offset timer to account for that.
|
||||
offset -= 10u;
|
||||
} else
|
||||
offset = 0u;
|
||||
|
||||
aa = (uint64_t) offset;
|
||||
aa *= 26u; // convert from 1MHz to 26MHz clock. todo scale for other clock freqs
|
||||
aa *= 26u; // convert from 1MHz to 26MHz clock. todo scale for other clock freqs
|
||||
|
||||
blocks = aa >> 7;
|
||||
blocks++; // round
|
||||
blocks++; // round
|
||||
|
||||
largecnt = blocks>>1; // communicate to event_timer() routine
|
||||
largecnt = blocks>>1; // communicate to event_timer() routine
|
||||
}
|
||||
|
||||
static void event_timer()
|
||||
|
|
|
@ -17,35 +17,11 @@
|
|||
#ifndef MBED_MBED_RTX_H
|
||||
#define MBED_MBED_RTX_H
|
||||
|
||||
#if defined(TARGET_EV_COG_AD3029LZ)
|
||||
|
||||
#ifndef INITIAL_SP
|
||||
#define INITIAL_SP (0x20004000UL)
|
||||
#endif
|
||||
#ifndef OS_TASKCNT
|
||||
#define OS_TASKCNT 6
|
||||
#endif
|
||||
#ifndef OS_MAINSTKSIZE
|
||||
#define OS_MAINSTKSIZE 112
|
||||
#endif
|
||||
#ifndef OS_CLOCK
|
||||
#define OS_CLOCK 26000000
|
||||
#endif
|
||||
#ifndef MBED_CONF_APP_THREAD_STACK_SIZE
|
||||
#define MBED_CONF_APP_THREAD_STACK_SIZE 1024
|
||||
#endif
|
||||
|
||||
#elif defined(TARGET_EV_COG_AD4050LZ)
|
||||
#if defined(TARGET_EV_COG_AD4050LZ)
|
||||
|
||||
#ifndef INITIAL_SP
|
||||
#define INITIAL_SP (0x20048000UL)
|
||||
#endif
|
||||
#ifndef OS_TASKCNT
|
||||
#define OS_TASKCNT 6
|
||||
#endif
|
||||
#ifndef OS_MAINSTKSIZE
|
||||
#define OS_MAINSTKSIZE 112
|
||||
#endif
|
||||
#ifndef OS_CLOCK
|
||||
#define OS_CLOCK 26000000
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue