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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 & m: V: s, Z. w+ r8 V
  1. [code]EDMA sample test application
    : K$ [$ w) K, q# ?! `2 q# C3 _
  2. /*
      x/ t5 d; j6 H$ S0 X
  3. * edma_test.c) J" n2 A, u2 V
  4. *0 b: F. u+ i' N3 {, {
  5. * brief  EDMA3 Test Application
    2 w9 }6 @9 y' s- j
  6. *
    8 L3 L9 X: V3 k) ]( p2 z# Q
  7. *   This file contains EDMA3 Test code.
    - e  R" \9 Y' l3 b+ O
  8. *4 e! J% z5 q% g1 p3 t$ `
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
      ]) u, {, H9 w- H
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ( r+ j" T3 e1 A: E( o7 Q) I- }! ?
  11. *         TO CHANGE.2 h% f! M/ a; l) t% S7 R
  12. *9 E  ~. R% a4 ]5 Z
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    8 j# f# g; |9 w+ u" r# Y( e
  14. *
    " w. f4 [! c* a
  15. * This program is free software; you can redistribute it and/or: I2 k; f! T# J0 U; x. n6 e
  16. * modify it under the terms of the GNU General Public License as8 H6 X5 e6 A+ \, l% |
  17. * published by the Free Software Foundation version 2.
    6 Y6 e7 n' M+ c1 a- W$ r' i
  18. *
    " Q' k8 f2 H7 c. }
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any. N/ d% H0 Y4 R
  20. * kind, whether express or implied; without even the implied warranty
    5 I- a5 z, g) i  p3 @* o5 z
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    $ v& d  L2 Z9 A9 @
  22. * GNU General Public License for more details., X- r4 @$ ^1 o  m- g
  23. */
    5 ^5 I. K  u6 c2 b8 A
  24. ; H, i+ h- m4 v  R+ E8 h4 r
  25. #include <linux/module.h>
    2 @* I! b) _& @: ?
  26. #include <linux/init.h>  ^# g$ k8 z3 W# }+ y; f
  27. #include <linux/errno.h>
    3 O0 |! k3 F8 F* q; m+ @7 r1 e! s3 P
  28. #include <linux/types.h>
    ' U+ V/ p# }+ M
  29. #include <linux/interrupt.h>% x1 Q: G1 G/ D  j: j
  30. #include <asm/io.h>
    2 \5 ?& q# `! `1 s( `# n8 I. H
  31. #include <linux/moduleparam.h>7 w/ [' s- h8 v) R
  32. #include <linux/sysctl.h>! G( ]1 `3 w! I5 v6 U
  33. #include <linux/mm.h>5 [: t' g# l" Z. H6 D$ l
  34. #include <linux/dma-mapping.h>
    * j) ~& R: |' G/ ~
  35. 4 x) K. g2 v, S3 u$ g
  36. #include <mach/memory.h>
    4 L" z% A' }1 A* i+ `# F
  37. #include <mach/hardware.h>
    & L- G, H: c  D4 T
  38. #include <mach/irqs.h>8 K  M7 B& h4 y' U5 v1 a
  39. #include <asm/hardware/edma.h># V3 u4 c4 P2 ~3 t& H3 o
  40. ( X$ S: E! N1 q) a2 U
  41. #undef EDMA3_DEBUG4 M+ N$ _5 R! u& q9 O* P. t4 ^
  42. /*#define EDMA3_DEBUG*/% G9 h9 ^9 Y6 y

  43. 6 X$ y0 P: ?  ~
  44. #ifdef EDMA3_DEBUG& R# @& a/ K& E& G
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ' }+ p. w8 R+ E2 p, r
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ! {" h& X2 g8 H, d! t
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    / @2 y4 T  g" U# D; S4 x
  48. #else
    & w+ `0 X) Q/ z. e# W4 N1 x
  49. #define DMA_PRINTK( x... )
    % L( w. [7 m4 }9 g/ X# |& _8 l
  50. #define DMA_FN_IN2 a9 c4 M. P5 T4 x
  51. #define DMA_FN_OUT
    ( P+ }& {2 e; ]" j
  52. #endif
    / Q. q2 o. Y; q/ M# @4 ]

  53. 3 y( c! c. P' }/ }9 f
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ) ~8 u5 R" K7 }" T
  55. #define STATIC_SHIFT                3
    % X$ L* t4 F9 _$ O
  56. #define TCINTEN_SHIFT               20
    " E9 M% j7 o3 q3 p  s
  57. #define ITCINTEN_SHIFT              21( w8 N  W; ^/ G4 Y
  58. #define TCCHEN_SHIFT                22
    ! {/ W) n  l6 K3 h. V7 ?
  59. #define ITCCHEN_SHIFT               23
    3 V8 Y& P4 _) `) V' ], R0 e' h1 b% [, Z

  60. : P  R5 U) S+ @0 p- z4 G9 ]
  61. static volatile int irqraised1 = 0;# R1 {4 p1 t; m) P  i
  62. static volatile int irqraised2 = 0;
    " Q7 n( X  K# @- V+ @  }: v( b
  63. 3 e0 L$ _/ l- q3 k: E
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' V) e1 N7 Q( q4 ]! \5 Y
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* b: D  T7 l% C7 s2 l
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) P8 [5 Z  y: i% d1 O* B& w% F
  67. 6 ?$ o+ f% Y; j* e' {  g
  68. dma_addr_t dmaphyssrc1 = 0;4 U" k8 M, Q$ j0 |3 r9 ]& z
  69. dma_addr_t dmaphyssrc2 = 0;' F; j: c. O2 y3 K9 V; K1 `
  70. dma_addr_t dmaphysdest1 = 0;
    5 R% S: r; j0 {+ v: q4 W/ [1 ^
  71. dma_addr_t dmaphysdest2 = 0;
    . u$ k# Y2 ^3 U4 K( [

  72. 5 u2 a8 w/ h% o( p' D* W. j
  73. char *dmabufsrc1 = NULL;
    & @; g0 }0 P2 K% J- n
  74. char *dmabufsrc2 = NULL;
    0 k# J/ C, e" P3 L) {0 F0 ^
  75. char *dmabufdest1 = NULL;
    , m0 t- ]. ]/ R7 _0 l/ |+ d
  76. char *dmabufdest2 = NULL;
    " H5 a9 p6 O2 `/ P' r) ^2 T

  77. : E3 N( _, |! A, d! f: W
  78. static int acnt = 512;0 p- h3 r. N# [  R0 n. E, }9 R& m
  79. static int bcnt = 8;
    1 l+ F( ^4 {6 Z# w  p& K) X  h! j
  80. static int ccnt = 8;
    7 o4 d8 H9 s0 g6 x2 }

  81. + P! O: ^+ j& I
  82. module_param(acnt, int, S_IRUGO);7 K3 y7 K% z7 R+ j; h# c
  83. module_param(bcnt, int, S_IRUGO);
    4 @# v1 b2 K' i- C9 L6 i
  84. module_param(ccnt, int, S_IRUGO);
复制代码

1 ]) [( B6 U2 V2 G( M. K: R1 O: Q8 v! E$ W* k/ D
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
- l1 E8 F: D1 [% Harm-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 ~9 }% |+ D1 ^4 J. v9 b$ }
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
6 E8 s3 k; f1 t# q
4 q' W% ~, Z  m) |* ]/ g  ^) a
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-10-21 17:50 , Processed in 0.038544 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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