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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
% G% O0 Q, S+ f& y" i1 P
  1. [code]EDMA sample test application
    " Y2 t* R; Q, z1 f# w+ z* a
  2. /*
    ) H& @4 g9 t& c" ]8 j& T2 l# d
  3. * edma_test.c8 S, q" J/ U" a+ H
  4. *% v/ W% f! s9 u  O0 N& \+ q& U
  5. * brief  EDMA3 Test Application: {1 `) G( Z4 }, Q# Y# `
  6. *. {% z2 M2 L8 N- K; ~  U, y
  7. *   This file contains EDMA3 Test code.
    # S/ ^1 p9 L: F  u5 e$ e! G
  8. *' i8 C4 \; E6 [; P  c
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ( }+ c6 Y: z' G' E( U1 Y; T* }) U8 F' A
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT% i8 v3 E/ }( x% a4 H
  11. *         TO CHANGE.
    : V7 G; w* L  m7 i3 D; P. q6 K
  12. *4 {6 n. r/ K+ N+ G, A
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ' i2 _! M8 {$ d  Q( ]
  14. *
    + O" G; r6 m7 m0 Z- `, @0 [  g
  15. * This program is free software; you can redistribute it and/or
    - l4 w. M6 g% W; H" P; v" ]$ m! y( R
  16. * modify it under the terms of the GNU General Public License as3 P* V) H5 H& e- t+ L6 m) F
  17. * published by the Free Software Foundation version 2.5 N  G+ Z* s7 K3 Z2 i
  18. *
    / m: M/ J! \( y9 F
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any! v4 ?- j1 V3 M8 G) R; [
  20. * kind, whether express or implied; without even the implied warranty
    * N- A$ \8 v# t% v1 w$ q: B
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the8 c, @  t9 Z) f! ^( E: e" |$ K% ^
  22. * GNU General Public License for more details.
    . A3 T; W+ r" H$ i0 c
  23. */
    . p9 |7 P- f. |2 |
  24. ' l" a6 ?1 f$ b) m# F
  25. #include <linux/module.h>
    ! o/ x( Y! e7 N/ L2 j  Y
  26. #include <linux/init.h>
    6 U7 w  a9 `& H& b3 \/ t1 I) u% r
  27. #include <linux/errno.h>
    ( p- ~7 o' g0 _" g2 L+ T5 m
  28. #include <linux/types.h>8 V8 j6 S. _/ K1 l) N" D1 Y
  29. #include <linux/interrupt.h>
    / |. x' N" t  ]# x
  30. #include <asm/io.h>5 d5 I' v# A: ^( |
  31. #include <linux/moduleparam.h>
    9 O* a9 p! \/ H
  32. #include <linux/sysctl.h>
      U. x! R7 N5 \/ J
  33. #include <linux/mm.h>8 L) J  G( }( h; N% f  C5 _1 q
  34. #include <linux/dma-mapping.h>
    3 ~  k: z3 @% }! |. H

  35. 0 K# J1 ?/ @) E
  36. #include <mach/memory.h>
    6 f& x1 `- B# {$ A9 g( i! `) _
  37. #include <mach/hardware.h>$ a, }! x2 |7 h3 t) c
  38. #include <mach/irqs.h>( k' G+ ^5 G. M# i. V
  39. #include <asm/hardware/edma.h>; Y4 R; E, W; O) e" ]

  40. 8 t8 Q& t( w; Y3 ~+ d& N
  41. #undef EDMA3_DEBUG; t0 N+ k9 O4 m9 P" ^% Y
  42. /*#define EDMA3_DEBUG*/4 y3 F' f: g) ?# K' _5 Y
  43. - h) ^# z; S0 O3 W
  44. #ifdef EDMA3_DEBUG
    3 e8 e1 V4 k: D- J
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    0 x2 W! t( d% T7 I) |
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)" f# c; z  A6 I  [9 O. F* y" T0 v
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    1 L8 t: z- ?# o. \4 l
  48. #else$ i% c4 b% [2 U+ ]6 t
  49. #define DMA_PRINTK( x... )1 [( P9 R# G  S0 }9 X5 }& A2 T
  50. #define DMA_FN_IN
    : ?) P5 R8 a* g. b
  51. #define DMA_FN_OUT
    1 B+ Y& v. z+ Y6 E  \4 M
  52. #endif$ g) l. C6 r% y( |
  53. 2 x( s6 ?" z9 [' O- g2 @8 m" w
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    9 w* P1 F1 \* m! \5 T+ ]1 l' b
  55. #define STATIC_SHIFT                3% S1 W: r0 V! d1 D2 u
  56. #define TCINTEN_SHIFT               205 w$ G4 r* s: k2 _. y$ s$ e
  57. #define ITCINTEN_SHIFT              21
    6 Q9 o1 a1 D. W3 R3 K
  58. #define TCCHEN_SHIFT                226 y. K, t8 b3 O& `5 U8 S
  59. #define ITCCHEN_SHIFT               23
    4 U& [4 N+ x/ v& V
  60. * _* B; q: g# }, L, _
  61. static volatile int irqraised1 = 0;
      k- B( q# V9 f. w3 m
  62. static volatile int irqraised2 = 0;
    % o) U7 p* Z4 x" S. F0 k1 `3 f# G

  63. 1 k6 h  S3 A' q( m1 d
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 B: a9 M  g: B! P
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ S+ h6 Z6 O. W* O- |
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ @  |+ B! c; a+ o/ ~' X. ?+ g# u

  67. * q: z2 l2 p6 ~
  68. dma_addr_t dmaphyssrc1 = 0;& R' T( [0 a) D8 r% a. x2 b
  69. dma_addr_t dmaphyssrc2 = 0;
    $ Y7 W) U; {) D3 P; Z
  70. dma_addr_t dmaphysdest1 = 0;- I7 P$ O% {0 L5 r- }2 \- Y1 v" @0 d
  71. dma_addr_t dmaphysdest2 = 0;, l% ^; w0 V2 M, y

  72. 5 m! S* F: K. i' O3 o; S
  73. char *dmabufsrc1 = NULL;- K; i, ?5 A' C* j  b& E2 m
  74. char *dmabufsrc2 = NULL;
    $ Q9 q0 z" h! b$ ?& p
  75. char *dmabufdest1 = NULL;; A; b# E( U, ^) ~' G- G  R
  76. char *dmabufdest2 = NULL;
    - P3 G. _. \7 T* I, J0 S# ~
  77.   z4 k9 Z; a" T1 [
  78. static int acnt = 512;
    9 `, i. T& m* Q' R9 T  D1 s9 s
  79. static int bcnt = 8;  ~2 H3 F1 X" M; t# M
  80. static int ccnt = 8;) v' S2 M4 C  d2 B

  81. / `. {# j3 I- F' p
  82. module_param(acnt, int, S_IRUGO);
    / r0 d5 B! K2 |) ]
  83. module_param(bcnt, int, S_IRUGO);
    % M" s3 L8 j! _# b& ?/ e+ w
  84. module_param(ccnt, int, S_IRUGO);
复制代码

5 U* t$ [9 h/ r' H
- m7 D9 ~+ }( L1 I$ k      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
% N- Z4 {3 e. R/ G) r& ~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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。% w( ]' _* k! p3 o, ?& H( V( D+ z) u
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。# X5 L5 k$ ~+ `4 n/ {

9 |* k: ^! S) A; j# V( r' y2 ^* P; N- _6 O
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-16 12:57 , Processed in 0.039998 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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