OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 * M7 d% \% r! c4 O+ @8 ]8 }. v/ j
  1. [code]EDMA sample test application
    " Z. ^9 f7 V0 F% _, O4 K
  2. /*0 Y6 z8 Q! T; M) {! y. f- L
  3. * edma_test.c' M  q) n/ l  k! V9 d8 e
  4. *
    5 A% K7 ]$ y, q
  5. * brief  EDMA3 Test Application5 y* H9 y2 q& @( M  x8 Y9 V
  6. *
    0 }. F/ F9 F' m/ Q. a
  7. *   This file contains EDMA3 Test code.2 V& n. S; n  ?9 e5 \2 b4 Q) O3 M
  8. *
    3 K& k7 w5 u; C0 `
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ( R/ d/ F0 a) _" |
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ! ?" q/ U3 V* a) G, J9 m
  11. *         TO CHANGE.
    0 \% v+ r& Y' g' A! B1 l# `  }6 l0 S6 t4 D
  12. *
    $ b5 b0 }5 l' w+ A0 Z1 a
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    3 L& c) G3 a9 z# b) H$ S2 b  l% B8 E
  14. *1 m% }" Q/ u* G6 K1 A) y$ X
  15. * This program is free software; you can redistribute it and/or
    5 C3 }. [! X' k! C5 g
  16. * modify it under the terms of the GNU General Public License as6 @# L  |- l6 h& b9 r( s7 Z5 }$ L/ y3 Q
  17. * published by the Free Software Foundation version 2.
    / F0 k' k& r+ t* v) C8 Y, G
  18. *
    0 k! s8 ?4 @2 b* c; n0 C* H
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any% X5 f8 D9 i( ~
  20. * kind, whether express or implied; without even the implied warranty4 e% r0 O/ u$ D" C7 ~
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the2 R( S% a: ]+ }: X  I8 c
  22. * GNU General Public License for more details.$ m$ i6 V; B$ z9 J' J
  23. */
    7 o* s4 ^. c, e; r+ X9 c* G

  24. ( H: M( K! O- @' T6 E
  25. #include <linux/module.h>% }- _( v" J# Z: Z8 o% G
  26. #include <linux/init.h>
    - V1 k3 @2 T8 a* {  E$ m) d
  27. #include <linux/errno.h># }0 g; ]2 o# o% B6 o
  28. #include <linux/types.h>
    3 R  B% @  ~. y/ o( e% c1 {
  29. #include <linux/interrupt.h># D! C% E9 y9 S$ F+ }6 J. j
  30. #include <asm/io.h>
    1 O  r, c4 b5 g! O
  31. #include <linux/moduleparam.h>( U; g/ _( Z; W$ H  j
  32. #include <linux/sysctl.h>
    2 C! X" U( O7 a4 x8 v. r. @
  33. #include <linux/mm.h>
    9 I$ t, @2 B' \, J7 e/ G: \
  34. #include <linux/dma-mapping.h>
    % P" t  s( Z5 }3 F$ ~2 B; n$ s6 ]
  35. 2 |4 A' m0 s/ c6 u- j' |
  36. #include <mach/memory.h>
    * F8 `, D3 R% x
  37. #include <mach/hardware.h>) ]9 [6 f% }0 \# T# z
  38. #include <mach/irqs.h>& s& h/ U. H) A0 n! J
  39. #include <asm/hardware/edma.h>6 ]# {$ }+ ]1 D$ G- W3 M6 U/ l  e

  40. 0 C8 R1 X! o' A
  41. #undef EDMA3_DEBUG
    " l" \; g" I/ F3 {
  42. /*#define EDMA3_DEBUG*/- Z" o8 m# @+ {2 ?$ _& b, W8 B/ P
  43. 5 E1 }( u, E9 k3 B3 v
  44. #ifdef EDMA3_DEBUG& e% c+ D/ P$ d5 p( p" ^$ g
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    : G5 g8 u( G, m/ n# y0 K
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)2 _3 L/ t. f0 E2 n
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    & W9 a9 B0 o, W' i3 o
  48. #else7 ^% W7 X$ B. ?1 i2 C/ C
  49. #define DMA_PRINTK( x... )
    8 a7 Z. |' Y3 h8 F
  50. #define DMA_FN_IN
    $ c  e  T( X  S' o8 X
  51. #define DMA_FN_OUT: A& b4 u+ c5 J9 B( |! C& L
  52. #endif
    9 x" \; K! ]7 N- @7 f* O! t

  53. 4 l) C! `0 z/ d% E
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    9 q* Q! n3 O% L) u# U2 \
  55. #define STATIC_SHIFT                3
    . D1 r$ h) w# H/ F
  56. #define TCINTEN_SHIFT               20: c$ v: n+ |. d0 }( O, t4 z$ y' U% f
  57. #define ITCINTEN_SHIFT              21% x( i! O7 D7 n  c% ~  v$ o' P- X
  58. #define TCCHEN_SHIFT                22; E& U1 D' j7 h' F
  59. #define ITCCHEN_SHIFT               23/ |  v$ M* r+ z- X" b3 m

  60.   b4 G) V2 k+ o+ j" G& }
  61. static volatile int irqraised1 = 0;
    . |( u: ~4 r" M  |: C0 ^
  62. static volatile int irqraised2 = 0;
    ' \0 ?& r) w" l
  63. 1 K& l: p1 B% r9 f
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% ~5 v- y& C: q6 u/ Z1 w! i
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( Q7 b8 _/ L2 d- M$ c' @. m) y
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ h8 U- z( P' W8 u; T- B
  67. ' F4 f5 N* }/ s
  68. dma_addr_t dmaphyssrc1 = 0;) w& ?: r' Y% Z- L# P5 M7 P9 w- m' V
  69. dma_addr_t dmaphyssrc2 = 0;
    : p/ q2 D( k5 i- l0 k
  70. dma_addr_t dmaphysdest1 = 0;
    . T# D' z7 ^5 l, X% y; d8 A
  71. dma_addr_t dmaphysdest2 = 0;2 d) u3 m, a6 c  `% z6 ~5 n* i3 Y

  72. + t1 D6 M7 Z8 M% B0 B
  73. char *dmabufsrc1 = NULL;+ U3 d( W" g, O, K
  74. char *dmabufsrc2 = NULL;0 _2 c' Z, m  V* ?
  75. char *dmabufdest1 = NULL;: U. f9 |: g# G1 P, Y3 h4 Z/ C# d  m
  76. char *dmabufdest2 = NULL;
    6 r6 V; Q$ T7 f1 j5 R

  77. 7 A4 U1 G, t. F
  78. static int acnt = 512;
    ; K# J: Z, ^* C7 v) L) j1 Y# k
  79. static int bcnt = 8;3 W% T8 A6 D- `5 ?( j* \% h! s
  80. static int ccnt = 8;
    4 O- d4 J3 ?' I; Y) t9 r2 R# O9 c: i

  81.   C/ f* C% @* b; O9 s/ U5 y
  82. module_param(acnt, int, S_IRUGO);' L! m* p) H# g# w
  83. module_param(bcnt, int, S_IRUGO);, @( c8 J% W- g1 k
  84. module_param(ccnt, int, S_IRUGO);
复制代码

, _5 ]0 ]- x4 a+ t% N
/ o1 G0 }# B1 Q; E      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用5 B$ e$ q! v' J% @# n& v! d$ o
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。6 l$ N$ ]% M8 a
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。: Q8 g1 e$ b! o2 F& F
/ S& O& ^1 S$ F8 q3 w' ~% N( V+ F

) s: O9 u, J/ f, x
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-7-9 18:24 , Processed in 0.036838 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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