1.1 --- a/pic32_c.h Thu Oct 18 22:45:55 2018 +0200
1.2 +++ b/pic32_c.h Thu Oct 18 22:55:28 2018 +0200
1.3 @@ -1,3 +1,22 @@
1.4 +/*
1.5 + * PIC32 peripheral access utilities.
1.6 + *
1.7 + * Copyright (C) 2018 Paul Boddie <paul@boddie.org.uk>
1.8 + *
1.9 + * This program is free software: you can redistribute it and/or modify
1.10 + * it under the terms of the GNU General Public License as published by
1.11 + * the Free Software Foundation, either version 3 of the License, or
1.12 + * (at your option) any later version.
1.13 + *
1.14 + * This program is distributed in the hope that it will be useful,
1.15 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
1.16 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1.17 + * GNU General Public License for more details.
1.18 + *
1.19 + * You should have received a copy of the GNU General Public License
1.20 + * along with this program. If not, see <http://www.gnu.org/licenses/>.
1.21 + */
1.22 +
1.23 #ifndef __ASSEMBLER__
1.24
1.25 #ifndef __PIC32_C_H__
1.26 @@ -7,10 +26,14 @@
1.27 #include "mips.h"
1.28 #include "pic32.h"
1.29
1.30 +
1.31 +
1.32 /* Access. */
1.33
1.34 #define REG(mem) *((volatile uint32_t *) (mem))
1.35
1.36 +
1.37 +
1.38 /* Bit clearing, setting and inverting. */
1.39
1.40 static inline void CLR_REG(uint32_t mem, uint32_t val)
1.41 @@ -28,6 +51,8 @@
1.42 REG(mem + INV) = val;
1.43 }
1.44
1.45 +
1.46 +
1.47 /* Address translation. */
1.48
1.49 static inline uint32_t PHYSICAL(uint32_t addr)
1.50 @@ -40,6 +65,8 @@
1.51 return ((uint32_t) addr) - KSEG1_BASE;
1.52 }
1.53
1.54 +
1.55 +
1.56 /* Register collection access. */
1.57
1.58 static inline uint32_t DMA_REG(int channel, uint32_t reg)
1.59 @@ -62,6 +89,8 @@
1.60 return UARTBASE + reg + (uart - UARTMIN) * UARTSTEP;
1.61 }
1.62
1.63 +
1.64 +
1.65 /* Convenience types. */
1.66
1.67 enum dma_chain