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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
9 H& g0 N: ^! m4 j0 l! K* {
  1. [code]EDMA sample test application7 M! B  u& r0 I1 f9 @0 U
  2. /*4 N* C! z/ a1 M: p
  3. * edma_test.c( h/ y: V5 N. Q& r3 v
  4. *: b' T% c9 i! c: u: D$ f+ O6 }
  5. * brief  EDMA3 Test Application& F/ j- Q3 {( u: C$ y
  6. *
    . R7 H" M" I5 I1 E/ }* x
  7. *   This file contains EDMA3 Test code.
    . o4 p* r" m, x7 E# g# E
  8. *
    # R1 G# |+ b6 f* R: \3 s8 o* h5 C
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE! W, I" N/ G  a/ W+ A
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT/ {  P) N; u) z( p) L' }
  11. *         TO CHANGE.
    9 v* J7 J$ d: A
  12. *
    8 n- x8 I- F7 c- r  g, l
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    0 r$ Y0 |1 I: a+ f) w+ t
  14. *
    . @, ]1 U9 C/ O3 H9 h3 H& [
  15. * This program is free software; you can redistribute it and/or
    * `5 Z( l0 H2 N( o6 ^2 M
  16. * modify it under the terms of the GNU General Public License as
    / m' a" f& |" U& }5 Q
  17. * published by the Free Software Foundation version 2.
    8 Z% Z5 R* k( x" b+ f
  18. *8 c# v) U5 p7 s: s% `
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any% o4 E" w' t9 n! q7 }) r: X4 @0 g0 `
  20. * kind, whether express or implied; without even the implied warranty4 p' K" @. h/ _7 W6 M+ A" @/ N
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    0 [3 Q8 C. n% f" Y0 [$ I
  22. * GNU General Public License for more details.
    6 f: h' B! \# Z+ x
  23. */
    : x: ?; Y& f+ C: A2 C1 E0 Z# z
  24. 4 D$ U/ E5 F4 @$ A) t) ?" ~
  25. #include <linux/module.h>
    " n7 N$ d, J# t  P
  26. #include <linux/init.h>
    6 a3 |, n2 u" {+ Q4 E- q6 W
  27. #include <linux/errno.h>& e5 f- V9 ?+ X6 A
  28. #include <linux/types.h>
    ) |, t2 M7 Q( f0 S$ ^
  29. #include <linux/interrupt.h>
    # Q' Y5 f' ]( T7 W0 Z; V( P
  30. #include <asm/io.h>
      y! A% q: U6 a/ ?% ]: M2 R6 h
  31. #include <linux/moduleparam.h>: t! z+ N  k+ l$ t1 y! |1 m
  32. #include <linux/sysctl.h>
    : z" r3 @% ?$ k- O( f
  33. #include <linux/mm.h># s0 D: Z$ o# y( n
  34. #include <linux/dma-mapping.h>
    7 ^8 p% h) z( A' U' N# m% X

  35. ! ?# u( r- Y& J  }* c
  36. #include <mach/memory.h>
    , e+ B; ?1 X) ~- \
  37. #include <mach/hardware.h>
    3 Y6 r2 ?4 h1 Q: h+ |
  38. #include <mach/irqs.h>1 W  Q* ?4 m2 i. l
  39. #include <asm/hardware/edma.h>/ x' \3 E& U* Y; v
  40. . g! X+ O4 k! w9 h7 g* T& V
  41. #undef EDMA3_DEBUG6 U* e/ d6 f9 C& q+ b
  42. /*#define EDMA3_DEBUG*/
    3 {/ T% H4 [& ?: M) a

  43. 4 }% n& m5 w3 j; ^& }# ^( _7 T
  44. #ifdef EDMA3_DEBUG/ [. K  @5 K3 k$ P$ E$ c$ \8 `
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)7 V8 P1 z& y$ P8 x! g* ?
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    / h5 k. u  u( X# V; h3 _# T) o
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    2 H; ~; S' _% A$ N
  48. #else% f1 Y1 ~/ w" c" t- U- I; H
  49. #define DMA_PRINTK( x... )
    $ @( p1 |& [3 }+ h& ]+ Z$ s
  50. #define DMA_FN_IN
    5 X: h0 I$ ]9 b7 |" g8 p
  51. #define DMA_FN_OUT
      w2 E2 V% y: e" L. F$ ?
  52. #endif
    % F$ {& t0 b( R' V+ p7 k

  53. : C. Z& p; L7 t+ X1 Y/ o  Q% B
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)8 {9 l, B( S5 o" ~2 y# h+ C
  55. #define STATIC_SHIFT                3* V% }, H3 Z0 i( z
  56. #define TCINTEN_SHIFT               20$ [+ ?" u; X7 S
  57. #define ITCINTEN_SHIFT              21
    5 X: V' M" P2 O; b0 U) F
  58. #define TCCHEN_SHIFT                227 L# N& L8 e% ^: g! r3 S1 _
  59. #define ITCCHEN_SHIFT               23! P6 J+ t" k7 @9 w) ^  y+ N% y& k

  60. 3 M" H; ]7 i5 J7 B, g/ x, i  T8 h) W
  61. static volatile int irqraised1 = 0;& m$ a+ T! a& V4 C, r  F
  62. static volatile int irqraised2 = 0;+ n  a% V# ]+ I5 _( X) x

  63. ( _9 R( K* X6 G- u  o6 k0 J
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 e3 p0 @% t9 t# C7 }$ U/ F# u
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; F) ?" l$ G+ S; g1 |
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & E/ |& i8 D7 G% \* C

  67. : J4 X+ ~. f# w% y0 W, T/ U9 c- O5 [
  68. dma_addr_t dmaphyssrc1 = 0;
    3 f$ b2 B& d) _
  69. dma_addr_t dmaphyssrc2 = 0;1 K9 b2 |9 M' F1 G
  70. dma_addr_t dmaphysdest1 = 0;, g' a% b# _1 ^: X
  71. dma_addr_t dmaphysdest2 = 0;, I/ r9 j3 v0 [8 B/ P6 D- `# e5 |
  72. # u1 o& v, z: o1 f- B/ j
  73. char *dmabufsrc1 = NULL;
    / A/ b# }8 {  J- o, H
  74. char *dmabufsrc2 = NULL;
    # U1 s3 ~8 N( X* O
  75. char *dmabufdest1 = NULL;, z, y) E8 F2 P/ H- f
  76. char *dmabufdest2 = NULL;
    ' V" T" I7 x; [% E9 F/ z
  77. 4 Y" B2 E  o5 K7 {4 p3 T# T) u% F
  78. static int acnt = 512;
    ) l1 |5 y$ j: z, O/ u9 G, q+ R
  79. static int bcnt = 8;
    ( j7 y' Q' m9 ^
  80. static int ccnt = 8;
    2 p" U' D% s1 Z% t! s

  81. 8 _2 B  q" A8 p( P# w6 ?" m3 q
  82. module_param(acnt, int, S_IRUGO);
    4 K; N( W; f9 K
  83. module_param(bcnt, int, S_IRUGO);  b/ N; x4 D8 h) e- A( x
  84. module_param(ccnt, int, S_IRUGO);
复制代码
" d( C& z3 T* K  I0 ?9 Y1 O* P& X

$ B' f, C  f2 J+ Y4 b0 ^' o; V# @      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用/ i* b/ x4 s8 p- D( k
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。0 Y+ ]+ F* S2 d; i$ ~. g: _' E
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
0 E0 s) t  [( F3 {. v  R5 D' u
! t/ f% S' R& i: P# _/ U. `0 f: r9 B5 ?. q; X3 U) p1 K+ P
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-17 13:19 , Processed in 0.040049 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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