#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include "upm_utilities.h"
int main()
{
int addr = M24LR64E_EEPROM_I2C_LENGTH-1;
printf("address being accessed: %d\n", addr);
uint8_t byte;
printf("error while reading value\n");
printf("value read from the device: %d\n", byte);
byte = ~byte;
printf("byte to be written: %d\n", byte);
printf("error while writing byte to the device\n");
uint8_t var;
printf("error while reading value back\n");
printf("new value at %d: %d\n", addr, var);
printf("all done!!\n");
return 0;
}
|
m24lr64e_context | m24lr64e_init (int bus, m24lr64e_access_mode mode) |
|
void | m24lr64e_close (m24lr64e_context dev) |
|
upm_result_t | m24lr64e_submit_password (m24lr64e_context dev, uint32_t password) |
|
upm_result_t | m24lr64e_write_password (m24lr64e_context dev, uint32_t password) |
|
upm_result_t | m24lr64e_sector_protect_config (m24lr64e_context dev, uint32_t sector_number, bool protect_enable, sector_access_right access_right, sector_select_password password) |
|
upm_result_t | m24lr64e_clear_sector_protect (m24lr64e_context dev) |
|
upm_result_t | m24lr64e_sector_write_lock_bit (m24lr64e_context dev, uint32_t sector_number, bool sock_enable) |
|
upm_result_t | m24lr64e_get_dsfid (m24lr64e_context dev, uint8_t *dsfid) |
|
upm_result_t | m24lr64e_get_afi (m24lr64e_context dev, uint8_t *afi) |
|
upm_result_t | m24lr64e_get_uid (m24lr64e_context dev, uint8_t *uid) |
|
upm_result_t | m24lr64e_get_memory_size (m24lr64e_context dev, uint32_t *memory_size) |
|
upm_result_t | m24lr64e_clear_memory (m24lr64e_context dev) |
|
upm_result_t | m24lr64e_write_byte (m24lr64e_context dev, uint32_t address, uint8_t data) |
|
upm_result_t | m24lr64e_write_bytes (m24lr64e_context dev, uint32_t address, uint8_t *buffer, int len) |
|
upm_result_t | m24lr64e_read_byte (m24lr64e_context dev, uint32_t address, uint8_t *data) |
|
upm_result_t | m24lr64e_read_bytes (m24lr64e_context dev, uint32_t address, uint8_t *buffer, int len) |
|
|
#define | M24LR64E_I2C_BUS 0 |
|
#define | M24LR64E_DEFAULT_I2C_ADDR 0x53 |
|
#define | M24LR64E_DEFAULT_I2C_ADDR_E2 (M24LR64E_DEFAULT_I2C_ADDR | 0x04) |
|
#define | M24LR64E_EEPROM_I2C_LENGTH 8192 |
|
#define | M24LR64E_PASSWORD_LENGTH 4 |
|
#define | M24LR64E_SECTOR_SECURITY_STATUS_BASE_ADDR 0x800 |
|
#define | M24LR64E_LOCK_PROTECT_BIT 0x01 |
|
#define | M24LR64E_WRITE_READ_PROTECT_BIT 0x02 |
|
#define | M24LR64E_PASSWORD_CTRL_BIT 0x04 |
|
#define | M24LR64E_UID_LENGTH 8 |
|
#define | M24LR64E_I2C_WRITE_TIME 5 |
|
|
enum | M24LR64E_ADDR_T {
M24LR64E_I2C_PASSWORD_ADDRESS = 2304,
M24LR64E_RF_PASSWORD_1_ADDRESS = 2308,
M24LR64E_RF_PASSWORD_2_ADDRESS = 2312,
M24LR64E_RF_PASSWORD_3_ADDRESS = 2316,
M24LR64E_DSFID_ADDRESS = 2320,
M24LR64E_AFI_ADDRESS = 2321,
M24LR64E_RESV_ADDRESS = 2322,
M24LR64E_CONFIG_ADDRESS = 2323,
M24LR64E_UID_ADDRESS = 2324,
M24LR64E_MEM_SIZE_ADDRESS = 2332,
M24LR64E_IC_REF_ADDRESS = 2335,
M24LR64E_PROG_COMP_ENERGY_HARVEST_ADDRESS = 2339
} |
|
enum | m24lr64e_access_mode { M24LR64E_USER_MODE = 0x0,
M24LR64E_ROOT_MODE = 0x1
} |
|
enum | sector_access_right { m24lr64e_access_1110 = 0,
m24lr64e_access_1111 = 1,
m24lr64e_access_1100 = 2,
m24lr64e_access_0111 = 3
} |
|
enum | sector_select_password { m24lr64e_no_password = 0,
m24lr64e_password_1 = 1,
m24lr64e_password_2 = 2,
m24lr64e_password_3 = 3
} |
|