Skip to content

Commit 8557b24

Browse files
committed
Merge remote-tracking branch 'github/master'
2 parents 8aaa1b7 + 38eb79e commit 8557b24

File tree

15 files changed

+218
-4
lines changed

15 files changed

+218
-4
lines changed

libraries/mbed/api/InterruptIn.h

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ class InterruptIn {
167167
*
168168
* @returns
169169
* The function object created for 'fptr'
170-
*/
170+
*/
171171
pFunctionPointer_t fall_add(void (*fptr)(void)) {
172172
return fall_add_common(fptr);
173173
}
@@ -240,6 +240,14 @@ class InterruptIn {
240240
*/
241241
void mode(PinMode pull);
242242

243+
/** Enable IRQ
244+
*/
245+
void enable_irq();
246+
247+
/** Disable IRQ
248+
*/
249+
void disable_irq();
250+
243251
static void _irq_handler(uint32_t id, gpio_irq_event event);
244252

245253
protected:

libraries/mbed/common/InterruptIn.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,14 @@ void InterruptIn::_irq_handler(uint32_t id, gpio_irq_event event) {
9999
}
100100
}
101101

102+
void InterruptIn::enable_irq() {
103+
gpio_irq_enable(&gpio_irq);
104+
}
105+
106+
void InterruptIn::disable_irq() {
107+
gpio_irq_disable(&gpio_irq);
108+
}
109+
102110
#ifdef MBED_OPERATORS
103111
InterruptIn::operator int() {
104112
return read();

libraries/mbed/hal/gpio_irq_api.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ typedef void (*gpio_irq_handler)(uint32_t id, gpio_irq_event event);
3737
int gpio_irq_init(gpio_irq_t *obj, PinName pin, gpio_irq_handler handler, uint32_t id);
3838
void gpio_irq_free(gpio_irq_t *obj);
3939
void gpio_irq_set (gpio_irq_t *obj, gpio_irq_event event, uint32_t enable);
40+
void gpio_irq_enable(gpio_irq_t *obj);
41+
void gpio_irq_disable(gpio_irq_t *obj);
4042

4143
#ifdef __cplusplus
4244
}

libraries/mbed/targets/hal/TARGET_Freescale/TARGET_KL05Z/gpio_irq_api.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,3 +154,19 @@ void gpio_irq_set(gpio_irq_t *obj, gpio_irq_event event, uint32_t enable) {
154154
// Interrupt configuration and clear interrupt
155155
port->PCR[obj->pin] = (port->PCR[obj->pin] & ~PORT_PCR_IRQC_MASK) | irq_settings | PORT_PCR_ISF_MASK;
156156
}
157+
158+
void gpio_irq_enable(gpio_irq_t *obj) {
159+
if (obj->port == PortA) {
160+
NVIC_EnableIRQ(PORTA_IRQn);
161+
} else if (obj->port == PortB) {
162+
NVIC_EnableIRQ(PORTB_IRQn);
163+
}
164+
}
165+
166+
void gpio_irq_disable(gpio_irq_t *obj) {
167+
if (obj->port == PortA) {
168+
NVIC_DisableIRQ(PORTA_IRQn);
169+
} else if (obj->port == PortB) {
170+
NVIC_DisableIRQ(PORTB_IRQn);
171+
}
172+
}

libraries/mbed/targets/hal/TARGET_Freescale/TARGET_KL25Z/gpio_irq_api.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,3 +143,19 @@ void gpio_irq_set(gpio_irq_t *obj, gpio_irq_event event, uint32_t enable) {
143143
// Interrupt configuration and clear interrupt
144144
port->PCR[obj->pin] = (port->PCR[obj->pin] & ~PORT_PCR_IRQC_MASK) | irq_settings | PORT_PCR_ISF_MASK;
145145
}
146+
147+
void gpio_irq_enable(gpio_irq_t *obj) {
148+
if (obj->port == PortA) {
149+
NVIC_EnableIRQ(PORTA_IRQn);
150+
} else if (obj->port == PortD) {
151+
NVIC_EnableIRQ(PORTD_IRQn);
152+
}
153+
}
154+
155+
void gpio_irq_disable(gpio_irq_t *obj) {
156+
if (obj->port == PortA) {
157+
NVIC_DisableIRQ(PORTA_IRQn);
158+
} else if (obj->port == PortD) {
159+
NVIC_DisableIRQ(PORTD_IRQn);
160+
}
161+
}

libraries/mbed/targets/hal/TARGET_Freescale/TARGET_KL46Z/gpio_irq_api.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,3 +143,19 @@ void gpio_irq_set(gpio_irq_t *obj, gpio_irq_event event, uint32_t enable) {
143143
// Interrupt configuration and clear interrupt
144144
port->PCR[obj->pin] = (port->PCR[obj->pin] & ~PORT_PCR_IRQC_MASK) | irq_settings | PORT_PCR_ISF_MASK;
145145
}
146+
147+
void gpio_irq_enable(gpio_irq_t *obj) {
148+
if (obj->port == PortA) {
149+
NVIC_EnableIRQ(PORTA_IRQn);
150+
} else if (obj->port == PortD) {
151+
NVIC_EnableIRQ(PORTD_IRQn);
152+
}
153+
}
154+
155+
void gpio_irq_disable(gpio_irq_t *obj) {
156+
if (obj->port == PortA) {
157+
NVIC_DisableIRQ(PORTA_IRQn);
158+
} else if (obj->port == PortD) {
159+
NVIC_DisableIRQ(PORTD_IRQn);
160+
}
161+
}

libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC11UXX/gpio_irq_api.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,3 +131,11 @@ void gpio_irq_set(gpio_irq_t *obj, gpio_irq_event event, uint32_t enable) {
131131
}
132132
}
133133
}
134+
135+
void gpio_irq_enable(gpio_irq_t *obj) {
136+
NVIC_EnableIRQ((IRQn_Type)(PININT_IRQ + obj->ch));
137+
}
138+
139+
void gpio_irq_disable(gpio_irq_t *obj) {
140+
NVIC_DisableIRQ((IRQn_Type)(PININT_IRQ + obj->ch));
141+
}

libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC11XX_11CXX/gpio_irq_api.c

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,3 +174,43 @@ void gpio_irq_set(gpio_irq_t *obj, gpio_irq_event event, uint32_t enable) {
174174
}
175175

176176
}
177+
178+
void gpio_irq_enable(gpio_irq_t *obj) {
179+
uint32_t port_num = ((obj->pin & 0xF000) >> PORT_SHIFT);
180+
switch (port_num) {
181+
case 0:
182+
NVIC_EnableIRQ(EINT0_IRQn);
183+
break;
184+
case 1:
185+
NVIC_EnableIRQ(EINT1_IRQn);
186+
break;
187+
case 2:
188+
NVIC_EnableIRQ(EINT2_IRQn);
189+
break;
190+
case 3:
191+
NVIC_EnableIRQ(EINT3_IRQn);
192+
break;
193+
default:
194+
break;
195+
}
196+
}
197+
198+
void gpio_irq_disable(gpio_irq_t *obj) {
199+
uint32_t port_num = ((obj->pin & 0xF000) >> PORT_SHIFT);
200+
switch (port_num) {
201+
case 0:
202+
NVIC_DisableIRQ(EINT0_IRQn);
203+
break;
204+
case 1:
205+
NVIC_DisableIRQ(EINT1_IRQn);
206+
break;
207+
case 2:
208+
NVIC_DisableIRQ(EINT2_IRQn);
209+
break;
210+
case 3:
211+
NVIC_DisableIRQ(EINT3_IRQn);
212+
break;
213+
default:
214+
break;
215+
}
216+
}

libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC13XX/gpio_irq_api.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,3 +131,12 @@ void gpio_irq_set(gpio_irq_t *obj, gpio_irq_event event, uint32_t enable) {
131131
}
132132
}
133133
}
134+
135+
void gpio_irq_enable(gpio_irq_t *obj) {
136+
NVIC_EnableIRQ((IRQn_Type)(PININT_IRQ + obj->ch));
137+
}
138+
139+
void gpio_irq_disable(gpio_irq_t *obj) {
140+
NVIC_DisableIRQ((IRQn_Type)(PININT_IRQ + obj->ch));
141+
}
142+

libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC176X/gpio_irq_api.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,3 +150,12 @@ void gpio_irq_set(gpio_irq_t *obj, gpio_irq_event event, uint32_t enable) {
150150
}
151151
}
152152
}
153+
154+
void gpio_irq_enable(gpio_irq_t *obj) {
155+
NVIC_EnableIRQ(EINT3_IRQn);
156+
}
157+
158+
void gpio_irq_disable(gpio_irq_t *obj) {
159+
NVIC_DisableIRQ(EINT3_IRQn);
160+
}
161+

libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC23XX/gpio_irq_api.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,3 +143,12 @@ void gpio_irq_set(gpio_irq_t *obj, gpio_irq_event event, uint32_t enable) {
143143
}
144144
}
145145
}
146+
147+
void gpio_irq_enable(gpio_irq_t *obj) {
148+
NVIC_EnableIRQ(EINT3_IRQn);
149+
}
150+
151+
void gpio_irq_disable(gpio_irq_t *obj) {
152+
NVIC_DisableIRQ(EINT3_IRQn);
153+
}
154+

libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC408X/gpio_irq_api.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,3 +164,11 @@ void gpio_irq_set(gpio_irq_t *obj, gpio_irq_event event, uint32_t enable) {
164164
}
165165
}
166166
}
167+
168+
void gpio_irq_enable(gpio_irq_t *obj) {
169+
NVIC_EnableIRQ(GPIO_IRQn);
170+
}
171+
172+
void gpio_irq_disable(gpio_irq_t *obj) {
173+
NVIC_DisableIRQ(GPIO_IRQn);
174+
}

libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC43XX/gpio_irq_api.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,3 +134,19 @@ void gpio_irq_set(gpio_irq_t *obj, gpio_irq_event event, uint32_t enable) {
134134
}
135135
}
136136
}
137+
138+
void gpio_irq_enable(gpio_irq_t *obj) {
139+
#if !defined(CORE_M0)
140+
NVIC_EnableIRQ((IRQn_Type)(PIN_INT0_IRQn + obj->ch));
141+
#else
142+
NVIC_EnableIRQ((IRQn_Type)(PIN_INT4_IRQn + obj->ch));
143+
#endif
144+
}
145+
146+
void gpio_irq_disable(gpio_irq_t *obj) {
147+
#if !defined(CORE_M0)
148+
NVIC_DisableIRQ((IRQn_Type)(PIN_INT0_IRQn + obj->ch));
149+
#else
150+
NVIC_DisableIRQ((IRQn_Type)(PIN_INT4_IRQn + obj->ch));
151+
#endif
152+
}

libraries/mbed/targets/hal/TARGET_NXP/TARGET_LPC81X/TARGET_LPC81X_COMMON/gpio_irq_api.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,3 +125,11 @@ void gpio_irq_set(gpio_irq_t *obj, gpio_irq_event event, uint32_t enable) {
125125
}
126126
}
127127
}
128+
129+
void gpio_irq_enable(gpio_irq_t *obj) {
130+
NVIC_EnableIRQ((IRQn_Type)(PININT_IRQ + obj->ch));
131+
}
132+
133+
void gpio_irq_disable(gpio_irq_t *obj) {
134+
NVIC_DisableIRQ((IRQn_Type)(PININT_IRQ + obj->ch));
135+
}

workspace_tools/make.py

Lines changed: 44 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
if __name__ == '__main__':
4343
# Parse Options
4444
parser = get_default_options_parser()
45-
parser.add_option("-p", type="int", dest="program",
45+
parser.add_option("-p", type="int", dest="program", default=-1,
4646
help="The index of the desired test program: [0-%d]" % (len(TESTS)-1))
4747
parser.add_option("-n", dest="program_name",
4848
help="The name of the desired test program")
@@ -52,6 +52,22 @@
5252
help="Add a macro definition")
5353

5454
# Local run
55+
parser.add_option("--automated", action="store_true", dest="automated",
56+
default=False, help="Automated test")
57+
parser.add_option("--host", dest="host_test",
58+
default=None, help="Host test")
59+
parser.add_option("--extra", dest="extra",
60+
default=None, help="Extra files")
61+
parser.add_option("--peripherals", dest="peripherals",
62+
default=None, help="Required peripherals")
63+
parser.add_option("--dep", dest="dependencies",
64+
default=None, help="Dependencies")
65+
parser.add_option("--source", dest="source_dir",
66+
default=None, help="The source (input) directory")
67+
parser.add_option("--duration", type="int", dest="duration",
68+
default=None, help="Duration of the test")
69+
parser.add_option("--build", dest="build_dir",
70+
default=None, help="The build (output) directory")
5571
parser.add_option("-d", "--disk", dest="disk",
5672
default=None, help="The mbed disk")
5773
parser.add_option("-s", "--serial", dest="serial",
@@ -69,9 +85,15 @@
6985
default=None, help="use the specified linker script")
7086

7187
(options, args) = parser.parse_args()
72-
88+
89+
# force program to "0" if a source dir is specified
90+
if options.source_dir is not None:
91+
p = 0
92+
n = None
93+
else:
7394
# Program Number or name
74-
p, n = options.program, options.program_name
95+
p, n = options.program, options.program_name
96+
7597
if n is not None and p is not None:
7698
args_error(parser, "[ERROR] specify either '-n' or '-p', not both")
7799
if n:
@@ -101,6 +123,19 @@
101123

102124
# Test
103125
test = Test(p)
126+
if options.automated is not None:
127+
test.automated = options.automated
128+
if options.dependencies is not None:
129+
test.dependencies = options.dependencies
130+
if options.host_test is not None:
131+
test.host_test = options.host_test;
132+
if options.peripherals is not None:
133+
test.peripherals = options.peripherals;
134+
if options.duration is not None:
135+
test.duration = options.duration;
136+
if options.extra is not None:
137+
test.extra_files = options.extra
138+
104139
if not test.is_supported(mcu, toolchain):
105140
print 'The selected test is not supported on target %s with toolchain %s' % (mcu, toolchain)
106141
sys.exit()
@@ -110,6 +145,12 @@
110145
test.dependencies.append(RTOS_LIBRARIES)
111146

112147
build_dir = join(BUILD_DIR, "test", mcu, toolchain, test.id)
148+
if options.source_dir is not None:
149+
test.source_dir = options.source_dir
150+
build_dir = options.source_dir
151+
152+
if options.build_dir is not None:
153+
build_dir = options.build_dir
113154

114155
target = TARGET_MAP[mcu]
115156
try:

0 commit comments

Comments
 (0)