Subversion Repositories HelenOS

Rev

Rev 4220 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
3502 rimsky 1
/*
2
 * Copyright (c) 2008 Pavel Rimsky
3
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
7
 * are met:
8
 *
9
 * - Redistributions of source code must retain the above copyright
10
 *   notice, this list of conditions and the following disclaimer.
11
 * - 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.
14
 * - The name of the author may not be used to endorse or promote products
15
 *   derived from this software without specific prior written permission.
16
 *
17
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20
 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
 */
28
 
29
/** @addtogroup sparc64
30
 * @{
31
 */
32
/** @file
33
 */
34
 
35
#ifndef KERN_sparc64_SGCN_H_
36
#define KERN_sparc64_SGCN_H_
37
 
38
#include <arch/types.h>
4071 jermar 39
#include <console/chardev.h>
4313 jermar 40
#include <proc/thread.h>
3502 rimsky 41
 
4220 decky 42
/* number of bytes in the TOC magic, including the NULL-terminator */
3502 rimsky 43
#define TOC_MAGIC_BYTES     8
44
 
4220 decky 45
/* number of bytes in the TOC key, including the NULL-terminator */
3502 rimsky 46
#define TOC_KEY_SIZE        8
47
 
48
/* maximum number of entries in the SRAM table of contents */
49
#define MAX_TOC_ENTRIES     32
50
 
4220 decky 51
/* number of bytes in the SGCN buffer magic, including the NULL-terminator */
3502 rimsky 52
#define SGCN_MAGIC_BYTES    4
53
 
54
/**
55
 * Entry in the SRAM table of contents. Describes one segment of the SRAM
56
 * which serves a particular purpose (e.g. OBP serial console, Solaris serial
57
 * console, Solaris mailbox,...).
58
 */
59
typedef struct {
60
    /** key (e.g. "OBPCONS", "SOLCONS", "SOLMBOX",...) */
61
    char key[TOC_KEY_SIZE];
62
 
63
    /** size of the segment in bytes */
64
    uint32_t size;
65
 
66
    /** offset of the segment within SRAM */
67
    uint32_t offset;
68
} __attribute ((packed)) toc_entry_t;
69
 
70
/**
71
 * SRAM table of contents. Describes all segments within the SRAM.
72
 */
73
typedef struct {
74
    /** hard-wired to "TOCSRAM" */
75
    char magic[TOC_MAGIC_BYTES];
76
 
77
    /** we don't need this */
78
    char unused[8];
79
 
80
    /** TOC entries */
81
    toc_entry_t keys[MAX_TOC_ENTRIES];
82
} __attribute__ ((packed)) iosram_toc_t;
83
 
84
/**
85
 * SGCN buffer header. It is placed at the very beginning of the SGCN
86
 * buffer.
87
 */
88
typedef struct {
89
    /** hard-wired to "CON" */
90
    char magic[SGCN_MAGIC_BYTES];
91
 
92
    /** we don't need this */
93
    char unused[8];
94
 
95
    /** offset within the SGCN buffer of the input buffer start */
96
    uint32_t in_begin;
97
 
98
    /** offset within the SGCN buffer of the input buffer end */
99
    uint32_t in_end;
100
 
101
    /** offset within the SGCN buffer of the input buffer read pointer */
102
    uint32_t in_rdptr;
103
 
104
    /** offset within the SGCN buffer of the input buffer write pointer */
105
    uint32_t in_wrptr;
106
 
107
    /** offset within the SGCN buffer of the output buffer start */
108
    uint32_t out_begin;
109
 
110
    /** offset within the SGCN buffer of the output buffer end */
111
    uint32_t out_end;
112
 
113
    /** offset within the SGCN buffer of the output buffer read pointer */
114
    uint32_t out_rdptr;
115
 
116
    /** offset within the SGCN buffer of the output buffer write pointer */
117
    uint32_t out_wrptr;
118
} __attribute__ ((packed)) sgcn_buffer_header_t;
119
 
4313 jermar 120
typedef struct {
121
    thread_t *thread;
122
    indev_t *srlnin;
123
} sgcn_instance_t;
3502 rimsky 124
 
4313 jermar 125
extern void sgcn_grab(void);
126
extern void sgcn_release(void);
127
extern sgcn_instance_t *sgcnin_init(void);
128
extern void sgcnin_wire(sgcn_instance_t *, indev_t *);
129
extern void sgcnout_init(void);
130
 
3502 rimsky 131
#endif
132
 
133
/** @}
3549 rimsky 134
 */