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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 % E% K' A. m! N
  1. [code]EDMA sample test application
    ( d- }/ M  H3 r9 z( X
  2. /*
    + P, z) D- d+ n; d+ P
  3. * edma_test.c' F, P: f% o3 l- s( J
  4. *6 u# q$ s6 \" g4 z
  5. * brief  EDMA3 Test Application% x/ o/ y6 H6 q. p) K
  6. *
    3 D$ j) p9 m* L& m6 X
  7. *   This file contains EDMA3 Test code.* O0 m! O4 ~: T2 C8 ]! k/ e
  8. *
    4 A5 M- g) G. g6 s. s" P0 U! ~
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    6 E1 Y! U' \( j' J( ^; D4 }! }
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    2 [8 l& c6 ^# Z3 g3 O9 F& V& n
  11. *         TO CHANGE.; [* u2 n% h+ g
  12. *& a: j1 U5 c; j- t! j1 b; F5 c
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    0 y6 C0 N" P, T" _- x* R
  14. *
    " }: y) L4 o3 `& w# U: O/ H
  15. * This program is free software; you can redistribute it and/or
    + m6 W/ R0 Q9 _4 [; K
  16. * modify it under the terms of the GNU General Public License as
    - s9 \% c1 ?+ ~1 Y: p8 C/ b# I4 ^" m
  17. * published by the Free Software Foundation version 2.
    + C1 b- z" `# ~. X7 g
  18. *
    ) Y; J) v  w- }9 f6 H  v( i
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any6 [% N8 x- M( b. j2 f, Q
  20. * kind, whether express or implied; without even the implied warranty1 t# y: r9 r8 {9 Z
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    4 h" J8 K8 K- n+ e! O+ N
  22. * GNU General Public License for more details.
    $ F, V% e# M! G7 d- ?
  23. */) y  [/ W% Z+ x; ?+ q4 I
  24. 6 U- s, z5 o: L5 y6 k* W" d# [, i- R
  25. #include <linux/module.h>; O- Z$ n0 V, x. D! S: f1 ^! m# N
  26. #include <linux/init.h>. y  c. l. Q& ?9 ^7 u) Y
  27. #include <linux/errno.h>! A3 u# s8 G% S, H( w
  28. #include <linux/types.h>
    & \! \) M: b, e
  29. #include <linux/interrupt.h>
    # w* |  R$ L: e* u7 i' p
  30. #include <asm/io.h>/ }: V/ T1 p0 A
  31. #include <linux/moduleparam.h>2 p5 h* d6 I" `7 o
  32. #include <linux/sysctl.h>  l* z$ Y+ I# z
  33. #include <linux/mm.h>
    1 n% [" Q( Q! B& q8 D) E% ?
  34. #include <linux/dma-mapping.h># \  W* F/ e2 z( i3 s) R+ Z2 c* D
  35. . K8 `" }0 E4 b
  36. #include <mach/memory.h>
    6 N+ j6 S7 J+ b2 j/ N
  37. #include <mach/hardware.h>
    4 p/ ?- j+ ]4 O% s4 y! y/ d9 A1 d
  38. #include <mach/irqs.h>
    ! T  ~# O$ H4 N& H. H1 o( m
  39. #include <asm/hardware/edma.h>7 v/ h& y5 v+ q, P* J
  40. % p. t( k2 G' S* I
  41. #undef EDMA3_DEBUG
    9 T9 h0 u5 _* F9 |( N* X
  42. /*#define EDMA3_DEBUG*/) c  `( a, H. S2 a7 e2 s

  43. ; v+ E" m0 ^( b7 O$ v2 l6 {) O
  44. #ifdef EDMA3_DEBUG- \) }: K8 u1 \: g; B- S% m" K
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    + O6 ?6 n$ }$ _! l- D
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)* L$ O; Q: N) \
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)4 t  i- e4 D7 a; g
  48. #else
    % n7 C& P/ Z. K& B+ ]+ H. m
  49. #define DMA_PRINTK( x... ), Z5 U' l4 X% x' X
  50. #define DMA_FN_IN: o6 ], Q+ N, K; ~' l* |% S  J/ }
  51. #define DMA_FN_OUT) H6 z8 d, _; i, }/ q6 B; A/ [
  52. #endif( w! Q0 V8 E) W
  53. , P5 j& O9 E; L7 @
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    + i5 U2 Y0 M2 `& H4 N
  55. #define STATIC_SHIFT                33 f/ S& D0 D+ u2 X: B  b0 q% i
  56. #define TCINTEN_SHIFT               20$ x. D$ w8 w  ?3 a4 R
  57. #define ITCINTEN_SHIFT              21
    7 ~; T$ }( r+ O# O! q: L  T" W
  58. #define TCCHEN_SHIFT                22
    # V9 ]1 ~$ I, ~5 F) S  w
  59. #define ITCCHEN_SHIFT               23
    , S3 v* n. ]9 _- @

  60. % v. w1 ], U7 c2 |: m
  61. static volatile int irqraised1 = 0;9 p' E% ~: x3 r* H3 x. ^7 X
  62. static volatile int irqraised2 = 0;( ~! A6 X, E5 P0 s% t

  63. + _4 R  z$ ?2 m8 a  _' j% T/ P
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* b# h+ i, h! E. ~( G% P
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( _: A7 t  T) e+ M+ E. r, k7 _
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' c0 H. g! B3 A' \2 a

  67. / X% b' P9 V6 U! D, W- n% s" ]
  68. dma_addr_t dmaphyssrc1 = 0;
    9 _5 I5 E7 A$ Z8 F
  69. dma_addr_t dmaphyssrc2 = 0;# ~* R: B" B  x; T6 l8 @5 X
  70. dma_addr_t dmaphysdest1 = 0;  r0 `; h" R! s
  71. dma_addr_t dmaphysdest2 = 0;8 V& Y  T9 K4 e

  72. # _5 @/ L  L7 @8 {4 Y
  73. char *dmabufsrc1 = NULL;1 u# v) J# p. i6 n/ M0 F6 \. }
  74. char *dmabufsrc2 = NULL;
    * E- q3 S! Z/ M8 j9 a: d
  75. char *dmabufdest1 = NULL;
    . V" `: ?7 e3 t
  76. char *dmabufdest2 = NULL;2 q4 E6 y2 O/ |( U6 l
  77. 5 y$ D; S' w! b- }% L- ?% f
  78. static int acnt = 512;
    0 Q0 n9 B/ h) r2 U. z, a# s
  79. static int bcnt = 8;
    ; x( b! V* T! Z7 \, l
  80. static int ccnt = 8;
    ) @" e9 o% i7 k+ X- P
  81. 5 F3 v, N0 i8 _. Y- ^8 q
  82. module_param(acnt, int, S_IRUGO);
    2 V6 W- q9 ?3 E5 O5 x
  83. module_param(bcnt, int, S_IRUGO);, }& Q5 j3 v* Q/ y, t0 y4 m
  84. module_param(ccnt, int, S_IRUGO);
复制代码

: E5 e" A- p% b4 w  f' t& P" I4 ?: J. p' ?2 c, \* N: _
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用/ A3 x) @" U1 E6 Z
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
# A# P0 T$ B! P4 \- G( d' }     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。7 m5 a. S7 w: T

5 g0 e" @! v, X+ i" |) i5 ~- L
  k; M1 I' M% c" U  }- ^
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-8 16:01 , Processed in 0.039255 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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