OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
2 [1 L# Y( b7 e# u
  1. [code]EDMA sample test application
    * A- o; R- i% i0 O5 _( E$ b; o4 `
  2. /*
    ' w, z& J; n4 T2 J
  3. * edma_test.c
    : H* h) M  x7 w4 i* z
  4. *; O" [' l! K$ H4 H; G9 p
  5. * brief  EDMA3 Test Application" q' m9 w, L- q; p. G9 v6 \
  6. *6 _  i# h# i% l0 o7 j0 H
  7. *   This file contains EDMA3 Test code.
    " Q3 B6 X: [/ E& p5 O0 h* t5 \8 ~$ P
  8. *8 q4 m( U5 g" {0 i! ]2 }
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    . f4 `: A" j5 C! A* i) Y% u
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ! c! z5 U( x  z$ F/ g- @: z
  11. *         TO CHANGE.; R7 k) U, R( s& e0 j  p2 F& |3 R
  12. *
    : M- @0 N5 f: y/ c
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/* y" e" E9 `$ V; R) w  O
  14. *
    3 C  ?$ J4 m4 Q
  15. * This program is free software; you can redistribute it and/or( ?) X9 o- M* D# s
  16. * modify it under the terms of the GNU General Public License as
    . X1 g6 W8 w( W) C' S
  17. * published by the Free Software Foundation version 2.* |! E8 B' L9 s; r1 g
  18. *
    4 Z1 n! U' q) z. n4 i: I
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    9 V4 @% c- @0 C# k, Y& v! L1 I
  20. * kind, whether express or implied; without even the implied warranty
    : Z! M1 M% D/ p) U" A7 b
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    6 y9 u3 }4 X: ]6 y
  22. * GNU General Public License for more details.
    2 p) n' s. E) r% f! m! x/ B; s
  23. */* a$ k3 D. G! w. r8 E9 R( D
  24. - g0 r+ B% u& t1 {9 Z
  25. #include <linux/module.h>
    $ X0 W9 G' _7 p. ]( A
  26. #include <linux/init.h>
    " [7 H9 u& A0 L  {
  27. #include <linux/errno.h>; ^4 d  q+ I% _3 |( `
  28. #include <linux/types.h>
    . D: a3 }' v! N4 {
  29. #include <linux/interrupt.h>
    . L) K' S) C% z
  30. #include <asm/io.h>. y( t$ k+ d: H! l; [2 I: B% K
  31. #include <linux/moduleparam.h>
    $ }# y" ?% h0 G; g( J) u. ~2 |
  32. #include <linux/sysctl.h>
    7 ]7 G8 T7 p$ v2 e
  33. #include <linux/mm.h>, a8 O2 w( @; ?$ _1 @
  34. #include <linux/dma-mapping.h>
    7 L3 Z+ F# {* Q6 K

  35. 9 d' N0 l% l0 d5 s
  36. #include <mach/memory.h>3 c, g3 F. X: G! }% G
  37. #include <mach/hardware.h>- E! m* W  X8 [; T" @) M
  38. #include <mach/irqs.h>  J; F: O5 }2 H8 m/ `" u1 G
  39. #include <asm/hardware/edma.h>
    + b- e& a) x6 [

  40. 3 n8 e7 t- `$ l4 A$ Z% K% ^' T
  41. #undef EDMA3_DEBUG
    3 W+ v: U9 t( J
  42. /*#define EDMA3_DEBUG*/2 A) K5 Q9 F2 Z) V) q6 V

  43. 3 z" U/ f% y4 I/ I) U) p8 R9 d* g/ U
  44. #ifdef EDMA3_DEBUG
    ' `& E  Y: r( ]  ~1 F9 q- l
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    - i4 X/ s- m6 S2 n) K( @
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    " n. u6 @- i% y6 [8 z( K
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    5 F1 z  S/ u& n
  48. #else
    0 e, i( Y9 u& R
  49. #define DMA_PRINTK( x... )" v! |! d: ?5 ~' _7 m
  50. #define DMA_FN_IN3 J. z1 J& {) C3 W- o9 A5 Y6 u4 R' b5 g9 @
  51. #define DMA_FN_OUT
    / @- y  o$ y" \
  52. #endif
    " [, L7 {6 |& w" ~7 E. f+ ?7 }0 D
  53. # o3 S7 x! T  K6 j5 O* [
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)# R8 h% c2 {) x8 X* q) ?7 F! _$ W
  55. #define STATIC_SHIFT                3
    * A2 r# R! H9 L
  56. #define TCINTEN_SHIFT               20; P: D. ]  Q0 I# x5 \, ~* b
  57. #define ITCINTEN_SHIFT              21
    0 A/ {# s; U, x+ \2 s9 F6 u
  58. #define TCCHEN_SHIFT                22
    ' F3 K$ i- m5 y+ o2 R" L/ x' C6 i
  59. #define ITCCHEN_SHIFT               23
    : l" T( r0 l6 |( `0 }; Y
  60. 2 \6 y' X( D3 Y! x" |, y0 M/ i
  61. static volatile int irqraised1 = 0;
    1 q' U9 H1 L% s/ i6 @) f" L8 M
  62. static volatile int irqraised2 = 0;: }' k5 b2 y; B$ @
  63. 6 G. ]/ @# ]$ b4 E" d4 C
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! {& Q1 m/ e" D8 o# B$ Q6 Y
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ v, I. `, V+ {' j2 x0 I, `- q# p
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' r, d' o% }1 K  s2 ?( i
  67. 6 O- T% H% K; X5 `; n: c
  68. dma_addr_t dmaphyssrc1 = 0;# g$ x& @  I6 d" b/ k9 Y; I
  69. dma_addr_t dmaphyssrc2 = 0;  R" u5 Z0 b, N
  70. dma_addr_t dmaphysdest1 = 0;
    ( Q- q5 ?( Y" n  q' E
  71. dma_addr_t dmaphysdest2 = 0;- K& N; h/ K) G8 X; B. p& @

  72. 1 I+ w# e+ P1 s3 w1 N1 j! i
  73. char *dmabufsrc1 = NULL;
    , R) B' F3 C, }  I
  74. char *dmabufsrc2 = NULL;
    " d# g6 ?/ _( |+ K( c1 Q
  75. char *dmabufdest1 = NULL;
    ( S3 ^3 ~( g* I" v/ b) K
  76. char *dmabufdest2 = NULL;9 ~# t7 j3 D4 s7 H& Q* K
  77. : X: e' }' `  H* x& m
  78. static int acnt = 512;/ B/ [! M2 s0 j
  79. static int bcnt = 8;; r. F* c. R* q9 E
  80. static int ccnt = 8;: \6 C7 ^2 U: [0 c; m

  81. 3 F8 M) w6 Z- {6 Y$ t& }% a3 E
  82. module_param(acnt, int, S_IRUGO);% J, f& T1 Y0 Q+ j4 o
  83. module_param(bcnt, int, S_IRUGO);
    " I1 s3 `/ ^. l9 V$ A
  84. module_param(ccnt, int, S_IRUGO);
复制代码

) Y8 W) N0 w  E- q: u8 e2 R/ y* ?$ K. U  w
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
% ^$ X+ E: E- P1 m) @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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。- E9 R1 z, p5 }- d
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
: T6 d. b$ T, d7 Q5 c  b
% n, X: j2 Z2 c# X. G
- N# ?2 g3 V; a' _0 z- u$ i
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-27 01:40 , Processed in 0.039350 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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