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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
; P6 s7 t% }  j& R% {1 ?7 C7 N
  1. [code]EDMA sample test application
    ! O$ Z+ g; g: A* {
  2. /*" W# l4 a: @/ Z7 r. w
  3. * edma_test.c0 f4 O* X; ~% \0 d5 V3 D4 i/ T. ^
  4. *
      O: r) n7 Q% r
  5. * brief  EDMA3 Test Application5 l8 E# L; \2 G' I3 w" ~
  6. *- ~9 w7 u/ A" m0 p
  7. *   This file contains EDMA3 Test code.
    0 i6 a$ U! w6 y  l' a$ }$ ^
  8. *% g  \/ ]9 h% a+ N$ j
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE8 D0 |0 q7 g/ H. N4 ^0 m
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT' L0 @  m& ^6 F. ?8 T2 r/ L( [
  11. *         TO CHANGE.1 t* Q2 X& m' b9 i
  12. *7 D3 H7 z# u7 F7 ~- G
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/) Q, |/ c9 u& W0 ^* ?1 f9 V
  14. *
    0 G4 h/ q# G0 M  b" X
  15. * This program is free software; you can redistribute it and/or; z7 b4 v# u0 v
  16. * modify it under the terms of the GNU General Public License as
    : J) V. i: }. n) N' g% z
  17. * published by the Free Software Foundation version 2.
    ! D- u& ?" D) r, R$ H, R/ P
  18. *. F5 d( r4 I: m& R4 z! o
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any  c/ R+ x& `9 u
  20. * kind, whether express or implied; without even the implied warranty* l& `1 P5 p7 r  O# o6 `. w
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the3 J4 W! `2 X4 S7 c3 P& g; T( g
  22. * GNU General Public License for more details.
    9 K- D0 {. y1 L7 F/ `
  23. */
    ( Q0 R: i5 G0 L8 s- W$ N  x
  24. 6 M1 @) `; w0 R7 h+ V4 n! U+ _+ ~
  25. #include <linux/module.h>
    + D* T# G0 L/ d* b; V
  26. #include <linux/init.h>& m3 X# \+ p2 S
  27. #include <linux/errno.h>
    5 o/ i/ e+ q7 ^& [! g- ]5 \1 c
  28. #include <linux/types.h>
    / X, Q4 S- Q) w% }5 b# v
  29. #include <linux/interrupt.h>$ W8 e- Z0 o$ b) I- b. c7 B' D
  30. #include <asm/io.h>3 }7 \  {9 K" N! x' z9 m1 a
  31. #include <linux/moduleparam.h>
    & X3 W% e5 r+ w: B$ X
  32. #include <linux/sysctl.h>
    $ B3 H: U4 U5 m. [. w( R' E
  33. #include <linux/mm.h>& X* f/ U; G7 U' g7 l* \
  34. #include <linux/dma-mapping.h>
    " B0 x+ x) X$ M* v- t4 y9 d

  35. ) G( x6 C9 n4 e$ H, l! C+ b; ~" ^3 H& @6 t
  36. #include <mach/memory.h>7 F& V0 G! M& ~9 t: C
  37. #include <mach/hardware.h>& ?/ ?$ B4 W4 T
  38. #include <mach/irqs.h>
    : n, h* q5 `; d2 o
  39. #include <asm/hardware/edma.h>
    0 @/ ^' M+ j6 c- s! g8 t/ B( l

  40. & L) g, ]. Y: f/ x) `4 p! B7 V
  41. #undef EDMA3_DEBUG5 S! k" h2 g1 r& S
  42. /*#define EDMA3_DEBUG*/2 @5 b; C9 W$ \- l# r) `

  43. % |7 \" x* f' A! s- f$ l8 l, Y
  44. #ifdef EDMA3_DEBUG; o2 Z, A* z6 _3 R6 j& g& s
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)0 G0 l, u% [: ^& h" x
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)  a$ ~  d  R$ |, X
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)1 ^5 l1 m" g. N- a" `* ]( S
  48. #else
    1 p# |" w; J! y( S0 f/ I( F
  49. #define DMA_PRINTK( x... )' C  s' q: H: v/ V4 g' c) z' M
  50. #define DMA_FN_IN
    % {0 a, }; ?' i8 Y
  51. #define DMA_FN_OUT
    & ?/ R7 C- p/ @7 e" L2 j
  52. #endif- Z+ U6 D- ^0 q; a
  53. % o. w+ Z2 H0 K5 s% B0 f% X7 G
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)% q3 L) k/ Q: G& x9 {( U" t" S8 P1 m
  55. #define STATIC_SHIFT                3: p3 \: ]% m* ^5 ~
  56. #define TCINTEN_SHIFT               20
    ) ?9 W& S7 b/ T$ o" W$ O
  57. #define ITCINTEN_SHIFT              211 ~* i1 ^/ A' u: E7 s
  58. #define TCCHEN_SHIFT                22# {! R! l0 c( n
  59. #define ITCCHEN_SHIFT               23  a8 }( _/ a& }6 Q
  60. 7 a$ s1 f& q+ F% y, e
  61. static volatile int irqraised1 = 0;
    ! d' j% {# C% R
  62. static volatile int irqraised2 = 0;4 I1 m2 Q, c9 ]- Y$ }

  63. $ F0 N) @% [6 m7 V5 [$ u* \0 t
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' M3 g( d/ M$ z' d; P/ h
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 f/ ?3 Q- W7 @0 d! _* b
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 Z0 a) ?' ~8 u, g

  67. - ?( r+ H9 P$ ~/ S
  68. dma_addr_t dmaphyssrc1 = 0;/ A5 U' L. r+ c- [# q& h: U6 _
  69. dma_addr_t dmaphyssrc2 = 0;
    - l1 D. i7 v' W6 x' C
  70. dma_addr_t dmaphysdest1 = 0;" u: _+ h: o. U+ \  }% b9 M" S
  71. dma_addr_t dmaphysdest2 = 0;  V2 Z' U* K  a% S

  72. ; I  b( E& d6 `3 X2 J
  73. char *dmabufsrc1 = NULL;
    9 Q7 m8 n5 c$ h% n6 N5 @
  74. char *dmabufsrc2 = NULL;/ ^( }) X1 V4 {1 m4 v: }
  75. char *dmabufdest1 = NULL;/ q, [; S. U7 ^  @" Q
  76. char *dmabufdest2 = NULL;( n! p" K0 F* H
  77. / X& X1 U% J5 M6 R' x' e2 P0 @; U
  78. static int acnt = 512;3 e) E, ~9 s- S5 h2 _
  79. static int bcnt = 8;/ C* ^; M2 P( x3 k6 ]4 i$ Q4 O
  80. static int ccnt = 8;
    2 s0 F4 U# \7 W# P' y5 l
  81. 0 O* h% o+ ?' _
  82. module_param(acnt, int, S_IRUGO);8 k5 ?+ M; G1 y9 q
  83. module_param(bcnt, int, S_IRUGO);
    ( R, s/ _! j  F8 V
  84. module_param(ccnt, int, S_IRUGO);
复制代码
5 \) V/ T" }  ?  |* v
8 a' f0 P. ?, `3 u( u) }! ^/ Z7 c
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
2 F$ u2 W, i: X* v0 M9 p  Xarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。4 [; u9 M7 q0 \1 ^, }$ l
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
5 r7 c$ R  y  A' ^5 T5 v; I3 b4 F7 }1 @6 L# U7 N
: i3 H* m4 a4 B2 {& b' j5 k
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-5-23 12:03 , Processed in 0.041683 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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