openMMC
Open Source Modular MMC for AMCs
Loading...
Searching...
No Matches
fru.h
Go to the documentation of this file.
1/*
2 * openMMC -- Open Source modular IPM Controller firmware
3 *
4 * Copyright (C) 2015 Julian Mendez <julian.mendez@cern.ch>
5 * Copyright (C) 2015-2016 Henrique Silva <henrique.silva@lnls.br>
6 *
7 * This program is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 *
20 * @license GPL-3.0+ <http://spdx.org/licenses/GPL-3.0+>
21 */
22
23#ifndef FRU_H_
24#define FRU_H_
25
26#include <stdint.h>
27#include <stdbool.h>
28
29enum {
31#ifdef MODULE_RTM
32 FRU_RTM,
33#endif
35};
36
37typedef size_t (* fru_build_t)(uint8_t **buffer);
38typedef size_t (* fru_st_read_t)(uint8_t id, uint16_t address, uint8_t *buffer, size_t len, uint32_t timeout);
39typedef size_t (* fru_st_write_t)(uint8_t id, uint16_t address, uint8_t *buffer, size_t len, uint32_t timeout);
40
47
48typedef struct fru_data {
50 uint8_t *buffer;
51 size_t fru_size;
52 bool runtime;
54
55void fru_init( uint8_t id );
56size_t fru_read( uint8_t id, uint8_t *rx_buff, uint16_t offset, size_t len );
57size_t fru_write( uint8_t id, uint8_t *tx_buff, uint16_t offset, size_t len );
58uint8_t fru_check_integrity( uint8_t id, size_t *fru_size );
59
60#endif
@ FRU_AMC
Definition fru.h:30
@ FRU_COUNT
Definition fru.h:34
struct fru_cfg fru_cfg_t
size_t(* fru_build_t)(uint8_t **buffer)
Definition fru.h:37
struct fru_data fru_data_t
size_t(* fru_st_write_t)(uint8_t id, uint16_t address, uint8_t *buffer, size_t len, uint32_t timeout)
Definition fru.h:39
size_t fru_write(uint8_t id, uint8_t *tx_buff, uint16_t offset, size_t len)
Definition fru.c:251
uint8_t fru_check_integrity(uint8_t id, size_t *fru_size)
Definition fru.c:62
size_t(* fru_st_read_t)(uint8_t id, uint16_t address, uint8_t *buffer, size_t len, uint32_t timeout)
Definition fru.h:38
void fru_init(uint8_t id)
Definition fru.c:39
size_t fru_read(uint8_t id, uint8_t *rx_buff, uint16_t offset, size_t len)
Definition fru.c:217
Definition fru.h:41
fru_build_t build_f
Definition fru.h:43
fru_st_read_t read_f
Definition fru.h:44
uint8_t eeprom_id
Definition fru.h:42
fru_st_write_t write_f
Definition fru.h:45
Definition fru.h:48
bool runtime
Definition fru.h:52
size_t fru_size
Definition fru.h:51
uint8_t * buffer
Definition fru.h:50
const fru_cfg_t cfg
Definition fru.h:49