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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 7 X( }9 i. N4 G3 T6 q7 {7 Y
  1. [code]EDMA sample test application
    5 e5 I: ?' {3 ?+ u
  2. /*/ u) [( r6 Z! [; y
  3. * edma_test.c
    8 x: n6 d4 f1 N% A0 A9 [
  4. *; D6 n& F6 a" G4 D
  5. * brief  EDMA3 Test Application
    ) Q2 ?1 }$ y5 y* @2 q3 S  Z! Y% Q4 [
  6. *1 Z9 b& ~, s9 i( s5 z
  7. *   This file contains EDMA3 Test code.
    , m% s, R, @$ y  Q: @# m1 W
  8. *
    " ^2 S6 `+ }1 i! J/ |. B
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    % z5 t; H/ y& O; G# ?1 S
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT6 V7 e! G( d$ l$ h7 H! s
  11. *         TO CHANGE.+ c! X+ h* I0 A% K/ o( D
  12. *
    6 v( ~0 \; g4 `  C( l5 L
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/; z) l+ [9 @( `# p. f+ m
  14. *# R# V, _# c  \% w; J, D+ O1 D+ `
  15. * This program is free software; you can redistribute it and/or; b2 {3 I& V/ Q$ N+ H& L
  16. * modify it under the terms of the GNU General Public License as2 L' x5 {# J+ k+ e2 e3 r* M
  17. * published by the Free Software Foundation version 2.
    ! P7 \9 J6 j% E% b3 J  K
  18. *" W$ S( @3 G1 F  S$ n( @3 u* U
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    " m) h: Z* n* V! t/ b; [' F
  20. * kind, whether express or implied; without even the implied warranty# l9 h+ b, Y; m' X) `
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the. K3 u! J/ q  }" u+ I
  22. * GNU General Public License for more details.
    8 Q; L6 i0 {& a9 Q3 B* D# C
  23. */
    ! x* a( S) U/ b: W( s0 Y9 Z" x

  24. 3 `5 X8 D. I9 K+ s1 S/ L
  25. #include <linux/module.h>6 S8 N5 m+ u) G  m6 Y. v7 U
  26. #include <linux/init.h>9 D/ x$ g+ C' B6 F9 ]4 B
  27. #include <linux/errno.h>
    : T7 X% ?1 P% n) D
  28. #include <linux/types.h>
    ( w. N, d  o& C7 v- l
  29. #include <linux/interrupt.h>; T& n. I" A- J2 T# G# Z
  30. #include <asm/io.h>+ {% o5 R8 ~  y
  31. #include <linux/moduleparam.h>
    + J! L* n" }3 S
  32. #include <linux/sysctl.h>
    7 |' {- H3 h* _7 N6 ~
  33. #include <linux/mm.h>* j  h2 d1 q5 A# _- r6 E: w; e; n
  34. #include <linux/dma-mapping.h>
    0 {, W8 x! k2 Z% C2 N4 N
  35. 2 p& L* g4 M" {& i" @
  36. #include <mach/memory.h># p, j0 M) w1 ~% W
  37. #include <mach/hardware.h>
    ( g; {" o' ~7 J: b
  38. #include <mach/irqs.h>
    ( @8 g* T8 z# ?7 m( _% F
  39. #include <asm/hardware/edma.h>
    7 {/ E6 ~5 z6 I0 S' ~+ a
  40. % T# f; ]6 a/ ?7 A( Z& _1 P" F. [
  41. #undef EDMA3_DEBUG
    5 a/ L) B3 E6 ]. a. _5 P( ?, w
  42. /*#define EDMA3_DEBUG*/5 p$ W) m1 o9 {9 M! V; o; [

  43. 1 b# x4 \$ O- R* v$ y2 `# c% v
  44. #ifdef EDMA3_DEBUG
    ! \+ M6 {" ?) @9 ?. @3 r# l
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ' V. X7 a0 r6 O) ^
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)" f% ?( T7 t/ |* l- M! \$ B
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    2 ]+ S6 H) m( q/ Z: V0 ^
  48. #else
    $ Z2 A; z! i3 Y& X( X  i
  49. #define DMA_PRINTK( x... )5 x" X, t# r) Q! e! r/ b
  50. #define DMA_FN_IN
    4 }+ ]) k) w5 `
  51. #define DMA_FN_OUT
    3 Y3 A) m4 \" {! y' [2 @  W: S; D3 w
  52. #endif7 [) E, Y8 H( c  G1 p& ^

  53.   k( H$ J$ m: }
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    2 {9 H+ a, }8 F/ n' t
  55. #define STATIC_SHIFT                3
    ; `9 q# y5 r: d, j
  56. #define TCINTEN_SHIFT               20
    * ?) t* ]) F/ i
  57. #define ITCINTEN_SHIFT              21
    + _( N; |  X4 e% D2 e6 ~: z
  58. #define TCCHEN_SHIFT                22' b- p7 W0 Y+ Z6 y& P
  59. #define ITCCHEN_SHIFT               23
    8 d* O3 y5 V3 R! C! q; R, X5 C
  60. 0 m& E5 a' q  r/ f5 r3 x
  61. static volatile int irqraised1 = 0;
    4 i) @# W. U: Z2 M6 y4 V6 x  S
  62. static volatile int irqraised2 = 0;1 V" L4 p8 l- ^0 a4 O( E
  63. ' |' t: e; B3 C! l4 c5 a( J4 j
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- m" [  g, m7 v) b2 J
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: N4 V. y, A+ d8 E2 J! X/ g
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 i( ~" Z  x8 B; F
  67. 5 }' q) W$ F- ^1 m' U: \9 Z! D
  68. dma_addr_t dmaphyssrc1 = 0;
    ' u2 ?/ X  l4 `- ~, d5 G8 N
  69. dma_addr_t dmaphyssrc2 = 0;8 ]7 z3 a$ \( r, W: n
  70. dma_addr_t dmaphysdest1 = 0;
    ! q& o/ I/ t  f% `7 N6 V
  71. dma_addr_t dmaphysdest2 = 0;
      j; R$ F5 q! s1 S

  72. 1 w3 b. I& p+ ]. X. m% [7 o/ [
  73. char *dmabufsrc1 = NULL;4 {! f* y. z8 X( B0 k
  74. char *dmabufsrc2 = NULL;
    ' A* v9 w. b3 o( c' ^
  75. char *dmabufdest1 = NULL;
    3 |: [5 H" \6 k5 q# P; |4 t
  76. char *dmabufdest2 = NULL;* a; Y# B* O( }  c  S; T
  77. ; m0 G- D+ b, R# L: t8 c+ ?8 V
  78. static int acnt = 512;
    % [2 X# l2 M' J. P
  79. static int bcnt = 8;% [6 k9 @( r- P" {6 [1 c
  80. static int ccnt = 8;% ^8 q9 ^& h! d( X3 S
  81. 3 }  v* f- y. A1 `/ A5 n
  82. module_param(acnt, int, S_IRUGO);
    ! L" l7 j; V! R( q% y) C3 N! p
  83. module_param(bcnt, int, S_IRUGO);& P7 B$ l8 b. \, ]! M! N
  84. module_param(ccnt, int, S_IRUGO);
复制代码
) [- c  M7 \7 V& N, w* @1 w
  C  J- R2 ]' [
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
, S6 q3 ?$ c; M" F. d) H" 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。1 f$ |1 r/ O/ t: T+ \1 \; x! ]* }; g, O
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
9 d" ^) u1 j+ B( q) Y
% T5 w3 g5 B5 S$ D3 L# I1 d* U, V, ?) _7 e
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-13 23:51 , Processed in 0.039728 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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