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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 5 Q+ m& L1 R- m
  1. [code]EDMA sample test application1 }# t) o# p8 ~' H9 P1 ~
  2. /*
    ( a) X0 A3 g+ O4 B
  3. * edma_test.c. T9 q6 R2 q. d% S9 e
  4. *
    8 K+ n4 t) h: y! C9 _6 B
  5. * brief  EDMA3 Test Application9 D# |* g5 o$ e& C0 g* ?
  6. */ D' f( r7 F7 _* h
  7. *   This file contains EDMA3 Test code.
    % p6 t2 i. Y0 O: x0 }$ l$ t
  8. *
    , }5 D3 `& B' J7 y, e
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    - B6 x8 f9 e4 p& c( C
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT+ k. M- X" `3 l( B
  11. *         TO CHANGE.
    9 q, C- k+ \* v: G; V+ Z, x
  12. *
    7 z+ ?0 y+ D3 H  Z8 i
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    6 l( u6 }/ c4 P
  14. *! D6 U  g0 @6 R- e) g2 u
  15. * This program is free software; you can redistribute it and/or
    " t, Y- k& ~# z( A# x
  16. * modify it under the terms of the GNU General Public License as/ x0 d% d5 _  Y4 P5 k! P) x
  17. * published by the Free Software Foundation version 2.* }& x* z# z4 k
  18. *5 L# h! B% v2 s& O3 P
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any. j+ k; z; w! Z5 L* i0 V  b
  20. * kind, whether express or implied; without even the implied warranty
    0 S) q+ |# R9 t* K$ Z
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the5 O2 y  y* \0 T
  22. * GNU General Public License for more details.
    6 B- P2 [, J. d8 m4 H
  23. */
    6 ]8 N1 N9 Q2 X6 w& R  U$ g% S

  24. - U& t" O, f4 j' |, R# q  G9 Q
  25. #include <linux/module.h>
    1 B9 S" T2 `- z% ?# M, c( m) ?" [
  26. #include <linux/init.h>2 t% G: l1 k) ]1 @$ Z$ \
  27. #include <linux/errno.h>3 R, r' L$ h! g3 {( P9 d* J
  28. #include <linux/types.h>
    : r+ ]+ K1 @+ n$ m
  29. #include <linux/interrupt.h>* o0 k/ e1 ~$ n4 i- a4 l6 `
  30. #include <asm/io.h>
    7 x4 t. [2 ~" K" @/ J: W) ~2 I
  31. #include <linux/moduleparam.h>' V6 j/ H$ |- F1 P/ g4 h0 K
  32. #include <linux/sysctl.h>
    0 E8 s1 R; K! N: _5 ^8 U
  33. #include <linux/mm.h>
    $ F# i' `% |: ?" u1 t* A6 l+ s6 j" B
  34. #include <linux/dma-mapping.h>5 I/ O" [3 z. S) [
  35. / d; Y( V8 Z4 _+ S4 w
  36. #include <mach/memory.h>
    5 ]1 n% s( y+ \* {' x6 t' z
  37. #include <mach/hardware.h>
    4 G$ V& E- I+ K2 V9 V
  38. #include <mach/irqs.h>
    . A+ ]* q1 j; M) ^0 [
  39. #include <asm/hardware/edma.h>
    2 ]; B1 \8 l: a$ e: z$ \! X, {

  40. + Y& U' }( I- [. q0 Y! {: S2 h" o- X
  41. #undef EDMA3_DEBUG
    . f  J- {- }) H, c
  42. /*#define EDMA3_DEBUG*/
    5 ], `2 Z% R) j; \
  43. 4 g6 ]& ]+ _# \
  44. #ifdef EDMA3_DEBUG& W' U+ J  i- @
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS): O) s9 b( Z4 w5 V9 R% W
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)1 u- L/ g+ [7 d' H6 Q- ^$ V  Z
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    8 {  ^2 W( _- D/ b9 ]0 c
  48. #else
    # U. a$ S% o; _" N4 C0 Z7 z
  49. #define DMA_PRINTK( x... )
    $ j- v1 _2 q9 ]* d; g. F, C9 B
  50. #define DMA_FN_IN& V4 u1 e* B- b6 T( ~
  51. #define DMA_FN_OUT( \, ~! U0 ?' Q
  52. #endif6 J8 o, z0 k: Z. l2 W$ j8 m

  53. 5 g. `/ o: L, T9 `0 C7 H3 h/ P
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    - _4 ~% M# X- a4 m" f9 x( }
  55. #define STATIC_SHIFT                3
    7 p+ g5 ^* c  H- e  b5 ~
  56. #define TCINTEN_SHIFT               20) R" f/ n  R- b5 q4 Q
  57. #define ITCINTEN_SHIFT              21
    2 H/ R- W6 |9 y$ V# T- j, _
  58. #define TCCHEN_SHIFT                22
    * a8 B+ q. {( `
  59. #define ITCCHEN_SHIFT               23
    # Q. l8 S0 c3 v! T2 c. V0 v6 }& W

  60. 9 l* @- Z8 }( l2 H& `* |
  61. static volatile int irqraised1 = 0;
    5 {+ S% v6 i: a+ p# Z% E
  62. static volatile int irqraised2 = 0;
    , M# x% h8 ?$ N) d6 |& k
  63. 7 L5 e) s3 A; |" M& L; M# r
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . V2 a6 T% `3 s$ r  k
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* S, x* E& L. M/ N0 _; m
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% f$ k7 L! u8 {0 \
  67. * D/ a# w  v1 K: l+ j+ x6 w
  68. dma_addr_t dmaphyssrc1 = 0;
    1 d) J6 |/ e: s  s0 r6 }! ]$ H
  69. dma_addr_t dmaphyssrc2 = 0;8 s% v) y3 ^4 X$ q
  70. dma_addr_t dmaphysdest1 = 0;3 z" c4 D1 q! D3 X1 j9 q" L
  71. dma_addr_t dmaphysdest2 = 0;
    3 e. Z; |3 Z) J6 _7 a

  72. . ]7 S0 A' C: g* R
  73. char *dmabufsrc1 = NULL;  T4 d, D; Y" x* Z" }( S
  74. char *dmabufsrc2 = NULL;
    3 H. V. Y5 e, b  g
  75. char *dmabufdest1 = NULL;4 V; _: _; z+ w3 \, c( g6 Y: L
  76. char *dmabufdest2 = NULL;
    ) n" W0 p& c6 n1 @4 q

  77. 3 U0 S) H, q/ d+ U+ ^& b
  78. static int acnt = 512;/ k% ]) n+ x, }6 t$ @
  79. static int bcnt = 8;, j: _7 \" C( z% J
  80. static int ccnt = 8;/ U" n2 ~: h: A+ D1 M4 B$ J
  81. 7 x& Z) n3 w& |: z# ^
  82. module_param(acnt, int, S_IRUGO);  g# O( i1 _" j  i  s5 \
  83. module_param(bcnt, int, S_IRUGO);
    . I6 U) T3 Q- i' @$ G% o
  84. module_param(ccnt, int, S_IRUGO);
复制代码
% n, n3 ~% ^# V7 A# x
7 @& d& B# E  `( {  b
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
5 L; E' z% ]1 r2 F5 zarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。* h8 W( e1 h# ]: d# _
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。* @" q( }$ }& D8 {: x6 N
& ~5 _+ a, h8 o- Y; t% U
# O; J0 D2 A8 V) _7 J6 _
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-28 23:40 , Processed in 0.040068 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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