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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
% p! l. n/ _+ E1 ]% Q9 ~
  1. [code]EDMA sample test application2 U. t  X# P8 ^$ Z! L$ |
  2. /*# D- S/ W- m' \7 F
  3. * edma_test.c
    / W' Q* O8 v. ?  Q$ ~% V- F
  4. *. C6 R; A) M% }2 q
  5. * brief  EDMA3 Test Application
    4 C6 H! O, N( d! \" z# K
  6. *
    7 L, r# G! W; f+ Q3 u2 S; ?
  7. *   This file contains EDMA3 Test code.
    1 l# U# a, q  n, J! `2 ]1 u
  8. *; l7 r8 {1 B* ]$ J7 B* k1 W
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    - W% G' j8 O, g
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    2 @1 Z8 |: h  O) k6 t& P
  11. *         TO CHANGE.
    : y' f/ e5 X4 r$ W9 `) o. Z8 ?
  12. *
    5 q4 C1 M4 t- _" R3 v0 J0 }; f5 P
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/% C  H7 ]) d1 i2 w  i
  14. *  K) p( o. u0 }# B; ]2 p+ E8 b! ^
  15. * This program is free software; you can redistribute it and/or6 ^6 J( j# X% O4 a) |
  16. * modify it under the terms of the GNU General Public License as
    ( P: V* ^  V$ i- b: }' `( ?' X1 I
  17. * published by the Free Software Foundation version 2.
    2 j3 t0 V. j" `9 N' ?
  18. *
    3 N# t3 w/ s2 H2 C8 }
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any4 D/ g: O( c; D1 `. w: U7 `
  20. * kind, whether express or implied; without even the implied warranty: |' q% B! `" o
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      Y1 G7 I" Z" @, y% }% W
  22. * GNU General Public License for more details.+ h& h1 L6 f# [
  23. */9 s( x, d* i- D: J2 f
  24.   r* G/ t, B9 u* p) F; S
  25. #include <linux/module.h>+ I1 L" c; o5 K% K
  26. #include <linux/init.h>6 G- Q; M. g" r8 h/ s
  27. #include <linux/errno.h>  E' F0 g/ u7 a, C
  28. #include <linux/types.h>
    8 z' s) C8 [& |
  29. #include <linux/interrupt.h>
    + o: W' K# d! U. P4 c
  30. #include <asm/io.h>$ \' n  @, s# r0 Q: x4 F$ o
  31. #include <linux/moduleparam.h>8 b. {* V3 @1 _( Z; q  A3 P
  32. #include <linux/sysctl.h>
    , V+ y2 Z+ S, h0 N
  33. #include <linux/mm.h>% s0 e; U, o6 Q) X1 v7 P
  34. #include <linux/dma-mapping.h>
    ! L1 \+ S4 ^+ t) @

  35. # L: J/ N: M# I& w1 _2 Y
  36. #include <mach/memory.h>2 _9 e% R# D% O2 ^# |7 V3 d
  37. #include <mach/hardware.h>
    : v! D% L) S# \
  38. #include <mach/irqs.h>
    0 k3 x6 u; R3 i# j
  39. #include <asm/hardware/edma.h>5 q# {# Y7 S+ {

  40. " R1 b1 z, N1 I6 ?# u/ v
  41. #undef EDMA3_DEBUG
    1 j( L2 M0 @4 y6 F0 T$ r
  42. /*#define EDMA3_DEBUG*/7 ]7 S1 V6 m" [( ^4 l) D
  43. 9 V9 Y6 ]7 K1 h4 w  i) o& U
  44. #ifdef EDMA3_DEBUG
    8 N% C  ]* ], K: d
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    , n* S: X5 F( f; D% K: @
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)9 Z6 J' Y0 a" A
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    - B. K2 s) D5 c
  48. #else
    8 J5 `" h; P* F5 O) `: W8 Q
  49. #define DMA_PRINTK( x... )
    / P  q. E# v8 \+ [  H2 `
  50. #define DMA_FN_IN8 w5 c* ]5 x6 v! w) f9 T
  51. #define DMA_FN_OUT
    4 B/ o8 P+ x7 z4 v! [- u) w
  52. #endif3 y* V) R2 d8 I. \
  53. 0 x4 E1 ]0 f2 ^. U
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)( n: U; X+ S# d* X6 G2 F  z
  55. #define STATIC_SHIFT                3
    * T& ^( B% Y# p/ ?( {- ]
  56. #define TCINTEN_SHIFT               20
    0 M( t0 `7 O. X; z' J: t1 X
  57. #define ITCINTEN_SHIFT              21! t( D6 j) V# }$ h
  58. #define TCCHEN_SHIFT                227 w' w1 z, n& f6 ~3 E- ^9 q' h; Y
  59. #define ITCCHEN_SHIFT               23
    6 B9 j4 C- j3 g9 s( r2 ~
  60. # _- z2 B# R) n' X' W. p
  61. static volatile int irqraised1 = 0;
    3 r! Q2 V+ J( b( D( [
  62. static volatile int irqraised2 = 0;. Z9 p; ], a) r) ?9 j% d, p6 l

  63. , i% H) L1 B3 j! ], d: _
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  K$ `0 w; H/ V) y* [9 u6 F
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 `% G' C# M5 G, ]/ b2 j: H4 G- D- _
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 q7 [$ X7 s2 E* A
  67. * \& b2 O) n8 q% {% Y; y
  68. dma_addr_t dmaphyssrc1 = 0;! ]' ^- k  u0 O) [# |0 R2 g+ E- [
  69. dma_addr_t dmaphyssrc2 = 0;
    9 M. e  e6 _$ L/ T# l+ P! i
  70. dma_addr_t dmaphysdest1 = 0;- `$ c' r& g2 Y, v1 U
  71. dma_addr_t dmaphysdest2 = 0;
    & i( u. \6 |7 z- r

  72. + H! C# |" y$ t
  73. char *dmabufsrc1 = NULL;
    ' f; N( y0 y2 o; o
  74. char *dmabufsrc2 = NULL;
    . q0 \. F$ R5 E% G
  75. char *dmabufdest1 = NULL;
    7 ~9 Y! B* F3 H
  76. char *dmabufdest2 = NULL;7 O8 H# d4 G- x3 v: ?' h) N
  77. # y5 G  I- z% e! h, ]9 z5 V
  78. static int acnt = 512;9 t+ [1 |! D1 n8 P) b6 ?  S
  79. static int bcnt = 8;1 W4 |  t/ R2 `& L/ F4 S3 x
  80. static int ccnt = 8;
    4 @' S4 A' k5 l

  81. 8 F$ g) P. ~: ]. X. J
  82. module_param(acnt, int, S_IRUGO);
    : f- e# B: }7 s- @: |7 @
  83. module_param(bcnt, int, S_IRUGO);5 |  S( F7 d, z$ P0 r6 k3 u
  84. module_param(ccnt, int, S_IRUGO);
复制代码
& f, R3 F% d( G4 L0 ?
( I+ m9 f3 `* K& q( q8 \/ O' H
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
! V2 _1 k; _" h) o. R9 t! {* e& \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 s: v$ L$ @3 S
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
+ B/ r/ m$ _2 a# O. y8 y
* V  z; z% ^9 r4 A( V5 f% p; P- ^% r" H+ \' s, U
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-1-5 15:59 , Processed in 0.038288 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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