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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ' F# |( `- h# [5 `! Y1 j
  1. [code]EDMA sample test application
    2 k6 A3 K9 }; b7 Y: u& I
  2. /*
    4 w: a, b; v6 z; [# R
  3. * edma_test.c1 a$ I: U0 z3 ]* j. k$ ]( x0 m4 U" J/ z
  4. *" w3 D) {% Y! E+ c/ L1 Y& O
  5. * brief  EDMA3 Test Application
    $ ?. }3 n+ [  G- \. K
  6. *% `; \. H9 c, s" M4 I+ Y! f& ^
  7. *   This file contains EDMA3 Test code.- `% Z: g/ V6 a; E8 Q, U; P+ E6 i
  8. *4 P* A2 P" p7 r' _* w& s( P
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE, P7 a+ j# X0 X; w
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT0 A" P5 X  o+ I
  11. *         TO CHANGE.+ e+ l. A( {- v9 k5 L
  12. *+ G1 G# @! e8 b( {% @8 {; k* P& c
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/6 I0 M3 X4 B) J1 B. T
  14. *: j1 l% U/ B  h
  15. * This program is free software; you can redistribute it and/or# p' \; ^* y0 H
  16. * modify it under the terms of the GNU General Public License as  n3 `. g+ q4 e& f, ?: E& K  _
  17. * published by the Free Software Foundation version 2.
    1 I8 W/ j9 v6 L
  18. *5 g0 H7 X1 u$ i0 u# l; u  r6 t" O
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any+ v( r" R" y# o: s; }) T' k& X
  20. * kind, whether express or implied; without even the implied warranty/ y4 J7 A+ ?/ l, E
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    2 l" w% a  c' M. y/ W
  22. * GNU General Public License for more details.- M6 i0 ^" ]% ~- N4 M- e
  23. */$ S5 O: l6 U* D+ n# z" X; D# V

  24. # j  u7 {$ H9 U) W' p1 \( f
  25. #include <linux/module.h>( p$ A5 x' G( `& C5 ?; R
  26. #include <linux/init.h>
    / }) W0 c( C5 H6 c9 [9 s% i
  27. #include <linux/errno.h>" k, p  ?# G& f% d9 k
  28. #include <linux/types.h>" ~& Q) J* W; z$ ~1 h& v
  29. #include <linux/interrupt.h>
    8 ]8 U$ i4 u3 [& c) T
  30. #include <asm/io.h>0 c: c9 a% m7 Q' W* ?& u
  31. #include <linux/moduleparam.h>, G, q: X7 h" D; D% J
  32. #include <linux/sysctl.h>% ~3 M" Z1 I- g3 U, x+ u
  33. #include <linux/mm.h>- g3 ^' X0 k) a3 J9 ?% S6 @
  34. #include <linux/dma-mapping.h>
    . ~  |+ Q2 O$ l

  35. ! D7 T2 d8 Y7 A
  36. #include <mach/memory.h>, W: `. W5 u) V7 l# q
  37. #include <mach/hardware.h>; M5 l4 p" Z7 l$ g2 [; ?
  38. #include <mach/irqs.h>8 F' c7 b7 m; J4 _9 K# \. {
  39. #include <asm/hardware/edma.h>
    $ V1 l3 o* I# _6 f5 z
  40. ' g7 v' j. I- m
  41. #undef EDMA3_DEBUG
    1 p1 }+ S5 R0 U/ Y6 \( Q, ^" w
  42. /*#define EDMA3_DEBUG*/, \3 V' |# L- L( }" g3 l- Q' K6 a
  43. - g: m9 \) O6 L
  44. #ifdef EDMA3_DEBUG
    3 ]2 ~# K& v# L
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
      C; g, q* l% A  T; d2 N
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)6 t, T2 u/ h3 ^( b0 o" B
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__). c/ @1 |. T% U' }3 R
  48. #else. z& N3 e6 P9 i/ K& c) ]3 I
  49. #define DMA_PRINTK( x... )( {5 h4 ^# A$ A
  50. #define DMA_FN_IN' |+ ?" n% z" M0 a
  51. #define DMA_FN_OUT
    9 J( n0 b2 t! [
  52. #endif: d. i: l7 p0 O9 k

  53. ' S' r7 H3 _: L5 x
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768); ^/ b" `3 S5 S  e) h/ ?; f0 x& K
  55. #define STATIC_SHIFT                3
    ! p' B8 W5 u# T3 F
  56. #define TCINTEN_SHIFT               20- q5 x7 B2 K$ C* |7 e
  57. #define ITCINTEN_SHIFT              21
    - d1 M& z/ T9 x6 I- a8 u
  58. #define TCCHEN_SHIFT                22
    0 @% D3 V" W0 G# Z; \/ o' a0 Y% z
  59. #define ITCCHEN_SHIFT               23
    ! ~8 d7 {8 [9 f& ^
  60. 6 g: h1 ?; p1 j/ @+ y8 A: @
  61. static volatile int irqraised1 = 0;" I: S& Q. H6 B, N0 F
  62. static volatile int irqraised2 = 0;
    6 H) k7 o# w0 X' k+ b- k/ }
  63. ( F# C0 B$ ^% l7 E1 N6 K3 a4 ?' D
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ @1 I4 @) ^. y$ s6 a0 _
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + B9 K1 ]0 ~1 g* r; f
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" j% @1 s+ S5 t1 A# g

  67. - \8 w/ ?% d3 J- |+ b
  68. dma_addr_t dmaphyssrc1 = 0;
    * h- D1 E) `/ {
  69. dma_addr_t dmaphyssrc2 = 0;9 {( D; g! k) _& }
  70. dma_addr_t dmaphysdest1 = 0;2 y. S5 _1 s; ?# `. p& P4 s- W
  71. dma_addr_t dmaphysdest2 = 0;& V1 E* z- y! |2 ]7 l8 f* b$ \
  72. ) T4 L2 k5 M$ B) a
  73. char *dmabufsrc1 = NULL;
    " o3 I( T8 i& T3 N' D9 @2 w
  74. char *dmabufsrc2 = NULL;
    8 v& d, ^5 d& v. X, |- V1 Z
  75. char *dmabufdest1 = NULL;
    " D( e/ Y/ W( l* e7 b( O2 s2 ^7 Y& e
  76. char *dmabufdest2 = NULL;
    6 R# W0 R& I# N2 a. w: h" C% I

  77. & [2 ]# r" Q- I( @: y+ u0 W
  78. static int acnt = 512;" h$ \- l9 n! f5 D+ J8 U
  79. static int bcnt = 8;' N( O7 N% ^3 {7 j7 Y# }& s; F0 q
  80. static int ccnt = 8;, L; i  S' L0 c& m6 X

  81. ; _/ Q0 n" z4 R. d; V
  82. module_param(acnt, int, S_IRUGO);
    5 O  y  a8 R, I6 U/ h. L
  83. module_param(bcnt, int, S_IRUGO);
    " P% D7 T9 X! ?" z0 B
  84. module_param(ccnt, int, S_IRUGO);
复制代码
7 z2 p4 Z3 n& S4 b  ~. P4 H; A

' c# u1 _5 c! ]( l$ l      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
" s" h" W* a8 r# r% C4 j+ }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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。! b8 \& L: M' A8 n6 c: m
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
. t  G5 p- H5 I  r. ~  ~0 P% ?
. w6 Q, P) w0 J( z5 @1 f: K& U+ x: j2 ]# T2 g) J* H0 a
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-12 02:42 , Processed in 0.039952 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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