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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 0 ?; Z0 A8 T( |3 E# ~
  1. [code]EDMA sample test application
    / h0 }# I/ z' S( v1 c- _% Z
  2. /*! s" N  W0 w6 R$ E
  3. * edma_test.c
    * V2 N& E" \; y1 D. s% s/ t; R9 e
  4. *) K; `2 ^) U- F2 d! A
  5. * brief  EDMA3 Test Application. D8 ~: c$ o" H; j; g/ r
  6. *
    ( j5 z  I( \/ V5 `6 H8 o& j. s. b2 ]: i
  7. *   This file contains EDMA3 Test code.' d6 q: L" x$ ^% U7 B3 \
  8. *
    ) v5 o" r6 j+ D* q# D$ X8 ~
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    . S. ^+ e- q, U/ z
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    5 e( E- j, j. R+ U3 P$ h
  11. *         TO CHANGE.
    $ i2 j% _, v* L2 \# R8 z& m& j% n
  12. *
    , q: _: b* ?# j! f8 R
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/- M* H7 E% R* X) i5 L/ t, {
  14. *, b2 Y/ I2 `7 ]; e
  15. * This program is free software; you can redistribute it and/or* m- _: L4 t8 I9 w; C; E8 g6 n
  16. * modify it under the terms of the GNU General Public License as8 H: G; C2 K& k1 K# i
  17. * published by the Free Software Foundation version 2.9 M. g5 x0 S9 `
  18. *
    4 S; _! Z' ~; n8 p- @5 I  U
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    - p0 h+ {% _1 F* b, P, u
  20. * kind, whether express or implied; without even the implied warranty6 a% ?" h* w3 ^, p) v
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ' W/ X5 D6 V* \( Z% i3 i
  22. * GNU General Public License for more details.! v4 @/ l5 V6 n5 H, j0 H2 w2 l
  23. */
    * d6 z7 t; x" q1 D; w
  24. + R* R/ m- _1 ^/ B. ^( Q" C
  25. #include <linux/module.h>
    ) u1 k( I6 Y) D: l
  26. #include <linux/init.h>
    $ w7 R, P: c- v) e. @6 Y8 g
  27. #include <linux/errno.h>: j% z( a. v2 h8 f! B1 G! \: p
  28. #include <linux/types.h>4 Q8 T' M& R3 Y$ c
  29. #include <linux/interrupt.h>
    9 J0 z- e# l0 g0 k# |# q$ g* c- V
  30. #include <asm/io.h>
    6 v& j) r; Y7 l3 h' R4 }
  31. #include <linux/moduleparam.h>) ?+ t' N$ W5 d3 U
  32. #include <linux/sysctl.h>
    4 K9 l+ E/ V6 C; B7 s  y: ]$ @
  33. #include <linux/mm.h>
    # \6 c6 }' Q6 m2 n! B
  34. #include <linux/dma-mapping.h>
    % o" ^+ @3 p. U: h

  35. 5 {/ o5 ^6 j- y' h0 N9 o
  36. #include <mach/memory.h>& J+ [) d! y4 V
  37. #include <mach/hardware.h>1 r; x8 s: e3 f- k+ `
  38. #include <mach/irqs.h>2 v. E, M- X3 Z
  39. #include <asm/hardware/edma.h>1 N* x8 ^$ u+ ~0 D( ?+ u
  40. , k, X/ O: [  B% `
  41. #undef EDMA3_DEBUG
    / f1 y1 I. {5 o( [& P9 K
  42. /*#define EDMA3_DEBUG*/+ x0 Z! J0 y" |+ R' q
  43. $ I" D% T2 T9 F  o
  44. #ifdef EDMA3_DEBUG( m* R  b6 G5 t) b& ?+ w# p# h, Y
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    & y; U; i6 l9 ?( j8 E8 U  q6 w' ]
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ! ~2 x: z: Y* G
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)2 U  R9 h3 @' S# Q( h& _; t% C
  48. #else% L, G' m" F8 k$ z& Y; c
  49. #define DMA_PRINTK( x... )
    8 i1 r, }& W+ ^* `4 Z
  50. #define DMA_FN_IN" C. U* y) o1 Q# N7 A
  51. #define DMA_FN_OUT
      n" X' y* S8 |1 _: d7 u
  52. #endif
    $ ]9 m1 c& K! M0 k' L- q
  53. 4 q& B% I3 K4 p4 `! A
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    . P2 W# w' p# D
  55. #define STATIC_SHIFT                3# ?2 H* E' t. c  O4 [# W
  56. #define TCINTEN_SHIFT               20
    . @8 O6 O7 {7 U, _
  57. #define ITCINTEN_SHIFT              21# D1 M% C2 e, \9 B& e
  58. #define TCCHEN_SHIFT                22
    ! P" a$ f" U9 I5 u
  59. #define ITCCHEN_SHIFT               23
    ; C( {5 Z: k: A1 S  C8 A7 C1 c" S

  60. 1 k- u& }, B6 z9 s
  61. static volatile int irqraised1 = 0;
    ' U8 x9 \4 L( `
  62. static volatile int irqraised2 = 0;, ~' v$ {- A4 N- ^' P' f
  63. 2 X7 K3 ?, G" u: d) J3 [
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 Y$ R1 y5 Y- H4 H8 {* }( {, [8 T
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. m* q; R9 ?7 c) i. z7 Q
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 n7 q' [+ a0 [+ b7 ^! ~. q4 b
  67. + R3 B0 m3 b% B+ ~/ z8 e5 c6 N( }1 W
  68. dma_addr_t dmaphyssrc1 = 0;5 S' F! w5 M0 u2 s9 m; R$ x
  69. dma_addr_t dmaphyssrc2 = 0;0 c: I+ u' C# a6 F& E0 s
  70. dma_addr_t dmaphysdest1 = 0;" j$ k- |& s% L4 l6 c
  71. dma_addr_t dmaphysdest2 = 0;1 @$ j) X9 d5 c! W
  72. 3 E; r( N' @8 C4 @
  73. char *dmabufsrc1 = NULL;: A, W  l0 y4 m+ H& J
  74. char *dmabufsrc2 = NULL;
    3 D4 V( \* ?6 D
  75. char *dmabufdest1 = NULL;
    % I$ A) Y9 e/ j1 _  a+ A4 k
  76. char *dmabufdest2 = NULL;
    , C3 ?" r1 e: c1 u8 a, V5 k5 K+ C
  77. 0 r7 q, [0 S- I* A+ f3 a. @
  78. static int acnt = 512;9 J3 S" p. M# H5 [9 j' }
  79. static int bcnt = 8;
    9 ^8 M! N3 n: u# k2 H. w" z
  80. static int ccnt = 8;
    6 Z5 F: S- t& M

  81. , G5 C! N( p6 z4 g/ w
  82. module_param(acnt, int, S_IRUGO);
    / t  C8 m  c* Q* J
  83. module_param(bcnt, int, S_IRUGO);- q, f# K3 d# l/ f; ~. T( t
  84. module_param(ccnt, int, S_IRUGO);
复制代码

' ]0 t- r$ s; w9 v4 |3 s, `4 ?6 m7 X% V' ?
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
3 ^. K" Y6 f' w+ G; Y$ L8 narm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。, v$ T2 f, z" t( B  n9 q3 J
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
; }6 n6 ?) p6 v2 r0 w9 n' G% Q2 k# B$ U
. a% r* V- s- ~  H- d; u
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-24 12:32 , Processed in 0.043616 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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