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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
. x# \5 M6 m/ l
  1. [code]EDMA sample test application1 G7 [7 n  K' i9 Z# d
  2. /*
      N( p* J' D  g/ N. P* }6 F
  3. * edma_test.c7 ~; C- M( @' ?' l" v; I9 `6 F1 a
  4. *
    6 k0 d+ `2 |9 E: c# S0 ^. p  b
  5. * brief  EDMA3 Test Application" M) f2 p! n- }/ h- {3 j: \# J: Z
  6. *
    ! q! m& P& W; h' a8 O
  7. *   This file contains EDMA3 Test code.5 J. l- c: P% E+ u) V; L
  8. *9 v3 `/ J5 D% w+ H, u' e  c# v
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    8 z& [* v# V+ F1 Y
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ' `/ }9 B- X( @. C2 \
  11. *         TO CHANGE.
    5 a: R% _- h" ?/ L& M% }
  12. *
    & ?) \. |7 D2 Y
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/3 W+ A) L: u1 K' A
  14. *
    ( q; y5 n0 {  _$ c
  15. * This program is free software; you can redistribute it and/or
    * s1 e% J1 w1 @. t
  16. * modify it under the terms of the GNU General Public License as
    * E( E; n/ A' r5 U: n0 o7 t
  17. * published by the Free Software Foundation version 2.. x. [7 ]/ [' @% E; v/ R
  18. *" Z. x- `. [2 F& w5 q: U$ M
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any5 ]( k7 u) U0 O. N- g2 @7 q9 X: C
  20. * kind, whether express or implied; without even the implied warranty
    . }2 g& Q3 g* B1 h, i
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the+ B5 w5 i# C0 u* z+ G0 c
  22. * GNU General Public License for more details.9 C5 i4 G& N. d0 R
  23. */* }" B, E% b. P3 Y# I! s
  24. + S" m& M5 T) i% G! K
  25. #include <linux/module.h>
    7 u/ ^6 m1 |* H
  26. #include <linux/init.h>
    ; k+ k9 @4 D" @+ m/ Q
  27. #include <linux/errno.h>
    + h8 T5 V, ?/ q) x
  28. #include <linux/types.h>
    ) G2 ~$ b- ?" @5 w9 Q! X7 n
  29. #include <linux/interrupt.h>6 W* j# ^- \; n" y/ k$ O
  30. #include <asm/io.h>
    6 `3 G" F( ?2 R* F9 x  N
  31. #include <linux/moduleparam.h>
    : O" {! X7 A  D" |/ i8 P; j5 p
  32. #include <linux/sysctl.h>
    8 O$ f4 B4 R% L
  33. #include <linux/mm.h>
    . Q6 h) F' \  T' r/ y; u$ v. p$ U
  34. #include <linux/dma-mapping.h>, o+ \  ?& V+ x' m. D4 w4 N8 U, J8 O

  35. 4 u' w; j) U0 p2 F2 F8 V
  36. #include <mach/memory.h>; ?+ O+ E7 z  ?& J) B
  37. #include <mach/hardware.h>
    % ~7 M& {" t: x, c# Y0 U
  38. #include <mach/irqs.h>
    3 q+ c* d0 w, U  P# u2 `
  39. #include <asm/hardware/edma.h>  ~! v  t+ o5 M9 q: b0 s

  40. ; L' B/ p- t8 Z9 d" S! p
  41. #undef EDMA3_DEBUG
    5 P- g( J% W/ P# z5 K
  42. /*#define EDMA3_DEBUG*/
    # Z  e" a1 h0 ^" ]0 D
  43. 2 [0 I8 w- _( H) O2 N. j
  44. #ifdef EDMA3_DEBUG+ F( b! L& n( a8 D: G
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    6 g" p  y( K8 Y$ ]2 y! h
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)' P( @8 r) c0 r0 i6 D
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    $ l. [+ {3 E8 M# a9 U) l
  48. #else, a2 M7 c- U: `7 ]
  49. #define DMA_PRINTK( x... )
    . M" y- j$ W* c# O; B5 P$ A4 I
  50. #define DMA_FN_IN
    # h1 U# W3 X8 u
  51. #define DMA_FN_OUT4 j4 |& y! F7 I% u* i+ j8 o
  52. #endif/ H& A. ~7 m5 [5 K( ], o

  53. * c. u/ F, X; N, c
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)+ b/ p$ d  S& `# m
  55. #define STATIC_SHIFT                3
    + {8 j0 W- ?3 M: ?! n  v+ R. M
  56. #define TCINTEN_SHIFT               20
    7 H' b/ ^' d3 K! ]9 Y& G
  57. #define ITCINTEN_SHIFT              21
    ( i8 d+ x$ S  Z8 U
  58. #define TCCHEN_SHIFT                22
    1 j5 f6 E7 t4 J# p/ I
  59. #define ITCCHEN_SHIFT               23
    ) [# W1 Y" ?7 i1 ~! D" N
  60. : Z: X# L) J" P0 L! `1 x
  61. static volatile int irqraised1 = 0;2 U, _- \% c  ~4 W- ], ~
  62. static volatile int irqraised2 = 0;
    1 Q" H/ {4 @/ c1 T, S  T

  63.   t0 ]$ Y& `9 e1 L7 ]% {: ~
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  Y2 N4 E+ Y9 ?
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # c1 m: w+ N3 d
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 \; o6 W" B! J
  67. + y2 ^6 @& ^  U0 ?2 T
  68. dma_addr_t dmaphyssrc1 = 0;( Y2 T' a1 t& v) o  ]& O
  69. dma_addr_t dmaphyssrc2 = 0;7 ^2 G0 Q' s; @* T
  70. dma_addr_t dmaphysdest1 = 0;( E  i" A% G. r
  71. dma_addr_t dmaphysdest2 = 0;
    0 z2 W! w2 |- k

  72. ) a  I( A, y/ ^( z5 E0 s( u% Z
  73. char *dmabufsrc1 = NULL;
    ! q. Q  l# S) @) h2 Z# x; n
  74. char *dmabufsrc2 = NULL;1 z. g- X1 D* P, K
  75. char *dmabufdest1 = NULL;  y( Y2 N2 j" P( E
  76. char *dmabufdest2 = NULL;
    & K: n" l' W: Y$ d' k! }

  77. 8 H& Q" K8 }& Y( A5 l; g
  78. static int acnt = 512;6 Z2 v4 N% H$ w
  79. static int bcnt = 8;
    ' s3 [& K8 @2 `1 ]
  80. static int ccnt = 8;: j3 l9 @1 I1 V; H$ s4 O" F% ^

  81. & U2 u  |9 S! _* v
  82. module_param(acnt, int, S_IRUGO);
    % W! t3 o* I( `: k
  83. module_param(bcnt, int, S_IRUGO);) N1 w! C, Y1 Q+ v% L
  84. module_param(ccnt, int, S_IRUGO);
复制代码
! i( C5 k9 z+ G0 y) K
: ~4 P' Q- d9 w; o' L
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用- _) `& v2 ?8 m
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。( i/ j5 d& t% R
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。  a& y0 U1 R! P& m5 R1 j

' D- f# I  @. A% U0 u4 j8 j- J- k4 ^0 F5 i* Z% ^7 P
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-7-18 23:13 , Processed in 0.038443 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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