packet.hh (11003:ba91725c8f6b) | packet.hh (11013:7e31bd5968c0) |
---|---|
1/* 2 * Copyright (c) 2012-2015 ARM Limited 3 * All rights reserved 4 * 5 * The license below extends only to copyright in the software and shall 6 * not be construed as granting a license to any other intellectual 7 * property including but not limited to intellectual property relating 8 * to a hardware implementation of the functionality of the software --- 753 unchanged lines hidden (view full) --- 762 { 763 assert(!flags.isSet(VALID_SIZE)); 764 765 this->size = size; 766 flags.set(VALID_SIZE); 767 } 768 769 | 1/* 2 * Copyright (c) 2012-2015 ARM Limited 3 * All rights reserved 4 * 5 * The license below extends only to copyright in the software and shall 6 * not be construed as granting a license to any other intellectual 7 * property including but not limited to intellectual property relating 8 * to a hardware implementation of the functionality of the software --- 753 unchanged lines hidden (view full) --- 762 { 763 assert(!flags.isSet(VALID_SIZE)); 764 765 this->size = size; 766 flags.set(VALID_SIZE); 767 } 768 769 |
770 public: |
|
770 /** | 771 /** |
772 * @{ 773 * @name Data accessor mehtods 774 */ 775 776 /** |
|
771 * Set the data pointer to the following value that should not be 772 * freed. Static data allows us to do a single memcpy even if 773 * multiple packets are required to get from source to destination 774 * and back. In essence the pointer is set calling dataStatic on 775 * the original packet, and whenever this packet is copied and 776 * forwarded the same pointer is passed on. When a packet 777 * eventually reaches the destination holding the data, it is 778 * copied once into the location originally set. On the way back --- 61 unchanged lines hidden (view full) --- 840 const T* 841 getConstPtr() const 842 { 843 assert(flags.isSet(STATIC_DATA|DYNAMIC_DATA)); 844 return (const T*)data; 845 } 846 847 /** | 777 * Set the data pointer to the following value that should not be 778 * freed. Static data allows us to do a single memcpy even if 779 * multiple packets are required to get from source to destination 780 * and back. In essence the pointer is set calling dataStatic on 781 * the original packet, and whenever this packet is copied and 782 * forwarded the same pointer is passed on. When a packet 783 * eventually reaches the destination holding the data, it is 784 * copied once into the location originally set. On the way back --- 61 unchanged lines hidden (view full) --- 846 const T* 847 getConstPtr() const 848 { 849 assert(flags.isSet(STATIC_DATA|DYNAMIC_DATA)); 850 return (const T*)data; 851 } 852 853 /** |
848 * return the value of what is pointed to in the packet. | 854 * Get the data in the packet byte swapped from big endian to 855 * host endian. |
849 */ 850 template <typename T> | 856 */ 857 template <typename T> |
858 T getBE() const; 859 860 /** 861 * Get the data in the packet byte swapped from little endian to 862 * host endian. 863 */ 864 template <typename T> 865 T getLE() const; 866 867 /** 868 * Get the data in the packet byte swapped from the specified 869 * endianness. 870 */ 871 template <typename T> 872 T get(ByteOrder endian) const; 873 874 /** 875 * Get the data in the packet byte swapped from guest to host 876 * endian. 877 */ 878 template <typename T> |
|
851 T get() const; 852 | 879 T get() const; 880 |
881 /** Set the value in the data pointer to v as big endian. */ 882 template <typename T> 883 void setBE(T v); 884 885 /** Set the value in the data pointer to v as little endian. */ 886 template <typename T> 887 void setLE(T v); 888 |
|
853 /** | 889 /** |
854 * set the value in the data pointer to v. | 890 * Set the value in the data pointer to v using the specified 891 * endianness. |
855 */ 856 template <typename T> | 892 */ 893 template <typename T> |
894 void set(T v, ByteOrder endian); 895 896 /** Set the value in the data pointer to v as guest endian. */ 897 template <typename T> |
|
857 void set(T v); 858 859 /** 860 * Copy data into the packet from the provided pointer. 861 */ 862 void 863 setData(const uint8_t *p) 864 { --- 55 unchanged lines hidden (view full) --- 920 void 921 allocate() 922 { 923 assert(flags.noneSet(STATIC_DATA|DYNAMIC_DATA)); 924 flags.set(DYNAMIC_DATA); 925 data = new uint8_t[getSize()]; 926 } 927 | 898 void set(T v); 899 900 /** 901 * Copy data into the packet from the provided pointer. 902 */ 903 void 904 setData(const uint8_t *p) 905 { --- 55 unchanged lines hidden (view full) --- 961 void 962 allocate() 963 { 964 assert(flags.noneSet(STATIC_DATA|DYNAMIC_DATA)); 965 flags.set(DYNAMIC_DATA); 966 data = new uint8_t[getSize()]; 967 } 968 |
969 /** @} */ 970 971 private: // Private data accessor methods 972 /** Get the data in the packet without byte swapping. */ 973 template <typename T> 974 T getRaw() const; 975 976 /** Set the value in the data pointer to v without byte swapping. */ 977 template <typename T> 978 void setRaw(T v); 979 980 public: |
|
928 /** 929 * Check a functional request against a memory value stored in 930 * another packet (i.e. an in-transit request or 931 * response). Returns true if the current packet is a read, and 932 * the other packet provides the data, which is then copied to the 933 * current packet. If the current packet is a write, and the other 934 * packet intersects this one, then we update the data 935 * accordingly. --- 77 unchanged lines hidden --- | 981 /** 982 * Check a functional request against a memory value stored in 983 * another packet (i.e. an in-transit request or 984 * response). Returns true if the current packet is a read, and 985 * the other packet provides the data, which is then copied to the 986 * current packet. If the current packet is a write, and the other 987 * packet intersects this one, then we update the data 988 * accordingly. --- 77 unchanged lines hidden --- |