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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 : G$ j2 I# `% z
  1. [code]EDMA sample test application
    9 \& t  S- l3 e6 y
  2. /** z' K6 @8 ]& o/ r
  3. * edma_test.c
    . L2 |) S, z; N+ J# m/ K8 O
  4. *8 |2 e, ~% J7 h& A% m5 D
  5. * brief  EDMA3 Test Application
      D  {& Q6 h. O0 L0 f
  6. *- E$ F# H' }/ W+ F5 h; Z6 u
  7. *   This file contains EDMA3 Test code.* q- _! F- z5 O4 a
  8. *; F! q4 Y4 |7 S! Z. \
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE  y& L/ U7 b$ H: J
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT3 T9 ~0 `+ S2 ?1 G5 M, Q
  11. *         TO CHANGE." t2 ^# a! x% U0 V
  12. *
    5 n" Y/ W. z* t7 J0 A- M/ z
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    1 J0 }" v. o5 n
  14. *
    ! k. M3 S  |  i9 A5 e1 V
  15. * This program is free software; you can redistribute it and/or
    1 u3 B$ n5 k  B8 Z$ w2 q& Y
  16. * modify it under the terms of the GNU General Public License as
    * |4 W% e  l) X/ V/ u& y0 K+ S
  17. * published by the Free Software Foundation version 2.
    8 F; o/ q+ ^; m$ }4 W
  18. *( S  ^, z' V2 q" O2 v  G7 @
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    2 r/ v3 G- e# y
  20. * kind, whether express or implied; without even the implied warranty6 f# i* L" Y5 D# K& r' `* J( y8 Y
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the/ z- U; O* F% d+ V* w" L
  22. * GNU General Public License for more details.  j5 }4 b) g7 L9 g2 Z1 |$ @9 j
  23. */
    7 _& v* M6 k1 }/ i. X9 n

  24. 7 N" R4 i# ]) i2 L7 l
  25. #include <linux/module.h>1 |# Q2 c7 M9 D1 t1 v
  26. #include <linux/init.h>
    ) H) N* R: @/ k2 O' {
  27. #include <linux/errno.h>* c' h& D: s! q/ t. S
  28. #include <linux/types.h>
    5 a6 H% L0 V' c" r+ G. q0 z
  29. #include <linux/interrupt.h>
    ' r9 H9 V" [4 f% o( g
  30. #include <asm/io.h>
    . r0 j7 C) v# B+ M. Z$ b# @. y
  31. #include <linux/moduleparam.h>
    ( Z; |0 D) W& F7 t- H- v
  32. #include <linux/sysctl.h>
    ! c, S! u  b( U4 o' H" ?" K5 I
  33. #include <linux/mm.h>
    ! z6 U% d  B' O9 Q$ q! a# _
  34. #include <linux/dma-mapping.h>
    6 F/ G) A8 V( i* p. u/ I4 i' ]

  35. + h: ]2 [$ s) R7 X
  36. #include <mach/memory.h>6 M! P& z& f' Z9 O. K% T6 F( E- Q* Q0 U
  37. #include <mach/hardware.h>
    7 K: B, ]/ |3 @! E. d
  38. #include <mach/irqs.h>0 r' b3 w7 }. R' e' ~% U
  39. #include <asm/hardware/edma.h>$ M4 H6 |% r; M" J. f
  40. 9 P% @0 b" T+ r' x) b" H1 l
  41. #undef EDMA3_DEBUG0 |- o4 ^; V+ K: k; U; j
  42. /*#define EDMA3_DEBUG*/: w6 t0 ]" F9 O1 a1 K
  43. ' |% i( a; j! ~8 S4 p2 I5 ?
  44. #ifdef EDMA3_DEBUG) |* K& N6 a. c& }) A1 `
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)% {! ^2 C0 Y: l6 X: g* G) L
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)  f2 q6 U; Y+ g/ q: y
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)! S! e& O* Q* H, ^" y, z
  48. #else3 Z6 M1 V1 L% u' {2 L+ a
  49. #define DMA_PRINTK( x... )
    # x0 d& R; R8 e3 j; `1 m
  50. #define DMA_FN_IN8 |# o: p* Q. v( q4 w3 ?
  51. #define DMA_FN_OUT
    ! U" Z/ ]: C8 i' n5 {- f, U9 e' r
  52. #endif* e; Y- _7 b3 M! z; p; [

  53. # N9 G5 Z3 b9 a6 U1 a2 n: |
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ) Q" L% d7 k0 W' t- n: c
  55. #define STATIC_SHIFT                3
    4 z* d3 r$ A& l8 b) [4 a2 R) u+ E( }
  56. #define TCINTEN_SHIFT               20
    8 E3 T" d& E: @: K5 Y
  57. #define ITCINTEN_SHIFT              21$ d( Q5 A% g& q0 V. q: }
  58. #define TCCHEN_SHIFT                22
    3 m1 y0 y& @: Y0 G- I
  59. #define ITCCHEN_SHIFT               23
    & Q. g5 t8 ]. u; w: L4 E

  60. 2 U- e7 X8 o4 Z4 i( m0 T" ~
  61. static volatile int irqraised1 = 0;3 D- Q9 Z  j# g* R/ D
  62. static volatile int irqraised2 = 0;
      Q+ Z) R( d, A( k4 N
  63. $ }! y8 {) e8 q
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) \* i- Z& `5 v+ z
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' N% G, |/ |. @$ z. ]1 Q
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& O+ r; @; P# o' B) r4 N
  67. 8 G) j% l( \$ J: W3 q
  68. dma_addr_t dmaphyssrc1 = 0;3 q/ G$ \+ G" `" u7 H' i- Y
  69. dma_addr_t dmaphyssrc2 = 0;
    9 d7 S% P; j' I" p
  70. dma_addr_t dmaphysdest1 = 0;
    % ]5 K5 b8 f! d! K& d
  71. dma_addr_t dmaphysdest2 = 0;- `# T% A% T/ q* [' {/ _: k

  72. 1 l. ]$ F. ?  g: t" |; {# l
  73. char *dmabufsrc1 = NULL;9 z+ B8 x4 r  W3 f
  74. char *dmabufsrc2 = NULL;  u% v2 \% j8 y# X6 o/ I" l5 r
  75. char *dmabufdest1 = NULL;
    # C. D  Q) T4 f1 O9 @5 h
  76. char *dmabufdest2 = NULL;
    5 p; m: q4 n$ n" j

  77. $ h3 C7 v8 v, ^
  78. static int acnt = 512;
    0 @8 C  u( [7 b! U; h
  79. static int bcnt = 8;9 Q) P6 d7 ^9 o" G- z; f9 ]
  80. static int ccnt = 8;
    ! C* X. n' _" J$ Q, [

  81.   ~" L8 m, f: t6 \3 r0 P% I
  82. module_param(acnt, int, S_IRUGO);. f- {2 j) z8 G: O) Z
  83. module_param(bcnt, int, S_IRUGO);
    8 \" _' W$ H' A1 a% n: Y9 ^$ k  ]
  84. module_param(ccnt, int, S_IRUGO);
复制代码

% v- N/ Q6 l# A( ~. v% S: J7 f% [
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用+ p2 p! @6 m: s& I
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。8 s* ?9 e' j. `6 l+ Y$ p
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。+ U% Y& j4 S3 L/ U" ?

& _. o# _4 F; m$ g/ i- i, |+ }" G. s5 A: z: z5 n* ~$ C, W& g
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-22 09:37 , Processed in 0.043084 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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