Skip to content

Commit ce580dd

Browse files
committed
Fixed issues raised in the feedback from ARM for the ADuCM4050 platform.
1 parent 00b1e72 commit ce580dd

File tree

4 files changed

+18
-58
lines changed

4 files changed

+18
-58
lines changed

targets/TARGET_Analog_Devices/TARGET_ADUCM4X50/TARGET_ADUCM4050/TARGET_EV_COG_AD4050LZ/device/startup_ADuCM4050.c

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -65,18 +65,6 @@ const uint32_t SECTION_PLACE(blank_checksum[],".checksum") =
6565
BLANKX60,BLANKX600
6666
};
6767

68-
/*----------------------------------------------------------------------------
69-
A relocated IVT is requested. Provision for IVT relocation
70-
to RAM during startup. This allows for dynamic interrupt
71-
vector patching required by RTOS. Places the relocated IVT
72-
at the start of RAM. We need (72 + 15 + 1)*4 = 352 bytes,
73-
which address 0x20000000.
74-
*----------------------------------------------------------------------------*/
75-
#ifdef __ICCARM__
76-
void (*__Relocated___Vectors[NVIC_NUM_VECTORS])(void) @(NVIC_RAM_VECTOR_ADDRESS);
77-
#else
78-
void (*__Relocated___Vectors[NVIC_NUM_VECTORS])(void) __attribute__((at(NVIC_RAM_VECTOR_ADDRESS)));
79-
#endif /* __ICCARM__ */
8068

8169
/*----------------------------------------------------------------------------
8270
External function Declaration

targets/TARGET_Analog_Devices/TARGET_ADUCM4X50/TARGET_ADUCM4050/api/analogin_api.c

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,6 @@
4747
#include "pinmap.h"
4848
#include "PeripheralPins.h"
4949

50-
/** Analogin hal structure. analogin_s is declared in the target's hal
51-
*/
52-
typedef struct analogin_s analogin_t;
53-
5450
#ifdef __cplusplus
5551
extern "C" {
5652
#endif
@@ -99,36 +95,36 @@ void analogin_init(analogin_t *obj, PinName pin)
9995
obj->UserBuffer.nChannels = channel;
10096

10197
/* Open the ADC device */
102-
adi_adc_Open(ADC_DEV_NUM, DeviceMemory, sizeof(DeviceMemory),&hDevice);
98+
adi_adc_Open(ADC_DEV_NUM, DeviceMemory, sizeof(DeviceMemory), &hDevice);
10399
obj->hDevice = hDevice;
104100

105101
/* Power up ADC */
106102
adi_adc_PowerUp (hDevice, true);
107103

108104
/* Set ADC reference */
109-
adi_adc_SetVrefSource (hDevice, ADI_ADC_VREF_SRC_INT_2_50_V);
105+
adi_adc_SetVrefSource(hDevice, ADI_ADC_VREF_SRC_INT_2_50_V);
110106

111107
/* Enable ADC sub system */
112-
adi_adc_EnableADCSubSystem (hDevice, true);
108+
adi_adc_EnableADCSubSystem(hDevice, true);
113109

114110
/* Wait untilthe ADC is ready for sampling */
115111
while(bReady == false) {
116-
adi_adc_IsReady (hDevice, &bReady);
112+
adi_adc_IsReady(hDevice, &bReady);
117113
}
118114

119115
/* Start calibration */
120116
adi_adc_StartCalibration (hDevice);
121117

122118
/* Wait until calibration is done */
123119
while (!bCalibrationDone) {
124-
adi_adc_IsCalibrationDone (hDevice, &bCalibrationDone);
120+
adi_adc_IsCalibrationDone(hDevice, &bCalibrationDone);
125121
}
126122

127123
/* Set the delay time */
128-
adi_adc_SetDelayTime ( hDevice, obj->DelayCycles);
124+
adi_adc_SetDelayTime(hDevice, obj->DelayCycles);
129125

130126
/* Set the acquisition time. (Application need to change it based on the impedence) */
131-
adi_adc_SetAcquisitionTime ( hDevice, obj->SampleCycles);
127+
adi_adc_SetAcquisitionTime(hDevice, obj->SampleCycles);
132128

133129
}
134130

