Skip to content

Instantly share code, notes, and snippets.

@pamaury
Created September 16, 2015 11:04
Show Gist options
  • Save pamaury/5826be2f7a49071c804f to your computer and use it in GitHub Desktop.
Save pamaury/5826be2f7a49071c804f to your computer and use it in GitHub Desktop.
gpio header
/***************************************************************************
* __________ __ ___.
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
* \/ \/ \/ \/ \/
* This file was automatically generated by headergen, DO NOT EDIT it.
* headergen version: 3.0.0
* vsoc2000 version: 0.5
* vsoc2000 authors: Amaury Pouly
*
* Copyright (C) 2015 by the authors
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
****************************************************************************/
#ifndef __HEADERGEN_VSOC2000_REGS_GPIO_H__
#define __HEADERGEN_VSOC2000_REGS_GPIO_H__
#define HW_CPU_GPIO_PORT_IN_ADDR(_n1,_n2) (0x80001000+((_n1)-1)*0x1000 + 0x0 + (_n2) * 0x100 + 0x0)
#define HW_CPU_GPIO_PORT_IN(_n1,_n2) (*(volatile uint8_t *)HW_CPU_GPIO_PORT_IN_ADDR(_n1,_n2))
#define BW_CPU_GPIO_PORT_IN(_n1,_n2,...) HW_CPU_GPIO_PORT_IN(_n1,_n2) = BF_OR(CPU_GPIO_PORT_IN, __VA_ARGS__)
#define BR_CPU_GPIO_PORT_IN(_n1,_n2,_f) ((HW_CPU_GPIO_PORT_IN(_n1,_n2) & BM_CPU_GPIO_PORT_IN_##_f) & BP_CPU_GPIO_PORT_IN_##_f)
#define BP_CPU_GPIO_PORT_IN_VALUE 0
#define BM_CPU_GPIO_PORT_IN_VALUE 0xff
#define BF_CPU_GPIO_PORT_IN_VALUE(_v) (((_v) << BP_CPU_GPIO_PORT_IN_VALUE) & BM_CPU_GPIO_PORT_IN_VALUE)
#define BF_CPU_GPIO_PORT_IN_VALUE_V(_e) BF_CPU_GPIO_PORT_IN_VALUE(BV_CPU_GPIO_PORT_IN_VALUE__##_e)
#define HW_CPU_GPIO_PORT_OE_ADDR(_n1,_n2) (0x80001000+((_n1)-1)*0x1000 + 0x0 + (_n2) * 0x100 + 0x10)
#define HW_CPU_GPIO_PORT_OE(_n1,_n2) (*(volatile uint8_t *)HW_CPU_GPIO_PORT_OE_ADDR(_n1,_n2))
#define BW_CPU_GPIO_PORT_OE(_n1,_n2,...) HW_CPU_GPIO_PORT_OE(_n1,_n2) = BF_OR(CPU_GPIO_PORT_OE, __VA_ARGS__)
#define BR_CPU_GPIO_PORT_OE(_n1,_n2,_f) ((HW_CPU_GPIO_PORT_OE(_n1,_n2) & BM_CPU_GPIO_PORT_OE_##_f) & BP_CPU_GPIO_PORT_OE_##_f)
#define HW_CPU_GPIO_PORT_OE_SET_ADDR(_n1,_n2) (HW_CPU_GPIO_PORT_OE_ADDR(_n1,_n2) + 0x4)
#define HW_CPU_GPIO_PORT_OE_SET(_n1,_n2) (*(volatile uint8_t *)HW_CPU_GPIO_PORT_OE_SET_ADDR(_n1,_n2))
#define BW_CPU_GPIO_PORT_OE_SET(_n1,_n2,...) HW_CPU_GPIO_PORT_OE_SET(_n1,_n2) = BF_OR(CPU_GPIO_PORT_OE, __VA_ARGS__)
#define BR_CPU_GPIO_PORT_OE_SET(_n1,_n2,_f) ((HW_CPU_GPIO_PORT_OE_SET(_n1,_n2) & BM_CPU_GPIO_PORT_OE_##_f) & BP_CPU_GPIO_PORT_OE_##_f)
#define HW_CPU_GPIO_PORT_OE_CLR_ADDR(_n1,_n2) (HW_CPU_GPIO_PORT_OE_ADDR(_n1,_n2) + 0x8)
#define HW_CPU_GPIO_PORT_OE_CLR(_n1,_n2) (*(volatile uint8_t *)HW_CPU_GPIO_PORT_OE_CLR_ADDR(_n1,_n2))
#define BW_CPU_GPIO_PORT_OE_CLR(_n1,_n2,...) HW_CPU_GPIO_PORT_OE_CLR(_n1,_n2) = BF_OR(CPU_GPIO_PORT_OE, __VA_ARGS__)
#define BR_CPU_GPIO_PORT_OE_CLR(_n1,_n2,_f) ((HW_CPU_GPIO_PORT_OE_CLR(_n1,_n2) & BM_CPU_GPIO_PORT_OE_##_f) & BP_CPU_GPIO_PORT_OE_##_f)
#define HW_CPU_GPIO_PORT_OE_MASK_ADDR(_n1,_n2) (HW_CPU_GPIO_PORT_OE_ADDR(_n1,_n2) + 0xc)
#define HW_CPU_GPIO_PORT_OE_MASK(_n1,_n2) (*(volatile uint8_t *)HW_CPU_GPIO_PORT_OE_MASK_ADDR(_n1,_n2))
#define BW_CPU_GPIO_PORT_OE_MASK(_n1,_n2,...) HW_CPU_GPIO_PORT_OE_MASK(_n1,_n2) = BF_OR(CPU_GPIO_PORT_OE, __VA_ARGS__)
#define BR_CPU_GPIO_PORT_OE_MASK(_n1,_n2,_f) ((HW_CPU_GPIO_PORT_OE_MASK(_n1,_n2) & BM_CPU_GPIO_PORT_OE_##_f) & BP_CPU_GPIO_PORT_OE_##_f)
#define BP_CPU_GPIO_PORT_OE_ENABLE 0
#define BM_CPU_GPIO_PORT_OE_ENABLE 0xff
#define BF_CPU_GPIO_PORT_OE_ENABLE(_v) (((_v) << BP_CPU_GPIO_PORT_OE_ENABLE) & BM_CPU_GPIO_PORT_OE_ENABLE)
#define BF_CPU_GPIO_PORT_OE_ENABLE_V(_e) BF_CPU_GPIO_PORT_OE_ENABLE(BV_CPU_GPIO_PORT_OE_ENABLE__##_e)
#endif /* __HEADERGEN_VSOC2000_REGS_GPIO_H__*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment