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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
4 v8 E: X' q1 d: c/ X
  1. [code]EDMA sample test application
    5 n6 N3 d/ t( _, d6 ~0 z6 ^0 C; K
  2. /*- }9 V$ |4 Y& S: X/ M' k
  3. * edma_test.c4 p- s& `9 g' w- L: r% b
  4. *
      P: D! h1 N6 y
  5. * brief  EDMA3 Test Application. Q, X( `- ~" x' d5 r
  6. *
    5 i7 R9 M( E# k
  7. *   This file contains EDMA3 Test code.
    ) D: l5 v' t& ]! ?" d9 h
  8. *
    8 R  K9 H9 R( e  e6 a- G0 R
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    , H, E) O5 X; B5 t2 |( }
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT, X, N; B# q7 y$ ^$ m2 z
  11. *         TO CHANGE.4 K" F! E9 k) W5 |4 {: |
  12. *
    % c8 W5 a& L  Y; C% H5 R
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/7 I4 ^0 g" Q% q4 l
  14. *
    ( K. y0 J9 C: |/ [
  15. * This program is free software; you can redistribute it and/or  {- d, Q( K" w& b9 H
  16. * modify it under the terms of the GNU General Public License as
    ) P6 c( _9 [& A. U2 ?8 Q+ ]
  17. * published by the Free Software Foundation version 2.
    0 K% }5 S# g1 A4 j
  18. *
    & N, Z* g5 ?  _8 Q  z
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any) J0 \* \" Y7 I. I6 Y  I# g
  20. * kind, whether express or implied; without even the implied warranty/ u6 f7 P: \5 v5 b& c
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the) |9 p' c7 t6 s4 o$ @; D
  22. * GNU General Public License for more details.+ _# A# O5 Q6 G5 u$ m- d
  23. */
    ! v7 N! `' h( D- T& M

  24. $ @- O  s& }1 o3 w+ ^+ d' u) |; E- ]6 y
  25. #include <linux/module.h>+ q! K. d8 p, a+ \; J
  26. #include <linux/init.h>2 n( d9 b! R5 w6 }* i3 w& }
  27. #include <linux/errno.h>
    4 M, B! y+ u( C6 J
  28. #include <linux/types.h>
    / B8 d9 U7 v! H; C
  29. #include <linux/interrupt.h>  N6 D# @. P" [( ~  h4 p
  30. #include <asm/io.h>
    3 i, A& J! ^8 ^5 O) G) F
  31. #include <linux/moduleparam.h>- j, ?& H, n% z
  32. #include <linux/sysctl.h>
    * M5 |# J, ]1 t. f% d) [# K
  33. #include <linux/mm.h>4 r' A( |- [6 n% o
  34. #include <linux/dma-mapping.h>
    / d, Q; }; v2 s* ?$ }
  35. 1 O6 ?; g* u7 @7 d
  36. #include <mach/memory.h>$ G1 t( W  g4 t
  37. #include <mach/hardware.h>
    3 m3 s- ?' p2 j, F. Q
  38. #include <mach/irqs.h>
    + \' w$ E" `0 C1 o
  39. #include <asm/hardware/edma.h>
    8 M% [1 ?/ S6 C  x+ g% X8 B

  40. ! Z$ S0 F; V% M& V1 q
  41. #undef EDMA3_DEBUG: `1 P# S; j" @
  42. /*#define EDMA3_DEBUG*/
    $ F9 i2 K1 O! l  |0 t) {
  43. . [9 G9 L6 c! {7 T; U) R( C0 }
  44. #ifdef EDMA3_DEBUG) {# ]. `; Z3 e  D; w8 D' v
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    4 t0 U! |8 U6 m
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ; V. D* }% ]2 j8 @% j
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)6 ^, L" B, \# ]1 m+ H
  48. #else4 I1 _5 g* ^' N: x# M
  49. #define DMA_PRINTK( x... )/ {. o7 U5 w& e6 H+ `! w2 d
  50. #define DMA_FN_IN) t* b. {0 x$ S/ O5 d
  51. #define DMA_FN_OUT3 N5 t( ^: P3 b2 E  U
  52. #endif
    7 g* ^* s/ _6 K0 g  _
  53. # h5 M6 [7 K! I2 T1 M8 B
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    7 T* t, x: l: c. J
  55. #define STATIC_SHIFT                31 `) ?6 p* [7 a) t/ k  H
  56. #define TCINTEN_SHIFT               20
    ! Y* V7 a% v+ D* R/ e1 L& C& R
  57. #define ITCINTEN_SHIFT              218 S* d  S" N8 e% Y
  58. #define TCCHEN_SHIFT                22
    3 y' z, k+ |4 o/ ]8 \2 l
  59. #define ITCCHEN_SHIFT               23
    : D: G. _* U' ^$ B! e$ S
  60. 5 ^, v2 ^/ G/ A
  61. static volatile int irqraised1 = 0;
    2 u. D$ W; ^+ u/ }' J
  62. static volatile int irqraised2 = 0;% Y; Q2 O: n1 g
  63. : t: L* X: Q8 h% z3 Q
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ E7 `- ?+ W( x  Z$ u5 M: C5 f# H
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : H1 y) V  U& L: o5 y
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ `/ x! G; U4 w& F1 ]+ c$ O9 x

  67. / D! T, m; B' T1 J( G9 z6 ?
  68. dma_addr_t dmaphyssrc1 = 0;; `: i; ]0 w/ d3 e; F' Z$ G# \
  69. dma_addr_t dmaphyssrc2 = 0;
    , j6 u/ L3 f  r1 O
  70. dma_addr_t dmaphysdest1 = 0;
    % b2 K$ g; l9 G, y' e" d- m& Z
  71. dma_addr_t dmaphysdest2 = 0;5 I. ^4 i! a' Z/ d# \  U  P
  72. ) d1 P& \" H0 L; u) t
  73. char *dmabufsrc1 = NULL;
    8 a! f- H2 r& v& j1 e1 z% p
  74. char *dmabufsrc2 = NULL;
    " F; U# P# @5 [3 l8 y. o$ G
  75. char *dmabufdest1 = NULL;, q* y* c- k: ]/ ]: ^6 Y3 [" a
  76. char *dmabufdest2 = NULL;
    % L( M- j* B4 `& H1 h
  77. 1 U8 n' a1 y4 l0 ^  h
  78. static int acnt = 512;
    , W- B/ h) U4 k3 E$ m6 @
  79. static int bcnt = 8;
    6 ~5 |5 d  t( w0 U& v9 {$ O
  80. static int ccnt = 8;9 Y6 l8 D, B( x$ O! L' Z3 g

  81. * Q5 i. `+ v8 N" Z* B
  82. module_param(acnt, int, S_IRUGO);
    2 h7 e+ p3 Z) S3 g! K$ j3 U" C
  83. module_param(bcnt, int, S_IRUGO);
    2 j  y2 e; i+ A/ U( U) g
  84. module_param(ccnt, int, S_IRUGO);
复制代码

* O7 C2 H/ u: D5 ?9 J
7 \& @% u0 N3 w6 w: r' U' p      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
5 g& M+ u, S& h: H7 {9 S0 B/ Rarm-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 [" @( `) E' M/ g0 `- s; {     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。. F* r/ E. q) L' ^: l. w: c- [8 E8 n

, _0 g) u& ~' x) X9 M: h9 b5 T+ k! z5 [* |" h+ z' ]9 e
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-29 11:44 , Processed in 0.047347 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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