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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 8 B/ O( R+ P6 ?9 k3 `( k
  1. [code]EDMA sample test application4 R: w4 b# e% G" T  Y  ~  c! @
  2. /*
    1 T" m1 T% W% |2 W0 e  |0 I
  3. * edma_test.c
    2 l, K9 q& D7 m9 ^
  4. *5 k: ?! M+ V( x2 [" p% z
  5. * brief  EDMA3 Test Application8 T- P/ @: X+ K
  6. *& g$ m. q" T$ T+ G: o
  7. *   This file contains EDMA3 Test code.# \$ W5 T! e% e7 L+ j
  8. *3 ]0 ~  b; _4 ~. r/ K- a3 P. ?
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ( W* v1 r# e( ?% U9 |! `4 {! A
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT' r, }) X3 u* \9 k" s4 K
  11. *         TO CHANGE.
    : X3 k3 `3 w8 H! J: N
  12. *! R0 n, F; i) o% F
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/6 o4 B0 v; x6 l3 Q) x$ J
  14. *9 U: s& `* a4 N2 ^
  15. * This program is free software; you can redistribute it and/or
    1 k/ b$ l  J: ~! q5 G3 |
  16. * modify it under the terms of the GNU General Public License as
    # Z" e, |( g( E. d  g
  17. * published by the Free Software Foundation version 2.
    5 g1 S' C6 Z& l* n5 o: Q$ L
  18. *
    : G1 @, \3 n5 V* i: _! H0 W
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any) ?  [0 S6 Y) b* v6 {. [
  20. * kind, whether express or implied; without even the implied warranty
    , [( B4 l  b4 A9 U, `; T
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    9 a, j. L+ l2 x& W. Q
  22. * GNU General Public License for more details.
    ( n4 j- W2 a, _7 e: j
  23. */3 {6 d+ y1 n, T7 i, R& [1 f' R
  24. 0 J5 U9 f9 }( ?
  25. #include <linux/module.h>
    1 {, F! x- R. t+ e4 x# G- n
  26. #include <linux/init.h>
    ! E/ v, J7 ~% @0 @
  27. #include <linux/errno.h>
    0 F' F! a4 A7 b9 F2 T/ K/ r
  28. #include <linux/types.h>
    1 t% f4 L: ?( T( t, t" `, z& @  |
  29. #include <linux/interrupt.h>& m0 }# B3 |* d) r# r
  30. #include <asm/io.h>
    : y4 L8 f7 t! e0 ^: ^0 P( L
  31. #include <linux/moduleparam.h>
    9 m7 h# H; s: S) S) \
  32. #include <linux/sysctl.h>0 V" w3 S9 u6 C- [, V
  33. #include <linux/mm.h>& ~0 c$ v" }# v/ K4 u0 f" _/ L
  34. #include <linux/dma-mapping.h>
    ; N( W# a! l9 o- j' W
  35. $ k1 K& @5 ^) B+ P
  36. #include <mach/memory.h>9 z& K8 j0 _& \0 w! ?* V  ~  o
  37. #include <mach/hardware.h>
    4 z: p4 W- z6 u6 n) L
  38. #include <mach/irqs.h>
    ! i* c! k1 _9 X' C
  39. #include <asm/hardware/edma.h>
    8 C! J1 `, {3 ~- |3 K/ w& m
  40. # M. ~; q/ }# e8 C
  41. #undef EDMA3_DEBUG, U3 Z/ R! d# _% n: J0 S( ~  x
  42. /*#define EDMA3_DEBUG*// ?3 S  v% [  l6 I; C9 E" b& @& m
  43. $ g$ p) \$ q* d4 A
  44. #ifdef EDMA3_DEBUG
    , i$ }) N- v; {; W' d; C3 m
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)- g# Q1 R' h! n5 w- B0 M) X2 ]
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    6 n9 A& Q7 e8 ], r' V# P
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)8 A5 B; w2 _1 N% l; f
  48. #else, G" o/ Q  V* p, g! |7 f% P
  49. #define DMA_PRINTK( x... )0 s& [: \8 L. {% a, F4 P
  50. #define DMA_FN_IN
    - ~5 D. d: N7 i3 t0 q5 z
  51. #define DMA_FN_OUT
    % U/ V4 D: [% a0 ?# `
  52. #endif, I; {4 O6 V' I0 w$ \* o# q+ }

  53. 0 s/ A9 k: H! K) Y# T7 d4 T) c5 `- ^
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    / \! s# T- F& M' n8 ~9 T
  55. #define STATIC_SHIFT                3
    2 O9 G+ q+ U- ~. C
  56. #define TCINTEN_SHIFT               20
    & S; x- a3 X8 Z
  57. #define ITCINTEN_SHIFT              217 F  T' H9 I7 k$ b& O9 [
  58. #define TCCHEN_SHIFT                220 M6 e* c8 s2 z% x
  59. #define ITCCHEN_SHIFT               23# r. k" ]' k9 l7 n2 @/ M2 o5 A
  60. ( C4 ~0 c( Q, z5 W% W0 J
  61. static volatile int irqraised1 = 0;
      p% D8 k* t, `- Z
  62. static volatile int irqraised2 = 0;
    , N/ U5 Q* d. n+ u; b

  63. # R; I" b- k# u9 g
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' f) }# x  E+ f& C, q
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . f5 s2 u- r0 ~) ]4 x# U9 e; m
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) v( s6 u8 f- R0 d

  67. ( e8 o+ k) P  C/ U# {
  68. dma_addr_t dmaphyssrc1 = 0;3 `8 E8 C. R( L& ?# {+ z
  69. dma_addr_t dmaphyssrc2 = 0;
    # b: L0 k+ h; B; D9 b5 w; m9 x  Q0 b
  70. dma_addr_t dmaphysdest1 = 0;
    1 |6 J7 G% V' T; L3 w
  71. dma_addr_t dmaphysdest2 = 0;
    6 }: W. r9 U9 j8 w" P& y
  72. # q$ ^( @$ V  @% z) ]7 s& a5 t
  73. char *dmabufsrc1 = NULL;
      t/ a2 i4 N  f0 F
  74. char *dmabufsrc2 = NULL;
    $ M) P9 C% c. x
  75. char *dmabufdest1 = NULL;
    , u9 [, n) {6 R; }# r
  76. char *dmabufdest2 = NULL;
    % ]7 w8 M& X9 ]+ q7 b9 ~/ o

  77. ; e- U. M" p/ ^8 K7 r
  78. static int acnt = 512;
    ( _. n$ K9 u+ Q! U& m9 N( y
  79. static int bcnt = 8;0 B. n7 ?) U5 q
  80. static int ccnt = 8;! O/ T! B2 d% w4 r, l

  81. , n7 |% Q. Y( |: }5 W  h
  82. module_param(acnt, int, S_IRUGO);" U. P/ A! B4 X9 w$ @
  83. module_param(bcnt, int, S_IRUGO);; n5 G( m' G3 |+ P
  84. module_param(ccnt, int, S_IRUGO);
复制代码

  y2 T8 s$ o* A/ h* x
: S% |$ C2 D- _* b! F  M  u1 q      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
1 z/ ~, d4 p2 M: s1 b; j1 [+ u- Carm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
0 S- ?- r) j, x& p     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
1 m1 h, V/ L* Z/ w: ?8 w, [/ ~  H2 L
) q* F3 G  ]" v) i( v
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-16 02:03 , Processed in 0.039600 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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