no-OS
Classes | Macros | Enumerations | Functions
max24287.h File Reference
#include <stdint.h>
#include "no_os_util.h"
#include "no_os_mdio.h"
Include dependency graph for max24287.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  max24287_init_param
 
struct  max24287_desc
 

Macros

#define MAX24287_REG(page, addr)   (((page) << 5) | ((addr) & 0x1f))
 
#define MAX24287_PAGE(addr)   ((addr) >> 5)
 
#define MAX24287_ADDR(addr)   ((addr) & 0x1f)
 
#define MAX24287_BMCR   0
 
#define MAX24287_DP_RST_MASK   NO_OS_BIT(15)
 
#define MAX24287_AN_EN_MASK   NO_OS_BIT(12)
 
#define MAX24287_AN_START_MASK   NO_OS_BIT(9)
 
#define MAX24287_BMSR   1
 
#define MAX24287_LINK_ST_MASK   NO_OS_BIT(2)
 
#define MAX24287_ID1   2
 
#define MAX24287_ID2   3
 
#define MAX24287_AN_ADV   4
 
#define MAX24287_AN_ADV_W_MASK   NO_OS_BIT(0)
 
#define MAX24287_LK_MASK   NO_OS_BIT(15)
 
#define MAX24287_DPLX_MASK   NO_OS_BIT(12)
 
#define MAX24287_SPD_MASK   NO_OS_GENMASK(11, 10)
 
#define MAX24287_AN_RX   5
 
#define MAX24287_AN_EXP   6
 
#define MAX24287_AN_RX_PAGE   NO_OS_BIT(1)
 
#define MAX24287_EXT_STAT   15
 
#define MAX24287_JIT_DIAG   16
 
#define MAX24287_PCSCR   17
 
#define MAX24287_WD_DIS_MASK   NO_OS_BIT(6)
 
#define MAX24287_BASEX_MASK   NO_OS_BIT(4)
 
#define MAX24287_EN_CDET_MASK   NO_OS_BIT(0)
 
#define MAX24287_GMIICR   18
 
#define MAX24287_GMIICR_W_MASK   NO_OS_BIT(7)
 
#define MAX24287_GMIICR_SPD_MASK   NO_OS_GENMASK(15, 14)
 
#define MAX24287_GMIICR_DTE_DCE_MASK   NO_OS_BIT(12)
 
#define MAX24287_GMIICR_DDR_MASK   NO_OS_BIT(11)
 
#define MAX24287_GMIICR_TXCLK_EN_MASK   NO_OS_BIT(10)
 
#define MAX24287_CR   19
 
#define MAX24287_IR   20
 
#define MAX24287_PAGE_IE   NO_OS_BIT(10)
 
#define MAX24287_ID   MAX24287_REG(1, 16)
 
#define MAX24287_GPIOCR1   MAX24287_REG(1, 17)
 
#define MAX24287_RST_MASK   NO_OS_BIT(15)
 
#define MAX24287_GPO1_SEL   NO_OS_GENMASK(14, 12)
 
#define MAX24287_GPO2_SEL   NO_OS_GENMASK(11, 9)
 
#define MAX24287_GPIO1_SEL   NO_OS_GENMASK(8, 6)
 
#define MAX24287_GPIO2_SEL   NO_OS_GENMASK(5, 3)
 
#define MAX24287_GPIO3_SEL   NO_OS_GENMASK(2, 0)
 
#define MAX24287_GPIOCR2   MAX24287_REG(1, 18)
 
#define MAX24287_GPIOSR   MAX24287_REG(1, 19)
 
#define MAX24287_PTPCR1   MAX24287_REG(2, 16)
 
#define MAX24287_PTPCR1_W_MASK   NO_OS_BIT(14)
 
#define MAX24287_PLL_PWDN_MASK   NO_OS_BIT(5)
 
#define MAX24287_TX_PWDN_MASK   NO_OS_BIT(3)
 
#define MAX24287_RX_PWDN_MASK   NO_OS_BIT(2)
 
#define MAX24287_PAGESEL   31
 
#define MAX24287_PAGE_MASK   NO_OS_GENMASK(1, 0)
 

Enumerations

enum  max24287_parallel {
  MAX24287_TBI,
  MAX24287_RTBI,
  MAX24287_GMII,
  MAX24287_RGMII,
  MAX24287_MII
}
 
enum  max24287_serial {
  MAX24287_SGMII,
  MAX24287_1000BASEX
}
 
enum  max24287_speed {
  MAX24287_10_HALFDUPLEX,
  MAX24287_10_FULLDUPLEX,
  MAX24287_100_HALFDUPLEX,
  MAX24287_100_FULLDUPLEX,
  MAX24287_1000_HALFDUPLEX,
  MAX24287_1000_FULLDUPLEX,
  MAX24287_1250_HALFDUPLEX,
  MAX24287_1250_FULLDUPLEX
}
 

Functions

int max24287_init (struct max24287_desc **dev, struct max24287_init_param *param)
 
