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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 8 I; j/ `  o% q- D6 A% g
  1. [code]EDMA sample test application$ Q$ ~0 _1 O- q* K- J
  2. /*4 r0 X* a5 E; h
  3. * edma_test.c
    ( L5 ~$ q  B2 f+ I$ l
  4. *
    8 S6 }# A- ]9 U2 s9 t  J4 K
  5. * brief  EDMA3 Test Application6 r: ?, U. c( ]$ M$ E5 s8 F2 w+ |+ Z
  6. *
    5 _) t: A: n7 K) G1 I2 }- f
  7. *   This file contains EDMA3 Test code.
    ' W, b0 j& K9 R3 y. W
  8. *) L* M6 M" q; ^
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE+ W8 }- J2 n( A" l! E/ J: ]
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT' d: I1 f+ W0 Y, U* q9 P' I8 e- }
  11. *         TO CHANGE.
    " \5 ?# B9 g& c% m  ^/ L* G
  12. *4 `: V" D6 Q" }) m$ V- t# i
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    5 i7 J5 E" `" y, o& Z. v8 w3 h1 I+ r
  14. *' c2 ^+ z  ]4 C1 D  t
  15. * This program is free software; you can redistribute it and/or
    : a1 S# L3 @# x$ O
  16. * modify it under the terms of the GNU General Public License as
    8 p- v* c3 x) r* P8 M7 b$ c
  17. * published by the Free Software Foundation version 2.5 V7 @5 R/ _8 l: a
  18. *
    1 x  b" j4 e4 H5 w" e6 F( A
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    2 S1 Q1 n) W0 q. T, S; X& P9 h1 h
  20. * kind, whether express or implied; without even the implied warranty- n& D+ G, t* [# n$ F
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the6 c4 k( @* w5 u6 K/ D
  22. * GNU General Public License for more details.
    & k2 ~& j' K! t& t7 M2 W
  23. */: G' I$ n# v- [/ O2 W% H7 ~; A
  24. 9 u0 W  x# o1 y; S# k4 G1 S
  25. #include <linux/module.h>7 d+ E( D% \' x
  26. #include <linux/init.h>
    8 r, h% f- R+ Z# t( T2 _
  27. #include <linux/errno.h>
    + R% F( M" W! q- I
  28. #include <linux/types.h>+ }" V' G3 R! j. U
  29. #include <linux/interrupt.h>
      I/ y* i  ~8 ~7 Z. m% e7 p  D4 d) E
  30. #include <asm/io.h>
      W0 M: }* O* B5 p
  31. #include <linux/moduleparam.h>7 Q3 Y% r2 M! R2 @
  32. #include <linux/sysctl.h>
    * P% J6 C* X- g1 A
  33. #include <linux/mm.h>% c# H: x: ]/ i) `: |
  34. #include <linux/dma-mapping.h>& ]; [: w' I% m
  35. 8 r- ]+ \( e2 H& ~
  36. #include <mach/memory.h>
    2 N3 d, p3 Q4 @% a% n
  37. #include <mach/hardware.h>
    " m3 l! Q3 W. u8 Z- P  x% p, _8 V+ z
  38. #include <mach/irqs.h>  d  s4 K$ y) b% A& J- `2 ^+ r
  39. #include <asm/hardware/edma.h>
    ; e) u) U+ }- U% z' O6 U; k

  40. & w3 N/ i7 c3 N# m# e
  41. #undef EDMA3_DEBUG  ?. w! X8 O. r7 o  i3 ~9 M8 z
  42. /*#define EDMA3_DEBUG*/
    # `; x" ?" ]+ k+ J' u

  43. $ ]* p& u& K& U" h$ S, B
  44. #ifdef EDMA3_DEBUG
    ' f0 [: \; L/ e1 L2 g6 ~
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ( ]' O2 W9 m8 n8 H! w' d1 P( k6 `9 h
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
      g. Z5 \: g! s- d
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)0 ]0 ?) A+ m$ B+ Y. Q
  48. #else& l  J$ D' q3 J/ }
  49. #define DMA_PRINTK( x... )
    ' r% U$ q2 Q, e; \7 Z, H
  50. #define DMA_FN_IN
    * H* T% G$ ?! R- C5 T
  51. #define DMA_FN_OUT6 f' O" `( P, m7 q+ G" w8 u
  52. #endif
      B1 V  V/ B+ J8 G3 f! h
  53. 7 O9 a+ Z8 D8 L+ l$ I" w6 ~; X
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    / v+ w' o. p6 s& _
  55. #define STATIC_SHIFT                3; @! a8 Y# Y$ q8 i* b: x* Q/ G- L
  56. #define TCINTEN_SHIFT               20
    2 b' q7 U1 J8 c
  57. #define ITCINTEN_SHIFT              21
    * `4 i2 {- c1 N
  58. #define TCCHEN_SHIFT                22
    0 K: G! k0 S' v0 R
  59. #define ITCCHEN_SHIFT               232 w; B2 i% g! V9 e& x
  60. - {% l2 d7 n* r9 @
  61. static volatile int irqraised1 = 0;
    8 d3 q* A! G) p5 L5 R9 C
  62. static volatile int irqraised2 = 0;
    9 G6 d0 Z" P, R. }( w! q
  63. 3 A' m8 s0 H+ f( w( i
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; i4 B; U- c9 d1 X$ A8 [
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : h- z6 B9 u* Q# ?5 v
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 E0 J8 Z! F( Y2 _  E0 j7 O
  67. 6 |9 x: t- o( u7 h9 a5 `
  68. dma_addr_t dmaphyssrc1 = 0;4 t, x& Z/ j4 o0 p  E! q, C, v+ L8 r
  69. dma_addr_t dmaphyssrc2 = 0;, Z" ^# C! [. n& t2 D5 k2 a
  70. dma_addr_t dmaphysdest1 = 0;
    % E7 s. c. J% I2 p$ Z
  71. dma_addr_t dmaphysdest2 = 0;
    * b5 H$ u3 @$ \+ s$ Q+ m$ R
  72. & K6 V' Z& o' h; X( g2 X
  73. char *dmabufsrc1 = NULL;
    + u5 R! \2 r4 X+ c7 g9 C0 |
  74. char *dmabufsrc2 = NULL;
      _  {) s' \6 p( O& w0 A- s
  75. char *dmabufdest1 = NULL;
    ) ]8 s0 @+ j- c& {
  76. char *dmabufdest2 = NULL;
    8 U+ I5 [, ?) b4 A: N5 v7 o

  77. , A6 N4 _$ @2 H+ k/ E8 g# w& ?  y
  78. static int acnt = 512;
    1 k0 y1 G! T+ n3 A# P3 [( Z- R
  79. static int bcnt = 8;
    ' W& P, x# H9 G# H1 \
  80. static int ccnt = 8;: s% q9 Z" P1 }2 }0 N1 X7 o
  81. 8 R5 i- V, O) j
  82. module_param(acnt, int, S_IRUGO);
    ) A& @% E3 A4 ~
  83. module_param(bcnt, int, S_IRUGO);
    ) H2 ]1 q! I, I- J5 V
  84. module_param(ccnt, int, S_IRUGO);
复制代码

$ f6 q1 Z/ X6 T8 T9 t" G0 U  o) ]
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用6 v# e: ~9 a7 c* r2 h9 h6 N
arm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。0 |7 n* V2 c8 c7 [! }+ \* k5 G
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。1 R. `9 Q+ N. |; J/ d- T

2 b0 x* t% m, T- e0 V! H1 _5 q  Z$ m0 {0 X& y
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-10-6 07:14 , Processed in 0.044202 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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