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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
: l! w0 w$ ~& a$ n; x2 V
  1. [code]EDMA sample test application
    ! c6 U& I% [7 ^" P1 E7 Y* k
  2. /*7 y. k8 g& |' X4 f! z
  3. * edma_test.c
    4 Z  S! I" Q8 w2 w2 p- b$ E
  4. *4 W% O1 n: `* }
  5. * brief  EDMA3 Test Application
    ! _& H( R) {8 I  e3 [
  6. ** h( E! G* p0 [0 t( e
  7. *   This file contains EDMA3 Test code.9 p+ Z/ ^6 l# }/ y" z
  8. *4 A2 h" {4 k: d5 |! u  b  t
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    1 ?; e9 t' w2 z- M$ `& k, O
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    5 w. u6 T; V+ c; D9 ^% Q
  11. *         TO CHANGE.
    4 b' M3 g6 E8 M, p% O0 X" Y
  12. *8 D, u! G+ U" U; E0 o3 l
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/6 S' X' r8 l" I/ D3 k
  14. *. F0 y1 f: [" U
  15. * This program is free software; you can redistribute it and/or: V) Z  h& t' w: Z
  16. * modify it under the terms of the GNU General Public License as. e# y9 I# I5 v( P) H& B
  17. * published by the Free Software Foundation version 2.
    , Z+ Z( i" L' v8 y5 X4 z
  18. *
    ) x0 I$ T9 _# ^! X+ U# i
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any* c0 g6 f! h$ A9 S
  20. * kind, whether express or implied; without even the implied warranty
    # x. S" O  V) t8 H1 P! c
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ; F; T5 e4 f$ F" A
  22. * GNU General Public License for more details.
    4 h7 |. f5 @, K, t* q
  23. */1 c3 C- h" j; y8 }

  24. $ m% p; _+ x8 ^3 @
  25. #include <linux/module.h>+ m: P* B" u2 b% M# m  s
  26. #include <linux/init.h>1 Q: `! c! ?2 x* L% j4 }
  27. #include <linux/errno.h>: j8 Y9 n  b5 _2 `( D$ Z
  28. #include <linux/types.h>
    # [- m% L$ k" I: P( Q! x1 o, \
  29. #include <linux/interrupt.h>
    4 a7 I+ ^' G$ T# o8 r% @- l
  30. #include <asm/io.h>0 x4 E# s9 ]* \3 ?
  31. #include <linux/moduleparam.h>
    0 K" e  B$ b" l' q! v
  32. #include <linux/sysctl.h>
    ) w# K$ E  w- y- p, R* d
  33. #include <linux/mm.h>) N3 ?2 k2 D4 ?0 n
  34. #include <linux/dma-mapping.h>
    9 A* J1 d( E8 ]8 v  B: s1 l7 ?

  35. . e6 ?  x2 E9 \( Z8 I4 F+ z
  36. #include <mach/memory.h>
    ! u: u! `7 \) P& L) T! x/ Z
  37. #include <mach/hardware.h>
    ! \4 Z3 T7 |. X" O, K& `8 n! W
  38. #include <mach/irqs.h>- i9 B. U4 v- ~+ S5 g/ T
  39. #include <asm/hardware/edma.h>
    - m8 i( I/ ]* ^
  40. $ o4 i$ s& H( s; x$ L  ?) z
  41. #undef EDMA3_DEBUG
    - \# @- J$ d0 N2 ^0 Z+ m1 _, y
  42. /*#define EDMA3_DEBUG*/
    8 B2 i* [' j- @) I4 n6 h. Z3 x
  43. , A8 v5 [2 z% H2 r# X9 x" Y
  44. #ifdef EDMA3_DEBUG7 c& e; y/ Z5 Q) I. h! v
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    8 j2 m, Z# y& q# K0 `
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    1 W: E! p1 S; p' t
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    % u, [! h" @; _8 ~0 T- M3 H
  48. #else
    5 |$ ^# Z, B/ i6 w
  49. #define DMA_PRINTK( x... )1 U+ ~) H9 w+ J& g
  50. #define DMA_FN_IN
    4 o* K* h0 e: B, L
  51. #define DMA_FN_OUT; M  F  Q; h5 S8 p+ P4 w, \3 s* J
  52. #endif, I' R3 }: t$ q" V
  53. 7 Z% ~6 c( e" z
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)6 r  @. L5 C& D8 ?+ L3 b* s
  55. #define STATIC_SHIFT                3/ \- ?4 B: z+ _  h
  56. #define TCINTEN_SHIFT               20) L" v8 A0 v7 h4 I0 t& g& C
  57. #define ITCINTEN_SHIFT              21
    ( r7 w5 F6 u/ M2 ~9 h6 x; v, p7 T) f
  58. #define TCCHEN_SHIFT                22
    ( I3 Y  F8 P& t, p% q, A
  59. #define ITCCHEN_SHIFT               23. e8 n! D/ ?' N
  60. 2 `& J' l" g- d
  61. static volatile int irqraised1 = 0;  }8 f+ N) G4 T
  62. static volatile int irqraised2 = 0;
    0 G. }; z) Y1 {: T4 M

  63. 6 a3 R+ Y  d, g) M3 U
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % K. j8 p3 X; f% Z! M0 Y
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. j8 L7 R* X0 H  Y) H# O1 `
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* v7 H; B, @6 L5 E2 s7 Q

  67. 1 c2 Y! j! u3 Y. F# u+ F* V
  68. dma_addr_t dmaphyssrc1 = 0;5 ?  k& X! x. Q8 [# E* Q/ l. F
  69. dma_addr_t dmaphyssrc2 = 0;
    & X+ s" M+ r- ~, W
  70. dma_addr_t dmaphysdest1 = 0;+ f9 g2 \; J$ Z0 J( x4 l- D' p- G4 b
  71. dma_addr_t dmaphysdest2 = 0;
    0 Q) ~; M( J% k; ]

  72. 6 w9 \. e4 W' R4 L, N
  73. char *dmabufsrc1 = NULL;
    4 s! z: k: X: j  E; s6 x, u
  74. char *dmabufsrc2 = NULL;  k3 S7 e" }5 ?0 O, q2 q) B; d6 p
  75. char *dmabufdest1 = NULL;
    7 L# X( E* W% s! d0 @
  76. char *dmabufdest2 = NULL;
    % L* u$ k( Y' o3 O. C& R
  77. % M; O* Y+ \2 V! p
  78. static int acnt = 512;5 F3 v+ h* L6 h* A- o. C# e
  79. static int bcnt = 8;
    7 [6 J) O* O/ [* `$ o
  80. static int ccnt = 8;5 v' U# ?8 W% S+ P% N

  81. , E. v- z2 B2 d# n  l, j  q
  82. module_param(acnt, int, S_IRUGO);  f+ u* r+ q; K" I, Z# R
  83. module_param(bcnt, int, S_IRUGO);! ~6 v, q; Y' o" M2 \
  84. module_param(ccnt, int, S_IRUGO);
复制代码

6 S3 Y6 X) j. _; Q. b2 w5 Y$ F5 I5 y' c8 p3 e1 T* C6 o- X
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
  J6 S5 K" O4 F6 H% h! D$ rarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。% G/ |7 K; L' ]) j5 Y9 n
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。( x  V1 A" Y5 M; N- @. m1 m6 l

8 q7 w/ Y: Z* G4 |9 x$ z( b1 O1 d( `
/ d+ r1 Y8 T# A
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-7 06:59 , Processed in 0.040115 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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