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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 $ c8 Q$ m2 C. e) \; [- o4 F0 y0 b
  1. [code]EDMA sample test application
    % c# K' N1 h% B: Y- V' K+ w
  2. /*/ Z" @" W& ]9 Y! b
  3. * edma_test.c
    ; J, M8 d* [8 r7 M  q0 k
  4. *
    ( n4 X2 j' }+ U9 Q
  5. * brief  EDMA3 Test Application
    & I" A3 b+ M- ?& r# X$ d1 b3 @8 c0 l
  6. *
    / c9 h- R* ~" g& h1 {
  7. *   This file contains EDMA3 Test code.9 A8 L: M" y+ S, D
  8. ** j$ q2 K/ ?1 v' {, u
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE5 t5 O2 G3 B" a& r, V
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT2 Y2 {0 \4 A$ Z; |2 G: ]# @, b
  11. *         TO CHANGE.' ?2 k: l5 V# W. }! {" w
  12. *
    : a- Z3 H3 ]0 d
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    2 P4 H* c; T3 f1 o: |. }: f7 ~
  14. *0 s& p; ?1 N+ H# P
  15. * This program is free software; you can redistribute it and/or, E' `0 C/ g7 M' W
  16. * modify it under the terms of the GNU General Public License as1 v( X, J) [4 Z2 O7 S+ q
  17. * published by the Free Software Foundation version 2.+ ]( \! h* Q: V: e  Y7 w: l
  18. *
    " U- g6 c1 o% _2 g0 E8 }
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any; Q# H" C0 K0 m1 g. k" w$ O
  20. * kind, whether express or implied; without even the implied warranty
    9 w$ u1 X" e; t9 ]$ P, u" P( P2 @
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the6 K) }5 `0 }; W$ q( g, k2 q- `
  22. * GNU General Public License for more details.: w4 q7 x+ I: X: q
  23. */: |: K2 G9 w) l% f: }
  24. 4 e% Y$ d& \! C2 ~! z" J. d  X
  25. #include <linux/module.h>2 A- n6 `5 }" W/ m( \
  26. #include <linux/init.h>$ E3 B; x3 w1 t" j& u5 F
  27. #include <linux/errno.h>4 v8 [  y- i1 d0 w5 U$ K$ B
  28. #include <linux/types.h>8 E) L8 C2 [/ _3 ~  X+ w
  29. #include <linux/interrupt.h>
    : z2 a7 V$ F& P/ e1 |
  30. #include <asm/io.h>
    0 K: s2 h" j9 S7 r- `2 K* f8 `
  31. #include <linux/moduleparam.h>
    + X4 O3 S4 p) Y
  32. #include <linux/sysctl.h>
    . C, H: W* g' n& ]- W7 x0 o% j% c
  33. #include <linux/mm.h>4 V% I, Y& h1 M% H
  34. #include <linux/dma-mapping.h>9 L9 d' a: y1 t& _$ g$ L
  35.   I: `& X) Q8 ^- S6 b# H
  36. #include <mach/memory.h>& K" @8 G& a  s4 h3 S0 V; B9 D
  37. #include <mach/hardware.h>
    ) L5 f+ y" Z/ m
  38. #include <mach/irqs.h>
    ; n+ B' I7 J- U9 r3 R. k2 m
  39. #include <asm/hardware/edma.h>9 w* ]# a8 m- V1 x: ]' y

  40. 2 J. A0 M* o) s+ A% {7 C6 X
  41. #undef EDMA3_DEBUG
    $ ?& g; s2 D+ ^* F
  42. /*#define EDMA3_DEBUG*// @4 r9 _' i7 M

  43. , F( n6 ^, A7 ?' M/ U  n
  44. #ifdef EDMA3_DEBUG3 l1 R  \5 i& x3 Q
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    : s6 D4 e) s6 c5 d
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ' v/ z& A$ y# [5 Y* ~5 d7 C! N
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    $ O0 ^# |- I, Y  h2 B2 c
  48. #else
    4 h1 R7 M+ b, b, Y5 ~
  49. #define DMA_PRINTK( x... )
    - i" c# I/ d5 k% d% h/ g+ y% w
  50. #define DMA_FN_IN
    4 O/ Q$ ~# \$ w1 O% j
  51. #define DMA_FN_OUT
    4 O# u! c* E) a/ k7 X
  52. #endif) o; L9 [$ Y. {

  53. . o% x5 ?( y3 w
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)2 l2 g) V8 W8 F" B
  55. #define STATIC_SHIFT                3
    6 d+ ?# J6 L- @! V& \
  56. #define TCINTEN_SHIFT               20
    + K0 _/ B* ]/ i+ w. a
  57. #define ITCINTEN_SHIFT              21' s$ }- s1 M3 R% R$ e( w$ _
  58. #define TCCHEN_SHIFT                22
    ( X5 ^% _( ~+ k' Q% ]) X2 J
  59. #define ITCCHEN_SHIFT               23) K% d" a. i$ U+ @. u8 D

  60. 0 C9 |' p& _% w4 A, s0 K
  61. static volatile int irqraised1 = 0;
    - k: V7 S& m) [7 ]* A4 R
  62. static volatile int irqraised2 = 0;. E: c2 O2 r# m8 k. q& w1 E& |1 x+ o7 v

  63. ( C$ F9 A7 t$ ]! S8 w0 ^  J
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) ?' R2 }/ _* E% A; V/ n0 y
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 p4 ^) M* h, E- X  A- h
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 k2 W6 t' e/ P( _, g4 w
  67. : s9 i4 N, x' h4 L! |% a
  68. dma_addr_t dmaphyssrc1 = 0;1 U3 [7 C1 w2 G& i+ l7 u
  69. dma_addr_t dmaphyssrc2 = 0;* Z, B, ]: S4 ]& r$ \: A% O0 z
  70. dma_addr_t dmaphysdest1 = 0;
    9 S$ \! D+ s3 m; M' Q) ?+ b
  71. dma_addr_t dmaphysdest2 = 0;6 U" Y4 H+ w* e- y- _
  72. % V/ `! p0 _9 z9 k% j
  73. char *dmabufsrc1 = NULL;
    ; \: A/ y6 C3 K7 M3 Z4 w
  74. char *dmabufsrc2 = NULL;
    * I* g" c! Z. b
  75. char *dmabufdest1 = NULL;
    , C) ]- T. f, e* M
  76. char *dmabufdest2 = NULL;$ @: M6 w& @) M: J
  77. $ t+ ^0 W/ A/ i8 G8 e9 x5 Q
  78. static int acnt = 512;! o9 l8 j. H( y, R
  79. static int bcnt = 8;4 o' `4 H  F- }! x+ n* X# t# k
  80. static int ccnt = 8;' U* [/ V9 Z; y

  81. ) F4 `: X1 V$ y
  82. module_param(acnt, int, S_IRUGO);
    . Y& N4 M' r* Q: u
  83. module_param(bcnt, int, S_IRUGO);2 x) d5 B' H2 ^" f: c
  84. module_param(ccnt, int, S_IRUGO);
复制代码
& H* k$ M% @. G3 z, D
3 t) k9 z/ j+ x8 i: e
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
( e5 t1 U* L- B  A  e) Larm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
6 ?5 K& S; `9 E& r, Z( L6 C     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。1 _" e- w) P) g9 t9 m
3 g* H4 J. u! N# |3 y! n3 ]  P/ F

7 O1 C! l: V& N9 w0 S
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-15 02:34 , Processed in 0.042443 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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