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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
: X7 P  s; D& K* i- O! T% g
  1. [code]EDMA sample test application
    & u) w- {/ i- M, t; Q" k9 w2 F7 m
  2. /*
    . W0 A( l  q0 Z- ]! b
  3. * edma_test.c
    # c+ v( [+ ?4 T; m" A2 P
  4. *
    & V- U' U. q9 x- \3 m
  5. * brief  EDMA3 Test Application
    . J1 R7 X& }6 H) N+ |6 {
  6. *
    % q( w0 s& a, Q, F. Z5 Z
  7. *   This file contains EDMA3 Test code.
    7 M) w9 |. B9 y# @* L
  8. *6 s/ K9 W' }1 s  A  B9 Z, B% N
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE/ S! d6 @& y& p3 X9 s
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT* ?9 [: z# B9 k! ?5 A
  11. *         TO CHANGE.
    * b. a- ?4 @. |# o# v
  12. *0 C/ Y: u) S( }1 E2 z$ N8 V
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/" O0 ], w6 o, ^
  14. *+ c& O. u0 B( j; r+ I# W
  15. * This program is free software; you can redistribute it and/or  X6 {  B1 O  @" s( \1 p" c
  16. * modify it under the terms of the GNU General Public License as. ]! n' T6 ?/ c5 A- Q+ G
  17. * published by the Free Software Foundation version 2.
    , u- f! S" n: u" h1 P
  18. *
    - i5 I' {5 ^# ?% S. W$ C; n/ r+ K
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    % t0 i6 F3 {* y2 L
  20. * kind, whether express or implied; without even the implied warranty
    0 K' ~$ s( j1 b3 g6 e* o# K
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    0 L3 Q" J& T8 [/ D- R6 l
  22. * GNU General Public License for more details.
    3 b& G% {+ q$ `* H! t3 q
  23. */
    ' z* y! i5 P) z9 J- f6 N7 r! T6 ^, s
  24. 8 P0 `! B+ x3 I& q% E
  25. #include <linux/module.h>, V+ c8 y( Q0 [8 S
  26. #include <linux/init.h>( n6 I8 J1 \6 ~& c
  27. #include <linux/errno.h>
    $ h/ P9 C, Q, L! {% u# L
  28. #include <linux/types.h>
    0 Q+ A  j6 A, V: ~% j
  29. #include <linux/interrupt.h>
    ) Y2 @6 o; c  o, ]/ R( D7 s3 P
  30. #include <asm/io.h>% w, G( N7 n3 ?
  31. #include <linux/moduleparam.h>
    + Z$ q- g! n8 h
  32. #include <linux/sysctl.h>
    , k0 d  o7 m* \* S
  33. #include <linux/mm.h># W6 G" k" h+ m& v6 y) T9 I2 a
  34. #include <linux/dma-mapping.h>: S( [0 v/ F7 Y9 A

  35. / W6 T7 j+ P0 J, a, ]6 g% z
  36. #include <mach/memory.h>" ]7 L) N8 b: Z5 Z. u
  37. #include <mach/hardware.h>5 Z+ z# s* }( T' M9 q' Q' B
  38. #include <mach/irqs.h>7 G( E$ I$ Q1 p' K8 Y; ~8 u
  39. #include <asm/hardware/edma.h>
    $ ]9 p+ a: C: g. |6 I

  40.   i; X3 w/ b; v( @7 r# P! e
  41. #undef EDMA3_DEBUG: R4 _" E3 z9 j) j
  42. /*#define EDMA3_DEBUG*/
    ( {, X! r7 T) x/ S& }

  43. 3 D$ t7 U; w- s. `" M- n
  44. #ifdef EDMA3_DEBUG
    : g) p" |% J8 b  o$ R
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
      ^3 l1 O& M3 t# g  C% |$ ?% I
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    . Z) I& h# p9 |/ {, i/ M/ X2 A
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)- O7 W( K2 w7 }$ V
  48. #else
    ) \% l) P2 r- F/ v- T5 a
  49. #define DMA_PRINTK( x... )
    ! w9 ~. L! l/ u8 M: t) p9 d
  50. #define DMA_FN_IN
    * @; n9 p- w4 L. }; P) C
  51. #define DMA_FN_OUT
    # w( W2 @) O; Y7 ?! ]" ~, u* O
  52. #endif
    + X" P. g1 @9 P4 f- u# k

  53. 5 }3 ~9 i5 C) _3 c+ ]
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    3 A% t$ C% z4 g3 j( B
  55. #define STATIC_SHIFT                3, k2 i" _2 P5 _( g& r& c
  56. #define TCINTEN_SHIFT               20
    8 v3 h, E2 X" R% [9 _
  57. #define ITCINTEN_SHIFT              211 a# q3 L3 ]/ C4 Y6 v
  58. #define TCCHEN_SHIFT                22
    + l/ g' c4 P; p
  59. #define ITCCHEN_SHIFT               23
    3 G* b0 J! |4 U

  60. - B/ l# k9 O1 h, \
  61. static volatile int irqraised1 = 0;- J! d/ u5 {7 k
  62. static volatile int irqraised2 = 0;2 V; o  t4 R" k' C; t0 h* x1 g
  63. " T+ k' t8 c" |/ q. O
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      l* c& l: X! c7 r  h6 i
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; V$ y+ Q# @# }3 k% g
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 K, Z6 c: L; m( M' m4 {. U# N+ @
  67. $ q4 b# g- v. C2 e
  68. dma_addr_t dmaphyssrc1 = 0;, ?8 w1 j* }$ @* W5 U. Q
  69. dma_addr_t dmaphyssrc2 = 0;& r3 n  V- z7 L0 i+ ]
  70. dma_addr_t dmaphysdest1 = 0;
    4 I1 O0 ^# N$ H0 E! C: V$ G/ R, ^/ i9 S
  71. dma_addr_t dmaphysdest2 = 0;
    ( Q4 K( X  m/ s7 s. D
  72. / q9 q# h8 w7 |' b( l: G
  73. char *dmabufsrc1 = NULL;
    - t6 F$ p$ _: J1 }! q$ G
  74. char *dmabufsrc2 = NULL;
      E* t) T" e  q' p; Y5 Q
  75. char *dmabufdest1 = NULL;
    % Q# p( f$ k- t# G6 Z6 V
  76. char *dmabufdest2 = NULL;
    - H' z) R7 V$ g2 n: e
  77. ; [. Z( F1 N: g5 n: ^& N
  78. static int acnt = 512;4 Z, |: j5 s2 P' u# C; U7 ^5 v
  79. static int bcnt = 8;
    , q, B& b; w# F3 g
  80. static int ccnt = 8;) ~; ~) i3 x3 _) `$ D/ r" u1 {, r
  81. . [" k% Z2 A  B
  82. module_param(acnt, int, S_IRUGO);
    . `6 Z. G4 _" y+ s8 G0 q# e
  83. module_param(bcnt, int, S_IRUGO);5 C1 Q+ l+ A( N5 M+ Y6 d
  84. module_param(ccnt, int, S_IRUGO);
复制代码

1 F; n; w4 K6 d: S. ~6 P) U! S; l9 W4 d3 s2 [8 p$ H% h8 c
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
4 ]" l' l6 g3 x) W! Oarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
. i5 S& `  r3 @- X( h: @     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
) k& ^/ i) N7 q1 l, i: h7 J* C0 G# b3 m1 D2 r- d

3 N/ E. |  k' w* K  A, u
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-5-20 13:57 , Processed in 0.043105 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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