piSmasher Configuration Libraries
piSmasher peripheral device configuration libraries
vid_tpg.c File Reference

Video Test Pattern Generator Userspace I/O Driver FreeBSD. More...

#include <sys/mman.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <stdbool.h>
#include <fcntl.h>
#include "vid_tpg.h"

Macros

#define VIDTPG_REG_CONTROL   (0x00000000U)
 
#define CONTROL_AP_START   (1 << 0)
 
#define CONTROL_AP_DONE   (1 << 1)
 
#define CONTROL_AP_IDLE   (1 << 2)
 
#define CONTROL_AP_READY   (1 << 3)
 
#define CONTROL_AUTO_RESTART   (1 << 7)
 
#define VIDTPG_REG_GINTEN   (0x00000004U)
 
#define VIDTPG_REG_IPINTEN   (0x00000008U)
 
#define VIDTPG_REG_ACTHEIGHT   (0x00000010U)
 
#define VIDTPG_REG_ACTWIDTH   (0x00000018U)
 
#define VIDTPG_REG_BGPAT_ID   (0x00000020U)
 
#define VIDTPG_REG_FGPAT_ID   (0x00000028U)
 
#define VIDTPG_REG_RGB_MASK_ID   (0x00000030U)
 
#define VIDTPG_REG_MOTION_SPEED   (0x00000038U)
 
#define VIDTPG_REG_COLOR_FMT   (0x00000040U)
 
#define VIDTPG_REG_ENABLE_INPUT   (0x00000098U)
 
#define VIDTPG_REG_PASS_THRU_X_START   (0x000000a0U)
 
#define VIDTPG_REG_PASS_THRU_Y_START   (0x000000a8U)
 
#define VIDTPG_REG_PASS_THRU_X_END   (0x000000b0U)
 
#define VIDTPG_REG_PASS_THRU_Y_END   (0x000000b8U)
 
#define REG_READ(__BASE__, __OFFSET__)   *((volatile uint32_t *)(((uint8_t *)(__BASE__)) + (__OFFSET__)))
 
#define REG_WRITE(__BASE__, __OFFSET__, __DATA__)   *((volatile uint32_t *)(((uint8_t *)(__BASE__)) + (__OFFSET__))) = (__DATA__)
 

Functions

int vidtpg_set_format (struct vidtpg *tpg, int height, int width, enum vidtpg_color_fmt color_fmt)
 
int vidtpg_set_pattern (struct vidtpg *tpg, enum vidtpg_bgpat bgpat, enum vidtpg_fgpat fgpat)
 
int vidtpg_init (struct vidtpg *tpg, const char *devname)
 

Detailed Description

Video Test Pattern Generator Userspace I/O Driver FreeBSD.

Author
R. Bush bush@.nosp@m.krtk.nosp@m.l.com
Version
0.1
Date
July 10, 2018 Copyright (c) 2018, krtkl inc. All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

The views and conclusions contained in the software and documentation are those of the authors and should not be interpreted as representing official policies, either expressed or implied, of the FreeBSD Project.

Macro Definition Documentation

◆ VIDTPG_REG_ACTHEIGHT

#define VIDTPG_REG_ACTHEIGHT   (0x00000010U)

Active height

◆ VIDTPG_REG_ACTWIDTH

#define VIDTPG_REG_ACTWIDTH   (0x00000018U)

Active width

◆ VIDTPG_REG_BGPAT_ID

#define VIDTPG_REG_BGPAT_ID   (0x00000020U)

Background pattern ID

◆ VIDTPG_REG_COLOR_FMT

#define VIDTPG_REG_COLOR_FMT   (0x00000040U)

Color format

◆ VIDTPG_REG_CONTROL

#define VIDTPG_REG_CONTROL   (0x00000000U)

Control

◆ VIDTPG_REG_ENABLE_INPUT

#define VIDTPG_REG_ENABLE_INPUT   (0x00000098U)

Enable input

◆ VIDTPG_REG_FGPAT_ID

#define VIDTPG_REG_FGPAT_ID   (0x00000028U)

Foreground pattern ID

◆ VIDTPG_REG_GINTEN

#define VIDTPG_REG_GINTEN   (0x00000004U)

Global interrupt enable

◆ VIDTPG_REG_IPINTEN

#define VIDTPG_REG_IPINTEN   (0x00000008U)

IP interrupt enable

◆ VIDTPG_REG_MOTION_SPEED

#define VIDTPG_REG_MOTION_SPEED   (0x00000038U)

Motion speed

◆ VIDTPG_REG_PASS_THRU_X_END

#define VIDTPG_REG_PASS_THRU_X_END   (0x000000b0U)

Video in horizontal end

◆ VIDTPG_REG_PASS_THRU_X_START

#define VIDTPG_REG_PASS_THRU_X_START   (0x000000a0U)

Video in horizontal start

◆ VIDTPG_REG_PASS_THRU_Y_END

#define VIDTPG_REG_PASS_THRU_Y_END   (0x000000b8U)

Video in vertical end

◆ VIDTPG_REG_PASS_THRU_Y_START

#define VIDTPG_REG_PASS_THRU_Y_START   (0x000000a8U)

Video in vertical start

◆ VIDTPG_REG_RGB_MASK_ID

#define VIDTPG_REG_RGB_MASK_ID   (0x00000030U)

Color mask selection for RGB formats