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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
! q7 m$ f4 A' p! r
  1. [code]EDMA sample test application
    : h: @9 b8 c' M3 {: ~/ S
  2. /*- i) E" B- l! _3 L; E
  3. * edma_test.c, q0 Q- ]9 f* b, L
  4. *
    6 |4 s& u; k1 F7 p. F
  5. * brief  EDMA3 Test Application
    : O5 F6 t2 w, t
  6. *  ~$ Q6 y: W$ ^" C5 r
  7. *   This file contains EDMA3 Test code.6 `' A$ x9 z+ U" ^
  8. *
    . B" ?" H+ Z% G
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE; ?+ G, }$ H3 E  r  q' g* h
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT- U8 f8 G, B1 U; F9 c$ o" w
  11. *         TO CHANGE.
    & p% M( ]- [4 l- J9 C3 G. c
  12. *$ M" x, y/ l$ i7 l
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/% p/ u, J- h  [7 i/ g
  14. *
    - g- i% R2 T( b+ w
  15. * This program is free software; you can redistribute it and/or
    " I( v$ _, E/ L6 N" j8 l! J: k
  16. * modify it under the terms of the GNU General Public License as
    + M& \+ ^/ _+ s* M
  17. * published by the Free Software Foundation version 2." y  L, H9 a3 k9 e3 \1 B
  18. *9 d; _6 t3 w6 @! x; c
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any' O* L7 U0 |/ r) \" h* I5 v$ K
  20. * kind, whether express or implied; without even the implied warranty# y/ m( u9 d" i+ g& l3 r- o
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the5 Y; A( ]  x* m3 n1 \
  22. * GNU General Public License for more details.
    ( _& U5 V: s1 @) N3 v. V
  23. */( n) x. {. I% {* v& `, Q7 F

  24. ' I6 T; T3 ^8 _. R% [' `
  25. #include <linux/module.h>
    6 d" [; I1 b$ J2 F) B, [% ?
  26. #include <linux/init.h>$ g' ]" Q- d0 V  g2 C4 F
  27. #include <linux/errno.h>  S7 y3 E8 `, q# ^' S" ^, j  z, o
  28. #include <linux/types.h>3 C. V& N, ^5 A2 R7 H7 |. _% e
  29. #include <linux/interrupt.h>8 v4 z( y8 q7 f. O4 Y( W0 {6 y( [
  30. #include <asm/io.h>
    / ^, }5 d8 ?! n' o! e
  31. #include <linux/moduleparam.h>! W! p! A2 ]7 ?8 I6 }8 [5 }
  32. #include <linux/sysctl.h>
    * m0 L1 l8 Y$ ^+ Z" q7 t3 }
  33. #include <linux/mm.h>$ b$ |- c$ a) D1 ^
  34. #include <linux/dma-mapping.h>
    6 B7 c- A& b8 j" L

  35. 8 P& t) ]1 Z$ q% t( H7 D7 v3 Q) ^
  36. #include <mach/memory.h>
    2 l0 F) |4 g5 {
  37. #include <mach/hardware.h>
    0 N0 s4 A2 V2 v% ^! U7 r
  38. #include <mach/irqs.h>
    1 C1 b$ n; C6 B# [
  39. #include <asm/hardware/edma.h>& g/ d+ o6 [1 G9 B) y
  40. - u4 i) X* @' ^( {
  41. #undef EDMA3_DEBUG9 l* `& J* r- M( F
  42. /*#define EDMA3_DEBUG*/: i9 {" o( L5 ~3 I

  43. 6 @+ L; |, r3 j4 Q" F
  44. #ifdef EDMA3_DEBUG4 ]+ j5 ~# Z% h% u7 f5 _0 ^
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ) w/ v: q0 b1 @9 [- [9 v
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    * o: w& ~& o) \, e# N+ W
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
      I4 A* D8 P0 O3 L& P' |2 D/ \7 a
  48. #else
    $ m) n1 `  G: X4 i: g( s9 @
  49. #define DMA_PRINTK( x... )  a: [- r( I  x/ B/ t. b# b# y
  50. #define DMA_FN_IN0 `! U5 J& _  z: N+ Z6 M* y2 t. ^
  51. #define DMA_FN_OUT
    7 @7 n; u- \# g" D3 L, _2 {
  52. #endif' t3 ?% D* Q  x& B/ Y6 s
  53. - y& m4 ^% i% @8 E5 P% X# n4 U
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    4 H( O4 X; n! _) d
  55. #define STATIC_SHIFT                33 N! T. W4 E5 O6 D- _
  56. #define TCINTEN_SHIFT               20
    3 u4 L  g$ f/ D" n* v; b
  57. #define ITCINTEN_SHIFT              21" Y( D" F8 J- h
  58. #define TCCHEN_SHIFT                22
    + `$ O# ?# A8 D' m
  59. #define ITCCHEN_SHIFT               23
    & f5 o6 X- T4 Y
  60. 3 Z8 P7 F/ r- |% {
  61. static volatile int irqraised1 = 0;
    * D& [" k4 F" c8 _" Q6 L+ E: {* O3 O
  62. static volatile int irqraised2 = 0;
    % R7 ?4 H0 f0 i2 e

  63. , G3 V5 K* I2 E' j' w! z
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ x7 ~% ~0 P$ z
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 b. t, ?$ I# S
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% s- i/ g% F. ]; L

  67. : w1 R& X% J' n
  68. dma_addr_t dmaphyssrc1 = 0;
    5 W( J: L* K+ o! X# T: b: k. z
  69. dma_addr_t dmaphyssrc2 = 0;9 {, D0 S4 t$ B" |+ O" P; p
  70. dma_addr_t dmaphysdest1 = 0;
    2 m' P4 s- s6 t  e
  71. dma_addr_t dmaphysdest2 = 0;
    9 o" `- `, f7 t; |1 t6 t

  72. 4 k9 V% L  f; m/ f4 D# l6 ]
  73. char *dmabufsrc1 = NULL;; J' R- M( [1 p! ?
  74. char *dmabufsrc2 = NULL;
    0 q% q) e4 k& [6 F3 l/ L# Z
  75. char *dmabufdest1 = NULL;" ]( B, j! \4 D: x
  76. char *dmabufdest2 = NULL;
    7 Y: R6 g3 Q. N6 `8 \6 Z

  77. 9 A8 F+ g! ?0 ^) H3 D
  78. static int acnt = 512;
    2 T: |0 f0 K- C0 d
  79. static int bcnt = 8;
    % F7 M/ d6 Q) \# M( @
  80. static int ccnt = 8;; ?" i3 Z; h# m. h. y

  81. " P- H% D1 g1 A; {8 r7 _- F& i
  82. module_param(acnt, int, S_IRUGO);
    . a9 s4 T  i5 v7 L1 s
  83. module_param(bcnt, int, S_IRUGO);' ?3 p* v0 p; f* e3 c  c
  84. module_param(ccnt, int, S_IRUGO);
复制代码

! n6 w' i! f/ S; {* G, M* c" c
& t# p. G" g+ N& ^3 Q      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
% Q! C, r( g8 V- e; e4 narm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
' l' j' F( t5 L% e8 j% A     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
# d& h9 e* o# k7 \5 b
& [! H0 z  U4 y/ U* G
! z- g; W$ |7 o
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-8-2 08:03 , Processed in 0.048071 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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