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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
( _- e/ M3 M+ i) ?% C9 I
  1. [code]EDMA sample test application5 a7 R) f1 z. M2 F
  2. /*
    - A3 Z" X4 |0 _3 {
  3. * edma_test.c5 R  a2 h9 c# c! w
  4. *3 g) E. {9 q7 y9 h: j2 t
  5. * brief  EDMA3 Test Application) L3 m* E- d( j" q  |
  6. *1 {$ c4 \$ _8 Q0 @4 o
  7. *   This file contains EDMA3 Test code.
    ) _8 U) p, e2 e. O  _  j! e
  8. *1 @6 v+ `3 v) T, v/ a% T6 z6 ?
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    * L! k* w- n: z* }# p+ D) B2 f
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ) s+ Y% s8 d8 f; A
  11. *         TO CHANGE.* B8 D* _+ V  t- ], s4 p8 t
  12. *
    ! [# I: d4 d' {& `0 U
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
      m+ e5 \( [4 O) A0 I2 G6 U2 R; U5 C
  14. *+ o- u" K# ^4 t. `6 m; C% |/ u
  15. * This program is free software; you can redistribute it and/or
    * G# Q% T$ U# [0 X9 |- e
  16. * modify it under the terms of the GNU General Public License as/ r3 r& v% B: d/ u9 F/ n7 o0 g
  17. * published by the Free Software Foundation version 2.% w; f( R) f( {# G
  18. *5 R6 p4 `+ L& p$ O
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    2 v; @" T, _0 o7 ]
  20. * kind, whether express or implied; without even the implied warranty4 L" W; ^, N$ l4 V! r
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ) K$ [( {0 C; l% x0 w  I: M
  22. * GNU General Public License for more details.* o* A$ ~- x, W7 \
  23. */) F( B6 l7 I$ E2 \
  24. , W" D' u# c$ f  M% i; z+ A
  25. #include <linux/module.h>' T# k# Y+ k1 Z/ O1 C
  26. #include <linux/init.h>
    + D0 T! n& L4 e# b0 M  k. A/ Z* p
  27. #include <linux/errno.h>
    ( v  J4 B3 R9 V+ Z' m
  28. #include <linux/types.h>6 U; v: f* E$ g' w+ U) d$ R7 ~
  29. #include <linux/interrupt.h>
    3 e" {0 q0 A# O" q$ J
  30. #include <asm/io.h>
    % u; t4 F- C, |& X2 k
  31. #include <linux/moduleparam.h>" A9 \6 H0 T- T' z( b# _( g7 ~0 \$ I. _
  32. #include <linux/sysctl.h>5 M* O; E! K9 m9 i$ r3 x9 k  w. j
  33. #include <linux/mm.h>
    * F' M, Z$ ?# V9 k. \; [
  34. #include <linux/dma-mapping.h>
    / C5 k1 E8 c$ p

  35. / Z6 n) S/ }, i/ y8 M3 a
  36. #include <mach/memory.h>8 M( C9 R& _# o) U# e' Y6 `4 j
  37. #include <mach/hardware.h>
    * i$ Y: I- c1 s" P1 W
  38. #include <mach/irqs.h>5 z3 I4 C* B$ f, d4 v+ v
  39. #include <asm/hardware/edma.h>
    8 N0 T  c# ?9 y& |& N
  40. 2 x, [1 x9 z$ Y! Z. c
  41. #undef EDMA3_DEBUG! S2 `8 \& A: l; C9 l/ N) f
  42. /*#define EDMA3_DEBUG*/
    # x) G5 k& N6 ^& {2 ]( s6 r& w, z2 _& D
  43. % Q' Z+ x' A! I7 H7 k
  44. #ifdef EDMA3_DEBUG7 ~4 t% P, X7 _: \% |, d% n
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    + a& r7 u+ M6 P( y" X
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    # _7 m: F$ H# v4 S1 |
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    9 G' W: n/ x+ ~
  48. #else
    4 y5 s& r6 \8 V: M+ B+ R
  49. #define DMA_PRINTK( x... )
    ! I2 t/ z( z! W- \- `* U
  50. #define DMA_FN_IN
    # |3 H0 Q. y1 u% H
  51. #define DMA_FN_OUT
    3 r& I9 d- h* X
  52. #endif0 l1 {/ O( g5 ?; V

  53. . @+ p! w/ c8 w2 q3 `! H+ X
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)2 h+ G, S+ L6 A; i" D
  55. #define STATIC_SHIFT                3
    1 D5 ^  N* N$ j) Z8 J  g. V
  56. #define TCINTEN_SHIFT               20
    0 K0 ?. i. y5 N" \) j
  57. #define ITCINTEN_SHIFT              219 G3 b' Q0 h% o+ K  C- K4 X
  58. #define TCCHEN_SHIFT                22
    5 W& C- n$ u. {9 K' A; Z# x- H
  59. #define ITCCHEN_SHIFT               23
    6 ^3 d! Z7 `. F. K
  60. 1 w# G6 p; U9 u1 _! G
  61. static volatile int irqraised1 = 0;. R8 Z0 R* ^  f9 r; U4 N
  62. static volatile int irqraised2 = 0;" b4 d) s; X8 s

  63. ) V& b3 D, t" _! R4 w
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " l- \% A+ h! R" D8 h
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  C7 J4 {3 f. X4 {+ ^. P6 l5 L
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 G; _/ ]6 {* T$ f1 O' E- C" P  |( p

  67. . D$ ]# A. x$ m9 v- @6 F
  68. dma_addr_t dmaphyssrc1 = 0;
    3 b4 \7 I2 c; Y4 f  _  b8 i. B
  69. dma_addr_t dmaphyssrc2 = 0;7 c3 @% M9 \& F! H. O& c4 r2 c
  70. dma_addr_t dmaphysdest1 = 0;; b$ o7 }. v" L0 W
  71. dma_addr_t dmaphysdest2 = 0;6 `! ?4 i7 ], ^  u1 H
  72. ) h7 |, i! g* F) M( p0 i+ J* h1 {
  73. char *dmabufsrc1 = NULL;
    * k4 o1 V3 o6 ?' Z& H
  74. char *dmabufsrc2 = NULL;6 N5 l6 @; H& x' `0 W
  75. char *dmabufdest1 = NULL;
    7 J+ ^" W! B) C; K+ V7 U8 w
  76. char *dmabufdest2 = NULL;+ x  D/ Z& B; ]# _) V1 x  M! L% H
  77. & M0 Y  N6 z% F8 |! [
  78. static int acnt = 512;
    2 m! V0 z8 N8 y  [# G% e  N
  79. static int bcnt = 8;/ C% j% X. m" |( m7 }# C
  80. static int ccnt = 8;
    $ w. @9 T: I$ q- S

  81. 2 `+ {4 U" _* h$ a
  82. module_param(acnt, int, S_IRUGO);
      s3 h1 d& z1 [" m5 O+ A( H
  83. module_param(bcnt, int, S_IRUGO);$ l' p; S" I* a* b" O0 d
  84. module_param(ccnt, int, S_IRUGO);
复制代码
. V+ a) {" h1 X! T

9 G! l  b( w0 }      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
5 H% w* {/ m: a6 y6 tarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
7 U$ n) Z$ [  `8 \' `7 B9 q6 M     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。0 f3 C  W. G# @0 Q0 ^( u/ Z

8 u) q4 U  E. H# W9 d# Q$ x9 S8 a$ g  S
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-11-9 18:06 , Processed in 0.040010 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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