Loading...
Searching...
No Matches
lisa_tag.h
Go to the documentation of this file.
/*
* This file is part of the Aaru Data Preservation Suite.
* Copyright (c) 2019-2026 Natalia Portillo.
*
* This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of the
* License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, see <http://www.gnu.org/licenses/>.
*/
#ifndef LIBAARUFORMAT_LISA_TAG_H
#define LIBAARUFORMAT_LISA_TAG_H
#include <stdint.h>
#pragma pack(push, 1)
typedef struct sony_tag
{
uint16_t version;
uint8_t kind : 2;
uint8_t reserved : 6;
uint8_t volume;
int16_t file_id;
uint16_t rel_page;
uint16_t next_block;
uint16_t prev_block;
} sony_tag;
typedef struct profile_tag
{
uint16_t version;
uint8_t kind : 2;
uint8_t reserved : 6;
uint8_t volume;
int16_t file_id;
uint8_t valid_chk : 1;
uint16_t used_bytes : 15;
uint32_t abs_page;
uint8_t checksum;
uint16_t rel_page;
uint32_t next_block;
uint32_t prev_block;
} profile_tag;
typedef struct priam_tag
{
uint16_t version;
uint8_t kind : 2;
uint8_t reserved : 6;
uint8_t volume;
int16_t file_id;
uint8_t valid_chk : 1;
uint16_t used_bytes : 15;
uint32_t abs_page;
uint8_t checksum;
uint16_t rel_page;
uint32_t next_block;
uint32_t prev_block;
uint32_t disk_size;
} priam_tag;
#pragma pack(pop)
sony_tag bytes_to_sony_tag(const uint8_t *bytes);
profile_tag bytes_to_profile_tag(const uint8_t *bytes);
priam_tag bytes_to_priam_tag(const uint8_t *bytes);
uint8_t *sony_tag_to_bytes(sony_tag tag);
uint8_t *profile_tag_to_bytes(profile_tag tag);
uint8_t *priam_tag_to_bytes(priam_tag tag);
profile_tag sony_tag_to_profile(sony_tag tag);
profile_tag priam_tag_to_profile(priam_tag tag);
priam_tag sony_tag_to_priam(sony_tag tag);
priam_tag profile_tag_to_priam(profile_tag tag);
sony_tag profile_tag_to_sony(profile_tag tag);
sony_tag priam_tag_to_sony(priam_tag tag);
#endif // LIBAARUFORMAT_LISA_TAG_H
priam_tag_to_bytes
uint8_t * priam_tag_to_bytes(priam_tag tag)
Serialize a priam_tag into a newly allocated 24-byte big-endian on-disk representation.
Definition lisa_tag.c:409
bytes_to_priam_tag
priam_tag bytes_to_priam_tag(const uint8_t *bytes)
Parse a 24-byte Priam tag record into a priam_tag structure.
Definition lisa_tag.c:112
profile_tag_to_sony
sony_tag profile_tag_to_sony(profile_tag tag)
Convert a profile_tag to a sony_tag.
Definition lisa_tag.c:257
sony_tag_to_bytes
uint8_t * sony_tag_to_bytes(sony_tag tag)
Serialize a sony_tag into a newly allocated 12-byte big-endian on-disk representation.
Definition lisa_tag.c:466
priam_tag_to_profile
profile_tag priam_tag_to_profile(priam_tag tag)
Convert a priam_tag to a profile_tag.
Definition lisa_tag.c:325
profile_tag_to_bytes
uint8_t * profile_tag_to_bytes(profile_tag tag)
Serialize a profile_tag into a newly allocated 20-byte big-endian on-disk representation.
Definition lisa_tag.c:357
sony_tag_to_profile
profile_tag sony_tag_to_profile(sony_tag tag)
Convert a sony_tag to a profile_tag representation.
Definition lisa_tag.c:173
bytes_to_sony_tag
sony_tag bytes_to_sony_tag(const uint8_t *bytes)
Parse a 12-byte Sony tag record into a sony_tag structure.
Definition lisa_tag.c:82
bytes_to_profile_tag
profile_tag bytes_to_profile_tag(const uint8_t *bytes)
Parse a 20-byte Profile tag record into a profile_tag structure.
Definition lisa_tag.c:142
sony_tag_to_priam
priam_tag sony_tag_to_priam(sony_tag tag)
Convert a sony_tag to a priam_tag representation.
Definition lisa_tag.c:201
profile_tag_to_priam
priam_tag profile_tag_to_priam(profile_tag tag)
Convert a profile_tag to a priam_tag.
Definition lisa_tag.c:228
priam_tag_to_sony
sony_tag priam_tag_to_sony(priam_tag tag)
Convert a priam_tag to a sony_tag.
Definition lisa_tag.c:291
priam_tag
Definition lisa_tag.h:63
priam_tag::reserved
uint8_t reserved
0x02 bits 5 to 0, reserved
Definition lisa_tag.h:66
priam_tag::file_id
int16_t file_id
0x04, file ID
Definition lisa_tag.h:68
priam_tag::next_block
uint32_t next_block
0x0E, 3 bytes, next block, 0xFFFFFF if it's last block
Definition lisa_tag.h:74
priam_tag::prev_block
uint32_t prev_block
0x11, 3 bytes, previous block, 0xFFFFFF if it's first block
Definition lisa_tag.h:75
priam_tag::disk_size
uint32_t disk_size
0x14, disk size
Definition lisa_tag.h:76
priam_tag::checksum
uint8_t checksum
0x0B, checksum of data
Definition lisa_tag.h:72
priam_tag::abs_page
uint32_t abs_page
0x08, 3 bytes, absolute page number
Definition lisa_tag.h:71
priam_tag::valid_chk
uint8_t valid_chk
0x06 bit 7, checksum valid?
Definition lisa_tag.h:69
priam_tag::kind
uint8_t kind
0x02 bits 7 to 6, kind of info in this block
Definition lisa_tag.h:65
priam_tag::used_bytes
uint16_t used_bytes
0x06 bits 6 to 0, used bytes in block
Definition lisa_tag.h:70
priam_tag::volume
uint8_t volume
0x03, disk volume number
Definition lisa_tag.h:67
priam_tag::version
uint16_t version
0x00, Lisa OS version number
Definition lisa_tag.h:64
priam_tag::rel_page
uint16_t rel_page
0x0C, relative page number
Definition lisa_tag.h:73
profile_tag
Definition lisa_tag.h:47
profile_tag::checksum
uint8_t checksum
0x0B, checksum of data
Definition lisa_tag.h:56
profile_tag::rel_page
uint16_t rel_page
0x0C, relative page number
Definition lisa_tag.h:57
profile_tag::used_bytes
uint16_t used_bytes
0x06 bits 6 to 0, used bytes in block
Definition lisa_tag.h:54
profile_tag::valid_chk
uint8_t valid_chk
0x06 bit 7, checksum valid?
Definition lisa_tag.h:53
profile_tag::abs_page
uint32_t abs_page
0x08, 3 bytes, absolute page number
Definition lisa_tag.h:55
profile_tag::reserved
uint8_t reserved
0x02 bits 5 to 0, reserved
Definition lisa_tag.h:50
profile_tag::next_block
uint32_t next_block
0x0E, 3 bytes, next block, 0xFFFFFF if it's last block
Definition lisa_tag.h:58
profile_tag::volume
uint8_t volume
0x03, disk volume number
Definition lisa_tag.h:51
profile_tag::kind
uint8_t kind
0x02 bits 7 to 6, kind of info in this block
Definition lisa_tag.h:49
profile_tag::file_id
int16_t file_id
0x04, file ID
Definition lisa_tag.h:52
profile_tag::version
uint16_t version
0x00, Lisa OS version number
Definition lisa_tag.h:48
profile_tag::prev_block
uint32_t prev_block
0x11, 3 bytes, previous block, 0xFFFFFF if it's first block
Definition lisa_tag.h:59
sony_tag
Definition lisa_tag.h:35
sony_tag::volume
uint8_t volume
0x03, disk volume number
Definition lisa_tag.h:39
sony_tag::file_id
int16_t file_id
0x04, file ID
Definition lisa_tag.h:40
sony_tag::version
uint16_t version
0x00, Lisa OS version number
Definition lisa_tag.h:36
sony_tag::rel_page
uint16_t rel_page
0x06, relative page number
Definition lisa_tag.h:41
sony_tag::next_block
uint16_t next_block
0x08, next block, 0x7FF if it's last block, 0x8000 set if block is valid
Definition lisa_tag.h:42
sony_tag::reserved
uint8_t reserved
0x02 bits 5 to 0, reserved
Definition lisa_tag.h:38
sony_tag::kind
uint8_t kind
0x02 bits 7 to 6, kind of info in this block
Definition lisa_tag.h:37
sony_tag::prev_block
uint16_t prev_block
0x0A, previous block, 0x7FF if it's first block
Definition lisa_tag.h:43