source: asp3_tinet_ecnl_arm/trunk/asp3_dcre/mbed/targets/TARGET_RENESAS/TARGET_RZA1XX/pinmap.c@ 374

Last change on this file since 374 was 374, checked in by coas-nagasima, 5 years ago

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

  • Property svn:eol-style set to native
  • Property svn:mime-type set to text/x-csrc;charset=UTF-8
File size: 2.5 KB
Line 
1/* mbed Microcontroller Library
2 * Copyright (c) 2006-2013 ARM Limited
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16#include "PeripheralPins.h"
17#include "mbed_error.h"
18#include "gpio_addrdefine.h"
19
20PinName gpio_multi_guard = (PinName)NC; /* If set pin name here, setting of the "pin" is just one time */
21
22void pin_function(PinName pin, int function) {
23 if (pin == (PinName)NC) return;
24
25 int n = pin >> 4;
26 int bitmask = 1<<(pin & 0xf);
27 const PinFunc * Pipc_0_func = PIPC_0_tbl;
28 int pipc_data = 1;
29
30 if (gpio_multi_guard != pin) {
31 if (function == 0) {
32 // means GPIO mode
33 *PMC(n) &= ~bitmask;
34 } else {
35 // alt-function mode
36 --function;
37
38 if (function & (1 << 2)) { *PFCAE(n) |= bitmask;}else { *PFCAE(n) &= ~bitmask;}
39 if (function & (1 << 1)) { *PFCE(n) |= bitmask;}else { *PFCE(n) &= ~bitmask;}
40 if (function & (1 << 0)) { *PFC(n) |= bitmask;}else { *PFC(n) &= ~bitmask;}
41
42 while (Pipc_0_func->pin != NC) {
43 if ((Pipc_0_func->pin == pin) && ((Pipc_0_func->function - 1) == function)) {
44 pipc_data = 0;
45 if (Pipc_0_func->pm == 0) {
46 *PMSR(n) = (bitmask << 16) | 0;
47 } else if (Pipc_0_func->pm == 1) {
48 *PMSR(n) = (bitmask << 16) | bitmask;
49 } else {
50 // Do Nothing
51 }
52 break;
53 }
54 Pipc_0_func++;
55 }
56 if (pipc_data == 1) {
57 *PIPC(n) |= bitmask;
58 } else {
59 *PIPC(n) &= ~bitmask;
60 }
61
62 if (P1_0 <= pin && pin <= P1_7 && function == 0) {
63 *PBDC(n) |= bitmask;
64 }
65 *PMC(n) |= bitmask;
66 }
67 } else {
68 gpio_multi_guard = (PinName)NC;
69 }
70}
71
72void pin_mode(PinName pin, PinMode mode) {
73// if (pin == (PinName)NC) { return; }
74}
Note: See TracBrowser for help on using the repository browser.