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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 $ x0 q1 v. |, n8 i4 `+ x2 n5 |
  1. [code]EDMA sample test application/ ?1 _7 l+ `$ t. b7 N
  2. /*
    9 ^: i* q0 ?0 u5 ]# i! D, H
  3. * edma_test.c" a$ E8 w: r1 E* Z# b
  4. *$ v: ?" \3 f& ~, I  ?& K: R
  5. * brief  EDMA3 Test Application
    2 ?4 @9 O& W$ R0 z) p$ q
  6. *
    : \) I- M& Q2 v" ?: q4 ]6 f$ A
  7. *   This file contains EDMA3 Test code.
    $ Z' |( u8 _# `  y$ {
  8. *' E# ^, Q* D0 t1 x1 d! m1 J
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ) m, E4 b! F- m
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    . P& E: U+ k2 b. j
  11. *         TO CHANGE.
    % w; x1 w. K* R, h, @" B/ |& v
  12. *
    ! V5 P- T- s8 h! H0 \
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    . L4 A/ ?! Q$ p% Q9 J  ~! }: Y
  14. *
    - U  A8 Q, ~  ~7 S4 ~+ n/ h" ]
  15. * This program is free software; you can redistribute it and/or
    9 ?$ u7 v. W7 |
  16. * modify it under the terms of the GNU General Public License as5 F- O3 C. _2 a, \2 K; c2 {
  17. * published by the Free Software Foundation version 2.! w9 f- i: _# w3 p) g
  18. *
    ( m* N0 M0 b6 j0 R
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any8 W2 N- o/ t8 ~* c) B
  20. * kind, whether express or implied; without even the implied warranty0 b" I& n. v6 P% a2 y+ w
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    : o9 k+ H/ \0 q) \) p- m3 S6 X8 w
  22. * GNU General Public License for more details.6 t) U8 M) \) D3 O
  23. */- Z$ q" ^0 S% _! \8 y5 K
  24. . E# h: M; e- }7 n4 O! f" `
  25. #include <linux/module.h>
    2 D2 B% B1 q. U0 Z9 Q6 i6 n
  26. #include <linux/init.h>/ R# O4 g, S8 A9 V) D/ C" @' z
  27. #include <linux/errno.h>
    # i/ g7 A) G  W1 V$ V
  28. #include <linux/types.h>
    6 _9 j- R1 g' g' v) }! [! C) C
  29. #include <linux/interrupt.h>
    6 q% f* |4 V6 F2 N( M
  30. #include <asm/io.h>
    * _; s; _7 O+ i/ h0 k7 f
  31. #include <linux/moduleparam.h>
    * T" P- k% J) a3 v0 J6 |9 i
  32. #include <linux/sysctl.h>" u) m: A5 q: _$ Z  i5 Z
  33. #include <linux/mm.h>7 R; r* X! h% h
  34. #include <linux/dma-mapping.h>$ S; V) T* L/ F0 ?
  35. 2 A' h0 v( B) j$ n
  36. #include <mach/memory.h>4 O& w* @- ?' i/ S) l0 k: ]* I
  37. #include <mach/hardware.h>) m/ U3 M$ P- r$ m# G9 Q
  38. #include <mach/irqs.h>
    " E; P  C" f3 E4 t
  39. #include <asm/hardware/edma.h>
    " {6 _" y( R- v
  40. : J( ?$ k! j$ _
  41. #undef EDMA3_DEBUG8 j. c2 u2 U- l; h
  42. /*#define EDMA3_DEBUG*/
    * c  i- D) H* ]& \
  43. & [% J0 M5 A4 n0 X: M4 i0 i" D2 ^
  44. #ifdef EDMA3_DEBUG
    ; g& r2 n2 z; C+ p: @
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)3 N) M3 a& w& x$ ]3 Z' W$ O
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    0 j+ B- d( @2 ~0 T
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__). z% |! \* L/ C8 M
  48. #else& C+ B+ f3 m8 H3 p0 p; G
  49. #define DMA_PRINTK( x... )( o( E/ j" z3 g; d/ z; [
  50. #define DMA_FN_IN+ u7 \& s# Q0 G: z! j! j' \* \
  51. #define DMA_FN_OUT, ?( N# f* _0 K# }2 x. P$ n5 G0 d
  52. #endif& E; ~: u8 x% \; q' X7 j1 D* r# ^
  53. : M, Z' c2 [3 S  T
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    $ i6 P4 ~# {9 ^7 w& R3 }
  55. #define STATIC_SHIFT                33 p* A1 ^" d# x8 i# Z& d, Z
  56. #define TCINTEN_SHIFT               201 W; X. A6 z2 k- d7 k
  57. #define ITCINTEN_SHIFT              215 q! D0 G5 q2 s  w, ~7 [5 W
  58. #define TCCHEN_SHIFT                22- f( o: x5 t/ {/ l' O
  59. #define ITCCHEN_SHIFT               23+ I' w- w. T5 _/ z
  60. 7 K  `1 V0 P0 _" H# i& C. ^
  61. static volatile int irqraised1 = 0;. L8 I- D& l4 \$ l  z' D& J1 c0 a
  62. static volatile int irqraised2 = 0;
    6 f# W. G+ v* f) S6 L: |

  63. ; U% m2 ^  n2 p# m
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) h. N0 t9 `2 q  S, d/ k( F& Y5 K
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 e$ O4 ?" G) h  V1 d: M- X6 L
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 o9 P1 k' Y# q' g$ I% s9 ~3 V; p- y% \

  67. ; l4 o( x3 y  G
  68. dma_addr_t dmaphyssrc1 = 0;
      b* ^- O; F3 g' K
  69. dma_addr_t dmaphyssrc2 = 0;5 D8 m5 L/ B/ J4 D3 J3 U
  70. dma_addr_t dmaphysdest1 = 0;
    $ v  O% x3 i" [1 A" J
  71. dma_addr_t dmaphysdest2 = 0;5 U0 P* v# _2 L5 P  p& g

  72. 6 {  ~  F: O/ w
  73. char *dmabufsrc1 = NULL;
    ' W! e/ D& E0 }' ?5 c+ L8 ]" ]  f
  74. char *dmabufsrc2 = NULL;$ W7 f$ `, t& N. J( p
  75. char *dmabufdest1 = NULL;" |, }! _; a+ ^$ k
  76. char *dmabufdest2 = NULL;
    7 r# k5 A* R( y) K
  77. % s1 ^/ p' X$ d2 y
  78. static int acnt = 512;2 ?0 }* p9 D6 W) N" }8 R6 h$ g; I4 Q6 L
  79. static int bcnt = 8;& z* z1 }0 b, d0 G6 y
  80. static int ccnt = 8;/ @  _( q( n9 {4 H4 j- K( A' w

  81. + j# S. Z1 r8 ?' \; D9 j9 N) }" v  S
  82. module_param(acnt, int, S_IRUGO);5 E6 G& ~1 }( }- q" y, A" Q8 Q
  83. module_param(bcnt, int, S_IRUGO);
    6 J+ k  O$ z# [7 K
  84. module_param(ccnt, int, S_IRUGO);
复制代码
: \( L- {. i9 Y$ f* f  f! X  A) b
) o2 K, h) P. p: g0 _
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
. P9 p2 o6 W2 Y/ Z/ T8 Q4 ~3 @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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
( D% V! [7 P& m. [7 L3 E( u     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。3 X0 t7 I- |' i/ q# K
2 l- z! H6 l6 ^5 p% N5 P% s4 N0 \

1 f; R' j" ^7 [( O; }  a, [
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-8-9 06:57 , Processed in 0.038142 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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