On 15 May 2013 05:48, Todd Zuercher <[email protected]> wrote:
> Several of the registers of these drives use a format of "A chain of two 8 > bit unsigned integers" to quote the manual. > Basically the drive is using 1 register to write two different pieces of > data. The mb2hal component is writing both of these data points to a single > s32 pin. How do I separate this into the two numbers I can use. Is there a > component that can divide an s32 into 4 u8 numbers? Would I then have to > change the 2 u8 numbers I need back to u32 numbers to be able to use them for > anything? u32 throughout would be better if you wanted to use more than 2 bytes. I think you can do what you want with a messy combination of conversions, scalings, and possibly weighted-sum and match8 components. I suspect that a custom component will be neater. component conv_u32_bytes "convert u32 to 4 bytes, and vice-versa"; pin in unsigned in-u32; pin in unsigned in-byte-# [4]; pin out unsigned out-u32; pin out unsigned out-byte-# [4]; nofp; function _; license "GPL"; ;; out_byte(0) = (in_u32 & 0x000000FF) out_byte(1) = (in_u32 & 0x0000FF00) >> 8; out_byte(2) = (in_u32 & 0x00FF0000) >> 16; out_byte(3) = (in_u32 & 0xFF000000) >> 24; out_u32 = in_byte(0) + (in_byte(1) << 8) + (in_byte(2)<<16) + (in_byte(3)<<24); You will need to convert your s32 to u32 to use this as-written (or you could change the pin types in the comp to suit) -- atp If you can't fix it, you don't own it. http://www.ifixit.com/Manifesto ------------------------------------------------------------------------------ AlienVault Unified Security Management (USM) platform delivers complete security visibility with the essential security capabilities. Easily and efficiently configure, manage, and operate all of your security controls from a single console and one unified framework. Download a free trial. http://p.sf.net/sfu/alienvault_d2d _______________________________________________ Emc-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/emc-users
