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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
8 v( ?7 b+ s' @6 r) E4 s
  1. [code]EDMA sample test application( t% T* }  F5 w  l
  2. /*
    5 v/ Q" W% |  d( T* [
  3. * edma_test.c8 r! p' y6 L3 o" ?; M4 r( ?: H% H: ]
  4. *" I3 i4 S3 }4 c8 f4 T
  5. * brief  EDMA3 Test Application
    9 [( n; f6 y& c1 w- v
  6. *8 }8 z/ ]8 G8 P2 l
  7. *   This file contains EDMA3 Test code.5 M0 b6 {  s# L5 W
  8. *' g+ W  }1 o0 _/ W& T) _6 r
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE6 x" r; v* N7 Y- ?% k$ P
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    " o6 X9 y# }0 U# A$ H9 k
  11. *         TO CHANGE.5 E. R% R! {1 h7 c' \
  12. *
    " s. a2 }/ j% w, [
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
      i$ q1 a5 C6 W6 u
  14. *
    1 v" D! O; x6 y+ U7 ?
  15. * This program is free software; you can redistribute it and/or) l4 G- s3 R# r; b$ n0 z# {# _
  16. * modify it under the terms of the GNU General Public License as
    ) @) A% w. [$ n5 `
  17. * published by the Free Software Foundation version 2.# o1 T/ L. A$ y1 ?9 D
  18. *3 T9 [8 k+ x4 w! n$ E4 X) M8 K) b
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any; B0 M/ l' s  [: t7 w0 X8 ~
  20. * kind, whether express or implied; without even the implied warranty  A- _$ A* i, g; r( @
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the; g8 T6 K" N0 x! L& P7 R
  22. * GNU General Public License for more details.
      w7 S0 q# H. s2 Y
  23. */2 _" e1 _9 o' r2 Q
  24.   G; z. t3 s: L# R
  25. #include <linux/module.h>4 U' `. G; Z/ J1 g0 j" h
  26. #include <linux/init.h>
    . U  I; S& B) P: {! N9 I
  27. #include <linux/errno.h>2 A) M4 k# w2 w* y1 t+ S# }# ^9 C
  28. #include <linux/types.h>4 n5 p; X+ ^( z# G! y, k* {
  29. #include <linux/interrupt.h>- [6 g1 z  s; D7 H3 x4 @: `) M
  30. #include <asm/io.h>. S8 K5 {+ n' m: Q
  31. #include <linux/moduleparam.h>. t+ g' A9 m- ]! P) ~2 ^
  32. #include <linux/sysctl.h>' a2 @7 F0 G6 B+ q8 \3 \7 A3 Y8 B
  33. #include <linux/mm.h>
    5 ^3 m# x# `6 E. j* Z' G
  34. #include <linux/dma-mapping.h>
    / n; L: v. ]1 F8 ]8 D0 Y, B
  35. 0 [/ `2 @/ T% b2 `
  36. #include <mach/memory.h>
      H7 p3 H1 U- v* Z6 C
  37. #include <mach/hardware.h>, C8 I% J; A: a
  38. #include <mach/irqs.h>
    9 r: y" E# |/ a! ^. F- |7 j" Z
  39. #include <asm/hardware/edma.h>
    6 D* N0 S7 w1 y$ j7 `* W
  40. & h! F, G. C2 q' {" X9 b6 A& t+ U: l
  41. #undef EDMA3_DEBUG% H) [( q: y& x% |/ z1 x, `, `
  42. /*#define EDMA3_DEBUG*/# S; P* h, f  n. T0 f/ H
  43.   N# m+ X( p9 I6 j" U& }( @
  44. #ifdef EDMA3_DEBUG
    7 O. Y) c: I/ S6 J
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    + T# _! I6 |0 a3 a6 P, O
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    # z$ j9 r( X. G, M
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)$ _. x, [# y0 b' z. }# B, j5 C7 K
  48. #else
    % }# [8 R0 D8 r+ Y) p! q8 h6 X- E
  49. #define DMA_PRINTK( x... )7 q) h3 z) J/ @2 N! Y5 g7 V
  50. #define DMA_FN_IN
    / ^# `& F3 y. R# U: t8 o
  51. #define DMA_FN_OUT
    5 M- G! X0 I- K$ R% D5 g* |4 o
  52. #endif
    ! [/ G  t0 J! o0 w; ]1 B" P
  53. ! s1 L3 p5 b6 O: u/ U: O
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)7 u5 Y9 Q' L+ ?
  55. #define STATIC_SHIFT                3
    ( o0 a& s( ~8 H. I( k! F3 r7 x9 q
  56. #define TCINTEN_SHIFT               20
    ( |7 s7 I1 [- ]
  57. #define ITCINTEN_SHIFT              214 c) Q/ A# `3 L
  58. #define TCCHEN_SHIFT                22! D* w- |/ U# s0 R) F4 r+ o
  59. #define ITCCHEN_SHIFT               232 e/ V- V: ?5 f5 {) Q

  60. ' V2 v9 \2 b- |+ ]- @% j8 V6 p+ h
  61. static volatile int irqraised1 = 0;
    # Y8 P  p2 P! s4 d1 f7 ^7 X- S
  62. static volatile int irqraised2 = 0;
    1 A: E- _4 i% e- e

  63. 9 {# I1 d# o4 ^. A- j
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : V- E' o: z8 }/ c
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 d" p0 X7 t, _# i
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 _, M- |6 ?4 N8 v4 v" z

  67. % C1 Y7 V! V; W8 W0 B! I0 D9 F& S
  68. dma_addr_t dmaphyssrc1 = 0;
    " |( |7 z* L* C/ y
  69. dma_addr_t dmaphyssrc2 = 0;
    4 e7 E2 R+ |! h. ?5 _7 G! ^- j
  70. dma_addr_t dmaphysdest1 = 0;( c# j" W/ E: ~1 v/ R  s5 e0 R
  71. dma_addr_t dmaphysdest2 = 0;
    * ~3 ]. g( @! v3 ^* V

  72. 3 ]3 `4 M: D1 G2 V
  73. char *dmabufsrc1 = NULL;: n3 f6 C* w, |% P5 j1 O
  74. char *dmabufsrc2 = NULL;
    3 @* ]+ ^/ V. R2 i# i
  75. char *dmabufdest1 = NULL;
    2 {1 I" D+ h: s' J
  76. char *dmabufdest2 = NULL;1 R: f" H: F0 ?! e3 `/ z
  77. ; j$ ?) @( y. D" M& ]1 A8 m. z
  78. static int acnt = 512;
    4 K' f7 E+ `( n, h
  79. static int bcnt = 8;4 \' Y  l" a' W( i% E5 F) D( c, ~1 H& P
  80. static int ccnt = 8;
      {6 i/ O7 G9 F4 W" N

  81.   L0 h- A* {4 r( z2 v0 V" o
  82. module_param(acnt, int, S_IRUGO);
    . T9 h( n! R* l8 F" Q) X/ h1 }
  83. module_param(bcnt, int, S_IRUGO);/ K1 p6 Y" B# L3 d+ U
  84. module_param(ccnt, int, S_IRUGO);
复制代码
4 w) E, x! f/ ]% Q

0 F0 R# ?; P6 V      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用" [3 f3 t7 y. v0 u$ {
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
0 J( x7 K5 T# E2 r3 W5 O; i     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。1 v# {- \# _/ P6 d" w" f

& n7 I4 ^" X( m  X
$ ?3 }$ r/ V7 i% ~" U' \
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-15 21:32 , Processed in 0.048417 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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