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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 1 K% i# c; b" C% ~
  1. [code]EDMA sample test application
    5 [4 N" d9 V0 L8 @/ q
  2. /*
    - R/ n4 I8 T* Q6 ~' l
  3. * edma_test.c
    ! \6 B0 b7 w  T+ T# w% `3 s0 }
  4. *
    9 `& X- f2 G" a+ @: A2 e" X
  5. * brief  EDMA3 Test Application5 ~! G0 J' g; |
  6. *7 E- `5 l/ z: k' P
  7. *   This file contains EDMA3 Test code.7 x1 S) p' O, Q7 l: H/ i
  8. *
    % L* _0 y, D7 _/ I
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ! c, g7 w+ E' A9 p3 @3 s9 _1 K
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    6 B; c0 \  y! |
  11. *         TO CHANGE.
    4 v8 u. B5 s% V
  12. *0 u; Q! x" v9 c, z$ X
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    # |0 e% p# d: f' h# G
  14. ** `7 }( d& g5 q
  15. * This program is free software; you can redistribute it and/or
    . ]0 C0 \2 z! N. a  [  D6 _3 l3 W6 ]
  16. * modify it under the terms of the GNU General Public License as
    - B6 f3 }0 V9 A7 ~& y' t
  17. * published by the Free Software Foundation version 2.% T7 b# M) F% @+ W5 Z' i6 W- `
  18. *
    ! n; f7 N4 B" w; Z8 i3 g0 ~3 V
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    , z" m; b4 v: J, z
  20. * kind, whether express or implied; without even the implied warranty* a+ v4 A+ d2 |- e% N0 U
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the' W! I8 d- [  B+ L' n, e9 S- {
  22. * GNU General Public License for more details.4 W  F) [; J5 a& `. d/ o/ |9 F
  23. */
    7 X! W% H, ?6 D

  24. . ?9 n3 f* q# {: ^
  25. #include <linux/module.h>. x, B, A' G7 W
  26. #include <linux/init.h>4 |* B$ V( X) @& h
  27. #include <linux/errno.h>
    2 ^7 |" a& g( a4 k
  28. #include <linux/types.h>
    3 U: u: z6 ^0 t5 H
  29. #include <linux/interrupt.h>
      u# o8 H- I8 e9 \  o) U
  30. #include <asm/io.h>
    % S$ \5 Q$ ^% O" l; u* R. X  b
  31. #include <linux/moduleparam.h>
    4 U+ L6 u8 K' Z% R
  32. #include <linux/sysctl.h># `1 u( p  y  u3 E  ^( ~
  33. #include <linux/mm.h>& j( _$ Y0 W- P8 t/ b4 ~
  34. #include <linux/dma-mapping.h>+ M% j: I) H( h4 k. z

  35. $ K3 y3 Z$ m' d+ o% a6 {
  36. #include <mach/memory.h>1 k0 v1 \9 k& P6 w$ x5 C; n$ }
  37. #include <mach/hardware.h>$ ]/ T) V  D5 V* p; b5 x  o
  38. #include <mach/irqs.h>
    1 }4 Y0 l4 f! l6 a1 K5 H+ f7 E
  39. #include <asm/hardware/edma.h>
    + H  j5 \' _- e+ A6 m& q4 m7 `: o5 `3 H

  40. ; j9 P6 W/ U- Q' \1 }, q7 x
  41. #undef EDMA3_DEBUG
    9 T% p. _3 V3 U5 t
  42. /*#define EDMA3_DEBUG*/8 \$ A0 O9 e% M, k5 W6 ~7 Y
  43. $ D. I4 \# D( Z9 {6 O2 V
  44. #ifdef EDMA3_DEBUG
    $ W, L3 G) q2 b& i6 q
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)6 W5 t* |: K# {/ F
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)' R* u% a  F9 M* h, m
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)4 o9 k  E0 t4 h
  48. #else
    : K4 W  D- L  ~' H2 ]5 f! d& |/ E
  49. #define DMA_PRINTK( x... ), O* p: ^  F9 K% @' ^" Q: k, [
  50. #define DMA_FN_IN
    ) X+ p, T9 Z6 k/ T
  51. #define DMA_FN_OUT
    7 u/ _7 m: S0 g8 R
  52. #endif$ M  J& E4 v; B6 [
  53. % f% K+ o1 }! k/ M( Z( c2 s5 m
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    0 a$ e: Y& V2 K4 q' t# a5 N
  55. #define STATIC_SHIFT                3+ [1 T# M2 A2 @8 }/ M1 A- d
  56. #define TCINTEN_SHIFT               20
    * ^- J# _( Y6 A3 t! j1 g
  57. #define ITCINTEN_SHIFT              21$ b8 j. ?1 I; d4 G  t
  58. #define TCCHEN_SHIFT                22( G, t6 a  d) F# L0 E
  59. #define ITCCHEN_SHIFT               23, D% J5 `" B6 Q7 d/ i: ?: D3 f
  60. 2 G1 K  V: i7 N# }: n; D
  61. static volatile int irqraised1 = 0;
    7 e2 \( F1 ~( U, v+ l
  62. static volatile int irqraised2 = 0;) l8 v4 q/ g( K6 ~  t0 o
  63. 5 @* P3 @, j( T1 B  ^0 \" l3 w. E
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* y$ ?) {* {& o& A# X6 _$ n
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" x  k+ q  m2 A: n& r; h
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% @% y- j5 _4 B9 t/ j: X

  67. ; I" F- l- x  p) V! I% p
  68. dma_addr_t dmaphyssrc1 = 0;) k4 L" Q. G& J% k, Y
  69. dma_addr_t dmaphyssrc2 = 0;
    # p8 b/ Q' t5 b) W
  70. dma_addr_t dmaphysdest1 = 0;
    4 v* y( Y2 v2 U) E' V
  71. dma_addr_t dmaphysdest2 = 0;4 f* |+ m9 a, t) m1 c4 Z! e4 I8 O

  72. : q% S, A. c! D; n( Y
  73. char *dmabufsrc1 = NULL;
    & X- r7 P) x2 H1 V; K" E
  74. char *dmabufsrc2 = NULL;
    ( f- }$ y1 T. y" p0 X
  75. char *dmabufdest1 = NULL;
      G: ~* p! v/ y  w
  76. char *dmabufdest2 = NULL;# P& ~8 _' I" F! ]; z% l  j

  77. : G& R( S8 A" r0 U
  78. static int acnt = 512;
    7 z# M: J  x3 w/ v
  79. static int bcnt = 8;; y# @/ {4 `- l# c
  80. static int ccnt = 8;
    9 {" s! q9 ~- R
  81. ; x: @" L/ p' [3 g: s5 i
  82. module_param(acnt, int, S_IRUGO);
    - ]4 ?9 {; G( d3 @! N+ a
  83. module_param(bcnt, int, S_IRUGO);
    + s8 `3 u* a0 k( R5 e' K  {% D$ K
  84. module_param(ccnt, int, S_IRUGO);
复制代码

5 m8 b, p# f5 S4 E1 [
/ B3 {$ v& o! a7 v4 A$ T      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用) s" R* p% W( g
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。( ?# `% Z& h  i% |$ U+ N" k
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。8 U$ j, I* j4 ~  L, Z& T( |6 |
8 P8 d, X7 b- t5 ?$ j0 \8 x

5 s1 B, s* Y- Y, n# G6 y
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-7 10:42 , Processed in 0.040597 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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