Ignore:
Timestamp:
Apr 5, 2019, 9:26:53 PM (5 years ago)
Author:
coas-nagasima
Message:

mbed関連を更新
シリアルドライバをmbedのHALを使うよう変更
ファイルディスクリプタの処理を更新

File:
1 edited

Legend:

Unmodified
Added
Removed
  • asp3_tinet_ecnl_arm/trunk/asp3_dcre/mbed/hal/mbed_pinmap_common.c

    r352 r374  
    1717#include "platform/mbed_error.h"
    1818
    19 void pinmap_pinout(PinName pin, const PinMap *map) {
    20     if (pin == NC)
     19void pinmap_pinout(PinName pin, const PinMap *map)
     20{
     21    if (pin == NC) {
    2122        return;
     23    }
    2224
    2325    while (map->pin != NC) {
     
    3032        map++;
    3133    }
    32     error("could not pinout");
     34    MBED_ERROR1(MBED_MAKE_ERROR(MBED_MODULE_PLATFORM, MBED_ERROR_CODE_PINMAP_INVALID), "could not pinout", pin);
    3335}
    3436
    35 uint32_t pinmap_merge(uint32_t a, uint32_t b) {
     37uint32_t pinmap_merge(uint32_t a, uint32_t b)
     38{
    3639    // both are the same (inc both NC)
    37     if (a == b)
     40    if (a == b) {
    3841        return a;
     42    }
    3943
    4044    // one (or both) is not connected
    41     if (a == (uint32_t)NC)
     45    if (a == (uint32_t)NC) {
    4246        return b;
    43     if (b == (uint32_t)NC)
     47    }
     48    if (b == (uint32_t)NC) {
    4449        return a;
     50    }
    4551
    4652    // mis-match error case
    47     error("pinmap mis-match");
     53    MBED_ERROR1(MBED_MAKE_ERROR(MBED_MODULE_PLATFORM, MBED_ERROR_CODE_PINMAP_INVALID), "pinmap mis-match", a);
    4854    return (uint32_t)NC;
    4955}
    5056
    51 uint32_t pinmap_find_peripheral(PinName pin, const PinMap* map) {
     57uint32_t pinmap_find_peripheral(PinName pin, const PinMap *map)
     58{
    5259    while (map->pin != NC) {
    53         if (map->pin == pin)
     60        if (map->pin == pin) {
    5461            return map->peripheral;
     62        }
    5563        map++;
    5664    }
     
    5866}
    5967
    60 uint32_t pinmap_peripheral(PinName pin, const PinMap* map) {
     68uint32_t pinmap_peripheral(PinName pin, const PinMap *map)
     69{
    6170    uint32_t peripheral = (uint32_t)NC;
    6271
    63     if (pin == (PinName)NC)
     72    if (pin == (PinName)NC) {
    6473        return (uint32_t)NC;
     74    }
    6575    peripheral = pinmap_find_peripheral(pin, map);
    66     if ((uint32_t)NC == peripheral) // no mapping available
    67         error("pinmap not found for peripheral");
     76    if ((uint32_t)NC == peripheral) { // no mapping available
     77        MBED_ERROR1(MBED_MAKE_ERROR(MBED_MODULE_PLATFORM, MBED_ERROR_CODE_PINMAP_INVALID), "pinmap not found for peripheral", peripheral);
     78    }
    6879    return peripheral;
    6980}
    7081
    71 uint32_t pinmap_find_function(PinName pin, const PinMap* map) {
     82uint32_t pinmap_find_function(PinName pin, const PinMap *map)
     83{
    7284    while (map->pin != NC) {
    73         if (map->pin == pin)
     85        if (map->pin == pin) {
    7486            return map->function;
     87        }
    7588        map++;
    7689    }
     
    7891}
    7992
    80 uint32_t pinmap_function(PinName pin, const PinMap* map) {
     93uint32_t pinmap_function(PinName pin, const PinMap *map)
     94{
    8195    uint32_t function = (uint32_t)NC;
    8296
    83     if (pin == (PinName)NC)
     97    if (pin == (PinName)NC) {
    8498        return (uint32_t)NC;
     99    }
    85100    function = pinmap_find_function(pin, map);
    86     if ((uint32_t)NC == function) // no mapping available
    87         error("pinmap not found for function");
     101    if ((uint32_t)NC == function) { // no mapping available
     102        MBED_ERROR1(MBED_MAKE_ERROR(MBED_MODULE_PLATFORM, MBED_ERROR_CODE_PINMAP_INVALID), "pinmap not found for function", function);
     103    }
    88104    return function;
    89105}
Note: See TracChangeset for help on using the changeset viewer.