openMMC
Open Source Modular MMC for AMCs
Loading...
Searching...
No Matches
adn4604.h
Go to the documentation of this file.
1/*
2 * openMMC -- Open Source modular IPM Controller firmware
3 *
4 * Copyright (C) 2015 Henrique Silva <henrique.silva@lnls.br>
5 *
6 * This program is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 *
19 * @license GPL-3.0+ <http://spdx.org/licenses/GPL-3.0+>
20 */
21
36#ifndef ADN4604_H_
37#define ADN4604_H_
38
39#include "mmc_error.h"
40
41typedef struct __attribute__((__packed__)) {
42#if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
43 uint8_t out1:4,
44 out0:4;
45 uint8_t out3:4,
46 out2:4;
47 uint8_t out5:4,
48 out4:4;
49 uint8_t out7:4,
50 out6:4;
51 uint8_t out9:4,
52 out8:4;
53 uint8_t out11:4,
54 out10:4;
55 uint8_t out13:4,
56 out12:4;
57 uint8_t out15:4,
58 out14:4;
59#else
60 uint8_t out0:4,
61 out1:4;
62 uint8_t out2:4,
63 out3:4;
64 uint8_t out4:4,
65 out5:4;
66 uint8_t out6:4,
67 out7:4;
68 uint8_t out8:4,
69 out9:4;
70 uint8_t out10:4,
71 out11:4;
72 uint8_t out12:4,
73 out13:4;
74 uint8_t out14:4,
75 out15:4;
76#endif
78
83
84#define ADN_XPT_MAP0_CON_REG 0x90
85#define ADN_XPT_MAP1_CON_REG 0x98
86
87#define ADN_RESET_REG 0x00
88
89#define ADN_XPT_UPDATE_REG 0x80
90#define ADN_XPT_MAP_TABLE_SEL_REG 0x81
91
92#define ADN_XPT_MAP0 0x00
93#define ADN_XPT_MAP1 0x01
94
95#define ADN_XPT_BROADCAST 0x82
96
97#define ADN_XPT_STATUS_REG 0xB0
98
99#define ADN_TERMINATION_CTL_REG 0xF0
100
101#define ADN_TX_CON_OUT0 0x20
102
104 RXW_TERM = 0, /*< Input[7:0] (West) termination control */
105 RXE_TERM, /*< Input[15:8] (East) termination control */
106 TXS_TERM, /*< Output[7:0] (South) termination control */
107 TXN_TERM /*< Output[15:8] (North) termination control */
109
116
123mmc_err adn4604_tx_control( uint8_t output, uint8_t tx_mode );
124
131mmc_err adn4604_update( void );
132
136mmc_err adn4604_reset( void );
137
144mmc_err adn4604_xpt_config( uint8_t map, adn_connect_map_t xpt_con );
145
151mmc_err adn4604_active_map( uint8_t map );
152
159
165mmc_err adn4604_termination_ctl( uint8_t cfg );
166
167#endif
adn_connect_map_t adn4604_out_status(void)
Reads the outputs current connections.
Definition adn4604.c:141
mmc_err adn4604_update(void)
Activates the current stored configuration.
Definition adn4604.c:81
mmc_err adn4604_termination_ctl(uint8_t cfg)
Controls the inputs/outputs line termination.
Definition adn4604.c:161
adn4604_tx_ctl
Definition adn4604.h:110
@ TX_STANDBY
Definition adn4604.h:112
@ TX_SQUELCHED
Definition adn4604.h:113
@ TX_DISABLED
Definition adn4604.h:111
@ TX_ENABLED
Definition adn4604.h:114
adn_connect_map_t
Definition adn4604.h:77
adn4604_term_ctl
Definition adn4604.h:103
@ RXW_TERM
Definition adn4604.h:104
@ TXS_TERM
Definition adn4604.h:106
@ RXE_TERM
Definition adn4604.h:105
@ TXN_TERM
Definition adn4604.h:107
mmc_err adn4604_reset(void)
ADN4604 Software Reset.
Definition adn4604.c:96
struct adn_connect_cfg adn_connect_cfg_t
struct __attribute__((__packed__))
Definition adn4604.h:41
mmc_err adn4604_tx_control(uint8_t output, uint8_t tx_mode)
Sets the output status.
Definition adn4604.c:42
mmc_err adn4604_active_map(uint8_t map)
Sets the active map on the IC.
Definition adn4604.c:125
mmc_err adn4604_xpt_config(uint8_t map, adn_connect_map_t xpt_con)
Configures the cross-connection map.
Definition adn4604.c:110
Error handling functions and codes.
mmc_err
Definition mmc_error.h:36
Definition adn4604.h:79
adn_connect_map_t map_connect
Definition adn4604.h:81
uint8_t map_reg
Definition adn4604.h:80