git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@4436 35acf78f-673a-0410-8e92-d51de3d6d3f4
This commit is contained in:
parent
10703d315c
commit
4399d50df5
File diff suppressed because it is too large
Load Diff
|
@ -107,6 +107,8 @@
|
|||
#define PIN_MODE_OUTPUT(n) (1U << ((n) * 2))
|
||||
#define PIN_MODE_ALTERNATE(n) (2U << ((n) * 2))
|
||||
#define PIN_MODE_ANALOG(n) (3U << ((n) * 2))
|
||||
#define PIN_ODR_LOW(n) (0U << (n))
|
||||
#define PIN_ODR_HIGH(n) (1U << (n))
|
||||
#define PIN_OTYPE_PUSHPULL(n) (0U << (n))
|
||||
#define PIN_OTYPE_OPENDRAIN(n) (1U << (n))
|
||||
#define PIN_OSPEED_2M(n) (0U << ((n) * 2))
|
||||
|
@ -149,7 +151,9 @@
|
|||
[#assign pinidx = pinidx + 1 /]
|
||||
[/#list]
|
||||
*/
|
||||
[#-- Generating MODER register value.--]
|
||||
[#--
|
||||
-- Generating MODER register value.
|
||||
--]
|
||||
[#assign pinidx = 0 /]
|
||||
[#list port.* as pin]
|
||||
[#assign pin_name = pin?node_name?upper_case /]
|
||||
|
@ -169,10 +173,8 @@
|
|||
[/#if]
|
||||
[#if pinidx == 0]
|
||||
[#assign line = "#define VAL_" + port_name + "_MODER (" + out /]
|
||||
[#--#define VAL_${port_name}_MODER (${out?right_pad(30, " ")}[#rt]--]
|
||||
[#else]
|
||||
[#assign line = " " + out /]
|
||||
[#-- ${out?right_pad(30, " ")}[#rt]--]
|
||||
[/#if]
|
||||
[#if pinidx < 15]
|
||||
${(line + " |")?right_pad(76, " ") + "\\"}
|
||||
|
@ -181,6 +183,150 @@ ${line + ")"}
|
|||
[/#if]
|
||||
[#assign pinidx = pinidx + 1 /]
|
||||
[/#list]
|
||||
[#--
|
||||
-- Generating OTYPER register value.
|
||||
--]
|
||||
[#assign pinidx = 0 /]
|
||||
[#list port.* as pin]
|
||||
[#assign pin_name = pin?node_name?upper_case /]
|
||||
[#assign name = pin.@ID[0]?string?trim /]
|
||||
[#if name?length == 0]
|
||||
[#assign name = pin_name /]
|
||||
[/#if]
|
||||
[#assign type = pin.@Type[0] /]
|
||||
[#if type == "PushPull"]
|
||||
[#assign out = "PIN_OTYPE_PUSHPULL(" + port_name + "_" + pin_name + ")" /]
|
||||
[#else]
|
||||
[#assign out = "PIN_OTYPE_OPENDRAIN(" + port_name + "_" + pin_name + ")" /]
|
||||
[/#if]
|
||||
[#if pinidx == 0]
|
||||
[#assign line = "#define VAL_" + port_name + "_OTYPER (" + out /]
|
||||
[#else]
|
||||
[#assign line = " " + out /]
|
||||
[/#if]
|
||||
[#if pinidx < 15]
|
||||
${(line + " |")?right_pad(76, " ") + "\\"}
|
||||
[#else]
|
||||
${line + ")"}
|
||||
[/#if]
|
||||
[#assign pinidx = pinidx + 1 /]
|
||||
[/#list]
|
||||
[#--
|
||||
-- Generating SPEEDR register value.
|
||||
--]
|
||||
[#assign pinidx = 0 /]
|
||||
[#list port.* as pin]
|
||||
[#assign pin_name = pin?node_name?upper_case /]
|
||||
[#assign name = pin.@ID[0]?string?trim /]
|
||||
[#if name?length == 0]
|
||||
[#assign name = pin_name /]
|
||||
[/#if]
|
||||
[#assign speed = pin.@Speed[0] /]
|
||||
[#if speed == "Minimum"]
|
||||
[#assign out = "PIN_OSPEED_2M(" + port_name + "_" + pin_name + ")" /]
|
||||
[#elseif speed == "Low"]
|
||||
[#assign out = "PIN_OSPEED_25M(" + port_name + "_" + pin_name + ")" /]
|
||||
[#elseif speed == "High"]
|
||||
[#assign out = "PIN_OSPEED_50M(" + port_name + "_" + pin_name + ")" /]
|
||||
[#else]
|
||||
[#assign out = "PIN_OSPEED_100M(" + port_name + "_" + pin_name + ")" /]
|
||||
[/#if]
|
||||
[#if pinidx == 0]
|
||||
[#assign line = "#define VAL_" + port_name + "_OSPEEDR (" + out /]
|
||||
[#else]
|
||||
[#assign line = " " + out /]
|
||||
[/#if]
|
||||
[#if pinidx < 15]
|
||||
${(line + " |")?right_pad(76, " ") + "\\"}
|
||||
[#else]
|
||||
${line + ")"}
|
||||
[/#if]
|
||||
[#assign pinidx = pinidx + 1 /]
|
||||
[/#list]
|
||||
[#--
|
||||
-- Generating PUDR register value.
|
||||
--]
|
||||
[#assign pinidx = 0 /]
|
||||
[#list port.* as pin]
|
||||
[#assign pin_name = pin?node_name?upper_case /]
|
||||
[#assign name = pin.@ID[0]?string?trim /]
|
||||
[#if name?length == 0]
|
||||
[#assign name = pin_name /]
|
||||
[/#if]
|
||||
[#assign resistor = pin.@Resistor[0] /]
|
||||
[#if resistor == "Floating"]
|
||||
[#assign out = "PIN_PUDR_FLOATING(" + port_name + "_" + pin_name + ")" /]
|
||||
[#elseif resistor == "PullUp"]
|
||||
[#assign out = "PIN_PUDR_PULLUP(" + port_name + "_" + pin_name + ")" /]
|
||||
[#else]
|
||||
[#assign out = "PIN_PUDR_PULLDOWN(" + port_name + "_" + pin_name + ")" /]
|
||||
[/#if]
|
||||
[#if pinidx == 0]
|
||||
[#assign line = "#define VAL_" + port_name + "_PUDR (" + out /]
|
||||
[#else]
|
||||
[#assign line = " " + out /]
|
||||
[/#if]
|
||||
[#if pinidx < 15]
|
||||
${(line + " |")?right_pad(76, " ") + "\\"}
|
||||
[#else]
|
||||
${line + ")"}
|
||||
[/#if]
|
||||
[#assign pinidx = pinidx + 1 /]
|
||||
[/#list]
|
||||
[#--
|
||||
-- Generating ODR register value.
|
||||
--]
|
||||
[#assign pinidx = 0 /]
|
||||
[#list port.* as pin]
|
||||
[#assign pin_name = pin?node_name?upper_case /]
|
||||
[#assign name = pin.@ID[0]?string?trim /]
|
||||
[#if name?length == 0]
|
||||
[#assign name = pin_name /]
|
||||
[/#if]
|
||||
[#assign level = pin.@Level[0] /]
|
||||
[#if level == "Low"]
|
||||
[#assign out = "PIN_ODR_LOW(" + port_name + "_" + pin_name + ")" /]
|
||||
[#else]
|
||||
[#assign out = "PIN_ODR_HIGH(" + port_name + "_" + pin_name + ")" /]
|
||||
[/#if]
|
||||
[#if pinidx == 0]
|
||||
[#assign line = "#define VAL_" + port_name + "_ODR (" + out /]
|
||||
[#else]
|
||||
[#assign line = " " + out /]
|
||||
[/#if]
|
||||
[#if pinidx < 15]
|
||||
${(line + " |")?right_pad(76, " ") + "\\"}
|
||||
[#else]
|
||||
${line + ")"}
|
||||
[/#if]
|
||||
[#assign pinidx = pinidx + 1 /]
|
||||
[/#list]
|
||||
[#--
|
||||
-- Generating AFRx registers values.
|
||||
--]
|
||||
[#assign pinidx = 0 /]
|
||||
[#list port.* as pin]
|
||||
[#assign pin_name = pin?node_name?upper_case /]
|
||||
[#assign name = pin.@ID[0]?string?trim /]
|
||||
[#if name?length == 0]
|
||||
[#assign name = pin_name /]
|
||||
[/#if]
|
||||
[#assign alternate = pin.@Alternate[0]?trim /]
|
||||
[#assign out = "PIN_AFIO_AF(" + port_name + "_" + pin_name + ", " + alternate + ")" /]
|
||||
[#if pinidx == 0]
|
||||
[#assign line = "#define VAL_" + port_name + "_AFRL (" + out /]
|
||||
[#elseif pinidx == 8]
|
||||
[#assign line = "#define VAL_" + port_name + "_AFRH (" + out /]
|
||||
[#else]
|
||||
[#assign line = " " + out /]
|
||||
[/#if]
|
||||
[#if (pinidx == 7) || (pinidx == 15)]
|
||||
${line + ")"}
|
||||
[#else]
|
||||
${(line + " |")?right_pad(76, " ") + "\\"}
|
||||
[/#if]
|
||||
[#assign pinidx = pinidx + 1 /]
|
||||
[/#list]
|
||||
|
||||
[/#list]
|
||||
|
||||
|
|
|
@ -1,49 +1,128 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<xs:schema elementFormDefault="qualified"
|
||||
xmlns:xs="http://www.w3.org/2001/XMLSchema">
|
||||
<xs:schema
|
||||
elementFormDefault="qualified"
|
||||
xmlns:xs="http://www.w3.org/2001/XMLSchema">
|
||||
|
||||
<xs:complexType name="STM32GPIOv2PortType">
|
||||
|
||||
<xs:sequence>
|
||||
<xs:element name="pin0" type="STM32GPIOv2PinType" maxOccurs="1" minOccurs="1"></xs:element>
|
||||
<xs:element name="pin1" type="STM32GPIOv2PinType" maxOccurs="1" minOccurs="1"></xs:element>
|
||||
<xs:element name="pin2" type="STM32GPIOv2PinType" maxOccurs="1" minOccurs="1"></xs:element>
|
||||
<xs:element name="pin3" type="STM32GPIOv2PinType" maxOccurs="1" minOccurs="1"></xs:element>
|
||||
<xs:element name="pin4" type="STM32GPIOv2PinType" maxOccurs="1" minOccurs="1"></xs:element>
|
||||
<xs:element name="pin5" type="STM32GPIOv2PinType" maxOccurs="1" minOccurs="1"></xs:element>
|
||||
<xs:element name="pin6" type="STM32GPIOv2PinType" maxOccurs="1" minOccurs="1"></xs:element>
|
||||
<xs:element name="pin7" type="STM32GPIOv2PinType" maxOccurs="1" minOccurs="1"></xs:element>
|
||||
<xs:element name="pin8" type="STM32GPIOv2PinType" maxOccurs="1" minOccurs="1"></xs:element>
|
||||
<xs:element name="pin9" type="STM32GPIOv2PinType" maxOccurs="1" minOccurs="1"></xs:element>
|
||||
<xs:element name="pin10" type="STM32GPIOv2PinType" maxOccurs="1" minOccurs="1"></xs:element>
|
||||
<xs:element name="pin11" type="STM32GPIOv2PinType" maxOccurs="1" minOccurs="1"></xs:element>
|
||||
<xs:element name="pin12" type="STM32GPIOv2PinType" maxOccurs="1" minOccurs="1"></xs:element>
|
||||
<xs:element name="pin13" type="STM32GPIOv2PinType" maxOccurs="1" minOccurs="1"></xs:element>
|
||||
<xs:element name="pin14" type="STM32GPIOv2PinType" maxOccurs="1" minOccurs="1"></xs:element>
|
||||
<xs:element name="pin15" type="STM32GPIOv2PinType" maxOccurs="1" minOccurs="1"></xs:element>
|
||||
</xs:sequence>
|
||||
<xs:sequence>
|
||||
<xs:element
|
||||
name="pin0"
|
||||
type="STM32GPIOv2PinType"
|
||||
maxOccurs="1"
|
||||
minOccurs="1"></xs:element>
|
||||
<xs:element
|
||||
name="pin1"
|
||||
type="STM32GPIOv2PinType"
|
||||
maxOccurs="1"
|
||||
minOccurs="1"></xs:element>
|
||||
<xs:element
|
||||
name="pin2"
|
||||
type="STM32GPIOv2PinType"
|
||||
maxOccurs="1"
|
||||
minOccurs="1"></xs:element>
|
||||
<xs:element
|
||||
name="pin3"
|
||||
type="STM32GPIOv2PinType"
|
||||
maxOccurs="1"
|
||||
minOccurs="1"></xs:element>
|
||||
<xs:element
|
||||
name="pin4"
|
||||
type="STM32GPIOv2PinType"
|
||||
maxOccurs="1"
|
||||
minOccurs="1"></xs:element>
|
||||
<xs:element
|
||||
name="pin5"
|
||||
type="STM32GPIOv2PinType"
|
||||
maxOccurs="1"
|
||||
minOccurs="1"></xs:element>
|
||||
<xs:element
|
||||
name="pin6"
|
||||
type="STM32GPIOv2PinType"
|
||||
maxOccurs="1"
|
||||
minOccurs="1"></xs:element>
|
||||
<xs:element
|
||||
name="pin7"
|
||||
type="STM32GPIOv2PinType"
|
||||
maxOccurs="1"
|
||||
minOccurs="1"></xs:element>
|
||||
<xs:element
|
||||
name="pin8"
|
||||
type="STM32GPIOv2PinType"
|
||||
maxOccurs="1"
|
||||
minOccurs="1"></xs:element>
|
||||
<xs:element
|
||||
name="pin9"
|
||||
type="STM32GPIOv2PinType"
|
||||
maxOccurs="1"
|
||||
minOccurs="1"></xs:element>
|
||||
<xs:element
|
||||
name="pin10"
|
||||
type="STM32GPIOv2PinType"
|
||||
maxOccurs="1"
|
||||
minOccurs="1"></xs:element>
|
||||
<xs:element
|
||||
name="pin11"
|
||||
type="STM32GPIOv2PinType"
|
||||
maxOccurs="1"
|
||||
minOccurs="1"></xs:element>
|
||||
<xs:element
|
||||
name="pin12"
|
||||
type="STM32GPIOv2PinType"
|
||||
maxOccurs="1"
|
||||
minOccurs="1"></xs:element>
|
||||
<xs:element
|
||||
name="pin13"
|
||||
type="STM32GPIOv2PinType"
|
||||
maxOccurs="1"
|
||||
minOccurs="1"></xs:element>
|
||||
<xs:element
|
||||
name="pin14"
|
||||
type="STM32GPIOv2PinType"
|
||||
maxOccurs="1"
|
||||
minOccurs="1"></xs:element>
|
||||
<xs:element
|
||||
name="pin15"
|
||||
type="STM32GPIOv2PinType"
|
||||
maxOccurs="1"
|
||||
minOccurs="1"></xs:element>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
|
||||
|
||||
<xs:complexType name="STM32GPIOv2PinType">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Object representing an STM32 pin for the GPIOv2 peripheral.</xs:documentation>
|
||||
</xs:annotation>
|
||||
<xs:attribute name="ID" use="required">
|
||||
<xs:annotation>
|
||||
<xs:documentation>
|
||||
Object representing an STM32 pin for the GPIOv2
|
||||
peripheral.
|
||||
</xs:documentation>
|
||||
</xs:annotation>
|
||||
<xs:attribute
|
||||
name="ID"
|
||||
use="required">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Pin identifier, used to generate a #define with the
|
||||
pin name.
|
||||
</xs:documentation>
|
||||
</xs:annotation>
|
||||
<xs:simpleType>
|
||||
<xs:annotation>
|
||||
<xs:documentation>Pin identifier, used to generate a #define with the pin name.</xs:documentation>
|
||||
</xs:annotation>
|
||||
<xs:restriction base="xs:string">
|
||||
<xs:annotation>
|
||||
<xs:documentation>
|
||||
</xs:documentation>
|
||||
</xs:annotation>
|
||||
<xs:restriction base="xs:string">
|
||||
<xs:pattern value="\w?[\w\d_]*"></xs:pattern>
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="Mode" use="required">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Pin mode, as defined for MODER register.</xs:documentation>
|
||||
</xs:annotation>
|
||||
<xs:simpleType>
|
||||
<xs:attribute
|
||||
name="Mode"
|
||||
use="required">
|
||||
<xs:annotation>
|
||||
<xs:documentation>
|
||||
Pin mode, as defined for MODER register.
|
||||
</xs:documentation>
|
||||
</xs:annotation>
|
||||
<xs:simpleType>
|
||||
<xs:restriction base="xs:string">
|
||||
<xs:enumeration value="Input"></xs:enumeration>
|
||||
<xs:enumeration value="Output"></xs:enumeration>
|
||||
|
@ -51,23 +130,29 @@
|
|||
<xs:enumeration value="Analog"></xs:enumeration>
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="Type" use="required">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Pin type as defined in TYPER register.</xs:documentation>
|
||||
</xs:annotation>
|
||||
<xs:simpleType>
|
||||
</xs:attribute>
|
||||
<xs:attribute
|
||||
name="Level"
|
||||
use="required">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Logic level for the ODR register.</xs:documentation>
|
||||
</xs:annotation>
|
||||
<xs:simpleType>
|
||||
<xs:restriction base="xs:string">
|
||||
<xs:enumeration value="PushPull"></xs:enumeration>
|
||||
<xs:enumeration value="OpenDrain"></xs:enumeration>
|
||||
<xs:enumeration value="High"></xs:enumeration>
|
||||
<xs:enumeration value="Low"></xs:enumeration>
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="Speed" use="required">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Pin speed as defined in SPEEDR register.</xs:documentation>
|
||||
</xs:annotation>
|
||||
<xs:simpleType>
|
||||
<xs:attribute
|
||||
name="Speed"
|
||||
use="required">
|
||||
<xs:annotation>
|
||||
<xs:documentation>
|
||||
Pin speed as defined in SPEEDR register.
|
||||
</xs:documentation>
|
||||
</xs:annotation>
|
||||
<xs:simpleType>
|
||||
<xs:restriction base="xs:string">
|
||||
<xs:enumeration value="Minimum"></xs:enumeration>
|
||||
<xs:enumeration value="Low"></xs:enumeration>
|
||||
|
@ -75,12 +160,31 @@
|
|||
<xs:enumeration value="Maximum"></xs:enumeration>
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
</xs:attribute>
|
||||
<xs:attribute
|
||||
name="Type"
|
||||
use="required">
|
||||
<xs:annotation>
|
||||
<xs:documentation>
|
||||
Pin type as defined in TYPER register.
|
||||
</xs:documentation>
|
||||
</xs:annotation>
|
||||
<xs:simpleType>
|
||||
<xs:restriction base="xs:string">
|
||||
<xs:enumeration value="PushPull"></xs:enumeration>
|
||||
<xs:enumeration value="OpenDrain"></xs:enumeration>
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="Resistor" use="required">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Pin pull-up/down resistor as defined in PUDR register.</xs:documentation>
|
||||
</xs:annotation>
|
||||
<xs:simpleType>
|
||||
<xs:attribute
|
||||
name="Resistor"
|
||||
use="required">
|
||||
<xs:annotation>
|
||||
<xs:documentation>
|
||||
Pin pull-up/down resistor as defined in PUDR register.
|
||||
</xs:documentation>
|
||||
</xs:annotation>
|
||||
<xs:simpleType>
|
||||
<xs:restriction base="xs:string">
|
||||
<xs:enumeration value="Floating"></xs:enumeration>
|
||||
<xs:enumeration value="PullUp"></xs:enumeration>
|
||||
|
@ -88,13 +192,18 @@
|
|||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
</xs:attribute>
|
||||
<xs:attribute name="Alternate" use="required">
|
||||
<xs:annotation>
|
||||
<xs:documentation>Pin alternate function number, only valid if "Alternate" is selected in the Mode attribute.</xs:documentation>
|
||||
</xs:annotation>
|
||||
<xs:simpleType>
|
||||
<xs:attribute
|
||||
name="Alternate"
|
||||
use="required">
|
||||
<xs:annotation>
|
||||
<xs:documentation>
|
||||
Pin alternate function number, only valid if
|
||||
"Alternate" is selected
|
||||
in the Mode attribute.
|
||||
</xs:documentation>
|
||||
</xs:annotation>
|
||||
<xs:simpleType>
|
||||
<xs:restriction base="xs:int">
|
||||
|
||||
<xs:minInclusive value="0"></xs:minInclusive>
|
||||
<xs:maxInclusive value="15"></xs:maxInclusive>
|
||||
<xs:whiteSpace value="collapse"></xs:whiteSpace>
|
||||
|
|
Loading…
Reference in New Issue