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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 2 i8 r& a- R+ p: N: r) x! y& q! f: d
  1. [code]EDMA sample test application6 ?8 X. x% e; o: p, g
  2. /*
    4 U( `7 H" W2 w8 k
  3. * edma_test.c& n- A' B- R) e+ k* X
  4. *  d# r; l$ ]7 f- _9 Q
  5. * brief  EDMA3 Test Application' c1 Z! Q* v  }. B- A$ }
  6. *" }/ v2 Y  c6 L# B
  7. *   This file contains EDMA3 Test code.; J3 q0 B: j4 K1 R& G
  8. *
    + G; d+ d% ^7 M# Z
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE  i) d" s" e- T* S( `. j
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT6 q8 g; E: W# `2 E9 }, X4 A; c
  11. *         TO CHANGE.
    3 U/ r9 d$ S; m: L, S
  12. *  t# D6 Q% E5 S; W- X' h# d! g3 p
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    : s$ p5 [9 T/ i
  14. *" `+ M- N, R6 v9 r/ g
  15. * This program is free software; you can redistribute it and/or
    % ^( v; U9 ?7 z/ ^
  16. * modify it under the terms of the GNU General Public License as3 \. c3 k4 w( E  V; M
  17. * published by the Free Software Foundation version 2.
    ' L+ j! k4 K, k
  18. *% A: d2 u: o/ [+ E
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any8 i3 I2 r% }1 H) C- n3 q4 B6 r' A
  20. * kind, whether express or implied; without even the implied warranty3 h! N  m/ z+ t& h: z, {# k+ j
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ! c; D8 I9 C" t
  22. * GNU General Public License for more details.
    , ^( `% S) e, m- I7 j! O7 H
  23. */, a9 q; W4 W( u& U; _* K6 O

  24. - S! P  H; }( q/ q" _' w7 P1 K
  25. #include <linux/module.h>
    1 t1 e: G; W- V+ `
  26. #include <linux/init.h>, w6 d" F$ v. h, l- `3 [
  27. #include <linux/errno.h>( o5 ^' z5 I+ B# s( r' B
  28. #include <linux/types.h>
    7 T1 L* ~4 g( d6 e* ^$ C
  29. #include <linux/interrupt.h>5 H1 |% c1 [5 q) a! f8 p1 b, {
  30. #include <asm/io.h>3 a# }0 c0 v0 v
  31. #include <linux/moduleparam.h>
    # n8 y# i2 P4 a8 t9 e
  32. #include <linux/sysctl.h>2 F9 a! S  x# v) B5 O
  33. #include <linux/mm.h>- S+ |; m, X: |, B
  34. #include <linux/dma-mapping.h>8 R9 V; U7 ?. q& v% B3 E7 }" r
  35. 8 E. ?/ r# y1 Q: @( T
  36. #include <mach/memory.h>
    / V" }: {' ^0 O/ R
  37. #include <mach/hardware.h>
    : p! B, V1 J8 G* p9 g
  38. #include <mach/irqs.h>
    4 z8 Z5 a3 q! B  o
  39. #include <asm/hardware/edma.h>
    * I0 ]* p2 U6 x
  40. 5 s* Q. [& e) S6 U6 ?* E
  41. #undef EDMA3_DEBUG
    $ F0 U, P% r! t0 l$ t5 z
  42. /*#define EDMA3_DEBUG*/
    / g" M; T; ~& A$ a+ f# A2 }
  43. - H* R0 _( ?7 j/ d  g1 H0 Z+ W
  44. #ifdef EDMA3_DEBUG
    / x; d$ c' J* }7 u5 b$ a" w
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    " m9 h  f0 j$ U: x" U$ i) b; L. r
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)8 N2 F( Z  z0 z4 H# w9 g
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)" P  b5 T, d' ?% s: @% R
  48. #else+ [$ v3 o$ \2 C  j. [
  49. #define DMA_PRINTK( x... )
    " S; H6 P4 d) c: v! |8 W
  50. #define DMA_FN_IN
    & k# @0 H% |/ c4 j1 M6 _! J* t3 G
  51. #define DMA_FN_OUT0 W8 y* e" ~! C% C$ ?+ [+ s! y
  52. #endif% X) _, U& \& _$ y/ J9 ^
  53.   N/ u$ u- w" f2 r' J0 @
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    8 y- M) L4 s; j* `; w
  55. #define STATIC_SHIFT                35 d- s+ S3 O, r% p2 G1 A
  56. #define TCINTEN_SHIFT               201 x' ^  A$ J3 M0 R5 Q3 c0 v
  57. #define ITCINTEN_SHIFT              21
    6 j* ~2 E$ h1 X  v' q
  58. #define TCCHEN_SHIFT                22; S1 Q6 G9 @1 T7 C
  59. #define ITCCHEN_SHIFT               23
    7 S/ o# y2 [2 u7 P* |
  60. 5 u4 w+ ]# V/ z. d$ f
  61. static volatile int irqraised1 = 0;( F& G1 _6 c( B& O) z7 |' |
  62. static volatile int irqraised2 = 0;
    3 Y7 X1 M& p1 W% B- M
  63. 8 j/ K5 ?6 d+ [8 C1 y" z
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" u$ ?, Q. k  S, c4 M3 B: ^
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; g- S3 |, H0 j/ I5 z
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( I; L3 X$ W* _4 N( K" l
  67. - b! H1 S' \  Y7 J
  68. dma_addr_t dmaphyssrc1 = 0;
    ( p  N1 K0 R$ ]" \/ K3 p( F
  69. dma_addr_t dmaphyssrc2 = 0;
    5 F/ E+ f; a" Y& M0 v
  70. dma_addr_t dmaphysdest1 = 0;  J4 x4 I% r2 F; s+ u% v
  71. dma_addr_t dmaphysdest2 = 0;
      q; E: e5 X- h

  72. , C9 S. \- {0 {4 ~) @
  73. char *dmabufsrc1 = NULL;! r5 v, F4 t& K* G
  74. char *dmabufsrc2 = NULL;
    ! t) r( o4 f* m7 H6 @
  75. char *dmabufdest1 = NULL;
    ) u* `5 `$ |5 w5 Z: T* E2 Z
  76. char *dmabufdest2 = NULL;1 X  I6 {3 ^1 _4 _0 h

  77. 0 K* q. A5 H3 a% {7 _( u+ ?. r( p8 ~
  78. static int acnt = 512;
    : ^" J: C: G  F! G3 d" z* I
  79. static int bcnt = 8;
    : u# t$ E( S6 {
  80. static int ccnt = 8;1 [9 E5 Q- X, G/ [, w9 b4 H* z9 M

  81. 1 c+ u7 u- H. c: |
  82. module_param(acnt, int, S_IRUGO);
    9 M9 f- P# t/ e. \3 h  o
  83. module_param(bcnt, int, S_IRUGO);
    + `; M# O4 |6 t1 B, G% v! V" m% }
  84. module_param(ccnt, int, S_IRUGO);
复制代码

& P8 \7 ^5 r. }. _
5 X% d8 H# X3 g3 f' l8 f: `0 T      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用6 X  Q) k& u4 [% ^. D7 t
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。0 A, Y) ?1 N6 e. z4 Z( J4 l) [
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
6 q7 c6 E# z( u3 x, j* L! p0 i  [" e1 M* x5 d
5 S6 a  {' I' E; }
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-14 15:51 , Processed in 0.039997 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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