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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ) \- k) I# ]' t
  1. [code]EDMA sample test application
    5 t% h6 r! b8 l2 e; M( v
  2. /*
    9 X7 w6 |' {# @' m% S% \
  3. * edma_test.c1 j- }# ?* B- a) j  u0 Y- y% P
  4. *
    * ]  f3 Q- ?+ ^
  5. * brief  EDMA3 Test Application8 o+ i! J2 w3 {& P) D4 U# U9 ?
  6. *
    ; B$ _. F) A0 t3 y3 v
  7. *   This file contains EDMA3 Test code.! O4 E  ^! s$ d4 _, H3 Y1 W
  8. *
    ; v: l) n: a$ Z6 j- o( _+ I
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    % m/ n. ]) Z8 x9 h8 W1 d! }
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT& Q6 ~1 h2 h2 n; P+ s9 L4 b
  11. *         TO CHANGE.8 v/ r' s5 }( @$ R
  12. *5 P5 S3 n0 r! A: q! D
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/& _2 t  o5 p8 f* X' M
  14. *
    8 G! ^4 ?& l& P
  15. * This program is free software; you can redistribute it and/or
    ; x, c' U- N. l
  16. * modify it under the terms of the GNU General Public License as
    * ], b7 V4 x. g+ e/ x6 n) h
  17. * published by the Free Software Foundation version 2.
    2 V% P+ G2 q& C$ E- N3 ~& W
  18. *" R2 @$ K2 Y) y' n; N
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    * `( d9 W; a. Q
  20. * kind, whether express or implied; without even the implied warranty
    5 n7 z8 b" D" u. d0 h4 W1 a5 J
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    : ]" f( j" A8 v8 a
  22. * GNU General Public License for more details.0 E3 j* J8 o- X, k$ a6 c
  23. */7 Z" l; g- x8 K8 e

  24. / d6 q; O. h( c! h6 u- T
  25. #include <linux/module.h>
    9 O' F( i6 s/ E  P* ]* m, |* ?$ Y
  26. #include <linux/init.h>
      K( b9 |/ C. v7 ]& Y6 K$ o
  27. #include <linux/errno.h>5 B  o- ?; p+ B' j/ s- C. h) ]
  28. #include <linux/types.h>
    0 y0 R6 _/ N4 a, T8 n
  29. #include <linux/interrupt.h>
    " k! e( j  I: [2 Z% F8 ~2 X  [
  30. #include <asm/io.h>% C+ V7 z7 \( g4 D; K5 ]! Y2 K
  31. #include <linux/moduleparam.h>
    6 B* k2 c6 p, q8 H* e8 O
  32. #include <linux/sysctl.h>$ D0 ~( t. _+ o( F$ M; J. q
  33. #include <linux/mm.h>
    # v& C8 F; L/ W) {. D4 p1 z, x
  34. #include <linux/dma-mapping.h>- m! m/ c+ k+ Q2 c5 q4 H$ Z  _
  35. + \, K) }* d1 U, |) c9 f
  36. #include <mach/memory.h>
    - B' k! ~+ a$ G- ~* N
  37. #include <mach/hardware.h>
    3 g8 C7 n! a  e. K9 A& }
  38. #include <mach/irqs.h>
    ) i, F7 w0 c( C* \: h# g
  39. #include <asm/hardware/edma.h>
    % T4 Q1 N! a/ P" V( f
  40. 6 a1 D' M* Y' H8 X* {
  41. #undef EDMA3_DEBUG$ t6 l  ^& s9 l8 L2 \* d
  42. /*#define EDMA3_DEBUG*/
    + \0 W  S' R* P' C1 M

  43. ( q+ f8 u! Q9 k: D5 w- ^6 \
  44. #ifdef EDMA3_DEBUG3 }! H" r' B; y4 s8 ^
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)9 A& f. n9 ?$ H* l+ ^
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)! }! P/ N1 i  n9 |/ f9 e& u8 @
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    9 [" H2 |2 S5 B' C( Y2 W! F) @
  48. #else
    + R- v; w5 R. w8 N
  49. #define DMA_PRINTK( x... )
    ) J1 x5 F! T; {; z2 l
  50. #define DMA_FN_IN
    & Q8 l! D4 o3 b6 P) }
  51. #define DMA_FN_OUT
    3 w7 _$ _- V. |, r3 W
  52. #endif( A" f* U3 v1 y% `# C' k$ o

  53. " G1 Q; x: C% ~  s# F. ^6 z  \9 R( h
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    2 t$ E8 v  V3 z5 `6 P" b
  55. #define STATIC_SHIFT                3
    $ R+ p, y- q/ v" T
  56. #define TCINTEN_SHIFT               208 U* }7 M, O8 e: u8 r* J
  57. #define ITCINTEN_SHIFT              21% H. N- N6 H/ I5 L8 |) S% M
  58. #define TCCHEN_SHIFT                22
    % K8 s& s9 r' }* \+ Y; \
  59. #define ITCCHEN_SHIFT               23. H: S* p4 D( S3 |
  60. 6 J5 ^; D- a/ ]
  61. static volatile int irqraised1 = 0;
    % ~8 I4 N2 A+ X- v! ]5 _
  62. static volatile int irqraised2 = 0;
    ) t4 S( `& ?* q$ p* q
  63. ! s9 `, O& T: Z0 z2 ^" U3 V/ {0 L4 \
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 i* @" e4 W! m2 Q. k( f
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' T$ V$ x% i0 d& D+ l5 s
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 _: u- ~. P; S  e; B$ I, h

  67. 9 O+ o( O3 x# L7 m
  68. dma_addr_t dmaphyssrc1 = 0;, c/ ^$ R. |$ t/ D( R) y: S
  69. dma_addr_t dmaphyssrc2 = 0;
    $ \/ p, j4 D, f9 Q& D2 c
  70. dma_addr_t dmaphysdest1 = 0;9 y) B) X: Z; |+ h2 S' {5 `/ v  q
  71. dma_addr_t dmaphysdest2 = 0;+ a/ I. q; c  E& v8 K) u

  72. : p3 S+ ^( R' K
  73. char *dmabufsrc1 = NULL;6 X: I- _! I3 i' n) W7 d+ a5 K9 X+ l
  74. char *dmabufsrc2 = NULL;
    * E( |1 b+ |# A6 ~
  75. char *dmabufdest1 = NULL;
    8 a; J2 ~; Z9 x6 v+ m: I, h# E
  76. char *dmabufdest2 = NULL;
    ! _8 _) J  w( D' N* F
  77. " ?& U2 C: t6 l8 K6 L* @8 r" N9 i- L
  78. static int acnt = 512;
    % Y0 U/ p# B& F3 }; J
  79. static int bcnt = 8;1 u- C& u" i$ p
  80. static int ccnt = 8;
    : K1 K9 i: T* |. B9 Z6 r+ H+ g1 a

  81. 4 f0 [7 K, _7 P" E' q
  82. module_param(acnt, int, S_IRUGO);  \# u4 Q9 h+ L/ \
  83. module_param(bcnt, int, S_IRUGO);: U$ I, n7 U' x7 j" X# K% o
  84. module_param(ccnt, int, S_IRUGO);
复制代码

/ L) c- H4 O8 w. c- j" H# H: U, i5 S( d9 V: h. ~" Y* X
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
& B+ v- i7 C2 W% Z# g- U  qarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
; C" K! A# P) j; p2 T     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
" V4 ~4 `. c8 u* m# n! l, E& H8 N9 P- Q& A( C

! I4 k7 h& K5 @3 L0 l
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-17 09:18 , Processed in 0.041180 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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