diff options
author | Marcel Holtmann <marcel@holtmann.org> | 2005-10-24 23:10:08 +0000 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2005-10-24 23:10:08 +0000 |
commit | 967b0ec7667fb6d3db632ce8ccc66668c060a1f0 (patch) | |
tree | 3464a038279cf2a26960a88ec6f4c5c7ed872b6d /tools/csr.c | |
parent | 51a4c2e364b3096d945ac4a01e844ca5d1513f4a (diff) |
Add support for UINT32 PS keys
Diffstat (limited to 'tools/csr.c')
-rw-r--r-- | tools/csr.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/tools/csr.c b/tools/csr.c index 4ab38232..936a20f9 100644 --- a/tools/csr.c +++ b/tools/csr.c @@ -720,3 +720,24 @@ int csr_write_pskey_uint16(int dd, uint16_t seqnum, uint16_t pskey, uint16_t sto return csr_write_pskey_complex(dd, seqnum, pskey, store, array, 2); } + +int csr_read_pskey_uint32(int dd, uint16_t seqnum, uint16_t pskey, uint16_t store, uint32_t *value) +{ + uint8_t array[4] = { 0x00, 0x00, 0x00, 0x00 }; + int err; + + err = csr_read_pskey_complex(dd, seqnum, pskey, store, array, 4); + + *value = ((array[0] + (array[1] << 8)) << 16) + + (array[2] + (array[3] << 8)); + + return err; +} + +int csr_write_pskey_uint32(int dd, uint16_t seqnum, uint16_t pskey, uint16_t store, uint32_t value) +{ + uint8_t array[4] = { (value & 0xff0000) >> 16, value >> 24, + value & 0xff, (value & 0xff00) >> 8 }; + + return csr_write_pskey_complex(dd, seqnum, pskey, store, array, 4); +} |