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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
6 w) d% l, \: }( m# ]# |0 E, T
  1. [code]EDMA sample test application' j: V# {+ X4 A  E
  2. /** O2 ^( a) R! c0 F7 |# ?! U
  3. * edma_test.c
    8 l4 v% d$ c( b! x1 o
  4. *
    7 Z2 J8 ^" z5 Z& a1 y1 d
  5. * brief  EDMA3 Test Application
    * C% t7 d4 d( L+ B! u
  6. *7 A/ ]8 r2 Y6 e3 ]3 C. [
  7. *   This file contains EDMA3 Test code.! U2 K4 x+ ^8 k' J
  8. *1 a) _6 p) g7 Z1 ^; p0 L6 t
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE6 Y# b# Y, f; c6 _9 H9 [
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    " v0 Q, \6 Z; s) R7 K( r" F
  11. *         TO CHANGE.9 c! T. [1 _+ i# @/ A
  12. *
    $ L  r! @2 |% ]3 ^6 P9 H
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/' {0 k8 J+ _' M. v) _1 N2 ^
  14. *3 L; M3 v& J9 y" x( ~3 w" C) U
  15. * This program is free software; you can redistribute it and/or/ X# G' a. Q. u1 ?. H7 _
  16. * modify it under the terms of the GNU General Public License as, b+ c+ D; I: o% H
  17. * published by the Free Software Foundation version 2.
    6 i5 g$ s0 X. W2 w- m" n
  18. *: a# F" N6 [9 l4 r" [6 J
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ' x9 R% Q1 C7 N( L) {1 e
  20. * kind, whether express or implied; without even the implied warranty) B; f7 E2 J% \8 N. U* v
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the- p$ g+ Z/ ?5 q6 i* H! x9 Z
  22. * GNU General Public License for more details.
    ( k; |: }8 b3 y1 j' i
  23. */3 P' H: O1 a' u$ W7 C7 S

  24. # b3 G, K' C/ n
  25. #include <linux/module.h>) T) U, b1 z, j
  26. #include <linux/init.h>3 ^2 `8 ~  ]/ K/ Y/ F) w
  27. #include <linux/errno.h>
    ! _6 h4 r+ u8 I  g8 R
  28. #include <linux/types.h>% p$ L/ j- d$ h* D9 r
  29. #include <linux/interrupt.h>
    6 R7 I' q2 c0 E$ f0 q6 {2 K
  30. #include <asm/io.h>
    . r( T5 _* `3 f5 f
  31. #include <linux/moduleparam.h>
    # m& \  W' ^0 V/ Y2 X
  32. #include <linux/sysctl.h>
    , J8 H6 G& G1 ]1 ~3 b- C
  33. #include <linux/mm.h>
    1 v/ B/ Y$ d! N
  34. #include <linux/dma-mapping.h>- f7 J3 P! o. \3 T8 X& m2 I

  35. 5 L- K& s% \4 Z, z1 b$ z8 F; [; n9 M
  36. #include <mach/memory.h>
    8 O7 z3 M7 }4 r. W  D' }
  37. #include <mach/hardware.h>
    * e, j5 B0 X+ b& z0 Q2 l( h/ V
  38. #include <mach/irqs.h>% j7 p- {' n  I% \
  39. #include <asm/hardware/edma.h>
    + v) |5 L2 j: Y  U0 ^

  40. ; v+ ~2 ]/ B8 Z7 t' B
  41. #undef EDMA3_DEBUG, B5 S% S- P- I9 ?( L
  42. /*#define EDMA3_DEBUG*/0 l, z) d5 f/ y% \2 a+ I! I( j4 m
  43. 3 p* j: l- f! S
  44. #ifdef EDMA3_DEBUG0 @( D5 \. E' Q. Y+ l
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)% z/ W  P( r+ C4 ?& ~
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    " H0 K$ O, j4 ]
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    + @/ `; B4 t$ [% w
  48. #else
    8 r1 y5 Z. ?" q" U' n/ H1 B
  49. #define DMA_PRINTK( x... )
    9 V1 R, `9 _. g! [) i
  50. #define DMA_FN_IN3 K6 [1 d& e$ W' T  m# D) R6 K- l
  51. #define DMA_FN_OUT
    + a6 r6 G, H1 t2 T+ x
  52. #endif, I- S6 @0 w: J8 t: s

  53. ' E( z2 a" ]9 b4 H. m2 ~
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)" ~- x: Y/ m4 C1 H
  55. #define STATIC_SHIFT                3
    ) A) R6 v% e4 A& v  `
  56. #define TCINTEN_SHIFT               20
    5 ]/ Q6 M" [. ~3 Y% u+ _
  57. #define ITCINTEN_SHIFT              21+ U; V7 T; n' g4 s
  58. #define TCCHEN_SHIFT                22) k( s: w* Z+ c" h& c4 ^9 H4 X% G
  59. #define ITCCHEN_SHIFT               23
    " {& \: y' ~  o

  60.   B6 h; S/ ]4 i. k# j* t0 k7 ~. Y8 g
  61. static volatile int irqraised1 = 0;
    5 r6 t. T5 |+ W3 m3 s
  62. static volatile int irqraised2 = 0;
    $ A  y! C: d1 x$ a) ?

  63.   P: c+ ~% d7 T0 B9 c
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, E) a8 |; v! `1 x8 J  z
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / E' \3 d: m0 f" r& F- @/ Y
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / B- p0 ~' g) z( Z* ?2 h- A5 p: A8 k6 K
  67. 8 `  b: o! @  Q* J  O
  68. dma_addr_t dmaphyssrc1 = 0;
    6 W7 ^: @6 G9 ?
  69. dma_addr_t dmaphyssrc2 = 0;/ k' h# N  h2 F. Z
  70. dma_addr_t dmaphysdest1 = 0;) Q) e6 c+ Y! {( s4 K+ }# k) J
  71. dma_addr_t dmaphysdest2 = 0;8 N0 F9 L7 X$ E1 L' s5 P1 O
  72. 2 q- x# J  |" v, w$ X6 {
  73. char *dmabufsrc1 = NULL;3 c+ T8 E6 p6 S2 x/ j* j
  74. char *dmabufsrc2 = NULL;
    & u, J! v$ j5 B( C
  75. char *dmabufdest1 = NULL;1 i# ?/ _( H' y5 C0 [5 |
  76. char *dmabufdest2 = NULL;
    6 e5 X% x! O" m1 {

  77. 3 _- F' o! y3 k; G: Q( `
  78. static int acnt = 512;. _6 i( O& x! K/ e4 {
  79. static int bcnt = 8;% M* D% w7 Q# X; d- h( v$ p
  80. static int ccnt = 8;
    ' o/ |* l" k5 i$ v0 V' P3 I
  81. % b7 H# w) i3 W) U
  82. module_param(acnt, int, S_IRUGO);3 b% L# g! i0 P- [" e
  83. module_param(bcnt, int, S_IRUGO);
    1 q5 B9 C, a( w- c$ A' E
  84. module_param(ccnt, int, S_IRUGO);
复制代码
. n/ z0 e7 R; c( {% X

# k# A" `& D# v: I/ d      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用" j! Y1 o4 j$ Y; k& ^
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。8 m9 D8 r" ]3 r" @
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。, |/ V' q. K* I$ N
" d; Z% T8 a1 n+ l
) [( D+ V* q) T# X& e
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-3 01:23 , Processed in 0.038650 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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