int max24287_remove (struct max24287_desc *dev)
 
int max24287_write (struct max24287_desc *dev, uint8_t addr, uint16_t val)
 
int max24287_read (struct max24287_desc *dev, uint8_t addr, uint16_t *val)
 
int max24287_write_bits (struct max24287_desc *dev, uint8_t addr, uint16_t val, uint16_t bitmask)
 
int max24287_hard_reset (struct max24287_desc *dev)
 
int max24287_soft_reset (struct max24287_desc *dev)
 
int max24287_config_parallel (struct max24287_desc *dev, enum max24287_parallel par, enum max24287_speed speed)
 
int max24287_get_config_parallel (struct max24287_desc *dev, enum max24287_parallel *par, enum max24287_speed *speed)
 
int max24287_config_serial (struct max24287_desc *dev, enum max24287_serial ser, enum max24287_speed speed)
 
int max24287_get_config_serial (struct max24287_desc *dev, enum max24287_serial *ser, enum max24287_speed *speed)
 
int max24287_config_link (struct max24287_desc *dev, bool up)
 
bool max24287_link_is_up (struct max24287_desc *dev)
 
void max24287_regmap (struct max24287_desc *dev)
 

Macro Definition Documentation

◆ MAX24287_ADDR

#define MAX24287_ADDR (   addr)    ((addr) & 0x1f)

◆ MAX24287_AN_ADV

#define MAX24287_AN_ADV   4

◆ MAX24287_AN_ADV_W_MASK

#define MAX24287_AN_ADV_W_MASK   NO_OS_BIT(0)

◆ MAX24287_AN_EN_MASK

#define MAX24287_AN_EN_MASK   NO_OS_BIT(12)

◆ MAX24287_AN_EXP

#define MAX24287_AN_EXP   6

◆ MAX24287_AN_RX

#define MAX24287_AN_RX   5

◆ MAX24287_AN_RX_PAGE

#define MAX24287_AN_RX_PAGE   NO_OS_BIT(1)

◆ MAX24287_AN_START_MASK

#define MAX24287_AN_START_MASK   NO_OS_BIT(9)

◆ MAX24287_BASEX_MASK

#define MAX24287_BASEX_MASK   NO_OS_BIT(4)

◆ MAX24287_BMCR

#define MAX24287_BMCR   0

◆ MAX24287_BMSR

#define MAX24287_BMSR   1

◆ MAX24287_CR

#define MAX24287_CR   19

◆ MAX24287_DP_RST_MASK

#define MAX24287_DP_RST_MASK   NO_OS_BIT(15)

◆ MAX24287_DPLX_MASK

#define MAX24287_DPLX_MASK   NO_OS_BIT(12)

◆ MAX24287_EN_CDET_MASK

#define MAX24287_EN_CDET_MASK   NO_OS_BIT(0)

◆ MAX24287_EXT_STAT

#define MAX24287_EXT_STAT   15

◆ MAX24287_GMIICR

#define MAX24287_GMIICR   18

◆ MAX24287_GMIICR_DDR_MASK

#define MAX24287_GMIICR_DDR_MASK   NO_OS_BIT(11)

◆ MAX24287_GMIICR_DTE_DCE_MASK

#define MAX24287_GMIICR_DTE_DCE_MASK   NO_OS_BIT(12)

◆ MAX24287_GMIICR_SPD_MASK

#define MAX24287_GMIICR_SPD_MASK   NO_OS_GENMASK(15, 14)

◆ MAX24287_GMIICR_TXCLK_EN_MASK

#define MAX24287_GMIICR_TXCLK_EN_MASK   NO_OS_BIT(10)

◆ MAX24287_GMIICR_W_MASK

#define MAX24287_GMIICR_W_MASK   NO_OS_BIT(7)

◆ MAX24287_GPIO1_SEL

#define MAX24287_GPIO1_SEL   NO_OS_GENMASK(8, 6)

◆ MAX24287_GPIO2_SEL

#define MAX24287_GPIO2_SEL   NO_OS_GENMASK(5, 3)

◆ MAX24287_GPIO3_SEL

#define MAX24287_GPIO3_SEL   NO_OS_GENMASK(2, 0)

◆ MAX24287_GPIOCR1

#define MAX24287_GPIOCR1   MAX24287_REG(1, 17)

◆ MAX24287_GPIOCR2

#define MAX24287_GPIOCR2   MAX24287_REG(1, 18)

◆ MAX24287_GPIOSR

#define MAX24287_GPIOSR   MAX24287_REG(1, 19)

◆ MAX24287_GPO1_SEL

#define MAX24287_GPO1_SEL   NO_OS_GENMASK(14, 12)

◆ MAX24287_GPO2_SEL

#define MAX24287_GPO2_SEL   NO_OS_GENMASK(11, 9)

◆ MAX24287_ID

#define MAX24287_ID   MAX24287_REG(1, 16)

◆ MAX24287_ID1

#define MAX24287_ID1   2

