SERIAL_FC disabled, critical section API Updation

SERIAL_FC disabled, critical section API and Format changes updated
pull/4840/head
Ganesh Ramachandran 2017-08-04 17:28:38 +05:30 committed by Ganesh Ramachandran
parent bd8fa4eb70
commit 624620b0d2
13 changed files with 49 additions and 92 deletions

View File

@ -19,6 +19,6 @@
#define DEVICE_ID_LENGTH 32
#include "objects.h"
#include "stddef.h"
#include <stddef.h>
#endif

View File

@ -13,11 +13,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "string.h"
#include "gpio_irq_api.h"
#include "mbed_error.h"
#include "PeripheralNames.h"
#include "pinmap.h"
#include "mbed_critical.h"
#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
obj->irq_id = pinmap_peripheral(pin, PinMap_GPIO_IRQ);
// Disable interrupt by CPU
__set_PRIMASK(1);
core_util_critical_section_enter();
// Get pin mask
obj->mask = (uint32_t)(1 << (pin & 0x07));
// Get GPIO port
obj->port = (GPIO_Port)(pin >> 3);
// Set pin level as LOW
GPIO_WriteDataBit(obj->port, obj->mask, 0);
// Enable gpio interrupt function
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
hal_irq_handler[obj->irq_src] = handler;
// Save irq id
channel_ids[obj->irq_src] = id;
// Initialize interrupt event as both edges detection
obj->event = INTIFAO_INT_ACTIVE_STATE_INVALID;
// Set interrupt event and enable INTx clear
INTIFAO_SetSTBYReleaseINTSrc(obj->irq_src, (INTIFAO_INTActiveState)obj->event, ENABLE);
// Clear gpio pending interrupt
NVIC_ClearPendingIRQ((IRQn_Type)obj->irq_id);
// Enable gpio interrupt
__set_PRIMASK(0);
core_util_critical_section_exit();;
return 0;
}

View File

@ -30,7 +30,7 @@ typedef struct {
static inline int gpio_is_connected(const gpio_t *obj)
{
return obj->pin != (PinName)NC;
return (obj->pin != (PinName)NC);
}
#ifdef __cplusplus

View File

@ -20,8 +20,12 @@
#define I2C_NACK (0)
#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 I2C_TIMEOUT (100000)
static const PinMap PinMap_I2C_SDA[] = {
{PC1, I2C_0, PIN_DATA(1, 2)},
@ -153,7 +157,6 @@ int i2c_stop(i2c_t *obj)
void i2c_reset(i2c_t *obj)
{
I2C_SWReset(obj->i2c);
return;
}
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);
}
#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)
{
i2c_reset(obj);
@ -293,7 +288,6 @@ void i2c_slave_mode(i2c_t *obj, int enable_slave)
I2C_Init(obj->i2c, &obj->myi2c);
}
int i2c_slave_receive(i2c_t *obj)
{
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;
i2c_slave_mode(obj, 1);
}
#endif
void INTI2C0_IRQHandler(void)
{
}
void INTI2C1_IRQHandler(void)
{
}

View File

@ -18,7 +18,7 @@
#include "PeripheralNames.h"
#include "pinmap.h"
#define UART_NUM 6
#define UART_NUM 2
static const PinMap PinMap_UART_TX[] = {
{PC2, SERIAL_0, PIN_DATA(1, 1)},
@ -239,15 +239,3 @@ void serial_pinout_tx(PinName 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)
{
}

View File

@ -24,7 +24,7 @@ static uint8_t us_ticker_inited = 0; // Is ticker initialized yet?
static volatile uint32_t acc_us_ticker = 0;
// 16Bb high timer counter
static uint32_t us_ticker_16h = 0;
static volatile uint32_t us_ticker_16h = 0;
void INT16A0_IRQHandler(void)
{
@ -57,11 +57,10 @@ void us_ticker_init(void)
NVIC_EnableIRQ(INT16A0_IRQn);
// Match counter set to max value
TSB_T16A0->RG = TMR16A_100US;
// TSB_T16A0->CP = 0x00;
TSB_T16A0->RUN = TMR16A_RUN;
}
uint32_t us_ticker_read()
uint32_t us_ticker_read(void)
{
uint32_t ret_val = 0;

View File

@ -3356,7 +3356,7 @@
"extra_labels": ["TOSHIBA"],
"macros": ["__TMPM066__", "CMSIS_VECTAB_VIRTUAL", "CMSIS_VECTAB_VIRTUAL_HEADER_FILE=\"cmsis_nvic.h\""],
"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",
"detect_code": ["7011"],
"release_versions": ["5"]