OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 3 i7 _  G0 C; J! u) x
  1. [code]EDMA sample test application
    . j* ^6 |+ d; Y( w7 @
  2. /*
    % I8 r  g1 R$ D+ R3 i: n
  3. * edma_test.c
    ' ]' Z0 l4 N% h
  4. *; @, I/ n, H/ q$ ~
  5. * brief  EDMA3 Test Application; l( X5 a( |; o* M7 A
  6. *
    & u" S( @% V* V* b1 R  E, F
  7. *   This file contains EDMA3 Test code.
    9 Y6 p' u+ c" p% ]' s* Z
  8. *% u+ z1 w0 u2 r! }% v; b' u6 f8 g
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ( A" I& t: U# n5 f
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    1 q: Y6 Y/ J6 I) \( L( i/ s. C( l! ]
  11. *         TO CHANGE.+ i7 g; j7 d! g
  12. *0 d, G; S, J& r# U# A! t
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    % W) t% M2 `/ j7 d$ {* x- W4 s
  14. *
    ; L! T$ w: W: x3 N5 ~
  15. * This program is free software; you can redistribute it and/or
    , E3 r) a2 }, q7 q0 u# e0 z
  16. * modify it under the terms of the GNU General Public License as! ]3 c; |' f5 p! I2 v
  17. * published by the Free Software Foundation version 2.* [5 l- O( l5 Z3 v0 Z, G" Q
  18. *$ A4 e7 ~5 U" ^. R3 l
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any+ j4 `. K* A6 A. D  t+ n, o
  20. * kind, whether express or implied; without even the implied warranty
    . r* p, w' `6 n! A. D8 w
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    2 }; b3 x9 O$ _" G1 G; C
  22. * GNU General Public License for more details.
      W- R) ^0 u+ T8 K1 h
  23. */
      `! Y9 d- P7 ]/ V/ S
  24.   ?" I- L5 k+ l# r" a6 J9 x7 U( G' r
  25. #include <linux/module.h>4 p! O2 ]  c* h7 {' _6 x
  26. #include <linux/init.h>. k) M, R) q) |; U
  27. #include <linux/errno.h>- H0 U7 o9 Y6 S# \
  28. #include <linux/types.h>
    / ^% v1 y& X7 L
  29. #include <linux/interrupt.h>
    . @1 j! m0 X* M, T
  30. #include <asm/io.h>
    ( I% C' u0 ], v
  31. #include <linux/moduleparam.h>3 W: c, Z- w/ ]6 ?% P& I
  32. #include <linux/sysctl.h>
    + t+ R% A, {- I" C7 b
  33. #include <linux/mm.h>3 x4 h% R$ b6 |. H8 m! s3 k
  34. #include <linux/dma-mapping.h>$ Q" [  F- {, Q# l4 L
  35. ) ?6 Q+ n9 G# b5 \
  36. #include <mach/memory.h>
    , p" r; j& r' y' I4 U3 _  ?5 C
  37. #include <mach/hardware.h>
    , W- ?- o$ S/ u) t
  38. #include <mach/irqs.h>
    4 Y# v$ c) U2 k! D
  39. #include <asm/hardware/edma.h>; z8 K' {6 E+ E8 ]
  40. . @/ U* I( Y8 U" Z
  41. #undef EDMA3_DEBUG
    + ]  {+ o7 s9 g. k1 r; t9 O
  42. /*#define EDMA3_DEBUG*/
    8 W+ A8 t6 F  K; l+ l
  43. & ^+ A% u/ h8 B# C  U1 s: A/ I$ ~
  44. #ifdef EDMA3_DEBUG
    / N/ y/ f" R* g+ B8 Z
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    7 V1 W/ S7 ?/ Y2 G, {
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)! E" @2 v8 L1 L. r; b
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)2 N$ }- S4 t: B& l) ?6 w
  48. #else$ G, u, i8 K1 M; H( m6 ?* Y8 v
  49. #define DMA_PRINTK( x... ), w! t9 j7 e, W1 a& J0 H' |" A
  50. #define DMA_FN_IN
    " O3 G. w3 s! C' k
  51. #define DMA_FN_OUT% l( u6 V0 Q4 v$ Z. Z
  52. #endif
    5 S% O! x) d  F" w, G9 K

  53. 2 E4 B) ?, E" O: w% O( ^/ f) ^. R
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)0 G. j5 z! {' o/ j' j& ?4 F4 |" K" \' V
  55. #define STATIC_SHIFT                3
    ' K3 @* b& _, f, N& v" j
  56. #define TCINTEN_SHIFT               20
    , u2 K' c8 |8 u: O
  57. #define ITCINTEN_SHIFT              218 e% u& n9 @' W8 q, }  ?8 y
  58. #define TCCHEN_SHIFT                22
    % z7 r5 K, O0 \- b# q
  59. #define ITCCHEN_SHIFT               23
    2 {) |0 j$ S4 r; ~% M
  60. 3 Z6 ^: M- q* h( Z6 i- v8 W# |( z
  61. static volatile int irqraised1 = 0;2 l' q. H7 l8 W2 @! Y/ X* _, h
  62. static volatile int irqraised2 = 0;
    & j8 D2 l8 o/ P/ E: O

  63. $ E! d% B- _$ C! K$ r3 Q& j
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % h- W+ R3 T. o1 [. }7 P
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, _0 R. a* d# I% \
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 X  _! g; K# S9 X- H- l7 s8 n4 [

  67. 5 Z- F; b$ b7 y) g
  68. dma_addr_t dmaphyssrc1 = 0;8 }+ ~+ `+ j) R8 |; j! d
  69. dma_addr_t dmaphyssrc2 = 0;" F5 S  Z: e. e$ v8 V
  70. dma_addr_t dmaphysdest1 = 0;
      j' n$ m4 `! [- z
  71. dma_addr_t dmaphysdest2 = 0;) a' F9 [- g$ I5 |* L* \3 }9 l

  72. ' g' j% G$ Z, s# Z
  73. char *dmabufsrc1 = NULL;
    ; F! t: q$ J! k4 J
  74. char *dmabufsrc2 = NULL;  y* B2 ]" N$ N3 l7 q! ?
  75. char *dmabufdest1 = NULL;
    ; s* T7 S% P, t
  76. char *dmabufdest2 = NULL;
    - P* R& p. p3 m5 Q: j# s/ T) A5 H* ^

  77. 6 R) a& W' C3 i; y  T- j1 P( ?
  78. static int acnt = 512;" \4 z1 q1 r1 s- p! S6 J! M  c' [
  79. static int bcnt = 8;
      A  S; w- d4 b# G$ k) V; s
  80. static int ccnt = 8;
    1 P- D8 `+ a% _( A
  81. / {6 M* D8 o; a+ ]0 i. h- p6 g- v
  82. module_param(acnt, int, S_IRUGO);5 m  D# j" }' _& Y: d$ ^( @
  83. module_param(bcnt, int, S_IRUGO);
    / r7 C1 P. x7 c3 [& p' K
  84. module_param(ccnt, int, S_IRUGO);
复制代码

5 w6 |6 f+ w: u: ^5 C! M5 g( q8 w( h, E% G/ D5 P) M
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用( _" z& D3 B' O5 r  q
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。2 V* {/ [: d, I5 C
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
( c4 }4 I! N3 U1 o" s  _* L5 f; {0 W  v

3 G* U( v$ X6 V# W6 j
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-18 03:52 , Processed in 0.037302 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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