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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 / V2 z, a, g7 Y* U+ y
  1. [code]EDMA sample test application* q" l, B1 h, m. u& I" p2 w
  2. /*  t8 j, A' ^; R
  3. * edma_test.c% F) H% Y; t6 t' \
  4. *
    5 K" z  l) R/ b+ ?2 Q
  5. * brief  EDMA3 Test Application
    + p1 R% Y( N; ^9 H! T) L1 t+ D
  6. *
    7 x8 ]9 {8 s) Q$ u) n+ O* v' s. g
  7. *   This file contains EDMA3 Test code.
    0 i  u. G$ C( n- I
  8. *
    " u9 P2 {/ ?$ j' h3 @- }
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    $ N- ?# V5 s8 i% V7 z
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    2 F; ^) k9 F# F$ _
  11. *         TO CHANGE.8 [8 @: c% v9 ~: V# P+ g8 N
  12. *( u! F" L. k5 j+ z- y
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    5 q6 u) G3 r2 J
  14. *# P9 _& m% e: m+ [* T
  15. * This program is free software; you can redistribute it and/or
    4 Z; ^/ p- j+ R0 P% i9 [" H
  16. * modify it under the terms of the GNU General Public License as
    8 I/ E- d4 X% b1 Z5 t, Z4 t
  17. * published by the Free Software Foundation version 2.
    , T5 W9 _' h! c' d1 e/ H8 R
  18. *
    ( F2 U  f: H0 b, _
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    . [) @+ f5 C- n/ u* o; e
  20. * kind, whether express or implied; without even the implied warranty
    + L  X% K' d6 s% `8 N
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the0 x8 C; |1 G# t1 w7 K# W  b
  22. * GNU General Public License for more details.
    1 t) r- z( a" b( E1 M
  23. */
    ( m) n$ Z+ l7 }& c8 o3 t

  24. . F2 v3 l( m  c2 ^% |7 U9 s
  25. #include <linux/module.h>
    2 p4 ]: y0 [; Q; ]
  26. #include <linux/init.h>
    - C+ l/ F! s/ u9 I  J
  27. #include <linux/errno.h>
    3 L4 c1 i( w+ W" ^
  28. #include <linux/types.h>* t4 g4 o4 k' v! e
  29. #include <linux/interrupt.h>/ c  Z3 r; _  E. K1 V
  30. #include <asm/io.h>
    2 R# P" e; N# B
  31. #include <linux/moduleparam.h>- @# K7 f. F- [, @: N4 a
  32. #include <linux/sysctl.h>
      s- ~. A, z( ]) i9 H- L
  33. #include <linux/mm.h>) w1 B" g* d; a$ i# k
  34. #include <linux/dma-mapping.h>
    1 Q1 Z1 ]& I" o6 n/ }) j

  35. ) K; v$ C6 S0 o4 P
  36. #include <mach/memory.h>3 {, w5 c+ I9 c' t
  37. #include <mach/hardware.h>. F% X1 d; [) q; i
  38. #include <mach/irqs.h>
    6 x, s6 h$ n$ w6 w) S  h
  39. #include <asm/hardware/edma.h>6 }( V0 n( v6 O" E

  40. & G5 k9 T$ p9 t" ~" T
  41. #undef EDMA3_DEBUG
    # e1 z7 w3 A0 l5 m
  42. /*#define EDMA3_DEBUG*/# p6 Q2 H; u( l' w) A  H

  43. 6 O& H% H3 w& _, q9 F
  44. #ifdef EDMA3_DEBUG
    9 |5 Z' E8 [* _4 m& u# {
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)7 p8 U# s# t6 Q* a; ]) S7 g
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    , T3 o' k7 F7 k* w" |
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ! R1 u4 u$ T- Z6 R! o
  48. #else, b$ i9 _9 L% j6 l: g0 e: `) m* i% u
  49. #define DMA_PRINTK( x... )7 ^% T0 m0 v, S. R$ K
  50. #define DMA_FN_IN
    : i' }" K7 M7 A2 z1 h% Q
  51. #define DMA_FN_OUT7 n) D+ r2 c' n
  52. #endif5 Q$ d3 W! p0 m9 R% g; P: r8 l/ |

  53. 1 r2 R5 n  S" ~+ Z, ~6 S4 B
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)1 g$ \; D' \  o; ?- d
  55. #define STATIC_SHIFT                3: a6 I3 n  U, h3 [' \' W5 E
  56. #define TCINTEN_SHIFT               20& d( _+ B4 }  @+ ^! {
  57. #define ITCINTEN_SHIFT              21( w! a5 ]- h  V( y
  58. #define TCCHEN_SHIFT                22
    ; m1 y" r, X/ ^) A  M
  59. #define ITCCHEN_SHIFT               234 X0 R* G$ `0 ]  G+ k3 u7 ^

  60. 4 K7 b) f5 g* I! ~5 P0 M
  61. static volatile int irqraised1 = 0;
    ( F, K5 Z* B5 i2 r8 Z
  62. static volatile int irqraised2 = 0;: M2 o; Z& ?) p

  63. 8 B( H( q4 I+ x, s. g1 ]6 _
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* G$ I1 a% A+ z  B( e
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" V8 L, V0 ^: c% w
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, }/ l" l1 ~% i3 g
  67. $ A. u- z3 x' D5 n
  68. dma_addr_t dmaphyssrc1 = 0;( y. l/ k3 y# C- j' \8 [
  69. dma_addr_t dmaphyssrc2 = 0;
    * V6 x  D6 X/ ?1 S5 F
  70. dma_addr_t dmaphysdest1 = 0;
    " f; W( |& H" C% X' ]
  71. dma_addr_t dmaphysdest2 = 0;9 U5 [2 w# T0 I8 b, N! q% _
  72. + [4 u% W5 p0 q7 y" {
  73. char *dmabufsrc1 = NULL;& Q0 `+ U2 r4 n( `( z, A
  74. char *dmabufsrc2 = NULL;1 x. V' S$ ^( f1 p9 D
  75. char *dmabufdest1 = NULL;1 Z# Y" ]( `* C1 s# ~' L4 x; o
  76. char *dmabufdest2 = NULL;
    4 _- c' [) D  p0 y+ E& K* S% T
  77. 6 q& L& q# l) D( F9 f6 T7 I) M
  78. static int acnt = 512;* Q2 l1 P$ E. H2 Z
  79. static int bcnt = 8;
    . l5 b7 K3 D0 O
  80. static int ccnt = 8;
    : ]7 Y, D6 V2 c' O9 P) i/ _

  81. & w# R' C8 E8 n! [1 k% x& V8 D; K
  82. module_param(acnt, int, S_IRUGO);8 Y- O( u6 [" V. v, }% Y8 g
  83. module_param(bcnt, int, S_IRUGO);
    9 `9 @/ g1 c# j& l! @
  84. module_param(ccnt, int, S_IRUGO);
复制代码

1 X. V3 ^. v8 m% Z
/ ]7 e, `+ v& P6 }1 A% D5 o3 j  _      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
/ \7 `. \# k1 W/ Y. uarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
5 ^2 q' c" A! m/ g6 W, G4 v9 J. Y: J     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。+ u  X! s% m6 p* c+ X# ]
5 `' D5 l) X  g8 }1 A: B  u
$ b  O; |  t4 P' R1 r
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-6 21:18 , Processed in 0.041235 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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