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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
# q$ E  ?2 f% i1 ~+ ]
  1. [code]EDMA sample test application
    3 F% T; A, l( y0 W1 ]* z5 j& r+ c+ v8 O8 k
  2. /*
      j! \. \9 `: W& c* t% V
  3. * edma_test.c
    . J: Q! l' E) T$ Y$ p
  4. *
    * m" X! G6 d" {7 h
  5. * brief  EDMA3 Test Application: |1 X3 D" C  a9 ^) `& Y
  6. *
    & V) f; I: r$ A* N
  7. *   This file contains EDMA3 Test code.& \8 g5 P2 a' Y& V; J/ U
  8. *
    2 Z- J$ e7 A2 c& Z
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE, q" x% F4 h( i$ U
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    + O# A1 e; S4 Y5 J& U. X
  11. *         TO CHANGE.
    1 L* u) w2 S, v: n4 L$ G/ G- q
  12. *
      D7 E; w* R8 }+ W4 J& E
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    $ k: u/ l7 i& g) u% n1 Z
  14. *0 l( a' u* o! R% j+ ?! M8 ~) ~; r2 q
  15. * This program is free software; you can redistribute it and/or: g; _* t- h. T5 I6 T8 h' G
  16. * modify it under the terms of the GNU General Public License as9 ~; B& G/ h/ Z) I
  17. * published by the Free Software Foundation version 2.
    - v2 r- ^) m' ]8 a
  18. *
    ( O7 |) j( b* }) W) t" g
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ) T7 r; d; b7 y4 c  u: w+ {6 U9 ]
  20. * kind, whether express or implied; without even the implied warranty
    / x, z8 D# o9 m6 e9 s- Q) z
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    : c2 a; O5 P- i7 B) {
  22. * GNU General Public License for more details.8 G, O5 z3 D: D2 L: r! Q: |  |( l1 ~
  23. */
    7 Z9 L/ }) L) k
  24. 2 T5 [; I& z6 j- R) C
  25. #include <linux/module.h>
    2 O" h9 Y1 m& g4 h- q
  26. #include <linux/init.h>
    7 e( l  s% K* t, K& S- P  ?9 y
  27. #include <linux/errno.h>0 ]7 z  B& ]; V  ^
  28. #include <linux/types.h>
    ) Y& T& x" \! C  ?& E* B9 O9 f
  29. #include <linux/interrupt.h>% \% r9 Q( e/ W/ K5 q8 j3 J
  30. #include <asm/io.h>
    # g+ ]  v6 `: K2 L7 ], @
  31. #include <linux/moduleparam.h>
    ' f+ R! E9 d% Y* I
  32. #include <linux/sysctl.h>5 k: ?0 Z( Y3 u
  33. #include <linux/mm.h>+ d0 V1 _# @) M  a
  34. #include <linux/dma-mapping.h>( e1 Q* ^- t3 w0 G

  35. ' {, Z& n, |/ g6 O
  36. #include <mach/memory.h>7 _" p: H$ b: V) p8 Z3 L! {
  37. #include <mach/hardware.h>
    4 k6 \; w8 V: {* Q
  38. #include <mach/irqs.h>
    $ Z' b+ N, \3 t# U- s
  39. #include <asm/hardware/edma.h>& f7 [" B, d8 G5 F  n

  40. ' O7 _' G0 K- r2 V
  41. #undef EDMA3_DEBUG) _. F% V/ k3 y! T8 @8 G  H
  42. /*#define EDMA3_DEBUG*/5 [" |7 p) ^! T+ y  @
  43. 0 B# c, f& D' n. d
  44. #ifdef EDMA3_DEBUG
    7 \( m, h7 S7 ?) r! C
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)7 {0 _7 _3 E# G2 r9 l) p
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    + D# @0 e: a' F; M+ u! [9 U, Q
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)" b% P" k$ q1 q+ ?+ b& L/ ^
  48. #else' Z% B+ `+ T0 ]. L
  49. #define DMA_PRINTK( x... )6 A0 j( x6 M) C6 I7 `$ ]4 q
  50. #define DMA_FN_IN9 X4 W4 c$ v. w  [
  51. #define DMA_FN_OUT
    , |( k! W; X# l( I, Z
  52. #endif0 J' {9 Z0 E5 d. G- q& z

  53. # v# O& U( N1 r
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    2 R" a) y% f: [2 A  k
  55. #define STATIC_SHIFT                3; Z8 D9 O5 }6 i5 D2 e  B' H% B/ F
  56. #define TCINTEN_SHIFT               20+ X" E( C+ W3 A% R+ \) K
  57. #define ITCINTEN_SHIFT              21
    ( _& H1 V4 K) m* {
  58. #define TCCHEN_SHIFT                22
    + T! y- Z( g7 f; P+ D3 h
  59. #define ITCCHEN_SHIFT               23
    $ s2 r% m- j2 F) k1 ]1 H
  60. , B4 D( M5 x/ A9 ]
  61. static volatile int irqraised1 = 0;7 r  |: c( w0 p1 Z: {# g
  62. static volatile int irqraised2 = 0;
    . h1 y! b6 `5 e2 x% `4 |
  63. 2 N6 s* N$ B* D1 H
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 @5 |, o% ^7 f& M
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " G: V' n1 F) [; a3 ~5 l$ V
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ E4 s, Q/ m# t1 S
  67. 3 T; |! _+ ?- S+ f, j8 E
  68. dma_addr_t dmaphyssrc1 = 0;
    ; p- f+ t4 _& q6 {7 p* T) V
  69. dma_addr_t dmaphyssrc2 = 0;
    ' s5 f4 Y. ~( E+ C1 e- B
  70. dma_addr_t dmaphysdest1 = 0;+ u8 b1 v/ I* S# j/ G' j- E9 W3 R
  71. dma_addr_t dmaphysdest2 = 0;5 V) \; \6 e  u
  72. 6 s& m+ z$ a" s% `9 A' K; n
  73. char *dmabufsrc1 = NULL;
    1 N( }% Y( W$ L9 W
  74. char *dmabufsrc2 = NULL;9 y3 r9 N1 n6 [$ p$ o
  75. char *dmabufdest1 = NULL;/ e0 T- @+ R4 y; g( Z* w
  76. char *dmabufdest2 = NULL;
    : P4 r0 e* c2 f( N# i6 \; _- u; n
  77. # U! H7 o2 D. T7 H+ d, r5 N/ l- Y
  78. static int acnt = 512;
    % T# g$ d& R2 }2 e
  79. static int bcnt = 8;' c$ ^/ R9 Q% o
  80. static int ccnt = 8;
    & o! i1 F" Q! T, p# ~2 o0 {! j. d% l
  81. ; Q1 E0 O* c, }( }
  82. module_param(acnt, int, S_IRUGO);  ?* i. g& e% G! A! D5 w
  83. module_param(bcnt, int, S_IRUGO);2 Y6 V' ?# q3 C; b) E0 R
  84. module_param(ccnt, int, S_IRUGO);
复制代码

. O+ q$ u5 i' v
! Q% m& [1 o3 i& V+ ^! O      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用7 U! i2 c8 Q! Z0 m1 D, X
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。# R' K+ F3 P5 |1 U4 R; q
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
8 U$ X+ N8 _& ?) h( V% ~' J( ]3 j+ w- g# [
" M& a' [$ b" V3 [' A, c& e! C1 [5 S7 f
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-29 19:48 , Processed in 0.041418 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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