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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 , ?& B8 s% n2 q9 q! T1 V3 y
  1. [code]EDMA sample test application8 J; Z- z$ O* i- E% V
  2. /** Z- R! a5 e2 S( c
  3. * edma_test.c
    6 T! w1 M6 t) W4 y, }" l
  4. *
    ( V9 h- H8 W" V1 n6 f+ p5 [8 a
  5. * brief  EDMA3 Test Application
    7 n' B/ i7 l. Y3 d& G; S$ ^
  6. *
    0 e; _9 U( ?: d
  7. *   This file contains EDMA3 Test code./ }$ U' {& O9 i
  8. *  Z( n# U" L  n% T
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE( |/ V( H/ ~  [* g
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ) m. s& d+ C/ |! d) ?
  11. *         TO CHANGE.. z6 P* @1 C1 g- ~( ~" Y, }0 L. w+ v0 k
  12. *! w) ^( H; X8 g6 q, K
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    , i4 {- l2 L" J' z% [# T8 J: c
  14. *
    4 f' U# X; |, M6 U
  15. * This program is free software; you can redistribute it and/or/ Q5 e9 K/ J3 t# S
  16. * modify it under the terms of the GNU General Public License as5 A: c9 p" R- m8 k! v
  17. * published by the Free Software Foundation version 2.
    + h0 j. `6 L7 W) \! G: o3 V* l
  18. *
    ( U1 A  A/ ^. N9 J4 A0 I8 F
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
      H7 o1 G8 z3 Q1 H" ^5 g/ q0 G
  20. * kind, whether express or implied; without even the implied warranty8 L: \9 b9 ^( s4 s
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    2 u5 _$ m1 Q" d. [1 d, F5 s
  22. * GNU General Public License for more details.( `7 d: ]! ]8 Y$ y1 ~3 m4 c7 B
  23. */5 k. a7 Y% W) C( J* f" p; x

  24. 7 w, `. @0 I- Q) n3 Z% Y
  25. #include <linux/module.h>
    3 ^! E9 @% h6 x! W8 C2 t0 v2 Q! x
  26. #include <linux/init.h>
    # I/ A" K4 B5 K5 f9 w5 r
  27. #include <linux/errno.h>
      L' F2 B6 ~% l) z
  28. #include <linux/types.h>
    - v) ], P- n: o' K9 K; S
  29. #include <linux/interrupt.h>0 h# e+ g$ P! a4 t9 N
  30. #include <asm/io.h>3 u& h# x$ m& j; ^9 H" S
  31. #include <linux/moduleparam.h>
    & @" j$ R; [2 I! \: [8 f
  32. #include <linux/sysctl.h>
    , P) ?' t+ \3 @
  33. #include <linux/mm.h>, c& H; ?$ P5 D" j0 w) e
  34. #include <linux/dma-mapping.h>4 G9 C" V7 h7 W! e/ q  ?! t
  35. $ Y/ X* g. Q$ P( z
  36. #include <mach/memory.h>
    1 B, [2 N& o+ E
  37. #include <mach/hardware.h>
    % e* z; ~7 M, Y9 b- b2 v5 G+ N# U
  38. #include <mach/irqs.h>
      k+ ~# [& K- @/ I& @! Y
  39. #include <asm/hardware/edma.h>% Q4 u' |: d9 J/ I$ E6 w# ]) r% ~
  40. 4 T6 R, u) o' ?. w
  41. #undef EDMA3_DEBUG( P7 B1 f8 x9 }2 U) B5 _
  42. /*#define EDMA3_DEBUG*/
    + i, _, A7 [' z2 f

  43. : w" Q' _+ O0 I; z$ q. P
  44. #ifdef EDMA3_DEBUG
    9 A3 C5 m/ S5 y, V" t
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)6 i: i/ s3 X: ~6 y( e9 a
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    . d- q4 G$ A( ?4 f' j. `2 C. U
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    6 I9 l1 i. m! @+ W( u( J
  48. #else
    7 o; u9 ~( _- O: S& v
  49. #define DMA_PRINTK( x... )  l) u! I8 I  ^- Y
  50. #define DMA_FN_IN
    : L: H. T3 V- @/ W( G9 l: V
  51. #define DMA_FN_OUT. j! W! r, b; [4 u
  52. #endif
    $ U, y* Q6 j/ g" ]4 U6 |
  53. ' {+ R) ]# G" V
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    $ N8 A, [6 z( H
  55. #define STATIC_SHIFT                3: o& f, L* J7 b2 Z5 J" F
  56. #define TCINTEN_SHIFT               206 x7 m1 e+ \9 q4 a& w* g! I
  57. #define ITCINTEN_SHIFT              21
    + W/ m( f/ z3 i  Q, m5 x
  58. #define TCCHEN_SHIFT                22/ T+ A5 B9 _% ^0 R6 _6 {5 i0 ]# x
  59. #define ITCCHEN_SHIFT               23: N, _$ @% P3 s: ?+ b& g/ X

  60. + {* C# X) M5 N! E4 D
  61. static volatile int irqraised1 = 0;3 v9 |. e3 C% b7 E5 Q
  62. static volatile int irqraised2 = 0;
    ) }% o2 i' @! G$ W) ]
  63. " F% X0 G1 @8 Y* p4 P$ \0 j
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 J) H) C: i" {% h0 @
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ n% J* n( `( b8 M+ H# D# f. `9 ]
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 r! o! ~' G  @9 [

  67. / ], E2 ]: X* ]
  68. dma_addr_t dmaphyssrc1 = 0;. A2 u3 f8 c0 [* X* ?
  69. dma_addr_t dmaphyssrc2 = 0;
    7 K" Q" R: e- q% L" d+ T
  70. dma_addr_t dmaphysdest1 = 0;) r! s# c. |1 H. L8 P0 Q
  71. dma_addr_t dmaphysdest2 = 0;
    5 p3 s" v4 v' o8 s1 }! l2 T9 e

  72. " F; y, d9 n6 ]
  73. char *dmabufsrc1 = NULL;, m9 E+ P, C& B! f9 z0 c
  74. char *dmabufsrc2 = NULL;0 L- [9 v3 G! ]# n5 x9 U
  75. char *dmabufdest1 = NULL;
    " o) l0 x# D& |; O1 T
  76. char *dmabufdest2 = NULL;% }0 O0 b# S; `' c4 i
  77.   C" n# C4 T" v- {' }: ~
  78. static int acnt = 512;% u8 b  K- Y8 z( y" R) H; M5 f! U  B7 s
  79. static int bcnt = 8;
    % q- X9 U2 y4 j. W/ t8 j- I
  80. static int ccnt = 8;; }1 \2 J# C9 h+ B  d
  81. + M+ V' l4 A0 J
  82. module_param(acnt, int, S_IRUGO);' h, N5 j3 b) X0 C
  83. module_param(bcnt, int, S_IRUGO);- \7 Y, Z$ S; s7 W
  84. module_param(ccnt, int, S_IRUGO);
复制代码
9 E& |& c. ~( H0 {* b) h; w  }: Q

( v* X' E5 a$ Q6 a/ H      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用! e7 A2 m+ J5 T3 q: y
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/ O: q+ z4 c! q  @4 R     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
' n) g! i) d% O% g9 B: a/ Q1 E/ P+ y# M
' c* Z- ~# e# Z8 U& V# ]7 I
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-18 23:49 , Processed in 0.040747 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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