2 * Copyright (C) 2011, 2012 glevand <geoffrey.levand@mail.ru>
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer,
10 * without modification, immediately at the beginning of the file.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
15 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
16 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
19 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 #define PS3DM_PID(fid, id) ((fid) | (id))
33 #define PS3DM_FID(pid) ((pid) & ~0xffful)
35 enum ps3dm_function_packet
{
38 PS3DM_FID_VTRM
= 0x00002000,
39 PS3DM_PID_VTRM_INIT
= PS3DM_PID(PS3DM_FID_VTRM
, 1),
40 PS3DM_PID_VTRM_GET_STATUS
= PS3DM_PID(PS3DM_FID_VTRM
, 2),
44 PS3DM_FID_SRTC
= 0x00003000,
45 PS3DM_PID_SRTC_GET_TIME
= PS3DM_PID(PS3DM_FID_SRTC
, 2),
46 PS3DM_PID_SRTC_SET_TIME
= PS3DM_PID(PS3DM_FID_SRTC
, 3),
50 PS3DM_FID_SM
= 0x00005000,
51 PS3DM_PID_SM_GET_RND
= PS3DM_PID(PS3DM_FID_SM
, 3),
56 uint32_t fid
; /* enum ps3dm_function_packet */
57 uint32_t payload_length
;
58 uint32_t reply_length
;
61 #define PS3DM_HDR(_p) ((struct ps3dm_header *) (_p))
63 struct ps3dm_ss_header
{
64 uint64_t pid
; /* enum ps3dm_function_packet */
65 uint64_t fid
; /* enum ps3dm_function_packet */
72 #define PS3DM_SS_HDR(_p) ((struct ps3dm_ss_header *) (_p))
74 struct ps3dm_sm_get_rnd
{
75 struct ps3dm_header dm_hdr
;
76 struct ps3dm_ss_header ss_hdr
;
81 ps3dm_init_header(struct ps3dm_header
*hdr
, uint32_t tag
, uint32_t fid
,
82 uint32_t payload_length
, uint32_t reply_length
)
86 hdr
->payload_length
= payload_length
;
87 hdr
->reply_length
= reply_length
;
91 ps3dm_init_ss_header( struct ps3dm_ss_header
*hdr
, uint64_t pid
,
92 uint64_t laid
, uint64_t paid
)
95 hdr
->fid
= PS3DM_FID(pid
);
100 #endif /* _PS3DM_MSG_H */