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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
6 ]4 @  o1 h& l! \+ ^
  1. [code]EDMA sample test application9 i! Q5 u$ U4 c
  2. /*
    1 D* ^3 }4 x! w
  3. * edma_test.c% {1 g# `. d% H1 r1 Z# t
  4. *5 w/ W: u5 ~5 x1 M
  5. * brief  EDMA3 Test Application
    8 N4 c6 f  s) g" P# y
  6. *
    % }/ W! n# O5 L! q- z
  7. *   This file contains EDMA3 Test code.' c* [  ^& V% M" T, P: [4 Z
  8. *
    $ `1 E8 o) X9 t& P4 \; b4 [/ f
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    9 ^/ H" m# F8 q# e4 J7 e$ G: i
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ! l# j* n$ @/ i9 o% `, C
  11. *         TO CHANGE.  P4 g$ z& L7 O+ }
  12. *
    . x% l  R8 x/ d) O% {% n: s. Q+ H7 g& p
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/, m. {3 e( s) S
  14. *" y4 A1 x# T  {* `0 C0 j7 P' E
  15. * This program is free software; you can redistribute it and/or
    ) i; Q; n! D$ F$ n
  16. * modify it under the terms of the GNU General Public License as
    + A4 {6 ], T9 p' h/ w  y
  17. * published by the Free Software Foundation version 2.
    - X7 S2 l) d3 c" ^1 @% c
  18. *
    6 K% f0 J1 w8 ]* M( P; N6 l
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any4 ]' q6 S' y' Y  y4 D8 u. {
  20. * kind, whether express or implied; without even the implied warranty0 v8 b# |% l1 K" e; H& A$ Q. x# ~
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ) Y4 O, q( V8 ]3 _8 x, \
  22. * GNU General Public License for more details.* r8 p2 f1 ]( S) a" ?6 R* R
  23. */
    4 M/ e$ p: W. ?2 D6 D

  24. ) d) W$ \+ ]+ [& p
  25. #include <linux/module.h>
    ' M+ k. b% ~" Y+ \' c
  26. #include <linux/init.h>! x7 s; M& z  _3 o) f9 W
  27. #include <linux/errno.h>
    0 h" {  C0 @' S2 u# |
  28. #include <linux/types.h>
    % Y4 q2 b2 P! s% s
  29. #include <linux/interrupt.h>) @) d; i& `  ^/ e) m/ @
  30. #include <asm/io.h>9 ^1 e2 z4 l) R+ n
  31. #include <linux/moduleparam.h>/ ?6 N( n9 {* L: @7 ~; r
  32. #include <linux/sysctl.h>
    # B% s( G+ M( B* U9 H
  33. #include <linux/mm.h>1 l: i9 a" g4 a0 M
  34. #include <linux/dma-mapping.h>( q* |$ Y6 V+ Z# R4 R0 @0 S
  35. ; U- L- N- `  N# @4 ^/ T) F
  36. #include <mach/memory.h>1 g/ a- n% E/ G8 p- z$ w3 H
  37. #include <mach/hardware.h>
    8 X" j' m& c6 B7 H9 }- p: ]. h$ z
  38. #include <mach/irqs.h>; d( Y; V9 f" |
  39. #include <asm/hardware/edma.h>
    8 @8 O$ a3 Z0 t7 ?

  40. 4 a# r' n9 O; g+ h+ |
  41. #undef EDMA3_DEBUG$ _  V. P' C' ?' e
  42. /*#define EDMA3_DEBUG*/
    ; N/ |9 C4 o$ k% Y
  43. ) f) A, e% C: e6 s
  44. #ifdef EDMA3_DEBUG
    4 Y# {( h& s; m) ]6 {0 V* |
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    0 |+ v. c: S: P1 j
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)( ~( `% v, N5 D6 b! |
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    1 d8 P! k. _' I6 Q, n
  48. #else. O! o& a3 {: h2 p% I9 L
  49. #define DMA_PRINTK( x... )
    8 S, O5 m5 Q% Y
  50. #define DMA_FN_IN
    " H; C% x5 ~- b3 ~
  51. #define DMA_FN_OUT
    ' e* y. Y) U$ {# [% g6 ?
  52. #endif
    ( ]7 g; L7 ?  W  L1 P9 l

  53. 5 U1 ]9 d2 K# [  E. q, r8 @  X
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)1 H4 N0 @$ d1 Q" ~  [+ v8 l
  55. #define STATIC_SHIFT                3
    " B1 ^! o" V8 E+ L
  56. #define TCINTEN_SHIFT               20
    * P; ~% w7 m. K4 P. P
  57. #define ITCINTEN_SHIFT              212 A0 @- F. T# a# h' x. Y" M
  58. #define TCCHEN_SHIFT                22
    4 r0 _6 P- t5 V: @6 {  w
  59. #define ITCCHEN_SHIFT               23
    ) ]3 J( g3 j3 e

  60. 5 F- {) S6 A) [3 Y2 z
  61. static volatile int irqraised1 = 0;
    + _3 W3 G" ^9 ~  v( |6 ~& q$ I
  62. static volatile int irqraised2 = 0;: Y' ~3 j# U. T- g! i7 T! w

  63. * N5 K7 c6 K4 }! N6 x* d" E
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 R% J1 o: z2 `- _  W0 P2 d
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ A1 w. H0 B% j! H0 l' U# \, r8 j8 c
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& d) U+ l: k, K) V$ k
  67. * c4 b& U8 f6 k0 F4 U
  68. dma_addr_t dmaphyssrc1 = 0;
    ' b5 K: T/ L/ a0 s  y+ }
  69. dma_addr_t dmaphyssrc2 = 0;
    0 z  @8 M  Z1 ~: y2 `0 S6 X$ ]0 {
  70. dma_addr_t dmaphysdest1 = 0;
    # c$ C; U5 Y' K& T+ s* m6 M
  71. dma_addr_t dmaphysdest2 = 0;4 E2 Q. m% g) E' l+ X

  72. , f0 l* l* T! r. Q! |# x
  73. char *dmabufsrc1 = NULL;
    5 C' m$ ?$ ^- l8 }
  74. char *dmabufsrc2 = NULL;+ r6 h9 h) f9 h+ E
  75. char *dmabufdest1 = NULL;$ w$ W% Q" y. N# s- |, X1 O
  76. char *dmabufdest2 = NULL;# g' {) [6 |) M/ v- K: t& x0 P# Z

  77. - D% J+ E. P2 k, O" _
  78. static int acnt = 512;
    3 F0 x/ o$ Y( v; d7 b+ q# I( t
  79. static int bcnt = 8;  s( h6 s# \! W$ E
  80. static int ccnt = 8;% [& v& z% w' O9 I& p) Y8 w! B

  81. 4 R7 v* b- E! z( h1 P
  82. module_param(acnt, int, S_IRUGO);* c& ]7 l4 R- c5 t3 ?
  83. module_param(bcnt, int, S_IRUGO);8 l3 ]% _" t# ]. ?$ [' A
  84. module_param(ccnt, int, S_IRUGO);
复制代码

$ f+ d- r; h$ y# H" L# V5 Q
, S) o! |" N- g- J6 d3 b      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
. M8 z( V; K6 n# earm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。& N/ h. v: n( {( X% O/ s& s# E
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。1 {  C+ p5 n  o$ p0 \
( z, m5 g' r& _" j* |6 d& k$ c5 D
! K8 Y0 [9 {7 u4 O0 W4 S
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-8 18:11 , Processed in 0.039810 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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