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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
9 T) q6 ?& M0 u7 g" X$ D" R- k
  1. [code]EDMA sample test application1 X; s" s' ]5 \) m
  2. /*1 v- p) \8 k' {. k
  3. * edma_test.c
    # L5 A6 Z. Z8 U" \
  4. *
    % l7 V5 h( i8 @) M, b% C/ o
  5. * brief  EDMA3 Test Application: T: P' y3 j3 K1 s# J- m. ^# x6 W2 p" a
  6. *
    2 k, t8 l4 c. F
  7. *   This file contains EDMA3 Test code.
    2 A7 e: p9 n! C5 a4 N. a
  8. *! i# [! j! x8 z, G8 K$ @/ \, a
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    9 Y/ a! c0 S' {) z% f. j
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT* z2 b2 f0 o6 c0 H6 d$ I
  11. *         TO CHANGE.
    + d0 j- @. Z% e4 T/ f
  12. *
    ; V( ]7 O! ^: W- Q8 l% D' K
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ! @2 T' l# r; N2 W, ?) q
  14. *9 R" i6 x; y3 T( X! H7 U
  15. * This program is free software; you can redistribute it and/or
    2 [: f3 R5 D+ q5 v0 ?
  16. * modify it under the terms of the GNU General Public License as- g" U; N- s+ `  @
  17. * published by the Free Software Foundation version 2.! H: A8 c, \. X
  18. *0 U1 E) u- A. w
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    # p6 i, H4 H7 s3 P& ?! ]
  20. * kind, whether express or implied; without even the implied warranty
    # A8 q7 ~& h: w5 ~- C7 M
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the% j! C8 ^. u  R3 T% j5 \% A
  22. * GNU General Public License for more details.
    ( d$ _- @% E8 o  Z7 U1 f* n9 K4 X+ m
  23. */8 z- H( X# t  A3 J. x3 ~

  24. ' R2 g- p/ H- o2 A, x: p) ]3 x
  25. #include <linux/module.h>
    ! Y; s) x: N- E8 H- ~: |) M
  26. #include <linux/init.h>1 K$ L8 S3 r1 u( _# M
  27. #include <linux/errno.h>
    + `3 q5 `& v% C  F; {( B: j+ o
  28. #include <linux/types.h>
    % K5 e9 ?1 h, [3 y: M* u
  29. #include <linux/interrupt.h>
    6 Y* ~/ Z& r# f8 G1 s; ?0 Q
  30. #include <asm/io.h>3 ~" M6 r6 T4 F& b! }
  31. #include <linux/moduleparam.h>
    7 W6 K1 L" x  ^3 z$ y# [! q! `
  32. #include <linux/sysctl.h>
    1 W# k) x5 e$ {& |, b
  33. #include <linux/mm.h>6 Q" Y. N: |/ C4 {
  34. #include <linux/dma-mapping.h>5 n# \% t" y5 A% u$ a

  35. 7 Q! Y! x1 n6 E8 [
  36. #include <mach/memory.h>
    " J% a' C9 C# {' Z9 J/ n
  37. #include <mach/hardware.h>
    + B) C  ?% ^" O/ S9 v1 [
  38. #include <mach/irqs.h>
    ( ~& L* f  h: V
  39. #include <asm/hardware/edma.h>
    % K5 |- e: ]6 ?# l3 J+ V
  40. ' H  @! F' y+ Z/ ~! a& r
  41. #undef EDMA3_DEBUG
    ( `% G" t! q% U5 y+ U$ d0 V3 V2 j
  42. /*#define EDMA3_DEBUG*/
    . d, t- [+ \4 R2 D  W
  43. ! P- G" i! A' `9 F5 k) c$ c7 m$ R
  44. #ifdef EDMA3_DEBUG
    * A( U5 q5 A( I( d# h% s
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ' r# c1 _* Y, A4 ]: T" R! Q
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ' G+ m" |$ S$ q4 v8 _
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    3 [' L* _8 M0 q0 i
  48. #else5 @9 J" z7 `6 `6 Z1 d
  49. #define DMA_PRINTK( x... ); q( v$ x2 i0 G+ z8 m8 U4 Z1 z
  50. #define DMA_FN_IN
    + j+ J( o, B! W' d% [6 u/ K& m& f
  51. #define DMA_FN_OUT
    % f! `7 C. B2 T/ u# a2 u
  52. #endif9 P- \5 X7 |; z# \# Q

  53. $ p: q$ O, W2 o8 i) ~0 {2 e
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    1 r: D9 o  E  {
  55. #define STATIC_SHIFT                3
    8 U  o" Q# K  |& S
  56. #define TCINTEN_SHIFT               206 l$ B: ^7 L# f
  57. #define ITCINTEN_SHIFT              210 f, \+ x  B1 D4 r" n5 e7 w9 z' r: K& _
  58. #define TCCHEN_SHIFT                225 t/ i' t2 ?) [  V' C7 _7 P) A
  59. #define ITCCHEN_SHIFT               23: V( x) T  C! `2 L

  60. & v! M5 Z9 Z; U" d5 I
  61. static volatile int irqraised1 = 0;
    ! }, M- j0 k- c
  62. static volatile int irqraised2 = 0;9 n9 g" w2 `1 V  L* j

  63. & Q, A) J' O- H' J( a) D
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" R! s$ s" P* J
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* j# T+ Y/ R2 r# K
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 A9 c0 E8 z8 x5 E
  67. / P/ N  L7 [; ~4 ?; ^
  68. dma_addr_t dmaphyssrc1 = 0;
      Q6 S9 h9 V! D! r# b
  69. dma_addr_t dmaphyssrc2 = 0;
    9 Z( w( m! p, r7 U( N
  70. dma_addr_t dmaphysdest1 = 0;
    ; k* }; B* x) Q! }) z' f& T! q
  71. dma_addr_t dmaphysdest2 = 0;
    6 S7 N* l! `+ l. }/ h

  72. 3 F/ }5 o; z0 A+ d9 @: K& h# J
  73. char *dmabufsrc1 = NULL;7 ]2 s; s) R  ]! U* ?9 z2 W
  74. char *dmabufsrc2 = NULL;
    4 B& c2 G. L8 n6 E8 [
  75. char *dmabufdest1 = NULL;! r1 n7 O* B/ A( a
  76. char *dmabufdest2 = NULL;3 e" e+ P2 v2 O+ G, [* b- H

  77. & C: V# r/ t, Y
  78. static int acnt = 512;' K) u5 k) {2 Y5 z5 @2 {
  79. static int bcnt = 8;2 h. _" N# H- D8 i& l# f% V) ~! d
  80. static int ccnt = 8;
    1 {4 p; G( g9 {4 V& P$ s1 K" B
  81. 3 W, y. s; }$ q3 q5 c0 l8 G  R) G' s
  82. module_param(acnt, int, S_IRUGO);
    0 O- B& Q, {& G
  83. module_param(bcnt, int, S_IRUGO);
    5 a0 s+ q* t. B6 M/ ^; u6 A) p
  84. module_param(ccnt, int, S_IRUGO);
复制代码

. Q" z; Z) g. ]% D9 q0 y& ~& o) C: C+ m$ T* @( x$ s
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用& W. f) ?0 Z, T, C# `, |
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。  ]: ?& S0 _, i
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。- i$ X( }2 Y9 w- A' `4 z* [5 J+ J
6 v/ E* J$ j3 V8 e6 \# D( Y  y
, T2 [6 X1 d6 y6 C& l
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-10 17:28 , Processed in 0.048898 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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