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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
1 o- m; \" W5 {; S  F# f
  1. [code]EDMA sample test application
    % \! }+ l  C' D' B+ @7 T8 W
  2. /*
    4 {$ a% d+ c% y5 _
  3. * edma_test.c5 x# p  `7 B* Q% E2 c, x
  4. *
    : x. Q( o  U4 W+ Z9 ~, i! F1 c
  5. * brief  EDMA3 Test Application& G; j& ]3 m0 s, K- `
  6. *: T% F# M3 d7 h$ @: _! |# |
  7. *   This file contains EDMA3 Test code.
    * f% z) f8 z* y& q% \! G: j) p( q
  8. *3 I! W: f  Z* I2 @$ s
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE$ M: D) i, t. N1 b  W
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT3 ]' T+ l" W% w1 p
  11. *         TO CHANGE.) C6 U9 k5 M8 u& f8 u
  12. *
    . s$ D: w$ Y; h. ^  }
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/" A0 D! W, ~( y2 F1 c1 c0 F: Q
  14. *5 }  f1 G6 T: k1 S9 C/ Y
  15. * This program is free software; you can redistribute it and/or' x$ K/ B4 E9 q% Y# Z9 L/ K
  16. * modify it under the terms of the GNU General Public License as0 _& A+ w3 A, y5 Y. r
  17. * published by the Free Software Foundation version 2.
    5 l! ~" X% E, e, t
  18. *
    5 `$ f: H6 J" ?# z8 A" Y
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    7 i# w, r$ |3 D6 Y2 h
  20. * kind, whether express or implied; without even the implied warranty
    3 ~7 ^  [, Z1 _5 `* p0 Y4 i
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the* A5 ]. ?6 \: G
  22. * GNU General Public License for more details.
    , ]- X: S4 l9 A9 ~6 V* x& w
  23. */
    - @8 E/ I4 C, C8 [. y# T
  24. 5 r9 M$ i7 r5 [  A4 U5 [8 z; y) }
  25. #include <linux/module.h>
    2 w2 q4 J: N4 C! r# T/ }1 {! a
  26. #include <linux/init.h>
    $ g! A$ j+ F6 D& {0 u
  27. #include <linux/errno.h>
    # L: C, n, e+ e/ `, S" n$ l4 m
  28. #include <linux/types.h>
    $ ]+ w7 p% U( c: [* }% p/ D
  29. #include <linux/interrupt.h>
    / E3 E( G, x- Q" ^2 m' |
  30. #include <asm/io.h>
    ! ^& p5 N+ B& @  A
  31. #include <linux/moduleparam.h>
    + x( x$ l" \$ v% J4 r
  32. #include <linux/sysctl.h>: w) ]2 b& f0 D- H
  33. #include <linux/mm.h>
    8 H+ e* I( f4 Q) s, t! G! n
  34. #include <linux/dma-mapping.h>
    ' N( i' Y7 b. r: i# C( h

  35. ! C4 K9 @3 X5 L5 }4 R% E
  36. #include <mach/memory.h>
    7 I. E; W4 i0 d5 A; }
  37. #include <mach/hardware.h>0 g8 w, p! v. Q+ f0 D  ]. L+ U7 b6 s
  38. #include <mach/irqs.h>
    ; w' D) }$ I1 K- z8 I: ]6 L
  39. #include <asm/hardware/edma.h>
    4 K$ S# B0 T3 ~& E" @: h1 ]

  40. 2 ?' g7 F- {  Z+ ^( C( ]* ?
  41. #undef EDMA3_DEBUG
    * H2 b4 G3 f8 N( y# L( L
  42. /*#define EDMA3_DEBUG*/
    / l) G; p6 V. w7 K( J& m. N
  43. 4 M$ w: x7 y/ q, C1 a7 b% l
  44. #ifdef EDMA3_DEBUG
    8 K7 W1 F" a5 T% F1 W' [
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    & U5 P: w% X3 ?/ {
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)0 g( k9 a0 {+ x& K$ l
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ! {' v2 f, o' I' ?" k% d/ e/ }4 _) a
  48. #else- s' B. Y9 Q- c
  49. #define DMA_PRINTK( x... ): }; f7 Z/ N; C* d; y0 x
  50. #define DMA_FN_IN
      {' Z& y% k7 C6 a: N4 t. j) R
  51. #define DMA_FN_OUT
    1 l! \" w" m3 ~4 ]% f
  52. #endif
    * U, W/ q2 ~1 U

  53. 0 I/ i% v& D' j7 T  k# q/ P4 Z
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    & i7 m# d. ~7 Y( L! Z7 I; t8 p
  55. #define STATIC_SHIFT                3
    + ]3 p" o8 Z/ o
  56. #define TCINTEN_SHIFT               201 X; }! W# Q" r& e
  57. #define ITCINTEN_SHIFT              21
    - r. d% H1 ]- ^4 a: V
  58. #define TCCHEN_SHIFT                22' e( W/ K* y! ~1 l8 L  y( c; s$ c
  59. #define ITCCHEN_SHIFT               233 _# H8 B: U5 s7 }
  60. ( [# m6 R, E' q- L8 Y
  61. static volatile int irqraised1 = 0;
    % |8 @$ Z. r1 O- i- M# `0 X
  62. static volatile int irqraised2 = 0;
    5 e0 L' I* X( S$ o+ S  S5 o

  63. 4 A% S1 e% q+ d: r. t0 W- d- Q% E
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 C' ]" c. f5 U; C% j4 N
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ c. Y: n: d$ x  L5 [
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: b- u% X# p/ A' x" E7 T  ]6 E
  67. ' G' p, D( c4 z+ ]7 p0 E; ^$ Y3 {
  68. dma_addr_t dmaphyssrc1 = 0;
    0 W$ ~) Q4 Q. I) M6 j6 Y( b+ Q! Z
  69. dma_addr_t dmaphyssrc2 = 0;
    ; {; V+ k% X5 a" u
  70. dma_addr_t dmaphysdest1 = 0;4 u( G: S$ h% R$ |
  71. dma_addr_t dmaphysdest2 = 0;
    8 o2 _* \, _1 b' `9 Q& j

  72. 3 I0 w- B$ z. V1 l  d/ A5 J
  73. char *dmabufsrc1 = NULL;
      b- f% y& n. y8 W6 Q' v7 d+ y
  74. char *dmabufsrc2 = NULL;( Q9 Q; C7 ]2 S) P. \5 M
  75. char *dmabufdest1 = NULL;$ F0 u$ J5 ?$ u( t- N7 }  `
  76. char *dmabufdest2 = NULL;
    ) [9 ?( |# x1 m, h1 }  v
  77.   z6 w2 B! s0 J
  78. static int acnt = 512;
    ( ?! f8 `2 B2 B, v
  79. static int bcnt = 8;; u1 }4 D* [' w! i
  80. static int ccnt = 8;
    : e! p' t3 I( n- t7 d/ v( B6 j

  81. : B/ O5 c( w) B9 a8 m3 ?
  82. module_param(acnt, int, S_IRUGO);# J* G9 p: t3 U2 |6 p
  83. module_param(bcnt, int, S_IRUGO);
    / j' B1 a4 F9 Q0 Y  e
  84. module_param(ccnt, int, S_IRUGO);
复制代码
4 {2 d1 f0 t6 z2 R; k
6 `& D; _3 J3 W$ R2 O# w
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用2 a# h$ }+ O! k0 z
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
9 Q) D/ U' m6 z! R& z* D2 `* R     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。+ x! J( u/ X4 j* H& i1 `7 Q

9 P/ \% h  w8 L% i6 o) B/ w' x7 T8 Z  \' l5 A
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-6-10 20:14 , Processed in 0.044802 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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