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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 , e. ~" p  i  t' ~
  1. [code]EDMA sample test application9 o' e# |- L/ q
  2. /*) m5 ~- \; A, f4 Z$ t& x. l
  3. * edma_test.c
    7 l/ Q. p1 G0 E/ E) i# ?
  4. *
    / x' J: d  d, I# h
  5. * brief  EDMA3 Test Application7 B4 w* L0 A& g8 E6 C9 c# Q
  6. *
    . T, n. p, P) h( P
  7. *   This file contains EDMA3 Test code.& g6 l' H' t( Y0 \; J
  8. *
    * l$ [( P/ V! w7 E5 J
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE' u0 V6 P0 d4 ^1 @3 r
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    4 e9 k4 O  @$ f9 A2 F# H
  11. *         TO CHANGE.+ ~& X3 a& @* D  ~% U
  12. *
    " |% C( ~4 B. {9 f. z" P
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    5 R$ K) R% ?* d# k* s
  14. *: x; g  U- l4 V) P! {
  15. * This program is free software; you can redistribute it and/or$ U: `) t7 ^) @! m& E) X1 Y
  16. * modify it under the terms of the GNU General Public License as
    % N! }- P- j# ~* }
  17. * published by the Free Software Foundation version 2.. p6 ?3 [9 Y: h# @% F
  18. *4 x7 j$ l$ C4 x% w' m
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any1 Q% M. {" S# `3 K- Y# j* F5 y
  20. * kind, whether express or implied; without even the implied warranty
    3 X6 [# z* A5 ~) }8 z- {
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the: R3 F1 |! Y* O
  22. * GNU General Public License for more details.% o3 ]8 d5 ?6 s+ u+ x
  23. */
    8 B' N" a( f  k5 }9 J  n

  24. 5 l: n3 d. y: E; p  t0 [2 e& s0 k
  25. #include <linux/module.h>, Z( ]7 v0 D2 W/ f" p- w7 S1 c
  26. #include <linux/init.h>
    ) o9 G5 G$ Y8 ?3 D* N
  27. #include <linux/errno.h>; K/ ]/ ^/ w7 b' Z
  28. #include <linux/types.h>
    : ^2 {$ l' m" p% E) m- p
  29. #include <linux/interrupt.h>
    / h% r  t* A7 u
  30. #include <asm/io.h>
    : x, u! c1 P8 @
  31. #include <linux/moduleparam.h>. q4 W1 w; M* i% A4 a& @3 ^' e
  32. #include <linux/sysctl.h>
    5 G( J5 x5 I. U$ `$ _
  33. #include <linux/mm.h>" o9 N4 `. A5 `0 O9 K' Y
  34. #include <linux/dma-mapping.h>) k1 f* U" j  O+ ^% V) v9 t! y

  35.   h9 S" [, A+ Z3 ^# {# [4 ]: P- S
  36. #include <mach/memory.h>8 y0 |) X) t2 C  [2 X0 Y" e
  37. #include <mach/hardware.h>, u& e/ l1 Z. G; r- v  o- s
  38. #include <mach/irqs.h>; K) @0 [1 j% }  n( e; u0 z
  39. #include <asm/hardware/edma.h>
    ( Y1 n2 [7 ^  ^9 c/ U& {" T3 W
  40. # E' s. U' B1 [$ Y8 p
  41. #undef EDMA3_DEBUG) t( Y# S8 H6 V  |
  42. /*#define EDMA3_DEBUG*/# [- e; }! s& Z+ i
  43. * n0 I: p* i/ q( k& [# q* {" j
  44. #ifdef EDMA3_DEBUG& h" I' d9 Z3 f# Q7 b7 t7 B
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)7 a) [8 ]1 M6 p. L$ O  A
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)/ D- g3 j6 `9 [) v/ V# y* m$ ]
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ; e" C7 n5 d( k0 a  x
  48. #else0 r; W8 l0 Z# [& F# f; D$ y; U
  49. #define DMA_PRINTK( x... )
    0 }& k6 g; h; L2 v& }; B
  50. #define DMA_FN_IN
    ) c7 x4 Y% e: g; w8 E( J
  51. #define DMA_FN_OUT0 x$ [) i# F! y
  52. #endif6 F% c0 @: R  Q
  53. , M( n6 i" C* E- G8 u
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    7 a. h, }- S( Q% S
  55. #define STATIC_SHIFT                3
    9 _# x  @. l7 d9 {' n
  56. #define TCINTEN_SHIFT               20
    ) Q$ |% Q$ R, {8 E6 D, D
  57. #define ITCINTEN_SHIFT              21+ _; [9 t) `# B6 E0 n+ N
  58. #define TCCHEN_SHIFT                22; T. l9 K' `" Y
  59. #define ITCCHEN_SHIFT               23
    ! O# w  P' {3 m! Q
  60. ) C! D2 c4 D( Z( r" Z' z
  61. static volatile int irqraised1 = 0;! E: a+ @! i- G/ p( E) x2 G' Q
  62. static volatile int irqraised2 = 0;5 i& f4 W. y  b9 {

  63. ; [- v! }& o, ]
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : L. g* p5 }: L
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % w1 x4 {4 B0 d  G3 a" m# V  L
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& P: x. h4 L# [# }6 B8 V
  67. 2 G5 j& R" y% u1 C! h5 [
  68. dma_addr_t dmaphyssrc1 = 0;
    # g" d- S( }3 ?, q# D
  69. dma_addr_t dmaphyssrc2 = 0;
    / }5 r6 o* I/ k; }4 w, n$ Z
  70. dma_addr_t dmaphysdest1 = 0;8 I( U6 J0 s/ y( }  n
  71. dma_addr_t dmaphysdest2 = 0;
    4 Q5 c" _7 T! q

  72. / j( \! m% w$ I2 H7 m. W  Z7 [* A
  73. char *dmabufsrc1 = NULL;
    & V2 {# b$ L1 S3 f* u  i, p
  74. char *dmabufsrc2 = NULL;" ^1 u4 V- N: S; [, @' \6 S
  75. char *dmabufdest1 = NULL;4 d2 {+ s, b8 }, D) \# G" s# V
  76. char *dmabufdest2 = NULL;
    9 {/ f; Y, l; L# S+ F
  77. . x, |2 Z# m% g, U- Y
  78. static int acnt = 512;
    $ w3 ]9 _& [# _' ~# V( N: Q
  79. static int bcnt = 8;+ I& z; Y& O3 V. z0 D
  80. static int ccnt = 8;
    9 |* v' {$ Q  e) w) F) K% m6 V

  81. 5 `9 r+ K% p! @! B
  82. module_param(acnt, int, S_IRUGO);: U0 P- _( \1 J2 Q
  83. module_param(bcnt, int, S_IRUGO);
    7 s" y3 |( ^4 S! l( c7 j6 x0 V- |
  84. module_param(ccnt, int, S_IRUGO);
复制代码
4 G& `, M9 T. A

0 V% ?" O9 _  L( \* u6 L- x( q( S      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
% Q4 L) d% m! j* f! `% n! o5 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
/ K$ W2 m% \# _. q! f. |     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
3 I9 W4 W- y- M
8 L6 n$ g4 m! @9 z9 e0 G5 P
( l0 W8 _4 |& J3 J/ p6 F8 D' ]
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-13 07:11 , Processed in 0.044778 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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