OpenBIC
OpenSource Bridge-IC
lattice.h
Go to the documentation of this file.
1/*
2 * Copyright (c) Meta Platforms, Inc. and affiliates.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#ifndef LATTICE_H
18#define LATTICE_H
19
20#include "stdint.h"
21
22typedef enum lattice_dev_type {
32
34 CFG0 = 0,
39};
40
41enum {
44};
45
47 unsigned long int QF;
48 uint32_t *CF;
49 uint32_t CF_Line;
50 uint32_t *UFM;
51 uint32_t UFM_Line;
52 uint32_t Version;
53 uint32_t CheckSum;
54 uint32_t FEARBits;
55 uint32_t FeatureRow;
56};
57
58typedef struct lattice_update_config {
60 uint8_t interface; //i2c or jtag
61 uint8_t bus; //i2c/jtag
62 uint8_t addr; //i2c
63 uint8_t *data; //received data
64 uint32_t data_ofs; //received data's ofset
65 uint32_t data_len; //received data's length
66 uint32_t next_ofs; //next request data's ofset
67 uint32_t next_len; //next request data's length
69
72
74 char name[20];
75 uint32_t id;
78};
79
81bool cpld_i2c_get_id(uint8_t bus, uint8_t addr, uint32_t *dev_id);
82bool cpld_i2c_get_usercode(uint8_t bus, uint8_t addr, uint32_t *usercode);
84
85#endif
uint8_t addr
Definition: isl69259.c:0
lattice_dev_type
Definition: lattice.h:22
@ LATTICE_LCMX03_9400C
Definition: lattice.h:28
@ LATTICE_UNKNOWN
Definition: lattice.h:30
@ LATTICE_LCMX02_2000HC
Definition: lattice.h:23
@ LATTICE_LCMX02_7000HC
Definition: lattice.h:25
@ LATTICE_LCMX03_2100C
Definition: lattice.h:26
@ LATTICE_LCMX02_4000HC
Definition: lattice.h:24
@ LATTICE_LCMX03_4300C
Definition: lattice.h:27
@ LATTICE_LFMNX_50
Definition: lattice.h:29
bool(* cpld_jtag_update_func)(lattice_update_config_t *config)
Definition: lattice.h:71
bool(* cpld_i2C_update_func)(lattice_update_config_t *config)
Definition: lattice.h:70
enum lattice_dev_type lattice_dev_type_t
struct lattice_update_config lattice_update_config_t
bool cpld_i2c_get_id(uint8_t bus, uint8_t addr, uint32_t *dev_id)
Definition: lattice.c:554
lattice_dev_type_t find_type_by_str(char *str)
Definition: lattice.c:541
bool lattice_fwupdate(lattice_update_config_t *config)
Definition: lattice.c:772
sector_type
Definition: lattice.h:33
@ CFG1
Definition: lattice.h:35
@ UFM2
Definition: lattice.h:38
@ UFM0
Definition: lattice.h:36
@ CFG0
Definition: lattice.h:34
@ UFM1
Definition: lattice.h:37
@ CPLD_TAR_I2C
Definition: lattice.h:42
@ CPLD_TAR_JTAG
Definition: lattice.h:43
bool cpld_i2c_get_usercode(uint8_t bus, uint8_t addr, uint32_t *usercode)
Definition: lattice.c:586
Definition: lattice.h:73
cpld_jtag_update_func cpld_jtag_update
Definition: lattice.h:77
cpld_i2C_update_func cpld_i2C_update
Definition: lattice.h:76
uint32_t id
Definition: lattice.h:75
Definition: lattice.h:46
uint32_t FEARBits
Definition: lattice.h:54
uint32_t FeatureRow
Definition: lattice.h:55
unsigned long int QF
Definition: lattice.h:47
uint32_t CF_Line
Definition: lattice.h:49
uint32_t Version
Definition: lattice.h:52
uint32_t UFM_Line
Definition: lattice.h:51
uint32_t CheckSum
Definition: lattice.h:53
uint32_t * UFM
Definition: lattice.h:50
uint32_t * CF
Definition: lattice.h:48
Definition: lattice.h:58
uint8_t bus
Definition: lattice.h:61
uint32_t next_ofs
Definition: lattice.h:66
lattice_dev_type_t type
Definition: lattice.h:59
uint8_t addr
Definition: lattice.h:62
uint32_t next_len
Definition: lattice.h:67
uint32_t data_len
Definition: lattice.h:65
uint8_t interface
Definition: lattice.h:60
uint32_t data_ofs
Definition: lattice.h:64
uint8_t * data
Definition: lattice.h:63
name
Definition: plat_i2c.h:24