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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 & f# j) p' Z) G' u6 U. ?
  1. [code]EDMA sample test application& m0 O! u/ E5 H! N6 h5 v
  2. /*
    0 B. E) L5 S. p
  3. * edma_test.c8 L7 d; H3 _* {+ C( D/ a, {
  4. *+ E" M' T4 N- j
  5. * brief  EDMA3 Test Application1 @1 d7 k7 {8 F& w
  6. *5 i1 A/ _; r& z. v" K0 m- S
  7. *   This file contains EDMA3 Test code.
    : w! Q1 @+ l6 x4 a$ v
  8. *
    / h9 Z$ S! t% C7 O$ a
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
      O; r' K5 b, K) [
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT. S+ X% e. \0 P* Z% }' z
  11. *         TO CHANGE.
    ) `% T8 Q/ T- S4 ~0 l( R
  12. *
    ) K4 A- l0 t( J$ a* ?; F3 v$ n$ P
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/: l5 }: o$ L) h' w; k8 O
  14. *: V& _/ m7 g; Y: J* U
  15. * This program is free software; you can redistribute it and/or: M7 @! Q1 O& d% W" {! z. [
  16. * modify it under the terms of the GNU General Public License as
    0 w  \: R6 v  F, ?3 z; K# ^0 ]
  17. * published by the Free Software Foundation version 2.
    1 w- x1 _( a0 L- j! D" x
  18. *
    5 d" d3 F* K4 J2 _' x; q
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any/ `; f' R% _! V+ z
  20. * kind, whether express or implied; without even the implied warranty
    * k) a& {' q+ Q/ o& h
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the3 k4 `% y5 }) z! \
  22. * GNU General Public License for more details.2 t$ p0 l& ]6 L: w/ A
  23. */3 _& \  _# B% h1 ?2 |0 C% @
  24. . o  Q! i) r: O5 m9 M9 Q& f; S
  25. #include <linux/module.h>- ^/ ~/ q5 @9 ?! o/ A3 I
  26. #include <linux/init.h>
    8 X% ?" U/ v! G2 n$ P6 J  U
  27. #include <linux/errno.h>3 c- B* [' t" s0 O; o, z
  28. #include <linux/types.h>0 _* s, P7 N, |8 d/ u
  29. #include <linux/interrupt.h>
    + L8 B0 U& h7 d# t% K, c
  30. #include <asm/io.h>( n$ ]2 u0 p$ o+ |* o: m% L
  31. #include <linux/moduleparam.h>4 }3 l2 T. B  v! I. s' Z0 X
  32. #include <linux/sysctl.h>( U) h) U! y+ w: ~
  33. #include <linux/mm.h>! q( L; E$ h- w& ?( i  A, T  ^% _
  34. #include <linux/dma-mapping.h>" D% l0 Q4 v; w1 a  u( H

  35. ) B8 n0 _$ K' f: u7 J+ t
  36. #include <mach/memory.h>9 ]1 i7 ~& G  k4 u
  37. #include <mach/hardware.h>' A5 v$ X+ i6 Z6 n- @8 h7 `+ K
  38. #include <mach/irqs.h>0 t( Z( n2 D% M. x9 P: |
  39. #include <asm/hardware/edma.h>2 `8 p& j% F& p4 a: a0 z

  40. 5 a2 k+ d& a$ U, G
  41. #undef EDMA3_DEBUG! _" C5 C, Y) M" ~* L2 C3 X
  42. /*#define EDMA3_DEBUG*/
    0 I5 m" s' |7 m  F  J

  43. + g' Z: j' R+ ^
  44. #ifdef EDMA3_DEBUG) S# ?; G) L! i+ i/ g4 b8 [
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)0 R- G; N. {4 P9 \% q* n3 ~. O5 U
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    4 A" j/ w9 [# z" h
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ' @- @# H8 o) G" D/ s- ~
  48. #else& A( J9 K8 q8 S3 U' u3 U
  49. #define DMA_PRINTK( x... )7 }; E" I3 y! D' k# H- y) p
  50. #define DMA_FN_IN& J3 w, O) y. _& ?6 ?
  51. #define DMA_FN_OUT' ~! g0 D5 V7 l: ?# |. y7 Z2 s
  52. #endif3 u! h; l  E5 @- Z* T- R

  53. ' }& F5 |& K. ]- t2 [
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)) T8 s' h& \( u2 F
  55. #define STATIC_SHIFT                32 b2 D( G4 `6 e7 `! ~8 m
  56. #define TCINTEN_SHIFT               200 Q* l( ~( y! r. U6 |
  57. #define ITCINTEN_SHIFT              21
    7 I' q/ u  r' ]4 Y+ _0 N$ H' x9 N
  58. #define TCCHEN_SHIFT                22
    / ^" R- B2 m) [" B( U! U! I
  59. #define ITCCHEN_SHIFT               234 _5 R1 Z- E& Z( i
  60.   \; }3 a5 o* J3 y. o, Z0 ^/ P
  61. static volatile int irqraised1 = 0;5 e( Q8 E, Q/ P
  62. static volatile int irqraised2 = 0;- ]7 x. |+ N  B# y6 {

  63. 7 P7 [6 u5 T2 ?* D' f
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! V( ~$ q) X+ u* A
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* g1 i. r; N+ p
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! T, J: X3 R- D7 ]$ k# M
  67. / y5 b/ q- F: e) Y2 q
  68. dma_addr_t dmaphyssrc1 = 0;) e9 Q) }" [( K
  69. dma_addr_t dmaphyssrc2 = 0;
    " v2 H4 a- I2 w2 p8 Z
  70. dma_addr_t dmaphysdest1 = 0;
    ( q1 H1 x4 h2 c! ?! N0 M
  71. dma_addr_t dmaphysdest2 = 0;5 q# ?9 U0 L0 M2 h0 Q% e
  72. ' y5 M# H3 t: I0 i1 X+ G( E0 B) P( y' Q
  73. char *dmabufsrc1 = NULL;
    & N1 g! _: h+ b, b' p8 m3 S
  74. char *dmabufsrc2 = NULL;* w. f: ~& R5 l2 ^7 B# v
  75. char *dmabufdest1 = NULL;; s+ q; O/ b0 R  W8 f
  76. char *dmabufdest2 = NULL;4 l" J8 U" P" b2 X
  77. / T2 C/ h3 L5 L+ C( K  o
  78. static int acnt = 512;& r" q# }* R( O' w
  79. static int bcnt = 8;. h  u" y( r$ a; W  _9 h" h1 M0 @* ^
  80. static int ccnt = 8;+ h, [$ Q8 {$ x$ P" b+ K( a8 a
  81.   A# s% ^1 m% m2 k% o. h. M- O1 t
  82. module_param(acnt, int, S_IRUGO);
    % A$ f6 u9 e% Q: g1 f' i9 q
  83. module_param(bcnt, int, S_IRUGO);  Q3 l) G+ t" g8 N2 N
  84. module_param(ccnt, int, S_IRUGO);
复制代码

9 e# G# B7 F# q) M! b5 ^& A, L1 X& x( |. O
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
8 y% d2 c0 ^: l3 s$ U: |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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
6 s) z; T- O9 p4 M+ ?5 N     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。7 l" E( E9 P6 \5 L" g
) d) m) p" \" D
& E- S2 i  V! q
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-21 08:59 , Processed in 0.046689 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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