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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ! l# j8 e  V; l+ K2 k  S, ]3 z  H
  1. [code]EDMA sample test application* U* n8 z8 m7 e! b- _9 O/ ~, B
  2. /*5 V% w2 C9 @7 v8 `0 C+ z' G7 P0 i
  3. * edma_test.c% J7 I& `* c5 I5 v( D- }
  4. *6 _( L. R) \' `7 q' W4 c
  5. * brief  EDMA3 Test Application
    ( Y3 A- \' {7 u5 E$ j5 p
  6. *
    ; ~; a" _5 B/ T: s6 K! y
  7. *   This file contains EDMA3 Test code.' B9 o1 A/ f- p: B- C
  8. *
    - A# x; p7 K2 u4 e+ ^
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE! a: X* c* I1 L2 B1 d, K
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT4 c$ E5 t8 G% s6 h! o. g
  11. *         TO CHANGE.
      R6 g# O( R/ W
  12. *! a' ^* r* A% H: m' q3 _! l- y
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ! J$ x( V9 i$ O  |, e
  14. *( L0 `/ E# U( e
  15. * This program is free software; you can redistribute it and/or
    8 ^. Q3 Q7 d/ K. ~: n& ?7 n
  16. * modify it under the terms of the GNU General Public License as. v' ~% L8 G# B! t- R0 w; d$ `
  17. * published by the Free Software Foundation version 2.
    $ i; V! z2 e) n& z4 s- J+ ^( |
  18. *
    & w; d/ @4 X* a. Q
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ' O: v% x# G8 A8 C) `% C' a
  20. * kind, whether express or implied; without even the implied warranty( ^. c+ r( Q# |2 P
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    : {  u2 }# V: Y% \
  22. * GNU General Public License for more details., H, {0 D3 C9 Z( b
  23. */! ?1 G$ C: k& M7 k1 y  g' h
  24. % w" X7 [$ X/ g" ~' o
  25. #include <linux/module.h>
    % [, O* L6 B+ G3 _  c
  26. #include <linux/init.h>  I7 P* r5 M- h( P) W  P
  27. #include <linux/errno.h>/ {7 w9 e2 j8 a4 |2 W6 s
  28. #include <linux/types.h>
    - L1 O; H& D) s4 D( ~) Q( l
  29. #include <linux/interrupt.h>" M0 X* Y3 Q% P% x9 d0 m
  30. #include <asm/io.h>
    8 C) L* v% b8 Z. d& D1 j
  31. #include <linux/moduleparam.h>
    ! [. e% R, f) T% n  j" c; t2 C
  32. #include <linux/sysctl.h>  Z4 \  s/ A% G  T3 k9 u6 b/ }& K
  33. #include <linux/mm.h>4 Z2 Z& F4 [  j  B3 C
  34. #include <linux/dma-mapping.h>, U- v6 L6 l9 X+ s" [! }

  35. 0 y6 ?, y  q! W6 g! i( ]) F/ ~7 ]
  36. #include <mach/memory.h>5 N9 }; ]- O' [% k! `& j1 f
  37. #include <mach/hardware.h>
    - _7 B; l& y0 f0 H
  38. #include <mach/irqs.h>8 z4 [4 z9 _; ?6 s3 h8 Y
  39. #include <asm/hardware/edma.h>
    / W) e9 \3 {% A, `# u: Z

  40. 5 {1 e7 U2 t" J  @% W+ E' B4 t
  41. #undef EDMA3_DEBUG# Z8 h8 p3 x2 p* J& o
  42. /*#define EDMA3_DEBUG*/
    ' Q7 V9 _% q( P3 A" B

  43. 1 @2 H* S+ m! f3 ?
  44. #ifdef EDMA3_DEBUG& h% W/ V. S4 U% [0 \$ E# }; K5 E
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    9 T1 S  A5 C% K" Z9 V/ Z: r9 `
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)+ p3 I$ t- f( ?
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    / n. ~+ Q4 C, Q! T
  48. #else, g) R0 [1 Y6 d! a
  49. #define DMA_PRINTK( x... )4 S2 y  _) L3 a# q) P
  50. #define DMA_FN_IN
      }6 [; V6 g0 Z0 P  s+ s
  51. #define DMA_FN_OUT0 U0 @+ _, [( t, U  U8 r
  52. #endif% z& c8 L1 J0 d5 o: |( r
  53. : [3 u" m1 {, [+ z
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    9 h0 w2 ^; o) H% q/ E
  55. #define STATIC_SHIFT                3
    + V/ x% T- X4 W/ Z3 Z
  56. #define TCINTEN_SHIFT               203 x3 o& Z/ c; }) P; C% |: V
  57. #define ITCINTEN_SHIFT              21
    # o, F* v& N7 r1 W" y
  58. #define TCCHEN_SHIFT                22% r$ e/ \  O0 G$ c0 M
  59. #define ITCCHEN_SHIFT               23& O3 C0 L5 H- N+ d

  60. , ~! q8 i2 \+ K: Q
  61. static volatile int irqraised1 = 0;
    & G6 I3 p; m; a& M
  62. static volatile int irqraised2 = 0;0 d1 Z) i$ E- y& V

  63. ! B4 K6 D. q( n2 p8 @
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / b, u7 M3 I3 A0 l
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! A& g% T9 v  R: H9 O# E* o
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * J6 s9 @5 ~( s) J0 t3 {
  67. 4 _9 A' Y2 B# `$ y, j
  68. dma_addr_t dmaphyssrc1 = 0;2 O: j+ @! d) j' {
  69. dma_addr_t dmaphyssrc2 = 0;. o1 f% B9 L2 [) M% c* V
  70. dma_addr_t dmaphysdest1 = 0;
    1 C# f8 |& g2 V7 ?8 Q  T( L" a
  71. dma_addr_t dmaphysdest2 = 0;
    : a; j! S/ Q" R8 S) v, k* F/ w

  72. 0 T- V  W4 b2 Y6 j6 \* B) H$ T
  73. char *dmabufsrc1 = NULL;" h" c/ P- q5 m
  74. char *dmabufsrc2 = NULL;
    . S; J1 }- Q; N
  75. char *dmabufdest1 = NULL;, @9 W1 S; O) N0 n( t
  76. char *dmabufdest2 = NULL;, K% b& V' I: M
  77. / i% w1 \3 R, m$ j8 e- V& |
  78. static int acnt = 512;  L3 ~; k6 n+ c$ |0 @& t3 ?
  79. static int bcnt = 8;
    5 [$ b$ }9 i3 ]
  80. static int ccnt = 8;
    ( p4 G' q' }; A* T$ z& D, B" |/ E9 K4 h

  81. 3 g" t5 D7 r7 t0 I( S+ A
  82. module_param(acnt, int, S_IRUGO);
    8 ?7 V& b, g4 p) [6 Y* O8 h9 u+ r
  83. module_param(bcnt, int, S_IRUGO);
    ! `' d9 u6 q# D1 @2 w
  84. module_param(ccnt, int, S_IRUGO);
复制代码

, m4 D4 p. @: R6 g# k, d$ i) p8 J
. m# \6 x/ p! G9 y4 b  N  u7 r, V$ H      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用# ]) Z/ ]9 D) ?
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。. U6 R2 {; ~( R6 a9 F  K
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
! c' l1 d* C& q  c+ \& |; H7 Y
* o0 J5 b) W1 ?" x% F
6 I# H1 B- y7 L' G; W* {9 f
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-4 15:13 , Processed in 0.040305 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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