mirror of https://github.com/ARMmbed/mbed-os.git
SERIAL_FC disabled, critical section API Updation
SERIAL_FC disabled, critical section API and Format changes updatedpull/4840/head
parent
bd8fa4eb70
commit
624620b0d2
|
@ -19,6 +19,6 @@
|
||||||
#define DEVICE_ID_LENGTH 32
|
#define DEVICE_ID_LENGTH 32
|
||||||
|
|
||||||
#include "objects.h"
|
#include "objects.h"
|
||||||
#include "stddef.h"
|
#include <stddef.h>
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -13,11 +13,11 @@
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
#include "string.h"
|
|
||||||
#include "gpio_irq_api.h"
|
#include "gpio_irq_api.h"
|
||||||
#include "mbed_error.h"
|
#include "mbed_error.h"
|
||||||
#include "PeripheralNames.h"
|
#include "PeripheralNames.h"
|
||||||
#include "pinmap.h"
|
#include "pinmap.h"
|
||||||
|
#include "mbed_critical.h"
|
||||||
|
|
||||||
#define CHANNEL_NUM 6
|
#define CHANNEL_NUM 6
|
||||||
|
|
||||||
|
@ -103,19 +103,13 @@ int gpio_irq_init(gpio_irq_t *obj, PinName pin, gpio_irq_handler handler, uint32
|
||||||
{
|
{
|
||||||
// Get gpio interrupt ID
|
// Get gpio interrupt ID
|
||||||
obj->irq_id = pinmap_peripheral(pin, PinMap_GPIO_IRQ);
|
obj->irq_id = pinmap_peripheral(pin, PinMap_GPIO_IRQ);
|
||||||
|
core_util_critical_section_enter();
|
||||||
// Disable interrupt by CPU
|
|
||||||
__set_PRIMASK(1);
|
|
||||||
|
|
||||||
// Get pin mask
|
// Get pin mask
|
||||||
obj->mask = (uint32_t)(1 << (pin & 0x07));
|
obj->mask = (uint32_t)(1 << (pin & 0x07));
|
||||||
|
|
||||||
// Get GPIO port
|
// Get GPIO port
|
||||||
obj->port = (GPIO_Port)(pin >> 3);
|
obj->port = (GPIO_Port)(pin >> 3);
|
||||||
|
|
||||||
// Set pin level as LOW
|
// Set pin level as LOW
|
||||||
GPIO_WriteDataBit(obj->port, obj->mask, 0);
|
GPIO_WriteDataBit(obj->port, obj->mask, 0);
|
||||||
|
|
||||||
// Enable gpio interrupt function
|
// Enable gpio interrupt function
|
||||||
pinmap_pinout(pin, PinMap_GPIO_IRQ);
|
pinmap_pinout(pin, PinMap_GPIO_IRQ);
|
||||||
|
|
||||||
|
@ -145,21 +139,15 @@ int gpio_irq_init(gpio_irq_t *obj, PinName pin, gpio_irq_handler handler, uint32
|
||||||
|
|
||||||
// Save irq handler
|
// Save irq handler
|
||||||
hal_irq_handler[obj->irq_src] = handler;
|
hal_irq_handler[obj->irq_src] = handler;
|
||||||
|
|
||||||
// Save irq id
|
// Save irq id
|
||||||
channel_ids[obj->irq_src] = id;
|
channel_ids[obj->irq_src] = id;
|
||||||
|
|
||||||
// Initialize interrupt event as both edges detection
|
// Initialize interrupt event as both edges detection
|
||||||
obj->event = INTIFAO_INT_ACTIVE_STATE_INVALID;
|
obj->event = INTIFAO_INT_ACTIVE_STATE_INVALID;
|
||||||
|
|
||||||
// Set interrupt event and enable INTx clear
|
// Set interrupt event and enable INTx clear
|
||||||
INTIFAO_SetSTBYReleaseINTSrc(obj->irq_src, (INTIFAO_INTActiveState)obj->event, ENABLE);
|
INTIFAO_SetSTBYReleaseINTSrc(obj->irq_src, (INTIFAO_INTActiveState)obj->event, ENABLE);
|
||||||
|
|
||||||
// Clear gpio pending interrupt
|
// Clear gpio pending interrupt
|
||||||
NVIC_ClearPendingIRQ((IRQn_Type)obj->irq_id);
|
NVIC_ClearPendingIRQ((IRQn_Type)obj->irq_id);
|
||||||
|
core_util_critical_section_exit();;
|
||||||
// Enable gpio interrupt
|
|
||||||
__set_PRIMASK(0);
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,7 +30,7 @@ typedef struct {
|
||||||
|
|
||||||
static inline int gpio_is_connected(const gpio_t *obj)
|
static inline int gpio_is_connected(const gpio_t *obj)
|
||||||
{
|
{
|
||||||
return obj->pin != (PinName)NC;
|
return (obj->pin != (PinName)NC);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|
|
@ -20,8 +20,12 @@
|
||||||
|
|
||||||
#define I2C_NACK (0)
|
#define I2C_NACK (0)
|
||||||
#define I2C_ACK (1)
|
#define I2C_ACK (1)
|
||||||
#define I2C_TIMEOUT (100000)
|
#define I2C_NO_DATA (0)
|
||||||
|
#define I2C_READ_ADDRESSED (1)
|
||||||
|
#define I2C_WRITE_GENERAL (2)
|
||||||
|
#define I2C_WRITE_ADDRESSED (3)
|
||||||
#define SELF_ADDR (0xE0)
|
#define SELF_ADDR (0xE0)
|
||||||
|
#define I2C_TIMEOUT (100000)
|
||||||
|
|
||||||
static const PinMap PinMap_I2C_SDA[] = {
|
static const PinMap PinMap_I2C_SDA[] = {
|
||||||
{PC1, I2C_0, PIN_DATA(1, 2)},
|
{PC1, I2C_0, PIN_DATA(1, 2)},
|
||||||
|
@ -153,7 +157,6 @@ int i2c_stop(i2c_t *obj)
|
||||||
void i2c_reset(i2c_t *obj)
|
void i2c_reset(i2c_t *obj)
|
||||||
{
|
{
|
||||||
I2C_SWReset(obj->i2c);
|
I2C_SWReset(obj->i2c);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int i2c_read(i2c_t *obj, int address, char *data, int length, int stop)
|
int i2c_read(i2c_t *obj, int address, char *data, int length, int stop)
|
||||||
|
@ -265,14 +268,6 @@ int i2c_byte_write(i2c_t *obj, int data)
|
||||||
return (result);
|
return (result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#if DEVICE_I2CSLAVE
|
|
||||||
|
|
||||||
#define I2C_NO_DATA (0)
|
|
||||||
#define I2C_READ_ADDRESSED (1)
|
|
||||||
#define I2C_WRITE_GENERAL (2)
|
|
||||||
#define I2C_WRITE_ADDRESSED (3)
|
|
||||||
|
|
||||||
void i2c_slave_mode(i2c_t *obj, int enable_slave)
|
void i2c_slave_mode(i2c_t *obj, int enable_slave)
|
||||||
{
|
{
|
||||||
i2c_reset(obj);
|
i2c_reset(obj);
|
||||||
|
@ -293,7 +288,6 @@ void i2c_slave_mode(i2c_t *obj, int enable_slave)
|
||||||
I2C_Init(obj->i2c, &obj->myi2c);
|
I2C_Init(obj->i2c, &obj->myi2c);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int i2c_slave_receive(i2c_t *obj)
|
int i2c_slave_receive(i2c_t *obj)
|
||||||
{
|
{
|
||||||
int32_t result = I2C_NO_DATA;
|
int32_t result = I2C_NO_DATA;
|
||||||
|
@ -347,15 +341,3 @@ void i2c_slave_address(i2c_t *obj, int idx, uint32_t address, uint32_t mask)
|
||||||
obj->address = address & 0xFE;
|
obj->address = address & 0xFE;
|
||||||
i2c_slave_mode(obj, 1);
|
i2c_slave_mode(obj, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void INTI2C0_IRQHandler(void)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void INTI2C1_IRQHandler(void)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
#include "PeripheralNames.h"
|
#include "PeripheralNames.h"
|
||||||
#include "pinmap.h"
|
#include "pinmap.h"
|
||||||
|
|
||||||
#define UART_NUM 6
|
#define UART_NUM 2
|
||||||
|
|
||||||
static const PinMap PinMap_UART_TX[] = {
|
static const PinMap PinMap_UART_TX[] = {
|
||||||
{PC2, SERIAL_0, PIN_DATA(1, 1)},
|
{PC2, SERIAL_0, PIN_DATA(1, 1)},
|
||||||
|
@ -239,15 +239,3 @@ void serial_pinout_tx(PinName tx)
|
||||||
{
|
{
|
||||||
pinmap_pinout(tx, PinMap_UART_TX);
|
pinmap_pinout(tx, PinMap_UART_TX);
|
||||||
}
|
}
|
||||||
|
|
||||||
void serial_set_flow_control(serial_t *obj, FlowControl type, PinName rxflow, PinName txflow)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void serial_break_set(serial_t *obj)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void serial_break_clear(serial_t *obj)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
|
@ -24,7 +24,7 @@ static uint8_t us_ticker_inited = 0; // Is ticker initialized yet?
|
||||||
static volatile uint32_t acc_us_ticker = 0;
|
static volatile uint32_t acc_us_ticker = 0;
|
||||||
|
|
||||||
// 16Bb high timer counter
|
// 16Bb high timer counter
|
||||||
static uint32_t us_ticker_16h = 0;
|
static volatile uint32_t us_ticker_16h = 0;
|
||||||
|
|
||||||
void INT16A0_IRQHandler(void)
|
void INT16A0_IRQHandler(void)
|
||||||
{
|
{
|
||||||
|
@ -57,11 +57,10 @@ void us_ticker_init(void)
|
||||||
NVIC_EnableIRQ(INT16A0_IRQn);
|
NVIC_EnableIRQ(INT16A0_IRQn);
|
||||||
// Match counter set to max value
|
// Match counter set to max value
|
||||||
TSB_T16A0->RG = TMR16A_100US;
|
TSB_T16A0->RG = TMR16A_100US;
|
||||||
// TSB_T16A0->CP = 0x00;
|
|
||||||
TSB_T16A0->RUN = TMR16A_RUN;
|
TSB_T16A0->RUN = TMR16A_RUN;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t us_ticker_read()
|
uint32_t us_ticker_read(void)
|
||||||
{
|
{
|
||||||
uint32_t ret_val = 0;
|
uint32_t ret_val = 0;
|
||||||
|
|
||||||
|
|
|
@ -3356,7 +3356,7 @@
|
||||||
"extra_labels": ["TOSHIBA"],
|
"extra_labels": ["TOSHIBA"],
|
||||||
"macros": ["__TMPM066__", "CMSIS_VECTAB_VIRTUAL", "CMSIS_VECTAB_VIRTUAL_HEADER_FILE=\"cmsis_nvic.h\""],
|
"macros": ["__TMPM066__", "CMSIS_VECTAB_VIRTUAL", "CMSIS_VECTAB_VIRTUAL_HEADER_FILE=\"cmsis_nvic.h\""],
|
||||||
"supported_toolchains": ["GCC_ARM", "ARM", "IAR"],
|
"supported_toolchains": ["GCC_ARM", "ARM", "IAR"],
|
||||||
"device_has": ["ANALOGIN", "INTERRUPTIN", "PORTIN", "PORTINOUT", "PORTOUT", "SERIAL", "SERIAL_FC", "SLEEP", "I2C", "I2CSLAVE", "STDIO_MESSAGES", "PWMOUT"],
|
"device_has": ["ANALOGIN", "INTERRUPTIN", "PORTIN", "PORTINOUT", "PORTOUT", "SERIAL", "SLEEP", "I2C", "I2CSLAVE", "STDIO_MESSAGES", "PWMOUT"],
|
||||||
"device_name": "TMPM066FWUG",
|
"device_name": "TMPM066FWUG",
|
||||||
"detect_code": ["7011"],
|
"detect_code": ["7011"],
|
||||||
"release_versions": ["5"]
|
"release_versions": ["5"]
|
||||||
|
|
Loading…
Reference in New Issue