OpenBIC
OpenSource Bridge-IC
eeprom.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 EEPROM_H
18
#define EEPROM_H
19
20
#include <stdbool.h>
21
#include <stdint.h>
22
#include "plat_def.h"
23
24
#ifndef EEPROM_WRITE_SIZE
25
#define EEPROM_WRITE_SIZE 0x20
26
#endif
27
28
// define offset, size and order for EEPROM write/read
29
#define FRU_START 0x0000
// start at 0x000
30
#define FRU_SIZE 0x0400
// size 1KB
31
32
#define SEL_START 0x0400
33
#define SEL_SIZE 0x0400
34
35
#define GUID_START 0x0800
36
#define GUID_SIZE 0x0100
37
38
#define BIC_CONFIG_START 0x0900
39
#define BIC_CONFIG_SIZE 0x0100
40
// next start should be 0x0A00
41
42
typedef
struct
_EEPROM_CFG_
{
43
uint8_t
dev_type
;
44
uint8_t
dev_id
;
45
uint8_t
port
;
46
uint8_t
target_addr
;
47
uint8_t
access
;
48
uint16_t
start_offset
;
49
uint16_t
max_size
;
50
bool
mux_present
;
51
uint8_t
mux_addr
;
52
uint8_t
mux_channel
;
53
struct
k_mutex *
bus_mutex
;
54
}
EEPROM_CFG
;
55
56
typedef
struct
_EEPROM_ENTRY_
{
57
EEPROM_CFG
config
;
58
uint16_t
offset
;
59
uint16_t
data_len
;
60
uint8_t
data
[
EEPROM_WRITE_SIZE
];
61
}
EEPROM_ENTRY
;
62
63
bool
eeprom_write
(
EEPROM_ENTRY
*entry);
64
bool
eeprom_read
(
EEPROM_ENTRY
*entry);
65
66
#endif
EEPROM_WRITE_SIZE
#define EEPROM_WRITE_SIZE
Definition:
eeprom.h:25
EEPROM_CFG
struct _EEPROM_CFG_ EEPROM_CFG
eeprom_write
bool eeprom_write(EEPROM_ENTRY *entry)
Definition:
eeprom.c:58
EEPROM_ENTRY
struct _EEPROM_ENTRY_ EEPROM_ENTRY
eeprom_read
bool eeprom_read(EEPROM_ENTRY *entry)
Definition:
eeprom.c:108
_EEPROM_CFG_
Definition:
eeprom.h:42
_EEPROM_CFG_::dev_id
uint8_t dev_id
Definition:
eeprom.h:44
_EEPROM_CFG_::access
uint8_t access
Definition:
eeprom.h:47
_EEPROM_CFG_::bus_mutex
struct k_mutex * bus_mutex
Definition:
eeprom.h:53
_EEPROM_CFG_::max_size
uint16_t max_size
Definition:
eeprom.h:49
_EEPROM_CFG_::start_offset
uint16_t start_offset
Definition:
eeprom.h:48
_EEPROM_CFG_::dev_type
uint8_t dev_type
Definition:
eeprom.h:43
_EEPROM_CFG_::mux_present
bool mux_present
Definition:
eeprom.h:50
_EEPROM_CFG_::port
uint8_t port
Definition:
eeprom.h:45
_EEPROM_CFG_::mux_addr
uint8_t mux_addr
Definition:
eeprom.h:51
_EEPROM_CFG_::mux_channel
uint8_t mux_channel
Definition:
eeprom.h:52
_EEPROM_CFG_::target_addr
uint8_t target_addr
Definition:
eeprom.h:46
_EEPROM_ENTRY_
Definition:
eeprom.h:56
_EEPROM_ENTRY_::data_len
uint16_t data_len
Definition:
eeprom.h:59
_EEPROM_ENTRY_::config
EEPROM_CFG config
Definition:
eeprom.h:57
_EEPROM_ENTRY_::data
uint8_t data[EEPROM_WRITE_SIZE]
Definition:
eeprom.h:60
_EEPROM_ENTRY_::offset
uint16_t offset
Definition:
eeprom.h:58
common
dev
include
eeprom.h
Generated by
1.9.2