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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 : Q1 y( o7 U( [! i( M* M3 X
  1. [code]EDMA sample test application- C- Q5 O2 x7 }0 `7 a
  2. /*
    0 k2 z0 h+ q: U' N. c1 @, B6 v
  3. * edma_test.c
    : ^% H0 w1 w6 R& C* y4 B
  4. *
    " J0 {6 h5 U( P$ e% Z9 a
  5. * brief  EDMA3 Test Application
    : O! M2 d, M  d" j* R& A
  6. *. Q8 p! l! g/ X) T- [
  7. *   This file contains EDMA3 Test code.. E/ L! Z& f0 n1 k' J2 E# O
  8. *# \) y, I0 T+ B/ U, N
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE) F/ P; O9 s5 J
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT# c8 w. C/ }9 ?) [! D
  11. *         TO CHANGE.4 }' b9 ?  E* c" u- W
  12. *# ~  {! P# O8 ]
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    4 d' e6 L( O4 Y1 [' ?; Z
  14. *
    4 ^4 |! k) b! C
  15. * This program is free software; you can redistribute it and/or5 Z; r) o# B5 X; i& B
  16. * modify it under the terms of the GNU General Public License as
    9 I* u! o* m& S# O/ s8 G4 t
  17. * published by the Free Software Foundation version 2.3 C  a" z3 S' }9 N1 ~% X  `
  18. *2 Z( V& t1 }/ F% \# y# s' v3 g
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    , g( W9 K) i, B. g6 J9 `5 ?; R0 J
  20. * kind, whether express or implied; without even the implied warranty
    " }9 u  e' b( a3 T
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the' O9 U' P6 J  S- m$ }
  22. * GNU General Public License for more details.
    % z% l8 k% N  A$ q1 [
  23. */
    . s2 ?$ e. q5 f! y  F
  24. 0 T( K) e4 Z1 o1 u! _5 l( _3 Y
  25. #include <linux/module.h>) q  s7 V& K- {5 b% Q
  26. #include <linux/init.h>
    & C+ J  z$ I" Q. T9 d% B
  27. #include <linux/errno.h>9 C$ p, B& y: {) n9 ~6 [2 [. n7 e
  28. #include <linux/types.h>
    6 D5 V9 ]9 a$ _
  29. #include <linux/interrupt.h># T0 V( S) _# I! n9 B% J
  30. #include <asm/io.h>! W0 G6 m3 k& A6 b
  31. #include <linux/moduleparam.h>. }# D0 m: }! M
  32. #include <linux/sysctl.h>! C% V7 d. J: y. |  \  Y2 g
  33. #include <linux/mm.h>
    & T$ l, _$ ^3 y2 }7 d* ^" R
  34. #include <linux/dma-mapping.h>
    " ?$ i' u1 Y3 D  W, J6 C
  35. 1 H; Y9 R7 \& t9 W' a6 F) J8 @% x- D
  36. #include <mach/memory.h>9 L( e7 J- L4 Z$ A
  37. #include <mach/hardware.h>4 n7 I) v" w' \9 v0 M
  38. #include <mach/irqs.h>3 [- [$ ~8 G. y
  39. #include <asm/hardware/edma.h>" h1 Q' j5 b- q$ C' ^

  40. 8 l+ K0 z7 a8 S5 j* R6 ?4 T
  41. #undef EDMA3_DEBUG
    0 R! m  J! C6 m! r& j8 |. U' C
  42. /*#define EDMA3_DEBUG*/, T5 }' k9 D2 o6 Z! b
  43. 2 x7 T' M. k$ H: b- k3 u! v1 t
  44. #ifdef EDMA3_DEBUG
    " _8 z% h- n8 ]; c
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    3 B# A% F5 G& N& d1 f& N
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)  E- N; _# |) O) `6 Y# y
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)# ?" r+ F& k/ {1 k
  48. #else
    $ Q2 Y, S; l7 Z0 K! L
  49. #define DMA_PRINTK( x... )
    : l) }6 d# G% q  D+ Y  b9 l
  50. #define DMA_FN_IN
    . a$ [. Z: q, k! t; g
  51. #define DMA_FN_OUT
    1 A6 }3 ~/ ?% i" w% D2 O
  52. #endif
      J( Z/ ~7 k* h# I6 D5 F/ O" h
  53. ( \5 Y+ F+ X: `5 i/ U
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    , J; p+ U/ T: V1 ?" w& u
  55. #define STATIC_SHIFT                3% D9 @  ]4 `2 W0 M$ ~0 \  \0 s
  56. #define TCINTEN_SHIFT               20
    1 M3 e% W3 {# J7 K' p  I! R% d
  57. #define ITCINTEN_SHIFT              21
    $ X2 U- j0 T. }2 Q: _# U: K
  58. #define TCCHEN_SHIFT                22
    4 x4 ]9 x( b1 K6 Z0 h* _
  59. #define ITCCHEN_SHIFT               23/ n/ |9 C$ e" m4 [' \

  60. 1 i. u% B" Y) q+ d( A4 ^2 u
  61. static volatile int irqraised1 = 0;! p( S; P( M) b4 D
  62. static volatile int irqraised2 = 0;0 {! u2 m* I9 C
  63. 3 v9 E+ H4 X  r( u, ]7 v4 {
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 w" M6 \5 d! r
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 J, r* e. u' y) I7 x
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  `: X  D4 Y: C) ^. @- Z  Q: `

  67. 9 I2 c, c) @* ^% ]9 m# c' v
  68. dma_addr_t dmaphyssrc1 = 0;% h; k% Z. T; G$ t
  69. dma_addr_t dmaphyssrc2 = 0;
    + X( |% B# F( X% S; Z' f
  70. dma_addr_t dmaphysdest1 = 0;
    ( a9 a! {: m* I4 m) a
  71. dma_addr_t dmaphysdest2 = 0;( R( C' [. l' c3 L: f
  72. $ {3 X# @6 R# ?6 O$ G% {, k) x
  73. char *dmabufsrc1 = NULL;
    3 {' T8 `/ a2 d6 @) `9 |. l
  74. char *dmabufsrc2 = NULL;. z, k  \8 Y! ]/ ^0 L8 @+ j9 x$ f
  75. char *dmabufdest1 = NULL;' F5 G0 p; u5 t/ R: [3 H
  76. char *dmabufdest2 = NULL;& T5 X9 N9 J" _6 o8 l1 i
  77. 1 v. q) f8 \9 k* `# x3 w0 c
  78. static int acnt = 512;% `3 L3 U. U. t/ g4 p* r
  79. static int bcnt = 8;
    ' n& d. z  j: Q1 s( A' \& j# [
  80. static int ccnt = 8;
    / ^5 M0 a3 O5 a# _3 q- e: N

  81. $ w  f" V; J! Y. \  Q9 L  x( Z
  82. module_param(acnt, int, S_IRUGO);' v( V. `: e8 I# R$ Z4 j
  83. module_param(bcnt, int, S_IRUGO);
    1 |6 C% Y- r: M* n% k9 Z4 m- q
  84. module_param(ccnt, int, S_IRUGO);
复制代码

) C# }- U8 s3 V
& r" D; c: X8 C4 R5 w0 D3 ]3 y. Y      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用& h' W1 B5 ?  L8 K; X2 U
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。  a5 W$ F( B6 |  D: e1 K
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。( K( L+ {* @' J! E  ?) t3 `

5 l5 p( ^0 d6 w
( `$ w# w) p' q' P0 D8 r% ^
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-5 19:41 , Processed in 0.038884 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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