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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
0 [4 B% s  Y3 `+ M9 q* N: [
  1. [code]EDMA sample test application3 w+ i/ f4 o% V
  2. /*) s  L& U2 q2 V/ n4 o0 m6 h
  3. * edma_test.c
    ( g8 p! K" ]9 o  H- u8 h
  4. *
    ( o! I) {) I' g7 S2 W
  5. * brief  EDMA3 Test Application  A) N9 t* K' i) x7 ~" e1 Y' v
  6. *
    + e* h% ^5 [8 V' T) r" U- r; W
  7. *   This file contains EDMA3 Test code.9 V3 r% C: I0 r: K  q2 V/ x0 X) j
  8. ** p% E5 ], T, }  h2 c2 ^) D
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ! ~0 O  C2 q; _! r: l: T
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    $ \3 @" A( y0 E
  11. *         TO CHANGE.
    . m3 g6 O) Y& a- o
  12. *
    . Q* L" D5 z. l0 ~+ n3 k/ v
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
      Q5 x, ^8 x. K8 E/ D4 g
  14. *
    $ H) w8 I5 Q3 \( b
  15. * This program is free software; you can redistribute it and/or
    7 Z2 V* J; s0 l( g! G1 a
  16. * modify it under the terms of the GNU General Public License as
    9 b& m" T2 o( Y) {
  17. * published by the Free Software Foundation version 2.
    : k' F' ~6 J/ v/ H
  18. *
    8 |) h. Q- D% I, \
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ) `/ h* ], b) p8 |
  20. * kind, whether express or implied; without even the implied warranty) ~% m) l& p( O) ]8 G: s. h2 H
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the; v9 D. \2 z, S8 |- K2 O' a
  22. * GNU General Public License for more details.
    / b) U8 X/ |6 H6 f
  23. */+ Q- ]6 M( I: O, w$ S+ V

  24. # K# Y+ u5 X/ {4 C$ J+ t
  25. #include <linux/module.h>4 R  q/ p" P5 G- Z/ v; ~
  26. #include <linux/init.h>2 E# k% w' I! l9 e; W( Z% M( H+ D
  27. #include <linux/errno.h>
    ' N' E* M4 b  L, o' n
  28. #include <linux/types.h>
    - k" E4 s8 ]3 w6 R5 _/ o
  29. #include <linux/interrupt.h>4 g4 ]+ V# m# X( C1 Z! e
  30. #include <asm/io.h>" ~" M0 m- R; p! G9 S
  31. #include <linux/moduleparam.h>" w" Z% n# R: R! u, c0 `
  32. #include <linux/sysctl.h>
    & M4 \* }1 t& k; f! w
  33. #include <linux/mm.h>
    " x3 X/ G; l! p& H3 ^6 }1 f* X  a5 e
  34. #include <linux/dma-mapping.h>
    / d! k1 d+ ^/ T2 u' z0 h) f6 R4 ]

  35. 6 T( x! T5 m8 }5 o' _
  36. #include <mach/memory.h>7 i' M* z% i8 w, ^) n% w& B
  37. #include <mach/hardware.h>
    ) e( t# r1 v/ e1 o$ z
  38. #include <mach/irqs.h>
    1 L: L# p4 X0 G% y: ?& k- u, \2 b
  39. #include <asm/hardware/edma.h>
    " l1 Q$ i2 \$ Y2 C
  40. 5 f6 F' x9 S, H" n6 Y0 R; [
  41. #undef EDMA3_DEBUG
    - @& K. k& E* y7 T% f! x
  42. /*#define EDMA3_DEBUG*/* E2 k: u" ~- }; A2 l3 ~+ }
  43. / x) `; a6 W. [9 N* D
  44. #ifdef EDMA3_DEBUG8 }* T. ^; [  w" }! {
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    5 {( b+ r( z4 C- |
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ) B& x. e0 ~* y. p
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)( G# }+ O3 n( S1 J
  48. #else1 c! q( G! Y, J1 K( q7 X% A
  49. #define DMA_PRINTK( x... )
    & i- _9 j8 r$ ^
  50. #define DMA_FN_IN
    - q0 J! _5 [" W
  51. #define DMA_FN_OUT% v2 @% m5 ?. U  c# @. h) _+ D
  52. #endif
    : W; [" k8 D" `, S
  53. ; {5 }( }# o: K7 C. W) C: J( N; G8 f, x
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    6 d. m$ B, F# A) k
  55. #define STATIC_SHIFT                3
    + ?' D9 i6 [* Y* U8 e9 j
  56. #define TCINTEN_SHIFT               207 n2 F) m, ?, ?" A$ ]
  57. #define ITCINTEN_SHIFT              21
    , ~6 n3 L+ N  T5 h3 a" o
  58. #define TCCHEN_SHIFT                22' }7 k/ c5 [$ B5 V4 c
  59. #define ITCCHEN_SHIFT               23
    . `7 V$ D4 N1 ^8 w( e3 C% u
  60. . _1 s- X5 L- m2 c- n+ d6 B
  61. static volatile int irqraised1 = 0;" `: g6 D* Z  q# \, H. L% i
  62. static volatile int irqraised2 = 0;, g+ p: ?5 W5 \& `* e- j( J
  63. 9 p' [! A- ~/ k2 y8 c) a$ r% W
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! E  m' `( M0 o3 t' W8 s
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! U# v3 k* O$ @( K+ ^6 m, t6 _' V
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + G& P+ k+ o% Q6 [

  67. . j. a  o4 b" i& H
  68. dma_addr_t dmaphyssrc1 = 0;
    0 T6 C% N5 v' z4 r
  69. dma_addr_t dmaphyssrc2 = 0;) M1 a3 K: t7 R3 K
  70. dma_addr_t dmaphysdest1 = 0;
    ' g. }. R% d( Y, y
  71. dma_addr_t dmaphysdest2 = 0;
    8 q0 `; `: m0 C" \7 E* N; c
  72. + ]% c" w1 M  l8 r. d$ |
  73. char *dmabufsrc1 = NULL;
    2 |5 r1 O4 u) ?# u+ \" i( ~1 n2 Y
  74. char *dmabufsrc2 = NULL;
    $ P: M- ]# `# ]  L
  75. char *dmabufdest1 = NULL;7 }: [0 Z7 C: X+ Z: x
  76. char *dmabufdest2 = NULL;
    9 Q2 h5 N7 C  ~$ ~
  77. : G8 u, A. O, S& l
  78. static int acnt = 512;
    % K& @$ [: j7 X4 H) h1 U
  79. static int bcnt = 8;; |+ m( A' @! ~
  80. static int ccnt = 8;
    + ~& A6 P2 F2 Q) f  G, t' U' q

  81. & r+ F3 ]- e/ }7 u3 B
  82. module_param(acnt, int, S_IRUGO);) N0 w2 x! ?8 T+ ]. q: U
  83. module_param(bcnt, int, S_IRUGO);
    ! }8 z! k0 Q* ^) h( L4 \' J) a
  84. module_param(ccnt, int, S_IRUGO);
复制代码

7 q8 H% V! o; \* c" a
; j* N  A9 F% O! _) [; X3 v9 Q1 X4 u      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
2 [% y! b( g) [; c' |5 l* @- barm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
" I4 n3 I, m( p- `     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。- }2 ^2 n; i  Z6 A! j
2 [+ O- Z( m6 d9 W
4 j8 M: ^' ^0 ^4 j. Z- C) c5 n) u  a
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-14 04:03 , Processed in 0.043455 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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