~jderose/ubuntu/raring/qemu/vde-again

« back to all changes in this revision

Viewing changes to hw/blizzard.c

  • Committer: Bazaar Package Importer
  • Author(s): Riku Voipio, Josh Triplett, Riku Voipio
  • Date: 2009-07-29 13:28:05 UTC
  • mfrom: (1.4.1 upstream)
  • mto: (12.1.1 sid) (10.1.13 sid)
  • mto: This revision was merged to the branch mainline in revision 13.
  • Revision ID: james.westby@ubuntu.com-20090729132805-cau7rfexh7dawyb8
Tags: 0.10.50+git20090729-1
[ Josh Triplett ]
* Remove myself from Uploaders.

[ Riku Voipio ]
* new upstream RC version
* nuke all linux-user patches (applied upstream)
  06_exit_segfault
  12_signal_powerpc_support
  21_net_soopts
  30_syscall_ipc
  32_syscall_sysctl
  35_syscall_sockaddr
  48_signal_terminate
  55_unmux_socketcall
* nuke all other applied-upstream patches
  01_nostrip (better version upstream)
  07_i386_exec_name (can be reintroduced in debian/rules)
  50_linuxbios_isa_bios_ram (shouldn't be needed anymore)
  51_linuxbios_piix_ram_size (applied)
  56_dhcp (crap)
  60_ppc_ld (reintroduce if needed)
  64_ppc_asm_constraints (ditto)
  66_tls_ld.patch (ditto)
  81_compile_dtb.patch (applied upstream)
  82_qemu-img_decimal (ditto)
* move to git
* simplify build rules
* Correct my email address

Show diffs side-by-side

added added

removed removed

Lines of Context:
15
15
 * GNU General Public License for more details.
16
16
 *
17
17
 * You should have received a copy of the GNU General Public License along
18
 
 * with this program; if not, write to the Free Software Foundation, Inc.,
19
 
 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 
18
 * with this program; if not, see <http://www.gnu.org/licenses/>.
20
19
 */
21
20
 
22
21
#include "qemu-common.h"
28
27
 
29
28
typedef void (*blizzard_fn_t)(uint8_t *, const uint8_t *, unsigned int);
30
29
 
31
 
struct blizzard_s {
 
30
typedef struct {
32
31
    uint8_t reg;
33
32
    uint32_t addr;
34
33
    int swallow;
120
119
        int pitch;
121
120
        blizzard_fn_t line_fn;
122
121
    } data;
123
 
};
 
122
} BlizzardState;
124
123
 
125
124
/* Bytes(!) per pixel */
126
125
static const int blizzard_iformat_bpp[0x10] = {
144
143
    *v = 0x80 + ((0xe0e * r - 0x0bc7 * g - 0x247 * b) >> 13);
145
144
}
146
145
 
147
 
static void blizzard_window(struct blizzard_s *s)
 
146
static void blizzard_window(BlizzardState *s)
148
147
{
149
148
    uint8_t *src, *dst;
150
149
    int bypp[2];
175
174
        fn(dst, src, bypl[2]);
176
175
}
177
176
 
178
 
static int blizzard_transfer_setup(struct blizzard_s *s)
 
177
static int blizzard_transfer_setup(BlizzardState *s)
179
178
{
180
179
    if (s->source > 3 || !s->bpp ||
181
180
                    s->ix[1] < s->ix[0] || s->iy[1] < s->iy[0])
199
198
    return 1;
200
199
}
201
200
 
202
 
static void blizzard_reset(struct blizzard_s *s)
 
201
static void blizzard_reset(BlizzardState *s)
203
202
{
204
203
    s->reg = 0;
205
204
    s->swallow = 0;
280
279
}
281
280
 
282
281
static inline void blizzard_invalidate_display(void *opaque) {
283
 
    struct blizzard_s *s = (struct blizzard_s *) opaque;
 
282
    BlizzardState *s = (BlizzardState *) opaque;
284
283
 
285
284
    s->invalidate = 1;
286
285
}
287
286
 
288
287
static uint16_t blizzard_reg_read(void *opaque, uint8_t reg)
289
288
{
290
 
    struct blizzard_s *s = (struct blizzard_s *) opaque;
 
289
    BlizzardState *s = (BlizzardState *) opaque;
291
290
 
292
291
    switch (reg) {
293
292
    case 0x00:  /* Revision Code */
490
489
 
491
490
static void blizzard_reg_write(void *opaque, uint8_t reg, uint16_t value)
492
491
{
493
 
    struct blizzard_s *s = (struct blizzard_s *) opaque;
 
492
    BlizzardState *s = (BlizzardState *) opaque;
494
493
 
495
494
    switch (reg) {
496
495
    case 0x04:  /* PLL M-Divider */
831
830
 
832
831
uint16_t s1d13745_read(void *opaque, int dc)
833
832
{
834
 
    struct blizzard_s *s = (struct blizzard_s *) opaque;
 
833
    BlizzardState *s = (BlizzardState *) opaque;
835
834
    uint16_t value = blizzard_reg_read(s, s->reg);
836
835
 
837
836
    if (s->swallow -- > 0)
844
843
 
845
844
void s1d13745_write(void *opaque, int dc, uint16_t value)
846
845
{
847
 
    struct blizzard_s *s = (struct blizzard_s *) opaque;
 
846
    BlizzardState *s = (BlizzardState *) opaque;
848
847
 
849
848
    if (s->swallow -- > 0)
850
849
        return;
860
859
void s1d13745_write_block(void *opaque, int dc,
861
860
                void *buf, size_t len, int pitch)
862
861
{
863
 
    struct blizzard_s *s = (struct blizzard_s *) opaque;
 
862
    BlizzardState *s = (BlizzardState *) opaque;
864
863
 
865
864
    while (len > 0) {
866
865
        if (s->reg == 0x90 && dc &&
886
885
 
887
886
static void blizzard_update_display(void *opaque)
888
887
{
889
 
    struct blizzard_s *s = (struct blizzard_s *) opaque;
 
888
    BlizzardState *s = (BlizzardState *) opaque;
890
889
    int y, bypp, bypl, bwidth;
891
890
    uint8_t *src, *dst;
892
891
 
935
934
}
936
935
 
937
936
static void blizzard_screen_dump(void *opaque, const char *filename) {
938
 
    struct blizzard_s *s = (struct blizzard_s *) opaque;
 
937
    BlizzardState *s = (BlizzardState *) opaque;
939
938
 
940
939
    blizzard_update_display(opaque);
941
940
    if (s && ds_get_data(s->state))
955
954
 
956
955
void *s1d13745_init(qemu_irq gpio_int)
957
956
{
958
 
    struct blizzard_s *s = (struct blizzard_s *) qemu_mallocz(sizeof(*s));
 
957
    BlizzardState *s = (BlizzardState *) qemu_mallocz(sizeof(*s));
959
958
 
960
959
    s->fb = qemu_malloc(0x180000);
961
960