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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
8 h# g, S( I2 C$ l; [( J
  1. [code]EDMA sample test application
    7 r% s: f2 f! I# W+ u
  2. /*" v9 |9 v. e8 V* g0 r$ D
  3. * edma_test.c& T( Z- c# d3 n; s7 p- K8 i
  4. *
      v" p7 \7 f1 m! W
  5. * brief  EDMA3 Test Application, L5 ^0 I& Q3 M5 Y: ~
  6. *
    & q3 b4 _# ]* s' l: U( L% X, X
  7. *   This file contains EDMA3 Test code.
    ( b, Y( k$ q  _: d
  8. *
    4 S7 l) a" ^$ p4 d" B& g9 {) _
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE0 Z! z$ w& I5 [! b' |! N& [: @
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    * F$ \! Y/ s6 j& a6 x* o( z
  11. *         TO CHANGE.' `8 Y+ H7 e1 u5 \% r/ J# h7 P/ H
  12. *7 i& S5 s" G8 f- X/ a2 E
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/- d6 x+ a% \1 U  {; W
  14. *
    ; N8 M2 A: k/ y' O, r/ [  j/ Y+ u
  15. * This program is free software; you can redistribute it and/or
    ! U. T$ q3 o- M+ U
  16. * modify it under the terms of the GNU General Public License as9 k3 H  R" R9 l( A
  17. * published by the Free Software Foundation version 2.4 M# x$ w9 U$ ?' |) a: Y
  18. *5 ^. ^9 K, i- y  c) W2 d
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    % Y" X% ]/ h; w+ c
  20. * kind, whether express or implied; without even the implied warranty$ g* F& {5 [5 M+ l, C4 K5 r
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    & [" n% q7 d6 _0 _0 X( Y- B; }- b5 ]
  22. * GNU General Public License for more details.
    ! ^0 d8 J8 _9 r. \
  23. */
    * t$ o8 m/ z" i% B6 t

  24. 2 a/ ^3 @4 A7 S# i% v
  25. #include <linux/module.h>, v$ Z3 X4 z/ U# u3 Q
  26. #include <linux/init.h>- T" y. j" I6 [
  27. #include <linux/errno.h>
    7 j& w) P' c4 @/ j. [; C
  28. #include <linux/types.h>; F5 k* Q' J- s7 ]
  29. #include <linux/interrupt.h>
    / ?. h/ H. Q, \, v4 W9 l/ ?9 B
  30. #include <asm/io.h>
    ; p; v' V) l) Z4 A! ?" m1 |5 t
  31. #include <linux/moduleparam.h>) F$ r3 H% x2 m" ?5 R
  32. #include <linux/sysctl.h>
    * ]$ [) q( I1 U; L
  33. #include <linux/mm.h>
    ( L+ g" g( ^: C: v
  34. #include <linux/dma-mapping.h>
    # ~- P2 S5 _, d& _$ c' B: s2 j& M/ [1 D

  35. + q1 |! o  W4 y, ?
  36. #include <mach/memory.h>
    * q7 F1 [' o9 b
  37. #include <mach/hardware.h>
    7 ?' Y: V0 v5 ?) r8 Z
  38. #include <mach/irqs.h>8 }/ [. k- [4 k: X- C  W
  39. #include <asm/hardware/edma.h>
      \- B3 P# p2 b9 i. S
  40. ( r; Q# @7 K7 r! e  f( }( n
  41. #undef EDMA3_DEBUG& O4 W/ m3 R. r8 P5 R
  42. /*#define EDMA3_DEBUG*/5 p9 H( c" J4 |1 _- X

  43. + y6 Z, \; ?; I* I
  44. #ifdef EDMA3_DEBUG
    ; u7 K8 P1 W& M! J
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS). o1 i; D1 Z: H+ X& `
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)5 t7 w. X7 j& G" G9 C
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    $ Q1 b. M. s9 S3 D5 d
  48. #else% \6 R5 w) Y' m8 m( N
  49. #define DMA_PRINTK( x... )
    # Q! `2 n+ p( s
  50. #define DMA_FN_IN
    . r% f/ w$ u9 k& W: |  ]5 [" U
  51. #define DMA_FN_OUT
    1 x* N0 m3 p/ u( \/ `
  52. #endif
    . M( |! K1 M8 S& ^

  53. 7 s1 L/ g, a: X, X" }# A
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)# M: T  L5 j6 H1 h2 y8 L5 `
  55. #define STATIC_SHIFT                3
    ) H" V& i4 R6 M( o" T: o
  56. #define TCINTEN_SHIFT               200 g/ P, B+ t% z9 ]: G
  57. #define ITCINTEN_SHIFT              21
    9 G3 l$ x/ T4 l7 R! i; _
  58. #define TCCHEN_SHIFT                22
    4 q' Y3 a+ @" C1 _
  59. #define ITCCHEN_SHIFT               238 b. r! z' m% F2 {5 v4 ~2 A4 t
  60. % x) }5 S, O# t5 ]0 f
  61. static volatile int irqraised1 = 0;5 @9 K0 ^) r; I$ P7 I
  62. static volatile int irqraised2 = 0;& M3 h  ]" {1 R6 g2 ^- L0 d. y. B2 {
  63. / o: O9 M) h2 @4 l
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # c0 }2 F4 F* [& `/ m" x8 |1 p2 J$ `
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 O8 j9 R0 k6 q; I
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! B% E, u: R( v3 Q* i) E
  67. ) G& r9 y9 X6 H4 [0 J9 x0 W
  68. dma_addr_t dmaphyssrc1 = 0;
    ) H$ i) B# ?( N0 F$ f) Q
  69. dma_addr_t dmaphyssrc2 = 0;
    4 c+ S/ o3 D7 B' E4 q. |) q' P
  70. dma_addr_t dmaphysdest1 = 0;
    0 S$ _( b# W) q/ y
  71. dma_addr_t dmaphysdest2 = 0;7 O* V9 G1 @. ~0 U
  72. , ^3 G0 }, o% `& W
  73. char *dmabufsrc1 = NULL;
      ^7 |# {9 S7 N. V0 s( f- K
  74. char *dmabufsrc2 = NULL;
    : q) r8 G9 @" t+ o5 Z' `; M
  75. char *dmabufdest1 = NULL;
    9 h' e3 ^+ b+ B; ^. ^! Z2 J
  76. char *dmabufdest2 = NULL;
    2 g4 @& Y& J2 k' T) C+ N" b3 }

  77. % E1 Q6 ~# g  a+ Z: |  `) ^7 a
  78. static int acnt = 512;
    * ?" _( z& n# [1 G3 K- D
  79. static int bcnt = 8;
    # Y+ K( a; {8 j& C& w" M) \
  80. static int ccnt = 8;  G* y. M% [/ ]
  81. - Q5 K6 T1 n! F% h! [
  82. module_param(acnt, int, S_IRUGO);5 p6 i4 B( l/ L4 X. }& A& @8 P
  83. module_param(bcnt, int, S_IRUGO);  d% I8 q9 I  O$ D  ?% R
  84. module_param(ccnt, int, S_IRUGO);
复制代码

5 N# X5 a+ l5 H
* B1 V. [5 z- ^; r, I4 w; N/ s      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用  W$ O, t9 o) I) a  _4 ?+ V( A
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。! ]7 i4 S1 B5 J9 D6 P" Z
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。3 B9 B, i, d2 I* H- N/ A8 v

) ^- r5 C6 n) [: `, S0 N; j9 x
* k5 M/ I8 s% F3 v
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-11-10 19:27 , Processed in 0.044939 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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