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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
, |: e4 Q9 ~  u7 o# Q0 l; `- |0 K
  1. [code]EDMA sample test application: d. P2 K+ d/ H
  2. /*; U  |6 r# ]! s
  3. * edma_test.c
    # o! S- k* E0 a/ ^+ ]
  4. *
    8 B, P6 r, A7 i! |( U, i
  5. * brief  EDMA3 Test Application
    * F+ F. b* v/ ?% g
  6. ** f( z2 r9 H* g! X+ x
  7. *   This file contains EDMA3 Test code.3 _0 @$ W7 G* x0 q, ?" P0 j, [
  8. *. v% m1 ]% J! F+ A7 k
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ; o! t' K# m- J* x6 E& k
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT/ Q' e; q) }) ]8 @% E
  11. *         TO CHANGE.4 P6 s7 u$ J. l' `
  12. *
    ' D( h4 l! {- Z* ?8 p, P, x  {
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    7 u2 q0 d4 q" L, P
  14. *5 Q6 p9 r! W) R- c5 l1 L  P( H" S
  15. * This program is free software; you can redistribute it and/or- e+ S8 z, [' ~4 U2 ?' T" r
  16. * modify it under the terms of the GNU General Public License as
    ! N; [' ?4 q- n( v# r
  17. * published by the Free Software Foundation version 2.
    . c6 C% A5 X- [3 a
  18. *. \) \; h  n( ^- a
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    $ F" U, {+ G8 d- v7 E4 A
  20. * kind, whether express or implied; without even the implied warranty9 |9 ^7 K: y2 [# W2 R
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the0 r+ E; t* F: V) u9 B0 J0 h+ O
  22. * GNU General Public License for more details.
    # b5 |& M0 q' j- X
  23. */
    8 v: [; F8 F% L' o3 x
  24. * \) \& w6 `% l% a0 a
  25. #include <linux/module.h>$ {6 x- f* ~# w2 s. r0 N4 s
  26. #include <linux/init.h>
    7 [2 k2 |$ I3 p+ f, E1 G6 M% V
  27. #include <linux/errno.h>
    * o& ]- m3 a: j7 l# v6 m# s! t
  28. #include <linux/types.h>) p1 S! v  t9 l9 B8 y$ S
  29. #include <linux/interrupt.h>
    : x+ b! p( X5 G1 I
  30. #include <asm/io.h>
    & k+ c- K' W0 n, [2 U$ Q/ n4 `
  31. #include <linux/moduleparam.h>5 C7 Y; b! v6 [+ Q5 t" T* r
  32. #include <linux/sysctl.h>0 b2 n4 A( w4 d; E
  33. #include <linux/mm.h>
    1 `# z- F6 i% K% g/ a
  34. #include <linux/dma-mapping.h>
    " L% ^# `" Q+ S  L' _8 d" Z
  35. 3 }$ O( y9 e) ^. Y3 S+ F' P
  36. #include <mach/memory.h>
    $ g/ k- m( x% p6 A2 m+ t! j
  37. #include <mach/hardware.h>, u( U6 F# L% g6 ^  G
  38. #include <mach/irqs.h>- ]+ g  z6 w9 e$ m
  39. #include <asm/hardware/edma.h>
    1 p1 h% c" l( Z

  40. & n( [5 C; X* y- ^% M. e
  41. #undef EDMA3_DEBUG
    . D$ A2 r1 d" e& X5 J
  42. /*#define EDMA3_DEBUG*/
    / c& W; Q5 Z! G+ ~, ~

  43. , ^) s! p3 q) n6 x4 J8 x
  44. #ifdef EDMA3_DEBUG/ C% W7 F& P# _
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)$ b8 ]7 V4 U; U+ F; ^
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    $ z# ?5 z9 _/ M9 o; ~6 y
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)2 w5 H. E; [* n2 J0 W! f4 J
  48. #else  K) {% }6 t2 O1 s
  49. #define DMA_PRINTK( x... ), f7 Q) w( A/ b( Y# r6 Z5 P: y& |
  50. #define DMA_FN_IN
    % V- `* h) P" w: `5 |& v% T+ h
  51. #define DMA_FN_OUT( n3 O, B! a. h- J! r0 k
  52. #endif
    : O7 t6 E( O1 n, _5 |) t) T6 _: q# O
  53. & H& |1 H% _) ~' u& n  K
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    6 q1 t% n# x/ {$ F  E& H
  55. #define STATIC_SHIFT                3
    3 c$ {% M6 r  V
  56. #define TCINTEN_SHIFT               205 `; r/ i4 t7 H! \; G9 r6 ^
  57. #define ITCINTEN_SHIFT              21
    7 H3 A, o7 |) t, L
  58. #define TCCHEN_SHIFT                22
    ( T( d& e# |( Q; f$ E
  59. #define ITCCHEN_SHIFT               234 `! `. D3 C% {3 w% n
  60. & L) P3 \5 ]& s* c/ m0 ?
  61. static volatile int irqraised1 = 0;" r6 ?" J3 y6 S+ `9 z& ?1 p1 a
  62. static volatile int irqraised2 = 0;
    ( V# m3 `1 [; ^. n+ N, h7 M0 `/ W
  63. . M% a' D- o7 F! G4 m
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ Q# L) `& u. ^6 O2 l6 ]2 u
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ r/ J  A% M# A- w5 y1 U7 |
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! r. q  c5 L6 o' k

  67. ( z! |& L2 x! M9 C/ S! |4 o8 Q  n
  68. dma_addr_t dmaphyssrc1 = 0;- r% i* k3 T5 w: \
  69. dma_addr_t dmaphyssrc2 = 0;6 q+ A/ n8 V1 D# w" W1 n
  70. dma_addr_t dmaphysdest1 = 0;
    ) ?7 s' j( b$ L2 M  w0 @" O
  71. dma_addr_t dmaphysdest2 = 0;5 g  |$ [7 |* K. j
  72. ; d' J. a; z3 ]& u* x5 q) A/ E. }
  73. char *dmabufsrc1 = NULL;
    ; F9 ~1 x# B4 u
  74. char *dmabufsrc2 = NULL;* j/ O( |* |+ i$ c) X, }2 v
  75. char *dmabufdest1 = NULL;
    2 o# i+ \9 X  r4 v- t- W5 ~6 k) f( S! f
  76. char *dmabufdest2 = NULL;* o3 Z" J3 ]7 J/ T, P5 i
  77. + Q2 P$ I1 x1 C+ `- ?, E
  78. static int acnt = 512;
    * c2 C1 b& }; F8 |
  79. static int bcnt = 8;
    . l( r3 O5 R3 [8 ~& Z' f
  80. static int ccnt = 8;
    4 D- S1 l$ [* C

  81. $ m$ q% f, e/ u& W+ V, k3 a
  82. module_param(acnt, int, S_IRUGO);
    9 O3 D0 F6 f0 n& A# j% V- w
  83. module_param(bcnt, int, S_IRUGO);
    ! I# T; }- g) f, Z
  84. module_param(ccnt, int, S_IRUGO);
复制代码

$ }, G7 C: B2 o# U2 v
5 K) z0 v! @; A3 w      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
/ ~3 F/ ]7 R- v3 n6 Warm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。1 _! u9 p: {6 r3 F- \
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。( l$ i% a) H2 z8 Q2 Q: Y1 f5 n
) j% p: Q/ y/ [( K: U, s: j7 E! p

% i$ E! X* _8 B
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-26 12:23 , Processed in 0.041166 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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