git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@8692 35acf78f-673a-0410-8e92-d51de3d6d3f4
This commit is contained in:
parent
9f0af42da0
commit
64acf753c7
|
@ -127,6 +127,13 @@
|
|||
* @ingroup IO
|
||||
*/
|
||||
|
||||
/**
|
||||
* @defgroup HAL_SUPPORT Support Code
|
||||
* @brief HAL Support Code.
|
||||
*
|
||||
* @ingroup IO
|
||||
*/
|
||||
|
||||
/**
|
||||
* @defgroup OSAL OSAL
|
||||
* @brief Operating System Abstraction Layer.
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
/*
|
||||
ChibiOS - Copyright (C) 2006..2015 Giovanni Di Sirio
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @defgroup MII MII/RMII Header
|
||||
* @brief MII/RMII Support Header
|
||||
* @details This header contains definitions and types related to MII/RMII.
|
||||
*
|
||||
* @ingroup HAL_SUPPORT
|
||||
*/
|
|
@ -0,0 +1,23 @@
|
|||
/*
|
||||
ChibiOS - Copyright (C) 2006..2015 Giovanni Di Sirio
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @defgroup USB_CDC USB CDC Header
|
||||
* @brief USB CDC Support Header
|
||||
* @details This header contains definitions and types related to USB CDC.
|
||||
*
|
||||
* @ingroup HAL_SUPPORT
|
||||
*/
|
|
@ -14,9 +14,9 @@
|
|||
limitations under the License.
|
||||
*/
|
||||
|
||||
/*-*
|
||||
/**
|
||||
* @file mii.h
|
||||
* @brief MII Driver macros and structures.
|
||||
* @brief MII macros and structures.
|
||||
*
|
||||
* @addtogroup MII
|
||||
* @{
|
||||
|
@ -25,9 +25,9 @@
|
|||
#ifndef _MII_H_
|
||||
#define _MII_H_
|
||||
|
||||
/*
|
||||
* Generic MII registers. Note, not all registers are present on all PHY
|
||||
* devices and some extra registers may be present.
|
||||
/**
|
||||
* @name Generic MII registers
|
||||
* @{
|
||||
*/
|
||||
#define MII_BMCR 0x00 /**< Basic mode control register. */
|
||||
#define MII_BMSR 0x01 /**< Basic mode status register. */
|
||||
|
@ -53,9 +53,11 @@
|
|||
#define MII_RESV2 0x1a /**< Reserved. */
|
||||
#define MII_TPISTATUS 0x1b /**< TPI status for 10Mbps. */
|
||||
#define MII_NCONFIG 0x1c /**< Network interface config. */
|
||||
/** @} */
|
||||
|
||||
/*
|
||||
* Basic mode control register.
|
||||
/**
|
||||
* @name Basic mode control register
|
||||
* @{
|
||||
*/
|
||||
#define BMCR_RESV 0x007f /**< Unused. */
|
||||
#define BMCR_CTST 0x0080 /**< Collision test. */
|
||||
|
@ -67,9 +69,11 @@
|
|||
#define BMCR_SPEED100 0x2000 /**< Select 100Mbps. */
|
||||
#define BMCR_LOOPBACK 0x4000 /**< TXD loopback bit. */
|
||||
#define BMCR_RESET 0x8000 /**< Reset. */
|
||||
/** @} */
|
||||
|
||||
/*
|
||||
* Basic mode status register.
|
||||
/**
|
||||
* @name Basic mode status register
|
||||
* @{
|
||||
*/
|
||||
#define BMSR_ERCAP 0x0001 /**< Ext-reg capability. */
|
||||
#define BMSR_JCD 0x0002 /**< Jabber detected. */
|
||||
|
@ -84,9 +88,11 @@
|
|||
#define BMSR_100HALF 0x2000 /**< Can do 100mbps, half-duplex. */
|
||||
#define BMSR_100FULL 0x4000 /**< Can do 100mbps, full-duplex. */
|
||||
#define BMSR_100BASE4 0x8000 /**< Can do 100mbps, 4k packets. */
|
||||
/** @} */
|
||||
|
||||
/*
|
||||
* Advertisement control register.
|
||||
/**
|
||||
* @name Advertisement control register
|
||||
* @{
|
||||
*/
|
||||
#define ADVERTISE_SLCT 0x001f /**< Selector bits. */
|
||||
#define ADVERTISE_CSMA 0x0001 /**< Only selector supported. */
|
||||
|
@ -106,9 +112,11 @@
|
|||
ADVERTISE_CSMA)
|
||||
#define ADVERTISE_ALL (ADVERTISE_10HALF | ADVERTISE_10FULL | \
|
||||
ADVERTISE_100HALF | ADVERTISE_100FULL)
|
||||
/** @} */
|
||||
|
||||
/*
|
||||
* Link partner ability register.
|
||||
/**
|
||||
* @name Link partner ability register
|
||||
* @{
|
||||
*/
|
||||
#define LPA_SLCT 0x001f /**< Same as advertise selector. */
|
||||
#define LPA_10HALF 0x0020 /**< Can do 10mbps half-duplex. */
|
||||
|
@ -125,9 +133,11 @@
|
|||
|
||||
#define LPA_DUPLEX (LPA_10FULL | LPA_100FULL)
|
||||
#define LPA_100 (LPA_100FULL | LPA_100HALF | LPA_100BASE4)
|
||||
/** @} */
|
||||
|
||||
/*
|
||||
* Expansion register for auto-negotiation.
|
||||
/**
|
||||
* @name Expansion register for auto-negotiation
|
||||
* @{
|
||||
*/
|
||||
#define EXPANSION_NWAY 0x0001 /**< Can do N-way auto-nego. */
|
||||
#define EXPANSION_LCWP 0x0002 /**< Got new RX page code word. */
|
||||
|
@ -135,16 +145,20 @@
|
|||
#define EXPANSION_NPCAPABLE 0x0008 /**< Link partner supports npage. */
|
||||
#define EXPANSION_MFAULTS 0x0010 /**< Multiple faults detected. */
|
||||
#define EXPANSION_RESV 0xffe0 /**< Unused. */
|
||||
/** @} */
|
||||
|
||||
/*
|
||||
* N-way test register.
|
||||
/**
|
||||
* @name N-way test register
|
||||
* @{
|
||||
*/
|
||||
#define NWAYTEST_RESV1 0x00ff /**< Unused. */
|
||||
#define NWAYTEST_LOOPBACK 0x0100 /**< Enable loopback for N-way. */
|
||||
#define NWAYTEST_RESV2 0xfe00 /**< Unused. */
|
||||
/** @} */
|
||||
|
||||
/*
|
||||
* PHY identifiers.
|
||||
/**
|
||||
* @name PHY identifiers
|
||||
* @{
|
||||
*/
|
||||
#define MII_DM9161_ID 0x0181b8a0
|
||||
#define MII_AM79C875_ID 0x00225540
|
||||
|
@ -154,6 +168,7 @@
|
|||
#define MII_LAN8710A_ID 0x0007C0F1
|
||||
#define MII_LAN8720_ID 0x0007C0F0
|
||||
#define MII_LAN8742A_ID 0x0007C130
|
||||
/** @} */
|
||||
|
||||
#endif /* _MII_H_ */
|
||||
|
||||
|
|
|
@ -27,82 +27,12 @@
|
|||
|
||||
#if (HAL_USE_SERIAL_USB == TRUE) || defined(__DOXYGEN__)
|
||||
|
||||
#include "usb_cdc.h"
|
||||
|
||||
/*===========================================================================*/
|
||||
/* Driver constants. */
|
||||
/*===========================================================================*/
|
||||
|
||||
/**
|
||||
* @name CDC specific messages.
|
||||
* @{
|
||||
*/
|
||||
#define CDC_SEND_ENCAPSULATED_COMMAND 0x00
|
||||
#define CDC_GET_ENCAPSULATED_RESPONSE 0x01
|
||||
#define CDC_SET_COMM_FEATURE 0x02
|
||||
#define CDC_GET_COMM_FEATURE 0x03
|
||||
#define CDC_CLEAR_COMM_FEATURE 0x04
|
||||
#define CDC_SET_AUX_LINE_STATE 0x10
|
||||
#define CDC_SET_HOOK_STATE 0x11
|
||||
#define CDC_PULSE_SETUP 0x12
|
||||
#define CDC_SEND_PULSE 0x13
|
||||
#define CDC_SET_PULSE_TIME 0x14
|
||||
#define CDC_RING_AUX_JACK 0x15
|
||||
#define CDC_SET_LINE_CODING 0x20
|
||||
#define CDC_GET_LINE_CODING 0x21
|
||||
#define CDC_SET_CONTROL_LINE_STATE 0x22
|
||||
#define CDC_SEND_BREAK 0x23
|
||||
#define CDC_SET_RINGER_PARMS 0x30
|
||||
#define CDC_GET_RINGER_PARMS 0x31
|
||||
#define CDC_SET_OPERATION_PARMS 0x32
|
||||
#define CDC_GET_OPERATION_PARMS 0x33
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @name CDC classes
|
||||
* @{
|
||||
*/
|
||||
#define CDC_COMMUNICATION_INTERFACE_CLASS 0x02
|
||||
#define CDC_DATA_INTERFACE_CLASS 0x0A
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @name CDC subclasses
|
||||
* @{
|
||||
*/
|
||||
#define CDC_ABSTRACT_CONTROL_MODEL 0x02
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @name CDC descriptors
|
||||
* @{
|
||||
*/
|
||||
#define CDC_CS_INTERFACE 0x24
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @name CDC subdescriptors
|
||||
* @{
|
||||
*/
|
||||
#define CDC_HEADER 0x00
|
||||
#define CDC_CALL_MANAGEMENT 0x01
|
||||
#define CDC_ABSTRACT_CONTROL_MANAGEMENT 0x02
|
||||
#define CDC_UNION 0x06
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @name Line Control bit definitions.
|
||||
* @{
|
||||
*/
|
||||
#define LC_STOP_1 0
|
||||
#define LC_STOP_1P5 1
|
||||
#define LC_STOP_2 2
|
||||
|
||||
#define LC_PARITY_NONE 0
|
||||
#define LC_PARITY_ODD 1
|
||||
#define LC_PARITY_EVEN 2
|
||||
#define LC_PARITY_MARK 3
|
||||
#define LC_PARITY_SPACE 4
|
||||
/** @} */
|
||||
|
||||
/*===========================================================================*/
|
||||
/* Driver pre-compile time settings. */
|
||||
/*===========================================================================*/
|
||||
|
@ -143,16 +73,6 @@
|
|||
/* Driver data structures and types. */
|
||||
/*===========================================================================*/
|
||||
|
||||
/**
|
||||
* @brief Type of Line Coding structure.
|
||||
*/
|
||||
typedef struct {
|
||||
uint8_t dwDTERate[4];
|
||||
uint8_t bCharFormat;
|
||||
uint8_t bParityType;
|
||||
uint8_t bDataBits;
|
||||
} cdc_linecoding_t;
|
||||
|
||||
/**
|
||||
* @brief Driver state machine possible states.
|
||||
*/
|
||||
|
|
|
@ -0,0 +1,136 @@
|
|||
/*
|
||||
ChibiOS - Copyright (C) 2006..2015 Giovanni Di Sirio
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file usb_cdc.h
|
||||
* @brief USB CDC macros and structures.
|
||||
*
|
||||
* @addtogroup USB_CDC
|
||||
* @{
|
||||
*/
|
||||
|
||||
#ifndef _USB_CDC_H_
|
||||
#define _USB_CDC_H_
|
||||
|
||||
/*===========================================================================*/
|
||||
/* Driver constants. */
|
||||
/*===========================================================================*/
|
||||
|
||||
/**
|
||||
* @name CDC specific messages.
|
||||
* @{
|
||||
*/
|
||||
#define CDC_SEND_ENCAPSULATED_COMMAND 0x00U
|
||||
#define CDC_GET_ENCAPSULATED_RESPONSE 0x01U
|
||||
#define CDC_SET_COMM_FEATURE 0x02U
|
||||
#define CDC_GET_COMM_FEATURE 0x03U
|
||||
#define CDC_CLEAR_COMM_FEATURE 0x04U
|
||||
#define CDC_SET_AUX_LINE_STATE 0x10U
|
||||
#define CDC_SET_HOOK_STATE 0x11U
|
||||
#define CDC_PULSE_SETUP 0x12U
|
||||
#define CDC_SEND_PULSE 0x13U
|
||||
#define CDC_SET_PULSE_TIME 0x14U
|
||||
#define CDC_RING_AUX_JACK 0x15U
|
||||
#define CDC_SET_LINE_CODING 0x20U
|
||||
#define CDC_GET_LINE_CODING 0x21U
|
||||
#define CDC_SET_CONTROL_LINE_STATE 0x22U
|
||||
#define CDC_SEND_BREAK 0x23U
|
||||
#define CDC_SET_RINGER_PARMS 0x30U
|
||||
#define CDC_GET_RINGER_PARMS 0x31U
|
||||
#define CDC_SET_OPERATION_PARMS 0x32U
|
||||
#define CDC_GET_OPERATION_PARMS 0x33U
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @name CDC classes
|
||||
* @{
|
||||
*/
|
||||
#define CDC_COMMUNICATION_INTERFACE_CLASS 0x02U
|
||||
#define CDC_DATA_INTERFACE_CLASS 0x0AU
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @name CDC subclasses
|
||||
* @{
|
||||
*/
|
||||
#define CDC_ABSTRACT_CONTROL_MODEL 0x02U
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @name CDC descriptors
|
||||
* @{
|
||||
*/
|
||||
#define CDC_CS_INTERFACE 0x24U
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @name CDC subdescriptors
|
||||
* @{
|
||||
*/
|
||||
#define CDC_HEADER 0x00U
|
||||
#define CDC_CALL_MANAGEMENT 0x01U
|
||||
#define CDC_ABSTRACT_CONTROL_MANAGEMENT 0x02U
|
||||
#define CDC_UNION 0x06U
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @name Line Control bit definitions.
|
||||
* @{
|
||||
*/
|
||||
#define LC_STOP_1 0U
|
||||
#define LC_STOP_1P5 1U
|
||||
#define LC_STOP_2 2U
|
||||
|
||||
#define LC_PARITY_NONE 0U
|
||||
#define LC_PARITY_ODD 1U
|
||||
#define LC_PARITY_EVEN 2U
|
||||
#define LC_PARITY_MARK 3U
|
||||
#define LC_PARITY_SPACE 4U
|
||||
/** @} */
|
||||
|
||||
/*===========================================================================*/
|
||||
/* Driver pre-compile time settings. */
|
||||
/*===========================================================================*/
|
||||
|
||||
/*===========================================================================*/
|
||||
/* Derived constants and error checks. */
|
||||
/*===========================================================================*/
|
||||
|
||||
/*===========================================================================*/
|
||||
/* Driver data structures and types. */
|
||||
/*===========================================================================*/
|
||||
|
||||
/**
|
||||
* @brief Type of Line Coding structure.
|
||||
*/
|
||||
typedef struct {
|
||||
uint8_t dwDTERate[4];
|
||||
uint8_t bCharFormat;
|
||||
uint8_t bParityType;
|
||||
uint8_t bDataBits;
|
||||
} cdc_linecoding_t;
|
||||
|
||||
/*===========================================================================*/
|
||||
/* Driver macros. */
|
||||
/*===========================================================================*/
|
||||
|
||||
/*===========================================================================*/
|
||||
/* External declarations. */
|
||||
/*===========================================================================*/
|
||||
|
||||
#endif /* _USB_CDC_H_ */
|
||||
|
||||
/** @} */
|
|
@ -15,7 +15,7 @@
|
|||
*/
|
||||
|
||||
#include "hal.h"
|
||||
|
||||
#include "usb_cdc.h"
|
||||
#include "usbcfg.h"
|
||||
|
||||
/*
|
||||
|
@ -283,20 +283,6 @@ static void usb_event(USBDriver *usbp, usbevent_t event) {
|
|||
return;
|
||||
}
|
||||
|
||||
#define CDC_SET_LINE_CODING 0x20
|
||||
#define CDC_GET_LINE_CODING 0x21
|
||||
#define CDC_SET_CONTROL_LINE_STATE 0x22
|
||||
|
||||
#define LC_STOP_1 0
|
||||
#define LC_PARITY_NONE 0
|
||||
|
||||
typedef struct {
|
||||
uint8_t dwDTERate[4];
|
||||
uint8_t bCharFormat;
|
||||
uint8_t bParityType;
|
||||
uint8_t bDataBits;
|
||||
} cdc_linecoding_t;
|
||||
|
||||
static cdc_linecoding_t linecoding = {
|
||||
{0x00, 0x96, 0x00, 0x00}, /* 38400. */
|
||||
LC_STOP_1, LC_PARITY_NONE, 8
|
||||
|
|
Loading…
Reference in New Issue