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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 0 w- E, {1 `! n8 @$ d
  1. [code]EDMA sample test application2 D: l! Z4 R# g9 y% x0 \
  2. /*
    # P/ ?' i7 {( Z& y, z1 k& {0 G$ T
  3. * edma_test.c% q  _1 A- |& T  u
  4. *
    & u: x. y3 T0 _; `
  5. * brief  EDMA3 Test Application
    9 e" ?2 T( Z. ?. h
  6. *
    6 e* j' a: ^/ w5 J+ H& _' M
  7. *   This file contains EDMA3 Test code.
    1 x( j( F" R6 e: F2 Z
  8. *
    , l, b' z- s+ x$ d
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE) H; T  R: P7 P" S: b
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT" W4 w1 z/ t4 a0 C
  11. *         TO CHANGE.5 W) Z; Y& F+ E9 U  L! h
  12. *1 t) G# Z' K% s7 L; ?3 N
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/* w: D" }  {7 S5 N( D
  14. *$ D5 }) Q, ~; P
  15. * This program is free software; you can redistribute it and/or. O/ T6 m7 q3 X2 L5 _* d6 A
  16. * modify it under the terms of the GNU General Public License as
    # J$ I. R- G3 {* `7 E5 c
  17. * published by the Free Software Foundation version 2.$ ?% K$ Z; v. s) _
  18. *4 i- D( T- `; y" @- [" B3 A! E4 v
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    7 r9 ?/ c1 @: S
  20. * kind, whether express or implied; without even the implied warranty
    ' C9 ~, r7 @/ D" N
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    9 @% I( Q& Y4 I- g+ s7 _8 ]
  22. * GNU General Public License for more details.( E( m* E: M: X) \: j
  23. */) @% \$ I$ O3 w. t) u. \

  24. 0 }1 N1 Q1 D8 s. \/ @- a/ v! i
  25. #include <linux/module.h>! S$ n7 j6 b( Y/ j: O% \( h  r+ K
  26. #include <linux/init.h>% m+ u; a: p/ `% A" e5 b' [' ~
  27. #include <linux/errno.h>
    ) p  a( }- [1 D& K9 L) _/ k
  28. #include <linux/types.h>
    ; q6 z7 p0 k7 @! b7 |: C
  29. #include <linux/interrupt.h>
    2 G: [" O" F+ |, W0 u
  30. #include <asm/io.h>2 s8 x' p4 ^9 W" Y9 P5 ~! S
  31. #include <linux/moduleparam.h>
    0 s+ w; t& D8 j
  32. #include <linux/sysctl.h>" E6 I  V7 H  I/ F
  33. #include <linux/mm.h>7 Q+ h9 h  g( {5 N) C0 s3 _
  34. #include <linux/dma-mapping.h>
    7 x* S/ p# C2 M+ y% g' w

  35. # a. L( B5 ^( X
  36. #include <mach/memory.h>; n; A) k; y3 h) N
  37. #include <mach/hardware.h>
    1 Z& |# R5 p; G. r/ x/ e
  38. #include <mach/irqs.h>
    2 Q1 o6 Z& t/ j6 n
  39. #include <asm/hardware/edma.h>
    3 o* r% r/ V( S) w  ]3 }/ n

  40. 6 o5 ^$ M; `# @
  41. #undef EDMA3_DEBUG
    4 a5 C& J1 G( }* `) `
  42. /*#define EDMA3_DEBUG*/8 s+ k8 n9 O  m$ L/ e
  43. 1 `# C+ k( u4 U2 h# Q2 @
  44. #ifdef EDMA3_DEBUG# G& A2 b0 j8 ~2 B: v; s% d
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    9 ?' H% \7 y! @; A: y0 H+ W7 x6 T
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)1 N8 p, }% D2 A
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    . K- m: J, J5 ~
  48. #else
    & w$ Y' L' q& M! G+ i
  49. #define DMA_PRINTK( x... )7 _, k. o: \$ l, J" j+ H
  50. #define DMA_FN_IN" I! q4 t" ?% T
  51. #define DMA_FN_OUT$ e# F8 V+ G$ y$ S
  52. #endif
    6 n7 Q+ n+ x+ y1 z2 u& z; P0 B* H
  53. 3 M: \% k3 }+ B7 ?( v# [8 K$ h
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    6 t% {+ ?" X! @, u( C
  55. #define STATIC_SHIFT                3
    9 P& C# {4 \; H& k- D+ f
  56. #define TCINTEN_SHIFT               20) p8 w  p" y% u% L+ s, `  h
  57. #define ITCINTEN_SHIFT              21$ _3 y7 u% V8 g9 m# F
  58. #define TCCHEN_SHIFT                22/ r; z  l3 P2 z
  59. #define ITCCHEN_SHIFT               23/ b: A' m! c" f6 x
  60. 2 j( m: S6 M6 b8 h  d! y9 v3 x
  61. static volatile int irqraised1 = 0;
    7 i2 ?; N  I1 H5 }* ?
  62. static volatile int irqraised2 = 0;
    % q' T7 x' a/ p( l

  63. 5 e5 n% _9 d% P  S
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 ?% y- r! Z2 [9 k  e
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, c; x2 o) q. {; }
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . M* T1 I: o4 w* L

  67. - v- z$ E$ j$ L
  68. dma_addr_t dmaphyssrc1 = 0;
    ! F0 |" i% ]* L, P) K
  69. dma_addr_t dmaphyssrc2 = 0;
    7 {9 h0 t5 J' m5 d
  70. dma_addr_t dmaphysdest1 = 0;
    ( t( k' ?! p  w# ^; |$ j8 D: s- ]
  71. dma_addr_t dmaphysdest2 = 0;
    0 [2 g: A, T" _
  72. ! Y$ w6 X! R6 z+ j: Z
  73. char *dmabufsrc1 = NULL;6 o& Q" |* A" G
  74. char *dmabufsrc2 = NULL;6 ~( |6 [0 A0 Q8 r" x) C
  75. char *dmabufdest1 = NULL;
    + M. h& `! c5 k
  76. char *dmabufdest2 = NULL;- X+ L, V' F! u
  77. 9 `* `. R% Z9 W1 G" f
  78. static int acnt = 512;
    $ Y/ N) t8 D/ U7 V* x& }3 L/ S
  79. static int bcnt = 8;8 ~! X# K  h; _, D( p. j
  80. static int ccnt = 8;/ E8 G6 T; T8 ^0 V, n! [
  81. 5 n2 l, X. \2 W( G
  82. module_param(acnt, int, S_IRUGO);* n1 ?1 {$ \7 U: m
  83. module_param(bcnt, int, S_IRUGO);
    % o, _  g" ~+ x5 J$ a4 O: X+ O
  84. module_param(ccnt, int, S_IRUGO);
复制代码
2 j4 N, D3 O: A- t7 o" n- k" p+ }
  w2 @$ r# t1 h; q& r* s
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用" d8 p* n) m6 Y, ^' [( V
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
; t3 P1 f* A6 Z     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
! I3 V5 z8 a. w8 X
; c7 U- I+ p  V2 Y" M0 w$ E9 w0 s" Y' L7 J( A/ V
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-8-15 16:27 , Processed in 0.041078 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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