OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站
点击跳转“创龙科技服务通”

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 10834|回复: 0
打印 上一主题 下一主题

[未解决] OMAPL138如何在Linux下使用EDMA3驱动

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 1 w" g- _% W& k, D2 Z, _
  1. [code]EDMA sample test application
    + t. P4 N& }% v7 @6 M3 [& ^
  2. /*
    # @, p) ]/ y- t0 f; Z" D# k( L1 K
  3. * edma_test.c
    / y! B% B% ], ^; W- v/ L# d2 i( L" I4 e
  4. *1 M# o" d- {  G; f' h- W3 j
  5. * brief  EDMA3 Test Application
    ' e. Y* j/ E  Y8 D
  6. *
    . F# o& j( ]1 D2 P* ~
  7. *   This file contains EDMA3 Test code.
    8 {2 N$ Q8 A; [/ `! }2 F/ r' n) `4 z
  8. *
    / h) y7 z! F/ ]
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ) b9 z! U1 q6 `* `% _
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT' f0 t8 Q9 w: {% M
  11. *         TO CHANGE.
    5 S3 u, n# R+ M- M4 {3 V
  12. *% z; p6 A; B. y6 V3 j
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/" q! N  z  w! A( `$ e  y3 G& |) ?
  14. *  u7 G/ O$ l) m& w2 p* G) P
  15. * This program is free software; you can redistribute it and/or" G3 m( f) N  X2 K8 z2 j
  16. * modify it under the terms of the GNU General Public License as
    * l1 ]' c: ~& j, f1 O7 c( R
  17. * published by the Free Software Foundation version 2.
    $ A! E6 ]: K" h
  18. *8 |% A. r3 e( n0 }  @% C( E* v
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any4 _4 W- P: W. A+ f: `/ w' y
  20. * kind, whether express or implied; without even the implied warranty
    : w0 t" y0 n/ y) m7 {
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the$ m5 x$ I$ o) k
  22. * GNU General Public License for more details.
    8 V5 s  |! D. z* y, q( \+ c
  23. */
    7 e. |/ e1 G+ A' {

  24. 1 H# [  x- v( l" {
  25. #include <linux/module.h>2 w/ ?. i6 b% i% A, T6 d8 d! \
  26. #include <linux/init.h>9 b  b1 ~6 ~9 e
  27. #include <linux/errno.h>+ R* P( r1 g6 B9 B
  28. #include <linux/types.h>
    . R4 o' W% H( d" |" N& M
  29. #include <linux/interrupt.h>
    ! T. U) h  ?  a; H7 v; k! t
  30. #include <asm/io.h>
    ) r5 `0 B+ _7 }0 U2 |( ?; m& X
  31. #include <linux/moduleparam.h>
    - _$ a& z2 _2 g* m0 u" W0 S9 {5 \( M
  32. #include <linux/sysctl.h>
    - F9 ~- D; }6 c( O; Z' t8 e
  33. #include <linux/mm.h>* s  Q, u  _3 E; O- e0 h0 D( j, q% I
  34. #include <linux/dma-mapping.h>
    , G/ g7 j, T5 R! }8 h* I
  35. # x* Y9 R: X5 c$ ~- Y
  36. #include <mach/memory.h>: E8 J$ g; i* a3 c7 u9 e! O
  37. #include <mach/hardware.h>
    3 c. T9 P, [7 N( P
  38. #include <mach/irqs.h>
    2 L$ o: `+ Q: e
  39. #include <asm/hardware/edma.h>
    6 y. z  `, y, t* p) }2 W8 d

  40. & A& H; ~+ ~% ?7 _7 W
  41. #undef EDMA3_DEBUG
    & P2 ^: L8 M+ D/ k) b# \
  42. /*#define EDMA3_DEBUG*/. K' R8 R; Q1 E- t
  43. " m# ~$ w+ t: y7 Z4 N
  44. #ifdef EDMA3_DEBUG# m0 D" d& l. b" y
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)& S' b+ d& i7 z
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)# n7 \4 [. a. A2 j- t; {( S5 |* J
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    6 C0 N5 ^2 q# q- o0 q9 [
  48. #else
    % I: M& ~: S" r9 o
  49. #define DMA_PRINTK( x... ): t8 U% |# T; q7 `
  50. #define DMA_FN_IN
    ' J& n& [1 a" t6 H
  51. #define DMA_FN_OUT2 A* ^) J! L2 L
  52. #endif) o- W" g0 [" |" J5 u  m
  53. ' D9 ^: `; _$ Z  |) c  V
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)- e3 E# @% S, D  }- \1 x/ C
  55. #define STATIC_SHIFT                3' J+ ?* O) p: V( i) P; L9 A  T9 A
  56. #define TCINTEN_SHIFT               20$ w1 s6 K; Y! U4 C
  57. #define ITCINTEN_SHIFT              21& ]0 z3 ^- ~, c/ r' b7 C
  58. #define TCCHEN_SHIFT                22
    2 G9 O! C+ _& R. j* E
  59. #define ITCCHEN_SHIFT               23* V. v2 Q) ]: o6 Z' A% z. A
  60. * L* K5 n4 G/ D% C
  61. static volatile int irqraised1 = 0;
    * X% M4 d% U+ U2 G
  62. static volatile int irqraised2 = 0;
    7 T8 o* T( ^/ r' g% s9 ~

  63. ' N) \7 q/ r, j- K/ f
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: h, \' X3 o/ D4 C+ }4 m( l7 j
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & z7 y" y  u2 }8 m# [' s
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ t1 B. B3 r1 b" t4 N! D
  67. % Z1 q) z/ H/ a. P5 G# R0 k
  68. dma_addr_t dmaphyssrc1 = 0;6 ^2 b1 p8 W# z/ b
  69. dma_addr_t dmaphyssrc2 = 0;
    * I" C4 {: u) ~  O/ O" n$ b
  70. dma_addr_t dmaphysdest1 = 0;% [7 g( X* V3 q  M- F* c* J5 o/ O
  71. dma_addr_t dmaphysdest2 = 0;
      A# ?% j  M) I) ~! o. i' G1 y6 }

  72. ( `4 ^+ M% G; m$ S$ s
  73. char *dmabufsrc1 = NULL;% \. _* C3 X* U" x8 S% m, z9 ~7 H
  74. char *dmabufsrc2 = NULL;3 m$ w7 a# ]% {1 w& P  h6 k
  75. char *dmabufdest1 = NULL;
    ) n9 r7 m9 z; Q2 `* f7 J- R5 b* I! `
  76. char *dmabufdest2 = NULL;8 `# i+ I( m) c. E6 ^
  77. # x( p8 B$ E! A: T  A
  78. static int acnt = 512;
    + S! b$ R: B+ S3 V
  79. static int bcnt = 8;
    ! p) b  q5 z- o( a# h/ L/ U
  80. static int ccnt = 8;( I* k0 m1 z4 V+ T$ `$ O4 t) J
  81. 4 z* g1 Y; }- M4 g* n5 A$ ^) _$ l
  82. module_param(acnt, int, S_IRUGO);( @+ I& @% H# a% P: y( X/ m9 t
  83. module_param(bcnt, int, S_IRUGO);" K7 B# f& u/ s0 ], ^5 _
  84. module_param(ccnt, int, S_IRUGO);
复制代码
4 O( K/ v7 d% ^  o

" i& ]( v, u, L* Y5 q' o      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
( W, l/ @3 u7 Xarm-none-linux-gnueabi-gcc  -I /home/tl/omapl138/linux-3.3/arch/arm/include -I /home/tl/omapl138/linux-3.3/include  EDMA3test.cpp -o EDMA3这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
* J; B% _* k, E# i) C/ G: O     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
7 x; k2 S) y" n( B
- u4 ]  \, X, v/ k" \# F% C6 i$ k# W" i* ~" y
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

点击跳转“创龙科技服务通”

QQ|手机版|小黑屋|嵌入式开发者社区 ( 粤ICP备15055271号

GMT+8, 2026-2-1 21:25 , Processed in 0.039227 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

快速回复 返回顶部 返回列表