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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
5 j! j3 q6 D4 o$ Y* e% r% B
  1. [code]EDMA sample test application/ G6 v  R5 }+ h% o2 z2 M* t+ M
  2. /*4 ]& y, O6 @  S3 X) A: C
  3. * edma_test.c
      Q7 [" q* E- g+ `
  4. *
    * H9 x) _2 m  i0 X
  5. * brief  EDMA3 Test Application
    ' t2 Y2 p# o6 z* W! l
  6. *
    * ~  ^( |$ R- r' a0 M
  7. *   This file contains EDMA3 Test code.
    $ l+ k! _% ?# _7 Y: L
  8. *" w. a3 `0 j. j  }6 c3 Z$ o
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE( k  e& L3 A+ D; v1 U! S
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT- D9 ?0 y; O8 z( I% J, y6 |
  11. *         TO CHANGE.
      J6 Y  N1 m  {9 p# _6 [1 p! b- I  o
  12. *
    4 R2 C0 e9 O* m: Z2 V' K
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    " O% s0 V& D4 Z: x# y# w2 q4 g% R  n( Z
  14. *' J+ c! o# u4 }8 |
  15. * This program is free software; you can redistribute it and/or
    ; T7 t6 k) f: `# D# _4 Q
  16. * modify it under the terms of the GNU General Public License as
    $ {) o# N: s6 I( q2 G1 E2 J
  17. * published by the Free Software Foundation version 2.  L1 U1 q+ v7 T6 U" ^; J. p! @
  18. *' ?- n6 z  |0 P  h
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any6 B0 X9 T) ?. y1 U
  20. * kind, whether express or implied; without even the implied warranty3 |5 F: ?, x# c( O
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    & Y! H  l7 s: E4 `7 x3 K" ]
  22. * GNU General Public License for more details.
    ( N1 F' h2 D* D
  23. */1 H3 L- H6 L. D
  24. $ H( o9 m& A4 X# ]3 L2 J
  25. #include <linux/module.h>
    + K( m$ L# V/ q3 `/ R# s9 ?
  26. #include <linux/init.h>. O' C6 D/ D7 p) y0 H% w1 }9 ]
  27. #include <linux/errno.h>
    / `( X1 L9 C- z) o' F
  28. #include <linux/types.h>  ^" r" l  ^/ Y
  29. #include <linux/interrupt.h>) ^4 Q9 j$ ?  \& e
  30. #include <asm/io.h>6 `% r# @5 x- U  B
  31. #include <linux/moduleparam.h>
    3 A; {" K6 P$ _' m  O9 S
  32. #include <linux/sysctl.h>
    $ b: Q$ c% `8 ~
  33. #include <linux/mm.h>( a  c3 B$ L0 P( H  q- S$ A  F
  34. #include <linux/dma-mapping.h>
    4 m3 M! ]3 Y6 E( A4 Q" P; `' j
  35. 3 G3 X; Z* r1 {1 B5 Y
  36. #include <mach/memory.h>% L6 J/ z& ~& N# b
  37. #include <mach/hardware.h>: k4 i- F% A2 u! y/ i4 c6 V9 @
  38. #include <mach/irqs.h>$ K! ]7 J7 \% d" {1 O( b" [
  39. #include <asm/hardware/edma.h>% j! U& W  {. @9 V4 \7 }/ V

  40. . y  ~+ D3 z. K2 u( h- d) k. C& r3 S
  41. #undef EDMA3_DEBUG
    , }. ^) O9 I( g4 O
  42. /*#define EDMA3_DEBUG*/7 ~  ?( M  h5 w2 b! P
  43. " ~. i, b1 O" ]  M  z$ [) L- d
  44. #ifdef EDMA3_DEBUG: p% ]' Y% ?2 O8 D3 R/ B
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ) U2 z/ {# ~5 A+ ~' V
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    , q: @( g4 i8 N3 U$ L4 |" u
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)$ ?' n; e) o* F1 N+ t' @
  48. #else
    ( V! S5 t7 S" L& A6 o( R, n8 |
  49. #define DMA_PRINTK( x... )' g0 X! g' \9 G3 x* L3 k8 s$ O3 s
  50. #define DMA_FN_IN: X! B9 ?1 w2 m- G
  51. #define DMA_FN_OUT
      G. b! Z- X8 q
  52. #endif
    ) l' C5 \$ a9 V% Z: B: [% c3 h

  53. 4 U( d8 P( D+ S- U9 ^( y6 Z: Q
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768); W" r; G4 E+ d; |1 |+ K+ n$ w
  55. #define STATIC_SHIFT                3
    ; y# J1 `3 c  W- M
  56. #define TCINTEN_SHIFT               20) G0 v1 ~8 A8 v$ G
  57. #define ITCINTEN_SHIFT              21
    4 ~4 }) g" Z, v; @! X
  58. #define TCCHEN_SHIFT                22
    - \! f) X. |4 l% q" h4 y+ N5 Y4 I
  59. #define ITCCHEN_SHIFT               23" R) s+ R5 K, p% _# g
  60. 8 C+ m+ w$ b9 a
  61. static volatile int irqraised1 = 0;
    7 v# N" b: a# b# C
  62. static volatile int irqraised2 = 0;
    " A+ H' N' ?5 @( {  o

  63. 4 g4 h& _" L! \( h+ Z7 d% g* X
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  x  C7 G6 a7 J5 [; M) R, N
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* }5 `' Q3 W" `( R- M
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : Q# p' D( S+ I9 v
  67. ( x: b' k) ~2 d8 T( C& l
  68. dma_addr_t dmaphyssrc1 = 0;2 H4 t, D6 @, t/ X2 V) r
  69. dma_addr_t dmaphyssrc2 = 0;& }* [! H2 w  h6 H
  70. dma_addr_t dmaphysdest1 = 0;
    ) R7 r5 r+ l4 N' n, u$ J
  71. dma_addr_t dmaphysdest2 = 0;
    0 E1 e3 s& Z$ s9 j
  72.   w5 a# f+ V, Z$ w/ A5 u3 W
  73. char *dmabufsrc1 = NULL;
    " s+ k7 i2 j* F: Q
  74. char *dmabufsrc2 = NULL;# H5 }) j( n" A+ Q8 X
  75. char *dmabufdest1 = NULL;' @8 O  s1 ]  Y0 s
  76. char *dmabufdest2 = NULL;
    9 p/ F: m( d. K1 d

  77.   w5 \, x3 J$ {( Z9 L; V8 W& F
  78. static int acnt = 512;0 S0 t, |7 |/ w; X' o% X
  79. static int bcnt = 8;& @5 B  Z( }/ K
  80. static int ccnt = 8;* ]6 x5 v: m; u

  81. + l; R+ ]- X& Z& e( \  ]
  82. module_param(acnt, int, S_IRUGO);
    $ b! ~1 d0 J' Q* P
  83. module_param(bcnt, int, S_IRUGO);6 S0 s7 `% U, U. t' ]; x- g( c
  84. module_param(ccnt, int, S_IRUGO);
复制代码
  c8 M! H5 n5 C+ ]; o# H' o1 T

! Y# ~$ c/ u3 Z9 |# [      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
% @8 s( d+ w& y* s3 e3 @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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
" m" T! a4 s1 m) X/ i* F% m9 d     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。9 R. s$ ]1 m- `

! \$ v$ u6 L. F0 [; O
( T; I4 U! h6 S3 r: \1 O
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-1 15:35 , Processed in 0.039087 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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