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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 / k1 x' j: U' h2 x, O3 Q
  1. [code]EDMA sample test application0 k% C& l+ X# r8 L/ y+ V+ `
  2. /*( t' ?' g1 X: H* X) e9 G
  3. * edma_test.c$ C/ ~, ^& @! s1 t# E
  4. *
    * y4 ^  n( f! L; N3 H$ P* j
  5. * brief  EDMA3 Test Application' A& J5 v7 O/ Q; h
  6. *2 G% L# I$ O  A# U: `1 D% S/ K
  7. *   This file contains EDMA3 Test code.4 j6 x& h* F$ H; y  L$ D
  8. *
    ) {$ ]* k. Z9 Z' K
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    : G( e  _2 x! [9 `0 C0 ^/ T
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT# r& s& a" ~) @
  11. *         TO CHANGE.
    ( r7 p5 L% d$ t
  12. *
    % @: }5 E3 o1 t6 b6 o# K
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/- k4 D" W+ C* A, u* Q9 C
  14. *6 S; [8 e: l3 F; b* ^5 F( n) P
  15. * This program is free software; you can redistribute it and/or3 R/ ]2 V. i# k. g" L
  16. * modify it under the terms of the GNU General Public License as
    0 n0 L' H1 h' r5 A* l
  17. * published by the Free Software Foundation version 2.) C7 Q$ j1 ~% q; D
  18. *! s  |% S! m/ k' U8 |
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any" f7 l! c& o" H9 D
  20. * kind, whether express or implied; without even the implied warranty
    3 g6 L( h) {7 A/ i" x: c
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    - k7 u' x: _( o6 \1 m* R& E+ g& X
  22. * GNU General Public License for more details.
    # u3 l5 d- E% L$ M* Y6 t; ~
  23. */8 z" n2 W+ p: X1 }0 t0 M
  24. . X8 U8 i  {; m( Q
  25. #include <linux/module.h>
    . h: \4 D/ Z4 B" }4 R: t& V
  26. #include <linux/init.h>$ c$ ~0 F/ \, n" M3 o  i6 T
  27. #include <linux/errno.h>9 H* f8 K+ t! W; U7 c7 L
  28. #include <linux/types.h>
    2 m0 u& Q- v! H2 P( f  A5 {
  29. #include <linux/interrupt.h>
    . @2 D# s5 a) Y
  30. #include <asm/io.h>  u( `, N9 U! D% r& F* }5 _
  31. #include <linux/moduleparam.h>9 V5 _4 v" i/ [& S# b
  32. #include <linux/sysctl.h># |9 F( r. N; z' T
  33. #include <linux/mm.h>; u0 G; Z5 G) M  C" W( s2 d3 h
  34. #include <linux/dma-mapping.h>8 i5 r( g# c( o  }+ t+ f2 B. y- M0 Q

  35. ; I: K4 Z7 K3 ]! Y7 n9 `2 W
  36. #include <mach/memory.h>
      \# {2 R: M. C! f5 @- A3 A
  37. #include <mach/hardware.h>
    8 S, A+ p3 F% [- y# s$ x
  38. #include <mach/irqs.h>  N3 i6 ~0 q# V8 {" k! C
  39. #include <asm/hardware/edma.h>, D* d5 L6 P' |0 ?

  40. ; V' l9 m; X& @# g
  41. #undef EDMA3_DEBUG
    # m1 T- p( \8 j3 r
  42. /*#define EDMA3_DEBUG*/1 M5 o8 M; X  B3 L3 J
  43. # [/ T. r+ f( s6 g; M5 U: ^
  44. #ifdef EDMA3_DEBUG
    / x1 M/ d& @: h
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)- B6 O8 P, u0 p$ Y7 ?. W8 r1 z' V
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    , F1 `) J& w1 ^8 ~5 R/ w  _/ i
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)" m5 E7 f% g: Z+ ?3 `$ F8 ?$ z3 Q
  48. #else
    0 D+ H7 [0 c- t2 `  S8 M
  49. #define DMA_PRINTK( x... ); d9 z2 X- n5 a# ^! V
  50. #define DMA_FN_IN" Q# S* a' }) }5 A
  51. #define DMA_FN_OUT
    5 L1 Y/ z. s* d. [1 h
  52. #endif+ X9 q8 O0 x+ A5 R! r
  53. 7 E% [3 r! _; G' N. d
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    7 ?. r; [- |1 m! w4 O# C$ Y
  55. #define STATIC_SHIFT                3: l* w+ I: T* G
  56. #define TCINTEN_SHIFT               20
    0 Y9 o& q8 u0 P8 k8 [! B6 w  o
  57. #define ITCINTEN_SHIFT              21
    9 \* A6 h% F3 L: [' Q) H$ Q
  58. #define TCCHEN_SHIFT                221 v& S4 P  R8 y
  59. #define ITCCHEN_SHIFT               239 x! ]9 o. H9 r% a
  60. / w  n9 x+ ]8 V3 O1 d( D
  61. static volatile int irqraised1 = 0;
    ) l6 d! I% ~) c3 y4 h+ A) T; u
  62. static volatile int irqraised2 = 0;
    9 _% O' j8 m, U$ u

  63. # N* Z( ^4 x" \7 z, n
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      N; F* ]; [. H4 a/ ~
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 G7 j% g7 k; W4 R4 i3 W( a
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : S# \5 f# T# l2 V$ L+ D+ Q0 U

  67. * Y8 s% [$ ?. i+ B8 P
  68. dma_addr_t dmaphyssrc1 = 0;
    ( G# G" s1 j: e/ _9 @' L0 P
  69. dma_addr_t dmaphyssrc2 = 0;
    5 e" m$ v( x2 A: X
  70. dma_addr_t dmaphysdest1 = 0;
    6 N) ]% a" K. z8 t" [) f
  71. dma_addr_t dmaphysdest2 = 0;4 ]! H  d1 I/ a" z6 F" s

  72. # t6 K2 y0 X& f+ ?
  73. char *dmabufsrc1 = NULL;/ r# _9 a3 s* M, \& X* a
  74. char *dmabufsrc2 = NULL;8 K3 {$ u- x# |5 Q# z
  75. char *dmabufdest1 = NULL;
    % A: V$ L6 P& c! N8 N  {3 ^$ A
  76. char *dmabufdest2 = NULL;
    : X: _7 _* |+ E( M6 m7 S" r
  77. 5 T0 Z' d* U1 U1 s# k4 p! R
  78. static int acnt = 512;+ C9 {" B7 b. L7 b; F
  79. static int bcnt = 8;
    ) K5 F) J# a& E
  80. static int ccnt = 8;0 Q" _: W- P3 x( z* t7 c) o
  81. $ r1 O% M$ P8 u2 [" m
  82. module_param(acnt, int, S_IRUGO);8 x& X6 ~# |( W- r
  83. module_param(bcnt, int, S_IRUGO);
    9 e! I  D, a: g- _
  84. module_param(ccnt, int, S_IRUGO);
复制代码
) L* X  ?9 U7 \! U% L

4 }2 p7 K) v3 r6 n& o" h" F8 A* ?      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
0 `' l& Y* F+ w% ^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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。# q3 p5 i) S% i% F
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
& S# {$ D' V. h( u  i
# R" y5 T+ n) P+ X; \
  k1 Q% \4 N$ Z; ?- s( i0 S( x; i1 U2 f
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-13 18:14 , Processed in 0.038304 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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