Skip to content

Commit bf426b0

Browse files
committed
[NUC472/M453/M487/NANO130] Remove dead power-down code with mbed OS 3
These power-down code are stale and would be superseded by sleep manager.
1 parent 4040211 commit bf426b0

File tree

20 files changed

+0
-354
lines changed

20 files changed

+0
-354
lines changed

targets/TARGET_NUVOTON/TARGET_M451/TARGET_NUMAKER_PFM_M453/objects.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -117,10 +117,6 @@ struct pwmout_s {
117117
uint32_t pulsewidth_us;
118118
};
119119

120-
struct sleep_s {
121-
int powerdown;
122-
};
123-
124120
struct can_s {
125121
CANName can;
126122
char index;

targets/TARGET_NUVOTON/TARGET_M451/i2c_api.c

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -339,25 +339,6 @@ static int i2c_set_int(i2c_t *obj, int inten)
339339
return inten_back;
340340
}
341341

342-
int i2c_allow_powerdown(void)
343-
{
344-
uint32_t modinit_mask = i2c_modinit_mask;
345-
while (modinit_mask) {
346-
int i2c_idx = nu_ctz(modinit_mask);
347-
const struct nu_modinit_s *modinit = i2c_modinit_tab + i2c_idx;
348-
struct nu_i2c_var *var = (struct nu_i2c_var *) modinit->var;
349-
if (var->obj) {
350-
// Disallow entering power-down mode if I2C transfer is enabled.
351-
if (i2c_active(var->obj)) {
352-
return 0;
353-
}
354-
}
355-
modinit_mask &= ~(1 << i2c_idx);
356-
}
357-
358-
return 1;
359-
}
360-
361342
static int i2c_do_tran(i2c_t *obj, char *buf, int length, int read, int naklastdata)
362343
{
363344
if (! buf || ! length) {

targets/TARGET_NUVOTON/TARGET_M451/pwmout_api.c

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -172,26 +172,6 @@ void pwmout_pulsewidth_us(pwmout_t* obj, int us)
172172
pwmout_config(obj);
173173
}
174174

175-
int pwmout_allow_powerdown(void)
176-
{
177-
uint32_t modinit_mask = pwm_modinit_mask;
178-
while (modinit_mask) {
179-
int pwm_idx = nu_ctz(modinit_mask);
180-
const struct nu_modinit_s *modinit = pwm_modinit_tab + pwm_idx;
181-
if (modinit->modname != NC) {
182-
PWM_T *pwm_base = (PWM_T *) NU_MODBASE(modinit->modname);
183-
uint32_t chn = NU_MODSUBINDEX(modinit->modname);
184-
// Disallow entering power-down mode if PWM counter is enabled.
185-
if ((pwm_base->CNTEN & (1 << chn)) && pwm_base->CMPDAT[chn]) {
186-
return 0;
187-
}
188-
}
189-
modinit_mask &= ~(1 << pwm_idx);
190-
}
191-
192-
return 1;
193-
}
194-
195175
static void pwmout_config(pwmout_t* obj)
196176
{
197177
PWM_T *pwm_base = (PWM_T *) NU_MODBASE(obj->pwm);

targets/TARGET_NUVOTON/TARGET_M451/serial_api.c

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -656,33 +656,6 @@ int serial_irq_handler_asynch(serial_t *obj)
656656
return (obj->serial.event & (event_rx | event_tx));
657657
}
658658

659-
int serial_allow_powerdown(void)
660-
{
661-
uint32_t modinit_mask = uart_modinit_mask;
662-
while (modinit_mask) {
663-
int uart_idx = nu_ctz(modinit_mask);
664-
const struct nu_modinit_s *modinit = uart_modinit_tab + uart_idx;
665-
if (modinit->modname != NC) {
666-
UART_T *uart_base = (UART_T *) NU_MODBASE(modinit->modname);
667-
// Disallow entering power-down mode if Tx FIFO has data to flush
668-
if (! UART_IS_TX_EMPTY((uart_base))) {
669-
return 0;
670-
}
671-
// Disallow entering power-down mode if async Rx transfer (not PDMA) is on-going
672-
if (uart_base->INTEN & (UART_INTEN_RDAIEN_Msk | UART_INTEN_RXTOIEN_Msk)) {
673-
return 0;
674-
}
675-
// Disallow entering power-down mode if async Rx transfer (PDMA) is on-going
676-
if (uart_base->INTEN & UART_INTEN_RXPDMAEN_Msk) {
677-
return 0;
678-
}
679-
}
680-
modinit_mask &= ~(1 << uart_idx);
681-
}
682-
683-
return 1;
684-
}
685-
686659
static void uart0_vec_async(void)
687660
{
688661
uart_irq_async(uart0_var.obj);

targets/TARGET_NUVOTON/TARGET_M451/spi_api.c

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -470,25 +470,6 @@ uint8_t spi_active(spi_t *obj)
470470
return (spi_base->CTL & SPI_CTL_SPIEN_Msk);
471471
}
472472

473-
int spi_allow_powerdown(void)
474-
{
475-
uint32_t modinit_mask = spi_modinit_mask;
476-
while (modinit_mask) {
477-
int spi_idx = nu_ctz(modinit_mask);
478-
const struct nu_modinit_s *modinit = spi_modinit_tab + spi_idx;
479-
if (modinit->modname != NC) {
480-
SPI_T *spi_base = (SPI_T *) NU_MODBASE(modinit->modname);
481-
// Disallow entering power-down mode if SPI transfer is enabled.
482-
if (spi_base->CTL & SPI_CTL_SPIEN_Msk) {
483-
return 0;
484-
}
485-
}
486-
modinit_mask &= ~(1 << spi_idx);
487-
}
488-
489-
return 1;
490-
}
491-
492473
static int spi_writeable(spi_t * obj)
493474
{
494475
// Receive FIFO must not be full to avoid receive FIFO overflow on next transmit/receive

targets/TARGET_NUVOTON/TARGET_M480/TARGET_NUMAKER_PFM_M487/objects.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -118,10 +118,6 @@ struct pwmout_s {
118118
uint32_t pulsewidth_us;
119119
};
120120

121-
struct sleep_s {
122-
int powerdown;
123-
};
124-
125121
struct trng_s {
126122
uint8_t dummy;
127123
};

targets/TARGET_NUVOTON/TARGET_M480/i2c_api.c

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -330,25 +330,6 @@ static int i2c_set_int(i2c_t *obj, int inten)
330330
return inten_back;
331331
}
332332

333-
int i2c_allow_powerdown(void)
334-
{
335-
uint32_t modinit_mask = i2c_modinit_mask;
336-
while (modinit_mask) {
337-
int i2c_idx = nu_ctz(modinit_mask);
338-
const struct nu_modinit_s *modinit = i2c_modinit_tab + i2c_idx;
339-
struct nu_i2c_var *var = (struct nu_i2c_var *) modinit->var;
340-
if (var->obj) {
341-
// Disallow entering power-down mode if I2C transfer is enabled.
342-
if (i2c_active(var->obj)) {
343-
return 0;
344-
}
345-
}
346-
modinit_mask &= ~(1 << i2c_idx);
347-
}
348-
349-
return 1;
350-
}
351-
352333
static int i2c_do_tran(i2c_t *obj, char *buf, int length, int read, int naklastdata)
353334
{
354335
if (! buf || ! length) {

targets/TARGET_NUVOTON/TARGET_M480/pwmout_api.c

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -167,26 +167,6 @@ void pwmout_pulsewidth_us(pwmout_t* obj, int us)
167167
pwmout_config(obj, 1);
168168
}
169169

170-
int pwmout_allow_powerdown(void)
171-
{
172-
uint32_t modinit_mask = pwm_modinit_mask;
173-
while (modinit_mask) {
174-
int pwm_idx = nu_ctz(modinit_mask);
175-
const struct nu_modinit_s *modinit = pwm_modinit_tab + pwm_idx;
176-
if (modinit->modname != NC) {
177-
EPWM_T *pwm_base = (EPWM_T *) NU_MODBASE(modinit->modname);
178-
uint32_t chn = NU_MODSUBINDEX(modinit->modname);
179-
// Disallow entering power-down mode if PWM counter is enabled.
180-
if ((pwm_base->CNTEN & (1 << chn)) && pwm_base->CMPDAT[chn]) {
181-
return 0;
182-
}
183-
}
184-
modinit_mask &= ~(1 << pwm_idx);
185-
}
186-
187-
return 1;
188-
}
189-
190170
static void pwmout_config(pwmout_t* obj, int start)
191171
{
192172
EPWM_T *pwm_base = (EPWM_T *) NU_MODBASE(obj->pwm);

targets/TARGET_NUVOTON/TARGET_M480/serial_api.c

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -710,33 +710,6 @@ int serial_irq_handler_asynch(serial_t *obj)
710710
return (obj->serial.event & (event_rx | event_tx));
711711
}
712712

713-
int serial_allow_powerdown(void)
714-
{
715-
uint32_t modinit_mask = uart_modinit_mask;
716-
while (modinit_mask) {
717-
int uart_idx = nu_ctz(modinit_mask);
718-
const struct nu_modinit_s *modinit = uart_modinit_tab + uart_idx;
719-
if (modinit->modname != NC) {
720-
UART_T *uart_base = (UART_T *) NU_MODBASE(modinit->modname);
721-
// Disallow entering power-down mode if Tx FIFO has data to flush
722-
if (! UART_IS_TX_EMPTY((uart_base))) {
723-
return 0;
724-
}
725-
// Disallow entering power-down mode if async Rx transfer (not PDMA) is on-going
726-
if (uart_base->INTEN & (UART_INTEN_RDAIEN_Msk | UART_INTEN_RXTOIEN_Msk)) {
727-
return 0;
728-
}
729-
// Disallow entering power-down mode if async Rx transfer (PDMA) is on-going
730-
if (uart_base->INTEN & UART_INTEN_RXPDMAEN_Msk) {
731-
return 0;
732-
}
733-
}
734-
modinit_mask &= ~(1 << uart_idx);
735-
}
736-
737-
return 1;
738-
}
739-
740713
static void uart0_vec_async(void)
741714
{
742715
uart_irq_async(uart0_var.obj);

targets/TARGET_NUVOTON/TARGET_M480/spi_api.c

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -461,25 +461,6 @@ uint8_t spi_active(spi_t *obj)
461461
return (spi_base->CTL & SPI_CTL_SPIEN_Msk);
462462
}
463463

464-
int spi_allow_powerdown(void)
465-
{
466-
uint32_t modinit_mask = spi_modinit_mask;
467-
while (modinit_mask) {
468-
int spi_idx = nu_ctz(modinit_mask);
469-
const struct nu_modinit_s *modinit = spi_modinit_tab + spi_idx;
470-
if (modinit->modname != NC) {
471-
SPI_T *spi_base = (SPI_T *) NU_MODBASE(modinit->modname);
472-
// Disallow entering power-down mode if SPI transfer is enabled.
473-
if (spi_base->CTL & SPI_CTL_SPIEN_Msk) {
474-
return 0;
475-
}
476-
}
477-
modinit_mask &= ~(1 << spi_idx);
478-
}
479-
480-
return 1;
481-
}
482-
483464
static int spi_writeable(spi_t * obj)
484465
{
485466
// Receive FIFO must not be full to avoid receive FIFO overflow on next transmit/receive

0 commit comments

Comments
 (0)