Flemmard | 939472a | 2014-02-21 20:23:00 +0100 | [diff] [blame] | 1 | /* |
| 2 | * linux/include/linux/a6_sbw_interface.h |
| 3 | * |
| 4 | * Public interface for the SBW protocol layer. Declares callbacks used by the core protocol. |
| 5 | * Interfaces include: |
| 6 | * - per-A6-device interface: every A6 device must define its own implementation of this interface. |
| 7 | * - per-target interfaces : each board-type must define its own implementation of these interfaces. |
| 8 | * - per-host system: operating system specific implementations must be defined. |
| 9 | * |
| 10 | * Copyright (C) 2008 Palm, Inc. |
| 11 | * Author: Raj Mojumder <raj.mojumder@palm.com> |
| 12 | * |
| 13 | * This program is free software; you can redistribute it and/or |
| 14 | * modify it under the terms of the GNU General Public License. |
| 15 | */ |
| 16 | |
| 17 | #ifndef _A6_SBW_INTERFACE_H_ |
| 18 | #define _A6_SBW_INTERFACE_H_ |
| 19 | |
| 20 | struct a6_sbw_interface { |
| 21 | // per-A6-device interface (separate instantiation for every a6 device) |
| 22 | struct { |
| 23 | uint16_t (*SetSBWTCK)(void); |
| 24 | uint16_t (*ClrSBWTCK)(void); |
| 25 | uint16_t (*SetSBWTDIO)(void); |
| 26 | uint16_t (*ClrSBWTDIO)(void); |
| 27 | uint16_t (*SetInSBWTDIO)(void); |
| 28 | uint16_t (*SetOutSBWTDIO)(void); |
| 29 | uint16_t (*GetSBWTDIO)(void); |
| 30 | uint16_t (*SetSBWAKEUP)(void); |
| 31 | uint16_t (*ClrSBWAKEUP)(void); |
| 32 | } a6_per_device_interface; |
| 33 | |
| 34 | // per-target interface (separate instantiation for every board) |
| 35 | struct { |
| 36 | void (*delay)(uint32_t delay_us); |
| 37 | } a6_per_target_interface; |
| 38 | }; |
| 39 | |
| 40 | |
| 41 | // per-host system: (operating system specific) |
| 42 | #ifdef __KERNEL__ |
| 43 | #define a6_disable_interrupts(flags) {flags=flags;local_irq_save(flags);} |
| 44 | #define a6_enable_interrupts(flags) {local_irq_restore(flags);} |
| 45 | #else |
| 46 | #define a6_disable_interrupts(flags) {i_need_definition();} |
| 47 | #define a6_enable_interrupts(flags) {i_need_definition();} |
| 48 | #endif |
| 49 | |
| 50 | |
| 51 | #endif // _A6_SBW_INTERFACE_H_ |