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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 , `: r. g9 c6 ]8 _8 Q1 g
  1. [code]EDMA sample test application4 R  q  v. x3 k" c2 }
  2. /*& o2 \3 q. I* \* n& ~, d
  3. * edma_test.c8 u8 d3 P3 r, P
  4. *
    * `2 ]8 t6 t4 g+ V' i0 |) a
  5. * brief  EDMA3 Test Application- {0 Y! @. N8 R% C, f) O& @
  6. *1 ^4 v7 B; U; m/ r
  7. *   This file contains EDMA3 Test code.
    * W: S1 T9 C" n5 q: m
  8. *$ z' v+ r; u+ d) t
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    % B/ w) ^7 _0 o
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ' i. I* u6 }+ J5 ^
  11. *         TO CHANGE.
    5 `: w! p( F3 R6 S3 {8 b. s
  12. *
      U) V4 b# p' k8 b; l
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    $ M8 E) w8 E. X& ^: k
  14. *
    : u. b, q. S! a* i( i- N
  15. * This program is free software; you can redistribute it and/or1 F/ H7 P- i( u$ r% O7 B
  16. * modify it under the terms of the GNU General Public License as
    & m. C: b! p: r5 d7 p; R, `
  17. * published by the Free Software Foundation version 2.
    * \+ c$ q3 d* P7 Y
  18. *
    2 R3 \4 I. t& z1 l/ X
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any5 t% N- E5 p- a
  20. * kind, whether express or implied; without even the implied warranty
    " S$ }2 C$ R7 }, b5 O1 Z+ Q
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the& \  z7 o+ R) `2 t, j! q! ~
  22. * GNU General Public License for more details.
    . q; S# Z, m% V. n  O
  23. */
    * K( s: P% g2 Q8 w+ f

  24. * I9 ^% z. Y- t& x- Q8 d* O7 T
  25. #include <linux/module.h>
    2 }) O! y: n) @8 H6 v1 p% ^+ r4 t
  26. #include <linux/init.h>5 q# b1 a! ]+ F9 |
  27. #include <linux/errno.h>% k; T# R& m7 Z) G5 Z9 w
  28. #include <linux/types.h>
    . r9 O$ i' y9 T( ]+ a3 A5 a
  29. #include <linux/interrupt.h>
    * t0 H; M/ q/ G3 q$ U$ i
  30. #include <asm/io.h>
    3 F1 c$ n+ H# S* {6 {  i4 i( G
  31. #include <linux/moduleparam.h>. t$ ]6 E& B2 T/ f' f- x; H
  32. #include <linux/sysctl.h>5 ~0 b- B6 P+ f6 z3 T
  33. #include <linux/mm.h>
    " A' \" g, m1 |/ o7 P* t
  34. #include <linux/dma-mapping.h>
    6 t, U- s3 F; B' m7 c( U: @
  35. $ q2 y* M! s' a  z2 e2 I- F
  36. #include <mach/memory.h>
    . y. B- |. V- l* x+ ^
  37. #include <mach/hardware.h>
    # R+ S& R% @* p- n; Y
  38. #include <mach/irqs.h>5 j1 h# e3 Q* d, B7 Z8 W* K( @
  39. #include <asm/hardware/edma.h>. C1 R. n; u1 h+ D  \* c+ t
  40. # m* s8 H8 s0 _/ m  Z+ b
  41. #undef EDMA3_DEBUG
    # T: D/ j1 u1 e2 I
  42. /*#define EDMA3_DEBUG*/- f  B+ i& f  G3 W/ g7 a$ p

  43. ( c  i" i. a! W- Q1 G" l2 E
  44. #ifdef EDMA3_DEBUG/ p, m; I  h* L! P1 X! @! {; Z
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    - I0 |1 V5 V% C! A) n5 K6 G
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)% K- \. W$ x/ s
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)* a5 {/ M# a- b1 v( }  }* f
  48. #else# {  ~& J9 n& u; M: J
  49. #define DMA_PRINTK( x... )* \- A4 O+ w1 G7 f. G# ]  j
  50. #define DMA_FN_IN
    ; p5 L* H% w, @8 k3 `7 l
  51. #define DMA_FN_OUT4 K! C+ {# V" m9 q8 L3 z
  52. #endif
    7 _1 q: r) l, F: C0 J
  53. 1 w( q9 x' k/ r6 T0 [  d; m
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    : r7 @. g9 S4 H) [9 v
  55. #define STATIC_SHIFT                3# W' M3 E& e- j* V
  56. #define TCINTEN_SHIFT               20$ S$ h5 ?4 g3 \
  57. #define ITCINTEN_SHIFT              21/ i6 w# F5 @& M! ]8 u. D
  58. #define TCCHEN_SHIFT                22' d1 l' E* ^! `8 Q! a
  59. #define ITCCHEN_SHIFT               230 d( C5 {2 F6 {, C

  60. * v3 R9 [  ?, [6 ?6 ?
  61. static volatile int irqraised1 = 0;
    5 E  ^* H9 [- f; \2 ]2 g- \
  62. static volatile int irqraised2 = 0;) c4 L  z# w5 ]2 |  U

  63. ! D; N& H' l, l. t+ F2 i/ S4 i
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : b( ^+ e  t5 `  Z7 s
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : f% ]8 T+ W. V
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, B! V7 O( v$ l: Y

  67. . v  C8 {+ J: g* ^' J2 V  d. U4 h
  68. dma_addr_t dmaphyssrc1 = 0;
    ; o* E' E& ~# C3 _
  69. dma_addr_t dmaphyssrc2 = 0;8 l2 L, u. y6 M% _% ]* B1 P
  70. dma_addr_t dmaphysdest1 = 0;- Z$ \: X* V3 T- l2 N2 a% O: R
  71. dma_addr_t dmaphysdest2 = 0;
    & u  u4 F% M; a; |* y! i
  72. ; z0 i0 y$ f3 _
  73. char *dmabufsrc1 = NULL;( R' I- ~) L' n2 S
  74. char *dmabufsrc2 = NULL;+ S1 V$ [- o9 ~% s- m( D7 ~2 b# w
  75. char *dmabufdest1 = NULL;. U" B# Z# _& N( E% J( ?
  76. char *dmabufdest2 = NULL;9 @4 z! I2 L& |8 h

  77. # @& x+ j8 e4 |0 x
  78. static int acnt = 512;
    . d6 Y5 l$ l$ s! c0 R: P0 z$ h
  79. static int bcnt = 8;4 |$ P8 b7 ]  n. Z
  80. static int ccnt = 8;' D" l- G7 R2 f6 C2 z: l( e; o- e' _4 I0 i

  81. " Q' h$ r' C  f
  82. module_param(acnt, int, S_IRUGO);. T4 A: v1 T; R. S- M9 `# `7 ^5 |
  83. module_param(bcnt, int, S_IRUGO);8 q8 y' y! C$ Y* o4 s* S
  84. module_param(ccnt, int, S_IRUGO);
复制代码
9 f. T3 k2 Y5 |" y1 w& Y* _5 g
7 G( J( G" W' W* T9 [+ E5 M- i
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
3 R+ F/ t* P8 p8 `4 z6 R9 a! d, Darm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
1 e# i7 g% D* Q) v1 l/ v" h     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
: `, h, r8 o4 t" Z8 h
( t6 `4 w# c6 t" }" ]' N2 d# e3 K9 r6 y  R8 `
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-15 02:18 , Processed in 0.038691 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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