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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
, k# U, S" W) M: R
  1. [code]EDMA sample test application3 ~( e' J+ J5 c6 C5 e' E* o
  2. /*
    ! x/ a6 c' w& L: Q) `' i; [
  3. * edma_test.c: z! f( j" F) ?3 }
  4. *& ?) p- }6 O% w4 q0 b0 O  {4 J
  5. * brief  EDMA3 Test Application' z+ ?+ b$ ]' u$ ~  j' E$ h
  6. *
    $ l* w9 T; F0 b. d- [/ d; p
  7. *   This file contains EDMA3 Test code.
    - O, V2 |! D* A7 r4 o3 ]: }
  8. *
    4 V* Y8 `$ _, {6 c
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE7 e; J! n& B! U* G
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    4 S7 g& O  n1 l3 Q8 B0 L
  11. *         TO CHANGE.8 a% ^4 D7 W- i# t! b% C
  12. *
    6 T) c$ r6 G3 O
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/, w$ }+ E' A5 n$ b! x1 H" y- J
  14. *
    7 p& K8 [1 m) ^* |. {: @6 ^- k
  15. * This program is free software; you can redistribute it and/or
    - I4 z" [0 Q; z. C& h" l
  16. * modify it under the terms of the GNU General Public License as
    5 d/ q% |- n! w' C7 N$ \; a+ {' T7 Y
  17. * published by the Free Software Foundation version 2.5 z5 W6 ^5 c' u* T$ }
  18. *; d, [9 ?* R- T
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any: ]4 ]" q. ?. Q- S9 Y" ]
  20. * kind, whether express or implied; without even the implied warranty
    + x; Y+ s9 j# ]% P
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ( Z8 b  g  m; R0 K) N
  22. * GNU General Public License for more details.! ~. A* }& f" N# V5 I
  23. */
    1 q# D+ ]3 b' Q' s: E; I( |/ w

  24. 7 V0 f, r) F8 p6 M; q* o
  25. #include <linux/module.h>
    6 o* {/ E/ T$ x( V. @; E; @
  26. #include <linux/init.h>
    5 T* s( i# \$ l3 U0 B4 A& g- B
  27. #include <linux/errno.h>8 T. V- |: i( t& Z' `6 o5 R) }
  28. #include <linux/types.h>0 _8 c7 h0 l' u
  29. #include <linux/interrupt.h>  g$ I; L, W9 O- D. r% I' j0 ]. z7 j
  30. #include <asm/io.h>0 i* K2 u- x: }/ |- n$ g
  31. #include <linux/moduleparam.h>
    4 a" z) g& o( k2 d% O
  32. #include <linux/sysctl.h>  a* _" i- L7 l  N
  33. #include <linux/mm.h>
    * l( h, \( B0 e
  34. #include <linux/dma-mapping.h>3 x+ V" c4 g( |8 u. U/ v# h$ v3 [) m+ Z
  35. 1 d3 W) x0 G+ Y+ f! l- T: I
  36. #include <mach/memory.h>
    3 q; x/ v) b* V- l) g
  37. #include <mach/hardware.h>4 Z. Z0 ^) X1 y
  38. #include <mach/irqs.h>
    & N& O2 F1 Q; s# k0 `
  39. #include <asm/hardware/edma.h>0 P  B+ v* j; k: ^* Z

  40. 6 f$ ]* @8 U, H" G4 C
  41. #undef EDMA3_DEBUG' p5 D1 y2 Y6 x9 y+ [
  42. /*#define EDMA3_DEBUG*/  `8 l: E8 ]  |. A+ J3 b! Y
  43. + @" e% Y) J0 P* u) t; a
  44. #ifdef EDMA3_DEBUG8 e# n+ i% _. _5 y  D
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    9 A- C, A  z! q$ I$ z% ?$ U
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)6 D! K% X2 b2 Y1 N" ]+ r
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)* F# P3 O% J$ N- D9 U5 I* c
  48. #else! h- ]8 Q: Y8 q- Z. l8 J+ l
  49. #define DMA_PRINTK( x... )
    4 b! l* e2 R0 T
  50. #define DMA_FN_IN
    : o, z( @3 A. [1 U! z
  51. #define DMA_FN_OUT& z5 Q+ X; q  N. ]* ~8 }* `: N. e
  52. #endif4 U+ n# t; V# x

  53. ' T- {6 B# e' c( X6 [6 q
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    8 _; {4 }+ t5 [7 M5 N
  55. #define STATIC_SHIFT                3
    9 ?# i% l: O# F% s; {
  56. #define TCINTEN_SHIFT               20$ ^$ {2 k2 i2 E" a
  57. #define ITCINTEN_SHIFT              21% O% P5 V$ m& Q  q
  58. #define TCCHEN_SHIFT                22
    4 p3 J+ X- D+ E, |, W" @) t6 b
  59. #define ITCCHEN_SHIFT               23
    0 L7 R# x& T5 s

  60. 6 Y7 L- @& D% O; W' Z6 S
  61. static volatile int irqraised1 = 0;8 x" P+ g! O9 _1 I# r
  62. static volatile int irqraised2 = 0;* z" D4 a& a9 s9 w* A

  63. ) Z7 C& Z$ {) C
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ q4 s/ [2 a5 m
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # }1 n. f# ]. `5 }8 R
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / c; G* p2 B+ @0 `% g7 J9 R

  67. 8 Z( u9 K5 f1 [( h6 e+ M
  68. dma_addr_t dmaphyssrc1 = 0;, Y' h8 ~/ x$ ]+ g/ Y! p6 V7 F7 P
  69. dma_addr_t dmaphyssrc2 = 0;! M. U9 N% Q# t6 a
  70. dma_addr_t dmaphysdest1 = 0;& }) \% `1 c4 @: ]7 }
  71. dma_addr_t dmaphysdest2 = 0;
    ' ]+ }8 Z4 v& g5 b7 m& A3 B# b
  72. + x+ e0 j& l2 F! \
  73. char *dmabufsrc1 = NULL;
    / q! T: z5 z* x) s8 X! B9 X
  74. char *dmabufsrc2 = NULL;
      U5 N2 U4 ~* R0 r
  75. char *dmabufdest1 = NULL;% ^6 R3 R; L3 C, p( U
  76. char *dmabufdest2 = NULL;; Z3 y+ L3 ]: Y2 g5 A

  77. / ?" ]% @7 |* U. a) d3 A
  78. static int acnt = 512;
    & M% S) a3 U! z$ Y8 X0 }
  79. static int bcnt = 8;6 S8 f3 g1 p7 q& ?8 }8 Z8 o
  80. static int ccnt = 8;
    - d. s% A% S7 ?+ R

  81. / [8 @8 A- T2 S* O6 n1 U' S. K  w
  82. module_param(acnt, int, S_IRUGO);
    3 }" ^6 k1 ?: o, A: L. t6 P
  83. module_param(bcnt, int, S_IRUGO);0 v3 V8 m! k, a1 v; ]9 \
  84. module_param(ccnt, int, S_IRUGO);
复制代码

6 K" |+ [4 K+ g5 [& q) Q1 k% p7 i: C2 F2 v: @1 w
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
; G) s( n* i$ v! b6 Rarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
" `! ~. a, K' V7 \$ R1 ?; n     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
4 o& n, k7 s6 k9 u0 \8 }# {" k3 e/ x
5 Z  `/ S" F1 C
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-18 13:24 , Processed in 0.043209 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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