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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
7 \( B8 A: x% b4 I( I  A
  1. [code]EDMA sample test application
    4 c& k. s, m$ ]2 |
  2. /*! B, V6 b4 Y! _5 y
  3. * edma_test.c; `& k$ U' D' o5 y% G- W
  4. *% H% j; w! O5 R
  5. * brief  EDMA3 Test Application
    ( r, ~! S$ ?6 l9 C0 ^4 b
  6. *
    ' s& A( U0 K* S# |6 y( Y: d: m
  7. *   This file contains EDMA3 Test code.; @0 W( ]2 f$ K9 f
  8. *
    ; [! @/ D  C4 A
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE2 R8 B  F  i; e! v2 X2 q4 G7 L; H
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT7 F5 N& j0 ]/ I5 Q
  11. *         TO CHANGE.
    6 @: P* P/ d7 ]8 G# z5 |# o
  12. *
    7 C- R, Q* J% {
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/% z# E* K# m9 f6 c* F, C
  14. *
    # j& u" O0 e; ?- h; K$ s
  15. * This program is free software; you can redistribute it and/or
    # p; V0 V: c: ~7 t
  16. * modify it under the terms of the GNU General Public License as
    7 g1 Q9 p! i; k6 r1 a5 m
  17. * published by the Free Software Foundation version 2.
    ! D; C5 k, n; L! A: o, ^
  18. *
    6 E, _; B3 ?5 R4 m
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any" ~+ T3 \  [* ~9 ^# I
  20. * kind, whether express or implied; without even the implied warranty
    2 u, Z. [. H- w- r) |& v
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the, I7 Q' S5 h+ k; x# Y& Z
  22. * GNU General Public License for more details.
      v0 p1 T6 U  d- \& `; U
  23. */
    ) F4 a( m  u* l0 e% k: g- F! {" @

  24. # J* k6 D# f+ t( Z7 V# Z
  25. #include <linux/module.h>4 [, q3 Y4 i+ [/ M, x+ V
  26. #include <linux/init.h>$ b% S9 k7 `" A9 C5 d
  27. #include <linux/errno.h>
    : P/ m; N* w  |8 E1 C6 C
  28. #include <linux/types.h>
    3 l/ B/ B0 l( H
  29. #include <linux/interrupt.h>
    . d* O& r, ]" W+ @9 Y
  30. #include <asm/io.h>) I7 Z& x/ r) i$ {: Y9 l6 K/ X& e! I
  31. #include <linux/moduleparam.h>
    5 R8 J  X6 C2 n" n; C  r5 {
  32. #include <linux/sysctl.h>
    9 G( s( N; Z) ]% `
  33. #include <linux/mm.h>
    " S' N2 z; R! Z! y' i
  34. #include <linux/dma-mapping.h>3 c% W' d2 F( O
  35. ) D8 @% r/ L* j3 t# Y
  36. #include <mach/memory.h>- Z, J  e6 T  i, B
  37. #include <mach/hardware.h>1 O0 h5 T0 }& ~" j3 K% V, r
  38. #include <mach/irqs.h>  \7 `6 T2 D! h1 y. c
  39. #include <asm/hardware/edma.h>6 X8 O$ }/ P: O$ I3 \  Z

  40. 1 B/ r+ A: C, e( }
  41. #undef EDMA3_DEBUG2 P% M8 d, s9 u, p7 U
  42. /*#define EDMA3_DEBUG*/
    ( U5 |2 e* x3 a$ ^. u3 _+ i" N
  43. . [$ ]5 a4 {- B% l- ^7 _$ r  \7 J
  44. #ifdef EDMA3_DEBUG7 P" v# X5 l& [* z% c
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)+ f8 g' J; g8 J- k* [, p
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)& G! }+ l( c# k) y/ H6 C; W- ~
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)' c* |. x: Q5 V6 F7 k7 P
  48. #else$ s& [8 C  M9 J) {
  49. #define DMA_PRINTK( x... )
    8 o7 `. t' h& R# i) F$ R/ |
  50. #define DMA_FN_IN7 h, t* w" d, b' G% J+ J5 X
  51. #define DMA_FN_OUT8 E! ]% ?% j) b) S7 z/ {' G2 M! T- l
  52. #endif" l6 D9 d7 t3 x5 D, V3 @8 X" w/ E1 j0 M

  53. + F7 ^7 ?9 |4 l  \2 C5 @
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ( m9 O( E0 V2 J6 l. K7 T: K
  55. #define STATIC_SHIFT                3* t0 R2 h4 Y# [, {+ n  P
  56. #define TCINTEN_SHIFT               20
    : t. e4 u9 e+ G
  57. #define ITCINTEN_SHIFT              21" o* x/ o2 o: r3 W
  58. #define TCCHEN_SHIFT                22  K4 p' f4 z* g% [* ]# r4 R0 ~1 N5 L9 a$ |
  59. #define ITCCHEN_SHIFT               23# ^4 D. f0 g/ J0 f) O6 g

  60. ' {8 Y7 O8 J! t
  61. static volatile int irqraised1 = 0;
    ' Z4 t% E7 Y% i' q& s
  62. static volatile int irqraised2 = 0;
    $ a. A6 \6 H% m) d: C  t+ s- t
  63. 2 \9 E$ L* p- ?5 Q3 T, t# C
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 e5 [  c) h7 s
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) y' k8 X" X* ~* e
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 _7 N1 ?) l3 j* y% X, ?4 \
  67. # G9 l" A' P4 J3 I
  68. dma_addr_t dmaphyssrc1 = 0;
    1 E% l4 p  H5 y4 J; y& s  o# L! r  {
  69. dma_addr_t dmaphyssrc2 = 0;  {" H. y; _. l6 m( Z
  70. dma_addr_t dmaphysdest1 = 0;
    " v' Z$ `( R1 V5 ~
  71. dma_addr_t dmaphysdest2 = 0;: C; O# ~# r& h, G/ z1 w
  72. 2 }) P7 |8 s: Y7 }2 A
  73. char *dmabufsrc1 = NULL;0 w( N( d# b! A8 u' I( u8 k- J
  74. char *dmabufsrc2 = NULL;
    3 D2 @$ g$ g7 S0 ~
  75. char *dmabufdest1 = NULL;
    * Z8 I6 g- l/ O* N
  76. char *dmabufdest2 = NULL;
    ' L9 e1 }8 ~) b1 b

  77. " p( G1 d& ?& E
  78. static int acnt = 512;' q/ u8 O# N( Q
  79. static int bcnt = 8;; y7 X3 X8 w2 h! U; p" n0 ~' _
  80. static int ccnt = 8;
    , U$ @, v. L) H* u- D9 \/ m
  81. ) n. \- Q1 m' r/ S- p& [, _( o
  82. module_param(acnt, int, S_IRUGO);
    1 r# _8 ]) V8 k$ }, m
  83. module_param(bcnt, int, S_IRUGO);3 X7 ?% q1 ?  {6 w( Y9 g% r
  84. module_param(ccnt, int, S_IRUGO);
复制代码
. H$ s6 ^4 _; E9 N2 k
! o7 F4 [+ e) I+ P
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
/ G" r( z# F9 V, harm-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 F6 q7 v" B8 g% _+ b4 |* s
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。" J4 V4 Q- U0 ]; z5 Y

; v3 f5 y! G3 X# U. ^0 l: d
+ B- ^/ [; Z2 ^" Q% g$ b
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-28 17:42 , Processed in 0.090403 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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