np.hstackk-c.h

USB Stack for Microchip PIC 16F, 18F, 24F, and 32MX Microcontrollers
A USB device stack is the software necessary to drive the USB device
peripheral hardware on a microcontroller (MCU) or other device.
Typically,
USB peripheral hardware only supports the transaction level and below of the
USB protocol.
Enumeration and transfers are left to the firmware or
software to implement.
The Microchip PIC line of microcontrollers work
exactly this way.
M-Stack is a functional, well-documented, free and open source implementation of a
USB stack for Microchip PIC platforms.
It performs the following
operations:
USB device hardware initialization
USB interrupt handling
Management of the serial interface engine SIE
Management of endpoints
Fragmentation and reassembly of control transfers
Handling and sending standard setup requests
Enumeration
The following device classes are supported:
Vendor Defined (no-class) devices, suitable for use with , , or with custom drivers
HID - Human Interface Device
CDC-ACM - Communication Device Class - Abstract Control Model
Mass Storage Class (MSC) with MMC/SD card support
Other features include:
Clean, well-documented examples (device, and PC-host (libusb))
Fast PIC24 bootloader
While having a working USB stack is of great benefit when starting a USB
project, know that there is no substitute for actually knowing the details
of how USB works.
The USB specification should be consulted frequently when
creating a USB device.
The software is dual-licensed under the LGPL version 3 and the
Apache License version 2.0. It may be used without royalty payment in
both commercial and open hardware projects so long as the conditions of
either the LGPL or the Apache License can be met.
Commercial licenses are available for purchase for companies and projects
which cannot or wish to not comply with the terms of either the LGPL or the
Apache License.
Contribution
Code contributions to the project are welcome, but copyright on code
submitted will need to be assigned to Signal 11 Software.
Shared copyright
is permissible.
Free support for this product is somewhat limited. A mailing list will
be setup soon.
Paid support is available through .
Getting Started
Downloading the Software
M-Stack's source code is currently hosted on
. To get the latest version, run:
git clone https://github.com/signal11/m-stack.git
Documentation
For an overview of how to use M-Stack, see the
Supported hardware
M-Stack has currently been tested on PIC16F, PIC18F, PIC24F, and
PIC32MX devices.
Microchip has obviously made a conscious effort to
make the register-level interfaces to their USB peripherals as similar as
possible across MCUs and even across MCU families.
While many devices
should be able to be easily supported with this software, there are often
times small differences which need to be worked out, the biggest of which
being buffer descriptor and data buffer locations with respect to the DMA
capabilities of the microcontroller being used.
The following MCU's and configurations have been tested:
PIC32MX460F512L - PIC32 USB Starter Board
PIC24FJ64GB002
PIC24FJ256DA206
PIC18F46J50 - PIC18F Starter Kit
PIC16F1459
If your hardware is not supported, and it's in the PIC16F/18F/24F/32MX
family, I can probably easily make you a port without very much trouble.
The easiest way is for you to send me a development board.
If your hardware
is in another MCU family which is not currently supported, I can also make
you a port, but it will be more effort.
In either case, I'd be happy to
talk with you about it.
Supported Software
The USB stack is supported by the following software:
Microchip XC8 compiler
Microchip XC16 compiler
Microchip XC32 compiler
Microchip MPLAB X IDE
Note that the C18 compiler is not currently supported. There are some
#defines in the code for C18 because this project came from code that was
originally done on a PIC18F4550 using C18.
It has not yet been determined
whether a port to C18 will be made, as C18 has been deprecated by Microchip.
Further, C18 has some properties which make a port somewhat more difficult
than other compilers.
Building the Unit Test Firmware
Open the MPLAB.X project in apps/unit_test in the MPLAB X IDE. Select a
configuration and build. Make sure a supported compiler is installed.
Building the Test Software
The host_test/ directory contains Libusb-based test programs for testing the
functionality of a USB device running the unit test firmware.
Currently the
Libusb test software has only been tested Linux, but since its only
dependency is the cross-platform Libusb library, it is easily portable to
other operating systems on which Libusb is supported.
With Libusb installed, run make in the host_test/ directory to build the
test software.
Running the Test Software
./control_transfer_in [number_of_bytes]
Execute an IN control transfer requesting number_of_bytes bytes
from the device. The data returned will be printed. The unit test
firmware supports control transfers up to 512 bytes.
./control_transfer_out [number_of_bytes]
Execute an OUT control transfer sending number_of_bytes bytes
to the device. A message will be printed. The unit test
firmware supports control transfers up to 512 bytes.
./test [number_of_bytes]
Send and then ask for number_of_bytes bytes on EP 1 OUT and EP 1
IN, respectively. The data is printed out. The unit test firmware
will support up to 128-bytes of this kind of operation.
./feature &clear&
Set the Endpoint halt feature on Endpoint 1 IN. Passing the
clear parameter clears endpoint halt.
Source Tree Structure
&- USB stack software
+- include/
&- API include file directory
&- Source files
+- storage/
&- MMC/SD card implementation
+- include/
&- API include files
&- Source files
&- Firmware USB device applications,
examples, and tests
+- unit_test/
&- Unit test firmware
+- hid_mouse/
&- HID Mouse example
+- cdc_acm/
&- CDC/ACM virtual COM port example
+- msc_test/
&- Mass Storage Class example
+- bootloader/
&- USB Bootloader firmware and software
+- host_test/
&- Software applications to run from a PC Host
USB Stack Source Files
usb/src/usb.c
- The implementation of the USB stack.
usb/src/usb_hal.h
- Hardware abstraction layer (HAL) containing
differences specific to each platform.
usb/src/usb_hid.c
- Implementation of the HID class.
usb/include/usb.h
- The API header for the USB stack. Applications should
#include this file.
usb/include/usb_ch9.h - Enums and structs from Chapter 9 of the USB
specification which deals with control transfers and
enumeration.
An application should #include this
file from their usb_descriptors.c and from any file
which deals with control transfers.
usb/src/usb_hid.h
- Enums, structs, and callbacks for the HID class
Application Source Files (Unit Test Example)
apps/unit_test/main.c
- Main program file
apps/unit_test/usb_config.h
- M-Stack configuration file. The USB
stack will include this file and use it
for configuration.
The application
should set the #defines in this file to
suit the application's needs.
apps/unit_test/usb_descriptors.c - The application's descriptors. The
application should set the descriptors in
this file as desired to suit the
application's needs.
Making Your Own Project
The easiest way to create a project using M-Stack is to simply
and modify it accordingly.
Sometimes it's better though to do things the
hard way in order to understand better.
To create a new project, perform the following steps:
Create a new project with MPLAB X.
Copy and add the usb/ directory as a subdirectory of your project.
Add the usb/include directory to the include path of your project. (Note
that the include paths are relative to the Makefile.
If you set up your
project like the examples, with an MPLAB.X/ subdirectory, you'll need to
add an additional ../ to the beginning of the include path).
Add . to the include path of your project (same note from #3 applies).
Copy a usb_config.h and a usb_descriptors.c file from one of the
example projects into your main project directory.
Modify usb_config.h to match your desired device configuration.
Modify usb_descriptors.c to match your device configuration.
If you're using a PIC16F/18F platform, add an interrupt handler similar to
one of the examples.
Reference main.c in one of the examples, and the Doxygen-generated
documentation to add your application logic.
Make sure to configure the MCU for your board (__CONFIG registers,
Limitations
Nothing's perfect. Here are the known limitations:
Control transfers are supported on endpoint 0 only.
Isochronous transfers are not supported.
Remote wake-up is not supported.
Future Plans
The following features are on the horizon:
Support for more specific MCUs
dsPIC33E and PIC24E support
Isochronous transfers
Consulting Services
USB is hard. There's no getting around it. There's a good chance if you're
reading this that USB is not the main focus of your project.
USB is a means
to an end, and your specialization is likely more related to the end than to
the means.
Given that, doesn't it makes sense to hire someone to help you
with the USB aspect of your project?
Many have found that hiring
specialized consultants for specialized jobs can drastically reduce the
total cost of a project.
This software testifies to the
expertise Signal 11 Software has with respect to USB and software
development.
information.
References
Microchip PIC
for support or consulting help.
Sometime in the near future there will be a mailing list.
Signal 11 Software
alan@signal11.us
http://www.signal11.us
+1 407-222-69752464人阅读
STL源码剖析(28)
// Filename:
stl_stack.h
// Comment By:
// E-mail:
http://blog.csdn.net/mdl13412
////////////////////////////////////////////////////////////////////////////////
// stack是一种先进后出(First In Last Out, FILO)的数据结构, 其只有一个出口
// 支持对栈顶元素的追加, 弹出, 获取, 但是不提供对其它位置元素的访问
////////////////////////////////////////////////////////////////////////////////
// 以下为使用deque时的布局
预留的内存边界
// --------------------------------------------------------------------
| ...... |
// --------------------------------------------------------------------
-------------------------------
这里是尚未使用的预留内存, 可能为0
仅支持在这里进行push(), pop(), top()操作
////////////////////////////////////////////////////////////////////////////////
* Copyright (c) 1994
* Hewlett-Packard Company
* Permission to use, copy, modify, distribute and sell this software
* and its documentation for any purpose is hereby granted without fee,
* provided that the above copyright notice appear in all copies and
* that both that copyright notice and this permission notice appear
* in supporting documentation.
Hewlett-Packard Company makes no
* representations about the suitability of this software for any
* purpose.
It is provided &as is& without express or implied warranty.
* Copyright (c)
* Silicon Graphics Computer Systems, Inc.
* Permission to use, copy, modify, distribute and sell this software
* and its documentation for any purpose is hereby granted without fee,
* provided that the above copyright notice appear in all copies and
* that both that copyright notice and this permission notice appear
* in supporting documentation.
Silicon Graphics makes no
* representations about the suitability of this software for any
* purpose.
It is provided &as is& without express or implied warranty.
/* NOTE: This is an internal header file, included by other STL headers.
You should not attempt to use it directly.
#ifndef __SGI_STL_INTERNAL_STACK_H
#define __SGI_STL_INTERNAL_STACK_H
__STL_BEGIN_NAMESPACE
// 如果编译器不能根据前面模板参数推导出后面使用的默认参数类型,
// 那么就需要手工指定, 本实作stack内部容器默认使用deque
// 选用deque可以在存储空间不足时可以动态增加, 而且代价很低
#ifndef __STL_LIMITED_DEFAULT_TEMPLATES
template &class T, class Sequence = deque&T& &
template &class T, class Sequence&
class stack
// 特化的全局运算符, 提供operator==和&重载则构建出所有运算符
// 其具体细节见&stl_pair.h&中的说明
friend bool operator== __STL_NULL_TMPL_ARGS (const stack&, const stack&);
friend bool operator& __STL_NULL_TMPL_ARGS (const stack&, const stack&);
// 由于stack仅支持对栈顶元素的操作, 所以不定义STL要求的
// pointer, iterator, difference_type
typedef typename Sequence::value_type value_
typedef typename Sequence::size_type size_
typedef typename Sequence::
typedef typename Sequence::const_reference const_
protected:
// 这个是我们实际维护的容器
// 下面的操作完全使用内部容器的成员函数实现
// 这再次体现了STL高度的可复用性:-)
// 判断stack是否为空
bool empty() const { return c.empty(); }
// stack中元素个数
size_type size() const { return c.size(); }
// 返回栈顶元素, 注意这里返回的是引用!!!
reference top() { return c.back(); }
const_reference top() const { return c.back(); }
// 在栈顶追加新元素
void push(const value_type& x) { c.push_back(x); }
// 移除栈顶元素, 注意不返回元素的引用,
// 很多初学者随机用此容器时经常误认为pop()操作同时会返回栈顶元素的引用
void pop() { c.pop_back(); }
// 判断两个stack是否相等, 就要测试其内部维护容器是否相等
// x.c == y.c会调用容器重载的operator ==
template &class T, class Sequence&
bool operator==(const stack&T, Sequence&& x, const stack&T, Sequence&& y)
return x.c == y.c;
template &class T, class Sequence&
bool operator&(const stack&T, Sequence&& x, const stack&T, Sequence&& y)
return x.c & y.c;
__STL_END_NAMESPACE
#endif /* __SGI_STL_INTERNAL_STACK_H */
// Local Variables:
// mode:C++
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
访问:280779次
积分:5824
积分:5824
排名:第2405名
原创:79篇
评论:457条
本人拥有该Blog内全部原创文章的所有权利。转载请注明作者和出处!
(1)(4)(9)(1)(1)(1)(1)(1)(1)(1)(2)(3)(3)(3)(5)(3)(2)(1)(1)(1)(2)(15)(17)(1)(1)啊!看不懂!
您的举报已经提交成功,我们将尽快处理,谢谢!
大家还关注
for(j = i-1; j >=6; j--)
for(k = j-1; k>=5;k--)
for(l = k-1; l>=4;l--)
for(m = l-1; m>=3;m--)
for(x = m-1; x>=2;x--)
for(o = x-1; o>=1;o--)
printf("%d %d %d %d %d %d %d\n",i,j,k,l,m,x,o);
//return(1);
return(1);
1、现在问题是运行后显示最终结果不完全,只显示最后的300个数据,前面显示的都不见了;
2、怎样把运行后的数据输出到文本文档(.txt)上
">Dev-C++如何将结果输出到txt文档...
T->lchild=InputLink(T->lchild);
T->rchild=InputLink(T->rchild);
void TraveLink(LinkCode *T,int serdata,int a[])
TraveLink(T->lchild,serdata,a);
visit(T,serdata,a);
TraveLink(T->rchild,serdata,a);
void visit(LinkCode *T,int serdata,int a[])
a[j+1]=T->
void main()
int serdata,n,i;
int a[100];
LinkCode *L;
printf("遍历二叉树\n");
InputLink(L);
printf("要查询的数据:");
scanf("%d",&serdata);
TraveLink(L,serdata,a);
中序遍历二叉树问题">指针地址有问题,高手帮忙看看 #incl...
6. int array[ 10 ] = { 0 };
for ( int i = 0; i<= 10; i++ )
cout << array[ i ];
7. const int arraySize = 5;
int a[arraySize];
arraySize = 6;
int b[arraySize];
8. char string1[1];
cout <> string1;
">改错题: 1. int fstPlace...
<a href="/b/.html" target="_blank" title="阅读程序(或片断),写出输出结果: 1.cout<<(8*5*2+3)/2+4;2.31%7+23.intx=3;while(x<=6){x++;cout<<“x的值是:“<<x<<}cout<<“x最终的值是:“<<x<<4.for(inti=1;i<=6;i++){switch(i){case1:cout<<“x的值是1\n”;case4:cout<<“x的值是4\n”;case6:cout<<“x的值是6\n”; <<“x的值不是1,4也不是6\n”;}}5.voidf1()voidf2(intx){intx=5;{x+=10;f2(x);cout<<x<<cout<<x<阅读程序(或片断),写出输出结果: 1....
(window.slotbydup=window.slotbydup || []).push({
id: '2081942',
container: s,
size: '1000,60',
display: 'inlay-fix'

我要回帖

更多关于 numpy hstack 的文章

 

随机推荐