| 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 |
3 |
iztok |
//////////////////////////////////////////////////////////////////////////////
|
| 31 |
|
|
// control status register //
|
| 32 |
|
|
//////////////////////////////////////////////////////////////////////////////
|
| 33 |
2 |
iztok |
|
| 34 |
3 |
iztok |
#define SOCKIT_OWM_CTL_REG 0
|
| 35 |
|
|
#define IOADDR_SOCKIT_OWM_CTL(base) IO_CALC_ADDRESS_NATIVE(base, SOCKIT_OWM_CTL_REG)
|
| 36 |
|
|
#define IORD_SOCKIT_OWM_CTL(base) IORD(base, SOCKIT_OWM_CTL_REG)
|
| 37 |
|
|
#define IOWR_SOCKIT_OWM_CTL(base, data) IOWR(base, SOCKIT_OWM_CTL_REG, data)
|
| 38 |
2 |
iztok |
|
| 39 |
3 |
iztok |
#define SOCKIT_OWM_CTL_DAT_MSK (0x00000001) // data bit
|
| 40 |
|
|
#define SOCKIT_OWM_CTL_DAT_OFST (0)
|
| 41 |
|
|
#define SOCKIT_OWM_CTL_RST_MSK (0x00000002) // reset
|
| 42 |
|
|
#define SOCKIT_OWM_CTL_RST_OFST (1)
|
| 43 |
|
|
#define SOCKIT_OWM_CTL_OVD_MSK (0x00000004) // overdrive
|
| 44 |
|
|
#define SOCKIT_OWM_CTL_OVD_OFST (2)
|
| 45 |
|
|
#define SOCKIT_OWM_CTL_CYC_MSK (0x00000008) // cycle
|
| 46 |
|
|
#define SOCKIT_OWM_CTL_CYC_OFST (3)
|
| 47 |
|
|
#define SOCKIT_OWM_CTL_PWR_MSK (0x00000010) // power (strong pull-up), if there is a single 1-wire line
|
| 48 |
|
|
#define SOCKIT_OWM_CTL_PWR_OFST (5)
|
| 49 |
|
|
#define SOCKIT_OWM_CTL_RSV_MSK (0x00000020) // reserved
|
| 50 |
|
|
#define SOCKIT_OWM_CTL_RSV_OFST (5)
|
| 51 |
|
|
#define SOCKIT_OWM_CTL_IRQ_MSK (0x00000040) // irq status
|
| 52 |
|
|
#define SOCKIT_OWM_CTL_IRQ_OFST (6)
|
| 53 |
|
|
#define SOCKIT_OWM_CTL_IEN_MSK (0x00000080) // irq enable
|
| 54 |
|
|
#define SOCKIT_OWM_CTL_IEN_OFST (7)
|
| 55 |
2 |
iztok |
|
| 56 |
3 |
iztok |
#define SOCKIT_OWM_CTL_SEL_MSK (0x00000f00) // port select number
|
| 57 |
|
|
#define SOCKIT_OWM_CTL_SEL_OFST (8)
|
| 58 |
2 |
iztok |
|
| 59 |
3 |
iztok |
#define SOCKIT_OWM_CTL_POWER_MSK (0xffff0000) // power (strong pull-up), if there is more than one 1-wire line
|
| 60 |
|
|
#define SOCKIT_OWM_CTL_POWER_OFST (16)
|
| 61 |
|
|
|
| 62 |
2 |
iztok |
// two common commands
|
| 63 |
3 |
iztok |
#define SOCKIT_OWM_CTL_DLY_MSK ( SOCKIT_OWM_CTL_RST_MSK | SOCKIT_OWM_CTL_DAT_MSK)
|
| 64 |
|
|
#define SOCKIT_OWM_CTL_IDL_MSK (SOCKIT_OWM_CTL_OVD_MSK | SOCKIT_OWM_CTL_RST_MSK | SOCKIT_OWM_CTL_DAT_MSK)
|
| 65 |
2 |
iztok |
|
| 66 |
3 |
iztok |
//////////////////////////////////////////////////////////////////////////////
|
| 67 |
|
|
// clock divider ratio register //
|
| 68 |
|
|
//////////////////////////////////////////////////////////////////////////////
|
| 69 |
|
|
|
| 70 |
|
|
#define SOCKIT_OWM_CDR_REG 1
|
| 71 |
|
|
#define IOADDR_SOCKIT_OWM_CDR(base) IO_CALC_ADDRESS_NATIVE(base, SOCKIT_OWM_CDR_REG)
|
| 72 |
|
|
#define IORD_SOCKIT_OWM_CDR(base) IORD(base, SOCKIT_OWM_CDR_REG)
|
| 73 |
|
|
#define IOWR_SOCKIT_OWM_CDR(base, data) IOWR(base, SOCKIT_OWM_CDR_REG, data)
|
| 74 |
|
|
|
| 75 |
|
|
#define SOCKIT_OWM_CDR_N_MSK (0x0000ffff) // normal mode
|
| 76 |
|
|
#define SOCKIT_OWM_CDR_N_OFST (0)
|
| 77 |
|
|
#define SOCKIT_OWM_CDR_O_MSK (0xffff0000) // overdrive mode
|
| 78 |
|
|
#define SOCKIT_OWM_CDR_O_OFST (16)
|
| 79 |
|
|
|
| 80 |
|
|
|
| 81 |
2 |
iztok |
#endif /* __SOCKIT_OWM_REGS_H__ */
|