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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 3 I7 z9 F( D8 V1 [( w9 B
  1. [code]EDMA sample test application6 ?2 J2 V+ j3 y8 A# U5 `
  2. /*
    , _8 M  a4 w6 R/ w! \4 Z( e
  3. * edma_test.c
    8 f5 M* Q- K6 [3 I
  4. *
    ' c$ H% m' B. ~* ^3 o
  5. * brief  EDMA3 Test Application
    $ m5 p9 y* v- Y+ P
  6. *7 q$ _  v+ z: Y% {4 S) j' i3 H0 F
  7. *   This file contains EDMA3 Test code.
    * e. B- ]* B+ G/ k
  8. *
    & C. @  f) F# @0 c1 B; k
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE7 b* ?- ~4 O; z- q+ b
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT* a5 ~- T8 ~* A( @* u
  11. *         TO CHANGE.4 ^3 j  C2 B$ e. {
  12. *5 m! Y+ }+ v7 _; Q  v
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/* v$ U2 [; T9 o- w1 T  d# ?
  14. *
    . @% [  \9 a! W- F9 c$ s4 ~
  15. * This program is free software; you can redistribute it and/or
    8 W8 D; q% Q$ ]+ h% G* o* w
  16. * modify it under the terms of the GNU General Public License as
    $ L4 h) U% Y# f
  17. * published by the Free Software Foundation version 2.5 E/ W# @7 f) M! s6 B& h* X7 _* k
  18. *9 w5 L5 x' A. C" \# V* [  |2 G8 s, [0 z
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any! Z4 V  g5 t6 N& ^
  20. * kind, whether express or implied; without even the implied warranty- p2 B9 L0 |( ]# D. C3 E7 M. q
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the5 z& @3 [& ~6 i- Q: N
  22. * GNU General Public License for more details.
    0 F2 }, e3 o3 M3 i! r+ \: ~: ^" F
  23. */
    # B" U( m' ?2 u# Z" F
  24. 0 p" f. l0 ^; q  l; k8 s2 q
  25. #include <linux/module.h>
      h" Q$ S# K6 p% W6 \
  26. #include <linux/init.h>
    1 q( P  f1 H' P8 x2 v) E4 k0 b4 b" N
  27. #include <linux/errno.h>) S& U' ]/ F- T5 Y. ?6 \2 [- q
  28. #include <linux/types.h>* W, t7 e9 K4 `  Z' a% d
  29. #include <linux/interrupt.h>' N! }# E! _/ i/ L
  30. #include <asm/io.h>
    / F! l9 N8 w) ^+ c$ j
  31. #include <linux/moduleparam.h>5 ]% K) ~  K" R, P- S7 d1 W
  32. #include <linux/sysctl.h>
    + a# p: G) \3 {. c4 }. N2 p
  33. #include <linux/mm.h>% M, j3 `2 W8 s) W$ e
  34. #include <linux/dma-mapping.h>
    6 b) j! {) N% Q; c9 S5 z

  35. % u# b7 ~& K0 l% B& Y+ w
  36. #include <mach/memory.h>
    3 @$ k& X- s# r  x% n
  37. #include <mach/hardware.h>) ^9 @2 c7 Z: v$ \; m
  38. #include <mach/irqs.h>$ g! p9 M" n/ v3 P4 U
  39. #include <asm/hardware/edma.h>8 g( d( D6 L- f+ y0 ?& m
  40. " Z6 |7 c8 U# w8 c" ?
  41. #undef EDMA3_DEBUG6 w% |# k+ f" l/ y5 T
  42. /*#define EDMA3_DEBUG*/
    2 f# g! x' K: ]4 j* Y

  43. / {, k( E% [3 |) a3 _' z  y5 _/ V
  44. #ifdef EDMA3_DEBUG
    * X: h, o* s7 c/ u4 N$ e9 S! R
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    6 z4 o& I! P/ x; i# j8 F' L
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)& W' v' O: }7 p0 i
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    " I5 F: g* c. o+ k& V2 f
  48. #else
    2 ^$ e" q. ~" i! _
  49. #define DMA_PRINTK( x... )% k, E9 ]8 H2 i+ ^3 z! u3 ~8 g$ [
  50. #define DMA_FN_IN
    , ?; F9 c; [6 K/ w5 A+ J/ B, V7 ]
  51. #define DMA_FN_OUT
    3 K+ a) s! Y9 c) F. p; L+ W: P. w
  52. #endif
    4 I: B( N; m1 I

  53. / R9 _( |% a# h
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    9 T7 M% Q7 ]9 h$ `4 g/ S
  55. #define STATIC_SHIFT                3. r% A2 ~# K% w
  56. #define TCINTEN_SHIFT               20) ^- w- X# u9 x  M8 C
  57. #define ITCINTEN_SHIFT              21
    ) x9 a- R, n/ Y4 O
  58. #define TCCHEN_SHIFT                22
    . X3 A0 ]" B% i$ N6 e1 V
  59. #define ITCCHEN_SHIFT               23
    0 ?& }- K4 V' t5 K$ P% P4 o

  60. , c4 x# W) k$ z3 i  r. M9 \" {  d
  61. static volatile int irqraised1 = 0;
    8 e* k4 F5 l/ g/ E. M  J( H' |
  62. static volatile int irqraised2 = 0;
    7 X  L" }2 ^, N0 X

  63. / t: n' Y3 N2 v3 _, u
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 z+ l* Y4 W3 o
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 Y* w# H) G6 S
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ k' @* }/ g# s% y" _8 l

  67. 6 H3 L4 z- G& s! n
  68. dma_addr_t dmaphyssrc1 = 0;
    * y; n5 u6 Z5 S  B+ m. r, j1 t
  69. dma_addr_t dmaphyssrc2 = 0;9 g  A/ `* B' w& T6 X/ S
  70. dma_addr_t dmaphysdest1 = 0;
    7 V/ d! e5 P" n- W2 l
  71. dma_addr_t dmaphysdest2 = 0;, Y9 `; U* X$ D4 ^

  72. 9 K' i' Z  v6 y, m9 v1 g6 y
  73. char *dmabufsrc1 = NULL;
    7 z: v) @* k& r" n9 I
  74. char *dmabufsrc2 = NULL;
    7 i3 E- u. D+ I$ c( v
  75. char *dmabufdest1 = NULL;
    3 Y! ?+ u6 `6 v8 T& M2 Z4 W8 R
  76. char *dmabufdest2 = NULL;
      H# D; N) ~) N! w2 w& F

  77. 0 _- j2 Q2 L1 l+ g% P& ~
  78. static int acnt = 512;
    ) Q7 T+ I6 F7 o9 r8 A. B
  79. static int bcnt = 8;
    * Y, ^9 p' r! r3 V6 n; ~& H5 Z. e
  80. static int ccnt = 8;, c5 F$ _! q3 m% Y$ K2 z: r
  81. % A3 c4 ?+ ^, `' E8 g
  82. module_param(acnt, int, S_IRUGO);+ L" x, |: @+ a5 d6 \! I+ H
  83. module_param(bcnt, int, S_IRUGO);7 ^9 ~& P% U6 E+ u9 a
  84. module_param(ccnt, int, S_IRUGO);
复制代码

3 `4 B, {- I' [/ v$ A
0 O! C1 y' D1 M      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
- N% N% F  X% C: ]: |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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。. X# T$ G6 c, L+ A6 h" [
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
/ h; t3 O* i9 A% L: I. V1 k6 e$ J" A- b, C' w3 q# y

0 U" d& h1 N6 J7 A3 B* K
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-27 13:13 , Processed in 0.040738 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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