| 1 |
2 |
iztok |
//////////////////////////////////////////////////////////////////////////////
|
| 2 |
|
|
// //
|
| 3 |
|
|
// Minimalistic 1-wire (onewire) master with Avalon MM bus interface //
|
| 4 |
|
|
// //
|
| 5 |
|
|
// Copyright (C) 2010 Iztok Jeras //
|
| 6 |
|
|
// //
|
| 7 |
|
|
//////////////////////////////////////////////////////////////////////////////
|
| 8 |
|
|
// //
|
| 9 |
|
|
// This program is free software: you can redistribute it and/or modify //
|
| 10 |
|
|
// it under the terms of the GNU Lesser General Public License //
|
| 11 |
|
|
// as published by the Free Software Foundation, either //
|
| 12 |
|
|
// version 3 of the License, or (at your option) any later version. //
|
| 13 |
|
|
// //
|
| 14 |
|
|
// This program is distributed in the hope that it will be useful, //
|
| 15 |
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
|
| 16 |
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
|
| 17 |
|
|
// GNU General Public License for more details. //
|
| 18 |
|
|
// //
|
| 19 |
|
|
// You should have received a copy of the GNU General Public License //
|
| 20 |
|
|
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
| 21 |
|
|
// //
|
| 22 |
|
|
//////////////////////////////////////////////////////////////////////////////
|
| 23 |
|
|
|
| 24 |
|
|
|
| 25 |
|
|
#ifndef __SOCKIT_OWM_REGS_H__
|
| 26 |
|
|
#define __SOCKIT_OWM_REGS_H__
|
| 27 |
|
|
|
| 28 |
|
|
#include <io.h>
|
| 29 |
|
|
|
| 30 |
|
|
#define SOCKIT_OWM_REG 0
|
| 31 |
|
|
#define IOADDR_SOCKIT_OWM(base) __IO_CALC_ADDRESS_NATIVE(base, SOCKIT_OWM_REG)
|
| 32 |
|
|
#define IORD_SOCKIT_OWM(base) IORD(base, SOCKIT_OWM_REG)
|
| 33 |
|
|
#define IOWR_SOCKIT_OWM(base, data) IOWR(base, SOCKIT_OWM_REG, data)
|
| 34 |
|
|
|
| 35 |
|
|
#define SOCKIT_OWM_DAT_MSK (0x01) // data bit
|
| 36 |
|
|
#define SOCKIT_OWM_DAT_OFST (0)
|
| 37 |
|
|
#define SOCKIT_OWM_RST_MSK (0x02) // reset (write only)
|
| 38 |
|
|
#define SOCKIT_OWM_RST_OFST (1)
|
| 39 |
|
|
#define SOCKIT_OWM_TRN_MSK (0x02) // transfer (read only)
|
| 40 |
|
|
#define SOCKIT_OWM_TRN_OFST (1)
|
| 41 |
|
|
#define SOCKIT_OWM_OVD_MSK (0x04) // overdrive
|
| 42 |
|
|
#define SOCKIT_OWM_OVD_OFST (2)
|
| 43 |
|
|
#define SOCKIT_OWM_PWR_MSK (0x08) // power (strong pull-up)
|
| 44 |
|
|
#define SOCKIT_OWM_PWR_OFST (3) // if there is a single port
|
| 45 |
|
|
#define SOCKIT_OWM_STX_MSK (0x10) // status TX
|
| 46 |
|
|
#define SOCKIT_OWM_STX_OFST (4)
|
| 47 |
|
|
#define SOCKIT_OWM_SRX_MSK (0x20) // status RX
|
| 48 |
|
|
#define SOCKIT_OWM_SRX_OFST (5)
|
| 49 |
|
|
#define SOCKIT_OWM_ETX_MSK (0x40) // irq enable TX
|
| 50 |
|
|
#define SOCKIT_OWM_ETX_OFST (6)
|
| 51 |
|
|
#define SOCKIT_OWM_ERX_MSK (0x80) // irq enable RX
|
| 52 |
|
|
#define SOCKIT_OWM_ERX_OFST (7)
|
| 53 |
|
|
|
| 54 |
|
|
#define SOCKIT_OWM_SEL_MSK (0x0f00) // port select number
|
| 55 |
|
|
#define SOCKIT_OWM_SEL_OFST (8)
|
| 56 |
|
|
|
| 57 |
|
|
#define SOCKIT_OWM_POWER_MSK (0xffff0000) // power (strong pull-up)
|
| 58 |
|
|
#define SOCKIT_OWM_POWER_OFST (16) // if there is more than one port
|
| 59 |
|
|
|
| 60 |
|
|
// two common commands
|
| 61 |
|
|
#define SOCKIT_OWM_DLY_MSK ( SOCKIT_OWM_RST_MSK | SOCKIT_OWM_DAT_MSK)
|
| 62 |
|
|
#define SOCKIT_OWM_IDL_MSK (SOCKIT_OWM_OVD_MSK | SOCKIT_OWM_RST_MSK | SOCKIT_OWM_DAT_MSK)
|
| 63 |
|
|
|
| 64 |
|
|
#endif /* __SOCKIT_OWM_REGS_H__ */
|