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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
) Y$ Y: P% w9 d0 B4 Q$ T, Y
  1. [code]EDMA sample test application
    ! f# K9 o& ~- s; O  u( h6 ]% f4 m
  2. /*  Q' g. g  B2 f- o3 S
  3. * edma_test.c
    9 j6 l& t0 d7 g2 z& y! W- P( t
  4. *
    1 }1 K: v: U# q1 l3 x) p- E+ C0 G
  5. * brief  EDMA3 Test Application
    3 J4 l3 l7 ]9 b% h* L, m0 W/ O# s$ I
  6. *  {4 \( p. c2 Y8 w, N/ ?
  7. *   This file contains EDMA3 Test code.) X0 m8 ~! Z4 [# l4 R- V
  8. *
    5 [- ]6 R0 _! w& E5 G3 c7 Z
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    & q' [, s' f( S. ?' Q" H
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    3 q% v* ~- a/ N
  11. *         TO CHANGE.
    / \9 O, y, y" J& A6 E8 S
  12. *
    0 u$ V  v* ]# X
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/$ o; h4 v+ Q: h7 z7 q
  14. *
    7 Y- n6 |3 N; P6 D) A6 @3 {; O8 j
  15. * This program is free software; you can redistribute it and/or1 [! Q9 y' U1 i+ J1 a  ^
  16. * modify it under the terms of the GNU General Public License as
    & y; W' T; o5 e0 w" D& G9 G7 @
  17. * published by the Free Software Foundation version 2.5 `5 d9 n/ n3 g8 l7 t
  18. *6 q# n# x+ Q; d/ Y6 V. @
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any, V' z; `+ Q7 g
  20. * kind, whether express or implied; without even the implied warranty5 ?9 J6 Y4 N9 d# J- b3 ]
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    * y1 ]. i, K+ `) r1 B4 D
  22. * GNU General Public License for more details.) O4 b) E7 e3 x* t0 s# @" q
  23. */  C- B( E, W2 Y
  24. 9 A  r: I# S, z: P
  25. #include <linux/module.h>: \, w5 s# b) S7 j5 Y# K
  26. #include <linux/init.h>1 |. A; N% P& X1 ^0 J0 B1 _7 x' I  M: T
  27. #include <linux/errno.h>
    ( a1 b2 {3 Z+ m- p8 Y
  28. #include <linux/types.h>1 ?3 E0 c. l% @! X
  29. #include <linux/interrupt.h>
    3 l7 O8 `5 L  Q( \; {% ]
  30. #include <asm/io.h>- N& y8 M  n9 Y3 g! h, e
  31. #include <linux/moduleparam.h>
    7 g) ~# [9 F0 b
  32. #include <linux/sysctl.h>9 V( K" P/ l& u+ k6 H( i0 i
  33. #include <linux/mm.h>* f, K* K3 s$ j
  34. #include <linux/dma-mapping.h>9 }' B5 C# T- S2 q! j( K
  35. ! E+ p# w8 C* g/ N  ^% _! M
  36. #include <mach/memory.h>
    + R5 S' c" E3 z) L" B1 m' A
  37. #include <mach/hardware.h>
    + y+ B- Z+ U7 y6 ]# o  H
  38. #include <mach/irqs.h>' `3 }, W( `  d" Q, x! R
  39. #include <asm/hardware/edma.h>
    ) u5 C( y$ |' r" E- @
  40. 2 N- {6 e; Z. L( ?
  41. #undef EDMA3_DEBUG
    8 e6 Y0 q# c4 x7 \/ K* {  Z
  42. /*#define EDMA3_DEBUG*/, i9 p8 [+ s* d5 W, e9 x8 B
  43. 2 [8 B7 r# w0 i9 b
  44. #ifdef EDMA3_DEBUG0 v% M; e0 |  y
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)7 O; C+ U. B$ s8 _$ S
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ! o: N2 {- }; \7 [; t" j7 Z& b$ d
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)0 E8 i! ?( R$ I2 G, C4 d
  48. #else
      `8 E$ S, N9 u/ s7 y' N
  49. #define DMA_PRINTK( x... )1 I& l4 Y3 o/ r' X0 ^' T5 e
  50. #define DMA_FN_IN0 u9 y5 p: g2 y
  51. #define DMA_FN_OUT( s2 G" D' A7 g6 i3 X  p1 U+ w
  52. #endif! n5 b6 `# m! O0 v3 B# S: ]- m7 E- F
  53. 9 q. R# h5 a2 M- Q6 \
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    8 }, a2 {4 N8 S2 t  d
  55. #define STATIC_SHIFT                3
    6 {! T, B, F* N% Z. N, J/ Z
  56. #define TCINTEN_SHIFT               20* L, e7 C' m/ g6 m# t
  57. #define ITCINTEN_SHIFT              21- o! M8 B1 A; Q, Y$ b1 ^
  58. #define TCCHEN_SHIFT                221 z0 T0 z7 U& z, P
  59. #define ITCCHEN_SHIFT               23
    ( N  i* @" Q) y$ p4 t
  60. . I: C0 i! f) G: R) j6 c% k
  61. static volatile int irqraised1 = 0;  U: u1 H( h2 {% ?& [; m2 X/ @: |% C
  62. static volatile int irqraised2 = 0;% ?; B+ m) d7 L  v' P5 [1 ?8 ^

  63. + m# M/ D* `# P3 s9 a4 @; N/ S; b! }
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! Z: h+ G4 G, K: X! {4 M
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& x8 {3 d7 V9 e8 ?
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 p& L1 |" L! R4 V  e5 r  N

  67. 6 ?) ?3 _; S6 H/ J
  68. dma_addr_t dmaphyssrc1 = 0;
    ' i/ {5 s, K* C5 q( m
  69. dma_addr_t dmaphyssrc2 = 0;+ H4 j! P2 ]" }7 |. E  |* N& {8 i4 s
  70. dma_addr_t dmaphysdest1 = 0;
      Q7 h; n* L8 F
  71. dma_addr_t dmaphysdest2 = 0;0 e3 k6 B/ u1 u/ G. D* M

  72. 3 ~0 D4 x9 ~8 i
  73. char *dmabufsrc1 = NULL;9 }% U. N5 U4 a$ C# O8 w) \
  74. char *dmabufsrc2 = NULL;
    5 g( W/ o! M" g5 `4 c
  75. char *dmabufdest1 = NULL;
    8 A7 f6 m+ I  v' }  W
  76. char *dmabufdest2 = NULL;
    ; M3 X, S( K5 O5 @9 ~' w# D' z5 ?/ h( U
  77. , a5 {, S# Z0 K( _# |
  78. static int acnt = 512;0 a5 n7 ^- G, E- k. c  p
  79. static int bcnt = 8;6 {, u) ~+ S7 p- A
  80. static int ccnt = 8;
    9 [; Z$ q# i1 Y0 f' C9 U

  81. ' m2 N5 [" X$ W* V" ]
  82. module_param(acnt, int, S_IRUGO);6 y4 s0 B: w, C6 [' ^/ w
  83. module_param(bcnt, int, S_IRUGO);' V5 ?# M1 }/ h
  84. module_param(ccnt, int, S_IRUGO);
复制代码
+ \8 l1 m! t, S/ j5 J& q
& C8 S9 n% [0 `& `
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
& p3 e5 Y! W5 t5 X2 parm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
3 g" A$ t- q5 r' ~     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
# a% j/ }" V, O7 h7 @0 ]3 j. }  R5 L! M( j+ u* |7 S& }
* E( X* I  I5 x# Y4 l& M
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-6-18 00:00 , Processed in 0.057917 second(s), 34 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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