@@ -155,15 +151,15 @@ uint16_t analogin_read_u16(analogin_t *obj)
155151
ADI_ADC_BUFFER *pAdcBuffer;
156152

157153
/* Submit the buffer to the driver */
158-
adi_adc_SubmitBuffer (hDevice, &obj->UserBuffer);
154+
adi_adc_SubmitBuffer(hDevice, &obj->UserBuffer);
159155

160156
/* Enable the ADC */
161-
adi_adc_Enable (hDevice, true);
157+
adi_adc_Enable(hDevice, true);
162158

163-
adi_adc_GetBuffer (hDevice, &pAdcBuffer);
159+
adi_adc_GetBuffer(hDevice, &pAdcBuffer);
164160
MBED_ASSERT(pAdcBuffer == &obj->UserBuffer);
165161

166-
return( (uint16_t) ( ((uint16_t *)pAdcBuffer->pDataBuffer)[(pAdcBuffer->nNumConversionPasses) - 1]) );
162+
return( (uint16_t)( ((uint16_t *)pAdcBuffer->pDataBuffer)[(pAdcBuffer->nNumConversionPasses) - 1]) );
167163
}
168164

169165
/* Retrieve te active channel correspondoing to the input pin */

targets/TARGET_Analog_Devices/TARGET_ADUCM4X50/TARGET_ADUCM4050/api/us_ticker.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -171,23 +171,23 @@ static void calc_event_counts(uint32_t timestamp)
171171
uint64_t aa;
172172

173173
calc_time = get_current_time();
174-
offset = timestamp - calc_time; // offset in useconds
174+
offset = timestamp - calc_time; // offset in useconds
175175

176-
if (offset > 0xf0000000u) // if offset is a really big number, assume that timer has already expired (i.e. negative)
176+
if (offset > 0xf0000000u) // if offset is a really big number, assume that timer has already expired (i.e. negative)
177177
offset = 0u;
178178

179-
if (offset > 10u) { // it takes 10us to user timer routine after interrupt. Offset timer to account for that.
179+
if (offset > 10u) { // it takes 10us to user timer routine after interrupt. Offset timer to account for that.
180180
offset -= 10u;
181181
} else
182182
offset = 0u;
183183

184184
aa = (uint64_t) offset;
185-
aa *= 26u; // convert from 1MHz to 26MHz clock. todo scale for other clock freqs
185+
aa *= 26u; // convert from 1MHz to 26MHz clock. todo scale for other clock freqs
186186

187187
blocks = aa >> 7;
188-
blocks++; // round
188+
blocks++; // round
189189

190-
largecnt = blocks>>1; // communicate to event_timer() routine
190+
largecnt = blocks>>1; // communicate to event_timer() routine
191191
}
192192

193193
static void event_timer()

targets/TARGET_Analog_Devices/mbed_rtx.h

Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -17,35 +17,11 @@
1717
#ifndef MBED_MBED_RTX_H
1818
#define MBED_MBED_RTX_H
1919

20-
#if defined(TARGET_EV_COG_AD3029LZ)
21-
22-
#ifndef INITIAL_SP
23-
#define INITIAL_SP (0x20004000UL)
24-
#endif
25-
#ifndef OS_TASKCNT
26-
#define OS_TASKCNT 6
27-
#endif
28-
#ifndef OS_MAINSTKSIZE
29-
#define OS_MAINSTKSIZE 112
30-
#endif
31-
#ifndef OS_CLOCK
32-
#define OS_CLOCK 26000000
33-
#endif
34-
#ifndef MBED_CONF_APP_THREAD_STACK_SIZE
35-
#define MBED_CONF_APP_THREAD_STACK_SIZE 1024
36-
#endif
37-
38-
#elif defined(TARGET_EV_COG_AD4050LZ)
20+
#if defined(TARGET_EV_COG_AD4050LZ)
3921

4022
#ifndef INITIAL_SP
4123
#define INITIAL_SP (0x20048000UL)
4224
#endif
43-
#ifndef OS_TASKCNT
44-
#define OS_TASKCNT 6
45-
#endif
46-
#ifndef OS_MAINSTKSIZE
47-
#define OS_MAINSTKSIZE 112
48-
#endif
4925
#ifndef OS_CLOCK
5026
#define OS_CLOCK 26000000
5127
#endif

0 commit comments

Comments
 (0)