Skip to content

Commit 7338280

Browse files
authored
Merge pull request #3318 from radhika-raghavendran/master
Register map changes for RevG
2 parents bd499da + 3d23ec0 commit 7338280

File tree

6 files changed

+30
-27
lines changed

6 files changed

+30
-27
lines changed

targets/TARGET_ONSEMI/TARGET_NCS36510/aes_map.h

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,18 +67,19 @@ typedef struct {
6767
__I uint32_t CBCo3; /**< Bits[127:96] of the 128-bit CBC result */
6868
union {
6969
struct {
70-
__O uint32_t START:1; /**< start the encryption : 0 = no-effect , 1 = enable */
71-
__O uint32_t ACC_CLR:1; /**< Clear the CBC accumulator : 0 = no-effect 1 = clears the CBC accumulator */
72-
__O uint32_t INT_CLEAR:1; /**< interrupt clear : 0 = no-effect 1 = clear the interrupt */
73-
__O uint32_t KEY_LENGTH:1; /**< Key Length: 0 = 128 Bit Encryption 1 = 256 Bit Encryption */
70+
__IO uint32_t START:1; /**< start the encryption : 0 = no-effect , 1 = enable */
71+
__IO uint32_t ACC_CLR:1; /**< Clear the CBC accumulator : 0 = no-effect 1 = clears the CBC accumulator */
72+
__IO uint32_t INT_CLEAR:1; /**< interrupt clear : 0 = no-effect 1 = clear the interrupt */
7473
} BITS;
75-
__O uint32_t WORD;
74+
__IO uint32_t WORD;
7675
} CTL;
7776
union {
7877
struct {
7978
__IO uint32_t CBC_MODE:1; /**< counter mode : 0 = counter mode , 1 = CBC mode */
8079
__IO uint32_t BYPASS:1; /**< encryption : 0 = Normal Mode , 1 = Bypasss any encryption */
8180
__IO uint32_t INT_EN:1; /**< interrupt mask : 0 = disabled 1 = enabled */
81+
__IO uint32_t KEY_LENGTH:1; /**< Key Length: 0 = 128 Bit Encryption 1 = 256 Bit Encryption */
82+
8283
} BITS;
8384
__IO uint32_t WORD;
8485
} MODE;

targets/TARGET_ONSEMI/TARGET_NCS36510/analogin_api.c

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,8 @@ void analogin_init(analogin_t *obj, PinName pin)
6464
obj->adcReg = (AdcReg_pt)adc;
6565
obj->pin = pin;
6666
obj->pinFlag = 1;
67-
67+
obj->ADC_Offset_Value = TRIMREG->ADC_OFFSET_TRIM;
68+
6869
switch (pin) {
6970
case A0:
7071
adc_pin=0;
@@ -183,7 +184,14 @@ uint16_t analogin_read_u16(analogin_t *obj)
183184
while((uint32_t)(obj->adcReg->STATUS)!=(uint32_t)1) {
184185
}
185186
adcData =(uint16_t)(obj->adcReg->DATA);
186-
CLOCK_DISABLE(CLOCK_ADC);
187+
188+
/* Offset the ADC data with trim value */
189+
if (obj->ADC_Offset_Value != 0xFFFFFFFF) {
190+
191+
if(adcData >= obj->ADC_Offset_Value) {
192+
adcData -= obj->ADC_Offset_Value;
193+
}
194+
}
187195

188196
return(adcData);
189197
}

targets/TARGET_ONSEMI/TARGET_NCS36510/ncs36510Init.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
#include "ncs36510Init.h"
3838

3939
void fPmuInit(void);
40-
uint32_t ADC_Trim_Offset;
40+
4141
/**
4242
* @brief
4343
* Hardware trimming function
@@ -94,8 +94,6 @@ boolean fTrim()
9494
RFANATRIMREG->TX_VCO_TRIM_LUT1 = TRIMREG->TX_VCO_LUT1.WORD;;
9595
RFANATRIMREG->TX_VCO_TRIM_LUT2 = TRIMREG->TX_VCO_LUT2.WORD;;
9696

97-
ADC_Trim_Offset = TRIMREG->ADC_OFFSET_TRIM;
98-
9997
status = True;
10098

10199
} else {

targets/TARGET_ONSEMI/TARGET_NCS36510/objects.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ struct analogin_s {
111111
AdcReg_pt adcReg;
112112
PinName pin;
113113
uint8_t pinFlag;
114+
uint32_t ADC_Offset_Value;
114115
};
115116

116117
struct pwmout_s {

targets/TARGET_ONSEMI/TARGET_NCS36510/pwm_map.h

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -45,24 +45,19 @@
4545

4646
/** Power management Control HW Structure Overlay */
4747
typedef struct {
48-
__IO uint32_t DUTYCYCLE;
49-
union {
50-
struct {
51-
__O uint32_t ENABLE :8; /**< Write any value to enable PWM output */
52-
__I uint32_t PAD :1; /** < Pad */
53-
__I uint32_t ENABLE_STATE :1; /**< Current state of pwmEnable configuration bit. ‘1’ PWM output is enabled. ‘0’ PWN output is disabled. */
54-
__I uint32_t OUTPUT_STATE :1; /**< Current state of PWM output */
55-
} BITS;
56-
__IO uint32_t WORD;
57-
} PWM_ENABLE;
48+
__O uint32_t DUTYCYCLE;
49+
__O uint32_t PWM_ENABLE;
5850
__O uint32_t PWM_DISABLE;
51+
__O uint32_t PRESCALE_ENABLE;
52+
__O uint32_t PRESCALE_DISABLE;
5953
union {
6054
struct {
61-
__O uint32_t ENABLE :8; /**< Write any value to select enable the 4-bit prescaler */
62-
__I uint32_t STATE:1; /**< Current state of the prescaler. ‘1’ the prescaler is enabled. ‘0’ the prescaler is disabled. */
55+
__I uint32_t CUR_DUTY_CYCLE_VALUE : 8; /** Curent value of duty Cycle */
56+
__I uint32_t CUR_PRE_SCALER_STATE : 1; /** Current state of the prescaler. ‘1’ the prescaler is enabled. ‘0’ the prescaler is disabled. */
57+
__I uint32_t CUR_PWM_ENABLE_STATE : 1; /** Current state of the PWM. ‘1’ the PWM is enabled. ‘0’ the PWM is disabled. */
58+
__I uint32_t CUR_PWM_OUTPUT_STATE : 1; /** Current state of PWM output */
6359
} BITS;
64-
__IO uint32_t WORD;
65-
} PRESCALE_ENABLE;
66-
__O uint32_t PRESCALE_DISABLE;
60+
__I uint32_t WORD;
61+
} READ_CONFIG_STATUS;
6762
} PwmReg_t, *PwmReg_pt;
6863
#endif /* PWM_MAP_H_ */

targets/TARGET_ONSEMI/TARGET_NCS36510/pwmout_api.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ void pwmout_init(pwmout_t *obj, PinName pin)
6161
obj->pwmReg->DUTYCYCLE = 0x80;
6262

6363
/* Write the PWM output enable register 0x4000B004, to 1 */
64-
obj->pwmReg->PWM_ENABLE.WORD = 0x1;
64+
obj->pwmReg->PWM_ENABLE = 0x1;
6565

6666
obj->pwmReg->PRESCALE_DISABLE = 0x1;
6767

@@ -190,7 +190,7 @@ void pwmout_pulsewidth_us(pwmout_t *obj, int us)
190190
}
191191
/* If pulsewidth is less than 128uSec, set the prescaler to 4096
192192
* by enabling prescale register 0x4000B00C to 1 */
193-
obj->pwmReg->PRESCALE_ENABLE.WORD = 0x1;
193+
obj->pwmReg->PRESCALE_ENABLE = 0x1;
194194

195195
/* Calculate the duty cycle based on the width of the pulse */
196196
/* ((255 * us) / 128) + 1 = duty cycle */

0 commit comments

Comments
 (0)