Root/
| 1 | /* |
| 2 | * include/ubb/ubb.h - Access functions for the Universal Breakout Board |
| 3 | * |
| 4 | * Written 2012 by Werner Almesberger |
| 5 | * Copyright 2012 Werner Almesberger |
| 6 | * |
| 7 | * This program is free software; you can redistribute it and/or modify |
| 8 | * it under the terms of the GNU General Public License as published by |
| 9 | * the Free Software Foundation; either version 2 of the License, or |
| 10 | * (at your option) any later version. |
| 11 | */ |
| 12 | |
| 13 | #ifndef UBB_UBB_H |
| 14 | #define UBB_UBB_H |
| 15 | |
| 16 | #include <stdint.h> |
| 17 | |
| 18 | #include <ubb/regbase.h> |
| 19 | |
| 20 | |
| 21 | #define UBB_nPWR (1 << 2) /* PD02 */ |
| 22 | #define UBB_DAT2 (1 << 12) /* PD12 */ |
| 23 | #define UBB_DAT3 (1 << 13) /* PD13 */ |
| 24 | #define UBB_CMD (1 << 8) /* PD08 */ |
| 25 | #define UBB_CLK (1 << 9) /* PD09 */ |
| 26 | #define UBB_DAT0 (1 << 10) /* PD10 */ |
| 27 | #define UBB_DAT1 (1 << 11) /* PD11 */ |
| 28 | |
| 29 | #define UBB_ALL_IO (UBB_DAT2 | UBB_DAT3 | UBB_CMD | UBB_CLK | UBB_DAT0 | \ |
| 30 | UBB_DAT1) |
| 31 | #define UBB_ALL (UBB_nPWR | UBB_ALL_IO) |
| 32 | |
| 33 | #define SET(mask) PDDATS = (mask) |
| 34 | #define CLR(mask) PDDATC = (mask) |
| 35 | #define OUT(mask) PDDIRS = (mask) |
| 36 | #define IN(mask) PDDIRC = (mask) |
| 37 | #define PIN(mask) (!!(PDPIN & (mask))) |
| 38 | |
| 39 | |
| 40 | int ubb_open(uint32_t keep); |
| 41 | void ubb_power(int on); |
| 42 | void ubb_close(uint32_t keep); |
| 43 | |
| 44 | #endif /* !UBB_UBB_H */ |
| 45 |
Branches:
master
