source: asp3_tinet_ecnl_arm/trunk/asp3_dcre/mbed/hal/mbed_us_ticker_api.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: 1.6 KB
Line 
1/* mbed Microcontroller Library
2 * Copyright (c) 2015 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 "hal/us_ticker_api.h"
17
18static ticker_event_queue_t events = { 0 };
19
20static ticker_irq_handler_type irq_handler = ticker_irq_handler;
21
22static const ticker_interface_t us_interface = {
23 .init = us_ticker_init,
24 .read = us_ticker_read,
25 .disable_interrupt = us_ticker_disable_interrupt,
26 .clear_interrupt = us_ticker_clear_interrupt,
27 .set_interrupt = us_ticker_set_interrupt,
28 .fire_interrupt = us_ticker_fire_interrupt,
29 .get_info = us_ticker_get_info,
30 .free = us_ticker_free,
31};
32
33static const ticker_data_t us_data = {
34 .interface = &us_interface,
35 .queue = &events
36};
37
38const ticker_data_t *get_us_ticker_data(void)
39{
40 return &us_data;
41}
42
43ticker_irq_handler_type set_us_ticker_irq_handler(ticker_irq_handler_type ticker_irq_handler)
44{
45 ticker_irq_handler_type prev_irq_handler = irq_handler;
46
47 irq_handler = ticker_irq_handler;
48
49 return prev_irq_handler;
50}
51
52void us_ticker_irq_handler(void)
53{
54 if (irq_handler) {
55 irq_handler(&us_data);
56 }
57}
Note: See TracBrowser for help on using the repository browser.