OpenBIC
OpenSource Bridge-IC
clock_shell.c File Reference
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <zephyr.h>
#include <logging/log.h>
#include <sys/slist.h>
#include "libutil.h"
#include "plat_i2c.h"
#include "clock_shell.h"
Include dependency graph for clock_shell.c:

Classes

struct  _clock_default_info
 

Macros

#define CLK_GEN_312M_ADDR   (0x12 >> 1)
 
#define CLK_GEN_100M_ADDR   (0xD0 >> 1)
 
#define CLK_BUF_U471_ADDR   (0xCE >> 1)
 
#define CLK_BUF_U519_ADDR   (0xD8 >> 1)
 
#define CLK_GEN_312M_SW_RESET_OFFSET   0x0C
 
#define CLK_GEN_312M_LOSMON_0_STS_OFFSET   0x30
 
#define CLK_GEN_312M_LOSMON_1_STS_OFFSET   0x40
 
#define CLK_GEN_312M_LOSMON_2_STS_OFFSET   0x50
 
#define CLK_GEN_312M_ACTMON_0_STS_OFFSET   0x60
 
#define CLK_GEN_312M_ACTMON_1_STS_OFFSET   0x80
 
#define CLK_BUF_100M_WRITE_LOCK_CLEAR_LOS_EVENT_OFFSET   0x27
 
#define CLK_GEN_312M_PAGE_REGISTER   0xFC
 
#define CLK_BUF_100M_BYTE_COUNT   0x7
 
#define REGISTER_BYTE_MAX   4
 

Typedefs

typedef struct _clock_default_info clock_default_info
 

Functions

 LOG_MODULE_REGISTER (clock_shell)
 
int find_clock_address_and_bus_by_clock_name_index (uint8_t clock_index, uint8_t *addr, uint8_t *bus)
 
int check_clock_offset_msb (uint8_t offset_msb, uint8_t addr, uint8_t bus)
 
bool clock_enum_get (uint8_t *name, uint8_t *num)
 
void cmd_set_clock (const struct shell *shell, size_t argc, char **argv)
 
void cmd_get_clock (const struct shell *shell, size_t argc, char **argv)
 
void cmd_get_clock_status (const struct shell *shell, size_t argc, char **argv)
 
void cmd_clear_clock_status (const struct shell *shell, size_t argc, char **argv)
 
bool clock_name_get (uint8_t index, uint8_t **name)
 
 SHELL_DYNAMIC_CMD_CREATE (clock_name, all_clock_name_get)
 
 SHELL_STATIC_SUBCMD_SET_CREATE (sub_clock_cmds, SHELL_CMD_ARG(set, &clock_name, "set <clock> <reg-offset> <value>|default", cmd_set_clock, 4, 3), SHELL_CMD_ARG(get, &clock_name, "get <clock> <reg-offset> <read_length>", cmd_get_clock, 4, 0), SHELL_SUBCMD_SET_END)
 
 SHELL_CMD_REGISTER (clock, &sub_clock_cmds, "Clock commands for AG", NULL)
 
 SHELL_STATIC_SUBCMD_SET_CREATE (sub_clock_status_cmds, SHELL_CMD_ARG(get, &clock_name, "get <clock>", cmd_get_clock_status, 2, 0), SHELL_CMD_ARG(clear, &clock_name, "clear <clock>", cmd_clear_clock_status, 2, 0), SHELL_SUBCMD_SET_END)
 
 SHELL_CMD_REGISTER (clock_status, &sub_clock_status_cmds, "Clock status commands for AG", NULL)
 

Variables

clock_compnt_mapping clock_compnt_mapping_table []
 

Macro Definition Documentation

◆ CLK_BUF_100M_BYTE_COUNT

#define CLK_BUF_100M_BYTE_COUNT   0x7

◆ CLK_BUF_100M_WRITE_LOCK_CLEAR_LOS_EVENT_OFFSET

#define CLK_BUF_100M_WRITE_LOCK_CLEAR_LOS_EVENT_OFFSET   0x27

◆ CLK_BUF_U471_ADDR

#define CLK_BUF_U471_ADDR   (0xCE >> 1)

◆ CLK_BUF_U519_ADDR

#define CLK_BUF_U519_ADDR   (0xD8 >> 1)

◆ CLK_GEN_100M_ADDR

#define CLK_GEN_100M_ADDR   (0xD0 >> 1)

◆ CLK_GEN_312M_ACTMON_0_STS_OFFSET

#define CLK_GEN_312M_ACTMON_0_STS_OFFSET   0x60

◆ CLK_GEN_312M_ACTMON_1_STS_OFFSET

#define CLK_GEN_312M_ACTMON_1_STS_OFFSET   0x80

◆ CLK_GEN_312M_ADDR

#define CLK_GEN_312M_ADDR   (0x12 >> 1)

◆ CLK_GEN_312M_LOSMON_0_STS_OFFSET

#define CLK_GEN_312M_LOSMON_0_STS_OFFSET   0x30

◆ CLK_GEN_312M_LOSMON_1_STS_OFFSET

#define CLK_GEN_312M_LOSMON_1_STS_OFFSET   0x40

◆ CLK_GEN_312M_LOSMON_2_STS_OFFSET

#define CLK_GEN_312M_LOSMON_2_STS_OFFSET   0x50

◆ CLK_GEN_312M_PAGE_REGISTER

#define CLK_GEN_312M_PAGE_REGISTER   0xFC

◆ CLK_GEN_312M_SW_RESET_OFFSET

#define CLK_GEN_312M_SW_RESET_OFFSET   0x0C

◆ REGISTER_BYTE_MAX

#define REGISTER_BYTE_MAX   4

Typedef Documentation

◆ clock_default_info

Function Documentation

◆ check_clock_offset_msb()

int check_clock_offset_msb ( uint8_t  offset_msb,
uint8_t  addr,
uint8_t  bus 
)
Here is the call graph for this function:

◆ clock_enum_get()

bool clock_enum_get ( uint8_t *  name,
uint8_t *  num 
)

◆ clock_name_get()

bool clock_name_get ( uint8_t  index,
uint8_t **  name 
)

◆ cmd_clear_clock_status()

void cmd_clear_clock_status ( const struct shell *  shell,
size_t  argc,
char **  argv 
)
Here is the call graph for this function:

◆ cmd_get_clock()

void cmd_get_clock ( const struct shell *  shell,
size_t  argc,
char **  argv 
)
Here is the call graph for this function:

◆ cmd_get_clock_status()

void cmd_get_clock_status ( const struct shell *  shell,
size_t  argc,
char **  argv 
)
Here is the call graph for this function:

◆ cmd_set_clock()

void cmd_set_clock ( const struct shell *  shell,
size_t  argc,
char **  argv 
)
Here is the call graph for this function:

◆ find_clock_address_and_bus_by_clock_name_index()

int find_clock_address_and_bus_by_clock_name_index ( uint8_t  clock_index,
uint8_t *  addr,
uint8_t *  bus 
)

◆ LOG_MODULE_REGISTER()

LOG_MODULE_REGISTER ( clock_shell  )

◆ SHELL_CMD_REGISTER() [1/2]

SHELL_CMD_REGISTER ( clock  ,
sub_clock_cmds,
"Clock commands for AG"  ,
NULL   
)

◆ SHELL_CMD_REGISTER() [2/2]

SHELL_CMD_REGISTER ( clock_status  ,
sub_clock_status_cmds,
"Clock status commands for AG"  ,
NULL   
)

◆ SHELL_DYNAMIC_CMD_CREATE()

SHELL_DYNAMIC_CMD_CREATE ( clock_name  ,
all_clock_name_get   
)

◆ SHELL_STATIC_SUBCMD_SET_CREATE() [1/2]

SHELL_STATIC_SUBCMD_SET_CREATE ( sub_clock_cmds  ,
SHELL_CMD_ARG(set, &clock_name, "set <clock> <reg-offset> <value>|default", cmd_set_clock, 4, 3)  ,
SHELL_CMD_ARG(get, &clock_name, "get <clock> <reg-offset> <read_length>", cmd_get_clock, 4, 0)  ,
SHELL_SUBCMD_SET_END   
)

◆ SHELL_STATIC_SUBCMD_SET_CREATE() [2/2]

SHELL_STATIC_SUBCMD_SET_CREATE ( sub_clock_status_cmds  ,
SHELL_CMD_ARG(get, &clock_name, "get <clock>", cmd_get_clock_status, 2, 0)  ,
SHELL_CMD_ARG(clear, &clock_name, "clear <clock>", cmd_clear_clock_status, 2, 0)  ,
SHELL_SUBCMD_SET_END   
)

Variable Documentation

◆ clock_compnt_mapping_table

clock_compnt_mapping clock_compnt_mapping_table[]
Initial value:
= {
{ CLKGEN_312M, CLK_GEN_312M_ADDR, I2C_BUS1, "CLKGEN_312M" },
{ CLKBUF_100M_U471, CLK_BUF_U471_ADDR, I2C_BUS1, "CLKBUF_100M_U471" },
{ CLKBUF_100M_U519, CLK_BUF_U519_ADDR, I2C_BUS1, "CLKBUF_100M_U519" },
{ CLKGEN_100M, CLK_GEN_100M_ADDR, I2C_BUS1, "CLKGEN_100M" },
}
#define I2C_BUS1
Definition: plat_i2c.h:24
#define CLK_BUF_U471_ADDR
Definition: clock_shell.c:31
#define CLK_BUF_U519_ADDR
Definition: clock_shell.c:32
#define CLK_GEN_100M_ADDR
Definition: clock_shell.c:30
#define CLK_GEN_312M_ADDR
Definition: clock_shell.c:29
@ CLKGEN_312M
Definition: clock_shell.h:23
@ CLKBUF_100M_U471
Definition: clock_shell.h:24
@ CLKBUF_100M_U519
Definition: clock_shell.h:25
@ CLKGEN_100M
Definition: clock_shell.h:26