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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 # y1 L! ]' q" c5 ?8 \8 T& w& X
  1. [code]EDMA sample test application/ V: A( ?6 [( C# w8 X
  2. /*, m6 H6 q4 L" b/ H% t! M; `+ r
  3. * edma_test.c& F  }7 c: R. ^4 K& p5 ~& O7 X6 A8 K/ B
  4. *
    - H2 {0 y4 r0 \5 T; J
  5. * brief  EDMA3 Test Application" @: @+ I9 T: H; L. [8 m; f
  6. *
    1 P" u3 W8 `4 y6 \( T7 b, ~
  7. *   This file contains EDMA3 Test code." W# g8 V; C9 ^' M  E' }, _3 m
  8. *
    - N- C! c1 X$ ~
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    5 @# w- f& |: A  @" c
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ! y9 o$ V. E( o9 t# y* R
  11. *         TO CHANGE.+ a. w% b' F8 u* Y  \
  12. *- x; O, E6 X4 ^6 A
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/1 ]% \. C0 z. v+ D
  14. *
    : ~" S; Z6 O& ?) b( n/ G3 R* t) w- C2 `
  15. * This program is free software; you can redistribute it and/or: M4 @- c9 v  Y4 Y8 h8 k3 O
  16. * modify it under the terms of the GNU General Public License as
    - c2 X& ^6 ^  l+ y! s9 Z
  17. * published by the Free Software Foundation version 2.  o+ L9 F8 R7 D) R& V
  18. *
    : {: ~9 R$ J/ p$ v* m" M3 [# d' o' K
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any' w( k: w+ h4 l- a6 O4 E" \
  20. * kind, whether express or implied; without even the implied warranty
    . h( K/ z% V8 T! {
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the* y+ F  ?* k' w+ u; a
  22. * GNU General Public License for more details.
    2 e0 o2 z6 E% W" k6 }0 J* s" }9 q
  23. */* F5 {; U9 D8 x/ r4 b1 S

  24. 3 R1 }) V2 j; b+ Z
  25. #include <linux/module.h>1 F' x4 ]. |/ c
  26. #include <linux/init.h>; H/ j+ S& }9 g% o: ^" D
  27. #include <linux/errno.h>. K) Y; ?4 W$ Q$ V  k
  28. #include <linux/types.h>
    7 M+ k5 [3 o! V7 p
  29. #include <linux/interrupt.h>
    7 J; S3 ?, z* F: q
  30. #include <asm/io.h>4 z/ c# T+ `% D1 I0 C# J
  31. #include <linux/moduleparam.h>
    6 L: K8 Y0 N, I% C( A- F. ]( Q
  32. #include <linux/sysctl.h>/ p6 ^% h; H, D( z- r
  33. #include <linux/mm.h>. ?) G7 [! K6 u# [7 C
  34. #include <linux/dma-mapping.h>
    8 w: r: T) D/ Y/ q* T

  35. ; t8 J: n; \0 T- I; K9 }
  36. #include <mach/memory.h>
    , `% J+ Z- g9 _! E5 R
  37. #include <mach/hardware.h>
    , F# H/ S5 c7 S4 K( @6 Q- D
  38. #include <mach/irqs.h>, r$ L7 V7 h" Y
  39. #include <asm/hardware/edma.h>+ O+ q# p1 b  [+ K
  40.   M$ P! i0 _& [- Z! P
  41. #undef EDMA3_DEBUG  W" G: T6 h4 g* V3 r$ u( x
  42. /*#define EDMA3_DEBUG*/2 N& t  d, \% ^1 p/ q
  43. 0 O% U% C/ Y! i
  44. #ifdef EDMA3_DEBUG
    ! u2 J- Z8 y" q5 ]
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    7 N. n2 W9 D  {
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)# A' g& O; m7 {0 `
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ( i: J9 v* [& N4 q  \
  48. #else
    " W( d( E/ Z8 [; |! N& B+ p
  49. #define DMA_PRINTK( x... )
    & h5 O8 z: P: h; h! _, Q% r3 ^5 v, T
  50. #define DMA_FN_IN1 A+ o5 Y* _$ ?7 t8 {  U8 A/ y
  51. #define DMA_FN_OUT( r; d3 I. ^% l  c; C7 p" F
  52. #endif
    , u* U: u' j; H- Y$ v% V7 z* R! P
  53. , r5 J6 J  j. h: ?6 \
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)+ b4 u% ^0 e; X5 u) q) }- t
  55. #define STATIC_SHIFT                3
    6 s9 X% I7 _5 L0 T0 V% h
  56. #define TCINTEN_SHIFT               20
    - b& _0 p7 \) S) X- L, Q# q
  57. #define ITCINTEN_SHIFT              21
    , C1 p# P0 q, M
  58. #define TCCHEN_SHIFT                222 }) r2 Q. G3 a7 s9 k
  59. #define ITCCHEN_SHIFT               23
    - s2 U! p4 ~$ D' Z! b4 g. f. G

  60. ; J' H' t" E( b( t
  61. static volatile int irqraised1 = 0;
    2 {2 I* U; U" [$ V% r4 A! t4 ~
  62. static volatile int irqraised2 = 0;
    . K& L) x0 u2 ?0 _# `

  63. + n- O" D$ O; F: V# z
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 J1 S  Z4 B4 Z0 ]0 O  Y
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  z) m5 a- H/ I" {. _) q/ i1 W
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 V  F, ~+ x9 [; I9 [
  67. 4 }  |; e  S- t! h" r
  68. dma_addr_t dmaphyssrc1 = 0;
    " u3 V  z3 G, y- I$ U# q
  69. dma_addr_t dmaphyssrc2 = 0;- K" _5 \6 G- I% K- p& c
  70. dma_addr_t dmaphysdest1 = 0;
    * I$ `. t  z- o5 B& s
  71. dma_addr_t dmaphysdest2 = 0;
    ! M: v3 w# h* S8 z

  72. 9 C5 {3 t9 k7 i4 k. O
  73. char *dmabufsrc1 = NULL;
    - }/ O# M0 O( Q& ~
  74. char *dmabufsrc2 = NULL;- i5 l& u: L* {  d# G' {$ b1 G
  75. char *dmabufdest1 = NULL;
    ( h9 \6 V7 s; m# U5 w
  76. char *dmabufdest2 = NULL;
    : u0 X! g& O" s/ g3 x* `4 e
  77. . h# l" D8 x6 c# O7 B3 R
  78. static int acnt = 512;9 L& n6 ^8 r: M0 l
  79. static int bcnt = 8;  c, e: X# k. @4 @
  80. static int ccnt = 8;
    5 E* k0 W3 {1 ^
  81. & H  \( y; D- y0 a
  82. module_param(acnt, int, S_IRUGO);
    9 b) j9 U4 U% o5 f; q! u
  83. module_param(bcnt, int, S_IRUGO);
    ) `* Y) s& d# C5 x' f" X
  84. module_param(ccnt, int, S_IRUGO);
复制代码

0 I- L1 ^9 |% K$ z1 K8 c' U6 e. K- p. G  B* `5 m% K! M
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用- [. g. `/ U: Q- 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
9 R! j+ V* z7 Q     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。/ w' _6 j* N4 S3 R& n; s( J. U
5 Y: Y! M) l1 X' ]/ Q
8 U& S- o/ G5 ^, x3 x- r2 M' g) U
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-14 00:50 , Processed in 0.069710 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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