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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 . j" W' J! {# o6 K" \6 [: S* n  u
  1. [code]EDMA sample test application
    8 j( y! {+ U4 O& f. ~
  2. /*
    : H- J  H3 q( D1 e( i
  3. * edma_test.c
    ; Y6 ^5 r: @4 G: A, |: D; [
  4. *5 X: l8 y1 @5 m) b) _2 a
  5. * brief  EDMA3 Test Application
    7 o# E0 I5 B% f, s% ?
  6. *
    , X, J' t1 V2 C+ f, E
  7. *   This file contains EDMA3 Test code.
    / X" m% D" L/ S2 u3 X* H0 U) x" ~
  8. *
    6 A' T5 e5 r, g. _
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE% @! l9 }  L, [# v# |" ?" |
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT' p% h7 O( [; j( m
  11. *         TO CHANGE.
    4 ]% C- G0 ~6 o
  12. *2 w& ]% i2 m: g
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/9 i% E5 [% I# j8 ]6 U* R: I; X+ k
  14. *
    : u6 s2 k# a4 V5 ~4 P  O3 s
  15. * This program is free software; you can redistribute it and/or( F6 E& r! m7 W% k1 \6 t2 {* p
  16. * modify it under the terms of the GNU General Public License as
    6 ~$ r; ~! B: Z9 Q8 ^
  17. * published by the Free Software Foundation version 2.3 n8 W' E+ w5 L2 C$ J; \  N% H
  18. *5 Y6 E  F% v5 P( N: C7 H* N
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    4 ~' B$ u- F1 T& x
  20. * kind, whether express or implied; without even the implied warranty  `7 a. m, S: r9 u. o. s% K# B
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the: O" F, C+ q  P$ x/ i/ |6 i
  22. * GNU General Public License for more details.8 [" x* z4 i% `' T( j2 C- I
  23. */% h4 _1 a& O( ~5 A, H

  24. - V. J$ s3 e5 o5 j$ Y
  25. #include <linux/module.h>9 o, q1 U3 l+ W9 E4 U' ]: P8 y3 T
  26. #include <linux/init.h>% B' L% B3 u5 \5 V2 C' D
  27. #include <linux/errno.h>  ^+ E. \1 ~7 ~2 J& l
  28. #include <linux/types.h>
    7 a3 h2 V! Q/ S0 g4 |3 E: H
  29. #include <linux/interrupt.h>
    6 ^( J9 J* P3 n
  30. #include <asm/io.h>
    " x. C8 n5 x- N( n
  31. #include <linux/moduleparam.h>* G+ J/ o' o5 }' T
  32. #include <linux/sysctl.h>
      ]" A+ X& Z% l* b4 n+ G
  33. #include <linux/mm.h>
    " y$ L& m$ c$ d5 \; a8 b
  34. #include <linux/dma-mapping.h>
      Y0 S7 @, Z+ c+ h; G  B/ F$ C: _
  35. " R& U# G. U; t' ]# j$ n
  36. #include <mach/memory.h>
    ( @1 d* ^) M" L; z& h; n8 O
  37. #include <mach/hardware.h>
    ( B! b6 Z# E4 u
  38. #include <mach/irqs.h>
    % k$ O! T" @2 G0 X& Z
  39. #include <asm/hardware/edma.h>! ~  J( z  k* f, L$ f, w  q

  40. 7 e2 `! C1 E/ o. v
  41. #undef EDMA3_DEBUG
    , G6 K" l- g2 P2 n2 L$ v; ]
  42. /*#define EDMA3_DEBUG*/- }: z1 N: ^$ v

  43. # V( a9 i9 L& W
  44. #ifdef EDMA3_DEBUG
    $ l) b0 e4 ]4 [
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    2 e( y9 R9 s0 {! K7 A4 r4 e
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ; ?4 |$ S3 d( F9 m
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)8 b# P6 W4 C. i" _
  48. #else
    3 Z- z. T9 T' W( t1 G# D4 l
  49. #define DMA_PRINTK( x... )
    # m5 T, M0 k3 M$ L7 Y: Y
  50. #define DMA_FN_IN1 g: E9 s( w" N; |( R5 n" ]. W
  51. #define DMA_FN_OUT& T+ H* }2 p- {. a9 [1 l0 \. D. v
  52. #endif
    ! y% Q# s. V! u; u5 \4 b

  53. * S7 D  v4 r& Q! Y
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    " w  s0 `0 Q, r( J* [: T& _# n- ~
  55. #define STATIC_SHIFT                30 J. H0 k6 X. x  T$ U0 C
  56. #define TCINTEN_SHIFT               204 H) V3 P' N7 P
  57. #define ITCINTEN_SHIFT              21
    0 l- y" N: y) G: N* K/ O' ]
  58. #define TCCHEN_SHIFT                22
    ! ~/ w! G% l' L& `7 q
  59. #define ITCCHEN_SHIFT               23$ R% N/ g- y$ E

  60. ; H5 _- ?3 I8 @6 `( O
  61. static volatile int irqraised1 = 0;
    * ?; B. M* W5 v
  62. static volatile int irqraised2 = 0;6 a+ d- O( a! O2 A& R' r
  63. 7 _6 T  G5 K8 r
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' R- ?" l: \9 y5 [; o4 K& _
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ n7 [9 ?" ]" S: O# g0 ]" k
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ Y9 ~. U* {- ]' ]' O

  67. 9 d! k' Y& t' M8 l' B
  68. dma_addr_t dmaphyssrc1 = 0;1 q1 M/ O, D, |
  69. dma_addr_t dmaphyssrc2 = 0;6 V- n) D* M+ r; N1 t5 k5 @
  70. dma_addr_t dmaphysdest1 = 0;
    8 b0 a7 ^7 f+ _2 u5 l0 H  Q$ S( p5 E
  71. dma_addr_t dmaphysdest2 = 0;$ d- A' t) C0 W6 a; b

  72. ' `2 p# Q6 t8 e' D# J9 @
  73. char *dmabufsrc1 = NULL;% [, U7 B3 E* Y& F8 M% j
  74. char *dmabufsrc2 = NULL;
    & Q  M4 T, Q* k  E' G) _; W+ j8 A
  75. char *dmabufdest1 = NULL;! w! F. t. L2 P; r7 j9 a
  76. char *dmabufdest2 = NULL;
    # ?9 h4 C$ q4 a

  77. 8 j, `  {2 Q3 l* ?$ w% i
  78. static int acnt = 512;+ _4 _, y. D, Y( z- `* Z+ H+ |
  79. static int bcnt = 8;
    ! m1 ?) d3 K% v0 j. k+ B& r& o
  80. static int ccnt = 8;
    . Z( [7 ], M/ K2 |
  81. : [* m$ x( k8 w5 [
  82. module_param(acnt, int, S_IRUGO);
    3 ?% N$ x* a8 G7 u. p6 Z" |. Y
  83. module_param(bcnt, int, S_IRUGO);
    1 U  S; p$ Y2 e7 k
  84. module_param(ccnt, int, S_IRUGO);
复制代码
. u& Y/ S9 n, x! k( N) m" X

1 ^# }% z. U. }  x      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用, i. l' q& s; ^  R/ L$ d% s7 l1 V
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。- S; U6 ^+ ~) |2 M8 i
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。+ Q  Z1 `6 J' i  v: e: w7 r6 H

& C5 ~, D' |/ |* i+ H3 Z
" x5 H/ ?+ i; V0 }) X
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-22 09:58 , Processed in 0.040918 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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