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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
% v% m8 X9 a' V' _7 T2 q
  1. [code]EDMA sample test application
    0 R1 G4 w" M- b7 H: p8 ^2 l- B
  2. /*
    : P# V4 Z3 t: R$ d+ e# k
  3. * edma_test.c
    - E& m7 Z6 q, N" k# g3 Y$ h
  4. *
    0 v% ~( a- x7 c
  5. * brief  EDMA3 Test Application
    : s+ Z1 I/ U7 N- k6 @
  6. *0 [$ H! _7 X3 P. O+ R1 J+ \
  7. *   This file contains EDMA3 Test code.
    5 P4 @5 ^! k3 F- M( x
  8. *+ `! ^8 z" [0 h' X/ O5 m
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    - w8 F$ _$ s# `+ {& C! d' r: y
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    - ~$ G; @$ [' i
  11. *         TO CHANGE.* ^* `: C% V" R
  12. *
    8 T( {  d1 I$ d0 @
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/0 |- K& `5 r& S& d3 Q
  14. *
    ( \* ?' y1 V' s% c: o6 k% T7 g
  15. * This program is free software; you can redistribute it and/or
    " t2 v, M' o" g! D! k
  16. * modify it under the terms of the GNU General Public License as8 g& b, h" Y" p/ [7 i; f
  17. * published by the Free Software Foundation version 2.( C4 P3 S  ~' y+ j- Q- |2 k0 U3 Q
  18. *
    . d! I# g3 o; S- p, b+ W
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any2 c1 n0 f* G: c: I
  20. * kind, whether express or implied; without even the implied warranty9 O: y2 w5 J) C
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ! n; Q6 Y- M) @: P! _, `
  22. * GNU General Public License for more details.0 l# U7 H$ s8 t( M
  23. */
    * o" F8 P5 k* B( `

  24.   h" p& D+ X2 x& W0 h5 h- j0 p
  25. #include <linux/module.h>& ~0 ^) a7 W& H) t+ G
  26. #include <linux/init.h>) t9 \7 k4 ~6 H' V8 T. u
  27. #include <linux/errno.h>
    9 g. C7 u7 W7 }; ?9 |% c2 w3 x( q
  28. #include <linux/types.h>
    1 f. P- Y+ Z  E/ x, V
  29. #include <linux/interrupt.h>) g" n& D4 I& F4 Z
  30. #include <asm/io.h>
    & L8 ]/ Y7 x/ {3 t$ P! [8 w
  31. #include <linux/moduleparam.h>* n, i+ ]' I% D% E! b+ i( L
  32. #include <linux/sysctl.h>
    $ @  f# |4 [; \" o* C) r& w
  33. #include <linux/mm.h>9 }# U2 {* O( E  J3 M  R
  34. #include <linux/dma-mapping.h>
    & k  `- X. X/ X" ?- W$ Q
  35. 9 y9 j$ t6 }$ m# V5 u; _; ?
  36. #include <mach/memory.h>- P  T" I( d: [: H( R; s
  37. #include <mach/hardware.h>
    2 G7 a/ }7 E- ^9 C
  38. #include <mach/irqs.h>& o2 U2 z0 X1 B# R" F5 M
  39. #include <asm/hardware/edma.h>4 `6 L& Z2 }. m2 {. ~
  40. $ g) p- {! n8 U$ C' w% Q( w9 t/ Q/ X
  41. #undef EDMA3_DEBUG: b! [* A, t7 a2 E
  42. /*#define EDMA3_DEBUG*/
    : x) S. I7 ]% ?5 e

  43. 1 N# [% a2 R* n& {2 M+ F9 ]
  44. #ifdef EDMA3_DEBUG3 j5 ~0 _$ v' ~4 \
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    7 V% T9 b6 B6 d/ ^
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    9 i$ P2 Q8 g) i3 H) Q
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)% g' S8 R4 ?5 |4 }& E% `
  48. #else
    ( |( d% M# p1 w( U# S
  49. #define DMA_PRINTK( x... )
    % }6 U; w6 @3 E4 j
  50. #define DMA_FN_IN- M4 `2 b7 W. J  O
  51. #define DMA_FN_OUT* M5 s0 W( j. X6 t
  52. #endif
    ( S% i$ z( Y3 s1 W, ]/ j

  53. # g. U9 c* F9 K$ Q" \
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)6 b- r, T( w3 @$ x2 {
  55. #define STATIC_SHIFT                3
    % G" u2 {! V  W7 G5 C1 \+ f
  56. #define TCINTEN_SHIFT               20
    . S+ b; C' w! ~/ T6 B! B7 r0 \
  57. #define ITCINTEN_SHIFT              21
    0 T0 @2 A3 g3 A- h$ P+ J
  58. #define TCCHEN_SHIFT                22
    : @; I5 n8 A6 R6 F
  59. #define ITCCHEN_SHIFT               232 S: `" H1 J  C1 h: O: r! `. ^4 S

  60. * k0 S  V& `, n9 y: S, j; S& m
  61. static volatile int irqraised1 = 0;% k' U, d4 V* R, s2 l3 l" l/ c+ d
  62. static volatile int irqraised2 = 0;5 g. m1 K1 S6 e& n3 W+ n3 w

  63. - R& e  @5 m& f& r
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % |! X0 q! a! {) V5 `$ @7 l
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + ?. v9 P. }* J4 |' g# s, U! U9 L
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, f' Q* t+ S) i& ]! u: `
  67. ; h# U5 |! x( t/ j9 @* I5 b
  68. dma_addr_t dmaphyssrc1 = 0;- X  b. {5 ?0 t% k; \, x% H+ k/ J
  69. dma_addr_t dmaphyssrc2 = 0;
    1 Q. x4 Q3 `8 W' v7 N
  70. dma_addr_t dmaphysdest1 = 0;
    1 l$ m; \# b: y9 g( ~; Q% _* G$ z
  71. dma_addr_t dmaphysdest2 = 0;) n: t2 g# L+ H) [( c2 M2 H
  72. ) x* }4 M, k7 J# `; ^
  73. char *dmabufsrc1 = NULL;2 j- A( |+ @9 J6 B9 T5 u# Q* A! R
  74. char *dmabufsrc2 = NULL;
    * g( Z4 _; }0 b) g
  75. char *dmabufdest1 = NULL;* f4 H8 v" z7 O1 z& G' B9 @
  76. char *dmabufdest2 = NULL;
    ) h+ J5 K9 M* k3 O6 t' h! Z, u
  77. + h! J& L/ b9 O, j4 Q; g* C
  78. static int acnt = 512;: |: M" w3 W& t2 b) J
  79. static int bcnt = 8;
    ; n, Q( p! c& m  I; U
  80. static int ccnt = 8;0 |& K; I( h2 I! W1 S
  81. 3 \0 [" _( E0 u
  82. module_param(acnt, int, S_IRUGO);; \* ~; f5 F( w1 z
  83. module_param(bcnt, int, S_IRUGO);
    6 Q8 d4 y) t7 R; d% X# k$ i; x1 \9 p7 B3 I
  84. module_param(ccnt, int, S_IRUGO);
复制代码

" V7 b% a* ^. S) D0 y3 |" s+ b0 t% r- o8 Z/ U
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
" e0 b. T2 X* A! Jarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
( X4 y3 Y: M/ r$ s5 j     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。- q5 c1 J" i/ m5 Q; X6 ]" E

% K4 @# e" W9 u, S- I: \3 N( Q" A+ D
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-6 07:13 , Processed in 0.038183 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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