◆ MAX24287_ID2

#define MAX24287_ID2   3

◆ MAX24287_IR

#define MAX24287_IR   20

◆ MAX24287_JIT_DIAG

#define MAX24287_JIT_DIAG   16

◆ MAX24287_LINK_ST_MASK

#define MAX24287_LINK_ST_MASK   NO_OS_BIT(2)

◆ MAX24287_LK_MASK

#define MAX24287_LK_MASK   NO_OS_BIT(15)

◆ MAX24287_PAGE

#define MAX24287_PAGE (   addr)    ((addr) >> 5)

◆ MAX24287_PAGE_IE

#define MAX24287_PAGE_IE   NO_OS_BIT(10)

◆ MAX24287_PAGE_MASK

#define MAX24287_PAGE_MASK   NO_OS_GENMASK(1, 0)

◆ MAX24287_PAGESEL

#define MAX24287_PAGESEL   31

◆ MAX24287_PCSCR

#define MAX24287_PCSCR   17

◆ MAX24287_PLL_PWDN_MASK

#define MAX24287_PLL_PWDN_MASK   NO_OS_BIT(5)

◆ MAX24287_PTPCR1

#define MAX24287_PTPCR1   MAX24287_REG(2, 16)

◆ MAX24287_PTPCR1_W_MASK

#define MAX24287_PTPCR1_W_MASK   NO_OS_BIT(14)

◆ MAX24287_REG

#define MAX24287_REG (   page,
  addr 
)    (((page) << 5) | ((addr) & 0x1f))

◆ MAX24287_RST_MASK

#define MAX24287_RST_MASK   NO_OS_BIT(15)

◆ MAX24287_RX_PWDN_MASK

#define MAX24287_RX_PWDN_MASK   NO_OS_BIT(2)

◆ MAX24287_SPD_MASK

#define MAX24287_SPD_MASK   NO_OS_GENMASK(11, 10)

◆ MAX24287_TX_PWDN_MASK

#define MAX24287_TX_PWDN_MASK   NO_OS_BIT(3)

◆ MAX24287_WD_DIS_MASK

#define MAX24287_WD_DIS_MASK   NO_OS_BIT(6)

Enumeration Type Documentation

◆ max24287_parallel

Enumerator
MAX24287_TBI 
MAX24287_RTBI 
MAX24287_GMII 
MAX24287_RGMII 
MAX24287_MII 

◆ max24287_serial

Enumerator
MAX24287_SGMII 
MAX24287_1000BASEX 

◆ max24287_speed

Enumerator
MAX24287_10_HALFDUPLEX 
MAX24287_10_FULLDUPLEX 
MAX24287_100_HALFDUPLEX 
MAX24287_100_FULLDUPLEX 
MAX24287_1000_HALFDUPLEX 
MAX24287_1000_FULLDUPLEX 
MAX24287_1250_HALFDUPLEX 
MAX24287_1250_FULLDUPLEX 

Function Documentation

◆ max24287_config_link()

int max24287_config_link ( struct max24287_desc dev,
bool  up 
)
Here is the caller graph for this function:

◆ max24287_config_parallel()

int max24287_config_parallel ( struct max24287_desc dev,
enum max24287_parallel  par,
enum max24287_speed  speed 
)
Here is the caller graph for this function:

◆ max24287_config_serial()

int max24287_config_serial ( struct max24287_desc dev,
enum max24287_serial  ser,
enum max24287_speed  speed 
)
Here is the caller graph for this function:

◆ max24287_get_config_parallel()

int max24287_get_config_parallel ( struct max24287_desc dev,
enum max24287_parallel par,
enum max24287_speed speed 
)

◆ max24287_get_config_serial()

int max24287_get_config_serial ( struct max24287_desc dev,
enum max24287_serial ser,
enum max24287_speed speed 
)

◆ max24287_hard_reset()

int max24287_hard_reset ( struct max24287_desc dev)
Here is the caller graph for this function:

◆ max24287_init()

int max24287_init ( struct max24287_desc **  dev,
struct max24287_init_param param 
)

◆ max24287_link_is_up()

bool max24287_link_is_up ( struct max24287_desc dev)

◆ max24287_read()

int max24287_read ( struct max24287_desc dev,
uint8_t  addr,
uint16_t *  val 
)
Here is the caller graph for this function:

◆ max24287_regmap()

void max24287_regmap ( struct max24287_desc dev)

◆ max24287_remove()

int max24287_remove ( struct max24287_desc dev)

◆ max24287_soft_reset()

int max24287_soft_reset ( struct max24287_desc dev)
Here is the caller graph for this function:

◆ max24287_write()

int max24287_write ( struct max24287_desc dev,
uint8_t  addr,
uint16_t  val 
)
Here is the caller graph for this function:

◆ max24287_write_bits()

int max24287_write_bits ( struct max24287_desc dev,
uint8_t  addr,
uint16_t  val,
uint16_t  bitmask 
)
Here is the caller graph for this function: