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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
( {3 j3 x* }# s3 G; c& x- @  L0 N
  1. [code]EDMA sample test application! r: P9 S9 n# G& {/ v# y
  2. /*' s4 F$ j: ~; z/ r2 m
  3. * edma_test.c. P/ V3 d7 C6 ?4 p0 C
  4. *
    2 }) H* Y  |4 ~+ w1 Q+ E2 t* u
  5. * brief  EDMA3 Test Application& v; f# ?  ?$ j, V8 @2 N
  6. *4 S6 a1 i" `) S. t6 G& B9 Y  e
  7. *   This file contains EDMA3 Test code.5 ]- O$ A' F. P* m
  8. *
    + ~5 P3 ~% e1 ^& ]9 v/ u
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE6 J2 w' ?* U1 R( g/ u4 I7 J# n
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    9 b) {- f8 x3 f* O  O$ b
  11. *         TO CHANGE." C3 u! e% P5 d9 i0 E
  12. *% ~: a* E, r4 L5 d- g6 ?  g
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ) f- ?. x0 e+ T( _" l1 f. Z
  14. *
    0 a: x# G5 K% Y) J8 l9 W5 o- x
  15. * This program is free software; you can redistribute it and/or
    $ |* x4 ^- `9 f, o
  16. * modify it under the terms of the GNU General Public License as
    9 {- b" O% M: X; [- h( p8 O- j" w6 K
  17. * published by the Free Software Foundation version 2.
    : f# {$ {- i+ l
  18. *3 V1 A% X; U8 i4 U. L
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any, k8 N" Z4 Y- ~& C" v* w
  20. * kind, whether express or implied; without even the implied warranty( d3 q3 ?, {1 V& T/ x& d
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the$ d4 k' w, D. |$ T- @. B' M
  22. * GNU General Public License for more details.
    ' }: U& `$ j. T6 {7 b7 W$ h5 f
  23. */) _! \) ^& [1 M9 p6 ?, G/ Z

  24. $ Z5 d9 `* \: m( t8 c9 x
  25. #include <linux/module.h>
    3 E& T# g: O2 L( [; w+ x/ G
  26. #include <linux/init.h>
    & y5 L3 @4 h; B1 v7 v0 P! L
  27. #include <linux/errno.h>. I) h) h+ M  \7 V9 |3 F+ H! i: n
  28. #include <linux/types.h>
    % q2 Z0 d. D: ]3 v  S: W( u
  29. #include <linux/interrupt.h>& k' }9 {2 s8 d8 q0 B
  30. #include <asm/io.h>$ O$ a. }1 Q1 C! ^9 B% c( }4 Z
  31. #include <linux/moduleparam.h>6 @/ e4 |4 A! ^% N2 Q) Y' M! ?
  32. #include <linux/sysctl.h>
    , `: x2 O. Y% n% ?6 T
  33. #include <linux/mm.h>
    7 z0 w. h4 _2 `: ~1 N4 w
  34. #include <linux/dma-mapping.h>
    - h  z8 P" w7 t" B4 T/ W2 H
  35. ( G/ n% r1 i3 H& H5 F
  36. #include <mach/memory.h>
    5 h+ c, K4 ~. W8 x; Y
  37. #include <mach/hardware.h>
    / t( a4 c4 ]& W- G# Z
  38. #include <mach/irqs.h>
    . E# i9 z' K) a. d. L5 A; c
  39. #include <asm/hardware/edma.h>! M+ K6 c3 ^3 b" f2 y4 C
  40. % h$ S+ {9 V! U2 q2 E
  41. #undef EDMA3_DEBUG
    - c! g2 ?# Q- Y5 M9 b" V5 N) e
  42. /*#define EDMA3_DEBUG*/
    , F5 g# d( K! e5 Z0 w% f1 N/ y: P
  43. ) T2 d# }2 Q6 f1 z$ t# q- M# A
  44. #ifdef EDMA3_DEBUG# U" D, `; a8 b  a2 w" P' v4 C5 h
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)3 P- h: D# a( ?! ^7 u- p$ y$ N( F
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    6 A) O6 L" Y7 W' F/ p5 y
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    3 z+ ~! I0 Y5 u5 u3 ]
  48. #else
      |; J3 e6 |& H$ \6 [1 ?7 G
  49. #define DMA_PRINTK( x... )
    : l- E0 U0 n! M2 {. c0 X' J; w; d9 A
  50. #define DMA_FN_IN
    + `% a! U0 E7 V  `  q
  51. #define DMA_FN_OUT
    1 K- B* V) l0 o% X' H) P0 L7 r3 G
  52. #endif
    + ~( r9 W7 s2 t5 s0 {) _' f
  53. . D$ e: f' |$ c/ a$ M
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    . B- `& p, n0 |4 D6 R, u
  55. #define STATIC_SHIFT                3
    $ @& [5 o- X" R. M! x8 c
  56. #define TCINTEN_SHIFT               207 ^+ X" H+ d, G6 j; T$ }
  57. #define ITCINTEN_SHIFT              21
    2 u3 u/ d) a6 E2 D# B' |2 W. M9 `0 Y* b
  58. #define TCCHEN_SHIFT                22- o. A1 w0 f- z. i7 Y; S
  59. #define ITCCHEN_SHIFT               23# `' S: |0 e$ x' w4 Y

  60. % O/ k+ k! T  G2 B3 U1 ^; a1 v
  61. static volatile int irqraised1 = 0;
    ) A4 n! [. a0 `) v8 V
  62. static volatile int irqraised2 = 0;
    1 e: B% |0 x6 T+ h/ K9 c

  63. " H6 ?1 G9 ]; _2 _
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / a- a( x3 w$ M$ k+ X' B
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : B9 Q- M& Y, Z+ J9 D
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! z# v! z% d3 m9 Y9 `, l

  67. # m9 C! d! V8 k, l9 ]/ q
  68. dma_addr_t dmaphyssrc1 = 0;
    5 B/ E4 {7 ?  x( e0 o7 I
  69. dma_addr_t dmaphyssrc2 = 0;: k  X; c4 e  g) i
  70. dma_addr_t dmaphysdest1 = 0;
    * K" {7 h+ S7 @( \
  71. dma_addr_t dmaphysdest2 = 0;% s; j& Y" b5 Z1 B4 L& g  U& D4 k
  72. % j: C2 {7 ^/ A8 R
  73. char *dmabufsrc1 = NULL;
    7 t9 m) c1 K" M" x* u
  74. char *dmabufsrc2 = NULL;
    . p0 h- U8 f5 t1 y9 w
  75. char *dmabufdest1 = NULL;
    5 z' P/ q9 [  Y$ D& w
  76. char *dmabufdest2 = NULL;
    5 u0 k7 g' t  P- ]
  77. 1 v4 e8 i8 o) _% b& J
  78. static int acnt = 512;) a. M5 U- r8 _9 e# g
  79. static int bcnt = 8;
    % h$ J5 d# t) M5 o- V9 L5 l
  80. static int ccnt = 8;+ d. j) s2 n) F& f5 n3 }
  81. 8 \! m* z0 w- T" k( L
  82. module_param(acnt, int, S_IRUGO);
    ; _& Z. V8 v- b( D( U# n
  83. module_param(bcnt, int, S_IRUGO);
    , j! d9 L) U& b6 X2 P5 u, h  v
  84. module_param(ccnt, int, S_IRUGO);
复制代码

/ y! I5 |" U/ L: `2 P& j# F
$ d* q: K6 x3 z; e) ?      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
) Y# e6 ^) L$ Aarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
4 H% \8 H: v5 _& u' f" J# P% d     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。; k# u6 K9 y# f8 k
# u" G! F# \1 {2 R
; T5 w: K- M5 r4 \  w7 T
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-19 11:18 , Processed in 0.044051 second(s), 27 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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