Subversion Repositories HelenOS

Rev

Rev 4346 | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

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