mirror of https://github.com/ARMmbed/mbed-os.git
hal: astyle update
parent
d10e821272
commit
483427a285
|
@ -74,7 +74,7 @@ typedef struct {
|
|||
uint32_t pc;
|
||||
} args_t;
|
||||
|
||||
typedef int32_t (*flash_algo_jump_t)(args_t*);
|
||||
typedef int32_t (*flash_algo_jump_t)(args_t *);
|
||||
|
||||
// prototypes for flash algo CMSIS API
|
||||
|
||||
|
|
|
@ -57,23 +57,23 @@ typedef void (*can_irq_handler)(uint32_t id, CanIrqType type);
|
|||
|
||||
typedef struct can_s can_t;
|
||||
|
||||
void can_init (can_t *obj, PinName rd, PinName td);
|
||||
void can_init_freq (can_t *obj, PinName rd, PinName td, int hz);
|
||||
void can_free (can_t *obj);
|
||||
int can_frequency (can_t *obj, int hz);
|
||||
void can_init(can_t *obj, PinName rd, PinName td);
|
||||
void can_init_freq(can_t *obj, PinName rd, PinName td, int hz);
|
||||
void can_free(can_t *obj);
|
||||
int can_frequency(can_t *obj, int hz);
|
||||
|
||||
void can_irq_init (can_t *obj, can_irq_handler handler, uint32_t id);
|
||||
void can_irq_free (can_t *obj);
|
||||
void can_irq_set (can_t *obj, CanIrqType irq, uint32_t enable);
|
||||
void can_irq_init(can_t *obj, can_irq_handler handler, uint32_t id);
|
||||
void can_irq_free(can_t *obj);
|
||||
void can_irq_set(can_t *obj, CanIrqType irq, uint32_t enable);
|
||||
|
||||
int can_write (can_t *obj, CAN_Message, int cc);
|
||||
int can_read (can_t *obj, CAN_Message *msg, int handle);
|
||||
int can_mode (can_t *obj, CanMode mode);
|
||||
int can_write(can_t *obj, CAN_Message, int cc);
|
||||
int can_read(can_t *obj, CAN_Message *msg, int handle);
|
||||
int can_mode(can_t *obj, CanMode mode);
|
||||
int can_filter(can_t *obj, uint32_t id, uint32_t mask, CANFormat format, int32_t handle);
|
||||
void can_reset (can_t *obj);
|
||||
unsigned char can_rderror (can_t *obj);
|
||||
unsigned char can_tderror (can_t *obj);
|
||||
void can_monitor (can_t *obj, int silent);
|
||||
void can_reset(can_t *obj);
|
||||
unsigned char can_rderror(can_t *obj);
|
||||
unsigned char can_tderror(can_t *obj);
|
||||
void can_monitor(can_t *obj, int silent);
|
||||
|
||||
#ifdef __cplusplus
|
||||
};
|
||||
|
|
|
@ -145,7 +145,7 @@ extern "C" {
|
|||
*
|
||||
* \return True if running if the polynomial is supported, false if not.
|
||||
*/
|
||||
bool hal_crc_is_supported(const crc_mbed_config_t* config);
|
||||
bool hal_crc_is_supported(const crc_mbed_config_t *config);
|
||||
|
||||
/** Initialize the hardware CRC module with the given polynomial
|
||||
*
|
||||
|
@ -177,7 +177,7 @@ bool hal_crc_is_supported(const crc_mbed_config_t* config);
|
|||
* hardware CRC module. For example, polynomial and initial seed
|
||||
* values.
|
||||
*/
|
||||
void hal_crc_compute_partial_start(const crc_mbed_config_t* config);
|
||||
void hal_crc_compute_partial_start(const crc_mbed_config_t *config);
|
||||
|
||||
/** Writes data to the current CRC module.
|
||||
*
|
||||
|
|
|
@ -86,7 +86,7 @@ int gpio_read(gpio_t *obj);
|
|||
* @param gpio The GPIO object
|
||||
* @param pin The pin name
|
||||
*/
|
||||
void gpio_init_in(gpio_t* gpio, PinName pin);
|
||||
void gpio_init_in(gpio_t *gpio, PinName pin);
|
||||
|
||||
/** Init the input pin and set the mode
|
||||
*
|
||||
|
@ -94,7 +94,7 @@ void gpio_init_in(gpio_t* gpio, PinName pin);
|
|||
* @param pin The pin name
|
||||
* @param mode The pin mode to be set
|
||||
*/
|
||||
void gpio_init_in_ex(gpio_t* gpio, PinName pin, PinMode mode);
|
||||
void gpio_init_in_ex(gpio_t *gpio, PinName pin, PinMode mode);
|
||||
|
||||
/** Init the output pin as an output, with predefined output value 0
|
||||
*
|
||||
|
@ -102,7 +102,7 @@ void gpio_init_in_ex(gpio_t* gpio, PinName pin, PinMode mode);
|
|||
* @param pin The pin name
|
||||
* @return An integer value 1 or 0
|
||||
*/
|
||||
void gpio_init_out(gpio_t* gpio, PinName pin);
|
||||
void gpio_init_out(gpio_t *gpio, PinName pin);
|
||||
|
||||
/** Init the pin as an output and set the output value
|
||||
*
|
||||
|
@ -110,7 +110,7 @@ void gpio_init_out(gpio_t* gpio, PinName pin);
|
|||
* @param pin The pin name
|
||||
* @param value The value to be set
|
||||
*/
|
||||
void gpio_init_out_ex(gpio_t* gpio, PinName pin, int value);
|
||||
void gpio_init_out_ex(gpio_t *gpio, PinName pin, int value);
|
||||
|
||||
/** Init the pin to be in/out
|
||||
*
|
||||
|
@ -120,7 +120,7 @@ void gpio_init_out_ex(gpio_t* gpio, PinName pin, int value);
|
|||
* @param mode The pin mode to be set
|
||||
* @param value The value to be set for an output pin
|
||||
*/
|
||||
void gpio_init_inout(gpio_t* gpio, PinName pin, PinDirection direction, PinMode mode, int value);
|
||||
void gpio_init_inout(gpio_t *gpio, PinName pin, PinDirection direction, PinMode mode, int value);
|
||||
|
||||
/**@}*/
|
||||
|
||||
|
|
|
@ -79,7 +79,7 @@ ticker_irq_handler_type set_lp_ticker_irq_handler(ticker_irq_handler_type ticker
|
|||
*
|
||||
* @return The low power ticker data
|
||||
*/
|
||||
const ticker_data_t* get_lp_ticker_data(void);
|
||||
const ticker_data_t *get_lp_ticker_data(void);
|
||||
|
||||
/** The wrapper for ticker_irq_handler, to pass lp ticker's data
|
||||
*
|
||||
|
@ -232,7 +232,7 @@ void lp_ticker_fire_interrupt(void);
|
|||
* }
|
||||
* @endcode
|
||||
*/
|
||||
const ticker_info_t* lp_ticker_get_info(void);
|
||||
const ticker_info_t *lp_ticker_get_info(void);
|
||||
|
||||
/**@}*/
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
*/
|
||||
#include "hal/gpio_api.h"
|
||||
|
||||
static inline void _gpio_init_in(gpio_t* gpio, PinName pin, PinMode mode)
|
||||
static inline void _gpio_init_in(gpio_t *gpio, PinName pin, PinMode mode)
|
||||
{
|
||||
gpio_init(gpio, pin);
|
||||
if (pin != NC) {
|
||||
|
@ -24,7 +24,7 @@ static inline void _gpio_init_in(gpio_t* gpio, PinName pin, PinMode mode)
|
|||
}
|
||||
}
|
||||
|
||||
static inline void _gpio_init_out(gpio_t* gpio, PinName pin, PinMode mode, int value)
|
||||
static inline void _gpio_init_out(gpio_t *gpio, PinName pin, PinMode mode, int value)
|
||||
{
|
||||
gpio_init(gpio, pin);
|
||||
if (pin != NC) {
|
||||
|
@ -34,27 +34,33 @@ static inline void _gpio_init_out(gpio_t* gpio, PinName pin, PinMode mode, int v
|
|||
}
|
||||
}
|
||||
|
||||
void gpio_init_in(gpio_t* gpio, PinName pin) {
|
||||
void gpio_init_in(gpio_t *gpio, PinName pin)
|
||||
{
|
||||
gpio_init_in_ex(gpio, pin, PullDefault);
|
||||
}
|
||||
|
||||
void gpio_init_in_ex(gpio_t* gpio, PinName pin, PinMode mode) {
|
||||
void gpio_init_in_ex(gpio_t *gpio, PinName pin, PinMode mode)
|
||||
{
|
||||
_gpio_init_in(gpio, pin, mode);
|
||||
}
|
||||
|
||||
void gpio_init_out(gpio_t* gpio, PinName pin) {
|
||||
void gpio_init_out(gpio_t *gpio, PinName pin)
|
||||
{
|
||||
gpio_init_out_ex(gpio, pin, 0);
|
||||
}
|
||||
|
||||
void gpio_init_out_ex(gpio_t* gpio, PinName pin, int value) {
|
||||
void gpio_init_out_ex(gpio_t *gpio, PinName pin, int value)
|
||||
{
|
||||
_gpio_init_out(gpio, pin, PullNone, value);
|
||||
}
|
||||
|
||||
void gpio_init_inout(gpio_t* gpio, PinName pin, PinDirection direction, PinMode mode, int value) {
|
||||
void gpio_init_inout(gpio_t *gpio, PinName pin, PinDirection direction, PinMode mode, int value)
|
||||
{
|
||||
if (direction == PIN_INPUT) {
|
||||
_gpio_init_in(gpio, pin, mode);
|
||||
if (pin != NC)
|
||||
if (pin != NC) {
|
||||
gpio_write(gpio, value); // we prepare the value in case it is switched later
|
||||
}
|
||||
} else {
|
||||
_gpio_init_out(gpio, pin, mode, value);
|
||||
}
|
||||
|
|
|
@ -70,8 +70,7 @@ uint32_t mbed_itm_send(uint32_t port, uint32_t data)
|
|||
{
|
||||
/* Check if ITM and port is enabled */
|
||||
if (((ITM->TCR & ITM_TCR_ITMENA_Msk) != 0UL) && /* ITM enabled */
|
||||
((ITM->TER & (1UL << port) ) != 0UL) ) /* ITM Port enabled */
|
||||
{
|
||||
((ITM->TER & (1UL << port)) != 0UL)) { /* ITM Port enabled */
|
||||
/* write data to port */
|
||||
ITM->PORT[port].u32 = data;
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ static const ticker_data_t lp_data = {
|
|||
.queue = &events,
|
||||
};
|
||||
|
||||
const ticker_data_t* get_lp_ticker_data(void)
|
||||
const ticker_data_t *get_lp_ticker_data(void)
|
||||
{
|
||||
return &lp_data;
|
||||
}
|
||||
|
|
|
@ -43,7 +43,7 @@ static void init_local()
|
|||
{
|
||||
MBED_ASSERT(core_util_in_critical_section());
|
||||
|
||||
const ticker_info_t* info = lp_ticker_get_info();
|
||||
const ticker_info_t *info = lp_ticker_get_info();
|
||||
if (info->bits >= 32) {
|
||||
mask = 0xffffffff;
|
||||
} else {
|
||||
|
|
|
@ -16,9 +16,11 @@
|
|||
#include "hal/pinmap.h"
|
||||
#include "platform/mbed_error.h"
|
||||
|
||||
void pinmap_pinout(PinName pin, const PinMap *map) {
|
||||
if (pin == NC)
|
||||
void pinmap_pinout(PinName pin, const PinMap *map)
|
||||
{
|
||||
if (pin == NC) {
|
||||
return;
|
||||
}
|
||||
|
||||
while (map->pin != NC) {
|
||||
if (map->pin == pin) {
|
||||
|
@ -32,58 +34,72 @@ void pinmap_pinout(PinName pin, const PinMap *map) {
|
|||
MBED_ERROR1(MBED_MAKE_ERROR(MBED_MODULE_PLATFORM, MBED_ERROR_CODE_PINMAP_INVALID), "could not pinout", pin);
|
||||
}
|
||||
|
||||
uint32_t pinmap_merge(uint32_t a, uint32_t b) {
|
||||
uint32_t pinmap_merge(uint32_t a, uint32_t b)
|
||||
{
|
||||
// both are the same (inc both NC)
|
||||
if (a == b)
|
||||
if (a == b) {
|
||||
return a;
|
||||
}
|
||||
|
||||
// one (or both) is not connected
|
||||
if (a == (uint32_t)NC)
|
||||
if (a == (uint32_t)NC) {
|
||||
return b;
|
||||
if (b == (uint32_t)NC)
|
||||
}
|
||||
if (b == (uint32_t)NC) {
|
||||
return a;
|
||||
}
|
||||
|
||||
// mis-match error case
|
||||
MBED_ERROR1(MBED_MAKE_ERROR(MBED_MODULE_PLATFORM, MBED_ERROR_CODE_PINMAP_INVALID), "pinmap mis-match", a);
|
||||
return (uint32_t)NC;
|
||||
}
|
||||
|
||||
uint32_t pinmap_find_peripheral(PinName pin, const PinMap* map) {
|
||||
uint32_t pinmap_find_peripheral(PinName pin, const PinMap *map)
|
||||
{
|
||||
while (map->pin != NC) {
|
||||
if (map->pin == pin)
|
||||
if (map->pin == pin) {
|
||||
return map->peripheral;
|
||||
}
|
||||
map++;
|
||||
}
|
||||
return (uint32_t)NC;
|
||||
}
|
||||
|
||||
uint32_t pinmap_peripheral(PinName pin, const PinMap* map) {
|
||||
uint32_t pinmap_peripheral(PinName pin, const PinMap *map)
|
||||
{
|
||||
uint32_t peripheral = (uint32_t)NC;
|
||||
|
||||
if (pin == (PinName)NC)
|
||||
if (pin == (PinName)NC) {
|
||||
return (uint32_t)NC;
|
||||
}
|
||||
peripheral = pinmap_find_peripheral(pin, map);
|
||||
if ((uint32_t)NC == peripheral) // no mapping available
|
||||
if ((uint32_t)NC == peripheral) { // no mapping available
|
||||
MBED_ERROR1(MBED_MAKE_ERROR(MBED_MODULE_PLATFORM, MBED_ERROR_CODE_PINMAP_INVALID), "pinmap not found for peripheral", peripheral);
|
||||
}
|
||||
return peripheral;
|
||||
}
|
||||
|
||||
uint32_t pinmap_find_function(PinName pin, const PinMap* map) {
|
||||
uint32_t pinmap_find_function(PinName pin, const PinMap *map)
|
||||
{
|
||||
while (map->pin != NC) {
|
||||
if (map->pin == pin)
|
||||
if (map->pin == pin) {
|
||||
return map->function;
|
||||
}
|
||||
map++;
|
||||
}
|
||||
return (uint32_t)NC;
|
||||
}
|
||||
|
||||
uint32_t pinmap_function(PinName pin, const PinMap* map) {
|
||||
uint32_t pinmap_function(PinName pin, const PinMap *map)
|
||||
{
|
||||
uint32_t function = (uint32_t)NC;
|
||||
|
||||
if (pin == (PinName)NC)
|
||||
if (pin == (PinName)NC) {
|
||||
return (uint32_t)NC;
|
||||
}
|
||||
function = pinmap_find_function(pin, map);
|
||||
if ((uint32_t)NC == function) // no mapping available
|
||||
if ((uint32_t)NC == function) { // no mapping available
|
||||
MBED_ERROR1(MBED_MAKE_ERROR(MBED_MODULE_PLATFORM, MBED_ERROR_CODE_PINMAP_INVALID), "pinmap not found for function", function);
|
||||
}
|
||||
return function;
|
||||
}
|
||||
|
|
|
@ -82,7 +82,7 @@ typedef struct sleep_statistic {
|
|||
|
||||
static sleep_statistic_t sleep_stats[STATISTIC_COUNT];
|
||||
|
||||
static sleep_statistic_t* sleep_tracker_find(const char *const filename)
|
||||
static sleep_statistic_t *sleep_tracker_find(const char *const filename)
|
||||
{
|
||||
for (int i = 0; i < STATISTIC_COUNT; ++i) {
|
||||
if (sleep_stats[i].identifier == filename) {
|
||||
|
@ -93,7 +93,7 @@ static sleep_statistic_t* sleep_tracker_find(const char *const filename)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
static sleep_statistic_t* sleep_tracker_add(const char* const filename)
|
||||
static sleep_statistic_t *sleep_tracker_add(const char *const filename)
|
||||
{
|
||||
for (int i = 0; i < STATISTIC_COUNT; ++i) {
|
||||
if (sleep_stats[i].identifier == NULL) {
|
||||
|
@ -139,7 +139,7 @@ void sleep_tracker_lock(const char *const filename, int line)
|
|||
debug("LOCK: %s, ln: %i, lock count: %u\r\n", filename, line, deep_sleep_lock);
|
||||
}
|
||||
|
||||
void sleep_tracker_unlock(const char* const filename, int line)
|
||||
void sleep_tracker_unlock(const char *const filename, int line)
|
||||
{
|
||||
sleep_statistic_t *stat = sleep_tracker_find(filename);
|
||||
|
||||
|
|
|
@ -108,7 +108,7 @@ static us_timestamp_t convert_timestamp(us_timestamp_t ref, timestamp_t timestam
|
|||
|
||||
us_timestamp_t result = (ref & ~((us_timestamp_t)UINT32_MAX)) | timestamp;
|
||||
if (overflow) {
|
||||
result += (1ULL<<32);
|
||||
result += (1ULL << 32);
|
||||
}
|
||||
|
||||
return result;
|
||||
|
@ -378,7 +378,7 @@ void ticker_remove_event(const ticker_data_t *const ticker, ticker_event_t *obj)
|
|||
schedule_interrupt(ticker);
|
||||
} else {
|
||||
// find the object before me, then drop me
|
||||
ticker_event_t* p = ticker->queue->head;
|
||||
ticker_event_t *p = ticker->queue->head;
|
||||
while (p != NULL) {
|
||||
if (p->next == obj) {
|
||||
p->next = obj->next;
|
||||
|
|
|
@ -34,7 +34,7 @@ static const ticker_data_t us_data = {
|
|||
.queue = &events
|
||||
};
|
||||
|
||||
const ticker_data_t* get_us_ticker_data(void)
|
||||
const ticker_data_t *get_us_ticker_data(void)
|
||||
{
|
||||
return &us_data;
|
||||
}
|
||||
|
|
14
hal/pinmap.h
14
hal/pinmap.h
|
@ -32,14 +32,14 @@ typedef struct {
|
|||
} PinMap;
|
||||
|
||||
void pin_function(PinName pin, int function);
|
||||
void pin_mode (PinName pin, PinMode mode);
|
||||
void pin_mode(PinName pin, PinMode mode);
|
||||
|
||||
uint32_t pinmap_peripheral(PinName pin, const PinMap* map);
|
||||
uint32_t pinmap_function(PinName pin, const PinMap* map);
|
||||
uint32_t pinmap_merge (uint32_t a, uint32_t b);
|
||||
void pinmap_pinout (PinName pin, const PinMap *map);
|
||||
uint32_t pinmap_find_peripheral(PinName pin, const PinMap* map);
|
||||
uint32_t pinmap_find_function(PinName pin, const PinMap* map);
|
||||
uint32_t pinmap_peripheral(PinName pin, const PinMap *map);
|
||||
uint32_t pinmap_function(PinName pin, const PinMap *map);
|
||||
uint32_t pinmap_merge(uint32_t a, uint32_t b);
|
||||
void pinmap_pinout(PinName pin, const PinMap *map);
|
||||
uint32_t pinmap_find_peripheral(PinName pin, const PinMap *map);
|
||||
uint32_t pinmap_find_function(PinName pin, const PinMap *map);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -121,7 +121,7 @@ ticker_irq_handler_type set_us_ticker_irq_handler(ticker_irq_handler_type ticker
|
|||
*
|
||||
* @return The microsecond ticker data
|
||||
*/
|
||||
const ticker_data_t* get_us_ticker_data(void);
|
||||
const ticker_data_t *get_us_ticker_data(void);
|
||||
|
||||
|
||||
/** The wrapper for ticker_irq_handler, to pass us ticker's data
|
||||
|
@ -269,7 +269,7 @@ void us_ticker_fire_interrupt(void);
|
|||
* }
|
||||
* @endcode
|
||||
*/
|
||||
const ticker_info_t* us_ticker_get_info(void);
|
||||
const ticker_info_t *us_ticker_get_info(void);
|
||||
|
||||
/**@}*/
|
||||
|
||||
|
|
Loading…
Reference in New Issue