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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
7 I+ q% @0 r& [- _1 \
  1. [code]EDMA sample test application
    ( K) k1 n" T4 K1 M% `
  2. /*
    / j* [% _% H- ]( m" d! |
  3. * edma_test.c
    9 X( J8 E$ U4 C* ~; V7 x! `5 J6 f! c
  4. *
    . n  S# I1 c9 S9 p; v
  5. * brief  EDMA3 Test Application
    & Z( V. [  C+ L4 `& I1 H
  6. *1 ?4 b9 W2 a* @+ G  ?8 `
  7. *   This file contains EDMA3 Test code.# g) Y5 P" X+ e0 t) L3 k
  8. *
    7 u5 R* D! L) ]" r3 Y+ E3 U) D
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    , m- b& b2 r. T: R, y8 a7 b
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT1 L8 A% M* V0 g& ^4 m9 g6 ~
  11. *         TO CHANGE.6 p& @0 k0 r5 y7 k
  12. *1 M- r. {/ R* O8 i# Q  y
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    / ^( S: m5 P4 W/ D' E0 ~$ N
  14. *8 K. l4 ~' b  a3 O1 T. I
  15. * This program is free software; you can redistribute it and/or
    5 v3 F2 H8 _5 ]4 ^
  16. * modify it under the terms of the GNU General Public License as, ^$ U& P3 }# w( J- H
  17. * published by the Free Software Foundation version 2.0 g' w$ q% o: s% _8 Y
  18. *" N3 p. O2 w/ \' y. {% q
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any$ b; C0 U" I: J9 d( n9 S# n
  20. * kind, whether express or implied; without even the implied warranty+ {8 {. c! }* Y) Y* e. P
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ( t4 \7 j- C3 r) _7 z
  22. * GNU General Public License for more details.  U4 E: S) n' d1 K; h( i% W6 ]2 d
  23. */, v7 J. `* n! J+ D

  24. & d& y9 T9 I# \1 u. q
  25. #include <linux/module.h>
    + M3 P( x' p  i. ~+ h, G/ y
  26. #include <linux/init.h>
    . Q1 c% H- a, _
  27. #include <linux/errno.h>6 N9 T; ^- n5 J# a' _
  28. #include <linux/types.h>
    & I+ Z" r" c  p: q8 p
  29. #include <linux/interrupt.h>
    2 x9 p& y7 X" m3 z/ P( E
  30. #include <asm/io.h>- u) e- G: [0 r8 w$ d) z; Y' q+ S
  31. #include <linux/moduleparam.h>& q+ [9 }1 x, f' A( e) D2 H% S
  32. #include <linux/sysctl.h>
    " U0 Y+ h. R3 a  E9 g7 D9 F8 w
  33. #include <linux/mm.h>1 `6 {7 C' J/ J; [7 ]( C
  34. #include <linux/dma-mapping.h>8 l* y$ ?/ }7 Y, A8 s
  35. 8 X1 ?/ ~" ^9 ~. O9 i6 Z0 e
  36. #include <mach/memory.h>
    4 J) g( ^9 X$ Q
  37. #include <mach/hardware.h>9 n% h+ a+ j9 N. R6 l
  38. #include <mach/irqs.h>3 @9 Y( d2 n( y6 X* e7 Z
  39. #include <asm/hardware/edma.h>" U, ^, A1 N. f/ y; V
  40. - T+ ?& h  x4 Y/ m* m
  41. #undef EDMA3_DEBUG
    7 J- [6 B' a/ \* }! j# k& v  m* O) C! P
  42. /*#define EDMA3_DEBUG*/  E+ i6 D& z4 N" d

  43. : o3 r% V9 G' H
  44. #ifdef EDMA3_DEBUG6 F/ }* ~% @& m! O
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)0 G# M) F9 i. i, i# n( ?* U/ t
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ( n% ~9 z! O- x8 T; e
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)1 ^, t/ o6 Z& J7 R; H
  48. #else/ A% S+ X5 m( F7 U
  49. #define DMA_PRINTK( x... )' r) L/ D9 M  h2 W; g
  50. #define DMA_FN_IN
    ( c3 |5 I9 O, ]+ G& C
  51. #define DMA_FN_OUT
    . _& l& P. G% j6 W5 D5 H7 ~" Q
  52. #endif
    2 K+ K: u9 B8 R5 ?
  53. - S' \6 O- e% ?6 p( e- r
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    4 ?8 P' K7 Z5 G. }; v1 Y: {
  55. #define STATIC_SHIFT                3
    0 a- j2 n# J; C8 ^  E5 M8 T6 \
  56. #define TCINTEN_SHIFT               20
    : g( ?: O# h: \
  57. #define ITCINTEN_SHIFT              21
    . b, x! N* M. Y3 U5 z& P, d9 q7 n# q' O% q
  58. #define TCCHEN_SHIFT                22: L; o4 R+ V6 e( t$ p7 }- F
  59. #define ITCCHEN_SHIFT               23
    , Z* x# j! I# _6 Z9 n8 L0 r$ X

  60. " s- L( t: d2 j" |9 f! q
  61. static volatile int irqraised1 = 0;! ?: e2 o9 K* D
  62. static volatile int irqraised2 = 0;, k9 N9 @/ ^; s3 |
  63. 3 Y4 U6 l3 l4 p; B8 C
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : ?1 x0 }; q  }# W
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' L) H) [, i( G, P/ S. B2 l
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 A( C, e. o' s& R6 t

  67. 5 a6 Y  ^7 w6 N! o& L) N
  68. dma_addr_t dmaphyssrc1 = 0;7 A3 Q( n$ u4 C+ u
  69. dma_addr_t dmaphyssrc2 = 0;
    5 S; h4 x' t# N& W- E
  70. dma_addr_t dmaphysdest1 = 0;
    6 Q* q* L' _+ T. U& j: p: u9 z
  71. dma_addr_t dmaphysdest2 = 0;
    + @) f4 v8 W3 ^4 \4 w" B5 _

  72. + `( U/ a) r- f
  73. char *dmabufsrc1 = NULL;& X0 J; {! ?9 H% @5 F; w* g; S
  74. char *dmabufsrc2 = NULL;
    2 w8 P. D8 u, g- i
  75. char *dmabufdest1 = NULL;
    2 ?8 x5 k# H4 D* @) Y
  76. char *dmabufdest2 = NULL;
    2 a9 K. j6 Y# l4 O
  77. " O3 X  a) w3 C/ U% `4 K: ]
  78. static int acnt = 512;8 ~9 N8 N, i8 z8 r1 F3 i8 [
  79. static int bcnt = 8;
    * q% ~; i" f& N3 R$ J" u2 ^/ x
  80. static int ccnt = 8;1 m6 Q# X0 p% P# |  ?

  81. ) ^3 V+ F- b% k$ a* R1 Q- m
  82. module_param(acnt, int, S_IRUGO);# ~, U) `; o! ~5 L$ A: D' g
  83. module_param(bcnt, int, S_IRUGO);' r4 M- q1 H2 x7 V+ w; ^
  84. module_param(ccnt, int, S_IRUGO);
复制代码
6 \+ \. m+ {) q2 `1 c5 A( {

* f! |  N1 h( h. o4 R) N      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
5 w5 a" `- ~2 [" Jarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。  C2 b& G' P) j; W
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。: L/ m( m3 b2 V8 @( {9 x% G5 v

. _6 H; A$ k/ m
; d) z) B  b% W
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-10 22:30 , Processed in 0.037638 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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