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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 # B! F/ {* I* O  A0 G
  1. [code]EDMA sample test application3 X3 I6 c6 m; N2 R
  2. /*3 q4 ^) [7 R0 \$ U6 d8 W6 c  M
  3. * edma_test.c
    ( f8 Y. F) ^! {2 Q2 V2 H5 [
  4. *
    2 b8 n! K7 G7 ]
  5. * brief  EDMA3 Test Application2 A' R' K' m* p' r9 M, ~$ ~
  6. *' B, J. Z' S* _% g
  7. *   This file contains EDMA3 Test code.
    6 b% t" U) e2 p0 r2 c* t
  8. *) S3 j3 b2 A5 Z% M3 w8 e5 F/ l
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ; }) F+ A' F  D( {
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    / s3 C/ V8 K. k, G
  11. *         TO CHANGE.3 O/ o7 c  O4 |0 L0 {0 i$ d! K+ [5 D
  12. *" o2 _4 n* I- p6 C( o% L1 m% u
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/& ^8 {4 I* S2 c" m9 s* k1 C6 C* z
  14. *1 @3 n# {) {# {1 m7 K0 T
  15. * This program is free software; you can redistribute it and/or
    , ~6 r" W% [, y. M' r0 W6 M+ E3 s! L
  16. * modify it under the terms of the GNU General Public License as
    + u9 M( j0 k- L* Y, Q8 l
  17. * published by the Free Software Foundation version 2.& ~# _$ ]! |& K$ L7 o3 S3 O" `" e
  18. *
    2 }! e+ P& [% l, U5 N/ g
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any  _3 k9 I6 d1 {  {  ^
  20. * kind, whether express or implied; without even the implied warranty' k' j! q4 e2 q! N/ Q, R& e5 i
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the& n& I% w/ G  x! K. `
  22. * GNU General Public License for more details.6 {1 I3 l0 z# R  b  s) b0 q
  23. */
    ) V% L( G& r/ A: d$ z6 j
  24. 1 E3 P6 x9 n, ^
  25. #include <linux/module.h>
    - p7 `! k& @7 s  m* A7 _& T
  26. #include <linux/init.h>
    & S* p; i3 ]0 O% j
  27. #include <linux/errno.h>( L4 `* _4 R6 \+ r7 N
  28. #include <linux/types.h>  ~  l) r( [3 D& [2 l
  29. #include <linux/interrupt.h>' j8 H+ W8 w. Z  y8 W# V# H
  30. #include <asm/io.h>
    % B4 k0 b0 S' h4 u
  31. #include <linux/moduleparam.h>& _# a! v5 m5 @, k- A. ]' Z
  32. #include <linux/sysctl.h>& G1 g& y9 k8 N4 S; C4 j% f4 S/ d+ D
  33. #include <linux/mm.h>
    + _! U. Y1 s' |
  34. #include <linux/dma-mapping.h>* k; F5 K: |+ v* i( K( v; y3 T
  35. # b1 U* G& F; L% o/ L
  36. #include <mach/memory.h>
    , R( r* ~7 R! n0 i0 s% ]7 R1 Q& ?5 V
  37. #include <mach/hardware.h>5 r3 J+ @* I3 f5 Y1 P
  38. #include <mach/irqs.h>
    & m( s9 X6 ~8 i( I: t
  39. #include <asm/hardware/edma.h>
    , g+ s; E5 q& p+ |# o! p( q

  40. ) V; q- W) S& M
  41. #undef EDMA3_DEBUG
    3 t! a4 i+ _& T- F- S: A4 d4 k
  42. /*#define EDMA3_DEBUG*/. a1 g# E" Z# ^5 |1 y9 }' z
  43. * A* P  j  z- T' {8 f
  44. #ifdef EDMA3_DEBUG
    , G* v- C6 G, Q( h
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    " n5 \3 u' P. ]5 p! M1 x
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)' Q  P2 |/ W+ |3 a
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    & @3 B+ _- w" ~) [% H2 h
  48. #else/ W) m( Z$ l0 a& `7 J
  49. #define DMA_PRINTK( x... )
      c8 Z( }- P% J, b5 j
  50. #define DMA_FN_IN8 P- Q& y7 L" l2 D
  51. #define DMA_FN_OUT
    : O3 R7 h% `/ T/ r; H2 A& _1 m
  52. #endif0 H2 Y* g1 ^) k

  53. : n7 d% a. ~3 s# Z3 e
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ! V2 p5 R* p4 V8 m0 J% a
  55. #define STATIC_SHIFT                3/ h+ ~' Q3 n! e# `
  56. #define TCINTEN_SHIFT               20
    6 {/ u; d$ o) H7 w0 M2 b
  57. #define ITCINTEN_SHIFT              21
    ( B3 R7 d7 x3 q' R9 q
  58. #define TCCHEN_SHIFT                22
    / K% Z+ f! K: G0 m
  59. #define ITCCHEN_SHIFT               231 D: _  v6 x. M- u6 m6 t( y) Y

  60.   S7 k4 c% p% j- {! G/ G# ?
  61. static volatile int irqraised1 = 0;
    3 c0 D, z* p3 p2 L5 d
  62. static volatile int irqraised2 = 0;7 R# w  H. [& ]1 g. ~
  63. 8 R' g- z: M% T  H& K
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" |( j3 l! q5 p9 u/ ]" Y  n
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ n- z. X9 b8 \' r
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 \. Q9 f* z1 n. i

  67. ) c8 ~7 N- R/ i6 N, J3 A! v- N% ^
  68. dma_addr_t dmaphyssrc1 = 0;
    * k) ]7 e9 e4 i' ^% l
  69. dma_addr_t dmaphyssrc2 = 0;
    ( c1 L& y3 m* G7 [( F
  70. dma_addr_t dmaphysdest1 = 0;
    - N- d/ z$ W# u* b& h
  71. dma_addr_t dmaphysdest2 = 0;/ q8 L, F8 w3 |4 [
  72. * l; E0 U; A1 C' _; `& s$ o# {
  73. char *dmabufsrc1 = NULL;
    + s& r" s* i, [5 @8 s3 y4 K% x9 m
  74. char *dmabufsrc2 = NULL;( k- D( q) P5 p9 k: z" f( w
  75. char *dmabufdest1 = NULL;
    5 c6 m" a7 e+ Q7 Y% J
  76. char *dmabufdest2 = NULL;
    5 S& s! n' S5 K7 d$ t3 B
  77. 9 x9 s+ }- A: }7 d# {
  78. static int acnt = 512;6 n! ^& p- P9 ?  K* V# Z' H
  79. static int bcnt = 8;
    5 J4 g; U- E- B" p0 p
  80. static int ccnt = 8;
    8 V9 C8 V: N9 W$ c
  81. $ ]% d+ G* q* }" l
  82. module_param(acnt, int, S_IRUGO);8 y+ \" P' b) R6 w
  83. module_param(bcnt, int, S_IRUGO);! u; [3 {' A6 K
  84. module_param(ccnt, int, S_IRUGO);
复制代码

% K3 e, Y- j1 Z2 `$ B- \
3 l; I$ |9 R# n$ s' ^* W5 R      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用/ H( l, _& q2 D4 Q% W! J6 }. J7 `
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。- Y' ~) s  ]& d9 O
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
# t9 L3 Z7 M; z" J; e4 R0 l6 T9 T! x. Z

- N( z- g- l! c& H+ d; b. i* A
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-10-22 00:27 , Processed in 0.042239 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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