OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 , k9 ]2 M4 V& v) V
  1. [code]EDMA sample test application% Q( {" P1 L& E7 O( v, d4 i" w- H
  2. /*5 O0 ]+ j# W. \5 G
  3. * edma_test.c
    9 a" l) k! N7 R2 q' q% g
  4. *" x, R9 _8 e: f! Z
  5. * brief  EDMA3 Test Application4 s( ?' z* m8 x  _% a( ~
  6. *
    7 J1 ]9 r6 `3 g  ]) R
  7. *   This file contains EDMA3 Test code.
    % g. ^: W0 U7 y1 T& r
  8. *
    2 p9 B$ f7 Q' S. {1 ~5 ^8 D
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE; d" j2 }; G( z# j
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT  h2 E, g9 B( P( E( B: m% }& C1 @9 {9 Y
  11. *         TO CHANGE.
    ( r9 {' o3 Z/ z7 ^7 W$ D9 ~
  12. *
    % m( z: I6 \4 d
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/6 I6 Q8 V% G* D( C9 T& \' e7 X
  14. *) g! O. _; L/ P8 O1 q: ^
  15. * This program is free software; you can redistribute it and/or( ?# h% `5 ^/ U6 Y/ l
  16. * modify it under the terms of the GNU General Public License as
    % `3 x, r6 e) M
  17. * published by the Free Software Foundation version 2.
    # Y! t0 @  _* f5 G
  18. *
    : G, D/ H) j9 A6 X% U. w+ M
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ; U% ~  C: `3 R- b( g
  20. * kind, whether express or implied; without even the implied warranty
    ) u' w$ A/ V! @5 o4 Z/ y3 r
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the/ p5 `6 p4 P  R$ d4 @
  22. * GNU General Public License for more details.( X# G+ v6 C/ \( l, h
  23. */
    " j# _" J; u3 L4 Q

  24.   E  g8 m8 ]% c) L4 j+ f
  25. #include <linux/module.h>
    , Z. P9 R, g- Z- s% N" z: E7 N( R
  26. #include <linux/init.h>0 x, ^: m' E2 z5 ?
  27. #include <linux/errno.h>
    1 A4 n6 |; @- \. P) l, s# D
  28. #include <linux/types.h>
      ?2 p; Z2 ]( c2 e) [
  29. #include <linux/interrupt.h>) |! T" E+ I. B7 L3 P2 J
  30. #include <asm/io.h>
    ( e8 c' Y( @' C; }& B0 p1 R8 X
  31. #include <linux/moduleparam.h>: j1 B; U1 Q0 Y  I5 D0 K9 m
  32. #include <linux/sysctl.h>
    5 ], M3 H! ?) S
  33. #include <linux/mm.h>: [* g  U% A3 d! I; m
  34. #include <linux/dma-mapping.h>
    ' H; R2 c+ b% Q0 D; y! g

  35. 4 p) G4 z2 g" B
  36. #include <mach/memory.h>
    9 K3 M3 N% V# U/ w$ i$ }
  37. #include <mach/hardware.h>
      a8 p  T: ^) e0 e$ H0 l' E4 f
  38. #include <mach/irqs.h>9 U! m( f) X2 ~  N
  39. #include <asm/hardware/edma.h>; N% `, Z6 W6 v4 Z+ p6 ?. g

  40. # @- @# M: b$ G
  41. #undef EDMA3_DEBUG
    ! O) Y5 E' Y' e( W8 B& Z
  42. /*#define EDMA3_DEBUG*/
    8 f6 l5 L: |8 r, u$ B

  43. , w' h, Y; t- H  l
  44. #ifdef EDMA3_DEBUG
    ( l* r" l% Z( F2 ]2 ^
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)) e2 A4 e' b! r( G9 D+ |9 H3 z4 o
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    + A1 @: M0 r9 A
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)4 V( o( ~" U: k7 t2 k9 N: h: M
  48. #else
    . D5 |& @& n$ n
  49. #define DMA_PRINTK( x... )
    4 z9 ~* ^7 V# o) v9 h& ^, \
  50. #define DMA_FN_IN
    ) W; t3 w0 ~. e9 \
  51. #define DMA_FN_OUT0 K4 q/ d- |6 z% K( g( C# x9 v) G; u
  52. #endif; o/ X9 P- h8 ?
  53. 9 n# X2 `2 b: L- X1 k; q+ g( c
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    9 W6 r3 Y5 Z5 r( G3 F
  55. #define STATIC_SHIFT                36 V/ f: [  @: l6 y( l2 t# X8 q7 [
  56. #define TCINTEN_SHIFT               20. {7 h! P1 c6 D9 w$ o* D8 d- W
  57. #define ITCINTEN_SHIFT              21
    7 s2 L: z: T9 P  `. I5 l
  58. #define TCCHEN_SHIFT                22
    * z/ P) x1 x: @8 {4 w' G/ H) _! r" L
  59. #define ITCCHEN_SHIFT               23
    * [$ m  v9 R" I: K; f# v! H
  60. 2 v. u- h2 N% i
  61. static volatile int irqraised1 = 0;8 p- i  W0 y# R# v1 V7 U
  62. static volatile int irqraised2 = 0;
    . ]% w' ?' f& z" _3 H! C
  63. " f; ]6 I" `% e9 e8 E
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 r, z  a* Z' c
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" |* k& r4 P" F% {
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- C7 {. }! r+ |! Y% w7 k2 Q
  67.   R4 f3 @4 j1 e& Q2 B& v: i4 r
  68. dma_addr_t dmaphyssrc1 = 0;( a6 h, j; A1 ~/ |9 A2 J; J8 o( \
  69. dma_addr_t dmaphyssrc2 = 0;" o6 P3 |3 e# }
  70. dma_addr_t dmaphysdest1 = 0;
    1 r% o1 c" h9 {- H3 R) ^) N+ V) n
  71. dma_addr_t dmaphysdest2 = 0;
    * e5 w& ?4 j/ k4 ]# P

  72. # w% O) |, ]! s( g* _  N' L
  73. char *dmabufsrc1 = NULL;
    $ b. z! I( T8 I- Y' z5 B2 l
  74. char *dmabufsrc2 = NULL;8 h, W& S! X6 t; r1 ]: ]$ t
  75. char *dmabufdest1 = NULL;* }. s: X$ d9 o6 ?$ y. T
  76. char *dmabufdest2 = NULL;
    # ~# b) V$ R/ T0 g; v+ a+ E
  77. - G5 q* I2 f: u# h- i
  78. static int acnt = 512;
    : E( c/ r( {& ~. w* W% b$ L& R. V
  79. static int bcnt = 8;
    + W9 k0 x; }0 P  r: u5 J( y6 |
  80. static int ccnt = 8;0 ^" w! x2 V' p) j. }2 Q( A

  81. + m5 u8 }7 X6 ^% o3 Y/ I, ]
  82. module_param(acnt, int, S_IRUGO);1 p/ U1 {8 W3 e* N5 A) ?8 H% d
  83. module_param(bcnt, int, S_IRUGO);
    & u- N* O5 A1 N
  84. module_param(ccnt, int, S_IRUGO);
复制代码
6 x' e5 L' g2 q* Y( m1 j2 ~
# X8 O  Z( @" u4 Z7 V0 j
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
+ f( x; w4 _1 [% g/ V* Y5 o" Yarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。) p' [. N8 p' L0 W8 H# O3 A
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
: C( v+ R5 j: ~2 B! P; H( I8 G! k8 o1 J1 t+ D" S' r% W
6 a" a" a$ N9 {5 O7 i$ i' i5 [
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-1 15:54 , Processed in 0.047585 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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