Line 1... |
Line 1... |
// #################################################################################################
|
// #################################################################################################
|
// # << NEORV32: neorv32_gpio.c - General Purpose Input/Output Port HW Driver (Source) >> #
|
// # << NEORV32: neorv32_gpio.c - General Purpose Input/Output Port HW Driver (Source) >> #
|
// # ********************************************************************************************* #
|
// # ********************************************************************************************* #
|
// # BSD 3-Clause License #
|
// # BSD 3-Clause License #
|
// # #
|
// # #
|
// # Copyright (c) 2021, Stephan Nolting. All rights reserved. #
|
// # Copyright (c) 2022, Stephan Nolting. All rights reserved. #
|
// # #
|
// # #
|
// # Redistribution and use in source and binary forms, with or without modification, are #
|
// # Redistribution and use in source and binary forms, with or without modification, are #
|
// # permitted provided that the following conditions are met: #
|
// # permitted provided that the following conditions are met: #
|
// # #
|
// # #
|
// # 1. Redistributions of source code must retain the above copyright notice, this list of #
|
// # 1. Redistributions of source code must retain the above copyright notice, this list of #
|
Line 141... |
Line 141... |
**************************************************************************/
|
**************************************************************************/
|
void neorv32_gpio_port_set(uint64_t port_data) {
|
void neorv32_gpio_port_set(uint64_t port_data) {
|
|
|
union {
|
union {
|
uint64_t uint64;
|
uint64_t uint64;
|
uint32_t uint32[sizeof(uint64_t)/2];
|
uint32_t uint32[sizeof(uint64_t)/sizeof(uint32_t)];
|
} data;
|
} data;
|
|
|
data.uint64 = port_data;
|
data.uint64 = port_data;
|
NEORV32_GPIO.OUTPUT_LO = data.uint32[0];
|
NEORV32_GPIO.OUTPUT_LO = data.uint32[0];
|
NEORV32_GPIO.OUTPUT_HI = data.uint32[1];
|
NEORV32_GPIO.OUTPUT_HI = data.uint32[1];
|
Line 159... |
Line 159... |
**************************************************************************/
|
**************************************************************************/
|
uint64_t neorv32_gpio_port_get(void) {
|
uint64_t neorv32_gpio_port_get(void) {
|
|
|
union {
|
union {
|
uint64_t uint64;
|
uint64_t uint64;
|
uint32_t uint32[sizeof(uint64_t)/2];
|
uint32_t uint32[sizeof(uint64_t)/sizeof(uint32_t)];
|
} data;
|
} data;
|
|
|
data.uint32[0] = NEORV32_GPIO.INPUT_LO;
|
data.uint32[0] = NEORV32_GPIO.INPUT_LO;
|
data.uint32[1] = NEORV32_GPIO.INPUT_HI;
|
data.uint32[1] = NEORV32_GPIO.INPUT_HI;
|
|
|