00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00034
00035
00036 #include "globals.h"
00037 #include "slave_config.h"
00038 #include "master.h"
00039
00040 #include "fmmu_config.h"
00041
00042
00043
00050 void ec_fmmu_config_init(
00051 ec_fmmu_config_t *fmmu,
00052 ec_slave_config_t *sc,
00053 ec_domain_t *domain,
00054 uint8_t sync_index,
00055 ec_direction_t dir
00056 )
00057 {
00058 INIT_LIST_HEAD(&fmmu->list);
00059 fmmu->sc = sc;
00060 fmmu->sync_index = sync_index;
00061 fmmu->dir = dir;
00062
00063 fmmu->logical_start_address = domain->data_size;
00064 fmmu->data_size = ec_pdo_list_total_size(
00065 &sc->sync_configs[sync_index].pdos);
00066
00067 ec_domain_add_fmmu_config(domain, fmmu);
00068 }
00069
00070
00071
00076 void ec_fmmu_config_page(
00077 const ec_fmmu_config_t *fmmu,
00078 const ec_sync_t *sync,
00079 uint8_t *data
00080 )
00081 {
00082 EC_CONFIG_DBG(fmmu->sc, 1, "FMMU: LogAddr 0x%08X, Size %3u,"
00083 " PhysAddr 0x%04X, SM%u, Dir %s\n",
00084 fmmu->logical_start_address, fmmu->data_size,
00085 sync->physical_start_address, fmmu->sync_index,
00086 fmmu->dir == EC_DIR_INPUT ? "in" : "out");
00087
00088 EC_WRITE_U32(data, fmmu->logical_start_address);
00089 EC_WRITE_U16(data + 4, fmmu->data_size);
00090 EC_WRITE_U8 (data + 6, 0x00);
00091 EC_WRITE_U8 (data + 7, 0x07);
00092 EC_WRITE_U16(data + 8, sync->physical_start_address);
00093 EC_WRITE_U8 (data + 10, 0x00);
00094 EC_WRITE_U8 (data + 11, fmmu->dir == EC_DIR_INPUT ? 0x01 : 0x02);
00095 EC_WRITE_U16(data + 12, 0x0001);
00096 EC_WRITE_U16(data + 14, 0x0000);
00097 }
00098
00099