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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
# u9 R5 x& ~  z
  1. [code]EDMA sample test application; ]) e1 x" A# `& o) ^
  2. /*8 u& y& e  V7 U; I
  3. * edma_test.c4 m! M0 p2 |; x8 r5 W
  4. *2 ]& @& h" a( q
  5. * brief  EDMA3 Test Application1 e) J! L1 u" ?2 T8 |
  6. *2 U& y; N# G0 E. J( J4 b, {
  7. *   This file contains EDMA3 Test code." T% Z3 _" I2 C- y% u
  8. *# U) l0 r/ {; E8 Q, h; b
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE  l) U2 |! c. o9 B- n" Y0 B
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    . u- d& t* }9 q6 m; y0 y* O
  11. *         TO CHANGE., F" O. i) D0 `( R8 Z) h
  12. *
    : b1 E9 r( b2 L, V; f1 c4 w
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/% ~* U4 Q8 ]9 t; M
  14. *% C( b- d! Q" w" \0 r/ L- m
  15. * This program is free software; you can redistribute it and/or, v' {3 d' A) s% i3 N* c+ C( w
  16. * modify it under the terms of the GNU General Public License as* U2 s+ [% D" w' i5 B0 j& o8 }" o
  17. * published by the Free Software Foundation version 2.
    " n+ D. k' P. S4 O; Z9 I
  18. *
    2 A* e  g( s- U
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any& G$ u: r7 n7 J9 C* b
  20. * kind, whether express or implied; without even the implied warranty
    6 e6 Y( X2 o- W$ R
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the: s3 T; n: Z% r1 ^- z6 A, x
  22. * GNU General Public License for more details.0 @, O% i) J% D6 y" [7 u
  23. */8 M6 w& K5 _* \% h

  24. 0 w; C! [8 z5 K' l+ y+ F
  25. #include <linux/module.h>
    4 q! ]% Q( n) J, m: F
  26. #include <linux/init.h>! E, R  ]& h0 a: G& _/ N$ `6 _
  27. #include <linux/errno.h>. b( o2 u/ a/ H& }! c" y& I2 q8 ?: J
  28. #include <linux/types.h>
    7 v8 d0 W: v8 F$ y* Z: }' t8 ?
  29. #include <linux/interrupt.h>. F/ f# b( i) f1 ~0 p
  30. #include <asm/io.h>
    - Q3 d1 }9 x3 o% v9 j) Z' D
  31. #include <linux/moduleparam.h>8 U. A) v) T" n9 A
  32. #include <linux/sysctl.h>
    $ D* i# E" d1 g4 e" G# A
  33. #include <linux/mm.h>
    # `  C! t" r3 ~2 g% f
  34. #include <linux/dma-mapping.h>& j8 f! [% X) _

  35. & h  U. `0 I: n% Q
  36. #include <mach/memory.h>
    2 R; u. y, S2 Y3 {
  37. #include <mach/hardware.h>' n- X1 I! {8 D* I; k8 @. ^, D: Q
  38. #include <mach/irqs.h>
    ; [( r' `' q: Y" P' i( ^$ E# E
  39. #include <asm/hardware/edma.h>$ a- n- t2 F, O

  40. - p0 W' M/ w$ p
  41. #undef EDMA3_DEBUG
    7 E' R) ^$ g4 ?- x
  42. /*#define EDMA3_DEBUG*/
    $ ?' [0 T: X1 H' P

  43. , }1 x* S7 z6 {9 y
  44. #ifdef EDMA3_DEBUG
    . ~8 g% u5 D+ x7 w. o
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)( o+ |' b; `. C) W; W: ~$ K
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)2 ?* a" g; f" j9 d. I
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
      x9 X" h# e+ j' u
  48. #else" c5 }$ d( c9 W/ m0 o. @7 p
  49. #define DMA_PRINTK( x... )
    3 [0 Y6 \( f" U2 n' s& B
  50. #define DMA_FN_IN
    1 {4 q& O0 l1 P# A1 p
  51. #define DMA_FN_OUT0 f: d, R; s* R& I' p
  52. #endif4 ?; \' e4 i0 L$ q5 u6 s  u
  53. ) `, e( }5 ?3 C: s$ A7 y( x
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768); A6 X: E7 Q1 U! U2 Y$ B
  55. #define STATIC_SHIFT                37 S, s) W! I+ U5 |1 v: e9 s2 Q$ Q
  56. #define TCINTEN_SHIFT               20
    $ M! M, @; h  Q; t9 \  [
  57. #define ITCINTEN_SHIFT              21
    / ^# ^4 e" ]3 q1 \( k; J  X, P8 }
  58. #define TCCHEN_SHIFT                22
    . k; j$ i7 @% e2 z
  59. #define ITCCHEN_SHIFT               238 ^0 E# N0 h4 a4 {
  60. 6 e  G- ?! I, r& F1 v- c1 q
  61. static volatile int irqraised1 = 0;( h8 B5 X1 W+ U3 Q1 L1 I
  62. static volatile int irqraised2 = 0;% E. I$ H) k  J
  63. " U6 e2 d" f0 u" q& W
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ h8 ?, u2 Z6 O
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' o; d: e1 B0 D7 R
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " [- |4 Z' E) q$ {8 V

  67. ' @) m& @+ u& o, x+ H
  68. dma_addr_t dmaphyssrc1 = 0;
    : X* ^0 O& \+ Z8 X0 _
  69. dma_addr_t dmaphyssrc2 = 0;1 A8 h* k2 A8 b! |
  70. dma_addr_t dmaphysdest1 = 0;
    7 u9 D; x3 L3 U0 L& J- R
  71. dma_addr_t dmaphysdest2 = 0;
      M6 ~+ N( ^3 P8 h. f4 _; W7 @
  72. 8 s. f7 W: j5 P. ]5 ~
  73. char *dmabufsrc1 = NULL;. [7 t! Y9 h2 O( d9 }6 p! [! j) _  R" }
  74. char *dmabufsrc2 = NULL;0 ~2 n/ v7 f+ n! |4 F
  75. char *dmabufdest1 = NULL;
    ! r/ J  U1 d! x7 f8 D+ \
  76. char *dmabufdest2 = NULL;  h- T: x8 U. V) f  _& O
  77. * \8 U$ R# p5 X7 Y) Q
  78. static int acnt = 512;
    # I9 k- l& u/ `0 K8 a
  79. static int bcnt = 8;
    % I% Z2 \  f+ A7 m  h7 b) [7 w
  80. static int ccnt = 8;' C9 [1 C8 U' {' ?6 Q

  81. 0 q, t0 f( D# j* B
  82. module_param(acnt, int, S_IRUGO);
    " e# ?6 @$ N) g  T& N) ]' m
  83. module_param(bcnt, int, S_IRUGO);
    ! ?! u  h% i. l, C
  84. module_param(ccnt, int, S_IRUGO);
复制代码

% l9 x& }' H% K+ I" H: F" L7 v4 Y
0 g# I4 F1 p9 ]3 a8 M% g+ y' {      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
3 w8 U5 l& w: ^# J# [: v* aarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
' q9 f7 a# |- }7 [     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
- T0 U0 _; s6 d7 e) g, X6 q
5 T9 ]1 B2 j0 J6 k# \3 x+ ^7 [0 d+ u& w- V
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-6 08:16 , Processed in 0.039280 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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