1 /* 2 * Arm SCP/MCP Software 3 * Copyright (c) 2018-2021, Arm Limited and Contributors. All rights reserved. 4 * 5 * SPDX-License-Identifier: BSD-3-Clause 6 */ 7 8 #ifndef INTERNAL_I2C_REG_ACCESS_H 9 #define INTERNAL_I2C_REG_ACCESS_H 10 11 #include <internal/i2c_driver.h> 12 13 #include <stdint.h> 14 15 /* F_I2C Register Write */ 16 void f_i2c_write_BSR(I2C_ST_PACKET_INFO_t *packet_info, uint8_t value); 17 void f_i2c_write_BCR(I2C_ST_PACKET_INFO_t *packet_info, uint8_t value); 18 void f_i2c_write_CCR(I2C_ST_PACKET_INFO_t *packet_info, uint8_t value); 19 void f_i2c_write_ADR(I2C_ST_PACKET_INFO_t *packet_info, uint8_t value); 20 void f_i2c_write_DAR(I2C_ST_PACKET_INFO_t *packet_info, uint8_t value); 21 void f_i2c_write_CSR(I2C_ST_PACKET_INFO_t *packet_info, uint8_t value); 22 void f_i2c_write_FSR(I2C_ST_PACKET_INFO_t *packet_info, uint8_t value); 23 void f_i2c_write_BC2R(I2C_ST_PACKET_INFO_t *packet_info, uint8_t value); 24 void f_i2c_write_UNDEFINED(I2C_ST_PACKET_INFO_t *packet_info, uint8_t value); 25 26 /* F_I2C Register Read */ 27 uint8_t f_i2c_read_BSR(I2C_ST_PACKET_INFO_t *packet_info); 28 uint8_t f_i2c_read_BCR(I2C_ST_PACKET_INFO_t *packet_info); 29 uint8_t f_i2c_read_CCR(I2C_ST_PACKET_INFO_t *packet_info); 30 uint8_t f_i2c_read_ADR(I2C_ST_PACKET_INFO_t *packet_info); 31 uint8_t f_i2c_read_DAR(I2C_ST_PACKET_INFO_t *packet_info); 32 uint8_t f_i2c_read_CSR(I2C_ST_PACKET_INFO_t *packet_info); 33 uint8_t f_i2c_read_FSR(I2C_ST_PACKET_INFO_t *packet_info); 34 uint8_t f_i2c_read_BC2R(I2C_ST_PACKET_INFO_t *packet_info); 35 uint8_t f_i2c_read_UNDEFINED(I2C_ST_PACKET_INFO_t *packet_info); 36 37 /* F_I2C_SP1 Register Write */ 38 void f_i2c_sp1_write_BSR(I2C_ST_PACKET_INFO_t *packet_info, uint8_t value); 39 void f_i2c_sp1_write_BS2R(I2C_ST_PACKET_INFO_t *packet_info, uint8_t value); 40 void f_i2c_sp1_write_BCR(I2C_ST_PACKET_INFO_t *packet_info, uint8_t value); 41 void f_i2c_sp1_write_BC2R(I2C_ST_PACKET_INFO_t *packet_info, uint8_t value); 42 void f_i2c_sp1_write_ADR(I2C_ST_PACKET_INFO_t *packet_info, uint8_t value); 43 void f_i2c_sp1_write_DAR(I2C_ST_PACKET_INFO_t *packet_info, uint8_t value); 44 void f_i2c_sp1_write_NFR(I2C_ST_PACKET_INFO_t *packet_info, uint8_t value); 45 void f_i2c_sp1_write_TLWR(I2C_ST_PACKET_INFO_t *packet_info, uint8_t value); 46 void f_i2c_sp1_write_TLW2R(I2C_ST_PACKET_INFO_t *packet_info, uint8_t value); 47 void f_i2c_sp1_write_THWR(I2C_ST_PACKET_INFO_t *packet_info, uint8_t value); 48 void f_i2c_sp1_write_THW2R(I2C_ST_PACKET_INFO_t *packet_info, uint8_t value); 49 void f_i2c_sp1_write_TBFR(I2C_ST_PACKET_INFO_t *packet_info, uint8_t value); 50 void f_i2c_sp1_write_TBF2R(I2C_ST_PACKET_INFO_t *packet_info, uint8_t value); 51 void f_i2c_sp1_write_TRSR(I2C_ST_PACKET_INFO_t *packet_info, uint8_t value); 52 void f_i2c_sp1_write_TRS2R(I2C_ST_PACKET_INFO_t *packet_info, uint8_t value); 53 void f_i2c_sp1_write_TSHR(I2C_ST_PACKET_INFO_t *packet_info, uint8_t value); 54 void f_i2c_sp1_write_TSH2R(I2C_ST_PACKET_INFO_t *packet_info, uint8_t value); 55 void f_i2c_sp1_write_TPSR(I2C_ST_PACKET_INFO_t *packet_info, uint8_t value); 56 void f_i2c_sp1_write_TPS2R(I2C_ST_PACKET_INFO_t *packet_info, uint8_t value); 57 void f_i2c_sp1_write_TLWRH(I2C_ST_PACKET_INFO_t *packet_info, uint8_t value); 58 void f_i2c_sp1_write_THWRH(I2C_ST_PACKET_INFO_t *packet_info, uint8_t value); 59 void f_i2c_sp1_write_TRSRH(I2C_ST_PACKET_INFO_t *packet_info, uint8_t value); 60 void f_i2c_sp1_write_TSHRH(I2C_ST_PACKET_INFO_t *packet_info, uint8_t value); 61 void f_i2c_sp1_write_TPSRH(I2C_ST_PACKET_INFO_t *packet_info, uint8_t value); 62 void f_i2c_sp1_write_UNDEFINED(I2C_ST_PACKET_INFO_t *packet_info, 63 uint8_t value); 64 65 /* F_I2C_SP1 Register Read */ 66 uint8_t f_i2c_sp1_read_BSR(I2C_ST_PACKET_INFO_t *packet_info); 67 uint8_t f_i2c_sp1_read_BS2R(I2C_ST_PACKET_INFO_t *packet_info); 68 uint8_t f_i2c_sp1_read_BCR(I2C_ST_PACKET_INFO_t *packet_info); 69 uint8_t f_i2c_sp1_read_BC2R(I2C_ST_PACKET_INFO_t *packet_info); 70 uint8_t f_i2c_sp1_read_ADR(I2C_ST_PACKET_INFO_t *packet_info); 71 uint8_t f_i2c_sp1_read_DAR(I2C_ST_PACKET_INFO_t *packet_info); 72 uint8_t f_i2c_sp1_read_NFR(I2C_ST_PACKET_INFO_t *packet_info); 73 uint8_t f_i2c_sp1_read_TLWR(I2C_ST_PACKET_INFO_t *packet_info); 74 uint8_t f_i2c_sp1_read_TLW2R(I2C_ST_PACKET_INFO_t *packet_info); 75 uint8_t f_i2c_sp1_read_THWR(I2C_ST_PACKET_INFO_t *packet_info); 76 uint8_t f_i2c_sp1_read_THW2R(I2C_ST_PACKET_INFO_t *packet_info); 77 uint8_t f_i2c_sp1_read_TBFR(I2C_ST_PACKET_INFO_t *packet_info); 78 uint8_t f_i2c_sp1_read_TBF2R(I2C_ST_PACKET_INFO_t *packet_info); 79 uint8_t f_i2c_sp1_read_TRSR(I2C_ST_PACKET_INFO_t *packet_info); 80 uint8_t f_i2c_sp1_read_TRS2R(I2C_ST_PACKET_INFO_t *packet_info); 81 uint8_t f_i2c_sp1_read_TSHR(I2C_ST_PACKET_INFO_t *packet_info); 82 uint8_t f_i2c_sp1_read_TSH2R(I2C_ST_PACKET_INFO_t *packet_info); 83 uint8_t f_i2c_sp1_read_TPSR(I2C_ST_PACKET_INFO_t *packet_info); 84 uint8_t f_i2c_sp1_read_TPS2R(I2C_ST_PACKET_INFO_t *packet_info); 85 uint8_t f_i2c_sp1_read_TLWRH(I2C_ST_PACKET_INFO_t *packet_info); 86 uint8_t f_i2c_sp1_read_THWRH(I2C_ST_PACKET_INFO_t *packet_info); 87 uint8_t f_i2c_sp1_read_TRSRH(I2C_ST_PACKET_INFO_t *packet_info); 88 uint8_t f_i2c_sp1_read_TSHRH(I2C_ST_PACKET_INFO_t *packet_info); 89 uint8_t f_i2c_sp1_read_TPSRH(I2C_ST_PACKET_INFO_t *packet_info); 90 uint8_t f_i2c_sp1_read_UNDEFINED(I2C_ST_PACKET_INFO_t *packet_info); 91 92 struct I2C_REG_FUNC_TABLE { 93 void (*set_BSR)(I2C_ST_PACKET_INFO_t *packet_info, uint8_t value); 94 void (*set_BS2R)(I2C_ST_PACKET_INFO_t *packet_info, uint8_t value); 95 void (*set_BCR)(I2C_ST_PACKET_INFO_t *packet_info, uint8_t value); 96 void (*set_BC2R)(I2C_ST_PACKET_INFO_t *packet_info, uint8_t value); 97 void (*set_ADR)(I2C_ST_PACKET_INFO_t *packet_info, uint8_t value); 98 void (*set_DAR)(I2C_ST_PACKET_INFO_t *packet_info, uint8_t value); 99 void (*set_NFR)(I2C_ST_PACKET_INFO_t *packet_info, uint8_t value); 100 void (*set_TLWR)(I2C_ST_PACKET_INFO_t *packet_info, uint8_t value); 101 void (*set_TLW2R)(I2C_ST_PACKET_INFO_t *packet_info, uint8_t value); 102 void (*set_THWR)(I2C_ST_PACKET_INFO_t *packet_info, uint8_t value); 103 void (*set_THW2R)(I2C_ST_PACKET_INFO_t *packet_info, uint8_t value); 104 void (*set_TBFR)(I2C_ST_PACKET_INFO_t *packet_info, uint8_t value); 105 void (*set_TBF2R)(I2C_ST_PACKET_INFO_t *packet_info, uint8_t value); 106 void (*set_TRSR)(I2C_ST_PACKET_INFO_t *packet_info, uint8_t value); 107 void (*set_TRS2R)(I2C_ST_PACKET_INFO_t *packet_info, uint8_t value); 108 void (*set_TSHR)(I2C_ST_PACKET_INFO_t *packet_info, uint8_t value); 109 void (*set_TSH2R)(I2C_ST_PACKET_INFO_t *packet_info, uint8_t value); 110 void (*set_TPSR)(I2C_ST_PACKET_INFO_t *packet_info, uint8_t value); 111 void (*set_TPS2R)(I2C_ST_PACKET_INFO_t *packet_info, uint8_t value); 112 void (*set_TLWRH)(I2C_ST_PACKET_INFO_t *packet_info, uint8_t value); 113 void (*set_THWRH)(I2C_ST_PACKET_INFO_t *packet_info, uint8_t value); 114 void (*set_TRSRH)(I2C_ST_PACKET_INFO_t *packet_info, uint8_t value); 115 void (*set_TSHRH)(I2C_ST_PACKET_INFO_t *packet_info, uint8_t value); 116 void (*set_TPSRH)(I2C_ST_PACKET_INFO_t *packet_info, uint8_t value); 117 void (*set_CCR)(I2C_ST_PACKET_INFO_t *packet_info, uint8_t value); 118 void (*set_CSR)(I2C_ST_PACKET_INFO_t *packet_info, uint8_t value); 119 void (*set_FSR)(I2C_ST_PACKET_INFO_t *packet_info, uint8_t value); 120 121 uint8_t (*get_BSR)(I2C_ST_PACKET_INFO_t *packet_info); 122 uint8_t (*get_BS2R)(I2C_ST_PACKET_INFO_t *packet_info); 123 uint8_t (*get_BCR)(I2C_ST_PACKET_INFO_t *packet_info); 124 uint8_t (*get_BC2R)(I2C_ST_PACKET_INFO_t *packet_info); 125 uint8_t (*get_ADR)(I2C_ST_PACKET_INFO_t *packet_info); 126 uint8_t (*get_DAR)(I2C_ST_PACKET_INFO_t *packet_info); 127 uint8_t (*get_NFR)(I2C_ST_PACKET_INFO_t *packet_info); 128 uint8_t (*get_TLWR)(I2C_ST_PACKET_INFO_t *packet_info); 129 uint8_t (*get_TLW2R)(I2C_ST_PACKET_INFO_t *packet_info); 130 uint8_t (*get_THWR)(I2C_ST_PACKET_INFO_t *packet_info); 131 uint8_t (*get_THW2R)(I2C_ST_PACKET_INFO_t *packet_info); 132 uint8_t (*get_TBFR)(I2C_ST_PACKET_INFO_t *packet_info); 133 uint8_t (*get_TBF2R)(I2C_ST_PACKET_INFO_t *packet_info); 134 uint8_t (*get_TRSR)(I2C_ST_PACKET_INFO_t *packet_info); 135 uint8_t (*get_TRS2R)(I2C_ST_PACKET_INFO_t *packet_info); 136 uint8_t (*get_TSHR)(I2C_ST_PACKET_INFO_t *packet_info); 137 uint8_t (*get_TSH2R)(I2C_ST_PACKET_INFO_t *packet_info); 138 uint8_t (*get_TPSR)(I2C_ST_PACKET_INFO_t *packet_info); 139 uint8_t (*get_TPS2R)(I2C_ST_PACKET_INFO_t *packet_info); 140 uint8_t (*get_TLWRH)(I2C_ST_PACKET_INFO_t *packet_info); 141 uint8_t (*get_THWRH)(I2C_ST_PACKET_INFO_t *packet_info); 142 uint8_t (*get_TRSRH)(I2C_ST_PACKET_INFO_t *packet_info); 143 uint8_t (*get_TSHRH)(I2C_ST_PACKET_INFO_t *packet_info); 144 uint8_t (*get_TPSRH)(I2C_ST_PACKET_INFO_t *packet_info); 145 uint8_t (*get_CCR)(I2C_ST_PACKET_INFO_t *packet_info); 146 uint8_t (*get_CSR)(I2C_ST_PACKET_INFO_t *packet_info); 147 uint8_t (*get_FSR)(I2C_ST_PACKET_INFO_t *packet_info); 148 }; 149 150 #endif /* INTERNAL_I2C_REG_ACCESS_H */ 151