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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ! @  a2 C/ ]# W2 w" {0 k* x6 j" f; @
  1. [code]EDMA sample test application# z4 {7 k6 ^2 N+ f
  2. /** i, s* p) G+ q" |5 D' d; i
  3. * edma_test.c# X  X: p$ \; q2 s2 i) m
  4. *. n) X+ k  c- C" ?% ?' ~& ~% @# x
  5. * brief  EDMA3 Test Application5 D, b! w5 L- H4 v+ J9 |( ~
  6. *
    2 p, u; e, s2 s" T( t
  7. *   This file contains EDMA3 Test code.
    ( |9 e; D* w/ J9 K6 k
  8. *2 p& q* k* }4 c( a
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    / W8 n1 S$ d& {9 h) |
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT# w0 I' x" {$ h  V# o; }; M
  11. *         TO CHANGE.
    8 x) f( \: q5 `7 |' c
  12. *
    & O1 \2 ^3 Z9 z/ L& z
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    , F; ]2 J2 y  w  O( f8 E  x
  14. *
    2 _9 O' o( @0 P5 i7 c3 s
  15. * This program is free software; you can redistribute it and/or& P6 D' N) h$ M! H; v
  16. * modify it under the terms of the GNU General Public License as) s& e4 j( B& O5 l# @
  17. * published by the Free Software Foundation version 2.
    & D+ X9 S9 p! z$ t
  18. *
    # h7 I" I- k9 j8 i  C! c7 ^
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    0 W) @5 ^2 }$ k- f
  20. * kind, whether express or implied; without even the implied warranty
    ; T2 g! R3 G8 q# V. b& n* T  J9 b8 K
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    9 }0 N8 e7 v) ?$ G" D4 ~
  22. * GNU General Public License for more details.
    3 k% m. g" `7 g; X' V2 ^3 A
  23. */
    # g$ ?# j, h) C3 `4 ~2 E
  24. & j% E3 `# y5 ^. a8 Y3 L
  25. #include <linux/module.h>$ C7 Y2 H" j) _
  26. #include <linux/init.h>
    - j  A6 o( R, T" F2 A$ G1 u
  27. #include <linux/errno.h>( A  i, f0 p4 o) |1 r2 b
  28. #include <linux/types.h>" Y" Q1 {3 w' F1 u
  29. #include <linux/interrupt.h>
    ; r" c1 D1 p3 ]
  30. #include <asm/io.h>
    + Q6 f  S- p. [: F# v) j
  31. #include <linux/moduleparam.h>* ?2 G" ^0 l: u* r6 A
  32. #include <linux/sysctl.h>
      }8 S# y; d6 ^- ~
  33. #include <linux/mm.h>1 T/ ^, B$ ^2 h& T& ]
  34. #include <linux/dma-mapping.h>6 T- [: g* F, {# Y! x* M7 f# G+ D

  35. & t7 c4 l; h3 ~8 b8 U/ W6 b, x
  36. #include <mach/memory.h>
    6 a# Z# e' I8 ~; Q" m* H) _
  37. #include <mach/hardware.h>; N+ l/ {& v9 j9 l! z, ~8 M
  38. #include <mach/irqs.h>
    7 g0 I, G6 X  [
  39. #include <asm/hardware/edma.h>3 N* K6 G6 t3 O$ d  C
  40. 6 y& C) Q& F/ x3 l; w2 D  v
  41. #undef EDMA3_DEBUG' P' x" O  K: k2 c6 u" }
  42. /*#define EDMA3_DEBUG*/
    9 s( j9 @( ^3 h( A5 U
  43. ; ?) X  [. f+ `
  44. #ifdef EDMA3_DEBUG5 i. v4 ~  _9 w# M1 l" Z
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ( s" ?8 t- W& E; J( i' J6 k  ~8 i
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)3 {. B' v3 g, t. C" ^
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    $ o" l- _- c# c. s
  48. #else5 q9 T% P9 E4 L4 @/ B% W
  49. #define DMA_PRINTK( x... )
    9 a$ U$ I+ G& p' G3 D* i" T
  50. #define DMA_FN_IN& a% k  q, L; ]; F( m( a& M) n5 e
  51. #define DMA_FN_OUT# G8 X6 b6 j  ^! i& l
  52. #endif" @& h, F6 j3 L8 \9 x5 `' @) T, y8 e% G
  53. % \; B) b% T9 k/ m# E
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    " \: ?! u4 h& i! H, ~
  55. #define STATIC_SHIFT                3* [, W5 B; {9 f0 n
  56. #define TCINTEN_SHIFT               20
    4 ~0 H7 o! ]) Z+ o
  57. #define ITCINTEN_SHIFT              213 T2 |. D1 |# g! h4 R
  58. #define TCCHEN_SHIFT                22
    1 t; b+ `7 u0 X( v4 u
  59. #define ITCCHEN_SHIFT               23& E2 h3 E" p; ^( L! f3 P
  60. 2 v! O& a0 r5 t6 c
  61. static volatile int irqraised1 = 0;
    ' n9 P( Y7 g  i  s8 E7 h  x+ j9 A
  62. static volatile int irqraised2 = 0;  u- I2 O5 y6 B/ T0 h

  63. & T3 W' ~5 ?  ^6 ^
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; k7 ]" C/ p( {+ y/ D
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' T$ t9 F* Y4 p/ m4 S' ^. v
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 r6 U3 c" ~& N/ d! u8 X  F
  67. " P7 Z5 ~# a  ~' s
  68. dma_addr_t dmaphyssrc1 = 0;8 Y1 c1 E0 c  t- h, S5 ]
  69. dma_addr_t dmaphyssrc2 = 0;
      B, |7 ~( k  g
  70. dma_addr_t dmaphysdest1 = 0;
    2 b! Z% @2 n0 Z9 K% o
  71. dma_addr_t dmaphysdest2 = 0;
    ! A, u/ ^" I/ e% ]
  72. 4 K% N7 k9 F2 X( U2 p; f/ w. ]
  73. char *dmabufsrc1 = NULL;
    3 M+ ?: h# _- _& H
  74. char *dmabufsrc2 = NULL;8 E! O7 E, b8 z- e) o2 B  d6 E
  75. char *dmabufdest1 = NULL;# D: E) R- H; L( k' Y
  76. char *dmabufdest2 = NULL;- X5 J2 V, R8 x+ L3 _$ L) d
  77. 2 W% c! F$ j& M- s7 R% K" `
  78. static int acnt = 512;+ f6 H( n8 t/ k; Q+ q) ?
  79. static int bcnt = 8;7 O! i& [; ?) Q' W
  80. static int ccnt = 8;" p& Y/ ]* @& k
  81. - M( e+ W6 \3 Q3 y. A
  82. module_param(acnt, int, S_IRUGO);
    / {5 J3 S* W7 S; c
  83. module_param(bcnt, int, S_IRUGO);
    ) v6 I( v3 z( ]$ d6 t' i- F
  84. module_param(ccnt, int, S_IRUGO);
复制代码
2 F  G6 N5 E- \

" r  G' n  A1 y2 I/ Q6 t      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
% v. X8 u4 S9 A. [, ~$ ^5 rarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。% }( G7 f5 I# y
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
% S% z, Z2 J7 D8 j
+ H" p9 K7 u, l: c  `1 `2 l; J5 Q  ], O
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-1-1 05:07 , Processed in 0.038958 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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