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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
# i3 s" J: g" c- A  `- R. N: y
  1. [code]EDMA sample test application! D+ j' {" C5 g5 l0 n
  2. /*  A& [3 O+ `+ X  ~  {7 r
  3. * edma_test.c
      o: V% ~$ r, S' w1 ~; h
  4. *2 I5 \. M( _0 S3 G- @
  5. * brief  EDMA3 Test Application# U! [4 D; V8 y. E& g
  6. *" M5 r3 {' |$ ?  h* \& q+ z  b
  7. *   This file contains EDMA3 Test code.
    ( s' P; T1 J2 @0 J3 s
  8. *
    9 _4 H! G, G2 t2 p/ p3 x
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    $ Z  j5 N( ]# c6 f& X8 d
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    7 S. {0 J# h. [/ c3 ?1 O: ~7 i% a9 G
  11. *         TO CHANGE.
    $ M7 m% S5 }3 u" j+ e' q4 Z$ w
  12. *! v5 U( O- Q1 N+ i& o
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/" f/ B( G* {" N! x/ `8 ^* o
  14. *. A$ X' J0 G+ V. O5 B  B
  15. * This program is free software; you can redistribute it and/or5 T- c# A& |4 D5 z) I1 @3 q
  16. * modify it under the terms of the GNU General Public License as* q( f6 L! ~4 F9 w# N: }( F
  17. * published by the Free Software Foundation version 2.
    # d" G; @. t8 _/ t8 k, L7 I' M
  18. *
      G5 N. Y4 @  M% L
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    7 L' d- \8 Z" w2 t* \- V
  20. * kind, whether express or implied; without even the implied warranty
    6 D+ e7 d% G0 R$ i2 Y2 E0 [
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the( a7 B* y. }5 S1 z2 h$ O: D
  22. * GNU General Public License for more details.
      i' F5 x0 d# j, c/ \
  23. *// Z, X$ i; f, Z* v$ U

  24. 4 I+ o2 D4 r2 Z- e9 R
  25. #include <linux/module.h># |6 }) d- V" p6 L% n! d
  26. #include <linux/init.h>
    % b% T9 F8 n& f" ~) Q. \
  27. #include <linux/errno.h>
    % x8 o% P5 h6 ^+ _1 k
  28. #include <linux/types.h>% ~: @/ i* ^' ~& o. X
  29. #include <linux/interrupt.h>
    . c0 I! _) ]2 J* o, V
  30. #include <asm/io.h>, U& ?2 q+ V2 H9 ?  V
  31. #include <linux/moduleparam.h>+ o9 d% W2 H" B* Q7 R0 Y1 h
  32. #include <linux/sysctl.h># Z1 W, F+ w8 ^$ `
  33. #include <linux/mm.h>
    : A* |# Z; j5 c  C6 @& C5 F) C: N2 C
  34. #include <linux/dma-mapping.h>
    ; i  C" p4 R' k! ]8 [5 ]

  35. 2 b: F) W* ~2 ]8 p1 U2 }# j( p
  36. #include <mach/memory.h>% F5 o5 h. F4 C. ~$ e* ~/ j9 I" \
  37. #include <mach/hardware.h>/ E, ~* `: }1 k1 {8 H- a
  38. #include <mach/irqs.h>" x* g9 o; N# Q6 |0 r* P* S: Q
  39. #include <asm/hardware/edma.h>
    - G( t9 {& g$ c5 k
  40. 8 ^: ?9 @+ G3 X7 f8 R2 Z
  41. #undef EDMA3_DEBUG
    # E3 `) ^. }- i; P: @( q
  42. /*#define EDMA3_DEBUG*/6 j! N0 o' ~% x0 k+ X/ i# `7 c
  43. # {" B' V; \3 Q5 ?+ y& g
  44. #ifdef EDMA3_DEBUG
    7 W# d, ~( ~* D* `2 \5 P0 A" {  r- Y
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    6 u) k/ a# h! {( g
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)! _3 d' F1 t/ y* c6 _( M3 A
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ( Q% F6 V' c0 p4 c, _. v
  48. #else* J1 b" ^' M4 c$ l( y
  49. #define DMA_PRINTK( x... )) O) T# X! P1 H* E' j
  50. #define DMA_FN_IN' T- Z. H! w+ a' ?" c( b6 F' a) b. N
  51. #define DMA_FN_OUT6 M3 ~1 [5 K" T. e
  52. #endif
    7 X8 V0 y1 q: O

  53. 8 X! g  J# N7 p
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    : C( d& g) Y# ]6 p- V* g
  55. #define STATIC_SHIFT                3
    - ]% ^3 Y5 @; F2 @( ]; |' }! h" r
  56. #define TCINTEN_SHIFT               20# \0 Q* Y" m- D; _( X; B+ D) N
  57. #define ITCINTEN_SHIFT              21
    ; R& X  d% {5 T. w5 W/ j9 w2 Q
  58. #define TCCHEN_SHIFT                22, h' ]4 x3 P2 y
  59. #define ITCCHEN_SHIFT               23; z( z; x; N) _% V+ y6 f: v

  60. 1 g+ g' T: y- f& I
  61. static volatile int irqraised1 = 0;% @0 i" O/ @/ |
  62. static volatile int irqraised2 = 0;( i( r7 X& q% Y& L4 H8 {/ V

  63. 6 P# `: U; D4 F" G" W: n1 I. m9 s! x
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  @- v$ N# ~* p. n- y
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 _' u4 N3 _7 l
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- W; z9 ~" @4 j# S% y% f6 Z

  67. - x1 Q3 R! j/ T
  68. dma_addr_t dmaphyssrc1 = 0;
    ' T0 i. B8 X% M$ ]/ k2 t. e$ h7 D4 D+ m
  69. dma_addr_t dmaphyssrc2 = 0;
    & `5 Q+ f& y8 a- U% r
  70. dma_addr_t dmaphysdest1 = 0;/ t# g0 I" r5 V1 L' A
  71. dma_addr_t dmaphysdest2 = 0;* N: T, _! k7 j
  72. : B5 S: x. `5 r- t- ?. T& i" N- @% N
  73. char *dmabufsrc1 = NULL;9 J! l- A: N( ^! p# Z/ E6 Q
  74. char *dmabufsrc2 = NULL;
    - _* D" R, a7 H. J9 w  A
  75. char *dmabufdest1 = NULL;
    ; Y/ u7 O, h" ?# C. }8 j
  76. char *dmabufdest2 = NULL;
    9 W$ F% e4 _3 r/ f" h: A  B

  77. 7 n! \. }' G7 ^
  78. static int acnt = 512;
    3 I1 ]7 N. K& t! t7 ~  N
  79. static int bcnt = 8;' _2 ^( ]; d- \% ]3 r
  80. static int ccnt = 8;: F* `: B1 J! `% z5 Y$ r

  81. 3 M: Q4 f4 N6 J5 v1 ]
  82. module_param(acnt, int, S_IRUGO);
    / d# x7 `* E; x8 x$ e$ c
  83. module_param(bcnt, int, S_IRUGO);$ y) N+ T3 k1 ^" R4 d
  84. module_param(ccnt, int, S_IRUGO);
复制代码
; |% r6 Y& r. m5 F; o$ \! h! s

9 H  Q2 r- e0 |# D      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用; m) x0 v, C% p  A/ N7 b1 l
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
/ C4 O% v$ S  l     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
% C9 n4 S4 _4 B; Z' ~8 O3 ^
( }/ K* ]3 s4 F  m  @% V/ a. E$ y9 ~9 ?7 L5 h- ^
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-7 01:55 , Processed in 0.040262 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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