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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
' E3 j( H" ?: k% B2 `' V6 h& p" h
  1. [code]EDMA sample test application
    ) X" A8 ~3 J# X1 g7 z8 \7 Y
  2. /*) K+ v  s: r) f8 c5 o4 }
  3. * edma_test.c
    / a- Q/ I, G2 Z( r  @' t
  4. *- i! u! S8 F$ w+ I
  5. * brief  EDMA3 Test Application
    ! f2 Q1 u4 x9 v, I' F
  6. ** g5 k! x; W3 S2 B
  7. *   This file contains EDMA3 Test code.
    1 a& |9 x/ r4 l' j
  8. *
    4 \: v* h+ ^/ d
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ; c7 B0 N9 @- N0 A7 S+ i
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT/ D* Q! N1 S; p' \5 b
  11. *         TO CHANGE.
    ) U6 @6 }6 R+ O3 R; x
  12. */ K  I4 x( C, ^" U9 M" |' g
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    * x/ |6 a; u/ _
  14. *  x/ V4 K1 D' p3 j
  15. * This program is free software; you can redistribute it and/or8 q3 N2 r2 b9 _: x1 n& X
  16. * modify it under the terms of the GNU General Public License as6 _6 i) |$ H& K7 ]  M' a
  17. * published by the Free Software Foundation version 2.
    % s$ E9 P1 y" j# @
  18. *
    2 h3 O% g6 I5 q, G
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ! ~# B' v" S& o7 ^1 ~
  20. * kind, whether express or implied; without even the implied warranty  a" c0 {9 Y7 E) s7 ]
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    5 g1 \: ^* P, D/ y
  22. * GNU General Public License for more details." [. j5 D. f' o. u$ Z
  23. */# ?; S6 T4 U0 \( x0 ?. D
  24. 1 I* D2 r, Y7 x" l- [9 @: u
  25. #include <linux/module.h>
    - m( [0 x1 U% T
  26. #include <linux/init.h>5 t- P& f, s1 p& v- U
  27. #include <linux/errno.h>  c% X, Q9 ?3 S+ x. A
  28. #include <linux/types.h>/ ~0 p" G) |6 n: c
  29. #include <linux/interrupt.h>, k, _$ o& }# J
  30. #include <asm/io.h>0 K4 [0 ]1 ]3 M. N' U, [. ^, g
  31. #include <linux/moduleparam.h># M- t; R8 }, f: L8 M
  32. #include <linux/sysctl.h>
    / q4 X' N3 r5 _5 x9 C" r* O
  33. #include <linux/mm.h>+ w- T8 K' H7 q: U: V
  34. #include <linux/dma-mapping.h>5 r1 g* x3 x: r; r$ i1 u8 ?* a
  35. ( w4 K1 L! ~0 {- S% h
  36. #include <mach/memory.h>, s3 P9 i  ]8 n9 \" m
  37. #include <mach/hardware.h>4 M9 Z# A) Q' y4 c# H  J8 B
  38. #include <mach/irqs.h>
    % K% _7 Q; \8 X* F4 K$ N
  39. #include <asm/hardware/edma.h>4 s) e9 Q7 \& U

  40. * Q: d  |6 D2 o5 U7 j8 z
  41. #undef EDMA3_DEBUG
    " ?( I  C0 j8 P7 ?. j3 C
  42. /*#define EDMA3_DEBUG*/- i% L* t/ U9 s: y' P

  43. 9 z1 V3 `0 `- L- Q1 E; _
  44. #ifdef EDMA3_DEBUG
    2 P% A3 q' W- |6 E: h9 m
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ( [$ l5 k, V& ]/ e" |
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    7 t# R7 e" ]) U2 P+ n! D
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)  P5 o' B5 |8 j) B
  48. #else
    - c2 k. h) S0 ~9 i" a6 p# f7 R
  49. #define DMA_PRINTK( x... ): M' e. F1 h) Q9 ^2 ~
  50. #define DMA_FN_IN
    5 h0 p; k$ u2 x
  51. #define DMA_FN_OUT
    1 ]6 t, Z& T3 z2 J6 O( ?
  52. #endif) W5 b" P* [) p1 W. ^6 e
  53. ; p6 F! v+ t- u
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    2 O2 }# S! W1 @; ]# w* j2 \8 }: n
  55. #define STATIC_SHIFT                3
    4 A! e1 ?9 B/ L% D0 y5 ^( R
  56. #define TCINTEN_SHIFT               20) a3 g0 J$ P9 {8 j& J/ c
  57. #define ITCINTEN_SHIFT              21
    ( J$ T+ b  I3 F  l
  58. #define TCCHEN_SHIFT                229 Y0 \3 w1 |% h$ Q; d: G
  59. #define ITCCHEN_SHIFT               23/ A3 }1 J! K  a" b. a7 u6 q

  60. / H0 e4 e, R7 L4 k0 m* U# }: U
  61. static volatile int irqraised1 = 0;" X: x5 f' D( x
  62. static volatile int irqraised2 = 0;
    4 z6 C: c& V4 l. r$ T9 [

  63. 4 w1 l: i$ I% r5 ~0 G1 A
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' V/ E+ i! D, ]) H# ]
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / j% E3 O2 j. f  d2 k+ f% l" c
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% W9 V3 j5 N& ^

  67. ( w! V9 Z! g- o1 ?
  68. dma_addr_t dmaphyssrc1 = 0;  H+ J9 W. m% k! ?8 l. k9 K/ _7 p
  69. dma_addr_t dmaphyssrc2 = 0;0 g8 H$ |3 z) d9 Z( S8 g
  70. dma_addr_t dmaphysdest1 = 0;
    : ^+ C- L0 |* [% M$ Q+ m
  71. dma_addr_t dmaphysdest2 = 0;
    , O* }. f: V/ j4 ^# u

  72. / B5 ]. q3 E- v) U$ w/ h7 }' ?6 G
  73. char *dmabufsrc1 = NULL;# r9 b, y' m7 b' i3 o4 z0 z# `* \
  74. char *dmabufsrc2 = NULL;
    . J" |/ A+ G6 I
  75. char *dmabufdest1 = NULL;% j9 O2 R- x# J
  76. char *dmabufdest2 = NULL;4 u. [- K  v# Q1 x8 |1 y
  77. " d, o  g% J: B- H3 [3 k* n
  78. static int acnt = 512;1 @7 ^1 d1 T9 B- j: i; R
  79. static int bcnt = 8;
    0 i& e! l6 v( @. m5 H5 u+ T+ I
  80. static int ccnt = 8;
    # \. o- v; g$ P7 F

  81. % t/ D! m- b0 d$ j, ^+ K$ K) L
  82. module_param(acnt, int, S_IRUGO);0 p) c( U/ I* `. M% b$ N
  83. module_param(bcnt, int, S_IRUGO);
    * z/ K' F) X% N4 b  \) i
  84. module_param(ccnt, int, S_IRUGO);
复制代码
" |" N! w: a+ w$ v1 h

; D1 h0 }2 f: X" Y# f      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
& O4 J, M/ }( g. h; ?: B. P2 E& `7 Warm-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 Q" `7 X0 x  q( x; D
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。& C$ F7 u, t0 L3 q5 q7 L; `
. @1 h' j5 F# R, Y: |
$ i4 U6 C' @8 B, M8 ^1 k
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-13 22:45 , Processed in 0.038665 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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