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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
) v& r2 Z7 Y9 P2 A9 k7 L
  1. [code]EDMA sample test application
    9 H7 l, N" v& P: m: R
  2. /*4 H  W% J  J- F0 J! Q+ N
  3. * edma_test.c
    5 ~& {! |5 }9 f0 g3 f9 {
  4. *
    ! k- ]4 T. y1 T% Y
  5. * brief  EDMA3 Test Application& V3 n8 E0 J7 U( W* ^9 T
  6. *
    ' V# o1 ^0 V! M) q
  7. *   This file contains EDMA3 Test code.
    7 y$ c+ G4 I5 b0 E% O$ i
  8. *# b; W# k3 C% j6 f
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
      L. R2 [# ]1 Z1 E9 i- _
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT" C5 t- {3 a, [
  11. *         TO CHANGE.' u) i% o) I* s" M/ g" G7 {
  12. *
    ) K2 {# H3 @- u) |  \3 [
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    & r$ N  Q. ^. e+ p& E, I2 ]
  14. *
    9 G3 J- R+ W2 K3 t* b+ B1 D
  15. * This program is free software; you can redistribute it and/or
    " A$ B( M3 P' M
  16. * modify it under the terms of the GNU General Public License as) ]$ A) F1 f0 \( U" L  X
  17. * published by the Free Software Foundation version 2.7 x6 y- n5 g# i, J
  18. *3 |# ~& H4 f$ V7 E# R/ a, l# m: I
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ) ~4 Q' @: r. m+ Z5 v( k( N' Q
  20. * kind, whether express or implied; without even the implied warranty5 x8 R8 W; s/ M1 Y) R
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the8 F9 H. r* I6 g. s7 ?2 B+ F' N/ {
  22. * GNU General Public License for more details.4 N! S6 p0 `, ^" z0 J9 C4 s
  23. */
    - [; f- @- j1 q' u7 H* Q; D
  24. 3 u( @! D- y' z# a
  25. #include <linux/module.h>- H* e8 w4 a/ z  D' B$ q* R
  26. #include <linux/init.h>& d) ?6 A. G8 ?8 [4 \: n& i/ ~
  27. #include <linux/errno.h>
    : w! Q! |0 \% G1 C' o0 M4 B
  28. #include <linux/types.h>
    - o. A8 [! O4 n, p- q' D' v
  29. #include <linux/interrupt.h>
    : o. B  c6 g3 W6 a, c0 J! {; w6 |9 s
  30. #include <asm/io.h>
    ' d  e* R) l; k+ I* ^( G' V/ _; J
  31. #include <linux/moduleparam.h>
    7 p) c; i* o6 r% D; Y( A3 }( ]
  32. #include <linux/sysctl.h>  N( ^( F! g7 u7 t, Z, o
  33. #include <linux/mm.h>/ w' m- t1 x3 [, C& A8 O
  34. #include <linux/dma-mapping.h>
    " [6 I/ A' u" `- ?( V
  35. 7 [) E3 v0 r* c' `6 O( m1 `
  36. #include <mach/memory.h>( G* v* `7 r" _0 I
  37. #include <mach/hardware.h>1 Y$ w! t4 J) C  Z1 e
  38. #include <mach/irqs.h>
    5 @' B+ j; M' m0 g$ l9 i
  39. #include <asm/hardware/edma.h>4 h  A6 D% }. R$ h' \1 V: B, v
  40. 0 C" M9 y" F% x5 y
  41. #undef EDMA3_DEBUG
    & `7 p! i. e2 R# W4 n
  42. /*#define EDMA3_DEBUG*/
    $ b0 Y0 L9 z8 X3 l2 [& O" r

  43. ! x- w$ d* r+ K% V  l
  44. #ifdef EDMA3_DEBUG
    , f( W9 V# @: _# D, D4 f
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ) [1 s# j; d2 v) u) R+ U
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    9 D3 q7 J$ s2 J& x8 {& u: _
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    + R6 W. o/ @3 g" u7 n/ ~
  48. #else2 D5 e; s' i8 N
  49. #define DMA_PRINTK( x... )
    ) U6 L: j! ~- t5 o/ N
  50. #define DMA_FN_IN" {3 t6 F& f1 R5 i
  51. #define DMA_FN_OUT$ t( M! E: P; W1 \; d0 ]8 H0 W
  52. #endif' X" v1 l2 E2 Z$ k: J7 i
  53. ; O0 O- |! o5 l
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    6 G: |5 Z" ]9 ]$ f: y# g- k! X
  55. #define STATIC_SHIFT                3# e# t9 R. _3 D1 R; ]. B/ D
  56. #define TCINTEN_SHIFT               20
    # M1 ~  q" m3 Q" y
  57. #define ITCINTEN_SHIFT              21
    * r/ U% C, x+ Y# y
  58. #define TCCHEN_SHIFT                22
    . X/ }  S) G! S$ S/ {9 B  L
  59. #define ITCCHEN_SHIFT               23" h: D) n& w) e* y1 v. Q- C
  60. 7 @1 y3 s& o) m
  61. static volatile int irqraised1 = 0;
    ! x7 S# |. U. M. Z/ ]' y
  62. static volatile int irqraised2 = 0;
    % ~& n, Z, o. v6 g) E6 n0 T

  63. - n! O. u- H) R# \: b7 a5 h
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 N" x# h$ q. t. ]
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : [/ a+ I( ^( C8 N% y6 x( ]& v7 e
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " e& x, C% ?4 \6 a4 ?1 \; z% D
  67. * w# f- j+ l1 i( T! y6 A7 G8 t# b& o
  68. dma_addr_t dmaphyssrc1 = 0;; N6 X# A# [( y$ b, u
  69. dma_addr_t dmaphyssrc2 = 0;2 q, d5 D" ?% s
  70. dma_addr_t dmaphysdest1 = 0;
    2 m/ y6 n: P3 g  N
  71. dma_addr_t dmaphysdest2 = 0;  [( G. }) z5 p" t2 q
  72. 7 q% L# `, K- @* }. c+ N" D
  73. char *dmabufsrc1 = NULL;
    2 ^1 z7 D) V6 P: c( ?
  74. char *dmabufsrc2 = NULL;
    7 M# f7 q$ w. m, g
  75. char *dmabufdest1 = NULL;
    7 {5 W+ f# ?0 i
  76. char *dmabufdest2 = NULL;
    ' S  b4 K% s- c" q% L& l+ {" D
  77. % U7 p" O* ]7 l" F3 v4 X* I
  78. static int acnt = 512;
      [4 H; \) W: k  n: l0 k
  79. static int bcnt = 8;$ p  E" ?! U, w% X. }2 r  y6 M9 \
  80. static int ccnt = 8;4 |  L" j/ b* a
  81. # }/ _. e. u+ y; s: i) k/ W4 A
  82. module_param(acnt, int, S_IRUGO);
    $ B3 q0 Y6 l2 _2 g$ K
  83. module_param(bcnt, int, S_IRUGO);
    $ Y9 ^, I* I# ]( P2 E. [
  84. module_param(ccnt, int, S_IRUGO);
复制代码

1 b7 M: f5 T( ^3 }1 B, s" i+ f' @: N. _- g. J) h
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
& i$ l- p* j  Q& K5 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。2 e+ x# D7 |2 X
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
, L7 q; E( x4 }3 @5 h
( I% P: T" T( I) g7 @
* @0 O( k; K- x1 h9 V* ]
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-24 22:15 , Processed in 0.038669 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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