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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
( H  [$ m) w: V- B* ^, x+ h# c
  1. [code]EDMA sample test application
    ! b4 E5 f" W6 b$ y4 T9 C: h# G) h  h+ V& o
  2. /*- y% }5 `( X! {* j& q5 Y
  3. * edma_test.c
    7 W+ X# R$ W3 L, _5 B
  4. *4 F: J  B4 \# r2 N
  5. * brief  EDMA3 Test Application
    2 ?! O6 J; a( O3 V: T
  6. *
    / z" E% O$ ~$ y" v
  7. *   This file contains EDMA3 Test code.' E! y* A: M5 C# ?
  8. *
    0 e2 C. H/ o, {' V: c/ f
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
      S) C- x& B& w; a3 G2 {
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    : A  [9 z# a5 \. ]/ }& V% W" p- p
  11. *         TO CHANGE.
    . \4 ]1 ~  K* r0 Y" X  n( ]* L; x9 \
  12. *7 V" z" J" y: K
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    # \$ t+ z4 @5 X! x# A8 ?" F
  14. *7 R! v* X) w8 S" F
  15. * This program is free software; you can redistribute it and/or6 l! J- z1 U; Q! h5 X0 I
  16. * modify it under the terms of the GNU General Public License as
    $ w  l+ s4 P, @- ]
  17. * published by the Free Software Foundation version 2., [, B7 p4 s1 e" U
  18. *1 a9 D1 g, f( z# G- q
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any* ?& C0 v# e! D! S
  20. * kind, whether express or implied; without even the implied warranty
    8 o; ?; {2 f: Z* c  `
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ' B- q8 @, @9 q# Y
  22. * GNU General Public License for more details.
    1 L- m) ~* K; i5 Q- `1 {
  23. */
    ( X* F+ P! _( W  A/ y

  24. 6 o+ C  D7 O: y2 Z2 w8 x
  25. #include <linux/module.h>( P1 y$ c/ n* W1 E
  26. #include <linux/init.h>
    : ~+ ?& y, x6 g. Q0 W; F
  27. #include <linux/errno.h>
    4 k  n5 o5 r- v  g) @  T0 U2 W
  28. #include <linux/types.h>! q6 i" B" k9 j) d, _$ s$ {
  29. #include <linux/interrupt.h>/ i7 b- u7 N& e+ M2 u( O
  30. #include <asm/io.h>
    / ?2 N4 K* Z/ s& B3 S0 v
  31. #include <linux/moduleparam.h>
    0 F( f0 n! T6 ?. D' d
  32. #include <linux/sysctl.h>8 e+ d- q' R; p# a& C% Z6 z
  33. #include <linux/mm.h>) C" ?) F  W3 f" }
  34. #include <linux/dma-mapping.h>
    - S. i) D3 i" B8 l$ d& i# g
  35. + X9 m9 P- p$ I$ T4 Q3 Y
  36. #include <mach/memory.h>
    ' j6 E5 L  m5 U& g3 I' g$ g
  37. #include <mach/hardware.h>
    / S0 G$ v$ D5 C& a4 W! I
  38. #include <mach/irqs.h>
    8 y8 z. S; }. N  |8 @0 a
  39. #include <asm/hardware/edma.h>, c7 r7 T5 t& t  a0 j- V' C

  40. . a/ G5 `3 K: i. Y5 a
  41. #undef EDMA3_DEBUG6 F  r# c; ~- q+ R( ]& I. s
  42. /*#define EDMA3_DEBUG*/8 @9 k4 w* Q+ L0 u) ?

  43. ' a; o, S3 X% d, n. [% G
  44. #ifdef EDMA3_DEBUG
    4 ^2 _9 z- s1 |  i0 z4 W
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)' y3 n1 N  N& V8 }
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)3 z8 t% q, p( \; R# ]9 T: b, j
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ; W0 J1 h9 ~8 K1 }& v5 Q8 J
  48. #else
    ; z+ {; R/ [$ s3 C2 J# [
  49. #define DMA_PRINTK( x... )6 R# @2 @7 `0 [# o; m4 R
  50. #define DMA_FN_IN( K) F* |  m; P6 G/ }& W- |
  51. #define DMA_FN_OUT
    5 r  x5 S7 ~# g* n" Q+ G, I. \
  52. #endif, ~( t5 Z; ?7 C8 K
  53. , D4 Z9 P9 Z  ]( C0 _6 S( A+ [
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    . H1 W; ]6 O1 {/ }8 L' w; g5 {
  55. #define STATIC_SHIFT                3
    * ?9 q9 Z4 v9 d# U
  56. #define TCINTEN_SHIFT               20
    1 S! M+ Q% t2 B6 |8 x( H
  57. #define ITCINTEN_SHIFT              217 X  H5 ], J$ E. Y- P
  58. #define TCCHEN_SHIFT                22
    3 p8 O# r, O# E8 {( M# E
  59. #define ITCCHEN_SHIFT               23
    # l- s7 c/ U; R4 q4 |- ]( H

  60. 8 T- f1 Z8 _* E6 N' r
  61. static volatile int irqraised1 = 0;  b5 J: J" X+ ?3 n; X
  62. static volatile int irqraised2 = 0;8 ~, e+ X" \+ q( P8 \4 W

  63. $ C% l2 I  `- V" `) }
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      \! P) T( m$ d% ~- x' X8 q' D) L: p
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ P$ i  z3 ?% H# p4 G
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 T% V; Z! ?: r) F# i3 a8 l
  67. 2 O, H/ y6 D3 L5 [: `
  68. dma_addr_t dmaphyssrc1 = 0;' s8 o  x5 Q9 G8 {: l" _; Z) n2 d0 D. |
  69. dma_addr_t dmaphyssrc2 = 0;
    % G4 L5 O# }$ C; x( X: X
  70. dma_addr_t dmaphysdest1 = 0;1 D- M0 l" y2 T5 s. M% @1 R
  71. dma_addr_t dmaphysdest2 = 0;/ x0 o9 a3 {( a( `. J# f0 ]+ H

  72. : }# r% K( ], }9 B/ O* d
  73. char *dmabufsrc1 = NULL;7 [9 x8 q* D/ P9 m# G) n6 K
  74. char *dmabufsrc2 = NULL;$ j: C6 G* \6 p
  75. char *dmabufdest1 = NULL;3 D: e! B- P) S0 W+ z
  76. char *dmabufdest2 = NULL;, O, {! z% C$ J2 t
  77.   S$ Q, c! N5 D2 [7 F  c
  78. static int acnt = 512;
    1 r, d/ Y* a0 d1 ?" V
  79. static int bcnt = 8;
    0 r# i$ [+ d* |
  80. static int ccnt = 8;
    ' w1 [/ r6 D8 v$ d$ F. k/ T

  81. ! |* {' M. K3 x
  82. module_param(acnt, int, S_IRUGO);- p1 S8 d0 A6 U/ B" q/ e0 Z6 ?' q
  83. module_param(bcnt, int, S_IRUGO);
    / E* E" i& W- f2 i$ v. C+ D8 G0 t( q
  84. module_param(ccnt, int, S_IRUGO);
复制代码
2 T6 d, m, e6 ]
. y- ]' K, K% P
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用- Z! N; N% h, |* [. {+ q6 {
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
) K- ]' G. Q3 s+ c/ v& k0 D     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
8 Y9 B& c& i2 F- o
% B2 k6 T9 `+ y! E' ?8 n3 S/ @( H: ?- H8 B/ N+ n3 j# |" L
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-1 03:03 , Processed in 0.039270 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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