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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 0 x$ F6 e/ r" y' H( _
  1. [code]EDMA sample test application
    + j3 Q0 r5 ]& u$ p  I5 i7 _2 n7 I
  2. /*4 Z, {/ m+ l/ b' Z& S+ D. _
  3. * edma_test.c  H! W) g- A6 Z! l2 m! D, H
  4. *5 q4 k" E1 q8 `
  5. * brief  EDMA3 Test Application2 x0 n7 t7 w/ h
  6. *
    ( J) ]. k. ~7 Z3 c" U, {% Y
  7. *   This file contains EDMA3 Test code.
    : r9 c5 v$ u. x) V' B! e! A
  8. *
    ; f+ a2 X5 j# t- X  ^; e4 g5 R4 C
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE  I9 E2 R* j- w; g0 U  [- i
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT  A7 X3 X4 j+ f# J! s8 F# j
  11. *         TO CHANGE.
    % W  A/ E& S4 [/ E1 c0 U( F
  12. *; k$ v7 p: n( e
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com// O: G3 W( G' h  i
  14. */ F; i2 z) B7 e' I8 B/ s" M
  15. * This program is free software; you can redistribute it and/or) ]* [- e. {- \7 K$ t
  16. * modify it under the terms of the GNU General Public License as3 s1 Q& Y; m$ N$ N
  17. * published by the Free Software Foundation version 2.
    7 x5 k' b( |4 |1 |2 F1 ]+ {* T
  18. *0 n7 ]' h3 f2 F! r+ k& Q0 A
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ; u7 a% b1 t7 t4 W* Q: w
  20. * kind, whether express or implied; without even the implied warranty
    $ H. {" Y& T: C+ s+ u0 i
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the& }. r# c7 V/ Y/ S, ~
  22. * GNU General Public License for more details.
    & P8 p  l9 _# U7 H6 G' @; R
  23. */8 T: ~  v9 w+ s$ i+ a! H* q
  24. : `2 P8 C) i" z
  25. #include <linux/module.h>
    . |1 R8 C0 t6 b, c/ N; S
  26. #include <linux/init.h>
    % m# U' I3 D2 }
  27. #include <linux/errno.h>
    # }" e+ M  C/ m$ B! {6 _% s2 B
  28. #include <linux/types.h>0 c  z0 j+ T7 Q; B
  29. #include <linux/interrupt.h>8 m& ?; r) B! _6 h2 L# X3 F
  30. #include <asm/io.h>& [% H$ t! H8 X9 t; s* J! h
  31. #include <linux/moduleparam.h>3 r2 Q+ X: J! ^0 a
  32. #include <linux/sysctl.h>6 x1 L/ \: G8 @* ^& {# O
  33. #include <linux/mm.h>
      ?1 E# q4 x, Z" U; j% b
  34. #include <linux/dma-mapping.h>
    2 o) {9 H, n/ m0 X6 C5 @

  35. ! I6 h: d$ w' u/ {, _) k3 _9 C
  36. #include <mach/memory.h>
    " G' R# ]6 B3 J3 Y9 v3 I9 i
  37. #include <mach/hardware.h>9 x; [$ {( x; I- d1 v- h
  38. #include <mach/irqs.h>7 i2 f9 c3 ]" v% M. o& I% t
  39. #include <asm/hardware/edma.h>; L2 d$ e9 g: X/ ]! |% I  t$ `! e: R

  40.   Z, v" {/ H, N) }
  41. #undef EDMA3_DEBUG1 [$ b0 b+ I" L+ Q6 E: R
  42. /*#define EDMA3_DEBUG*/
    ) q9 ?5 r, d# ^4 @6 U

  43. & d1 {( @5 @) U' {
  44. #ifdef EDMA3_DEBUG. |8 A7 u7 x$ w+ O
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)! R  R) v; _) n4 h% j1 o& B
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)8 R# e5 O' K; E5 o; F) O
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    3 p  U$ X, q. N# ~( s9 m4 j# X
  48. #else
    % `3 o$ I' b) q
  49. #define DMA_PRINTK( x... )5 R5 R" p' `# B. P$ t% s2 i/ J
  50. #define DMA_FN_IN& F6 x" t/ X3 A( B/ a
  51. #define DMA_FN_OUT2 l1 |8 h/ M; m8 j
  52. #endif
    ! u' ^% Z& m* p6 j
  53. 0 Q9 q) M# o- E0 H
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)7 W5 ?8 u$ w7 i3 e5 T5 m5 K4 M
  55. #define STATIC_SHIFT                3
    & g3 K* X+ P& h
  56. #define TCINTEN_SHIFT               20
    ; M% _% c( h* x1 z, a
  57. #define ITCINTEN_SHIFT              21
    . w% O- ~: V" k4 ^7 J) @
  58. #define TCCHEN_SHIFT                22
    , X4 `) l3 h& d8 r
  59. #define ITCCHEN_SHIFT               23
    # a9 y. P7 C$ W3 m0 s4 R  v

  60. 6 W& r) g+ h# f  {9 U
  61. static volatile int irqraised1 = 0;1 o, A( q4 y1 Z3 ^
  62. static volatile int irqraised2 = 0;
    ( F8 W8 I' G" r9 I) U
  63. 5 F0 E1 t" q  L+ l& v9 f
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 i$ ^, A  F. [; d7 r2 q
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * @; ^1 a3 t  K5 ^6 N; H/ Q3 k: s& M
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - {9 d! [3 a/ D$ G0 r3 ]

  67. ! M- I% @# j( X' w5 W  m
  68. dma_addr_t dmaphyssrc1 = 0;4 I# v  ~' o2 U& U' R% V
  69. dma_addr_t dmaphyssrc2 = 0;
    1 A5 Y  j7 k$ Z& d% m
  70. dma_addr_t dmaphysdest1 = 0;+ f7 q! a2 A& o2 S0 Z0 D
  71. dma_addr_t dmaphysdest2 = 0;
    : H$ ~( G8 k3 U* o9 W

  72. : @1 T1 d% ^: ^! [7 j$ h
  73. char *dmabufsrc1 = NULL;
    2 u. Y# m3 B/ Z
  74. char *dmabufsrc2 = NULL;  m. r  K$ Y  f. }; m
  75. char *dmabufdest1 = NULL;
    - _3 c! K: W& \4 C/ E7 o) @6 X7 c
  76. char *dmabufdest2 = NULL;
    1 s+ R: [- R6 E; _9 K
  77. # Z9 P/ z# p1 E/ ?
  78. static int acnt = 512;
    & }0 a! `, `. c* |+ ]. d
  79. static int bcnt = 8;/ O( U; w# F8 G; }* Z! P" ^' c# ]0 L
  80. static int ccnt = 8;: y7 s+ g8 A+ `0 C" H* W
  81. 6 \. f9 `( g/ v- ~/ h# G0 ^
  82. module_param(acnt, int, S_IRUGO);
    0 O$ \% g% J+ n+ q( @
  83. module_param(bcnt, int, S_IRUGO);
    6 A- J. b7 v- R; m, Q
  84. module_param(ccnt, int, S_IRUGO);
复制代码
: G2 @  I, Z. w) Z: L" _7 I+ V
3 P2 B( R: V8 j0 A0 F1 ]# R
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
( f, B# V! s- ]! A; V# h, oarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。' o' `% i% O! @4 A3 `
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
- u, Y' k* G- C4 O0 S2 w# `, t, q- l* j+ @8 t# r" h3 T$ V$ j
$ P/ a$ g6 K3 t# G  S$ `# S! L
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-22 05:24 , Processed in 0.039342 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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