OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
! m( G+ @. T% k# S9 r. V( x; `  |
  1. [code]EDMA sample test application1 K5 R+ @6 S3 C- F% b
  2. /*# k2 x3 U- y4 ?3 a: A" I
  3. * edma_test.c
    ) c, _; r$ O9 L4 x: g* J: G
  4. *. N' ?& O" E( J& c- [/ s
  5. * brief  EDMA3 Test Application
    ) x1 b5 b8 z! \' C( m5 M" h
  6. *
    3 [. g+ ]- G$ N! @  Z
  7. *   This file contains EDMA3 Test code.+ D  x) D4 Q* H! U3 Z& c
  8. *( k  v% E" i0 M: K: p
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    * }( @' S& Y1 S/ V
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT/ q: h9 r( H: K& f+ p( i
  11. *         TO CHANGE.( {- ^8 `, A9 I9 ^+ d% o6 j
  12. *
    : ?+ a. Y2 G$ V
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/- U: P1 L( G9 R3 d; U  p
  14. *
    1 D$ Q+ G8 u* U( d
  15. * This program is free software; you can redistribute it and/or# E( g. ?8 M# }2 }4 `  L
  16. * modify it under the terms of the GNU General Public License as
    ' B' |5 |5 l0 \$ m( l. B" F, q. ]
  17. * published by the Free Software Foundation version 2.
    0 P) u& N& U9 d( M3 s
  18. *
    , T* H9 ?" z. {$ C: f/ c3 ?' j
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ' N% G$ N% f/ V7 Q% j/ z
  20. * kind, whether express or implied; without even the implied warranty
    % |: A# m( H% V! [1 U! g
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ( a- x( x( {  X( B
  22. * GNU General Public License for more details.
    * b% F+ T1 ?9 Z: ?1 w& |
  23. */4 Y0 p$ D$ m4 ?, e. x( F) V

  24. , b7 r  Y# b& G! G- }& E
  25. #include <linux/module.h>
    1 Z* f6 D# p& h% k- s1 S# b4 q
  26. #include <linux/init.h>
    1 u; A, n& \6 y: j, l
  27. #include <linux/errno.h>) Q3 Z. T$ d6 l8 s# o* i
  28. #include <linux/types.h>. k) V; ^0 Z* a+ X3 d; a
  29. #include <linux/interrupt.h>; c4 c, `$ k8 t9 c$ w! n$ o
  30. #include <asm/io.h>7 M' P- J1 A. P, ?' Q; }
  31. #include <linux/moduleparam.h>) q7 Y6 B" `; q% d! R$ U" Q8 S
  32. #include <linux/sysctl.h>3 X3 e9 {% S- t" j3 O
  33. #include <linux/mm.h>7 B9 [; j$ e9 }& s8 U
  34. #include <linux/dma-mapping.h>: \# ]% ]+ H& \( R1 a  F" ?

  35. ! {1 M, A. k' X4 N; g- q$ R
  36. #include <mach/memory.h>* i6 {) x# P0 d/ Y* I7 K
  37. #include <mach/hardware.h>
    % K  S  k4 G9 r( y. P0 E
  38. #include <mach/irqs.h>) \; y. [% J7 P% G; u4 @
  39. #include <asm/hardware/edma.h>' O! R+ o9 @( X% H. \

  40. ) p% I+ Y2 P9 j* i' G% {
  41. #undef EDMA3_DEBUG0 j/ i& _7 ~: r8 z; n: L' p8 l
  42. /*#define EDMA3_DEBUG*/
    7 o& B8 E9 T# X/ [

  43. ) x" J7 _5 Z$ i, K' _9 `
  44. #ifdef EDMA3_DEBUG
    $ M7 @& j' \+ c! w2 c
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    - I) `* x' U- {4 ~8 j$ H
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    + H1 I  x0 I# r6 B, X8 P# \, f
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)  x6 v3 r; G9 L
  48. #else7 b. y  v" t- H6 e; i& v8 [
  49. #define DMA_PRINTK( x... )6 [+ H# e* J/ t; I  G: z; I( G
  50. #define DMA_FN_IN  @+ |* _. \1 ]: H# Y
  51. #define DMA_FN_OUT( e$ c- s! F+ X+ r+ S0 g; a* H  A/ a
  52. #endif0 ^# \$ A" q9 M: P: N9 E

  53. & V# m5 Y4 B6 p! j
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768), l  D9 D0 C" k
  55. #define STATIC_SHIFT                3# E) s  W& U& d8 }
  56. #define TCINTEN_SHIFT               20+ p& ]# x9 H0 s% O
  57. #define ITCINTEN_SHIFT              21
    6 B& s6 c8 q& y  Z5 l
  58. #define TCCHEN_SHIFT                22$ R3 _* y1 Y3 z  p$ r
  59. #define ITCCHEN_SHIFT               234 ^: F4 P) j+ I/ V$ x
  60. ) y( d3 i2 C1 F0 P
  61. static volatile int irqraised1 = 0;. Z/ N3 ^$ T" f$ g+ B
  62. static volatile int irqraised2 = 0;# c; |: g, E( l- }

  63. 4 X! M( U" I. v+ I9 k
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , w1 R& o) L6 P0 z8 Y
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 {/ Z7 y3 l1 v% {& U# }1 N
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , F$ e" u1 a; m" f

  67.   A8 G  h" r1 I$ u# S
  68. dma_addr_t dmaphyssrc1 = 0;
    9 a$ ]8 o" g9 Z, z$ ~$ k2 D$ Q0 O0 e
  69. dma_addr_t dmaphyssrc2 = 0;5 u  j3 [' o1 d$ o0 n  |" b
  70. dma_addr_t dmaphysdest1 = 0;# G+ ^) C0 t0 w9 t
  71. dma_addr_t dmaphysdest2 = 0;$ g" {% ]# Z2 j$ J$ L, T1 b

  72. ) ]7 y2 e1 C7 R
  73. char *dmabufsrc1 = NULL;
    ! _0 Q2 `5 z- b, y; F9 @
  74. char *dmabufsrc2 = NULL;
    + g, o* y& W0 G3 ?% I$ L! m
  75. char *dmabufdest1 = NULL;  X: j+ h: b8 L  y: a2 g
  76. char *dmabufdest2 = NULL;
    6 q6 I9 [! o! O; r6 X

  77. ! r6 q" C2 k6 i8 `0 i/ P
  78. static int acnt = 512;
    - ?/ D: P+ z6 X% K* H% D  I% s: N2 }9 u
  79. static int bcnt = 8;
    & m; I! b3 n( |
  80. static int ccnt = 8;
    0 _- n( @7 F1 r8 m: K9 V( E

  81. " G& p: J5 i1 ?+ s
  82. module_param(acnt, int, S_IRUGO);
    4 e) a5 U, ]+ n9 C' m5 v
  83. module_param(bcnt, int, S_IRUGO);2 j) C4 \3 g/ l) g4 L( N8 \
  84. module_param(ccnt, int, S_IRUGO);
复制代码

( Y8 W" M, l" h. {6 L
( F5 O$ S& o% z$ I8 k  R+ z      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用* v) m! `2 L! ]. r1 z* N5 G
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。$ H. Y4 ?3 |, K/ D
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
4 m6 F; x  D# |4 o8 \$ y# z2 ^& J+ R  G& t) L& Q! v

" s5 A2 m' z' N& t5 c8 Q8 X& ~
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-14 04:37 , Processed in 0.038268 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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